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 |
|---|---|---|---|---|---|
PHP | PHP | fix coding standards, double whitespace | 54607ba0fada8883e6f9a9f774c55523ada5e05a | <ide><path>lib/Cake/Model/CakeSchema.php
<ide> protected function _values($values) {
<ide> if (is_array($values)) {
<ide> foreach ($values as $key => $val) {
<ide> if (is_array($val)) {
<del> $vals[] = "'{$key}' => array(" . implode(", ", $this->_values($val)) . ")";
<add> $vals[] = "'{$key}' => array(" . implode(", ", $this->_values($val)) . ")";
<ide> } else {
<ide> $val = var_export($val, true);
<ide> if ($val === 'NULL') { | 1 |
Text | Text | add changelog entry [skip ci] | e505bc8acd4448030fd4d2f85796bdb61d45a5b1 | <ide><path>activesupport/CHANGELOG.md
<add>* Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
<add>
<add> *Erol Fornoles*
<add>
<ide> * Add `rfc3339` aliases to `xmlschema` for `Time` and `ActiveSupport::TimeWithZone`
<ide>
<ide> For naming consistency when using the RFC 3339 profile of ISO 8601 in applications. | 1 |
Javascript | Javascript | remove react stack systrace logic | 973ef9728cd196f6853c24449af28569fa592462 | <ide><path>Libraries/Core/InitializeCore.js
<ide> if (!global.process.env.NODE_ENV) {
<ide> // Setup the Systrace profiling hooks if necessary
<ide> if (global.__RCTProfileIsProfiling) {
<ide> const Systrace = require('Systrace');
<del> Systrace.installReactHook(true);
<add> Systrace.installReactHook();
<ide> Systrace.setEnabled(true);
<ide> }
<ide>
<ide><path>Libraries/Performance/Systrace.js
<ide> let _asyncCookie = 0;
<ide> const _markStack = [];
<ide> let _markStackIndex = -1;
<ide> let _canInstallReactHook = false;
<del>let _useFiber = false;
<ide>
<ide> // Implements a subset of User Timing API necessary for React measurements.
<ide> // https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API
<ide> const userTimingPolyfill = __DEV__ ? {
<ide> },
<ide> } : null;
<ide>
<del>// A hook to get React Stack markers in Systrace.
<del>const reactDebugToolHook = __DEV__ ? {
<del> onBeforeMountComponent(debugID) {
<del> const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
<del> const displayName = ReactComponentTreeHook.getDisplayName(debugID);
<del> Systrace.beginEvent(`ReactReconciler.mountComponent(${displayName})`);
<del> },
<del> onMountComponent(debugID) {
<del> Systrace.endEvent();
<del> },
<del> onBeforeUpdateComponent(debugID) {
<del> const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
<del> const displayName = ReactComponentTreeHook.getDisplayName(debugID);
<del> Systrace.beginEvent(`ReactReconciler.updateComponent(${displayName})`);
<del> },
<del> onUpdateComponent(debugID) {
<del> Systrace.endEvent();
<del> },
<del> onBeforeUnmountComponent(debugID) {
<del> const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
<del> const displayName = ReactComponentTreeHook.getDisplayName(debugID);
<del> Systrace.beginEvent(`ReactReconciler.unmountComponent(${displayName})`);
<del> },
<del> onUnmountComponent(debugID) {
<del> Systrace.endEvent();
<del> },
<del> onBeginLifeCycleTimer(debugID, timerType) {
<del> const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
<del> const displayName = ReactComponentTreeHook.getDisplayName(debugID);
<del> Systrace.beginEvent(`${displayName}.${timerType}()`);
<del> },
<del> onEndLifeCycleTimer(debugID, timerType) {
<del> Systrace.endEvent();
<del> },
<del>} : null;
<del>
<ide> const Systrace = {
<del> installReactHook(useFiber: boolean) {
<add> installReactHook() {
<ide> if (_enabled) {
<ide> if (__DEV__) {
<del> if (useFiber) {
<del> global.performance = userTimingPolyfill;
<del> } else {
<del> require('ReactDebugTool').addHook(reactDebugToolHook);
<del> }
<add> global.performance = userTimingPolyfill;
<ide> }
<ide> }
<del> _useFiber = useFiber;
<ide> _canInstallReactHook = true;
<ide> },
<ide>
<ide> const Systrace = {
<ide> global.nativeTraceEndLegacy && global.nativeTraceEndLegacy(TRACE_TAG_JS_VM_CALLS);
<ide> }
<ide> if (_canInstallReactHook) {
<del> if (_useFiber) {
<del> if (enabled && global.performance === undefined) {
<del> global.performance = userTimingPolyfill;
<del> }
<del> } else {
<del> const ReactDebugTool = require('ReactDebugTool');
<del> if (enabled) {
<del> ReactDebugTool.addHook(reactDebugToolHook);
<del> } else {
<del> ReactDebugTool.removeHook(reactDebugToolHook);
<del> }
<add> if (enabled && global.performance === undefined) {
<add> global.performance = userTimingPolyfill;
<ide> }
<ide> }
<ide> }
<ide> const Systrace = {
<ide> attachToRelayProfiler(relayProfiler: RelayProfiler) {
<ide> relayProfiler.attachProfileHandler('*', (name, state?) => {
<ide> if (state != null && state.queryName !== undefined) {
<del> name += '_' + state.queryName
<add> name += '_' + state.queryName;
<ide> }
<ide> const cookie = Systrace.beginAsyncEvent(name);
<ide> return () => { | 2 |
PHP | PHP | change default transport to 'default' | 297b8987b2152a6a32045e93ae98c8e6908e11d0 | <ide><path>src/Mailer/Email.php
<ide> protected function _logDelivery($contents)
<ide> * @return \Cake\Mailer\Email Instance of Cake\Mailer\Email
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true)
<add> public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'default', $send = true)
<ide> {
<ide> $class = __CLASS__;
<ide> $instance = new $class($transportConfig); | 1 |
Javascript | Javascript | update error message | b55743ebcde87751606933bdbd6d45b25eb3a8be | <ide><path>examples/js/exporters/PLYBinaryExporter.js
<ide> THREE.PLYBinaryExporter.prototype = {
<ide> // as triangles)
<ide> console.error(
<ide>
<del> 'PLYExporter: Failed to generate a valid PLY file because the ' +
<del> 'number of faces is not divisible by 3. This can be caused by ' +
<del> 'exporting a mix of triangle and non-triangle mesh types.'
<add> 'PLYBinaryExporter: Failed to generate a valid PLY file with triangle indices because the ' +
<add> 'number of faces is not divisible by 3.'
<ide>
<ide> );
<ide>
<ide><path>examples/js/exporters/PLYExporter.js
<ide> THREE.PLYExporter.prototype = {
<ide> // as triangles)
<ide> console.error(
<ide>
<del> 'PLYExporter: Failed to generate a valid PLY file because the ' +
<del> 'number of faces is not divisible by 3. This can be caused by ' +
<del> 'exporting a mix of triangle and non-triangle mesh types.'
<add> 'PLYExporter: Failed to generate a valid PLY file with triangle indices because the ' +
<add> 'number of faces is not divisible by 3.'
<ide>
<ide> );
<ide> | 2 |
Javascript | Javascript | relax permissionsandroid enforcement" | 3b65d2c2c8ce92693abc92bd0b3ff8342ab80f3c | <ide><path>Libraries/PermissionsAndroid/NativePermissionsAndroid.js
<ide> export interface Spec extends TurboModule {
<ide> ) => Promise<{[permission: PermissionType]: PermissionStatus}>;
<ide> }
<ide>
<del>export default TurboModuleRegistry.getEnforcing<Spec>('PermissionsAndroid');
<add>export default TurboModuleRegistry.get<Spec>('PermissionsAndroid');
<ide><path>Libraries/PermissionsAndroid/PermissionsAndroid.js
<ide> 'use strict';
<ide>
<ide> import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManagerAndroid';
<del>const NativeModules = require('../BatchedBridge/NativeModules');
<ide> const Platform = require('../Utilities/Platform');
<ide> import NativePermissionsAndroid from './NativePermissionsAndroid';
<ide>
<add>import invariant from 'invariant';
<add>
<ide> import type {
<ide> PermissionStatus,
<ide> PermissionType,
<ide> class PermissionsAndroid {
<ide> return Promise.resolve(false);
<ide> }
<ide>
<add> invariant(
<add> NativePermissionsAndroid,
<add> 'PermissionsAndroid is not installed correctly.',
<add> );
<add>
<ide> return NativePermissionsAndroid.checkPermission(permission);
<ide> }
<ide>
<ide> class PermissionsAndroid {
<ide> );
<ide> return Promise.resolve(false);
<ide> }
<add>
<add> invariant(
<add> NativePermissionsAndroid,
<add> 'PermissionsAndroid is not installed correctly.',
<add> );
<add>
<ide> return NativePermissionsAndroid.checkPermission(permission);
<ide> }
<ide>
<ide> class PermissionsAndroid {
<ide> return Promise.resolve(this.RESULTS.DENIED);
<ide> }
<ide>
<add> invariant(
<add> NativePermissionsAndroid,
<add> 'PermissionsAndroid is not installed correctly.',
<add> );
<add>
<ide> if (rationale) {
<ide> const shouldShowRationale = await NativePermissionsAndroid.shouldShowRequestPermissionRationale(
<ide> permission,
<ide> class PermissionsAndroid {
<ide> return Promise.resolve({});
<ide> }
<ide>
<add> invariant(
<add> NativePermissionsAndroid,
<add> 'PermissionsAndroid is not installed correctly.',
<add> );
<add>
<ide> return NativePermissionsAndroid.requestMultiplePermissions(permissions);
<ide> }
<ide> } | 2 |
Javascript | Javascript | add $setdirty method | e8941c0fe5217d2e705bad8253dc0162aff4c709 | <ide><path>src/ng/directive/input.js
<ide> var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
<ide> $animate.addClass($element, PRISTINE_CLASS);
<ide> };
<ide>
<add> /**
<add> * @ngdoc method
<add> * @name ngModel.NgModelController#$setDirty
<add> *
<add> * @description
<add> * Sets the control to its dirty state.
<add> *
<add> * This method can be called to remove the `ng-pristine` class and set the control to its dirty
<add> * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
<add> * from when first compiled.
<add> */
<add> this.$setDirty = function() {
<add> ctrl.$dirty = true;
<add> ctrl.$pristine = false;
<add> $animate.removeClass($element, PRISTINE_CLASS);
<add> $animate.addClass($element, DIRTY_CLASS);
<add> parentForm.$setDirty();
<add> };
<add>
<ide> /**
<ide> * @ngdoc method
<ide> * @name ngModel.NgModelController#$setUntouched
<ide> var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
<ide>
<ide> // change to dirty
<ide> if (ctrl.$pristine) {
<del> ctrl.$dirty = true;
<del> ctrl.$pristine = false;
<del> $animate.removeClass($element, PRISTINE_CLASS);
<del> $animate.addClass($element, DIRTY_CLASS);
<del> parentForm.$setDirty();
<add> this.$setDirty();
<ide> }
<ide> this.$$parseAndValidate();
<ide> };
<ide><path>test/ng/directive/inputSpec.js
<ide> describe('NgModelController', function() {
<ide> });
<ide> });
<ide>
<add> describe('setDirty', function() {
<add>
<add> it('should set control to its dirty state', function() {
<add> expect(ctrl.$pristine).toBe(true);
<add> expect(ctrl.$dirty).toBe(false);
<add>
<add> ctrl.$setDirty();
<add> expect(ctrl.$pristine).toBe(false);
<add> expect(ctrl.$dirty).toBe(true);
<add> });
<add>
<add> it('should set parent form to its dirty state', function() {
<add> ctrl.$setDirty();
<add> expect(parentFormCtrl.$setDirty).toHaveBeenCalled();
<add> });
<add> });
<add>
<ide> describe('setUntouched', function() {
<ide>
<ide> it('should set control to its untouched state', function() { | 2 |
PHP | PHP | fix doc string | 42e8c7a0c2048f0f2d20ef57e2977bc34a0076f8 | <ide><path>tests/TestCase/Routing/RouteCollectionTest.php
<ide> public function testAddingDuplicateNamedRoutes()
<ide> }
<ide>
<ide> /**
<del> * Test get/set combined method.
<add> * Test combined get/set method.
<ide> *
<ide> * @return void
<ide> * @deprecated 3.5.0 | 1 |
Python | Python | improve method ordering | 0bbbec6ff6bbc560c1e8afa6cc09ee4f343b0d39 | <ide><path>libcloud/container/drivers/kubernetes.py
<ide> class KubernetesContainerDriver(KubernetesDriverMixin, ContainerDriver):
<ide> connectionCls = KubernetesBasicAuthConnection
<ide> supports_clusters = True
<ide>
<del> def ex_get_version(self):
<del> """Get Kubernetes version"""
<del> return self.connection.request("/version").object["gitVersion"]
<del>
<ide> def list_containers(self, image=None, all=True):
<ide> """
<ide> List the deployed container images
<ide> def create_namespace(self, name, location=None):
<ide> ).object
<ide> return self._to_namespace(result)
<ide>
<del> def ex_list_nodes_metrics(self):
<del> return self.connection.request(
<del> "/apis/metrics.k8s.io/v1beta1/nodes", enforce_unicode_response=True
<del> ).object["items"]
<del>
<del> def ex_list_pods_metrics(self):
<del> return self.connection.request(
<del> "/apis/metrics.k8s.io/v1beta1/pods", enforce_unicode_response=True
<del> ).object["items"]
<del>
<del> def ex_list_services(self):
<del> return self.connection.request(
<del> ROOT_URL + "v1/services", enforce_unicode_response=True
<del> ).object["items"]
<del>
<ide> def deploy_container(
<ide> self, name, image, namespace=None, parameters=None, start=True
<ide> ):
<ide> def destroy_container(self, container):
<ide> """
<ide> return self.ex_destroy_pod(container.extra["namespace"], container.extra["pod"])
<ide>
<add> def ex_list_pods(self):
<add> """
<add> List available Pods
<add>
<add> :rtype: ``list`` of :class:`.KubernetesPod`
<add> """
<add> result = self.connection.request(
<add> ROOT_URL + "v1/pods", enforce_unicode_response=True
<add> ).object
<add> return [self._to_pod(value) for value in result["items"]]
<add>
<add> def ex_destroy_pod(self, namespace, pod_name):
<add> """
<add> Delete a pod and the containers within it.
<add> """
<add> self.connection.request(
<add> ROOT_URL + "v1/namespaces/%s/pods/%s" % (namespace, pod_name),
<add> method="DELETE",
<add> ).object
<add> return True
<add>
<ide> def ex_list_nodes(self):
<ide> """
<ide> List available Nodes
<ide> def ex_list_nodes(self):
<ide> ).object
<ide> return [self._to_node(node) for node in result["items"]]
<ide>
<add> def ex_get_version(self):
<add> """Get Kubernetes version"""
<add> return self.connection.request("/version").object["gitVersion"]
<add>
<add> def ex_list_nodes_metrics(self):
<add> return self.connection.request(
<add> "/apis/metrics.k8s.io/v1beta1/nodes", enforce_unicode_response=True
<add> ).object["items"]
<add>
<add> def ex_list_pods_metrics(self):
<add> return self.connection.request(
<add> "/apis/metrics.k8s.io/v1beta1/pods", enforce_unicode_response=True
<add> ).object["items"]
<add>
<add> def ex_list_services(self):
<add> return self.connection.request(
<add> ROOT_URL + "v1/services", enforce_unicode_response=True
<add> ).object["items"]
<add>
<ide> def _to_node(self, data):
<ide> """
<ide> Convert an API node data object to a `Node` object
<ide> def _to_node(self, data):
<ide> created_at=created_at,
<ide> )
<ide>
<del> def ex_list_pods(self):
<del> """
<del> List available Pods
<del>
<del> :rtype: ``list`` of :class:`.KubernetesPod`
<del> """
<del> result = self.connection.request(
<del> ROOT_URL + "v1/pods", enforce_unicode_response=True
<del> ).object
<del> return [self._to_pod(value) for value in result["items"]]
<del>
<del> def ex_destroy_pod(self, namespace, pod_name):
<del> """
<del> Delete a pod and the containers within it.
<del> """
<del> self.connection.request(
<del> ROOT_URL + "v1/namespaces/%s/pods/%s" % (namespace, pod_name),
<del> method="DELETE",
<del> ).object
<del> return True
<del>
<ide> def _to_pod(self, data):
<ide> """
<ide> Convert an API response to a Pod object | 1 |
Ruby | Ruby | update rubocop-cask to 0.12.0 | f6b1f88c3c7715a72a2dbd8ec9a7359450909747 | <ide><path>Library/Homebrew/constants.rb
<ide> # RuboCop version used for `brew style` and `brew cask style`
<ide> HOMEBREW_RUBOCOP_VERSION = "0.47.1".freeze
<del>HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.11.0".freeze # has to be updated when RuboCop version changes
<add>HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.12.0".freeze # has to be updated when RuboCop version changes | 1 |
PHP | PHP | add persistent caching to stringtemplate | ebd24c408b90d8a208443ebf121cdd5856075192 | <ide><path>src/View/Helper/StringTemplateTrait.php
<ide> public function formatTemplate($name, $data) {
<ide> public function templater() {
<ide> if (empty($this->_templater)) {
<ide> $class = $this->config('templateClass') ?: 'Cake\View\StringTemplate';
<del> $this->_templater = new $class;
<add> $this->_templater = new $class([], str_replace('\\', '_', __CLASS__));
<ide>
<ide> $templates = $this->config('templates');
<ide> if ($templates) {
<ide> public function templater() {
<ide> } else {
<ide> $this->_templater->add($templates);
<ide> }
<add> $this->_templater->writeCache();
<ide> }
<ide> }
<ide>
<ide><path>src/View/StringTemplate.php
<ide> */
<ide> namespace Cake\View;
<ide>
<add>use Cake\Cache\Cache;
<ide> use Cake\Configure\Engine\PhpConfig;
<ide> use Cake\Core\InstanceConfigTrait;
<ide>
<ide> class StringTemplate {
<ide> */
<ide> protected $_compiled = [];
<ide>
<add>/**
<add> * The persistent cache key for templates.
<add> *
<add> * @var string
<add> */
<add> protected $_cacheKey;
<add>
<ide> /**
<ide> * Constructor.
<ide> *
<ide> * @param array $config A set of templates to add.
<add> * @param string $cacheKey The cache key to load templates from
<add> */
<add> public function __construct(array $config = [], $key = null) {
<add> if ($key) {
<add> $this->_cacheKey = $key;
<add> $this->loadCache();
<add> }
<add> $this->add($config);
<add> }
<add>
<add>/**
<add> * Loads templates and compiled results from the persistent cache.
<add> *
<add> * @return void
<add> */
<add> public function loadCache() {
<add> if (!$this->_cacheKey) {
<add> return;
<add> }
<add> $results = Cache::read($this->_cacheKey, '_cake_core_');
<add> if (!$results) {
<add> return;
<add> }
<add> $this->_templates = $results['templates'];
<add> $this->_compiled = $results['compiled'];
<add> }
<add>
<add>/**
<add> * Save templates to the persistent cache.
<add> *
<add> * @return void
<ide> */
<del> public function __construct(array $config = []) {
<del> $this->config($config);
<add> public function writeCache() {
<add> if (empty($this->_cacheKey)) {
<add> return;
<add> }
<add> $data = [
<add> 'templates' => $this->_config,
<add> 'compiled' => $this->_compiled
<add> ];
<add> Cache::write($this->_cacheKey, '_cake_core_');
<ide> }
<ide>
<ide> /**
<ide> public function __construct(array $config = []) {
<ide> * @return void
<ide> */
<ide> public function push() {
<del> $this->_configStack[] = $this->_config;
<add> $this->_configStack[] = [
<add> $this->_config,
<add> $this->_compiled
<add> ];
<ide> }
<ide>
<ide> /**
<ide> * Restore the most recently pushed set of templates.
<ide> *
<del> * Restoring templates will invalidate all compiled templates.
<del> *
<ide> * @return void
<ide> */
<ide> public function pop() {
<ide> if (empty($this->_configStack)) {
<ide> return;
<ide> }
<del> $this->_config = array_pop($this->_configStack);
<del> $this->_compiled = [];
<add> list($this->_config, $this->_compiled) = array_pop($this->_configStack);
<ide> }
<ide>
<ide> /**
<ide> public function pop() {
<ide> */
<ide> public function add(array $templates) {
<ide> $this->config($templates);
<del> $this->_compiled = array_diff_key($this->_compiled, $templates);
<add> $this->_compileTemplates(array_keys($templates));
<ide> return $this;
<ide> }
<ide>
<add>/**
<add> * Compile templates into a more efficient printf() compatible format.
<add> *
<add> * @param array $templates The template names to compile. If empty all templates will be compiled.
<add> */
<add> protected function _compileTemplates(array $templates = []) {
<add> if (empty($templates)) {
<add> $templates = array_keys($this->_config);
<add> }
<add> foreach ($templates as $name) {
<add> $template = $this->get($name);
<add> if ($template === null) {
<add> $this->_compiled[$name] = [null, null];
<add> }
<add>
<add> preg_match_all('#\{\{(\w+)\}\}#', $template, $matches);
<add> $this->_compiled[$name] = [
<add> str_replace($matches[0], '%s', $template),
<add> $matches[1]
<add> ];
<add> }
<add> }
<add>
<ide> /**
<ide> * Load a config file containing templates.
<ide> *
<ide> public function remove($name) {
<ide> unset($this->_compiled[$name]);
<ide> }
<ide>
<del>/**
<del> * Returns an array containing the compiled template to be used with
<del> * the sprintf function and a list of placeholder names that were found
<del> * in the template in the order that they should be replaced.
<del> *
<del> * @param string $name The compiled template info
<del> * @return array
<del> */
<del> public function compile($name) {
<del> if (isset($this->_compiled[$name])) {
<del> return $this->_compiled[$name];
<del> }
<del>
<del> $template = $this->get($name);
<del> if ($template === null) {
<del> return $this->_compiled[$name] = [null, null];
<del> }
<del>
<del> preg_match_all('#\{\{(\w+)\}\}#', $template, $matches);
<del> return $this->_compiled[$name] = [
<del> str_replace($matches[0], '%s', $template),
<del> $matches[1]
<del> ];
<del> }
<del>
<ide> /**
<ide> * Format a template string with $data
<ide> *
<ide> public function compile($name) {
<ide> * @return string
<ide> */
<ide> public function format($name, array $data) {
<del> list($template, $placeholders) = $this->compile($name);
<add> if (!isset($this->_compiled[$name])) {
<add> return '';
<add> }
<add> list($template, $placeholders) = $this->_compiled[$name];
<ide> if ($template === null) {
<ide> return '';
<ide> }
<ide><path>tests/TestCase/View/StringTemplateTest.php
<ide> public function testFormatAttributesArray() {
<ide> );
<ide> }
<ide>
<del>/**
<del> * Tests that compile information is refreshed on adds and removes
<del> *
<del> * @return void
<del> */
<del> public function testCopiledInfoRefresh() {
<del> $compilation = $this->template->compile('link');
<del> $this->template->add([
<del> 'link' => '<a bar="{{foo}}">{{baz}}</a>'
<del> ]);
<del> $this->assertNotEquals($compilation, $this->template->compile('link'));
<del> $this->template->remove('link');
<del> $this->assertEquals([null, null], $this->template->compile('link'));
<del> }
<del>
<ide> /**
<ide> * test push/pop templates.
<ide> * | 3 |
Javascript | Javascript | add okanagan news app to showcase | 279a6cd52f9fd3f709f6cf6d9c78fc9f34552b5c | <ide><path>website/src/react-native/showcase.js
<ide> var apps = [
<ide> link: 'https://itunes.apple.com/gb/app/night-light-feeding-light/id1016843582?mt=8',
<ide> author: 'Tian Yuan',
<ide> },
<add> {
<add> name: 'Okanagan News',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple69/v4/aa/93/17/aa93171e-d0ed-7e07-54a1-be27490e210c/icon175x175.jpeg',
<add> link: 'https://itunes.apple.com/us/app/okanagan-news-reader-for-viewing/id1049147148?mt=8',
<add> author: 'Levi Cabral',
<add> },
<ide> {
<ide> name: 'Posyt - Tinder for ideas',
<ide> icon: 'http://a3.mzstatic.com/us/r30/Purple6/v4/a5/b3/86/a5b38618-a5e9-6089-7425-7fa51ecd5d30/icon175x175.jpeg', | 1 |
Ruby | Ruby | update xcode links | 9877b1e7b8e62e8285b459cabe70556c37abfe75 | <ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def check_xcode_up_to_date
<ide> Your Xcode (#{MacOS::Xcode.version}) is outdated
<ide> Please update to Xcode #{MacOS::Xcode.latest_version}.
<ide> Xcode can be updated from
<del> https://developer.apple.com/downloads
<add> https://developer.apple.com/xcode/downloads/
<ide> EOS
<ide> end
<ide> end
<ide> def check_xcode_up_to_date
<ide> Your Xcode (#{MacOS::Xcode.version}) is outdated
<ide> Please update to Xcode #{MacOS::Xcode.latest_version}.
<ide> Xcode can be updated from
<del> https://developer.apple.com/downloads
<add> https://developer.apple.com/xcode/downloads/
<ide> EOS
<ide> end
<ide> end
<ide> def check_for_installed_developer_tools
<ide> unless MacOS::Xcode.installed? then <<-EOS.undent
<ide> Xcode is not installed. Most formulae need Xcode to build.
<ide> It can be installed from
<del> https://developer.apple.com/downloads
<add> https://developer.apple.com/xcode/downloads/
<ide> EOS
<ide> end
<ide> end
<ide> def check_xcode_up_to_date
<ide> Your Xcode (#{MacOS::Xcode.version}) is outdated
<ide> Please update to Xcode #{MacOS::Xcode.latest_version}.
<ide> Xcode can be updated from
<del> https://developer.apple.com/downloads
<add> https://developer.apple.com/xcode/downloads/
<ide> EOS
<ide> end
<ide> end | 1 |
Python | Python | revert some of the indirects in the initializers | 8c56113365d2aa1036980c9b9a408e2400c2b7fa | <ide><path>keras/initializers/initializers_v2.py
<ide> def __call__(self, shape, dtype=None, **kwargs):
<ide> raise ValueError(f'Expected numeric or boolean dtype, got {dtype}.')
<ide> if _PARTITION_SHAPE in kwargs:
<ide> shape = kwargs[_PARTITION_SHAPE]
<del> return self._call(shape, dtype, **kwargs)
<del>
<del> def _call(self, shape, dtype, **kwargs):
<del> # TODO(scottzhu): remove this extra level of _call when layout is part of
<del> # the public API.
<del> del kwargs
<ide> return tf.zeros(shape, dtype)
<ide>
<ide>
<ide> def __call__(self, shape, dtype=None, **kwargs):
<ide> raise ValueError(f'Expected numeric or boolean dtype, got {dtype}.')
<ide> if _PARTITION_SHAPE in kwargs:
<ide> shape = kwargs[_PARTITION_SHAPE]
<del> return self._call(shape, dtype, **kwargs)
<del>
<del> def _call(self, shape, dtype, **kwargs):
<del> del kwargs
<ide> return tf.ones(shape, dtype)
<ide>
<ide> | 1 |
Text | Text | fix typos on n-api | d20f1f004ca45b408a774f4a58f35266a03bb001 | <ide><path>doc/api/n-api.md
<ide> are no longer required, the scope can be 'closed' and any handles associated
<ide> with the scope are invalidated. The methods available to open/close scopes are
<ide> [`napi_open_handle_scope`][] and [`napi_close_handle_scope`][].
<ide>
<del>N-API only supports a single nested hiearchy of scopes. There is only one
<add>N-API only supports a single nested hierarchy of scopes. There is only one
<ide> active scope at any time, and all new handles will be associated with that
<ide> scope while it is active. Scopes must be closed in the reverse order from
<ide> which they are opened. In addition, all scopes created within a native method
<ide> object to which the reference is related.
<ide> Returns `napi_ok` if the API succeeded.
<ide>
<ide> If still valid, this API returns the `napi_value` representing the
<del>JavaScript Object associated with the `napi_ref`. Otherise, result
<add>JavaScript Object associated with the `napi_ref`. Otherwise, result
<ide> will be NULL.
<ide>
<ide> ## Module registration
<ide> napi_status napi_is_arraybuffer(napi_env env, napi_value value, bool* result)
<ide>
<ide> Returns `napi_ok` if the API succeeded.
<ide>
<del>This API checks if the Object passsed in is an array buffer.
<add>This API checks if the Object passed in is an array buffer.
<ide>
<ide> ### napi_is_buffer
<ide> <!-- YAML
<ide> object.
<ide>
<ide> Returns `napi_ok` if the API succeeded.
<ide>
<del>This API checks if the Object passsed in is a buffer.
<add>This API checks if the Object passed in is a buffer.
<ide>
<ide> ### napi_is_error
<ide> <!-- YAML
<ide> napi_status napi_is_error(napi_env env, napi_value value, bool* result)
<ide>
<ide> Returns `napi_ok` if the API succeeded.
<ide>
<del>This API checks if the Object passsed in is an Error.
<add>This API checks if the Object passed in is an Error.
<ide>
<ide> ### napi_is_typedarray
<ide> <!-- YAML
<ide> napi_status napi_is_typedarray(napi_env env, napi_value value, bool* result)
<ide>
<ide> Returns `napi_ok` if the API succeeded.
<ide>
<del>This API checks if the Object passsed in is a typed array.
<add>This API checks if the Object passed in is a typed array.
<ide>
<ide> ### napi_is_dataview
<ide> <!-- YAML
<ide> and [`napi_get_element`][].
<ide>
<ide> Returns `napi_ok` if the API succeeded.
<ide>
<del>This API returns the array of propertys for the Object passed in
<add>This API returns the array of properties for the Object passed in
<ide>
<ide> #### napi_set_property
<ide> <!-- YAML
<ide> napi_status napi_create_async_work(napi_env env,
<ide> that will be passed to possible async_hooks [`init` hooks][].
<ide> - `[in] async_resource_name`: Identifier for the kind of resource that is
<ide> being provided for diagnostic information exposed by the `async_hooks` API.
<del>- `[in] execute`: The native function which should be called to excute
<add>- `[in] execute`: The native function which should be called to execute
<ide> the logic asynchronously. The given function is called from a worker pool
<ide> thread and can execute in parallel with the main event loop thread.
<ide> - `[in] complete`: The native function which will be called when the | 1 |
Ruby | Ruby | ignore stdout during gitdownloadstrategy.stage | 04f3ddeac01b75c66ec8e8f83a517cc13b6d3ab9 | <ide><path>Library/Homebrew/download_strategy.rb
<ide> def fetch
<ide> safe_system 'git', 'clone', @url, @clone
<ide> else
<ide> # TODO git pull?
<del> puts "Repository already cloned"
<add> puts "Repository already cloned to #{@clone}"
<ide> end
<ide> end
<ide> def stage
<ide> def stage
<ide> ohai "Checking out #{@spec} #{@ref}"
<ide> case @spec
<ide> when :branch
<del> safe_system 'git', 'checkout', "origin/#{@ref}"
<add> nostdout { safe_system 'git', 'checkout', "origin/#{@ref}" }
<ide> when :tag
<del> safe_system 'git', 'checkout', @ref
<add> nostdout { safe_system 'git', 'checkout', @ref }
<ide> end
<ide> end
<ide> # http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export
<ide><path>Library/Homebrew/test/unittest.rb
<ide> def inspect
<ide> end
<ide> end
<ide>
<del>def nostdout
<del> if ARGV.include? '-V'
<del> yield
<del> end
<del> begin
<del> require 'stringio'
<del> tmpo=$stdout
<del> tmpe=$stderr
<del> $stdout=StringIO.new
<del> yield
<del> ensure
<del> $stdout=tmpo
<del> end
<del>end
<del>
<ide> module ExtendArgvPlusYeast
<ide> def reset
<ide> @named = nil
<ide><path>Library/Homebrew/utils.rb
<ide> def ignore_interrupts
<ide> ensure
<ide> trap("INT", std_trap)
<ide> end
<add>
<add>def nostdout
<add> if ARGV.verbose?
<add> yield
<add> else
<add> begin
<add> require 'stringio'
<add> real_stdout = $stdout
<add> $stdout = StringIO.new
<add> yield
<add> ensure
<add> $stdout = real_stdout
<add> end
<add> end
<add>end
<ide>\ No newline at end of file | 3 |
Ruby | Ruby | fix basename for extracting cask downloads | 82c1e6fb0ebeb5bb34f03c1ef1b4cd482515f76c | <ide><path>Library/Homebrew/cask/download.rb
<ide> def cached_download
<ide> downloader.cached_location
<ide> end
<ide>
<add> def basename
<add> downloader.basename
<add> end
<add>
<ide> def verify_download_integrity(fn)
<ide> if @cask.sha256 == :no_check
<ide> opoo "No checksum defined for cask '#{@cask}', skipping verification."
<ide><path>Library/Homebrew/cask/installer.rb
<ide> def summary
<ide> s.freeze
<ide> end
<ide>
<add> sig { returns(Download) }
<add> def downloader
<add> @downloader ||= Download.new(@cask, quarantine: quarantine?)
<add> end
<add>
<ide> sig { returns(Pathname) }
<ide> def download
<del> @download ||= Download.new(@cask, quarantine: quarantine?)
<del> .fetch(verify_download_integrity: @verify_download_integrity)
<add> @download ||= downloader.fetch(verify_download_integrity: @verify_download_integrity)
<ide> end
<ide>
<ide> def verify_has_sha
<ide> def extract_primary_container(to: @cask.staged_path)
<ide>
<ide> odebug "Using container class #{primary_container.class} for #{primary_container.path}"
<ide>
<del> basename = CGI.unescape(File.basename(@cask.url.path))
<add> basename = downloader.basename
<ide>
<ide> if nested_container = @cask.container&.nested
<ide> Dir.mktmpdir do |tmpdir| | 2 |
PHP | PHP | fix exception message | 603a32ede92b4166dfa1f8fac1c57ceb6df06d97 | <ide><path>src/ORM/Association.php
<ide> public function getTarget()
<ide> if (!is_a($this->_targetTable, $className)) {
<ide> throw new RuntimeException(sprintf(
<ide> 'Invalid Table retrieved from a registry. Requested: %s, got: %s',
<del> get_class($this->_targetTable),
<del> $className
<add> $className,
<add> get_class($this->_targetTable)
<ide> ));
<ide> }
<ide> } | 1 |
Text | Text | fix typo / grammar in the responsive docs | b50a1c21f2509f54a49347eeb73970a66b3c2013 | <ide><path>docs/general/responsive.md
<ide> # Responsive Charts
<ide>
<del>When it comes to change the chart size based on the window size, a major limitation is that the canvas *render* size (`canvas.width` and `.height`) can **not** be expressed with relative values, contrary to the *display* size (`canvas.style.width` and `.height`). Furthermore, these sizes are independent from each other and thus the canvas *render* size does not adjust automatically based on the *display* size, making the rendering inaccurate.
<add>When it comes to changing the chart size based on the window size, a major limitation is that the canvas *render* size (`canvas.width` and `.height`) can **not** be expressed with relative values, contrary to the *display* size (`canvas.style.width` and `.height`). Furthermore, these sizes are independent from each other and thus the canvas *render* size does not adjust automatically based on the *display* size, making the rendering inaccurate.
<ide>
<ide> The following examples **do not work**:
<ide> | 1 |
Java | Java | introduce datafieldmaxvalueincrementer for mariadb | 39f24f024458c21ed4ba97976cc2ed59a5ec4ba3 | <ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/MariaDBSequenceMaxValueIncrementer.java
<add>/*
<add> * Copyright 2022 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.jdbc.support.incrementer;
<add>
<add>import javax.sql.DataSource;
<add>
<add>/**
<add> * {@link DataFieldMaxValueIncrementer} that retrieves the next value
<add> * of a given MariaDB sequence.
<add> *
<add> * @author Mahmoud Ben Hassine
<add> * @since 6.0.0
<add> */
<add>public class MariaDBSequenceMaxValueIncrementer extends AbstractSequenceMaxValueIncrementer {
<add>
<add> /**
<add> * Default constructor for bean property style usage.
<add> * @see #setDataSource
<add> * @see #setIncrementerName
<add> */
<add> public MariaDBSequenceMaxValueIncrementer() {
<add> }
<add>
<add> /**
<add> * Convenience constructor.
<add> * @param dataSource the DataSource to use
<add> * @param incrementerName the name of the sequence to use
<add> */
<add> public MariaDBSequenceMaxValueIncrementer(DataSource dataSource, String incrementerName) {
<add> super(dataSource, incrementerName);
<add> }
<add>
<add> @Override
<add> protected String getSequenceQuery() {
<add> return "select next value for " + getIncrementerName();
<add> }
<add>
<add>}
<ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java
<ide> /*
<del> * Copyright 2002-2021 the original author or authors.
<add> * Copyright 2002-2022 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
<ide> import org.springframework.jdbc.support.incrementer.HanaSequenceMaxValueIncrementer;
<ide> import org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer;
<add>import org.springframework.jdbc.support.incrementer.MariaDBSequenceMaxValueIncrementer;
<ide> import org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer;
<ide> import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer;
<ide> import org.springframework.jdbc.support.incrementer.PostgresSequenceMaxValueIncrementer;
<ide> *
<ide> * @author Juergen Hoeller
<ide> * @author Sam Brannen
<add> * @author Mahmoud Ben Hassine
<ide> * @since 27.02.2004
<ide> */
<ide> class DataFieldMaxValueIncrementerTests {
<ide> void postgresSequenceMaxValueIncrementer() throws SQLException {
<ide> verify(connection, times(2)).close();
<ide> }
<ide>
<add> @Test
<add> void mariaDBSequenceMaxValueIncrementer() throws SQLException {
<add> given(dataSource.getConnection()).willReturn(connection);
<add> given(connection.createStatement()).willReturn(statement);
<add> given(statement.executeQuery("select next value for myseq")).willReturn(resultSet);
<add> given(resultSet.next()).willReturn(true);
<add> given(resultSet.getLong(1)).willReturn(10L, 12L);
<add>
<add> MariaDBSequenceMaxValueIncrementer incrementer = new MariaDBSequenceMaxValueIncrementer();
<add> incrementer.setDataSource(dataSource);
<add> incrementer.setIncrementerName("myseq");
<add> incrementer.setPaddingLength(5);
<add> incrementer.afterPropertiesSet();
<add>
<add> assertThat(incrementer.nextStringValue()).isEqualTo("00010");
<add> assertThat(incrementer.nextIntValue()).isEqualTo(12);
<add>
<add> verify(resultSet, times(2)).close();
<add> verify(statement, times(2)).close();
<add> verify(connection, times(2)).close();
<add> }
<add>
<ide> } | 2 |
Ruby | Ruby | reduce string objects, reduce method calls | ddbd2039615ca4376a46a97a17612732f24568cd | <ide><path>activerecord/lib/active_record/associations/class_methods/join_dependency.rb
<ide> class JoinDependency # :nodoc:
<ide>
<ide> def initialize(base, associations, joins)
<ide> @active_record = base
<del> @table_joins = joins || ''
<add> @table_joins = joins
<ide> @join_parts = [JoinBase.new(base)]
<ide> @associations = {}
<ide> @reflections = []
<ide> def columns
<ide> end
<ide>
<ide> def count_aliases_from_table_joins(name)
<add> return 0 unless @table_joins
<add>
<ide> # quoted_name should be downcased as some database adapters (Oracle) return quoted name in uppercase
<ide> quoted_name = active_record.connection.quote_table_name(name.downcase).downcase
<ide> join_sql = @table_joins.downcase
<del> join_sql.blank? ? 0 :
<del> # Table names
<del> join_sql.scan(/join(?:\s+\w+)?\s+#{quoted_name}\son/).size +
<add> # Table names
<add> join_sql.scan(/join(?:\s+\w+)?\s+#{quoted_name}\son/).size +
<ide> # Table aliases
<ide> join_sql.scan(/join(?:\s+\w+)?\s+\S+\s+#{quoted_name}\son/).size
<ide> end | 1 |
Mixed | Go | simplify swappiness check | 6f8ddec1d0e67058c7a4a15c7d4d9a75bc1e5dea | <ide><path>docs/reference/run.md
<ide> and require killing system processes to free memory.
<ide> By default, a container's kernel can swap out a percentage of anonymous pages.
<ide> To set this percentage for a container, specify a `--memory-swappiness` value
<ide> between 0 and 100. A value of 0 turns off anonymous page swapping. A value of
<del>100 sets all anonymous pages as swappable.
<add>100 sets all anonymous pages as swappable. By default, if you are not using
<add>`--memory-swappiness`, memory swappiness value will be inherited from the parent.
<ide>
<ide> For example, you can set:
<ide>
<ide><path>integration-cli/docker_cli_run_test.go
<ide> func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
<ide> if err == nil {
<ide> c.Fatalf("failed. test was able to set invalid value, output: %q", out)
<ide> }
<del> runCmd = exec.Command(dockerBinary, "run", "--memory-swappiness", "-1", "busybox", "true")
<del> out, _, err = runCommandWithOutput(runCmd)
<del> if err == nil {
<del> c.Fatalf("failed. test was able to set invalid value, output: %q", out)
<del> }
<ide> }
<ide>
<ide> // "test" should be printed
<ide><path>runconfig/parse.go
<ide> func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
<ide> flStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Keep STDIN open even if not attached")
<ide> flTty = cmd.Bool([]string{"t", "-tty"}, false, "Allocate a pseudo-TTY")
<ide> flOomKillDisable = cmd.Bool([]string{"-oom-kill-disable"}, false, "Disable OOM Killer")
<del> flSwappinessStr = cmd.String([]string{"-memory-swappiness"}, "", "Tuning container memory swappiness (0 to 100)")
<ide> flContainerIDFile = cmd.String([]string{"#cidfile", "-cidfile"}, "", "Write the container ID to the file")
<ide> flEntrypoint = cmd.String([]string{"#entrypoint", "-entrypoint"}, "", "Overwrite the default ENTRYPOINT of the image")
<ide> flHostname = cmd.String([]string{"h", "-hostname"}, "", "Container host name")
<ide> func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
<ide> flCpusetCpus = cmd.String([]string{"#-cpuset", "-cpuset-cpus"}, "", "CPUs in which to allow execution (0-3, 0,1)")
<ide> flCpusetMems = cmd.String([]string{"-cpuset-mems"}, "", "MEMs in which to allow execution (0-3, 0,1)")
<ide> flBlkioWeight = cmd.Int64([]string{"-blkio-weight"}, 0, "Block IO (relative weight), between 10 and 1000")
<add> flSwappiness = cmd.Int64([]string{"-memory-swappiness"}, -1, "Tuning container memory swappiness (0 to 100)")
<ide> flNetMode = cmd.String([]string{"-net"}, "default", "Set the Network mode for the container")
<ide> flMacAddress = cmd.String([]string{"-mac-address"}, "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)")
<ide> flIpcMode = cmd.String([]string{"-ipc"}, "", "IPC namespace to use")
<ide> func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
<ide> }
<ide> }
<ide>
<del> var parsedSwappiness int64
<del> var flSwappiness int64
<del>
<del> if *flSwappinessStr != "" {
<del> parsedSwappiness, err = strconv.ParseInt(*flSwappinessStr, 10, 64)
<del> if err != nil || parsedSwappiness < 0 || parsedSwappiness > 100 {
<del> return nil, nil, cmd, fmt.Errorf("invalid value:%s. valid memory swappiness range is 0-100", *flSwappinessStr)
<del> }
<del> flSwappiness = parsedSwappiness
<del> } else {
<del> flSwappiness = -1
<add> swappiness := *flSwappiness
<add> if swappiness != -1 && (swappiness < 0 || swappiness > 100) {
<add> return nil, nil, cmd, fmt.Errorf("Invalid value: %d. Valid memory swappiness range is 0-100", swappiness)
<ide> }
<ide>
<ide> var binds []string
<ide> func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
<ide> CpuQuota: *flCpuQuota,
<ide> BlkioWeight: *flBlkioWeight,
<ide> OomKillDisable: *flOomKillDisable,
<del> MemorySwappiness: flSwappiness,
<add> MemorySwappiness: swappiness,
<ide> Privileged: *flPrivileged,
<ide> PortBindings: portBindings,
<ide> Links: flLinks.GetAll(), | 3 |
Javascript | Javascript | clockwise full ellipse | 1d7b7f74cfba5adb85770464b96b6d98daf9985f | <ide><path>src/extras/curves/EllipseCurve.js
<ide> THREE.EllipseCurve.prototype.getPoint = function( t ) {
<ide>
<ide> }
<ide>
<del> if ( this.aClockwise === true && deltaAngle != twoPi && ! samePoints ) {
<add> if ( this.aClockwise === true && ! samePoints ) {
<ide>
<del> deltaAngle = deltaAngle - twoPi;
<add> if ( deltaAngle === twoPi ) {
<add>
<add> deltaAngle = - twoPi;
<add>
<add> } else {
<add>
<add> deltaAngle = deltaAngle - twoPi;
<add>
<add> }
<ide>
<ide> }
<ide> | 1 |
Text | Text | fix broken links in benchmark readme | 5688eb8f83646a8c4896d5b81086377eb5092b3e | <ide><path>benchmark/README.md
<ide> writing benchmarks.
<ide>
<ide> ### `createBenchmark(fn, configs[, options])`
<ide>
<del>See [the guide on writing benchmarks](../doc/guides/contributing/writing-and-running-benchmarks.md#basics-of-a-benchmark).
<add>See [the guide on writing benchmarks](../doc/guides/writing-and-running-benchmarks.md#basics-of-a-benchmark).
<ide>
<ide> ### `default_http_benchmarker`
<ide>
<ide> The default benchmarker used to run HTTP benchmarks.
<del>See [the guide on writing HTTP benchmarks](../doc/guides/contributing/writing-and-running-benchmarks.md#creating-an-http-benchmark).
<add>See [the guide on writing HTTP benchmarks](../doc/guides/writing-and-running-benchmarks.md#creating-an-http-benchmark).
<ide>
<ide> ### `PORT`
<ide>
<ide> The default port used to run HTTP benchmarks.
<del>See [the guide on writing HTTP benchmarks](../doc/guides/contributing/writing-and-running-benchmarks.md#creating-an-http-benchmark).
<add>See [the guide on writing HTTP benchmarks](../doc/guides/writing-and-running-benchmarks.md#creating-an-http-benchmark).
<ide>
<ide> ### `sendResult(data)`
<ide> | 1 |
PHP | PHP | fix redis job php doc | bdfc993c0a5e547d01f76818e439d715a345a1e9 | <ide><path>src/Illuminate/Queue/Jobs/RedisJob.php
<ide> public function getJobId()
<ide> /**
<ide> * Get the underlying Redis factory implementation.
<ide> *
<del> * @return \Illuminate\Contracts\Redis\Factory
<add> * @return \Illuminate\Queue\RedisQueue
<ide> */
<ide> public function getRedisQueue()
<ide> { | 1 |
Ruby | Ruby | freeze static arguments for gsub | 58d75fd8112d27c0f4bdd004e10b4f4e8b350595 | <ide><path>actionpack/lib/action_controller/metal/http_authentication.rb
<ide> def encode_credentials(user_name, password)
<ide> end
<ide>
<ide> def authentication_request(controller, realm)
<del> controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub('"', "")}")
<add> controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub('"'.freeze, "".freeze)}")
<ide> controller.status = 401
<ide> controller.response_body = "HTTP Basic: Access denied.\n"
<ide> end
<ide> def encode_credentials(token, options = {})
<ide> #
<ide> # Returns nothing.
<ide> def authentication_request(controller, realm)
<del> controller.headers["WWW-Authenticate"] = %(Token realm="#{realm.gsub('"', "")}")
<add> controller.headers["WWW-Authenticate"] = %(Token realm="#{realm.gsub('"'.freeze, "".freeze)}")
<ide> controller.__send__ :render, :text => "HTTP Token: Access denied.\n", :status => :unauthorized
<ide> end
<ide> end
<ide><path>actionpack/lib/action_controller/metal/live.rb
<ide> def perform_write(json, options)
<ide> end
<ide> end
<ide>
<del> message = json.gsub("\n", "\ndata: ")
<add> message = json.gsub("\n".freeze, "\ndata: ".freeze)
<ide> @stream.write "data: #{message}\n\n"
<ide> end
<ide> end
<ide><path>actionview/lib/action_view/template/handlers/raw.rb
<ide> module ActionView
<ide> module Template::Handlers
<ide> class Raw
<ide> def call(template)
<del> escaped = template.source.gsub(':', '\:')
<add> escaped = template.source.gsub(':'.freeze, '\:'.freeze)
<ide>
<ide> '%q:' + escaped + ':;'
<ide> end
<ide><path>activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
<ide> def self.add_right_association(name, options)
<ide>
<ide> def middle_reflection(join_model)
<ide> middle_name = [lhs_model.name.downcase.pluralize,
<del> association_name].join('_').gsub('::', '_').to_sym
<add> association_name].join('_'.freeze).gsub('::'.freeze, '_'.freeze).to_sym
<ide> middle_options = middle_options join_model
<ide>
<ide> HasMany.create_reflection(lhs_model,
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
<ide> def fetch_type_metadata(sql_type)
<ide> # Quotes a string, escaping any ' (single quote) and \ (backslash)
<ide> # characters.
<ide> def quote_string(s)
<del> s.gsub('\\', '\&\&').gsub("'", "''") # ' (for ruby-mode)
<add> s.gsub('\\'.freeze, '\&\&'.freeze).gsub("'".freeze, "''".freeze) # ' (for ruby-mode)
<ide> end
<ide>
<ide> # Quotes the column name. Defaults to no quoting.
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
<ide> def extract_value_from_default(default) # :nodoc:
<ide> case default
<ide> # Quoted types
<ide> when /\A[\(B]?'(.*)'::/m
<del> $1.gsub("''", "'")
<add> $1.gsub("''".freeze, "'".freeze)
<ide> # Boolean types
<del> when 'true', 'false'
<add> when 'true'.freeze, 'false'.freeze
<ide> default
<ide> # Numeric types
<ide> when /\A\(?(-?\d+(\.\d*)?)\)?(::bigint)?\z/
<ide><path>activesupport/lib/active_support/inflector/methods.rb
<ide> def camelize(term, uppercase_first_letter = true)
<ide> string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { $&.downcase }
<ide> end
<ide> string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" }
<del> string.gsub!('/', '::')
<add> string.gsub!('/'.freeze, '::'.freeze)
<ide> string
<ide> end
<ide>
<ide> def camelize(term, uppercase_first_letter = true)
<ide> # camelize(underscore('SSLError')) # => "SslError"
<ide> def underscore(camel_cased_word)
<ide> return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/
<del> word = camel_cased_word.to_s.gsub('::', '/')
<add> word = camel_cased_word.to_s.gsub('::'.freeze, '/'.freeze)
<ide> word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" }
<ide> word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
<ide> word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
<ide><path>activesupport/lib/active_support/number_helper/number_to_currency_converter.rb
<ide> def convert
<ide> end
<ide>
<ide> rounded_number = NumberToRoundedConverter.convert(number, options)
<del> format.gsub('%n', rounded_number).gsub('%u', options[:unit])
<add> format.gsub('%n'.freeze, rounded_number).gsub('%u'.freeze, options[:unit])
<ide> end
<ide>
<ide> private
<ide><path>activesupport/lib/active_support/number_helper/number_to_human_converter.rb
<ide> def convert # :nodoc:
<ide> unit = determine_unit(units, exponent)
<ide>
<ide> rounded_number = NumberToRoundedConverter.convert(number, options)
<del> format.gsub('%n', rounded_number).gsub('%u', unit).strip
<add> format.gsub('%n'.freeze, rounded_number).gsub('%u'.freeze, unit).strip
<ide> end
<ide>
<ide> private
<ide><path>activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb
<ide> def convert
<ide> human_size = number / (base ** exponent)
<ide> number_to_format = NumberToRoundedConverter.convert(human_size, options)
<ide> end
<del> conversion_format.gsub('%n', number_to_format).gsub('%u', unit)
<add> conversion_format.gsub('%n'.freeze, number_to_format).gsub('%u'.freeze, unit)
<ide> end
<ide>
<ide> private
<ide><path>activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb
<ide> class NumberToPercentageConverter < NumberConverter # :nodoc:
<ide>
<ide> def convert
<ide> rounded_number = NumberToRoundedConverter.convert(number, options)
<del> options[:format].gsub('%n', rounded_number)
<add> options[:format].gsub('%n'.freeze, rounded_number)
<ide> end
<ide> end
<ide> end | 11 |
PHP | PHP | apply fixes from styleci | a472d71fdfeb3e02a5e487e6fa395f7ea56d20ed | <ide><path>src/Illuminate/Console/Scheduling/Schedule.php
<ide> namespace Illuminate\Console\Scheduling;
<ide>
<ide> use DateTimeInterface;
<del>use Illuminate\Support\Carbon;
<ide> use Illuminate\Console\Application;
<ide> use Illuminate\Container\Container;
<ide> use Illuminate\Contracts\Queue\ShouldQueue; | 1 |
Text | Text | add install step to "compile from source" | c0b76f4c19ea8e5d50ac327874a34155b91d129f | <ide><path>website/docs/usage/index.md
<ide> $ source .env/bin/activate # activate virtual env
<ide> $ export PYTHONPATH=`pwd` # set Python path to spaCy dir
<ide> $ pip install -r requirements.txt # install all requirements
<ide> $ python setup.py build_ext --inplace # compile spaCy
<add>$ python setup.py install # install spaCy
<ide> ```
<ide>
<ide> Compared to regular install via pip, the | 1 |
Ruby | Ruby | fix fixture tests that replace connection handler | 79744bc3350bf2eb158a4db5f333dc9a64401fd1 | <ide><path>activerecord/test/cases/fixtures_test.rb
<ide> def setup
<ide> @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config
<ide> db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(ENV["RAILS_ENV"], "readonly", readonly_config)
<ide>
<add> teardown_shared_connection_pool
<add>
<ide> handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
<del> handler.establish_connection(db_config)
<ide> ActiveRecord::Base.connection_handler = handler
<add> handler.establish_connection(db_config)
<ide>
<ide> ActiveRecord::Base.connects_to(database: { writing: :default, reading: :readonly })
<ide>
<ide> def setup
<ide> @prev_configs, ActiveRecord::Base.configurations = ActiveRecord::Base.configurations, config
<ide> db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(ENV["RAILS_ENV"], "readonly", readonly_config)
<ide>
<add> teardown_shared_connection_pool
<add>
<ide> handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
<add> ActiveRecord::Base.connection_handler = handler
<ide> handler.establish_connection(db_config)
<ide> assert_deprecated do
<ide> ActiveRecord::Base.connection_handlers = {}
<ide> end
<del> ActiveRecord::Base.connection_handler = handler
<ide> ActiveRecord::Base.connects_to(database: { writing: :default, reading: :readonly })
<ide>
<ide> setup_shared_connection_pool | 1 |
Javascript | Javascript | switch ios focus/blur calls to use new commands | da9364fa3e2e78ed3e06d469af8414933611501b | <ide><path>Libraries/Components/TextInput/TextInputState.js
<ide>
<ide> const React = require('react');
<ide> const Platform = require('../../Utilities/Platform');
<del>const UIManager = require('../../ReactNative/UIManager');
<ide> const {findNodeHandle} = require('../../Renderer/shims/ReactNative');
<ide> import {Commands as AndroidTextInputCommands} from '../../Components/TextInput/AndroidTextInputNativeComponent';
<add>import {Commands as iOSTextInputCommands} from '../../Components/TextInput/RCTSingelineTextInputNativeComponent';
<ide>
<ide> import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
<ide> type ComponentRef = React.ElementRef<HostComponent<mixed>>;
<ide> function focusTextInput(textField: ?ComponentRef) {
<ide> }
<ide>
<ide> if (currentlyFocusedInputRef !== textField && textField != null) {
<del> const textFieldID = findNodeHandle(textField);
<ide> focusInput(textField);
<ide> if (Platform.OS === 'ios') {
<del> UIManager.focus(textFieldID);
<add> // This isn't necessarily a single line text input
<add> // But commands don't actually care as long as the thing being passed in
<add> // actually has a command with that name. So this should work with single
<add> // and multiline text inputs. Ideally we'll merge them into one component
<add> // in the future.
<add> iOSTextInputCommands.focus(textField);
<ide> } else if (Platform.OS === 'android') {
<ide> AndroidTextInputCommands.focus(textField);
<ide> }
<ide> function blurTextInput(textField: ?ComponentRef) {
<ide> }
<ide>
<ide> if (currentlyFocusedInputRef === textField && textField != null) {
<del> const textFieldID = findNodeHandle(textField);
<ide> blurInput(textField);
<ide> if (Platform.OS === 'ios') {
<del> UIManager.blur(textFieldID);
<add> // This isn't necessarily a single line text input
<add> // But commands don't actually care as long as the thing being passed in
<add> // actually has a command with that name. So this should work with single
<add> // and multiline text inputs. Ideally we'll merge them into one component
<add> // in the future.
<add> iOSTextInputCommands.blur(textField);
<ide> } else if (Platform.OS === 'android') {
<ide> AndroidTextInputCommands.blur(textField);
<ide> } | 1 |
Javascript | Javascript | fix lint problem | 544fee4658550fbe279942d9b7ce11a2782ccd97 | <ide><path>benchmark/createTestCases.js
<ide> createTree(fs, 5000, `${root}/modules-5000`);
<ide> function createTree(fs, count, folder) {
<ide> fs.mkdirSync(folder);
<ide> let remaining = count - 1;
<add>
<ide> function make(prefix, count, depth) {
<ide> if(count === 0) {
<ide> fs.writeFileSync(`${folder}/${prefix}.js`, `export default 1;\n${avgJs}`); | 1 |
Text | Text | add v3.27.2 to changelog.md | d252b96f36d1faf2844df3776697467d0a6789f4 | <ide><path>CHANGELOG.md
<ide>
<ide> - [#19472](https://github.com/emberjs/ember.js/pull/19472) [BUGFIX] Prevent transformation of block params called `attrs`
<ide>
<add>### v3.27.2 (May 27, 2021)
<add>
<add>- [#19511](https://github.com/emberjs/ember.js/pull/19511) / [#19548](https://github.com/emberjs/ember.js/pull/19548) [BUGFIX] Makes the (hash) helper lazy
<add>- [#19530](https://github.com/emberjs/ember.js/pull/19530) [DOC] fix passing params to named blocks examples
<add>- [#19536](https://github.com/emberjs/ember.js/pull/19536) [BUGFIX] Fix `computed.*` deprecation message to include the correct import path
<add>- [#19544](https://github.com/emberjs/ember.js/pull/19544) [BUGFIX] Use explicit this in helper test blueprints
<add>- [#19555](https://github.com/emberjs/ember.js/pull/19555) [BUGFIX] Improve class based tranform deprecation message
<add>- [#19557](https://github.com/emberjs/ember.js/pull/19557) [BUGFIX] Refine Ember Global deprecation message
<add>- [#19564](https://github.com/emberjs/ember.js/pull/19564) [BUGFIX] Improve computed.* and run.* deprecation message (IE11)
<add>
<ide> ### v3.27.1 (May 13, 2021)
<ide>
<ide> - [#19540](https://github.com/emberjs/ember.js/pull/19540) [BUGFIX] Ensure ember-testing is loaded lazily | 1 |
Javascript | Javascript | ignore empty strings for text selection | 9ba08f2c3dc2a055cfdb5033b515d33ae278ab99 | <ide><path>web/viewer.js
<ide> var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) {
<ide>
<ide> for (var i = 0, ii = textDivs.length; i < ii; i++) {
<ide> var textDiv = textDivs[i];
<add> if ('isWhitespace' in textDiv.dataset) {
<add> continue;
<add> }
<ide> textLayerFrag.appendChild(textDiv);
<ide>
<ide> ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
<ide> var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) {
<ide> for (var i = 0; i < bidiTexts.length; i++) {
<ide> var bidiText = bidiTexts[i];
<ide> var textDiv = textDivs[i];
<add> if (!/\S/.test(bidiText.str)) {
<add> textDiv.dataset.isWhitespace = true;
<add> continue;
<add> }
<ide>
<ide> textDiv.textContent = bidiText.str;
<ide> textDiv.dir = bidiText.ltr ? 'ltr' : 'rtl'; | 1 |
Ruby | Ruby | remove glide_home cache directories | 5efb158860d0a919587c52e65e651153cda9a887 | <ide><path>Library/Homebrew/cleanup.rb
<ide> def self.cleanup_cache(cache = HOMEBREW_CACHE)
<ide> cleanup_path(path) { path.unlink }
<ide> next
<ide> end
<del> if %w[java_cache npm_cache].include?(path.basename.to_s) && path.directory?
<add> if %w[glide_home java_cache npm_cache].include?(path.basename.to_s) && path.directory?
<ide> cleanup_path(path) { FileUtils.rm_rf path }
<ide> next
<ide> end | 1 |
Mixed | Ruby | update schema.rb documentation [ci skip] | 84718df86097442f85999d6f2e6f6b8b59724c3f | <ide><path>activerecord/lib/active_record/schema_dumper.rb
<ide> def header(stream)
<ide> # of editing this file, please use the migrations feature of Active Record to
<ide> # incrementally modify your database, and then regenerate this schema definition.
<ide> #
<del># Note that this schema.rb definition is the authoritative source for your
<del># database schema. If you need to create the application database on another
<del># system, you should be using db:schema:load, not running all the migrations
<del># from scratch. The latter is a flawed and unsustainable approach (the more migrations
<del># you'll amass, the slower it'll run and the greater likelihood for issues).
<add># This file is the source Rails uses to define your schema when running `rails
<add># db:schema:load`. When creating a new database, `rails db:schema:load` tends to
<add># be faster and is potentially less error prone than running all of your
<add># migrations from scratch. Old migrations may fail to apply correctly if those
<add># migrations use external dependencies or application code.
<ide> #
<ide> # It's strongly recommended that you check this file into your version control system.
<ide>
<ide><path>guides/source/active_record_migrations.md
<ide> Schema Dumping and You
<ide> ### What are Schema Files for?
<ide>
<ide> Migrations, mighty as they may be, are not the authoritative source for your
<del>database schema. That role falls to either `db/schema.rb` or an SQL file which
<del>Active Record generates by examining the database. They are not designed to be
<del>edited, they just represent the current state of the database.
<add>database schema. Your database remains the authoritative source. By default,
<add>Rails generates `db/schema.rb` which attempts to capture the current state of
<add>your database schema.
<ide>
<del>There is no need (and it is error prone) to deploy a new instance of an app by
<del>replaying the entire migration history. It is much simpler and faster to just
<del>load into the database a description of the current schema.
<del>
<del>For example, this is how the test database is created: the current development
<del>database is dumped (either to `db/schema.rb` or `db/structure.sql`) and then
<del>loaded into the test database.
<add>It tends to be faster and less error prone to create a new instance of your
<add>application's database by loading the schema file via `rails db:schema:load`
<add>than it is to replay the entire migration history. Old migrations may fail to
<add>apply correctly if those migrations use changing external dependencies or rely
<add>on application code which evolves separately from your migrations.
<ide>
<ide> Schema files are also useful if you want a quick look at what attributes an
<ide> Active Record object has. This information is not in the model's code and is
<ide> frequently spread across several migrations, but the information is nicely
<del>summed up in the schema file. The
<del>[annotate_models](https://github.com/ctran/annotate_models) gem automatically
<del>adds and updates comments at the top of each model summarizing the schema if
<del>you desire that functionality.
<add>summed up in the schema file.
<ide>
<ide> ### Types of Schema Dumps
<ide>
<del>There are two ways to dump the schema. This is set in `config/application.rb`
<del>by the `config.active_record.schema_format` setting, which may be either `:sql`
<del>or `:ruby`.
<add>The format of the schema dump generated by Rails is controlled by the
<add>`config.active_record.schema_format` setting in `config/application.rb`. By
<add>default, the format is `:ruby`, but can also be set to `:sql`.
<ide>
<ide> If `:ruby` is selected, then the schema is stored in `db/schema.rb`. If you look
<del>at this file you'll find that it looks an awful lot like one very big
<del>migration:
<add>at this file you'll find that it looks an awful lot like one very big migration:
<ide>
<ide> ```ruby
<ide> ActiveRecord::Schema.define(version: 20080906171750) do
<ide> end
<ide>
<ide> In many ways this is exactly what it is. This file is created by inspecting the
<ide> database and expressing its structure using `create_table`, `add_index`, and so
<del>on. Because this is database-independent, it could be loaded into any database
<del>that Active Record supports. This could be very useful if you were to
<del>distribute an application that is able to run against multiple databases.
<del>
<del>NOTE: `db/schema.rb` cannot express database specific items such as triggers,
<del>sequences, stored procedures or check constraints, etc. Please note that while
<del>custom SQL statements can be run in migrations, these statements cannot be reconstituted
<del>by the schema dumper. If you are using features like this, then you
<del>should set the schema format to `:sql`.
<del>
<del>Instead of using Active Record's schema dumper, the database's structure will
<del>be dumped using a tool specific to the database (via the `db:structure:dump`
<del>rails task) into `db/structure.sql`. For example, for PostgreSQL, the `pg_dump`
<del>utility is used. For MySQL and MariaDB, this file will contain the output of
<del>`SHOW CREATE TABLE` for the various tables.
<del>
<del>Loading these schemas is simply a question of executing the SQL statements they
<del>contain. By definition, this will create a perfect copy of the database's
<del>structure. Using the `:sql` schema format will, however, prevent loading the
<del>schema into a RDBMS other than the one used to create it.
<add>on.
<add>
<add>`db/schema.rb` cannot express everything your database may support such as
<add>triggers, sequences, stored procedures, check constraints, etc. While migrations
<add>may use `execute` to create database constructs that are not supported by the
<add>Ruby migration DSL, these constructs may not be able to be reconstituted by the
<add>schema dumper. If you are using features like these, you should set the schema
<add>format to `:sql` in order to get an accurate schema file that is useful to
<add>create new database instances.
<add>
<add>When the schema format is set to `:sql`, the database structure will be dumped
<add>using a tool specific to the database into `db/structure.sql`. For example, for
<add>PostgreSQL, the `pg_dump` utility is used. For MySQL and MariaDB, this file will
<add>contain the output of `SHOW CREATE TABLE` for the various tables.
<add>
<add>To load the schema from `db/strcuture.sql`, run `rails db:structure:load`.
<add>Loading this file is done by executing the SQL statements it contains. By
<add>definition, this will create a perfect copy of the database's structure.
<ide>
<ide> ### Schema Dumps and Source Control
<ide>
<del>Because schema dumps are the authoritative source for your database schema, it
<del>is strongly recommended that you check them into source control.
<add>Because schema files are commonly used to create new databases, it is strongly
<add>recommended that you check your schema file into source control.
<ide>
<del>`db/schema.rb` contains the current version number of the database. This
<del>ensures conflicts are going to happen in the case of a merge where both
<del>branches touched the schema. When that happens, solve conflicts manually,
<del>keeping the highest version number of the two.
<add>Merge conflicts can occur in your schema file when two branches modify schema.
<add>To resolve these conflicts run `rails db:migrate` to regenerate the schema file.
<ide>
<ide> Active Record and Referential Integrity
<ide> --------------------------------------- | 2 |
Javascript | Javascript | add deprecation warning for maskedviewios | 4ac65f5413ee59f7546b88a2eae2c4ce6fa8826b | <ide><path>Libraries/react-native/react-native-implementation.js
<ide> module.exports = {
<ide> return require('ListView');
<ide> },
<ide> get MaskedViewIOS() {
<add> warnOnce(
<add> 'maskedviewios-moved',
<add> 'MaskedViewIOS has been extracted from react-native core and will be removed in a future release. ' +
<add> "It can now be installed and imported from '@react-native-community/masked-view' instead of 'react-native'. " +
<add> 'See https://github.com/react-native-community/react-native-masked-view',
<add> );
<ide> return require('MaskedViewIOS');
<ide> },
<ide> get Modal() { | 1 |
Python | Python | remove braindead test | 3bae2867e91443e8cb2d64072d77c6a22ba6ee82 | <ide><path>rest_framework/tests/package.py
<del>"""Tests for the rest_framework package setup."""
<del>from django.test import TestCase
<del>import rest_framework
<del>
<del>class TestVersion(TestCase):
<del> """Simple sanity test to check the VERSION exists"""
<del>
<del> def test_version(self):
<del> """Ensure the VERSION exists."""
<del> rest_framework.VERSION
<del> | 1 |
Javascript | Javascript | improve error message for missing itemview | 1af8166a2e53287426aeb06a1cc922a30a58f2f1 | <ide><path>packages/container/lib/main.js
<ide> define("container",
<ide> return this.resolver(fullName) || this.registry.get(fullName);
<ide> },
<ide>
<add> /**
<add> A hook that can be used to describe how the resolver will
<add> attempt to find the factory.
<add>
<add> For example, the default Ember `.describe` returns the full
<add> class name (including namespace) where Ember's resolver expects
<add> to find the `fullName`.
<add>
<add> @method describe
<add> */
<add> describe: function(fullName) {
<add> return fullName;
<add> },
<add>
<ide> /**
<ide> A hook to enable custom fullName normalization behaviour
<ide>
<ide><path>packages/ember-application/lib/system/application.js
<ide> Ember.Application.reopenClass({
<ide> container.set = Ember.set;
<ide> container.normalize = normalize;
<ide> container.resolver = resolverFor(namespace);
<add> container.describe = container.resolver.describe;
<ide> container.optionsForType('view', { singleton: false });
<ide> container.optionsForType('template', { instantiate: false });
<ide> container.register('application:main', namespace, { instantiate: false });
<ide> function resolverFor(namespace) {
<ide> var resolver = resolverClass.create({
<ide> namespace: namespace
<ide> });
<del> return function(fullName) {
<add>
<add> function resolve(fullName) {
<ide> return resolver.resolve(fullName);
<add> }
<add>
<add> resolve.describe = function(fullName) {
<add> return resolver.lookupDescription(fullName);
<ide> };
<add>
<add> return resolve;
<ide> }
<ide>
<ide> function normalize(fullName) {
<ide><path>packages/ember-application/lib/system/resolver.js
<ide> Ember.DefaultResolver = Ember.Object.extend({
<ide> var className = classify(parsedName.name) + classify(parsedName.type),
<ide> factory = get(parsedName.root, className);
<ide> if (factory) { return factory; }
<add> },
<add>
<add> lookupDescription: function(name) {
<add> var parsedName = this.parseName(name);
<add>
<add> if (parsedName.type === 'template') {
<add> return "template at " + parsedName.fullNameWithoutType.replace(/\./g, '/');
<add> }
<add>
<add> var description = parsedName.root + "." + classify(parsedName.name);
<add> if (parsedName.type !== 'model') { description += classify(parsedName.type); }
<add>
<add> return description;
<ide> }
<ide> });
<ide><path>packages/ember-handlebars-compiler/lib/main.js
<ide> Ember.Handlebars.helper = function(name, value) {
<ide>
<ide> if (Ember.View.detect(value)) {
<ide> Ember.Handlebars.registerHelper(name, function(options) {
<del> Ember.assert("You can only pass attributes as parameters (not values) to a application-defined helper", arguments.length < 2);
<add> Ember.assert("You can only pass attributes (such as name=value) not bare values to a helper for a View", arguments.length < 2);
<ide> makeBindings(options);
<ide> return Ember.Handlebars.helpers.view.call(this, value, options);
<ide> });
<ide><path>packages/ember-handlebars/lib/helpers/binding.js
<ide> EmberHandlebars.registerHelper('bindAttr', function(options) {
<ide> var path = attrs[attr],
<ide> normalized;
<ide>
<del> Ember.assert(fmt("You must provide a String for a bound attribute, not %@", [path]), typeof path === 'string');
<add> Ember.assert(fmt("You must provide an expression as the value of bound attribute. You specified: %@=%@", [attr, path]), typeof path === 'string');
<ide>
<ide> normalized = normalizePath(ctx, path, options.data);
<ide>
<ide><path>packages/ember-handlebars/lib/helpers/collection.js
<ide> Ember.Handlebars.registerHelper('collection', function(path, options) {
<ide>
<ide> if (hash.itemView) {
<ide> var controller = data.keywords.controller;
<del> Ember.assert('itemView given, but no container is available', controller && controller.container);
<add> Ember.assert('You specified an itemView, but the current context has no container to look the itemView up in. This probably means that you created a view manually, instead of through the container. Instead, use container.lookup("view:viewName"), which will properly instantiate your view.', controller && controller.container);
<ide> var container = controller.container;
<ide> itemViewClass = container.resolve('view:' + Ember.String.camelize(hash.itemView));
<del> Ember.assert('itemView not found in container', !!itemViewClass);
<add> Ember.assert('You specified the itemView ' + hash.itemView + ", but it was not found at " + container.describe("view:" + hash.itemView) + " (and it was not registered in the container)", !!itemViewClass);
<ide> } else if (hash.itemViewClass) {
<ide> itemViewClass = handlebarsGet(collectionPrototype, hash.itemViewClass, options);
<ide> } else { | 6 |
Javascript | Javascript | remove syntheticevent subtypes | 76ce685d0fc7821a6c8be486d7cbb2c3d22f6fb7 | <ide><path>packages/react-dom/src/events/SyntheticEvent.js
<ide> import getEventCharCode from './getEventCharCode';
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/
<ide> */
<ide> const EventInterface = {
<del> type: null,
<del> target: null,
<del> // currentTarget is set when dispatching; no use in copying it here
<del> currentTarget: function() {
<del> return null;
<del> },
<del> eventPhase: null,
<del> bubbles: null,
<del> cancelable: null,
<add> type: 0,
<add> eventPhase: 0,
<add> bubbles: 0,
<add> cancelable: 0,
<ide> timeStamp: function(event) {
<ide> return event.timeStamp || Date.now();
<ide> },
<del> defaultPrevented: null,
<del> isTrusted: null,
<add> defaultPrevented: 0,
<add> isTrusted: 0,
<ide> };
<ide>
<ide> function functionThatReturnsTrue() {
<ide> export function SyntheticEvent(
<ide> targetInst,
<ide> nativeEvent,
<ide> nativeEventTarget,
<add> Interface = EventInterface,
<ide> ) {
<ide> this._reactName = reactName;
<ide> this._targetInst = targetInst;
<ide> this.nativeEvent = nativeEvent;
<add> this.target = nativeEventTarget;
<add> this.currentTarget = null;
<ide>
<del> const Interface = this.constructor.Interface;
<ide> for (const propName in Interface) {
<ide> if (!Interface.hasOwnProperty(propName)) {
<ide> continue;
<ide> export function SyntheticEvent(
<ide> if (normalize) {
<ide> this[propName] = normalize(nativeEvent);
<ide> } else {
<del> if (propName === 'target') {
<del> this.target = nativeEventTarget;
<del> } else {
<del> this[propName] = nativeEvent[propName];
<del> }
<add> this[propName] = nativeEvent[propName];
<ide> }
<ide> }
<ide>
<ide> Object.assign(SyntheticEvent.prototype, {
<ide> isPersistent: functionThatReturnsTrue,
<ide> });
<ide>
<del>SyntheticEvent.Interface = EventInterface;
<del>
<del>/**
<del> * Helper to reduce boilerplate when creating subclasses.
<del> */
<del>SyntheticEvent.extend = function(Interface) {
<del> const Super = this;
<del>
<del> const E = function() {};
<del> E.prototype = Super.prototype;
<del> const prototype = new E();
<del>
<del> function Class() {
<del> return Super.apply(this, arguments);
<del> }
<del> Object.assign(prototype, Class.prototype);
<del> Class.prototype = prototype;
<del> Class.prototype.constructor = Class;
<del>
<del> Class.Interface = Object.assign({}, Super.Interface, Interface);
<del> Class.extend = Super.extend;
<del>
<del> return Class;
<add>export const UIEventInterface = {
<add> ...EventInterface,
<add> view: 0,
<add> detail: 0,
<ide> };
<ide>
<del>export const SyntheticUIEvent = SyntheticEvent.extend({
<del> view: null,
<del> detail: null,
<del>});
<del>
<ide> let previousScreenX = 0;
<ide> let previousScreenY = 0;
<ide> // Use flags to signal movementX/Y has already been set
<ide> let isMovementYSet = false;
<ide> * @interface MouseEvent
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/
<ide> */
<del>export const SyntheticMouseEvent = SyntheticUIEvent.extend({
<del> screenX: null,
<del> screenY: null,
<del> clientX: null,
<del> clientY: null,
<del> pageX: null,
<del> pageY: null,
<del> ctrlKey: null,
<del> shiftKey: null,
<del> altKey: null,
<del> metaKey: null,
<add>export const MouseEventInterface = {
<add> ...UIEventInterface,
<add> screenX: 0,
<add> screenY: 0,
<add> clientX: 0,
<add> clientY: 0,
<add> pageX: 0,
<add> pageY: 0,
<add> ctrlKey: 0,
<add> shiftKey: 0,
<add> altKey: 0,
<add> metaKey: 0,
<ide> getModifierState: getEventModifierState,
<del> button: null,
<del> buttons: null,
<add> button: 0,
<add> buttons: 0,
<ide> relatedTarget: function(event) {
<ide> return (
<ide> event.relatedTarget ||
<ide> export const SyntheticMouseEvent = SyntheticUIEvent.extend({
<ide>
<ide> return event.type === 'mousemove' ? event.screenY - screenY : 0;
<ide> },
<del>});
<add>};
<ide>
<ide> /**
<ide> * @interface DragEvent
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/
<ide> */
<del>export const SyntheticDragEvent = SyntheticMouseEvent.extend({
<del> dataTransfer: null,
<del>});
<add>export const DragEventInterface = {
<add> ...MouseEventInterface,
<add> dataTransfer: 0,
<add>};
<ide>
<ide> /**
<ide> * @interface FocusEvent
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/
<ide> */
<del>export const SyntheticFocusEvent = SyntheticUIEvent.extend({
<del> relatedTarget: null,
<del>});
<add>export const FocusEventInterface = {
<add> ...UIEventInterface,
<add> relatedTarget: 0,
<add>};
<ide>
<ide> /**
<ide> * @interface Event
<ide> * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
<ide> * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
<ide> */
<del>export const SyntheticAnimationEvent = SyntheticEvent.extend({
<del> animationName: null,
<del> elapsedTime: null,
<del> pseudoElement: null,
<del>});
<add>export const AnimationEventInterface = {
<add> ...EventInterface,
<add> animationName: 0,
<add> elapsedTime: 0,
<add> pseudoElement: 0,
<add>};
<ide>
<ide> /**
<ide> * @interface Event
<ide> * @see http://www.w3.org/TR/clipboard-apis/
<ide> */
<del>export const SyntheticClipboardEvent = SyntheticEvent.extend({
<add>export const ClipboardEventInterface = {
<add> ...EventInterface,
<ide> clipboardData: function(event) {
<ide> return 'clipboardData' in event
<ide> ? event.clipboardData
<ide> : window.clipboardData;
<ide> },
<del>});
<add>};
<ide>
<ide> /**
<ide> * @interface Event
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
<ide> */
<del>export const SyntheticCompositionEvent = SyntheticEvent.extend({
<del> data: null,
<del>});
<add>export const CompositionEventInterface = {
<add> ...EventInterface,
<add> data: 0,
<add>};
<ide>
<ide> /**
<ide> * @interface Event
<ide> * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
<ide> * /#events-inputevents
<ide> */
<del>export const SyntheticInputEvent = SyntheticEvent.extend({
<del> data: null,
<del>});
<add>// Happens to share the same list for now.
<add>export const InputEventInterface = CompositionEventInterface;
<ide>
<ide> /**
<ide> * Normalization of deprecated HTML5 `key` values
<ide> function getEventModifierState(nativeEvent) {
<ide> * @interface KeyboardEvent
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/
<ide> */
<del>export const SyntheticKeyboardEvent = SyntheticUIEvent.extend({
<add>export const KeyboardEventInterface = {
<add> ...UIEventInterface,
<ide> key: getEventKey,
<del> code: null,
<del> location: null,
<del> ctrlKey: null,
<del> shiftKey: null,
<del> altKey: null,
<del> metaKey: null,
<del> repeat: null,
<del> locale: null,
<add> code: 0,
<add> location: 0,
<add> ctrlKey: 0,
<add> shiftKey: 0,
<add> altKey: 0,
<add> metaKey: 0,
<add> repeat: 0,
<add> locale: 0,
<ide> getModifierState: getEventModifierState,
<ide> // Legacy Interface
<ide> charCode: function(event) {
<ide> export const SyntheticKeyboardEvent = SyntheticUIEvent.extend({
<ide> }
<ide> return 0;
<ide> },
<del>});
<add>};
<ide>
<ide> /**
<ide> * @interface PointerEvent
<ide> * @see http://www.w3.org/TR/pointerevents/
<ide> */
<del>export const SyntheticPointerEvent = SyntheticMouseEvent.extend({
<del> pointerId: null,
<del> width: null,
<del> height: null,
<del> pressure: null,
<del> tangentialPressure: null,
<del> tiltX: null,
<del> tiltY: null,
<del> twist: null,
<del> pointerType: null,
<del> isPrimary: null,
<del>});
<add>export const PointerEventInterface = {
<add> ...MouseEventInterface,
<add> pointerId: 0,
<add> width: 0,
<add> height: 0,
<add> pressure: 0,
<add> tangentialPressure: 0,
<add> tiltX: 0,
<add> tiltY: 0,
<add> twist: 0,
<add> pointerType: 0,
<add> isPrimary: 0,
<add>};
<ide>
<ide> /**
<ide> * @interface TouchEvent
<ide> * @see http://www.w3.org/TR/touch-events/
<ide> */
<del>export const SyntheticTouchEvent = SyntheticUIEvent.extend({
<del> touches: null,
<del> targetTouches: null,
<del> changedTouches: null,
<del> altKey: null,
<del> metaKey: null,
<del> ctrlKey: null,
<del> shiftKey: null,
<add>export const TouchEventInterface = {
<add> ...UIEventInterface,
<add> touches: 0,
<add> targetTouches: 0,
<add> changedTouches: 0,
<add> altKey: 0,
<add> metaKey: 0,
<add> ctrlKey: 0,
<add> shiftKey: 0,
<ide> getModifierState: getEventModifierState,
<del>});
<add>};
<ide>
<ide> /**
<ide> * @interface Event
<ide> * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
<ide> * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
<ide> */
<del>export const SyntheticTransitionEvent = SyntheticEvent.extend({
<del> propertyName: null,
<del> elapsedTime: null,
<del> pseudoElement: null,
<del>});
<add>export const TransitionEventInterface = {
<add> ...EventInterface,
<add> propertyName: 0,
<add> elapsedTime: 0,
<add> pseudoElement: 0,
<add>};
<ide>
<ide> /**
<ide> * @interface WheelEvent
<ide> * @see http://www.w3.org/TR/DOM-Level-3-Events/
<ide> */
<del>export const SyntheticWheelEvent = SyntheticMouseEvent.extend({
<add>export const WheelEventInterface = {
<add> ...MouseEventInterface,
<ide> deltaX(event) {
<ide> return 'deltaX' in event
<ide> ? event.deltaX
<ide> export const SyntheticWheelEvent = SyntheticMouseEvent.extend({
<ide> ? -event.wheelDelta
<ide> : 0;
<ide> },
<del> deltaZ: null,
<add> deltaZ: 0,
<ide>
<ide> // Browsers without "deltaMode" is reporting in raw wheel delta where one
<ide> // notch on the scroll is always +/- 120, roughly equivalent to pixels.
<ide> // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
<ide> // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
<del> deltaMode: null,
<del>});
<add> deltaMode: 0,
<add>};
<ide><path>packages/react-dom/src/events/plugins/BeforeInputEventPlugin.js
<ide> import {
<ide> reset as FallbackCompositionStateReset,
<ide> } from '../FallbackCompositionState';
<ide> import {
<del> SyntheticCompositionEvent,
<del> SyntheticInputEvent,
<add> CompositionEventInterface,
<add> InputEventInterface,
<add> SyntheticEvent,
<ide> } from '../SyntheticEvent';
<ide> import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
<ide>
<ide> function extractCompositionEvent(
<ide> }
<ide> }
<ide>
<del> const event = new SyntheticCompositionEvent(
<add> const event = new SyntheticEvent(
<ide> eventType,
<ide> null,
<ide> nativeEvent,
<ide> nativeEventTarget,
<add> CompositionEventInterface,
<ide> );
<ide> accumulateTwoPhaseListeners(targetInst, dispatchQueue, event);
<ide>
<ide> function extractBeforeInputEvent(
<ide> return null;
<ide> }
<ide>
<del> const event = new SyntheticInputEvent(
<add> const event = new SyntheticEvent(
<ide> 'onBeforeInput',
<ide> null,
<ide> nativeEvent,
<ide> nativeEventTarget,
<add> InputEventInterface,
<ide> );
<ide> accumulateTwoPhaseListeners(targetInst, dispatchQueue, event);
<ide> event.data = chars;
<ide><path>packages/react-dom/src/events/plugins/EnterLeaveEventPlugin.js
<ide> import {
<ide> TOP_POINTER_OVER,
<ide> } from '../DOMTopLevelEventTypes';
<ide> import {IS_REPLAYED} from 'react-dom/src/events/EventSystemFlags';
<del>import {SyntheticMouseEvent, SyntheticPointerEvent} from '../SyntheticEvent';
<add>import {
<add> SyntheticEvent,
<add> MouseEventInterface,
<add> PointerEventInterface,
<add>} from '../SyntheticEvent';
<ide> import {
<ide> getClosestInstanceFromNode,
<ide> getNodeFromInstance,
<ide> function extractEvents(
<ide> let eventInterface, leaveEventType, enterEventType, eventTypePrefix;
<ide>
<ide> if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
<del> eventInterface = SyntheticMouseEvent;
<add> eventInterface = MouseEventInterface;
<ide> leaveEventType = 'onMouseLeave';
<ide> enterEventType = 'onMouseEnter';
<ide> eventTypePrefix = 'mouse';
<ide> } else if (
<ide> topLevelType === TOP_POINTER_OUT ||
<ide> topLevelType === TOP_POINTER_OVER
<ide> ) {
<del> eventInterface = SyntheticPointerEvent;
<add> eventInterface = PointerEventInterface;
<ide> leaveEventType = 'onPointerLeave';
<ide> enterEventType = 'onPointerEnter';
<ide> eventTypePrefix = 'pointer';
<ide> function extractEvents(
<ide> const fromNode = from == null ? win : getNodeFromInstance(from);
<ide> const toNode = to == null ? win : getNodeFromInstance(to);
<ide>
<del> const leave = new eventInterface(
<add> const leave = new SyntheticEvent(
<ide> leaveEventType,
<ide> from,
<ide> nativeEvent,
<ide> nativeEventTarget,
<add> eventInterface,
<ide> );
<ide> leave.type = eventTypePrefix + 'leave';
<ide> leave.target = fromNode;
<ide> leave.relatedTarget = toNode;
<ide>
<del> let enter = new eventInterface(
<add> let enter = new SyntheticEvent(
<ide> enterEventType,
<ide> to,
<ide> nativeEvent,
<ide> nativeEventTarget,
<add> eventInterface,
<ide> );
<ide> enter.type = eventTypePrefix + 'enter';
<ide> enter.target = toNode;
<ide><path>packages/react-dom/src/events/plugins/SimpleEventPlugin.js
<ide> import type {EventSystemFlags} from '../EventSystemFlags';
<ide>
<ide> import {
<ide> SyntheticEvent,
<del> SyntheticAnimationEvent,
<del> SyntheticClipboardEvent,
<del> SyntheticFocusEvent,
<del> SyntheticKeyboardEvent,
<del> SyntheticMouseEvent,
<del> SyntheticPointerEvent,
<del> SyntheticDragEvent,
<del> SyntheticTouchEvent,
<del> SyntheticTransitionEvent,
<del> SyntheticUIEvent,
<del> SyntheticWheelEvent,
<add> AnimationEventInterface,
<add> ClipboardEventInterface,
<add> FocusEventInterface,
<add> KeyboardEventInterface,
<add> MouseEventInterface,
<add> PointerEventInterface,
<add> DragEventInterface,
<add> TouchEventInterface,
<add> TransitionEventInterface,
<add> UIEventInterface,
<add> WheelEventInterface,
<ide> } from '../../events/SyntheticEvent';
<ide>
<ide> import * as DOMTopLevelEventTypes from '../DOMTopLevelEventTypes';
<ide> function extractEvents(
<ide> if (reactName === undefined) {
<ide> return;
<ide> }
<del> let EventConstructor;
<add> let EventInterface;
<ide> switch (topLevelType) {
<ide> case DOMTopLevelEventTypes.TOP_KEY_PRESS:
<ide> // Firefox creates a keypress event for function keys too. This removes
<ide> function extractEvents(
<ide> /* falls through */
<ide> case DOMTopLevelEventTypes.TOP_KEY_DOWN:
<ide> case DOMTopLevelEventTypes.TOP_KEY_UP:
<del> EventConstructor = SyntheticKeyboardEvent;
<add> EventInterface = KeyboardEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_FOCUS_IN:
<ide> case DOMTopLevelEventTypes.TOP_FOCUS_OUT:
<ide> case DOMTopLevelEventTypes.TOP_BEFORE_BLUR:
<ide> case DOMTopLevelEventTypes.TOP_AFTER_BLUR:
<del> EventConstructor = SyntheticFocusEvent;
<add> EventInterface = FocusEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_CLICK:
<ide> // Firefox creates a click event on right mouse clicks. This removes the
<ide> function extractEvents(
<ide> case DOMTopLevelEventTypes.TOP_MOUSE_OUT:
<ide> case DOMTopLevelEventTypes.TOP_MOUSE_OVER:
<ide> case DOMTopLevelEventTypes.TOP_CONTEXT_MENU:
<del> EventConstructor = SyntheticMouseEvent;
<add> EventInterface = MouseEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_DRAG:
<ide> case DOMTopLevelEventTypes.TOP_DRAG_END:
<ide> function extractEvents(
<ide> case DOMTopLevelEventTypes.TOP_DRAG_OVER:
<ide> case DOMTopLevelEventTypes.TOP_DRAG_START:
<ide> case DOMTopLevelEventTypes.TOP_DROP:
<del> EventConstructor = SyntheticDragEvent;
<add> EventInterface = DragEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_TOUCH_CANCEL:
<ide> case DOMTopLevelEventTypes.TOP_TOUCH_END:
<ide> case DOMTopLevelEventTypes.TOP_TOUCH_MOVE:
<ide> case DOMTopLevelEventTypes.TOP_TOUCH_START:
<del> EventConstructor = SyntheticTouchEvent;
<add> EventInterface = TouchEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_ANIMATION_END:
<ide> case DOMTopLevelEventTypes.TOP_ANIMATION_ITERATION:
<ide> case DOMTopLevelEventTypes.TOP_ANIMATION_START:
<del> EventConstructor = SyntheticAnimationEvent;
<add> EventInterface = AnimationEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_TRANSITION_END:
<del> EventConstructor = SyntheticTransitionEvent;
<add> EventInterface = TransitionEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_SCROLL:
<del> EventConstructor = SyntheticUIEvent;
<add> EventInterface = UIEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_WHEEL:
<del> EventConstructor = SyntheticWheelEvent;
<add> EventInterface = WheelEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_COPY:
<ide> case DOMTopLevelEventTypes.TOP_CUT:
<ide> case DOMTopLevelEventTypes.TOP_PASTE:
<del> EventConstructor = SyntheticClipboardEvent;
<add> EventInterface = ClipboardEventInterface;
<ide> break;
<ide> case DOMTopLevelEventTypes.TOP_GOT_POINTER_CAPTURE:
<ide> case DOMTopLevelEventTypes.TOP_LOST_POINTER_CAPTURE:
<ide> function extractEvents(
<ide> case DOMTopLevelEventTypes.TOP_POINTER_OUT:
<ide> case DOMTopLevelEventTypes.TOP_POINTER_OVER:
<ide> case DOMTopLevelEventTypes.TOP_POINTER_UP:
<del> EventConstructor = SyntheticPointerEvent;
<add> EventInterface = PointerEventInterface;
<ide> break;
<ide> default:
<ide> // Unknown event. This is used by createEventHandle.
<del> EventConstructor = SyntheticEvent;
<ide> break;
<ide> }
<del> const event = new EventConstructor(
<add> const event = new SyntheticEvent(
<ide> reactName,
<ide> null,
<ide> nativeEvent,
<ide> nativeEventTarget,
<add> EventInterface,
<ide> );
<ide>
<ide> const inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0; | 4 |
Text | Text | improve paragraph in esm.md | 95eecd58b39b7dbedfce509b4a38d0c18e22f7cb | <ide><path>doc/api/esm.md
<ide> as ES modules and `.cjs` files are always treated as CommonJS.
<ide> ### Package scope and file extensions
<ide>
<ide> A folder containing a `package.json` file, and all subfolders below that folder
<del>down until the next folder containing another `package.json`, is considered a
<del>_package scope_. The `"type"` field defines how `.js` files should be treated
<del>within a particular `package.json` file’s package scope. Every package in a
<add>until the next folder containing another `package.json`, are a
<add>_package scope_. The `"type"` field defines how to treat `.js` files
<add>within the package scope. Every package in a
<ide> project’s `node_modules` folder contains its own `package.json` file, so each
<del>project’s dependencies have their own package scopes. A `package.json` lacking a
<del>`"type"` field is treated as if it contained `"type": "commonjs"`.
<add>project’s dependencies have their own package scopes. If a `package.json` file
<add>does not have a `"type"` field, the default `"type"` is `"commonjs"`.
<ide>
<ide> The package scope applies not only to initial entry points (`node my-app.js`)
<ide> but also to files referenced by `import` statements and `import()` expressions. | 1 |
Javascript | Javascript | add default value to binding element | 77b9ef571b9ef1dd66e8a736a11007c799c115b7 | <ide><path>lib/ModuleBuildError.js
<ide> const WebpackError = require("./WebpackError");
<ide> const cutOffLoaderExecution = require("./ErrorHelpers").cutOffLoaderExecution;
<ide>
<ide> class ModuleBuildError extends WebpackError {
<del> constructor(module, err, { from } = {}) {
<add> constructor(module, err, { from = null } = {}) {
<ide> super();
<ide>
<ide> this.name = "ModuleBuildError";
<ide><path>lib/ModuleError.js
<ide> const WebpackError = require("./WebpackError");
<ide> const cleanUp = require("./ErrorHelpers").cleanUp;
<ide>
<ide> class ModuleError extends WebpackError {
<del> constructor(module, err, { from } = {}) {
<add> constructor(module, err, { from = null } = {}) {
<ide> super();
<ide>
<ide> this.name = "ModuleError";
<ide><path>lib/ModuleWarning.js
<ide> const WebpackError = require("./WebpackError");
<ide> const cleanUp = require("./ErrorHelpers").cleanUp;
<ide>
<ide> class ModuleWarning extends WebpackError {
<del> constructor(module, warning, { from } = {}) {
<add> constructor(module, warning, { from = null } = {}) {
<ide> super();
<ide>
<ide> this.name = "ModuleWarning"; | 3 |
Ruby | Ruby | remove the transaction_open variable | 748052a99bb3046e4cdb7f8c00457da74fbdb75b | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
<ide> module ConnectionAdapters # :nodoc:
<ide> module DatabaseStatements
<ide> def initialize
<ide> super
<del> @transaction = ClosedTransaction.new(self)
<add> reset_transaction
<ide> end
<ide>
<ide> # Converts an arel AST to SQL
<ide> def supports_statement_cache?
<ide> def transaction(options = {})
<ide> options.assert_valid_keys :requires_new, :joinable
<ide>
<del> transaction_open = false
<del>
<del> begin
<del> if options[:requires_new] || !current_transaction.joinable?
<del> begin_transaction(options)
<del> transaction_open = true
<del> end
<del>
<del> yield
<del> rescue Exception => error
<del> if !outside_transaction? && transaction_open
<del> rollback_transaction
<del> transaction_open = false
<del> end
<del>
<del> raise unless error.is_a?(ActiveRecord::Rollback)
<add> if !options[:requires_new] && current_transaction.joinable?
<add> within_existing_transaction { yield }
<add> else
<add> within_new_transaction(options) { yield }
<ide> end
<add> rescue Exception => error
<add> raise unless error.is_a?(ActiveRecord::Rollback)
<add> end
<ide>
<add> def within_new_transaction(options = {}) #:nodoc:
<add> begin_transaction(options)
<add> yield
<add> rescue Exception => error
<add> rollback_transaction unless outside_transaction?
<add> raise
<ide> ensure
<ide> if outside_transaction?
<del> @transaction = ClosedTransaction.new(self)
<del> elsif current_transaction.open? && transaction_open
<add> reset_transaction
<add> else
<ide> begin
<del> commit_transaction
<del> rescue Exception
<add> commit_transaction unless error
<add> rescue Exception => e
<ide> rollback_transaction
<ide> raise
<ide> end
<ide> end
<ide> end
<ide>
<add> def within_existing_transaction #:nodoc:
<add> yield
<add> ensure
<add> reset_transaction if outside_transaction?
<add> end
<add>
<ide> def current_transaction #:nodoc:
<ide> @transaction
<ide> end
<ide> def rollback_transaction #:nodoc:
<ide> @transaction = @transaction.rollback
<ide> end
<ide>
<add> def reset_transaction
<add> @transaction = ClosedTransaction.new(self)
<add> end
<add>
<ide> # Register a record with the current transaction so that its after_commit and after_rollback callbacks
<ide> # can be called.
<ide> def add_transaction_record(record)
<ide><path>activerecord/test/cases/transactions_test.rb
<ide> def test_open_transactions_count_is_reset_to_zero_if_no_transaction_active
<ide> assert_equal 0, Topic.connection.open_transactions
<ide> end
<ide> assert_equal 0, Topic.connection.open_transactions
<add>
<add> Topic.transaction do
<add> Topic.connection.rollback_db_transaction
<add> end
<add> assert_equal 0, Topic.connection.open_transactions
<ide> end
<ide> end
<ide> | 2 |
Java | Java | remove cookie handler on destroy | 3a00545bc77c74d4fd49584e262326d3dffabb2f | <ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java
<ide> public void loadLibrary(String libraryName) {
<ide> }
<ide>
<ide> Context context = this.getReactApplicationContext().getApplicationContext();
<del> OkHttpClient okHttpClient =
<del> OkHttpClientProvider.getCookieAwareOkHttpClient(getReactApplicationContext());
<add> OkHttpClient okHttpClient = OkHttpClientProvider.getOkHttpClient();
<ide> ImagePipelineConfig.Builder builder =
<ide> OkHttpImagePipelineConfigFactory.newBuilder(context, okHttpClient);
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java
<ide> import java.io.IOException;
<ide> import java.io.InputStream;
<ide> import java.io.Reader;
<del>import java.net.CookieHandler;
<ide>
<ide> import com.facebook.react.bridge.Arguments;
<ide> import com.facebook.react.bridge.GuardedAsyncTask;
<ide> public final class NetworkingModule extends ReactContextBaseJavaModule {
<ide> private static final int CHUNK_TIMEOUT_NS = 100 * 1000000; // 100ms
<ide>
<ide> private final OkHttpClient mClient;
<add> private final ForwardingCookieHandler mCookieHandler;
<ide> private final @Nullable String mDefaultUserAgent;
<ide> private boolean mShuttingDown;
<ide>
<ide> public final class NetworkingModule extends ReactContextBaseJavaModule {
<ide> super(reactContext);
<ide> mClient = client;
<ide> mClient.networkInterceptors().add(new StethoInterceptor());
<add> mCookieHandler = new ForwardingCookieHandler(reactContext);
<ide> mShuttingDown = false;
<ide> mDefaultUserAgent = defaultUserAgent;
<ide> }
<ide> public final class NetworkingModule extends ReactContextBaseJavaModule {
<ide> * @param context the ReactContext of the application
<ide> */
<ide> public NetworkingModule(final ReactApplicationContext context) {
<del> this(context, null, OkHttpClientProvider.getCookieAwareOkHttpClient(context));
<add> this(context, null, OkHttpClientProvider.getOkHttpClient());
<ide> }
<ide>
<ide> /**
<ide> public NetworkingModule(final ReactApplicationContext context) {
<ide> * caller does not provide one explicitly
<ide> */
<ide> public NetworkingModule(ReactApplicationContext context, String defaultUserAgent) {
<del> this(context, defaultUserAgent, OkHttpClientProvider.getCookieAwareOkHttpClient(context));
<add> this(context, defaultUserAgent, OkHttpClientProvider.getOkHttpClient());
<ide> }
<ide>
<ide> public NetworkingModule(ReactApplicationContext reactContext, OkHttpClient client) {
<ide> this(reactContext, null, client);
<ide> }
<ide>
<add> @Override
<add> public void initialize() {
<add> mClient.setCookieHandler(mCookieHandler);
<add> }
<add>
<ide> @Override
<ide> public String getName() {
<ide> return "RCTNetworking";
<ide> public void onCatalystInstanceDestroy() {
<ide> mShuttingDown = true;
<ide> mClient.cancel(null);
<ide>
<del> CookieHandler cookieHandler = mClient.getCookieHandler();
<del> if (cookieHandler instanceof ForwardingCookieHandler) {
<del> ((ForwardingCookieHandler) cookieHandler).destroy();
<del> }
<add> mCookieHandler.destroy();
<add> mClient.setCookieHandler(null);
<ide> }
<ide>
<ide> @ReactMethod
<ide> protected void doInBackgroundGuarded(Void... params) {
<ide>
<ide> @ReactMethod
<ide> public void clearCookies(com.facebook.react.bridge.Callback callback) {
<del> CookieHandler cookieHandler = mClient.getCookieHandler();
<del> if (cookieHandler instanceof ForwardingCookieHandler) {
<del> ((ForwardingCookieHandler) cookieHandler).clearCookies(callback);
<del> }
<add> mCookieHandler.clearCookies(callback);
<ide> }
<ide>
<ide> private @Nullable MultipartBuilder constructMultipartBody(
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java
<ide>
<ide> import java.util.concurrent.TimeUnit;
<ide>
<del>import com.facebook.react.bridge.ReactContext;
<del>
<ide> import com.squareup.okhttp.OkHttpClient;
<ide>
<ide> /**
<ide> public class OkHttpClientProvider {
<ide>
<ide> // Centralized OkHttpClient for all networking requests.
<ide> private static @Nullable OkHttpClient sClient;
<del> private static ForwardingCookieHandler sCookieHandler;
<ide>
<ide> public static OkHttpClient getOkHttpClient() {
<ide> if (sClient == null) {
<ide> public static OkHttpClient getOkHttpClient() {
<ide> return sClient;
<ide> }
<ide>
<del> public static OkHttpClient getCookieAwareOkHttpClient(ReactContext context) {
<del> if (sCookieHandler == null) {
<del> sCookieHandler = new ForwardingCookieHandler(context);
<del> getOkHttpClient().setCookieHandler(sCookieHandler);
<del> }
<del> return getOkHttpClient();
<del> }
<del>
<ide> private static OkHttpClient createClient() {
<ide> // TODO: #7108751 plug in stetho
<ide> OkHttpClient client = new OkHttpClient(); | 3 |
PHP | PHP | fix whitespace errors | b32273e713904c84fe18d98f189b49b83b69f1e8 | <ide><path>lib/Cake/Test/Case/BasicsTest.php
<ide> public function testH() {
<ide> 'n' => ' '
<ide> );
<ide> $this->assertEquals($expected, $result);
<del>
<add>
<ide> // Test that boolean values are not converted to strings
<ide> $result = h(false);
<ide> $this->assertFalse($result);
<ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php
<ide> public function testInputCheckboxesInLoop() {
<ide> public function testInputCheckboxWithDisabledElements() {
<ide> $options = array(1 => 'One', 2 => 'Two', '3' => 'Three');
<ide> $result = $this->Form->input('Contact.multiple', array('multiple' => 'checkbox', 'disabled' => 'disabled', 'options' => $options));
<del>
<add>
<ide> $expected = array(
<ide> array('div' => array('class' => 'input select')),
<ide> array('label' => array('for' => "ContactMultiple")),
<ide> public function testInputCheckboxWithDisabledElements() {
<ide> '/div'
<ide> );
<ide> $this->assertTags($result, $expected);
<del>
<add>
<ide> $result = $this->Form->input('Contact.multiple', array('multiple' => 'checkbox', 'disabled' => true, 'options' => $options));
<ide> $this->assertTags($result, $expected);
<del>
<add>
<ide> $disabled = array('2', 3);
<del>
<add>
<ide> $expected = array(
<ide> array('div' => array('class' => 'input select')),
<ide> array('label' => array('for' => "ContactMultiple")), | 2 |
Javascript | Javascript | simplify continuous hydration targets | ace9e8134c3080d86f20097d5ba3369e15a97a83 | <ide><path>packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js
<ide> import {createEventTarget} from 'dom-event-testing-library';
<ide> let React;
<ide> let ReactDOM;
<ide> let ReactDOMServer;
<add>let ReactTestUtils;
<ide> let Scheduler;
<ide> let Suspense;
<ide> let usePress;
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide> React = require('react');
<ide> ReactDOM = require('react-dom');
<ide> ReactDOMServer = require('react-dom/server');
<add> ReactTestUtils = require('react-dom/test-utils');
<ide> Scheduler = require('scheduler');
<ide> Suspense = React.Suspense;
<ide> usePress = require('react-interactions/events/press').usePress;
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide> document.body.removeChild(container);
<ide> });
<ide>
<del> it('hydrates the last target as higher priority for continuous events', async () => {
<add> it('hydrates the hovered targets as higher priority for continuous events', async () => {
<ide> let suspend = false;
<ide> let resolve;
<ide> let promise = new Promise(resolvePromise => (resolve = resolvePromise));
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide>
<ide> // We should prioritize hydrating D first because we clicked it.
<ide> // Next we should hydrate C since that's the current hover target.
<del> // Next it doesn't matter if we hydrate A or B first but as an
<del> // implementation detail we're currently hydrating B first since
<del> // we at one point hovered over it and we never deprioritized it.
<add> // To simplify implementation details we hydrate both B and C at
<add> // the same time since B was already scheduled.
<add> // This is ok because it will at least not continue for nested
<add> // boundary. See the next test below.
<ide> expect(Scheduler).toFlushAndYield([
<ide> 'D',
<ide> 'Clicked D',
<add> 'B', // Ideally this should be later.
<ide> 'C',
<ide> 'Hover C',
<del> 'B',
<ide> 'A',
<ide> ]);
<ide>
<ide> document.body.removeChild(container);
<ide> });
<ide>
<add> it('hydrates the last target path first for continuous events', async () => {
<add> let suspend = false;
<add> let resolve;
<add> let promise = new Promise(resolvePromise => (resolve = resolvePromise));
<add>
<add> function Child({text}) {
<add> if ((text === 'A' || text === 'D') && suspend) {
<add> throw promise;
<add> }
<add> Scheduler.unstable_yieldValue(text);
<add> return (
<add> <span
<add> onMouseEnter={e => {
<add> e.preventDefault();
<add> Scheduler.unstable_yieldValue('Hover ' + text);
<add> }}>
<add> {text}
<add> </span>
<add> );
<add> }
<add>
<add> function App() {
<add> Scheduler.unstable_yieldValue('App');
<add> return (
<add> <div>
<add> <Suspense fallback="Loading...">
<add> <Child text="A" />
<add> </Suspense>
<add> <Suspense fallback="Loading...">
<add> <div>
<add> <Suspense fallback="Loading...">
<add> <Child text="B" />
<add> </Suspense>
<add> </div>
<add> <Child text="C" />
<add> </Suspense>
<add> <Suspense fallback="Loading...">
<add> <Child text="D" />
<add> </Suspense>
<add> </div>
<add> );
<add> }
<add>
<add> let finalHTML = ReactDOMServer.renderToString(<App />);
<add>
<add> expect(Scheduler).toHaveYielded(['App', 'A', 'B', 'C', 'D']);
<add>
<add> let container = document.createElement('div');
<add> // We need this to be in the document since we'll dispatch events on it.
<add> document.body.appendChild(container);
<add>
<add> container.innerHTML = finalHTML;
<add>
<add> let spanB = container.getElementsByTagName('span')[1];
<add> let spanC = container.getElementsByTagName('span')[2];
<add> let spanD = container.getElementsByTagName('span')[3];
<add>
<add> suspend = true;
<add>
<add> // A and D will be suspended. We'll click on D which should take
<add> // priority, after we unsuspend.
<add> let root = ReactDOM.createRoot(container, {hydrate: true});
<add> root.render(<App />);
<add>
<add> // Nothing has been hydrated so far.
<add> expect(Scheduler).toHaveYielded([]);
<add>
<add> // Hover over B and then C.
<add> dispatchMouseHoverEvent(spanB, spanD);
<add> dispatchMouseHoverEvent(spanC, spanB);
<add>
<add> suspend = false;
<add> resolve();
<add> await promise;
<add>
<add> // We should prioritize hydrating D first because we clicked it.
<add> // Next we should hydrate C since that's the current hover target.
<add> // Next it doesn't matter if we hydrate A or B first but as an
<add> // implementation detail we're currently hydrating B first since
<add> // we at one point hovered over it and we never deprioritized it.
<add> expect(Scheduler).toFlushAndYield(['App', 'C', 'Hover C', 'A', 'B', 'D']);
<add>
<add> document.body.removeChild(container);
<add> });
<add>
<ide> it('hydrates the last explicitly hydrated target at higher priority', async () => {
<ide> function Child({text}) {
<ide> Scheduler.unstable_yieldValue(text);
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide> // gets highest priority followed by the next added.
<ide> expect(Scheduler).toFlushAndYield(['App', 'C', 'B', 'A']);
<ide> });
<add>
<add> it('hydrates before an update even if hydration moves away from it', async () => {
<add> function Child({text}) {
<add> Scheduler.unstable_yieldValue(text);
<add> return <span>{text}</span>;
<add> }
<add> let ChildWithBoundary = React.memo(function({text}) {
<add> return (
<add> <Suspense fallback="Loading...">
<add> <Child text={text} />
<add> <Child text={text.toLowerCase()} />
<add> </Suspense>
<add> );
<add> });
<add>
<add> function App({a}) {
<add> Scheduler.unstable_yieldValue('App');
<add> React.useEffect(() => {
<add> Scheduler.unstable_yieldValue('Commit');
<add> });
<add> return (
<add> <div>
<add> <ChildWithBoundary text={a} />
<add> <ChildWithBoundary text="B" />
<add> <ChildWithBoundary text="C" />
<add> </div>
<add> );
<add> }
<add>
<add> let finalHTML = ReactDOMServer.renderToString(<App a="A" />);
<add>
<add> expect(Scheduler).toHaveYielded(['App', 'A', 'a', 'B', 'b', 'C', 'c']);
<add>
<add> let container = document.createElement('div');
<add> container.innerHTML = finalHTML;
<add>
<add> // We need this to be in the document since we'll dispatch events on it.
<add> document.body.appendChild(container);
<add>
<add> let spanA = container.getElementsByTagName('span')[0];
<add> let spanB = container.getElementsByTagName('span')[2];
<add> let spanC = container.getElementsByTagName('span')[4];
<add>
<add> let root = ReactDOM.createRoot(container, {hydrate: true});
<add> ReactTestUtils.act(() => {
<add> root.render(<App a="A" />);
<add>
<add> // Hydrate the shell.
<add> expect(Scheduler).toFlushAndYieldThrough(['App', 'Commit']);
<add>
<add> // Render an update at Idle priority that needs to update A.
<add> Scheduler.unstable_runWithPriority(
<add> Scheduler.unstable_IdlePriority,
<add> () => {
<add> root.render(<App a="AA" />);
<add> },
<add> );
<add>
<add> // Start rendering. This will force the first boundary to hydrate
<add> // by scheduling it at one higher pri than Idle.
<add> expect(Scheduler).toFlushAndYieldThrough(['App', 'A']);
<add>
<add> // Hover over A which (could) schedule at one higher pri than Idle.
<add> dispatchMouseHoverEvent(spanA, null);
<add>
<add> // Before, we're done we now switch to hover over B.
<add> // This is meant to test that this doesn't cause us to forget that
<add> // we still have to hydrate A. The first boundary.
<add> // This also tests that we don't do the -1 down-prioritization of
<add> // continuous hover events because that would decrease its priority
<add> // to Idle.
<add> dispatchMouseHoverEvent(spanB, spanA);
<add>
<add> // Also click C to prioritize that even higher which resets the
<add> // priority levels.
<add> dispatchClickEvent(spanC);
<add>
<add> expect(Scheduler).toHaveYielded([
<add> // Hydrate C first since we clicked it.
<add> 'C',
<add> 'c',
<add> ]);
<add>
<add> expect(Scheduler).toFlushAndYield([
<add> // Finish hydration of A since we forced it to hydrate.
<add> 'A',
<add> 'a',
<add> // Also, hydrate B since we hovered over it.
<add> // It's not important which one comes first. A or B.
<add> // As long as they both happen before the Idle update.
<add> 'B',
<add> 'b',
<add> // Begin the Idle update again.
<add> 'App',
<add> 'AA',
<add> 'aa',
<add> 'Commit',
<add> ]);
<add> });
<add>
<add> let spanA2 = container.getElementsByTagName('span')[0];
<add> // This is supposed to have been hydrated, not replaced.
<add> expect(spanA).toBe(spanA2);
<add>
<add> document.body.removeChild(container);
<add> });
<ide> });
<ide><path>packages/react-reconciler/src/ReactFiberExpirationTime.js
<ide> export const Never = 1;
<ide> // Idle is slightly higher priority than Never. It must completely finish in
<ide> // order to be consistent.
<ide> export const Idle = 2;
<del>// Continuous Hydration is a moving priority. It is slightly higher than Idle
<del>// and is used to increase priority of hover targets. It is increasing with
<del>// each usage so that last always wins.
<del>let ContinuousHydration = 3;
<add>// Continuous Hydration is slightly higher than Idle and is used to increase
<add>// priority of hover targets.
<add>export const ContinuousHydration = 3;
<ide> export const Sync = MAX_SIGNED_31_BIT_INT;
<ide> export const Batched = Sync - 1;
<ide>
<ide> export function computeInteractiveExpiration(currentTime: ExpirationTime) {
<ide> );
<ide> }
<ide>
<del>export function computeContinuousHydrationExpiration(
<del> currentTime: ExpirationTime,
<del>) {
<del> // Each time we ask for a new one of these we increase the priority.
<del> // This ensures that the last one always wins since we can't deprioritize
<del> // once we've scheduled work already.
<del> return ContinuousHydration++;
<del>}
<del>
<ide> export function inferPriorityFromExpirationTime(
<ide> currentTime: ExpirationTime,
<ide> expirationTime: ExpirationTime,
<ide><path>packages/react-reconciler/src/ReactFiberReconciler.js
<ide> import {
<ide> import {StrictMode} from './ReactTypeOfMode';
<ide> import {
<ide> Sync,
<add> ContinuousHydration,
<ide> computeInteractiveExpiration,
<del> computeContinuousHydrationExpiration,
<ide> } from './ReactFiberExpirationTime';
<ide> import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
<ide> import {
<ide> export function attemptContinuousHydration(fiber: Fiber): void {
<ide> // Suspense.
<ide> return;
<ide> }
<del> let expTime = computeContinuousHydrationExpiration(
<del> requestCurrentTimeForUpdate(),
<del> );
<del> scheduleWork(fiber, expTime);
<del> markRetryTimeIfNotHydrated(fiber, expTime);
<add> scheduleWork(fiber, ContinuousHydration);
<add> markRetryTimeIfNotHydrated(fiber, ContinuousHydration);
<ide> }
<ide>
<ide> export function attemptHydrationAtCurrentPriority(fiber: Fiber): void { | 3 |
Ruby | Ruby | normalize locals in unbound templates | 76561430e5e64f64ce46b9bf4af00ef58def4782 | <ide><path>actionview/lib/action_view/unbound_template.rb
<ide> def initialize(source, identifier, details:, virtual_path:)
<ide> @virtual_path = virtual_path
<ide>
<ide> @templates = Concurrent::Map.new(initial_capacity: 2)
<add> @write_lock = Mutex.new
<ide> end
<ide>
<ide> def bind_locals(locals)
<del> @templates[locals] ||= build_template(locals)
<add> if template = @templates[locals]
<add> template
<add> else
<add> @write_lock.synchronize do
<add> normalized_locals = normalize_locals(locals)
<add>
<add> # We need ||=, both to dedup on the normalized locals and to check
<add> # while holding the lock.
<add> @templates[normalized_locals] ||= build_template(normalized_locals)
<add>
<add> # This may have already been assigned, but we've already de-dup'd so
<add> # reassignment is fine.
<add> @templates[locals.dup] = @templates[normalized_locals]
<add> end
<add> end
<ide> end
<ide>
<ide> private
<ide> def build_template(locals)
<ide> variant: variant&.to_s,
<ide> virtual_path: @virtual_path,
<ide>
<del> locals: locals
<add> locals: locals.map(&:to_s)
<ide> )
<ide> end
<add>
<add> def normalize_locals(locals)
<add> locals.map(&:to_sym).sort!.freeze
<add> end
<ide> end
<ide> end | 1 |
Ruby | Ruby | add audit for formulae with synced versions | ce2d946a7cd11a69ea1631579bf7df0e738adf0f | <ide><path>Library/Homebrew/formula_auditor.rb
<ide> def self.aliases
<ide> @aliases ||= Formula.aliases + Formula.tap_aliases
<ide> end
<ide>
<add> SYNCED_VERSIONS_FORMULAE_FILE = "synced_versions_formulae.json"
<add>
<add> def audit_synced_versions_formulae
<add> synced_versions_formulae_file = formula.tap.path/SYNCED_VERSIONS_FORMULAE_FILE
<add> return unless synced_versions_formulae_file.file?
<add>
<add> name = formula.name
<add> version = formula.version
<add>
<add> synced_versions_formulae = JSON.parse(synced_versions_formulae_file.read)
<add> synced_versions_formulae.each do |synced_version_formulae|
<add> next unless synced_version_formulae.include? name
<add>
<add> synced_version_formulae.each do |synced_formula|
<add> next if synced_formula == name
<add>
<add> if (synced_version = Formulary.factory(synced_formula).version) != version
<add> problem "Version of `#{synced_formula}` (#{synced_version}) should match version of `#{name}` (#{version})"
<add> end
<add> end
<add>
<add> break
<add> end
<add> end
<add>
<ide> def audit_formula_name
<ide> name = formula.name
<ide> | 1 |
Python | Python | fix typehints in project_euler/problem01 | edf2cd2b0c81898aa2c2c735eff39924b2e4aa9e | <ide><path>project_euler/problem_01/sol1.py
<ide> """
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """Returns the sum of all the multiples of 3 or 5 below n.
<ide>
<ide> >>> solution(3)
<ide><path>project_euler/problem_01/sol2.py
<ide> """
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """Returns the sum of all the multiples of 3 or 5 below n.
<ide>
<ide> >>> solution(3)
<ide><path>project_euler/problem_01/sol3.py
<ide> """
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """
<ide> This solution is based on the pattern that the successive numbers in the
<ide> series follow: 0+3,+2,+1,+3,+1,+2,+3.
<ide><path>project_euler/problem_01/sol4.py
<ide> """
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """Returns the sum of all the multiples of 3 or 5 below n.
<ide>
<ide> >>> solution(3)
<ide><path>project_euler/problem_01/sol5.py
<ide> """A straightforward pythonic solution using list comprehension"""
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """Returns the sum of all the multiples of 3 or 5 below n.
<ide>
<ide> >>> solution(3)
<ide><path>project_euler/problem_01/sol6.py
<ide> """
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """Returns the sum of all the multiples of 3 or 5 below n.
<ide>
<ide> >>> solution(3)
<ide><path>project_euler/problem_01/sol7.py
<ide> """
<ide>
<ide>
<del>def solution(n):
<add>def solution(n: int = 1000) -> int:
<ide> """Returns the sum of all the multiples of 3 or 5 below n.
<ide>
<ide> >>> solution(3) | 7 |
Python | Python | remove reimported airflowexception class | e0d4c6b24d4564ad10d4c243100188ee0f90dc1f | <ide><path>airflow/www/views.py
<ide> def trigger(self, session=None):
<ide>
<ide> def _clear_dag_tis(self, dag, start_date, end_date, origin,
<ide> recursive=False, confirmed=False, only_failed=False):
<del> from airflow.exceptions import AirflowException
<del>
<ide> if confirmed:
<ide> count = dag.clear(
<ide> start_date=start_date, | 1 |
Go | Go | fix cleanup logic if restoring plugin fails | 5d25195f29539b3f12fa8dbc802201f93805c1c4 | <ide><path>plugin/manager_linux.go
<ide> func (pm *Manager) upgradePlugin(p *v2.Plugin, configDigest digest.Digest, blobs
<ide> logrus.WithError(rmErr).WithField("dir", backup).Error("error cleaning up after failed upgrade")
<ide> return
<ide> }
<del>
<del> if err := os.Rename(backup, orig); err != nil {
<del> err = errors.Wrap(err, "error restoring old plugin root on upgrade failure")
<add> if mvErr := os.Rename(backup, orig); mvErr != nil {
<add> err = errors.Wrap(mvErr, "error restoring old plugin root on upgrade failure")
<ide> }
<ide> if rmErr := os.RemoveAll(tmpRootFSDir); rmErr != nil && !os.IsNotExist(rmErr) {
<ide> logrus.WithError(rmErr).WithField("plugin", p.Name()).Errorf("error cleaning up plugin upgrade dir: %s", tmpRootFSDir) | 1 |
PHP | PHP | skip consoleinput tests on windows/appveyor | bc0a9898b8093610eedf37e853ea71e3a9dea819 | <ide><path>tests/TestCase/Console/ConsoleInputTest.php
<ide> public function setUp()
<ide> */
<ide> public function testDataAvailable()
<ide> {
<add> $this->skipIf(
<add> DS === '\\',
<add> 'Skip ConsoleInput tests on Windows as they fail on AppVeyor.'
<add> );
<add>
<ide> $this->assertFalse($this->in->dataAvailable());
<ide> }
<ide> } | 1 |
Python | Python | fix exception causes in __init__.py | 6bb947c8dc3d5c154807d79861a7e5e995a6dc50 | <ide><path>numpy/__init__.py
<ide> else:
<ide> try:
<ide> from numpy.__config__ import show as show_config
<del> except ImportError:
<add> except ImportError as e:
<ide> msg = """Error importing numpy: you should not try to import numpy from
<ide> its source directory; please exit the numpy source tree, and relaunch
<ide> your python interpreter from there."""
<del> raise ImportError(msg)
<add> raise ImportError(msg) from e
<ide>
<ide> from .version import git_revision as __git_revision__
<ide> from .version import version as __version__ | 1 |
Ruby | Ruby | convert hashes into parameters | 716f2e09c23e48716460027b78d2133bce0cdf3e | <ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def extract!(*keys)
<ide> # params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
<ide> # params.transform_values { |x| x * 2 }
<ide> # # => <ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false>
<del> def transform_values(&block)
<del> if block
<del> new_instance_with_inherited_permitted_status(
<del> @parameters.transform_values(&block)
<del> )
<del> else
<del> @parameters.transform_values
<del> end
<add> def transform_values
<add> return to_enum(:transform_values) unless block_given?
<add> new_instance_with_inherited_permitted_status(
<add> @parameters.transform_values { |v| yield convert_value_to_parameters(v) }
<add> )
<ide> end
<ide>
<ide> # Performs values transformation and returns the altered
<ide> # <tt>ActionController::Parameters</tt> instance.
<del> def transform_values!(&block)
<del> @parameters.transform_values!(&block)
<add> def transform_values!
<add> return to_enum(:transform_values!) unless block_given?
<add> @parameters.transform_values! { |v| yield convert_value_to_parameters(v) }
<ide> self
<ide> end
<ide>
<ide><path>actionpack/test/controller/parameters/accessors_test.rb
<ide> class ParametersAccessorsTest < ActiveSupport::TestCase
<ide> assert_not_predicate @params.transform_values { |v| v }, :permitted?
<ide> end
<ide>
<add> test "transform_values converts hashes to parameters" do
<add> @params.transform_values do |value|
<add> assert_kind_of ActionController::Parameters, value
<add> value
<add> end
<add> end
<add>
<add> test "transform_values without block yieds an enumerator" do
<add> assert_kind_of Enumerator, @params.transform_values
<add> end
<add>
<add> test "transform_values! converts hashes to parameters" do
<add> @params.transform_values! do |value|
<add> assert_kind_of ActionController::Parameters, value
<add> end
<add> end
<add>
<add> test "transform_values! without block yields an enumerator" do
<add> assert_kind_of Enumerator, @params.transform_values!
<add> end
<add>
<ide> test "value? returns true if the given value is present in the params" do
<ide> params = ActionController::Parameters.new(city: "Chicago", state: "Illinois")
<ide> assert params.value?("Chicago") | 2 |
Text | Text | add api documentation | f97a555445e59c3739c4ff42ea5e68fc4306834d | <ide><path>website/docs/api/goldparse.md
<ide> Convert a list of Doc objects into the
<ide> | `id` | int | ID to assign to the JSON. Defaults to `0`. |
<ide> | **RETURNS** | list | The data in spaCy's JSON format. |
<ide>
<add>### gold.align {#align tag="function"}
<add>
<add>Calculate alignment tables between two tokenizations, using the Levenshtein
<add>algorithm. The alignment is case-insensitive.
<add>
<add>> #### Example
<add>>
<add>> ```python
<add>> from spacy.gold import align
<add>>
<add>> bert_tokens = ["obama", "'", "s", "podcast"]
<add>> spacy_tokens = ["obama", "'s", "podcast"]
<add>> alignment = align(bert_tokens, spacy_tokens)
<add>> cost, a2b, b2a, a2b_multi, b2a_multi = alignment
<add>> ```
<add>
<add>| Name | Type | Description |
<add>| ----------- | ----- | -------------------------------------------------------------------------- |
<add>| `tokens_a` | list | String values of candidate tokens to align. |
<add>| `tokens_b` | list | String values of reference tokens to align. |
<add>| **RETURNS** | tuple | A `(cost, a2b, b2a, a2b_multi, b2a_multi)` tuple describing the alignment. |
<add>
<add>The returned tuple contains the following alignment information:
<add>
<add>> #### Example
<add>>
<add>> ```python
<add>> a2b = array([0, -1, -1, 2])
<add>> b2a = array([0, 2, 3])
<add>> a2b_multi = {1: 1, 2: 1}
<add>> b2a_multi = {}
<add>> ```
<add>>
<add>> If `a2b[3] == 2`, that means that `tokens_a[3]` aligns to `tokens_b[2]`. If
<add>> there's no one-to-one alignment for a token, it has the value `-1`.
<add>
<add>| Name | Type | Description |
<add>| ----------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
<add>| `cost` | int | The number of misaligned tokens. |
<add>| `a2b` | `numpy.ndarray[ndim=1, dtype='int32']` | One-to-one mappings of indices in `tokens_a` to indices in `tokens_b`. |
<add>| `b2a` | `numpy.ndarray[ndim=1, dtype='int32']` | One-to-one mappings of indices in `tokens_b` to indices in `tokens_a`. |
<add>| `a2b_multi` | dict | A dictionary mapping indices in `tokens_a` to indices in `tokens_b`, where multiple tokens of `tokens_a` align to the same token of `tokens_b`. |
<add>| `b2a_multi` | dict | A dictionary mapping indices in `tokens_b` to indices in `tokens_a`, where multiple tokens of `tokens_b` align to the same token of `tokens_a`. |
<add>
<ide> ### gold.biluo_tags_from_offsets {#biluo_tags_from_offsets tag="function"}
<ide>
<ide> Encode labelled spans into per-token tags, using the | 1 |
Python | Python | fix typo in recurrent | 0933147dc89242fb4c89d3bfeedc051d82acc9c5 | <ide><path>keras/layers/recurrent.py
<ide> def build(self):
<ide> raise Exception('If a RNN is stateful, a complete ' +
<ide> 'input_shape must be provided ' +
<ide> '(including batch size).')
<del> self.states = [K.zeros(input_shape[0], self.output_dim)]
<add> self.states = [K.zeros((input_shape[0], self.output_dim))]
<ide> else:
<ide> # initial states: all-zero tensor of shape (output_dim)
<ide> self.states = [None]
<ide> def build(self):
<ide> raise Exception('If a RNN is stateful, a complete ' +
<ide> 'input_shape must be provided ' +
<ide> '(including batch size).')
<del> self.states = [K.zeros(input_shape[0], self.output_dim),
<del> K.zeros(input_shape[0], self.output_dim)]
<add> self.states = [K.zeros((input_shape[0], self.output_dim)),
<add> K.zeros((input_shape[0], self.output_dim))]
<ide> else:
<ide> # initial states: 2 all-zero tensor of shape (output_dim)
<ide> self.states = [None, None] | 1 |
Go | Go | fix error handling for stale default gateways | 72eed906b8199c13022370fe5de4e015bf77e35e | <ide><path>libnetwork/drivers/bridge/bridge.go
<ide> func (d *driver) checkConflict(config *networkConfiguration) error {
<ide> nwConfig := nw.config
<ide> nw.Unlock()
<ide> if err := nwConfig.Conflicts(config); err != nil {
<del> if config.DefaultBridge {
<add> if nwConfig.DefaultBridge {
<ide> // We encountered and identified a stale default network
<ide> // We must delete it as libnetwork is the source of truth
<ide> // The default network being created must be the only one | 1 |
PHP | PHP | remove app assignment | c0d7d3283abe6fb045920ae2ad06d288e9923772 | <ide><path>src/Illuminate/Support/Manager.php
<ide> abstract class Manager
<ide> */
<ide> public function __construct(Container $container)
<ide> {
<del> $this->app = $container;
<ide> $this->container = $container;
<ide> $this->config = $container->make('config');
<ide> } | 1 |
Javascript | Javascript | add node support for external @import | e2616fcd5d47928be5c66ce50ef6cf0feb5e5c27 | <ide><path>lib/WebpackOptionsApply.js
<ide> class WebpackOptionsApply extends OptionsApply {
<ide> }
<ide> : /^(\/\/|https?:\/\/|std:)/
<ide> ).apply(compiler);
<add> } else if (options.externalsPresets.node) {
<add> if (options.experiments.css) {
<add> //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
<add> const ExternalsPlugin = require("./ExternalsPlugin");
<add> new ExternalsPlugin(
<add> "module",
<add> ({ request, dependencyType }, callback) => {
<add> if (dependencyType === "url") {
<add> if (/^(\/\/|https?:\/\/)/.test(request))
<add> return callback(null, `asset ${request}`);
<add> } else if (dependencyType === "css-import") {
<add> if (/^(\/\/|https?:\/\/)/.test(request))
<add> return callback(null, `css-import ${request}`);
<add> } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) {
<add> if (/^\.css(\?|$)/.test(request))
<add> return callback(null, `css-import ${request}`);
<add> return callback(null, `module ${request}`);
<add> }
<add> callback();
<add> }
<add> ).apply(compiler);
<add> }
<ide> }
<ide>
<ide> new ChunkPrefetchPreloadPlugin().apply(compiler);
<ide><path>test/configCases/css/external-in-node/index.js
<add>it("should import an external css", done => {
<add> import("../external/style.css").then(x => {
<add> expect(x).toEqual(nsObj({}));
<add> done();
<add> }, done);
<add>});
<ide><path>test/configCases/css/external-in-node/webpack.config.js
<add>const path = require("path");
<add>
<add>/** @type {import("../../../../").Configuration} */
<add>module.exports = {
<add> context: path.join(__dirname, "../external"),
<add> entry: "../external-in-node/index.js",
<add> target: "node",
<add> experiments: {
<add> css: true
<add> }
<add>}; | 3 |
PHP | PHP | add another intl variant | 5731856f412214647ac422ad28c51ac3e7a91198 | <ide><path>tests/TestCase/I18n/TimeTest.php
<ide> public function assertTimeFormat(string $expected, string $result, string $messa
<ide> $expected = str_replace([',', '(', ')', ' at', ' م.', ' ه.ش.', ' AP', ' AH', ' SAKA', 'à '], '', $expected);
<ide> $expected = str_replace([' '], ' ', $expected);
<ide>
<add> $result = str_replace('temps universel coordonné', 'UTC', $result);
<ide> $result = str_replace('Temps universel coordonné', 'UTC', $result);
<ide> $result = str_replace('tiempo universal coordinado', 'GMT', $result);
<ide> $result = str_replace('Coordinated Universal Time', 'GMT', $result); | 1 |
Ruby | Ruby | use diff-tree and simplify diff parsing | 9a9328eef485e8321e1242b4a291215fde959198 | <ide><path>Library/Contributions/cmd/brew-pull.rb
<ide> def tap arg
<ide>
<ide> changed_formulae = []
<ide>
<del> `git diff #{revision}.. --name-status`.each_line do |line|
<add>
<add> if tap_dir
<add> formula_dir = %w[Formula HomebrewFormula].find { |d| tap_dir.join(d).directory? } || ""
<add> else
<add> formula_dir = "Library/Formula"
<add> end
<add>
<add> Utils.popen_read(
<add> "git", "diff-tree", "-r", "--name-status",
<add> revision, "HEAD", "--", formula_dir, &:read
<add> ).each_line do |line|
<ide> status, filename = line.split
<ide> # Don't try and do anything to removed files.
<del> if (status =~ /A|M/) && (filename =~ %r{Formula/.+\.rb$}) || tap(url)
<del> formula_name = File.basename(filename, '.rb')
<del> formula = Formula[formula_name] rescue nil
<add> if status == "A" || status == "M"
<add> name = File.basename(filename, ".rb")
<add> formula = Formula[name] rescue nil
<ide> next unless formula
<ide> changed_formulae << formula
<ide> end
<ide> def tap arg
<ide> end
<ide>
<ide> ohai 'Patch changed:'
<del> safe_system 'git', '--no-pager', 'diff', "#{revision}..", '--stat'
<add> safe_system "git", "diff-tree", "-r", "--stat", revision, "HEAD"
<ide>
<ide> if ARGV.include? '--install'
<ide> changed_formulae.each do |f| | 1 |
PHP | PHP | remove unnecessary variable | 3ee0065bcd879b82ee42023165f8a8f71e893011 | <ide><path>app/Http/Middleware/VerifyCsrfToken.php
<ide>
<ide> class VerifyCsrfToken extends Middleware
<ide> {
<del> /**
<del> * Indicates whether the XSRF-TOKEN cookie should be set on the response.
<del> *
<del> * @var bool
<del> */
<del> protected $addHttpCookie = true;
<del>
<ide> /**
<ide> * The URIs that should be excluded from CSRF verification.
<ide> * | 1 |
Python | Python | update return introduction | d6d747cb28a3c8d946b6278706b13e50179b8421 | <ide><path>src/transformers/file_utils.py
<ide> def docstring_decorator(fn):
<ide>
<ide> PT_RETURN_INTRODUCTION = r"""
<ide> Returns:
<del> :class:`~{full_output_type}` or :obj:`tuple(torch.FloatTensor)`: A :class:`~{full_output_type}` (if
<del> ``return_dict=True`` is passed or when ``config.return_dict=True``) or a tuple of :obj:`torch.FloatTensor`
<del> comprising various elements depending on the configuration (:class:`~transformers.{config_class}`) and inputs.
<add> :class:`~{full_output_type}` or :obj:`tuple(torch.FloatTensor)`: A :class:`~{full_output_type}` or a tuple of
<add> :obj:`torch.FloatTensor` (if ``return_dict=False`` is passed or when ``config.return_dict=False``) comprising
<add> various elements depending on the configuration (:class:`~transformers.{config_class}`) and inputs.
<ide>
<ide> """
<ide>
<ide>
<ide> TF_RETURN_INTRODUCTION = r"""
<ide> Returns:
<del> :class:`~{full_output_type}` or :obj:`tuple(tf.Tensor)`: A :class:`~{full_output_type}` (if
<del> ``return_dict=True`` is passed or when ``config.return_dict=True``) or a tuple of :obj:`tf.Tensor` comprising
<del> various elements depending on the configuration (:class:`~transformers.{config_class}`) and inputs.
<add> :class:`~{full_output_type}` or :obj:`tuple(tf.Tensor)`: A :class:`~{full_output_type}` or a tuple of
<add> :obj:`tf.Tensor` (if ``return_dict=False`` is passed or when ``config.return_dict=False``) comprising various
<add> elements depending on the configuration (:class:`~transformers.{config_class}`) and inputs.
<ide>
<ide> """
<ide> | 1 |
Go | Go | reduce parameters for func joinoptionpriority | a24e5f5fd498115dec6247c2bea8a7153c7cb0ea | <ide><path>libnetwork/endpoint.go
<ide> func CreateOptionLoadBalancer() EndpointOption {
<ide>
<ide> // JoinOptionPriority function returns an option setter for priority option to
<ide> // be passed to the endpoint.Join() method.
<del>func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
<add>func JoinOptionPriority(prio int) EndpointOption {
<ide> return func(ep *endpoint) {
<ide> // ep lock already acquired
<ide> c := ep.network.getController()
<ide><path>libnetwork/endpoint_test.go
<ide> fe90::2 somehost.example.com somehost
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if err := ep1.Join(sbx, JoinOptionPriority(ep1, 1)); err != nil {
<add> if err := ep1.Join(sbx, JoinOptionPriority(1)); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<ide><path>libnetwork/sandbox_test.go
<ide> func TestSandboxAddMultiPrio(t *testing.T) {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if err := ep1.Join(sbx, JoinOptionPriority(ep1, 1)); err != nil {
<add> if err := ep1.Join(sbx, JoinOptionPriority(1)); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if err := ep2.Join(sbx, JoinOptionPriority(ep2, 2)); err != nil {
<add> if err := ep2.Join(sbx, JoinOptionPriority(2)); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if err := ep3.Join(sbx, JoinOptionPriority(ep3, 3)); err != nil {
<add> if err := ep3.Join(sbx, JoinOptionPriority(3)); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<ide> func TestSandboxAddMultiPrio(t *testing.T) {
<ide> }
<ide>
<ide> // Re-add ep3 back
<del> if err := ep3.Join(sbx, JoinOptionPriority(ep3, 3)); err != nil {
<add> if err := ep3.Join(sbx, JoinOptionPriority(3)); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> | 3 |
Ruby | Ruby | raise typeerror instead of infinite looping | d0e95f45f3881e2b9cda44c2a2e74aad976297df | <ide><path>activerecord/lib/active_record/connection_adapters/connection_specification.rb
<ide> def resolve_connection(config_or_env, pool_name = nil)
<ide> when Hash
<ide> resolve_hash_connection config_or_env
<ide> else
<del> resolve_connection config_or_env
<add> raise TypeError, "Invalid type for configuration. Expected Symbol, String, or Hash. Got #{config_or_env.inspect}"
<ide> end
<ide> end
<ide>
<ide><path>activerecord/test/cases/connection_specification/resolver_test.rb
<ide> def test_spec_name_with_inline_config
<ide> spec = spec("adapter" => "sqlite3")
<ide> assert_equal "primary", spec.name, "should default to primary id"
<ide> end
<add>
<add> def test_spec_with_invalid_type
<add> assert_raises TypeError do
<add> spec(Object.new)
<add> end
<add> end
<ide> end
<ide> end
<ide> end | 2 |
Javascript | Javascript | fix input tests without jquery | 665c62548359c6f16cfaf08274c1ce677feed8aa | <ide><path>packages/@ember/-internals/glimmer/tests/integration/components/input-angle-test.js
<ide> import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test
<ide> import { EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS } from '@ember/canary-features';
<ide> import { assign } from '@ember/polyfills';
<ide> import { set } from '@ember/-internals/metal';
<del>import { jQuery } from '@ember/-internals/views';
<add>import { jQueryDisabled, jQuery } from '@ember/-internals/views';
<ide>
<ide> import { Component } from '../../utils/helpers';
<ide>
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed.');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> if (EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS) {
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide><path>packages/@ember/-internals/glimmer/tests/integration/components/input-curly-test.js
<ide> import { RenderingTestCase, moduleFor, runDestroy, runTask } from 'internal-test
<ide> import { EMBER_GLIMMER_ANGLE_BRACKET_BUILT_INS } from '@ember/canary-features';
<ide> import { assign } from '@ember/polyfills';
<ide> import { set } from '@ember/-internals/metal';
<del>import { jQuery } from '@ember/-internals/views';
<add>import { jQueryDisabled, jQuery } from '@ember/-internals/views';
<ide>
<ide> import { Component } from '../../utils/helpers';
<ide>
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed.');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> });
<ide> moduleFor(
<ide> actions: {
<ide> foo(value, event) {
<ide> assert.ok(true, 'action was triggered');
<del> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> if (jQueryDisabled) {
<add> assert.notOk(event.originalEvent, 'event is not a jQuery.Event');
<add> } else {
<add> assert.ok(event instanceof jQuery.Event, 'jQuery event was passed');
<add> }
<ide> },
<ide> },
<ide> }); | 2 |
Python | Python | add tests for custom storage suffix for | 91d14eaa0d54432e0b047e291279a4f6123314b1 | <ide><path>libcloud/test/compute/test_azure_arm.py
<ide> def setUp(self):
<ide> self.driver = Azure(self.TENANT_ID, self.SUBSCRIPTION_ID,
<ide> self.APPLICATION_ID, self.APPLICATION_PASS)
<ide>
<add> def test_get_image(self):
<add> # Default storage suffix
<add> image = self.driver.get_image(image_id='http://www.example.com/foo/image_name')
<add> self.assertEqual(image.id, 'https://www.blob.core.windows.net/foo/image_name')
<add> self.assertEqual(image.name, 'image_name')
<add>
<add> # Custom storage suffix
<add> self.driver.connection.storage_suffix = '.core.chinacloudapi.cn'
<add> image = self.driver.get_image(image_id='http://www.example.com/foo/image_name')
<add> self.assertEqual(image.id, 'https://www.blob.core.chinacloudapi.cn/foo/image_name')
<add> self.assertEqual(image.name, 'image_name')
<add>
<ide> def test_locations_returned_successfully(self):
<ide> locations = self.driver.list_locations()
<ide> self.assertEqual([l.name for l in locations], | 1 |
Text | Text | remove obsolete comment in iserror() example | d09c972fde7c608eaa3eba823ad5c9b114855783 | <ide><path>doc/api/util.md
<ide> possible to obtain an incorrect result when the `object` argument manipulates
<ide> `@@toStringTag`.
<ide>
<ide> ```js
<del>// This example requires the `--harmony-tostring` flag
<ide> const util = require('util');
<ide> const obj = { name: 'Error', message: 'an error occurred' };
<ide> | 1 |
PHP | PHP | remove used properties | ebd01d720c8be0ea4c7a4d2777086f6b238dd291 | <ide><path>src/Controller/Component/AuthComponent.php
<ide> class AuthComponent extends Component
<ide> */
<ide> public $allowedActions = [];
<ide>
<del> /**
<del> * Request object
<del> *
<del> * @var \Cake\Http\ServerRequest
<del> */
<del> public $request;
<del>
<del> /**
<del> * Response object
<del> *
<del> * @var \Cake\Http\Response
<del> */
<del> public $response;
<del>
<ide> /**
<ide> * The instance of the Authenticate provider that was used for
<ide> * successfully logging in the current user after calling `login()` | 1 |
Javascript | Javascript | fix enterleaveeventplugin-test in ie10 | e938116549fad743afa02308c5a43ff2c305e06f | <ide><path>src/browser/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js
<ide> describe('EnterLeaveEventPlugin', function() {
<ide>
<ide> var iframeDocument = iframe.contentDocument;
<ide>
<del> if (!iframeDocument.innerHTML) {
<del> iframeDocument.innerHTML = '<html><head></head><body></body></html>';
<del> }
<add> iframeDocument.write(
<add> '<!DOCTYPE html><html><head></head><body></body></html>'
<add> );
<add> iframeDocument.close();
<ide>
<ide> var component = React.renderComponent(<div />, iframeDocument.body);
<ide> var div = component.getDOMNode(); | 1 |
Ruby | Ruby | convert `search_remote_tap` test to spec | 423f22df0033f83a04a9452d2e755a96e830b039 | <ide><path>Library/Homebrew/test/cmd/search_remote_tap_spec.rb
<add>require "cmd/search"
<add>
<add>describe Homebrew do
<add> specify "#search_tap" do
<add> json_response = {
<add> "tree" => [
<add> {
<add> "path" => "Formula/not-a-formula.rb",
<add> "type" => "blob",
<add> },
<add> ],
<add> }
<add>
<add> allow(GitHub).to receive(:open).and_yield(json_response)
<add>
<add> expect(described_class.search_tap("homebrew", "not-a-tap", "not-a-formula"))
<add> .to eq(["homebrew/not-a-tap/not-a-formula"])
<add> end
<add>end
<ide><path>Library/Homebrew/test/search_remote_tap_test.rb
<del>require "testing_env"
<del>require "cmd/search"
<del>
<del>class SearchRemoteTapTests < Homebrew::TestCase
<del> def test_search_remote_tap
<del> json_response = {
<del> "tree" => [
<del> {
<del> "path" => "Formula/not-a-formula.rb",
<del> "type" => "blob",
<del> },
<del> ],
<del> }
<del>
<del> GitHub.stubs(:open).yields(json_response)
<del>
<del> assert_equal ["homebrew/not-a-tap/not-a-formula"], Homebrew.search_tap("homebrew", "not-a-tap", "not-a-formula")
<del> end
<del>end | 2 |
Ruby | Ruby | fix compatibility with psych 4 | 22737122a2762bc97a5a364dfe1793c6ac3319e2 | <ide><path>activesupport/lib/active_support/configuration_file.rb
<ide> def self.parse(content_path, **options)
<ide> end
<ide>
<ide> def parse(context: nil, **options)
<del> YAML.load(render(context), **options) || {}
<add> source = render(context)
<add> begin
<add> YAML.load(source, aliases: true, **options) || {}
<add> rescue ArgumentError
<add> YAML.load(source, **options) || {}
<add> end
<ide> rescue Psych::SyntaxError => error
<ide> raise "YAML syntax error occurred while parsing #{@content_path}. " \
<ide> "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ | 1 |
Python | Python | add some tests for random.multivariate_normal | 1c825f38d74bd9435c0b0c691dbea0a36a1ab0af | <ide><path>numpy/random/tests/test_random.py
<ide> from __future__ import division, absolute_import, print_function
<ide>
<del>from numpy.testing import TestCase, run_module_suite, assert_,\
<del> assert_raises, assert_equal
<add>import numpy as np
<add>from numpy.testing import (
<add> TestCase, run_module_suite, assert_, assert_raises, assert_equal,
<add> assert_warns)
<ide> from numpy import random
<ide> from numpy.compat import asbytes
<del>import numpy as np
<ide>
<ide>
<ide> class TestBinomial(TestCase):
<ide> def test_multinomial(self):
<ide> def test_multivariate_normal(self):
<ide> np.random.seed(self.seed)
<ide> mean= (.123456789, 10)
<add> # Hmm... not even symmetric.
<ide> cov = [[1, 0], [1, 0]]
<ide> size = (3, 2)
<ide> actual = np.random.multivariate_normal(mean, cov, size)
<del> desired = np.array([[[ -1.47027513018564449, 10. ],
<del> [ -1.65915081534845532, 10. ]],
<del> [[ -2.29186329304599745, 10. ],
<del> [ -1.77505606019580053, 10. ]],
<del> [[ -0.54970369430044119, 10. ],
<del> [ 0.29768848031692957, 10. ]]])
<add> desired = np.array([[[-1.47027513018564449, 10.],
<add> [-1.65915081534845532, 10.]],
<add> [[-2.29186329304599745, 10.],
<add> [-1.77505606019580053, 10.]],
<add> [[-0.54970369430044119, 10.],
<add> [ 0.29768848031692957, 10.]]])
<ide> np.testing.assert_array_almost_equal(actual, desired, decimal=15)
<ide>
<add> # Check for default size, was raising deprecation warning
<add> actual = np.random.multivariate_normal(mean, cov)
<add> desired = np.array([-0.79441224511977482, 10.])
<add> np.testing.assert_array_almost_equal(actual, desired, decimal=15)
<add>
<add> # Check that non positive-semidefinite covariance raises warning
<add> mean= [0, 0]
<add> cov = [[1, 1 + 1e-10], [1 + 1e-10, 1]]
<add> rng = np.random.multivariate_normal
<add> assert_warns(RuntimeWarning, np.random.multivariate_normal, mean, cov)
<add>
<ide> def test_negative_binomial(self):
<ide> np.random.seed(self.seed)
<del> actual = np.random.negative_binomial(n = 100, p = .12345, size = (3, 2))
<add> actual = np.random.negative_binomial(n=100, p=.12345, size=(3, 2))
<ide> desired = np.array([[848, 841],
<ide> [892, 611],
<ide> [779, 647]]) | 1 |
PHP | PHP | remove a number of unused methods from helper | 71c26e913f62627d7380ac08acad2356a5ebe451 | <ide><path>src/View/Helper.php
<ide> class Helper extends Object implements EventListener {
<ide> */
<ide> protected $_View;
<ide>
<del>/**
<del> * A list of strings that should be treated as suffixes, or
<del> * sub inputs for a parent input. This is used for date/time
<del> * inputs primarily.
<del> *
<del> * @var array
<del> */
<del> protected $_fieldSuffixes = array(
<del> 'year', 'month', 'day', 'hour', 'min', 'second', 'meridian'
<del> );
<del>
<del>/**
<del> * The name of the current model entities are in scope of.
<del> *
<del> * @see Helper::setEntity()
<del> * @var string
<del> */
<del> protected $_modelScope;
<del>
<del>/**
<del> * The name of the current model association entities are in scope of.
<del> *
<del> * @see Helper::setEntity()
<del> * @var string
<del> */
<del> protected $_association;
<del>
<del>/**
<del> * The dot separated list of elements the current field entity is for.
<del> *
<del> * @see Helper::setEntity()
<del> * @var string
<del> */
<del> protected $_entityPath;
<del>
<ide> /**
<ide> * Minimized attributes
<ide> *
<ide> protected function _confirm($message, $okCode, $cancelCode = '', $options = arra
<ide> return $confirm;
<ide> }
<ide>
<del>/**
<del> * Sets this helper's model and field properties to the dot-separated value-pair in $entity.
<del> *
<del> * @param string $entity A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName"
<del> * @param boolean $setScope Sets the view scope to the model specified in $tagValue
<del> * @return void
<del> */
<del> public function setEntity($entity, $setScope = false) {
<del> if ($entity === null) {
<del> $this->_modelScope = false;
<del> }
<del> if ($setScope === true) {
<del> $this->_modelScope = $entity;
<del> }
<del> $parts = array_values(Hash::filter(explode('.', $entity)));
<del> if (empty($parts)) {
<del> return;
<del> }
<del> $count = count($parts);
<del> $lastPart = isset($parts[$count - 1]) ? $parts[$count - 1] : null;
<del>
<del> // Either 'body' or 'date.month' type inputs.
<del> if (
<del> ($count === 1 && $this->_modelScope && !$setScope) ||
<del> (
<del> $count === 2 &&
<del> in_array($lastPart, $this->_fieldSuffixes) &&
<del> $this->_modelScope &&
<del> $parts[0] !== $this->_modelScope
<del> )
<del> ) {
<del> $entity = $this->_modelScope . '.' . $entity;
<del> }
<del>
<del> // 0.name, 0.created.month style inputs. Excludes inputs with the modelScope in them.
<del> if (
<del> $count >= 2 &&
<del> is_numeric($parts[0]) &&
<del> !is_numeric($parts[1]) &&
<del> $this->_modelScope &&
<del> strpos($entity, $this->_modelScope) === false
<del> ) {
<del> $entity = $this->_modelScope . '.' . $entity;
<del> }
<del>
<del> $this->_association = null;
<del>
<del> $isHabtm = (
<del> isset($this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type']) &&
<del> $this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type'] === 'multiple'
<del> );
<del>
<del> // habtm models are special
<del> if ($count === 1 && $isHabtm) {
<del> $this->_association = $parts[0];
<del> $entity = $parts[0] . '.' . $parts[0];
<del> } else {
<del> // check for associated model.
<del> $reversed = array_reverse($parts);
<del> foreach ($reversed as $i => $part) {
<del> if ($i > 0 && preg_match('/^[A-Z]/', $part)) {
<del> $this->_association = $part;
<del> break;
<del> }
<del> }
<del> }
<del> $this->_entityPath = $entity;
<del> }
<del>
<del>/**
<del> * Returns the entity reference of the current context as an array of identity parts
<del> *
<del> * @return array An array containing the identity elements of an entity
<del> */
<del> public function entity() {
<del> return explode('.', $this->_entityPath);
<del> }
<del>
<del>/**
<del> * Gets the currently-used model of the rendering context.
<del> *
<del> * @return string
<del> */
<del> public function model() {
<del> if ($this->_association) {
<del> return $this->_association;
<del> }
<del> return $this->_modelScope;
<del> }
<del>
<del>/**
<del> * Gets the currently-used model field of the rendering context.
<del> * Strips off field suffixes such as year, month, day, hour, min, meridian
<del> * when the current entity is longer than 2 elements.
<del> *
<del> * @return string
<del> */
<del> public function field() {
<del> $entity = $this->entity();
<del> $count = count($entity);
<del> $last = $entity[$count - 1];
<del> if ($count > 2 && in_array($last, $this->_fieldSuffixes)) {
<del> $last = isset($entity[$count - 2]) ? $entity[$count - 2] : null;
<del> }
<del> return $last;
<del> }
<del>
<del>/**
<del> * Gets the input field name for the current tag. Creates input name attributes
<del> * using CakePHP's `Model[field]` formatting.
<del> *
<del> * @param array|string $options If an array, should be an array of attributes that $key needs to be added to.
<del> * If a string or null, will be used as the View entity.
<del> * @param string $field
<del> * @param string $key The name of the attribute to be set, defaults to 'name'
<del> * @return mixed If an array was given for $options, an array with $key set will be returned.
<del> * If a string was supplied a string will be returned.
<del> */
<del> protected function _name($options = array(), $field = null, $key = 'name') {
<del> if ($options === null) {
<del> $options = array();
<del> } elseif (is_string($options)) {
<del> $field = $options;
<del> $options = 0;
<del> }
<del>
<del> if (!empty($field)) {
<del> $this->setEntity($field);
<del> }
<del>
<del> if (is_array($options) && array_key_exists($key, $options)) {
<del> return $options;
<del> }
<del>
<del> switch ($field) {
<del> case '_method':
<del> $name = $field;
<del> break;
<del> default:
<del> $entity = $this->entity();
<del> $first = array_shift($entity);
<del> $name = $first . ($entity ? '[' . implode('][', $entity) . ']' : '');
<del> break;
<del> }
<del>
<del> if (is_array($options)) {
<del> $options[$key] = $name;
<del> return $options;
<del> }
<del> return $name;
<del> }
<del>
<del>/**
<del> * Gets the data for the current tag
<del> *
<del> * @param array|string $options If an array, should be an array of attributes that $key needs to be added to.
<del> * If a string or null, will be used as the View entity.
<del> * @param string $field
<del> * @param string $key The name of the attribute to be set, defaults to 'value'
<del> * @return mixed If an array was given for $options, an array with $key set will be returned.
<del> * If a string was supplied a string will be returned.
<del> */
<del> public function value($options = array(), $field = null, $key = 'value') {
<del> if ($options === null) {
<del> $options = array();
<del> } elseif (is_string($options)) {
<del> $field = $options;
<del> $options = 0;
<del> }
<del>
<del> if (is_array($options) && isset($options[$key])) {
<del> return $options;
<del> }
<del>
<del> if (!empty($field)) {
<del> $this->setEntity($field);
<del> }
<del> $result = null;
<del> $data = $this->request->data;
<del>
<del> $entity = $this->entity();
<del> if (!empty($data) && is_array($data) && !empty($entity)) {
<del> $result = Hash::get($data, implode('.', $entity));
<del> }
<del>
<del> $habtmKey = $this->field();
<del> if (empty($result) && isset($data[$habtmKey][$habtmKey]) && is_array($data[$habtmKey])) {
<del> $result = $data[$habtmKey][$habtmKey];
<del> }
<del>
<del> if (is_array($options)) {
<del> if ($result === null && isset($options['default'])) {
<del> $result = $options['default'];
<del> }
<del> unset($options['default']);
<del> }
<del>
<del> if (is_array($options)) {
<del> $options[$key] = $result;
<del> return $options;
<del> }
<del> return $result;
<del> }
<del>
<del>/**
<del> * Sets the defaults for an input tag. Will set the
<del> * name, value, and id attributes for an array of html attributes.
<del> *
<del> * @param string $field The field name to initialize.
<del> * @param array $options Array of options to use while initializing an input field.
<del> * @return array Array options for the form input.
<del> */
<del> protected function _initInputField($field, $options = array()) {
<del> if ($field !== null) {
<del> $this->setEntity($field);
<del> }
<del> $options = (array)$options;
<del> $options = $this->_name($options);
<del> $options = $this->value($options);
<del> $options = $this->domId($options);
<del> return $options;
<del> }
<del>
<ide> /**
<ide> * Adds the given class to the element options
<ide> *
<ide> public function implementedEvents() {
<ide> return $events;
<ide> }
<ide>
<del>/**
<del> * Transforms a recordset from a hasAndBelongsToMany association to a list of selected
<del> * options for a multiple select element
<del> *
<del> * @param string|array $data
<del> * @param string $key
<del> * @return array
<del> */
<del> protected function _selectedArray($data, $key = 'id') {
<del> if (!is_array($data)) {
<del> $model = $data;
<del> if (!empty($this->request->data[$model][$model])) {
<del> return $this->request->data[$model][$model];
<del> }
<del> if (!empty($this->request->data[$model])) {
<del> $data = $this->request->data[$model];
<del> }
<del> }
<del> $array = array();
<del> if (!empty($data)) {
<del> foreach ($data as $row) {
<del> if (isset($row[$key])) {
<del> $array[$row[$key]] = $row[$key];
<del> }
<del> }
<del> }
<del> return empty($array) ? null : $array;
<del> }
<del>
<ide> }
<ide><path>tests/TestCase/View/HelperTest.php
<ide> public function tearDown() {
<ide> unset($this->Helper, $this->View);
<ide> }
<ide>
<del>/**
<del> * Provider for setEntity test.
<del> *
<del> * @return array
<del> */
<del> public static function entityProvider() {
<del> return array(
<del> array(
<del> 'HelperTestPost.id',
<del> array('HelperTestPost', 'id'),
<del> 'HelperTestPost',
<del> 'id'
<del> ),
<del> array(
<del> 'HelperTestComment.body',
<del> array('HelperTestComment', 'body'),
<del> 'HelperTestComment',
<del> 'body'
<del> ),
<del> array(
<del> 'HelperTest.1.Comment.body',
<del> array('HelperTest', '1', 'Comment', 'body'),
<del> 'Comment',
<del> 'body'
<del> ),
<del> array(
<del> 'HelperTestComment.BigField',
<del> array('HelperTestComment', 'BigField'),
<del> 'HelperTestComment',
<del> 'BigField'
<del> ),
<del> array(
<del> 'HelperTestComment.min',
<del> array('HelperTestComment', 'min'),
<del> 'HelperTestComment',
<del> 'min'
<del> )
<del> );
<del> }
<del>
<ide> /**
<ide> * Test settings merging
<ide> *
<ide> public function testSettingsMerging() {
<ide> $this->assertEquals($expected, $Helper->settings);
<ide> }
<ide>
<del>/**
<del> * Test setting an entity and retrieving the entity, model and field.
<del> *
<del> * @dataProvider entityProvider
<del> * @return void
<del> */
<del> public function testSetEntity($entity, $expected, $modelKey, $fieldKey) {
<del> $this->Helper->setEntity($entity);
<del> $this->assertEquals($expected, $this->Helper->entity());
<del> $this->assertEquals($modelKey, $this->Helper->model());
<del> $this->assertEquals($fieldKey, $this->Helper->field());
<del> }
<del>
<del>/**
<del> * test setEntity with setting a scope.
<del> *
<del> * @return void
<del> */
<del> public function testSetEntityScoped() {
<del> $this->Helper->setEntity('HelperTestPost', true);
<del> $this->assertEquals(array('HelperTestPost'), $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('id');
<del> $expected = array('HelperTestPost', 'id');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('HelperTestComment.body');
<del> $expected = array('HelperTestComment', 'body');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('body');
<del> $expected = array('HelperTestPost', 'body');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('2.body');
<del> $expected = array('HelperTestPost', '2', 'body');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('Something.else');
<del> $expected = array('Something', 'else');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('HelperTestComment.5.id');
<del> $expected = array('HelperTestComment', 5, 'id');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('HelperTestComment.id.time');
<del> $expected = array('HelperTestComment', 'id', 'time');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('HelperTestComment.created.year');
<del> $expected = array('HelperTestComment', 'created', 'year');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity(null);
<del> $this->Helper->setEntity('ModelThatDoesntExist.field_that_doesnt_exist');
<del> $expected = array('ModelThatDoesntExist', 'field_that_doesnt_exist');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del> }
<del>
<del>/**
<del> * Test that setEntity() and model()/field() work with associated models.
<del> *
<del> * @return void
<del> */
<del> public function testSetEntityAssociated() {
<del> $this->Helper->setEntity('HelperTestPost', true);
<del>
<del> $this->Helper->setEntity('HelperTestPost.1.HelperTestComment.1.title');
<del> $expected = array('HelperTestPost', '1', 'HelperTestComment', '1', 'title');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->assertEquals('HelperTestComment', $this->Helper->model());
<del> }
<del>
<del>/**
<del> * Test creating saveMany() compatible entities
<del> *
<del> * @return void
<del> */
<del> public function testSetEntitySaveMany() {
<del> $this->Helper->setEntity('HelperTestPost', true);
<del>
<del> $this->Helper->setEntity('0.HelperTestPost.id');
<del> $expected = array('0', 'HelperTestPost', 'id');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del> }
<del>
<del>/**
<del> * Test that setEntity doesn't make CamelCase fields that are not associations an
<del> * associated model.
<del> *
<del> * @return void
<del> */
<del> public function testSetEntityAssociatedCamelCaseField() {
<del> $this->Helper->fieldset = array(
<del> 'HelperTestComment' => array(
<del> 'fields' => array('BigField' => array('type' => 'integer'))
<del> )
<del> );
<del> $this->Helper->setEntity('HelperTestComment', true);
<del> $this->Helper->setEntity('HelperTestComment.BigField');
<del>
<del> $this->assertEquals('HelperTestComment', $this->Helper->model());
<del> $this->assertEquals('BigField', $this->Helper->field());
<del> }
<del>
<del>/**
<del> * Test that multiple fields work when they are camelcase and in fieldset
<del> *
<del> * @return void
<del> */
<del> public function testSetEntityAssociatedCamelCaseFieldHabtmMultiple() {
<del> $this->Helper->fieldset = array(
<del> 'HelperTestComment' => array(
<del> 'fields' => array('Tag' => array('type' => 'multiple'))
<del> )
<del> );
<del> $this->Helper->setEntity('HelperTestComment', true);
<del> $this->Helper->setEntity('Tag');
<del>
<del> $this->assertEquals('Tag', $this->Helper->model());
<del> $this->assertEquals('Tag', $this->Helper->field());
<del> $this->assertEquals(array('Tag', 'Tag'), $this->Helper->entity());
<del> }
<del>
<del>/**
<del> * Test that habtm associations can have property fields created.
<del> *
<del> * @return void
<del> */
<del> public function testSetEntityHabtmPropertyFieldNames() {
<del> $this->Helper->fieldset = array(
<del> 'HelperTestComment' => array(
<del> 'fields' => array('Tag' => array('type' => 'multiple'))
<del> )
<del> );
<del> $this->Helper->setEntity('HelperTestComment', true);
<del>
<del> $this->Helper->setEntity('Tag.name');
<del> $this->assertEquals('Tag', $this->Helper->model());
<del> $this->assertEquals('name', $this->Helper->field());
<del> $this->assertEquals(array('Tag', 'name'), $this->Helper->entity());
<del> }
<del>
<del>/**
<del> * test that 'view' doesn't break things.
<del> *
<del> * @return void
<del> */
<del> public function testSetEntityWithView() {
<del> $this->assertNull($this->Helper->setEntity('Allow.view.group_id'));
<del> $this->assertNull($this->Helper->setEntity('Allow.view'));
<del> $this->assertNull($this->Helper->setEntity('View.view'));
<del> }
<del>
<del>/**
<del> * test getting values from Helper
<del> *
<del> * @return void
<del> */
<del> public function testValue() {
<del> $this->Helper->request->data = array('fullname' => 'This is me');
<del> $this->Helper->setEntity('fullname');
<del> $result = $this->Helper->value('fullname');
<del> $this->assertEquals('This is me', $result);
<del>
<del> $this->Helper->request->data = array(
<del> 'Post' => array('name' => 'First Post')
<del> );
<del> $this->Helper->setEntity('Post.name');
<del> $result = $this->Helper->value('Post.name');
<del> $this->assertEquals('First Post', $result);
<del>
<del> $this->Helper->request->data = array(
<del> 'Post' => array(2 => array('name' => 'First Post'))
<del> );
<del> $this->Helper->setEntity('Post.2.name');
<del> $result = $this->Helper->value('Post.2.name');
<del> $this->assertEquals('First Post', $result);
<del>
<del> $this->Helper->request->data = array(
<del> 'Post' => array(
<del> 2 => array('created' => array('year' => '2008'))
<del> )
<del> );
<del> $this->Helper->setEntity('Post.2.created');
<del> $result = $this->Helper->value('Post.2.created');
<del> $this->assertEquals(array('year' => '2008'), $result);
<del>
<del> $this->Helper->request->data = array(
<del> 'Post' => array(
<del> 2 => array('created' => array('year' => '2008'))
<del> )
<del> );
<del> $this->Helper->setEntity('Post.2.created.year');
<del> $result = $this->Helper->value('Post.2.created.year');
<del> $this->assertEquals('2008', $result);
<del> }
<del>
<del>/**
<del> * Test default values with value()
<del> *
<del> * @return void
<del> */
<del> public function testValueWithDefault() {
<del> $this->Helper->request->data = array('zero' => 0);
<del> $this->Helper->setEntity('zero');
<del> $result = $this->Helper->value(array('default' => 'something'), 'zero');
<del> $this->assertEquals(array('value' => 0), $result);
<del>
<del> $this->Helper->request->data = array('zero' => '0');
<del> $result = $this->Helper->value(array('default' => 'something'), 'zero');
<del> $this->assertEquals(array('value' => '0'), $result);
<del>
<del> $this->Helper->setEntity('inexistent');
<del> $result = $this->Helper->value(array('default' => 'something'), 'inexistent');
<del> $this->assertEquals(array('value' => 'something'), $result);
<del> }
<del>
<del>/**
<del> * Test habtm data fetching and ensure no pollution happens.
<del> *
<del> * @return void
<del> */
<del> public function testValueHabtmKeys() {
<del> $this->Helper->request->data = array(
<del> 'HelperTestTag' => array('HelperTestTag' => '')
<del> );
<del> $this->Helper->setEntity('HelperTestTag.HelperTestTag');
<del> $result = $this->Helper->value('HelperTestTag.HelperTestTag');
<del> $this->assertEquals('', $result);
<del>
<del> $this->Helper->request->data = array(
<del> 'HelperTestTag' => array(
<del> 'HelperTestTag' => array(2, 3, 4)
<del> )
<del> );
<del> $this->Helper->setEntity('HelperTestTag.HelperTestTag');
<del> $result = $this->Helper->value('HelperTestTag.HelperTestTag');
<del> $this->assertEquals(array(2, 3, 4), $result);
<del>
<del> $this->Helper->request->data = array(
<del> 'HelperTestTag' => array(
<del> 'body' => '',
<del> 'title' => 'winning'
<del> ),
<del> );
<del> $this->Helper->setEntity('HelperTestTag.body');
<del> $result = $this->Helper->value('HelperTestTag.body');
<del> $this->assertEquals('', $result);
<del> }
<del>
<ide> /**
<ide> * Ensure HTML escaping of URL params. So link addresses are valid and not exploited
<ide> *
<ide> public function testAssetTimestampPluginsAndThemes() {
<ide> }
<ide>
<ide> /**
<del> * testFieldsWithSameName method
<del> *
<del> * @return void
<del> */
<del> public function testFieldsWithSameName() {
<del> $this->Helper->setEntity('HelperTestTag', true);
<del>
<del> $this->Helper->setEntity('HelperTestTag.id');
<del> $expected = array('HelperTestTag', 'id');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('My.id');
<del> $expected = array('My', 'id');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('MyOther.id');
<del> $expected = array('MyOther', 'id');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del> }
<del>
<del>/**
<del> * testFieldSameAsModel method
<del> *
<del> * @return void
<del> */
<del> public function testFieldSameAsModel() {
<del> $this->Helper->setEntity('HelperTestTag', true);
<del>
<del> $this->Helper->setEntity('helper_test_post');
<del> $expected = array('HelperTestTag', 'helper_test_post');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $this->Helper->setEntity('HelperTestTag');
<del> $expected = array('HelperTestTag', 'HelperTestTag');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del> }
<del>
<del>/**
<del> * testFieldSuffixForDate method
<del> *
<del> * @return void
<del> */
<del> public function testFieldSuffixForDate() {
<del> $this->Helper->setEntity('HelperTestPost', true);
<del> $expected = array('HelperTestPost');
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> foreach (array('year', 'month', 'day', 'hour', 'min', 'meridian') as $d) {
<del> $this->Helper->setEntity('date.' . $d);
<del> $expected = array('HelperTestPost', 'date', $d);
<del> $this->assertEquals($expected, $this->Helper->entity());
<del> }
<del> }
<del>
<del>/**
<del> * testMulitDimensionValue method
<del> *
<del> * @return void
<del> */
<del> public function testMultiDimensionValue() {
<del> $this->Helper->data = array();
<del> for ($i = 0; $i < 2; $i++) {
<del> $this->Helper->request->data['Model'][$i] = 'what';
<del> $result[] = $this->Helper->value("Model.{$i}");
<del> $this->Helper->request->data['Model'][$i] = array();
<del> for ($j = 0; $j < 2; $j++) {
<del> $this->Helper->request->data['Model'][$i][$j] = 'how';
<del> $result[] = $this->Helper->value("Model.{$i}.{$j}");
<del> }
<del> }
<del> $expected = array('what', 'how', 'how', 'what', 'how', 'how');
<del> $this->assertEquals($expected, $result);
<del>
<del> $this->Helper->request->data['HelperTestComment']['5']['id'] = 'ok';
<del> $result = $this->Helper->value('HelperTestComment.5.id');
<del> $this->assertEquals('ok', $result);
<del>
<del> $this->Helper->setEntity('HelperTestPost', true);
<del> $this->Helper->request->data['HelperTestPost']['5']['created']['month'] = '10';
<del> $result = $this->Helper->value('5.created.month');
<del> $this->assertEquals(10, $result);
<del>
<del> $this->Helper->request->data['HelperTestPost']['0']['id'] = 100;
<del> $result = $this->Helper->value('HelperTestPost.0.id');
<del> $this->assertEquals(100, $result);
<del> }
<del>
<del>/**
<del> * testMultiDimensionalField method
<add> * Test generating paths with webroot().
<ide> *
<ide> * @return void
<ide> */
<del> public function testMultiDimensionalField() {
<del> $this->Helper->setEntity('HelperTestPost', true);
<del>
<del> $entity = 'HelperTestPost.2.HelperTestComment.1.title';
<del> $this->Helper->setEntity($entity);
<del> $expected = array(
<del> 'HelperTestPost', '2', 'HelperTestComment', '1', 'title'
<del> );
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $entity = 'HelperTestPost.1.HelperTestComment.1.HelperTestTag.1.created';
<del> $this->Helper->setEntity($entity);
<del> $expected = array(
<del> 'HelperTestPost', '1', 'HelperTestComment', '1',
<del> 'HelperTestTag', '1', 'created'
<del> );
<del> $this->assertEquals($expected, $this->Helper->entity());
<del>
<del> $entity = 'HelperTestPost.0.HelperTestComment.1.HelperTestTag.1.fake';
<del> $expected = array(
<del> 'HelperTestPost', '0', 'HelperTestComment', '1',
<del> 'HelperTestTag', '1', 'fake'
<del> );
<del> $this->Helper->setEntity($entity);
<del>
<del> $entity = '1.HelperTestComment.1.HelperTestTag.created.year';
<del> $this->Helper->setEntity($entity);
<del>
<del> $this->Helper->request->data['HelperTestPost'][2]['HelperTestComment'][1]['title'] = 'My Title';
<del> $result = $this->Helper->value('HelperTestPost.2.HelperTestComment.1.title');
<del> $this->assertEquals('My Title', $result);
<del>
<del> $this->Helper->request->data['HelperTestPost'][2]['HelperTestComment'][1]['created']['year'] = 2008;
<del> $result = $this->Helper->value('HelperTestPost.2.HelperTestComment.1.created.year');
<del> $this->assertEquals(2008, $result);
<del>
<del> $this->Helper->request->data[2]['HelperTestComment'][1]['created']['year'] = 2008;
<del> $result = $this->Helper->value('HelperTestPost.2.HelperTestComment.1.created.year');
<del> $this->assertEquals(2008, $result);
<del>
<del> $this->Helper->request->data['HelperTestPost']['title'] = 'My Title';
<del> $result = $this->Helper->value('title');
<del> $this->assertEquals('My Title', $result);
<del>
<del> $this->Helper->request->data['My']['title'] = 'My Title';
<del> $result = $this->Helper->value('My.title');
<del> $this->assertEquals('My Title', $result);
<del> }
<del>
<ide> public function testWebrootPaths() {
<ide> $this->Helper->request->webroot = '/';
<ide> $result = $this->Helper->webroot('/img/cake.power.gif'); | 2 |
Ruby | Ruby | move commit_message from utils/git | 8b206dfa335d55f3fa59f9bfd4c5701e246f851c | <ide><path>Library/Homebrew/dev-cmd/pr-pull.rb
<ide> def separate_commit_message(message)
<ide> end
<ide>
<ide> def signoff!(path, pr: nil, dry_run: false)
<del> subject, body, trailers = separate_commit_message(Utils::Git.commit_message(path))
<add> subject, body, trailers = separate_commit_message(path.git_commit_message)
<ide>
<ide> if pr
<ide> # This is a tap pull request and approving reviewers should also sign-off.
<ide> def reword_formula_commit(commit, file, reason: "", verbose: false, resolve: fal
<ide> new_formula = Utils::Git.file_at_commit(path, file, "HEAD")
<ide>
<ide> bump_subject = determine_bump_subject(old_formula, new_formula, formula_file, reason: reason).strip
<del> subject, body, trailers = separate_commit_message(Utils::Git.commit_message(path))
<add> subject, body, trailers = separate_commit_message(path.git_commit_message)
<ide>
<ide> if subject != bump_subject && !subject.start_with?("#{formula_name}:")
<ide> safe_system("git", "-C", path, "commit", "--amend", "-q",
<ide> def squash_formula_commits(commits, file, reason: "", verbose: false, resolve: f
<ide> messages = []
<ide> trailers = []
<ide> commits.each do |commit|
<del> subject, body, trailer = separate_commit_message(Utils::Git.commit_message(path, commit))
<add> subject, body, trailer = separate_commit_message(path.git_commit_message(commit))
<ide> body = body.lines.map { |line| " #{line.strip}" }.join("\n")
<ide> messages << "* #{subject}\n#{body}".strip
<ide> trailers << trailer
<ide><path>Library/Homebrew/extend/git_repository.rb
<ide> def git_last_commit_date
<ide>
<ide> Utils.popen_read("git", "show", "-s", "--format=%cd", "--date=short", "HEAD", chdir: self).chomp.presence
<ide> end
<add>
<add> # Gets the full commit message of the specified commit, or of the HEAD commit if unspecified.
<add> sig { params(commit: String).returns(T.nilable(String)) }
<add> def git_commit_message(commit = "HEAD")
<add> return unless git? && Utils::Git.available?
<add>
<add> Utils.popen_read("git", "log", "-1", "--pretty=%B", commit, "--", chdir: self, err: :out).strip.presence
<add> end
<ide> end
<ide><path>Library/Homebrew/test/dev-cmd/pr-pull_spec.rb
<ide> class Foo < Formula
<ide> EOS
<ide> end
<ide> let(:formula_file) { path/"Formula/foo.rb" }
<del> let(:path) { Tap::TAP_DIRECTORY/"homebrew/homebrew-foo" }
<add> let(:path) { (Tap::TAP_DIRECTORY/"homebrew/homebrew-foo").extend(GitRepositoryExtension) }
<ide>
<ide> describe "Homebrew.pr_pull_args" do
<ide> it_behaves_like "parseable arguments"
<ide> class Foo < Formula
<ide> File.open(formula_file, "w") { |f| f.write(formula_version) }
<ide> safe_system Utils::Git.git, "commit", formula_file, "-m", "version", "--author=#{secondary_author}"
<ide> described_class.autosquash!(original_hash, path: path)
<del> expect(Utils::Git.commit_message(path)).to include("foo 2.0")
<del> expect(Utils::Git.commit_message(path)).to include("Co-authored-by: #{secondary_author}")
<add> expect(path.git_commit_message).to include("foo 2.0")
<add> expect(path.git_commit_message).to include("Co-authored-by: #{secondary_author}")
<ide> end
<ide> end
<ide> end
<ide> class Foo < Formula
<ide> safe_system Utils::Git.git, "commit", "-m", "foo 1.0 (new formula)"
<ide> end
<ide> described_class.signoff!(path)
<del> expect(Utils::Git.commit_message(path)).to include("Signed-off-by:")
<add> expect(path.git_commit_message).to include("Signed-off-by:")
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/test/utils/git_spec.rb
<ide> let(:files_hash2) { [@h2[0..6], ["README.md"]] }
<ide> let(:cherry_pick_commit) { @cherry_pick_commit[0..6] }
<ide>
<del> describe "#commit_message" do
<del> it "returns the commit message" do
<del> expect(described_class.commit_message(HOMEBREW_CACHE, file_hash1)).to eq("File added")
<del> expect(described_class.commit_message(HOMEBREW_CACHE, file_hash2)).to eq("written to File")
<del> end
<del>
<del> it "errors when commit doesn't exist" do
<del> expect {
<del> described_class.commit_message(HOMEBREW_CACHE, "bad_refspec")
<del> }.to raise_error(ErrorDuringExecution, /bad revision/)
<del> end
<del> end
<del>
<ide> describe "#cherry_pick!" do
<ide> it "can cherry pick a commit" do
<ide> expect(described_class.cherry_pick!(HOMEBREW_CACHE, cherry_pick_commit)).to be_truthy
<ide><path>Library/Homebrew/utils/git.rb
<ide> def file_at_commit(repo, file, commit)
<ide> end
<ide>
<ide> def commit_message(repo, commit = nil)
<add> odeprecated "Utils::Git.commit_message(repo)", "Pathname(repo).git_commit_message"
<ide> commit ||= "HEAD"
<del> Utils.safe_popen_read(git, "-C", repo, "log", "-1", "--pretty=%B", commit, "--", err: :out).strip
<add> Pathname(repo).extend(GitRepositoryExtension).git_commit_message(commit)
<ide> end
<ide>
<ide> def ensure_installed! | 5 |
Javascript | Javascript | fix incorrect default | 91546a11ab06406a0249172f8b83e33f6ff64e93 | <ide><path>lib/UmdMainTemplatePlugin.js
<ide> const accessorToObjectAccess = accessor => {
<ide> * @param {string=} joinWith the element separator
<ide> * @returns {string} the path
<ide> */
<del>const accessorAccess = (base, accessor, joinWith = "; ") => {
<add>const accessorAccess = (base, accessor, joinWith = ", ") => {
<ide> const accessors = Array.isArray(accessor) ? accessor : [accessor];
<ide> return accessors
<ide> .map((_, idx) => { | 1 |
Ruby | Ruby | fix the enums writer methods | 7aebcb67b040bca353cd2e97a468c8ffe4594665 | <ide><path>activerecord/lib/active_record/enum.rb
<ide> def enum(definitions)
<ide> _enum_methods_module.module_eval do
<ide> # def status=(value) self[:status] = STATUS[value] end
<ide> define_method("#{name}=") { |value|
<del> unless enum_values.has_key?(value) || value.blank?
<add> unless enum_values.has_key?(value) || enum_values.has_value?(value) || value.blank?
<ide> raise ArgumentError, "'#{value}' is not a valid #{name}"
<ide> end
<ide> self[name] = enum_values[value]
<ide><path>activerecord/test/cases/enum_test.rb
<ide> class EnumTest < ActiveRecord::TestCase
<ide> assert @book.unread?
<ide> end
<ide>
<del> test "query state with symbol" do
<add> test "query state with strings" do
<ide> assert_equal "proposed", @book.status
<ide> assert_equal "unread", @book.read_status
<ide> end
<ide> class EnumTest < ActiveRecord::TestCase
<ide> assert_equal 1, Book::STATUS["written"]
<ide> assert_equal 2, Book::STATUS[:published]
<ide> end
<add>
<add> test "first_or_initialize with enums' scopes" do
<add> class Issue < ActiveRecord::Base
<add> enum status: [:open, :closed]
<add> end
<add>
<add> assert Issue.open.empty?
<add> assert Issue.open.first_or_initialize
<add> end
<ide> end
<ide><path>activerecord/test/schema/schema.rb
<ide> def create_table(*args, &block)
<ide> t.string :color
<ide> end
<ide>
<add> create_table :issues, force: true do |t|
<add> t.integer :status
<add> end
<add>
<ide> create_table :items, force: true do |t|
<ide> t.column :name, :string
<ide> end | 3 |
PHP | PHP | remove an unused method | f441a1d537cdb9481e561c8dcb1d4b6cddf2b511 | <ide><path>src/Console/Command/Task/TestTask.php
<ide> protected function _addFixture($name) {
<ide> $this->_fixtures[$name] = $fixture;
<ide> }
<ide>
<del>/**
<del> * Interact with the user to get additional fixtures they want to use.
<del> *
<del> * @return array Array of fixtures the user wants to add.
<del> */
<del> public function getUserFixtures() {
<del> $proceed = $this->in(__d('cake_console', 'Bake could not detect fixtures, would you like to add some?'), ['y', 'n'], 'n');
<del> $fixtures = [];
<del> if (strtolower($proceed) === 'y') {
<del> $fixtureList = $this->in(__d('cake_console', "Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'"));
<del> $fixtureListTrimmed = str_replace(' ', '', $fixtureList);
<del> $fixtures = explode(',', $fixtureListTrimmed);
<del> }
<del> $this->_fixtures = array_merge($this->_fixtures, $fixtures);
<del> return $fixtures;
<del> }
<del>
<ide> /**
<ide> * Is a mock class required for this type of test?
<ide> * Controllers require a mock class.
<ide><path>tests/TestCase/Console/Command/Task/TestTaskTest.php
<ide> public function testRegistryClearWhenBuildingTestObjects() {
<ide> $this->assertFalse(TableRegistry::exists('Articles'));
<ide> }
<ide>
<del>/**
<del> * Test the user interaction for defining additional fixtures.
<del> *
<del> * @return void
<del> */
<del> public function testGetUserFixtures() {
<del> $this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
<del> $this->Task->expects($this->at(1))->method('in')
<del> ->will($this->returnValue('app.pizza, app.topping, app.side_dish'));
<del>
<del> $result = $this->Task->getUserFixtures();
<del> $expected = array('app.pizza', 'app.topping', 'app.side_dish');
<del> $this->assertEquals($expected, $result);
<del> }
<del>
<ide> /**
<ide> * Dataprovider for class name generation.
<ide> * | 2 |
Python | Python | set default path in en/de tests | 0cf4aff4702ad580f9709b33c96cd115f34b028d | <ide><path>spacy/tests/conftest.py
<ide>
<ide> @pytest.fixture(scope="session")
<ide> def EN():
<del> return English(path=False)
<add> return English()
<ide>
<ide> @pytest.fixture(scope="session")
<ide> def DE():
<del> return German(path=False)
<add> return German()
<ide>
<ide>
<ide> def pytest_addoption(parser): | 1 |
Java | Java | apply formatvalue to a few remaining places | 12240c7524ee81deab6049dbfa59b5963f4ff2e7 | <ide><path>spring-web/src/main/java/org/springframework/http/codec/FormHttpMessageWriter.java
<ide> public Mono<Void> write(Publisher<? extends MultiValueMap<String, String>> input
<ide> if (logger.isDebugEnabled()) {
<ide> String s = Hints.getLogPrefix(hints) + "Writing " +
<ide> (isEnableLoggingRequestDetails() ?
<del> form.toString() : "form fields " + form.keySet() + " (content masked)");
<add> formatValue(form, logger.isTraceEnabled()) :
<add> "form fields " + form.keySet() + " (content masked)");
<ide> if (logger.isTraceEnabled()) {
<ide> logger.trace(s);
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/multipart/MultipartHttpMessageReader.java
<ide> public Mono<MultiValueMap<String, Part>> readMono(ResolvableType elementType,
<ide> if (logger.isDebugEnabled()) {
<ide> String s = Hints.getLogPrefix(hints) + "Parsed " +
<ide> (isEnableLoggingRequestDetails() ?
<del> map.toString() : "parts " + map.keySet() + " (content masked)");
<add> formatValue(map, logger.isTraceEnabled()) :
<add> "parts " + map.keySet() + " (content masked)");
<ide> if (logger.isTraceEnabled()) {
<ide> logger.trace(s);
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriter.java
<ide> private Mono<Void> writeMultipart(
<ide> if (logger.isDebugEnabled()) {
<ide> String s = Hints.getLogPrefix(hints) + "Encoding " +
<ide> (isEnableLoggingRequestDetails() ?
<del> map.toString() : "parts " + map.keySet() + " (content masked)");
<add> formatValue(map, logger.isTraceEnabled()) :
<add> "parts " + map.keySet() + " (content masked)");
<ide> if (logger.isTraceEnabled()) {
<ide> logger.trace(s);
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/multipart/SynchronossPartHttpMessageReader.java
<ide> public Flux<Part> read(ResolvableType elementType, ReactiveHttpInputMessage mess
<ide> return Flux.create(new SynchronossPartGenerator(message, this.bufferFactory, this.streamStorageFactory))
<ide> .doOnNext(part -> {
<ide> if (logger.isDebugEnabled() && !Hints.isLoggingSuppressed(hints)) {
<del> String s = Hints.getLogPrefix(hints) + "Parsed " + (isEnableLoggingRequestDetails() ?
<del> part.toString() : "parts '" + part.name() + "' (content masked)");
<add> String s = Hints.getLogPrefix(hints) + "Parsed " +
<add> (isEnableLoggingRequestDetails() ?
<add> formatValue(part, logger.isTraceEnabled()) :
<add> "parts '" + part.name() + "' (content masked)");
<ide> if (logger.isTraceEnabled()) {
<ide> logger.trace(s);
<ide> } | 4 |
Javascript | Javascript | change ciphers from rc4 to no-such-cipher | 07e0c4eaa3e91fa92f63486c0d0a12cc1f330597 | <ide><path>test/parallel/test-tls-handshake-error.js
<ide> const server = tls.createServer({
<ide> assert.throws(() => {
<ide> tls.connect({
<ide> port: this.address().port,
<del> ciphers: 'RC4'
<add> ciphers: 'no-such-cipher'
<ide> }, common.mustNotCall());
<ide> }, /no cipher match/i);
<ide> | 1 |
PHP | PHP | add validator for integers | 2093755a9e9e5f557787c965edefc092fa38095c | <ide><path>src/Validation/Validation.php
<ide> public static function longitude($value, array $options = [])
<ide> return self::geoCoordinate($value, $options);
<ide> }
<ide>
<add> /**
<add> * Check that the input value is an integer
<add> *
<add> * This method will accept strings that contain only integer data
<add> * as well.
<add> *
<add> * @param string $value The value to check
<add> * @return bool
<add> */
<add> public static function isInteger($value)
<add> {
<add> if (!is_scalar($value) || is_float($value)) {
<add> return false;
<add> }
<add> if (is_int($value)) {
<add> return true;
<add> }
<add> return (bool)preg_match('/^-?[0-9]+$/', $value);
<add> }
<add>
<ide> /**
<ide> * Converts an array representing a date or datetime into a ISO string.
<ide> * The arrays are typically sent for validation from a form generated by
<ide><path>tests/TestCase/Validation/ValidationTest.php
<ide> public function testLongitude()
<ide> $this->assertTrue(Validation::longitude('10.451526'));
<ide> $this->assertFalse(Validation::longitude('-190.52236'));
<ide> }
<add>
<add> /**
<add> * Test is_integer
<add> *
<add> * @return void
<add> */
<add> public function testIsInteger()
<add> {
<add> $this->assertTrue(Validation::isInteger(-10));
<add> $this->assertTrue(Validation::isInteger(0));
<add> $this->assertTrue(Validation::isInteger(10));
<add> $this->assertTrue(Validation::isInteger('-10'));
<add> $this->assertTrue(Validation::isInteger('0'));
<add> $this->assertTrue(Validation::isInteger('10'));
<add>
<add> $this->assertFalse(Validation::isInteger('2.5'));
<add> $this->assertFalse(Validation::isInteger([]));
<add> $this->assertFalse(Validation::isInteger(new \StdClass));
<add> $this->assertFalse(Validation::isInteger('2 bears'));
<add> }
<ide> } | 2 |
Python | Python | add some additional test cases for types | 9ff9a5585ad1535840fd802421c0664ae75c6460 | <ide><path>libcloud/test/compute/test_types.py
<ide>
<ide> class TestType(Type):
<ide> INUSE = "inuse"
<add> NOTINUSE = "NOTINUSE"
<ide>
<ide>
<ide> class TestTestType(TestCase):
<ide> model = TestType
<del> attribute = TestType.INUSE
<ide>
<ide> def test_provider_tostring(self):
<ide> self.assertEqual(Provider.tostring(TestType.INUSE), "INUSE")
<add> self.assertEqual(Provider.tostring(TestType.NOTINUSE), "NOTINUSE")
<ide>
<ide> def test_provider_fromstring(self):
<ide> self.assertEqual(TestType.fromstring("inuse"), TestType.INUSE)
<add> self.assertEqual(TestType.fromstring("NOTINUSE"), TestType.NOTINUSE)
<ide>
<ide> def test_provider_fromstring_caseinsensitive(self):
<ide> self.assertEqual(TestType.fromstring("INUSE"), TestType.INUSE)
<add> self.assertEqual(TestType.fromstring("notinuse"), TestType.NOTINUSE)
<ide>
<ide> def test_compare_as_string(self):
<ide> self.assertTrue(TestType.INUSE == 'inuse') | 1 |
Ruby | Ruby | check syntax with readall | 68a8d1a5e7abe6a572e2973c244dfeeb49cfb289 | <ide><path>Library/Homebrew/cmd/test-bot.rb
<ide> def formula formula_name
<ide> def homebrew
<ide> @category = __method__
<ide> test "brew", "tests"
<del> test "brew", "readall"
<add> test "brew", "readall", "--syntax"
<ide> end
<ide>
<ide> def cleanup_before | 1 |
PHP | PHP | fix glob error in bundle class | f53ebbf6727c98accaa677e91d35b502e76b39c8 | <ide><path>laravel/bundle.php
<ide> public static function parse($identifier)
<ide> /**
<ide> * Detect all of the existing bundles in the application.
<ide> *
<del> * The names of the bundles are cached so this operation will be only be
<del> * performed once and then the same array will be returned on each later
<del> * request for the bundle names.
<del> *
<ide> * @return array
<ide> */
<ide> public static function all()
<ide> public static function all()
<ide>
<ide> $bundles = array();
<ide>
<del> foreach (array_filter(glob(BUNDLE_PATH.'*'), 'is_dir') as $bundle)
<add> $files = glob(BUNDLE_PATH.'*');
<add>
<add> // When open_basedir is enabled the glob function returns false on
<add> // an empty array. We'll check for this and return an empty array
<add> // if the bundle directory doesn't have any bundles.
<add> if ($files !== false)
<ide> {
<del> $bundles[] = basename($bundle);
<add> foreach (array_filter($files, 'is_dir') as $bundle)
<add> {
<add> $bundles[] = basename($bundle);
<add> }
<ide> }
<ide>
<ide> return static::$bundles = $bundles;
<ide><path>laravel/cli/command.php
<ide> public static function resolve($bundle, $task)
<ide> {
<ide> $identifier = Bundle::identifier($bundle, $task);
<ide>
<del> // First we'll check to see if the task has been registered in
<del> // the application IoC container. This allows dependencies to
<del> // be injected into tasks for more testability.
<add> // First we'll check to see if the task has been registered in the
<add> // application IoC container. This allows all dependencies to be
<add> // injected into tasks for more testability.
<ide> if (IoC::registered("task: {$identifier}"))
<ide> {
<ide> return IoC::resolve("task: {$identifier}");
<ide> }
<ide>
<del> // If the task file exists, we'll format the bundle and task
<del> // name into a task class name and resolve an instance of
<del> // the so that the requested method may be executed.
<add> // If the task file exists, we'll format the bundle and task name
<add> // into a task class name and resolve an instance of the so that
<add> // the requested method may be executed.
<ide> if (file_exists($path = Bundle::path($bundle).'tasks/'.$task.EXT))
<ide> {
<ide> require $path; | 2 |
Text | Text | add 2.7.0-beta.1 to changelog | 49730043e687a1d789d90246e375b0712199a8fe | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### 2.7.0-beta.1 (June 8, 2016)
<add>
<add>- [#13424](https://github.com/emberjs/ember.js/pull/13424) [DEPRECATE] Deprecate Ember.Binding. See [the deprecation guide](http://emberjs.com/deprecations/v2.x/#toc_ember-binding) for more details.
<add>- [#13599](https://github.com/emberjs/ember.js/pull/13599) [FEATURE] Enable `ember-runtime-computed-uniq-by` feature.
<add>
<ide> ### 2.6.0 (June 8, 2016)
<ide>
<ide> - [#13520](https://github.com/emberjs/ember.js/pull/13520) [BUGFIX] Fixes issues with `baseURL` and `rootURL` in `Ember.HistoryLocation` and ensures that `Ember.NoneLocation` properly handles `rootURL`. | 1 |
Text | Text | give the correct link of docker swarm init | e8279afb1a9439b482d9e3a66dcc46f155aa5251 | <ide><path>docs/swarm/swarm-mode.md
<ide> and try the [swarm mode tutorial](swarm-tutorial/index.md).
<ide>
<ide> When you run the command to create a swarm, the Docker Engine starts running in swarm mode.
<ide>
<del>Run [`docker swarm init`](/engine/reference/commandline/swarm_init.md)]
<add>Run [`docker swarm init`](../reference/commandline/swarm_init.md)
<ide> to create a single-node swarm on the current node. The Engine sets up the swarm
<ide> as follows:
<ide> | 1 |
Javascript | Javascript | flow strict staticcontainer | 6476151717f44d3a90679f0f5293bed62a4f420e | <ide><path>Libraries/Components/StaticContainer.react.js
<ide> * LICENSE file in the root directory of this source tree.
<ide> *
<ide> * @format
<del> * @flow
<add> * @flow strict-local
<ide> */
<ide>
<ide> 'use strict';
<ide> const React = require('React');
<ide> * Typically, you will not need to use this component and should opt for normal
<ide> * React reconciliation.
<ide> */
<del>class StaticContainer extends React.Component<Object> {
<del> shouldComponentUpdate(nextProps: Object): boolean {
<add>
<add>type Props = $ReadOnly<{|
<add> /**
<add> * Whether or not this component should update.
<add> */
<add> shouldUpdate: ?boolean,
<add> /**
<add> * Content short-circuited by React reconciliation process.
<add> */
<add> children: React.Node,
<add>|}>;
<add>class StaticContainer extends React.Component<Props> {
<add> shouldComponentUpdate(nextProps: Props): boolean {
<ide> return !!nextProps.shouldUpdate;
<ide> }
<ide> | 1 |
Javascript | Javascript | remove ancient check | 6a3dbdacd6cf67f643dee219fd782a193ddd2534 | <ide><path>lib/dgram.js
<ide> function newHandle(type) {
<ide> return handle;
<ide> }
<ide>
<del> if (type == 'unix_dgram')
<del> throw new Error('"unix_dgram" type sockets are not supported any more');
<del>
<ide> throw new Error('Bad socket type specified. Valid types are: udp4, udp6');
<ide> }
<ide> | 1 |
PHP | PHP | remove deprecated calls in cake\database | 0061e8d37af6aa1beb402d6ce00c28bd9e447a03 | <ide><path>src/Database/Dialect/PostgresDialectTrait.php
<ide> protected function _expressionTranslators()
<ide> */
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> {
<del> switch ($expression->name()) {
<add> switch ($expression->getName()) {
<ide> case 'CONCAT':
<ide> // CONCAT function is expressed as exp1 || exp2
<del> $expression->name('')->tieWith(' ||');
<add> $expression->setName('')->setConjunction(' ||');
<ide> break;
<ide> case 'DATEDIFF':
<ide> $expression
<del> ->name('')
<del> ->tieWith('-')
<add> ->setName('')
<add> ->setConjunction('-')
<ide> ->iterateParts(function ($p) {
<ide> if (is_string($p)) {
<ide> $p = ['value' => [$p => 'literal'], 'type' => null];
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> break;
<ide> case 'CURRENT_DATE':
<ide> $time = new FunctionExpression('LOCALTIMESTAMP', [' 0 ' => 'literal']);
<del> $expression->name('CAST')->tieWith(' AS ')->add([$time, 'date' => 'literal']);
<add> $expression->setName('CAST')->setConjunction(' AS ')->add([$time, 'date' => 'literal']);
<ide> break;
<ide> case 'CURRENT_TIME':
<ide> $time = new FunctionExpression('LOCALTIMESTAMP', [' 0 ' => 'literal']);
<del> $expression->name('CAST')->tieWith(' AS ')->add([$time, 'time' => 'literal']);
<add> $expression->setName('CAST')->setConjunction(' AS ')->add([$time, 'time' => 'literal']);
<ide> break;
<ide> case 'NOW':
<del> $expression->name('LOCALTIMESTAMP')->add([' 0 ' => 'literal']);
<add> $expression->setName('LOCALTIMESTAMP')->add([' 0 ' => 'literal']);
<ide> break;
<ide> case 'DATE_ADD':
<ide> $expression
<del> ->name('')
<del> ->tieWith(' + INTERVAL')
<add> ->setName('')
<add> ->setConjunction(' + INTERVAL')
<ide> ->iterateParts(function ($p, $key) {
<ide> if ($key === 1) {
<ide> $p = sprintf("'%s'", $p);
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> break;
<ide> case 'DAYOFWEEK':
<ide> $expression
<del> ->name('EXTRACT')
<del> ->tieWith(' ')
<add> ->setName('EXTRACT')
<add> ->setConjunction(' ')
<ide> ->add(['DOW FROM' => 'literal'], [], true)
<ide> ->add([') + (1' => 'literal']); // Postgres starts on index 0 but Sunday should be 1
<ide> break;
<ide><path>src/Database/Dialect/SqliteDialectTrait.php
<ide> protected function _expressionTranslators()
<ide> */
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> {
<del> switch ($expression->name()) {
<add> switch ($expression->getName()) {
<ide> case 'CONCAT':
<ide> // CONCAT function is expressed as exp1 || exp2
<del> $expression->name('')->tieWith(' ||');
<add> $expression->setName('')->setConjunction(' ||');
<ide> break;
<ide> case 'DATEDIFF':
<ide> $expression
<del> ->name('ROUND')
<del> ->tieWith('-')
<add> ->setName('ROUND')
<add> ->setConjunction('-')
<ide> ->iterateParts(function ($p) {
<ide> return new FunctionExpression('JULIANDAY', [$p['value']], [$p['type']]);
<ide> });
<ide> break;
<ide> case 'NOW':
<del> $expression->name('DATETIME')->add(["'now'" => 'literal']);
<add> $expression->setName('DATETIME')->add(["'now'" => 'literal']);
<ide> break;
<ide> case 'CURRENT_DATE':
<del> $expression->name('DATE')->add(["'now'" => 'literal']);
<add> $expression->setName('DATE')->add(["'now'" => 'literal']);
<ide> break;
<ide> case 'CURRENT_TIME':
<del> $expression->name('TIME')->add(["'now'" => 'literal']);
<add> $expression->setName('TIME')->add(["'now'" => 'literal']);
<ide> break;
<ide> case 'EXTRACT':
<ide> $expression
<del> ->name('STRFTIME')
<del> ->tieWith(' ,')
<add> ->setName('STRFTIME')
<add> ->setConjunction(' ,')
<ide> ->iterateParts(function ($p, $key) {
<ide> if ($key === 0) {
<ide> $value = rtrim(strtolower($p), 's');
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> break;
<ide> case 'DATE_ADD':
<ide> $expression
<del> ->name('DATE')
<del> ->tieWith(',')
<add> ->setName('DATE')
<add> ->setConjunction(',')
<ide> ->iterateParts(function ($p, $key) {
<ide> if ($key === 1) {
<ide> $p = ['value' => $p, 'type' => null];
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> break;
<ide> case 'DAYOFWEEK':
<ide> $expression
<del> ->name('STRFTIME')
<del> ->tieWith(' ')
<add> ->setName('STRFTIME')
<add> ->setConjunction(' ')
<ide> ->add(["'%w', " => 'literal'], [], true)
<ide> ->add([') + (1' => 'literal']); // Sqlite starts on index 0 but Sunday should be 1
<ide> break;
<ide><path>src/Database/Dialect/SqlserverDialectTrait.php
<ide> protected function _pagingSubquery($original, $limit, $offset)
<ide> ->offset(null)
<ide> ->order([], true);
<ide>
<del> $outer = new Query($query->connection());
<add> $outer = new Query($query->getConnection());
<ide> $outer->select('*')
<ide> ->from(['_cake_paging_' => $query]);
<ide>
<ide> protected function _transformDistinct($original)
<ide> ->select(function ($q) use ($distinct, $order) {
<ide> $over = $q->newExpr('ROW_NUMBER() OVER')
<ide> ->add('(PARTITION BY')
<del> ->add($q->newExpr()->add($distinct)->tieWith(','))
<add> ->add($q->newExpr()->add($distinct)->setConjunction(','))
<ide> ->add($order)
<ide> ->add(')')
<del> ->tieWith(' ');
<add> ->setConjunction(' ');
<ide>
<ide> return [
<ide> '_cake_distinct_pivot_' => $over
<ide> protected function _transformDistinct($original)
<ide> ->offset(null)
<ide> ->order([], true);
<ide>
<del> $outer = new Query($query->connection());
<add> $outer = new Query($query->getConnection());
<ide> $outer->select('*')
<ide> ->from(['_cake_distinct_' => $query])
<ide> ->where(['_cake_distinct_pivot_' => 1]);
<ide> protected function _expressionTranslators()
<ide> */
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> {
<del> switch ($expression->name()) {
<add> switch ($expression->getName()) {
<ide> case 'CONCAT':
<ide> // CONCAT function is expressed as exp1 + exp2
<del> $expression->name('')->tieWith(' +');
<add> $expression->setName('')->setConjunction(' +');
<ide> break;
<ide> case 'DATEDIFF':
<ide> $hasDay = false;
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> break;
<ide> case 'CURRENT_DATE':
<ide> $time = new FunctionExpression('GETUTCDATE');
<del> $expression->name('CONVERT')->add(['date' => 'literal', $time]);
<add> $expression->setName('CONVERT')->add(['date' => 'literal', $time]);
<ide> break;
<ide> case 'CURRENT_TIME':
<ide> $time = new FunctionExpression('GETUTCDATE');
<del> $expression->name('CONVERT')->add(['time' => 'literal', $time]);
<add> $expression->setName('CONVERT')->add(['time' => 'literal', $time]);
<ide> break;
<ide> case 'NOW':
<del> $expression->name('GETUTCDATE');
<add> $expression->setName('GETUTCDATE');
<ide> break;
<ide> case 'EXTRACT':
<del> $expression->name('DATEPART')->tieWith(' ,');
<add> $expression->setName('DATEPART')->setConjunction(' ,');
<ide> break;
<ide> case 'DATE_ADD':
<ide> $params = [];
<ide> protected function _transformFunctionExpression(FunctionExpression $expression)
<ide> };
<ide>
<ide> $expression
<del> ->name('DATEADD')
<del> ->tieWith(',')
<add> ->setName('DATEADD')
<add> ->setConjunction(',')
<ide> ->iterateParts($visitor)
<ide> ->iterateParts($manipulator)
<ide> ->add([$params[2] => 'literal']);
<ide> break;
<ide> case 'DAYOFWEEK':
<ide> $expression
<del> ->name('DATEPART')
<del> ->tieWith(' ')
<add> ->setName('DATEPART')
<add> ->setConjunction(' ')
<ide> ->add(['weekday, ' => 'literal'], [], true);
<ide> break;
<ide> case 'SUBSTR':
<del> $expression->name('SUBSTRING');
<add> $expression->setName('SUBSTRING');
<ide> if (count($expression) < 4) {
<ide> $params = [];
<ide> $expression
<ide><path>src/Database/Dialect/TupleComparisonTranslatorTrait.php
<ide> protected function _transformTupleComparison(TupleComparison $expression, $query
<ide> return;
<ide> }
<ide>
<del> $surrogate = $query->connection()
<add> $surrogate = $query->getConnection()
<ide> ->newQuery()
<ide> ->select($true);
<ide>
<ide><path>src/Database/Driver.php
<ide> public function __construct($config = [])
<ide> $config += $this->_baseConfig;
<ide> $this->_config = $config;
<ide> if (!empty($config['quoteIdentifiers'])) {
<del> $this->autoQuoting(true);
<add> $this->enableAutoQuoting(true);
<ide> }
<ide> }
<ide> | 5 |
Go | Go | use correct auth config when logging in | 967010ae8c7eb2f6482a9245b42731b7ead61e4b | <ide><path>commands.go
<ide> func (cli *DockerCli) CmdLogin(args ...string) error {
<ide> }
<ide>
<ide> cli.LoadConfigFile()
<del> authconfig, ok := cli.configFile.Configs[auth.IndexServerAddress()]
<add> authconfig, ok := cli.configFile.Configs[serverAddress]
<ide> if !ok {
<ide> authconfig = auth.AuthConfig{}
<ide> } | 1 |
PHP | PHP | remove unnecessary line | f9e48b2d59880db3c415a26689c78cc278755973 | <ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> protected function runCommandInForeground(Container $container)
<ide> */
<ide> protected function callAfterCallbacks(Container $container)
<ide> {
<del> if (empty($this->afterCallbacks)) return;
<del>
<ide> foreach ($this->afterCallbacks as $callback)
<ide> {
<ide> $container->call($callback); | 1 |
Text | Text | improve usage of `zero`/`0` | 42de4bb819da32994d35de54aec17195af6636a8 | <ide><path>doc/api/http.md
<ide> added: v0.1.90
<ide> Begin accepting connections on the specified `port` and `hostname`. If the
<ide> `hostname` is omitted, the server will accept connections on any IPv6 address
<ide> (`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. Use a
<del>port value of zero to have the operating system assign an available port.
<add>port value of `0` to have the operating system assign an available port.
<ide>
<ide> To listen to a unix socket, supply a filename instead of port and hostname.
<ide>
<ide><path>doc/api/process.md
<ide> code without properly recovering from the exception can cause additional
<ide> unforeseen and unpredictable issues.
<ide>
<ide> Exceptions thrown from within the event handler will not be caught. Instead the
<del>process will exit with a non zero exit code and the stack trace will be printed.
<add>process will exit with a non-zero exit code and the stack trace will be printed.
<ide> This is to avoid infinite recursion.
<ide>
<ide> Attempting to resume normally after an uncaught exception can be similar to | 2 |
Text | Text | clarify research folder and add samples folder | 9557674c73eb57540672a74366afcab359cb9fd1 | <ide><path>README.md
<ide> This repository contains a number of different models implemented in [TensorFlow
<ide>
<ide> The [official models](official) are a collection of example models that use TensorFlow's high-level APIs. They are intended to be well-maintained, tested, and kept up to date with the latest stable TensorFlow API. They should also be reasonably optimized for fast performance while still being easy to read. We especially recommend newer TensorFlow users to start here.
<ide>
<del>The [research models](research) are a large collection of models implemented in TensorFlow by researchers.
<add>The [research models](research) are a large collection of models implemented in TensorFlow by researchers. It is up to the individual researchers to maintain the models and/or provide support on issues and pull requests.
<ide>
<del>The [tutorial models](tutorials) are models described in the [TensorFlow tutorials](https://www.tensorflow.org/tutorials/).
<add>The [samples](samples) folder contains code snippets and smaller models that demonstrate features of TensorFlow, including code presented in various blog posts.
<add>
<add>The [tutorials](tutorials) folder is a collection of models described in the [TensorFlow tutorials](https://www.tensorflow.org/tutorials/). | 1 |
Javascript | Javascript | defeat race condition when replying to client | 41850a962f56767358405f42415d29d09d236cea | <ide><path>packager/react-packager/src/SocketInterface/SocketServer.js
<ide> class SocketServer {
<ide> _reply(sock, id, type, data) {
<ide> debug('request finished', type);
<ide>
<del> this._jobs--;
<ide> data = toJSON(data);
<ide>
<ide> sock.write(bser.dumpToBuffer({
<ide> id,
<ide> type,
<ide> data,
<ide> }));
<add>
<add> // Debounce the kill timer to make sure all the bytes are sent through
<add> // the socket and the client has time to fully finish and disconnect.
<add> this._dieEventually();
<add> this._jobs--;
<ide> }
<ide>
<ide> _dieEventually(delay = MAX_IDLE_TIME) { | 1 |
Python | Python | clean unused code from fabfile | d5840c488bfc9d0d17f012f266860174b8a7b411 | <ide><path>fabfile.py
<ide> VENV_DIR = path.join(PWD, '.env')
<ide>
<ide>
<del>def counts():
<del> pass
<del> # Tokenize the corpus
<del> # tokenize()
<del> # get_freqs()
<del> # Collate the counts
<del> # cat freqs | sort -k2 | gather_freqs()
<del> # gather_freqs()
<del> # smooth()
<del>
<del>
<del># clean, make, sdist
<del># cd to new env, install from sdist,
<del># Push changes to server
<del># Pull changes on server
<del># clean make init model
<del># test --vectors --slow
<del># train
<del># test --vectors --slow --models
<del># sdist
<del># upload data to server
<del># change to clean venv
<del># py2: install from sdist, test --slow, download data, test --models --vectors
<del># py3: install from sdist, test --slow, download data, test --models --vectors
<del>
<del>
<del>def prebuild(build_dir='/tmp/build_spacy'):
<del> if file_exists(build_dir):
<del> shutil.rmtree(build_dir)
<del> os.mkdir(build_dir)
<del> spacy_dir = path.dirname(__file__)
<del> wn_url = 'http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz'
<del> build_venv = path.join(build_dir, '.env')
<del> with lcd(build_dir):
<del> local('git clone %s .' % spacy_dir)
<del> local('virtualenv ' + build_venv)
<del> with prefix('cd %s && PYTHONPATH=`pwd` && . %s/bin/activate' % (build_dir, build_venv)):
<del> local('pip install cython fabric fabtools pytest')
<del> local('pip install --no-cache-dir -r requirements.txt')
<del> local('fab clean make')
<del> local('cp -r %s/corpora/en/wordnet corpora/en/' % spacy_dir)
<del> local('PYTHONPATH=`pwd` python bin/init_model.py en lang_data corpora spacy/en/data')
<del> local('PYTHONPATH=`pwd` fab test')
<del> local('PYTHONPATH=`pwd` python -m spacy.en.download --force all')
<del> local('PYTHONPATH=`pwd` py.test --models spacy/tests/')
<del>
<del>
<del>def web():
<del> def jade(source_name, out_dir):
<del> pwd = path.join(path.dirname(__file__), 'website')
<del> jade_loc = path.join(pwd, 'src', 'jade', source_name)
<del> out_loc = path.join(pwd, 'site', out_dir)
<del> local('jade -P %s --out %s' % (jade_loc, out_loc))
<del>
<del> with virtualenv(VENV_DIR):
<del> local('./website/create_code_samples spacy/tests/website/ website/src/code/')
<del>
<del> jade('404.jade', '')
<del> jade('home/index.jade', '')
<del> jade('docs/index.jade', 'docs/')
<del> jade('blog/index.jade', 'blog/')
<del>
<del> for collection in ('blog', 'tutorials'):
<del> for post_dir in (Path(__file__).parent / 'website' / 'src' / 'jade' / collection).iterdir():
<del> if post_dir.is_dir() \
<del> and (post_dir / 'index.jade').exists() \
<del> and (post_dir / 'meta.jade').exists():
<del> jade(str(post_dir / 'index.jade'), path.join(collection, post_dir.parts[-1]))
<del>
<del>
<del>def web_publish(assets_path):
<del> from boto.s3.connection import S3Connection, OrdinaryCallingFormat
<del>
<del> site_path = 'website/site'
<del>
<del> os.environ['S3_USE_SIGV4'] = 'True'
<del> conn = S3Connection(host='s3.eu-central-1.amazonaws.com',
<del> calling_format=OrdinaryCallingFormat())
<del> bucket = conn.get_bucket('spacy.io', validate=False)
<del>
<del> keys_left = set([k.name for k in bucket.list()
<del> if not k.name.startswith('resources')])
<del>
<del> for root, dirnames, filenames in os.walk(site_path):
<del> for dirname in dirnames:
<del> target = os.path.relpath(os.path.join(root, dirname), site_path)
<del> source = os.path.join(target, 'index.html')
<del>
<del> if os.path.exists(os.path.join(root, dirname, 'index.html')):
<del> key = bucket.new_key(source)
<del> key.set_redirect('//%s/%s' % (bucket.name, target))
<del> print('adding redirect for %s' % target)
<del>
<del> keys_left.remove(source)
<del>
<del> for filename in filenames:
<del> source = os.path.join(root, filename)
<del>
<del> target = os.path.relpath(root, site_path)
<del> if target == '.':
<del> target = filename
<del> elif filename != 'index.html':
<del> target = os.path.join(target, filename)
<del>
<del> key = bucket.new_key(target)
<del> key.set_metadata('Content-Type', 'text/html')
<del> key.set_contents_from_filename(source)
<del> print('uploading %s' % target)
<del>
<del> keys_left.remove(target)
<del>
<del> for key_name in keys_left:
<del> print('deleting %s' % key_name)
<del> bucket.delete_key(key_name)
<del>
<del> local('aws s3 sync --delete %s s3://spacy.io/resources' % assets_path)
<del>
<del>
<del>def publish(version):
<del> with virtualenv(VENV_DIR):
<del> local('git push origin master')
<del> local('git tag -a %s' % version)
<del> local('git push origin %s' % version)
<del> local('python setup.py sdist')
<del> local('python setup.py register')
<del> local('twine upload dist/spacy-%s.tar.gz' % version)
<del>
<del>
<ide> def env(lang="python2.7"):
<ide> if file_exists('.env'):
<ide> local('rm -rf .env')
<ide> def test():
<ide> with virtualenv(VENV_DIR):
<ide> with lcd(path.dirname(__file__)):
<ide> local('py.test -x spacy/tests')
<del>
<del>
<del>def train(json_dir=None, dev_loc=None, model_dir=None):
<del> if json_dir is None:
<del> json_dir = 'corpora/en/json'
<del> if model_dir is None:
<del> model_dir = 'models/en/'
<del> with virtualenv(VENV_DIR):
<del> with lcd(path.dirname(__file__)):
<del> local('python bin/init_model.py en lang_data/ corpora/ ' + model_dir)
<del> local('python bin/parser/train.py -p en %s/train/ %s/development %s' % (json_dir, json_dir, model_dir))
<del>
<del>
<del>def travis():
<del> local('open https://travis-ci.org/honnibal/thinc')
<del>
<del>
<del>def pos():
<del> with virtualenv(VENV_DIR):
<del> local('python tools/train.py ~/work_data/docparse/wsj02-21.conll ~/work_data/docparse/wsj22.conll spacy/en/data')
<del> local('python tools/tag.py ~/work_data/docparse/wsj22.raw /tmp/tmp')
<del> local('python tools/eval_pos.py ~/work_data/docparse/wsj22.conll /tmp/tmp')
<del>
<del>
<del>def ner():
<del> local('rm -rf data/en/ner')
<del> local('python tools/train_ner.py ~/work_data/docparse/wsj02-21.conll data/en/ner')
<del> local('python tools/tag_ner.py ~/work_data/docparse/wsj22.raw /tmp/tmp')
<del> local('python tools/eval_ner.py ~/work_data/docparse/wsj22.conll /tmp/tmp | tail')
<del>
<del>
<del>def conll():
<del> local('rm -rf data/en/ner')
<del> local('python tools/conll03_train.py ~/work_data/ner/conll2003/eng.train data/en/ner/')
<del> local('python tools/conll03_eval.py ~/work_data/ner/conll2003/eng.testa') | 1 |
Java | Java | use a default for introspect_type_level_mapping | 914557b9753d2822f79b7be9d33a1258895a69e9 | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
<ide> import java.util.Map;
<ide> import java.util.Set;
<ide> import java.util.concurrent.ConcurrentHashMap;
<add>
<ide> import javax.servlet.ServletException;
<ide> import javax.servlet.ServletRequest;
<ide> import javax.servlet.ServletResponse;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<del>
<ide> import org.springframework.beans.BeanUtils;
<ide> import org.springframework.beans.factory.BeanFactory;
<ide> import org.springframework.beans.factory.BeanFactoryAware;
<ide> private boolean useTypeLevelMapping(HttpServletRequest request) {
<ide> if (!hasTypeLevelMapping() || ObjectUtils.isEmpty(getTypeLevelMapping().value())) {
<ide> return false;
<ide> }
<del> return (Boolean) request.getAttribute(HandlerMapping.INTROSPECT_TYPE_LEVEL_MAPPING);
<add> Object value = request.getAttribute(HandlerMapping.INTROSPECT_TYPE_LEVEL_MAPPING);
<add> return (value != null) ? (Boolean) value : Boolean.TRUE;
<ide> }
<ide>
<ide> private boolean useSuffixPattern(HttpServletRequest request) { | 1 |
Mixed | Ruby | apply suggestions from code review | 22baff39bc1433bfdd26139d2d18bd34c902c7fc | <ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_bottle_disabled
<ide>
<ide> def audit_github_repository
<ide> user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula
<del> user ||=nil
<del> repo ||=nil
<add> user ||= nil
<add> repo ||= nil
<ide> return if user.nil?
<ide>
<ide> warning = SharedAudits.github(user, repo)
<ide> def audit_github_repository
<ide> def audit_gitlab_repository
<ide> user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if @new_formula
<ide> user ||= nil
<del> repo ||=nil
<add> repo ||= nil
<ide> return if user.nil?
<ide>
<ide> warning = SharedAudits.gitlab(user, repo)
<ide><path>docs/Manpage.md
<ide> directory.
<ide> Update SPDX license data in the Homebrew repository.
<ide>
<ide> * `--fail-if-changed`:
<del> Return a failing status code if current license data's version is different fromthe upstream. This can be used to notify CI when the SPDX license data is out of date.
<add> Return a failing status code if the current license data's version is different from the upstream. This can be used to notify CI when the SPDX license data is out of date.
<ide>
<ide> ### `update-test` [*`options`*]
<ide> | 2 |
Javascript | Javascript | fix minor bug | deecc75ca313e6c281ede482493f01d1647bb0a1 | <ide><path>examples/js/cameras/CinematicCamera.js
<ide> THREE.CinematicCamera.prototype.renderCinematic = function ( scene, renderer ) {
<ide> scene.overrideMaterial = this.materialDepth;
<ide> renderer.setRenderTarget( this.postprocessing.rtTextureDepth );
<ide> renderer.clear();
<del> renderer.render( scene, camera, this.postprocessing.rtTextureDepth );
<add> renderer.render( scene, camera );
<ide>
<ide> // Render bokeh composite
<ide> | 1 |
Go | Go | remove unused platform field from configwrapper | b33f3c7802ac4308c10ca3fdbeec8a3fc46c3c97 | <ide><path>client/container_create.go
<ide> type configWrapper struct {
<ide> *container.Config
<ide> HostConfig *container.HostConfig
<ide> NetworkingConfig *network.NetworkingConfig
<del> Platform *specs.Platform
<ide> }
<ide>
<ide> // ContainerCreate creates a new container based on the given configuration. | 1 |
Javascript | Javascript | add error class for restore errors | bbedceaa16569edd549a03710c95c27f21faafdc | <ide><path>lib/Compilation.js
<ide> const ModuleDependencyWarning = require("./ModuleDependencyWarning");
<ide> const ModuleGraph = require("./ModuleGraph");
<ide> const ModuleNotFoundError = require("./ModuleNotFoundError");
<ide> const ModuleProfile = require("./ModuleProfile");
<add>const ModuleRestoreError = require("./ModuleRestoreError");
<ide> const ModuleTemplate = require("./ModuleTemplate");
<ide> const RuntimeTemplate = require("./RuntimeTemplate");
<ide> const Stats = require("./Stats");
<ide> class Compilation {
<ide>
<ide> const cacheName = `${this.compilerPath}/module/${identifier}`;
<ide> this.cache.get(cacheName, null, (err, cacheModule) => {
<del> if (err) return callback(err);
<add> if (err) return callback(new ModuleRestoreError(module, err));
<ide>
<ide> if (currentProfile !== undefined) {
<ide> currentProfile.markRestoringEnd();
<ide><path>lib/ModuleRestoreError.js
<add>/*
<add> MIT License http://www.opensource.org/licenses/mit-license.php
<add> Author Tobias Koppers @sokra
<add>*/
<add>
<add>"use strict";
<add>
<add>const WebpackError = require("./WebpackError");
<add>
<add>class ModuleRestoreError extends WebpackError {
<add> constructor(module, err) {
<add> let message = "Module restore failed: ";
<add> let details = undefined;
<add> if (err !== null && typeof err === "object") {
<add> if (typeof err.stack === "string" && err.stack) {
<add> const stack = err.stack;
<add> message += stack;
<add> } else if (typeof err.message === "string" && err.message) {
<add> message += err.message;
<add> } else {
<add> message += err;
<add> }
<add> } else {
<add> message = err;
<add> }
<add>
<add> super(message);
<add>
<add> this.name = "ModuleRestoreError";
<add> this.details = details;
<add> this.module = module;
<add> this.error = err;
<add>
<add> Error.captureStackTrace(this, this.constructor);
<add> }
<add>}
<add>
<add>module.exports = ModuleRestoreError; | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.