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 |
|---|---|---|---|---|---|
Javascript | Javascript | simplify glyph segment writing code | 83c1599cf70da0be82c13b7a56396757e16748a1 | <ide><path>fonts.js
<ide> var Font = (function () {
<ide> var bias = 0;
<ide> for (var i = 0; i < segCount - 1; i++) {
<ide> var range = ranges[i];
<del> var start = FontsUtils.integerToBytes(range[0], 2);
<del> var end = FontsUtils.integerToBytes(range[1], 2);
<add> var start = range[0];
<add> var end = range[1];
<add> var delta = (((start - 1) - bias) ^ 0xffff) + 1;
<add> bias += (end - start + 1);
<ide>
<del> var delta = FontsUtils.integerToBytes(((range[0] - 1) - bias) % 65536, 2);
<del> bias += (range[1] - range[0] + 1);
<del>
<del> // deltas are signed shorts
<del> delta[0] ^= 0xFF;
<del> delta[1] ^= 0xFF;
<del> delta[1] += 1;
<add> var start = FontsUtils.integerToBytes(start, 2);
<add> var end = FontsUtils.integerToBytes(end, 2);
<add> var delta = FontsUtils.integerToBytes(delta, 2);
<ide>
<ide> startCount.push(start[0], start[1]);
<ide> endCount.push(end[0], end[1]);
<ide> idDeltas.push(delta[0], delta[1]);
<ide> idRangeOffsets.push(0x00, 0x00);
<ide>
<del> for (var j = range[0]; j <= range[1]; j++)
<add> for (var j = start; j <= end; j++)
<ide> glyphsIdsArray.push(j);
<ide> }
<ide> startCount.push(0xFF, 0xFF); | 1 |
Python | Python | add multi-worker benchmarks to keras resnet model | ff6c3b1e8ce5a102a430ba3e21d17161bd658d44 | <ide><path>official/r1/resnet/resnet_run_loop.py
<ide> def define_resnet_flags(resnet_size_choices=None, dynamic_loss_scale=False,
<ide> tf_data_experimental_slack=True)
<ide> flags_core.define_image()
<ide> flags_core.define_benchmark()
<add> flags_core.define_distribution()
<ide> flags.adopt_module_key_flags(flags_core)
<ide>
<ide> flags.DEFINE_enum(
<ide> def define_resnet_flags(resnet_size_choices=None, dynamic_loss_scale=False,
<ide> 'If True, uses `tf.estimator.train_and_evaluate` for the training '
<ide> 'and evaluation loop, instead of separate calls to `classifier.train '
<ide> 'and `classifier.evaluate`, which is the default behavior.'))
<del> flags.DEFINE_string(
<del> name='worker_hosts', default=None,
<del> help=flags_core.help_wrap(
<del> 'Comma-separated list of worker ip:port pairs for running '
<del> 'multi-worker models with DistributionStrategy. The user would '
<del> 'start the program on each host with identical value for this flag.'))
<del> flags.DEFINE_integer(
<del> name='task_index', default=-1,
<del> help=flags_core.help_wrap('If multi-worker training, the task_index of '
<del> 'this worker.'))
<ide> flags.DEFINE_bool(
<ide> name='enable_lars', default=False,
<ide> help=flags_core.help_wrap(
<ide><path>official/resnet/keras/keras_common.py
<ide> def define_keras_flags(dynamic_loss_scale=True):
<ide> force_v2_in_keras_compile=True)
<ide> flags_core.define_image()
<ide> flags_core.define_benchmark()
<add> flags_core.define_distribution()
<ide> flags.adopt_module_key_flags(flags_core)
<ide>
<ide> flags.DEFINE_boolean(name='enable_eager', default=False, help='Enable eager?')
<ide><path>official/resnet/keras/keras_imagenet_benchmark.py
<ide> def fill_report_object(self, stats):
<ide> log_steps=FLAGS.log_steps)
<ide>
<ide>
<add>class Resnet50MultiWorkerKerasBenchmark(Resnet50KerasBenchmarkBase):
<add> """Resnet50 distributed benchmark tests with multiple workers."""
<add>
<add> def __init__(self, output_dir=None, default_flags=None):
<add> super(Resnet50MultiWorkerKerasBenchmark, self).__init__(
<add> output_dir=output_dir, default_flags=default_flags)
<add>
<add> def _benchmark_common(self, eager, num_workers, all_reduce_alg):
<add> """Common to all benchmarks in this class."""
<add> self._setup()
<add>
<add> num_gpus = 8
<add> FLAGS.num_gpus = num_gpus
<add> FLAGS.dtype = 'fp16'
<add> FLAGS.enable_eager = eager
<add> FLAGS.enable_xla = False
<add> FLAGS.distribution_strategy = 'multi_worker_mirrored'
<add> FLAGS.use_tensor_lr = True
<add> FLAGS.tf_gpu_thread_mode = 'gpu_private'
<add> FLAGS.model_dir = self._get_model_dir(
<add> 'benchmark_graph_8_gpu_{}_worker_fp16_{}_tweaked'.format(
<add> num_workers, all_reduce_alg))
<add> FLAGS.batch_size = 256 * num_gpus * num_workers
<add> FLAGS.all_reduce_alg = all_reduce_alg
<add>
<add> self._run_and_report_benchmark()
<add>
<add> def benchmark_graph_8_gpu_1_worker_fp16_ring_tweaked(self):
<add> """Legacy graph, 8 GPUs per worker, 1 worker, fp16, ring all-reduce."""
<add> self._benchmark_common(eager=False, num_workers=1, all_reduce_alg='ring')
<add>
<add> def benchmark_graph_8_gpu_1_worker_fp16_nccl_tweaked(self):
<add> """Legacy graph, 8 GPUs per worker, 1 worker, fp16, nccl all-reduce."""
<add> self._benchmark_common(eager=False, num_workers=1, all_reduce_alg='nccl')
<add>
<add> def benchmark_graph_8_gpu_2_workers_fp16_ring_tweaked(self):
<add> """Legacy graph, 8 GPUs per worker, 2 workers, fp16, ring all-reduce."""
<add> self._benchmark_common(eager=False, num_workers=2, all_reduce_alg='ring')
<add>
<add> def benchmark_graph_8_gpu_2_workers_fp16_nccl_tweaked(self):
<add> """Legacy graph, 8 GPUs per worker, 2 workers, fp16, nccl all-reduce."""
<add> self._benchmark_common(eager=False, num_workers=2, all_reduce_alg='nccl')
<add>
<add> def benchmark_graph_8_gpu_8_workers_fp16_ring_tweaked(self):
<add> """Legacy graph, 8 GPUs per worker, 8 workers, fp16, ring all-reduce."""
<add> self._benchmark_common(eager=False, num_workers=8, all_reduce_alg='ring')
<add>
<add> def benchmark_graph_8_gpu_8_workers_fp16_nccl_tweaked(self):
<add> """Legacy graph, 8 GPUs per worker, 8 workers, fp16, nccl all-reduce."""
<add> self._benchmark_common(eager=False, num_workers=8, all_reduce_alg='nccl')
<add>
<add> def benchmark_eager_8_gpu_1_worker_fp16_ring_tweaked(self):
<add> """Eager, 8 GPUs per worker, 1 worker, fp16, ring all-reduce."""
<add> self._benchmark_common(eager=True, num_workers=1, all_reduce_alg='ring')
<add>
<add> def benchmark_eager_8_gpu_1_worker_fp16_nccl_tweaked(self):
<add> """Eager, 8 GPUs per worker, 1 worker, fp16, nccl all-reduce."""
<add> self._benchmark_common(eager=True, num_workers=1, all_reduce_alg='nccl')
<add>
<add> def benchmark_eager_8_gpu_2_workers_fp16_ring_tweaked(self):
<add> """Eager, 8 GPUs per worker, 2 workers, fp16, ring all-reduce."""
<add> self._benchmark_common(eager=True, num_workers=2, all_reduce_alg='ring')
<add>
<add> def benchmark_eager_8_gpu_2_workers_fp16_nccl_tweaked(self):
<add> """Eager, 8 GPUs per worker, 2 workers, fp16, nccl all-reduce."""
<add> self._benchmark_common(eager=True, num_workers=2, all_reduce_alg='nccl')
<add>
<add> def benchmark_eager_8_gpu_8_workers_fp16_ring_tweaked(self):
<add> """Eager, 8 GPUs per worker, 8 workers, fp16, ring all-reduce."""
<add> self._benchmark_common(eager=True, num_workers=8, all_reduce_alg='ring')
<add>
<add> def benchmark_eager_8_gpu_8_workers_fp16_nccl_tweaked(self):
<add> """Eager, 8 GPUs per worker, 8 workers, fp16, nccl all-reduce."""
<add> self._benchmark_common(eager=True, num_workers=8, all_reduce_alg='nccl')
<add>
<add>
<add>class Resnet50MultiWorkerKerasBenchmarkSynth(Resnet50KerasBenchmarkBase):
<add> """Resnet50 multi-worker synthetic benchmark tests."""
<add>
<add> def __init__(self, output_dir=None, root_data_dir=None, **kwargs):
<add> def_flags = {}
<add> def_flags['skip_eval'] = True
<add> def_flags['report_accuracy_metrics'] = False
<add> def_flags['use_synthetic_data'] = True
<add> def_flags['train_steps'] = 110
<add> def_flags['log_steps'] = 10
<add>
<add> super(Resnet50MultiWorkerKerasBenchmarkSynth, self).__init__(
<add> output_dir=output_dir, default_flags=def_flags)
<add>
<add>
<ide> if __name__ == '__main__':
<ide> tf.test.main()
<ide><path>official/resnet/keras/keras_imagenet_main.py
<ide> def run(flags_obj):
<ide> if tf.test.is_built_with_cuda() else 'channels_last')
<ide> tf.keras.backend.set_image_data_format(data_format)
<ide>
<add> # Configures cluster spec for distribution strategy.
<add> num_workers = distribution_utils.configure_cluster(flags_obj.worker_hosts,
<add> flags_obj.task_index)
<add>
<ide> strategy = distribution_utils.get_distribution_strategy(
<ide> distribution_strategy=flags_obj.distribution_strategy,
<ide> num_gpus=flags_obj.num_gpus,
<del> num_workers=distribution_utils.configure_cluster(),
<add> num_workers=num_workers,
<ide> all_reduce_alg=flags_obj.all_reduce_alg,
<ide> num_packs=flags_obj.num_packs)
<ide>
<ide><path>official/utils/flags/_distribution.py
<add># Copyright 2019 The TensorFlow Authors. All Rights Reserved.
<add>#
<add># Licensed under the Apache License, Version 2.0 (the "License");
<add># you may not use this file except in compliance with the License.
<add># You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing, software
<add># distributed under the License is distributed on an "AS IS" BASIS,
<add># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add># See the License for the specific language governing permissions and
<add># limitations under the License.
<add># ==============================================================================
<add>"""Flags related to distributed execution."""
<add>
<add>from __future__ import absolute_import
<add>from __future__ import division
<add>from __future__ import print_function
<add>
<add>from absl import flags
<add>import tensorflow as tf
<add>
<add>from official.utils.flags._conventions import help_wrap
<add>
<add>
<add>def define_distribution(worker_hosts=True, task_index=True):
<add> """Register distributed execution flags.
<add>
<add> Args:
<add> worker_hosts: Create a flag for specifying comma-separated list of workers.
<add> task_index: Create a flag for specifying index of task.
<add>
<add> Returns:
<add> A list of flags for core.py to marks as key flags.
<add> """
<add> key_flags = []
<add>
<add> if worker_hosts:
<add> flags.DEFINE_string(
<add> name='worker_hosts', default=None,
<add> help=help_wrap(
<add> 'Comma-separated list of worker ip:port pairs for running '
<add> 'multi-worker models with DistributionStrategy. The user would '
<add> 'start the program on each host with identical value for this '
<add> 'flag.'))
<add>
<add> if task_index:
<add> flags.DEFINE_integer(
<add> name='task_index', default=-1,
<add> help=help_wrap('If multi-worker training, the task_index of this '
<add> 'worker.'))
<add>
<add> return key_flags
<ide><path>official/utils/flags/core.py
<ide> from official.utils.flags import _benchmark
<ide> from official.utils.flags import _conventions
<ide> from official.utils.flags import _device
<add>from official.utils.flags import _distribution
<ide> from official.utils.flags import _misc
<ide> from official.utils.flags import _performance
<ide>
<ide> def core_fn(*args, **kwargs):
<ide> define_device = register_key_flags_in_core(_device.define_device)
<ide> define_image = register_key_flags_in_core(_misc.define_image)
<ide> define_performance = register_key_flags_in_core(_performance.define_performance)
<add>define_distribution = register_key_flags_in_core(
<add> _distribution.define_distribution)
<ide>
<ide>
<ide> help_wrap = _conventions.help_wrap | 6 |
Text | Text | update changelog for | 2ffa001faa3e9d0295358dfe716b17c54623a086 | <ide><path>railties/CHANGELOG.md
<add>* Default `config.assets.quiet = true` in the development environment. Suppress
<add> logging of `sprockets-rails` requests by default.
<add>
<add> *Kevin McPhillips*
<add>
<ide> * Ensure `/rails/info` routes match in development for apps with a catch-all globbing route.
<ide>
<ide> *Nicholas Firth-McCoy* | 1 |
PHP | PHP | refactor the auto-loader | 11ac2919f823c1f7e2b332d61085fdd0cf5fffda | <ide><path>system/loader.php
<ide> public static function load($class)
<ide> {
<ide> $file = strtolower(str_replace('\\', '/', $class));
<ide>
<del> if (array_key_exists($class, static::$aliases)) return class_alias(static::$aliases[$class], $class);
<add> if (array_key_exists($class, static::$aliases))
<add> {
<add> return class_alias(static::$aliases[$class], $class);
<add> }
<ide>
<ide> ( ! static::load_from_registered($file)) or static::load_from_module($file);
<ide> } | 1 |
Python | Python | fix french tag map | 54579805c5d8034ad3153140173182fa8defda50 | <ide><path>spacy/lang/fr/tag_map.py
<ide> # coding: utf8
<ide> from __future__ import unicode_literals
<ide>
<add>from ...symbols import POS, PUNCT, ADJ, CCONJ, NUM, DET, ADV, ADP, X, VERB
<add>from ...symbols import NOUN, PROPN, PART, INTJ, SPACE, PRON
<add>
<ide>
<ide> TAG_MAP = {
<del> "ADJ__Gender=Fem|Number=Plur": {"pos": "PRON"},
<del> "ADJ__Gender=Fem|Number=Plur|NumType=Ord": {"pos": "PRON"},
<del> "ADJ__Gender=Fem|Number=Sing": {"pos": "PRON"},
<del> "ADJ__Gender=Fem|Number=Sing|NumType=Ord": {"pos": "PRON"},
<del> "ADJ__Gender=Masc": {"pos": "PRON"},
<del> "ADJ__Gender=Masc|Number=Plur": {"pos": "PRON"},
<del> "ADJ__Gender=Masc|Number=Plur|NumType=Ord": {"pos": "PRON"},
<del> "ADJ__Gender=Masc|Number=Sing": {"pos": "PRON"},
<del> "ADJ__Gender=Masc|Number=Sing|NumType=Card": {"pos": "PRON"},
<del> "ADJ__Gender=Masc|Number=Sing|NumType=Ord": {"pos": "PRON"},
<del> "ADJ__NumType=Card": {"pos": "PRON"},
<del> "ADJ__NumType=Ord": {"pos": "PRON"},
<del> "ADJ__Number=Plur": {"pos": "PRON"},
<del> "ADJ__Number=Sing": {"pos": "PRON"},
<del> "ADJ__Number=Sing|NumType=Ord": {"pos": "PRON"},
<del> "ADJ___": {"pos": "PRON"},
<del> "ADP__Gender=Fem|Number=Plur|Person=3": {"pos": "PRON"},
<del> "ADP__Gender=Masc|Number=Plur|Person=3": {"pos": "PRON"},
<del> "ADP__Gender=Masc|Number=Sing|Person=3": {"pos": "PRON"},
<del> "ADP___": {"pos": "PRON"},
<del> "ADV__Polarity=Neg": {"pos": "PRON"},
<del> "ADV__PronType=Int": {"pos": "PRON"},
<del> "ADV___": {"pos": "PRON"},
<del> "AUX__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "AUX__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "AUX__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "AUX__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "AUX__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "AUX__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "AUX__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "AUX__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "AUX__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Cnd|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=2|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Sub|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Sub|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Sub|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "AUX__Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "AUX__Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "AUX__Tense=Pres|VerbForm=Part": {"pos": "PRON"},
<del> "AUX__VerbForm=Inf": {"pos": "PRON"},
<del> "CCONJ___": {"pos": "PRON"},
<del> "DET__Definite=Def|Gender=Fem|Number=Sing|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Def|Gender=Masc|Number=Sing|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Def|Number=Plur|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Def|Number=Sing|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Ind|Gender=Fem|Number=Plur|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Ind|Gender=Fem|Number=Sing|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Ind|Gender=Masc|Number=Plur|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Ind|Gender=Masc|Number=Sing|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Ind|Number=Plur|PronType=Art": {"pos": "PRON"},
<del> "DET__Definite=Ind|Number=Sing|PronType=Art": {"pos": "PRON"},
<del> "DET__Gender=Fem|Number=Plur": {"pos": "PRON"},
<del> "DET__Gender=Fem|Number=Plur|PronType=Int": {"pos": "PRON"},
<del> "DET__Gender=Fem|Number=Sing": {"pos": "PRON"},
<del> "DET__Gender=Fem|Number=Sing|Poss=Yes": {"pos": "PRON"},
<del> "DET__Gender=Fem|Number=Sing|PronType=Dem": {"pos": "PRON"},
<del> "DET__Gender=Fem|Number=Sing|PronType=Int": {"pos": "PRON"},
<del> "DET__Gender=Masc|Number=Plur": {"pos": "PRON"},
<del> "DET__Gender=Masc|Number=Sing": {"pos": "PRON"},
<del> "DET__Gender=Masc|Number=Sing|PronType=Dem": {"pos": "PRON"},
<del> "DET__Gender=Masc|Number=Sing|PronType=Int": {"pos": "PRON"},
<del> "DET__Number=Plur": {"pos": "PRON"},
<del> "DET__Number=Plur|Poss=Yes": {"pos": "PRON"},
<del> "DET__Number=Plur|PronType=Dem": {"pos": "PRON"},
<del> "DET__Number=Sing": {"pos": "PRON"},
<del> "DET__Number=Sing|Poss=Yes": {"pos": "PRON"},
<del> "DET___": {"pos": "PRON"},
<del> "INTJ___": {"pos": "PRON"},
<del> "NOUN__Gender=Fem": {"pos": "PRON"},
<del> "NOUN__Gender=Fem|Number=Plur": {"pos": "PRON"},
<del> "NOUN__Gender=Fem|Number=Sing": {"pos": "PRON"},
<del> "NOUN__Gender=Masc": {"pos": "PRON"},
<del> "NOUN__Gender=Masc|Number=Plur": {"pos": "PRON"},
<del> "NOUN__Gender=Masc|Number=Plur|NumType=Card": {"pos": "PRON"},
<del> "NOUN__Gender=Masc|Number=Sing": {"pos": "PRON"},
<del> "NOUN__Gender=Masc|Number=Sing|NumType=Card": {"pos": "PRON"},
<del> "NOUN__NumType=Card": {"pos": "PRON"},
<del> "NOUN__Number=Plur": {"pos": "PRON"},
<del> "NOUN__Number=Sing": {"pos": "PRON"},
<del> "NOUN___": {"pos": "PRON"},
<del> "NUM__Gender=Masc|Number=Plur|NumType=Card": {"pos": "PRON"},
<del> "NUM__NumType=Card": {"pos": "PRON"},
<del> "PART___": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Plur": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Plur|Person=3": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Plur|Person=3|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Plur|PronType=Dem": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Plur|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Sing|Person=3": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Sing|PronType=Dem": {"pos": "PRON"},
<del> "PRON__Gender=Fem|Number=Sing|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Fem|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Plur": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Plur|Person=3": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Plur|Person=3|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Plur|PronType=Dem": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Plur|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Sing": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Sing|Person=3": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Sing|Person=3|PronType=Dem": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Sing|PronType=Dem": {"pos": "PRON"},
<del> "PRON__Gender=Masc|Number=Sing|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Gender=Masc|PronType=Rel": {"pos": "PRON"},
<del> "PRON__NumType=Card|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=1": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=1|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=1|Reflex=Yes": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=2": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=2|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=2|Reflex=Yes": {"pos": "PRON"},
<del> "PRON__Number=Plur|Person=3": {"pos": "PRON"},
<del> "PRON__Number=Plur|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Number=Sing|Person=1": {"pos": "PRON"},
<del> "PRON__Number=Sing|Person=1|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Number=Sing|Person=1|Reflex=Yes": {"pos": "PRON"},
<del> "PRON__Number=Sing|Person=2|PronType=Prs": {"pos": "PRON"},
<del> "PRON__Number=Sing|Person=3": {"pos": "PRON"},
<del> "PRON__Number=Sing|PronType=Dem": {"pos": "PRON"},
<del> "PRON__Number=Sing|PronType=Rel": {"pos": "PRON"},
<del> "PRON__Person=3": {"pos": "PRON"},
<del> "PRON__Person=3|Reflex=Yes": {"pos": "PRON"},
<del> "PRON__PronType=Int": {"pos": "PRON"},
<del> "PRON__PronType=Rel": {"pos": "PRON"},
<del> "PRON___": {"pos": "PRON"},
<del> "PROPN__Gender=Fem|Number=Plur": {"pos": "PRON"},
<del> "PROPN__Gender=Fem|Number=Sing": {"pos": "PRON"},
<del> "PROPN__Gender=Masc": {"pos": "PRON"},
<del> "PROPN__Gender=Masc|Number=Plur": {"pos": "PRON"},
<del> "PROPN__Gender=Masc|Number=Sing": {"pos": "PRON"},
<del> "PROPN__Number=Plur": {"pos": "PRON"},
<del> "PROPN__Number=Sing": {"pos": "PRON"},
<del> "PROPN___": {"pos": "PRON"},
<del> "PUNCT___": {"pos": "PRON"},
<del> "SCONJ___": {"pos": "PRON"},
<del> "VERB__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Gender=Masc|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Gender=Masc|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Imp|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=2|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=1|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|Person=3|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Ind|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Sub|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Sub|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "PRON"},
<del> "VERB__Number=Plur|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Number=Sing|Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Tense=Past|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__Tense=Past|VerbForm=Part|Voice=Pass": {"pos": "PRON"},
<del> "VERB__Tense=Pres|VerbForm=Part": {"pos": "PRON"},
<del> "VERB__VerbForm=Inf": {"pos": "PRON"},
<del> "VERB__VerbForm=Part": {"pos": "PRON"},
<del> "X___": {"pos": "PRON"},
<del> "_SP": {"pos": "PRON"}
<add> "ADJ__Gender=Fem|Number=Plur": {POS: ADJ},
<add> "ADJ__Gender=Fem|Number=Plur|NumType=Ord": {POS: ADJ},
<add> "ADJ__Gender=Fem|Number=Sing": {POS: ADJ},
<add> "ADJ__Gender=Fem|Number=Sing|NumType=Ord": {POS: ADJ},
<add> "ADJ__Gender=Masc": {POS: ADJ},
<add> "ADJ__Gender=Masc|Number=Plur": {POS: ADJ},
<add> "ADJ__Gender=Masc|Number=Plur|NumType=Ord": {POS: ADJ},
<add> "ADJ__Gender=Masc|Number=Sing": {POS: ADJ},
<add> "ADJ__Gender=Masc|Number=Sing|NumType=Card": {POS: ADJ},
<add> "ADJ__Gender=Masc|Number=Sing|NumType=Ord": {POS: ADJ},
<add> "ADJ__NumType=Card": {POS: ADJ},
<add> "ADJ__NumType=Ord": {POS: ADJ},
<add> "ADJ__Number=Plur": {POS: ADJ},
<add> "ADJ__Number=Sing": {POS: ADJ},
<add> "ADJ__Number=Sing|NumType=Ord": {POS: ADJ},
<add> "ADJ___": {POS: ADJ},
<add> "ADP__Gender=Fem|Number=Plur|Person=3": {POS: ADP},
<add> "ADP__Gender=Masc|Number=Plur|Person=3": {POS: ADP},
<add> "ADP__Gender=Masc|Number=Sing|Person=3": {POS: ADP},
<add> "ADP___": {POS: ADP},
<add> "ADV__Polarity=Neg": {POS: ADV},
<add> "ADV__PronType=Int": {POS: ADV},
<add> "ADV___": {POS: ADV},
<add> "AUX__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {POS: "AUX"},
<add> "AUX__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {POS: "AUX"},
<add> "AUX__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {POS: "AUX"},
<add> "AUX__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {POS: "AUX"},
<add> "AUX__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {POS: "AUX"},
<add> "AUX__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {POS: "AUX"},
<add> "AUX__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {POS: "AUX"},
<add> "AUX__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {POS: "AUX"},
<add> "AUX__Mood=Cnd|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Cnd|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=2|Tense=Imp|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Sub|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Sub|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Sub|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: "AUX"},
<add> "AUX__Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {POS: "AUX"},
<add> "AUX__Tense=Past|VerbForm=Part": {POS: "AUX"},
<add> "AUX__Tense=Pres|VerbForm=Part": {POS: "AUX"},
<add> "AUX__VerbForm=Inf": {POS: "AUX"},
<add> "CCONJ___": {POS: CCONJ},
<add> "DET__Definite=Def|Gender=Fem|Number=Sing|PronType=Art": {POS: DET},
<add> "DET__Definite=Def|Gender=Masc|Number=Sing|PronType=Art": {POS: DET},
<add> "DET__Definite=Def|Number=Plur|PronType=Art": {POS: DET},
<add> "DET__Definite=Def|Number=Sing|PronType=Art": {POS: DET},
<add> "DET__Definite=Ind|Gender=Fem|Number=Plur|PronType=Art": {POS: DET},
<add> "DET__Definite=Ind|Gender=Fem|Number=Sing|PronType=Art": {POS: DET},
<add> "DET__Definite=Ind|Gender=Masc|Number=Plur|PronType=Art": {POS: DET},
<add> "DET__Definite=Ind|Gender=Masc|Number=Sing|PronType=Art": {POS: DET},
<add> "DET__Definite=Ind|Number=Plur|PronType=Art": {POS: DET},
<add> "DET__Definite=Ind|Number=Sing|PronType=Art": {POS: DET},
<add> "DET__Gender=Fem|Number=Plur": {POS: DET},
<add> "DET__Gender=Fem|Number=Plur|PronType=Int": {POS: DET},
<add> "DET__Gender=Fem|Number=Sing": {POS: DET},
<add> "DET__Gender=Fem|Number=Sing|Poss=Yes": {POS: DET},
<add> "DET__Gender=Fem|Number=Sing|PronType=Dem": {POS: DET},
<add> "DET__Gender=Fem|Number=Sing|PronType=Int": {POS: DET},
<add> "DET__Gender=Masc|Number=Plur": {POS: DET},
<add> "DET__Gender=Masc|Number=Sing": {POS: DET},
<add> "DET__Gender=Masc|Number=Sing|PronType=Dem": {POS: DET},
<add> "DET__Gender=Masc|Number=Sing|PronType=Int": {POS: DET},
<add> "DET__Number=Plur": {POS: DET},
<add> "DET__Number=Plur|Poss=Yes": {POS: DET},
<add> "DET__Number=Plur|PronType=Dem": {POS: DET},
<add> "DET__Number=Sing": {POS: DET},
<add> "DET__Number=Sing|Poss=Yes": {POS: DET},
<add> "DET___": {POS: DET},
<add> "INTJ___": {POS: INTJ},
<add> "NOUN__Gender=Fem": {POS: NOUN},
<add> "NOUN__Gender=Fem|Number=Plur": {POS: NOUN},
<add> "NOUN__Gender=Fem|Number=Sing": {POS: NOUN},
<add> "NOUN__Gender=Masc": {POS: NOUN},
<add> "NOUN__Gender=Masc|Number=Plur": {POS: NOUN},
<add> "NOUN__Gender=Masc|Number=Plur|NumType=Card": {POS: NOUN},
<add> "NOUN__Gender=Masc|Number=Sing": {POS: NOUN},
<add> "NOUN__Gender=Masc|Number=Sing|NumType=Card": {POS: NOUN},
<add> "NOUN__NumType=Card": {POS: NOUN},
<add> "NOUN__Number=Plur": {POS: NOUN},
<add> "NOUN__Number=Sing": {POS: NOUN},
<add> "NOUN___": {POS: NOUN},
<add> "NUM__Gender=Masc|Number=Plur|NumType=Card": {POS: NUM},
<add> "NUM__NumType=Card": {POS: NUM},
<add> "PART___": {POS: PART},
<add> "PRON__Gender=Fem|Number=Plur": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Plur|Person=3": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Plur|Person=3|PronType=Prs": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Plur|Person=3|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Plur|PronType=Dem": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Plur|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Sing|Person=3": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Sing|Person=3|PronType=Prs": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Sing|PronType=Dem": {POS: PRON},
<add> "PRON__Gender=Fem|Number=Sing|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Fem|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Plur": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Plur|Person=3": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Plur|Person=3|PronType=Prs": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Plur|Person=3|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Plur|PronType=Dem": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Plur|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Sing": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Sing|Person=3": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Sing|Person=3|PronType=Dem": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Sing|Person=3|PronType=Prs": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Sing|PronType=Dem": {POS: PRON},
<add> "PRON__Gender=Masc|Number=Sing|PronType=Rel": {POS: PRON},
<add> "PRON__Gender=Masc|PronType=Rel": {POS: PRON},
<add> "PRON__NumType=Card|PronType=Rel": {POS: PRON},
<add> "PRON__Number=Plur|Person=1": {POS: PRON},
<add> "PRON__Number=Plur|Person=1|PronType=Prs": {POS: PRON},
<add> "PRON__Number=Plur|Person=1|Reflex=Yes": {POS: PRON},
<add> "PRON__Number=Plur|Person=2": {POS: PRON},
<add> "PRON__Number=Plur|Person=2|PronType=Prs": {POS: PRON},
<add> "PRON__Number=Plur|Person=2|Reflex=Yes": {POS: PRON},
<add> "PRON__Number=Plur|Person=3": {POS: PRON},
<add> "PRON__Number=Plur|PronType=Rel": {POS: PRON},
<add> "PRON__Number=Sing|Person=1": {POS: PRON},
<add> "PRON__Number=Sing|Person=1|PronType=Prs": {POS: PRON},
<add> "PRON__Number=Sing|Person=1|Reflex=Yes": {POS: PRON},
<add> "PRON__Number=Sing|Person=2|PronType=Prs": {POS: PRON},
<add> "PRON__Number=Sing|Person=3": {POS: PRON},
<add> "PRON__Number=Sing|PronType=Dem": {POS: PRON},
<add> "PRON__Number=Sing|PronType=Rel": {POS: PRON},
<add> "PRON__Person=3": {POS: PRON},
<add> "PRON__Person=3|Reflex=Yes": {POS: PRON},
<add> "PRON__PronType=Int": {POS: PRON},
<add> "PRON__PronType=Rel": {POS: PRON},
<add> "PRON___": {POS: PRON},
<add> "PROPN__Gender=Fem|Number=Plur": {POS: PROPN},
<add> "PROPN__Gender=Fem|Number=Sing": {POS: PROPN},
<add> "PROPN__Gender=Masc": {POS: PROPN},
<add> "PROPN__Gender=Masc|Number=Plur": {POS: PROPN},
<add> "PROPN__Gender=Masc|Number=Sing": {POS: PROPN},
<add> "PROPN__Number=Plur": {POS: PROPN},
<add> "PROPN__Number=Sing": {POS: PROPN},
<add> "PROPN___": {POS: PROPN},
<add> "PUNCT___": {POS: PUNCT},
<add> "SCONJ___": {POS: "SCONJ"},
<add> "VERB__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Gender=Fem|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Gender=Fem|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Gender=Masc|Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Gender=Masc|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Gender=Masc|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Mood=Cnd|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Cnd|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Cnd|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Imp|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Imp|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Imp|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=2|Tense=Fut|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=2|Tense=Imp|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Fut|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Imp|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=1|Tense=Fut|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=1|Tense=Imp|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Fut|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Imp|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|Person=3|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Ind|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Sub|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Sub|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Sub|Number=Sing|Person=3|Tense=Past|VerbForm=Fin": {POS: VERB},
<add> "VERB__Mood=Sub|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {POS: VERB},
<add> "VERB__Number=Plur|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Number=Plur|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Number=Sing|Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Number=Sing|Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Tense=Past|VerbForm=Part": {POS: VERB},
<add> "VERB__Tense=Past|VerbForm=Part|Voice=Pass": {POS: VERB},
<add> "VERB__Tense=Pres|VerbForm=Part": {POS: VERB},
<add> "VERB__VerbForm=Inf": {POS: VERB},
<add> "VERB__VerbForm=Part": {POS: VERB},
<add> "X___": {POS: X},
<add> "_SP": {POS: SPACE}
<ide> } | 1 |
Python | Python | add test for real float types locale independance | b90bfef72d85e68d9df5dfc8145de52c5dff5488 | <ide><path>numpy/core/tests/test_print.py
<ide> import numpy as np
<ide> from numpy.testing import *
<ide>
<add>import locale
<add>import sys
<add>
<ide> def check_float_type(tp):
<ide> for x in [0, 1,-1, 1e10, 1e20] :
<ide> assert_equal(str(tp(x)), str(float(x)))
<ide> def test_complex_types():
<ide> for t in [np.complex64, np.cdouble, np.clongdouble] :
<ide> yield check_complex_type, t
<ide>
<add>def has_french_locale():
<add> curloc = locale.getlocale(locale.LC_NUMERIC)
<add> try:
<add> if not sys.platform == 'win32':
<add> locale.setlocale(locale.LC_NUMERIC, 'fr_FR')
<add> else:
<add> locale.setlocale(locale.LC_NUMERIC, 'FRENCH')
<add>
<add> st = True
<add> except:
<add> st = False
<add> finally:
<add> locale.setlocale(locale.LC_NUMERIC, locale=curloc)
<add>
<add> return st
<add>
<add>def _test_locale_independance(tp):
<add> # XXX: How to query locale on a given system ?
<add>
<add> # French is one language where the decimal is ',' not '.', and should be
<add> # relatively common on many systems
<add> curloc = locale.getlocale(locale.LC_NUMERIC)
<add> try:
<add> if not sys.platform == 'win32':
<add> locale.setlocale(locale.LC_NUMERIC, 'fr_FR')
<add> else:
<add> locale.setlocale(locale.LC_NUMERIC, 'FRENCH')
<add>
<add> assert_equal(str(tp(1.2)), str(float(1.2)))
<add> finally:
<add> locale.setlocale(locale.LC_NUMERIC, locale=curloc)
<add>
<add>@np.testing.dec.skipif(not has_french_locale(),
<add> "Skipping locale test, French locale not found")
<add>def test_locale_single():
<add> return _test_locale_independance(np.float32)
<add>
<add>@np.testing.dec.skipif(not has_french_locale(),
<add> "Skipping locale test, French locale not found")
<add>def test_locale_double():
<add> return _test_locale_independance(np.float64)
<add>
<add>@np.testing.dec.skipif(not has_french_locale(),
<add> "Skipping locale test, French locale not found")
<add>def test_locale_longdouble():
<add> return _test_locale_independance(np.float96)
<add>
<ide> if __name__ == "__main__":
<ide> run_module_suite() | 1 |
PHP | PHP | add getactionmethod to route.php | 8be9acfbb802a74b4939eb84c24c4f151c30512a | <ide><path>src/Illuminate/Routing/Route.php
<ide> public function getActionName()
<ide> return isset($this->action['controller']) ? $this->action['controller'] : 'Closure';
<ide> }
<ide>
<add> /**
<add> * Get the method name of the route action.
<add> *
<add> * @return string
<add> */
<add> public function getActionMethod()
<add> {
<add> return array_last(explode('@', $this->getActionName()));
<add> }
<add>
<ide> /**
<ide> * Get the action array for the route.
<ide> * | 1 |
Go | Go | add image load/save support | 50fb999bb148ce4cd50c1a8952353a95c9751bff | <ide><path>api/server/router/image/backend.go
<ide> type imageBackend interface {
<ide> }
<ide>
<ide> type importExportBackend interface {
<del> LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error
<add> LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
<ide> ImportImage(src string, repository string, platform *specs.Platform, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, changes []string) error
<del> ExportImage(names []string, outStream io.Writer) error
<add> ExportImage(ctx context.Context, names []string, outStream io.Writer) error
<ide> }
<ide>
<ide> type registryBackend interface {
<ide><path>api/server/router/image/image_routes.go
<ide> func (s *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter, r
<ide> names = r.Form["names"]
<ide> }
<ide>
<del> if err := s.backend.ExportImage(names, output); err != nil {
<add> if err := s.backend.ExportImage(ctx, names, output); err != nil {
<ide> if !output.Flushed() {
<ide> return err
<ide> }
<ide> func (s *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter,
<ide>
<ide> output := ioutils.NewWriteFlusher(w)
<ide> defer output.Close()
<del> if err := s.backend.LoadImage(r.Body, output, quiet); err != nil {
<add> if err := s.backend.LoadImage(ctx, r.Body, output, quiet); err != nil {
<ide> _, _ = output.Write(streamformatter.FormatError(err))
<ide> }
<ide> return nil
<ide><path>daemon/containerd/image_exporter.go
<ide> package containerd
<ide>
<del>import "io"
<add>import (
<add> "context"
<add> "io"
<add>
<add> "github.com/containerd/containerd"
<add> "github.com/containerd/containerd/images/archive"
<add> "github.com/containerd/containerd/platforms"
<add> "github.com/docker/distribution/reference"
<add>)
<ide>
<ide> // ExportImage exports a list of images to the given output stream. The
<ide> // exported images are archived into a tar when written to the output
<ide> // stream. All images with the given tag and all versions containing
<ide> // the same tag are exported. names is the set of tags to export, and
<ide> // outStream is the writer which the images are written to.
<del>func (i *ImageService) ExportImage(names []string, outStream io.Writer) error {
<del> panic("not implemented")
<add>func (i *ImageService) ExportImage(ctx context.Context, names []string, outStream io.Writer) error {
<add> opts := []archive.ExportOpt{
<add> archive.WithPlatform(platforms.Ordered(platforms.DefaultSpec())),
<add> archive.WithSkipNonDistributableBlobs(),
<add> }
<add> is := i.client.ImageService()
<add> for _, imageRef := range names {
<add> named, err := reference.ParseDockerRef(imageRef)
<add> if err != nil {
<add> return err
<add> }
<add> opts = append(opts, archive.WithImage(is, named.String()))
<add> }
<add> return i.client.Export(ctx, outStream, opts...)
<ide> }
<ide>
<ide> // LoadImage uploads a set of images into the repository. This is the
<ide> // complement of ExportImage. The input stream is an uncompressed tar
<ide> // ball containing images and metadata.
<del>func (i *ImageService) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
<del> panic("not implemented")
<add>func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
<add> _, err := i.client.Import(ctx, inTar,
<add> containerd.WithImportPlatform(platforms.DefaultStrict()),
<add> )
<add> return err
<ide> }
<ide><path>daemon/image_service.go
<ide> type ImageService interface {
<ide> PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
<ide> CreateImage(config []byte, parent string) (builder.Image, error)
<ide> ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
<del> ExportImage(names []string, outStream io.Writer) error
<del> LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error
<add> ExportImage(ctx context.Context, names []string, outStream io.Writer) error
<add> LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
<ide> Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error)
<ide> LogImageEvent(imageID, refName, action string)
<ide> LogImageEventWithAttributes(imageID, refName, action string, attributes map[string]string)
<ide><path>daemon/images/image_exporter.go
<ide> package images // import "github.com/docker/docker/daemon/images"
<ide>
<ide> import (
<add> "context"
<ide> "io"
<ide>
<ide> "github.com/docker/docker/image/tarexport"
<ide> import (
<ide> // stream. All images with the given tag and all versions containing
<ide> // the same tag are exported. names is the set of tags to export, and
<ide> // outStream is the writer which the images are written to.
<del>func (i *ImageService) ExportImage(names []string, outStream io.Writer) error {
<add>func (i *ImageService) ExportImage(ctx context.Context, names []string, outStream io.Writer) error {
<ide> imageExporter := tarexport.NewTarExporter(i.imageStore, i.layerStore, i.referenceStore, i)
<ide> return imageExporter.Save(names, outStream)
<ide> }
<ide>
<ide> // LoadImage uploads a set of images into the repository. This is the
<ide> // complement of ExportImage. The input stream is an uncompressed tar
<ide> // ball containing images and metadata.
<del>func (i *ImageService) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
<add>func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
<ide> imageExporter := tarexport.NewTarExporter(i.imageStore, i.layerStore, i.referenceStore, i)
<ide> return imageExporter.Load(inTar, outStream, quiet)
<ide> } | 5 |
Javascript | Javascript | fix global reference to promise | 5c6543771b7fe7ca37ab4b4419a7f873e0849cfb | <ide><path>packages/react-dom/src/client/ReactDOMHostConfig.js
<ide> export const scheduleTimeout: any =
<ide> export const cancelTimeout: any =
<ide> typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
<ide> export const noTimeout = -1;
<del>const localPromise = Promise;
<add>const localPromise = typeof Promise === 'function' ? Promise : undefined;
<ide>
<ide> // -------------------
<ide> // Microtasks | 1 |
Text | Text | add jquery environment notes | 4d19306c7fe3e36dc5deba65b64a339baf2750e5 | <ide><path>README.md
<ide> In the spirit of open source software development, jQuery always encourages comm
<ide> 3. [Writing Code for jQuery Foundation Projects](http://contribute.jquery.org/code/)
<ide>
<ide>
<add>Environments in which to use jQuery
<add>--------------------------------------
<add>
<add>- [Browser support](http://jquery.com/browser-support/) differs between the master (2.x) branch and the 1.x-master branch. Specifically, 2.x does not support legacy browsers such as IE6-8. The jQuery team continues to provide support for legacy browsers on the 1.x-master branch. Use the latest 1.x release if support for those browsers is required. See [browser support](http://jquery.com/browser-support/) for more info.
<add>- To use jQuery in Node, browser extensions, and other non-browser environments, use only **2.x** releases. 1.x does not support these environments.
<add>
<add>
<ide> What you need to build your own jQuery
<ide> --------------------------------------
<ide> | 1 |
Text | Text | fix typo in tutorial.md | 37f94bd3bb5b5c0d8a30dee13614066f35070b40 | <ide><path>docs/tutorial/tutorial.md
<ide> Square no longer keeps its own state; it receives its value from its parent `Boa
<ide>
<ide> ## Why Immutability Is Important
<ide>
<del>In the previous code example, I suggest using the `.slice()` operator to copy the `squares` array prior to making changges and to prevent mutating the existing array. Let's talk about what this means and why it an important concept to learn.
<add>In the previous code example, I suggest using the `.slice()` operator to copy the `squares` array prior to making changes and to prevent mutating the existing array. Let's talk about what this means and why it an important concept to learn.
<ide>
<ide> There are generally two ways for changing data. The first, and most common method in past, has been to *mutate* the data by directly changing the values of a variable. The second method is to replace the data with a new copy of the object that also includes desired changes.
<ide> | 1 |
Go | Go | add default route to networkgetroutes | 26726dc9ff3ac8ccc7f40f7672e6494d0e77611d | <ide><path>network.go
<ide> func networkSize(mask net.IPMask) int32 {
<ide> return int32(binary.BigEndian.Uint32(m)) + 1
<ide> }
<ide>
<del>func checkRouteOverlaps(networks []*net.IPNet, dockerNetwork *net.IPNet) error {
<add>func checkRouteOverlaps(networks []netlink.Route, dockerNetwork *net.IPNet) error {
<ide> for _, network := range networks {
<del> if networkOverlaps(dockerNetwork, network) {
<add> if networkOverlaps(dockerNetwork, network.IPNet) {
<ide> return fmt.Errorf("Network %s is already routed: '%s'", dockerNetwork, network)
<ide> }
<ide> }
<ide><path>network_test.go
<ide> package docker
<ide>
<ide> import (
<ide> "github.com/dotcloud/docker/pkg/iptables"
<add> "github.com/dotcloud/docker/pkg/netlink"
<ide> "github.com/dotcloud/docker/proxy"
<add>
<ide> "net"
<ide> "testing"
<ide> )
<ide> func TestNetworkOverlaps(t *testing.T) {
<ide> func TestCheckRouteOverlaps(t *testing.T) {
<ide> routesData := []string{"10.0.2.0/32", "10.0.3.0/24", "10.0.42.0/24", "172.16.42.0/24", "192.168.142.0/24"}
<ide>
<del> routes := []*net.IPNet{}
<add> routes := []netlink.Route{}
<ide> for _, addr := range routesData {
<ide> _, netX, _ := net.ParseCIDR(addr)
<del> routes = append(routes, netX)
<add> routes = append(routes, netlink.Route{IPNet: netX})
<ide> }
<ide>
<ide> _, netX, _ := net.ParseCIDR("172.16.0.1/24")
<ide><path>pkg/netlink/netlink_linux.go
<ide> func NetworkLinkAdd(name string, linkType string) error {
<ide> return s.HandleAck(wb.Seq)
<ide> }
<ide>
<add>// A Route is a subnet associated with the interface to reach it.
<add>type Route struct {
<add> *net.IPNet
<add> Iface *net.Interface
<add> Default bool
<add>}
<add>
<ide> // Returns an array of IPNet for all the currently routed subnets on ipv4
<ide> // This is similar to the first column of "ip route" output
<del>func NetworkGetRoutes() ([]*net.IPNet, error) {
<add>func NetworkGetRoutes() ([]Route, error) {
<ide> native := nativeEndian()
<ide>
<ide> s, err := getNetlinkSocket()
<ide> func NetworkGetRoutes() ([]*net.IPNet, error) {
<ide> return nil, err
<ide> }
<ide>
<del> res := make([]*net.IPNet, 0)
<add> res := make([]Route, 0)
<ide>
<ide> done:
<ide> for {
<ide> done:
<ide> continue
<ide> }
<ide>
<del> var iface *net.Interface = nil
<del> var ipNet *net.IPNet = nil
<add> var r Route
<ide>
<ide> msg := (*RtMsg)(unsafe.Pointer(&m.Data[0:syscall.SizeofRtMsg][0]))
<ide>
<ide> done:
<ide> }
<ide>
<ide> if msg.Dst_len == 0 {
<del> // Ignore default routes
<del> continue
<add> // Default routes
<add> r.Default = true
<ide> }
<ide>
<ide> attrs, err := syscall.ParseNetlinkRouteAttr(&m)
<ide> done:
<ide> switch attr.Attr.Type {
<ide> case syscall.RTA_DST:
<ide> ip := attr.Value
<del> ipNet = &net.IPNet{
<add> r.IPNet = &net.IPNet{
<ide> IP: ip,
<ide> Mask: net.CIDRMask(int(msg.Dst_len), 8*len(ip)),
<ide> }
<ide> case syscall.RTA_OIF:
<ide> index := int(native.Uint32(attr.Value[0:4]))
<del> iface, _ = net.InterfaceByIndex(index)
<del> _ = iface
<add> r.Iface, _ = net.InterfaceByIndex(index)
<ide> }
<ide> }
<del> if ipNet != nil {
<del> res = append(res, ipNet)
<add> if r.Default || r.IPNet != nil {
<add> res = append(res, r)
<ide> }
<ide> }
<ide> } | 3 |
Go | Go | remove all syscall calls from devicemapper | 5690139785fc2bfaa2f233ed41d5f927a8b28dbf | <ide><path>graphdriver/devmapper/deviceset.go
<ide> import (
<ide> "path/filepath"
<ide> "strconv"
<ide> "sync"
<del> "syscall"
<ide> "time"
<ide> )
<ide>
<ide> func setCloseOnExec(name string) {
<ide> if link == name {
<ide> fd, err := strconv.Atoi(i.Name())
<ide> if err == nil {
<del> SyscallCloseOnExec(fd)
<add> sysCloseOnExec(fd)
<ide> }
<ide> }
<ide> }
<ide> func (devices *DeviceSet) initDevmapper(doInit bool) error {
<ide> if err != nil {
<ide> return fmt.Errorf("Error looking up dir %s: %s", devices.root, err)
<ide> }
<del> sysSt := st.Sys().(*syscall.Stat_t)
<add> sysSt := toSysStatT(st.Sys())
<ide> // "reg-" stands for "regular file".
<ide> // In the future we might use "dev-" for "device file", etc.
<ide> // docker-maj,min[-inode] stands for:
<ide> func (devices *DeviceSet) byHash(hash string) (devname string, err error) {
<ide> }
<ide>
<ide> func (devices *DeviceSet) Shutdown() error {
<del> utils.Debugf("[deviceset %s] shutdown()", devices.devicePrefix)
<del> defer utils.Debugf("[deviceset %s] shutdown END", devices.devicePrefix)
<ide> devices.Lock()
<del> utils.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
<ide> defer devices.Unlock()
<ide>
<add> utils.Debugf("[deviceset %s] shutdown()", devices.devicePrefix)
<add> utils.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
<add> defer utils.Debugf("[deviceset %s] shutdown END", devices.devicePrefix)
<add>
<ide> for path, count := range devices.activeMounts {
<ide> for i := count; i > 0; i-- {
<del> if err := SyscallUnmount(path, 0); err != nil {
<add> if err := sysUnmount(path, 0); err != nil {
<ide> utils.Debugf("Shutdown unmounting %s, error: %s\n", path, err)
<ide> }
<ide> }
<ide> func (devices *DeviceSet) MountDevice(hash, path string, readOnly bool) error {
<ide>
<ide> info := devices.Devices[hash]
<ide>
<del> var flags uintptr = syscall.MS_MGC_VAL
<add> var flags uintptr = sysMsMgcVal
<ide>
<ide> if readOnly {
<del> flags = flags | syscall.MS_RDONLY
<add> flags = flags | sysMsRdOnly
<ide> }
<ide>
<del> err := SyscallMount(info.DevName(), path, "ext4", flags, "discard")
<del> if err != nil && err == syscall.EINVAL {
<del> err = SyscallMount(info.DevName(), path, "ext4", flags, "")
<add> err := sysMount(info.DevName(), path, "ext4", flags, "discard")
<add> if err != nil && err == sysEInval {
<add> err = sysMount(info.DevName(), path, "ext4", flags, "")
<ide> }
<ide> if err != nil {
<ide> return fmt.Errorf("Error mounting '%s' on '%s': %s", info.DevName(), path, err)
<ide> func (devices *DeviceSet) UnmountDevice(hash, path string, deactivate bool) erro
<ide> defer devices.Unlock()
<ide>
<ide> utils.Debugf("[devmapper] Unmount(%s)", path)
<del> if err := SyscallUnmount(path, 0); err != nil {
<add> if err := sysUnmount(path, 0); err != nil {
<ide> utils.Debugf("\n--->Err: %s\n", err)
<ide> return err
<ide> }
<ide><path>graphdriver/devmapper/devmapper.go
<ide> import (
<ide> "github.com/dotcloud/docker/utils"
<ide> "os"
<ide> "runtime"
<del> "syscall"
<ide> )
<ide>
<ide> type DevmapperLogger interface {
<ide> func FindLoopDeviceFor(file *os.File) *os.File {
<ide> if err != nil {
<ide> return nil
<ide> }
<del> targetInode := stat.Sys().(*syscall.Stat_t).Ino
<del> targetDevice := stat.Sys().(*syscall.Stat_t).Dev
<add> targetInode := stat.Sys().(*sysStatT).Ino
<add> targetDevice := stat.Sys().(*sysStatT).Dev
<ide>
<ide> for i := 0; true; i++ {
<ide> path := fmt.Sprintf("/dev/loop%d", i)
<ide>
<del> file, err := OSOpenFile(path, os.O_RDWR, 0)
<add> file, err := osOpenFile(path, os.O_RDWR, 0)
<ide> if err != nil {
<ide> if os.IsNotExist(err) {
<ide> return nil
<ide> func getStatus(name string) (uint64, uint64, string, string, error) {
<ide> return 0, 0, "", "", fmt.Errorf("Non existing device %s", name)
<ide> }
<ide>
<del> _, start, length, target_type, params := task.GetNextTarget(0)
<del> return start, length, target_type, params, nil
<add> _, start, length, targetType, params := task.GetNextTarget(0)
<add> return start, length, targetType, params, nil
<ide> }
<ide>
<ide> func setTransactionId(poolName string, oldId uint64, newId uint64) error {
<ide><path>graphdriver/devmapper/devmapper_test.go
<ide> package devmapper
<ide>
<ide> import (
<del> "syscall"
<ide> "testing"
<ide> )
<ide>
<ide> func dmAttachLoopDeviceFail(filename string, fd *int) string {
<ide> return ""
<ide> }
<ide>
<del>func sysGetBlockSizeFail(fd uintptr, size *uint64) syscall.Errno {
<add>func sysGetBlockSizeFail(fd uintptr, size *uint64) sysErrno {
<ide> return 1
<ide> }
<ide>
<ide><path>graphdriver/devmapper/devmapper_wrapper.go
<ide> static void log_with_errno_init()
<ide> import "C"
<ide>
<ide> import (
<del> "syscall"
<ide> "unsafe"
<ide> )
<ide>
<ide> func dmTaskAddTargetFct(task *CDmTask,
<ide> C.uint64_t(start), C.uint64_t(size), Cttype, Cparams))
<ide> }
<ide>
<del>func dmGetLoopbackBackingFile(fd uintptr) (uint64, uint64, syscall.Errno) {
<add>func dmGetLoopbackBackingFile(fd uintptr) (uint64, uint64, sysErrno) {
<ide> var lo64 C.struct_loop_info64
<del> _, _, err := SyscallSyscall(syscall.SYS_IOCTL, fd, C.LOOP_GET_STATUS64,
<add> _, _, err := sysSyscall(sysSysIoctl, fd, C.LOOP_GET_STATUS64,
<ide> uintptr(unsafe.Pointer(&lo64)))
<del> return uint64(lo64.lo_device), uint64(lo64.lo_inode), err
<add> return uint64(lo64.lo_device), uint64(lo64.lo_inode), sysErrno(err)
<ide> }
<ide>
<del>func dmLoopbackSetCapacity(fd uintptr) syscall.Errno {
<del> _, _, err := SyscallSyscall(syscall.SYS_IOCTL, fd, C.LOOP_SET_CAPACITY, 0)
<del> return err
<add>func dmLoopbackSetCapacity(fd uintptr) sysErrno {
<add> _, _, err := sysSyscall(sysSysIoctl, fd, C.LOOP_SET_CAPACITY, 0)
<add> return sysErrno(err)
<ide> }
<ide>
<del>func dmGetBlockSizeFct(fd uintptr) (int64, syscall.Errno) {
<add>func dmGetBlockSizeFct(fd uintptr) (int64, sysErrno) {
<ide> var size int64
<del> _, _, err := SyscallSyscall(syscall.SYS_IOCTL, fd, C.BLKGETSIZE64,
<del> uintptr(unsafe.Pointer(&size)))
<del> return size, err
<add> _, _, err := sysSyscall(sysSysIoctl, fd, C.BLKGETSIZE64, uintptr(unsafe.Pointer(&size)))
<add> return size, sysErrno(err)
<ide> }
<ide>
<ide> func dmTaskGetInfoFct(task *CDmTask, info *Info) int {
<ide> func dmTaskGetInfoFct(task *CDmTask, info *Info) int {
<ide> return int(C.dm_task_get_info((*C.struct_dm_task)(task), &Cinfo))
<ide> }
<ide>
<del>func dmGetNextTargetFct(task *CDmTask, next uintptr, start, length *uint64,
<del> target, params *string) uintptr {
<del>
<add>func dmGetNextTargetFct(task *CDmTask, next uintptr, start, length *uint64, target, params *string) uintptr {
<ide> var (
<ide> Cstart, Clength C.uint64_t
<ide> CtargetType, Cparams *C.char
<ide> func dmGetNextTargetFct(task *CDmTask, next uintptr, start, length *uint64,
<ide> *target = C.GoString(CtargetType)
<ide> *params = C.GoString(Cparams)
<ide> }()
<add>
<ide> nextp := C.dm_get_next_target((*C.struct_dm_task)(task),
<ide> unsafe.Pointer(next), &Cstart, &Clength, &CtargetType, &Cparams)
<ide> return uintptr(nextp)
<ide> func dmAttachLoopDeviceFct(filename string, fd *int) string {
<ide> return C.GoString(ret)
<ide> }
<ide>
<del>func getBlockSizeFct(fd uintptr, size *uint64) syscall.Errno {
<del> _, _, err := SyscallSyscall(syscall.SYS_IOCTL, fd, C.BLKGETSIZE64,
<del> uintptr(unsafe.Pointer(&size)))
<del> return err
<add>func getBlockSizeFct(fd uintptr, size *uint64) sysErrno {
<add> _, _, err := sysSyscall(sysSysIoctl, fd, C.BLKGETSIZE64, uintptr(unsafe.Pointer(&size)))
<add> return sysErrno(err)
<ide> }
<ide>
<ide> func dmUdevWaitFct(cookie uint) int {
<ide><path>graphdriver/devmapper/mount.go
<ide> package devmapper
<ide> import (
<ide> "os"
<ide> "path/filepath"
<del> "syscall"
<ide> )
<ide>
<ide> // FIXME: this is copy-pasted from the aufs driver.
<ide> func Mounted(mountpoint string) (bool, error) {
<ide> if err != nil {
<ide> return false, err
<ide> }
<del> mntpointSt := mntpoint.Sys().(*syscall.Stat_t)
<del> parentSt := parent.Sys().(*syscall.Stat_t)
<add> mntpointSt := toSysStatT(mntpoint.Sys())
<add> parentSt := toSysStatT(parent.Sys())
<ide> return mntpointSt.Dev != parentSt.Dev, nil
<ide> }
<ide><path>graphdriver/devmapper/sys.go
<ide> package devmapper
<ide>
<del>
<ide> import (
<add> "os"
<ide> "syscall"
<ide> )
<ide>
<add>type (
<add> sysStatT syscall.Stat_t
<add> sysErrno syscall.Errno
<add>)
<ide>
<ide> var (
<del> SyscallMount = syscall.Mount
<del> SyscallUnmount = syscall.Unmount
<del> SyscallCloseOnExec = syscall.CloseOnExec
<del> SyscallSyscall = syscall.Syscall
<del> OSOpenFile = os.OpenFile
<add> // functions
<add> sysMount = syscall.Mount
<add> sysUnmount = syscall.Unmount
<add> sysCloseOnExec = syscall.CloseOnExec
<add> sysSyscall = syscall.Syscall
<add> osOpenFile = os.OpenFile
<ide> )
<add>
<add>const (
<add> sysMsMgcVal = syscall.MS_MGC_VAL
<add> sysMsRdOnly = syscall.MS_RDONLY
<add> sysEInval = syscall.EINVAL
<add> sysSysIoctl = syscall.SYS_IOCTL
<add>)
<add>
<add>func toSysStatT(i interface{}) *sysStatT {
<add> return (*sysStatT)(i.(*syscall.Stat_t))
<add>} | 6 |
PHP | PHP | fix status code | 1a67ab0a88b2b7cd7e5fbc6f60241b43b902813f | <ide><path>src/Illuminate/Exception/PlainDisplayer.php
<ide>
<ide> use Exception;
<ide> use Symfony\Component\HttpFoundation\Response;
<add>use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
<ide>
<ide> class PlainDisplayer implements ExceptionDisplayerInterface {
<ide>
<ide> class PlainDisplayer implements ExceptionDisplayerInterface {
<ide> */
<ide> public function display(Exception $exception)
<ide> {
<del> return new Response(file_get_contents(__DIR__.'/resources/plain.html'), 500);
<add> $status = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500;
<add>
<add> return new Response(file_get_contents(__DIR__.'/resources/plain.html'), $status);
<ide> }
<ide>
<ide> }
<ide>\ No newline at end of file
<ide><path>src/Illuminate/Exception/WhoopsDisplayer.php
<ide> use Exception;
<ide> use Whoops\Run;
<ide> use Symfony\Component\HttpFoundation\Response;
<add>use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
<ide>
<ide> class WhoopsDisplayer implements ExceptionDisplayerInterface {
<ide>
<ide> public function __construct(Run $whoops, $runningInConsole)
<ide> */
<ide> public function display(Exception $exception)
<ide> {
<del> return new Response($this->whoops->handleException($exception), 500);
<add> $status = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500;
<add>
<add> return new Response($this->whoops->handleException($exception), $status);
<ide> }
<ide>
<ide> }
<ide>\ No newline at end of file | 2 |
Javascript | Javascript | remove old browser logger | 37bb9b76aba0deb445874273b93955ffb1c18bf8 | <ide><path>test/lib/testImageURL.browser.js
<del>testImageURL._recycle = function(img){
<del> console.log('_recycle', img);
<del> try {
<del> img.src = '';
<del> img.onload = img.onerror = null;
<del> } catch(e){}
<del> testImageURL._recycleBin.push(img);
<del>}
<del>testImageURL.getImage = function(callback){
<del> // if (!testImageURL._recycleBin) testImageURL._recycleBin = [new Image(),new Image(),new Image(),new Image()];
<del> // function get(){
<del> // if (testImageURL._recycleBin.length === 0) return setTimeout(get, 100);
<del> // callback(testImageURL._recycleBin.shift(), testImageURL._recycle);
<del> // }
<del> // get();
<del> callback(new Image(), function recycle(){});
<del>}
<del>
<del>testImageURL.defaultCallback = function(error, event){}
<del>
<del>function testImageURL(url, timeout, callback){
<del> if (typeof timeout == 'function'){
<del> callback = timeout;
<del> timeout = testImageURL.timeout;
<del> }
<del> if (typeof callback != 'function') callback = testImageURL.defaultCallback;
<del>
<del> testImageURL.getImage(function(img, done){
<del> function callbackWrapper(error, event){
<del> callbackWrapper = testImageURL.noop;
<del> testImageURL.running = (testImageURL.running || 0) - 1;
<del> clearTimeout(timer);
<del> done(img);
<del> img = url = timeout = null;
<del> callback(error, event);
<del> error = event = callback = null;
<del> }
<del>
<del> var timer = setTimeout(function(){callbackWrapper(Error('timeout'));}, timeout);
<del>
<del> try {
<del> img.onload = function(event){ callbackWrapper(null, event || window.event); };
<del> img.onerror = function(error){ callbackWrapper(error); };
<del> img.src = url;
<del> testImageURL.running = (testImageURL.running || 0) + 1;
<del>
<del> if (img.complete === true
<del> || img.readyState == 4
<del> || img.width > 0
<del> || img.height > 0
<del> || img.readyState == 'complete'
<del> ) callbackWrapper(null, null);
<del> }
<del> catch(error){
<del> callbackWrapper(error);
<del> }
<del> });
<del>}
<del>
<del>testImageURL.noop = function(){};
<del>
<del>testImageURL.timeout = 5000; | 1 |
Javascript | Javascript | simplify blending mode | 3d8f71715d0937d831b39ea8793fe90e59d58c79 | <ide><path>examples/js/loaders/EquiangularToCubeGenerator.js
<ide> THREE.EquiangularToCubeGenerator.prototype = {
<ide> gl_FragColor = vec4( color, 1.0 );\n\
<ide> }",
<ide>
<del> blending: THREE.CustomBlending,
<del> premultipliedAlpha: false,
<del> blendSrc: THREE.OneFactor,
<del> blendDst: THREE.ZeroFactor,
<del> blendSrcAlpha: THREE.OneFactor,
<del> blendDstAlpha: THREE.ZeroFactor,
<del> blendEquation: THREE.AddEquation
<add> blending: THREE.NoBlending
<ide>
<ide> } );
<ide>
<ide><path>examples/js/pmrem/PMREMCubeUVPacker.js
<ide> THREE.PMREMCubeUVPacker.prototype = {
<ide> gl_FragColor = linearToOutputTexel( color );\
<ide> }",
<ide>
<del> blending: THREE.CustomBlending,
<del> premultipliedAlpha: false,
<del> blendSrc: THREE.OneFactor,
<del> blendDst: THREE.ZeroFactor,
<del> blendSrcAlpha: THREE.OneFactor,
<del> blendDstAlpha: THREE.ZeroFactor,
<del> blendEquation: THREE.AddEquation
<add> blending: THREE.NoBlending
<ide>
<ide> } );
<ide>
<ide><path>examples/js/pmrem/PMREMGenerator.js
<ide> THREE.PMREMGenerator.prototype = {
<ide> gl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\
<ide> }",
<ide>
<del> blending: THREE.CustomBlending,
<del> premultipliedAlpha: false,
<del> blendSrc: THREE.OneFactor,
<del> blendDst: THREE.ZeroFactor,
<del> blendSrcAlpha: THREE.OneFactor,
<del> blendDstAlpha: THREE.ZeroFactor,
<del> blendEquation: THREE.AddEquation
<add> blending: THREE.NoBlending
<ide>
<ide> } );
<ide> | 3 |
Mixed | Javascript | use https where possible | 1de834672959636da8c06263c3530226b17a84c3 | <ide><path>README.md
<ide> What you need to build your own jQuery
<ide>
<ide> In order to build jQuery, you need to have the latest Node.js/npm and git 1.7 or later. Earlier versions might work, but are not supported.
<ide>
<del>For Windows, you have to download and install [git](http://git-scm.com/downloads) and [Node.js](https://nodejs.org/en/download/).
<add>For Windows, you have to download and install [git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/en/download/).
<ide>
<ide> OS X users should install [Homebrew](http://brew.sh/). Once Homebrew is installed, run `brew install git` to install git,
<ide> and `brew install node` to install Node.js.
<ide><path>src/css/curCSS.js
<ide> function curCSS( elem, name, computed ) {
<ide> // Android Browser returns percentage for some values,
<ide> // but width seems to be reliably pixels.
<ide> // This is against the CSSOM draft spec:
<del> // http://dev.w3.org/csswg/cssom/#resolved-values
<add> // https://drafts.csswg.org/cssom/#resolved-values
<ide> if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
<ide>
<ide> // Remember the original values
<ide><path>src/event.js
<ide> jQuery.Event = function( src, props ) {
<ide> };
<ide>
<ide> // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
<del>// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
<add>// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
<ide> jQuery.Event.prototype = {
<ide> constructor: jQuery.Event,
<ide> isDefaultPrevented: returnFalse, | 3 |
Text | Text | add changelog entry for swf update | 0f1c5f22f06d0ad0b8b34cd683023a63a66bcf0f | <ide><path>CHANGELOG.md
<ide> CHANGELOG
<ide> =========
<ide>
<ide> ## HEAD (Unreleased)
<del>* src() should not return blob URLs with MSE source handlers ([view](https://github.com/videojs/video.js/pull/2271))
<add>* @dmlap update to video-js-swf 4.7.1 ([view](https://github.com/videojs/video.js/pull/2280))
<add>* @imbcmdth src() should not return blob URLs with MSE source handlers ([view](https://github.com/videojs/video.js/pull/2271))
<ide>
<ide> --------------------
<ide> | 1 |
Ruby | Ruby | add assertions order by field with empty data | 25dbfba26343f04f0eb978852ad0dc80a18aedc5 | <ide><path>activerecord/test/cases/relations_test.rb
<ide> def test_finding_with_complex_order
<ide> def test_finding_with_sanitized_order
<ide> query = Tag.order(["field(id, ?)", [1,3,2]]).to_sql
<ide> assert_match(/field\(id, 1,3,2\)/, query)
<add>
<add> query = Tag.order(["field(id, ?)", []]).to_sql
<add> assert_match(/field\(id, NULL\)/, query)
<add>
<add> query = Tag.order(["field(id, ?)", nil]).to_sql
<add> assert_match(/field\(id, NULL\)/, query)
<ide> end
<ide>
<ide> def test_finding_with_order_limit_and_offset | 1 |
Javascript | Javascript | fix question motion on correct answer | 38d2513223c602d8c3a2e41d75396fe8f47b1f21 | <ide><path>common/app/routes/Hikes/flux/Actions.js
<ide> export default Actions({
<ide> // index 0
<ide> if (tests[currentQuestion]) {
<ide>
<del> return {
<add> return Observable.just({
<ide> transform(state) {
<del>
<ide> const hikesApp = {
<ide> ...state.hikesApp,
<del> currentQuestion: currentQuestion + 1
<add> mouse: [0, 0]
<ide> };
<del>
<ide> return { ...state, hikesApp };
<ide> }
<del> };
<add> })
<add> .delay(300)
<add> .startWith({
<add> transform(state) {
<add>
<add> const hikesApp = {
<add> ...state.hikesApp,
<add> currentQuestion: currentQuestion + 1,
<add> mouse: [ userAnswer ? 1000 : -1000, 0]
<add> };
<add>
<add> return { ...state, hikesApp };
<add> }
<add> });
<ide> }
<ide>
<ide> // challenge completed
<ide> export default Actions({
<ide> },
<ide> optimistic: optimisticSave
<ide> })
<del> .delay(500)
<add> .delay(300)
<ide> .startWith(correctAnswer)
<ide> .catch(err => {
<ide> console.error(err); | 1 |
Text | Text | add 2.16.1 to changelog | 8f3ec0523780e799751656842aff3265e4c7c23a | <ide><path>CHANGELOG.md
<ide> - [#15265](https://github.com/emberjs/ember.js/pull/15265) [BUGFIX] fixed issue when passing `false` to `activeClass` for `{{link-to}}`
<ide> - [#15672](https://github.com/emberjs/ember.js/pull/15672) Update router_js to 2.0.0.
<ide>
<add>### 2.16.1 (October 29, 2017)
<add>
<add>- [#15722](https://github.com/emberjs/ember.js/pull/15722) [BUGFIX] Avoid assertion when using `(get` helper with empty paths.
<add>- [#15746](https://github.com/emberjs/ember.js/pull/15746) [BUGFIX] Fix computed sort regression when array property is initally `null`.
<add>- [#15613](https://github.com/emberjs/ember.js/pull/15613) [BUGFIX] Prevent an error from being thrown when partial set of query params are passed to the router service.
<add>- [#15777](https://github.com/emberjs/ember.js/pull/15777) [BUGFIX] Fix various issues around accessing dynamic data within a partial.
<add>
<ide> ### 2.16.0 (October 9, 2017)
<ide>
<ide> - [#15604](https://github.com/emberjs/ember.js/pull/15604) Data Adapter: Only trigger model type update if the record live array count actually changed | 1 |
Javascript | Javascript | return backslashes from fileurltopath on win | 7237eaa3353aacf284289c8b59b0a5e0fa5744bb | <ide><path>lib/internal/url.js
<ide> function urlToOptions(url) {
<ide> return options;
<ide> }
<ide>
<add>const forwardSlashRegEx = /\//g;
<add>
<ide> function getPathFromURLWin32(url) {
<ide> var hostname = url.hostname;
<ide> var pathname = url.pathname;
<ide> function getPathFromURLWin32(url) {
<ide> }
<ide> }
<ide> }
<add> pathname = pathname.replace(forwardSlashRegEx, '\\');
<ide> pathname = decodeURIComponent(pathname);
<ide> if (hostname !== '') {
<ide> // If hostname is set, then we have a UNC path
<ide> function getPathFromURLWin32(url) {
<ide> // about percent encoding because the URL parser will have
<ide> // already taken care of that for us. Note that this only
<ide> // causes IDNs with an appropriate `xn--` prefix to be decoded.
<del> return `//${domainToUnicode(hostname)}${pathname}`;
<add> return `\\\\${domainToUnicode(hostname)}${pathname}`;
<ide> } else {
<ide> // Otherwise, it's a local path that requires a drive letter
<ide> var letter = pathname.codePointAt(1) | 0x20;
<ide><path>test/parallel/test-fs-whatwg-url.js
<ide> if (common.isWindows) {
<ide> code: 'ERR_INVALID_ARG_VALUE',
<ide> type: TypeError,
<ide> message: 'The argument \'path\' must be a string or Uint8Array without ' +
<del> 'null bytes. Received \'c:/tmp/\\u0000test\''
<add> 'null bytes. Received \'c:\\\\tmp\\\\\\u0000test\''
<ide> }
<ide> );
<ide> } else {
<ide><path>test/parallel/test-url-fileurltopath.js
<add>'use strict';
<add>const { isWindows } = require('../common');
<add>const assert = require('assert');
<add>const url = require('url');
<add>
<add>function testInvalidArgs(...args) {
<add> for (const arg of args) {
<add> assert.throws(() => url.fileURLToPath(arg), {
<add> code: 'ERR_INVALID_ARG_TYPE'
<add> });
<add> }
<add>}
<add>
<add>// Input must be string or URL
<add>testInvalidArgs(null, undefined, 1, {}, true);
<add>
<add>// Input must be a file URL
<add>assert.throws(() => url.fileURLToPath('https://a/b/c'), {
<add> code: 'ERR_INVALID_URL_SCHEME'
<add>});
<add>
<add>{
<add> const withHost = new URL('file://host/a');
<add>
<add> if (isWindows) {
<add> assert.strictEqual(url.fileURLToPath(withHost), '\\\\host\\a');
<add> } else {
<add> assert.throws(() => url.fileURLToPath(withHost), {
<add> code: 'ERR_INVALID_FILE_URL_HOST'
<add> });
<add> }
<add>}
<add>
<add>{
<add> if (isWindows) {
<add> assert.throws(() => url.fileURLToPath('file:///C:/a%2F/'), {
<add> code: 'ERR_INVALID_FILE_URL_PATH'
<add> });
<add> assert.throws(() => url.fileURLToPath('file:///C:/a%5C/'), {
<add> code: 'ERR_INVALID_FILE_URL_PATH'
<add> });
<add> assert.throws(() => url.fileURLToPath('file:///?:/'), {
<add> code: 'ERR_INVALID_FILE_URL_PATH'
<add> });
<add> } else {
<add> assert.throws(() => url.fileURLToPath('file:///a%2F/'), {
<add> code: 'ERR_INVALID_FILE_URL_PATH'
<add> });
<add> }
<add>}
<add>
<add>{
<add> let testCases;
<add> if (isWindows) {
<add> testCases = [
<add> // lowercase ascii alpha
<add> { path: 'C:\\foo', fileURL: 'file:///C:/foo' },
<add> // uppercase ascii alpha
<add> { path: 'C:\\FOO', fileURL: 'file:///C:/FOO' },
<add> // dir
<add> { path: 'C:\\dir\\foo', fileURL: 'file:///C:/dir/foo' },
<add> // trailing separator
<add> { path: 'C:\\dir\\', fileURL: 'file:///C:/dir/' },
<add> // dot
<add> { path: 'C:\\foo.mjs', fileURL: 'file:///C:/foo.mjs' },
<add> // space
<add> { path: 'C:\\foo bar', fileURL: 'file:///C:/foo%20bar' },
<add> // question mark
<add> { path: 'C:\\foo?bar', fileURL: 'file:///C:/foo%3Fbar' },
<add> // number sign
<add> { path: 'C:\\foo#bar', fileURL: 'file:///C:/foo%23bar' },
<add> // ampersand
<add> { path: 'C:\\foo&bar', fileURL: 'file:///C:/foo&bar' },
<add> // equals
<add> { path: 'C:\\foo=bar', fileURL: 'file:///C:/foo=bar' },
<add> // colon
<add> { path: 'C:\\foo:bar', fileURL: 'file:///C:/foo:bar' },
<add> // semicolon
<add> { path: 'C:\\foo;bar', fileURL: 'file:///C:/foo;bar' },
<add> // percent
<add> { path: 'C:\\foo%bar', fileURL: 'file:///C:/foo%25bar' },
<add> // backslash
<add> { path: 'C:\\foo\\bar', fileURL: 'file:///C:/foo/bar' },
<add> // backspace
<add> { path: 'C:\\foo\bbar', fileURL: 'file:///C:/foo%08bar' },
<add> // tab
<add> { path: 'C:\\foo\tbar', fileURL: 'file:///C:/foo%09bar' },
<add> // newline
<add> { path: 'C:\\foo\nbar', fileURL: 'file:///C:/foo%0Abar' },
<add> // carriage return
<add> { path: 'C:\\foo\rbar', fileURL: 'file:///C:/foo%0Dbar' },
<add> // latin1
<add> { path: 'C:\\fóóbàr', fileURL: 'file:///C:/f%C3%B3%C3%B3b%C3%A0r' },
<add> // euro sign (BMP code point)
<add> { path: 'C:\\€', fileURL: 'file:///C:/%E2%82%AC' },
<add> // rocket emoji (non-BMP code point)
<add> { path: 'C:\\🚀', fileURL: 'file:///C:/%F0%9F%9A%80' }
<add> ];
<add> } else {
<add> testCases = [
<add> // lowercase ascii alpha
<add> { path: '/foo', fileURL: 'file:///foo' },
<add> // uppercase ascii alpha
<add> { path: '/FOO', fileURL: 'file:///FOO' },
<add> // dir
<add> { path: '/dir/foo', fileURL: 'file:///dir/foo' },
<add> // trailing separator
<add> { path: '/dir/', fileURL: 'file:///dir/' },
<add> // dot
<add> { path: '/foo.mjs', fileURL: 'file:///foo.mjs' },
<add> // space
<add> { path: '/foo bar', fileURL: 'file:///foo%20bar' },
<add> // question mark
<add> { path: '/foo?bar', fileURL: 'file:///foo%3Fbar' },
<add> // number sign
<add> { path: '/foo#bar', fileURL: 'file:///foo%23bar' },
<add> // ampersand
<add> { path: '/foo&bar', fileURL: 'file:///foo&bar' },
<add> // equals
<add> { path: '/foo=bar', fileURL: 'file:///foo=bar' },
<add> // colon
<add> { path: '/foo:bar', fileURL: 'file:///foo:bar' },
<add> // semicolon
<add> { path: '/foo;bar', fileURL: 'file:///foo;bar' },
<add> // percent
<add> { path: '/foo%bar', fileURL: 'file:///foo%25bar' },
<add> // backslash
<add> { path: '/foo\\bar', fileURL: 'file:///foo%5Cbar' },
<add> // backspace
<add> { path: '/foo\bbar', fileURL: 'file:///foo%08bar' },
<add> // tab
<add> { path: '/foo\tbar', fileURL: 'file:///foo%09bar' },
<add> // newline
<add> { path: '/foo\nbar', fileURL: 'file:///foo%0Abar' },
<add> // carriage return
<add> { path: '/foo\rbar', fileURL: 'file:///foo%0Dbar' },
<add> // latin1
<add> { path: '/fóóbàr', fileURL: 'file:///f%C3%B3%C3%B3b%C3%A0r' },
<add> // euro sign (BMP code point)
<add> { path: '/€', fileURL: 'file:///%E2%82%AC' },
<add> // rocket emoji (non-BMP code point)
<add> { path: '/🚀', fileURL: 'file:///%F0%9F%9A%80' },
<add> ];
<add> }
<add>
<add> for (const { path, fileURL } of testCases) {
<add> const fromString = url.fileURLToPath(fileURL);
<add> assert.strictEqual(fromString, path);
<add> const fromURL = url.fileURLToPath(new URL(fileURL));
<add> assert.strictEqual(fromURL, path);
<add> }
<add>} | 3 |
Ruby | Ruby | handle dependencies better | 3eedfd80249bc5e54a665656c4554d0f8db1ef3f | <ide><path>Library/Contributions/cmds/brew-test-bot.rb
<ide> def setup
<ide> def formula formula
<ide> @category = __method__.to_s + ".#{formula}"
<ide>
<add> dependencies = `brew deps #{formula}`.split("\n")
<add> dependencies -= `brew list`.split("\n")
<add> dependencies = dependencies.join(' ')
<add>
<ide> test "brew audit #{formula}"
<del> test "brew fetch --deps #{formula}"
<add> test "brew fetch #{dependencies}" unless dependencies.empty?
<add> test "brew fetch --build-bottle #{formula}"
<add> test "brew install --verbose #{dependencies}" unless dependencies.empty?
<ide> test "brew install --verbose --build-bottle #{formula}"
<ide> return unless steps.last.status == :passed
<ide> test "brew bottle #{formula}", true
<ide> test "brew test #{formula}" if defined? Formula.factory(formula).test
<ide> test "brew uninstall #{formula}"
<add> test "brew uninstall #{dependencies}" unless dependencies.empty?
<ide> end
<ide>
<ide> def homebrew | 1 |
Ruby | Ruby | move to_param undef closer to the deprecations | 8fa2ecf8ed9db0ce72defdba2c49ba61e701e27d | <ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def [](key)
<ide> convert_hashes_to_parameters(key, @parameters[key])
<ide> end
<ide>
<del> undef_method :to_param
<del>
<ide> # Assigns a value to a given +key+. The given key may still get filtered out
<ide> # when +permit+ is called.
<ide> def []=(key, value)
<ide> def init_with(coder) # :nodoc:
<ide> end
<ide> end
<ide>
<add> # Undefine `to_param` such that it gets caught in the `method_missing`
<add> # deprecation cycle below.
<add> undef_method :to_param
<add>
<ide> def method_missing(method_sym, *args, &block)
<ide> if @parameters.respond_to?(method_sym)
<ide> message = <<-DEPRECATE.squish | 1 |
Javascript | Javascript | use @container decorator in todo example | d56fa5655bf957174be233e59f6af5879c9f011d | <ide><path>examples/todo/App.js
<ide> import React from 'react';
<ide> import Header from './Header';
<ide> import Body from './Body';
<del>import { root, Container } from 'redux';
<del>import { todoStore } from './stores/index';
<del>import { addTodo } from './actions/index';
<add>import { root } from 'redux';
<ide>
<ide> @root
<ide> export default class TodoApp {
<ide> render() {
<ide> return (
<del> <Container stores={todoStore} actions={{ addTodo }}>
<del> {props =>
<del> <div>
<del> <Header addTodo={props.addTodo} />
<del> <Body todos={props.todos} />
<del> </div>
<del> }
<del> </Container>
<add> <div>
<add> <Header />
<add> <Body />
<add> </div>
<ide> );
<ide> }
<ide> }
<ide><path>examples/todo/Body.js
<ide> import React, { PropTypes } from 'react';
<add>import { container } from 'redux';
<add>import { todoStore } from './stores/index';
<ide>
<add>@container({
<add> stores: todoStore
<add>})
<ide> export default class Body {
<ide> static propTypes = {
<ide> todos: PropTypes.array.isRequired
<ide><path>examples/todo/Header.js
<ide> import React, { PropTypes } from 'react';
<add>import { container } from 'redux';
<add>import { addTodo } from './actions/index';
<ide>
<add>@container({
<add> actions: { addTodo }
<add>})
<ide> export default class Header {
<ide> static propTypes = {
<ide> addTodo: PropTypes.func.isRequired | 3 |
Python | Python | use mobilenet model with undefined shape | bc54e152666bbd7ed741ec812ea2fc24c894ed11 | <ide><path>keras/applications/mobilenet.py
<ide> def MobileNet(input_shape=None,
<ide> '`0.25`, `0.50`, `0.75` or `1.0` only.')
<ide>
<ide> if rows != cols or rows not in [128, 160, 192, 224]:
<del> raise ValueError('If imagenet weights are being loaded, '
<del> 'input must have a static square shape (one of '
<del> '(128,128), (160,160), (192,192), or (224, 224)).'
<del> ' Input shape provided = %s' % (input_shape,))
<add> if rows is None:
<add> rows = 224
<add> warnings.warn('MobileNet shape is undefined.'
<add> ' Weights for input shape (224, 224) will be loaded.')
<add> else:
<add> raise ValueError('If imagenet weights are being loaded, '
<add> 'input must have a static square shape (one of '
<add> '(128, 128), (160, 160), (192, 192), or (224, 224)).'
<add> ' Input shape provided = %s' % (input_shape,))
<ide>
<ide> if K.image_data_format() != 'channels_last':
<ide> warnings.warn('The MobileNet family of models is only available '
<ide> def _depthwise_conv_block(inputs, pointwise_conv_filters, alpha,
<ide> strides=strides,
<ide> use_bias=False,
<ide> name='conv_dw_%d' % block_id)(x)
<del> x = BatchNormalization(axis=channel_axis, name='conv_dw_%d_bn' % block_id)(x)
<add> x = BatchNormalization(
<add> axis=channel_axis, name='conv_dw_%d_bn' % block_id)(x)
<ide> x = Activation(relu6, name='conv_dw_%d_relu' % block_id)(x)
<ide>
<ide> x = Conv2D(pointwise_conv_filters, (1, 1),
<ide> padding='same',
<ide> use_bias=False,
<ide> strides=(1, 1),
<ide> name='conv_pw_%d' % block_id)(x)
<del> x = BatchNormalization(axis=channel_axis, name='conv_pw_%d_bn' % block_id)(x)
<add> x = BatchNormalization(
<add> axis=channel_axis, name='conv_pw_%d_bn' % block_id)(x)
<ide> return Activation(relu6, name='conv_pw_%d_relu' % block_id)(x) | 1 |
Javascript | Javascript | remove unused code | d6ee63b3af87e10b56d88c28ed82a1f64f58cd56 | <ide><path>packages/ember-handlebars/tests/views/collection_view_test.js
<ide> test("should be able to specify which class should be used for the empty view",
<ide> window.App = Ember.Application.create();
<ide> });
<ide>
<del> App.ListView = Ember.CollectionView.extend();
<ide> App.EmptyView = Ember.View.extend({
<ide> template: Ember.Handlebars.compile('This is an empty view')
<ide> }); | 1 |
PHP | PHP | fix import order | 251f1b76febdd4bedb044b52c68be80cc6d3fb4a | <ide><path>tests/TestCase/Core/ServiceConfigTest.php
<ide> */
<ide> namespace Cake\Test\TestCase\Core;
<ide>
<del>use Cake\Core\ServiceConfig;
<ide> use Cake\Core\Configure;
<add>use Cake\Core\ServiceConfig;
<ide> use Cake\TestSuite\TestCase;
<ide>
<ide> /** | 1 |
Python | Python | use new mixed_float16 policy for transformer | acdf24c56ce0079720ab9638ad9339ca168e908c | <ide><path>official/transformer/v2/embedding_layer.py
<ide> class EmbeddingSharedWeights(tf.keras.layers.Layer):
<ide> """Calculates input embeddings and pre-softmax linear with shared weights."""
<ide>
<del> def __init__(self, vocab_size, hidden_size, dtype=None):
<add> def __init__(self, vocab_size, hidden_size):
<ide> """Specify characteristic parameters of embedding layer.
<ide>
<ide> Args:
<ide> vocab_size: Number of tokens in the embedding. (Typically ~32,000)
<ide> hidden_size: Dimensionality of the embedding. (Typically 512 or 1024)
<del> dtype: The dtype of the layer: float16 or float32.
<ide> """
<del> if dtype == tf.float16:
<del> # We cannot rely on the global policy of "infer_with_float32_vars", as
<del> # this layer is called on both int64 inputs and floating-point inputs.
<del> # If "infer_with_float32_vars" is used, the dtype will be inferred to be
<del> # int64, which means floating-point inputs would not be casted.
<del> # TODO(b/138859351): Remove this logic once we stop using the deprecated
<del> # "infer_with_float32_vars" policy
<del> dtype = tf.keras.mixed_precision.experimental.Policy(
<del> "float16_with_float32_vars")
<del> super(EmbeddingSharedWeights, self).__init__(dtype=dtype)
<add> super(EmbeddingSharedWeights, self).__init__()
<ide> self.vocab_size = vocab_size
<ide> self.hidden_size = hidden_size
<ide>
<ide> def build(self, input_shape):
<ide> self.shared_weights = self.add_weight(
<ide> "weights",
<ide> shape=[self.vocab_size, self.hidden_size],
<del> dtype="float32",
<ide> initializer=tf.random_normal_initializer(
<ide> mean=0., stddev=self.hidden_size**-0.5))
<ide> super(EmbeddingSharedWeights, self).build(input_shape)
<ide><path>official/transformer/v2/transformer.py
<ide> def create_model(params, is_train):
<ide> label_smoothing = params["label_smoothing"]
<ide> if params["enable_metrics_in_training"]:
<ide> logits = metrics.MetricLayer(vocab_size)([logits, targets])
<del> logits = tf.keras.layers.Lambda(lambda x: x, name="logits")(logits)
<add> logits = tf.keras.layers.Lambda(lambda x: x, name="logits",
<add> dtype="float32")(logits)
<ide> model = tf.keras.Model([inputs, targets], logits)
<add> # TODO(reedwm): Can we do this loss in float16 instead of float32?
<ide> loss = metrics.transformer_loss(
<ide> logits, targets, label_smoothing, vocab_size)
<ide> model.add_loss(loss)
<ide> def __init__(self, params, name=None):
<ide> super(Transformer, self).__init__(name=name)
<ide> self.params = params
<ide> self.embedding_softmax_layer = embedding_layer.EmbeddingSharedWeights(
<del> params["vocab_size"], params["hidden_size"], dtype=params["dtype"])
<add> params["vocab_size"], params["hidden_size"])
<ide> self.encoder_stack = EncoderStack(params)
<ide> self.decoder_stack = DecoderStack(params)
<ide>
<ide><path>official/transformer/v2/transformer_main.py
<ide> def __init__(self, flags_obj):
<ide> # like this. What if multiple instances of TransformerTask are created?
<ide> # We should have a better way in the tf.keras.mixed_precision API of doing
<ide> # this.
<add> loss_scale = flags_core.get_loss_scale(flags_obj,
<add> default_for_fp16="dynamic")
<ide> policy = tf.keras.mixed_precision.experimental.Policy(
<del> "infer_float32_vars")
<add> "mixed_float16", loss_scale=loss_scale)
<ide> tf.keras.mixed_precision.experimental.set_policy(policy)
<ide>
<ide> self.distribution_strategy = distribution_utils.get_distribution_strategy(
<ide> def _create_optimizer(self):
<ide> params["optimizer_adam_beta1"],
<ide> params["optimizer_adam_beta2"],
<ide> epsilon=params["optimizer_adam_epsilon"])
<del> if params["dtype"] == tf.float16:
<del> opt = tf.keras.mixed_precision.experimental.LossScaleOptimizer(
<del> opt, loss_scale=flags_core.get_loss_scale(self.flags_obj,
<del> default_for_fp16="dynamic"))
<ide> return opt
<ide>
<ide> | 3 |
Javascript | Javascript | remove an unnecessary __dev__ condition | ffec3be560de3bf1e567b9657b7128d4d0cdd185 | <ide><path>src/renderers/testing/ReactShallowRendererEntry.js
<ide> const React = require('react');
<ide> const emptyObject = require('fbjs/lib/emptyObject');
<ide> const invariant = require('fbjs/lib/invariant');
<ide>
<del>if (__DEV__) {
<del> var describeComponentFrame = require('describeComponentFrame');
<del> var getComponentName = require('getComponentName');
<del>
<del> var currentlyValidatingElement = null;
<del>
<del> var getDisplayName = function(element: ?ReactElement): string {
<del> if (element == null) {
<del> return '#empty';
<del> } else if (typeof element === 'string' || typeof element === 'number') {
<del> return '#text';
<del> } else if (typeof element.type === 'string') {
<del> return element.type;
<del> } else {
<del> return element.type.displayName || element.type.name || 'Unknown';
<del> }
<del> };
<del>
<del> var getStackAddendum = function(): string {
<del> var stack = '';
<del> if (currentlyValidatingElement) {
<del> var name = getDisplayName(currentlyValidatingElement);
<del> var owner = currentlyValidatingElement._owner;
<del> stack += describeComponentFrame(
<del> name,
<del> currentlyValidatingElement._source,
<del> owner && getComponentName(owner),
<del> );
<del> }
<del> return stack;
<del> };
<del>}
<add>const describeComponentFrame = require('describeComponentFrame');
<add>const getComponentName = require('getComponentName');
<ide>
<ide> class ReactShallowRenderer {
<ide> static createRenderer = function() {
<ide> class Updater {
<ide> }
<ide> }
<ide>
<add>var currentlyValidatingElement = null;
<add>
<add>function getDisplayName(element) {
<add> if (element == null) {
<add> return '#empty';
<add> } else if (typeof element === 'string' || typeof element === 'number') {
<add> return '#text';
<add> } else if (typeof element.type === 'string') {
<add> return element.type;
<add> } else {
<add> return element.type.displayName || element.type.name || 'Unknown';
<add> }
<add>}
<add>
<add>function getStackAddendum() {
<add> var stack = '';
<add> if (currentlyValidatingElement) {
<add> var name = getDisplayName(currentlyValidatingElement);
<add> var owner = currentlyValidatingElement._owner;
<add> stack += describeComponentFrame(
<add> name,
<add> currentlyValidatingElement._source,
<add> owner && getComponentName(owner),
<add> );
<add> }
<add> return stack;
<add>}
<add>
<ide> function getName(type, instance) {
<ide> var constructor = instance && instance.constructor;
<ide> return ( | 1 |
Go | Go | take pid as argument | 81945da0ac1ac7f117f87b9dc51aac913494bcfb | <ide><path>cmd/dockerd/daemon.go
<ide> func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
<ide> potentiallyUnderRuntimeDir := []string{cli.Config.ExecRoot}
<ide>
<ide> if cli.Pidfile != "" {
<del> if err := pidfile.Write(cli.Pidfile); err != nil {
<add> if err = pidfile.Write(cli.Pidfile, os.Getpid()); err != nil {
<ide> return errors.Wrap(err, "failed to start daemon")
<ide> }
<ide> potentiallyUnderRuntimeDir = append(potentiallyUnderRuntimeDir, cli.Pidfile)
<ide><path>pkg/pidfile/pidfile.go
<ide> func checkPIDFileAlreadyExists(path string) error {
<ide> // Write writes a "PID file" at the specified path. It returns an error if the
<ide> // file exists and contains a valid PID of a running process, or when failing
<ide> // to write the file.
<del>func Write(path string) error {
<add>func Write(path string, pid int) error {
<add> if pid < 1 {
<add> // We might be running as PID 1 when running docker-in-docker,
<add> // but 0 or negative PIDs are not acceptable.
<add> return fmt.Errorf("invalid PID (%d): only positive PIDs are allowed", pid)
<add> }
<ide> if err := checkPIDFileAlreadyExists(path); err != nil {
<ide> return err
<ide> }
<ide> if err := system.MkdirAll(filepath.Dir(path), 0o755); err != nil {
<ide> return err
<ide> }
<del> return os.WriteFile(path, []byte(strconv.Itoa(os.Getpid())), 0o644)
<add> return os.WriteFile(path, []byte(strconv.Itoa(pid)), 0o644)
<ide> }
<ide><path>pkg/pidfile/pidfile_test.go
<ide> package pidfile // import "github.com/docker/docker/pkg/pidfile"
<ide>
<ide> import (
<add> "os"
<ide> "path/filepath"
<ide> "testing"
<ide> )
<ide>
<ide> func TestWrite(t *testing.T) {
<ide> path := filepath.Join(t.TempDir(), "testfile")
<del> err := Write(path)
<add>
<add> err := Write(path, 0)
<add> if err == nil {
<add> t.Fatal("writing PID < 1 should fail")
<add> }
<add>
<add> err = Write(path, os.Getpid())
<ide> if err != nil {
<ide> t.Fatal("Could not create test file", err)
<ide> }
<ide>
<del> err = Write(path)
<add> err = Write(path, os.Getpid())
<ide> if err == nil {
<ide> t.Fatal("Test file creation not blocked")
<ide> } | 3 |
Ruby | Ruby | tell people that --all is a no-op | f17a55b2690777ba67700a09a8eea623bd9ba98a | <ide><path>Library/Homebrew/cmd/upgrade.rb
<ide> def upgrade
<ide>
<ide> Homebrew.perform_preinstall_checks
<ide>
<add> if ARGV.include?("--all")
<add> opoo <<-EOS.undent
<add> We decided to not change the behaviour of `brew upgrade` so
<add> `brew upgrade --all` is equivalent to `brew upgrade` without any other
<add> arguments (so the `--all` is a no-op and can be removed).
<add> EOS
<add> end
<add>
<ide> if ARGV.named.empty?
<ide> outdated = Formula.installed.select do |f|
<ide> f.outdated?(fetch_head: ARGV.fetch_head?) | 1 |
Ruby | Ruby | add bundler helper for appgeneratortest | c63a13fa0b5ffc7826883d039331dac335cf44c7 | <ide><path>railties/test/generators/app_generator_test.rb
<ide> def test_no_skip_javascript_option_with_no_skip_javascript_argument
<ide> end
<ide>
<ide> def test_hotwire
<del> run_generator [destination_root, "--no-skip-bundle"]
<add> run_generator_and_bundler [destination_root]
<ide> assert_gem "turbo-rails"
<ide> assert_gem "stimulus-rails"
<ide> assert_file "app/views/layouts/application.html.erb" do |content|
<ide> def test_skip_hotwire
<ide> end
<ide>
<ide> def test_css_option_with_asset_pipeline_tailwind
<del> run_generator [destination_root, "--css", "tailwind", "--no-skip-bundle"]
<add> run_generator_and_bundler [destination_root, "--css=tailwind"]
<ide> assert_gem "tailwindcss-rails"
<ide> assert_file "app/views/layouts/application.html.erb" do |content|
<ide> assert_match(/tailwind/, content)
<ide> end
<ide> end
<ide>
<ide> def test_css_option_with_cssbundling_gem
<del> run_generator [destination_root, "--css", "postcss", "--no-skip-bundle"]
<add> run_generator_and_bundler [destination_root, "--css=postcss"]
<ide> assert_gem "cssbundling-rails"
<ide> assert_file "app/assets/stylesheets/application.postcss.css"
<ide> end
<ide> def test_name_option
<ide> end
<ide>
<ide> private
<add> def run_generator_and_bundler(args)
<add> option_args, positional_args = args.partition { |arg| arg.start_with?("--") }
<add> option_args << "--no-skip-bundle"
<add> generator(positional_args, option_args)
<add>
<add> # Stub `rails_gemfile_entry` so that Bundler resolves `gem "rails"` to the
<add> # current repository instead of searching for an invalid version number
<add> # (for a version that hasn't been released yet).
<add> rails_gemfile_entry = Rails::Generators::AppBase::GemfileEntry.path("rails", Rails::Generators::RAILS_DEV_PATH)
<add> generator.stub(:rails_gemfile_entry, -> { rails_gemfile_entry }) do
<add> quietly { run_generator_instance }
<add> end
<add> end
<add>
<ide> def run_app_update(app_root = destination_root)
<ide> Dir.chdir(app_root) do
<ide> gemfile_contents = File.read("Gemfile") | 1 |
Javascript | Javascript | fix bad syntax in docs | 306f75cd555336302c3e5295cba141e92cca2f5f | <ide><path>packages/ember-routing/lib/system/router.js
<ide> EmberRouter.reopenClass({
<ide> supplied callback function using `this.resource` and `this.route`.
<ide>
<ide> ```javascript
<del> App.Router.map(function({
<add> App.Router.map(function(){
<ide> this.route('about');
<ide> this.resource('article');
<del> }));
<add> });
<ide> ```
<ide>
<ide> For more detailed examples please see | 1 |
Ruby | Ruby | use arel in sql generation through associations | 7be3e3ba0547587313d87bccb788a8466a62628a | <ide><path>activerecord/lib/active_record/base.rb
<ide> def destroy(id)
<ide> # # Update all books that match our conditions, but limit it to 5 ordered by date
<ide> # Book.update_all "author = 'David'", "title LIKE '%Rails%'", :order => 'created_at', :limit => 5
<ide> def update_all(updates, conditions = nil, options = {})
<del> sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} "
<add> # sql = "UPDATE #{quoted_table_name} SET #{sanitize_sql_for_assignment(updates)} "
<ide>
<del> scope = scope(:find)
<add> # scope = scope(:find)
<add>
<add> # select_sql = ""
<add> # add_conditions!(select_sql, conditions, scope)
<add>
<add> # if options.has_key?(:limit) || (scope && scope[:limit])
<add> # # Only take order from scope if limit is also provided by scope, this
<add> # # is useful for updating a has_many association with a limit.
<add> # add_order!(select_sql, options[:order], scope)
<ide>
<del> select_sql = ""
<del> add_conditions!(select_sql, conditions, scope)
<add> # add_limit!(select_sql, options, scope)
<add> # sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key)))
<add> # else
<add> # add_order!(select_sql, options[:order], nil)
<add> # sql.concat(select_sql)
<add> # end
<add>
<add> # connection.update(sql, "#{name} Update")
<add> scope = scope(:find)
<ide>
<add> arel = arel_table
<add> arel = arel.where(Arel::SqlLiteral.new(construct_conditions(conditions, scope))) if conditions || scope
<ide> if options.has_key?(:limit) || (scope && scope[:limit])
<ide> # Only take order from scope if limit is also provided by scope, this
<ide> # is useful for updating a has_many association with a limit.
<del> add_order!(select_sql, options[:order], scope)
<add> arel = arel.order(construct_order(options[:order], scope))
<ide>
<del> add_limit!(select_sql, options, scope)
<del> sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key)))
<add> arel = arel.take(construct_limit(options, scope))
<add> #arel = arel.where(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key)))
<add> #sql.concat(connection.limited_update_conditions(select_sql, quoted_table_name, connection.quote_column_name(primary_key)))
<ide> else
<del> add_order!(select_sql, options[:order], nil)
<del> sql.concat(select_sql)
<add> arel = arel.order(construct_order(options[:order], nil))
<add> #sql.concat(select_sql)
<ide> end
<ide>
<del> connection.update(sql, "#{name} Update")
<add> arel.update(sanitize_sql_for_assignment(updates))
<ide> end
<ide>
<ide> # Destroys the records matching +conditions+ by instantiating each | 1 |
Text | Text | require a link element in html | dfe80470c6695aa14086f4c9800b0beeb306a02f | <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.md
<ide> Import the `Lobster` font to your web page. Then, use an element selector to set
<ide> You should import the `Lobster` font.
<ide>
<ide> ```js
<del>assert(new RegExp('googleapis', 'gi').test(code));
<add>assert($('link[href*="googleapis" i]').length);
<ide> ```
<ide>
<ide> Your `h2` element should use the font `Lobster`. | 1 |
Ruby | Ruby | add test coverage for dump_filename | 50b588144f3bb401ec1ae9e760c7c583cf37c3d4 | <ide><path>activerecord/test/cases/tasks/database_tasks_test.rb
<ide> def test_check_schema_file
<ide> end
<ide>
<ide> class DatabaseTasksCheckSchemaFileMethods < ActiveRecord::TestCase
<add> setup do
<add> @configurations = { "development" => { "database" => "my-db" } }
<add> end
<add>
<ide> def test_check_schema_file_defaults
<ide> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<ide> assert_deprecated do
<ide> def test_check_schema_file_defaults
<ide> end
<ide> end
<ide> end
<add>
<add> def test_check_dump_filename_defaults
<add> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<add> with_stubbed_configurations do
<add> assert_equal "/tmp/schema.rb", ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_for("development", "primary").name)
<add> end
<add> end
<add> end
<add>
<add> def test_check_dump_filename_with_schema_env
<add> schema = ENV["SCHEMA"]
<add> ENV["SCHEMA"] = "schema_path"
<add> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<add> with_stubbed_configurations do
<add> assert_equal "schema_path", ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_for("development", "primary").name)
<add> end
<add> end
<add> ensure
<add> ENV["SCHEMA"] = schema
<add> end
<add>
<add> { ruby: "schema.rb", sql: "structure.sql" }.each_pair do |fmt, filename|
<add> define_method("test_check_dump_filename_for_#{fmt}_format") do
<add> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<add> with_stubbed_configurations do
<add> assert_equal "/tmp/#{filename}", ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_for("development", "primary").name, fmt)
<add> end
<add> end
<add> end
<add> end
<add>
<add> def test_check_dump_filename_defaults_for_non_primary_databases
<add> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<add> configurations = {
<add> "development" => { "primary" => { "database" => "dev-db" }, "secondary" => { "database" => "secondary-dev-db" } },
<add> }
<add> with_stubbed_configurations(configurations) do
<add> assert_equal "/tmp/secondary_schema.rb", ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_for("development", "secondary").name)
<add> end
<add> end
<add> end
<add>
<add> def test_check_dump_filename_with_schema_env_with_non_primary_databases
<add> schema = ENV["SCHEMA"]
<add> ENV["SCHEMA"] = "schema_path"
<add> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<add> configurations = {
<add> "development" => { "primary" => { "database" => "dev-db" }, "secondary" => { "database" => "secondary-dev-db" } },
<add> }
<add> with_stubbed_configurations(configurations) do
<add> assert_equal "schema_path", ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_for("development", "secondary").name)
<add> end
<add> end
<add> ensure
<add> ENV["SCHEMA"] = schema
<add> end
<add>
<add> { ruby: "schema.rb", sql: "structure.sql" }.each_pair do |fmt, filename|
<add> define_method("test_check_dump_filename_for_#{fmt}_format_with_non_primary_databases") do
<add> ActiveRecord::Tasks::DatabaseTasks.stub(:db_dir, "/tmp") do
<add> configurations = {
<add> "development" => { "primary" => { "database" => "dev-db" }, "secondary" => { "database" => "secondary-dev-db" } },
<add> }
<add> with_stubbed_configurations(configurations) do
<add> assert_equal "/tmp/secondary_#{filename}", ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_for("development", "secondary").name, fmt)
<add> end
<add> end
<add> end
<add> end
<add>
<add> private
<add> def config_for(env_name, name)
<add> ActiveRecord::Base.configurations.configs_for(env_name: env_name, name: name)
<add> end
<add>
<add> def with_stubbed_configurations(configurations = @configurations)
<add> old_configurations = ActiveRecord::Base.configurations
<add> ActiveRecord::Base.configurations = configurations
<add>
<add> yield
<add> ensure
<add> ActiveRecord::Base.configurations = old_configurations
<add> end
<ide> end
<ide> end | 1 |
Python | Python | fix typo in transformerencoderblock docstring | 420e8179b6b009b2df5b281cb38592613c7830fd | <ide><path>official/nlp/keras_nlp/layers/transformer_encoder_block.py
<ide> def call(self, inputs):
<ide> attention.
<ide>
<ide> Returns:
<del> An ouput tensor with the same dimensions as input/query tensor.
<add> An output tensor with the same dimensions as input/query tensor.
<ide> """
<ide> if isinstance(inputs, (list, tuple)):
<ide> if len(inputs) == 2: | 1 |
PHP | PHP | remove controllers constant | 80e68763a3810bc19e9839409117666865d75b6e | <ide><path>lib/Cake/Console/Command/Task/ControllerTask.php
<ide> class ControllerTask extends BakeTask {
<ide> public $tasks = array('Model', 'Test', 'Template', 'DbConfig', 'Project');
<ide>
<ide> /**
<del> * path to CONTROLLERS directory
<add> * path to Controller directory
<ide> *
<ide> * @var array
<ide> * @access public
<ide> */
<del> public $path = CONTROLLERS;
<add> public $path = null;
<ide>
<ide> /**
<ide> * Override initialize
<ide> *
<ide> */
<ide> public function initialize() {
<add> $this->path = App::path('Controller');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Console/Command/Task/PluginTask.php
<ide> class PluginTask extends Shell {
<ide>
<ide> /**
<del> * path to CONTROLLERS directory
<add> * path to plugins directory
<ide> *
<ide> * @var array
<ide> * @access public
<ide> public function findPath($pathOptions) {
<ide> */
<ide> public function getOptionParser() {
<ide> $parser = parent::getOptionParser();
<del> return $parser->description(__d('cake_console',
<add> return $parser->description(__d('cake_console',
<ide> 'Create the directory structure, AppModel and AppController classes for a new plugin. ' .
<ide> 'Can create plugins in any of your bootstrapped plugin paths.'
<ide> ))->addArgument('name', array(
<ide><path>lib/Cake/bootstrap.php
<ide> */
<ide> define('BEHAVIORS', MODELS.'Behavior'.DS);
<ide>
<del>/**
<del> * Path to the application's controllers directory.
<del> */
<del> define('CONTROLLERS', APP.'Controller'.DS);
<del>
<ide> /**
<ide> * Path to the application's components directory.
<ide> */ | 3 |
Javascript | Javascript | replace regexp with function | 1c3df965705d156db7b8132b86b3193a7467a2e2 | <ide><path>lib/fs.js
<ide> fs.unwatchFile = function(filename, listener) {
<ide> };
<ide>
<ide>
<del>// Regexp that finds the next portion of a (partial) path
<del>// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
<del>const nextPartRe = isWindows ?
<del> /(.*?)(?:[/\\]+|$)/g :
<del> /(.*?)(?:[/]+|$)/g;
<del>
<ide> // Regex to find the device root, including trailing slash. E.g. 'c:\\'.
<ide> const splitRootRe = isWindows ?
<ide> /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/][^\\/]+)?[\\/]*/ :
<ide> function encodeRealpathResult(result, options) {
<ide> }
<ide> }
<ide>
<add>// Finds the next portion of a (partial) path, up to the next path delimiter
<add>var nextPart;
<add>if (isWindows) {
<add> nextPart = function nextPart(p, i) {
<add> for (; i < p.length; ++i) {
<add> const ch = p.charCodeAt(i);
<add> if (ch === 92/*'\'*/ || ch === 47/*'/'*/)
<add> return i;
<add> }
<add> return -1;
<add> };
<add>} else {
<add> nextPart = function nextPart(p, i) { return p.indexOf('/', i); };
<add>}
<add>
<ide> fs.realpathSync = function realpathSync(p, options) {
<ide> options = getOptions(options, {});
<ide> handleError((p = getPathFromURL(p)));
<ide> fs.realpathSync = function realpathSync(p, options) {
<ide> // NB: p.length changes.
<ide> while (pos < p.length) {
<ide> // find the next part
<del> nextPartRe.lastIndex = pos;
<del> var result = nextPartRe.exec(p);
<add> var result = nextPart(p, pos);
<ide> previous = current;
<del> current += result[0];
<del> base = previous + result[1];
<del> pos = nextPartRe.lastIndex;
<add> if (result === -1) {
<add> var last = p.slice(pos);
<add> current += last;
<add> base = previous + last;
<add> pos = p.length;
<add> } else {
<add> current += p.slice(pos, result + 1);
<add> base = previous + p.slice(pos, result);
<add> pos = result + 1;
<add> }
<ide>
<ide> // continue if not a symlink
<ide> if (knownHard[base] || (cache && cache.get(base) === base)) {
<ide> fs.realpath = function realpath(p, options, callback) {
<ide> }
<ide>
<ide> // find the next part
<del> nextPartRe.lastIndex = pos;
<del> var result = nextPartRe.exec(p);
<add> var result = nextPart(p, pos);
<ide> previous = current;
<del> current += result[0];
<del> base = previous + result[1];
<del> pos = nextPartRe.lastIndex;
<add> if (result === -1) {
<add> var last = p.slice(pos);
<add> current += last;
<add> base = previous + last;
<add> pos = p.length;
<add> } else {
<add> current += p.slice(pos, result + 1);
<add> base = previous + p.slice(pos, result);
<add> pos = result + 1;
<add> }
<ide>
<ide> // continue if not a symlink
<ide> if (knownHard[base]) { | 1 |
Text | Text | improve description of --input-type | a81b4ebb7598a020fa95d80da13fc0b331c35c2a | <ide><path>doc/api/cli.md
<ide> module. String input is input via `--eval`, `--print`, or `STDIN`.
<ide>
<ide> Valid values are `"commonjs"` and `"module"`. The default is `"commonjs"`.
<ide>
<add>The REPL does not support this option.
<add>
<ide> ### `--inspect-brk[=[host:]port]`
<ide>
<ide> <!-- YAML | 1 |
Ruby | Ruby | fix package creation | bd24f5a45eae5f8c2c2a97d0b6c4451e51db0659 | <ide><path>Library/Homebrew/bintray.rb
<ide> def official_org?(org: @bintray_org)
<ide> end
<ide>
<ide> def create_package(repo:, package:, **extra_data_args)
<del> url = "#{API_URL}/packages/#{@bintray_org}/#{repo}/#{package}"
<add> url = "#{API_URL}/packages/#{@bintray_org}/#{repo}"
<ide> data = { name: package, public_download_numbers: true }
<ide> data[:public_stats] = official_org?
<ide> data.merge! extra_data_args
<del> open_api url, "--request", "POST", "--data", data.to_json
<add> open_api url, "--header", "Content-Type: application/json", "--request", "POST", "--data", data.to_json
<ide> end
<ide>
<ide> def package_exists?(repo:, package:)
<ide> url = "#{API_URL}/packages/#{@bintray_org}/#{repo}/#{package}"
<del> open_api url, "--output", "/dev/null", auth: false
<add> begin
<add> open_api url, "--silent", "--output", "/dev/null", auth: false
<add> rescue ErrorDuringExecution => e
<add> stderr = e.output.select { |type,| type == :stderr }
<add> .map { |_, line| line }
<add> .join
<add> raise if e.status.exitstatus != 22 && !stderr.include?("404 Not Found")
<add>
<add> false
<add> else
<add> true
<add> end
<ide> end
<ide>
<ide> def file_published?(repo:, remote_file:)
<ide> def upload_bottle_json(json_files, publish_package: false)
<ide> end
<ide>
<ide> if !formula_packaged[formula_name] && !package_exists?(repo: bintray_repo, package: bintray_package)
<del> odebug "Creating package #{@bintray_org}/#{bintray_repo}/#{package}"
<add> odebug "Creating package #{@bintray_org}/#{bintray_repo}/#{bintray_package}"
<ide> create_package repo: bintray_repo, package: bintray_package
<ide> formula_packaged[formula_name] = true
<ide> end
<ide><path>Library/Homebrew/test/bintray_spec.rb
<ide> describe "::package_exists?" do
<ide> it "detects a package" do
<ide> results = bintray.package_exists?(repo: "bottles", package: "hello")
<del> expect(results.status.exitstatus).to be 0
<add> expect(results).to be true
<ide> end
<ide> end
<ide> end | 2 |
Python | Python | add check for kerberos | 71fdee3f007d652915d76e84d2a0330587a179c1 | <ide><path>airflow/hooks/hive_hooks.py
<ide> from airflow.utils import AirflowException
<ide> from airflow.hooks.base_hook import BaseHook
<ide> from airflow.utils import TemporaryDirectory
<add>from airflow.configuration import conf
<ide>
<ide>
<ide> class HiveCliHook(BaseHook):
<ide> def __init__(self, hiveserver2_conn_id='hiveserver2_default'):
<ide>
<ide> def get_conn(self):
<ide> db = self.get_connection(self.hiveserver2_conn_id)
<add> auth_mechanism = db.extra_dejson.get('authMechanism', 'NOSASL')
<add> if conf.get('security','enabled'):
<add> auth_mechanism = db.extra_dejson.get('authMechanism', 'KERBEROS')
<add>
<ide> return pyhs2.connect(
<ide> host=db.host,
<ide> port=db.port,
<del> authMechanism=db.extra_dejson.get('authMechanism', 'NOSASL'),
<add> authMechanism=auth_mechanism,
<ide> user=db.login,
<ide> database=db.schema or 'default')
<ide> | 1 |
Python | Python | add code to test for a declaration in header | 2d914ba6055da226a039dd846b19363532a26254 | <ide><path>numpy/core/setup.py
<ide> def configuration(parent_package='',top_path=None):
<ide>
<ide> header_dir = 'include/numpy' # this is relative to config.path_in_package
<ide>
<add> def generate_declaration_test(symbol, includes):
<add> main_src = """
<add>int main()
<add>{
<add>#ifndef %s
<add> (void) %s;
<add>#endif
<add> ;
<add> return 0;
<add>}""" % (symbol, symbol)
<add>
<add> return "\n".join([includes, main_src])
<add>
<ide> def generate_config_h(ext, build_dir):
<ide> target = join(build_dir,'config.h')
<ide> if newer(__file__,target):
<ide> def generate_config_h(ext, build_dir):
<ide> raise SystemError,"Failed to test configuration. "\
<ide> "See previous error messages for more information."
<ide>
<del> # Python 2.3 causes a segfault when
<del> # trying to re-acquire the thread-state
<del> # which is done in error-handling
<del> # ufunc code. NPY_ALLOW_C_API and friends
<del> # cause the segfault. So, we disable threading
<del> # for now.
<add> def test_declaration(symbol, includes = ""):
<add> code = generate_declaration_test(symbol, includes)
<add> result = config_cmd.try_run(code, include_dirs = [python_include],
<add> library_dirs = default_lib_dirs)
<add> return result
<add>
<add> # Python 2.3 causes a segfault when
<add> # trying to re-acquire the thread-state
<add> # which is done in error-handling
<add> # ufunc code. NPY_ALLOW_C_API and friends
<add> # cause the segfault. So, we disable threading
<add> # for now.
<ide> if sys.version[:5] < '2.4.2':
<ide> nosmp = 1
<ide> else: | 1 |
Javascript | Javascript | prevent race condition with nganimate | 8366622bed009d2cad7d0cff28b9c1e48bfbd4e1 | <ide><path>src/ngMessages/messages.js
<ide> angular.module('ngMessages', [])
<ide> controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {
<ide> var ctrl = this;
<ide> var latestKey = 0;
<add> var nextAttachId = 0;
<add>
<add> this.getAttachId = function getAttachId() { return nextAttachId++; };
<ide>
<ide> var messages = this.messages = {};
<ide> var renderLater, cachedCollection;
<ide> function ngMessageDirectiveFactory(restrict) {
<ide> $animate.enter(elm, null, element);
<ide> currentElement = elm;
<ide>
<add> // Each time we attach this node to a message we get a new id that we can match
<add> // when we are destroying the node later.
<add> var $$attachId = currentElement.$$attachId = ngMessagesCtrl.getAttachId();
<add>
<ide> // in the event that the parent element is destroyed
<ide> // by any other structural directive then it's time
<ide> // to deregister the message from the controller
<ide> currentElement.on('$destroy', function() {
<del> if (currentElement) {
<add> if (currentElement && currentElement.$$attachId === $$attachId) {
<ide> ngMessagesCtrl.deregister(commentNode);
<ide> messageCtrl.detach();
<ide> }
<ide><path>test/ngMessages/messagesSpec.js
<ide> describe('ngMessages', function() {
<ide> expect(trim(element.text())).toEqual("Enter something");
<ide> }));
<ide>
<add> // issue #12856
<add> it('should only detach the message object that is associated with the message node being removed',
<add> inject(function($rootScope, $compile, $animate) {
<add>
<add> // We are going to spy on the `leave` method to give us control over
<add> // when the element is actually removed
<add> spyOn($animate, 'leave');
<add>
<add> // Create a basic ng-messages set up
<add> element = $compile('<div ng-messages="col">' +
<add> ' <div ng-message="primary">Enter something</div>' +
<add> '</div>')($rootScope);
<add>
<add> // Trigger the message to be displayed
<add> $rootScope.col = { primary: true };
<add> $rootScope.$digest();
<add> expect(messageChildren(element).length).toEqual(1);
<add> var oldMessageNode = messageChildren(element)[0];
<add>
<add> // Remove the message
<add> $rootScope.col = { primary: undefined };
<add> $rootScope.$digest();
<add>
<add> // Since we have spied on the `leave` method, the message node is still in the DOM
<add> expect($animate.leave).toHaveBeenCalledOnce();
<add> var nodeToRemove = $animate.leave.mostRecentCall.args[0][0];
<add> expect(nodeToRemove).toBe(oldMessageNode);
<add> $animate.leave.reset();
<add>
<add> // Add the message back in
<add> $rootScope.col = { primary: true };
<add> $rootScope.$digest();
<add>
<add> // Simulate the animation completing on the node
<add> jqLite(nodeToRemove).remove();
<add>
<add> // We should not get another call to `leave`
<add> expect($animate.leave).not.toHaveBeenCalled();
<add>
<add> // There should only be the new message node
<add> expect(messageChildren(element).length).toEqual(1);
<add> var newMessageNode = messageChildren(element)[0];
<add> expect(newMessageNode).not.toBe(oldMessageNode);
<add> }));
<ide>
<ide> it('should render animations when the active/inactive classes are added/removed', function() {
<ide> module('ngAnimate'); | 2 |
Javascript | Javascript | add viewconfig to rctslider component, fix | c9960817eea008b2703657066212002557e0d939 | <ide><path>Examples/UIExplorer/js/RTLExample.js
<ide> const {
<ide> const UIExplorerPage = require('./UIExplorerPage');
<ide> const UIExplorerBlock = require('./UIExplorerBlock');
<ide>
<del>const AnimatedImage = Animated.createAnimatedComponent(Image);
<del>
<ide> type State = {
<ide> toggleStatus: any,
<ide> pan: Object,
<ide> function AnimationBlock(props) {
<ide> return (
<ide> <View style={styles.block}>
<ide> <TouchableWithoutFeedback onPress={props.onPress}>
<del> <AnimatedImage
<add> <Animated.Image
<ide> style={[styles.img, props.imgStyle]}
<ide> source={require('./Thumbnails/poke.png')}
<ide> />
<ide><path>Libraries/Animated/src/AnimatedImplementation.js
<ide> function createAnimatedComponent(Component: any): any {
<ide> var callback = () => {
<ide> if (this._component.setNativeProps) {
<ide> if (!this._propsAnimated.__isNative) {
<add> if (this._component.viewConfig == null) {
<add> var ctor = this._component.constructor;
<add> var componentName = ctor.displayName || ctor.name || '<Unknown Component>';
<add> throw new Error(componentName + ' "viewConfig" is not defined.');
<add> }
<add>
<ide> this._component.setNativeProps(
<ide> this._propsAnimated.__getAnimatedValue()
<ide> );
<ide><path>Libraries/Components/Slider/Slider.js
<ide>
<ide> var Image = require('Image');
<ide> var NativeMethodsMixin = require('react/lib/NativeMethodsMixin');
<add>var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
<ide> var Platform = require('Platform');
<ide> var PropTypes = require('react/lib/ReactPropTypes');
<ide> var React = require('React');
<ide> var Slider = React.createClass({
<ide> };
<ide> },
<ide>
<add> viewConfig: {
<add> uiViewClassName: 'RCTSlider',
<add> validAttributes: {
<add> ...ReactNativeViewAttributes.RCTView,
<add> value: true
<add> }
<add> },
<add>
<ide> render: function() {
<ide> const {style, onValueChange, onSlidingComplete, ...props} = this.props;
<ide> props.style = [styles.slider, style]; | 3 |
PHP | PHP | fix a styling issue | 1bcad051b668b06ba3366560242d4f112e3a1860 | <ide><path>src/Illuminate/Database/Schema/Builder.php
<ide> public function blueprintResolver(Closure $resolver)
<ide> *
<ide> * @param string $class
<ide> * @param string $name
<del> * @param string $type
<add> * @param string $type
<ide> * @return void
<ide> *
<ide> * @throws \Doctrine\DBAL\DBALException
<ide><path>src/Illuminate/Database/Schema/MySqlBuilder.php
<ide> class MySqlBuilder extends Builder
<ide> /**
<ide> * MySqlBuilder constructor.
<ide> *
<del> * @param Connection $connection
<del> *
<add> * @param \Illuminate\Database\Connection $connection
<ide> * @throws \Doctrine\DBAL\DBALException
<ide> */
<ide> public function __construct(Connection $connection)
<ide><path>src/Illuminate/Database/Schema/Types/TinyInteger.php
<ide> class TinyInteger extends Type
<ide> * Gets the SQL declaration snippet for a field of this type.
<ide> *
<ide> * @param array $fieldDeclaration
<del> * @param AbstractPlatform $platform
<add> * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
<ide> * @return string
<ide> */
<ide> public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) | 3 |
Ruby | Ruby | add some tests, yay! | a328f2ffd2d7764c92c87505d0b43f9e3a8c8f28 | <ide><path>actionpack/test/routing/helper_test.rb
<add>require 'abstract_unit'
<add>
<add>module ActionDispatch
<add> module Routing
<add> class HelperTest < ActiveSupport::TestCase
<add> class Duck
<add> def to_param
<add> nil
<add> end
<add> end
<add>
<add> def test_exception
<add> rs = ::ActionDispatch::Routing::RouteSet.new
<add> rs.draw do
<add> resources :ducks do
<add> member do
<add> get :pond
<add> end
<add> end
<add> end
<add>
<add> x = Class.new {
<add> include rs.url_helpers
<add> }
<add> assert_raises ActionController::RoutingError do
<add> x.new.pond_duck_path Duck.new
<add> end
<add> end
<add> end
<add> end
<add>end | 1 |
Text | Text | correct broken link to npm | ff70ae633d1a4c55a6462686072624a53dfe7a4f | <ide><path>docs/packages/authoring-packages.md
<ide> on creating your first package.
<ide>
<ide> ## package.json
<ide>
<del>Similar to [npm packages](http://en.wikipedia.org/wiki/Npm_(software), Atom packages
<add>Similar to [npm packages](http://en.wikipedia.org/wiki/Npm_(software\)), Atom packages
<ide> can contain a _package.json_ file in their top-level directory. This file contains metadata
<ide> about the package, such as the path to its "main" module, library dependencies,
<ide> and manifests specifying the order in which its resources should be loaded. | 1 |
Javascript | Javascript | fix a typo | 2d414fbaeee4fd1f9568d2343e5ac0c5b2d7a8a6 | <ide><path>src/ngComponentRouter/Router.js
<ide> * @name RouteDefinition
<ide> * @description
<ide> *
<del> * Each item in a the **RouteConfig** for a **Routing Component** is an instance of
<add> * Each item in the **RouteConfig** for a **Routing Component** is an instance of
<ide> * this type. It can have the following properties:
<ide> *
<ide> * * `path` or (`regex` and `serializer) - defines how to recognize and generate this route | 1 |
Javascript | Javascript | fix url prop override | 1d884efe78bbe3989e8a9381208895b738128129 | <ide><path>lib/app.js
<ide> export default class App extends Component {
<ide> const {router, Component, pageProps} = this.props
<ide> const url = createUrl(router)
<ide> return <Container>
<del> <Component url={url} {...pageProps} />
<add> <Component {...pageProps} url={url} />
<ide> </Container>
<ide> }
<ide> }
<ide><path>test/integration/basic/pages/url-prop-override.js
<add>import React from 'react'
<add>export default class extends React.Component {
<add> static getInitialProps () {
<add> return {
<add> url: 'test' // This gets overridden by Next in lib/_app.js
<add> }
<add> }
<add> render () {
<add> const {url} = this.props
<add> return <div>
<add> <p id='pathname'>{url.pathname}</p>
<add> <p id='query'>{Object.keys(url.query).length}</p>
<add> <p id='aspath'>{url.asPath}</p>
<add> </div>
<add> }
<add>}
<ide><path>test/integration/basic/pages/url-prop.js
<add>export default ({url}) => {
<add> return <div>
<add> <p id='pathname'>{url.pathname}</p>
<add> <p id='query'>{Object.keys(url.query).length}</p>
<add> <p id='aspath'>{url.asPath}</p>
<add> </div>
<add>}
<ide><path>test/integration/basic/test/index.test.js
<ide> describe('Basic Features', () => {
<ide> renderViaHTTP(context.appPort, '/custom-extension'),
<ide> renderViaHTTP(context.appPort, '/styled-jsx'),
<ide> renderViaHTTP(context.appPort, '/with-cdm'),
<add> renderViaHTTP(context.appPort, '/url-prop'),
<add> renderViaHTTP(context.appPort, '/url-prop-override'),
<ide>
<ide> renderViaHTTP(context.appPort, '/nav'),
<ide> renderViaHTTP(context.appPort, '/nav/about'),
<ide><path>test/integration/basic/test/rendering.js
<ide> export default function ({ app }, suiteName, render, fetch) {
<ide> expect($('.as-path-content').text()).toBe('/nav/as-path?aa=10')
<ide> })
<ide>
<add> describe('Url prop', () => {
<add> it('should provide pathname, query and asPath', async () => {
<add> const $ = await get$('/url-prop')
<add> expect($('#pathname').text()).toBe('/url-prop')
<add> expect($('#query').text()).toBe('0')
<add> expect($('#aspath').text()).toBe('/url-prop')
<add> })
<add>
<add> it('should override props.url, even when getInitialProps returns url as property', async () => {
<add> const $ = await get$('/url-prop-override')
<add> expect($('#pathname').text()).toBe('/url-prop-override')
<add> expect($('#query').text()).toBe('0')
<add> expect($('#aspath').text()).toBe('/url-prop-override')
<add> })
<add> })
<add>
<ide> describe('404', () => {
<ide> it('should 404 on not existent page', async () => {
<ide> const $ = await get$('/non-existent') | 5 |
Javascript | Javascript | add kiwiship app | 216cbb40656442dae5b4df6fb27822d5618f5606 | <ide><path>website/src/react-native/showcase.js
<ide> var apps = [
<ide> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.kakaponative',
<ide> author: 'Daniel Levitt',
<ide> },
<add> {
<add> name: 'Kiwiship',
<add> icon: 'http://a1.mzstatic.com/us/r30/Purple4/v4/c2/92/d0/c292d053-72fd-c429-dd58-5b0ae9d75af1/icon175x175.jpeg',
<add> link: 'https://www.kiwiship.com',
<add> author: 'Kiwiship'
<add> },
<ide> {
<ide> name: 'Koza Gujarati Dictionary',
<ide> icon: 'http://a1.mzstatic.com/us/r30/Purple69/v4/77/95/83/77958377-05ae-4754-684a-3c9dbb67b517/icon175x175.jpeg', | 1 |
Text | Text | remove misleading class [ci skip] | 872b6cc986af437fda117b49bb539f40927f3f49 | <ide><path>guides/source/contributing_to_ruby_on_rails.md
<ide> Rails follows a simple set of coding style conventions:
<ide> * Use Ruby >= 1.9 syntax for hashes. Prefer `{ a: :b }` over `{ :a => :b }`.
<ide> * Prefer `&&`/`||` over `and`/`or`.
<ide> * Prefer class << self over self.method for class methods.
<del>* Use `MyClass.my_method(my_arg)` not `my_method( my_arg )` or `my_method my_arg`.
<add>* Use `my_method(my_arg)` not `my_method( my_arg )` or `my_method my_arg`.
<ide> * Use `a = b` and not `a=b`.
<ide> * Use assert_not methods instead of refute.
<ide> * Prefer `method { do_stuff }` instead of `method{do_stuff}` for single-line blocks. | 1 |
Javascript | Javascript | add a global promise polyfill. | 62fcb2b664c27689d565d6709f83c6ac322a9a7c | <ide><path>client/index.js
<ide> import App from '../lib/app'
<ide> import evalScript from '../lib/eval-script'
<ide> import { loadGetInitialProps, getURL } from '../lib/utils'
<ide>
<add>// Polyfill Promise globally
<add>// This is needed because Webpack2's dynamic loading(common chunks) code
<add>// depends on Promise.
<add>// So, we need to polyfill it.
<add>// See: https://github.com/webpack/webpack/issues/4254
<add>if (!window.Promise) {
<add> window.Promise = Promise
<add>}
<add>
<ide> const {
<ide> __NEXT_DATA__: {
<ide> component, | 1 |
PHP | PHP | add doc block | 464ddd66543d500efb63a6e52a5cffe7d5cabd9d | <ide><path>src/Illuminate/Routing/Route.php
<ide> public function bindingFieldFor($parameter)
<ide> return $this->bindingFields[$parameter] ?? null;
<ide> }
<ide>
<add> /**
<add> * Get the parent parameter of the given parameter.
<add> *
<add> * @param string $parameter
<add> * @return string
<add> */
<ide> public function parentOfParameter($parameter)
<ide> {
<ide> $key = array_search($parameter, array_keys($this->parameters)); | 1 |
Javascript | Javascript | move qpl to oss | 8a638d8e58c87685422fc748b372dc5d13a6b03a | <ide><path>Libraries/QuickPerformanceLogger/QuickPerformanceLogger.js
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> *
<add> * @providesModule QuickPerformanceLogger
<add> */
<add>
<add>'use strict';
<add>
<add>var fixOpts = function(opts) {
<add> var AUTO_SET_TIMESTAMP = -1;
<add> var DUMMY_INSTANCE_KEY = 0;
<add> opts = opts || {};
<add> opts.instanceKey = opts.instanceKey || DUMMY_INSTANCE_KEY;
<add> opts.timestamp = opts.timestamp || AUTO_SET_TIMESTAMP;
<add> return opts;
<add>};
<add>
<add>var QuickPerformanceLogger = {
<add>
<add> // These two empty containers will cause all calls to ActionId.SOMETHING or MarkerId.OTHER
<add> // to equal 'undefined', unless they are given a concrete value elsewhere.
<add> ActionId: {},
<add> MarkerId: {},
<add>
<add> markerStart(markerId, opts) {
<add> if (markerId === undefined) {
<add> return;
<add> }
<add> if (global.nativeQPLMarkerStart) {
<add> opts = fixOpts(opts);
<add> global.nativeQPLMarkerStart(markerId, opts.instanceKey, opts.timestamp);
<add> }
<add> },
<add>
<add> markerEnd(markerId, actionId, opts) {
<add> if (markerId === undefined || actionId === undefined) {
<add> return;
<add> }
<add> if (global.nativeQPLMarkerEnd) {
<add> opts = fixOpts(opts);
<add> global.nativeQPLMarkerEnd(markerId, opts.instanceKey, actionId, opts.timestamp);
<add> }
<add> },
<add>
<add> markerNote(markerId, actionId, opts) {
<add> if (markerId === undefined || actionId === undefined) {
<add> return;
<add> }
<add> if (global.nativeQPLMarkerNote) {
<add> opts = fixOpts(opts);
<add> global.nativeQPLMarkerNote(markerId, opts.instanceKey, actionId, opts.timestamp);
<add> }
<add> },
<add>
<add> markerCancel(markerId, opts) {
<add> if (markerId === undefined) {
<add> return;
<add> }
<add> if (global.nativeQPLMarkerCancel) {
<add> opts = fixOpts(opts);
<add> global.nativeQPLMarkerCancel(markerId, opts.instanceKey);
<add> }
<add> },
<add>
<add> currentTimestamp() {
<add> if (global.nativeQPLTimestamp) {
<add> return global.nativeQPLTimestamp();
<add> }
<add> return 0;
<add> },
<add>
<add>};
<add>
<add>module.exports = QuickPerformanceLogger; | 1 |
Ruby | Ruby | collapse indeces per jeremy | 212f925654f944067f18429ca02d902473214722 | <ide><path>lib/active_storage/migration.rb
<ide> def change
<ide> t.datetime :created_at
<ide>
<ide> t.index :blob_id
<del> t.index [ :record_type, :record_id ]
<del> t.index [ :record_type, :record_id, :name ], name: "index_active_storage_attachments_record_and_name"
<del> t.index [ :record_type, :record_id, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
<add> t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
<ide> end
<ide> end
<ide> end | 1 |
PHP | PHP | add a null caching engine | 05d8a193c006eec84b81d16e158fa476d0a0501f | <ide><path>src/Cache/Cache.php
<ide> namespace Cake\Cache;
<ide>
<ide> use Cake\Core\StaticConfigTrait;
<add>use Cake\Cache\Engine\NullEngine;
<ide> use Cake\Error;
<ide>
<ide> /**
<ide> protected static function _buildEngine($name) {
<ide> * triggered.
<ide> *
<ide> * @param string $config The configuration name you want an engine for.
<del> * @return \Cake\Cache\CacheEngine
<add> * @return \Cake\Cache\CacheEngine When caching is diabled a null engine will be returned.
<ide> */
<ide> public static function engine($config) {
<ide> if (!static::$_enabled) {
<del> return false;
<add> return new NullEngine();
<ide> }
<ide>
<ide> if (isset(static::$_registry->{$config})) {
<ide> public static function engine($config) {
<ide> */
<ide> public static function gc($config = 'default', $expires = null) {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return;
<del> }
<del>
<ide> $engine->gc($expires);
<ide> }
<ide>
<ide> public static function gc($config = 'default', $expires = null) {
<ide> */
<ide> public static function write($key, $value, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine || is_resource($value)) {
<add> if (is_resource($value)) {
<ide> return false;
<ide> }
<ide>
<ide> public static function write($key, $value, $config = 'default') {
<ide> */
<ide> public static function writeMany($data, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> $return = $engine->writeMany($data);
<ide> foreach ($return as $key => $success) {
<ide> if ($success === false && !empty($data[$key])) {
<ide> public static function writeMany($data, $config = 'default') {
<ide> */
<ide> public static function read($key, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> return $engine->read($key);
<ide> }
<ide>
<ide> public static function read($key, $config = 'default') {
<ide> */
<ide> public static function readMany($keys, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> return $engine->readMany($keys);
<ide> }
<ide>
<ide> public static function readMany($keys, $config = 'default') {
<ide> */
<ide> public static function increment($key, $offset = 1, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine || !is_int($offset) || $offset < 0) {
<add> if (!is_int($offset) || $offset < 0) {
<ide> return false;
<ide> }
<ide>
<ide> public static function increment($key, $offset = 1, $config = 'default') {
<ide> */
<ide> public static function decrement($key, $offset = 1, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine || !is_int($offset) || $offset < 0) {
<add> if (!is_int($offset) || $offset < 0) {
<ide> return false;
<ide> }
<ide>
<ide> public static function decrement($key, $offset = 1, $config = 'default') {
<ide> */
<ide> public static function delete($key, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> return $engine->delete($key);
<ide> }
<ide>
<ide> public static function delete($key, $config = 'default') {
<ide> */
<ide> public static function deleteMany($keys, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> return $engine->deleteMany($keys);
<ide> }
<ide>
<ide> public static function deleteMany($keys, $config = 'default') {
<ide> */
<ide> public static function clear($check = false, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> return $engine->clear($check);
<ide> }
<ide>
<ide> public static function clear($check = false, $config = 'default') {
<ide> */
<ide> public static function clearGroup($group, $config = 'default') {
<ide> $engine = static::engine($config);
<del> if (!$engine) {
<del> return false;
<del> }
<del>
<ide> return $engine->clearGroup($group);
<ide> }
<ide>
<ide><path>src/Cache/Engine/NullEngine.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.0.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Cache\Engine;
<add>
<add>use Cake\Cache\CacheEngine;
<add>
<add>/**
<add> * Null cache engine, all operations return false.
<add> *
<add> * This is used internally for when Cache::disable() has been called.
<add> */
<add>class NullEngine extends CacheEngine {
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function init(array $config = []) {
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function gc($expires = null) {
<add> return false;
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function write($key, $value) {
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function writeMany($data) {
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function read($key) {
<add> return false;
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function readMany($keys) {
<add> return false;
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function increment($key, $offset = 1) {
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function decrement($key, $offset = 1) {
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function delete($key) {
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function deleteMany($keys) {
<add> return false;
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function clear($check) {
<add> return false;
<add> }
<add>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function clearGroup($group) {
<add> return false;
<add> }
<add>
<add>}
<ide><path>tests/TestCase/Cache/CacheTest.php
<ide> public function testNonFatalErrorsWithCachedisable() {
<ide> Cache::delete('no_save', 'tests');
<ide> }
<ide>
<add>/**
<add> * Check that a null instance is returned from engine() when caching is disabled.
<add> *
<add> * @return void
<add> */
<add> public function testNullEngineWhenCacheDisable() {
<add> $this->_configCache();
<add> Cache::disable();
<add>
<add> $result = Cache::engine('tests');
<add> $this->assertInstanceOf('Cake\Cache\Engine\NullEngine', $result);
<add> }
<add>
<ide> /**
<ide> * test configuring CacheEngines in App/libs
<ide> *
<ide> public function testCacheDisable() {
<ide>
<ide> Cache::disable();
<ide>
<del> $this->assertFalse(Cache::write('key_2', 'hello', 'test_cache_disable_1'));
<add> $this->assertNull(Cache::write('key_2', 'hello', 'test_cache_disable_1'));
<ide> $this->assertFalse(Cache::read('key_2', 'test_cache_disable_1'));
<ide>
<ide> Cache::enable();
<ide> public function testCacheDisable() {
<ide> 'path' => TMP . 'tests'
<ide> ]);
<ide>
<del> $this->assertFalse(Cache::write('key_4', 'hello', 'test_cache_disable_2'));
<add> $this->assertNull(Cache::write('key_4', 'hello', 'test_cache_disable_2'));
<ide> $this->assertFalse(Cache::read('key_4', 'test_cache_disable_2'));
<ide>
<ide> Cache::enable();
<ide> public function testCacheDisable() {
<ide> $this->assertSame(Cache::read('key_5', 'test_cache_disable_2'), 'hello');
<ide>
<ide> Cache::disable();
<del> $this->assertFalse(Cache::write('key_6', 'hello', 'test_cache_disable_2'));
<add> $this->assertNull(Cache::write('key_6', 'hello', 'test_cache_disable_2'));
<ide> $this->assertFalse(Cache::read('key_6', 'test_cache_disable_2'));
<ide>
<ide> Cache::enable(); | 3 |
Java | Java | remove isolated use of reactor buffer | 382c98f9680fab9a0c2ad50de18e3385f9cba5c1 | <ide><path>spring-web-reactive/src/main/java/org/springframework/http/server/servlet31/ResponseBodySubscriber.java
<ide> import org.apache.commons.logging.LogFactory;
<ide> import org.reactivestreams.Subscriber;
<ide> import org.reactivestreams.Subscription;
<del>import reactor.io.buffer.Buffer;
<ide>
<ide> import org.springframework.util.Assert;
<ide>
<ide> public void onWritePossible() throws IOException {
<ide>
<ide> if (ready) {
<ide> if (this.buffer != null) {
<del> output.write(new Buffer(this.buffer).asBytes());
<add> byte[] bytes = new byte[this.buffer.remaining()];
<add> this.buffer.get(bytes);
<ide> this.buffer = null;
<del>
<add> output.write(bytes);
<ide> if (!subscriberComplete) {
<ide> this.subscription.request(1);
<ide> } | 1 |
PHP | PHP | add expectevents method | a8be30e6411cdfe97d13abd497cc267ba911aae7 | <ide><path>src/Illuminate/Foundation/Testing/ApplicationTrait.php
<ide> protected function refreshApplication()
<ide> $this->app = $this->createApplication();
<ide> }
<ide>
<add> /**
<add> * Specify a list of events that should be fired for the given operation.
<add> *
<add> * These events will be mocked, so that handlers will not actually be executed.
<add> *
<add> * @param array|dynamic $events
<add> * @return $this
<add> */
<add> public function expectEvents($events)
<add> {
<add> $events = is_array($events) ? $events : func_get_args();
<add>
<add> $mock = Mockery::mock('Illuminate\Contracts\Events\Dispatcher');
<add>
<add> $mock->shouldIgnoreMissing();
<add>
<add> foreach ($events as $event) {
<add> $mock->shouldReceive('fire')->atLeast()->once()
<add> ->with(Mockery::type($event), [], false);
<add> }
<add>
<add> $this->app->instance('events', $mock);
<add>
<add> return $this;
<add> }
<add>
<ide> /**
<ide> * Mock the event dispatcher so all events are silenced.
<ide> * | 1 |
Text | Text | add link to sem-ver info | 6bcea0a38365f518580a4dbbf2f5627bede5aac5 | <ide><path>doc/api/documentation.md
<ide> The stability indices are as follows:
<ide>
<ide> <!-- separator -->
<ide>
<del>> Stability: 1 - Experimental. The feature is not subject to Semantic Versioning
<del>> rules. Non-backward compatible changes or removal may occur in any future
<del>> release. Use of the feature is not recommended in production environments.
<add>> Stability: 1 - Experimental. The feature is not subject to
<add>> [Semantic Versioning][] rules. Non-backward compatible changes or removal may
<add>> occur in any future release. Use of the feature is not recommended in
<add>> production environments.
<ide>
<ide> <!-- separator -->
<ide>
<ide> to the corresponding man pages which describe how the system call works.
<ide> Most Unix system calls have Windows analogues. Still, behavior differences may
<ide> be unavoidable.
<ide>
<add>[Semantic Versioning]: https://semver.org/
<ide> [the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
<ide> [the issue tracker]: https://github.com/nodejs/node/issues/new
<ide> [V8 JavaScript engine]: https://v8.dev/ | 1 |
Python | Python | add test for ticket | 9b354f4dc00e3aef4cfceae71be60b1dc60a1927 | <ide><path>numpy/ma/tests/test_regression.py
<ide> def test_masked_array_repr_unicode(self):
<ide> """Ticket #1256"""
<ide> repr(np.ma.array(u"Unicode"))
<ide>
<add> def test_atleast_2d(self):
<add> """Ticket #1559"""
<add> a = np.ma.masked_array([0.0, 1.2, 3.5], mask=[False, True, False])
<add> b = np.atleast_2d(a)
<add> assert_(a.mask.ndim == 1)
<add> assert_(b.mask.ndim == 2)
<add>
<add>
<add>if __name__ == "__main__":
<add> run_module_suite() | 1 |
Javascript | Javascript | exclude less from snapshot | 7fbe68e12e9332b46ebe552711550637f523b953 | <ide><path>script/lib/generate-startup-snapshot.js
<ide> module.exports = function (packagedAppPath) {
<ide> relativePath == path.join('..', 'node_modules', 'htmlparser2', 'lib', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'iconv-lite', 'encodings', 'internal.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'iconv-lite', 'encodings', 'index.js') ||
<del> relativePath == path.join('..', 'node_modules', 'less', 'lib', 'less', 'index.js') ||
<add> relativePath == path.join('..', 'node_modules', 'less', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'less', 'lib', 'less', 'fs.js') ||
<add> relativePath == path.join('..', 'node_modules', 'less', 'lib', 'less-node', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'less', 'node_modules', 'graceful-fs', 'graceful-fs.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'marker-index', 'dist', 'native', 'marker-index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'superstring', 'index.js') || | 1 |
Javascript | Javascript | stringify module name using json module | 28d06932892d4d96f4bb62f7e6213839564511cf | <ide><path>lib/dependencies/AMDDefineDependency.js
<ide> AMDDefineDependency.Template = class AMDDefineDependencyTemplate {
<ide> ],
<ide> lf: [
<ide> "var XXX, XXXmodule;",
<del> "!(XXXmodule = { id: 'YYY', exports: {}, loaded: false }, XXX = #.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))"
<add> "!(XXXmodule = { id: YYY, exports: {}, loaded: false }, XXX = #.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule), XXXmodule.loaded = true, XXX === undefined && (XXX = XXXmodule.exports))"
<ide> ],
<ide> lo: [
<ide> "var XXX;",
<ide> "!(XXX = #)"
<ide> ],
<ide> lof: [
<ide> "var XXX, XXXfactory, XXXmodule;",
<del> "!(XXXfactory = (#), (XXXmodule = { id: 'YYY', exports: {}, loaded: false }), XXX = (typeof XXXfactory === 'function' ? (XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)) : XXXfactory), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports))"
<add> "!(XXXfactory = (#), (XXXmodule = { id: YYY, exports: {}, loaded: false }), XXX = (typeof XXXfactory === 'function' ? (XXXfactory.call(XXXmodule.exports, __webpack_require__, XXXmodule.exports, XXXmodule)) : XXXfactory), (XXXmodule.loaded = true), XXX === undefined && (XXX = XXXmodule.exports))"
<ide> ],
<ide> laf: [
<ide> "var __WEBPACK_AMD_DEFINE_ARRAY__, XXX;",
<ide> AMDDefineDependency.Template = class AMDDefineDependencyTemplate {
<ide> }
<ide>
<ide> if(dependency.namedModule) {
<del> text = text.replace(/YYY/g, dependency.namedModule);
<add> text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule));
<ide> }
<ide>
<ide> const texts = text.split("#"); | 1 |
PHP | PHP | convert errors to http exception | d493b629771844b08e51370c75a97afdde988c88 | <ide><path>src/Illuminate/Foundation/Exceptions/Handler.php
<ide> protected function convertValidationExceptionToResponse(ValidationException $e,
<ide> */
<ide> protected function prepareResponse($request, Exception $e)
<ide> {
<del> if ($this->isHttpException($e)) {
<del> return $this->toIlluminateResponse($this->renderHttpException($e), $e);
<del> } else {
<add> if (! $this->isHttpException($e) && config('app.debug')) {
<ide> return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e);
<ide> }
<add>
<add> if (! $this->isHttpException($e)) {
<add> $e = new HttpException(500, $e->getMessage());
<add> }
<add>
<add> return $this->toIlluminateResponse($this->renderHttpException($e), $e);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | add cookie domain to loginbyrequest | 75ac5962e03f03c80bdc52f4a4b8e030a9a6567f | <ide><path>common/models/user.js
<ide> module.exports = function(User) {
<ide> const config = {
<ide> signed: !!req.signedCookies,
<ide> maxAge: accessToken.ttl,
<del> domain: '.freecodecamp.org'
<add> domain: process.env.COOKIE_DOMAIN || 'localhost'
<ide> };
<ide> if (accessToken && accessToken.id) {
<ide> res.cookie('access_token', accessToken.id, config); | 1 |
Javascript | Javascript | fix permanent deopt | fc6f487f2e2eaa54e2de38b1cf9529dec5f8fcd5 | <ide><path>lib/internal/process/warning.js
<ide> function setupProcessWarnings() {
<ide> if (isDeprecation && process.noDeprecation) return;
<ide> const trace = process.traceProcessWarnings ||
<ide> (isDeprecation && process.traceDeprecation);
<del> let msg = `${prefix}`;
<add> var msg = `${prefix}`;
<ide> if (warning.code)
<ide> msg += `[${warning.code}] `;
<ide> if (trace && warning.stack) { | 1 |
Javascript | Javascript | fix performancelogger clearing unfinished events | 005fbe6aa46d6866cb74bb721b310cee05da0103 | <ide><path>Libraries/Utilities/PerformanceLogger.js
<ide> var PerformanceLogger = {
<ide> extras = {};
<ide> },
<ide>
<add> clearCompleted() {
<add> for (var key in timespans) {
<add> if (timespans[key].totalTime) {
<add> delete timespans[key];
<add> }
<add> }
<add> extras = {};
<add> },
<add>
<ide> clearExceptTimespans(keys) {
<ide> timespans = Object.keys(timespans).reduce(function(previous, key) {
<ide> if (keys.indexOf(key) !== -1) { | 1 |
Javascript | Javascript | fix deprecation test messages to {{#each ...}} | 23c36f5181ed00611692003f1fd57cfc1475f0bc | <ide><path>packages/ember-template-compiler/tests/plugins/transform-each-in-to-block-params-test.js
<ide> QUnit.test('cannot use block params and keyword syntax together', function() {
<ide>
<ide> throws(function() {
<ide> compile('{{#each thing in controller as |other-thing|}}{{thing}}-{{other-thing}}{{/each}}', true);
<del> }, /You cannot use keyword \(`{{each foo in bar}}`\) and block params \(`{{each bar as \|foo\|}}`\) at the same time\ ./);
<add> }, /You cannot use keyword \(`{{#each foo in bar}}`\) and block params \(`{{#each bar as \|foo\|}}`\) at the same time\ ./);
<ide> });
<ide>
<del>QUnit.test('using {{each in}} syntax is deprecated for blocks', function() {
<add>QUnit.test('using {{#each in}} syntax is deprecated for blocks', function() {
<ide> expect(1);
<ide>
<ide> expectDeprecation(function() {
<ide> compile('\n\n {{#each foo in model}}{{/each}}', { moduleName: 'foo/bar/baz' });
<del> }, `Using the '{{each item in model}}' form of the {{each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{each model as |item|}}').`);
<add> }, `Using the '{{#each item in model}}' form of the {{#each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{#each model as |item|}}').`);
<ide> });
<ide>
<del>QUnit.test('using {{each in}} syntax is deprecated for non-block statemens', function() {
<add>QUnit.test('using {{#each in}} syntax is deprecated for non-block statemens', function() {
<ide> expect(1);
<ide>
<ide> expectDeprecation(function() {
<ide> compile('\n\n {{each foo in model}}', { moduleName: 'foo/bar/baz' });
<del> }, `Using the '{{each item in model}}' form of the {{each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{each model as |item|}}').`);
<add> }, `Using the '{{#each item in model}}' form of the {{#each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{#each model as |item|}}').`);
<ide> }); | 1 |
Ruby | Ruby | use file.join rather than depend on pathname | 880481a355e0017c43d6ff14b2d1a657548d06bf | <ide><path>railties/lib/rails/commands/server.rb
<ide> def start
<ide>
<ide> #Create required tmp directories if not found
<ide> %w(cache pids sessions sockets).each do |dir_to_make|
<del> FileUtils.mkdir_p(Rails.root.join('tmp', dir_to_make))
<add> FileUtils.mkdir_p(File.join(Rails.root, 'tmp', dir_to_make))
<ide> end
<ide>
<ide> unless options[:daemonize] | 1 |
Javascript | Javascript | update timeline without reload | 6316b47fbbedd52e1678cb94f88d820378da5268 | <ide><path>client/src/redux/index.js
<ide> export const reducer = handleActions(
<ide> }
<ide> }),
<ide> [types.submitComplete]: (state, { payload: { id, challArray } }) => {
<del> let submitedchallneges = [{ id }];
<add> // TODO: possibly more of the payload (files?) should be added
<add> // to the completedChallenges array.
<add> let submittedchallenges = [{ id, completedDate: Date.now() }];
<ide> if (challArray) {
<del> submitedchallneges = challArray;
<add> submittedchallenges = challArray;
<ide> }
<ide> const { appUsername } = state;
<ide> return {
<ide> export const reducer = handleActions(
<ide> ...state.user[appUsername],
<ide> completedChallenges: uniqBy(
<ide> [
<del> ...submitedchallneges,
<add> ...submittedchallenges,
<ide> ...state.user[appUsername].completedChallenges
<ide> ],
<ide> 'id' | 1 |
Python | Python | use pure py3 syntax | dc500ef45a8118eeb39f443e7824dc20ceb3f433 | <ide><path>official/core/base_task.py
<ide> from typing import Any, Callable, Optional
<ide>
<ide> from absl import logging
<del>import six
<ide> import tensorflow as tf
<ide>
<ide> from official.modeling.hyperparams import config_definitions as cfg
<ide>
<ide>
<del>@six.add_metaclass(abc.ABCMeta)
<del>class Task(tf.Module):
<add>class Task(tf.Module, metaclass=abc.ABCMeta):
<ide> """A single-replica view of training procedure.
<ide>
<ide> Tasks provide artifacts for training/evalution procedures, including | 1 |
Javascript | Javascript | remove dead code and simplify args check | a2bed79726f4de893eeac15d0b796103d2c65830 | <ide><path>lib/internal/timers.js
<ide> Timeout.prototype.refresh = function() {
<ide> return this;
<ide> };
<ide>
<del>function setUnrefTimeout(callback, after, arg1, arg2, arg3) {
<add>function setUnrefTimeout(callback, after) {
<ide> // Type checking identical to setTimeout()
<ide> if (typeof callback !== 'function') {
<ide> throw new ERR_INVALID_CALLBACK();
<ide> }
<ide>
<del> let i, args;
<del> switch (arguments.length) {
<del> // fast cases
<del> case 1:
<del> case 2:
<del> break;
<del> case 3:
<del> args = [arg1];
<del> break;
<del> case 4:
<del> args = [arg1, arg2];
<del> break;
<del> default:
<del> args = [arg1, arg2, arg3];
<del> for (i = 5; i < arguments.length; i++) {
<del> // Extend array dynamically, makes .apply run much faster in v6.0.0
<del> args[i - 2] = arguments[i];
<del> }
<del> break;
<del> }
<del>
<del> const timer = new Timeout(callback, after, args, false);
<add> const timer = new Timeout(callback, after, undefined, false);
<ide> getTimers()._unrefActive(timer);
<ide>
<ide> return timer;
<ide><path>lib/timers.js
<ide> function listOnTimeout(list, now) {
<ide>
<ide> try {
<ide> const args = timer._timerArgs;
<del> if (!args)
<add> if (args === undefined)
<ide> timer._onTimeout();
<ide> else
<ide> Reflect.apply(timer._onTimeout, timer, args);
<ide> function setTimeout(callback, after, arg1, arg2, arg3) {
<ide> }
<ide>
<ide> setTimeout[internalUtil.promisify.custom] = function(after, value) {
<add> const args = value !== undefined ? [value] : value;
<ide> return new Promise((resolve) => {
<del> active(new Timeout(resolve, after, [value], false));
<add> active(new Timeout(resolve, after, args, false));
<ide> });
<ide> };
<ide> | 2 |
PHP | PHP | return connect value | f7894e9da7d92de64f2c73eedc78c3a7ed66a740 | <ide><path>src/Illuminate/Remote/SecLibGateway.php
<ide> protected function setHostAndPort($host)
<ide> * Connect to the SSH server.
<ide> *
<ide> * @param string $username
<del> * @return void
<add> * @return bool
<ide> */
<ide> public function connect($username)
<ide> {
<del> $this->getConnection()->login($username, $this->getAuthForLogin());
<add> return $this->getConnection()->login($username, $this->getAuthForLogin());
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | replace var for let / const | df2f4ad22b27bc4cf26e1c5552d037327850bef4 | <ide><path>lib/internal/async_hooks.js
<ide> function getOrSetAsyncId(object) {
<ide> // the user to safeguard this call and make sure it's zero'd out when the
<ide> // constructor is complete.
<ide> function getDefaultTriggerAsyncId() {
<del> var defaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];
<add> let defaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];
<ide> // If defaultTriggerAsyncId isn't set, use the executionAsyncId
<ide> if (defaultTriggerAsyncId < 0)
<ide> defaultTriggerAsyncId = async_id_fields[kExecutionAsyncId];
<ide> function defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) {
<ide> const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];
<ide> async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId;
<ide>
<del> var ret;
<add> let ret;
<ide> try {
<ide> ret = Reflect.apply(block, null, args);
<ide> } finally {
<ide><path>lib/internal/bootstrap_node.js
<ide> const fs = NativeModule.require('fs');
<ide> // read the source
<ide> const filename = Module._resolveFilename(process.argv[1]);
<del> var source = fs.readFileSync(filename, 'utf-8');
<add> const source = fs.readFileSync(filename, 'utf-8');
<ide> checkScriptSyntax(source, filename);
<ide> process.exit(0);
<ide> }
<ide> // Read all of stdin - execute it.
<ide> process.stdin.setEncoding('utf8');
<ide>
<del> var code = '';
<add> let code = '';
<ide> process.stdin.on('data', function(d) {
<ide> code += d;
<ide> });
<ide> const versionTypes = icu.getVersion().split(',');
<ide>
<ide> for (var n = 0; n < versionTypes.length; n++) {
<del> var name = versionTypes[n];
<add> const name = versionTypes[n];
<ide> const version = icu.getVersion(name);
<ide> Object.defineProperty(process.versions, name, {
<ide> writable: false,
<ide> ];
<ide>
<ide> NativeModule.prototype.compile = function() {
<del> var source = NativeModule.getSource(this.id);
<add> let source = NativeModule.getSource(this.id);
<ide> source = NativeModule.wrap(source);
<ide>
<ide> this.loading = true;
<ide><path>lib/internal/readline.js
<ide> const ansi =
<ide>
<ide> const kEscape = '\x1b';
<ide>
<del>var getStringWidth;
<del>var isFullWidthCodePoint;
<add>let getStringWidth;
<add>let isFullWidthCodePoint;
<ide>
<ide> function CSI(strings, ...args) {
<ide> let ret = `${kEscape}[`; | 3 |
Javascript | Javascript | retool challenge framework | ee8ac7b4538473504fa9f1153f03ebb81be9f45e | <ide><path>client/frame-runner.js
<ide> document.addEventListener('DOMContentLoaded', function() {
<ide> const newTest = { text, testString };
<ide> let test;
<ide> let __result;
<add>
<add> // uncomment the following line to inspect
<add> // the framerunner as it runs tests
<add> // make sure the dev tools console is open
<add> // debugger;
<ide> try {
<ide> /* eslint-disable no-eval */
<ide> // eval test string to actual JavaScript
<ide><path>client/rechallenge/builders.js
<add>import { Observable } from 'rx';
<add>import cond from 'lodash/cond';
<add>import flow from 'lodash/flow';
<add>import identity from 'lodash/identity';
<add>import matchesProperty from 'lodash/matchesProperty';
<add>import partial from 'lodash/partial';
<add>import stubTrue from 'lodash/stubTrue';
<add>
<add>import {
<add> compileHeadTail,
<add> setExt,
<add> transformContents
<add>} from '../../common/utils/polyvinyl';
<add>import {
<add> fetchScript,
<add> fetchLink
<add>} from '../utils/fetch-and-cache.js';
<add>
<add>const htmlCatch = '\n<!--fcc-->\n';
<add>const jsCatch = '\n;/*fcc*/\n';
<add>
<add>const wrapInScript = partial(transformContents, (content) => (
<add> `${htmlCatch}<script>${content}${jsCatch}</script>`
<add>));
<add>const wrapInStyle = partial(transformContents, (content) => (
<add> `${htmlCatch}<style>${content}</style>`
<add>));
<add>const setExtToHTML = partial(setExt, 'html');
<add>const padContentWithJsCatch = partial(compileHeadTail, jsCatch);
<add>const padContentWithHTMLCatch = partial(compileHeadTail, htmlCatch);
<add>
<add>export const jsToHtml = cond([
<add> [
<add> matchesProperty('ext', 'js'),
<add> flow(padContentWithJsCatch, wrapInScript, setExtToHTML)
<add> ],
<add> [ stubTrue, identity ]
<add>]);
<add>
<add>export const cssToHtml = cond([
<add> [
<add> matchesProperty('ext', 'css'),
<add> flow(padContentWithHTMLCatch, wrapInStyle, setExtToHTML)
<add> ],
<add> [ stubTrue, identity ]
<add>]);
<add>
<add>// FileStream::concactHtml(
<add>// required: [ ...Object ]
<add>// ) => Observable[{ build: String, sources: Dictionary }]
<add>export function concactHtml(required) {
<add> const source = this.shareReplay();
<add> const sourceMap = source
<add> .flatMap(files => files.reduce((sources, file) => {
<add> sources[file.name] = file.source || file.contents;
<add> return sources;
<add> }, {}));
<add>
<add> const head = Observable.from(required)
<add> .flatMap(required => {
<add> if (required.src) {
<add> return fetchScript(required);
<add> }
<add> if (required.link) {
<add> return fetchLink(required);
<add> }
<add> return Observable.just('');
<add> })
<add> .reduce((head, required) => head + required, '')
<add> .map(head => `<head>${head}</head>`);
<add>
<add> const body = source
<add> .flatMap(file => file.reduce((body, file) => {
<add> return body + file.contents + htmlCatch;
<add> }, ''))
<add> .map(source => `
<add> <body style='margin:8px;'>
<add> <!-- fcc-start-source -->
<add> ${source}
<add> <!-- fcc-end-source -->
<add> </body>
<add> `);
<add>
<add> return Observable
<add> .combineLatest(
<add> head,
<add> body,
<add> fetchScript({
<add> src: '/js/frame-runner.js',
<add> crossDomain: false,
<add> cacheBreaker: true
<add> }),
<add> sourceMap,
<add> (head, body, frameRunner, sources) => ({
<add> build: head + body + frameRunner,
<add> sources
<add> })
<add> );
<add>}
<ide><path>client/rechallenge/throwers.js
<del>import { helpers, Observable } from 'rx';
<add>import { Observable } from 'rx';
<add>import cond from 'lodash/cond';
<add>import identity from 'lodash/identity';
<add>import stubTrue from 'lodash/stubTrue';
<add>import conforms from 'lodash/conforms';
<ide>
<del>const throwForJsHtml = {
<del> ext: /js|html/,
<del> throwers: [
<del> {
<del> name: 'multiline-comment',
<del> description: 'Detect if a JS multi-line comment is left open',
<del> thrower: function checkForComments({ contents }) {
<del> const openingComments = contents.match(/\/\*/gi);
<del> const closingComments = contents.match(/\*\//gi);
<del> if (
<del> openingComments &&
<del> (!closingComments || openingComments.length > closingComments.length)
<del> ) {
<del> throw new Error('SyntaxError: Unfinished multi-line comment');
<del> }
<add>import castToObservable from '../../common/app/utils/cast-to-observable.js';
<add>
<add>const HTML$JSReg = /html|js/;
<add>
<add>const testHTMLJS = conforms({ ext: (ext) => HTML$JSReg.test(ext) });
<add>// const testJS = matchesProperty('ext', 'js');
<add>const passToNext = [ stubTrue, identity ];
<add>
<add>// Detect if a JS multi-line comment is left open
<add>const throwIfOpenComments = cond([
<add> [
<add> testHTMLJS,
<add> function _checkForComments({ contents }) {
<add> const openingComments = contents.match(/\/\*/gi);
<add> const closingComments = contents.match(/\*\//gi);
<add> if (
<add> openingComments &&
<add> (!closingComments || openingComments.length > closingComments.length)
<add> ) {
<add> throw new SyntaxError('Unfinished multi-line comment');
<ide> }
<del> }, {
<del> name: 'nested-jQuery',
<del> description: 'Nested dollar sign calls breaks browsers',
<del> detectUnsafeJQ: /\$\s*?\(\s*?\$\s*?\)/gi,
<del> thrower: function checkForNestedJquery({ contents }) {
<del> if (contents.match(this.detectUnsafeJQ)) {
<del> throw new Error('Unsafe $($)');
<del> }
<add> }
<add> ],
<add> passToNext
<add>]);
<add>
<add>
<add>// Nested dollar sign calls breaks browsers
<add>const nestedJQCallReg = /\$\s*?\(\s*?\$\s*?\)/gi;
<add>const throwIfNestedJquery = cond([
<add> [
<add> testHTMLJS,
<add> function({ contents }) {
<add> if (nestedJQCallReg.test(contents)) {
<add> throw new SyntaxError('Nested jQuery calls breaks browsers');
<ide> }
<del> }, {
<del> name: 'unfinished-function',
<del> description: 'lonely function keywords breaks browsers',
<del> detectFunctionCall: /function\s*?\(|function\s+\w+\s*?\(/gi,
<del> thrower: function checkForUnfinishedFunction({ contents }) {
<del> if (
<del> contents.match(/function/g) &&
<del> !contents.match(this.detectFunctionCall)
<del> ) {
<del> throw new Error(
<del> 'SyntaxError: Unsafe or unfinished function declaration'
<del> );
<del> }
<add> }
<add> ],
<add> passToNext
<add>]);
<add>
<add>const functionReg = /function/g;
<add>const functionCallReg = /function\s*?\(|function\s+\w+\s*?\(/gi;
<add>// lonely function keywords breaks browsers
<add>const ThrowIfUnfinishedFunction = cond([
<add>
<add> [
<add> testHTMLJS,
<add> function({ contents }) {
<add> if (
<add> functionReg.test(contents) &&
<add> !functionCallReg.test(contents)
<add> ) {
<add> throw new SyntaxError(
<add> 'Unsafe or unfinished function declaration'
<add> );
<ide> }
<del> }, {
<del> name: 'unsafe console call',
<del> description: 'console call stops tests scripts from running',
<del> detectUnsafeConsoleCall: /if\s\(null\)\sconsole\.log\(1\);/gi,
<del> thrower: function checkForUnsafeConsole({ contents }) {
<del> if (contents.match(this.detectUnsafeConsoleCall)) {
<del> throw new Error('Invalid if (null) console.log(1); detected');
<del> }
<add> }
<add> ],
<add> passToNext
<add>]);
<add>
<add>
<add>// console call stops tests scripts from running
<add>const unsafeConsoleCallReg = /if\s\(null\)\sconsole\.log\(1\);/gi;
<add>const throwIfUnsafeConsoleCall = cond([
<add> [
<add> testHTMLJS,
<add> function({ contents }) {
<add> if (unsafeConsoleCallReg.test(contents)) {
<add> throw new SyntaxError(
<add> '`if (null) console.log(1)` detected. This will break tests'
<add> );
<ide> }
<del> }, {
<del> name: 'glitch in code',
<del> description: 'Code with the URL glitch.com or glitch.me' +
<del> 'should not be allowed to run',
<del> detectGlitchInCode: /glitch\.(com|me)/gi,
<del> thrower: function checkForGlitch({ contents }) {
<del> if (contents.match(this.detectGlitchInCode)) {
<del> throw new Error('Glitch.com or Glitch.me should not be in the code');
<del> }
<add> }
<add> ],
<add> passToNext
<add>]);
<add>
<add>// Code with the URL hyperdev.com should not be allowed to run,
<add>const goMixReg = /glitch\.(com|me)/gi;
<add>const throwIfGomixDetected = cond([
<add> [
<add> testHTMLJS,
<add> function({ contents }) {
<add> if (goMixReg.test(contents)) {
<add> throw new Error('Glitch.com or Glitch.me should not be in the code');
<ide> }
<ide> }
<del> ]
<del>};
<add> ],
<add> passToNext
<add>]);
<ide>
<del>export default function throwers() {
<del> const source = this;
<del> return source.map(file$ => file$.flatMap(file => {
<del> if (!throwForJsHtml.ext.test(file.ext)) {
<del> return Observable.just(file);
<add>const validators = [
<add> throwIfOpenComments,
<add> throwIfGomixDetected,
<add> throwIfNestedJquery,
<add> ThrowIfUnfinishedFunction,
<add> throwIfUnsafeConsoleCall
<add>];
<add>
<add>export default function validate(file) {
<add> return validators.reduce((obs, validator) => obs.flatMap(file => {
<add> try {
<add> return castToObservable(validator(file));
<add> } catch (err) {
<add> return Observable.throw(err);
<ide> }
<del> return Observable.from(throwForJsHtml.throwers)
<del> .flatMap(context => {
<del> try {
<del> let finalObs;
<del> const maybeObservableOrPromise = context.thrower(file);
<del> if (helpers.isPromise(maybeObservableOrPromise)) {
<del> finalObs = Observable.fromPromise(maybeObservableOrPromise);
<del> } else if (Observable.isObservable(maybeObservableOrPromise)) {
<del> finalObs = maybeObservableOrPromise;
<del> } else {
<del> finalObs = Observable.just(maybeObservableOrPromise);
<del> }
<del> return finalObs;
<del> } catch (err) {
<del> return Observable.throw(err);
<del> }
<del> })
<del> // if none of the throwers throw, wait for last one
<del> .last({ defaultValue: null })
<del> // then map to the original file
<del> .map(file)
<del> // if err add it to the file
<del> // and return file
<del> .catch(err => {
<del> file.error = err;
<del> return Observable.just(file);
<del> });
<del> }));
<add> }), Observable.of(file))
<add> // if no error has occured map to the original file
<add> .map(() => file)
<add> // if err add it to the file
<add> // and return file
<add> .catch(err => {
<add> file.error = err;
<add> return Observable.just(file);
<add> });
<ide> }
<ide><path>client/rechallenge/transformers.js
<add>import cond from 'lodash/cond';
<add>import identity from 'lodash/identity';
<add>import matchesProperty from 'lodash/matchesProperty';
<add>import stubTrue from 'lodash/stubTrue';
<add>import conforms from 'lodash/conforms';
<add>
<ide> import * as babel from 'babel-core';
<ide> import presetEs2015 from 'babel-preset-es2015';
<ide> import presetReact from 'babel-preset-react';
<ide> import { Observable } from 'rx';
<ide> import loopProtect from 'loop-protect';
<ide> /* eslint-enable import/no-unresolved */
<ide>
<del>import { updateContents } from '../../common/utils/polyvinyl';
<add>import {
<add> transformHeadTailAndContents,
<add> setContent
<add>} from '../../common/utils/polyvinyl.js';
<add>import castToObservable from '../../common/app/utils/cast-to-observable.js';
<ide>
<ide> const babelOptions = { presets: [ presetEs2015, presetReact ] };
<ide> loopProtect.hit = function hit(line) {
<ide> loopProtect.hit = function hit(line) {
<ide> throw new Error(err);
<ide> };
<ide>
<del>const transformersForHtmlJS = {
<del> ext: /html|js/,
<del> transformers: [
<del> {
<del> name: 'add-loop-protect',
<del> transformer: function addLoopProtect(file) {
<del> const _contents = file.contents.toLowerCase();
<del> if (file.ext === 'html' && _contents.indexOf('<script>') === -1) {
<del> // No JavaScript in user code, so no need for loopProtect
<del> return updateContents(file.contents, file);
<del> }
<del> return updateContents(loopProtect(file.contents), file);
<del> }
<del> },
<del> {
<del> name: 'replace-nbsp',
<del> nbspRegExp: new RegExp(String.fromCharCode(160), 'g'),
<del> transformer: function replaceNBSP(file) {
<del> return updateContents(
<del> file.contents.replace(this.nbspRegExp, ' '),
<del> file
<del> );
<del> }
<del> }
<del> ]
<del>};
<add>// const sourceReg =
<add>// /(<!-- fcc-start-source -->)([\s\S]*?)(?=<!-- fcc-end-source -->)/g;
<add>const HTML$JSReg = /html|js/;
<add>const console$logReg = /(?:\b)console(\.log\S+)/g;
<add>const NBSPReg = new RegExp(String.fromCharCode(160), 'g');
<ide>
<del>const transformersForJs = {
<del> ext: /js/,
<del> transformers: [
<del> {
<del> name: 'babel-transformer',
<del> transformer: function babelTransformer(file) {
<del> const result = babel.transform(file.contents, babelOptions);
<del> return updateContents(
<del> result.code,
<del> file
<del> );
<add>const testHTMLJS = conforms({ ext: (ext) => HTML$JSReg.test(ext) });
<add>const testJS = matchesProperty('ext', 'js');
<add>
<add>// if shouldProxyConsole then we change instances of console log
<add>// to `window.__console.log`
<add>// this let's us tap into logging into the console.
<add>// currently we only do this to the main window and not the test window
<add>export function proxyLoggerTransformer(file) {
<add> return transformHeadTailAndContents(
<add> (source) => (
<add> source.replace(console$logReg, (match, methodCall) => {
<add> return 'window.__console' + methodCall;
<add> })),
<add> file
<add> );
<add>}
<add>
<add>export const addLoopProtect = cond([
<add> [
<add> testHTMLJS,
<add> function(file) {
<add> const _contents = file.contents.toLowerCase();
<add> if (file.ext === 'html' && !_contents.indexOf('<script>') !== -1) {
<add> // No JavaScript in user code, so no need for loopProtect
<add> return file;
<ide> }
<add> return setContent(loopProtect(file.contents), file);
<ide> }
<del> ]
<del>};
<del>
<del>// Observable[Observable[File]]::addLoopProtect() => Observable[String]
<del>export default function transformers() {
<del> const source = this;
<del> return source.map(files$ => files$.flatMap(file => {
<del> if (!transformersForHtmlJS.ext.test(file.ext)) {
<del> return Observable.just(file);
<add> ],
<add> [ stubTrue, identity ]
<add>]);
<add>export const replaceNBSP = cond([
<add> [
<add> testHTMLJS,
<add> function(file) {
<add> return setContent(
<add> file.contents.replace(NBSPReg, ' '),
<add> file
<add> );
<ide> }
<del> if (
<del> transformersForJs.ext.test(file.ext) &&
<del> transformersForHtmlJS.ext.test(file.ext)
<del> ) {
<del> return Observable.of(
<del> ...transformersForHtmlJS.transformers,
<del> ...transformersForJs.transformers
<del> )
<del> .reduce((file, context) => context.transformer(file), file);
<add> ],
<add> [ stubTrue, identity ]
<add>]);
<add>
<add>export const babelTransformer = cond([
<add> [
<add> testJS,
<add> function(file) {
<add> const result = babel.transform(file.contents, babelOptions);
<add> return setContent(
<add> result.code,
<add> file
<add> );
<ide> }
<del> return Observable.from(transformersForHtmlJS.transformers)
<del> .reduce((file, context) => context.transformer(file), file);
<del> }));
<add> ],
<add> [ stubTrue, identity ]
<add>]);
<add>
<add>export const _transformers = [
<add> addLoopProtect,
<add> replaceNBSP,
<add> babelTransformer
<add>];
<add>
<add>export function applyTransformers(file, transformers = _transformers) {
<add> return transformers.reduce(
<add> (obs, transformer) => {
<add> return obs.flatMap(file => castToObservable(transformer(file)));
<add> },
<add> Observable.of(file)
<add> );
<ide> }
<ide><path>client/sagas/code-storage-saga.js
<ide> import store from 'store';
<ide>
<ide> import { removeCodeUri, getCodeUri } from '../utils/code-uri';
<ide> import { ofType } from '../../common/utils/get-actions-of-type';
<del>import { updateContents } from '../../common/utils/polyvinyl';
<add>import { setContent } from '../../common/utils/polyvinyl';
<ide> import combineSagas from '../../common/utils/combine-sagas';
<ide>
<ide> import { userSelector } from '../../common/app/redux/selectors';
<ide> function getLegacyCode(legacy) {
<ide> }
<ide>
<ide> function legacyToFile(code, files, key) {
<del> return { [key]: updateContents(code, files[key]) };
<add> return { [key]: setContent(code, files[key]) };
<ide> }
<ide>
<ide> export function clearCodeSaga(actions, getState) {
<ide><path>client/sagas/frame-epic.js
<ide> function frameMain({ build } = {}, document, proxyLogger) {
<ide> main.close();
<ide> }
<ide>
<del>function frameTests({ build, source, checkChallengePayload } = {}, document) {
<add>function frameTests({ build, sources, checkChallengePayload } = {}, document) {
<ide> const { frame: tests } = getFrameDocument(document, testId);
<ide> refreshFrame(tests);
<ide> tests.Rx = Rx;
<del> tests.__source = source;
<del> tests.__getUserInput = key => source[key];
<add> // default for classic challenges
<add> // should not be used for modern
<add> tests.__source = sources['index'] || '';
<add> tests.__getUserInput = key => sources[key];
<ide> tests.__checkChallengePayload = checkChallengePayload;
<ide> tests.open();
<ide> tests.write(createHeader(testId) + build);
<ide><path>client/utils/build.js
<ide> import { Observable } from 'rx';
<ide> import { getValues } from 'redux-form';
<add>import identity from 'lodash/identity';
<ide>
<del>import { ajax$ } from '../../common/utils/ajax-stream';
<add>import { fetchScript } from '../utils/fetch-and-cache.js';
<ide> import throwers from '../rechallenge/throwers';
<del>import transformers from '../rechallenge/transformers';
<del>import { setExt, updateContents } from '../../common/utils/polyvinyl';
<add>import {
<add> applyTransformers,
<add> proxyLoggerTransformer
<add>} from '../rechallenge/transformers';
<add>import {
<add> cssToHtml,
<add> jsToHtml,
<add> concactHtml
<add>} from '../rechallenge/builders.js';
<add>import {
<add> createFileStream,
<add> pipe
<add>} from '../../common/utils/polyvinyl.js';
<ide>
<del>const consoleReg = /(?:\b)console(\.log\S+)/g;
<del>// const sourceReg =
<del>// /(<!-- fcc-start-source -->)([\s\S]*?)(?=<!-- fcc-end-source -->)/g;
<del>
<del>// useConsoleLogProxy(source: String) => String
<del>export function useConsoleLogProxy(source) {
<del> return source.replace(consoleReg, (match, methodCall) => {
<del> return 'window.__console' + methodCall;
<del> });
<del>}
<del>
<del>// createFileStream(files: Dictionary[Path, PolyVinyl]) =>
<del>// Observable[...Observable[...PolyVinyl]]
<del>export function createFileStream(files = {}) {
<del> return Observable.just(
<del> Observable.from(Object.keys(files)).map(key => files[key])
<del> );
<del>}
<ide>
<ide> const jQuery = {
<ide> src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'
<ide> };
<add>const frameRunner = {
<add> src: '/js/frame-runner.js',
<add> crossDomain: false,
<add> cacheBreaker: true
<add>};
<ide> const globalRequires = [
<ide> {
<ide> link: 'https://cdnjs.cloudflare.com/' +
<ide> const globalRequires = [
<ide> jQuery
<ide> ];
<ide>
<del>const scriptCache = new Map();
<del>export function cacheScript({ src } = {}, crossDomain = true) {
<del> if (!src) {
<del> throw new Error('No source provided for script');
<del> }
<del> if (scriptCache.has(src)) {
<del> return scriptCache.get(src);
<del> }
<del> const script$ = ajax$({ url: src, crossDomain })
<del> .doOnNext(res => {
<del> if (res.status !== 200) {
<del> throw new Error('Request errror: ' + res.status);
<del> }
<del> })
<del> .map(({ response }) => response)
<del> .map(script => `<script>${script}</script>`)
<del> .shareReplay();
<del>
<del> scriptCache.set(src, script$);
<del> return script$;
<del>}
<del>
<del>const linkCache = new Map();
<del>export function cacheLink({ link } = {}, crossDomain = true) {
<del> if (!link) {
<del> return Observable.throw(new Error('No source provided for link'));
<del> }
<del> if (linkCache.has(link)) {
<del> return linkCache.get(link);
<del> }
<del> const link$ = ajax$({ url: link, crossDomain })
<del> .doOnNext(res => {
<del> if (res.status !== 200) {
<del> throw new Error('Request errror: ' + res.status);
<del> }
<del> })
<del> .map(({ response }) => response)
<del> .map(script => `<style>${script}</style>`)
<del> .catch(() => Observable.just(''))
<del> .shareReplay();
<del>
<del> linkCache.set(link, link$);
<del> return link$;
<del>}
<del>
<del>const htmlCatch = '\n<!--fcc-->';
<del>const jsCatch = '\n;/*fcc*/\n';
<del>// we add a cache breaker to prevent browser from caching ajax request
<del>const frameRunner = cacheScript({
<del> src: `/js/frame-runner.js?cacheBreaker=${Math.random()}` },
<del> false
<del>);
<del>
<ide> export function buildClassic(files, required, shouldProxyConsole) {
<ide> const finalRequires = [...globalRequires, ...required ];
<ide> return createFileStream(files)
<del> ::throwers()
<del> ::transformers()
<del> // createbuild
<del> .flatMap(file$ => file$.reduce((build, file) => {
<del> let finalFile;
<del> const finalContents = [
<del> file.head,
<del> file.contents,
<del> file.tail
<del> ].map(
<del> // if shouldProxyConsole then we change instances of console log
<del> // to `window.__console.log`
<del> // this let's us tap into logging into the console.
<del> // currently we only do this to the main window and not the test window
<del> source => shouldProxyConsole ? useConsoleLogProxy(source) : source
<del> );
<del> if (file.ext === 'js') {
<del> finalFile = setExt('html', updateContents(
<del> `<script>${finalContents.join(jsCatch)}${jsCatch}</script>`,
<del> file
<del> ));
<del> } else if (file.ext === 'css') {
<del> finalFile = setExt('html', updateContents(
<del> `<style>${finalContents.join(htmlCatch)}</style>`,
<del> file
<del> ));
<del> } else {
<del> finalFile = file;
<del> }
<del> return build + finalFile.contents + htmlCatch;
<del> }, ''))
<del> // add required scripts and links here
<del> .flatMap(source => {
<del> const head$ = Observable.from(finalRequires)
<del> .flatMap(required => {
<del> if (required.src) {
<del> return cacheScript(required, required.crossDomain);
<del> }
<del> // css files with `url(...` may not work in style tags
<del> // so we put them in raw links
<del> if (required.link && required.raw) {
<del> return Observable.just(
<del> `<link href=${required.link} rel='stylesheet' />`
<del> );
<del> }
<del> if (required.link) {
<del> return cacheLink(required, required.crossDomain);
<del> }
<del> return Observable.just('');
<del> })
<del> .reduce((head, required) => head + required, '')
<del> .map(head => `<head>${head}</head>`);
<del>
<del> return Observable.combineLatest(head$, frameRunner)
<del> .map(([ head, frameRunner ]) => {
<del> const body = `
<del> <body style='margin:8px;'>
<del> <!-- fcc-start-source -->
<del> ${source}
<del> <!-- fcc-end-source -->
<del> </body>`;
<del> return {
<del> build: head + body + frameRunner,
<del> source,
<del> head
<del> };
<del> });
<del> });
<add> ::pipe(throwers)
<add> ::pipe(applyTransformers)
<add> ::pipe(shouldProxyConsole ? proxyLoggerTransformer : identity)
<add> ::pipe(jsToHtml)
<add> ::pipe(cssToHtml)
<add> ::concactHtml(finalRequires, frameRunner);
<ide> }
<ide>
<ide> export function buildBackendChallenge(state) {
<ide> const { solution: url } = getValues(state.form.BackEndChallenge);
<del> return Observable.combineLatest(frameRunner, cacheScript(jQuery))
<add> return Observable.combineLatest(
<add> fetchScript(frameRunner),
<add> fetchScript(jQuery)
<add> )
<ide> .map(([ frameRunner, jQuery ]) => ({
<ide> build: jQuery + frameRunner,
<ide> source: { url },
<ide><path>client/utils/fetch-and-cache.js
<add>import { Observable } from 'rx';
<add>import { ajax$ } from '../../common/utils/ajax-stream';
<add>
<add>// value used to break browser ajax caching
<add>const cacheBreakerValue = Math.random();
<add>
<add>export function _fetchScript(
<add> {
<add> src,
<add> cacheBreaker = false,
<add> crossDomain = true
<add> } = {},
<add>) {
<add> if (!src) {
<add> throw new Error('No source provided for script');
<add> }
<add> if (this.cache.has(src)) {
<add> return this.cache.get(src);
<add> }
<add> const url = cacheBreaker ?
<add> `${src}?cacheBreaker=${cacheBreakerValue}` :
<add> src;
<add> const script = ajax$({ url, crossDomain })
<add> .doOnNext(res => {
<add> if (res.status !== 200) {
<add> throw new Error('Request errror: ' + res.status);
<add> }
<add> })
<add> .map(({ response }) => response)
<add> .map(script => `<script>${script}</script>`)
<add> .shareReplay();
<add>
<add> this.cache.set(src, script);
<add> return script;
<add>}
<add>export const fetchScript = _fetchScript.bind({ cache: new Map() });
<add>
<add>export function _fetchLink(
<add> {
<add> link: href,
<add> raw = false,
<add> crossDomain = true
<add> } = {},
<add>) {
<add> if (!href) {
<add> return Observable.throw(new Error('No source provided for link'));
<add> }
<add> if (this.cache.has(href)) {
<add> return this.cache.get(href);
<add> }
<add> // css files with `url(...` may not work in style tags
<add> // so we put them in raw links
<add> if (raw) {
<add> const link = Observable.just(`<link href=${href} rel='stylesheet' />`)
<add> .shareReplay();
<add> this.cache.set(href, link);
<add> return link;
<add> }
<add> const link = ajax$({ url: href, crossDomain })
<add> .doOnNext(res => {
<add> if (res.status !== 200) {
<add> throw new Error('Request error: ' + res.status);
<add> }
<add> })
<add> .map(({ response }) => response)
<add> .map(script => `<style>${script}</style>`)
<add> .catch(() => Observable.just(''))
<add> .shareReplay();
<add>
<add> this.cache.set(href, link);
<add> return link;
<add>}
<add>
<add>export const fetchLink = _fetchLink.bind({ cache: new Map() });
<ide><path>common/app/routes/challenges/redux/actions.js
<ide> import { createAction } from 'redux-actions';
<del>import { updateContents } from '../../../../utils/polyvinyl';
<add>import { setContent } from '../../../../utils/polyvinyl';
<ide> import { getMouse, loggerToStr } from '../utils';
<ide>
<ide> import types from './types';
<ide> export const clearFilter = createAction(types.clearFilter);
<ide> // files
<ide> export const updateFile = createAction(
<ide> types.updateFile,
<del> (content, file) => updateContents(content, file)
<add> (content, file) => setContent(content, file)
<ide> );
<ide>
<ide> export const updateFiles = createAction(types.updateFiles);
<ide><path>common/app/utils/cast-to-observable.js
<add>import { Observable, helpers } from 'rx';
<add>
<add>export default function castToObservable(maybe) {
<add> if (Observable.isObservable(maybe)) {
<add> return maybe;
<add> }
<add> if (helpers.isPromise(maybe)) {
<add> return Observable.fromPromise(maybe);
<add> }
<add> return Observable.of(maybe);
<add>}
<ide><path>common/utils/polyvinyl.js
<del>// originally base off of https://github.com/gulpjs/vinyl
<add>// originally based off of https://github.com/gulpjs/vinyl
<ide> import invariant from 'invariant';
<add>import { Observable } from 'rx';
<add>import castToObservable from '../app/utils/cast-to-observable.js';
<add>
<add>
<add>// createFileStream(
<add>// files: Dictionary[Path, PolyVinyl]
<add>// ) => Observable[...Observable[...PolyVinyl]]
<add>export function createFileStream(files = {}) {
<add> return Observable.of(
<add> Observable.from(Object.keys(files).map(key => files[key]))
<add> );
<add>}
<add>
<add>// Observable::pipe(
<add>// project(
<add>// file: PolyVinyl
<add>// ) => PolyVinyl|Observable[PolyVinyl]|Promise[PolyVinyl]
<add>// ) => Observable[...Observable[...PolyVinyl]]
<add>export function pipe(project) {
<add> const source = this;
<add> return source.map(
<add> files => files.flatMap(file => castToObservable(project(file)))
<add> );
<add>}
<ide>
<ide> // interface PolyVinyl {
<add>// source: String,
<ide> // contents: String,
<ide> // name: String,
<ide> // ext: String,
<ide> import invariant from 'invariant';
<ide> // head: String,
<ide> // tail: String,
<ide> // history: [...String],
<del>// error: Null|Object
<add>// error: Null|Object|Error
<ide> // }
<del>//
<add>
<ide> // createPoly({
<ide> // name: String,
<ide> // ext: String,
<ide> export function isEmpty(poly) {
<ide> return !!poly.contents;
<ide> }
<ide>
<del>// updateContents(contents: String, poly: PolyVinyl) => PolyVinyl
<del>export function updateContents(contents, poly) {
<add>// setContent(contents: String, poly: PolyVinyl) => PolyVinyl
<add>// setContent will loose source if set
<add>export function setContent(contents, poly) {
<ide> checkPoly(poly);
<ide> return {
<ide> ...poly,
<del> contents
<add> contents,
<add> source: null
<ide> };
<ide> }
<ide>
<add>// setExt(contents: String, poly: PolyVinyl) => PolyVinyl
<ide> export function setExt(ext, poly) {
<ide> checkPoly(poly);
<ide> const newPoly = {
<ide> export function setExt(ext, poly) {
<ide> return newPoly;
<ide> }
<ide>
<add>// setName(contents: String, poly: PolyVinyl) => PolyVinyl
<ide> export function setName(name, poly) {
<ide> checkPoly(poly);
<ide> const newPoly = {
<ide> export function setName(name, poly) {
<ide> return newPoly;
<ide> }
<ide>
<add>// setError(contents: String, poly: PolyVinyl) => PolyVinyl
<ide> export function setError(error, poly) {
<ide> invariant(
<ide> typeof error === 'object',
<ide> export function setError(error, poly) {
<ide> error
<ide> };
<ide> }
<add>
<add>// clearHeadTail(poly: PolyVinyl) => PolyVinyl
<add>export function clearHeadTail(poly) {
<add> checkPoly(poly);
<add> return {
<add> ...poly,
<add> head: '',
<add> tail: ''
<add> };
<add>}
<add>
<add>// compileHeadTail(contents: String, poly: PolyVinyl) => PolyVinyl
<add>export function compileHeadTail(padding = '', poly) {
<add> return clearHeadTail(setContent(
<add> [ poly.head, poly.contents, poly.tail ].join(padding),
<add> poly
<add> ));
<add>}
<add>
<add>// transformContents(
<add>// wrap: (contents: String) => String,
<add>// poly: PolyVinyl
<add>// ) => PolyVinyl
<add>// transformContents will keep a copy of the original
<add>// code in the `source` property. If the original polyvinyl
<add>// already contains a source, this version will continue as
<add>// the source property
<add>export function transformContents(wrap, poly) {
<add> const newPoly = setContent(
<add> wrap(poly.contents),
<add> poly
<add> );
<add> // if no source exist, set the original contents as source
<add> newPoly.source = poly.contents || poly.contents;
<add> return newPoly;
<add>}
<add>
<add>// transformHeadTailAndContents(
<add>// wrap: (source: String) => String,
<add>// poly: PolyVinyl
<add>// ) => PolyVinyl
<add>export function transformHeadTailAndContents(wrap, poly) {
<add> return {
<add> ...setContent(
<add> wrap(poly.contents),
<add> poly
<add> ),
<add> head: wrap(poly.head),
<add> tail: wrap(poly.tail)
<add> };
<add>} | 11 |
Text | Text | add full description text for scales | f4ef56993d94ad5379ebd82331f05f16d89df987 | <ide><path>docs/01-Scales.md
<ide> Every scale extends a core scale class with the following options:
<ide>
<ide> Name | Type | Default | Description
<ide> --- |:---:| --- | ---
<del>display | Boolean | true | If true, show the scale.
<del>reverse | Boolean | false | If true, reverses the scales.
<del>gridLines | Array | |
<add>type | String | Chart specific. | Type of scale being employed. Custom scales can be created. Options: ["category"](#scales-category-scale), ["linear"](#scales-linear-scale), ["logarithmic"](#scales-logarithmic-scale), ["time"](#scales-time-scale), ["radialLinear"](#scales-radial-linear-scale)
<add>display | Boolean | true | If true, show the scale including gridlines, ticks, and labels. Overrides *gridLines.show*, *scaleLabel.show*, and *ticks.show*.
<add>**gridLines** | Array | - | Options for the grid lines that run perpendicular to the axis.
<ide> *gridLines*.show | Boolean | true | If true, show the grid lines.
<ide> *gridLines*.color | Color | "rgba(0, 0, 0, 0.1)" | Color of the grid lines.
<ide> *gridLines*.lineWidth | Number | 1 | Width of the grid lines in number of pixels.
<del>*gridLines*.drawOnChartArea | Boolean | true | If true draw lines on the chart area, if false...
<del>*gridLines*.drawTicks | Boolean | true | If true draw ticks in the axis area, if false...
<add>*gridLines*.drawOnChartArea | Boolean | true | If true, draw lines on the chart area inside the axis lines.
<add>*gridLines*.drawTicks | Boolean | true | If true, draw lines beside the ticks in the axis area beside the chart.
<ide> *gridLines*.zeroLineWidth | Number | 1 | Width of the grid line for the first index (index 0).
<ide> *gridLines*.zeroLineColor | Color | "rgba(0, 0, 0, 0.25)" | Color of the grid line for the first index (index 0).
<ide> *gridLines*.offsetGridLines | Boolean | false | If true, offset labels from grid lines.
<del>scaleLabel | Array | | Label for the axis.
<del>*scaleLabel*.show | Boolean | false | Whether the label is displayed.
<del>*scaleLabel*.labelString | String | "" | The text for the label.
<del>*scaleLabel*.fontColor | Color | "#666" |
<del>*scaleLabel*.fontFamily| String | "Helvetica Neue" |
<del>*scaleLabel*.fontSize | Number | 12 |
<del>*scaleLabel*.fontStyle | String | "normal" |
<del>ticks | Array | | Settings for the ticks along the axis.
<add>**scaleLabel** | Array | | Label for the entire axis.
<add>*scaleLabel*.show | Boolean | false | If true, show the scale label.
<add>*scaleLabel*.labelString | String | "" | The text for the label. (i.e. "# of People", "Response Choices")
<add>*scaleLabel*.fontColor | Color | "#666" | Font color for the scale label.
<add>*scaleLabel*.fontFamily| String | "Helvetica Neue" | Font family for the scale label, follows CSS font-family options.
<add>*scaleLabel*.fontSize | Number | 12 | Font size for the scale label.
<add>*scaleLabel*.fontStyle | String | "normal" | Font style for the scale label, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
<add>**ticks** | Array | | Settings for the labels that run along the axis.
<ide> *ticks*.beginAtZero | Boolean | false | If true the scale will be begin at 0, if false the ticks will begin at your smallest data value.
<del>*ticks*.fontSize | Number | 12 |
<del>*ticks*.fontStyle | String | "normal" |
<del>*ticks*.fontColor | Color | "#666" |
<del>*ticks*.fontFamily | String | "Helvetica Neue" |
<del>*ticks*.maxRotation | Number | 90 |
<del>*ticks*.minRotation | Number | 20 |
<del>*ticks*.mirror | Boolean | false |
<del>*ticks*.padding | Number | 10 |
<del>*ticks*.reverse | Boolean | false |
<del>*ticks*.show | Boolean | true |
<add>*ticks*.fontColor | Color | "#666" | Font color for the tick labels.
<add>*ticks*.fontFamily | String | "Helvetica Neue" | Font family for the tick labels, follows CSS font-family options.
<add>*ticks*.fontSize | Number | 12 | Font size for the tick labels.
<add>*ticks*.fontStyle | String | "normal" | Font style for the tick labels, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
<add>*ticks*.maxRotation | Number | 90 | Maximum rotation for tick labels when rotating to condense labels. Note: Rotation doesn't occur until necessary. *Note: Only applicable to horizontal scales.*
<add>*ticks*.minRotation | Number | 20 | *currently not-implemented* Minimum rotation for tick labels when condensing is necessary. *Note: Only applicable to horizontal scales.*
<add>*ticks*.padding | Number | 10 | Padding between the tick label and the axis. *Note: Only applicable to horizontal scales.*
<add>*ticks*.mirror | Boolean | false | Flips tick labels around axis, displaying the labels inside the chart instead of outside. *Note: Only applicable to vertical scales.*
<add>*ticks*.reverse | Boolean | false | Reverses order of tick labels.
<add>*ticks*.show | Boolean | true | If true, show the ticks.
<ide> *ticks*.suggestedMin | Number | - | User defined minimum number for the scale, overrides minimum value *except for if* it is higher than the minimum value.
<ide> *ticks*.suggestedMax | Number | - | User defined maximum number for the scale, overrides maximum value *except for if* it is lower than the maximum value.
<del>*ticks*.callback | Function | `function(value) { return '' + value; } ` |
<add>*ticks*.callback | Function | `function(value) { return '' + value; } ` | Returns the string representation of the tick value as it should be displayed on the chart.
<ide>
<ide> The `userCallback` method may be used for advanced tick customization. The following callback would display every label in scientific notation
<ide> ```javascript | 1 |
Python | Python | fix merge issue | 30aa2ca4cbc8b337c4e2dba10915abc5ff2ea474 | <ide><path>tests/core.py
<ide> def test_cyclic_dependencies_3(self):
<ide> regexp = "Cycle detected in DAG. (.*)runme_0(.*)"
<ide> with self.assertRaisesRegexp(AirflowException, regexp):
<ide> self.run_this_last.set_downstream(self.runme_0)
<del>>>>>>>> 17aed4c... fixed Variable json deserialization
<del>
<ide>
<ide> class CliTests(unittest.TestCase):
<ide> | 1 |
PHP | PHP | fix bug in session store | 469f85234468aa923da0fcc9814a22d07b9b6b33 | <ide><path>src/Illuminate/Session/Store.php
<ide> public function get($name, $default = null)
<ide> /**
<ide> * Determine if the session contains old input.
<ide> *
<add> * @param string $key
<ide> * @return bool
<ide> */
<del> public function hasOldInput()
<add> public function hasOldInput($key)
<ide> {
<del> return ! is_null($this->getOldInput());
<add> return ! is_null($this->getOldInput($key));
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | use native string.prototype.trim if available | 22b9b4757610918456e3486deb514bcc60a08852 | <ide><path>src/Angular.js
<ide> function isBoolean(value) {
<ide> }
<ide>
<ide>
<del>function trim(value) {
<del> return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
<del>}
<add>var trim = (function() {
<add> // native trim is way faster: http://jsperf.com/angular-trim-test
<add> // but IE doesn't have it... :-(
<add> // TODO: we should move this into IE/ES5 polyfill
<add> if (!String.prototype.trim) {
<add> return function(value) {
<add> return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
<add> };
<add> }
<add> return function(value) {
<add> return isString(value) ? value.trim() : value;
<add> };
<add>})();
<add>
<ide>
<ide> /**
<ide> * @ngdoc function | 1 |
Javascript | Javascript | load jquery from a script tag in iframe | ebfee3ed0a20deb4bc3fbe6a74ea1d8f9512a7e2 | <ide><path>client/commonFramework/update-preview.js
<ide> window.common = (function(global) {
<ide> // context to that of the iframe.
<ide> var libraryIncludes = `
<ide> <script>
<del> window.$ = parent.$.proxy(parent.$.fn.find, parent.$(document));
<ide> window.loopProtect = parent.loopProtect;
<ide> window.__err = null;
<ide> window.loopProtect.hit = function(line) {
<ide> window.common = (function(global) {
<ide>
<ide> const iFrameScript$ =
<ide> common.getScriptContent$('/js/iFrameScripts.js').shareReplay();
<add> const jQueryScript$ = common.getScriptContent$(
<add> '/bower_components/jquery/dist/jquery.js'
<add> ).shareReplay();
<ide>
<ide> // behavior subject allways remembers the last value
<ide> // we use this to determine if runPreviewTest$ is defined
<ide> window.common = (function(global) {
<ide> common.updatePreview$ = function updatePreview$(code = '') {
<ide> const preview = common.getIframe('preview');
<ide>
<del> return iFrameScript$
<del> .map(script => `<script>${script}</script>`)
<del> .flatMap(script => {
<add> return Observable.combineLatest(
<add> iFrameScript$,
<add> jQueryScript$,
<add> (iframe, jQuery) => ({
<add> iframeScript: `<script>${iframe}</script>`,
<add> jQuery: `<script>${jQuery}</script>`
<add> })
<add> )
<add> .first()
<add> .flatMap(({ iframeScript, jQuery }) => {
<ide> // we make sure to override the last value in the
<ide> // subject to false here.
<ide> common.previewReady$.onNext(false);
<ide> preview.open();
<del> preview.write(libraryIncludes + code + '<!-- -->' + script);
<add> preview.write(
<add> libraryIncludes +
<add> jQuery +
<add> code +
<add> '<!-- -->' +
<add> iframeScript
<add> );
<ide> preview.close();
<ide> // now we filter false values and wait for the first true
<ide> return common.previewReady$ | 1 |
Javascript | Javascript | add include/exclude filtering to bannerplugin | b76aa12b380ffba004edae23d35942dd84bc4624 | <ide><path>lib/BannerPlugin.js
<ide> Author Tobias Koppers @sokra
<ide> */
<ide> var ConcatSource = require("webpack-core/lib/ConcatSource");
<add>var ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
<ide>
<ide> function wrapComment(str) {
<ide> if(str.indexOf("\n") < 0) return "/*! " + str + " */";
<ide> return "/*!\n * " + str.split("\n").join("\n * ") + "\n */";
<ide> }
<ide>
<ide> function BannerPlugin(banner, options) {
<del> if(!options) options = {};
<del> this.banner = options.raw ? banner : wrapComment(banner);
<del> this.entryOnly = options.entryOnly;
<add> this.options = options || {};
<add> this.banner = this.options.raw ? banner : wrapComment(banner);
<ide> }
<ide> module.exports = BannerPlugin;
<add>
<ide> BannerPlugin.prototype.apply = function(compiler) {
<add> var options = this.options;
<ide> var banner = this.banner;
<del> var entryOnly = this.entryOnly;
<add>
<ide> compiler.plugin("compilation", function(compilation) {
<ide> compilation.plugin("optimize-chunk-assets", function(chunks, callback) {
<ide> chunks.forEach(function(chunk) {
<del> if(entryOnly && !chunk.initial) return;
<del> chunk.files.forEach(function(file) {
<add> if(options.entryOnly && !chunk.initial) return;
<add> chunk.files.filter(ModuleFilenameHelpers.matchObject.bind(undefined, options)).forEach(function(file) {
<ide> compilation.assets[file] = new ConcatSource(banner, "\n", compilation.assets[file]);
<ide> });
<ide> }); | 1 |
Mixed | Ruby | add headless chrome driver to system tests | ada05850f84ee0eef5413950333e5b5332a64b48 | <ide><path>actionpack/CHANGELOG.md
<add>* Add headless chrome support to System Tests.
<add>
<add> *Yuji Yaginuma*
<add>
<ide> * Add ability to enable Early Hints for HTTP/2
<ide>
<ide> If supported by the server, and enabled in Puma this allows H2 Early Hints to be used.
<ide><path>actionpack/lib/action_dispatch/system_test_case.rb
<ide> def self.start_application # :nodoc:
<ide> #
<ide> # driven_by :selenium, using: :firefox
<ide> #
<add> # driven_by :selenium, using: :headless_chrome
<add> #
<ide> # driven_by :selenium, screen_size: [800, 800]
<ide> def self.driven_by(driver, using: :chrome, screen_size: [1400, 1400], options: {})
<ide> self.driver = SystemTesting::Driver.new(driver, using: using, screen_size: screen_size, options: options)
<ide><path>actionpack/lib/action_dispatch/system_testing/driver.rb
<ide> def register
<ide> end
<ide> end
<ide>
<add> def browser_options
<add> if @browser == :headless_chrome
<add> browser_options = Selenium::WebDriver::Chrome::Options.new
<add> browser_options.args << "--headless"
<add> browser_options.args << "--disable-gpu"
<add>
<add> @options.merge(options: browser_options)
<add> else
<add> @options
<add> end
<add> end
<add>
<add> def browser
<add> @browser == :headless_chrome ? :chrome : @browser
<add> end
<add>
<ide> def register_selenium(app)
<del> Capybara::Selenium::Driver.new(app, { browser: @browser }.merge(@options)).tap do |driver|
<add> Capybara::Selenium::Driver.new(app, { browser: browser }.merge(browser_options)).tap do |driver|
<ide> driver.browser.manage.window.size = Selenium::WebDriver::Dimension.new(*@screen_size)
<ide> end
<ide> end
<ide><path>actionpack/test/abstract_unit.rb
<ide> class DrivenByRackTest < ActionDispatch::SystemTestCase
<ide> class DrivenBySeleniumWithChrome < ActionDispatch::SystemTestCase
<ide> driven_by :selenium, using: :chrome
<ide> end
<add>
<add>class DrivenBySeleniumWithHeadlessChrome < ActionDispatch::SystemTestCase
<add> driven_by :selenium, using: :headless_chrome
<add>end
<ide><path>actionpack/test/dispatch/system_testing/driver_test.rb
<ide> class DriverTest < ActiveSupport::TestCase
<ide> assert_equal ({ url: "http://example.com/wd/hub" }), driver.instance_variable_get(:@options)
<ide> end
<ide>
<add> test "initializing the driver with a headless chrome" do
<add> driver = ActionDispatch::SystemTesting::Driver.new(:selenium, using: :headless_chrome, screen_size: [1400, 1400], options: { url: "http://example.com/wd/hub" })
<add> assert_equal :selenium, driver.instance_variable_get(:@name)
<add> assert_equal :headless_chrome, driver.instance_variable_get(:@browser)
<add> assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size)
<add> assert_equal ({ url: "http://example.com/wd/hub" }), driver.instance_variable_get(:@options)
<add> end
<add>
<ide> test "initializing the driver with a poltergeist" do
<ide> driver = ActionDispatch::SystemTesting::Driver.new(:poltergeist, screen_size: [1400, 1400], options: { js_errors: false })
<ide> assert_equal :poltergeist, driver.instance_variable_get(:@name)
<ide><path>actionpack/test/dispatch/system_testing/system_test_case_test.rb
<ide> class SetDriverToSeleniumTest < DrivenBySeleniumWithChrome
<ide> end
<ide> end
<ide>
<add>class SetDriverToSeleniumHeadlessChromeTest < DrivenBySeleniumWithHeadlessChrome
<add> test "uses selenium headless chrome" do
<add> assert_equal :selenium, Capybara.current_driver
<add> end
<add>end
<add>
<ide> class SetHostTest < DrivenByRackTest
<ide> test "sets default host" do
<ide> assert_equal "http://127.0.0.1", Capybara.app_host | 6 |
Ruby | Ruby | fix syntax error in redirect_to example | fd76b9d5469c3309ce4308fda5bc9e95cbc457f8 | <ide><path>actionpack/lib/action_controller/metal/redirecting.rb
<ide> module Redirecting
<ide> # redirect_to post_url(@post), alert: "Watch it, mister!"
<ide> # redirect_to post_url(@post), status: :found, notice: "Pay attention to the road"
<ide> # redirect_to post_url(@post), status: 301, flash: { updated_post_id: @post.id }
<del> # redirect_to { action: 'atom' }, alert: "Something serious happened"
<add> # redirect_to({ action: 'atom' }, alert: "Something serious happened")
<ide> #
<ide> # When using <tt>redirect_to :back</tt>, if there is no referrer, ActionController::RedirectBackError will be raised. You may specify some fallback
<ide> # behavior for this case by rescuing ActionController::RedirectBackError. | 1 |
Python | Python | prepare pypi release | 576f8fe8e6a21b7094316d36c315c2f6bdb487cc | <ide><path>keras/__init__.py
<ide> from . import optimizers
<ide> from . import regularizers
<ide>
<del>__version__ = '2.0.1'
<add>__version__ = '2.0.2'
<ide><path>setup.py
<ide>
<ide>
<ide> setup(name='Keras',
<del> version='2.0.1',
<add> version='2.0.2',
<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.1',
<add> download_url='https://github.com/fchollet/keras/tarball/2.0.2',
<ide> license='MIT',
<ide> install_requires=['theano', 'pyyaml', 'six'],
<ide> extras_require={ | 2 |
Java | Java | fix unnecessary import | 7c609157c4459f372abf0480b34857568ea9680c | <ide><path>src/main/java/io/reactivex/internal/operators/completable/CompletableMergeIterable.java
<ide>
<ide> package io.reactivex.internal.operators.completable;
<ide>
<del>import io.reactivex.internal.functions.ObjectHelper;
<ide> import java.util.Iterator;
<ide> import java.util.concurrent.atomic.*;
<ide> | 1 |
Javascript | Javascript | allow wildcards in common name | 45024e7b7551eca7796e16fe453b2cbaee94b916 | <ide><path>lib/tls.js
<ide> function checkServerIdentity(host, cert) {
<ide> dnsNames = dnsNames.concat(uriNames);
<ide>
<ide> // And only after check if hostname matches CN
<del> // (because CN is deprecated, but should be used for compatiblity anyway)
<ide> var commonNames = cert.subject.CN;
<ide> if (Array.isArray(commonNames)) {
<ide> for (var i = 0, k = commonNames.length; i < k; ++i) {
<del> dnsNames.push(regexpify(commonNames[i], false));
<add> dnsNames.push(regexpify(commonNames[i], true));
<ide> }
<ide> } else {
<del> dnsNames.push(regexpify(commonNames, false));
<add> dnsNames.push(regexpify(commonNames, true));
<ide> }
<ide>
<ide> valid = dnsNames.some(function(re) { | 1 |
PHP | PHP | add a missing docblock | d99be7ef3be4b00789f5fd4647a2d586cb8d41f7 | <ide><path>src/Database/Schema/Table.php
<ide> class Table
<ide> */
<ide> const LENGTH_LONG = 4294967295;
<ide>
<add> /**
<add> * Valid column length that can be used with text type columns
<add> *
<add> * @var array
<add> */
<ide> public static $columnLengths = [
<ide> 'tiny' => self::LENGTH_TINY,
<ide> 'medium' => self::LENGTH_MEDIUM,
<ide> 'long' => self::LENGTH_LONG
<ide> ];
<ide>
<del>
<ide> /**
<ide> * The valid keys that can be used in a column
<ide> * definition. | 1 |
Go | Go | convert socket group to int | e5d77c64a2030fe4c5c1413b69b45f40a2347358 | <ide><path>pkg/listeners/listeners_unix.go
<ide> func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) ([]net.Listene
<ide> }
<ide> ls = append(ls, l)
<ide> case "unix":
<del> l, err := sockets.NewUnixSocket(addr, socketGroup)
<add>
<add> gid, err := strconv.Atoi(socketGroup)
<add> if err != nil {
<add> return nil, fmt.Errorf("failed to parse socket group id: should be a number: %v", socketGroup)
<add> }
<add> l, err := sockets.NewUnixSocket(addr, gid)
<ide> if err != nil {
<ide> return nil, fmt.Errorf("can't create unix socket %s: %v", addr, err)
<ide> } | 1 |
Python | Python | improve description of `novalue` | 4c4f201e3d16b57e1ba03a5c12ed6343cca447ae | <ide><path>numpy/_globals.py
<ide> class _NoValueType:
<ide> """Special keyword value.
<ide>
<ide> The instance of this class may be used as the default value assigned to a
<del> deprecated keyword in order to check if it has been given a user defined
<del> value.
<add> keyword if no other obvious default (e.g., `None`) is suitable,
<add>
<add> Common reasons for using this keyword are:
<add>
<add> - A new keyword is added to a function, and that function forwards its
<add> inputs to another function or method which can be defined outside of
<add> NumPy. For example, ``np.std(x)`` calls ``x.std``, so when a ``keepdims``
<add> keyword was added that could only be forwarded if the user explicitly
<add> specified ``keepdims``; downstream array libraries may not have added
<add> the same keyword, so adding ``x.std(..., keepdims=keepdims)``
<add> unconditionally could have broken previously working code.
<add> - A keyword is being deprecated, and a deprecation warning must only be
<add> emitted when the keyword is used.
<add>
<ide> """
<ide> __instance = None
<ide> def __new__(cls): | 1 |
PHP | PHP | fix seeder property for in-memory tests | 76a7b3cc7942eda2841518ca7877a5e009570b22 | <ide><path>src/Illuminate/Database/Console/Migrations/MigrateCommand.php
<ide> class MigrateCommand extends BaseCommand
<ide> {--schema-path= : The path to a schema dump file}
<ide> {--pretend : Dump the SQL queries that would be run}
<ide> {--seed : Indicates if the seed task should be re-run}
<add> {--seeder= : The class name of the root seeder}
<ide> {--step : Force the migrations to be run so they can be rolled back individually}';
<ide>
<ide> /**
<ide> public function handle()
<ide> // seed task to re-populate the database, which is convenient when adding
<ide> // a migration and a seed at the same time, as it is only this command.
<ide> if ($this->option('seed') && ! $this->option('pretend')) {
<del> $this->call('db:seed', ['--force' => true]);
<add> $this->call('db:seed', [
<add> '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder',
<add> '--force' => true,
<add> ]);
<ide> }
<ide> });
<ide>
<ide><path>src/Illuminate/Foundation/Testing/RefreshDatabase.php
<ide> protected function migrateUsing()
<ide> {
<ide> return [
<ide> '--seed' => $this->shouldSeed(),
<add> '--seeder' => $this->seeder(),
<ide> ];
<ide> }
<ide> | 2 |
Python | Python | add args info to evaluate_result.txt | 47e9aea0fe9b8b83459f0744fa47bda6c6d4a699 | <ide><path>examples/single_model_scripts/run_multiple_choice.py
<ide> def evaluate(args, model, tokenizer, prefix=""):
<ide> results.update(result)
<ide>
<ide> output_eval_file = os.path.join(eval_output_dir, "eval_results.txt")
<add>
<ide> with open(output_eval_file, "w") as writer:
<ide> logger.info("***** Eval results {} *****".format(prefix))
<add> writer.write("model =%s\n" % str(args.model_name_or_path))
<add> writer.write("total batch size=%d\n" % (args.train_batch_size * args.gradient_accumulation_steps *
<add> (torch.distributed.get_world_size() if args.local_rank != -1 else 1)))
<add> writer.write("train num epochs=%d\n" % args.num_train_epochs)
<add> writer.write("fp16 =%s\n" % args.fp16)
<add> writer.write("max seq length =%d\n" % args.max_seq_length)
<ide> for key in sorted(result.keys()):
<ide> logger.info(" %s = %s", key, str(result[key]))
<ide> writer.write("%s = %s\n" % (key, str(result[key])))
<del>
<ide> return results
<ide>
<ide> | 1 |
PHP | PHP | add an http cache middleware | 5defbd745dc41577e408d9714b137b056c3bd807 | <ide><path>src/Illuminate/Http/Middleware/Cache.php
<add><?php
<add>
<add>namespace Illuminate\Http\Middleware;
<add>
<add>use Closure;
<add>
<add>class Cache
<add>{
<add> /**
<add> * Add cache related HTTP headers.
<add> *
<add> * @param \Illuminate\Http\Request $request
<add> * @param \Closure $next
<add> * @param int|null $maxAge
<add> * @param int|null $sharedMaxAge
<add> * @param bool|null $public
<add> * @param bool|null $etag
<add> * @return \Symfony\Component\HttpFoundation\Response
<add> */
<add> public function handle($request, Closure $next, int $maxAge = null, int $sharedMaxAge = null, bool $public = null, bool $etag = false)
<add> {
<add> /**
<add> * @var \Symfony\Component\HttpFoundation\Response
<add> */
<add> $response = $next($request);
<add>
<add> if (! $request->isMethodCacheable() || ! $response->getContent()) {
<add> return $response;
<add> }
<add>
<add> if (! $response->getContent()) {
<add> return;
<add> }
<add> if ($etag) {
<add> $response->setEtag(md5($response->getContent()));
<add> }
<add> if (null !== $maxAge) {
<add> $response->setMaxAge($maxAge);
<add> }
<add> if (null !== $sharedMaxAge) {
<add> $response->setSharedMaxAge($sharedMaxAge);
<add> }
<add> if (null !== $public) {
<add> $public ? $response->setPublic() : $response->setPrivate();
<add> }
<add>
<add> return $response;
<add> }
<add>}
<ide><path>tests/Http/Middleware/CacheTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Http\Middleware;
<add>
<add>use Illuminate\Http\Request;
<add>use Illuminate\Http\Response;
<add>use PHPUnit\Framework\TestCase;
<add>use Illuminate\Http\Middleware\Cache;
<add>
<add>class CacheTest extends TestCase
<add>{
<add> public function testDoNotSetHeaderWhenMethodNotCacheable()
<add> {
<add> $request = new Request();
<add> $request->setMethod('PUT');
<add>
<add> $response = (new Cache())->handle($request, function () {
<add> return new Response('Hello Laravel');
<add> }, 1, 2, true, true);
<add>
<add> $this->assertNull($response->getMaxAge());
<add> $this->assertNull($response->getEtag());
<add> }
<add>
<add> public function testDoNotSetHeaderWhenNoContent()
<add> {
<add> $response = (new Cache())->handle(new Request(), function () {
<add> return new Response();
<add> }, 1, 2, true, true);
<add>
<add> $this->assertNull($response->getMaxAge());
<add> $this->assertNull($response->getEtag());
<add> }
<add>
<add> public function testAddHeaders()
<add> {
<add> $response = (new Cache())->handle(new Request(), function () {
<add> return new Response('some content');
<add> }, 100, 200, true, true);
<add>
<add> $this->assertSame('"9893532233caff98cd083a116b013c0b"', $response->getEtag());
<add> $this->assertSame('max-age=100, public, s-maxage=200', $response->headers->get('Cache-Control'));
<add> }
<add>} | 2 |
Text | Text | update markdown syntax on dataflow.md | b105f1e3783b1112b2aedeac2edc005313221b87 | <ide><path>docs/basics/DataFlow.md
<ide> The data lifecycle in any Redux app follows these 4 steps:
<ide> let nextState = todoApp(previousState, action)
<ide> ```
<ide>
<del> Note that a reducer is a pure function. It only *computes* the next state. It should be completely predictable: calling it with the same inputs many times should produce the same outputs. It shouldn't perform any side effects like API calls or router transitions. These should happen before an action is dispatched.
<add> Note that a reducer is a pure function. It only *computes* the next state. It should be completely predictable: calling it with the same inputs many times should produce the same outputs. It shouldn't perform any side effects like API calls or router transitions. These should happen before an action is dispatched.
<ide>
<ide> 3. **The root reducer may combine the output of multiple reducers into a single state tree.**
<ide> | 1 |
Javascript | Javascript | fix typo in with-redux-reselect-recompose example | a30870bd37390543c3e1b0512241b0569788c940 | <ide><path>examples/with-redux-reselect-recompose/reducers/index.js
<ide> import { combineReducers } from 'redux'
<ide> import count, { initialState as countState } from './count'
<ide>
<del>export const intitialState = {
<add>export const initialState = {
<ide> count: countState
<ide> }
<ide> | 1 |
Text | Text | fix typo in per-form csrf token docs [ci skip] | af90af42a748551d6dd2690be313186e7b0d8301 | <ide><path>guides/source/upgrading_ruby_on_rails.md
<ide> want to add this feature it will need to be turned on in an initializer.
<ide>
<ide> Rails 5 now supports per-form CSRF tokens to mitigate against code-injection attacks with forms
<ide> created by JavaScript. With this option turned on, forms in your application will each have their
<del>own CSRF token that is specified to the action and method for that form.
<add>own CSRF token that is specific to the action and method for that form.
<ide>
<ide> config.action_controller.per_form_csrf_tokens = true
<ide> | 1 |
Java | Java | restore proper use of cacheloader | 9172a6d05e26a9103d0fbcc5ae1d047482319938 | <ide><path>spring-context-support/src/main/java/org/springframework/cache/guava/GuavaCache.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2015 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import java.util.concurrent.Callable;
<ide> import java.util.concurrent.ExecutionException;
<ide>
<add>import com.google.common.cache.LoadingCache;
<add>import com.google.common.util.concurrent.UncheckedExecutionException;
<add>
<ide> import org.springframework.cache.Cache;
<ide> import org.springframework.cache.support.SimpleValueWrapper;
<ide> import org.springframework.util.Assert;
<ide> public final boolean isAllowNullValues() {
<ide>
<ide> @Override
<ide> public ValueWrapper get(Object key) {
<del> Object value = this.cache.getIfPresent(key);
<del> return toWrapper(value);
<add> if (this.cache instanceof LoadingCache) {
<add> try {
<add> Object value = ((LoadingCache<Object, Object>) this.cache).get(key);
<add> return toWrapper(value);
<add> }
<add> catch (ExecutionException ex) {
<add> throw new UncheckedExecutionException(ex.getMessage(), ex);
<add> }
<add> }
<add> return toWrapper(this.cache.getIfPresent(key));
<ide> }
<ide>
<ide> @Override
<ide><path>spring-context-support/src/test/java/org/springframework/cache/guava/GuavaCacheManagerTests.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2015 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> import com.google.common.cache.CacheBuilder;
<ide> import com.google.common.cache.CacheLoader;
<add>import com.google.common.util.concurrent.UncheckedExecutionException;
<add>import org.junit.Rule;
<ide> import org.junit.Test;
<add>import org.junit.rules.ExpectedException;
<ide>
<ide> import org.springframework.cache.Cache;
<ide> import org.springframework.cache.CacheManager;
<ide> */
<ide> public class GuavaCacheManagerTests {
<ide>
<add> @Rule
<add> public final ExpectedException thrown = ExpectedException.none();
<add>
<ide> @Test
<ide> public void testDynamicMode() {
<ide> CacheManager cm = new GuavaCacheManager();
<ide> public void setCacheNameNullRestoreDynamicMode() {
<ide> assertNotNull(cm.getCache("someCache"));
<ide> }
<ide>
<add> @Test
<add> public void cacheLoaderUseLoadingCache() {
<add> GuavaCacheManager cm = new GuavaCacheManager("c1");
<add> cm.setCacheLoader(new CacheLoader<Object, Object>() {
<add> @Override
<add> public Object load(Object key) throws Exception {
<add> if ("ping".equals(key)) {
<add> return "pong";
<add> }
<add> throw new IllegalArgumentException("I only know ping");
<add> }
<add> });
<add> Cache cache1 = cm.getCache("c1");
<add> Cache.ValueWrapper value = cache1.get("ping");
<add> assertNotNull(value);
<add> assertEquals("pong", value.get());
<add>
<add> thrown.expect(UncheckedExecutionException.class);
<add> thrown.expectMessage("I only know ping");
<add> assertNull(cache1.get("foo"));
<add> }
<add>
<ide> @SuppressWarnings("unchecked")
<ide> private CacheLoader<Object, Object> mockCacheLoader() {
<ide> return mock(CacheLoader.class); | 2 |
Go | Go | use pivot_root instead of chroot | 5b5c884cc8266d0c2a56da0bc2df14cc9d5d85e8 | <ide><path>pkg/libcontainer/nsinit/mount.go
<ide> package nsinit
<ide> import (
<ide> "fmt"
<ide> "github.com/dotcloud/docker/pkg/system"
<add> "io/ioutil"
<ide> "os"
<ide> "path/filepath"
<ide> "syscall"
<ide> func setupNewMountNamespace(rootfs, console string, readonly bool) error {
<ide> if err := system.Chdir(rootfs); err != nil {
<ide> return fmt.Errorf("chdir into %s %s", rootfs, err)
<ide> }
<del> if err := system.Mount(rootfs, "/", "", syscall.MS_MOVE, ""); err != nil {
<del> return fmt.Errorf("mount move %s into / %s", rootfs, err)
<add>
<add> pivotDir, err := ioutil.TempDir(rootfs, ".pivot_root")
<add> if err != nil {
<add> return fmt.Errorf("can't create pivot_root dir %s", pivotDir, err)
<ide> }
<del> if err := system.Chroot("."); err != nil {
<del> return fmt.Errorf("chroot . %s", err)
<add> if err := system.Pivotroot(rootfs, pivotDir); err != nil {
<add> return fmt.Errorf("pivot_root %s", err)
<ide> }
<ide> if err := system.Chdir("/"); err != nil {
<ide> return fmt.Errorf("chdir / %s", err)
<ide> }
<ide>
<add> // path to pivot dir now changed, update
<add> pivotDir = filepath.Join("/", filepath.Base(pivotDir))
<add>
<add> if err := system.Unmount(pivotDir, syscall.MNT_DETACH); err != nil {
<add> return fmt.Errorf("unmount pivot_root dir %s", err)
<add> }
<add>
<add> if err := os.Remove(pivotDir); err != nil {
<add> return fmt.Errorf("remove pivot_root dir %s", err)
<add> }
<add>
<ide> system.Umask(0022)
<ide>
<ide> return nil | 1 |
Text | Text | update previous section and added new sections | bc64fb970e58179703730f46db242c0a8bd1406f | <ide><path>guide/english/csharp/array/index.md
<ide> evenNum = new int[] {2, 4, 6, 8};
<ide>
<ide> You can assign a value into an element directly by using the format below:
<ide>
<del>`nameOfArray[2] = 50;`
<add>```csharp
<add>nameOfArray[2] = 50;
<add>```
<ide>
<ide> Code above will assign the value of 50 directly into element [2]
<ide>
<ide> You can declare, initialize and assign values in the array all at once by using
<ide>
<ide> or simply:
<ide>
<del>`var nameOfArray = new dataType {value1, value2, value3, value4};`
<add>```csharp
<add>int [] nameOfArray = new nameOfArray[4] {2,9,56,1280};
<add>int [] nameOfSecondArray = nameOfArray;
<add>```
<add>
<add>## Sorting Values in Arrays
<add>
<add>You can sort values in arrays by using the `Array.Sort` method. `Array.Sort` sorts an array **by reference** so there is no need to assign the array to the output of the `Array.Sort` method.
<add>
<add>There are a number of different ways to use `Array.Sort`, but for a vast majority of use cases, the following few ways should do the trick.
<add>
<add>#### Sorting Implicitly (Ascending only)
<add>
<add>One way to sort an Array is to just call `Array.Sort` and pass in the array to sort. Keep in mind that only passing in the array this way will only sort an array in ascending order, which is why it is an implicit sort of sorting, as it is assumed that you want to sort this array in ascending order. Integers are always sorted in numerical order from least to greatest.
<add>
<add>For Example:
<add>
<add>```csharp
<add>int [] myIntArray = { 7, 4, 1, 9, 8 };
<add>Array.Sort(myIntArray);
<add>//sorts myIntArray in Ascending order
<add>//produces: { 1, 4, 7, 8, 9 } stored back into myIntArray
<add>```
<add>
<add>Strings are sorted going from left to right, with the lowest alphabetical representation from left to right being sent to the beginning and the highest being sent to the end.
<add>
<add>For Example:
<add>
<add>[Run the following code here at Repl.it](https://repl.it/@heyitsmarcus/SimpleArraySortingImplicit?language=csharp)
<add>```csharp
<add>string [] myStringArray = { "Hi", "Hello", "Konichiwa", "Hola", "Hallo" };
<add>Array.Sort(myStringArray);
<add>Console.WriteLine(String.Join(",", myStringArray));
<add>//sorts myStringArray in Ascending order
<add>//produces { "Hallo", "Hello", "Hi", "Hola", "Konichiwa" } back into myStringArray
<add>```
<add>
<add>#### Sorting Explicitly (Ascending/Descending/Any Order You Wish)
<add>
<add>One way to sort an array is to **explicitly** set your sorting method within the `Array.Sort` method, which will allow you to sort in any order you choose including preferring certain array items over others in their order.
<add>
<add>Using the `myStringArray` from above, you can sort it Ascending **explicitly** by passing in an anonymous method using delegate.
<add>
<add>For example:
<add>
<add>[Run the following code here at Repl.it](https://repl.it/@heyitsmarcus/SortArrayExplicitly?language=csharp)
<add>```csharp
<add>string[] myStringArray = { "Hi", "Hello", "Konichiwa", "Hola", "Hallo" };
<add>
<add>Array.Sort(myStringArray, delegate (string strPrev, string strNext) {
<add> //use a return statement here
<add> //strPrev represents the previous string in the array (also the starting element)
<add> //strNext represents the next string in the array up to the very end of the array
<add> return strPrev.CompareTo(strNext);
<add>});
<add>Console.WriteLine(String.Join(",", myStringArray));
<add>```
<add>You can use this override to sort a vast array of arrays, no pun intended! There are several more overrides for `Array.Sort` but you can get by, in most cases, by an implicit sort or an explicit sort like above.
<add>
<ide>
<ide> ## Jagged Arrays
<ide> | 1 |
Javascript | Javascript | clarify input documentation | 3f8bc3245cb07f49223111b6c33c6241014a23bd | <ide><path>packages/ember-handlebars/lib/controls.js
<ide> function normalizeHash(hash, hashTypes) {
<ide>
<ide> /**
<ide> * `{{input}}` inserts a new instance of either Ember.TextField or
<del> * Ember.Checkbox, depending on the `inputType` passed in. If no `inputType`
<add> * Ember.Checkbox, depending on the `type` option passed in. If no `type`
<ide> * is supplied it defaults to Ember.TextField.
<ide> *
<ide> * @method input | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.