content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Mixed | Javascript | emit error on invalid address family | 7c73cd4c70513dd4fa1f7ea13e3bb3270696eabe | <ide><path>doc/api/errors.md
<ide> The `inspector` module is not available for use.
<ide> While using the `inspector` module, an attempt was made to use the inspector
<ide> before it was connected.
<ide>
<add><a id="ERR_INVALID_ADDRESS_FAMILY"></a>
<add>### ERR_INVALID_ADDRESS_FAMILY
<add>
<add>The provided address family is not understood by the Node.js API.
<add>
<ide> <a id="ERR_INVALID_ARG_TYPE"></a>
<ide> ### ERR_INVALID_ARG_TYPE
<ide>
<ide><path>lib/internal/errors.js
<ide> E('ERR_INSPECTOR_ALREADY_CONNECTED',
<ide> E('ERR_INSPECTOR_CLOSED', 'Session was closed', Error);
<ide> E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error);
<ide> E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error);
<add>E('ERR_INVALID_ADDRESS_FAMILY', 'Invalid address family: %s', RangeError);
<ide> E('ERR_INVALID_ARG_TYPE', invalidArgType, TypeError);
<ide> E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => {
<ide> const util = lazyUtil();
<ide><path>lib/net.js
<ide> const {
<ide> } = require('internal/async_hooks');
<ide> const errors = require('internal/errors');
<ide> const {
<add> ERR_INVALID_ADDRESS_FAMILY,
<ide> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_FD_TYPE,
<ide> ERR_INVALID_IP_ADDRESS,
<ide> function lookupAndConnect(self, options) {
<ide> err.port = options.port;
<ide> err.message = err.message + ' ' + options.host + ':' + options.port;
<ide> process.nextTick(connectErrorNT, self, err);
<add> } else if (addressType !== 4 && addressType !== 6) {
<add> err = new ERR_INVALID_ADDRESS_FAMILY(addressType);
<add> err.host = options.host;
<add> err.port = options.port;
<add> err.message = err.message + ' ' + options.host + ':' + options.port;
<add> process.nextTick(connectErrorNT, self, err);
<ide> } else {
<ide> self._unrefTimer();
<ide> defaultTriggerAsyncIdScope(
<ide><path>test/parallel/test-net-options-lookup.js
<ide> function connectDoesNotThrow(input) {
<ide> lookup: input
<ide> };
<ide>
<del> net.connect(opts);
<add> return net.connect(opts);
<add>}
<add>
<add>{
<add> // Verify that an error is emitted when an invalid address family is returned.
<add> const s = connectDoesNotThrow((host, options, cb) => {
<add> cb(null, '127.0.0.1', 100);
<add> });
<add>
<add> s.on('error', common.expectsError({ code: 'ERR_INVALID_ADDRESS_FAMILY' }));
<ide> } | 4 |
Ruby | Ruby | remove unused require | 1006382655487bf4afaa237920e03c1dfc8c5016 | <ide><path>railties/test/application/middleware_test.rb
<ide> require 'isolation/abstract_unit'
<del>require 'stringio'
<del>require 'rack/test'
<ide>
<ide> module ApplicationTests
<ide> class MiddlewareTest < ActiveSupport::TestCase
<ide><path>railties/test/application/queue_test.rb
<ide> require 'isolation/abstract_unit'
<del>require 'rack/test'
<ide>
<ide> module ApplicationTests
<ide> class QueueTest < ActiveSupport::TestCase | 2 |
Javascript | Javascript | add reserved words to avoid syntax errors | b77a52b43af0e29cd944358d2894bdbc41cdff25 | <ide><path>lib/optimize/ConcatenatedModule.js
<ide> class ConcatenatedModule extends Module {
<ide> });
<ide>
<ide> // List of all used names to avoid conflicts
<del> const allUsedNames = new Set(["__WEBPACK_MODULE_DEFAULT_EXPORT__", "Object"]);
<add> const allUsedNames = new Set([
<add> "abstract", "arguments", "await", "boolean", "break", "byte", "case", "catch", "char", "class",
<add> "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "eval",
<add> "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if",
<add> "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new",
<add> "null", "package", "private", "protected", "public", "return", "short", "static", "super",
<add> "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof",
<add> "var", "void", "volatile", "while", "with", "yield",
<add>
<add> "Array", "Date", "eval", "function", "hasOwnProperty", "Infinity", "isFinite", "isNaN",
<add> "isPrototypeOf", "length", "Math", "NaN", "name", "Number", "Object", "prototype", "String",
<add> "toString", "undefined", "valueOf",
<add>
<add> "alert", "all", "anchor", "anchors", "area", "assign", "blur", "button", "checkbox",
<add> "clearInterval", "clearTimeout", "clientInformation", "close", "closed", "confirm", "constructor",
<add> "crypto", "decodeURI", "decodeURIComponent", "defaultStatus", "document", "element", "elements",
<add> "embed", "embeds", "encodeURI", "encodeURIComponent", "escape", "event", "fileUpload", "focus",
<add> "form", "forms", "frame", "innerHeight", "innerWidth", "layer", "layers", "link", "location",
<add> "mimeTypes", "navigate", "navigator", "frames", "frameRate", "hidden", "history", "image",
<add> "images", "offscreenBuffering", "open", "opener", "option", "outerHeight", "outerWidth",
<add> "packages", "pageXOffset", "pageYOffset", "parent", "parseFloat", "parseInt", "password", "pkcs11",
<add> "plugin", "prompt", "propertyIsEnum", "radio", "reset", "screenX", "screenY", "scroll", "secure",
<add> "select", "self", "setInterval", "setTimeout", "status", "submit", "taint", "text", "textarea",
<add> "top", "unescape", "untaint", "window",
<add>
<add> "onblur", "onclick", "onerror", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onmouseover",
<add> "onload", "onmouseup", "onmousedown", "onsubmit"
<add> ]);
<ide>
<ide> // get all global names
<ide> modulesWithInfo.forEach(info => { | 1 |
PHP | PHP | move domain() and geturi() out of foreach loop | 10a0c61cc47bfa97f8b440b6266b8a47d51239b1 | <ide><path>src/Illuminate/Routing/RouteCollection.php
<ide> public function add(Route $route)
<ide> */
<ide> protected function addToCollections($route)
<ide> {
<add> $domainAndUri = $route->domain().$route->getUri();
<add>
<ide> foreach ($route->methods() as $method)
<ide> {
<del> $domainAndUri = $route->domain().$route->getUri();
<ide> $this->routes[$method][$domainAndUri] = $route;
<ide> }
<ide> | 1 |
Python | Python | remove the staticmethod used to load the config | 81ee29ee8d64c292c3fd5fc7e13b387acd1bfc39 | <ide><path>transformers/modeling_bert.py
<ide> class BertDecoderModel(BertPreTrainedModel):
<ide>
<ide> """
<ide> def __init__(self, config):
<del> super(BertModel, self).__init__(config)
<add> super(BertDecoderModel, self).__init__(config)
<ide>
<ide> self.embeddings = BertEmbeddings(config)
<ide> self.decoder = BertDecoder(config)
<ide> def from_pretrained(cls, pretrained_model_or_path, *model_args, **model_kwargs):
<ide> pretrained weights we need to override the `from_pretrained` method of the base `PreTrainedModel`
<ide> class.
<ide> """
<del> pretrained_encoder = BertModel.from_pretrained(pretrained_model_or_path, *model_args, **model_kwargs)
<del>
<del> config = cls._load_config(pretrained_model_or_path, *model_args, **model_kwargs)
<del> model = cls(config)
<del> model.encoder = pretrained_encoder
<del>
<del> return model
<ide>
<del> def _load_config(self, pretrained_model_name_or_path, *args, **kwargs):
<del> config = kwargs.pop('config', None)
<add> # Load the configuration
<add> config = model_kwargs.pop('config', None)
<ide> if config is None:
<del> cache_dir = kwargs.pop('cache_dir', None)
<del> force_download = kwargs.pop('force_download', False)
<del> config, _ = self.config_class.from_pretrained(
<del> pretrained_model_name_or_path,
<del> *args,
<add> cache_dir = model_kwargs.pop('cache_dir', None)
<add> force_download = model_kwargs.pop('force_download', False)
<add> config, _ = cls.config_class.from_pretrained(
<add> pretrained_model_or_path,
<add> *model_args,
<ide> cache_dir=cache_dir,
<ide> return_unused_kwargs=True,
<ide> force_download=force_download,
<del> **kwargs
<add> **model_kwargs
<ide> )
<del> return config
<add> model = cls(config)
<add>
<add> # The encoder is loaded with pretrained weights
<add> pretrained_encoder = BertModel.from_pretrained(pretrained_model_or_path, *model_args, **model_kwargs)
<add> model.encoder = pretrained_encoder
<add>
<add> return model
<ide>
<ide> def forward(self, input_ids, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None):
<ide> encoder_outputs = self.encoder(input_ids, | 1 |
PHP | PHP | use user resolver | 8327416018d07568b39aeddc8a594eb7f430090b | <ide><path>src/Illuminate/Auth/Access/Gate.php
<ide> class Gate implements GateContract
<ide> protected $container;
<ide>
<ide> /**
<del> * The user instance.
<add> * The user resolver callable.
<ide> *
<del> * @var \Illuminate\Contracts\Auth\Authenticatable
<add> * @var callable
<ide> */
<del> protected $user;
<add> protected $userResolver;
<ide>
<ide> /**
<ide> * All of the defined abilities.
<ide> class Gate implements GateContract
<ide> * Create a new gate instance.
<ide> *
<ide> * @param \Illuminate\Contracts\Container\Container $container
<del> * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
<add> * @param callable $userResolver
<ide> * @param array $abilities
<ide> * @param array $policies
<ide> * @return void
<ide> */
<del> public function __construct(Container $container, $user, array $abilities = [], array $policies = [])
<add> public function __construct(Container $container, callable $userResolver, array $abilities = [], array $policies = [])
<ide> {
<del> $this->user = $user;
<ide> $this->policies = $policies;
<ide> $this->container = $container;
<ide> $this->abilities = $abilities;
<add> $this->userResolver = $userResolver;
<ide> }
<ide>
<ide> /**
<ide> public function denies($ability, $arguments = [])
<ide> */
<ide> public function check($ability, $arguments = [])
<ide> {
<del> if (! $this->user) {
<add> $user = $this->resolveUser();
<add>
<add> if (! $user) {
<ide> return false;
<ide> }
<ide>
<ide> public function check($ability, $arguments = [])
<ide> return false;
<ide> }
<ide>
<del> array_unshift($arguments, $this->user);
<add> array_unshift($arguments, $user);
<ide>
<ide> return call_user_func_array($callback, $arguments);
<ide> }
<ide> public function resolvePolicy($class)
<ide> public function forUser($user)
<ide> {
<ide> return new static(
<del> $this->container, $user, $this->abilities, $this->policies
<add> $this->container, function () use ($user) { return $user; }, $this->abilities, $this->policies
<ide> );
<ide> }
<add>
<add> /**
<add> * Resolve the user from the user resolver.
<add> *
<add> * @return mixed
<add> */
<add> protected function resolveUser()
<add> {
<add> return call_user_func($this->userResolver);
<add> }
<ide> }
<ide><path>src/Illuminate/Auth/AuthServiceProvider.php
<ide> protected function registerUserResolver()
<ide> protected function registerAccessGate()
<ide> {
<ide> $this->app->singleton(GateContract::class, function ($app) {
<del> return new Gate($app, $app['auth']->user());
<add> return new Gate($app, function () use ($app) { return $app['auth']->user(); });
<ide> });
<ide> }
<ide>
<ide><path>tests/Auth/AuthAccessGateTest.php
<ide> public function test_for_user_method_attaches_a_new_user_to_a_new_gate_instance(
<ide>
<ide> protected function getBasicGate()
<ide> {
<del> return new Gate(new Container, (object) ['id' => 1]);
<add> return new Gate(new Container, function () { return (object) ['id' => 1]; });
<ide> }
<ide> }
<ide> | 3 |
PHP | PHP | fix custom id problem in multicheckbox() | 56033f0ff3f928a9be46eba4ec4706cef11f7620 | <ide><path>src/View/Helper/FormHelper.php
<ide> public function multiCheckbox(string $fieldName, iterable $options, array $attri
<ide> 'secure' => true,
<ide> ];
<ide>
<add> $generatedHiddenId = false;
<ide> if (!isset($attributes['id'])) {
<ide> $attributes['id'] = true;
<add> $generatedHiddenId = true;
<ide> }
<ide>
<ide> $attributes = $this->_initInputField($fieldName, $attributes);
<ide> public function multiCheckbox(string $fieldName, iterable $options, array $attri
<ide> }
<ide> unset($attributes['hiddenField']);
<ide>
<del> if (!isset($attributes['type']) && isset($attributes['name'])) {
<add> if ($generatedHiddenId) {
<ide> unset($attributes['id']);
<ide> }
<ide>
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testSelectCheckboxMultipleOverrideName(): void
<ide> $this->assertHtml($expected, $result);
<ide> }
<ide>
<add> /**
<add> * testSelectCheckboxMultipleOverrideName method
<add> *
<add> * Test that select() with multiple = checkbox works with overriding name attribute.
<add> */
<add> public function testSelectCheckboxMultipleCustomId(): void
<add> {
<add> $result = $this->Form->select('category', ['1', '2'], [
<add> 'multiple' => 'checkbox',
<add> 'id' => 'cat',
<add> ]);
<add> $expected = [
<add> 'input' => ['type' => 'hidden', 'name' => 'category', 'value' => '', 'id' => 'cat'],
<add> ['div' => ['class' => 'checkbox']],
<add> ['label' => ['for' => 'cat-0']],
<add> ['input' => ['type' => 'checkbox', 'name' => 'category[]', 'value' => '0', 'id' => 'cat-0']],
<add> '1',
<add> '/label',
<add> '/div',
<add> ['div' => ['class' => 'checkbox']],
<add> ['label' => ['for' => 'cat-1']],
<add> ['input' => ['type' => 'checkbox', 'name' => 'category[]', 'value' => '1', 'id' => 'cat-1']],
<add> '2',
<add> '/label',
<add> '/div',
<add> ];
<add> $this->assertHtml($expected, $result);
<add>
<add> $result = $this->Form->multiCheckbox(
<add> 'category',
<add> ['1', '2'],
<add> ['id' => 'cat']
<add> );
<add> $this->assertHtml($expected, $result);
<add> }
<add>
<ide> /**
<ide> * testControlMultiCheckbox method
<ide> * | 2 |
Python | Python | remove old links to cdn | b5492582d05be76e19098fcbd2400bc9518afc40 | <ide><path>src/transformers/models/herbert/tokenization_herbert.py
<ide> }
<ide>
<ide> PRETRAINED_VOCAB_FILES_MAP = {
<del> "vocab_file": {"allegro/herbert-base-cased": "https://cdn.huggingface.co/allegro/herbert-base-cased/vocab.json"},
<del> "merges_file": {"allegro/herbert-base-cased": "https://cdn.huggingface.co/allegro/herbert-base-cased/merges.txt"},
<add> "vocab_file": {"allegro/herbert-base-cased": "https://huggingface.co/allegro/herbert-base-cased/vocab.json"},
<add> "merges_file": {"allegro/herbert-base-cased": "https://huggingface.co/allegro/herbert-base-cased/merges.txt"},
<ide> }
<ide>
<ide> PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"allegro/herbert-base-cased": 514}
<ide><path>src/transformers/models/herbert/tokenization_herbert_fast.py
<ide> }
<ide>
<ide> PRETRAINED_VOCAB_FILES_MAP = {
<del> "vocab_file": {"allegro/herbert-base-cased": "https://cdn.huggingface.co/allegro/herbert-base-cased/vocab.json"},
<del> "merges_file": {"allegro/herbert-base-cased": "https://cdn.huggingface.co/allegro/herbert-base-cased/merges.txt"},
<add> "vocab_file": {"allegro/herbert-base-cased": "https://huggingface.co/allegro/herbert-base-cased/vocab.json"},
<add> "merges_file": {"allegro/herbert-base-cased": "https://huggingface.co/allegro/herbert-base-cased/merges.txt"},
<ide> }
<ide>
<ide> PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {"allegro/herbert-base-cased": 514}
<ide><path>src/transformers/models/reformer/configuration_reformer.py
<ide> logger = logging.get_logger(__name__)
<ide>
<ide> REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP = {
<del> "google/reformer-crime-and-punishment": "https://cdn.huggingface.co/google/reformer-crime-and-punishment/config.json",
<del> "google/reformer-enwik8": "https://cdn.huggingface.co/google/reformer-enwik8/config.json",
<add> "google/reformer-crime-and-punishment": "https://huggingface.co/google/reformer-crime-and-punishment/config.json",
<add> "google/reformer-enwik8": "https://huggingface.co/google/reformer-enwik8/config.json",
<ide> }
<ide>
<ide>
<ide><path>src/transformers/models/xlm_prophetnet/tokenization_xlm_prophetnet.py
<ide>
<ide> PRETRAINED_VOCAB_FILES_MAP = {
<ide> "vocab_file": {
<del> "microsoft/xprophetnet-large-wiki100-cased": "https://cdn.huggingface.co/microsoft/xprophetnet-large-wiki100-cased/prophetnet.tokenizer",
<add> "microsoft/xprophetnet-large-wiki100-cased": "https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/prophetnet.tokenizer",
<ide> }
<ide> }
<ide> | 4 |
Text | Text | add efficientnet to community | 127c9d809dc009d6c44985455ee0f6ce1b82285e | <ide><path>community/README.md
<ide> This repository provides a curated list of the GitHub repositories with machine
<ide> | [ResNet 101](https://github.com/IntelAI/models/tree/master/benchmarks/image_recognition/tensorflow/resnet101) | [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385) | • Int8 Inference<br/>• FP32 Inference | [Intel](https://github.com/IntelAI) |
<ide> | [ResNet 50](https://github.com/IntelAI/models/tree/master/benchmarks/image_recognition/tensorflow/resnet50) | [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385) | • Int8 Inference<br/>• FP32 Inference | [Intel](https://github.com/IntelAI) |
<ide> | [ResNet 50v1.5](https://github.com/IntelAI/models/tree/master/benchmarks/image_recognition/tensorflow/resnet50v1_5) | [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385) | • Int8 Inference<br/>• FP32 Inference<br/>• FP32 Training | [Intel](https://github.com/IntelAI) |
<add>| [EfficientNet](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow2/Classification/ConvNets/efficientnet) | [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/pdf/1905.11946.pdf) | • Automatic mixed precision<br/>• Horovod Multi-GPU training (NCCL)<br/>• Multi-node training on a Pyxis/Enroot Slurm cluster<br/>• XLA | [NVIDIA](https://github.com/NVIDIA) |
<ide>
<ide> ### Object Detection
<ide> | 1 |
Python | Python | add example to histogram2d docstring | 7eab53a8ba51089c3debc6a18523587a8ce1ba0a | <ide><path>numpy/lib/twodim_base.py
<ide> def histogram2d(x, y, bins=10, range=None, normed=None, weights=None,
<ide> >>> ax.images.append(im)
<ide> >>> plt.show()
<ide>
<add> It is also possible to construct a 2-D histogram without specifying bin
<add> edges:
<add>
<add> >>> # Generate non-symmetric test data
<add> >>> n = 10000
<add> >>> x = np.linspace(1, 100, n)
<add> >>> y = 2*np.log(x) + np.random.rand(n) - 0.5
<add> >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges
<add> >>> H, yedges, xedges = np.histogram2d(y, x, bins=20)
<add>
<add> Now we can plot the histogram using
<add> :func:`pcolormesh <matplotlib.pyplot.pcolormesh>`, and a
<add> :func:`hexbin <matplotlib.pyplot.hexbin>` for comparison.
<add>
<add> >>> # Plot histogram using pcolormesh
<add> >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True)
<add> >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow')
<add> >>> ax1.plot(x, 2*np.log(x), 'k-')
<add> >>> ax1.set_xlim(x.min(), x.max())
<add> >>> ax1.set_ylim(y.min(), y.max())
<add> >>> ax1.set_xlabel('x')
<add> >>> ax1.set_ylabel('y')
<add> >>> ax1.set_title('histogram2d')
<add> >>> ax1.grid()
<add>
<add> >>> # Create hexbin plot for comparison
<add> >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow')
<add> >>> ax2.plot(x, 2*np.log(x), 'k-')
<add> >>> ax2.set_title('hexbin')
<add> >>> ax2.set_xlim(x.min(), x.max())
<add> >>> ax2.set_xlabel('x')
<add> >>> ax2.grid()
<add>
<add> >>> plt.show()
<ide> """
<ide> from numpy import histogramdd
<ide> | 1 |
Text | Text | add referecnes for translations | e8403d4ef8e08d21db1e96a761e4ec35b70b3bd7 | <ide><path>threejs/lessons/threejs-custom-buffergeometry.md
<ide> I hope these were useful examples of how to use `BufferGeometry` directly to
<ide> make your own geometry and how to dynamically update the contents of a
<ide> `BufferAttribute`.
<ide>
<add><!-- needed to prevent warning from outdated translation -->
<add><a href="resources/threejs-geometry.svg"></a>
<add><a href="threejs-custom-geometry.html"></a>
<add>
<ide> <canvas id="c"></canvas>
<ide> <script type="module" src="resources/threejs-custom-buffergeometry.js"></script>
<ide> | 1 |
Java | Java | fix dispatchdraw crash | dd9fd2acac35fd7a257c1c6f80c6670b2a03e039 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java
<ide> public class ReactFeatureFlags {
<ide>
<ide> /** Disable customDrawOrder in ReactViewGroup under Fabric only. */
<ide> public static boolean disableCustomDrawOrderFabric = false;
<add>
<add> /** Potential bugfix for crashes caused by mutating the view hierarchy during onDraw. */
<add> public static boolean enableDrawMutationFix = true;
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java
<ide> public boolean getThemeData(int surfaceID, float[] defaultTextInputPadding) {
<ide> @Override
<ide> @UiThread
<ide> @ThreadConfined(UI)
<del> public void synchronouslyUpdateViewOnUIThread(int reactTag, @NonNull ReadableMap props) {
<add> public void synchronouslyUpdateViewOnUIThread(
<add> final int reactTag, @NonNull final ReadableMap props) {
<ide> UiThreadUtil.assertOnUiThread();
<ide>
<ide> int commitNumber = mCurrentSynchronousCommitNumber++;
<ide>
<del> // We are on the UI thread so this is safe to call. We try to flush any existing
<del> // mount instructions that are queued.
<del> tryDispatchMountItems();
<add> // We are on the UI thread so this would otherwise be safe to call, *BUT* we don't know
<add> // where we are on the callstack. Why isn't this safe, and why do we have additional safeguards
<add> // here?
<add> //
<add> // A tangible example where this will cause a crash:
<add> // 1. There are queued "delete" mutations
<add> // 2. We're called by this stack trace:
<add> // FabricUIManager.synchronouslyUpdateViewOnUIThread(FabricUIManager.java:574)
<add> // PropsAnimatedNode.updateView(PropsAnimatedNode.java:114)
<add> // NativeAnimatedNodesManager.updateNodes(NativeAnimatedNodesManager.java:655)
<add> // NativeAnimatedNodesManager.handleEvent(NativeAnimatedNodesManager.java:521)
<add> // NativeAnimatedNodesManager.onEventDispatch(NativeAnimatedNodesManager.java:483)
<add> // EventDispatcherImpl.dispatchEvent(EventDispatcherImpl.java:116)
<add> // ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.java:85)
<add> // ReactScrollViewHelper.emitScrollEvent(ReactScrollViewHelper.java:46)
<add> // ReactScrollView.onScrollChanged(ReactScrollView.java:285)
<add> // ReactScrollView.onOverScrolled(ReactScrollView.java:808)
<add> // android.view.View.overScrollBy(View.java:26052)
<add> // android.widget.ScrollView.overScrollBy(ScrollView.java:2040)
<add> // android.widget.ScrollView.computeScroll(ScrollView.java:1481)
<add> // android.view.View.updateDisplayListIfDirty(View.java:20466)
<add> if (!ReactFeatureFlags.enableDrawMutationFix) {
<add> tryDispatchMountItems();
<add> }
<ide>
<del> try {
<del> ReactMarker.logFabricMarker(
<del> ReactMarkerConstants.FABRIC_UPDATE_UI_MAIN_THREAD_START, null, commitNumber);
<del> if (ENABLE_FABRIC_LOGS) {
<del> FLog.d(
<del> TAG,
<del> "SynchronouslyUpdateViewOnUIThread for tag %d: %s",
<del> reactTag,
<del> (IS_DEVELOPMENT_ENVIRONMENT ? props.toHashMap().toString() : "<hidden>"));
<add> MountItem synchronousMountItem =
<add> new MountItem() {
<add> @Override
<add> public void execute(@NonNull MountingManager mountingManager) {
<add> try {
<add> updatePropsMountItem(reactTag, props).execute(mountingManager);
<add> } catch (Exception ex) {
<add> // TODO T42943890: Fix animations in Fabric and remove this try/catch
<add> ReactSoftException.logSoftException(
<add> TAG,
<add> new ReactNoCrashSoftException(
<add> "Caught exception in synchronouslyUpdateViewOnUIThread", ex));
<add> }
<add> }
<add> };
<add>
<add> // If the reactTag exists, we assume that it might at the end of the next
<add> // batch of MountItems. Otherwise, we try to execute immediately.
<add> if (!mMountingManager.getViewExists(reactTag)) {
<add> synchronized (mMountItemsLock) {
<add> mMountItems.add(synchronousMountItem);
<ide> }
<add> return;
<add> }
<ide>
<del> updatePropsMountItem(reactTag, props).execute(mMountingManager);
<del> } catch (Exception ex) {
<del> // TODO T42943890: Fix animations in Fabric and remove this try/catch
<del> ReactSoftException.logSoftException(
<add> ReactMarker.logFabricMarker(
<add> ReactMarkerConstants.FABRIC_UPDATE_UI_MAIN_THREAD_START, null, commitNumber);
<add>
<add> if (ENABLE_FABRIC_LOGS) {
<add> FLog.d(
<ide> TAG,
<del> new ReactNoCrashSoftException(
<del> "Caught exception in synchronouslyUpdateViewOnUIThread", ex));
<del> } finally {
<del> ReactMarker.logFabricMarker(
<del> ReactMarkerConstants.FABRIC_UPDATE_UI_MAIN_THREAD_END, null, commitNumber);
<add> "SynchronouslyUpdateViewOnUIThread for tag %d: %s",
<add> reactTag,
<add> (IS_DEVELOPMENT_ENVIRONMENT ? props.toHashMap().toString() : "<hidden>"));
<ide> }
<add>
<add> synchronousMountItem.execute(mMountingManager);
<add>
<add> ReactMarker.logFabricMarker(
<add> ReactMarkerConstants.FABRIC_UPDATE_UI_MAIN_THREAD_END, null, commitNumber);
<ide> }
<ide>
<ide> public void addUIManagerEventListener(UIManagerListener listener) {
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java
<ide> public void run() {
<ide> }
<ide> }
<ide>
<del> private @NonNull ViewState getViewState(int tag) {
<add> @NonNull
<add> private ViewState getViewState(int tag) {
<ide> ViewState viewState = mTagToViewState.get(tag);
<ide> if (viewState == null) {
<ide> throw new RetryableMountingLayerException("Unable to find viewState view for tag " + tag);
<ide> }
<ide> return viewState;
<ide> }
<ide>
<add> public boolean getViewExists(int tag) {
<add> return mTagToViewState.get(tag) != null;
<add> }
<add>
<ide> private @Nullable ViewState getNullableViewState(int tag) {
<ide> return mTagToViewState.get(tag);
<ide> } | 3 |
Text | Text | revise changelog.md text | 34f164f1c29f5f51520b6f68bdc107effecb1c8a | <ide><path>CHANGELOG.md
<ide> # Node.js Changelog
<ide>
<del><!--lint disable maximum-line-length-->
<del>
<del>To make the changelog easier to both use and manage, it has been split into
<del>multiple files organized according to significant major and minor Node.js
<del>release lines.
<del>
<ide> Select a Node.js version below to view the changelog history:
<ide>
<ide> * [Node.js 11](doc/changelogs/CHANGELOG_V11.md) - **Current**
<ide> release.
<ide>
<ide> ### Notes
<ide>
<del>* Release streams marked with `LTS` are currently covered by the
<del> [Node.js Long Term Support plan](https://github.com/nodejs/Release).
<del>* Release versions displayed in **bold** text represent the most
<del> recent actively supported release.
<add>* The [Node.js Long Term Support plan](https://github.com/nodejs/Release) covers
<add> LTS releases.
<add>* Release versions in **bold** text are the most recent supported releases.
<ide>
<ide> ----
<ide> ---- | 1 |
Text | Text | update wrong output of the example of code | 9e5b352a862de1f1030b5ed622d559d1639371fd | <ide><path>guide/english/c/for/index.md
<ide> int main () {
<ide> > Item on index 1 is 2
<ide> > Item on index 2 is 3
<ide> > Item on index 3 is 4
<add>> Item on index 4 is 5
<ide> ```
<ide> ## Example for printing star pattern for pyramid
<ide> ```c | 1 |
PHP | PHP | fix more phpstan errors | 7b2163012b0a63883139b03d7625809026cda2a9 | <ide><path>src/Error/BaseErrorHandler.php
<ide> namespace Cake\Error;
<ide>
<ide> use Cake\Core\Configure;
<add>use Cake\Core\Exception\Exception as CoreException;
<ide> use Cake\Log\Log;
<ide> use Cake\Routing\Router;
<ide> use Error;
<ide> protected function _logException(Throwable $exception): bool
<ide>
<ide> if (!empty($config['skipLog'])) {
<ide> foreach ((array)$config['skipLog'] as $class) {
<del> if ($error instanceof $class) {
<add> if ($exception instanceof $class) {
<ide> return false;
<ide> }
<ide> }
<ide> protected function _getMessage(Throwable $exception): string
<ide> );
<ide> $debug = Configure::read('debug');
<ide>
<del> if ($debug && method_exists($exception, 'getAttributes')) {
<add> if ($debug && $exception instanceof CoreException) {
<ide> $attributes = $exception->getAttributes();
<ide> if ($attributes) {
<ide> $message .= "\nException Attributes: " . var_export($exception->getAttributes(), true);
<ide><path>src/Log/LogEngineRegistry.php
<ide> protected function _create($class, $alias, $settings)
<ide> * @param string $name The logger name.
<ide> * @return $this
<ide> */
<del> public function unload(string $name
<add> public function unload(string $name)
<ide> {
<ide> unset($this->_loaded[$name]);
<ide> | 2 |
Python | Python | add some catch. should correct the issue #223 | 0a789bb9a1c0b7f511640c8ff3dcb9e6dc966070 | <ide><path>glances/glances.py
<ide> def __init__(self):
<ide> """
<ide>
<ide> self._init_host()
<add>
<add> # Init the grab error tags
<add> # for managing error during stats grab
<add> # By default, we *hope* that there is no error
<add> self.network_error_tag = False
<add> self.diskio_error_tag = False
<ide>
<ide> # Init the fs stats
<ide> try:
<ide> def __update__(self, input_stats):
<ide> self.memswap = {}
<ide>
<ide> # NET
<del> if network_tag:
<add> if network_tag and not self.network_error_tag:
<ide> self.network = []
<ide> # By storing time data we enable Rx/s and Tx/s calculations in the
<ide> # XML/RPC API, which would otherwise be overly difficult work
<ide> # for users of the API
<ide> time_since_update = getTimeSinceLastUpdate('net')
<ide> if not hasattr(self, 'network_old'):
<del> self.network_old = psutil.network_io_counters(pernic=True)
<add> try:
<add> self.network_old = psutil.network_io_counters(pernic=True)
<add> except IOError:
<add> self.network_error_tag = True
<ide> else:
<ide> self.network_new = psutil.network_io_counters(pernic=True)
<ide> for net in self.network_new:
<ide> def __update__(self, input_stats):
<ide> self.hddtemp = self.glancesgrabhddtemp.get()
<ide>
<ide> # DISK I/O
<del> if diskio_tag:
<add> if diskio_tag and not self.diskio_error_tag:
<ide> time_since_update = getTimeSinceLastUpdate('disk')
<ide> self.diskio = []
<ide> if not hasattr(self, 'diskio_old'):
<del> self.diskio_old = psutil.disk_io_counters(perdisk=True)
<add> try:
<add> self.diskio_old = psutil.disk_io_counters(perdisk=True)
<add> except IOError:
<add> self.diskio_error_tag = True
<ide> else:
<ide> self.diskio_new = psutil.disk_io_counters(perdisk=True)
<ide> for disk in self.diskio_new:
<ide> def display(self, stats, cs_status="None"):
<ide> cpu_offset = self.displayCpu(stats.getCpu(), stats.getPerCpu(), processlist)
<ide> load_offset = self.displayLoad(stats.getLoad(), stats.getCore(), processlist, cpu_offset)
<ide> self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, load_offset)
<del> network_count = self.displayNetwork(stats.getNetwork())
<add> network_count = self.displayNetwork(stats.getNetwork(), error = stats.network_error_tag)
<ide> sensors_count = self.displaySensors(stats.getSensors(),
<ide> self.network_y + network_count)
<ide> hddtemp_count = self.displayHDDTemp(stats.getHDDTemp(),
<ide> self.network_y + network_count + sensors_count)
<ide> diskio_count = self.displayDiskIO(stats.getDiskIO(),
<del> self.network_y + sensors_count +
<del> network_count + hddtemp_count)
<add> offset_y = self.network_y + sensors_count +
<add> network_count + hddtemp_count,
<add> error = stats.diskio_error_tag)
<ide> fs_count = self.displayFs(stats.getFs(),
<ide> self.network_y + sensors_count +
<ide> network_count + diskio_count +
<ide> def displayMem(self, mem, memswap, proclist, offset_x=0):
<ide> self.mem_y + 3, self.mem_x + offset_x + 39,
<ide> format(self.__autoUnit(memswap['free']), '>5'), 8)
<ide>
<del> def displayNetwork(self, network):
<add> def displayNetwork(self, network, error = False):
<ide> """
<ide> Display the network interface bitrate
<add> If error = True, then display a grab error message
<ide> Return the number of interfaces
<ide> """
<ide> if not self.network_tag:
<ide> def displayNetwork(self, network):
<ide> self.term_window.addnstr(self.network_y, self.network_x + 18,
<ide> format(_(tx_column_name), '>5'), 5)
<ide>
<del> # If there is no data to display...
<del> if not network:
<add> if error:
<add> # If there is a grab error
<add> self.term_window.addnstr(self.network_y + 1, self.network_x,
<add> _("Can not grab data..."), 20)
<add> return 3
<add> elif not network:
<add> # or no data to display...
<ide> self.term_window.addnstr(self.network_y + 1, self.network_x,
<ide> _("Compute data..."), 15)
<ide> return 3
<ide> def displayHDDTemp(self, hddtemp, offset_y=0):
<ide> return ret
<ide> return 0
<ide>
<del> def displayDiskIO(self, diskio, offset_y=0):
<add> def displayDiskIO(self, diskio, offset_y=0, error = False):
<ide> # Disk input/output rate
<ide> if not self.diskio_tag:
<ide> return 0
<ide> def displayDiskIO(self, diskio, offset_y=0):
<ide> self.term_window.addnstr(self.diskio_y, self.diskio_x + 18,
<ide> format(_("Out/s"), '>5'), 5)
<ide>
<del> # If there is no data to display...
<del> if not diskio:
<add> if error:
<add> # If there is a grab error
<add> self.term_window.addnstr(self.diskio_y + 1, self.diskio_x,
<add> _("Can not grab data..."), 20)
<add> return 3
<add> elif not diskio:
<add> # or no data to display...
<ide> self.term_window.addnstr(self.diskio_y + 1, self.diskio_x,
<ide> _("Compute data..."), 15)
<ide> return 3 | 1 |
Javascript | Javascript | use mustnotcall in test-http-eof-on-connect | 77d575d0057692413f0c26ad90425077c40f339f | <ide><path>test/parallel/test-http-eof-on-connect.js
<ide> const http = require('http');
<ide> // It is separate from test-http-malformed-request.js because it is only
<ide> // reproduceable on the first packet on the first connection to a server.
<ide>
<del>const server = http.createServer(common.noop);
<add>const server = http.createServer(common.mustNotCall());
<ide> server.listen(0);
<ide>
<ide> server.on('listening', function() { | 1 |
Go | Go | fix flaky test testsuccessfuldownload | 0757a52737b283e56c9a8f5597e8b52c365ce1f6 | <ide><path>distribution/xfer/download_test.go
<ide> func TestSuccessfulDownload(t *testing.T) {
<ide>
<ide> progressChan := make(chan progress.Progress)
<ide> progressDone := make(chan struct{})
<del> receivedProgress := make(map[string]int64)
<add> receivedProgress := make(map[string]progress.Progress)
<ide>
<ide> go func() {
<ide> for p := range progressChan {
<del> if p.Action == "Downloading" {
<del> receivedProgress[p.ID] = p.Current
<del> } else if p.Action == "Already exists" {
<del> receivedProgress[p.ID] = -1
<del> }
<add> receivedProgress[p.ID] = p
<ide> }
<ide> close(progressDone)
<ide> }()
<ide> func TestSuccessfulDownload(t *testing.T) {
<ide> descriptor := d.(*mockDownloadDescriptor)
<ide>
<ide> if descriptor.diffID != "" {
<del> if receivedProgress[d.ID()] != -1 {
<del> t.Fatalf("did not get 'already exists' message for %v", d.ID())
<add> if receivedProgress[d.ID()].Action != "Already exists" {
<add> t.Fatalf("did not get 'Already exists' message for %v", d.ID())
<ide> }
<del> } else if receivedProgress[d.ID()] != 10 {
<del> t.Fatalf("missing or wrong progress output for %v (got: %d)", d.ID(), receivedProgress[d.ID()])
<add> } else if receivedProgress[d.ID()].Action != "Pull complete" {
<add> t.Fatalf("did not get 'Pull complete' message for %v", d.ID())
<ide> }
<ide>
<ide> if rootFS.DiffIDs[i] != descriptor.expectedDiffID { | 1 |
Ruby | Ruby | fix wrong timezone mapping for switzerland [22233] | 7de7f21e1528a9d299ae22089a371da2505a6c0c | <ide><path>activesupport/lib/active_support/values/time_zone.rb
<ide> class TimeZone
<ide> "Paris" => "Europe/Paris",
<ide> "Amsterdam" => "Europe/Amsterdam",
<ide> "Berlin" => "Europe/Berlin",
<del> "Bern" => "Europe/Berlin",
<add> "Bern" => "Europe/Zurich",
<add> "Zurich" => "Europe/Zurich",
<ide> "Rome" => "Europe/Rome",
<ide> "Stockholm" => "Europe/Stockholm",
<ide> "Vienna" => "Europe/Vienna", | 1 |
Text | Text | add note to docs for i18n and next export | 13f8732f86ad449366f29a843af32379be72cacc | <ide><path>docs/advanced-features/i18n-routing.md
<ide> export const getStaticPaths = ({ locales }) => {
<ide> }
<ide> }
<ide> ```
<add>
<add>Note: i18n routing does not currently support [`next export`](https://nextjs.org/docs/advanced-features/i18n-routing) mode as you are no longer leveraging Next.js' server-side routing. | 1 |
Python | Python | fix typo in test_array_object test description | 7c8e1134ae86f8a8c002e1068337bec63ddf7f0d | <ide><path>numpy/array_api/tests/test_array_object.py
<ide> def test_array_keys_use_private_array():
<ide> in __getitem__(). This is achieved by passing array_api arrays with 0-sized
<ide> dimensions, which NumPy-proper treats erroneously - not sure why!
<ide>
<del> TODO: Find and use appropiate __setitem__() case.
<add> TODO: Find and use appropriate __setitem__() case.
<ide> """
<ide> a = ones((0, 0), dtype=bool_)
<ide> assert a[a].shape == (0,) | 1 |
Javascript | Javascript | improve callback performance | 656bb71867ffb7a0ce9edf5b60cb9303ec915576 | <ide><path>benchmark/dns/lookup.js
<add>'use strict';
<add>
<add>const common = require('../common.js');
<add>const lookup = require('dns').lookup;
<add>
<add>const bench = common.createBenchmark(main, {
<add> name: ['', '127.0.0.1', '::1'],
<add> all: [true, false],
<add> n: [5e6]
<add>});
<add>
<add>function main(conf) {
<add> const name = conf.name;
<add> const n = +conf.n;
<add> const all = !!conf.all;
<add> var i = 0;
<add>
<add> if (all) {
<add> const opts = { all: true };
<add> bench.start();
<add> (function cb(err, results) {
<add> if (i++ === n) {
<add> bench.end(n);
<add> return;
<add> }
<add> lookup(name, opts, cb);
<add> })();
<add> } else {
<add> bench.start();
<add> (function cb(err, result) {
<add> if (i++ === n) {
<add> bench.end(n);
<add> return;
<add> }
<add> lookup(name, cb);
<add> })();
<add> }
<add>}
<ide><path>lib/dns.js
<ide> function errnoException(err, syscall, hostname) {
<ide> }
<ide>
<ide>
<del>// c-ares invokes a callback either synchronously or asynchronously,
<del>// but the dns API should always invoke a callback asynchronously.
<del>//
<del>// This function makes sure that the callback is invoked asynchronously.
<del>// It returns a function that invokes the callback within nextTick().
<del>//
<del>// To avoid invoking unnecessary nextTick(), `immediately` property of
<del>// returned function should be set to true after c-ares returned.
<del>//
<del>// Usage:
<del>//
<del>// function someAPI(callback) {
<del>// callback = makeAsync(callback);
<del>// channel.someAPI(..., callback);
<del>// callback.immediately = true;
<del>// }
<del>function makeAsync(callback) {
<del> return function asyncCallback(...args) {
<del> if (asyncCallback.immediately) {
<del> // The API already returned, we can invoke the callback immediately.
<del> callback.apply(null, args);
<del> } else {
<del> args.unshift(callback);
<del> process.nextTick.apply(null, args);
<del> }
<del> };
<del>}
<del>
<del>
<ide> function onlookup(err, addresses) {
<ide> if (err) {
<ide> return this.callback(errnoException(err, 'getaddrinfo', this.hostname));
<ide> function lookup(hostname, options, callback) {
<ide> if (family !== 0 && family !== 4 && family !== 6)
<ide> throw new TypeError('Invalid argument: family must be 4 or 6');
<ide>
<del> callback = makeAsync(callback);
<del>
<ide> if (!hostname) {
<ide> if (all) {
<del> callback(null, []);
<add> process.nextTick(callback, null, []);
<ide> } else {
<del> callback(null, null, family === 6 ? 6 : 4);
<add> process.nextTick(callback, null, null, family === 6 ? 6 : 4);
<ide> }
<ide> return {};
<ide> }
<ide>
<ide> var matchedFamily = isIP(hostname);
<ide> if (matchedFamily) {
<ide> if (all) {
<del> callback(null, [{address: hostname, family: matchedFamily}]);
<add> process.nextTick(
<add> callback, null, [{address: hostname, family: matchedFamily}]);
<ide> } else {
<del> callback(null, hostname, matchedFamily);
<add> process.nextTick(callback, null, hostname, matchedFamily);
<ide> }
<ide> return {};
<ide> }
<ide> function lookup(hostname, options, callback) {
<ide>
<ide> var err = cares.getaddrinfo(req, hostname, family, hints);
<ide> if (err) {
<del> callback(errnoException(err, 'getaddrinfo', hostname));
<add> process.nextTick(callback, errnoException(err, 'getaddrinfo', hostname));
<ide> return {};
<ide> }
<del>
<del> callback.immediately = true;
<ide> return req;
<ide> }
<ide>
<ide> function lookupService(host, port, callback) {
<ide> throw new TypeError('"callback" argument must be a function');
<ide>
<ide> port = +port;
<del> callback = makeAsync(callback);
<ide>
<ide> var req = new GetNameInfoReqWrap();
<ide> req.callback = callback;
<ide> function lookupService(host, port, callback) {
<ide>
<ide> var err = cares.getnameinfo(req, host, port);
<ide> if (err) throw errnoException(err, 'getnameinfo', host);
<del>
<del> callback.immediately = true;
<ide> return req;
<ide> }
<ide>
<ide> function resolver(bindingName) {
<ide> throw new Error('"callback" argument must be a function');
<ide> }
<ide>
<del> callback = makeAsync(callback);
<ide> var req = new QueryReqWrap();
<ide> req.bindingName = bindingName;
<ide> req.callback = callback;
<ide> function resolver(bindingName) {
<ide> req.ttl = !!(options && options.ttl);
<ide> var err = binding(req, name);
<ide> if (err) throw errnoException(err, bindingName);
<del> callback.immediately = true;
<ide> return req;
<ide> };
<ide> } | 2 |
Text | Text | improve react strict mode documentation. | d5dc968134db912e9ae5e8bf9659c0af461c58dc | <ide><path>docs/api-reference/next.config.js/react-strict-mode.md
<ide> description: The complete Next.js runtime is now Strict Mode-compliant, learn ho
<ide>
<ide> > **Suggested**: We strongly suggest you enable Strict Mode in your Next.js application to better prepare your application for the future of React.
<ide>
<del>The Next.js runtime is now Strict Mode-compliant. To opt-in to Strict Mode, configure the following option in your `next.config.js`:
<add>React's [Strict Mode](https://reactjs.org/docs/strict-mode.html) is a development mode only feature for highlighting potential problems in an application. It helps to identify unsafe lifecycles, legacy API usage, and a number of other features.
<add>
<add>The Next.js runtime is Strict Mode-compliant. To opt-in to Strict Mode, configure the following option in your `next.config.js`:
<ide>
<ide> ```js
<ide> // next.config.js
<ide> module.exports = {
<ide> }
<ide> ```
<ide>
<del>If you or your team are not ready to use Strict Mode in your entire application, that's OK! You can incrementally migrate on a page-by-page basis [using `<React.StrictMode>`](https://reactjs.org/docs/strict-mode.html).
<del>
<del>React's Strict Mode is a development mode only feature for highlighting potential problems in an application. It helps to identify unsafe lifecycles, legacy API usage, and a number of other features.
<add>If you or your team are not ready to use Strict Mode in your entire application, that's OK! You can incrementally migrate on a page-by-page basis using `<React.StrictMode>`.
<ide>
<ide> ## Related
<ide> | 1 |
Go | Go | add marshaljson for future proofing | 85733620ebea3da75abe7d732043354aa0883f8a | <ide><path>api/types/filters/parse.go
<ide> func NewArgs(initialArgs ...KeyValuePair) Args {
<ide> return args
<ide> }
<ide>
<add>func (args Args) Keys() []string {
<add> keys := make([]string, 0, len(args.fields))
<add> for k := range args.fields {
<add> keys = append(keys, k)
<add> }
<add> return keys
<add>}
<add>
<ide> // MarshalJSON returns a JSON byte representation of the Args
<ide> func (args Args) MarshalJSON() ([]byte, error) {
<ide> if len(args.fields) == 0 {
<ide><path>daemon/config/builder.go
<ide> package config
<ide>
<ide> import (
<ide> "encoding/json"
<add> "fmt"
<add> "sort"
<ide> "strings"
<ide>
<ide> "github.com/docker/docker/api/types/filters"
<ide> type BuilderGCRule struct {
<ide>
<ide> type BuilderGCFilter filters.Args
<ide>
<add>func (x *BuilderGCFilter) MarshalJSON() ([]byte, error) {
<add> f := filters.Args(*x)
<add> keys := f.Keys()
<add> sort.Strings(keys)
<add> arr := make([]string, 0, len(keys))
<add> for _, k := range keys {
<add> values := f.Get(k)
<add> for _, v := range values {
<add> arr = append(arr, fmt.Sprintf("%s=%s", k, v))
<add> }
<add> }
<add> return json.Marshal(arr)
<add>}
<add>
<ide> func (x *BuilderGCFilter) UnmarshalJSON(data []byte) error {
<ide> var arr []string
<ide> f := filters.NewArgs() | 2 |
PHP | PHP | remove unnecessary else | 30ef35a830e279c302a00cbc22ec008873f06390 | <ide><path>src/Database/Expression/WindowExpression.php
<ide> public function range(?int $start, ?int $end = 0)
<ide> {
<ide> if (func_num_args() === 1) {
<ide> return $this->frame(self::RANGE, $start, self::PRECEDING);
<del> } else {
<del> return $this->frame(self::RANGE, $start, self::PRECEDING, $end, self::FOLLOWING);
<ide> }
<add>
<add> return $this->frame(self::RANGE, $start, self::PRECEDING, $end, self::FOLLOWING);
<ide> }
<ide>
<ide> /**
<ide> public function rows(?int $start, ?int $end = 0)
<ide> {
<ide> if (func_num_args() === 1) {
<ide> return $this->frame(self::ROWS, $start, self::PRECEDING);
<del> } else {
<del> return $this->frame(self::ROWS, $start, self::PRECEDING, $end, self::FOLLOWING);
<ide> }
<add>
<add> return $this->frame(self::ROWS, $start, self::PRECEDING, $end, self::FOLLOWING);
<ide> }
<ide>
<ide> /**
<ide> public function groups(?int $start, ?int $end = 0)
<ide> {
<ide> if (func_num_args() === 1) {
<ide> return $this->frame(self::GROUPS, $start, self::PRECEDING);
<del> } else {
<del> return $this->frame(self::GROUPS, $start, self::PRECEDING, $end, self::FOLLOWING);
<ide> }
<add>
<add> return $this->frame(self::GROUPS, $start, self::PRECEDING, $end, self::FOLLOWING);
<ide> }
<ide>
<ide> /** | 1 |
Ruby | Ruby | move generic logic from linux. (#454) | 11624b9a7da00448e660f1454121a63b3d401729 | <ide><path>Library/Homebrew/extend/os/linux/hardware/cpu.rb
<ide> module Hardware
<ide> class CPU
<ide> class << self
<del>
<del> OPTIMIZATION_FLAGS = {
<del> :penryn => "-march=core2 -msse4.1",
<del> :core2 => "-march=core2",
<del> :core => "-march=prescott"
<del> }.freeze
<del> def optimization_flags
<del> OPTIMIZATION_FLAGS
<del> end
<del>
<del> # Linux supports x86 only, and universal archs do not apply
<del> def arch_32_bit
<del> :i386
<del> end
<del>
<del> def arch_64_bit
<del> :x86_64
<del> end
<del>
<ide> def universal_archs
<ide> [].extend ArchitectureListExtension
<ide> end
<ide><path>Library/Homebrew/extend/os/mac/hardware/cpu.rb
<ide> module Hardware
<ide> class CPU
<ide> class << self
<del>
<del> OPTIMIZATION_FLAGS = {
<del> :penryn => "-march=core2 -msse4.1",
<del> :core2 => "-march=core2",
<del> :core => "-march=prescott",
<add> PPC_OPTIMIZATION_FLAGS = {
<ide> :g3 => "-mcpu=750",
<ide> :g4 => "-mcpu=7400",
<ide> :g4e => "-mcpu=7450",
<ide> :g5 => "-mcpu=970",
<del> :g5_64 => "-mcpu=970 -arch ppc64"
<add> :g5_64 => "-mcpu=970 -arch ppc64",
<ide> }.freeze
<ide> def optimization_flags
<del> OPTIMIZATION_FLAGS
<add> OPTIMIZATION_FLAGS.merge(PPC_OPTIMIZATION_FLAGS)
<ide> end
<ide>
<ide> # These methods use info spewed out by sysctl.
<ide><path>Library/Homebrew/hardware.rb
<ide> class CPU
<ide> PPC_64BIT_ARCHS = [:ppc64].freeze
<ide>
<ide> class << self
<add> OPTIMIZATION_FLAGS = {
<add> :penryn => "-march=core2 -msse4.1",
<add> :core2 => "-march=core2",
<add> :core => "-march=prescott",
<add> :dunno => "",
<add> }.freeze
<add>
<add> def optimization_flags
<add> OPTIMIZATION_FLAGS
<add> end
<add>
<add> def arch_32_bit
<add> :i386
<add> end
<add>
<add> def arch_64_bit
<add> :x86_64
<add> end
<add>
<ide> def type
<ide> :dunno
<ide> end | 3 |
Javascript | Javascript | add cache typings | 3432c906dc8477f42820aca151fc8d1cfa96bf49 | <ide><path>lib/Cache.js
<ide>
<ide> const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = require("tapable");
<ide>
<del>/** @typedef {(result: any, callback: (err?: Error) => void) => void} GotHandler */
<add>/** @typedef {import("./WebpackError")} WebpackError */
<add>
<add>/**
<add> * @template T
<add> * @callback Callback
<add> * @param {WebpackError=} err
<add> * @param {T=} stats
<add> * @returns {void}
<add> */
<add>
<add>/**
<add> * @callback GotHandler
<add> * @param {any} result
<add> * @param {Callback<void>} stats
<add> * @returns {void}
<add> */
<ide>
<ide> const needCalls = (times, callback) => {
<ide> return err => {
<ide> const needCalls = (times, callback) => {
<ide> class Cache {
<ide> constructor() {
<ide> this.hooks = {
<del> /** @type {AsyncSeriesBailHook<[string, string, TODO[]], any>} */
<add> /** @type {AsyncSeriesBailHook<[string, string, GotHandler[]], any>} */
<ide> get: new AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]),
<ide> /** @type {AsyncParallelHook<[string, string, any]>} */
<ide> store: new AsyncParallelHook(["identifier", "etag", "data"]),
<ide> class Cache {
<ide> };
<ide> }
<ide>
<add> /**
<add> * @template T
<add> * @param {string} identifier the cache identifier
<add> * @param {string} etag the etag
<add> * @param {Callback<T>} callback signals when the value is retrieved
<add> * @returns {void}
<add> */
<ide> get(identifier, etag, callback) {
<ide> const gotHandlers = [];
<ide> this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => {
<ide> class Cache {
<ide> });
<ide> }
<ide>
<add> /**
<add> * @template T
<add> * @param {string} identifier the cache identifier
<add> * @param {string} etag the etag
<add> * @param {T} data the value to store
<add> * @param {Callback<void>} callback signals when the value is stored
<add> * @returns {void}
<add> */
<ide> store(identifier, etag, data, callback) {
<ide> this.hooks.store.callAsync(identifier, etag, data, callback);
<ide> }
<ide>
<add> /**
<add> * @returns {void}
<add> */
<ide> beginIdle() {
<ide> this.hooks.beginIdle.call();
<ide> }
<ide>
<add> /**
<add> * @param {Callback<void>} callback signals when the call finishes
<add> * @returns {void}
<add> */
<ide> endIdle(callback) {
<ide> this.hooks.endIdle.callAsync(callback);
<ide> }
<ide>
<add> /**
<add> * @param {Callback<void>} callback signals when the call finishes
<add> * @returns {void}
<add> */
<ide> shutdown(callback) {
<ide> this.hooks.shutdown.callAsync(callback);
<ide> } | 1 |
Ruby | Ruby | remove unnecessary test from route_inspect_test | 44591250189fd2dadc8303d094b72552d7d06543 | <ide><path>railties/test/application/route_inspect_test.rb
<ide> def test_redirect
<ide> assert_equal " bar GET /bar(.:format) redirect(307, path: /foo/bar)", output[1]
<ide> assert_equal "foobar GET /foobar(.:format) redirect(301)", output[2]
<ide> end
<del>
<del> def test_presenter
<del> output = draw do
<del> get "/foo" => redirect("/foo/bar"), :constraints => { :subdomain => "admin" }
<del> get "/bar" => redirect(path: "/foo/bar", status: 307)
<del> get "/foobar" => redirect{ "/foo/bar" }
<del> end
<del> assert_equal output.join("\n"), Rails::Application::RoutePresenter.display_routes(@set.routes)
<del> end
<ide> end
<ide> end | 1 |
PHP | PHP | remove blank line | 7f356976b6b4295a2030d4567552ec5845074974 | <ide><path>src/ORM/Association/BelongsToMany.php
<ide> protected function _buildQuery($options)
<ide> ->where($this->junctionConditions())
<ide> ->select($query->aliasFields((array)$assoc->foreignKey(), $name));
<ide>
<del>
<ide> $assoc->attachTo($query);
<ide> return $query;
<ide> } | 1 |
Javascript | Javascript | use nullish coalencing operator | 6e6663b8a4f97400dee61ab961960b43caa9e962 | <ide><path>benchmark/events/ee-add-remove.js
<ide> 'use strict';
<ide> const common = require('../common.js');
<del>const events = require('events');
<add>const { EventEmitter } = require('events');
<ide>
<del>const bench = common.createBenchmark(main, { n: [1e6] });
<add>const bench = common.createBenchmark(main, {
<add> newListener: [0, 1],
<add> removeListener: [0, 1],
<add> n: [1e6],
<add>});
<ide>
<del>function main({ n }) {
<del> const ee = new events.EventEmitter();
<add>function main({ newListener, removeListener, n }) {
<add> const ee = new EventEmitter();
<ide> const listeners = [];
<ide>
<ide> for (let k = 0; k < 10; k += 1)
<ide> listeners.push(() => {});
<ide>
<add> if (newListener === 1)
<add> ee.on('newListener', (event, listener) => {});
<add>
<add> if (removeListener === 1)
<add> ee.on('removeListener', (event, listener) => {});
<add>
<ide> bench.start();
<ide> for (let i = 0; i < n; i += 1) {
<ide> const dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1';
<ide><path>lib/events.js
<ide> function _addListener(target, type, listener, prepend) {
<ide> // adding it to the listeners, first emit "newListener".
<ide> if (events.newListener !== undefined) {
<ide> target.emit('newListener', type,
<del> listener.listener ? listener.listener : listener);
<add> listener.listener ?? listener);
<ide>
<ide> // Re-assign `events` because a newListener handler could have caused the
<ide> // this._events to be assigned to a new object | 2 |
Text | Text | update directions on guide files location | d7e6838aa39b2727f3c8d1085ef36c38d794b464 | <ide><path>docs/how-to-work-on-guide-articles.md
<ide> There are two ways you can propose a change to the repository, after you edit or
<ide>
<ide> Watch the video demonstration or follow the steps below it:
<ide>
<del>**[TODO]** Update the GIF recording.
<add>
<ide>
<del>
<del>
<del>1. Go into the **"pages"** folder (located in [`guide`](/guide)) and find the article stub you'd like to write or edit.
<add>1. Go into the [**"guide"**](/guide) folder (located in freeCodeCamp repository), select the language you want to contribute to, and find the article stub you'd like to write or edit.
<ide>
<ide> > All stubs will be in an index.md file
<ide> | 1 |
Ruby | Ruby | remove autotools check | f5f41f2079039699c0157b602391d7744fc7222b | <ide><path>Library/Homebrew/diagnostic.rb
<ide> def check_git_origin
<ide> end
<ide> end
<ide>
<del> def check_for_autoconf
<del> return unless MacOS::Xcode.installed?
<del> return unless MacOS::Xcode.provides_autotools?
<del>
<del> autoconf = which("autoconf")
<del> safe_autoconfs = %w[/usr/bin/autoconf /Developer/usr/bin/autoconf]
<del> return if autoconf.nil? || safe_autoconfs.include?(autoconf.to_s)
<del>
<del> <<-EOS.undent
<del> An "autoconf" in your path blocks the Xcode-provided version at:
<del> #{autoconf}
<del>
<del> This custom autoconf may cause some Homebrew formulae to fail to compile.
<del> EOS
<del> end
<del>
<ide> def __check_linked_brew(f)
<ide> f.installed_prefixes.each do |prefix|
<ide> prefix.find do |src|
<ide><path>Library/Homebrew/test/test_diagnostic.rb
<ide> def test_check_for_symlinked_cellar
<ide> HOMEBREW_CELLAR.mkpath
<ide> end
<ide>
<del> def test_check_for_autoconf
<del> MacOS::Xcode.stubs(:installed?).returns true
<del> MacOS::Xcode.stubs(:provides_autotools?).returns true
<del> mktmpdir do |path|
<del> file = "#{path}/autoconf"
<del> FileUtils.touch file
<del> FileUtils.chmod 0755, file
<del> ENV["PATH"] = [path, ENV["PATH"]].join File::PATH_SEPARATOR
<del>
<del> assert_match "This custom autoconf",
<del> @checks.check_for_autoconf
<del> end
<del> end
<del>
<ide> def test_check_tmpdir
<ide> ENV["TMPDIR"] = "/i/don/t/exis/t"
<ide> assert_match "doesn't exist", | 2 |
Javascript | Javascript | apply changes suggested by linter | cf6539b0963c741830e39489ac7791b22c1ab340 | <ide><path>src/path-watcher.js
<ide> class NSFWNativeWatcher extends NativeWatcher {
<ide> } else {
<ide> payload.oldPath = path.join(
<ide> event.directory,
<del> (typeof event.oldFile === 'undefined') ? '' : event.oldFile
<add> typeof event.oldFile === 'undefined' ? '' : event.oldFile
<ide> );
<ide> payload.path = path.join(
<ide> event.directory,
<del> (typeof event.newFile === 'undefined') ? '' : event.newFile
<add> typeof event.newFile === 'undefined' ? '' : event.newFile
<ide> );
<ide> }
<ide> | 1 |
Javascript | Javascript | update spark.js and tween.js libraries | 228ddebb885247f2ae7755869e63e534370776c9 | <ide><path>examples/js/Sparks.js
<ide> var SPARKS = {};
<ide> * Creates and Manages Particles
<ide> *********************************/
<ide>
<del>
<ide> SPARKS.Emitter = function (counter) {
<ide>
<ide> this._counter = counter ? counter : new SPARKS.SteadyCounter(10); // provides number of particles to produce
<ide> SPARKS.Emitter.prototype = {
<ide> _timer: null,
<ide> _lastTime: null,
<ide> _timerStep: 10,
<add> _velocityVerlet: true,
<ide>
<ide> // run its built in timer / stepping
<ide> start: function() {
<ide> SPARKS.Emitter.prototype = {
<ide> var time = Date.now();
<ide> var elapsed = time - emitter._lastTime;
<ide>
<del> while(elapsed >= emitter._TIMESTEP) {
<del> emitter.update(emitter._TIMESTEP / 1000);
<del> elapsed -= emitter._TIMESTEP;
<add> if (!this._velocityVerlet) {
<add> // if elapsed is way higher than time step, (usually after switching tabs, or excution cached in ff)
<add> // we will drop cycles. perhaps set to a limit of 10 or something?
<add> var maxBlock = emitter._TIMESTEP * 20;
<add>
<add> if (elapsed >= maxBlock) {
<add> //console.log('warning: sparks.js is fast fowarding engine, skipping steps', elapsed / emitter._TIMESTEP);
<add> //emitter.update( (elapsed - maxBlock) / 1000);
<add> elapsed = maxBlock;
<add> }
<add>
<add> while(elapsed >= emitter._TIMESTEP) {
<add> emitter.update(emitter._TIMESTEP / 1000);
<add> elapsed -= emitter._TIMESTEP;
<add> }
<add> emitter._lastTime = time - elapsed;
<add>
<add> } else {
<add> emitter.update(elapsed/1000);
<add> emitter._lastTime = time;
<ide> }
<ide>
<del> emitter._lastTime = time - elapsed;
<add>
<ide>
<ide> if (emitter._isRunning)
<ide> setTimeout(emitter.step, emitter._timerStep, emitter);
<ide> SPARKS.Emitter.prototype = {
<ide> }
<ide> }
<ide>
<add> this.dispatchEvent("loopUpdated");
<add>
<ide> },
<ide>
<ide> createParticle: function() {
<ide> SPARKS.Emitter.prototype = {
<ide> addAction: function (action) {
<ide> this._actions.push(action);
<ide> },
<add>
<add> removeInitializer: function (initializer) {
<add> var index = this._initializers.indexOf(initializer);
<add> if (index > -1) {
<add> this._initializers.splice( index, 1 );
<add> }
<add> },
<add>
<add> removeAction: function (action) {
<add> var index = this._actions.indexOf(action);
<add> if (index > -1) {
<add> this._actions.splice( index, 1 );
<add> }
<add> //console.log('removeAction', index, this._actions);
<add> },
<ide>
<ide> addCallback: function(name, callback) {
<ide> this.callbacks[name] = callback;
<ide> SPARKS.Emitter.prototype = {
<ide> };
<ide>
<ide>
<add>/*
<add> * Constant Names for
<add> * Events called by emitter.dispatchEvent()
<add> *
<add> */
<add>SPARKS.EVENT_PARTICLE_CREATED = "created"
<add>SPARKS.EVENT_PARTICLE_UPDATED = "updated"
<add>SPARKS.EVENT_PARTICLE_DEAD = "dead";
<add>SPARKS.EVENT_LOOP_UPDATED = "loopUpdated";
<add>
<add>
<add>
<add>/*
<add> * Steady Counter attempts to produces a particle rate steadily
<add> *
<add> */
<add>
<ide> // Number of particles per seconds
<ide> SPARKS.SteadyCounter = function(rate) {
<ide> this.rate = rate;
<ide>
<add> // we use a shortfall counter to make up for slow emitters
<add> this.leftover = 0;
<add>
<ide> };
<ide>
<ide> SPARKS.SteadyCounter.prototype.updateEmitter = function(emitter, time) {
<del>
<del> return Math.floor(time * this.rate);
<add>
<add> var targetRelease = time * this.rate + this.leftover;
<add> var actualRelease = Math.floor(targetRelease);
<add>
<add> this.leftover = targetRelease - actualRelease;
<add>
<add> return actualRelease;
<ide> };
<ide>
<ide>
<add>/*
<add> * Shot Counter produces specified particles
<add> * on a single impluse or burst
<add> */
<add>
<add>SPARKS.ShotCounter = function(particles) {
<add> this.particles = particles;
<add> this.used = false;
<add>};
<add>
<add>SPARKS.ShotCounter.prototype.updateEmitter = function(emitter, time) {
<add>
<add> if (this.used) {
<add> return 0;
<add> } else {
<add> this.used = true;
<add> }
<add>
<add> return this.particles;
<add>};
<ide>
<ide>
<ide> /********************************
<ide> SPARKS.Particle = function() {
<ide>
<ide> this.position = SPARKS.VectorPool.get().set(0,0,0); //new THREE.Vector3( 0, 0, 0 );
<ide> this.velocity = SPARKS.VectorPool.get().set(0,0,0); //new THREE.Vector3( 0, 0, 0 );
<add> this._oldvelocity = SPARKS.VectorPool.get().set(0,0,0);
<ide> // rotation vec3
<ide> // angVelocity vec3
<ide> // faceAxis vec3
<ide> SPARKS.Move = function() {
<ide> };
<ide>
<ide> SPARKS.Move.prototype.update = function(emitter, particle, time) {
<del>
<add> // attempt verlet velocity updating.
<ide> var p = particle.position;
<del> var v = particle.velocity;
<add> var v = particle.velocity;
<add> var old = particle._oldvelocity;
<add>
<add> if (this._velocityVerlet) {
<add> p.x += (v.x + old.x) * 0.5 * time;
<add> p.y += (v.y + old.y) * 0.5 * time;
<add> p.z += (v.z + old.z) * 0.5 * time;
<add> } else {
<add> p.x += v.x * time;
<add> p.y += v.y * time;
<add> p.z += v.z * time;
<add> }
<add>
<add> // OldVel = Vel;
<add> // Vel = Vel + Accel * dt;
<add> // Pos = Pos + (vel + Vel + Accel * dt) * 0.5 * dt;
<add>
<add>
<add>
<add>};
<add>
<add>/* Marks particles found in specified zone dead */
<add>SPARKS.DeathZone = function(zone) {
<add> this.zone = zone;
<add>};
<add>
<add>SPARKS.DeathZone.prototype.update = function(emitter, particle, time) {
<ide>
<del> p.x += v.x * time;
<del> p.y += v.y * time;
<del> p.z += v.z * time;
<add> if (this.zone.contains(particle.position)) {
<add> particle.isDead = true;
<add> }
<ide>
<ide> };
<ide>
<add>/*
<add> * SPARKS.ActionZone applies an action when particle is found in zone
<add> */
<add>SPARKS.ActionZone = function(action, zone) {
<add> this.action = action;
<add> this.zone = zone;
<add>};
<add>
<add>SPARKS.ActionZone.prototype.update = function(emitter, particle, time) {
<add>
<add> if (this.zone.contains(particle.position)) {
<add> this.action.update( emitter, particle, time );
<add> }
<add>
<add>};
<ide>
<add>/*
<add> * Accelerate action affects velocity in specified 3d direction
<add> */
<ide> SPARKS.Accelerate = function(x,y,z) {
<ide>
<ide> if (x instanceof THREE.Vector3) {
<ide> SPARKS.Accelerate.prototype.update = function(emitter, particle, time) {
<ide>
<ide> var v = particle.velocity;
<ide>
<add> particle._oldvelocity.set(v.x, v.y, v.z);
<add>
<ide> v.x += acc.x * time;
<ide> v.y += acc.y * time;
<ide> v.z += acc.z * time;
<ide>
<ide> };
<ide>
<add>/*
<add> * Accelerate Factor accelerate based on a factor of particle's velocity.
<add> */
<add>SPARKS.AccelerateFactor = function(factor) {
<add> this.factor = factor;
<add>};
<add>
<add>SPARKS.AccelerateFactor.prototype.update = function(emitter, particle, time) {
<add> var factor = this.factor;
<add>
<add> var v = particle.velocity;
<add> var len = v.length();
<add> var adjFactor;
<add> if (len>0) {
<add>
<add> adjFactor = factor * time / len;
<add> adjFactor += 1;
<add>
<add> v.multiplyScalar(adjFactor);
<add> // v.x *= adjFactor;
<add> // v.y *= adjFactor;
<add> // v.z *= adjFactor;
<add> }
<add>
<add>};
<add>
<add>/*
<add>AccelerateNormal
<add> * AccelerateVelocity affects velocity based on its velocity direction
<add> */
<add>SPARKS.AccelerateVelocity = function(factor) {
<add>
<add> this.factor = factor;
<add>
<add>};
<add>
<add>SPARKS.AccelerateVelocity.prototype.update = function(emitter, particle, time) {
<add> var factor = this.factor;
<add>
<add> var v = particle.velocity;
<add>
<add>
<add> v.z += - v.x * factor;
<add> v.y += v.z * factor;
<add> v.x += v.y * factor;
<add>
<add>};
<add>
<add>
<ide> /* Set the max ammount of x,y,z drift movements in a second */
<ide> SPARKS.RandomDrift = function(x,y,z) {
<ide> if (x instanceof THREE.Vector3) {
<ide> SPARKS.LineZone.prototype.getLocation = function() {
<ide> };
<ide>
<ide> // Basically a RectangleZone
<del>
<del>
<ide> SPARKS.ParallelogramZone = function(corner, side1, side2) {
<ide> this.corner = corner;
<ide> this.side1 = side1;
<ide> SPARKS.ParallelogramZone.prototype.getLocation = function() {
<ide>
<ide> };
<ide>
<add>SPARKS.CubeZone = function(position, x, y, z) {
<add> this.position = position;
<add> this.x = x;
<add> this.y = y;
<add> this.z = z;
<add>};
<add>
<add>SPARKS.CubeZone.prototype.getLocation = function() {
<add> //TODO use pool?
<add>
<add> var location = this.position.clone();
<add> location.x += Math.random() * this.x;
<add> location.y += Math.random() * this.y;
<add> location.z += Math.random() * this.z;
<add>
<add> return location;
<add>
<add>};
<add>
<add>
<add>SPARKS.CubeZone.prototype.contains = function(position) {
<add>
<add> var startX = this.position.x;
<add> var startY = this.position.y;
<add> var startZ = this.position.z;
<add> var x = this.x; // width
<add> var y = this.y; // depth
<add> var z = this.z; // height
<add>
<add> if (x<0) {
<add> startX += x;
<add> x = Math.abs(x);
<add> }
<add>
<add> if (y<0) {
<add> startY += y;
<add> y = Math.abs(y);
<add> }
<add>
<add> if (z<0) {
<add> startZ += z;
<add> z = Math.abs(z);
<add> }
<add>
<add> var diffX = position.x - startX;
<add> var diffY = position.y - startY;
<add> var diffZ = position.z - startZ;
<add>
<add> if ( (diffX > 0) && (diffX < x) &&
<add> (diffY > 0) && (diffY < y) &&
<add> (diffZ > 0) && (diffZ < z) ) {
<add> return true;
<add> }
<add>
<add> return false;
<add>
<add>};
<add>
<add>
<ide>
<ide> /**
<ide> * The constructor creates a DiscZone 3D zone.
<ide> SPARKS.Target = function(target, callback) {
<ide> this.callback = callback;
<ide> };
<ide>
<del>SPARKS.Target.prototype.initialize = function( emitter, particle) {
<add>SPARKS.Target.prototype.initialize = function( emitter, particle ) {
<ide>
<ide> if (this.callback) {
<ide> particle.target = this.callback();
<ide> SPARKS.Utils = {
<ide> }
<ide> }
<ide>
<del>};
<add>};
<ide>\ No newline at end of file
<ide><path>examples/js/Tween.js
<del>// tween.js r2 - http://github.com/sole/tween.js
<del>var TWEEN=TWEEN||function(){var a,e,c,d,f=[];return{start:function(g){c=setInterval(this.update,1E3/(g||60))},stop:function(){clearInterval(c)},add:function(g){f.push(g)},getAll:function(){return f},removeAll:function(){f=[]},remove:function(g){a=f.indexOf(g);a!==-1&&f.splice(a,1)},update:function(){a=0;e=f.length;for(d=(new Date).getTime();a<e;)if(f[a].update(d))a++;else{f.splice(a,1);e--}}}}();
<del>TWEEN.Tween=function(a){var e={},c={},d={},f=1E3,g=0,j=null,n=TWEEN.Easing.Linear.EaseNone,k=null,l=null,m=null;this.to=function(b,h){if(h!==null)f=h;for(var i in b)if(a[i]!==null)d[i]=b[i];return this};this.start=function(){TWEEN.add(this);j=(new Date).getTime()+g;for(var b in d)if(a[b]!==null){e[b]=a[b];c[b]=d[b]-a[b]}return this};this.stop=function(){TWEEN.remove(this);return this};this.delay=function(b){g=b;return this};this.easing=function(b){n=b;return this};this.chain=function(b){k=b};this.onUpdate=
<del>function(b){l=b;return this};this.onComplete=function(b){m=b;return this};this.update=function(b){var h,i;if(b<j)return true;b=(b-j)/f;b=b>1?1:b;i=n(b);for(h in c)a[h]=e[h]+c[h]*i;l!==null&&l.call(a,i);if(b==1){m!==null&&m.call(a);k!==null&&k.start();return false}return true}};TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};TWEEN.Easing.Linear.EaseNone=function(a){return a};
<add>// tween.js r5 - http://github.com/sole/tween.js
<add>var TWEEN=TWEEN||function(){var a,e,c=60,b=false,h=[];return{setFPS:function(f){c=f||60},start:function(f){arguments.length!=0&&this.setFPS(f);e=setInterval(this.update,1E3/c)},stop:function(){clearInterval(e)},setAutostart:function(f){(b=f)&&!e&&this.start()},add:function(f){h.push(f);b&&!e&&this.start()},getAll:function(){return h},removeAll:function(){h=[]},remove:function(f){a=h.indexOf(f);a!==-1&&h.splice(a,1)},update:function(f){a=0;num_tweens=h.length;for(f=f||Date.now();a<num_tweens;)if(h[a].update(f))a++;
<add>else{h.splice(a,1);num_tweens--}num_tweens==0&&b==true&&this.stop()}}}();
<add>TWEEN.Tween=function(a){var e={},c={},b={},h=1E3,f=0,j=null,n=TWEEN.Easing.Linear.EaseNone,k=null,l=null,m=null;this.to=function(d,g){if(g!==null)h=g;for(var i in d)if(a[i]!==null)b[i]=d[i];return this};this.start=function(d){TWEEN.add(this);j=d?d+f:Date.now()+f;for(var g in b)if(a[g]!==null){e[g]=a[g];c[g]=b[g]-a[g]}return this};this.stop=function(){TWEEN.remove(this);return this};this.delay=function(d){f=d;return this};this.easing=function(d){n=d;return this};this.chain=function(d){k=d};this.onUpdate=
<add>function(d){l=d;return this};this.onComplete=function(d){m=d;return this};this.update=function(d){var g,i;if(d<j)return true;d=(d-j)/h;d=d>1?1:d;i=n(d);for(g in c)a[g]=e[g]+c[g]*i;l!==null&&l.call(a,i);if(d==1){m!==null&&m.call(a);k!==null&&k.start();return false}return true}};TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};TWEEN.Easing.Linear.EaseNone=function(a){return a};
<ide> TWEEN.Easing.Quadratic.EaseIn=function(a){return a*a};TWEEN.Easing.Quadratic.EaseOut=function(a){return-a*(a-2)};TWEEN.Easing.Quadratic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)};TWEEN.Easing.Cubic.EaseIn=function(a){return a*a*a};TWEEN.Easing.Cubic.EaseOut=function(a){return--a*a*a+1};TWEEN.Easing.Cubic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a;return 0.5*((a-=2)*a*a+2)};TWEEN.Easing.Quartic.EaseIn=function(a){return a*a*a*a};
<ide> TWEEN.Easing.Quartic.EaseOut=function(a){return-(--a*a*a*a-1)};TWEEN.Easing.Quartic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a;return-0.5*((a-=2)*a*a*a-2)};TWEEN.Easing.Quintic.EaseIn=function(a){return a*a*a*a*a};TWEEN.Easing.Quintic.EaseOut=function(a){return(a-=1)*a*a*a*a+1};TWEEN.Easing.Quintic.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*a*a*a;return 0.5*((a-=2)*a*a*a*a+2)};TWEEN.Easing.Sinusoidal.EaseIn=function(a){return-Math.cos(a*Math.PI/2)+1};
<ide> TWEEN.Easing.Sinusoidal.EaseOut=function(a){return Math.sin(a*Math.PI/2)};TWEEN.Easing.Sinusoidal.EaseInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};TWEEN.Easing.Exponential.EaseIn=function(a){return a==0?0:Math.pow(2,10*(a-1))};TWEEN.Easing.Exponential.EaseOut=function(a){return a==1?1:-Math.pow(2,-10*a)+1};TWEEN.Easing.Exponential.EaseInOut=function(a){if(a==0)return 0;if(a==1)return 1;if((a*=2)<1)return 0.5*Math.pow(2,10*(a-1));return 0.5*(-Math.pow(2,-10*(a-1))+2)};
<del>TWEEN.Easing.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};TWEEN.Easing.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};TWEEN.Easing.Circular.EaseInOut=function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)};TWEEN.Easing.Elastic.EaseIn=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);return-(c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/d))};
<del>TWEEN.Easing.Elastic.EaseOut=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);return c*Math.pow(2,-10*a)*Math.sin((a-e)*2*Math.PI/d)+1};
<del>TWEEN.Easing.Elastic.EaseInOut=function(a){var e,c=0.1,d=0.4;if(a==0)return 0;if(a==1)return 1;d||(d=0.3);if(!c||c<1){c=1;e=d/4}else e=d/(2*Math.PI)*Math.asin(1/c);if((a*=2)<1)return-0.5*c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/d);return c*Math.pow(2,-10*(a-=1))*Math.sin((a-e)*2*Math.PI/d)*0.5+1};TWEEN.Easing.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};TWEEN.Easing.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1};
<add>TWEEN.Easing.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};TWEEN.Easing.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};TWEEN.Easing.Circular.EaseInOut=function(a){if((a/=0.5)<1)return-0.5*(Math.sqrt(1-a*a)-1);return 0.5*(Math.sqrt(1-(a-=2)*a)+1)};TWEEN.Easing.Elastic.EaseIn=function(a){var e,c=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!c||c<1){c=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/c);return-(c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/b))};
<add>TWEEN.Easing.Elastic.EaseOut=function(a){var e,c=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!c||c<1){c=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/c);return c*Math.pow(2,-10*a)*Math.sin((a-e)*2*Math.PI/b)+1};
<add>TWEEN.Easing.Elastic.EaseInOut=function(a){var e,c=0.1,b=0.4;if(a==0)return 0;if(a==1)return 1;b||(b=0.3);if(!c||c<1){c=1;e=b/4}else e=b/(2*Math.PI)*Math.asin(1/c);if((a*=2)<1)return-0.5*c*Math.pow(2,10*(a-=1))*Math.sin((a-e)*2*Math.PI/b);return c*Math.pow(2,-10*(a-=1))*Math.sin((a-e)*2*Math.PI/b)*0.5+1};TWEEN.Easing.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};TWEEN.Easing.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1};
<ide> TWEEN.Easing.Back.EaseInOut=function(a){if((a*=2)<1)return 0.5*a*a*(3.5949095*a-2.5949095);return 0.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)};TWEEN.Easing.Bounce.EaseIn=function(a){return 1-TWEEN.Easing.Bounce.EaseOut(1-a)};TWEEN.Easing.Bounce.EaseOut=function(a){return(a/=1)<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375};
<del>TWEEN.Easing.Bounce.EaseInOut=function(a){if(a<0.5)return TWEEN.Easing.Bounce.EaseIn(a*2)*0.5;return TWEEN.Easing.Bounce.EaseOut(a*2-1)*0.5+0.5};
<add>TWEEN.Easing.Bounce.EaseInOut=function(a){if(a<0.5)return TWEEN.Easing.Bounce.EaseIn(a*2)*0.5;return TWEEN.Easing.Bounce.EaseOut(a*2-1)*0.5+0.5};
<ide>\ No newline at end of file | 2 |
Javascript | Javascript | ensure correct syntax err for await parsing | 8189dcc52abd97f30b5c8aab09d44322ea532035 | <ide><path>lib/internal/repl/await.js
<ide> const {
<ide> ArrayPrototypePush,
<ide> FunctionPrototype,
<ide> ObjectKeys,
<add> RegExpPrototypeSymbolReplace,
<add> StringPrototypeEndsWith,
<add> StringPrototypeIncludes,
<add> StringPrototypeIndexOf,
<add> StringPrototypeRepeat,
<add> StringPrototypeSplit,
<add> StringPrototypeStartsWith,
<add> SyntaxError,
<ide> } = primordials;
<ide>
<ide> const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser;
<ide> const walk = require('internal/deps/acorn/acorn-walk/dist/walk');
<add>const { Recoverable } = require('internal/repl');
<ide>
<ide> const noop = FunctionPrototype;
<ide> const visitorsWithoutAncestors = {
<ide> for (const nodeType of ObjectKeys(walk.base)) {
<ide> }
<ide>
<ide> function processTopLevelAwait(src) {
<del> const wrapped = `(async () => { ${src} })()`;
<add> const wrapPrefix = '(async () => { ';
<add> const wrapped = `${wrapPrefix}${src} })()`;
<ide> const wrappedArray = ArrayFrom(wrapped);
<ide> let root;
<ide> try {
<ide> root = parser.parse(wrapped, { ecmaVersion: 'latest' });
<del> } catch {
<del> return null;
<add> } catch (e) {
<add> if (StringPrototypeStartsWith(e.message, 'Unterminated '))
<add> throw new Recoverable(e);
<add> // If the parse error is before the first "await", then use the execution
<add> // error. Otherwise we must emit this parse error, making it look like a
<add> // proper syntax error.
<add> const awaitPos = StringPrototypeIndexOf(src, 'await');
<add> const errPos = e.pos - wrapPrefix.length;
<add> if (awaitPos > errPos)
<add> return null;
<add> // Convert keyword parse errors on await into their original errors when
<add> // possible.
<add> if (errPos === awaitPos + 6 &&
<add> StringPrototypeIncludes(e.message, 'Expecting Unicode escape sequence'))
<add> return null;
<add> if (errPos === awaitPos + 7 &&
<add> StringPrototypeIncludes(e.message, 'Unexpected token'))
<add> return null;
<add> const line = e.loc.line;
<add> const column = line === 1 ? e.loc.column - wrapPrefix.length : e.loc.column;
<add> let message = '\n' + StringPrototypeSplit(src, '\n')[line - 1] + '\n' +
<add> StringPrototypeRepeat(' ', column) +
<add> '^\n\n' + RegExpPrototypeSymbolReplace(/ \([^)]+\)/, e.message, '');
<add> // V8 unexpected token errors include the token string.
<add> if (StringPrototypeEndsWith(message, 'Unexpected token'))
<add> message += " '" + src[e.pos - wrapPrefix.length] + "'";
<add> // eslint-disable-next-line no-restricted-syntax
<add> throw new SyntaxError(message);
<ide> }
<ide> const body = root.body[0].expression.callee.body;
<ide> const state = {
<ide><path>lib/repl.js
<ide> function REPLServer(prompt,
<ide> ({ processTopLevelAwait } = require('internal/repl/await'));
<ide> }
<ide>
<del> const potentialWrappedCode = processTopLevelAwait(code);
<del> if (potentialWrappedCode !== null) {
<del> code = potentialWrappedCode;
<del> wrappedCmd = true;
<del> awaitPromise = true;
<add> try {
<add> const potentialWrappedCode = processTopLevelAwait(code);
<add> if (potentialWrappedCode !== null) {
<add> code = potentialWrappedCode;
<add> wrappedCmd = true;
<add> awaitPromise = true;
<add> }
<add> } catch (e) {
<add> decorateErrorStack(e);
<add> err = e;
<ide> }
<ide> }
<ide>
<ide> // First, create the Script object to check the syntax
<ide> if (code === '\n')
<ide> return cb(null);
<ide>
<del> let parentURL;
<del> try {
<del> const { pathToFileURL } = require('url');
<del> // Adding `/repl` prevents dynamic imports from loading relative
<del> // to the parent of `process.cwd()`.
<del> parentURL = pathToFileURL(path.join(process.cwd(), 'repl')).href;
<del> } catch {
<del> }
<del> while (true) {
<add> if (err === null) {
<add> let parentURL;
<ide> try {
<del> if (self.replMode === module.exports.REPL_MODE_STRICT &&
<del> !RegExpPrototypeTest(/^\s*$/, code)) {
<del> // "void 0" keeps the repl from returning "use strict" as the result
<del> // value for statements and declarations that don't return a value.
<del> code = `'use strict'; void 0;\n${code}`;
<del> }
<del> script = vm.createScript(code, {
<del> filename: file,
<del> displayErrors: true,
<del> importModuleDynamically: async (specifier) => {
<del> return asyncESM.ESMLoader.import(specifier, parentURL);
<add> const { pathToFileURL } = require('url');
<add> // Adding `/repl` prevents dynamic imports from loading relative
<add> // to the parent of `process.cwd()`.
<add> parentURL = pathToFileURL(path.join(process.cwd(), 'repl')).href;
<add> } catch {
<add> }
<add> while (true) {
<add> try {
<add> if (self.replMode === module.exports.REPL_MODE_STRICT &&
<add> !RegExpPrototypeTest(/^\s*$/, code)) {
<add> // "void 0" keeps the repl from returning "use strict" as the result
<add> // value for statements and declarations that don't return a value.
<add> code = `'use strict'; void 0;\n${code}`;
<ide> }
<del> });
<del> } catch (e) {
<del> debug('parse error %j', code, e);
<del> if (wrappedCmd) {
<del> // Unwrap and try again
<del> wrappedCmd = false;
<del> awaitPromise = false;
<del> code = input;
<del> wrappedErr = e;
<del> continue;
<add> script = vm.createScript(code, {
<add> filename: file,
<add> displayErrors: true,
<add> importModuleDynamically: async (specifier) => {
<add> return asyncESM.ESMLoader.import(specifier, parentURL);
<add> }
<add> });
<add> } catch (e) {
<add> debug('parse error %j', code, e);
<add> if (wrappedCmd) {
<add> // Unwrap and try again
<add> wrappedCmd = false;
<add> awaitPromise = false;
<add> code = input;
<add> wrappedErr = e;
<add> continue;
<add> }
<add> // Preserve original error for wrapped command
<add> const error = wrappedErr || e;
<add> if (isRecoverableError(error, code))
<add> err = new Recoverable(error);
<add> else
<add> err = error;
<ide> }
<del> // Preserve original error for wrapped command
<del> const error = wrappedErr || e;
<del> if (isRecoverableError(error, code))
<del> err = new Recoverable(error);
<del> else
<del> err = error;
<add> break;
<ide> }
<del> break;
<ide> }
<ide>
<ide> // This will set the values from `savedRegExMatches` to corresponding
<ide><path>test/parallel/test-repl-top-level-await.js
<ide> async function ordinaryTests() {
<ide> 'undefined',
<ide> ],
<ide> ],
<add> ['await Promise..resolve()',
<add> [
<add> 'await Promise..resolve()\r',
<add> 'Uncaught SyntaxError: ',
<add> 'await Promise..resolve()',
<add> ' ^',
<add> '',
<add> 'Unexpected token \'.\'',
<add> ],
<add> ],
<ide> ];
<ide>
<ide> for (const [input, expected = [`${input}\r`], options = {}] of testCases) { | 3 |
PHP | PHP | fix trailing whitespace | 0e17ccee406f7b661aea6a84d704c97528d72df4 | <ide><path>src/Collection/Iterator/NoChildrenIterator.php
<ide>
<ide> /**
<ide> * An iterator that can be used as an argument for other iterators that require
<del> * a RecursiveIterator but do not want children. This iterator will
<add> * a RecursiveIterator but do not want children. This iterator will
<ide> * always behave as having no nested items.
<ide> */
<ide> class NoChildrenIterator extends Collection implements RecursiveIterator | 1 |
Text | Text | use https url | cae706d7b76f8e13e47854df54c0cf5161f8dc86 | <ide><path>examples/basic-css/README.md
<ide> cd basic-css
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/basic-css
<ide> ```
<ide>
<ide><path>examples/custom-server-express/README.md
<ide> cd custom-server-express
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/custom-server-express
<ide> ```
<ide>
<ide><path>examples/custom-server/README.md
<ide> cd custom-server
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/custom-server
<ide> ```
<ide>
<ide><path>examples/head-elements/README.md
<ide> cd head-elements
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/head-elements
<ide> ```
<ide>
<ide><path>examples/hello-world/README.md
<ide> cd hello-world
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/hello-world
<ide> ```
<ide>
<ide><path>examples/nested-components/README.md
<ide> cd nested-components
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/nested-components
<ide> ```
<ide>
<ide><path>examples/parameterized-routing/README.md
<ide> cd parametrized-routing
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/parametrized-routing
<ide> ```
<ide>
<ide><path>examples/shared-modules/README.md
<ide> cd shared-modules
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/shared-modules
<ide> ```
<ide>
<ide><path>examples/using-router/README.md
<ide> cd using-router
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/using-router
<ide> ```
<ide>
<ide><path>examples/with-prefetching/README.md
<ide> cd with-prefetching
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/with-prefetching
<ide> ```
<ide>
<ide><path>examples/with-redux/README.md
<ide> cd with-redux
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/with-redux
<ide> ```
<ide>
<ide><path>examples/with-styled-components/README.md
<ide> cd with-styled-components
<ide> or clone the repo:
<ide>
<ide> ```bash
<del>git clone git@github.com:zeit/next.js.git --depth=1
<add>git clone https://github.com/zeit/next.js.git --depth=1
<ide> cd next.js/examples/with-styled-components
<ide> ```
<ide> | 12 |
PHP | PHP | improve code style, doc | bb9f8c01e1cdb693b38f79e4c477d266b2a7f8ed | <ide><path>src/Validation/Validation.php
<ide> public static function time($check)
<ide> *
<ide> * @param string|\DateTime $check a date string or object (will always pass)
<ide> * @param string $type Parser type, one out of 'date', 'time', and 'datetime'
<del> * @param string|int $format any format accepted by IntlDateFormatter
<add> * @param string|int|null $format any format accepted by IntlDateFormatter
<ide> * @return bool Success
<ide> * @throws \InvalidArgumentException when unsupported $type given
<ide> * @see \Cake\I18N\Time::parseDate(), \Cake\I18N\Time::parseTime(), \Cake\I18N\Time::parseDateTime()
<ide> public static function localizedTime($check, $type = 'datetime', $format = null)
<ide> if (empty($methods[$type])) {
<ide> throw new \InvalidArgumentException('Unsupported parser type given.');
<ide> }
<del> return (!is_null(Time::{$methods[$type]}($check, $format)));
<add> return (Time::{$methods[$type]}($check, $format) !== null);
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | remove unused module docstrings | f2f027d1fbc12f3ff24f3e471e11ac56e1a5d869 | <ide><path>src/flask/__init__.py
<del>"""
<del> flask
<del> ~~~~~
<del>
<del> A microframework based on Werkzeug. It's extensively documented
<del> and follows best practice patterns.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<del># utilities we import from Werkzeug and Jinja2 that are unused
<del># in the module but are exported as public interface.
<ide> from jinja2 import escape
<ide> from jinja2 import Markup
<ide> from werkzeug.exceptions import abort
<ide><path>src/flask/__main__.py
<del>"""
<del> flask.__main__
<del> ~~~~~~~~~~~~~~
<add>from .cli import main
<ide>
<del> Alias for flask.run for the command line.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<del>
<del>if __name__ == "__main__":
<del> from .cli import main
<del>
<del> main(as_module=True)
<add>main(as_module=True)
<ide><path>src/flask/app.py
<del>"""
<del> flask.app
<del> ~~~~~~~~~
<del>
<del> This module implements the central WSGI application object.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import os
<ide> import sys
<ide> from datetime import timedelta
<ide><path>src/flask/blueprints.py
<del>"""
<del> flask.blueprints
<del> ~~~~~~~~~~~~~~~~
<del>
<del> Blueprints are the recommended way to implement larger or more
<del> pluggable applications in Flask 0.7 and later.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from functools import update_wrapper
<ide>
<ide> from .helpers import _endpoint_from_view_func
<ide><path>src/flask/cli.py
<del>"""
<del> flask.cli
<del> ~~~~~~~~~
<del>
<del> A simple command line application to run flask apps.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import ast
<ide> import inspect
<ide> import os
<ide><path>src/flask/config.py
<del>"""
<del> flask.config
<del> ~~~~~~~~~~~~
<del>
<del> Implements the configuration related objects.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import errno
<ide> import os
<ide> import types
<ide><path>src/flask/ctx.py
<del>"""
<del> flask.ctx
<del> ~~~~~~~~~
<del>
<del> Implements the objects required to keep the context.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import sys
<ide> from functools import update_wrapper
<ide>
<ide><path>src/flask/debughelpers.py
<del>"""
<del> flask.debughelpers
<del> ~~~~~~~~~~~~~~~~~~
<del>
<del> Various helpers to make the development experience better.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import os
<ide> from warnings import warn
<ide>
<ide><path>src/flask/globals.py
<del>"""
<del> flask.globals
<del> ~~~~~~~~~~~~~
<del>
<del> Defines all the global objects that are proxies to the current
<del> active context.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from functools import partial
<ide>
<ide> from werkzeug.local import LocalProxy
<ide><path>src/flask/helpers.py
<del>"""
<del> flask.helpers
<del> ~~~~~~~~~~~~~
<del>
<del> Implements various helpers.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import io
<ide> import mimetypes
<ide> import os
<ide><path>src/flask/json/__init__.py
<del>"""
<del>flask.json
<del>~~~~~~~~~~
<del>
<del>:copyright: 2010 Pallets
<del>:license: BSD-3-Clause
<del>"""
<ide> import codecs
<ide> import io
<ide> import uuid
<ide><path>src/flask/json/tag.py
<ide> Tagged JSON
<ide> ~~~~~~~~~~~
<ide>
<del>A compact representation for lossless serialization of non-standard JSON types.
<del>:class:`~flask.sessions.SecureCookieSessionInterface` uses this to serialize
<del>the session data, but it may be useful in other places. It can be extended to
<del>support other types.
<add>A compact representation for lossless serialization of non-standard JSON
<add>types. :class:`~flask.sessions.SecureCookieSessionInterface` uses this
<add>to serialize the session data, but it may be useful in other places. It
<add>can be extended to support other types.
<ide>
<ide> .. autoclass:: TaggedJSONSerializer
<ide> :members:
<ide>
<ide> .. autoclass:: JSONTag
<ide> :members:
<ide>
<del>Let's seen an example that adds support for :class:`~collections.OrderedDict`.
<del>Dicts don't have an order in Python or JSON, so to handle this we will dump
<del>the items as a list of ``[key, value]`` pairs. Subclass :class:`JSONTag` and
<del>give it the new key ``' od'`` to identify the type. The session serializer
<del>processes dicts first, so insert the new tag at the front of the order since
<del>``OrderedDict`` must be processed before ``dict``. ::
<add>Let's see an example that adds support for
<add>:class:`~collections.OrderedDict`. Dicts don't have an order in JSON, so
<add>to handle this we will dump the items as a list of ``[key, value]``
<add>pairs. Subclass :class:`JSONTag` and give it the new key ``' od'`` to
<add>identify the type. The session serializer processes dicts first, so
<add>insert the new tag at the front of the order since ``OrderedDict`` must
<add>be processed before ``dict``.
<add>
<add>.. code-block:: python
<ide>
<ide> from flask.json.tag import JSONTag
<ide>
<ide> def to_python(self, value):
<ide> return OrderedDict(value)
<ide>
<ide> app.session_interface.serializer.register(TagOrderedDict, index=0)
<del>
<del>:copyright: 2010 Pallets
<del>:license: BSD-3-Clause
<ide> """
<ide> from base64 import b64decode
<ide> from base64 import b64encode
<ide><path>src/flask/logging.py
<del>"""
<del>flask.logging
<del>~~~~~~~~~~~~~
<del>
<del>:copyright: 2010 Pallets
<del>:license: BSD-3-Clause
<del>"""
<ide> import logging
<ide> import sys
<ide>
<ide><path>src/flask/sessions.py
<del>"""
<del> flask.sessions
<del> ~~~~~~~~~~~~~~
<del>
<del> Implements cookie based sessions based on itsdangerous.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import hashlib
<ide> import warnings
<ide> from collections.abc import MutableMapping
<ide><path>src/flask/signals.py
<del>"""
<del> flask.signals
<del> ~~~~~~~~~~~~~
<del>
<del> Implements signals based on blinker if available, otherwise
<del> falls silently back to a noop.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> try:
<ide> from blinker import Namespace
<ide>
<ide><path>src/flask/templating.py
<del>"""
<del> flask.templating
<del> ~~~~~~~~~~~~~~~~
<del>
<del> Implements the bridge to Jinja2.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from jinja2 import BaseLoader
<ide> from jinja2 import Environment as BaseEnvironment
<ide> from jinja2 import TemplateNotFound
<ide><path>src/flask/testing.py
<del>"""
<del> flask.testing
<del> ~~~~~~~~~~~~~
<del>
<del> Implements test support helpers. This module is lazily imported
<del> and usually not used in production environments.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from contextlib import contextmanager
<ide>
<ide> import werkzeug.test
<ide><path>src/flask/views.py
<del>"""
<del> flask.views
<del> ~~~~~~~~~~~
<del>
<del> This module provides class-based views inspired by the ones in Django.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from .globals import request
<ide>
<ide>
<ide><path>src/flask/wrappers.py
<del>"""
<del> flask.wrappers
<del> ~~~~~~~~~~~~~~
<del>
<del> Implements the WSGI wrappers (request and response).
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from werkzeug.exceptions import BadRequest
<ide> from werkzeug.wrappers import Request as RequestBase
<ide> from werkzeug.wrappers import Response as ResponseBase
<ide><path>tests/conftest.py
<del>"""
<del> tests.conftest
<del> ~~~~~~~~~~~~~~
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import os
<ide> import pkgutil
<ide> import sys
<ide><path>tests/test_appctx.py
<del>"""
<del> tests.appctx
<del> ~~~~~~~~~~~~
<del>
<del> Tests the application context.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import pytest
<ide>
<ide> import flask
<ide><path>tests/test_basic.py
<del>"""
<del> tests.basic
<del> ~~~~~~~~~~~~~~~~~~~~~
<del>
<del> The basic functionality.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import re
<ide> import sys
<ide> import time
<ide><path>tests/test_blueprints.py
<del>"""
<del> tests.blueprints
<del> ~~~~~~~~~~~~~~~~
<del>
<del> Blueprints (and currently modules)
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import functools
<ide>
<ide> import pytest
<ide><path>tests/test_cli.py
<del>"""
<del> tests.test_cli
<del> ~~~~~~~~~~~~~~
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> # This file was part of Flask-CLI and was modified under the terms of
<ide> # its Revised BSD License. Copyright © 2015 CERN.
<ide> import os
<ide><path>tests/test_config.py
<del>"""
<del> tests.test_config
<del> ~~~~~~~~~~~~~~~~~
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import json
<ide> import os
<ide> import textwrap
<ide><path>tests/test_helpers.py
<del>"""
<del> tests.helpers
<del> ~~~~~~~~~~~~~~~~~~~~~~~
<del>
<del> Various helpers.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import datetime
<ide> import io
<ide> import os
<ide><path>tests/test_instance_config.py
<del>"""
<del> tests.test_instance
<del> ~~~~~~~~~~~~~~~~~~~
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import os
<ide> import sys
<ide>
<ide><path>tests/test_json_tag.py
<del>"""
<del>tests.test_json_tag
<del>~~~~~~~~~~~~~~~~~~~
<del>
<del>:copyright: 2010 Pallets
<del>:license: BSD-3-Clause
<del>"""
<ide> from datetime import datetime
<ide> from uuid import uuid4
<ide>
<ide><path>tests/test_logging.py
<del>"""
<del>tests.test_logging
<del>~~~~~~~~~~~~~~~~~~~
<del>
<del>:copyright: 2010 Pallets
<del>:license: BSD-3-Clause
<del>"""
<ide> import logging
<ide> import sys
<ide> from io import StringIO
<ide><path>tests/test_regression.py
<del>"""
<del> tests.regression
<del> ~~~~~~~~~~~~~~~~~~~~~~~~~~
<del>
<del> Tests regressions.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import gc
<ide> import platform
<ide> import threading
<ide><path>tests/test_reqctx.py
<del>"""
<del> tests.reqctx
<del> ~~~~~~~~~~~~
<del>
<del> Tests the request context.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import pytest
<ide>
<ide> import flask
<ide><path>tests/test_signals.py
<del>"""
<del> tests.signals
<del> ~~~~~~~~~~~~~~~~~~~~~~~
<del>
<del> Signalling.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import pytest
<ide>
<ide> try:
<ide><path>tests/test_subclassing.py
<del>"""
<del> tests.subclassing
<del> ~~~~~~~~~~~~~~~~~
<del>
<del> Test that certain behavior of flask can be customized by
<del> subclasses.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> from io import StringIO
<ide>
<ide> import flask
<ide><path>tests/test_templating.py
<del>"""
<del> tests.templating
<del> ~~~~~~~~~~~~~~~~
<del>
<del> Template functionality
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import logging
<ide>
<ide> import pytest
<ide><path>tests/test_testing.py
<del>"""
<del> tests.testing
<del> ~~~~~~~~~~~~~
<del>
<del> Test client and more.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import click
<ide> import pytest
<ide> import werkzeug
<ide><path>tests/test_user_error_handler.py
<del>"""
<del>tests.test_user_error_handler
<del>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<del>
<del>:copyright: 2010 Pallets
<del>:license: BSD-3-Clause
<del>"""
<ide> import pytest
<ide> from werkzeug.exceptions import Forbidden
<ide> from werkzeug.exceptions import HTTPException
<ide><path>tests/test_views.py
<del>"""
<del> tests.views
<del> ~~~~~~~~~~~
<del>
<del> Pluggable views.
<del>
<del> :copyright: 2010 Pallets
<del> :license: BSD-3-Clause
<del>"""
<ide> import pytest
<ide> from werkzeug.http import parse_set_header
<ide> | 37 |
Javascript | Javascript | add missing super() calls | 2d1a24e8dfb18359a1b0d9b626b10855fb8d8897 | <ide><path>src/modern/class/__tests__/ReactES6Class-test.js
<ide> describe('ReactES6Class', function() {
<ide> it('renders based on state using props in the constructor', function() {
<ide> class Foo extends React.Component {
<ide> constructor(props) {
<add> super(props);
<ide> this.state = {bar: props.initialValue};
<ide> }
<ide> changeState() {
<ide> describe('ReactES6Class', function() {
<ide> var renderCount = 0;
<ide> class Foo extends React.Component {
<ide> constructor(props) {
<add> super(props);
<ide> this.state = {bar: props.initialValue};
<ide> }
<ide> componentWillMount() {
<ide> describe('ReactES6Class', function() {
<ide> it('should render with null in the initial state property', function() {
<ide> class Foo extends React.Component {
<ide> constructor() {
<add> super();
<ide> this.state = null;
<ide> }
<ide> render() {
<ide> describe('ReactES6Class', function() {
<ide> it('setState through an event handler', function() {
<ide> class Foo extends React.Component {
<ide> constructor(props) {
<add> super(props);
<ide> this.state = {bar: props.initialValue};
<ide> }
<ide> handleClick() {
<ide> describe('ReactES6Class', function() {
<ide> it('should not implicitly bind event handlers', function() {
<ide> class Foo extends React.Component {
<ide> constructor(props) {
<add> super(props);
<ide> this.state = {bar: props.initialValue};
<ide> }
<ide> handleClick() {
<ide> describe('ReactES6Class', function() {
<ide> it('renders using forceUpdate even when there is no state', function() {
<ide> class Foo extends React.Component {
<ide> constructor(props) {
<add> super(props);
<ide> this.mutativeValue = props.initialValue;
<ide> }
<ide> handleClick() {
<ide> describe('ReactES6Class', function() {
<ide> var getInitialStateWasCalled = false;
<ide> class Foo extends React.Component {
<ide> constructor() {
<add> super();
<ide> this.contextTypes = {};
<ide> this.propTypes = {};
<ide> } | 1 |
Python | Python | add regression tesst for #947 | 1ace4444065fe39b01739b85189e7fc5cd9fecdd | <ide><path>numpy/core/tests/test_regression.py
<ide> def test_for_zero_length_in_choose(self, level=rlevel):
<ide> a = np.array(1)
<ide> self.failUnlessRaises(ValueError, lambda x: x.choose([]), a)
<ide>
<add> @dec.knownfailureif(True, "Overflowing ndmin arg of array ctor segfaults.")
<add> def test_array_ndmin_overflow(self):
<add> "Ticket #947."
<add> a = np.array([1], ndmin=33)
<add>
<ide> def test_errobj_reference_leak(self, level=rlevel):
<ide> """Ticket #955"""
<ide> z = int(0) | 1 |
Python | Python | make 2 gpu tests num_gpu=2 (was wrong before) | 25b10ebe78eaefe801278992555fbc8e31c39064 | <ide><path>official/resnet/estimator_cifar_benchmark.py
<ide> def resnet56_fp16_1_gpu(self):
<ide> def resnet56_2_gpu(self):
<ide> """Test layers model with Estimator and dist_strat. 2 GPUs."""
<ide> self._setup()
<del> flags.FLAGS.num_gpus = 1
<add> flags.FLAGS.num_gpus = 2
<ide> flags.FLAGS.data_dir = DATA_DIR
<ide> flags.FLAGS.batch_size = 128
<ide> flags.FLAGS.train_epochs = 182 | 1 |
Go | Go | change restart delay for windows service to 15s | 624daf8d9e4bd164eb7cf5ce6640098277fad712 | <ide><path>cmd/dockerd/service_windows.go
<ide> func registerService() error {
<ide>
<ide> err = s.SetRecoveryActions(
<ide> []mgr.RecoveryAction{
<del> {Type: mgr.ServiceRestart, Delay: 60 * time.Second},
<del> {Type: mgr.ServiceRestart, Delay: 60 * time.Second},
<add> {Type: mgr.ServiceRestart, Delay: 15 * time.Second},
<add> {Type: mgr.ServiceRestart, Delay: 15 * time.Second},
<ide> {Type: mgr.NoAction},
<ide> },
<ide> uint32(24*time.Hour/time.Second), | 1 |
Javascript | Javascript | return correct label for value type axis | 7bbf3cab5bb8f2c561d0a81f6408e017d815e54e | <ide><path>src/controllers/controller.bar.js
<ide> module.exports = DatasetController.extend({
<ide> _updateElementGeometry: function(rectangle, index, reset) {
<ide> var me = this;
<ide> var model = rectangle._model;
<del> var vscale = me.getValueScale();
<add> var vscale = me._getValueScale();
<ide> var base = vscale.getBasePixel();
<ide> var horizontal = vscale.isHorizontal();
<ide> var ruler = me._ruler || me.getRuler();
<ide> module.exports = DatasetController.extend({
<ide> model.width = horizontal ? undefined : ipixels.size;
<ide> },
<ide>
<del> /**
<del> * @private
<del> */
<del> getValueScaleId: function() {
<del> return this.getMeta().yAxisID;
<del> },
<del>
<del> /**
<del> * @private
<del> */
<del> getIndexScaleId: function() {
<del> return this.getMeta().xAxisID;
<del> },
<del>
<del> /**
<del> * @private
<del> */
<del> getValueScale: function() {
<del> return this.getScaleForId(this.getValueScaleId());
<del> },
<del>
<del> /**
<del> * @private
<del> */
<del> getIndexScale: function() {
<del> return this.getScaleForId(this.getIndexScaleId());
<del> },
<del>
<ide> /**
<ide> * Returns the stacks based on groups and bar visibility.
<ide> * @param {Number} [last] - The dataset index
<ide> module.exports = DatasetController.extend({
<ide> _getStacks: function(last) {
<ide> var me = this;
<ide> var chart = me.chart;
<del> var scale = me.getIndexScale();
<add> var scale = me._getIndexScale();
<ide> var stacked = scale.options.stacked;
<ide> var ilen = last === undefined ? chart.data.datasets.length : last + 1;
<ide> var stacks = [];
<ide> module.exports = DatasetController.extend({
<ide> */
<ide> getRuler: function() {
<ide> var me = this;
<del> var scale = me.getIndexScale();
<add> var scale = me._getIndexScale();
<ide> var stackCount = me.getStackCount();
<ide> var datasetIndex = me.index;
<ide> var isHorizontal = scale.isHorizontal();
<ide> module.exports = DatasetController.extend({
<ide> var me = this;
<ide> var chart = me.chart;
<ide> var meta = me.getMeta();
<del> var scale = me.getValueScale();
<add> var scale = me._getValueScale();
<ide> var isHorizontal = scale.isHorizontal();
<ide> var datasets = chart.data.datasets;
<ide> var value = +scale.getRightValue(datasets[datasetIndex].data[index]);
<ide> module.exports = DatasetController.extend({
<ide>
<ide> if (imeta.bar &&
<ide> imeta.stack === stack &&
<del> imeta.controller.getValueScaleId() === scale.id &&
<add> imeta.controller._getValueScaleId() === scale.id &&
<ide> chart.isDatasetVisible(i)) {
<ide>
<ide> ivalue = +scale.getRightValue(datasets[i].data[index]);
<ide> module.exports = DatasetController.extend({
<ide> draw: function() {
<ide> var me = this;
<ide> var chart = me.chart;
<del> var scale = me.getValueScale();
<add> var scale = me._getValueScale();
<ide> var rects = me.getMeta().data;
<ide> var dataset = me.getDataset();
<ide> var ilen = rects.length;
<ide><path>src/controllers/controller.horizontalBar.js
<ide> module.exports = BarController.extend({
<ide> /**
<ide> * @private
<ide> */
<del> getValueScaleId: function() {
<add> _getValueScaleId: function() {
<ide> return this.getMeta().xAxisID;
<ide> },
<ide>
<ide> /**
<ide> * @private
<ide> */
<del> getIndexScaleId: function() {
<add> _getIndexScaleId: function() {
<ide> return this.getMeta().yAxisID;
<ide> }
<ide> });
<ide><path>src/core/core.datasetController.js
<ide> helpers.extend(DatasetController.prototype, {
<ide> return this.chart.scales[scaleID];
<ide> },
<ide>
<add> /**
<add> * @private
<add> */
<add> _getValueScaleId: function() {
<add> return this.getMeta().yAxisID;
<add> },
<add>
<add> /**
<add> * @private
<add> */
<add> _getIndexScaleId: function() {
<add> return this.getMeta().xAxisID;
<add> },
<add>
<add> /**
<add> * @private
<add> */
<add> _getValueScale: function() {
<add> return this.getScaleForId(this._getValueScaleId());
<add> },
<add>
<add> /**
<add> * @private
<add> */
<add> _getIndexScale: function() {
<add> return this.getScaleForId(this._getIndexScaleId());
<add> },
<add>
<ide> reset: function() {
<ide> this.update(true);
<ide> },
<ide><path>src/scales/scale.category.js
<ide> module.exports = Scale.extend({
<ide>
<ide> getLabelForIndex: function(index, datasetIndex) {
<ide> var me = this;
<del> var data = me.chart.data;
<del> var isHorizontal = me.isHorizontal();
<add> var chart = me.chart;
<ide>
<del> if (data.yLabels && !isHorizontal) {
<del> return me.getRightValue(data.datasets[datasetIndex].data[index]);
<add> if (chart.getDatasetMeta(datasetIndex).controller._getValueScaleId() === me.id) {
<add> return me.getRightValue(chart.data.datasets[datasetIndex].data[index]);
<ide> }
<add>
<ide> return me.ticks[index - me.minIndex];
<ide> },
<ide>
<ide><path>test/specs/scale.category.tests.js
<ide> describe('Category scale tests', function() {
<ide> expect(scale.ticks).toEqual(labels);
<ide> });
<ide>
<del> it ('should get the correct label for the index', function() {
<del> var scaleID = 'myScale';
<del>
<del> var mockData = {
<del> datasets: [{
<del> yAxisID: scaleID,
<del> data: [10, 5, 0, 25, 78]
<del> }],
<del> labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5']
<del> };
<del>
<del> var config = Chart.helpers.clone(Chart.scaleService.getScaleDefaults('category'));
<del> var Constructor = Chart.scaleService.getScaleConstructor('category');
<del> var scale = new Constructor({
<del> ctx: {},
<del> options: config,
<del> chart: {
<del> data: mockData
<add> it('should get the correct label for the index', function() {
<add> var chart = window.acquireChart({
<add> type: 'line',
<add> data: {
<add> datasets: [{
<add> xAxisID: 'xScale0',
<add> yAxisID: 'yScale0',
<add> data: [10, 5, 0, 25, 78]
<add> }],
<add> labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5']
<ide> },
<del> id: scaleID
<add> options: {
<add> scales: {
<add> xAxes: [{
<add> id: 'xScale0',
<add> type: 'category',
<add> position: 'bottom'
<add> }],
<add> yAxes: [{
<add> id: 'yScale0',
<add> type: 'linear'
<add> }]
<add> }
<add> }
<ide> });
<ide>
<del> scale.determineDataLimits();
<del> scale.buildTicks();
<add> var scale = chart.scales.xScale0;
<ide>
<del> expect(scale.getLabelForIndex(1)).toBe('tick2');
<add> expect(scale.getLabelForIndex(1, 0)).toBe('tick2');
<ide> });
<ide>
<del> it ('Should get the correct pixel for a value when horizontal', function() {
<add> it('Should get the correct pixel for a value when horizontal', function() {
<ide> var chart = window.acquireChart({
<ide> type: 'line',
<ide> data: {
<ide> describe('Category scale tests', function() {
<ide> expect(xScale.getValueForPixel(417)).toBe(4);
<ide> });
<ide>
<del> it ('Should get the correct pixel for a value when there are repeated labels', function() {
<add> it('Should get the correct pixel for a value when there are repeated labels', function() {
<ide> var chart = window.acquireChart({
<ide> type: 'line',
<ide> data: {
<ide> describe('Category scale tests', function() {
<ide> expect(xScale.getPixelForValue('tick_1', 1, 0)).toBeCloseToPixel(143);
<ide> });
<ide>
<del> it ('Should get the correct pixel for a value when horizontal and zoomed', function() {
<add> it('Should get the correct pixel for a value when horizontal and zoomed', function() {
<ide> var chart = window.acquireChart({
<ide> type: 'line',
<ide> data: {
<ide> describe('Category scale tests', function() {
<ide> expect(xScale.getPixelForValue(0, 3, 0)).toBeCloseToPixel(429);
<ide> });
<ide>
<del> it ('should get the correct pixel for a value when vertical', function() {
<add> it('should get the correct pixel for a value when vertical', function() {
<ide> var chart = window.acquireChart({
<ide> type: 'line',
<ide> data: {
<ide> describe('Category scale tests', function() {
<ide> expect(yScale.getValueForPixel(437)).toBe(4);
<ide> });
<ide>
<del> it ('should get the correct pixel for a value when vertical and zoomed', function() {
<add> it('should get the correct pixel for a value when vertical and zoomed', function() {
<ide> var chart = window.acquireChart({
<ide> type: 'line',
<ide> data: { | 5 |
PHP | PHP | add strict typing to i18n/middleware classes | 1528ec161668302119b3930f98d603d8d153bb45 | <ide><path>src/I18n/Middleware/LocaleSelectorMiddleware.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> public function __construct(array $locales = [])
<ide> * @param callable $next The next middleware to call.
<ide> * @return \Psr\Http\Message\ResponseInterface A response.
<ide> */
<del> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
<add> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface
<ide> {
<ide> $locale = Locale::acceptFromHttp($request->getHeaderLine('Accept-Language'));
<ide> if (!$locale) {
<ide><path>tests/TestCase/I18n/Middleware/LocaleSelectorMiddlewareTest.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) | 2 |
Ruby | Ruby | use describe correctly | eb9a31b52b0643b3b88f75ce509145fe45fdd18d | <ide><path>Library/Homebrew/test/requirement_spec.rb
<ide> end
<ide>
<ide> describe "#fatal?" do
<del> context "#fatal true is specified" do
<add> describe "#fatal true is specified" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> fatal true
<ide> it { is_expected.to be_fatal }
<ide> end
<ide>
<del> context "#fatal is omitted" do
<add> describe "#fatal is omitted" do
<ide> it { is_expected.not_to be_fatal }
<ide> end
<ide> end
<ide>
<ide> describe "#satisfied?" do
<del> context "#satisfy with block and build_env returns true" do
<add> describe "#satisfy with block and build_env returns true" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy(build_env: false) do
<ide> it { is_expected.to be_satisfied }
<ide> end
<ide>
<del> context "#satisfy with block and build_env returns false" do
<add> describe "#satisfy with block and build_env returns false" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy(build_env: false) do
<ide> it { is_expected.not_to be_satisfied }
<ide> end
<ide>
<del> context "#satisfy returns true" do
<add> describe "#satisfy returns true" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy true
<ide> it { is_expected.to be_satisfied }
<ide> end
<ide>
<del> context "#satisfy returns false" do
<add> describe "#satisfy returns false" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy false
<ide> it { is_expected.not_to be_satisfied }
<ide> end
<ide>
<del> context "#satisfy with block returning true and without :build_env" do
<add> describe "#satisfy with block returning true and without :build_env" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy do
<ide> end
<ide> end
<ide>
<del> context "#satisfy with block returning true and :build_env set to false" do
<add> describe "#satisfy with block returning true and :build_env set to false" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy(build_env: false) do
<ide> end
<ide> end
<ide>
<del> context "#satisfy with block returning path and without :build_env" do
<add> describe "#satisfy with block returning path and without :build_env" do
<ide> let(:klass) do
<ide> Class.new(described_class) do
<ide> satisfy do
<ide> it { is_expected.to be_a_build_requirement }
<ide> end
<ide>
<del> context "#build omitted" do
<add> describe "#build omitted" do
<ide> it { is_expected.not_to be_a_build_requirement }
<ide> end
<ide> end | 1 |
Text | Text | remove repeated info onboarding.md | 8951d3e0e551308a217351e1b5c0337c8b026724 | <ide><path>COLLABORATOR_GUIDE.md
<ide> Collaborators or additional evidence that the issue has relevance, the
<ide> issue may be closed. Remember that issues can always be re-opened if
<ide> necessary.
<ide>
<add>[**See "Who to CC in issues"**](./onboarding-extras.md#who-to-cc-in-issues)
<add>
<ide> ## Accepting Modifications
<ide>
<ide> All modifications to the Node.js code and documentation should be
<ide> and work schedules. Trivial changes (e.g. those which fix minor bugs
<ide> or improve performance without affecting API or causing other
<ide> wide-reaching impact) may be landed after a shorter delay.
<ide>
<del>For non-breaking changes, if there is no disagreement amongst Collaborators, a
<del>pull request may be landed given appropriate review. Where there is discussion
<del>amongst Collaborators, consensus should be sought if possible. The
<del>lack of consensus may indicate the need to elevate discussion to the
<del>CTC for resolution (see below).
<del>
<del>Breaking changes (that is, pull requests that require an increase in the
<del>major version number, known as `semver-major` changes) must be elevated for
<del>review by the CTC. This does not necessarily mean that the PR must be put onto
<del>the CTC meeting agenda. If multiple CTC members approve (`LGTM`) the PR and no
<del>Collaborators oppose the PR, it can be landed. Where there is disagreement among
<del>CTC members or objections from one or more Collaborators, `semver-major` pull
<del>requests should be put on the CTC meeting agenda.
<add>For non-breaking changes, if there is no disagreement amongst
<add>Collaborators, a pull request may be landed given appropriate review.
<add>Where there is discussion amongst Collaborators, consensus should be
<add>sought if possible. The lack of consensus may indicate the need to
<add>elevate discussion to the CTC for resolution (see below).
<add>
<add>Breaking changes (that is, pull requests that require an increase in
<add>the major version number, known as `semver-major` changes) must be
<add>elevated for review by the CTC. This does not necessarily mean that the
<add>PR must be put onto the CTC meeting agenda. If multiple CTC members
<add>approve (`LGTM`) the PR and no Collaborators oppose the PR, it can be
<add>landed. Where there is disagreement among CTC members or objections
<add>from one or more Collaborators, `semver-major` pull requests should be
<add>put on the CTC meeting agenda.
<ide>
<ide> All bugfixes require a test case which demonstrates the defect. The
<ide> test should *fail* before the change, and *pass* after the change.
<ide> The CTC should serve as the final arbiter where required.
<ide>
<ide> ## Landing Pull Requests
<ide>
<add>* Please never use GitHub's green ["Merge Pull Request"](https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-using-the-github-web-interface) button.
<add> * If you do, please force-push removing the merge.
<add> * Reasons for not using the web interface button:
<add> * The merge method will add an unnecessary merge commit.
<add> * The rebase & merge method adds metadata to the commit title.
<add> * The rebase method changes the author.
<add> * The squash & merge method has been known to add metadata to the
<add> commit title.
<add> * If more than one author has contributed to the PR, only the
<add> latest author will be considered during the squashing.
<add>
<ide> Always modify the original commit message to include additional meta
<ide> information regarding the change process:
<ide>
<del>- A `Reviewed-By: Name <email>` line for yourself and any
<del> other Collaborators who have reviewed the change.
<del> - Useful for @mentions / contact list if something goes wrong in the PR.
<del> - Protects against the assumption that GitHub will be around forever.
<ide> - A `PR-URL:` line that references the *full* GitHub URL of the original
<ide> pull request being merged so it's easy to trace a commit back to the
<ide> conversation that led up to that change.
<ide> - A `Fixes: X` line, where _X_ either includes the *full* GitHub URL
<ide> for an issue, and/or the hash and commit message if the commit fixes
<ide> a bug in a previous commit. Multiple `Fixes:` lines may be added if
<ide> appropriate.
<add>- A `Reviewed-By: Name <email>` line for yourself and any
<add> other Collaborators who have reviewed the change.
<add> - Useful for @mentions / contact list if something goes wrong in the PR.
<add> - Protects against the assumption that GitHub will be around forever.
<ide>
<ide> Review the commit message to ensure that it adheres to the guidelines
<ide> outlined in the [contributing](https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit) guide.
<ide> See the commit log for examples such as
<ide> exactly how to format your commit messages.
<ide>
<ide> Additionally:
<del>
<ide> - Double check PRs to make sure the person's _full name_ and email
<ide> address are correct before merging.
<ide> - Except when updating dependencies, all commits should be self
<ide> Save the file and close the editor. You'll be asked to enter a new
<ide> commit message for that commit. This is a good moment to fix incorrect
<ide> commit logs, ensure that they are properly formatted, and add
<ide> `Reviewed-By` lines.
<add>* The commit message text must conform to the [commit message guidelines](../CONTRIBUTING.md#step-3-commit).
<ide>
<ide> Time to push it:
<ide>
<ide> ```text
<ide> $ git push origin master
<ide> ```
<add>* Optional: Force push the amended commit to the branch you used to
<add>open the pull request. If your branch is called `bugfix`, then the
<add>command would be `git push --force-with-lease origin master:bugfix`.
<add>When the pull request is closed, this will cause the pull request to
<add>show the purple merged status rather than the red closed status that is
<add>usually used for pull requests that weren't merged. Only do this when
<add>landing your own contributions.
<add>
<add>* Close the pull request with a "Landed in `<commit hash>`" comment. If
<add>your pull request shows the purple merged status then you should still
<add>add the "Landed in <commit hash>..<commit hash>" comment if you added
<add>multiple commits.
<add>
<add>* `./configure && make -j8 test`
<add> * `-j8` builds node in parallel with 8 threads. Adjust to the number
<add> of cores or processor-level threads your processor has (or slightly
<add> more) for best results.
<ide>
<ide> ### I Just Made a Mistake
<ide>
<del>With `git`, there's a way to override remote trees by force pushing
<add>* Ping a CTC member.
<add>* `#node-dev` on freenode
<add>* With `git`, there's a way to override remote trees by force pushing
<ide> (`git push -f`). This should generally be seen as forbidden (since
<ide> you're rewriting history on a repository other people are working
<ide> against) but is allowed for simpler slip-ups such as typos in commit
<ide> messages. However, you are only allowed to force push to any Node.js
<ide> branch within 10 minutes from your original push. If someone else
<ide> pushes to the branch or the 10 minute period passes, consider the
<ide> commit final.
<add> * Use `--force-with-lease` to minimize the chance of overwriting
<add> someone else's change.
<add> * Post to `#node-dev` (IRC) if you force push.
<ide>
<ide> ### Long Term Support
<ide>
<ide><path>doc/onboarding.md
<ide> onboarding session.
<ide> * Prior to the onboarding session, add the new Collaborators to
<ide> [the Collaborators team](https://github.com/orgs/nodejs/teams/collaborators).
<ide>
<del>## **thank you** for doing this
<add>## Onboarding session
<ide>
<del> * going to cover four things:
<del> * local setup
<del> * some project goals & values
<del> * issues, labels, and reviewing code
<del> * merging code
<del>
<del>## setup
<del>
<del> * notifications setup
<del> * use https://github.com/notifications or set up email
<del> * watching the main repo will flood your inbox, so be prepared
<add>* **thank you** for doing this
<add>* will cover:
<add> * [local setup](#local-setup)
<add> * [project goals & values](#project-goals--values)
<add> * [managing the issue tracker](#managing-the-issue-tracker)
<add> * [reviewing PRs](#reviewing-prs)
<add> * [landing PRs](#landing-prs)
<ide>
<add>## Local setup
<ide>
<ide> * git:
<ide> * make sure you have whitespace=fix: `git config --global --add core.whitespace fix`
<ide> * usually PR from your own github fork
<del> * [**See "Updating Node.js from Upstream"**](./onboarding-extras.md#updating-nodejs-from-upstream)
<add> * [See "Updating Node.js from Upstream"](./onboarding-extras.md#updating-nodejs-from-upstream)
<ide> * make new branches for all commits you make!
<ide>
<add> * notifications:
<add> * use [https://github.com/notifications](https://github.com/notifications) or set up email
<add> * watching the main repo will flood your inbox, so be prepared
<ide>
<del> * `#node-dev` on `chat.freenode.net` is the best place to interact with the CTC / other collaborators
<add> * `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is the best place to interact with the CTC / other collaborators
<ide>
<ide>
<del>## a little deeper about the project
<add>## Project goals & values
<ide>
<ide> * collaborators are effectively part owners
<ide> * the project has the goals of its contributors
<ide>
<del>
<ide> * but, there are some higher-level goals and values
<ide> * not everything belongs in core (if it can be done reasonably in userland, let it stay in userland)
<ide> * empathy towards users matters (this is in part why we onboard people)
<ide> * generally: try to be nice to people
<ide>
<del>
<del>## managing the issue tracker
<add>## Managing the issue tracker
<ide>
<ide> * you have (mostly) free rein – don't hesitate to close an issue if you are confident that it should be closed
<del> * this will come more naturally over time
<del> * IMPORTANT: be nice about closing issues, let people know why, and that issues and PRs can be reopened if necessary
<del> * Still need to follow the Code of Conduct.
<del>
<add> * **IMPORTANT**: be nice about closing issues, let people know why, and that issues and PRs can be reopened if necessary
<add> * Still need to follow the Code of Conduct
<ide>
<del> * Labels:
<add> * [**See "Labels"**](./onboarding-extras.md#labels)
<ide> * There is [a bot](https://github.com/nodejs-github-bot/github-bot) that applies subsystem labels (for example, `doc`, `test`, `assert`, or `buffer`) so that we know what parts of the code base the pull request modifies. It is not perfect, of course. Feel free to apply relevant labels and remove irrelevant labels from pull requests and issues.
<del> * [**See "Labels"**](./onboarding-extras.md#labels)
<ide> * Use the `ctc-review` label if a topic is controversial or isn't coming to
<ide> a conclusion after an extended time.
<ide> * `semver-{minor,major}`:
<del> * If a change has the remote *chance* of breaking something, use `semver-major`
<add> * If a change has the remote *chance* of breaking something, use the `semver-major` label
<ide> * When adding a semver label, add a comment explaining why you're adding it. Do it right away so you don't forget!
<ide>
<del> * Notifying humans
<del> * [**See "Who to CC in issues"**](./onboarding-extras.md#who-to-cc-in-issues)
<add> * [**See "Who to CC in issues"**](./onboarding-extras.md#who-to-cc-in-issues)
<ide> * will also come more naturally over time
<ide>
<del>
<del> * Reviewing:
<del> * The primary goal is for the codebase to improve.
<del> * Secondary (but not far off) is for the person submitting code to succeed.
<add>## Reviewing PRs
<add> * The primary goal is for the codebase to improve.
<add> * Secondary (but not far off) is for the person submitting code to succeed.
<ide> A pull request from a new contributor is an opportunity to grow the
<ide> community.
<del> * Review a bit at a time. Do not overwhelm new contributors.
<del> * It is tempting to micro-optimize and make everything about relative
<add> * Review a bit at a time. Do not overwhelm new contributors.
<add> * It is tempting to micro-optimize and make everything about relative
<ide> performance. Don't succumb to that temptation. We change V8 often.
<ide> Techniques that provide improved performance today may be unnecessary in
<ide> the future.
<del> * Be aware: Your opinion carries a lot of weight!
<del> * Nits (requests for small changes that are not essential) are fine, but try
<del> to avoid stalling the pull request.
<del> * Note that they are nits when you comment: `Nit: change foo() to bar().`
<del> * If they are stalling the pull request, fix them yourself on merge.
<del> * Minimum wait for comments time
<del> * There is a minimum waiting time which we try to respect for non-trivial
<add> * Be aware: Your opinion carries a lot of weight!
<add> * Nits (requests for small changes that are not essential) are fine, but try
<add> to avoid stalling the pull request.
<add> * Note that they are nits when you comment: `Nit: change foo() to bar().`
<add> * If they are stalling the pull request, fix them yourself on merge.
<add> * Minimum wait for comments time
<add> * There is a minimum waiting time which we try to respect for non-trivial
<ide> changes, so that people who may have important input in such a
<ide> distributed project are able to respond.
<del> * For non-trivial changes, leave the pull request open for at least 48
<add> * For non-trivial changes, leave the pull request open for at least 48
<ide> hours (72 hours on a weekend).
<del> * If a pull request is abandoned, check if they'd mind if you took it over
<add> * If a pull request is abandoned, check if they'd mind if you took it over
<ide> (especially if it just has nits left).
<del> * Approving a change
<del> * Collaborators indicate that they have reviewed and approve of the
<add> * Approving a change
<add> * Collaborators indicate that they have reviewed and approve of the
<ide> the changes in a pull request by commenting with `LGTM`, which stands
<ide> for "looks good to me".
<del> * You have the power to `LGTM` another collaborator's (including TSC/CTC
<add> * You have the power to `LGTM` another collaborator's (including TSC/CTC
<ide> members) work.
<del> * You may not `LGTM` your own pull requests.
<del> * You have the power to `LGTM` anyone else's pull requests.
<del>
<add> * You may not `LGTM` your own pull requests.
<add> * You have the power to `LGTM` anyone else's pull requests.
<ide>
<del> * what belongs in node:
<add> * What belongs in node:
<ide> * opinions vary, but I find the following helpful:
<ide> * if node itself needs it (due to historic reasons), then it belongs in node
<ide> * that is to say, url is there because of http, freelist is there because of http, et al
<ide> * also, things that cannot be done outside of core, or only with significant pain (example: async-wrap)
<ide>
<del>
<ide> * Continuous Integration (CI) Testing:
<del> * https://ci.nodejs.org/
<add> * [https://ci.nodejs.org/](https://ci.nodejs.org/)
<ide> * It is not automatically run. You need to start it manually.
<ide> * Log in on CI is integrated with GitHub. Try to log in now!
<ide> * You will be using `node-test-pull-request` most of the time. Go there now!
<ide> onboarding session.
<ide> * Use the [Build WG repo](https://github.com/nodejs/build) to file issues for the Build WG members who maintain the CI infrastructure.
<ide>
<ide>
<del>## Landing PRs: Overview
<del>
<del> * The [Collaborator Guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#technical-howto) is a great resource.
<del>
<del>
<del> * No one (including TSC or CTC members) pushes directly to master without review.
<del> * An exception is made for release commits only.
<del>
<del>
<del> * One `LGTM` is sufficient, except for semver-major changes.
<del> * More than one is better.
<del> * Breaking changes must be LGTM'ed by at least two CTC members.
<del> * If one or more Collaborators object to a change, it should not land until
<del> the objection is addressed. The options for such a situation include:
<del> * Engaging those with objections to determine a viable path forward;
<del> * Altering the pull request to address the objections;
<del> * Escalating the discussion to the CTC using the `ctc-review` label. This
<del> should only be done after the previous options have been exhausted.
<del>
<del> * Wait before merging non-trivial changes.
<del> * 48 hours during the week and 72 hours on weekends.
<del> * An example of a trivial change would be correcting the misspelling of a single word in a documentation file. This sort of change still needs to receive at least one `LGTM` but it does not need to wait 48 hours before landing.
<del>
<del> * **Run the PR through CI before merging!**
<del> * An exception can be made for documentation-only PRs as long as it does not include the `addons.md` documentation file. (Example code from that document is extracted and built as part of the tests!)
<del>
<del> * What if something goes wrong?
<del> * Ping a CTC member.
<del> * `#node-dev` on freenode
<del> * Force-pushing to fix things after is allowed for ~10 minutes. Avoid it if you can.
<del> * Use `--force-with-lease` to minimize the chance of overwriting someone else's change.
<del> * Post to `#node-dev` (IRC) if you force push.
<del>
<del>
<del>## Landing PRs: Details
<del>
<del>* Please never use GitHub's green ["Merge Pull Request"](https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-using-the-github-web-interface) button.
<del> * If you do, please force-push removing the merge.
<del> * Reasons for not using the web interface button:
<del> * The merge method will add an unnecessary merge commit.
<del> * The rebase & merge method adds metadata to the commit title.
<del> * The rebase method changes the author.
<del> * The squash & merge method has been known to add metadata to the commit title.
<del> * If more than one author has contributed to the PR, only the latest author will be considered during the squashing.
<del>
<del>
<del>Update your `master` branch (or whichever branch you are landing on, almost always `master`)
<del>
<del>* [**See "Updating Node.js from Upstream"**](./onboarding-extras.md#updating-nodejs-from-upstream)
<del>
<del>Landing a PR
<del>
<del>* If it all looks good, `curl -L 'url-of-pr.patch' | git am`
<del> * If `git am` fails, see [the relevant section of the Onboarding Extras doc](./onboarding-extras.md#if-git-am-fails).
<del>* `git rebase -i upstream/master`
<del>* Squash into logical commits if necessary.
<del>* `./configure && make -j8 test` (`-j8` builds node in parallel with 8 threads. adjust to the number of cores (or processor-level threads) your processor has (or slightly more) for best results.)
<del>* Amend the commit description.
<del> * The commit message text must conform to the [commit message guidelines](../CONTRIBUTING.md#step-3-commit).
<del> * Add required metadata:
<del> * `PR-URL: <full-pr-url>`
<del> * `Reviewed-By: <collaborator name> <collaborator email>`
<del> * Easiest to use `git log`, then do a search.
<del> * In vim: `/Name` + `enter` (+ `n` as much as you need to)
<del> * Only include collaborators who have commented `LGTM`.
<del> * Add additional metadata as appropriate:
<del> * `Fixes: <full-issue-url>`
<del> * Full URL of GitHub issue that the PR fixes.
<del> * This will automatically close the PR when the commit lands in master.
<del> * `Refs: <full-url>`
<del> * Full URL of material that might provide additional useful information or context to someone trying to understand the change set or the thinking behind it.
<del>* Optional: Force push the amended commit to the branch you used to open the pull request. If your branch is called `bugfix`, then the command would be `git push --force-with-lease origin master:bugfix`. When the pull request is closed, this will cause the pull request to show the purple merged status rather than the red closed status that is usually used for pull requests that weren't merged. Only do this when landing your own contributions.
<del>* `git push upstream master`
<del> * Close the pull request with a "Landed in `<commit hash>`" comment.
<add>## Landing PRs
<ide>
<add> * [See the Collaborator Guide: Technical HOWTO](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#technical-howto)
<ide>
<ide> ## Exercise: Make a PR adding yourself to the README
<ide>
<del> * Example: https://github.com/nodejs/node/commit/7b09aade8468e1c930f36b9c81e6ac2ed5bc8732
<add> * Example: [https://github.com/nodejs/node/commit/7b09aade8468e1c930f36b9c81e6ac2ed5bc8732](https://github.com/nodejs/node/commit/7b09aade8468e1c930f36b9c81e6ac2ed5bc8732)
<ide> * For raw commit message: `git log 7b09aade8468e1c930f36b9c81e6ac2ed5bc8732 -1`
<ide> * Collaborators are in alphabetical order by GitHub username.
<ide> * Label your pull request with the `doc` subsystem label.
<ide> * Run CI on your PR.
<ide> * After a `LGTM` or two, land the PR.
<ide> * Be sure to add the `PR-URL: <full-pr-url>` and appropriate `Reviewed-By:` metadata!
<ide>
<del>
<del>## final notes
<add>## Final notes
<ide>
<ide> * don't worry about making mistakes: everybody makes them, there's a lot to internalize and that takes time (and we recognize that!)
<ide> * very few (no?) mistakes are unrecoverable
<del> * the existing node committers trust you and are grateful for your help!
<add> * the existing collaborators trust you and are grateful for your help!
<ide> * other repos:
<del> * https://github.com/nodejs/dev-policy
<del> * https://github.com/nodejs/NG
<del> * https://github.com/nodejs/api
<del> * https://github.com/nodejs/build
<del> * https://github.com/nodejs/docs
<del> * https://github.com/nodejs/nodejs.org
<del> * https://github.com/nodejs/readable-stream
<del> * https://github.com/nodejs/LTS
<add> * [https://github.com/nodejs/dev-policy](https://github.com/nodejs/dev-policy)
<add> * [https://github.com/nodejs/NG](https://github.com/nodejs/NG)
<add> * [https://github.com/nodejs/api](https://github.com/nodejs/api)
<add> * [https://github.com/nodejs/build](https://github.com/nodejs/build)
<add> * [https://github.com/nodejs/docs](https://github.com/nodejs/docs)
<add> * [https://github.com/nodejs/nodejs.org](https://github.com/nodejs/nodejs.org)
<add> * [https://github.com/nodejs/readable-stream](https://github.com/nodejs/readable-stream)
<add> * [https://github.com/nodejs/LTS](https://github.com/nodejs/LTS) | 2 |
Text | Text | add v2.17.1 to changelog.md | 5112d7a4443670dbf965432540a468dc59b4e850 | <ide><path>CHANGELOG.md
<ide> - [#14590](https://github.com/emberjs/ember.js/pull/14590) [DEPRECATION] Deprecate using `targetObject`.
<ide> - [#15754](https://github.com/emberjs/ember.js/pull/15754) [CLEANUP] Remove `router.router` deprecation.
<ide>
<add>### 2.17.1 (February 13, 2018)
<add>
<add>- [#16174](https://github.com/emberjs/ember.js/pull/16174) [BUGFIX] Enable _some_ recovery of errors thrown during render.
<add>- [#16241](https://github.com/emberjs/ember.js/pull/16241) [BUGFIX] Avoid excessively calling Glimmer AST transforms.
<add>
<ide> ### 2.17.0 (November 29, 2017)
<ide>
<ide> - [#15855](https://github.com/emberjs/ember.js/pull/15855) [BUGFIX] fix regression with computed `filter/map/sort` | 1 |
Text | Text | add browserstack mention to readme and website | 529ebedc906d33af9fba44d8b642c6491fa7c852 | <ide><path>README.md
<ide> For support using Chart.js, please post questions with the [`chartjs` tag on Sta
<ide> ## Building and Testing
<ide> `gulp build`, `gulp test`
<ide>
<add>Thanks to [BrowserStack](https://browserstack.com) for allowing our team to test on thousands of browsers.
<add>
<ide> ## License
<ide>
<ide> Chart.js is available under the [MIT license](http://opensource.org/licenses/MIT).
<ide><path>docs/08-Notes.md
<ide> Chart.js offers support for all browsers where canvas is supported.
<ide>
<ide> Browser support for the canvas element is available in all modern & major mobile browsers <a href="http://caniuse.com/#feat=canvas" target="_blank">(http://caniuse.com/#feat=canvas)</a>.
<ide>
<add>Thanks to <a href="https://browserstack.com" target="_blank">BrowserStack</a> for allowing our team to test on thousands of browsers.
<add>
<ide>
<ide> ### Bugs & issues
<ide> | 2 |
Go | Go | check isterminal() for both stdin and stdout | d742c57f534352b6cad596d0c9fe8cf84044e92a | <ide><path>api/client/cli.go
<ide> type DockerCli struct {
<ide> in io.ReadCloser
<ide> out io.Writer
<ide> err io.Writer
<del> isTerminal bool
<del> terminalFd uintptr
<ide> tlsConfig *tls.Config
<ide> scheme string
<add> // inFd holds file descriptor of the client's STDIN, if it's a valid file
<add> inFd uintptr
<add> // outFd holds file descriptor of the client's STDOUT, if it's a valid file
<add> outFd uintptr
<add> // isTerminalIn describes if client's STDIN is a TTY
<add> isTerminalIn bool
<add> // isTerminalOut describes if client's STDOUT is a TTY
<add> isTerminalOut bool
<ide> }
<ide>
<ide> var funcMap = template.FuncMap{
<ide> func (cli *DockerCli) LoadConfigFile() (err error) {
<ide>
<ide> func NewDockerCli(in io.ReadCloser, out, err io.Writer, proto, addr string, tlsConfig *tls.Config) *DockerCli {
<ide> var (
<del> isTerminal = false
<del> terminalFd uintptr
<del> scheme = "http"
<add> inFd uintptr
<add> outFd uintptr
<add> isTerminalIn = false
<add> isTerminalOut = false
<add> scheme = "http"
<ide> )
<ide>
<ide> if tlsConfig != nil {
<ide> func NewDockerCli(in io.ReadCloser, out, err io.Writer, proto, addr string, tlsC
<ide>
<ide> if in != nil {
<ide> if file, ok := in.(*os.File); ok {
<del> terminalFd = file.Fd()
<del> isTerminal = term.IsTerminal(terminalFd)
<add> inFd = file.Fd()
<add> isTerminalIn = term.IsTerminal(inFd)
<add> }
<add> }
<add>
<add> if out != nil {
<add> if file, ok := out.(*os.File); ok {
<add> outFd = file.Fd()
<add> isTerminalOut = term.IsTerminal(outFd)
<ide> }
<ide> }
<ide>
<ide> if err == nil {
<ide> err = out
<ide> }
<add>
<ide> return &DockerCli{
<del> proto: proto,
<del> addr: addr,
<del> in: in,
<del> out: out,
<del> err: err,
<del> isTerminal: isTerminal,
<del> terminalFd: terminalFd,
<del> tlsConfig: tlsConfig,
<del> scheme: scheme,
<add> proto: proto,
<add> addr: addr,
<add> in: in,
<add> out: out,
<add> err: err,
<add> inFd: inFd,
<add> outFd: outFd,
<add> isTerminalIn: isTerminalIn,
<add> isTerminalOut: isTerminalOut,
<add> tlsConfig: tlsConfig,
<add> scheme: scheme,
<ide> }
<ide> }
<ide><path>api/client/commands.go
<ide> func (cli *DockerCli) CmdLogin(args ...string) error {
<ide> // the password or email from the config file, so prompt them
<ide> if username != authconfig.Username {
<ide> if password == "" {
<del> oldState, _ := term.SaveState(cli.terminalFd)
<add> oldState, _ := term.SaveState(cli.inFd)
<ide> fmt.Fprintf(cli.out, "Password: ")
<del> term.DisableEcho(cli.terminalFd, oldState)
<add> term.DisableEcho(cli.inFd, oldState)
<ide>
<ide> password = readInput(cli.in, cli.out)
<ide> fmt.Fprint(cli.out, "\n")
<ide>
<del> term.RestoreTerminal(cli.terminalFd, oldState)
<add> term.RestoreTerminal(cli.inFd, oldState)
<ide> if password == "" {
<ide> return fmt.Errorf("Error : Password Required")
<ide> }
<ide> func (cli *DockerCli) CmdStart(args ...string) error {
<ide> }
<ide>
<ide> if *openStdin || *attach {
<del> if tty && cli.isTerminal {
<add> if tty && cli.isTerminalOut {
<ide> if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil {
<ide> log.Errorf("Error monitoring TTY size: %s", err)
<ide> }
<ide> func (cli *DockerCli) CmdAttach(args ...string) error {
<ide> tty = config.GetBool("Tty")
<ide> )
<ide>
<del> if tty && cli.isTerminal {
<add> if tty && cli.isTerminalOut {
<ide> if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil {
<ide> log.Debugf("Error monitoring TTY size: %s", err)
<ide> }
<ide> func (cli *DockerCli) CmdRun(args ...string) error {
<ide> return err
<ide> }
<ide>
<del> if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminal {
<add> if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminalOut {
<ide> if err := cli.monitorTtySize(runResult.Get("Id"), false); err != nil {
<ide> log.Errorf("Error monitoring TTY size: %s", err)
<ide> }
<ide> func (cli *DockerCli) CmdExec(args ...string) error {
<ide> }
<ide> }
<ide>
<del> if execConfig.Tty && cli.isTerminal {
<add> if execConfig.Tty && cli.isTerminalIn {
<ide> if err := cli.monitorTtySize(execID, true); err != nil {
<ide> log.Errorf("Error monitoring TTY size: %s", err)
<ide> }
<ide><path>api/client/hijack.go
<ide> func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
<ide>
<ide> var oldState *term.State
<ide>
<del> if in != nil && setRawTerminal && cli.isTerminal && os.Getenv("NORAW") == "" {
<del> oldState, err = term.SetRawTerminal(cli.terminalFd)
<add> if in != nil && setRawTerminal && cli.isTerminalIn && os.Getenv("NORAW") == "" {
<add> oldState, err = term.SetRawTerminal(cli.inFd)
<ide> if err != nil {
<ide> return err
<ide> }
<del> defer term.RestoreTerminal(cli.terminalFd, oldState)
<add> defer term.RestoreTerminal(cli.inFd, oldState)
<ide> }
<ide>
<ide> if stdout != nil || stderr != nil {
<ide> receiveStdout = utils.Go(func() (err error) {
<ide> defer func() {
<ide> if in != nil {
<del> if setRawTerminal && cli.isTerminal {
<del> term.RestoreTerminal(cli.terminalFd, oldState)
<add> if setRawTerminal && cli.isTerminalIn {
<add> term.RestoreTerminal(cli.inFd, oldState)
<ide> }
<ide> // For some reason this Close call blocks on darwin..
<ide> // As the client exists right after, simply discard the close
<ide> func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
<ide> }
<ide> }
<ide>
<del> if !cli.isTerminal {
<add> if !cli.isTerminalIn {
<ide> if err := <-sendStdin; err != nil {
<ide> log.Debugf("Error sendStdin: %s", err)
<ide> return err
<ide><path>api/client/utils.go
<ide> func (cli *DockerCli) streamHelper(method, path string, setRawTerminal bool, in
<ide> }
<ide>
<ide> if api.MatchesContentType(resp.Header.Get("Content-Type"), "application/json") || api.MatchesContentType(resp.Header.Get("Content-Type"), "application/x-json-stream") {
<del> return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.terminalFd, cli.isTerminal)
<add> return utils.DisplayJSONMessagesStream(resp.Body, stdout, cli.outFd, cli.isTerminalOut)
<ide> }
<ide> if stdout != nil || stderr != nil {
<ide> // When TTY is ON, use regular copy
<ide> func (cli *DockerCli) monitorTtySize(id string, isExec bool) error {
<ide> }
<ide>
<ide> func (cli *DockerCli) getTtySize() (int, int) {
<del> if !cli.isTerminal {
<add> if !cli.isTerminalOut {
<ide> return 0, 0
<ide> }
<del> ws, err := term.GetWinsize(cli.terminalFd)
<add> ws, err := term.GetWinsize(cli.outFd)
<ide> if err != nil {
<ide> log.Debugf("Error getting size: %s", err)
<ide> if ws == nil { | 4 |
Javascript | Javascript | use json.stringify replacer function for nan | e1a1ed5c12dc8b9878c2deea87681906ad6f3e31 | <ide><path>client/src/client/workers/test-evaluator.js
<ide> const __utils = (() => {
<ide> }
<ide> }
<ide>
<add> function replacer(key, value) {
<add> if (Number.isNaN(value)) {
<add> return 'NaN';
<add> }
<add> return value;
<add> }
<add>
<ide> const oldLog = self.console.log.bind(self.console);
<ide> self.console.log = function proxyConsole(...args) {
<del> logs.push(args.map(arg => '' + JSON.stringify(arg)).join(' '));
<add> logs.push(args.map(arg => '' + JSON.stringify(arg, replacer)).join(' '));
<ide> if (logs.join('\n').length > MAX_LOGS_SIZE) {
<ide> flushLogs();
<ide> } | 1 |
Python | Python | check input to poly for zero-dimensional arrays | 88c05e836e527f0780a6a1430f3dc459a215badf | <ide><path>numpy/lib/polynomial.py
<ide> def poly(seq_of_zeros):
<ide> """
<ide> seq_of_zeros = atleast_1d(seq_of_zeros)
<ide> sh = seq_of_zeros.shape
<del> if len(sh) == 2 and sh[0] == sh[1]:
<add> if len(sh) == 2 and sh[0] == sh[1] and sh[0] != 0:
<ide> seq_of_zeros = eigvals(seq_of_zeros)
<del> elif len(sh) ==1:
<add> elif len(sh) == 1:
<ide> pass
<ide> else:
<ide> raise ValueError, "input must be 1d or square 2d array."
<ide><path>numpy/lib/tests/test_polynomial.py
<ide> def test_integ_coeffs(self):
<ide> p2 = p.integ(3, k=[9,7,6])
<ide> assert (p2.coeffs == [1/4./5.,1/3./4.,1/2./3.,9/1./2.,7,6]).all()
<ide>
<add> def test_zero_dims(self):
<add> try:
<add> np.poly(np.zeros((0, 0)))
<add> except ValueError:
<add> pass
<add>
<ide> if __name__ == "__main__":
<ide> run_module_suite() | 2 |
Javascript | Javascript | use font loading api if available | d0845df971b1462c361c9a3dd8cfd42d1b03a632 | <ide><path>src/display/font_loader.js
<ide> * limitations under the License.
<ide> */
<ide> /* globals PDFJS, shadow, isWorker, assert, warn, bytesToString, string32,
<del> globalScope */
<add> globalScope, FontFace, Promise */
<ide>
<ide> 'use strict';
<ide>
<ide> var FontLoader = {
<ide> if (styleElement) {
<ide> styleElement.parentNode.removeChild(styleElement);
<ide> }
<add>//#if !(MOZCENTRAL)
<add> this.nativeFontFaces.forEach(function(nativeFontFace) {
<add> document.fonts.delete(nativeFontFace);
<add> });
<add> this.nativeFontFaces.length = 0;
<add>//#endif
<ide> },
<ide> //#if !(MOZCENTRAL)
<ide> get loadTestFont() {
<ide> var FontLoader = {
<ide> return false;
<ide> })(),
<ide>
<add> nativeFontFaces: [],
<add>
<add> isFontLoadingAPISupported: !isWorker && !!document.fonts,
<add>
<add> addNativeFontFace: function fontLoader_addNativeFontFace(nativeFontFace) {
<add> this.nativeFontFaces.push(nativeFontFace);
<add> document.fonts.add(nativeFontFace);
<add> },
<add>
<ide> bind: function fontLoaderBind(fonts, callback) {
<ide> assert(!isWorker, 'bind() shall be called from main thread');
<ide>
<del> var rules = [], fontsToLoad = [];
<add> var rules = [];
<add> var fontsToLoad = [];
<add> var fontLoadPromises = [];
<ide> for (var i = 0, ii = fonts.length; i < ii; i++) {
<ide> var font = fonts[i];
<ide>
<ide> var FontLoader = {
<ide> }
<ide> font.attached = true;
<ide>
<del> var rule = font.bindDOM();
<del> if (rule) {
<del> rules.push(rule);
<del> fontsToLoad.push(font);
<add> if (this.isFontLoadingAPISupported) {
<add> var nativeFontFace = font.createNativeFontFace();
<add> if (nativeFontFace) {
<add> fontLoadPromises.push(nativeFontFace.loaded);
<add> }
<add> } else {
<add> var rule = font.bindDOM();
<add> if (rule) {
<add> rules.push(rule);
<add> fontsToLoad.push(font);
<add> }
<ide> }
<ide> }
<ide>
<ide> var request = FontLoader.queueLoadingCallback(callback);
<del> if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
<add> if (this.isFontLoadingAPISupported) {
<add> Promise.all(fontsToLoad).then(function() {
<add> request.complete();
<add> });
<add> } else if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
<ide> FontLoader.prepareFontLoadEvent(rules, fontsToLoad, request);
<ide> } else {
<ide> request.complete();
<ide> var FontFaceObject = (function FontFaceObjectClosure() {
<ide> }
<ide> }
<ide> FontFaceObject.prototype = {
<add>//#if !(MOZCENTRAL)
<add> createNativeFontFace: function FontFaceObject_createNativeFontFace() {
<add> if (!this.data) {
<add> return null;
<add> }
<add>
<add> if (PDFJS.disableFontFace) {
<add> this.disableFontFace = true;
<add> return null;
<add> }
<add>
<add> var nativeFontFace = new FontFace(this.loadedName, this.data);
<add>
<add> FontLoader.addNativeFontFace(nativeFontFace);
<add>
<add> if (PDFJS.pdfBug && 'FontInspector' in globalScope &&
<add> globalScope['FontInspector'].enabled) {
<add> globalScope['FontInspector'].fontAdded(this);
<add> }
<add> return nativeFontFace;
<add> },
<add>//#endif
<add>
<ide> bindDOM: function FontFaceObject_bindDOM() {
<ide> if (!this.data) {
<ide> return null;
<ide><path>web/debugger.js
<ide> var FontInspector = (function FontInspectorClosure() {
<ide> return moreInfo;
<ide> }
<ide> var moreInfo = properties(fontObj, ['name', 'type']);
<del> var m = /url\(['"]?([^\)"']+)/.exec(url);
<ide> var fontName = fontObj.loadedName;
<ide> var font = document.createElement('div');
<ide> var name = document.createElement('span');
<ide> name.textContent = fontName;
<ide> var download = document.createElement('a');
<del> download.href = m[1];
<add> if (url) {
<add> url = /url\(['"]?([^\)"']+)/.exec(url);
<add> download.href = url[1];
<add> } else if (fontObj.data) {
<add> url = URL.createObjectURL(new Blob([fontObj.data], {
<add> type: fontObj.mimeType
<add> }));
<add> }
<add> download.href = url;
<ide> download.textContent = 'Download';
<ide> var logIt = document.createElement('a');
<ide> logIt.href = ''; | 2 |
Ruby | Ruby | allow linkage to libnss_files.so.2 on linux | 4e68a7b5bc11c26d92f15bca1bb1cd301d04dcb2 | <ide><path>Library/Homebrew/extend/os/linux/linkage_checker.rb
<ide> class LinkageChecker
<ide> libm.so.6
<ide> libmvec.so.1
<ide> libnsl.so.1
<add> libnss_files.so.2
<ide> libpthread.so.0
<ide> libresolv.so.2
<ide> librt.so.1 | 1 |
Ruby | Ruby | add some sanity checks to the gem push script | dab1d8dcc6030a5c1f5e88744d3c40d771be23a3 | <ide><path>tasks/release.rb
<ide>
<ide> root = File.expand_path('../../', __FILE__)
<ide> version = File.read("#{root}/RAILS_VERSION").strip
<add>tag = "v#{version}"
<ide>
<ide> directory "dist"
<ide>
<ide> sh "gem install #{gem}"
<ide> end
<ide>
<add> task :prep_release => [:ensure_clean_state, :build]
<add>
<ide> task :push => :build do
<ide> sh "gem push #{gem}"
<ide> end
<ide> end
<ide> end
<ide>
<del>namespace :git do
<add>namespace :release do
<add> task :ensure_clean_state do
<add> unless `git status -s | grep -v RAILS_VERSION`.strip.empty?
<add> abort "[ABORTING] `git status` reports a dirty tree. Make sure all changes are committed"
<add> end
<add>
<add> unless ENV['SKIP_TAG'] || `git tag | grep #{tag}`.strip.empty?
<add> abort "[ABORTING] `git tag` shows that #{tag} already exists. Has this version already\n"\
<add> " been released? Git tagging can be skipped by setting SKIP_TAG=1"
<add> end
<add> end
<add>
<ide> task :tag do
<del> sh "git tag v#{version}"
<add> sh "git tag #{tag}"
<ide> end
<ide> end
<ide> | 1 |
Ruby | Ruby | clarify use of params in `direct` | 630e709ea6cb535b45a9cbd89c08c572646f5608 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> module CustomUrls
<ide> # [ :products, options.merge(params.permit(:page, :size)) ]
<ide> # end
<ide> #
<add> # In this instance the `params` object comes from the context in which the the
<add> # block is executed, e.g. generating a url inside a controller action or a view.
<add> # If the block is executed where there isn't a params object such as this:
<add> #
<add> # Rails.application.routes.url_helpers.browse_path
<add> #
<add> # then it will raise a `NameError`. Because of this you need to be aware of the
<add> # context in which you will use your custom url helper when defining it.
<add> #
<ide> # NOTE: The `direct` method can't be used inside of a scope block such as
<ide> # `namespace` or `scope` and will raise an error if it detects that it is.
<ide> def direct(name, options = {}, &block)
<ide><path>actionpack/test/dispatch/routing/custom_url_helpers_test.rb
<ide> class ProductPage < Page; end
<ide> direct(:options) { |options| [:products, options] }
<ide> direct(:defaults, size: 10) { |options| [:products, options] }
<ide>
<add> direct(:browse, page: 1, size: 10) do |options|
<add> [:products, options.merge(params.permit(:page, :size).to_h.symbolize_keys)]
<add> end
<add>
<ide> resolve("Article") { |article| [:post, { id: article.id }] }
<ide> resolve("Basket") { |basket| [:basket] }
<ide> resolve("User", anchor: "details") { |user, options| [:profile, options] }
<ide> def setup
<ide> @safe_params = ActionController::Parameters.new(@path_params).permit(:controller, :action)
<ide> end
<ide>
<add> def params
<add> ActionController::Parameters.new(page: 2, size: 25)
<add> end
<add>
<ide> def test_direct_paths
<ide> assert_equal "http://www.rubyonrails.org", website_path
<ide> assert_equal "http://www.rubyonrails.org", Routes.url_helpers.website_path
<ide> def test_direct_paths
<ide> assert_equal "/products?size=10", Routes.url_helpers.defaults_path
<ide> assert_equal "/products?size=20", defaults_path(size: 20)
<ide> assert_equal "/products?size=20", Routes.url_helpers.defaults_path(size: 20)
<add>
<add> assert_equal "/products?page=2&size=25", browse_path
<add> assert_raises(NameError) { Routes.url_helpers.browse_path }
<ide> end
<ide>
<ide> def test_direct_urls
<ide> def test_direct_urls
<ide> assert_equal "http://www.example.com/products?size=10", Routes.url_helpers.defaults_url
<ide> assert_equal "http://www.example.com/products?size=20", defaults_url(size: 20)
<ide> assert_equal "http://www.example.com/products?size=20", Routes.url_helpers.defaults_url(size: 20)
<add>
<add> assert_equal "http://www.example.com/products?page=2&size=25", browse_url
<add> assert_raises(NameError) { Routes.url_helpers.browse_url }
<ide> end
<ide>
<ide> def test_resolve_paths | 2 |
Text | Text | remove weird stuff | 25b641125d80e77e8f7cf761df4c912c35619587 | <ide><path>docs/build-instructions/windows.md
<ide> fix this, you probably need to fiddle with your system PATH.
<ide> * `script/build` outputs only the Node and Python versions before returning
<ide>
<ide> * Try moving the repository to `C:\atom`. Most likely, the path is too long.
<del> This causes Weird Stuff(tm). See [issue #2200](https://github.com/atom/atom/issues/2200).
<add> See [issue #2200](https://github.com/atom/atom/issues/2200).
<ide>
<ide> ### Windows build error reports in atom/atom
<ide> * Use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+label%3Awindows&type=Issues) to get a list of reports about build errors on Windows. | 1 |
Python | Python | fix staticvectors after floret+mypy merge | bb26550e22af3e1cfc7f66dd54a607cf50822e84 | <ide><path>spacy/ml/staticvectors.py
<ide> def backprop(d_output: Ragged) -> List[Doc]:
<ide> model.inc_grad(
<ide> "W",
<ide> model.ops.gemm(
<del> cast(Floats2d, d_output.data), model.ops.as_contig(V[rows]), trans1=True
<add> cast(Floats2d, d_output.data), model.ops.as_contig(V), trans1=True
<ide> ),
<ide> )
<ide> return [] | 1 |
Go | Go | improve error when connecting service to network | 70acb89fa2e889393d33664bc780cf116795f3e4 | <ide><path>daemon/cluster/cluster.go
<ide> func (c *Cluster) populateNetworkID(ctx context.Context, client swarmapi.Control
<ide> apiNetwork, err := getNetwork(ctx, client, n.Target)
<ide> if err != nil {
<ide> if ln, _ := c.config.Backend.FindNetwork(n.Target); ln != nil && !ln.Info().Dynamic() {
<del> err = fmt.Errorf("network %s is not eligible for docker services", ln.Name())
<add> err = fmt.Errorf("The network %s cannot be used with services. Only networks scoped to the swarm can be used, such as those created with the overlay driver.", ln.Name())
<ide> return apierrors.NewRequestForbiddenError(err)
<ide> }
<ide> return err | 1 |
PHP | PHP | remove docblock duplication | ceda4940aa046b0dfb069bd7abbce6e89af0d3b0 | <ide><path>src/Database/Driver/Mysql.php
<ide> class Mysql extends Driver
<ide> use MysqlDialectTrait;
<ide>
<ide> /**
<del> * @var int|null Maximum alias length or null if no limit
<add> * @inheritDoc
<ide> */
<ide> protected const MAX_ALIAS_LENGTH = 256;
<ide>
<ide><path>src/Database/Driver/Postgres.php
<ide> class Postgres extends Driver
<ide> use PostgresDialectTrait;
<ide>
<ide> /**
<del> * @var int|null Maximum alias length or null if no limit
<add> * @inheritDoc
<ide> */
<ide> protected const MAX_ALIAS_LENGTH = 63;
<ide>
<ide><path>src/Database/Driver/Sqlserver.php
<ide> class Sqlserver extends Driver
<ide> use SqlserverDialectTrait;
<ide>
<ide> /**
<del> * @var int|null Maximum alias length or null if no limit
<add> * @inheritDoc
<ide> */
<ide> protected const MAX_ALIAS_LENGTH = 128;
<ide> | 3 |
Python | Python | fix false warnings re non-json extra params | 9efcd64041e2e4439ec875cea8256c8bd72609e1 | <ide><path>airflow/models/connection.py
<ide> def get_extra(self) -> Dict:
<ide> def set_extra(self, value: str):
<ide> """Encrypt extra-data and save in object attribute to object."""
<ide> if value:
<add> self._validate_extra(value, self.conn_id)
<ide> fernet = get_fernet()
<ide> self._extra = fernet.encrypt(bytes(value, 'utf-8')).decode()
<del> self._validate_extra(self._extra, self.conn_id)
<ide> self.is_extra_encrypted = fernet.is_encrypted
<ide> else:
<ide> self._extra = value | 1 |
Javascript | Javascript | move a comment line in animationaction | f99ce24e8212a1ff6fd2883e80140df325a15746 | <ide><path>src/animation/AnimationAction.js
<ide> Object.assign( AnimationAction.prototype, {
<ide>
<ide> _update: function( time, deltaTime, timeDirection, accuIndex ) {
<ide>
<add> // called by the mixer
<add>
<ide> if ( ! this.enabled ) {
<ide>
<ide> // call ._updateWeight() to update ._effectiveWeight
<ide> Object.assign( AnimationAction.prototype, {
<ide>
<ide> }
<ide>
<del> // called by the mixer
<del>
<ide> var startTime = this._startTime;
<ide>
<ide> if ( startTime !== null ) { | 1 |
Ruby | Ruby | show replacement command in `odeprecated` | ae788550f9b5599e308b7f3b7ff8bef96c4387e6 | <ide><path>Library/Homebrew/dev-cmd/pr-automerge.rb
<ide> def pr_automerge_args
<ide> def pr_automerge
<ide> args = pr_automerge_args.parse
<ide>
<del> odeprecated "`brew pr-automerge --autosquash`" if args.autosquash?
<add> odeprecated "`brew pr-automerge --autosquash`", "`brew pr-automerge`" if args.autosquash?
<ide>
<ide> without_labels = args.without_labels || [
<ide> "do not merge",
<ide><path>Library/Homebrew/dev-cmd/pr-publish.rb
<ide> def pr_publish
<ide> workflow = args.workflow || "publish-commit-bottles.yml"
<ide> ref = args.branch || "master"
<ide>
<del> odeprecated "`brew pr-publish --autosquash`" if args.autosquash?
<add> odeprecated "`brew pr-publish --autosquash`", "`brew pr-publish`" if args.autosquash?
<ide>
<ide> extra_args = []
<ide> extra_args << "--autosquash" unless args.no_autosquash? | 2 |
Javascript | Javascript | add test for stats string | 9103c89838005bc076f448c33582a3786bd7ce4e | <ide><path>test/Defaults.unittest.js
<ide> describe("Defaults", () => {
<ide> + },
<ide> `)
<ide> );
<add>
<add> test("stats string", { stats: "minimal" }, e =>
<add> e.toMatchInlineSnapshot(`
<add> - Expected
<add> + Received
<add>
<add>
<add> - "stats": Object {},
<add> + "stats": Object {
<add> + "preset": "minimal",
<add> + },
<add> `)
<add> );
<ide> }); | 1 |
Ruby | Ruby | avoid object creation if there is no rc file | b0645ea04c7f75769b106d96a4fbb4e8cc2a258c | <ide><path>railties/lib/rails/generators/rails/app/app_generator.rb
<ide> def railsrc(argv)
<ide> end
<ide>
<ide> def read_rc_file(railsrc)
<del> return [] unless File.exists?(railsrc)
<ide> extra_args_string = File.read(railsrc)
<ide> extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten
<ide> puts "Using #{extra_args.join(" ")} from #{railsrc}"
<ide> extra_args
<ide> end
<ide>
<ide> def insert_railsrc_into_argv!(argv, railsrc)
<add> return argv unless File.exists?(railsrc)
<ide> extra_args = read_rc_file railsrc
<ide> argv.take(1) + extra_args + argv.drop(1)
<ide> end | 1 |
Javascript | Javascript | remove invalid line of code | b488bbf4bfd6c73f2c0c22acda51322d0e69cc37 | <ide><path>docs/app/src/docs.js
<ide> angular.module('docsApp', [
<ide> $scope.offlineEnabled = ($cookies[OFFLINE_COOKIE_NAME] == angular.version.full);
<ide> $scope.futurePartialTitle = null;
<ide> $scope.loading = 0;
<del> $scope.URL = URL;
<ide> $scope.$cookies = $cookies;
<ide>
<ide> $cookies.platformPreference = $cookies.platformPreference || 'gitUnix'; | 1 |
Javascript | Javascript | animate #testsuite to focus user on errors | ce46d1906b4943afebce38794f2e38f26dff2405 | <ide><path>client/commonFramework/display-test-results.js
<ide> window.common = (function({ $, common = { init: [] }}) {
<ide>
<ide> common.displayTestResults = function displayTestResults(data = []) {
<ide> $('#testSuite').children().remove();
<add> $('#testSuite').fadeIn('slow');
<ide> data.forEach(({ err = false, text = '' }) => {
<ide> var iconClass = err ?
<ide> '"ion-close-circled big-error-icon"' :
<ide> window.common = (function({ $, common = { init: [] }}) {
<ide> `)
<ide> .appendTo($('#testSuite'));
<ide> });
<del>
<add> $('#scroll-locker').animate({ scrollTop: $(document).height() }, 'slow');
<ide> return data;
<ide> };
<ide>
<ide><path>client/commonFramework/end.js
<ide> $(document).ready(function() {
<ide> common.submitBtn$
<ide> )
<ide> .flatMap(() => {
<add> $('#testSuite').fadeOut('slow');
<ide> common.appendToOutputDisplay('\n// testing challenge...');
<ide> return common.executeChallenge$()
<ide> .map(({ tests, ...rest }) => { | 2 |
Javascript | Javascript | move .bind() and .delegate() to deprecated | ee0854f85bd686b55757e8854a10480f23c928da | <ide><path>src/deprecated.js
<ide> define( function() {
<add>
<add>jQuery.fn.extend( {
<add>
<add> bind: function( types, data, fn ) {
<add> return this.on( types, null, data, fn );
<add> },
<add> unbind: function( types, fn ) {
<add> return this.off( types, null, fn );
<add> },
<add>
<add> delegate: function( selector, types, data, fn ) {
<add> return this.on( types, selector, data, fn );
<add> },
<add> undelegate: function( selector, types, fn ) {
<add>
<add> // ( namespace ) or ( selector, types [, fn] )
<add> return arguments.length === 1 ?
<add> this.off( selector, "**" ) :
<add> this.off( types, selector || "**", fn );
<add> }
<add>} );
<add>
<ide> } );
<ide><path>src/event/alias.js
<ide> jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
<ide> jQuery.fn.extend( {
<ide> hover: function( fnOver, fnOut ) {
<ide> return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
<del> },
<del>
<del> bind: function( types, data, fn ) {
<del> return this.on( types, null, data, fn );
<del> },
<del> unbind: function( types, fn ) {
<del> return this.off( types, null, fn );
<del> },
<del>
<del> delegate: function( selector, types, data, fn ) {
<del> return this.on( types, selector, data, fn );
<del> },
<del> undelegate: function( selector, types, fn ) {
<del>
<del> // ( namespace ) or ( selector, types [, fn] )
<del> return arguments.length === 1 ?
<del> this.off( selector, "**" ) :
<del> this.off( types, selector || "**", fn );
<ide> }
<ide> } );
<ide>
<ide><path>test/data/testinit.js
<ide> this.loadTests = function() {
<ide> "unit/core.js",
<ide> "unit/callbacks.js",
<ide> "unit/deferred.js",
<add> "unit/deprecated.js",
<ide> "unit/support.js",
<ide> "unit/data.js",
<ide> "unit/queue.js",
<ide><path>test/unit/deprecated.js
<ide> QUnit.module( "deprecated", { teardown: moduleTeardown } );
<ide>
<add>
<add>QUnit.test( "bind/unbind", function( assert ) {
<add> assert.expect( 4 );
<add>
<add> var markup = jQuery(
<add> "<div><p><span><b>b</b></span></p></div>"
<add> );
<add>
<add> markup
<add> .find( "b" )
<add> .bind( "click", { bindData: 19 }, function( e, trig ) {
<add> assert.equal( e.type, "click", "correct event type" );
<add> assert.equal( e.data.bindData, 19, "correct trigger data" );
<add> assert.equal( trig, 42, "correct bind data" );
<add> assert.equal( e.target.nodeName.toLowerCase(), "b" , "correct element" );
<add> } )
<add> .trigger( "click", [ 42 ] )
<add> .unbind( "click" )
<add> .trigger( "click" )
<add> .remove();
<add>} );
<add>
<add>QUnit.test( "delegate/undelegate", function( assert ) {
<add> assert.expect( 2 );
<add>
<add> var markup = jQuery(
<add> "<div><p><span><b>b</b></span></p></div>"
<add> );
<add>
<add> markup
<add> .delegate( "b", "click", function( e ) {
<add> assert.equal( e.type, "click", "correct event type" );
<add> assert.equal( e.target.nodeName.toLowerCase(), "b" , "correct element" );
<add> } )
<add> .find( "b" )
<add> .trigger( "click" )
<add> .end()
<add> .undelegate( "b", "click" )
<add> .remove();
<add>} );
<ide>\ No newline at end of file | 4 |
Javascript | Javascript | fix xss logic that matched some valid urls | 841466416b6851666955113a60ae46830a27003f | <ide><path>lib/helpers/isValidXss.js
<ide> 'use strict';
<ide>
<ide> module.exports = function isValidXss(requestURL) {
<del> var xssRegex = /(\b)(on\S+)(\s*)=|javascript|(<\s*)(\/*)script/gi;
<add> var xssRegex = /(\b)(on\w+)=|javascript|(<\s*)(\/*)script/gi;
<ide> return xssRegex.test(requestURL);
<ide> };
<add>
<ide><path>test/specs/helpers/isValidXss.spec.js
<ide> describe('helpers::isValidXss', function () {
<ide> });
<ide>
<ide> it('should not detect non script tags', function() {
<add> expect(isValidXss("/one/?foo=bar")).toBe(false);
<ide> expect(isValidXss("<safe> tags")).toBe(false);
<ide> expect(isValidXss("<safetag>")).toBe(false);
<ide> expect(isValidXss(">>> safe <<<")).toBe(false); | 2 |
Text | Text | fix text to follow portuguese language syntax | bff834d8cbf0a56bbd27eede472339ed168bed08 | <ide><path>curriculum/challenges/portuguese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.portuguese.md
<ide> localeTitle: Use a propriedade de base flexível para definir o tamanho inicial
<ide> ---
<ide>
<ide> ## Description
<del><section id="description"> A propriedade de <code>flex-basis</code> especifica o tamanho inicial do item antes que o CSS faça ajustes com <code>flex-shrink</code> ou <code>flex-grow</code> . As unidades usadas pela propriedade <code>flex-basis</code> são as mesmas que outras propriedades de tamanho ( <code>px</code> , <code>em</code> , <code>%</code> , etc.). O valor <code>auto</code> dimensiona itens com base no conteúdo. </section>
<add><section id="description"> A propriedade <code>flex-basis</code> especifica o tamanho inicial do item antes que o CSS faça ajustes com <code>flex-shrink</code> ou <code>flex-grow</code> .
<add>As unidades usadas pela propriedade <code>flex-basis</code> são as mesmas que outras propriedades de tamanho ( <code>px</code> , <code>em</code> , <code>%</code> , etc.). O valor <code>auto</code> dimensiona itens com base no conteúdo. </section>
<ide>
<ide> ## Instructions
<del><section id="instructions"> Defina o tamanho inicial das caixas usando <code>flex-basis</code> . Adicione a propriedade <code>flex-basis</code> CSS a <code>#box-1</code> e <code>#box-2</code> . Dê <code>#box-1</code> um valor de <code>10em</code> e <code>#box-2</code> um valor de <code>20em</code> . </section>
<add><section id="instructions"> Defina o tamanho inicial das caixas usando <code>flex-basis</code> . Adicione a propriedade CSS <code>flex-basis</code> a ambos <code>#box-1</code> e <code>#box-2</code> . Dê <code>#box-1</code> um valor de <code>10em</code> e <code>#box-2</code> um valor de <code>20em</code> . </section>
<ide>
<ide> ## Tests
<ide> <section id='tests'> | 1 |
Python | Python | improve error-checking of axis argument | 78084ee261eae43e3b6cb12abee7d7880c62bc0c | <ide><path>numpy/lib/shape_base.py
<ide> def apply_along_axis(func1d, axis, arr, *args, **kwargs):
<ide> # handle negative axes
<ide> arr = asanyarray(arr)
<ide> nd = arr.ndim
<add> if not (-nd <= axis < nd):
<add> raise IndexError('axis {0} out of bounds [-{1}, {1})'.format(axis, nd))
<ide> if axis < 0:
<ide> axis += nd
<del> if axis >= nd:
<del> raise ValueError("axis must be less than arr.ndim; axis=%d, rank=%d."
<del> % (axis, nd))
<ide>
<ide> # arr, with the iteration axis at the end
<ide> in_dims = list(range(nd)) | 1 |
Ruby | Ruby | fix broken tests | b30294b54ab019b0e53402c6927981f8c306e976 | <ide><path>activesupport/lib/active_support/notifications.rb
<ide> require 'thread'
<ide> require 'active_support/core_ext/module/delegation'
<ide> require 'active_support/core_ext/module/attribute_accessors'
<add>require 'active_support/secure_random'
<ide>
<ide> module ActiveSupport
<ide> # Notifications provides an instrumentation API for Ruby. To instrument an
<ide><path>railties/test/application/notifications_test.rb
<ide> def initialize
<ide> @subscribers = []
<ide> end
<ide>
<del> def publish(name, payload=nil)
<add> def publish(name, *args)
<ide> @events << name
<ide> end
<ide> | 2 |
Ruby | Ruby | pull option duping up | 0c3f8e3f0248c033119c81d4590c8de2ac46f174 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def match(path, *rest)
<ide>
<ide> path_types = paths.group_by(&:class)
<ide> path_types.fetch(String, []).each do |_path|
<del> process_path(options, controller, _path, option_path || _path)
<add> route_options = options.dup
<add> process_path(route_options, controller, _path, option_path || _path)
<ide> end
<ide>
<ide> path_types.fetch(Symbol, []).each do |action|
<ide> def match(path, *rest)
<ide> end
<ide>
<ide> def process_path(options, controller, path, option_path)
<del> route_options = options.dup
<del>
<ide> path_without_format = path.sub(/\(\.:format\)$/, '')
<del> if using_match_shorthand?(path_without_format, route_options)
<del> route_options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1')
<del> route_options[:to].tr!("-", "_")
<add> if using_match_shorthand?(path_without_format, options)
<add> options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1')
<add> options[:to].tr!("-", "_")
<ide> end
<ide>
<del> decomposed_match(path, controller, route_options, option_path)
<add> decomposed_match(path, controller, options, option_path)
<ide> end
<ide>
<ide> def using_match_shorthand?(path, options) | 1 |
PHP | PHP | apply patch from 'biesbjerg' to apcengine | e6836163298c49bd8430f6f2a93200099afed6ea | <ide><path>lib/Cake/Cache/Engine/ApcEngine.php
<ide> public function clear($check) {
<ide> if ($check) {
<ide> return true;
<ide> }
<del> $info = apc_cache_info('user');
<del> $cacheKeys = $info['cache_list'];
<del> unset($info);
<del> foreach ($cacheKeys as $key) {
<del> if (strpos($key['info'], $this->settings['prefix']) === 0) {
<del> apc_delete($key['info']);
<add> if (class_exists('APCIterator')) {
<add> $iterator = new APCIterator(
<add> 'user',
<add> '/^' . preg_quote($this->settings['prefix'], '/') . '/',
<add> APC_ITER_NONE
<add> );
<add> apc_delete($iterator);
<add> } else {
<add> $cache = apc_cache_info('user');
<add> foreach ($cache['cache_list'] as $key) {
<add> if (strpos($key['info'], $this->settings['prefix']) === 0) {
<add> apc_delete($key['info']);
<add> }
<ide> }
<ide> }
<ide> return true; | 1 |
Ruby | Ruby | upload job fixes | b1331e62b1cc6ae7ed71ad70bfc3d5e18efccdf2 | <ide><path>Library/Contributions/cmd/brew-test-bot.rb
<ide> def single_commit? start_revision, end_revision
<ide>
<ide> def setup
<ide> @category = __method__
<del>
<add> return if ARGV.include? "--skip-setup"
<ide> test "brew doctor"
<ide> test "brew --env"
<ide> test "brew --config"
<ide> def check_results
<ide> def run
<ide> cleanup_before
<ide> download
<del> setup unless ARGV.include? "--skip-setup"
<ide> if ARGV.include? '--ci-pr-upload' or ARGV.include? '--ci-testing-upload'
<ide> bottle_upload
<ide> else
<add> setup
<ide> homebrew
<ide> formulae.each do |f|
<ide> formula(f)
<ide> def bottle_upload
<ide> id = ENV['UPSTREAM_BUILD_ID']
<ide> raise "Missing Jenkins variables!" unless jenkins and job and id
<ide>
<del> test "cp #{jenkins}/jobs/'#{job}'/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.* ."
<add> test "cp #{jenkins}/jobs/\"#{job}\"/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.* ."
<ide> test "brew bottle --merge --write *.bottle*.rb"
<ide>
<del> remote = "https://github.com/BrewTestBot/homebrew.git"
<add> remote = "git@github.com:BrewTestBot/homebrew.git"
<ide> pr = ENV['UPSTREAM_PULL_REQUEST']
<ide> tag = pr ? "pr-#{pr}" : "testing-#{id}"
<ide> test "git push --force #{remote} :refs/tags/#{tag}"
<ide>
<ide> path = "/home/frs/project/m/ma/machomebrew/Bottles/"
<del> url = "mikemcquaid,machomebrew@frs.sourceforge.net:#{path}"
<add> url = "BrewTestBot,machomebrew@frs.sourceforge.net:#{path}"
<ide> options = "--partial --progress --human-readable --compress"
<ide> test "rsync #{options} *.bottle.tar.gz #{url}"
<ide> test "git tag --force #{tag}" | 1 |
Go | Go | reduce the timeout for restart/stop | 34353e782e1cdbd6aae078b3e660875e703d35ff | <ide><path>integration/server_test.go
<ide> func TestCreateStartRestartStopStartKillRm(t *testing.T) {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if err := srv.ContainerRestart(id, 150); err != nil {
<add> if err := srv.ContainerRestart(id, 15); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if err := srv.ContainerStop(id, 150); err != nil {
<add> if err := srv.ContainerStop(id, 15); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<ide><path>term/term.go
<ide> import (
<ide> )
<ide>
<ide> var (
<del> ErrInvalidState = errors.New("Invlide terminal state")
<add> ErrInvalidState = errors.New("Invlid terminal state")
<ide> )
<ide>
<ide> type State struct { | 2 |
Javascript | Javascript | make remaining empty lanes transition lanes | 114ab52953bea3d78785e25300e70cce56f307e9 | <ide><path>packages/react-reconciler/src/ReactFiberLane.new.js
<ide> export const SyncBatchedLane: Lane = /* */ 0b0000000000000000000
<ide> export const InputDiscreteHydrationLane: Lane = /* */ 0b0000000000000000000000000000100;
<ide> const InputDiscreteLane: Lanes = /* */ 0b0000000000000000000000000001000;
<ide>
<del>const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000100000;
<del>const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000001000000;
<del>
<del>export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000100000000;
<del>export const DefaultLane: Lanes = /* */ 0b0000000000000000000001000000000;
<del>
<del>const TransitionHydrationLane: Lane = /* */ 0b0000000000000000001000000000000;
<del>const TransitionLanes: Lanes = /* */ 0b0000000001111111110000000000000;
<del>const TransitionLane1: Lane = /* */ 0b0000000000000000010000000000000;
<del>const TransitionLane2: Lane = /* */ 0b0000000000000000100000000000000;
<del>const TransitionLane3: Lane = /* */ 0b0000000000000001000000000000000;
<del>const TransitionLane4: Lane = /* */ 0b0000000000000010000000000000000;
<del>const TransitionLane5: Lane = /* */ 0b0000000000000100000000000000000;
<del>const TransitionLane6: Lane = /* */ 0b0000000000001000000000000000000;
<del>const TransitionLane7: Lane = /* */ 0b0000000000010000000000000000000;
<del>const TransitionLane8: Lane = /* */ 0b0000000000100000000000000000000;
<del>const TransitionLane9: Lane = /* */ 0b0000000001000000000000000000000;
<del>
<del>const RetryLanes: Lanes = /* */ 0b0000011110000000000000000000000;
<del>const RetryLane1: Lane = /* */ 0b0000000010000000000000000000000;
<del>const RetryLane2: Lane = /* */ 0b0000000100000000000000000000000;
<del>const RetryLane3: Lane = /* */ 0b0000001000000000000000000000000;
<del>const RetryLane4: Lane = /* */ 0b0000010000000000000000000000000;
<add>const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000010000;
<add>const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000100000;
<add>
<add>export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000001000000;
<add>export const DefaultLane: Lanes = /* */ 0b0000000000000000000000010000000;
<add>
<add>const TransitionLanes: Lanes = /* */ 0b0000000011111111111111100000000;
<add>const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000100000000;
<add>const TransitionLane1: Lane = /* */ 0b0000000000000000000001000000000;
<add>const TransitionLane2: Lane = /* */ 0b0000000000000000000010000000000;
<add>const TransitionLane3: Lane = /* */ 0b0000000000000000000100000000000;
<add>const TransitionLane4: Lane = /* */ 0b0000000000000000001000000000000;
<add>const TransitionLane5: Lane = /* */ 0b0000000000000000010000000000000;
<add>const TransitionLane6: Lane = /* */ 0b0000000000000000100000000000000;
<add>const TransitionLane7: Lane = /* */ 0b0000000000000001000000000000000;
<add>const TransitionLane8: Lane = /* */ 0b0000000000000010000000000000000;
<add>const TransitionLane9: Lane = /* */ 0b0000000000000100000000000000000;
<add>const TransitionLane10: Lane = /* */ 0b0000000000001000000000000000000;
<add>const TransitionLane11: Lane = /* */ 0b0000000000010000000000000000000;
<add>const TransitionLane12: Lane = /* */ 0b0000000000100000000000000000000;
<add>const TransitionLane13: Lane = /* */ 0b0000000001000000000000000000000;
<add>const TransitionLane14: Lane = /* */ 0b0000000010000000000000000000000;
<add>
<add>const RetryLanes: Lanes = /* */ 0b0000111100000000000000000000000;
<add>const RetryLane1: Lane = /* */ 0b0000000100000000000000000000000;
<add>const RetryLane2: Lane = /* */ 0b0000001000000000000000000000000;
<add>const RetryLane3: Lane = /* */ 0b0000010000000000000000000000000;
<add>const RetryLane4: Lane = /* */ 0b0000100000000000000000000000000;
<ide>
<ide> export const SomeRetryLane: Lane = RetryLane1;
<ide>
<del>export const SelectiveHydrationLane: Lane = /* */ 0b0000100000000000000000000000000;
<add>export const SelectiveHydrationLane: Lane = /* */ 0b0001000000000000000000000000000;
<ide>
<del>const NonIdleLanes = /* */ 0b0000111111111111111111111111111;
<add>const NonIdleLanes = /* */ 0b0001111111111111111111111111111;
<ide>
<del>export const IdleHydrationLane: Lane = /* */ 0b0001000000000000000000000000000;
<del>const IdleLane: Lanes = /* */ 0b0010000000000000000000000000000;
<add>export const IdleHydrationLane: Lane = /* */ 0b0010000000000000000000000000000;
<add>const IdleLane: Lanes = /* */ 0b0100000000000000000000000000000;
<ide>
<ide> export const OffscreenLane: Lane = /* */ 0b1000000000000000000000000000000;
<ide>
<ide> function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
<ide> case TransitionLane7:
<ide> case TransitionLane8:
<ide> case TransitionLane9:
<add> case TransitionLane10:
<add> case TransitionLane11:
<add> case TransitionLane12:
<add> case TransitionLane13:
<add> case TransitionLane14:
<ide> return_highestLanePriority = TransitionPriority;
<ide> return lanes & TransitionLanes;
<ide> case RetryLane1:
<ide><path>packages/react-reconciler/src/ReactFiberLane.old.js
<ide> export const SyncBatchedLane: Lane = /* */ 0b0000000000000000000
<ide> export const InputDiscreteHydrationLane: Lane = /* */ 0b0000000000000000000000000000100;
<ide> const InputDiscreteLane: Lanes = /* */ 0b0000000000000000000000000001000;
<ide>
<del>const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000100000;
<del>const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000001000000;
<del>
<del>export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000100000000;
<del>export const DefaultLane: Lanes = /* */ 0b0000000000000000000001000000000;
<del>
<del>const TransitionHydrationLane: Lane = /* */ 0b0000000000000000001000000000000;
<del>const TransitionLanes: Lanes = /* */ 0b0000000001111111110000000000000;
<del>const TransitionLane1: Lane = /* */ 0b0000000000000000010000000000000;
<del>const TransitionLane2: Lane = /* */ 0b0000000000000000100000000000000;
<del>const TransitionLane3: Lane = /* */ 0b0000000000000001000000000000000;
<del>const TransitionLane4: Lane = /* */ 0b0000000000000010000000000000000;
<del>const TransitionLane5: Lane = /* */ 0b0000000000000100000000000000000;
<del>const TransitionLane6: Lane = /* */ 0b0000000000001000000000000000000;
<del>const TransitionLane7: Lane = /* */ 0b0000000000010000000000000000000;
<del>const TransitionLane8: Lane = /* */ 0b0000000000100000000000000000000;
<del>const TransitionLane9: Lane = /* */ 0b0000000001000000000000000000000;
<del>
<del>const RetryLanes: Lanes = /* */ 0b0000011110000000000000000000000;
<del>const RetryLane1: Lane = /* */ 0b0000000010000000000000000000000;
<del>const RetryLane2: Lane = /* */ 0b0000000100000000000000000000000;
<del>const RetryLane3: Lane = /* */ 0b0000001000000000000000000000000;
<del>const RetryLane4: Lane = /* */ 0b0000010000000000000000000000000;
<add>const InputContinuousHydrationLane: Lane = /* */ 0b0000000000000000000000000010000;
<add>const InputContinuousLane: Lanes = /* */ 0b0000000000000000000000000100000;
<add>
<add>export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000001000000;
<add>export const DefaultLane: Lanes = /* */ 0b0000000000000000000000010000000;
<add>
<add>const TransitionLanes: Lanes = /* */ 0b0000000011111111111111100000000;
<add>const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000100000000;
<add>const TransitionLane1: Lane = /* */ 0b0000000000000000000001000000000;
<add>const TransitionLane2: Lane = /* */ 0b0000000000000000000010000000000;
<add>const TransitionLane3: Lane = /* */ 0b0000000000000000000100000000000;
<add>const TransitionLane4: Lane = /* */ 0b0000000000000000001000000000000;
<add>const TransitionLane5: Lane = /* */ 0b0000000000000000010000000000000;
<add>const TransitionLane6: Lane = /* */ 0b0000000000000000100000000000000;
<add>const TransitionLane7: Lane = /* */ 0b0000000000000001000000000000000;
<add>const TransitionLane8: Lane = /* */ 0b0000000000000010000000000000000;
<add>const TransitionLane9: Lane = /* */ 0b0000000000000100000000000000000;
<add>const TransitionLane10: Lane = /* */ 0b0000000000001000000000000000000;
<add>const TransitionLane11: Lane = /* */ 0b0000000000010000000000000000000;
<add>const TransitionLane12: Lane = /* */ 0b0000000000100000000000000000000;
<add>const TransitionLane13: Lane = /* */ 0b0000000001000000000000000000000;
<add>const TransitionLane14: Lane = /* */ 0b0000000010000000000000000000000;
<add>
<add>const RetryLanes: Lanes = /* */ 0b0000111100000000000000000000000;
<add>const RetryLane1: Lane = /* */ 0b0000000100000000000000000000000;
<add>const RetryLane2: Lane = /* */ 0b0000001000000000000000000000000;
<add>const RetryLane3: Lane = /* */ 0b0000010000000000000000000000000;
<add>const RetryLane4: Lane = /* */ 0b0000100000000000000000000000000;
<ide>
<ide> export const SomeRetryLane: Lane = RetryLane1;
<ide>
<del>export const SelectiveHydrationLane: Lane = /* */ 0b0000100000000000000000000000000;
<add>export const SelectiveHydrationLane: Lane = /* */ 0b0001000000000000000000000000000;
<ide>
<del>const NonIdleLanes = /* */ 0b0000111111111111111111111111111;
<add>const NonIdleLanes = /* */ 0b0001111111111111111111111111111;
<ide>
<del>export const IdleHydrationLane: Lane = /* */ 0b0001000000000000000000000000000;
<del>const IdleLane: Lanes = /* */ 0b0010000000000000000000000000000;
<add>export const IdleHydrationLane: Lane = /* */ 0b0010000000000000000000000000000;
<add>const IdleLane: Lanes = /* */ 0b0100000000000000000000000000000;
<ide>
<ide> export const OffscreenLane: Lane = /* */ 0b1000000000000000000000000000000;
<ide>
<ide> function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes {
<ide> case TransitionLane7:
<ide> case TransitionLane8:
<ide> case TransitionLane9:
<add> case TransitionLane10:
<add> case TransitionLane11:
<add> case TransitionLane12:
<add> case TransitionLane13:
<add> case TransitionLane14:
<ide> return_highestLanePriority = TransitionPriority;
<ide> return lanes & TransitionLanes;
<ide> case RetryLane1:
<ide><path>packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js
<ide> describe('DebugTracing', () => {
<ide>
<ide> let logs;
<ide>
<add> const DEFAULT_LANE_STRING = '0b0000000000000000000000010000000';
<add> const RETRY_LANE_STRING = '0b0000000100000000000000000000000';
<add>
<ide> beforeEach(() => {
<ide> jest.resetModules();
<ide>
<ide> describe('DebugTracing', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000010000000000000000000000)',
<add> `group: ⚛️ render (${RETRY_LANE_STRING})`,
<ide> 'log: <Example/>',
<del> 'groupEnd: ⚛️ render (0b0000000010000000000000000000000)',
<add> `groupEnd: ⚛️ render (${RETRY_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000000000000000001000000000)',
<add> `group: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> 'log: ⚛️ Example suspended',
<del> 'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
<add> `groupEnd: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide>
<ide> logs.splice(0);
<ide> describe('DebugTracing', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000000000000000001000000000)',
<add> `group: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> 'log: <Wrapper/>',
<del> 'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
<add> `groupEnd: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide>
<ide> logs.splice(0);
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000010000000000000000000000)',
<add> `group: ⚛️ render (${RETRY_LANE_STRING})`,
<ide> 'log: <Example/>',
<del> 'groupEnd: ⚛️ render (0b0000000010000000000000000000000)',
<add> `groupEnd: ⚛️ render (${RETRY_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ commit (0b0000000000000000000001000000000)',
<del> 'group: ⚛️ layout effects (0b0000000000000000000001000000000)',
<add> `group: ⚛️ commit (${DEFAULT_LANE_STRING})`,
<add> `group: ⚛️ layout effects (${DEFAULT_LANE_STRING})`,
<ide> 'log: ⚛️ Example updated state (0b0000000000000000000000000000001)',
<del> 'groupEnd: ⚛️ layout effects (0b0000000000000000000001000000000)',
<del> 'groupEnd: ⚛️ commit (0b0000000000000000000001000000000)',
<add> `groupEnd: ⚛️ layout effects (${DEFAULT_LANE_STRING})`,
<add> `groupEnd: ⚛️ commit (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> }).toErrorDev('Cannot update during an existing state transition');
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000000000000000001000000000)',
<del> 'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
<del> 'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
<del> 'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
<add> `group: ⚛️ render (${DEFAULT_LANE_STRING})`,
<add> `log: ⚛️ Example updated state (${DEFAULT_LANE_STRING})`,
<add> `log: ⚛️ Example updated state (${DEFAULT_LANE_STRING})`,
<add> `groupEnd: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ commit (0b0000000000000000000001000000000)',
<del> 'group: ⚛️ layout effects (0b0000000000000000000001000000000)',
<add> `group: ⚛️ commit (${DEFAULT_LANE_STRING})`,
<add> `group: ⚛️ layout effects (${DEFAULT_LANE_STRING})`,
<ide> 'log: ⚛️ Example updated state (0b0000000000000000000000000000001)',
<del> 'groupEnd: ⚛️ layout effects (0b0000000000000000000001000000000)',
<del> 'groupEnd: ⚛️ commit (0b0000000000000000000001000000000)',
<add> `groupEnd: ⚛️ layout effects (${DEFAULT_LANE_STRING})`,
<add> `groupEnd: ⚛️ commit (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> );
<ide> });
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ passive effects (0b0000000000000000000001000000000)',
<del> 'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
<del> 'groupEnd: ⚛️ passive effects (0b0000000000000000000001000000000)',
<add> `group: ⚛️ passive effects (${DEFAULT_LANE_STRING})`,
<add> `log: ⚛️ Example updated state (${DEFAULT_LANE_STRING})`,
<add> `groupEnd: ⚛️ passive effects (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> });
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000000000000000001000000000)',
<del> 'log: ⚛️ Example updated state (0b0000000000000000000001000000000)',
<del> 'log: ⚛️ Example updated state (0b0000000000000000000001000000000)', // debugRenderPhaseSideEffectsForStrictMode
<del> 'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
<add> `group: ⚛️ render (${DEFAULT_LANE_STRING})`,
<add> `log: ⚛️ Example updated state (${DEFAULT_LANE_STRING})`,
<add> `log: ⚛️ Example updated state (${DEFAULT_LANE_STRING})`, // debugRenderPhaseSideEffectsForStrictMode
<add> `groupEnd: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide> describe('DebugTracing', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expect(logs).toEqual([
<del> 'group: ⚛️ render (0b0000000000000000000001000000000)',
<add> `group: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> 'log: Hello from user code',
<del> 'groupEnd: ⚛️ render (0b0000000000000000000001000000000)',
<add> `groupEnd: ⚛️ render (${DEFAULT_LANE_STRING})`,
<ide> ]);
<ide> });
<ide>
<ide><path>packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js
<ide> describe('SchedulingProfiler', () => {
<ide> delete global.performance;
<ide> });
<ide>
<add> // This is coupled to implementation
<add> const DEFAULT_LANE = 128;
<add>
<ide> // @gate !enableSchedulingProfiler
<ide> it('should not mark if enableSchedulingProfiler is false', () => {
<ide> ReactTestRenderer.create(<div />);
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expectMarksToEqual([
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--layout-effects-stop',
<ide> '--commit-stop',
<ide> ]);
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<del> '--render-start-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-yield',
<ide> ]);
<ide> });
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expectMarksToEqual([
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--suspense-suspend-0-Example',
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--layout-effects-stop',
<ide> '--commit-stop',
<ide> ]);
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expectMarksToEqual([
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--suspense-suspend-0-Example',
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--layout-effects-stop',
<ide> '--commit-stop',
<ide> ]);
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expectMarksToEqual([
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--schedule-state-update-1-Example',
<ide> '--layout-effects-stop',
<ide> '--render-start-1',
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expectMarksToEqual([
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--schedule-forced-update-1-Example',
<ide> '--layout-effects-stop',
<ide> '--render-start-1',
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide> describe('SchedulingProfiler', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide> }).toErrorDev('Cannot update during an existing state transition');
<ide>
<del> expectMarksToContain('--schedule-state-update-512-Example');
<add> expectMarksToContain(`--schedule-state-update-${DEFAULT_LANE}-Example`);
<ide> });
<ide>
<ide> // @gate enableSchedulingProfiler
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide> describe('SchedulingProfiler', () => {
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide> }).toErrorDev('Cannot update during an existing state transition');
<ide>
<del> expectMarksToContain('--schedule-forced-update-512-Example');
<add> expectMarksToContain(`--schedule-forced-update-${DEFAULT_LANE}-Example`);
<ide> });
<ide>
<ide> // @gate enableSchedulingProfiler
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<ide> ]);
<ide>
<ide> clearPendingMarks();
<ide>
<ide> expect(Scheduler).toFlushUntilNextPaint([]);
<ide>
<ide> expectMarksToEqual([
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--schedule-state-update-1-Example',
<ide> '--layout-effects-stop',
<ide> '--render-start-1',
<ide> describe('SchedulingProfiler', () => {
<ide>
<ide> expectMarksToEqual([
<ide> `--react-init-${ReactVersion}`,
<del> '--schedule-render-512',
<del> '--render-start-512',
<add> `--schedule-render-${DEFAULT_LANE}`,
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-stop',
<del> '--commit-start-512',
<del> '--layout-effects-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<add> `--layout-effects-start-${DEFAULT_LANE}`,
<ide> '--layout-effects-stop',
<ide> '--commit-stop',
<del> '--passive-effects-start-512',
<del> '--schedule-state-update-512-Example',
<add> `--passive-effects-start-${DEFAULT_LANE}`,
<add> `--schedule-state-update-${DEFAULT_LANE}-Example`,
<ide> '--passive-effects-stop',
<del> '--render-start-512',
<add> `--render-start-${DEFAULT_LANE}`,
<ide> '--render-stop',
<del> '--commit-start-512',
<add> `--commit-start-${DEFAULT_LANE}`,
<ide> '--commit-stop',
<ide> ]);
<ide> });
<ide> describe('SchedulingProfiler', () => {
<ide> ReactTestRenderer.create(<Example />, {unstable_isConcurrent: true});
<ide> });
<ide>
<del> expectMarksToContain('--schedule-state-update-512-Example');
<add> expectMarksToContain(`--schedule-state-update-${DEFAULT_LANE}-Example`);
<ide> });
<ide> }); | 4 |
Python | Python | use default view in triggerdagrunlink | 289c9b5a994a3e26951ca23b6edd30b2329b3089 | <ide><path>airflow/operators/dagrun_operator.py
<ide>
<ide> import datetime
<ide> from typing import Dict, Optional, Union
<del>from urllib.parse import quote
<ide>
<ide> from airflow.api.common.experimental.trigger_dag import trigger_dag
<ide> from airflow.exceptions import DagNotFound, DagRunAlreadyExists
<ide> from airflow.models import BaseOperator, BaseOperatorLink, DagBag, DagModel, DagRun
<ide> from airflow.utils import timezone
<ide> from airflow.utils.decorators import apply_defaults
<add>from airflow.utils.helpers import build_airflow_url_with_query
<ide> from airflow.utils.types import DagRunType
<ide>
<ide>
<ide> class TriggerDagRunLink(BaseOperatorLink):
<ide> name = 'Triggered DAG'
<ide>
<ide> def get_link(self, operator, dttm):
<del> return f"/graph?dag_id={operator.trigger_dag_id}&root=&execution_date={quote(dttm.isoformat())}"
<add> query = {"dag_id": operator.trigger_dag_id, "execution_date": dttm.isoformat()}
<add> return build_airflow_url_with_query(query)
<ide>
<ide>
<ide> class TriggerDagRunOperator(BaseOperator):
<ide><path>airflow/sensors/external_task_sensor.py
<ide> import datetime
<ide> import os
<ide> from typing import FrozenSet, Optional, Union
<del>from urllib.parse import quote
<ide>
<ide> from sqlalchemy import func
<ide>
<ide> from airflow.operators.dummy_operator import DummyOperator
<ide> from airflow.sensors.base_sensor_operator import BaseSensorOperator
<ide> from airflow.utils.decorators import apply_defaults
<add>from airflow.utils.helpers import build_airflow_url_with_query
<ide> from airflow.utils.session import provide_session
<ide> from airflow.utils.state import State
<ide>
<ide> class ExternalTaskSensorLink(BaseOperatorLink):
<ide> name = 'External DAG'
<ide>
<ide> def get_link(self, operator, dttm):
<del> return f"/graph?dag_id={operator.external_dag_id}&root=&execution_date={quote(dttm.isoformat())}"
<add> query = {"dag_id": operator.external_dag_id, "execution_date": dttm.isoformat()}
<add> return build_airflow_url_with_query(query)
<ide>
<ide>
<ide> class ExternalTaskSensor(BaseSensorOperator):
<ide><path>airflow/utils/helpers.py
<ide> from functools import reduce
<ide> from itertools import filterfalse, tee
<ide> from typing import Any, Callable, Dict, Generator, Iterable, List, Optional, TypeVar
<add>from urllib import parse
<ide>
<ide> from jinja2 import Template
<ide>
<add>from airflow.configuration import conf
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.utils.module_loading import import_string
<ide>
<ide> def cross_downstream(*args, **kwargs):
<ide> stacklevel=2,
<ide> )
<ide> return import_string('airflow.models.baseoperator.cross_downstream')(*args, **kwargs)
<add>
<add>
<add>def build_airflow_url_with_query(query: Dict[str, Any]) -> str:
<add> """
<add> Build airflow url using base_url and default_view and provided query
<add> For example:
<add> 'http://0.0.0.0:8000/base/graph?dag_id=my-task&root=&execution_date=2020-10-27T10%3A59%3A25.615587
<add> """
<add> view = conf.get('webserver', 'dag_default_view').lower()
<add> return f"/{view}?{parse.urlencode(query)}"
<ide><path>tests/utils/test_helpers.py
<ide> from airflow.models.dag import DAG
<ide> from airflow.operators.dummy_operator import DummyOperator
<ide> from airflow.utils import helpers
<del>from airflow.utils.helpers import merge_dicts
<add>from airflow.utils.helpers import build_airflow_url_with_query, merge_dicts
<add>from tests.test_utils.config import conf_vars
<ide>
<ide>
<ide> class TestHelpers(unittest.TestCase):
<ide> def test_merge_dicts_recursive_right_only(self):
<ide> dict2 = {'a': 1, 'r': {'c': 3, 'b': 0}}
<ide> merged = merge_dicts(dict1, dict2)
<ide> self.assertDictEqual(merged, {'a': 1, 'r': {'b': 0, 'c': 3}})
<add>
<add> @conf_vars(
<add> {
<add> ("webserver", "dag_default_view"): "custom",
<add> }
<add> )
<add> def test_build_airflow_url_with_query(self):
<add> query = {"dag_id": "test_dag", "param": "key/to.encode"}
<add> url = build_airflow_url_with_query(query)
<add> assert url == "/custom?dag_id=test_dag¶m=key%2Fto.encode" | 4 |
Text | Text | fix typo in usagewithreactrouter.md | 7286d06ed5d4899312c2fc4c6dd9c1ca7e3896b7 | <ide><path>docs/advanced/UsageWithReactRouter.md
<ide> # Usage with React Router
<ide>
<del>So you want to do routing with your Redux app. You can use it with [React Router](https://github.com/reactjs/react-router). Redux will be the source of truth for your data and React Router will be the source of truth for your URL. In most of the cases, **it is fine** to have them separate unless if you need to time travel and rewind actions that triggers the change URL.
<add>So you want to do routing with your Redux app. You can use it with [React Router](https://github.com/reactjs/react-router). Redux will be the source of truth for your data and React Router will be the source of truth for your URL. In most of the cases, **it is fine** to have them separate unless you need to time travel and rewind actions that triggers the change URL.
<ide>
<ide> ## Installing React Router
<ide> `react-router` is available on npm . This guides assumes you are using `react-router@^2.7.0`. | 1 |
Text | Text | add history entry for breaking destroy() change | 7fcbeb4e7e63a11bf9de91ccf54a7d745b73c9d1 | <ide><path>doc/api/stream.md
<ide> See also: [`writable.uncork()`][], [`writable._writev()`][stream-_writev].
<ide> ##### `writable.destroy([error])`
<ide> <!-- YAML
<ide> added: v8.0.0
<add>changes:
<add> - version: v14.0.0
<add> pr-url: https://github.com/nodejs/node/pull/29197
<add> description: Work as noop when called on an already `destroyed` stream.
<ide> -->
<ide>
<ide> * `error` {Error} Optional, an error to emit with `'error'` event.
<ide> called and `readableFlowing` is not `true`.
<ide> ##### `readable.destroy([error])`
<ide> <!-- YAML
<ide> added: v8.0.0
<add>changes:
<add> - version: v14.0.0
<add> pr-url: https://github.com/nodejs/node/pull/29197
<add> description: Work as noop when called on an already `destroyed` stream.
<ide> -->
<ide>
<ide> * `error` {Error} Error which will be passed as payload in `'error'` event
<ide> Examples of `Transform` streams include:
<ide> ##### `transform.destroy([error])`
<ide> <!-- YAML
<ide> added: v8.0.0
<add>changes:
<add> - version: v14.0.0
<add> pr-url: https://github.com/nodejs/node/pull/29197
<add> description: Work as noop when called on an already `destroyed` stream.
<ide> -->
<ide>
<ide> * `error` {Error} | 1 |
Text | Text | add some interesting information about crypto.. | 24a58a712dbe7133981ec72fb8452f4e00558d7d | <ide><path>guide/russian/blockchain/cryptocurrency/index.md
<ide> Cryptocurrency - это подмножество цифровой валюты,
<ide>
<ide> В отличие от обычной валюты, криптовалюту можно обменять как фракции. Например, транзакции могут составлять 0,00007 Btc (биткоинов) или даже ниже.
<ide>
<add>
<ide> Если вы хотите зарабатывать биткойны посредством майнинга, это можно сделать, разрешив математические доказательства работы, которые проверяют транзакции. Blockchain использует концепцию необратимой криптографической хэш-функции, которая состоит из угадывания случайного числа (обычно меньше определенного значения) для решения проблемы для проверки транзакции. Для решения этих проблем вам потребуются машины с высокой вычислительной мощностью (например, Fast-Hash One или CoinTerra TerraMiner IV).
<ide>
<add>
<ide> #### Дополнительная информация:
<ide>
<ide> [криптовалюта](https://en.wikipedia.org/wiki/Cryptocurrency) | 1 |
PHP | PHP | remove deprecated file from symfony/finder | 1361c23a1be302e0bed34add6c07adacfe8b5aa2 | <ide><path>src/Illuminate/Foundation/Console/Optimize/config.php
<ide> $basePath.'/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php',
<ide> $basePath.'/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php',
<ide> $basePath.'/vendor/symfony/finder/Iterator/FilenameFilterIterator.php',
<del> $basePath.'/vendor/symfony/finder/Shell/Shell.php',
<del> $basePath.'/vendor/symfony/finder/Adapter/AdapterInterface.php',
<del> $basePath.'/vendor/symfony/finder/Adapter/AbstractAdapter.php',
<del> $basePath.'/vendor/symfony/finder/Adapter/AbstractFindAdapter.php',
<del> $basePath.'/vendor/symfony/finder/Adapter/GnuFindAdapter.php',
<del> $basePath.'/vendor/symfony/finder/Adapter/PhpAdapter.php',
<del> $basePath.'/vendor/symfony/finder/Adapter/BsdFindAdapter.php',
<ide> $basePath.'/vendor/symfony/finder/Finder.php',
<ide> $basePath.'/vendor/symfony/finder/Glob.php',
<ide> $basePath.'/vendor/vlucas/phpdotenv/src/Dotenv.php', | 1 |
Java | Java | eliminate the need for encoder#getcontentlength | 010352163ba4d7f754c019912dc67cb31ef5702a | <ide><path>spring-core/src/main/java/org/springframework/core/codec/ByteArrayEncoder.java
<ide> public Flux<DataBuffer> encode(Publisher<? extends byte[]> inputStream,
<ide> return Flux.from(inputStream).map(bufferFactory::wrap);
<ide> }
<ide>
<del> @Override
<del> public Long getContentLength(byte[] bytes, @Nullable MimeType mimeType) {
<del> return (long) bytes.length;
<del> }
<ide> }
<ide><path>spring-core/src/main/java/org/springframework/core/codec/ByteBufferEncoder.java
<ide> public Flux<DataBuffer> encode(Publisher<? extends ByteBuffer> inputStream,
<ide> return Flux.from(inputStream).map(bufferFactory::wrap);
<ide> }
<ide>
<del> @Override
<del> public Long getContentLength(ByteBuffer byteBuffer, @Nullable MimeType mimeType) {
<del> return (long) byteBuffer.array().length;
<del> }
<ide> }
<ide><path>spring-core/src/main/java/org/springframework/core/codec/CharSequenceEncoder.java
<ide> private Charset getCharset(@Nullable MimeType mimeType) {
<ide> return charset;
<ide> }
<ide>
<del> @Override
<del> public Long getContentLength(CharSequence data, @Nullable MimeType mimeType) {
<del> return (long) data.toString().getBytes(getCharset(mimeType)).length;
<del> }
<del>
<ide> /**
<ide> * Create a {@code CharSequenceEncoder} that supports only "text/plain".
<ide> */
<ide><path>spring-core/src/main/java/org/springframework/core/codec/DataBufferEncoder.java
<ide> public Flux<DataBuffer> encode(Publisher<? extends DataBuffer> inputStream,
<ide> return Flux.from(inputStream);
<ide> }
<ide>
<del> @Override
<del> public Long getContentLength(DataBuffer dataBuffer, @Nullable MimeType mimeType) {
<del> return (long) dataBuffer.readableByteCount();
<del> }
<del>
<ide> }
<ide><path>spring-core/src/main/java/org/springframework/core/codec/Encoder.java
<ide> Flux<DataBuffer> encode(Publisher<? extends T> inputStream, DataBufferFactory bufferFactory,
<ide> ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints);
<ide>
<del> /**
<del> * Return the length for the given item, if known.
<del> * @param t the item to check
<del> * @return the length in bytes, or {@code null} if not known.
<del> * @since 5.0.5
<del> */
<del> @Nullable
<del> default Long getContentLength(T t, @Nullable MimeType mimeType) {
<del> return null;
<del> }
<del>
<ide> /**
<ide> * Return the list of mime types this encoder supports.
<ide> */
<ide><path>spring-core/src/main/java/org/springframework/core/codec/ResourceEncoder.java
<ide>
<ide> package org.springframework.core.codec;
<ide>
<del>import java.io.IOException;
<ide> import java.util.Map;
<ide>
<ide> import reactor.core.publisher.Flux;
<ide>
<ide> import org.springframework.core.ResolvableType;
<del>import org.springframework.core.io.InputStreamResource;
<ide> import org.springframework.core.io.Resource;
<ide> import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.core.io.buffer.DataBufferFactory;
<ide> protected Flux<DataBuffer> encode(Resource resource, DataBufferFactory dataBuffe
<ide> return DataBufferUtils.read(resource, dataBufferFactory, this.bufferSize);
<ide> }
<ide>
<del> @Override
<del> public Long getContentLength(Resource resource, @Nullable MimeType mimeType) {
<del> // Don't consume InputStream...
<del> if (InputStreamResource.class != resource.getClass()) {
<del> try {
<del> return resource.contentLength();
<del> }
<del> catch (IOException ignored) {
<del> }
<del> }
<del> return null;
<del> }
<del>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/EncoderHttpMessageWriter.java
<ide> import org.springframework.core.ResolvableType;
<ide> import org.springframework.core.codec.Encoder;
<ide> import org.springframework.core.io.buffer.DataBuffer;
<add>import org.springframework.core.io.buffer.DataBufferFactory;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.ReactiveHttpOutputMessage;
<ide> public Mono<Void> write(Publisher<? extends T> inputStream, ResolvableType eleme
<ide> @Nullable MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) {
<ide>
<ide> MediaType contentType = updateContentType(message, mediaType);
<del> HttpHeaders headers = message.getHeaders();
<del>
<del> if (headers.getContentLength() < 0 && !headers.containsKey(HttpHeaders.TRANSFER_ENCODING)) {
<del> if (inputStream instanceof Mono) {
<del> // This works because we don't actually commit until after the first signal...
<del> inputStream = ((Mono<T>) inputStream).doOnNext(data -> {
<del> Long contentLength = this.encoder.getContentLength(data, contentType);
<del> if (contentLength != null) {
<del> headers.setContentLength(contentLength);
<del> }
<del> });
<del> }
<del> }
<ide>
<ide> Flux<DataBuffer> body = this.encoder.encode(
<ide> inputStream, message.bufferFactory(), elementType, contentType, hints);
<ide>
<add> // Response is not committed until the first signal...
<add> if (inputStream instanceof Mono) {
<add> HttpHeaders headers = message.getHeaders();
<add> if (headers.getContentLength() < 0 && !headers.containsKey(HttpHeaders.TRANSFER_ENCODING)) {
<add> body = body.doOnNext(data -> headers.setContentLength(data.readableByteCount()));
<add> }
<add> }
<add>
<ide> return (isStreamingMediaType(contentType) ?
<ide> message.writeAndFlushWith(body.map(Flux::just)) : message.writeWith(body));
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/ResourceHttpMessageWriter.java
<ide> import org.springframework.core.codec.ResourceDecoder;
<ide> import org.springframework.core.codec.ResourceEncoder;
<ide> import org.springframework.core.codec.ResourceRegionEncoder;
<add>import org.springframework.core.io.InputStreamResource;
<ide> import org.springframework.core.io.Resource;
<ide> import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.core.io.buffer.DataBufferFactory;
<ide> private Mono<Void> writeResource(Resource resource, ResolvableType type, @Nullab
<ide> headers.setContentType(resourceMediaType);
<ide>
<ide> if (headers.getContentLength() < 0) {
<del> Long contentLength = this.encoder.getContentLength(resource, mediaType);
<del> if (contentLength != null) {
<del> headers.setContentLength(contentLength);
<add> long length = lengthOf(resource);
<add> if (length != -1) {
<add> headers.setContentLength(length);
<ide> }
<ide> }
<ide>
<ide> private static MediaType getResourceMediaType(@Nullable MediaType mediaType, Res
<ide> return MediaTypeFactory.getMediaType(resource).orElse(MediaType.APPLICATION_OCTET_STREAM);
<ide> }
<ide>
<add> private static long lengthOf(Resource resource) {
<add> // Don't consume InputStream...
<add> if (InputStreamResource.class != resource.getClass()) {
<add> try {
<add> return resource.contentLength();
<add> }
<add> catch (IOException ignored) {
<add> }
<add> }
<add> return -1;
<add> }
<add>
<ide> private static Optional<Mono<Void>> zeroCopy(Resource resource, @Nullable ResourceRegion region,
<ide> ReactiveHttpOutputMessage message) {
<ide>
<ide> public Mono<Void> write(Publisher<? extends Resource> inputStream, @Nullable Res
<ide> if (regions.size() == 1){
<ide> ResourceRegion region = regions.get(0);
<ide> headers.setContentType(resourceMediaType);
<del> Long contentLength = this.encoder.getContentLength(resource, mediaType);
<del> if (contentLength != null) {
<add> long contentLength = lengthOf(resource);
<add> if (contentLength != -1) {
<ide> long start = region.getPosition();
<ide> long end = start + region.getCount() - 1;
<ide> end = Math.min(end, contentLength - 1);
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java
<ide> public void byteBufferResponseBodyWithFlowable() throws Exception {
<ide> @Test
<ide> public void personResponseBody() throws Exception {
<ide> Person expected = new Person("Robert");
<del> assertEquals(expected, performGet("/person-response/person", JSON, Person.class).getBody());
<add> ResponseEntity<Person> responseEntity = performGet("/person-response/person", JSON, Person.class);
<add> assertEquals(17, responseEntity.getHeaders().getContentLength());
<add> assertEquals(expected, responseEntity.getBody());
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithCompletableFuture() throws Exception {
<ide> Person expected = new Person("Robert");
<del> assertEquals(expected, performGet("/person-response/completable-future", JSON, Person.class).getBody());
<add> ResponseEntity<Person> responseEntity = performGet("/person-response/completable-future", JSON, Person.class);
<add> assertEquals(17, responseEntity.getHeaders().getContentLength());
<add> assertEquals(expected, responseEntity.getBody());
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithMono() throws Exception {
<ide> Person expected = new Person("Robert");
<del> assertEquals(expected, performGet("/person-response/mono", JSON, Person.class).getBody());
<add> ResponseEntity<Person> responseEntity = performGet("/person-response/mono", JSON, Person.class);
<add> assertEquals(17, responseEntity.getHeaders().getContentLength());
<add> assertEquals(expected, responseEntity.getBody());
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithMonoDeclaredAsObject() throws Exception {
<ide> Person expected = new Person("Robert");
<del> assertEquals(expected, performGet("/person-response/mono-declared-as-object", JSON, Person.class).getBody());
<add> ResponseEntity<Person> entity = performGet("/person-response/mono-declared-as-object", JSON, Person.class);
<add> assertEquals(17, entity.getHeaders().getContentLength());
<add> assertEquals(expected, entity.getBody());
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithSingle() throws Exception {
<ide> Person expected = new Person("Robert");
<del> assertEquals(expected, performGet("/person-response/single", JSON, Person.class).getBody());
<add> ResponseEntity<Person> entity = performGet("/person-response/single", JSON, Person.class);
<add> assertEquals(17, entity.getHeaders().getContentLength());
<add> assertEquals(expected, entity.getBody());
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithMonoResponseEntity() throws Exception {
<ide> Person expected = new Person("Robert");
<del> assertEquals(expected, performGet("/person-response/mono-response-entity", JSON, Person.class).getBody());
<add> ResponseEntity<Person> entity = performGet("/person-response/mono-response-entity", JSON, Person.class);
<add> assertEquals(17, entity.getHeaders().getContentLength());
<add> assertEquals(expected, entity.getBody());
<ide> }
<ide>
<ide> @Test // SPR-16172
<ide> public void personResponseBodyWithMonoResponseEntityXml() throws Exception {
<ide>
<del> String actual = performGet("/person-response/mono-response-entity-xml",
<del> new HttpHeaders(), String.class).getBody();
<add> String url = "/person-response/mono-response-entity-xml";
<add> ResponseEntity<String> entity = performGet(url, new HttpHeaders(), String.class);
<add> String actual = entity.getBody();
<ide>
<add> assertEquals(91, entity.getHeaders().getContentLength());
<ide> assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
<ide> "<person><name>Robert</name></person>", actual);
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithList() throws Exception {
<ide> List<?> expected = asList(new Person("Robert"), new Person("Marie"));
<del> assertEquals(expected, performGet("/person-response/list", JSON, PERSON_LIST).getBody());
<add> ResponseEntity<List<Person>> entity = performGet("/person-response/list", JSON, PERSON_LIST);
<add> assertEquals(36, entity.getHeaders().getContentLength());
<add> assertEquals(expected, entity.getBody());
<ide> }
<ide>
<ide> @Test
<ide> public void personResponseBodyWithPublisher() throws Exception {
<ide> List<?> expected = asList(new Person("Robert"), new Person("Marie"));
<del> assertEquals(expected, performGet("/person-response/publisher", JSON, PERSON_LIST).getBody());
<add> ResponseEntity<List<Person>> entity = performGet("/person-response/publisher", JSON, PERSON_LIST);
<add> assertEquals(-1, entity.getHeaders().getContentLength());
<add> assertEquals(expected, entity.getBody());
<ide> }
<ide>
<ide> @Test | 9 |
Python | Python | fix yaml rendering | d905d1cbd3a20191835be1a5bddee0aabf136ec6 | <ide><path>rest_framework/renderers.py
<ide> from rest_framework.utils.breadcrumbs import get_breadcrumbs
<ide> from rest_framework.utils.mediatypes import get_media_type_params
<ide> from rest_framework import VERSION
<del>from rest_framework import serializers
<add>from rest_framework import serializers, parsers
<ide>
<ide>
<ide> class BaseRenderer(object):
<ide> class YAMLRenderer(BaseRenderer):
<ide>
<ide> media_type = 'application/yaml'
<ide> format = 'yaml'
<add> encoder = encoders.SafeDumper
<ide>
<ide> def render(self, data, accepted_media_type=None, renderer_context=None):
<ide> """
<ide> def render(self, data, accepted_media_type=None, renderer_context=None):
<ide> if data is None:
<ide> return ''
<ide>
<del> return yaml.safe_dump(data)
<add> return yaml.dump(data, stream=None, Dumper=self.encoder)
<ide>
<ide>
<ide> class HTMLRenderer(BaseRenderer):
<ide> def get_form(self, view, method, request):
<ide> if method == 'DELETE' or method == 'OPTIONS':
<ide> return True # Don't actually need to return a form
<ide>
<del> if not getattr(view, 'get_serializer', None):
<add> if (not getattr(view, 'get_serializer', None) or
<add> not parsers.FormParser in getattr(view, 'parser_classes')):
<ide> media_types = [parser.media_type for parser in view.parser_classes]
<ide> return self.get_generic_content_form(media_types)
<ide>
<ide><path>rest_framework/utils/encoders.py
<ide> """
<ide> import datetime
<ide> import decimal
<add>import types
<ide> from django.utils import simplejson as json
<add>from django.utils.datastructures import SortedDict
<ide> from rest_framework.compat import timezone
<add>from rest_framework.serializers import DictWithMetadata, SortedDictWithMetadata
<ide>
<ide>
<ide> class JSONEncoder(json.JSONEncoder):
<ide> def default(self, o):
<ide> elif hasattr(o, '__iter__'):
<ide> return [i for i in o]
<ide> return super(JSONEncoder, self).default(o)
<add>
<add>
<add>try:
<add> import yaml
<add>except ImportError:
<add> SafeDumper = None
<add>else:
<add> # Adapted from http://pyyaml.org/attachment/ticket/161/use_ordered_dict.py
<add> class SafeDumper(yaml.SafeDumper):
<add> """
<add> Handles decimals as strings.
<add> Handles SortedDicts as usual dicts, but preserves field order, rather
<add> than the usual behaviour of sorting the keys.
<add> """
<add> def represent_decimal(self, data):
<add> return self.represent_scalar('tag:yaml.org,2002:str', str(data))
<add>
<add> def represent_mapping(self, tag, mapping, flow_style=None):
<add> value = []
<add> node = yaml.MappingNode(tag, value, flow_style=flow_style)
<add> if self.alias_key is not None:
<add> self.represented_objects[self.alias_key] = node
<add> best_style = True
<add> if hasattr(mapping, 'items'):
<add> mapping = list(mapping.items())
<add> if not isinstance(mapping, SortedDict):
<add> mapping.sort()
<add> for item_key, item_value in mapping:
<add> node_key = self.represent_data(item_key)
<add> node_value = self.represent_data(item_value)
<add> if not (isinstance(node_key, yaml.ScalarNode) and not node_key.style):
<add> best_style = False
<add> if not (isinstance(node_value, yaml.ScalarNode) and not node_value.style):
<add> best_style = False
<add> value.append((node_key, node_value))
<add> if flow_style is None:
<add> if self.default_flow_style is not None:
<add> node.flow_style = self.default_flow_style
<add> else:
<add> node.flow_style = best_style
<add> return node
<add>
<add> SafeDumper.add_representer(SortedDict,
<add> yaml.representer.SafeRepresenter.represent_dict)
<add> SafeDumper.add_representer(DictWithMetadata,
<add> yaml.representer.SafeRepresenter.represent_dict)
<add> SafeDumper.add_representer(SortedDictWithMetadata,
<add> yaml.representer.SafeRepresenter.represent_dict)
<add> SafeDumper.add_representer(types.GeneratorType,
<add> yaml.representer.SafeRepresenter.represent_list) | 2 |
Text | Text | update all reddit.com api request links | c8567dc8bc352087e5e04da25e5eaf21be6a4653 | <ide><path>docs/advanced/AsyncActions.md
<ide> function receivePosts(subreddit, json) {
<ide> function fetchPosts(subreddit) {
<ide> return dispatch => {
<ide> dispatch(requestPosts(subreddit))
<del> return fetch(`http://www.reddit.com/r/${subreddit}.json`)
<add> return fetch(`https://www.reddit.com/r/${subreddit}.json`)
<ide> .then(response => response.json())
<ide> .then(json => dispatch(receivePosts(subreddit, json)))
<ide> }
<ide><path>docs/advanced/ExampleRedditAPI.md
<ide> function receivePosts(subreddit, json) {
<ide> function fetchPosts(subreddit) {
<ide> return dispatch => {
<ide> dispatch(requestPosts(subreddit))
<del> return fetch(`http://www.reddit.com/r/${subreddit}.json`)
<add> return fetch(`https://www.reddit.com/r/${subreddit}.json`)
<ide> .then(response => response.json())
<ide> .then(json => dispatch(receivePosts(subreddit, json)))
<ide> } | 2 |
Javascript | Javascript | imitate public interface | 4cc1afbb68c9e48c3391910c73f9d4ff29fff4d4 | <ide><path>src/tree-sitter-grammar.js
<ide> module.exports = class TreeSitterGrammar {
<ide> }
<ide> }
<ide> }
<add>
<add> /*
<add> Section - Backward compatibility shims
<add> */
<add>
<add> onDidUpdate(callback) {
<add> // do nothing
<add> }
<add>
<add> tokenizeLines(text, compatibilityMode = true) {
<add> return text
<add> .split('\n')
<add> .map(line => this.tokenizeLine(line, null, false));
<add> }
<add>
<add> tokenizeLine(line, ruleStack, firstLine) {
<add> return {
<add> value: line,
<add> scopes: [this.scopeName]
<add> };
<add> }
<ide> };
<ide>
<ide> const preprocessScopes = value => | 1 |
PHP | PHP | fix coding standards in event/ | 15e6e9d9817fa016e6cef4947c52b4fa9b64f7b6 | <ide><path>lib/Cake/Event/CakeEvent.php
<ide> public function name() {
<ide> return $this->_name;
<ide> }
<ide>
<del>
<ide> /**
<ide> * Returns the subject of this event
<ide> *
<ide> public function isStopped() {
<ide> return $this->_stopped;
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>lib/Cake/Event/CakeEventListener.php
<ide> interface CakeEventListener {
<ide> * that should be called in the object when the respective event is fired
<ide> */
<ide> public function implementedEvents();
<del>}
<ide>\ No newline at end of file
<add>
<add>}
<ide><path>lib/Cake/Event/CakeEventManager.php
<ide> class CakeEventManager {
<ide> */
<ide> protected $_isGlobal = false;
<ide>
<del>
<ide> /**
<ide> * Returns the globally available instance of a CakeEventManager
<ide> * this is used for dispatching events attached from outside the scope
<ide> public static function instance($manager = null) {
<ide> * when the listener is called. If $called is an instance of CakeEventListener, this parameter will be ignored
<ide> *
<ide> * @return void
<add> * @throws InvalidArgumentException When event key is missing or callable is not an
<add> * instance of CakeEventListener.
<ide> */
<ide> public function attach($callable, $eventKey = null, $options = array()) {
<ide> if (!$eventKey && !($callable instanceof CakeEventListener)) { | 3 |
PHP | PHP | remove setmeta function | 0143f32d5eacfe0b985588502fd94849289d8298 | <ide><path>src/Illuminate/Queue/Queue.php
<ide> protected function createPlainPayload($job, $data)
<ide> return ['job' => $job, 'data' => $data];
<ide> }
<ide>
<del> /**
<del> * Set additional meta on a payload string.
<del> *
<del> * @param string $payload
<del> * @param string $key
<del> * @param string $value
<del> * @return string
<del> *
<del> * @throws \Illuminate\Queue\InvalidPayloadException
<del> */
<del> // protected function setMeta($payload, $key, $value)
<del> // {
<del> // $payload = json_decode($payload, true);
<del>
<del> // $payload = json_encode(Arr::set($payload, $key, $value));
<del>
<del> // if (JSON_ERROR_NONE !== json_last_error()) {
<del> // throw new InvalidPayloadException;
<del> // }
<del>
<del> // return $payload;
<del> // }
<del>
<ide> /**
<ide> * Set the IoC container instance.
<ide> * | 1 |
Mixed | Ruby | fix to_param to maximize content | 3b49d792231f8051a82cee37c46ac5b23de844db | <ide><path>activerecord/CHANGELOG.md
<add>* Fix the generated `#to_param` method to use `omission:''` so that
<add> the resulting output is actually up to 20 characters, not
<add> effectively 17 to leave room for the default "...".
<add> Also call `#parameterize` before `#truncate` and make the
<add> `separator: /-/` to maximize the information included in the
<add> output.
<add>
<add> Fixes #23635
<add>
<add> *Rob Biedenharn*
<add>
<ide> * Ensure concurrent invocations of the connection reaper cannot allocate the
<ide> same connection to two threads.
<ide>
<ide><path>activerecord/lib/active_record/integration.rb
<ide> module ClassMethods
<ide> #
<ide> # user = User.find_by(name: 'David Heinemeier Hansson')
<ide> # user.id # => 125
<del> # user_path(user) # => "/users/125-david"
<add> # user_path(user) # => "/users/125-david-heinemeier"
<ide> #
<ide> # Because the generated param begins with the record's +id+, it is
<ide> # suitable for passing to +find+. In a controller, for example:
<ide> def to_param(method_name = nil)
<ide> define_method :to_param do
<ide> if (default = super()) &&
<ide> (result = send(method_name).to_s).present? &&
<del> (param = result.squish.truncate(20, separator: /\s/, omission: nil).parameterize).present?
<add> (param = result.squish.parameterize.truncate(20, separator: /-/, omission: '')).present?
<ide> "#{default}-#{param}"
<ide> else
<ide> default
<ide><path>activerecord/test/cases/integration_test.rb
<ide> def test_to_param_class_method
<ide> assert_equal '4-flamboyant-software', firm.to_param
<ide> end
<ide>
<add> def test_to_param_class_method_truncates_words_properly
<add> firm = Firm.find(4)
<add> firm.name << ', Inc.'
<add> assert_equal '4-flamboyant-software', firm.to_param
<add> end
<add>
<add> def test_to_param_class_method_truncates_after_parameterize
<add> firm = Firm.find(4)
<add> firm.name = "Huey, Dewey, & Louie LLC"
<add> # 123456789T123456789v
<add> assert_equal '4-huey-dewey-louie-llc', firm.to_param
<add> end
<add>
<add> def test_to_param_class_method_truncates_after_parameterize_with_hyphens
<add> firm = Firm.find(4)
<add> firm.name = "Door-to-Door Wash-n-Fold Service"
<add> # 123456789T123456789v
<add> assert_equal '4-door-to-door-wash-n', firm.to_param
<add> end
<add>
<ide> def test_to_param_class_method_truncates
<ide> firm = Firm.find(4)
<ide> firm.name = 'a ' * 100
<del> assert_equal '4-a-a-a-a-a-a-a-a-a', firm.to_param
<add> assert_equal '4-a-a-a-a-a-a-a-a-a-a', firm.to_param
<ide> end
<ide>
<ide> def test_to_param_class_method_truncates_edge_case
<ide> def test_to_param_class_method_truncates_edge_case
<ide> assert_equal '4-david', firm.to_param
<ide> end
<ide>
<add> def test_to_param_class_method_truncates_case_shown_in_doc
<add> firm = Firm.find(4)
<add> firm.name = 'David Heinemeier Hansson'
<add> assert_equal '4-david-heinemeier', firm.to_param
<add> end
<add>
<ide> def test_to_param_class_method_squishes
<ide> firm = Firm.find(4)
<ide> firm.name = "ab \n" * 100
<del> assert_equal '4-ab-ab-ab-ab-ab-ab', firm.to_param
<add> assert_equal '4-ab-ab-ab-ab-ab-ab-ab', firm.to_param
<ide> end
<ide>
<ide> def test_to_param_class_method_multibyte_character | 3 |
Text | Text | add guide to releasing rwd for an i18n client | efa788ab26eeba30b013b499298cc4be3f0c51f6 | <ide><path>docs/how-to-test-translations-locally.md
<ide> CLIENT_LOCALE="dothraki"
<ide> CURRICULUM_LOCALE="dothraki"
<ide> ```
<ide>
<add>### Releasing a Superblock
<add>
<add>After a superblock has been fully translated into a language, there are two steps to release it. First add the superblock enum to that language's `auditedCerts` array. So, if you want to release the new Responsive Web Design superblock for Dothraki, the array should look like this:
<add>
<add>```ts
<add>export const auditedCerts = {
<add> // other languages
<add> dothraki: [
<add> SuperBlocks.RespWebDesignNew, // the newly translated superblock
<add> SuperBlocks.RespWebDesign,
<add> SuperBlocks.JsAlgoDataStruct,
<add> SuperBlocks.FrontEndDevLibs
<add> ]
<add>```
<add>
<add>Finally, the `languagesWithAuditedBetaReleases` array should be updated to include the new language like this:
<add>
<add>```ts
<add>export const languagesWithAuditedBetaReleases: ['english', 'dothraki'];
<add>```
<add>
<add>This will move the new superblock to the correct place in the curriculum map on `/learn`.
<add>
<ide> ## Enabling Localized Videos
<ide>
<ide> For the video challenges, you need to change a few things. First add the new locale to the GraphQL query in the `client/src/templates/Challenges/video/Show.tsx` file. For example, adding Dothraki to the query: | 1 |
PHP | PHP | fix possible errors on docblocks | 29923153f049bd1006953a74388511eda729318d | <ide><path>src/Illuminate/Contracts/Cookie/QueueingFactory.php
<ide> interface QueueingFactory extends Factory
<ide> /**
<ide> * Queue a cookie to send with the next response.
<ide> *
<del> * @param mixed
<ide> * @return void
<ide> */
<ide> public function queue();
<ide><path>src/Illuminate/Contracts/Foundation/Application.php
<ide> public function basePath();
<ide> /**
<ide> * Get or check the current application environment.
<ide> *
<del> * @param mixed
<ide> * @return string
<ide> */
<ide> public function environment();
<ide><path>src/Illuminate/Cookie/CookieJar.php
<ide> public function queued($key, $default = null)
<ide> /**
<ide> * Queue a cookie to send with the next response.
<ide> *
<del> * @param mixed
<ide> * @return void
<ide> */
<ide> public function queue()
<ide><path>src/Illuminate/Database/Eloquent/Builder.php
<ide> public function chunk($count, callable $callback)
<ide> *
<ide> * @param int $count
<ide> * @param callable $callback
<del> * @param string $alias
<add> * @param string $column
<ide> * @return bool
<ide> */
<ide> public function chunkById($count, callable $callback, $column = 'id')
<ide><path>src/Illuminate/Foundation/Application.php
<ide> public function environmentFilePath()
<ide> /**
<ide> * Get or check the current application environment.
<ide> *
<del> * @param mixed
<ide> * @return string|bool
<ide> */
<ide> public function environment()
<ide><path>src/Illuminate/Http/RedirectResponse.php
<ide> protected function removeFilesFromInput(array $input)
<ide> /**
<ide> * Flash an array of input to the session.
<ide> *
<del> * @param mixed string
<ide> * @return $this
<ide> */
<ide> public function onlyInput()
<ide> public function onlyInput()
<ide> /**
<ide> * Flash an array of input to the session.
<ide> *
<del> * @param mixed string
<ide> * @return \Illuminate\Http\RedirectResponse
<ide> */
<ide> public function exceptInput()
<ide><path>src/Illuminate/Http/Request.php
<ide> public function segments()
<ide> /**
<ide> * Determine if the current request URI matches a pattern.
<ide> *
<del> * @param mixed string
<ide> * @return bool
<ide> */
<ide> public function is()
<ide> public function is()
<ide> /**
<ide> * Determine if the current request URL and query string matches a pattern.
<ide> *
<del> * @param mixed string
<ide> * @return bool
<ide> */
<ide> public function fullUrlIs()
<ide><path>src/Illuminate/Queue/Worker.php
<ide> protected function getNextJob($connection, $queue)
<ide> /**
<ide> * Process a given job from the queue.
<ide> *
<del> * @param string $connection
<add> * @param string $connectionName
<ide> * @param \Illuminate\Contracts\Queue\Job $job
<ide> * @param \Illuminate\Queue\WorkerOptions $options
<ide> * @return void
<ide><path>src/Illuminate/Routing/Router.php
<ide> public function currentRouteName()
<ide> /**
<ide> * Alias for the "currentRouteNamed" method.
<ide> *
<del> * @param mixed string
<ide> * @return bool
<ide> */
<ide> public function is()
<ide> public function currentRouteAction()
<ide> /**
<ide> * Alias for the "currentRouteUses" method.
<ide> *
<del> * @param mixed string
<ide> * @return bool
<ide> */
<ide> public function uses()
<ide><path>src/Illuminate/Support/Facades/Facade.php
<ide> public static function spy()
<ide> /**
<ide> * Initiate a mock expectation on the facade.
<ide> *
<del> * @param mixed
<ide> * @return \Mockery\Expectation
<ide> */
<ide> public static function shouldReceive() | 10 |
Javascript | Javascript | increase stats action install timeout | f21cba4929d582ad164d7a7476c4205c5d091e5c | <ide><path>.github/actions/next-stats-action/src/index.js
<ide> if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
<ide> logger(`Running initial build for ${dir}`)
<ide> if (!actionInfo.skipClone) {
<ide> let buildCommand = `cd ${dir}${
<del> !statsConfig.skipInitialInstall ? ' && yarn install' : ''
<add> !statsConfig.skipInitialInstall
<add> ? ' && yarn install --network-timeout 1000000'
<add> : ''
<ide> }`
<ide>
<ide> if (statsConfig.initialBuildCommand) { | 1 |
Python | Python | use a simpler invocation of cython | df32fcdd4d225baa1628de35b718ed059fc1902b | <ide><path>tools/cythonize.py
<ide> def process_pyx(fromfile, tofile):
<ide> except OSError:
<ide> # There are ways of installing Cython that don't result in a cython
<ide> # executable on the path, see scipy/scipy#2397.
<del> r = subprocess.call([sys.executable, '-c',
<del> 'import sys; from Cython.Compiler.Main import '
<del> 'setuptools_main as main; sys.exit(main())'] + flags +
<del> ["-o", tofile, fromfile])
<add> r = subprocess.call([sys.executable, '-m', 'cython'] + flags +
<add> ["-o", tofile, fromfile])
<ide> if r != 0:
<ide> raise Exception('Cython failed')
<ide> except OSError: | 1 |
Python | Python | fix capitalization on morphological features | ec44bee32102187e44ff5ce649ea8bf357bd1442 | <ide><path>spacy/en/language_data.py
<ide>
<ide>
<ide> TAG_MAP = {
<del> ".": {POS: PUNCT, "puncttype": "peri"},
<del> ",": {POS: PUNCT, "puncttype": "comm"},
<del> "-LRB-": {POS: PUNCT, "puncttype": "brck", "punctside": "ini"},
<del> "-RRB-": {POS: PUNCT, "puncttype": "brck", "punctside": "fin"},
<del> "``": {POS: PUNCT, "puncttype": "quot", "punctside": "ini"},
<del> "\"\"": {POS: PUNCT, "puncttype": "quot", "punctside": "fin"},
<del> "''": {POS: PUNCT, "puncttype": "quot", "punctside": "fin"},
<add> ".": {POS: PUNCT, "PunctType": "peri"},
<add> ",": {POS: PUNCT, "PunctType": "comm"},
<add> "-LRB-": {POS: PUNCT, "PunctType": "brck", "PunctSide": "ini"},
<add> "-RRB-": {POS: PUNCT, "PunctType": "brck", "PunctSide": "fin"},
<add> "``": {POS: PUNCT, "PunctType": "quot", "PunctSide": "ini"},
<add> "\"\"": {POS: PUNCT, "PunctType": "quot", "PunctSide": "fin"},
<add> "''": {POS: PUNCT, "PunctType": "quot", "PunctSide": "fin"},
<ide> ":": {POS: PUNCT},
<del> "$": {POS: SYM, "other": {"symtype": "currency"}},
<del> "#": {POS: SYM, "other": {"symtype": "numbersign"}},
<del> "AFX": {POS: ADJ, "hyph": "hyph"},
<del> "CC": {POS: CONJ, "conjtype": "coor"},
<del> "CD": {POS: NUM, "numtype": "card"},
<add> "$": {POS: SYM, "Other": {"SymType": "currency"}},
<add> "#": {POS: SYM, "Other": {"SymType": "numbersign"}},
<add> "AFX": {POS: ADJ, "Hyph": "yes"},
<add> "CC": {POS: CONJ, "ConjType": "coor"},
<add> "CD": {POS: NUM, "NumType": "card"},
<ide> "DT": {POS: DET},
<del> "EX": {POS: ADV, "advtype": "ex"},
<del> "FW": {POS: X, "foreign": "foreign"},
<del> "HYPH": {POS: PUNCT, "puncttype": "dash"},
<add> "EX": {POS: ADV, "AdvType": "ex"},
<add> "FW": {POS: X, "Foreign": "yes"},
<add> "HYPH": {POS: PUNCT, "PunctType": "dash"},
<ide> "IN": {POS: ADP},
<del> "JJ": {POS: ADJ, "degree": "pos"},
<del> "JJR": {POS: ADJ, "degree": "comp"},
<del> "JJS": {POS: ADJ, "degree": "sup"},
<del> "LS": {POS: PUNCT, "numtype": "ord"},
<del> "MD": {POS: VERB, "verbtype": "mod"},
<add> "JJ": {POS: ADJ, "Degree": "pos"},
<add> "JJR": {POS: ADJ, "Degree": "comp"},
<add> "JJS": {POS: ADJ, "Degree": "sup"},
<add> "LS": {POS: PUNCT, "NumType": "ord"},
<add> "MD": {POS: VERB, "VerbType": "mod"},
<ide> "NIL": {POS: ""},
<del> "NN": {POS: NOUN, "number": "sing"},
<del> "NNP": {POS: PROPN, "nountype": "prop", "number": "sing"},
<del> "NNPS": {POS: PROPN, "nountype": "prop", "number": "plur"},
<del> "NNS": {POS: NOUN, "number": "plur"},
<del> "PDT": {POS: ADJ, "adjtype": "pdt", "prontype": "prn"},
<del> "POS": {POS: PART, "poss": "poss"},
<del> "PRP": {POS: PRON, "prontype": "prs"},
<del> "PRP$": {POS: ADJ, "prontype": "prs", "poss": "poss"},
<del> "RB": {POS: ADV, "degree": "pos"},
<del> "RBR": {POS: ADV, "degree": "comp"},
<del> "RBS": {POS: ADV, "degree": "sup"},
<add> "NN": {POS: NOUN, "Number": "sing"},
<add> "NNP": {POS: PROPN, "NounType": "prop", "Number": "sing"},
<add> "NNPS": {POS: PROPN, "NounType": "prop", "Number": "plur"},
<add> "NNS": {POS: NOUN, "Number": "plur"},
<add> "PDT": {POS: ADJ, "AdjType": "pdt", "PronType": "prn"},
<add> "POS": {POS: PART, "Poss": "yes"},
<add> "PRP": {POS: PRON, "PronType": "prs"},
<add> "PRP$": {POS: ADJ, "PronType": "prs", "Poss": "yes"},
<add> "RB": {POS: ADV, "Degree": "pos"},
<add> "RBR": {POS: ADV, "Degree": "comp"},
<add> "RBS": {POS: ADV, "Degree": "sup"},
<ide> "RP": {POS: PART},
<ide> "SYM": {POS: SYM},
<del> "TO": {POS: PART, "parttype": "inf", "verbform": "inf"},
<add> "TO": {POS: PART, "PartType": "inf", "VerbForm": "inf"},
<ide> "UH": {POS: INTJ},
<del> "VB": {POS: VERB, "verbform": "inf"},
<del> "VBD": {POS: VERB, "verbform": "fin", "tense": "past"},
<del> "VBG": {POS: VERB, "verbform": "part", "tense": "pres", "aspect": "prog"},
<del> "VBN": {POS: VERB, "verbform": "part", "tense": "past", "aspect": "perf"},
<del> "VBP": {POS: VERB, "verbform": "fin", "tense": "pres"},
<del> "VBZ": {POS: VERB, "verbform": "fin", "tense": "pres", "number": "sing", "person": 3},
<del> "WDT": {POS: ADJ, "prontype": "int|rel"},
<del> "WP": {POS: NOUN, "prontype": "int|rel"},
<del> "WP$": {POS: ADJ, "poss": "poss", "prontype": "int|rel"},
<del> "WRB": {POS: ADV, "prontype": "int|rel"},
<add> "VB": {POS: VERB, "VerbForm": "inf"},
<add> "VBD": {POS: VERB, "VerbForm": "fin", "Tense": "past"},
<add> "VBG": {POS: VERB, "VerbForm": "part", "Tense": "pres", "Aspect": "prog"},
<add> "VBN": {POS: VERB, "VerbForm": "part", "Tense": "past", "Aspect": "perf"},
<add> "VBP": {POS: VERB, "VerbForm": "fin", "Tense": "pres"},
<add> "VBZ": {POS: VERB, "VerbForm": "fin", "Tense": "pres", "Number": "sing", "Person": 3},
<add> "WDT": {POS: ADJ, "PronType": "int|rel"},
<add> "WP": {POS: NOUN, "PronType": "int|rel"},
<add> "WP$": {POS: ADJ, "Poss": "yes", "PronType": "int|rel"},
<add> "WRB": {POS: ADV, "PronType": "int|rel"},
<ide> "SP": {POS: SPACE},
<ide> "ADD": {POS: X},
<ide> "NFP": {POS: PUNCT}, | 1 |
Javascript | Javascript | update console messages regarding devtools | a4bd998edcc2f161610955f7c677a60f4347ac32 | <ide><path>src/renderers/dom/ReactDOM.js
<ide> if (__DEV__) {
<ide> var ExecutionEnvironment = require('ExecutionEnvironment');
<ide> if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
<ide>
<del> // If we're in Chrome, look for the devtools marker and provide a download
<del> // link if not installed.
<del> if (navigator.userAgent.indexOf('Chrome') > -1) {
<del> if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
<add> // First check if devtools is not installed
<add> if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
<add> // If we're in Chrome or Firefox, provide a download link if not installed.
<add> if ((navigator.userAgent.indexOf('Chrome') > -1 &&
<add> navigator.userAgent.indexOf('Edge') === -1) ||
<add> navigator.userAgent.indexOf('Firefox') > -1) {
<ide> console.debug(
<ide> 'Download the React DevTools for a better development experience: ' +
<ide> 'https://fb.me/react-devtools' | 1 |
PHP | PHP | reduce calls to config() | e3fa02b6d20cd6c1603e022f22e73955e16c4590 | <ide><path>src/Controller/Component/AuthComponent.php
<ide> public function startup(Event $event) {
<ide> return $this->_unauthenticated($controller);
<ide> }
<ide>
<del> $authorize = $this->config('authorize');
<ide> if ($this->_isLoginAction($controller) ||
<del> empty($authorize) ||
<add> empty($this->_config['authorize']) ||
<ide> $this->isAuthorized($this->user())
<ide> ) {
<ide> return true;
<ide> protected function _unauthenticated(Controller $controller) {
<ide> }
<ide>
<ide> if (!$controller->request->is('ajax')) {
<del> $this->flash($this->config('authError'));
<add> $this->flash($this->_config['authError']);
<ide> $this->Session->write('Auth.redirect', $controller->request->here(false));
<del> $controller->redirect($this->config('loginAction'));
<add> $controller->redirect($this->_config['loginAction']);
<ide> return false;
<ide> }
<ide>
<del> $ajaxLogin = $this->config('ajaxLogin');
<del> if (!empty($ajaxLogin)) {
<add> if (!empty($this->_config['ajaxLogin'])) {
<ide> $controller->response->statusCode(403);
<ide> $controller->viewPath = 'Element';
<del> echo $controller->render($ajaxLogin, $this->RequestHandler->ajaxLayout);
<add> echo $controller->render($this->_config['ajaxLogin'], $this->RequestHandler->ajaxLayout);
<ide> $this->_stop();
<ide> return false;
<ide> }
<ide> protected function _isLoginAction(Controller $controller) {
<ide> $url = $controller->request->url;
<ide> }
<ide> $url = Router::normalize($url);
<del> $loginAction = Router::normalize($this->config('loginAction'));
<add> $loginAction = Router::normalize($this->_config['loginAction']);
<ide>
<ide> return $loginAction === $url;
<ide> }
<ide> protected function _isLoginAction(Controller $controller) {
<ide> * @throws \Cake\Error\ForbiddenException
<ide> */
<ide> protected function _unauthorized(Controller $controller) {
<del> $unauthorizedRedirect = $this->config('unauthorizedRedirect');
<del> if ($unauthorizedRedirect === false) {
<del> throw new Error\ForbiddenException($this->config('authError'));
<add> if ($this->_config['unauthorizedRedirect'] === false) {
<add> throw new Error\ForbiddenException($this->_config['authError']);
<ide> }
<ide>
<del> $this->flash($this->config('authError'));
<del> if ($unauthorizedRedirect === true) {
<add> $this->flash($this->_config['authError']);
<add> if ($this->_config['unauthorizedRedirect'] === true) {
<ide> $default = '/';
<del> $loginRedirect = $this->config('loginRedirect');
<del> if (!empty($loginRedirect)) {
<del> $default = $loginRedirect;
<add> if (!empty($this->_config['loginRedirect'])) {
<add> $default = $this->_config['loginRedirect'];
<ide> }
<ide> $url = $controller->referer($default, true);
<ide> } else {
<del> $url = $unauthorizedRedirect;
<add> $url = $this->_config['unauthorizedRedirect'];
<ide> }
<ide> $controller->redirect($url, null, true);
<ide> return false;
<ide> protected function _setDefaults() {
<ide> 'action' => 'login',
<ide> 'plugin' => null
<ide> ],
<del> 'logoutRedirect' => $this->config('loginAction'),
<add> 'logoutRedirect' => $this->_config['loginAction'],
<ide> 'authError' => __d('cake', 'You are not authorized to access that location.')
<ide> ];
<ide>
<ide> public function isAuthorized($user = null, Request $request = null) {
<ide> * @throws \Cake\Error\Exception
<ide> */
<ide> public function constructAuthorize() {
<del> $authorize = $this->config('authorize');
<del> if (empty($authorize)) {
<add> if (empty($this->_config['authorize'])) {
<ide> return;
<ide> }
<ide> $this->_authorizeObjects = array();
<del> $authorize = Hash::normalize((array)$authorize);
<add> $authorize = Hash::normalize((array)$this->_config['authorize']);
<ide> $global = array();
<ide> if (isset($authorize[AuthComponent::ALL])) {
<ide> $global = $authorize[AuthComponent::ALL];
<ide> public function logout() {
<ide> $this->Session->delete(static::$sessionKey);
<ide> $this->Session->delete('Auth.redirect');
<ide> $this->Session->renew();
<del> return Router::normalize($this->config('logoutRedirect'));
<add> return Router::normalize($this->_config['logoutRedirect']);
<ide> }
<ide>
<ide> /**
<ide> public function redirectUrl($url = null) {
<ide> $redir = $this->Session->read('Auth.redirect');
<ide> $this->Session->delete('Auth.redirect');
<ide>
<del> if (Router::normalize($redir) == Router::normalize($this->config('loginAction'))) {
<del> $redir = $this->config('loginRedirect');
<add> if (Router::normalize($redir) == Router::normalize($this->_config['loginAction'])) {
<add> $redir = $this->_config['loginRedirect'];
<ide> }
<del> } elseif ($this->config('loginRedirect')) {
<del> $redir = $this->config('loginRedirect');
<add> } elseif ($this->_config['loginRedirect']) {
<add> $redir = $this->_config['loginRedirect'];
<ide> } else {
<ide> $redir = '/';
<ide> }
<ide> public function identify(Request $request, Response $response) {
<ide> * @throws \Cake\Error\Exception
<ide> */
<ide> public function constructAuthenticate() {
<del> $authenticate = $this->config('authenticate');
<del> if (empty($authenticate)) {
<add> if (empty($this->_config['authenticate'])) {
<ide> return;
<ide> }
<ide> $this->_authenticateObjects = array();
<del> $authenticate = Hash::normalize((array)$authenticate);
<add> $authenticate = Hash::normalize((array)$this->_config['authenticate']);
<ide> $global = array();
<ide> if (isset($authenticate[AuthComponent::ALL])) {
<ide> $global = $authenticate[AuthComponent::ALL];
<ide> public function flash($message) {
<ide> if ($message === false) {
<ide> return;
<ide> }
<del> $flashConfig = $this->config('flash');
<add> $flashConfig = $this->_config['flash'];
<ide> $this->Session->setFlash(
<ide> $message,
<ide> $flashConfig['element'],
<ide><path>src/Controller/Component/CookieComponent.php
<ide> class CookieComponent extends Component {
<ide> public function __construct(ComponentRegistry $collection, $config = array()) {
<ide> parent::__construct($collection, $config);
<ide>
<del> if ($this->config('key')) {
<add> if (!$this->_config['key']) {
<ide> $this->config('key', Configure::read('Security.salt'));
<ide> }
<ide>
<del> if ($this->config('time')) {
<del> $this->_expire($this->config('time'));
<add> if ($this->_config['time']) {
<add> $this->_expire($this->_config['time']);
<ide> }
<ide>
<ide> $controller = $collection->getController();
<ide> public function __construct(ComponentRegistry $collection, $config = array()) {
<ide> * @return void
<ide> */
<ide> public function startup(Event $event) {
<del> $this->_expire($this->config('time'));
<add> $this->_expire($this->_config['time']);
<ide>
<del> $this->_values[$this->config('name')] = array();
<add> $this->_values[$this->_config['name']] = array();
<ide> }
<ide>
<ide> /**
<ide> public function write($key, $value = null, $encrypt = true, $expires = null) {
<ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::read
<ide> */
<ide> public function read($key = null) {
<del> $name = $this->config('name');
<del> $values = $this->_request->cookie($name);
<del> if (empty($this->_values[$name]) && $values) {
<del> $this->_values[$name] = $this->_decrypt($values);
<add> $cookieName = $this->config('name');
<add> $values = $this->_request->cookie($cookieName);
<add> if (empty($this->_values[$cookieName]) && $values) {
<add> $this->_values[$cookieName] = $this->_decrypt($values);
<ide> }
<del> if (empty($this->_values[$name])) {
<del> $this->_values[$name] = array();
<add> if (empty($this->_values[$cookieName])) {
<add> $this->_values[$cookieName] = array();
<ide> }
<ide> if ($key === null) {
<del> return $this->_values[$name];
<add> return $this->_values[$cookieName];
<ide> }
<ide>
<ide> if (strpos($key, '.') !== false) {
<ide> $names = explode('.', $key, 2);
<ide> $key = $names[0];
<ide> }
<del> if (!isset($this->_values[$name][$key])) {
<add> if (!isset($this->_values[$cookieName][$key])) {
<ide> return null;
<ide> }
<ide>
<ide> if (!empty($names[1])) {
<del> return Hash::get($this->_values[$name][$key], $names[1]);
<add> return Hash::get($this->_values[$cookieName][$key], $names[1]);
<ide> }
<del> return $this->_values[$name][$key];
<add> return $this->_values[$cookieName][$key];
<ide> }
<ide>
<ide> /**
<ide> public function check($key = null) {
<ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::delete
<ide> */
<ide> public function delete($key) {
<del> $name = $this->config('name');
<del> if (empty($this->_values[$name])) {
<add> $cookieName = $this->config('name');
<add> if (empty($this->_values[$cookieName])) {
<ide> $this->read();
<ide> }
<ide> if (strpos($key, '.') === false) {
<del> if (isset($this->_values[$name][$key]) && is_array($this->_values[$name][$key])) {
<del> foreach ($this->_values[$name][$key] as $idx => $val) {
<add> if (isset($this->_values[$cookieName][$key]) && is_array($this->_values[$cookieName][$key])) {
<add> foreach ($this->_values[$cookieName][$key] as $idx => $val) {
<ide> $this->_delete("[$key][$idx]");
<ide> }
<ide> }
<ide> $this->_delete("[$key]");
<del> unset($this->_values[$name][$key]);
<add> unset($this->_values[$cookieName][$key]);
<ide> return;
<ide> }
<ide> $names = explode('.', $key, 2);
<del> if (isset($this->_values[$name][$names[0]])) {
<del> $this->_values[$name][$names[0]] = Hash::remove($this->_values[$name][$names[0]], $names[1]);
<add> if (isset($this->_values[$cookieName][$names[0]])) {
<add> $this->_values[$cookieName][$names[0]] = Hash::remove($this->_values[$cookieName][$names[0]], $names[1]);
<ide> }
<ide> $this->_delete('[' . implode('][', $names) . ']');
<ide> }
<ide> protected function _encrypt($value) {
<ide> }
<ide> $prefix = "Q2FrZQ==.";
<ide> if ($this->_type === 'rijndael') {
<del> $cipher = Security::rijndael($value, $this->config('key'), 'encrypt');
<add> $cipher = Security::rijndael($value, $this->_config['key'], 'encrypt');
<ide> }
<ide> if ($this->_type === 'aes') {
<del> $cipher = Security::encrypt($value, $this->config('key'));
<add> $cipher = Security::encrypt($value, $this->_config['key']);
<ide> }
<ide> return $prefix . base64_encode($cipher);
<ide> }
<ide> protected function _decode($value) {
<ide> }
<ide> $value = base64_decode(substr($value, strlen($prefix)));
<ide> if ($this->_type === 'rijndael') {
<del> $plain = Security::rijndael($value, $this->config('key'), 'decrypt');
<add> $plain = Security::rijndael($value, $this->_config['key'], 'decrypt');
<ide> }
<ide> if ($this->_type === 'aes') {
<del> $plain = Security::decrypt($value, $this->config('key'));
<add> $plain = Security::decrypt($value, $this->_config['key']);
<ide> }
<ide> return $this->_explode($plain);
<ide> } | 2 |
Text | Text | correct a typo in pairwise.english.md | 0a330e65f902dcbf750d0f0666c737dd9335f76d | <ide><path>curriculum/challenges/english/08-coding-interview-prep/algorithms/pairwise.english.md
<ide> challengeType: 5
<ide> ## Description
<ide> <section id='description'>
<ide> Given an array <code>arr</code>, find element pairs whose sum equal the second argument <code>arg</code> and return the sum of their indices.
<del>You may use multiple pairs that have the same numeric elements but different indices. Each pair should use the lowest possible available indices. Once an element has been used it cannot be reused to pair with another element. For instance, <code>pairwise([1, 1, 2], 3)</code> creates a pair <code>[2, 1]</code> using the 1 at indice 0 rather than the 1 at indice 1, because 0+2 < 1+2.
<add>You may use multiple pairs that have the same numeric elements but different indices. Each pair should use the lowest possible available indices. Once an element has been used it cannot be reused to pair with another element. For instance, <code>pairwise([1, 1, 2], 3)</code> creates a pair <code>[2, 1]</code> using the 1 at index 0 rather than the 1 at index 1, because 0+2 < 1+2.
<ide> For example <code>pairwise([7, 9, 11, 13, 15], 20)</code> returns <code>6</code>. The pairs that sum to 20 are <code>[7, 13]</code> and <code>[9, 11]</code>. We can then write out the array with their indices and values.
<ide> <table class="table"><tr><th><strong>Index</strong></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th></tr><tr><td>Value</td><td>7</td><td>9</td><td>11</td><td>13</td><td>15</td></tr></table>
<ide> Below we'll take their corresponding indices and add them. | 1 |
PHP | PHP | try lc_all instead | 6a1e9e80b2ece33a86a9607ba70b17a140993dac | <ide><path>lib/Cake/Test/Case/Utility/CakeNumberTest.php
<ide> public function testToReadableSize() {
<ide> * @return void
<ide> */
<ide> public function testReadableSizeLocalized() {
<del> $restore = setlocale(LC_NUMERIC, 0);
<del> setlocale(LC_NUMERIC, 'de_DE');
<add> $restore = setlocale(LC_ALL, 0);
<add> setlocale(LC_ALL, 'de_DE');
<ide> $result = $this->Number->toReadableSize(1321205);
<ide> $this->assertEquals('1,26 MB', $result);
<ide>
<ide> $result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
<ide> $this->assertEquals('512,00 GB', $result);
<del> setlocale(LC_NUMERIC, $restore);
<add> setlocale(LC_ALL, $restore);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | make copy of options arg | 68f63fe9ec2b8a7308cefa4a1ae1261cd6d1675f | <ide><path>lib/child_process.js
<ide> exports.fork = function(modulePath /*, args, options*/) {
<ide> var options, args, execArgv;
<ide> if (Array.isArray(arguments[1])) {
<ide> args = arguments[1];
<del> options = arguments[2] || {};
<add> options = util._extend({}, arguments[2]);
<ide> } else {
<ide> args = [];
<del> options = arguments[1] || {};
<add> options = util._extend({}, arguments[1]);
<ide> }
<ide>
<ide> // Prepare arguments for fork:
<ide> exports.execFile = function(file /* args, options, callback */) {
<ide>
<ide> if (Array.isArray(arguments[1])) {
<ide> args = arguments[1];
<del> if (typeof arguments[2] === 'object') optionArg = arguments[2];
<add> options = util._extend(options, arguments[2]);
<ide> } else {
<ide> args = [];
<del> if (typeof arguments[1] === 'object') optionArg = arguments[1];
<add> options = util._extend(options, arguments[1]);
<ide> }
<ide>
<del> // Merge optionArg into options
<del> util._extend(options, optionArg);
<del>
<ide> var child = spawn(file, args, {
<ide> cwd: options.cwd,
<ide> env: options.env, | 1 |
Text | Text | add changelog for 2.16.2 | d90545005d1cae84705bb0f2635ab0c10b106e8a | <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.2 (November 1, 2017)
<add>
<add>- [#15797](https://github.com/emberjs/ember.js/pull/15797) [BUGFIX] Fix issues with using partials nested within other partials.
<add>
<ide> ### 2.16.1 (October 29, 2017)
<ide>
<ide> - [#15722](https://github.com/emberjs/ember.js/pull/15722) [BUGFIX] Avoid assertion when using `(get` helper with empty paths. | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.