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
Python
Python
correct another utf-8 issue
07f73ddeb693b038690181d01ea0c21cedd48846
<ide><path>glances/outputs/glances_curses.py <ide> def display_plugin(self, plugin_stats, <ide> try: <ide> # Python 2: we need to decode to get real screen size because utf-8 special tree chars <ide> # occupy several bytes <del> offset = len(m['msg'].decode("utf-8")) <add> offset = len(m['msg'].decode("utf-8", "replace")) <ide> except AttributeError: <ide> # Python 3: strings are strings and bytes are bytes, all is <ide> # good
1
Java
Java
add support for importaware callback
9ba927215edc7b8f936d6205d8f1c0c10b2202a2
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/generator/AotContributingBeanFactoryPostProcessor.java <add>/* <add> * Copyright 2002-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.beans.factory.generator; <add> <add>import org.springframework.beans.BeansException; <add>import org.springframework.beans.factory.config.BeanFactoryPostProcessor; <add>import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; <add>import org.springframework.lang.Nullable; <add> <add>/** <add> * Specialization of {@link BeanFactoryPostProcessor} that contributes bean <add> * factory optimizations ahead of time, using generated code that replaces <add> * runtime behavior. <add> * <add> * @author Stephane Nicoll <add> * @since 6.0 <add> */ <add>@FunctionalInterface <add>public interface AotContributingBeanFactoryPostProcessor extends BeanFactoryPostProcessor { <add> <add> /** <add> * Contribute a {@link BeanFactoryContribution} for the given bean factory, <add> * if applicable. <add> * @param beanFactory the bean factory to optimize <add> * @return the contribution to use or {@code null} <add> */ <add> @Nullable <add> BeanFactoryContribution contribute(ConfigurableListableBeanFactory beanFactory); <add> <add> @Override <add> default void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <add> <add> } <add> <add>} <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.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> <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <add>import java.util.HashMap; <ide> import java.util.HashSet; <ide> import java.util.LinkedHashMap; <ide> import java.util.LinkedHashSet; <ide> import java.util.List; <ide> import java.util.Map; <ide> import java.util.Set; <ide> <add>import javax.lang.model.element.Modifier; <add> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <ide> <ide> import org.springframework.aop.framework.autoproxy.AutoProxyUtils; <add>import org.springframework.aot.hint.ResourceHints; <add>import org.springframework.aot.hint.TypeReference; <ide> import org.springframework.beans.PropertyValues; <ide> import org.springframework.beans.factory.BeanClassLoaderAware; <ide> import org.springframework.beans.factory.BeanDefinitionStoreException; <ide> import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; <ide> import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor; <ide> import org.springframework.beans.factory.config.SingletonBeanRegistry; <add>import org.springframework.beans.factory.generator.AotContributingBeanFactoryPostProcessor; <add>import org.springframework.beans.factory.generator.BeanFactoryContribution; <add>import org.springframework.beans.factory.generator.BeanFactoryInitialization; <ide> import org.springframework.beans.factory.parsing.FailFastProblemReporter; <ide> import org.springframework.beans.factory.parsing.PassThroughSourceExtractor; <ide> import org.springframework.beans.factory.parsing.ProblemReporter; <ide> import org.springframework.core.type.MethodMetadata; <ide> import org.springframework.core.type.classreading.CachingMetadataReaderFactory; <ide> import org.springframework.core.type.classreading.MetadataReaderFactory; <add>import org.springframework.javapoet.CodeBlock; <add>import org.springframework.javapoet.CodeBlock.Builder; <add>import org.springframework.javapoet.MethodSpec; <add>import org.springframework.javapoet.ParameterizedTypeName; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ClassUtils; <ide> * @since 3.0 <ide> */ <ide> public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPostProcessor, <del> PriorityOrdered, ResourceLoaderAware, ApplicationStartupAware, BeanClassLoaderAware, EnvironmentAware { <add> AotContributingBeanFactoryPostProcessor, PriorityOrdered, ResourceLoaderAware, ApplicationStartupAware, <add> BeanClassLoaderAware, EnvironmentAware { <ide> <ide> /** <ide> * A {@code BeanNameGenerator} using fully qualified class names as default bean names. <ide> public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) <ide> beanFactory.addBeanPostProcessor(new ImportAwareBeanPostProcessor(beanFactory)); <ide> } <ide> <add> @Override <add> public BeanFactoryContribution contribute(ConfigurableListableBeanFactory beanFactory) { <add> return (beanFactory.containsBean(IMPORT_REGISTRY_BEAN_NAME) <add> ? new ImportAwareBeanFactoryConfiguration(beanFactory) : null); <add> } <add> <ide> /** <ide> * Build and validate a configuration model based on the registry of <ide> * {@link Configuration} classes. <ide> public Object postProcessBeforeInitialization(Object bean, String beanName) { <ide> } <ide> } <ide> <add> private static final class ImportAwareBeanFactoryConfiguration implements BeanFactoryContribution { <add> <add> private final ConfigurableListableBeanFactory beanFactory; <add> <add> private ImportAwareBeanFactoryConfiguration(ConfigurableListableBeanFactory beanFactory) { <add> this.beanFactory = beanFactory; <add> } <add> <add> <add> @Override <add> public void applyTo(BeanFactoryInitialization initialization) { <add> Map<String, String> mappings = buildImportAwareMappings(); <add> if (!mappings.isEmpty()) { <add> MethodSpec method = initialization.generatedTypeContext().getMainGeneratedType() <add> .addMethod(beanPostProcessorMethod(mappings)); <add> initialization.contribute(code -> code.addStatement("beanFactory.addBeanPostProcessor($N())", method)); <add> ResourceHints resourceHints = initialization.generatedTypeContext().runtimeHints().resources(); <add> mappings.forEach((target, importedFrom) -> resourceHints.registerType( <add> TypeReference.of(importedFrom))); <add> } <add> } <add> <add> private MethodSpec.Builder beanPostProcessorMethod(Map<String, String> mappings) { <add> Builder code = CodeBlock.builder(); <add> code.addStatement("$T mappings = new $T<>()", ParameterizedTypeName.get( <add> Map.class, String.class, String.class), HashMap.class); <add> mappings.forEach((key, value) -> code.addStatement("mappings.put($S, $S)", key, value)); <add> code.addStatement("return new $T($L)", ImportAwareAotBeanPostProcessor.class, "mappings"); <add> return MethodSpec.methodBuilder("createImportAwareBeanPostProcessor") <add> .returns(ImportAwareAotBeanPostProcessor.class) <add> .addModifiers(Modifier.PRIVATE).addCode(code.build()); <add> } <add> <add> private Map<String, String> buildImportAwareMappings() { <add> ImportRegistry ir = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class); <add> Map<String, String> mappings = new LinkedHashMap<>(); <add> for (String name : this.beanFactory.getBeanDefinitionNames()) { <add> Class<?> beanType = this.beanFactory.getType(name); <add> if (beanType != null && ImportAware.class.isAssignableFrom(beanType)) { <add> String type = ClassUtils.getUserClass(beanType).getName(); <add> AnnotationMetadata importingClassMetadata = ir.getImportingClassFor(type); <add> if (importingClassMetadata != null) { <add> mappings.put(type, importingClassMetadata.getClassName()); <add> } <add> } <add> } <add> return mappings; <add> } <add> <add> } <add> <ide> } <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ImportAwareAotBeanPostProcessor.java <add>/* <add> * Copyright 2002-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.context.annotation; <add> <add>import java.io.IOException; <add>import java.util.Map; <add> <add>import org.springframework.beans.factory.config.BeanPostProcessor; <add>import org.springframework.core.type.classreading.CachingMetadataReaderFactory; <add>import org.springframework.core.type.classreading.MetadataReader; <add>import org.springframework.core.type.classreading.MetadataReaderFactory; <add>import org.springframework.lang.Nullable; <add>import org.springframework.util.ClassUtils; <add> <add>/** <add> * A {@link BeanPostProcessor} that honours {@link ImportAware} callback using <add> * a mapping computed at build time. <add> * <add> * @author Stephane Nicoll <add> * @since 6.0 <add> */ <add>public final class ImportAwareAotBeanPostProcessor implements BeanPostProcessor { <add> <add> private final MetadataReaderFactory metadataReaderFactory; <add> <add> private final Map<String, String> importsMapping; <add> <add> public ImportAwareAotBeanPostProcessor(Map<String, String> importsMapping) { <add> this.metadataReaderFactory = new CachingMetadataReaderFactory(); <add> this.importsMapping = Map.copyOf(importsMapping); <add> } <add> <add> @Override <add> public Object postProcessBeforeInitialization(Object bean, String beanName) { <add> if (bean instanceof ImportAware) { <add> setAnnotationMetadata((ImportAware) bean); <add> } <add> return bean; <add> } <add> <add> private void setAnnotationMetadata(ImportAware instance) { <add> String importingClass = getImportingClassFor(instance); <add> if (importingClass == null) { <add> return; // import aware configuration class not imported <add> } <add> try { <add> MetadataReader metadataReader = this.metadataReaderFactory.getMetadataReader(importingClass); <add> instance.setImportMetadata(metadataReader.getAnnotationMetadata()); <add> } <add> catch (IOException ex) { <add> throw new IllegalStateException(String.format("Failed to read metadata for '%s'", importingClass), ex); <add> } <add> } <add> <add> @Nullable <add> private String getImportingClassFor(ImportAware instance) { <add> String target = ClassUtils.getUserClass(instance).getName(); <add> return this.importsMapping.get(target); <add> } <add> <add>} <ide><path>spring-context/src/test/java/org/springframework/context/annotation/ImportAwareAotBeanPostProcessorTests.java <add>/* <add> * Copyright 2002-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.context.annotation; <add> <add>import java.util.Map; <add> <add>import org.junit.jupiter.api.Test; <add> <add>import org.springframework.core.type.AnnotationMetadata; <add> <add>import static org.assertj.core.api.Assertions.assertThat; <add>import static org.assertj.core.api.Assertions.assertThatIllegalStateException; <add> <add>/** <add> * Tests for {@link ImportAwareAotBeanPostProcessor}. <add> * <add> * @author Stephane Nicoll <add> */ <add>class ImportAwareAotBeanPostProcessorTests { <add> <add> @Test <add> void postProcessOnMatchingCandidate() { <add> ImportAwareAotBeanPostProcessor postProcessor = new ImportAwareAotBeanPostProcessor( <add> Map.of(TestImportAware.class.getName(), ImportAwareAotBeanPostProcessorTests.class.getName())); <add> TestImportAware importAware = new TestImportAware(); <add> postProcessor.postProcessBeforeInitialization(importAware, "test"); <add> assertThat(importAware.importMetadata).isNotNull(); <add> assertThat(importAware.importMetadata.getClassName()) <add> .isEqualTo(ImportAwareAotBeanPostProcessorTests.class.getName()); <add> } <add> <add> @Test <add> void postProcessOnMatchingCandidateWithNestedClass() { <add> ImportAwareAotBeanPostProcessor postProcessor = new ImportAwareAotBeanPostProcessor( <add> Map.of(TestImportAware.class.getName(), TestImporting.class.getName())); <add> TestImportAware importAware = new TestImportAware(); <add> postProcessor.postProcessBeforeInitialization(importAware, "test"); <add> assertThat(importAware.importMetadata).isNotNull(); <add> assertThat(importAware.importMetadata.getClassName()) <add> .isEqualTo(TestImporting.class.getName()); <add> } <add> <add> @Test <add> void postProcessOnNoCandidateDoesNotInvokeCallback() { <add> ImportAwareAotBeanPostProcessor postProcessor = new ImportAwareAotBeanPostProcessor( <add> Map.of(String.class.getName(), ImportAwareAotBeanPostProcessorTests.class.getName())); <add> TestImportAware importAware = new TestImportAware(); <add> postProcessor.postProcessBeforeInitialization(importAware, "test"); <add> assertThat(importAware.importMetadata).isNull(); <add> } <add> <add> @Test <add> void postProcessOnMatchingCandidateWithNoMetadata() { <add> ImportAwareAotBeanPostProcessor postProcessor = new ImportAwareAotBeanPostProcessor( <add> Map.of(TestImportAware.class.getName(), "com.example.invalid.DoesNotExist")); <add> TestImportAware importAware = new TestImportAware(); <add> assertThatIllegalStateException().isThrownBy(() -> postProcessor.postProcessBeforeInitialization(importAware, "test")) <add> .withMessageContaining("Failed to read metadata for 'com.example.invalid.DoesNotExist'"); <add> } <add> <add> <add> static class TestImportAware implements ImportAware { <add> <add> private AnnotationMetadata importMetadata; <add> <add> @Override <add> public void setImportMetadata(AnnotationMetadata importMetadata) { <add> this.importMetadata = importMetadata; <add> } <add> } <add> <add> static class TestImporting { <add> <add> } <add> <add>} <ide><path>spring-context/src/test/java/org/springframework/context/annotation/ImportAwareBeanFactoryContributionTests.java <add>/* <add> * Copyright 2002-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.context.annotation; <add> <add>import java.io.IOException; <add>import java.io.StringWriter; <add> <add>import org.junit.jupiter.api.Test; <add> <add>import org.springframework.aot.generator.DefaultGeneratedTypeContext; <add>import org.springframework.aot.generator.GeneratedType; <add>import org.springframework.aot.generator.GeneratedTypeContext; <add>import org.springframework.beans.factory.generator.BeanFactoryContribution; <add>import org.springframework.beans.factory.generator.BeanFactoryInitialization; <add>import org.springframework.beans.factory.support.DefaultListableBeanFactory; <add>import org.springframework.beans.factory.support.RootBeanDefinition; <add>import org.springframework.beans.testfixture.beans.factory.generator.SimpleConfiguration; <add>import org.springframework.context.testfixture.context.generator.annotation.ImportConfiguration; <add>import org.springframework.javapoet.ClassName; <add>import org.springframework.javapoet.support.CodeSnippet; <add>import org.springframework.lang.Nullable; <add> <add>import static org.assertj.core.api.Assertions.assertThat; <add> <add>/** <add> * Tests for {@code ImportAwareBeanFactoryConfiguration}. <add> * <add> * @author Stephane Nicoll <add> */ <add>public class ImportAwareBeanFactoryContributionTests { <add> <add> @Test <add> void contributeWithImportAwareConfigurationRegistersBeanPostProcessor() { <add> BeanFactoryContribution contribution = createContribution(ImportConfiguration.class); <add> assertThat(contribution).isNotNull(); <add> BeanFactoryInitialization initialization = new BeanFactoryInitialization(createGenerationContext()); <add> contribution.applyTo(initialization); <add> assertThat(CodeSnippet.of(initialization.toCodeBlock()).getSnippet()).isEqualTo(""" <add> beanFactory.addBeanPostProcessor(createImportAwareBeanPostProcessor()); <add> """); <add> } <add> <add> @Test <add> void contributeWithImportAwareConfigurationCreateMappingsMethod() { <add> BeanFactoryContribution contribution = createContribution(ImportConfiguration.class); <add> assertThat(contribution).isNotNull(); <add> GeneratedTypeContext generationContext = createGenerationContext(); <add> contribution.applyTo(new BeanFactoryInitialization(generationContext)); <add> assertThat(codeOf(generationContext.getMainGeneratedType())).contains(""" <add> private ImportAwareAotBeanPostProcessor createImportAwareBeanPostProcessor() { <add> Map<String, String> mappings = new HashMap<>(); <add> mappings.put("org.springframework.context.testfixture.context.generator.annotation.ImportAwareConfiguration", "org.springframework.context.testfixture.context.generator.annotation.ImportConfiguration"); <add> return new ImportAwareAotBeanPostProcessor(mappings); <add> } <add> """); <add> <add> } <add> <add> @Test <add> void contributeWithImportAwareConfigurationRegisterBytecodeResourceHint() { <add> BeanFactoryContribution contribution = createContribution(ImportConfiguration.class); <add> assertThat(contribution).isNotNull(); <add> GeneratedTypeContext generationContext = createGenerationContext(); <add> contribution.applyTo(new BeanFactoryInitialization(generationContext)); <add> assertThat(generationContext.runtimeHints().resources().resourcePatterns()) <add> .singleElement().satisfies(resourceHint -> assertThat(resourceHint.getIncludes()).containsOnly( <add> "org/springframework/context/testfixture/context/generator/annotation/ImportConfiguration.class")); <add> } <add> <add> @Test <add> void contributeWithNoImportAwareConfigurationReturnsNull() { <add> assertThat(createContribution(SimpleConfiguration.class)).isNull(); <add> } <add> <add> <add> @Nullable <add> private BeanFactoryContribution createContribution(Class<?> type) { <add> DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); <add> beanFactory.registerBeanDefinition("configuration", new RootBeanDefinition(type)); <add> ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); <add> pp.postProcessBeanFactory(beanFactory); <add> return pp.contribute(beanFactory); <add> } <add> <add> private GeneratedTypeContext createGenerationContext() { <add> return new DefaultGeneratedTypeContext("com.example", packageName -> <add> GeneratedType.of(ClassName.get(packageName, "Test"))); <add> } <add> <add> private String codeOf(GeneratedType type) { <add> try { <add> StringWriter out = new StringWriter(); <add> type.toJavaFile().writeTo(out); <add> return out.toString(); <add> } <add> catch (IOException ex) { <add> throw new IllegalStateException(ex); <add> } <add> } <add> <add>} <ide><path>spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/generator/annotation/ImportAwareConfiguration.java <add>/* <add> * Copyright 2002-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.context.testfixture.context.generator.annotation; <add> <add>import org.springframework.context.EnvironmentAware; <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.context.annotation.ImportAware; <add>import org.springframework.core.env.Environment; <add>import org.springframework.core.type.AnnotationMetadata; <add> <add>@Configuration(proxyBeanMethods = false) <add>@SuppressWarnings("unused") <add>public class ImportAwareConfiguration implements ImportAware, EnvironmentAware { <add> <add> private AnnotationMetadata annotationMetadata; <add> <add> @Override <add> public void setImportMetadata(AnnotationMetadata importMetadata) { <add> this.annotationMetadata = importMetadata; <add> } <add> <add> @Override <add> public void setEnvironment(Environment environment) { <add> <add> } <add> <add>} <ide><path>spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/generator/annotation/ImportConfiguration.java <add>/* <add> * Copyright 2002-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.context.testfixture.context.generator.annotation; <add> <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.context.annotation.Import; <add> <add>@Configuration(proxyBeanMethods = false) <add>@Import(ImportAwareConfiguration.class) <add>public class ImportConfiguration { <add>}
7
Ruby
Ruby
improve explanation of with_options
91871f25f01f6b5d67e7da4aeb6dec0fae7b18fe
<ide><path>activesupport/lib/active_support/core_ext/object/misc.rb <ide> def returning(value) <ide> value <ide> end <ide> <del> # An elegant way to refactor out common options <add> # An elegant way to factor duplication out of options passed to a series of <add> # method calls. Each method called in the block, with the block variable as <add> # the receiver, will have its options merged with the default +options+ hash <add> # provided. Each method called on the block variable must take an options <add> # hash as its final argument. <ide> # <ide> # with_options :order => 'created_at', :class_name => 'Comment' do |post| <ide> # post.has_many :comments, :conditions => ['approved = ?', true], :dependent => :delete_all
1
Go
Go
remove setup logging from sysinit
a64ebabdfaca66709d664cb87a35d689e35cfd0d
<ide><path>sysinit/sysinit.go <ide> import ( <ide> "github.com/dotcloud/docker/execdriver" <ide> _ "github.com/dotcloud/docker/execdriver/lxc" <ide> _ "github.com/dotcloud/docker/execdriver/native" <del> "io" <ide> "io/ioutil" <ide> "log" <ide> "os" <ide> func SysInit() { <ide> driver = flag.String("driver", "", "exec driver") <ide> pipe = flag.Int("pipe", 0, "sync pipe fd") <ide> console = flag.String("console", "", "console (pty slave) path") <del> logFile = flag.String("log", "", "log file path") <ide> ) <ide> flag.Parse() <ide> <del> if err := setupLogging(*logFile); err != nil { <del> log.Fatalf("setup logging %s", err) <del> } <del> <ide> // Get env <ide> var env []string <ide> content, err := ioutil.ReadFile(".dockerenv") <ide> func SysInit() { <ide> log.Fatal(err) <ide> } <ide> } <del> <del>func setupLogging(logFile string) (err error) { <del> var writer io.Writer <del> switch logFile { <del> case "stderr": <del> writer = os.Stderr <del> case "none", "": <del> writer = ioutil.Discard <del> default: <del> writer, err = os.OpenFile(logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0755) <del> if err != nil { <del> return err <del> } <del> } <del> log.SetOutput(writer) <del> return nil <del>}
1
Javascript
Javascript
add animated color example
1aec8819585d1e78f646bb0aac29d400083cf144
<ide><path>packages/rn-tester/js/examples/Animated/AnimatedIndex.js <ide> import ComposeAnimationsWithEasingExample from './ComposeAnimationsWithEasingExa <ide> import TransformBounceExample from './TransformBounceExample'; <ide> import ComposingExample from './ComposingExample'; <ide> import TransformStylesExample from './TransformStylesExample'; <add>import ColorStylesExample from './ColorStylesExample'; <ide> <ide> export default ({ <ide> framework: 'React', <ide> export default ({ <ide> showIndividualExamples: true, <ide> examples: [ <ide> TransformStylesExample, <add> ColorStylesExample, <ide> FadeInViewExample, <ide> ComposingExample, <ide> EasingExample, <ide><path>packages/rn-tester/js/examples/Animated/ColorStylesExample.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow strict-local <add> * @format <add> */ <add> <add>import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; <add>import * as React from 'react'; <add>import {Animated, View, StyleSheet} from 'react-native'; <add>import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; <add>import RNTesterButton from '../../components/RNTesterButton'; <add>import ToggleNativeDriver from './utils/ToggleNativeDriver'; <add> <add>function AnimatedView({useNativeDriver}: {useNativeDriver: boolean}) { <add> const animations = []; <add> <add> const animatedViewStyle = { <add> backgroundColor: new Animated.Color('blue'), <add> borderColor: new Animated.Color('orange'), <add> }; <add> animations.push( <add> Animated.timing(animatedViewStyle.backgroundColor, { <add> toValue: new Animated.Color('red'), <add> duration: 1000, <add> useNativeDriver, <add> }), <add> ); <add> animations.push( <add> Animated.timing(animatedViewStyle.borderColor, { <add> toValue: new Animated.Color('purple'), <add> duration: 1000, <add> useNativeDriver, <add> }), <add> ); <add> <add> const animatedTextStyle = { <add> color: new Animated.Color('blue'), <add> }; <add> animations.push( <add> Animated.timing(animatedTextStyle.color, { <add> toValue: new Animated.Color('red'), <add> duration: 1000, <add> useNativeDriver, <add> }), <add> ); <add> <add> const animatedImageStyle = { <add> tintColor: new Animated.Color('blue'), <add> }; <add> animations.push( <add> Animated.timing(animatedImageStyle.tintColor, { <add> toValue: new Animated.Color('red'), <add> duration: 1000, <add> useNativeDriver, <add> }), <add> ); <add> <add> const animation = Animated.parallel(animations); <add> <add> return ( <add> <> <add> <RNTesterButton <add> onPress={() => { <add> animation.reset(); <add> animation.start(); <add> }}> <add> Press to animate <add> </RNTesterButton> <add> <Animated.View style={[styles.animatedView, animatedViewStyle]} /> <add> <Animated.Text style={[styles.animatedText, animatedTextStyle]}> <add> Hello World <add> </Animated.Text> <add> <Animated.Image <add> style={[styles.animatedImage, animatedImageStyle]} <add> source={require('../../assets/bunny.png')} <add> /> <add> </> <add> ); <add>} <add> <add>function AnimatedColorStyleExample(): React.Node { <add> const [useNativeDriver, setUseNativeDriver] = React.useState(false); <add> <add> return ( <add> <View> <add> <RNTConfigurationBlock> <add> <ToggleNativeDriver <add> value={useNativeDriver} <add> onValueChange={setUseNativeDriver} <add> /> <add> </RNTConfigurationBlock> <add> <AnimatedView <add> key={`animated-view-use-${useNativeDriver ? 'native' : 'js'}-driver`} <add> useNativeDriver={useNativeDriver} <add> /> <add> </View> <add> ); <add>} <add> <add>const styles = StyleSheet.create({ <add> animatedView: { <add> height: 100, <add> width: 100, <add> borderWidth: 10, <add> }, <add> animatedText: { <add> fontSize: 20, <add> fontWeight: 'bold', <add> }, <add> animatedImage: { <add> height: 100, <add> width: 100, <add> }, <add>}); <add> <add>export default ({ <add> title: 'Color Styles', <add> name: 'colorStyles', <add> description: 'Animations of color styles.', <add> render: () => <AnimatedColorStyleExample />, <add>}: RNTesterModuleExample);
2
Javascript
Javascript
ensure computed.oneway is exported properly
7d3e25ea41ad91978e2405690f5d715e4074f55f
<ide><path>packages/ember-metal/lib/main.js <ide> import { <ide> gte, <ide> lt, <ide> lte, <del> oneWay, <add> oneWay as computedOneWay, <ide> readOnly, <ide> defaultTo, <ide> deprecatingAlias, <ide> computed.gte = gte; <ide> computed.lt = lt; <ide> computed.lte = lte; <ide> computed.alias = alias; <del>computed.oneWay = oneWay; <del>computed.reads = oneWay; <add>computed.oneWay = computedOneWay; <add>computed.reads = computedOneWay; <ide> computed.readOnly = readOnly; <ide> computed.defaultTo = defaultTo; <ide> computed.deprecatingAlias = deprecatingAlias;
1
Javascript
Javascript
improve argument validation
26c973d4b33210111034c360bf6f6f44d1f41cdc
<ide><path>lib/child_process.js <ide> const { getValidatedPath } = require('internal/fs/utils'); <ide> const { <ide> isInt32, <ide> validateAbortSignal, <add> validateArray, <ide> validateBoolean, <add> validateFunction, <ide> validateObject, <ide> validateString, <ide> } = require('internal/validators'); <ide> function fork(modulePath, args = [], options) { <ide> <ide> if (args == null) { <ide> args = []; <del> } else if (typeof args !== 'object') { <del> throw new ERR_INVALID_ARG_VALUE('args', args); <del> } else if (!ArrayIsArray(args)) { <add> } else if (typeof args === 'object' && !ArrayIsArray(args)) { <ide> options = args; <ide> args = []; <add> } else { <add> validateArray(args, 'args'); <ide> } <ide> <del> if (options == null) { <del> options = {}; <del> } else if (typeof options !== 'object') { <del> throw new ERR_INVALID_ARG_VALUE('options', options); <del> } else { <del> options = { ...options }; <add> if (options != null) { <add> validateObject(options, 'options'); <ide> } <add> options = { ...options, shell: false }; <add> options.execPath = options.execPath || process.execPath; <ide> <ide> // Prepare arguments for fork: <ide> execArgv = options.execArgv || process.execArgv; <ide> function fork(modulePath, args = [], options) { <ide> throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio'); <ide> } <ide> <del> options.execPath = options.execPath || process.execPath; <del> options.shell = false; <del> <ide> return spawn(options.execPath, args, options); <ide> } <ide> <ide> ObjectDefineProperty(exec, promisify.custom, { <ide> * @returns {ChildProcess} <ide> */ <ide> function execFile(file, args = [], options, callback) { <del> if (args == null) { <del> args = []; <del> } else if (typeof args === 'object') { <del> if (!ArrayIsArray(args)) { <del> callback = options; <del> options = args; <del> args = []; <del> } <add> if (args != null && typeof args === 'object' && !ArrayIsArray(args)) { <add> callback = options; <add> options = args; <add> args = null; <ide> } else if (typeof args === 'function') { <ide> callback = args; <del> options = {}; <del> args = []; <del> } else { <del> throw new ERR_INVALID_ARG_VALUE('args', args); <add> options = null; <add> args = null; <ide> } <ide> <del> if (options == null) { <del> options = {}; <del> } else if (typeof options === 'function') { <add> if (typeof options === 'function') { <ide> callback = options; <del> options = {}; <del> } else if (typeof options !== 'object') { <del> throw new ERR_INVALID_ARG_VALUE('options', options); <add> options = null; <add> } else if (options != null) { <add> validateObject(options, 'options'); <ide> } <ide> <del> if (callback && typeof callback !== 'function') { <del> throw new ERR_INVALID_ARG_VALUE('callback', callback); <add> if (callback != null) { <add> validateFunction(callback, 'callback'); <ide> } <ide> <ide> options = { <ide> function execFile(file, args = [], options, callback) { <ide> return; <ide> } <ide> <del> if (args.length !== 0) <add> if (args?.length) <ide> cmd += ` ${ArrayPrototypeJoin(args, ' ')}`; <ide> <ide> if (!ex) { <ide><path>test/parallel/test-child-process-fork-args.js <ide> const expectedEnv = { foo: 'bar' }; <ide> fork(fixtures.path('child-process-echo-options.js'), arg); <ide> }, <ide> { <del> code: 'ERR_INVALID_ARG_VALUE', <add> code: 'ERR_INVALID_ARG_TYPE', <ide> name: 'TypeError' <ide> } <ide> ); <ide> const expectedEnv = { foo: 'bar' }; <ide> fork(fixtures.path('child-process-echo-options.js'), [], arg); <ide> }, <ide> { <del> code: 'ERR_INVALID_ARG_VALUE', <add> code: 'ERR_INVALID_ARG_TYPE', <ide> name: 'TypeError' <ide> } <ide> ); <ide><path>test/parallel/test-child-process-spawn-typeerror.js <ide> spawn(cmd, u, o); <ide> spawn(cmd, n, o); <ide> spawn(cmd, a, u); <ide> <del>assert.throws(function() { spawn(cmd, a, n); }, invalidArgTypeError); <del> <del>assert.throws(function() { spawn(cmd, s); }, invalidArgTypeError); <del>assert.throws(function() { spawn(cmd, a, s); }, invalidArgTypeError); <add>assert.throws(() => { spawn(cmd, a, n); }, invalidArgTypeError); <add>assert.throws(() => { spawn(cmd, s); }, invalidArgTypeError); <add>assert.throws(() => { spawn(cmd, a, s); }, invalidArgTypeError); <add>assert.throws(() => { spawn(cmd, a, a); }, invalidArgTypeError); <ide> <ide> <ide> // Verify that execFile has same argument parsing behavior as spawn. <ide> execFile(cmd, c, n); <ide> // String is invalid in arg position (this may seem strange, but is <ide> // consistent across node API, cf. `net.createServer('not options', 'not <ide> // callback')`. <del>assert.throws(function() { execFile(cmd, s, o, c); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, a, s, c); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, a, o, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, a, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, o, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, u, u, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, n, n, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, a, u, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, a, n, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, u, o, s); }, invalidArgValueError); <del>assert.throws(function() { execFile(cmd, n, o, s); }, invalidArgValueError); <add>assert.throws(() => { execFile(cmd, s, o, c); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, a, s, c); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, a, o, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, a, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, o, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, u, u, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, n, n, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, a, u, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, a, n, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, u, o, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, n, o, s); }, invalidArgTypeError); <add>assert.throws(() => { execFile(cmd, a, a); }, invalidArgTypeError); <ide> <ide> execFile(cmd, c, s); // Should not throw. <ide> <ide> fork(empty, n, n); <ide> fork(empty, n, o); <ide> fork(empty, a, n); <ide> <del>assert.throws(function() { fork(empty, s); }, invalidArgValueError); <del>assert.throws(function() { fork(empty, a, s); }, invalidArgValueError); <add>assert.throws(() => { fork(empty, s); }, invalidArgTypeError); <add>assert.throws(() => { fork(empty, a, s); }, invalidArgTypeError); <add>assert.throws(() => { fork(empty, a, a); }, invalidArgTypeError);
3
PHP
PHP
add missing method signature in docblock
c0c46a4aad10c186419a129283573e86b7c05798
<ide><path>src/Illuminate/Support/Facades/Bus.php <ide> * @method static void assertDispatchedAfterResponseTimes(string $command, int $times = 1) <ide> * @method static void assertNotDispatchedAfterResponse(string|\Closure $command, callable $callback = null) <ide> * @method static void assertBatched(callable $callback) <add> * @method static void assertChained(array $expectedChain) <ide> * <ide> * @see \Illuminate\Contracts\Bus\Dispatcher <ide> */
1
Javascript
Javascript
remove unused dependency from `ngmodel` directive
f3c8aa279028270f1952d066c0f9a19b9c13dc11
<ide><path>src/ngAria/aria.js <ide> ngAriaModule.directive('ngShow', ['$aria', function($aria) { <ide> .directive('ngRequired', ['$aria', function($aria) { <ide> return $aria.$$watchExpr('ngRequired', 'aria-required', nodeBlackList, false); <ide> }]) <del>.directive('ngModel', ['$aria', '$parse', function($aria, $parse) { <add>.directive('ngModel', ['$aria', function($aria) { <ide> <ide> function shouldAttachAttr(attr, normalizedAttr, elem, allowBlacklistEls) { <ide> return $aria.config(normalizedAttr) && !elem.attr(attr) && (allowBlacklistEls || !isNodeOneOf(elem, nodeBlackList));
1
Ruby
Ruby
remove outdated comment
3040bd3aae9e8b03f8c5ddcc44d6eb624d031ae6
<ide><path>Library/Homebrew/os/mac.rb <ide> def gcc_42_build_version <ide> alias_method :gcc_build_version, :gcc_42_build_version <ide> <ide> def llvm_build_version <del> # for Xcode 3 on OS X 10.5 this will not exist <del> # NOTE may not be true anymore but we can't test <ide> @llvm_build_version ||= <ide> if (path = locate("llvm-gcc")) && path.realpath.basename.to_s !~ /^clang/ <ide> %x{#{path} --version}[/LLVM build (\d{4,})/, 1].to_i
1
Javascript
Javascript
handle https git clone urls
395c02567cfe0e70ab85f4fc134a4d8643123f6e
<ide><path>shells/utils.js <ide> function getGitCommit() { <ide> } <ide> <ide> function getGitHubURL() { <del> // TODO potentially replac this with an fb.me URL (if it can forward the query params) <del> return execSync('git remote get-url origin') <add> // TODO potentially replace this with an fb.me URL (assuming it can forward the query params) <add> const url = execSync('git remote get-url origin') <ide> .toString() <del> .trim() <del> .replace(':', '/') <del> .replace('git@', 'https://') <del> .replace('.git', ''); <add> .trim(); <add> <add> if (url.startsWith('https://')) { <add> return url.replace('.git', ''); <add> } else { <add> return url <add> .replace(':', '/') <add> .replace('git@', 'https://') <add> .replace('.git', ''); <add> } <ide> } <ide> <ide> function getVersionString() {
1
PHP
PHP
start command class
c9ef4b6de3541ae130d63f5badf4e016f12bd3fb
<ide><path>src/Console/Command.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 3.6.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Console; <add> <add>use Cake\Datasource\ModelAwareTrait; <add>use Cake\Log\LogTrait; <add>use Cake\ORM\Locator\LocatorAwareTrait; <add> <add>/** <add> * Base class for console commands. <add> */ <add>class Command <add>{ <add> use LocatorAwareTrait; <add> use LogTrait; <add> use ModelAwareTrait; <add> <add> /** <add> * Constructor <add> * <add> * By default CakePHP will construct command objects when <add> * building the CommandCollection for your application. <add> */ <add> public function __construct() <add> { <add> $locator = $this->getTableLocator() ? : 'Cake\ORM\TableRegistry'; <add> $this->modelFactory('Table', [$locator, 'get']); <add> } <add> <add> /** <add> * Hook method invoked by CakePHP when a command is about to be executed. <add> * <add> * Override this method and implement expensive/important setup steps that <add> * should not run on every command run. This method will be called *before* <add> * the options and arguments are validated and processed. <add> * <add> * @return void <add> */ <add> public function initialize() <add> { <add> } <add>} <ide><path>tests/TestCase/Console/CommandTest.php <add><?php <add>/** <add> * CakePHP : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP Project <add> * @since 3.6.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\Console; <add> <add>use Cake\Console\Command; <add>use Cake\ORM\Locator\TableLocator; <add>use Cake\ORM\Table; <add>use Cake\TestSuite\TestCase; <add> <add> <add>/** <add> * Test case for Console\Command <add> */ <add>class CommandTest extends TestCase <add>{ <add> /** <add> * test orm locator is setup <add> * <add> * @return void <add> */ <add> public function testConstructorSetsLocator() <add> { <add> $command = new Command(); <add> $result = $command->getTableLocator(); <add> $this->assertInstanceOf(TableLocator::class, $result); <add> } <add> <add> /** <add> * test loadModel is configured properly <add> * <add> * @return void <add> */ <add> public function testConstructorLoadModel() <add> { <add> $command = new Command(); <add> $command->loadModel('Comments'); <add> $this->assertInstanceOf(Table::class, $command->Comments); <add> } <add>}
2
Javascript
Javascript
add regression test for `unpipe()`
92ece8671a3da8910bc8755b16ac121ba300a122
<ide><path>test/parallel/test-stream-pipe-unpipe-streams.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add> <add>const { Readable, Writable } = require('stream'); <add> <add>const source = Readable({read: () => {}}); <add>const dest1 = Writable({write: () => {}}); <add>const dest2 = Writable({write: () => {}}); <add> <add>source.pipe(dest1); <add>source.pipe(dest2); <add> <add>dest1.on('unpipe', common.mustCall(() => {})); <add>dest2.on('unpipe', common.mustCall(() => {})); <add> <add>assert.strictEqual(source._readableState.pipes[0], dest1); <add>assert.strictEqual(source._readableState.pipes[1], dest2); <add>assert.strictEqual(source._readableState.pipes.length, 2); <add> <add>// Should be able to unpipe them in the reverse order that they were piped. <add> <add>source.unpipe(dest2); <add> <add>assert.strictEqual(source._readableState.pipes, dest1); <add>assert.notStrictEqual(source._readableState.pipes, dest2); <add> <add>source.unpipe(dest1); <add> <add>assert.strictEqual(source._readableState.pipes, null);
1
Javascript
Javascript
call event.stoppropagation in the click handler
2c7644f91e69de7251b3ee55e58c8316f06b8284
<ide><path>src/js/control-bar/play-toggle.js <ide> class PlayToggle extends Button { <ide> } else { <ide> this.player_.pause(); <ide> } <add> event.stopPropagation(); <ide> } <ide> <ide> /**
1
Javascript
Javascript
improve translation as per bangla academy
13a61b285c095bda7ea8e33156090ea5ccfeaef1
<ide><path>src/locale/bn.js <ide> numberMap = { <ide> }; <ide> <ide> export default moment.defineLocale('bn', { <del> months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), <del> monthsShort : 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), <add> months : 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), <add> monthsShort : 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'), <ide> weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'), <ide> weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), <del> weekdaysMin : 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.split('_'), <add> weekdaysMin : 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'), <ide> longDateFormat : { <ide> LT : 'A h:mm সময়', <ide> LTS : 'A h:mm:ss সময়', <ide><path>src/test/locale/bn.js <ide> import moment from '../../moment'; <ide> localeModule('bn'); <ide> <ide> test('parse', function (assert) { <del> var tests = 'জানুয়ারী জানু_ফেব্রুয়ারি ফেব_মার্চ মার্চ_এপ্রিল এপ্র_মে মে_জুন জুন_জুলাই জুল_আগস্ট আগ_সেপ্টেম্বর সেপ্ট_অক্টোবর অক্টো_নভেম্বর নভে_ডিসেম্বর ডিসে'.split('_'), i; <add> var tests = 'জানুয়ারি জানু_ফেব্রুয়ারি ফেব্রু_মার্চ মার্চ_এপ্রিল এপ্রিল_মে মে_জুন জুন_জুলাই জুলাই_আগস্ট আগস্ট_সেপ্টেম্বর সেপ্ট_অক্টোবর অক্টো_নভেম্বর নভে_ডিসেম্বর ডিসে'.split('_'), i; <ide> function equalTest(input, mmm, i) { <ide> assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); <ide> } <ide> test('format', function (assert) { <ide> var a = [ <ide> ['dddd, Do MMMM YYYY, a h:mm:ss সময়', 'রবিবার, ১৪ ফেব্রুয়ারি ২০১০, দুপুর ৩:২৫:৫০ সময়'], <ide> ['ddd, a h সময়', 'রবি, দুপুর ৩ সময়'], <del> ['M Mo MM MMMM MMM', '২ ২ ০২ ফেব্রুয়ারি ফেব'], <add> ['M Mo MM MMMM MMM', '২ ২ ০২ ফেব্রুয়ারি ফেব্রু'], <ide> ['YYYY YY', '২০১০ ১০'], <ide> ['D Do DD', '১৪ ১৪ ১৪'], <ide> ['d do dddd ddd dd', '০ ০ রবিবার রবি রবি'], <ide> test('format', function (assert) { <ide> ['LLL', '১৪ ফেব্রুয়ারি ২০১০, দুপুর ৩:২৫ সময়'], <ide> ['LLLL', 'রবিবার, ১৪ ফেব্রুয়ারি ২০১০, দুপুর ৩:২৫ সময়'], <ide> ['l', '১৪/২/২০১০'], <del> ['ll', '১৪ ফেব ২০১০'], <del> ['lll', '১৪ ফেব ২০১০, দুপুর ৩:২৫ সময়'], <del> ['llll', 'রবি, ১৪ ফেব ২০১০, দুপুর ৩:২৫ সময়'] <add> ['ll', '১৪ ফেব্রু ২০১০'], <add> ['lll', '১৪ ফেব্রু ২০১০, দুপুর ৩:২৫ সময়'], <add> ['llll', 'রবি, ১৪ ফেব্রু ২০১০, দুপুর ৩:২৫ সময়'] <ide> ], <ide> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), <ide> i; <ide> test('format ordinal', function (assert) { <ide> }); <ide> <ide> test('format month', function (assert) { <del> var expected = 'জানুয়ারী জানু_ফেব্রুয়ারি ফেব_মার্চ মার্চ_এপ্রিল এপ্র_মে মে_জুন জুন_জুলাই জুল_আগস্ট আগ_সেপ্টেম্বর সেপ্ট_অক্টোবর অক্টো_নভেম্বর নভে_ডিসেম্বর ডিসে'.split('_'), i; <add> var expected = 'জানুয়ারি জানু_ফেব্রুয়ারি ফেব্রু_মার্চ মার্চ_এপ্রিল এপ্রিল_মে মে_জুন জুন_জুলাই জুলাই_আগস্ট আগস্ট_সেপ্টেম্বর সেপ্ট_অক্টোবর অক্টো_নভেম্বর নভে_ডিসেম্বর ডিসে'.split('_'), i; <ide> for (i = 0; i < expected.length; i++) { <ide> assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); <ide> } <ide> }); <ide> <ide> test('format week', function (assert) { <del> var expected = 'রবিবার রবি রবি_সোমবার সোম সোম_মঙ্গলবার মঙ্গল মঙ্গ_বুধবার বুধ বুধ_বৃহস্পতিবার বৃহস্পতি বৃহঃ_শুক্রবার শুক্র শুক্র_শনিবার শনি শনি'.split('_'), i; <add> var expected = 'রবিবার রবি রবি_সোমবার সোম সোম_মঙ্গলবার মঙ্গল মঙ্গল_বুধবার বুধ বুধ_বৃহস্পতিবার বৃহস্পতি বৃহ_শুক্রবার শুক্র শুক্র_শনিবার শনি শনি'.split('_'), i; <ide> for (i = 0; i < expected.length; i++) { <ide> assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); <ide> }
2
Javascript
Javascript
use correct script-url for plnkr on snapshot
c625b0d5680b1ee3e921f5cee18c466bc5733329
<ide><path>docs/config/services/deployments/production.js <ide> var cdnUrl = googleCdnUrl + versionInfo.cdnVersion; <ide> // The currentVersion may not be available on the cdn (e.g. if built locally, or hasn't been pushed <ide> // yet). This will lead to a 404, but this is preferable to loading a version with which the example <ide> // might not work (possibly in subtle ways). <del>var examplesCdnUrl = versionInfo.isSnapshot ? <add>var examplesCdnUrl = versionInfo.currentVersion.isSnapshot ? <ide> (angularCodeUrl + 'snapshot') : <del> (googleCdnUrl + (versionInfo.version || versionInfo.currentVersion)); <add> (googleCdnUrl + (versionInfo.currentVersion.version || versionInfo.currentVersion)); <ide> <ide> module.exports = function productionDeployment(getVersion) { <ide> return {
1
PHP
PHP
make dependency optional
8b33dcd1bbafed763c99bc3b8af4acf6b0ac08cf
<ide><path>src/Illuminate/View/Engines/CompilerEngine.php <ide> class CompilerEngine extends PhpEngine <ide> * Create a new compiler engine instance. <ide> * <ide> * @param \Illuminate\View\Compilers\CompilerInterface $compiler <del> * @param \Illuminate\Filesystem\Filesystem $files <add> * @param \Illuminate\Filesystem\Filesystem|null $files <ide> * @return void <ide> */ <del> public function __construct(CompilerInterface $compiler, Filesystem $files) <add> public function __construct(CompilerInterface $compiler, Filesystem $files = null) <ide> { <del> parent::__construct($files); <add> parent::__construct($files ?: new Filesystem); <ide> <ide> $this->compiler = $compiler; <ide> }
1
Text
Text
fix broken fedora documentation
62213219dc97a97471f8d7813aa61a74745ec902
<ide><path>docs/installation/fedora.md <ide> only the package you install differs. There are two packages to choose from: <ide> </td> <ide> <p> <ide> <a href="https://get.docker.com/rpm/1.7.0/fedora-20/SRPMS/docker-engine-1.7.0-1.fc20.src.rpm"> <del> https://get.docker.com/rpm/1.7.0/fedora-20/SRPMS/docker-engine-1.7.0-1.fc20.src.rpm/a> <add> https://get.docker.com/rpm/1.7.0/fedora-20/SRPMS/docker-engine-1.7.0-1.fc20.src.rpm</a> <ide> </p> <ide> </td> <ide> </tr> <ide> only the package you install differs. There are two packages to choose from: <ide> </td> <ide> <p> <ide> <a href="https://get.docker.com/rpm/1.7.0/fedora-21/SRPMS/docker-engine-1.7.0-1.fc21.src.rpm"> <del> https://get.docker.com/rpm/1.7.0/fedora-21/SRPMS/docker-engine-1.7.0-1.fc21.src.rpm/a> <add> https://get.docker.com/rpm/1.7.0/fedora-21/SRPMS/docker-engine-1.7.0-1.fc21.src.rpm</a> <ide> </p> <ide> </td> <ide> </tr> <ide> only the package you install differs. There are two packages to choose from: <ide> </td> <ide> <p> <ide> <a href="https://get.docker.com/rpm/1.7.0/fedora-22/SRPMS/docker-engine-1.7.0-1.fc22.src.rpm"> <del> https://get.docker.com/rpm/1.7.0/fedora-22/SRPMS/docker-engine-1.7.0-1.fc22.src.rpm/a> <add> https://get.docker.com/rpm/1.7.0/fedora-22/SRPMS/docker-engine-1.7.0-1.fc22.src.rpm</a> <ide> </p> <ide> </td> <ide> </tr>
1
Javascript
Javascript
return a promise from watchpath
a0bdc50535fa3036d3145f90b33098015f01c0ac
<ide><path>src/path-watcher.js <ide> class PathWatcherManager { <ide> // * `path` {String} containing the absolute path to the filesystem entry that was acted upon. <ide> // * `oldPath` For rename events, {String} containing the filesystem entry's former absolute path. <ide> // <del>// Returns a {PathWatcher}. Note that every {PathWatcher} is a {Disposable}, so they can be managed by <del>// [CompositeDisposables]{CompositeDisposable} if desired. <add>// Returns a {Promise} that will resolve to a {PathWatcher} once it has started. Note that every {PathWatcher} <add>// is a {Disposable}, so they can be managed by a {CompositeDisposable} if desired. <ide> // <ide> // ```js <ide> // const {watchPath} = require('atom') <ide> class PathWatcherManager { <ide> // ``` <ide> // <ide> function watchPath (rootPath, options, eventCallback) { <del> return PathWatcherManager.instance().createWatcher(rootPath, options, eventCallback) <add> const watcher = PathWatcherManager.instance().createWatcher(rootPath, options, eventCallback) <add> return watcher.getStartPromise().then(() => watcher) <ide> } <ide> <ide> // Private: Return a Promise that resolves when all {NativeWatcher} instances associated with a FileSystemManager
1
Text
Text
add changes for 1.4.0-beta.6 and 1.3.15
db866f1f867752f5be082c348f7fcefffcfbd305
<ide><path>CHANGELOG.md <add><a name="1.4.0-beta.6"></a> <add># 1.4.0-beta.6 cookie-liberation (2015-03-17) <add> <add> <add>## Bug Fixes <add> <add>- **$animate:** call `applyStyles` from options on `leave` <add> ([4374f892](https://github.com/angular/angular.js/commit/4374f892c6fa4af6ba1f2ed47c5f888fdb5fadc5), <add> [#10068](https://github.com/angular/angular.js/issues/10068)) <add>- **$browser:** don't crash if `history.state` access causes error in IE <add> ([3b8163b7](https://github.com/angular/angular.js/commit/3b8163b7b664f24499e75460ab50c066eaec0f78), <add> [#10367](https://github.com/angular/angular.js/issues/10367), [#10369](https://github.com/angular/angular.js/issues/10369)) <add>- **$sanitize:** disallow unsafe svg animation tags <add> ([67688d5c](https://github.com/angular/angular.js/commit/67688d5ca00f6de4c7fe6084e2fa762a00d25610), <add> [#11290](https://github.com/angular/angular.js/issues/11290)) <add>- **Angular:** properly compare RegExp with other objects for equality <add> ([f22e1fc9](https://github.com/angular/angular.js/commit/f22e1fc9610ae111a3ea8746a3a57169c99ce142), <add> [#11204](https://github.com/angular/angular.js/issues/11204), [#11205](https://github.com/angular/angular.js/issues/11205)) <add>- **date filter:** display localised era for `G` format codes <add> ([2b4dfa9e](https://github.com/angular/angular.js/commit/2b4dfa9e2b63d7ebb78f3b0fd3439d18f932e1cd), <add> [#10503](https://github.com/angular/angular.js/issues/10503), [#11266](https://github.com/angular/angular.js/issues/11266)) <add>- **filterFilter:** <add> - fix filtering using an object expression when the filter value is undefined <add> ([c62fa6bd](https://github.com/angular/angular.js/commit/c62fa6bd898e1048d4690d41034489dc60ba6ac2), <add> [#10419](https://github.com/angular/angular.js/issues/10419), [#10424](https://github.com/angular/angular.js/issues/10424)) <add> - do not throw an error if property is null when comparing objects <add> ([2c4ffd6a](https://github.com/angular/angular.js/commit/2c4ffd6af4eb012c4054fe7c096267bbc5510af0), <add> [#10991](https://github.com/angular/angular.js/issues/10991), [#10992](https://github.com/angular/angular.js/issues/10992), [#11116](https://github.com/angular/angular.js/issues/11116)) <add>- **form:** allow dynamic form names which initially evaluate to blank <add> ([410f7c68](https://github.com/angular/angular.js/commit/410f7c682633c681be641cd2a321f9e51671d474)) <add>- **jqLite:** attr should ignore comment, text and attribute nodes <add> ([bb5bf7f8](https://github.com/angular/angular.js/commit/bb5bf7f8162d11610a53428e630b47030bdc38e5)) <add>- **ng/$locale:** add ERA info in generic locale <add> ([4acb0af2](https://github.com/angular/angular.js/commit/4acb0af24c7fb3705a197ca96adc532de4766a7a)) <add>- **ngJq:** don't rely on existence of jqlite <add> ([342e5f3c](https://github.com/angular/angular.js/commit/342e5f3ce38d2fd10c5d5a98ca66f864286a7922), <add> [#11044](https://github.com/angular/angular.js/issues/11044)) <add>- **ngMessages:** ensure that multi-level transclusion works with `ngMessagesInclude` <add> ([d7ec5f39](https://github.com/angular/angular.js/commit/d7ec5f392e1550658ddf271a30627b1749eccb69), <add> [#11196](https://github.com/angular/angular.js/issues/11196)) <add>- **ngOptions:** fix model<->option interaction when using `track by` <add> ([6a03ca27](https://github.com/angular/angular.js/commit/6a03ca274314352052c3082163367a146bb11c2d), <add> [#10869](https://github.com/angular/angular.js/issues/10869), [#10893](https://github.com/angular/angular.js/issues/10893)) <add>- **rootScope:** prevent memory leak when destroying scopes <add> ([fb7db4a0](https://github.com/angular/angular.js/commit/fb7db4a07bd1b0b67824d3808fe315419b272689), <add> [#11173](https://github.com/angular/angular.js/issues/11173), [#11169](https://github.com/angular/angular.js/issues/11169)) <add> <add> <add>## Features <add> <add>- **$cookies:** <add> - allow passing cookie options <add> ([92c366d2](https://github.com/angular/angular.js/commit/92c366d205da36ec26502aded23db71a6473dad7), <add> [#8324](https://github.com/angular/angular.js/issues/8324), [#3988](https://github.com/angular/angular.js/issues/3988), [#1786](https://github.com/angular/angular.js/issues/1786), [#950](https://github.com/angular/angular.js/issues/950)) <add> - move logic into $cookies and deprecate $cookieStore <add> ([38fbe3ee](https://github.com/angular/angular.js/commit/38fbe3ee8370fc449b82d80df07b5c2ed2cd5fbe), <add> [#6411](https://github.com/angular/angular.js/issues/6411), [#7631](https://github.com/angular/angular.js/issues/7631)) <add>- **$cookiesProvider:** provide path, domain, expires and secure options <add> ([53c66369](https://github.com/angular/angular.js/commit/53c663699126815eabc2a3bc1e3bafc8b3874268)) <add>- **$interval:** pass additional arguments to the callback <add> ([4f1f9cfd](https://github.com/angular/angular.js/commit/4f1f9cfdb721cf308ca1162b2227836dc1d28388), <add> [#10632](https://github.com/angular/angular.js/issues/10632)) <add>- **$timeout:** pass additional arguments to the callback <add> ([3a4b6b83](https://github.com/angular/angular.js/commit/3a4b6b83efdb8051e5c4803c0892c19ceb2cba50), <add> [#10631](https://github.com/angular/angular.js/issues/10631)) <add>- **angular.merge:** provide an alternative to `angular.extend` that merges 'deeply' <add> ([c0498d45](https://github.com/angular/angular.js/commit/c0498d45feb913c318224ea70b5adf7112df6bac), <add> [#10507](https://github.com/angular/angular.js/issues/10507), [#10519](https://github.com/angular/angular.js/issues/10519)) <add>- **filterFilter:** compare object with custom `toString()` to primitive <add> ([f8c42161](https://github.com/angular/angular.js/commit/f8c421617096a8d613f4eb6d0f5b098ee149c029), <add> [#10464](https://github.com/angular/angular.js/issues/10464), [#10548](https://github.com/angular/angular.js/issues/10548)) <add>- **ngAria:** <add> - add `button` role to `ngClick` <add> ([bb365070](https://github.com/angular/angular.js/commit/bb365070a3ed7c2d26056d378ab6a8ef493b23cc), <add> [#9254](https://github.com/angular/angular.js/issues/9254), [#10318](https://github.com/angular/angular.js/issues/10318)) <add> - add roles to custom inputs <add> ([29cdaee2](https://github.com/angular/angular.js/commit/29cdaee2b6e853bc3f8882a00661698d146ecd18), <add> [#10012](https://github.com/angular/angular.js/issues/10012), [#10318](https://github.com/angular/angular.js/issues/10318)) <add>- **ngLocale:** Add FIRSTDAYOFWEEK and WEEKENDRANGE from google data <add> ([3d149c7f](https://github.com/angular/angular.js/commit/3d149c7f20ffabab5a635af9ddcfc7105112ab4a)) <add>- **ngMock:** <add> - allow mock $controller service to set up controller bindings <add> ([d02d0585](https://github.com/angular/angular.js/commit/d02d0585a086ecd2e1de628218b5a6d85c8fc7bd), <add> [#9425](https://github.com/angular/angular.js/issues/9425), [#11239](https://github.com/angular/angular.js/issues/11239)) <add> - add `they` helpers for testing multiple specs <add> ([e650c458](https://github.com/angular/angular.js/commit/e650c45894abe6314a806e6b3e32c908df5c00fd), <add> [#10864](https://github.com/angular/angular.js/issues/10864)) <add>- **ngModel:** support conversion to timezone other than UTC <add> ([0413bee8](https://github.com/angular/angular.js/commit/0413bee8cc563a6555f8d42d5f183f6fbefc7350), <add> [#11005](https://github.com/angular/angular.js/issues/11005)) <add> <add> <add>## Breaking Changes <add> <add>- **$cookies:** due to [38fbe3ee](https://github.com/angular/angular.js/commit/38fbe3ee8370fc449b82d80df07b5c2ed2cd5fbe), <add> <add> <add>`$cookies` no longer exposes properties that represent the current browser cookie <add>values. Now you must explicitly the methods described above to access the cookie <add>values. This also means that you can no longer watch the `$cookies` properties for <add>changes to the browser's cookies. <add> <add>This feature is generally only needed if a 3rd party library was programmatically <add>changing the cookies at runtime. If you rely on this then you must either write code that <add>can react to the 3rd party library making the changes to cookies or implement your own polling <add>mechanism. <add> <add> <add> <add> <add><a name="1.3.15"></a> <add># 1.3.15 locality-filtration (2015-03-17) <add> <add>## Bug Fixes <add> <add>- **$animate:** call `applyStyles` with options on `leave` <add> ([ebd84e80](https://github.com/angular/angular.js/commit/ebd84e8008f45ccaa84290f6da8c2a114fcfa8cd), <add> [#10068](https://github.com/angular/angular.js/issues/10068)) <add>- **$browser:** don't crash if history.state access causes error in IE <add> ([92767c09](https://github.com/angular/angular.js/commit/92767c098feaf8c58faf2d67f882305019d8160e), <add> [#10367](https://github.com/angular/angular.js/issues/10367), [#10369](https://github.com/angular/angular.js/issues/10369)) <add>- **Angular:** properly compare RegExp with other objects for equality <add> ([b8e8f9af](https://github.com/angular/angular.js/commit/b8e8f9af78f4ef3e556dd3cef6bfee35ad4cb82a), <add> [#11204](https://github.com/angular/angular.js/issues/11204), [#11205](https://github.com/angular/angular.js/issues/11205)) <add>- **date filter:** display localised era for `G` format codes <add> ([f2683f95](https://github.com/angular/angular.js/commit/f2683f956fcd3216eaa263db20b31e0d46338800), <add> [#10503](https://github.com/angular/angular.js/issues/10503), [#11266](https://github.com/angular/angular.js/issues/11266)) <add>- **filterFilter:** <add> - fix filtering using an object expression when the filter value is `undefined` <add> ([63b9956f](https://github.com/angular/angular.js/commit/63b9956faf4c3679c88a9401b8ccbb111c0294ee), <add> [#10419](https://github.com/angular/angular.js/issues/10419), [#10424](https://github.com/angular/angular.js/issues/10424)) <add> - do not throw an error if property is null when comparing objects <add> ([01161a0e](https://github.com/angular/angular.js/commit/01161a0e9fb1af93e9f06535aed8392ed7f116a4), <add> [#10991](https://github.com/angular/angular.js/issues/10991), [#10992](https://github.com/angular/angular.js/issues/10992), [#11116](https://github.com/angular/angular.js/issues/11116)) <add>- **form:** allow dynamic form names which initially evaluate to blank <add> ([190ea883](https://github.com/angular/angular.js/commit/190ea883c588d63f8b900a8de1d45c6c9ebb01ec), <add> [#11096](https://github.com/angular/angular.js/issues/11096)) <add>- **ng/$locale:** add ERA info in generic locale <add> ([57842530](https://github.com/angular/angular.js/commit/578425303f2480959da80f31920d08f277d42010)) <add>- **rootScope:** prevent memory leak when destroying scopes <add> ([528cf09e](https://github.com/angular/angular.js/commit/528cf09e3f78ad4e3bb6a329ebe315c4f29b4cdb), <add> [#11173](https://github.com/angular/angular.js/issues/11173), [#11169](https://github.com/angular/angular.js/issues/11169)) <add>- **templateRequest:** avoid throwing syntax error in Android 2.3 <add> ([75abbd52](https://github.com/angular/angular.js/commit/75abbd525f07866fdcc6fb311802b8fe700af174), <add> [#11089](https://github.com/angular/angular.js/issues/11089), [#11051](https://github.com/angular/angular.js/issues/11051), [#11088](https://github.com/angular/angular.js/issues/11088)) <add> <add> <add>## Features <add> <add>- **ngAria:** <add> - add `button` role to `ngClick` <add> ([b9ad91cf](https://github.com/angular/angular.js/commit/b9ad91cf1e86310a2d2bf13b29fa13a9b835e1ce), <add> [#9254](https://github.com/angular/angular.js/issues/9254), [#10318](https://github.com/angular/angular.js/issues/10318)) <add> - add roles to custom inputs <add> ([21369943](https://github.com/angular/angular.js/commit/21369943fafd577b36827a641b021b1c14cefb57), <add> [#10012](https://github.com/angular/angular.js/issues/10012), [#10318](https://github.com/angular/angular.js/issues/10318)) <add>- **ngMock:** <add> - allow mock $controller service to set up controller bindings <add> ([b3878a36](https://github.com/angular/angular.js/commit/b3878a36d9f8e56ad7be1eedb9691c9bd12568cb), <add> [#9425](https://github.com/angular/angular.js/issues/9425), [#11239](https://github.com/angular/angular.js/issues/11239)) <add> - add `they` helpers for testing multiple specs <add> ([7288be25](https://github.com/angular/angular.js/commit/7288be25a75d6ca6ac7eca05a7d6b12ccb3a22f8), <add> [#10864](https://github.com/angular/angular.js/issues/10864)) <add> <add> <add> <ide> <a name="1.4.0-beta.5"></a> <ide> # 1.4.0-beta.5 karmic-stabilization (2015-02-24) <ide>
1
Javascript
Javascript
improve error reporting
846e8f0265844197fb91eb9764112584c1f6c035
<ide><path>test/checkArrayExpectation.js <ide> const check = (expected, actual) => { <ide> if (expected instanceof RegExp) { <ide> expected = { message: expected }; <ide> } <add> if (Array.isArray(expected)) { <add> return expected.every(e => check(e, actual)); <add> } <ide> return Object.keys(expected).every(key => { <ide> let value = actual[key]; <ide> if (typeof value === "object") { <ide> const explain = object => { <ide> .join("; "); <ide> }; <ide> <add>const diffItems = (actual, expected, kind) => { <add> const tooMuch = actual.slice(); <add> const missing = expected.slice(); <add> for (let i = 0; i < missing.length; i++) { <add> const current = missing[i]; <add> for (let j = 0; j < tooMuch.length; j++) { <add> if (check(current, tooMuch[j])) { <add> tooMuch.splice(j, 1); <add> missing.splice(i, 1); <add> i--; <add> break; <add> } <add> } <add> } <add> const diff = []; <add> if (missing.length > 0) { <add> diff.push(`The following expected ${kind}s are missing: <add>${missing.map(item => `${item}`).join("\n\n")}`); <add> } <add> if (tooMuch.length > 0) { <add> diff.push(`The following ${kind}s are unexpected: <add>${tooMuch.map(item => `${explain(item)}`).join("\n\n")}`); <add> } <add> return diff.join("\n\n"); <add>}; <add> <ide> module.exports = function checkArrayExpectation( <ide> testDirectory, <ide> object, <ide> module.exports = function checkArrayExpectation( <ide> if (fs.existsSync(path.join(testDirectory, `${filename}.js`))) { <ide> const expectedFilename = path.join(testDirectory, `${filename}.js`); <ide> const expected = require(expectedFilename); <add> const diff = diffItems(array, expected, kind); <ide> if (expected.length < array.length) { <ide> return ( <ide> done( <ide> new Error( <del> `More ${kind}s while compiling than expected:\n\n${array <del> .map(explain) <del> .join("\n\n")}. Check expected ${kind}s: ${expectedFilename}` <add> `More ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}` <ide> ) <ide> ), <ide> true <ide> module.exports = function checkArrayExpectation( <ide> return ( <ide> done( <ide> new Error( <del> `Less ${kind}s while compiling than expected:\n\n${array <del> .map(explain) <del> .join("\n\n")}. Check expected ${kind}s: ${expectedFilename}` <add> `Less ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}` <ide> ) <ide> ), <ide> true
1
Text
Text
add docs for `react.children.toarray` in 0.14.0
319b37409769ee32f6a3f5a80a986298f8fd06e4
<ide><path>docs/docs/ref-01-top-level-api.md <ide> Verifies the object is a ReactElement. <ide> #### React.Children.map <ide> <ide> ```javascript <del>object React.Children.map(object children, function fn [, object thisArg]) <add>array React.Children.map(object children, function fn [, object thisArg]) <ide> ``` <ide> <del>Invoke `fn` on every immediate child contained within `children` with `this` set to `thisArg`. If `children` is a nested object or array it will be traversed: `fn` will never be passed the container objects. If children is `null` or `undefined` returns `null` or `undefined` rather than an empty object. <add>Invoke `fn` on every immediate child contained within `children` with `this` set to `thisArg`. If `children` is a nested object or array it will be traversed: `fn` will never be passed the container objects. If children is `null` or `undefined` returns `null` or `undefined` rather than an array. <ide> <ide> #### React.Children.forEach <ide> <ide> ```javascript <ide> React.Children.forEach(object children, function fn [, object thisArg]) <ide> ``` <ide> <del>Like `React.Children.map()` but does not return an object. <add>Like `React.Children.map()` but does not return an array. <ide> <ide> #### React.Children.count <ide> <ide> object React.Children.only(object children) <ide> <ide> Return the only child in `children`. Throws otherwise. <ide> <add>#### React.Children.toArray <add> <add>```javascript <add>array React.Children.toArray(object children) <add>``` <add> <add>Return the `children` opaque data structure as a flat array with keys assigned to each child. Useful if you want to manipulate collections of children in your render methods, especially if you want to reorder or slice `this.props.children` before passing it down. <add> <ide> ## ReactDOM <ide> <ide> The `react-dom` package provides DOM-specific methods that can be used at the top level of your app and as an escape hatch to get outside of the React model if you need to. Most of your components should not need to use this module.
1
Python
Python
handle multimodal inputs
cc5c061e346365252458126abb699b87cda5dcc0
<ide><path>src/transformers/commands/pt_to_tf.py <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <ide> <add>import inspect <ide> import os <ide> from argparse import ArgumentParser, Namespace <ide> from importlib import import_module <ide> <ide> import huggingface_hub <ide> <del>from .. import AutoConfig, AutoFeatureExtractor, AutoTokenizer, is_tf_available, is_torch_available <add>from .. import ( <add> FEATURE_EXTRACTOR_MAPPING, <add> PROCESSOR_MAPPING, <add> TOKENIZER_MAPPING, <add> AutoConfig, <add> AutoFeatureExtractor, <add> AutoProcessor, <add> AutoTokenizer, <add> is_tf_available, <add> is_torch_available, <add>) <ide> from ..utils import logging <ide> from . import BaseTransformersCLICommand <ide> <ide> def __init__( <ide> self._push = push <ide> self._extra_commit_description = extra_commit_description <ide> <del> def get_text_inputs(self): <del> tokenizer = AutoTokenizer.from_pretrained(self._local_dir) <del> sample_text = ["Hi there!", "I am a batch with more than one row and different input lengths."] <del> if tokenizer.pad_token is None: <del> tokenizer.pad_token = tokenizer.eos_token <del> pt_input = tokenizer(sample_text, return_tensors="pt", padding=True, truncation=True) <del> tf_input = tokenizer(sample_text, return_tensors="tf", padding=True, truncation=True) <del> return pt_input, tf_input <add> def get_inputs(self, pt_model, config): <add> """ <add> Returns the right inputs for the model, based on its signature. <add> """ <ide> <del> def get_audio_inputs(self): <del> processor = AutoFeatureExtractor.from_pretrained(self._local_dir) <del> num_samples = 2 <del> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation") <del> speech_samples = ds.sort("id").select(range(num_samples))[:num_samples]["audio"] <del> raw_samples = [x["array"] for x in speech_samples] <del> pt_input = processor(raw_samples, return_tensors="pt", padding=True) <del> tf_input = processor(raw_samples, return_tensors="tf", padding=True) <del> return pt_input, tf_input <add> def _get_audio_input(): <add> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation") <add> speech_samples = ds.sort("id").select(range(2))[:2]["audio"] <add> raw_samples = [x["array"] for x in speech_samples] <add> return raw_samples <add> <add> model_forward_signature = set(inspect.signature(pt_model.forward).parameters.keys()) <add> processor_inputs = {} <add> if "input_ids" in model_forward_signature: <add> processor_inputs.update( <add> { <add> "text": ["Hi there!", "I am a batch with more than one row and different input lengths."], <add> "padding": True, <add> "truncation": True, <add> } <add> ) <add> if "pixel_values" in model_forward_signature: <add> sample_images = load_dataset("cifar10", "plain_text", split="test")[:2]["img"] <add> processor_inputs.update({"images": sample_images}) <add> if "input_features" in model_forward_signature: <add> processor_inputs.update({"raw_speech": _get_audio_input(), "padding": True}) <add> if "input_values" in model_forward_signature: # Wav2Vec2 audio input <add> processor_inputs.update({"raw_speech": _get_audio_input(), "padding": True}) <add> <add> model_config_class = type(pt_model.config) <add> if model_config_class in PROCESSOR_MAPPING: <add> processor = AutoProcessor.from_pretrained(self._local_dir) <add> if model_config_class in TOKENIZER_MAPPING and processor.tokenizer.pad_token is None: <add> processor.tokenizer.pad_token = processor.tokenizer.eos_token <add> elif model_config_class in FEATURE_EXTRACTOR_MAPPING: <add> processor = AutoFeatureExtractor.from_pretrained(self._local_dir) <add> elif model_config_class in TOKENIZER_MAPPING: <add> processor = AutoTokenizer.from_pretrained(self._local_dir) <add> if processor.pad_token is None: <add> processor.pad_token = processor.eos_token <add> else: <add> raise ValueError(f"Unknown data processing type (model config type: {model_config_class})") <add> <add> pt_input = processor(**processor_inputs, return_tensors="pt") <add> tf_input = processor(**processor_inputs, return_tensors="tf") <add> <add> # Extra input requirements, in addition to the input modality <add> if config.is_encoder_decoder or (hasattr(pt_model, "encoder") and hasattr(pt_model, "decoder")): <add> decoder_input_ids = np.asarray([[1], [1]], dtype=int) * (pt_model.config.decoder_start_token_id or 0) <add> pt_input.update({"decoder_input_ids": torch.tensor(decoder_input_ids)}) <add> tf_input.update({"decoder_input_ids": tf.convert_to_tensor(decoder_input_ids)}) <ide> <del> def get_image_inputs(self): <del> feature_extractor = AutoFeatureExtractor.from_pretrained(self._local_dir) <del> num_samples = 2 <del> ds = load_dataset("cifar10", "plain_text", split="test")[:num_samples]["img"] <del> pt_input = feature_extractor(images=ds, return_tensors="pt") <del> tf_input = feature_extractor(images=ds, return_tensors="tf") <ide> return pt_input, tf_input <ide> <ide> def run(self): <ide> def run(self): <ide> except AttributeError: <ide> raise AttributeError(f"The TensorFlow equivalent of {architectures[0]} doesn't exist in transformers.") <ide> <del> # Load models and acquire a basic input for its modality. <add> # Load models and acquire a basic input compatible with the model. <ide> pt_model = pt_class.from_pretrained(self._local_dir) <del> main_input_name = pt_model.main_input_name <del> if main_input_name == "input_ids": <del> pt_input, tf_input = self.get_text_inputs() <del> elif main_input_name == "pixel_values": <del> pt_input, tf_input = self.get_image_inputs() <del> elif main_input_name == "input_features": <del> pt_input, tf_input = self.get_audio_inputs() <del> else: <del> raise ValueError(f"Can't detect the model modality (`main_input_name` = {main_input_name})") <ide> tf_from_pt_model = tf_class.from_pretrained(self._local_dir, from_pt=True) <del> <del> # Extra input requirements, in addition to the input modality <del> if config.is_encoder_decoder or (hasattr(pt_model, "encoder") and hasattr(pt_model, "decoder")): <del> decoder_input_ids = np.asarray([[1], [1]], dtype=int) * pt_model.config.decoder_start_token_id <del> pt_input.update({"decoder_input_ids": torch.tensor(decoder_input_ids)}) <del> tf_input.update({"decoder_input_ids": tf.convert_to_tensor(decoder_input_ids)}) <add> pt_input, tf_input = self.get_inputs(pt_model, config) <ide> <ide> # Confirms that cross loading PT weights into TF worked. <ide> crossload_differences = self.find_pt_tf_differences(pt_model, pt_input, tf_from_pt_model, tf_input)
1
Python
Python
move folder for exec argument one up
cd632d8ec23c48d59cad982ad60fd619b993deb0
<ide><path>spacy/cli/project.py <ide> def update_dvc_config( <ide> continue <ide> # Default to "." as the project path since dvc.yaml is auto-generated <ide> # and we don't want arbitrary paths in there <del> project_cmd = ["python", "-m", NAME, "project", "exec", ".", name] <add> project_cmd = ["python", "-m", NAME, "project", ".", "exec", name] <ide> deps_cmd = [c for cl in [["-d", p] for p in deps] for c in cl] <ide> outputs_cmd = [c for cl in [["-o", p] for p in outputs] for c in cl] <ide> outputs_nc_cmd = [c for cl in [["-O", p] for p in outputs_no_cache] for c in cl]
1
PHP
PHP
synchronize license tag
6e767400a760b3c5eaf1f3cde10e9e73582babc5
<ide><path>src/Utility/Time.php <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <del> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <ide> namespace Cake\Utility; <ide>
1
Mixed
Ruby
add the ability to nullify the `enum` column
e0ad9ae27e9b6dc5460d91761ce6fbd7a92b08f0
<ide><path>activerecord/CHANGELOG.md <add>* Add the ability to nullify the `enum` column. <add> <add> Example: <add> <add> class Conversation < ActiveRecord::Base <add> enum gender: [:female, :male] <add> end <add> <add> Conversation::GENDER # => { female: 0, male: 1 } <add> <add> # conversation.update! gender: 0 <add> conversation.female! <add> conversation.female? # => true <add> conversation.gender # => "female" <add> <add> # conversation.update! gender: nil <add> conversation.gender = nil <add> conversation.gender.nil? # => true <add> conversation.gender # => nil <add> <add> *Amr Tamimi* <add> <ide> * Connection specification now accepts a "url" key. The value of this <ide> key is expected to contain a database URL. The database URL will be <ide> expanded into a hash and merged. <ide><path>activerecord/lib/active_record/enum.rb <ide> module ActiveRecord <ide> # # conversation.update! status: 1 <ide> # conversation.status = "archived" <ide> # <add> # # conversation.update! status: nil <add> # conversation.status = nil <add> # conversation.status.nil? # => true <add> # conversation.status # => nil <add> # <ide> # You can set the default value from the database declaration, like: <ide> # <ide> # create_table :conversations do |t| <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) <add> unless enum_values.has_key?(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_equal "'unknown' is not a valid status", e.message <ide> end <ide> <add> test "assign nil value" do <add> @book.status = nil <add> assert @book.status.nil? <add> end <add> <add> test "assign empty string value" do <add> @book.status = '' <add> assert @book.status.nil? <add> end <add> <add> test "assign long empty string value" do <add> @book.status = ' ' <add> assert @book.status.nil? <add> end <add> <ide> test "constant to access the mapping" do <ide> assert_equal 0, Book::STATUS[:proposed] <ide> assert_equal 1, Book::STATUS["written"]
3
Ruby
Ruby
use same logic to handle core fully-qualified name
6e92609cf42c18a84c0eefd3e7dea56856330f76
<ide><path>Library/Homebrew/cmd/install.rb <ide> def install <ide> end <ide> <ide> ARGV.named.each do |name| <del> if !File.exist?(name) && (name !~ HOMEBREW_CORE_FORMULA_REGEX) \ <del> && (name =~ HOMEBREW_TAP_FORMULA_REGEX || name =~ HOMEBREW_CASK_TAP_FORMULA_REGEX) <add> if !File.exist?(name) && <add> (name =~ HOMEBREW_TAP_FORMULA_REGEX || name =~ HOMEBREW_CASK_TAP_FORMULA_REGEX) <ide> tap = Tap.fetch($1, $2) <ide> tap.install unless tap.installed? <ide> end <ide><path>Library/Homebrew/formulary.rb <ide> def self.loader_for(ref) <ide> return FromUrlLoader.new(ref) <ide> when Pathname::BOTTLE_EXTNAME_RX <ide> return BottleLoader.new(ref) <del> when HOMEBREW_CORE_FORMULA_REGEX <del> name = $1 <del> formula_with_that_name = core_path(name) <del> if (newname = FORMULA_RENAMES[name]) && !formula_with_that_name.file? <del> return FormulaLoader.new(newname, core_path(newname)) <del> else <del> return FormulaLoader.new(name, formula_with_that_name) <del> end <ide> when HOMEBREW_TAP_FORMULA_REGEX <ide> return TapLoader.new(ref) <ide> end <ide><path>Library/Homebrew/tap_constants.rb <ide> # match taps' formulae, e.g. someuser/sometap/someformula <ide> HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.]+)$} <del># match core's formulae, e.g. homebrew/homebrew/someformula <del>HOMEBREW_CORE_FORMULA_REGEX = %r{^homebrew/homebrew/([\w+-.]+)$}i <ide> # match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap <ide> HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/([\w-]+)/([\w-]+)} <ide> # match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula
3
Javascript
Javascript
remove symbol polyfill (again)
0de3ddf56e011c708067319d9b8e94e1cd1ea1a5
<ide><path>packages/react/src/__tests__/ReactElement-test.js <ide> <ide> 'use strict'; <ide> <del>import {enableSymbolFallbackForWWW} from 'shared/ReactFeatureFlags'; <del> <ide> let React; <ide> let ReactDOM; <ide> let ReactTestUtils; <ide> <ide> describe('ReactElement', () => { <ide> let ComponentClass; <del> let originalSymbol; <ide> <ide> beforeEach(() => { <ide> jest.resetModules(); <ide> <del> if (enableSymbolFallbackForWWW) { <del> // Delete the native Symbol if we have one to ensure we test the <del> // unpolyfilled environment. <del> originalSymbol = global.Symbol; <del> global.Symbol = undefined; <del> } <del> <ide> React = require('react'); <ide> ReactDOM = require('react-dom'); <ide> ReactTestUtils = require('react-dom/test-utils'); <ide> describe('ReactElement', () => { <ide> }; <ide> }); <ide> <del> afterEach(() => { <del> if (enableSymbolFallbackForWWW) { <del> global.Symbol = originalSymbol; <del> } <del> }); <del> <del> // @gate enableSymbolFallbackForWWW <del> it('uses the fallback value when in an environment without Symbol', () => { <del> expect((<div />).$$typeof).toBe(0xeac7); <del> }); <del> <ide> it('returns a complete element according to spec', () => { <ide> const element = React.createElement(ComponentClass); <ide> expect(element.type).toBe(ComponentClass); <ide> describe('ReactElement', () => { <ide> expect(element.type.someStaticMethod()).toBe('someReturnValue'); <ide> }); <ide> <del> // NOTE: We're explicitly not using JSX here. This is intended to test <del> // classic JS without JSX. <del> // @gate enableSymbolFallbackForWWW <del> it('identifies valid elements', () => { <del> class Component extends React.Component { <del> render() { <del> return React.createElement('div'); <del> } <del> } <del> <del> expect(React.isValidElement(React.createElement('div'))).toEqual(true); <del> expect(React.isValidElement(React.createElement(Component))).toEqual(true); <del> <del> expect(React.isValidElement(null)).toEqual(false); <del> expect(React.isValidElement(true)).toEqual(false); <del> expect(React.isValidElement({})).toEqual(false); <del> expect(React.isValidElement('string')).toEqual(false); <del> if (!__EXPERIMENTAL__) { <del> let factory; <del> expect(() => { <del> factory = React.createFactory('div'); <del> }).toWarnDev( <del> 'Warning: React.createFactory() is deprecated and will be removed in a ' + <del> 'future major release. Consider using JSX or use React.createElement() ' + <del> 'directly instead.', <del> {withoutStack: true}, <del> ); <del> expect(React.isValidElement(factory)).toEqual(false); <del> } <del> expect(React.isValidElement(Component)).toEqual(false); <del> expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); <del> <del> const jsonElement = JSON.stringify(React.createElement('div')); <del> expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true); <del> }); <del> <ide> // NOTE: We're explicitly not using JSX here. This is intended to test <ide> // classic JS without JSX. <ide> it('is indistinguishable from a plain object', () => { <ide> describe('ReactElement', () => { <ide> const test = ReactTestUtils.renderIntoDocument(<Test value={+undefined} />); <ide> expect(test.props.value).toBeNaN(); <ide> }); <del> <del> // NOTE: We're explicitly not using JSX here. This is intended to test <del> // classic JS without JSX. <del> // @gate !enableSymbolFallbackForWWW <del> it('identifies elements, but not JSON, if Symbols are supported', () => { <del> class Component extends React.Component { <del> render() { <del> return React.createElement('div'); <del> } <del> } <del> <del> expect(React.isValidElement(React.createElement('div'))).toEqual(true); <del> expect(React.isValidElement(React.createElement(Component))).toEqual(true); <del> <del> expect(React.isValidElement(null)).toEqual(false); <del> expect(React.isValidElement(true)).toEqual(false); <del> expect(React.isValidElement({})).toEqual(false); <del> expect(React.isValidElement('string')).toEqual(false); <del> if (!__EXPERIMENTAL__) { <del> let factory; <del> expect(() => { <del> factory = React.createFactory('div'); <del> }).toWarnDev( <del> 'Warning: React.createFactory() is deprecated and will be removed in a ' + <del> 'future major release. Consider using JSX or use React.createElement() ' + <del> 'directly instead.', <del> {withoutStack: true}, <del> ); <del> expect(React.isValidElement(factory)).toEqual(false); <del> } <del> expect(React.isValidElement(Component)).toEqual(false); <del> expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); <del> <del> const jsonElement = JSON.stringify(React.createElement('div')); <del> expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); <del> }); <del> <del> // NOTE: We're explicitly not using JSX here. This is intended to test <del> // classic JS without JSX. <del> it('identifies elements, but not JSON, if Symbols are supported (with polyfill)', () => { <del> // Rudimentary polyfill <del> // Once all jest engines support Symbols natively we can swap this to test <del> // WITH native Symbols by default. <del> const REACT_ELEMENT_TYPE = function() {}; // fake Symbol <del> const OTHER_SYMBOL = function() {}; // another fake Symbol <del> global.Symbol = function(name) { <del> return OTHER_SYMBOL; <del> }; <del> global.Symbol.for = function(key) { <del> if (key === 'react.element') { <del> return REACT_ELEMENT_TYPE; <del> } <del> return OTHER_SYMBOL; <del> }; <del> <del> jest.resetModules(); <del> <del> React = require('react'); <del> <del> class Component extends React.Component { <del> render() { <del> return React.createElement('div'); <del> } <del> } <del> <del> expect(React.isValidElement(React.createElement('div'))).toEqual(true); <del> expect(React.isValidElement(React.createElement(Component))).toEqual(true); <del> <del> expect(React.isValidElement(null)).toEqual(false); <del> expect(React.isValidElement(true)).toEqual(false); <del> expect(React.isValidElement({})).toEqual(false); <del> expect(React.isValidElement('string')).toEqual(false); <del> if (!__EXPERIMENTAL__) { <del> let factory; <del> expect(() => { <del> factory = React.createFactory('div'); <del> }).toWarnDev( <del> 'Warning: React.createFactory() is deprecated and will be removed in a ' + <del> 'future major release. Consider using JSX or use React.createElement() ' + <del> 'directly instead.', <del> {withoutStack: true}, <del> ); <del> expect(React.isValidElement(factory)).toEqual(false); <del> } <del> expect(React.isValidElement(Component)).toEqual(false); <del> expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); <del> <del> const jsonElement = JSON.stringify(React.createElement('div')); <del> expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); <del> }); <ide> }); <ide><path>packages/react/src/__tests__/ReactElementJSX-test.js <ide> <ide> 'use strict'; <ide> <del>import {enableSymbolFallbackForWWW} from 'shared/ReactFeatureFlags'; <del> <ide> let React; <ide> let ReactDOM; <ide> let ReactTestUtils; <ide> let JSXDEVRuntime; <ide> // A lot of these tests are pulled from ReactElement-test because <ide> // this api is meant to be backwards compatible. <ide> describe('ReactElement.jsx', () => { <del> let originalSymbol; <del> <ide> beforeEach(() => { <ide> jest.resetModules(); <ide> <del> if (enableSymbolFallbackForWWW) { <del> // Delete the native Symbol if we have one to ensure we test the <del> // unpolyfilled environment. <del> originalSymbol = global.Symbol; <del> global.Symbol = undefined; <del> } <del> <ide> React = require('react'); <ide> JSXRuntime = require('react/jsx-runtime'); <ide> JSXDEVRuntime = require('react/jsx-dev-runtime'); <ide> ReactDOM = require('react-dom'); <ide> ReactTestUtils = require('react-dom/test-utils'); <ide> }); <ide> <del> afterEach(() => { <del> if (enableSymbolFallbackForWWW) { <del> global.Symbol = originalSymbol; <del> } <del> }); <del> <ide> it('allows static methods to be called using the type property', () => { <ide> class StaticMethodComponentClass extends React.Component { <ide> render() { <ide> describe('ReactElement.jsx', () => { <ide> expect(element.type.someStaticMethod()).toBe('someReturnValue'); <ide> }); <ide> <del> // @gate enableSymbolFallbackForWWW <del> it('identifies valid elements', () => { <del> class Component extends React.Component { <del> render() { <del> return JSXRuntime.jsx('div', {}); <del> } <del> } <del> <del> expect(React.isValidElement(JSXRuntime.jsx('div', {}))).toEqual(true); <del> expect(React.isValidElement(JSXRuntime.jsx(Component, {}))).toEqual(true); <del> expect( <del> React.isValidElement(JSXRuntime.jsx(JSXRuntime.Fragment, {})), <del> ).toEqual(true); <del> if (__DEV__) { <del> expect(React.isValidElement(JSXDEVRuntime.jsxDEV('div', {}))).toEqual( <del> true, <del> ); <del> } <del> <del> expect(React.isValidElement(null)).toEqual(false); <del> expect(React.isValidElement(true)).toEqual(false); <del> expect(React.isValidElement({})).toEqual(false); <del> expect(React.isValidElement('string')).toEqual(false); <del> if (!__EXPERIMENTAL__) { <del> let factory; <del> expect(() => { <del> factory = React.createFactory('div'); <del> }).toWarnDev( <del> 'Warning: React.createFactory() is deprecated and will be removed in a ' + <del> 'future major release. Consider using JSX or use React.createElement() ' + <del> 'directly instead.', <del> {withoutStack: true}, <del> ); <del> expect(React.isValidElement(factory)).toEqual(false); <del> } <del> expect(React.isValidElement(Component)).toEqual(false); <del> expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); <del> <del> const jsonElement = JSON.stringify(JSXRuntime.jsx('div', {})); <del> expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true); <del> }); <del> <ide> it('is indistinguishable from a plain object', () => { <ide> const element = JSXRuntime.jsx('div', {className: 'foo'}); <ide> const object = {}; <ide> describe('ReactElement.jsx', () => { <ide> ); <ide> }); <ide> <del> // @gate !enableSymbolFallbackForWWW <del> it('identifies elements, but not JSON, if Symbols are supported', () => { <del> class Component extends React.Component { <del> render() { <del> return JSXRuntime.jsx('div', {}); <del> } <del> } <del> <del> expect(React.isValidElement(JSXRuntime.jsx('div', {}))).toEqual(true); <del> expect(React.isValidElement(JSXRuntime.jsx(Component, {}))).toEqual(true); <del> expect( <del> React.isValidElement(JSXRuntime.jsx(JSXRuntime.Fragment, {})), <del> ).toEqual(true); <del> if (__DEV__) { <del> expect(React.isValidElement(JSXDEVRuntime.jsxDEV('div', {}))).toEqual( <del> true, <del> ); <del> } <del> <del> expect(React.isValidElement(null)).toEqual(false); <del> expect(React.isValidElement(true)).toEqual(false); <del> expect(React.isValidElement({})).toEqual(false); <del> expect(React.isValidElement('string')).toEqual(false); <del> if (!__EXPERIMENTAL__) { <del> let factory; <del> expect(() => { <del> factory = React.createFactory('div'); <del> }).toWarnDev( <del> 'Warning: React.createFactory() is deprecated and will be removed in a ' + <del> 'future major release. Consider using JSX or use React.createElement() ' + <del> 'directly instead.', <del> {withoutStack: true}, <del> ); <del> expect(React.isValidElement(factory)).toEqual(false); <del> } <del> expect(React.isValidElement(Component)).toEqual(false); <del> expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); <del> <del> const jsonElement = JSON.stringify(JSXRuntime.jsx('div', {})); <del> expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); <del> }); <del> <del> it('identifies elements, but not JSON, if Symbols are polyfilled', () => { <del> // Rudimentary polyfill <del> // Once all jest engines support Symbols natively we can swap this to test <del> // WITH native Symbols by default. <del> const REACT_ELEMENT_TYPE = function() {}; // fake Symbol <del> const OTHER_SYMBOL = function() {}; // another fake Symbol <del> global.Symbol = function(name) { <del> return OTHER_SYMBOL; <del> }; <del> global.Symbol.for = function(key) { <del> if (key === 'react.element') { <del> return REACT_ELEMENT_TYPE; <del> } <del> return OTHER_SYMBOL; <del> }; <del> <del> jest.resetModules(); <del> <del> React = require('react'); <del> JSXRuntime = require('react/jsx-runtime'); <del> <del> class Component extends React.Component { <del> render() { <del> return JSXRuntime.jsx('div'); <del> } <del> } <del> <del> expect(React.isValidElement(JSXRuntime.jsx('div', {}))).toEqual(true); <del> expect(React.isValidElement(JSXRuntime.jsx(Component, {}))).toEqual(true); <del> <del> expect(React.isValidElement(null)).toEqual(false); <del> expect(React.isValidElement(true)).toEqual(false); <del> expect(React.isValidElement({})).toEqual(false); <del> expect(React.isValidElement('string')).toEqual(false); <del> if (!__EXPERIMENTAL__) { <del> let factory; <del> expect(() => { <del> factory = React.createFactory('div'); <del> }).toWarnDev( <del> 'Warning: React.createFactory() is deprecated and will be removed in a ' + <del> 'future major release. Consider using JSX or use React.createElement() ' + <del> 'directly instead.', <del> {withoutStack: true}, <del> ); <del> expect(React.isValidElement(factory)).toEqual(false); <del> } <del> expect(React.isValidElement(Component)).toEqual(false); <del> expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); <del> <del> const jsonElement = JSON.stringify(JSXRuntime.jsx('div', {})); <del> expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); <del> }); <del> <ide> it('should warn when unkeyed children are passed to jsx', () => { <ide> const container = document.createElement('div'); <ide> <ide><path>packages/shared/ReactFeatureFlags.js <ide> export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; <ide> // like migrating internal callers or performance testing. <ide> // ----------------------------------------------------------------------------- <ide> <del>// This is blocked on adding a symbol polyfill to www. <del>export const enableSymbolFallbackForWWW = false; <del> <ide> // This rolled out to 10% public in www, so we should be able to land, but some <ide> // internal tests need to be updated. The open source behavior is correct. <ide> export const skipUnmountedBoundaries = true; <ide><path>packages/shared/ReactSymbols.www.js <del>/** <del> * Copyright (c) Facebook, Inc. and its affiliates. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> * <del> * @flow <del> */ <del> <del>// ATTENTION <del>// When adding new symbols to this file, <del>// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' <del> <del>import {enableSymbolFallbackForWWW} from './ReactFeatureFlags'; <del> <del>const usePolyfill = <del> enableSymbolFallbackForWWW && (typeof Symbol !== 'function' || !Symbol.for); <del> <del>// The Symbol used to tag the ReactElement-like types. <del>export const REACT_ELEMENT_TYPE = usePolyfill <del> ? 0xeac7 <del> : Symbol.for('react.element'); <del>export const REACT_PORTAL_TYPE = usePolyfill <del> ? 0xeaca <del> : Symbol.for('react.portal'); <del>export const REACT_FRAGMENT_TYPE = usePolyfill <del> ? 0xeacb <del> : Symbol.for('react.fragment'); <del>export const REACT_STRICT_MODE_TYPE = usePolyfill <del> ? 0xeacc <del> : Symbol.for('react.strict_mode'); <del>export const REACT_PROFILER_TYPE = usePolyfill <del> ? 0xead2 <del> : Symbol.for('react.profiler'); <del>export const REACT_PROVIDER_TYPE = usePolyfill <del> ? 0xeacd <del> : Symbol.for('react.provider'); <del>export const REACT_CONTEXT_TYPE = usePolyfill <del> ? 0xeace <del> : Symbol.for('react.context'); <del>export const REACT_SERVER_CONTEXT_TYPE = usePolyfill <del> ? 0xeae6 <del> : Symbol.for('react.server_context'); <del>export const REACT_FORWARD_REF_TYPE = usePolyfill <del> ? 0xead0 <del> : Symbol.for('react.forward_ref'); <del>export const REACT_SUSPENSE_TYPE = usePolyfill <del> ? 0xead1 <del> : Symbol.for('react.suspense'); <del>export const REACT_SUSPENSE_LIST_TYPE = usePolyfill <del> ? 0xead8 <del> : Symbol.for('react.suspense_list'); <del>export const REACT_MEMO_TYPE = usePolyfill ? 0xead3 : Symbol.for('react.memo'); <del>export const REACT_LAZY_TYPE = usePolyfill ? 0xead4 : Symbol.for('react.lazy'); <del>export const REACT_SCOPE_TYPE = usePolyfill <del> ? 0xead7 <del> : Symbol.for('react.scope'); <del>export const REACT_DEBUG_TRACING_MODE_TYPE = usePolyfill <del> ? 0xeae1 <del> : Symbol.for('react.debug_trace_mode'); <del>export const REACT_OFFSCREEN_TYPE = usePolyfill <del> ? 0xeae2 <del> : Symbol.for('react.offscreen'); <del>export const REACT_LEGACY_HIDDEN_TYPE = usePolyfill <del> ? 0xeae3 <del> : Symbol.for('react.legacy_hidden'); <del>export const REACT_CACHE_TYPE = usePolyfill <del> ? 0xeae4 <del> : Symbol.for('react.cache'); <del>export const REACT_TRACING_MARKER_TYPE = usePolyfill <del> ? 0xeae5 <del> : Symbol.for('react.tracing_marker'); <del>export const REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = usePolyfill <del> ? 0xeae7 <del> : Symbol.for('react.default_value'); <del>const MAYBE_ITERATOR_SYMBOL = usePolyfill <del> ? typeof Symbol === 'function' && Symbol.iterator <del> : Symbol.iterator; <del> <del>const FAUX_ITERATOR_SYMBOL = '@@iterator'; <del> <del>export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator<*> { <del> if (maybeIterable === null || typeof maybeIterable !== 'object') { <del> return null; <del> } <del> const maybeIterator = <del> (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || <del> maybeIterable[FAUX_ITERATOR_SYMBOL]; <del> if (typeof maybeIterator === 'function') { <del> return maybeIterator; <del> } <del> return null; <del>} <ide><path>packages/shared/__tests__/ReactSymbols-test.internal.js <ide> describe('ReactSymbols', () => { <ide> it('Symbol values should be unique', () => { <ide> expectToBeUnique(Object.entries(require('shared/ReactSymbols'))); <ide> }); <del> <del> // @gate enableSymbolFallbackForWWW <del> it('numeric values should be unique', () => { <del> const originalSymbolFor = global.Symbol.for; <del> global.Symbol.for = null; <del> try { <del> const entries = Object.entries(require('shared/ReactSymbols.www')).filter( <del> // REACT_ASYNC_MODE_TYPE and REACT_CONCURRENT_MODE_TYPE have the same numeric value <del> // for legacy backwards compatibility <del> ([key]) => key !== 'REACT_ASYNC_MODE_TYPE', <del> ); <del> expectToBeUnique(entries); <del> } finally { <del> global.Symbol.for = originalSymbolFor; <del> } <del> }); <ide> }); <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = true; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = false; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = false; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.native.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = false; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = true; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.testing.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = false; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.testing.www.js <ide> export const enableServerContext = false; <ide> export const enableUseMutableSource = true; <ide> <ide> export const enableTransitionTracing = false; <del>export const enableSymbolFallbackForWWW = false; <ide> <ide> export const enableFloat = false; <ide> // Flow magic to verify the exports of this file match the original version. <ide><path>packages/shared/forks/ReactFeatureFlags.www-dynamic.js <ide> export const consoleManagedByDevToolsDuringStrictMode = __VARIANT__; <ide> export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = __VARIANT__; <ide> export const enableClientRenderFallbackOnTextMismatch = __VARIANT__; <ide> export const enableTransitionTracing = __VARIANT__; <del>export const enableSymbolFallbackForWWW = __VARIANT__; <ide> // Enable this flag to help with concurrent mode debugging. <ide> // It logs information to the console about React scheduling, rendering, and commit phases. <ide> // <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const enableUseMutableSource = true; <ide> <ide> export const enableCustomElementPropertySupport = __EXPERIMENTAL__; <ide> <del>export const enableSymbolFallbackForWWW = true; <ide> // Flow magic to verify the exports of this file match the original version. <ide> // eslint-disable-next-line no-unused-vars <ide> type Check<_X, Y: _X, X: Y = _X> = null; <ide><path>packages/shared/isValidElementType.js <ide> import { <ide> enableTransitionTracing, <ide> enableDebugTracing, <ide> enableLegacyHidden, <del> enableSymbolFallbackForWWW, <ide> } from './ReactFeatureFlags'; <ide> <del>let REACT_MODULE_REFERENCE; <del>if (enableSymbolFallbackForWWW) { <del> if (typeof Symbol === 'function') { <del> REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); <del> } else { <del> REACT_MODULE_REFERENCE = 0; <del> } <del>} else { <del> REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); <del>} <add>const REACT_MODULE_REFERENCE: Symbol = Symbol.for('react.module.reference'); <ide> <ide> export default function isValidElementType(type: mixed) { <ide> if (typeof type === 'string' || typeof type === 'function') { <ide><path>scripts/jest/setupTests.www.js <ide> jest.mock('shared/ReactFeatureFlags', () => { <ide> return wwwFlags; <ide> }); <ide> <del>jest.mock('shared/ReactSymbols', () => { <del> return jest.requireActual('shared/ReactSymbols.www'); <del>}); <del> <ide> jest.mock('scheduler/src/SchedulerFeatureFlags', () => { <ide> const schedulerSrcPath = process.cwd() + '/packages/scheduler'; <ide> jest.mock( <ide><path>scripts/rollup/forks.js <ide> const forks = Object.freeze({ <ide> return null; <ide> }, <ide> <del> './packages/shared/ReactSymbols.js': bundleType => { <del> switch (bundleType) { <del> case FB_WWW_DEV: <del> case FB_WWW_PROD: <del> case FB_WWW_PROFILING: <del> return './packages/shared/ReactSymbols.www.js'; <del> default: <del> return './packages/shared/ReactSymbols.js'; <del> } <del> }, <del> <ide> './packages/scheduler/index.js': (bundleType, entry, dependencies) => { <ide> switch (bundleType) { <ide> case UMD_DEV:
17
Ruby
Ruby
move alternative solution to a new line
db7997e1a0acde9f11ee9ae0b91833f493eff2ef
<ide><path>Library/Homebrew/exceptions.rb <ide> def initialize(flags, bottled: true) <ide> EOS <ide> <ide> message << <<~EOS.chomp! if bottled <del> Alternatively, remove the #{flag_text} to attempt bottle installation. <add> \nAlternatively, remove the #{flag_text} to attempt bottle installation. <ide> EOS <ide> <ide> super message
1
Javascript
Javascript
add a fastboot test to help design the api
104e2c6593bf5ba81da0a39bad74f8ab40912e2d
<ide><path>packages/ember-application/lib/system/application-instance.js <ide> import { set } from 'ember-metal/property_set'; <ide> import EmberObject from 'ember-runtime/system/object'; <ide> import run from 'ember-metal/run_loop'; <ide> import { computed } from 'ember-metal/computed'; <add>import ContainerProxy from 'ember-runtime/mixins/container_proxy'; <add>import DOMHelper from 'ember-htmlbars/system/dom-helper'; <ide> import Registry from 'container/registry'; <ide> import RegistryProxy, { buildFakeRegistryWithDeprecations } from 'ember-runtime/mixins/registry_proxy'; <del>import ContainerProxy from 'ember-runtime/mixins/container_proxy'; <add>import Renderer from 'ember-metal-views/renderer'; <ide> import assign from 'ember-metal/assign'; <ide> import environment from 'ember-metal/environment'; <ide> <add> <ide> let BootOptions; <ide> <ide> /** <ide> let ApplicationInstance = EmberObject.extend(RegistryProxy, ContainerProxy, { <ide> options = new BootOptions(options); <ide> set(this, '_bootOptions', options); <ide> <add> if (options.document) { <add> this.__registry__.register('renderer:-dom', { <add> create() { <add> return new Renderer(new DOMHelper(options.document), options.hasDOM); <add> } <add> }); <add> } <add> <ide> if (options.rootElement) { <ide> set(this, 'rootElement', options.rootElement); <ide> } else { <ide> if (isEnabled('ember-application-visit')) { <ide> let router = get(this, 'router'); <ide> <ide> let handleResolve = () => { <del> return this; <add> // Resolve only after rendering is complete <add> return new Ember.RSVP.Promise((resolve) => { <add> // TODO: why is this necessary? Shouldn't 'actions' queue be enough? <add> // Also, aren't proimses supposed to be async anyway? <add> run.next(null, resolve, this); <add> }); <ide> }; <ide> <ide> let handleReject = (error) => { <ide> if (isEnabled('ember-application-visit')) { <ide> BootOptions = function BootOptions(options) { <ide> options = options || {}; <ide> <add> /** <add> If present, render into the given `Document` object instead of `window.document`. <add> <add> @property document <add> @type Document <add> @default null <add> @private <add> */ <add> if (options.document) { <add> this.document = options.document; <add> } <add> <ide> /** <ide> If present, overrides the `rootElement` property on the instance. This is useful <ide> for testing environment, where you might want to append the root view to a fixture <ide> area. <ide> <ide> @property rootElement <del> @property {String|DOMElement} rootElement <add> @type String|DOMElement <ide> @default null <ide> @private <ide> */ <ide><path>packages/ember-application/lib/system/application.js <ide> if (isEnabled('ember-application-visit')) { <ide> @method visit <ide> @private <ide> */ <del> visit(url) { <add> visit(url, options) { <ide> return this.boot().then(() => { <del> let defer = new Ember.RSVP.defer(); <del> <del> return this.buildInstance().boot({ <del> location: 'none', <del> hasDOM: false, <del> didCreateRootView(view) { <del> this.view = view; <del> defer.resolve(this); <del> } <del> }).then((instance) => { <add> options = options || {}; <add> <add> let instance = this.buildInstance(); <add> <add> var bootOptions = {}; <add> <add> if (options.location !== null) { <add> bootOptions.location = options.location || 'none'; <add> } <add> <add> if (options.server) { <add> bootOptions.hasDOM = false; <add> bootOptions.didCreateRootView = function(view) { <add> view.renderer.appendTo(view, options.rootElement); <add> }; <add> } <add> <add> if (options.document) { <add> bootOptions.document = options.document; <add> } <add> <add> if (options.rootElement) { <add> bootOptions.rootElement = options.rootElement; <add> } <add> <add> return instance.boot(bootOptions).then(() => { <ide> return instance.visit(url); <del> }).then(() => { <del> return defer.promise; <ide> }); <ide> }); <ide> } <ide><path>packages/ember-application/tests/system/visit_test.js <ide> import ApplicationInstance from 'ember-application/system/application-instance'; <ide> import Route from 'ember-routing/system/route'; <ide> import Router from 'ember-routing/system/router'; <ide> import View from 'ember-views/views/view'; <add>import Component from 'ember-views/components/component'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide> <ide> let App = null; <ide> let instance = null; <add>let instances = []; <ide> <del>function createApplication() { <add>function createApplication(integration) { <ide> App = Application.extend().create({ <ide> autoboot: false, <add> rootElement: '#qunit-fixture', <ide> LOG_TRANSITIONS: true, <ide> LOG_TRANSITIONS_INTERNAL: true, <ide> LOG_ACTIVE_GENERATION: true <ide> }); <ide> <ide> App.Router = Router.extend(); <ide> <del> App.instanceInitializer({ <del> name: 'auto-cleanup', <del> initialize(_instance) { <del> if (instance) { <del> run(instance, 'destroy'); <add> if (integration) { <add> App.instanceInitializer({ <add> name: 'auto-cleanup', <add> initialize(_instance) { <add> instances.push(_instance); <ide> } <add> }); <add> } else { <add> App.instanceInitializer({ <add> name: 'auto-cleanup', <add> initialize(_instance) { <add> if (instance) { <add> run(instance, 'destroy'); <add> } <ide> <del> instance = _instance; <del> } <del> }); <add> instance = _instance; <add> } <add> }); <add> } <ide> <ide> return App; <ide> } <ide> if (isEnabled('ember-application-visit')) { <ide> App.visit('/').then(function(instance) { <ide> QUnit.start(); <ide> assert.ok(instance instanceof ApplicationInstance, 'promise is resolved with an ApplicationInstance'); <del> <del> run(instance.view, 'appendTo', '#qunit-fixture'); <ide> assert.equal(Ember.$('#qunit-fixture > .ember-view h1').text(), 'Hello world', 'the application was rendered once the promise resolves'); <ide> }, function(error) { <ide> QUnit.start(); <ide> if (isEnabled('ember-application-visit')) { <ide> App.visit('/').then(function(instance) { <ide> QUnit.start(); <ide> assert.ok(instance instanceof ApplicationInstance, 'promise is resolved with an ApplicationInstance'); <del> <del> run(instance.view, 'appendTo', '#qunit-fixture'); <ide> assert.equal(Ember.$('#qunit-fixture > #my-cool-app h1').text(), 'Hello world', 'the application was rendered once the promise resolves'); <ide> assert.strictEqual(View.views['my-cool-app'], undefined, 'view was not registered globally'); <ide> <ide> if (isEnabled('ember-application-visit')) { <ide> }); <ide> }); <ide> }); <add> <add> QUnit.module('Ember.Application - visit() Integration Tests', { <add> teardown() { <add> if (instances) { <add> run(instances, 'forEach', (i) => i.destroy()); <add> instances = []; <add> } <add> <add> if (App) { <add> run(App, 'destroy'); <add> App = null; <add> } <add> } <add> }); <add> <add> QUnit.test('FastBoot-style setup', function(assert) { <add> QUnit.expect(15); <add> QUnit.stop(); <add> <add> let initCalled = false; <add> let didInsertElementCalled = false; <add> <add> run(function() { <add> createApplication(true); <add> <add> App.Router.map(function() { <add> this.route('a'); <add> this.route('b'); <add> }); <add> <add> App.register('template:application', compile('<h1>Hello world</h1>\n{{outlet}}')); <add> <add> App.register('template:a', compile('<h2>Welcome to {{x-foo page="A"}}</h2>')); <add> <add> App.register('template:b', compile('<h2>{{x-foo page="B"}}</h2>')); <add> <add> App.register('template:components/x-foo', compile('Page {{page}}')); <add> <add> App.register('component:x-foo', Component.extend({ <add> tagName: 'span', <add> init() { <add> this._super(); <add> initCalled = true; <add> }, <add> didInsertElement() { <add> didInsertElementCalled = true; <add> } <add> })); <add> }); <add> <add> assert.equal(Ember.$('#qunit-fixture').children().length, 0, 'there are no elements in the fixture element'); <add> <add> function makeFakeDom() { <add> // TODO: use simple-dom <add> return document.implementation.createHTMLDocument(); <add> } <add> <add> let a = run(function() { <add> let dom = makeFakeDom(); <add> <add> return App.visit('/a', { document: dom, rootElement: dom.body, server: true }).then(instance => { <add> QUnit.start(); <add> assert.ok(instance instanceof ApplicationInstance, 'promise is resolved with an ApplicationInstance'); <add> assert.equal(instance.getURL(), '/a'); <add> <add> let serialized = dom.body.innerHTML; <add> let $parsed = Ember.$(serialized); <add> <add> assert.equal($parsed.find('h1').text(), 'Hello world'); <add> assert.equal($parsed.find('h2').text(), 'Welcome to Page A'); <add> <add> assert.ok(initCalled, 'Component#init should be called'); <add> assert.ok(!didInsertElementCalled, 'Component#didInsertElement should not be called'); <add> <add> assert.equal(Ember.$('#qunit-fixture').children().length, 0, 'there are no elements in the fixture element'); <add> QUnit.stop(); <add> }); <add> }); <add> <add> let b = run(function() { <add> let dom = makeFakeDom(); <add> <add> return App.visit('/b', { document: dom, rootElement: dom.body, server: true }).then(instance => { <add> QUnit.start(); <add> assert.ok(instance instanceof ApplicationInstance, 'promise is resolved with an ApplicationInstance'); <add> assert.equal(instance.getURL(), '/b'); <add> <add> let serialized = dom.body.innerHTML; <add> let $parsed = Ember.$(serialized); <add> <add> assert.equal($parsed.find('h1').text(), 'Hello world'); <add> assert.equal($parsed.find('h2').text(), 'Page B'); <add> <add> assert.ok(initCalled, 'Component#init should be called'); <add> assert.ok(!didInsertElementCalled, 'Component#didInsertElement should not be called'); <add> <add> assert.equal(Ember.$('#qunit-fixture').children().length, 0, 'there are no elements in the fixture element'); <add> QUnit.stop(); <add> }); <add> }); <add> <add> Ember.RSVP.all([a, b]).finally(() => QUnit.start()); <add> }); <add> <add> QUnit.test('Ember Islands-style setup', function(assert) { <add> <add> }); <add> <add> QUnit.skip('Resource-discovery setup', function(assert) { <add> <add> <add> }); <add> <add> QUnit.skip('Test setup', function(assert) { <add> <add> <add> }); <add> <add> QUnit.skip('iframe setup', function(assert) { <add> <add> <add> }); <ide> }
3
PHP
PHP
fix style ci errors
452826b8f17ff07fcbba99523bb15b015b2d94f8
<ide><path>src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php <ide> use Illuminate\Foundation\Console\ViewClearCommand; <ide> use Illuminate\Notifications\Console\NotificationTableCommand; <ide> use Illuminate\Queue\Console\BatchesTableCommand; <add>use Illuminate\Queue\Console\ClearCommand as QueueClearCommand; <ide> use Illuminate\Queue\Console\FailedTableCommand; <ide> use Illuminate\Queue\Console\FlushFailedCommand as FlushFailedQueueCommand; <ide> use Illuminate\Queue\Console\ForgetFailedCommand as ForgetFailedQueueCommand; <ide> use Illuminate\Queue\Console\RestartCommand as QueueRestartCommand; <ide> use Illuminate\Queue\Console\RetryBatchCommand as QueueRetryBatchCommand; <ide> use Illuminate\Queue\Console\RetryCommand as QueueRetryCommand; <del>use Illuminate\Queue\Console\ClearCommand as QueueClearCommand; <ide> use Illuminate\Queue\Console\TableCommand; <ide> use Illuminate\Queue\Console\WorkCommand as QueueWorkCommand; <ide> use Illuminate\Routing\Console\ControllerMakeCommand; <ide><path>src/Illuminate/Queue/Console/ClearCommand.php <ide> public function handle() <ide> $queueName = $this->getQueue($connection); <ide> $queue = ($this->laravel['queue'])->connection($connection); <ide> <del> if($queue instanceof ClearableQueue) { <add> if ($queue instanceof ClearableQueue) { <ide> $count = $queue->clear($queueName); <ide> <ide> $this->line('<info>Cleared '.$count.' jobs from the '.$queueName.' queue</info> '); <ide><path>src/Illuminate/Queue/DatabaseQueue.php <ide> <ide> namespace Illuminate\Queue; <ide> <del>use Illuminate\Contracts\Queue\Queue as QueueContract; <ide> use Illuminate\Contracts\Queue\ClearableQueue; <add>use Illuminate\Contracts\Queue\Queue as QueueContract; <ide> use Illuminate\Database\Connection; <ide> use Illuminate\Queue\Jobs\DatabaseJob; <ide> use Illuminate\Queue\Jobs\DatabaseJobRecord; <ide><path>src/Illuminate/Queue/RedisQueue.php <ide> <ide> namespace Illuminate\Queue; <ide> <del>use Illuminate\Contracts\Queue\Queue as QueueContract; <ide> use Illuminate\Contracts\Queue\ClearableQueue; <add>use Illuminate\Contracts\Queue\Queue as QueueContract; <ide> use Illuminate\Contracts\Redis\Factory as Redis; <ide> use Illuminate\Queue\Jobs\RedisJob; <ide> use Illuminate\Support\Str;
4
Ruby
Ruby
add extra clarifying line in docs. [ci skip]
a3c8e4add7178e86d80584f2c7df51b77fc882ff
<ide><path>actionpack/lib/action_dispatch/http/request.rb <ide> def original_url <ide> # The +String+ MIME type of the request <ide> # <ide> # app.get "/articles" <add> # app.request.media_type <ide> # # => "application/x-www-form-urlencoded" <ide> def media_type <ide> content_mime_type.to_s
1
Mixed
Text
add middleware docs
f9c5f4fbd4031db0f4ccbe6f288ab0776254d3c2
<ide><path>docs/advanced/AsyncActions.md <del># Async Actions <ide><path>docs/advanced/Middleware.md <ide> # Middleware <ide> <add>If you used server-side libraries like [Express](http://expressjs.com/) and [Koa](http://koajs.com/), you are familiar with a concept of *middleware*. In these frameworks, middleware is some code you can put between the framework receiving a request, and framework generating a response. For example, Express or Koa middleware may add CORS headers, logging, compression, and more. The best feature of middleware is that it’s composable in a chain. You can use multiple indepent third-party middleware in a single project. <add> <add>Redux middleware solves different problems than Express or Koa middleware, but in a conceptually similar way. **It provides a third-party extension point between dispatching an action, and the moment it reaches the store.** People use Redux middleware for logging, crash reporting, talking to an asynchronous API, routing, and more. <add> <add>This article is divided in an in-depth intro to help you grok the concept, and [a few practical examples](#seven-examples) to show the power of middleware at the very end. You may find it helpful to switch back and forth between them, as you flip between feeling bored and inspired. <add> <add>>##### Note for the Impatient <add> <add>>You will find some practical advice on using middleware for asynchronous actions [in the next section](AsyncActions.md). However we strongly advise you to resist the urge to skip this article. <add> <add>>Middleware is the most “magical” part of Redux you are likely to encounter. Learning how it works and how to write your own is the best investment you can make into your productivity using Redux. <add> <add>>If you’re really impatient, skip ahead to [seven examples](#seven-examples) and come back. <add> <add>## Understanding Middleware <add> <add>While middleware can be used for a variety of things, including asynchronous API calls, it’s really important that you understand where it comes from. We’ll guide you through the thought process leading to middleware, by using logging and crash reporting as examples. <add> <add>### Problem: Logging <add> <add>One of the benefits of Redux is that it makes state changes predictable and transparent. Every time an action is dispatched, the new state is computed and saved. The state cannot change by itself, it can only change as a consequence of a specific action. <add> <add>Wouldn’t it be nice if we logged every action that happens in the app, together with the state computed after it? When something goes wrong, we can look back at our log, and figure out which action corrupted the state. <add> <add><img src='http://i.imgur.com/BjGBlES.png' width='70%'> <add> <add>How do we approach this with Redux? <add> <add>### Attempt #1: Logging Manually <add> <add>The most naïve solution is just to log the action and the next state yourself every time you call [`store.dispatch(action)`](../api/Store.md#dispatch). It’s not really a solution, but just a first step towards understanding the problem. <add> <add>>##### Note <add> <add>>If you’re using [react-redux](https://github.com/gaearon/react-redux) or similar bindings, you likely won’t have direct access to the store instance in your components. For the next few paragraphs, just assume you pass the store down explicitly. <add> <add>Say, you call this when creating a todo: <add> <add>```js <add>store.dispatch(addTodo('Use Redux')); <add>``` <add> <add>To log the action and state, you can change it to something like this: <add> <add>```js <add>let action = addTodo('Use Redux'); <add> <add>console.log('dispatching', action); <add>store.dispatch(action); <add>console.log('next state', store.getState()); <add>``` <add> <add>This produces the desired effect, but you wouldn’t want to do it every time. <add> <add>### Attempt #2: Wrapping Dispatch <add> <add>You can logging into a function: <add> <add>```js <add>function dispatchAndLog(store, action) { <add> console.log('dispatching', action); <add> store.dispatch(action); <add> console.log('next state', store.getState()); <add>} <add>``` <add> <add>You can then use it everywhere instead of `store.dispatch()`: <add> <add>```js <add>dispatchAndLog(store, addTodo('Use Redux')); <add>``` <add> <add>We could end this here, but it’s not very convenient to import a special function every time. <add> <add>### Attempt #3: Monkeypatching Dispatch <add> <add>What if we just replace the `dispatch` function on the store instance? Redux store is just a plain object with [a few methods](../api/Store.md), and we’re writing JavaScript, so we can just monkeypatch the `dispatch` implementation: <add> <add>```js <add>let next = store.dispatch; <add>store.dispatch = function dispatchAndLog(action) { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add>}; <add>``` <add> <add>This is already closer to what we want! No matter where we dispatch an action, it is guaranteed to be logged. Monkeypatching never feels right, but we can live with this for now. <add> <add>### Problem: Crash Reporting <add> <add>What if we want to apply **more then one** such transformation to `dispatch`? <add> <add>A different useful transformation that comes to my mind is reporting JavaScript errors in production. The global `window.onerror` event is not reliable because it doesn’t provide stack information in some older browsers, which is crucial to understand why an error is happening. <add> <add>Wouldn’t it be useful if, any time an error is thrown as a result of dispatching an action, we would send it to an crash reporting service like [Sentry](https://getsentry.com/welcome/) with the stack trace, the action that caused the error, and the current state? This way it’s much easier to reproduce the error in development. <add> <add>However, it is important that we keep logging and crash reporting separate. Ideally we want them to be different modules, potentially in different packages. Otherwise we can’t have an ecosystem of such utilities. (Hint: we’re slowly getting to what middleware is!) <add> <add>If logging and crash reporting are separate utilities, they might look like this: <add> <add>```js <add>function patchStoreToAddLogging(store) { <add> let next = store.dispatch; <add> store.dispatch = function dispatchAndLog(action) { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add> }; <add>} <add> <add>function patchStoreToAddCrashReporting(store) { <add> let next = store.dispatch; <add> store.dispatch = function dispatchAndReportErrors(action) { <add> try { <add> return next(action); <add> } catch (err) { <add> console.error('Caught an exception!', err); <add> Raven.captureException(err, { <add> extra: { <add> action, <add> state: store.getState() <add> } <add> }); <add> throw err; <add> } <add> }; <add>} <add>``` <add> <add>If these functions are published as separate modules, we can later use them to patch our store: <add> <add>```js <add>patchStoreToAddLogging(store); <add>patchStoreToAddCrashReporting(store); <add>``` <add> <add>Still, this isn’t nice. <add> <add>### Attempt #4: Hiding Monkeypatching <add> <add>Monkeypatching is a hack. “Replace any method you like”, what kind of API is that? Let’s figure out the essence of it instead. Previously, our functions replaced `store.dispatch`. What if they *returned* the new `dispatch` function instead? <add> <add>```js <add>function logger(store) { <add> let next = store.dispatch; <add> <add> // Previously: <add> // store.dispatch = function dispatchAndLog(action) { <add> <add> return function dispatchAndLog(action) { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add> }; <add>} <add>``` <add> <add>We could provide a helper inside Redux that would apply the actual monkeypatching as an implementation detail: <add> <add>```js <add>function applyMiddlewareByMonkeypatching(store, middlewares) { <add> middlewares = middlewares.slice(); <add> middlewares.reverse(); <add> <add> // Transform dispatch function with each middleware. <add> middlewares.forEach(middleware => <add> store.dispatch = middleware(store) <add> ); <add>} <add>``` <add> <add>We could use it to apply multiple middleware like this: <add> <add>```js <add>applyMiddlewareByMonkeypatching(store, [logger, crashReporter]); <add>``` <add> <add>However, it is still monkeypatching. <add>The fact that we hide it inside the library doesn’t alter this fact. <add> <add>### Attempt #5: Removing Monkeypatching <add> <add>Why do we even overwrite `dispatch`? Of course, to be able to call it later, but there’s also another reason: so that every middleware can access (and call) the previously wrapped `store.dispatch`: <add> <add>```js <add>function logger(store) { <add> // Must point to the function returned by the previous middleware: <add> let next = store.dispatch; <add> <add> return function dispatchAndLog(action) { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add> }; <add>} <add>``` <add> <add>It is essential to chaining middleware! <add> <add>If `applyMiddlewareByMonkeypatching` doesn’t assign `store.dispatch` immediately after processing the first middleware, `store.dispatch` will keep pointing to the original `dispatch` function. Then the second middleware will also be bound to the original `dispatch` function. <add> <add>But there’s also a different way to enable chaining. The middleware could accept the `next()` dispatch function as a parameter instead of reading it from the `store` instance. <add> <add>```js <add>function logger(store) { <add> return function wrapDispatchToAddLogging(next) { <add> return function dispatchAndLog(action) { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add> }; <add> } <add>} <add>``` <add> <add>It’s a [“we need to go deeper”](http://knowyourmeme.com/memes/we-need-to-go-deeper) kind of moment, so it might take a while for this to make sense. The function cascade feels intimidating. ES6 arrow functions make this [currying](https://en.wikipedia.org/wiki/Currying) easier on eyes: <add> <add>```js <add>const logger = store => next => action => { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add>}; <add> <add>const crashReporter = store => next => action => { <add> try { <add> return next(action); <add> } catch (err) { <add> console.error('Caught an exception!', err); <add> Raven.captureException(err, { <add> extra: { <add> action, <add> state: store.getState() <add> } <add> }); <add> throw err; <add> } <add>} <add>``` <add> <add>**This is exactly what Redux middleware looks like.** <add> <add>Now middleware takes the `next()` dispatch function, and returns a dispatch function, which in turn serves as `next()` to the middleware to the left, and so on. It’s still useful to have access to some store methods like `getState()`, so `store` stays available as the top-level argument. <add> <add>### Attempt #6: Naïvely Applying the Middleware <add> <add>Instead of `applyMiddlewareByMonkeypatching()`, we could write `applyMiddleware()` that first obtains the final, fully wrapped `dispatch()` function, and returns a copy of the store using it: <add> <add>```js <add>// Warning: Naïve implementation! <add>// That's *not* Redux API. <add> <add>function applyMiddleware(store, middlewares) { <add> middlewares = middlewares.slice(); <add> middlewares.reverse(); <add> <add> let dispatch = store.dispatch; <add> middlewares.forEach(middleware => <add> dispatch = middleware(store)(dispatch) <add> ); <add> <add> return Object.assign({}, store, { dispatch }); <add>} <add>``` <add> <add>The implementation of [`applyMiddleware()`](../api/applyMiddleware.md) that ships with Redux is similar, but **different in three important aspects**: <add> <add>* It only exposes a subset of [store API](../api/Store.md) to the middleware: [`dispatch(action)`](../api/Store.md#dispatch) and [`getState()`](../api/Store. <add>md#getState). <add> <add>* It does a bit of trickery to make sure that if you call `store.dispatch(action)` from your middleware instead of `next(action)`, the action will actually travel the whole middleware chain again, including the current middleware. This is useful for asynchronous middleware, as we will see [later](AsyncActions.md). <add> <add>* To ensure that you may only apply middleware once, it operates on `createStore()` rather than on `store` itself. Instead of `(store, middlewares) => store`, its signature is `(...middlewares) => (createStore) => createStore`. <add> <add>### The Final Approach <add> <add>Given this middleware we just wrote: <add> <add>```js <add>const logger = store => next => action => { <add> console.log('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> return result; <add>}; <add> <add>const crashReporter = store => next => action => { <add> try { <add> return next(action); <add> } catch (err) { <add> console.error('Caught an exception!', err); <add> Raven.captureException(err, { <add> extra: { <add> action, <add> state: store.getState() <add> } <add> }); <add> throw err; <add> } <add>} <add>``` <add> <add>Here’s how to apply it to a Redux store: <add> <add>```js <add>import { createStore, combineReducers, applyMiddleware } from 'redux'; <add> <add>// applyMiddleware takes createStore() and returns <add>// a function with a compatible API. <add>let createStoreWithMiddleware = applyMiddleware( <add> logger, <add> crashReporter <add>)(createStore); <add> <add>// Use it like you would use createStore() <add>let todoApp = combineReducers(reducers); <add>let store = createStoreWithMiddleware(todoApp); <add>``` <add> <add>This is it! Now any actions dispatched to the store instance will flow through `logger` and `crashReporter`: <add> <add>```js <add>// Will flow through both logger and crashReporter middleware! <add>store.dispatch(addTodo('Use Redux')); <add>``` <add> <add>## Seven Examples <add> <add>If your head boiled from reading the above section, imagine what it was like to write it. This part is meant to be a relaxation for you and me, and will help get your gears turning. <add> <add>Each function below is (or, in some cases, returns) a valid Redux middleware. They are not equally useful, but at least they are equally fun. <add> <add>```js <add>/** <add> * Logs all actions and states after they are dispatched. <add> */ <add>const logger = store => next => action => { <add> console.group(action.type); <add> console.info('dispatching', action); <add> let result = next(action); <add> console.log('next state', store.getState()); <add> console.groupEnd(action.type); <add> return result; <add>}; <add> <add>/** <add> * Sends crash reports as state is updated and listeners are notified. <add> */ <add>const crashReporter = store => next => action => { <add> try { <add> return next(action); <add> } catch (err) { <add> console.error('Caught an exception!', err); <add> Raven.captureException(err, { <add> extra: { <add> action, <add> state: store.getState() <add> } <add> }); <add> throw err; <add> } <add>} <add> <add>/** <add> * Schedules actions with { meta: { delay: N } } to be delayed by N milliseconds. <add> * Makes `dispatch` return a function to cancel the interval in this case. <add> */ <add>const timeoutScheduler = store => next => action => { <add> if (!action.meta || !action.meta.delay) { <add> return next(action); <add> } <add> <add> let intervalId = setTimeout( <add> () => next(action), <add> action.meta.delay <add> ); <add> <add> return function cancel() { <add> clearInterval(intervalId); <add> }; <add>}; <add> <add>/** <add> * Schedules actions with { meta: { raf: true } } to be dispatched inside a rAF loop frame. <add> * Makes `dispatch` return a function to remove the action from queue in this case. <add> */ <add>const rafScheduler = store => next => { <add> let queuedActions = []; <add> let frame = null; <add> <add> function loop() { <add> frame = null; <add> try { <add> if (queuedActions.length) { <add> next(queuedActions.shift()); <add> } <add> } finally { <add> maybeRaf(); <add> } <add> } <add> <add> function maybeRaf() { <add> if (queuedActions.length && !frame) { <add> frame = requestAnimationFrame(loop); <add> } <add> } <add> <add> return action => { <add> if (!action.meta || !action.meta.raf) { <add> return next(action); <add> } <add> <add> queuedActions.push(action); <add> maybeRaf(); <add> <add> return function cancel() { <add> queuedActions = queuedActions.filter(a => a !== action) <add> }; <add> }; <add>}; <add> <add>/** <add> * Lets you dispatch promises in addition to actions. <add> * If the promise is resolved, its result will be dispatched as an action. <add> * The promise is returned from `dispatch` so the caller may handle rejection. <add> */ <add>const vanillaPromise = store => next => action => { <add> if (typeof action.then !== 'function') { <add> return next(action); <add> } <add> <add> return Promise.resolve(action).then(store.dispatch); <add>}; <add> <add>/** <add> * Lets you dispatch special actions with a { promise } field. <add> * <add> * This middleware will turn them into a single action at the beginning, <add> * and a single success (or failure) action when the `promise` resolves. <add> * <add> * For convenience, `dispatch` will return the promise so the caller can wait. <add> */ <add>const readyStatePromise = store => next => action => { <add> if (!action.promise) { <add> return next(action) <add> } <add> <add> function makeAction(ready, data) { <add> let newAction = Object.assign({}, action, { ready }, data); <add> delete newAction.promise; <add> return newAction; <add> } <add> <add> next(makeAction(false)); <add> return action.promise.then( <add> result => next(makeAction(true, { result })), <add> error => next(makeAction(true, { error })) <add> ); <add>}; <add> <add>/** <add> * Lets you dispatch a function instead an action. <add> * This function will receive `dispatch` and `getState` as arguments. <add> * <add> * Useful for early exits (conditions over `getState()`), as well <add> * as for async control flow (it can `dispatch()` something else). <add> * <add> * `dispatch` will return the return value of the dispatched function. <add> */ <add>const thunk = store => next => action => <add> typeof action === 'function' ? <add> action(store.dispatch, store.getState) : <add> next(action); <add> <add> <add>// You can use all of them! (It doesn’t mean you should.) <add>let createStoreWithMiddleware = applyMiddleware( <add> rafScheduler, <add> timeoutScheduler, <add> thunk, <add> vanillaPromise, <add> readyStatePromise, <add> logger, <add> errorHandler <add>)(createStore); <add>let todoApp = combineReducers(reducers); <add>let store = createStoreWithMiddleware(todoApp); <add>``` <ide>\ No newline at end of file <ide><path>src/utils/applyMiddleware.js <ide> import compose from './compose'; <ide> * @returns {Function} A store enhancer applying the middleware. <ide> */ <ide> export default function applyMiddleware(...middlewares) { <del> return (next) => (reducer, initialState) => { <del> var store = next(reducer, initialState); <del> var dispatch = store.dispatch; <del> var chain = []; <add> return function applyGivenMiddleware(createStore) { <add> middlewares = middlewares.slice(); <add> middlewares.reverse(); <ide> <del> var middlewareAPI = { <del> getState: store.getState, <del> dispatch: (action) => dispatch(action) <del> }; <del> chain = middlewares.map(middleware => middleware(middlewareAPI)); <del> dispatch = compose(...chain, store.dispatch); <add> return function createStoreWithMiddleware(reducer, initialState) { <add> const store = createStore(reducer, initialState); <add> <add> let dispatch = store.dispatch; <add> let middlewareAPI = { <add> getState: store.getState, <add> dispatch: (action) => dispatch(action) <add> }; <add> middlewares.forEach(middleware => <add> dispatch = middleware(store)(dispatch) <add> ); <ide> <del> return { <del> ...store, <del> dispatch <add> return Object.assign({}, store, { dispatch }); <ide> }; <del> }; <add> } <ide> }
3
Javascript
Javascript
hide reactelement constructor
7ce8c844bda7d2fe204ad59c10092ffde3f53938
<ide><path>src/core/ReactElement.js <ide> var ReactElement = function(type, key, ref, owner, context, props) { <ide> this.props = props; <ide> }; <ide> <add>// We intentionally don't expose the function on the constructor property. <add>// ReactElement should be indistinguishable from a plain object. <add>ReactElement.prototype = { <add> _isReactElement: true <add>}; <add> <ide> if (__DEV__) { <ide> defineMutationMembrane(ReactElement.prototype); <ide> } <ide> <del>ReactElement.prototype._isReactElement = true; <del> <ide> ReactElement.createElement = function(type, config, children) { <ide> var propName; <ide> <ide><path>src/core/__tests__/ReactElement-test.js <ide> describe('ReactElement', function() { <ide> expect(instance.getDOMNode().tagName).toBe('DIV'); <ide> }); <ide> <add> it('is indistinguishable from a plain object', function() { <add> var element = React.createElement('div', { className: 'foo' }); <add> var object = {}; <add> expect(element.constructor).toBe(object.constructor); <add> }); <add> <ide> });
2
Ruby
Ruby
fix comment error in example formula
00cba6dc042d0fec7b0158ea3a16e357d32acf5d
<ide><path>Library/Contributions/example-formula.rb <ide> def install <ide> # Sometime you will see that instead of `+` we build up a path with `/` <ide> # because it looks nicer (but you can't nest more than two `/`): <ide> (var/'foo').mkpath <del> # Copy `./example_code/simple/ones` to share/demos/examples <add> # Copy `./example_code/simple/ones` to share/demos <ide> (share/'demos').install "example_code/simple/ones" <ide> # Copy `./example_code/simple/ones` to share/demos/examples <ide> (share/'demos').install "example_code/simple/ones" => 'examples'
1
Text
Text
add changes for 1.3.9 and 1.4.0-beta.0
f2e1a930aa5d98f1efe11e0641261762b47a4721
<ide><path>CHANGELOG.md <add><a name="1.4.0-beta.0"></a> <add># 1.4.0-beta.0 photonic-umbrakinesis (2015-01-13) <add> <add> <add>## Bug Fixes <add> <add>- **$location:** support right button click on anchors in firefox <add> ([aa798f12](https://github.com/angular/angular.js/commit/aa798f123658cb78b5581513d26577016195cafe), <add> [#7984](https://github.com/angular/angular.js/issues/7984)) <add>- **$templateRequest:** propagate HTTP status on failed requests <add> ([e24f22bd](https://github.com/angular/angular.js/commit/e24f22bdb1740388938d58778aa24d307a79a796), <add> [#10514](https://github.com/angular/angular.js/issues/10514), [#10628](https://github.com/angular/angular.js/issues/10628)) <add>- **dateFilter:** ignore invalid dates <add> ([1334b8c8](https://github.com/angular/angular.js/commit/1334b8c8326b93e0ca016c85516627900c7a9fd3), <add> [#10640](https://github.com/angular/angular.js/issues/10640)) <add>- **filterFilter:** use isArray() to determine array type <add> ([a01ce6b8](https://github.com/angular/angular.js/commit/a01ce6b81c197b0a4a1057981e8e9c1b74f37587), <add> [#10621](https://github.com/angular/angular.js/issues/10621)) <add>- **ngChecked:** ensure that ngChecked doesn't interfere with ngModel <add> ([e079111b](https://github.com/angular/angular.js/commit/e079111b33bf36be21c0941718b41cc9ca67bea0), <add> [#10662](https://github.com/angular/angular.js/issues/10662), [#10664](https://github.com/angular/angular.js/issues/10664)) <add>- **ngClass:** handle multi-class definitions as an element of an array <add> ([e1132f53](https://github.com/angular/angular.js/commit/e1132f53b03a5a71aa9b6eded24d64e3bc83929b), <add> [#8578](https://github.com/angular/angular.js/issues/8578), [#10651](https://github.com/angular/angular.js/issues/10651)) <add>- **ngModelOptions:** allow sharing options between multiple inputs <add> ([9c9c6b3f](https://github.com/angular/angular.js/commit/9c9c6b3fe4edfe78ae275c413ee3eefb81f1ebf6), <add> [#10667](https://github.com/angular/angular.js/issues/10667)) <add>- **ngOptions:** <add> - support one-time binding on the option values <add> ([ba90261b](https://github.com/angular/angular.js/commit/ba90261b7586b519483883800ea876510faf5c21), <add> [#10687](https://github.com/angular/angular.js/issues/10687), [#10694](https://github.com/angular/angular.js/issues/10694)) <add> - prevent infinite digest if track by expression is stable <add> ([fc21db8a](https://github.com/angular/angular.js/commit/fc21db8a15545fad53124fc941b3c911a8d57067), <add> [#9464](https://github.com/angular/angular.js/issues/9464)) <add> - update model if selected option is removed <add> ([933591d6](https://github.com/angular/angular.js/commit/933591d69cee2c5580da1d8522ba90a7d924da0e), <add> [#7736](https://github.com/angular/angular.js/issues/7736)) <add> - ensure that the correct option is selected when options are loaded async <add> ([7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef), <add> [#8019](https://github.com/angular/angular.js/issues/8019), [#9714](https://github.com/angular/angular.js/issues/9714), [#10639](https://github.com/angular/angular.js/issues/10639)) <add>- **ngPluralize:** generate a warning when using a not defined rule <add> ([c66b4b6a](https://github.com/angular/angular.js/commit/c66b4b6a133f7215d50c23db516986cfc1f0a985)) <add> <add> <add>## Features <add> <add>- **$filter:** display Infinity symbol when number is Infinity <add> ([51d67742](https://github.com/angular/angular.js/commit/51d6774286202b55ade402ca097e417e70fd546b), <add> [#10421](https://github.com/angular/angular.js/issues/10421)) <add>- **$timeout:** allow `fn` to be an optional parameter <add> ([5a603023](https://github.com/angular/angular.js/commit/5a60302389162c6ef45f311c1aaa65a00d538c66), <add> [#9176](https://github.com/angular/angular.js/issues/9176)) <add>- **limitTo:** ignore limit when invalid <add> ([a3c3bf33](https://github.com/angular/angular.js/commit/a3c3bf3332e5685dc319c46faef882cb6ac246e1), <add> [#10510](https://github.com/angular/angular.js/issues/10510)) <add>- **ngMock/$exceptionHandler:** log errors when rethrowing <add> ([deb3cb4d](https://github.com/angular/angular.js/commit/deb3cb4daef0054457bd9fb8995829fff0e8f1e4), <add> [#10540](https://github.com/angular/angular.js/issues/10540), [#10564](https://github.com/angular/angular.js/issues/10564)) <add> <add> <add>## Performance Improvements <add> <add>- **ngStyleDirective:** use $watchCollection <add> ([8928d023](https://github.com/angular/angular.js/commit/8928d0234551a272992d0eccef73b3ad6cb8bfd1), <add> [#10535](https://github.com/angular/angular.js/issues/10535)) <add> <add> <add>## Breaking Changes <add> <add>- **limitTo:** due to [a3c3bf33](https://github.com/angular/angular.js/commit/a3c3bf3332e5685dc319c46faef882cb6ac246e1), <add> limitTo changed behavior when limit value is invalid. <add>Instead of returning empty object/array it returns unchanged input. <add> <add> <add>- **ngOptions:** due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef), <add> <add> <add>When using `ngOptions`: the directive applies a surrogate key as the value of the `<option>` element. <add>This commit changes the actual string used as the surrogate key. We now store a string that is computed <add>by calling `hashKey` on the item in the options collection; previously it was the index or key of the <add>item in the collection. <add> <add>(This is in keeping with the way that the unknown option value is represented in the select directive.) <add> <add>Before you might have seen: <add> <add>``` <add><select ng-model="x" ng-option="i in items"> <add> <option value="1">a</option> <add> <option value="2">b</option> <add> <option value="3">c</option> <add> <option value="4">d</option> <add></select> <add>``` <add> <add>Now it will be something like: <add> <add>``` <add><select ng-model="x" ng-option="i in items"> <add> <option value="string:a">a</option> <add> <option value="string:b">b</option> <add> <option value="string:c">c</option> <add> <option value="string:d">d</option> <add></select> <add>``` <add> <add>If your application code relied on this value, which it shouldn't, then you will need to modify your <add>application to accommodate this. You may find that you can use the `track by` feaure of `ngOptions` <add>as this provides the ability to specify the key that is stored. <add> <add>- **ngOptions:** due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef), <add> <add>When iterating over an object's properties using the `(key, value) in obj` syntax <add>the order of the elements used to be sorted alphabetically. This was an artificial <add>attempt to create a deterministic ordering since browsers don't guarantee the order. <add>But in practice this is not what people want and so this change iterates over properties <add>in the order they are returned by Object.keys(obj), which is almost always the order <add>in which the properties were defined. <add> <add> <add> <add><a name="1.3.9"></a> <add># 1.3.9 multidimensional-awareness (2015-01-13) <add> <add> <add>## Bug Fixes <add> <add>- **$parse:** allow use of locals in assignments <add> ([86900814](https://github.com/angular/angular.js/commit/869008140a96e0e9e0d9774cc2e5fdd66ada7ba9)) <add>- **filterFilter:** use isArray() to determine array type <add> ([d4b60ada](https://github.com/angular/angular.js/commit/d4b60ada1ecff5afdb3210caa44e149e9f3d4c1b), <add> [#10621](https://github.com/angular/angular.js/issues/10621)) <add> <add> <add>## Features <add> <add>- **ngMock/$exceptionHandler:** log errors when rethrowing <add> ([2b97854b](https://github.com/angular/angular.js/commit/2b97854bf4786fe8579974e2b9d6b4adee8a3dc3), <add> [#10540](https://github.com/angular/angular.js/issues/10540), [#10564](https://github.com/angular/angular.js/issues/10564)) <add> <add> <add>## Performance Improvements <add> <add>- **ngStyleDirective:** use $watchCollection <add> ([4c8d8ad5](https://github.com/angular/angular.js/commit/4c8d8ad5083d9dd17c0b8480339d5f95943f1b71), <add> [#10535](https://github.com/angular/angular.js/issues/10535)) <add> <add> <add> <add> <ide> <a name="1.3.8"></a> <ide> # 1.3.8 prophetic-narwhal (2014-12-19) <ide>
1
Ruby
Ruby
add type accessors to dependencies
2d93935e6a4a303d4c67c9007e02bb5ba73f2644
<ide><path>Library/Homebrew/dependable.rb <ide> def recommended? <ide> tags.include? :recommended <ide> end <ide> <add> def required? <add> !build? && !optional? && !recommended? <add> end <add> <ide> def options <ide> Options.coerce(tags - RESERVED_TAGS) <ide> end <ide><path>Library/Homebrew/dependencies.rb <ide> def to_a <ide> @deps <ide> end <ide> alias_method :to_ary, :to_a <add> <add> def optional <add> select(&:optional?) <add> end <add> <add> def recommended <add> select(&:recommended?) <add> end <add> <add> def build <add> select(&:build?) <add> end <add> <add> def required <add> select(&:required?) <add> end <add> <add> def default <add> build + required + recommended <add> end <ide> end <ide><path>Library/Homebrew/test/test_dependencies.rb <ide> def test_to_ary <ide> @deps << dep <ide> assert_equal [dep], @deps.to_ary <ide> end <add> <add> def test_type_helpers <add> foo = Dependency.new("foo") <add> bar = Dependency.new("bar", [:optional]) <add> baz = Dependency.new("baz", [:build]) <add> qux = Dependency.new("qux", [:recommended]) <add> quux = Dependency.new("quux") <add> @deps << foo << bar << baz << qux << quux <add> assert_equal [foo, quux], @deps.required <add> assert_equal [bar], @deps.optional <add> assert_equal [baz], @deps.build <add> assert_equal [qux], @deps.recommended <add> assert_equal [foo, baz, quux, qux].sort_by(&:name), @deps.default.sort_by(&:name) <add> end <ide> end
3
Python
Python
extend works in-place
a67413ccc82ed6bfdf9ea2f6b17ee3869f2f87a7
<ide><path>examples/run_seq2seq_finetuning.py <ide> def _fit_to_block_size(sequence, block_size): <ide> if len(sequence) > block_size: <ide> return sequence[:block_size] <ide> else: <del> return sequence.extend([0] * (block_size - len(sequence))) <add> sequence.extend([0] * (block_size - len(sequence))) <add> return sequence <ide> <ide> <ide> def mask_padding_tokens(sequence):
1
Ruby
Ruby
provide directed url as well as resolving
c231a73b892e1fd2d4ae2e939fe36bee0238f919
<ide><path>config/routes.rb <ide> ActiveStorage::Engine.routes.draw do <ide> get "/rails/active_storage/disk/:encoded_key/*filename" => "active_storage/disk#show", as: :rails_disk_blob <del> get "/rails/active_storage/variants/:encoded_blob_key/:variation_key/*filename" => "active_storage/variants#show", as: :rails_blob_variant <ide> post "/rails/active_storage/direct_uploads" => "active_storage/direct_uploads#create", as: :rails_direct_uploads <ide> <del> resolve 'ActiveStorage::Variant' do |variant| <add> get "/rails/active_storage/variants/:encoded_blob_key/:variation_key/*filename" => "active_storage/variants#show", as: :rails_blob_variation <add> <add> direct :rails_variant do |variant| <ide> encoded_blob_key = ActiveStorage::VerifiedKeyWithExpiration.encode(variant.blob.key) <del> variantion_key = ActiveStorage::Variation.encode(variant.variation) <add> variation_key = variant.variation.key <ide> filename = variant.blob.filename <ide> <del> route_for(:rails_blob_variant, encoded_blob_key, variantion_key, filename) <add> route_for(:rails_blob_variation, encoded_blob_key, variation_key, filename) <ide> end <add> <add> resolve 'ActiveStorage::Variant' { |variant| route_for(:rails_variant, variant) } <ide> end
1
Ruby
Ruby
remove trailing whitespace
863e1a3cc54a7a3fe0b049d5754b235bd4208d3f
<ide><path>Library/Homebrew/utils.rb <ide> def open url, headers={}, &block <ide> raise e <ide> end <ide> end <del> <add> <ide> def issues_for_formula name <ide> # bit basic as depends on the issue at github having the exact name of the <ide> # formula in it. Which for stuff like objective-caml is unlikely. So we
1
Ruby
Ruby
handle duplicate headers
94449d07c07bb9d858ea11b097d1d2fd33bca187
<ide><path>Library/Homebrew/test/utils/curl_spec.rb <ide> }, <ide> } <ide> <add> response_hash[:duplicate_header] = { <add> status_code: "200", <add> status_text: "OK", <add> headers: { <add> "cache-control" => "max-age=604800", <add> "content-type" => "text/html; charset=UTF-8", <add> "date" => "Wed, 1 Jan 2020 01:23:45 GMT", <add> "expires" => "Wed, 31 Jan 2020 01:23:45 GMT", <add> "last-modified" => "Thu, 1 Jan 2019 01:23:45 GMT", <add> "content-length" => "123", <add> "set-cookie" => [ <add> "example1=first", <add> "example2=second; Expires Wed, 31 Jan 2020 01:23:45 GMT", <add> "example3=third", <add> ], <add> }, <add> } <add> <ide> response_hash <ide> } <ide> <ide> #{response_text[:ok]} <ide> EOS <ide> <add> response_text[:duplicate_header] = response_text[:ok].sub( <add> /\r\n\Z/, <add> "Set-Cookie: #{response_hash[:duplicate_header][:headers]["set-cookie"][0]}\r\n" \ <add> "Set-Cookie: #{response_hash[:duplicate_header][:headers]["set-cookie"][1]}\r\n" \ <add> "Set-Cookie: #{response_hash[:duplicate_header][:headers]["set-cookie"][2]}\r\n\r\n", <add> ) <add> <ide> response_text <ide> } <ide> <ide> it "returns a correct hash when given HTTP response text" do <ide> expect(parse_curl_response(response_text[:ok])).to eq(response_hash[:ok]) <ide> expect(parse_curl_response(response_text[:redirection])).to eq(response_hash[:redirection]) <add> expect(parse_curl_response(response_text[:duplicate_header])).to eq(response_hash[:duplicate_header]) <ide> end <ide> <ide> it "returns an empty hash when given an empty string" do <ide><path>Library/Homebrew/utils/curl.rb <ide> def parse_curl_response(response_text) <ide> response_text = response_text.sub(%r{^HTTP/.* (\d+).*$\s*}, "") <ide> <ide> # Create a hash from the header lines <del> response[:headers] = <del> response_text.split("\r\n") <del> .to_h { |header| header.split(/:\s*/, 2) } <del> .transform_keys(&:downcase) <add> response[:headers] = {} <add> response_text.split("\r\n").each do |line| <add> header_name, header_value = line.split(/:\s*/, 2) <add> next if header_name.blank? <add> <add> header_name = header_name.strip.downcase <add> header_value&.strip! <add> <add> case response[:headers][header_name] <add> when nil <add> response[:headers][header_name] = header_value <add> when String <add> response[:headers][header_name] = [response[:headers][header_name], header_value] <add> when Array <add> response[:headers][header_name].push(header_value) <add> end <add> <add> response[:headers][header_name] <add> end <ide> <ide> response <ide> end
2
Javascript
Javascript
improve inspect readability
9c5019995c59f81f54719cefcc19c330fdf02635
<ide><path>test/parallel/test-util-inspect.js <ide> assert.strictEqual( <ide> Object.assign(new String('hello'), { [Symbol('foo')]: 123 }), <ide> { showHidden: true } <ide> ), <del> '{ [String: \'hello\'] [length]: 5, [Symbol(foo)]: 123 }' <add> "{ [String: 'hello'] [length]: 5, [Symbol(foo)]: 123 }" <ide> ); <ide> <ide> assert.strictEqual(util.inspect((new JSStream())._externalStream), <ide> assert.strictEqual( <ide> name: { value: 'Tim', enumerable: true }, <ide> hidden: { value: 'secret' } <ide> })), <del> '{ name: \'Tim\' }' <add> "{ name: 'Tim' }" <ide> ); <ide> <ide> // Dynamic properties. <ide> assert.strictEqual( <ide> } <ide> ); <ide> assert.strictEqual(util.inspect(value), <del> '[ 1, 2, 3, growingLength: [Getter], \'-1\': -1 ]'); <add> "[ 1, 2, 3, growingLength: [Getter], '-1': -1 ]"); <ide> } <ide> <ide> // Array with inherited number properties. <ide> assert.strictEqual(util.inspect(-5e-324), '-5e-324'); <ide> // Test for sparse array. <ide> { <ide> const a = ['foo', 'bar', 'baz']; <del> assert.strictEqual(util.inspect(a), '[ \'foo\', \'bar\', \'baz\' ]'); <add> assert.strictEqual(util.inspect(a), "[ 'foo', 'bar', 'baz' ]"); <ide> delete a[1]; <del> assert.strictEqual(util.inspect(a), '[ \'foo\', <1 empty item>, \'baz\' ]'); <add> assert.strictEqual(util.inspect(a), "[ 'foo', <1 empty item>, 'baz' ]"); <ide> assert.strictEqual( <ide> util.inspect(a, true), <del> '[ \'foo\', <1 empty item>, \'baz\', [length]: 3 ]' <add> "[ 'foo', <1 empty item>, 'baz', [length]: 3 ]" <ide> ); <ide> assert.strictEqual(util.inspect(new Array(5)), '[ <5 empty items> ]'); <ide> a[3] = 'bar'; <ide> a[100] = 'qux'; <ide> assert.strictEqual( <ide> util.inspect(a, { breakLength: Infinity }), <del> '[ \'foo\', <1 empty item>, \'baz\', \'bar\', <96 empty items>, \'qux\' ]' <add> "[ 'foo', <1 empty item>, 'baz', 'bar', <96 empty items>, 'qux' ]" <ide> ); <ide> delete a[3]; <ide> assert.strictEqual( <ide> util.inspect(a, { maxArrayLength: 4 }), <del> '[ \'foo\', <1 empty item>, \'baz\', <97 empty items>, ... 1 more item ]' <add> "[ 'foo', <1 empty item>, 'baz', <97 empty items>, ... 1 more item ]" <ide> ); <ide> } <ide> <ide> assert.strictEqual(util.inspect(Object.create(Date.prototype)), 'Date {}'); <ide> <ide> assert.strictEqual( <ide> util.inspect(w), <del> '{ \'\\\\\': 1, \'\\\\\\\\\': 2, \'\\\\\\\\\\\\\': 3, ' + <del> '\'\\\\\\\\\\\\\\\\\': 4, \'\\n\': 5, \'\\r\': 6 }' <add> "{ '\\\\': 1, '\\\\\\\\': 2, '\\\\\\\\\\\\': 3, " + <add> "'\\\\\\\\\\\\\\\\': 4, '\\n': 5, '\\r': 6 }" <ide> ); <ide> assert.strictEqual( <ide> util.inspect(y), <del> '[ \'a\', \'b\', \'c\', \'\\\\\\\\\': \'d\', ' + <del> '\'\\n\': \'e\', \'\\r\': \'f\' ]' <add> "[ 'a', 'b', 'c', '\\\\\\\\': 'd', " + <add> "'\\n': 'e', '\\r': 'f' ]" <ide> ); <ide> } <ide> <ide> util.inspect({ hasOwnProperty: null }); <ide> // A custom [util.inspect.custom]() should be able to return other Objects. <ide> subject[util.inspect.custom] = () => ({ foo: 'bar' }); <ide> <del> assert.strictEqual(util.inspect(subject), '{ foo: \'bar\' }'); <add> assert.strictEqual(util.inspect(subject), "{ foo: 'bar' }"); <ide> <ide> subject[util.inspect.custom] = (depth, opts) => { <ide> assert.strictEqual(opts.customInspectOptions, true); <ide> util.inspect({ hasOwnProperty: null }); <ide> } <ide> <ide> // Test boxed primitives output the correct values. <del>assert.strictEqual(util.inspect(new String('test')), '[String: \'test\']'); <add>assert.strictEqual(util.inspect(new String('test')), "[String: 'test']"); <ide> assert.strictEqual( <ide> util.inspect(Object(Symbol('test'))), <ide> '[Symbol: Symbol(test)]' <ide> assert.strictEqual(util.inspect(new Number(13.37)), '[Number: 13.37]'); <ide> { <ide> const str = new String('baz'); <ide> str.foo = 'bar'; <del> assert.strictEqual(util.inspect(str), '{ [String: \'baz\'] foo: \'bar\' }'); <add> assert.strictEqual(util.inspect(str), "{ [String: 'baz'] foo: 'bar' }"); <ide> <ide> const bool = new Boolean(true); <ide> bool.foo = 'bar'; <del> assert.strictEqual(util.inspect(bool), '{ [Boolean: true] foo: \'bar\' }'); <add> assert.strictEqual(util.inspect(bool), "{ [Boolean: true] foo: 'bar' }"); <ide> <ide> const num = new Number(13.37); <ide> num.foo = 'bar'; <del> assert.strictEqual(util.inspect(num), '{ [Number: 13.37] foo: \'bar\' }'); <add> assert.strictEqual(util.inspect(num), "{ [Number: 13.37] foo: 'bar' }"); <ide> } <ide> <ide> // Test es6 Symbol. <ide> if (typeof Symbol !== 'undefined') { <ide> assert.strictEqual(util.inspect(subject), '{ [Symbol(symbol)]: 42 }'); <ide> assert.strictEqual( <ide> util.inspect(subject, options), <del> '{ [Symbol(symbol)]: 42, [Symbol()]: \'non-enum\' }' <add> "{ [Symbol(symbol)]: 42, [Symbol()]: 'non-enum' }" <ide> ); <ide> <ide> subject = [1, 2, 3]; <ide> if (typeof Symbol !== 'undefined') { <ide> set.bar = 42; <ide> assert.strictEqual( <ide> util.inspect(set, true), <del> 'Set { \'foo\', [size]: 1, bar: 42 }' <add> "Set { 'foo', [size]: 1, bar: 42 }" <ide> ); <ide> } <ide> <ide> if (typeof Symbol !== 'undefined') { <ide> { <ide> assert.strictEqual(util.inspect(new Map()), 'Map {}'); <ide> assert.strictEqual(util.inspect(new Map([[1, 'a'], [2, 'b'], [3, 'c']])), <del> 'Map { 1 => \'a\', 2 => \'b\', 3 => \'c\' }'); <add> "Map { 1 => 'a', 2 => 'b', 3 => 'c' }"); <ide> const map = new Map([['foo', null]]); <ide> map.bar = 42; <ide> assert.strictEqual(util.inspect(map, true), <del> 'Map { \'foo\' => null, [size]: 1, bar: 42 }'); <add> "Map { 'foo' => null, [size]: 1, bar: 42 }"); <ide> } <ide> <ide> // Test circular Map. <ide> if (typeof Symbol !== 'undefined') { <ide> const promiseWithProperty = Promise.resolve('foo'); <ide> promiseWithProperty.bar = 42; <ide> assert.strictEqual(util.inspect(promiseWithProperty), <del> 'Promise { \'foo\', bar: 42 }'); <add> "Promise { 'foo', bar: 42 }"); <ide> } <ide> <ide> // Make sure it doesn't choke on polyfills. Unlike Set/Map, there is no standard <ide> if (typeof Symbol !== 'undefined') { <ide> // Test Map iterators. <ide> { <ide> const map = new Map([['foo', 'bar']]); <del> assert.strictEqual(util.inspect(map.keys()), '[Map Iterator] { \'foo\' }'); <del> assert.strictEqual(util.inspect(map.values()), '[Map Iterator] { \'bar\' }'); <add> assert.strictEqual(util.inspect(map.keys()), "[Map Iterator] { 'foo' }"); <add> assert.strictEqual(util.inspect(map.values()), "[Map Iterator] { 'bar' }"); <ide> assert.strictEqual(util.inspect(map.entries()), <del> '[Map Iterator] { [ \'foo\', \'bar\' ] }'); <add> "[Map Iterator] { [ 'foo', 'bar' ] }"); <ide> // Make sure the iterator doesn't get consumed. <ide> const keys = map.keys(); <del> assert.strictEqual(util.inspect(keys), '[Map Iterator] { \'foo\' }'); <del> assert.strictEqual(util.inspect(keys), '[Map Iterator] { \'foo\' }'); <add> assert.strictEqual(util.inspect(keys), "[Map Iterator] { 'foo' }"); <add> assert.strictEqual(util.inspect(keys), "[Map Iterator] { 'foo' }"); <ide> keys.extra = true; <ide> assert.strictEqual( <ide> util.inspect(keys, { maxArrayLength: 0 }), <ide> if (typeof Symbol !== 'undefined') { <ide> assert.strictEqual(util.inspect(new SetSubclass([1, 2, 3])), <ide> 'SetSubclass [Set] { 1, 2, 3 }'); <ide> assert.strictEqual(util.inspect(new MapSubclass([['foo', 42]])), <del> 'MapSubclass [Map] { \'foo\' => 42 }'); <add> "MapSubclass [Map] { 'foo' => 42 }"); <ide> assert.strictEqual(util.inspect(new PromiseSubclass(() => {})), <ide> 'PromiseSubclass [Promise] { <pending> }'); <ide> assert.strictEqual( <ide> if (typeof Symbol !== 'undefined') { <ide> { <ide> const x = []; <ide> x[''] = 1; <del> assert.strictEqual(util.inspect(x), '[ \'\': 1 ]'); <add> assert.strictEqual(util.inspect(x), "[ '': 1 ]"); <ide> } <ide> <ide> // The following maxArrayLength tests were introduced after v6.0.0 was released. <ide> if (typeof Symbol !== 'undefined') { <ide> const breakpoint = oneLine.length - 5; <ide> const twoLines = util.inspect(obj, { breakLength: breakpoint }); <ide> <del> assert.strictEqual(oneLine, '{ foo: \'abc\', bar: \'xyz\' }'); <add> assert.strictEqual(oneLine, "{ foo: 'abc', bar: 'xyz' }"); <ide> assert.strictEqual(oneLine, <ide> util.inspect(obj, { breakLength: breakpoint + 1 })); <del> assert.strictEqual(twoLines, '{ foo: \'abc\',\n bar: \'xyz\' }'); <add> assert.strictEqual(twoLines, "{ foo: 'abc',\n bar: 'xyz' }"); <ide> } <ide> <ide> // util.inspect.defaultOptions tests. <ide> util.inspect(process); <ide> { <ide> // @@toStringTag <ide> assert.strictEqual(util.inspect({ [Symbol.toStringTag]: 'a' }), <del> 'Object [a] { [Symbol(Symbol.toStringTag)]: \'a\' }'); <add> "Object [a] { [Symbol(Symbol.toStringTag)]: 'a' }"); <ide> <ide> class Foo { <ide> constructor() { <ide> util.inspect(process); <ide> Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } })), <ide> '[foo] {}'); <ide> <del> assert.strictEqual(util.inspect(new Foo()), 'Foo [bar] { foo: \'bar\' }'); <add> assert.strictEqual(util.inspect(new Foo()), "Foo [bar] { foo: 'bar' }"); <ide> <ide> assert.strictEqual( <ide> util.inspect(new (class extends Foo {})()), <del> 'Foo [bar] { foo: \'bar\' }'); <add> "Foo [bar] { foo: 'bar' }"); <ide> <ide> assert.strictEqual( <ide> util.inspect(Object.create(Object.create(Foo.prototype), { <ide> foo: { value: 'bar', enumerable: true } <ide> })), <del> 'Foo [bar] { foo: \'bar\' }'); <add> "Foo [bar] { foo: 'bar' }"); <ide> <ide> class ThrowingClass { <ide> get [Symbol.toStringTag]() { <ide> util.inspect(process); <ide> ' 2,', <ide> ' [', <ide> ' [', <del> ' \'Lorem ipsum dolor\\nsit amet,\\tconsectetur \' +', <del> ' \'adipiscing elit, sed do eiusmod tempor \' +', <del> ' \'incididunt ut labore et dolore magna \' +', <del> ' \'aliqua.\',', <del> ' \'test\',', <del> ' \'foo\'', <add> " 'Lorem ipsum dolor\\nsit amet,\\tconsectetur ' +", <add> " 'adipiscing elit, sed do eiusmod tempor ' +", <add> " 'incididunt ut labore et dolore magna ' +", <add> " 'aliqua.',", <add> " 'test',", <add> " 'foo'", <ide> ' ]', <ide> ' ],', <ide> ' 4', <ide> ' ],', <ide> ' b: Map {', <del> ' \'za\' => 1,', <del> ' \'zb\' => \'test\'', <add> " 'za' => 1,", <add> " 'zb' => 'test'", <ide> ' }', <ide> '}' <ide> ].join('\n'); <ide> assert.strictEqual(out, expect); <ide> <ide> out = util.inspect(o.a[2][0][0], { compact: false, breakLength: 30 }); <ide> expect = [ <del> '\'Lorem ipsum dolor\\nsit \' +', <del> ' \'amet,\\tconsectetur \' +', <del> ' \'adipiscing elit, sed do \' +', <del> ' \'eiusmod tempor incididunt \' +', <del> ' \'ut labore et dolore magna \' +', <del> ' \'aliqua.\'' <add> "'Lorem ipsum dolor\\nsit ' +", <add> " 'amet,\\tconsectetur ' +", <add> " 'adipiscing elit, sed do ' +", <add> " 'eiusmod tempor incididunt ' +", <add> " 'ut labore et dolore magna ' +", <add> " 'aliqua.'" <ide> ].join('\n'); <ide> assert.strictEqual(out, expect); <ide> <ide> out = util.inspect( <ide> '12345678901234567890123456789012345678901234567890', <ide> { compact: false, breakLength: 3 }); <del> expect = '\'12345678901234567890123456789012345678901234567890\''; <add> expect = "'12345678901234567890123456789012345678901234567890'"; <ide> assert.strictEqual(out, expect); <ide> <ide> out = util.inspect( <ide> '12 45 78 01 34 67 90 23 56 89 123456789012345678901234567890', <ide> { compact: false, breakLength: 3 }); <ide> expect = [ <del> '\'12 45 78 01 34 \' +', <del> ' \'67 90 23 56 89 \' +', <del> ' \'123456789012345678901234567890\'' <add> "'12 45 78 01 34 ' +", <add> " '67 90 23 56 89 ' +", <add> " '123456789012345678901234567890'" <ide> ].join('\n'); <ide> assert.strictEqual(out, expect); <ide> <ide> out = util.inspect( <ide> '12 45 78 01 34 67 90 23 56 89 1234567890123 0', <ide> { compact: false, breakLength: 3 }); <ide> expect = [ <del> '\'12 45 78 01 34 \' +', <del> ' \'67 90 23 56 89 \' +', <del> ' \'1234567890123 0\'' <add> "'12 45 78 01 34 ' +", <add> " '67 90 23 56 89 ' +", <add> " '1234567890123 0'" <ide> ].join('\n'); <ide> assert.strictEqual(out, expect); <ide> <ide> out = util.inspect( <ide> '12 45 78 01 34 67 90 23 56 89 12345678901234567 0', <ide> { compact: false, breakLength: 3 }); <ide> expect = [ <del> '\'12 45 78 01 34 \' +', <del> ' \'67 90 23 56 89 \' +', <del> ' \'12345678901234567 \' +', <del> ' \'0\'' <add> "'12 45 78 01 34 ' +", <add> " '67 90 23 56 89 ' +", <add> " '12345678901234567 ' +", <add> " '0'" <ide> ].join('\n'); <ide> assert.strictEqual(out, expect); <ide> <ide> util.inspect(process); <ide> <ide> o[util.inspect.custom] = () => ({ a: '12 45 78 01 34 67 90 23' }); <ide> out = util.inspect(o, { compact: false, breakLength: 3 }); <del> expect = '{\n a: \'12 45 78 01 34 \' +\n \'67 90 23\'\n}'; <add> expect = "{\n a: '12 45 78 01 34 ' +\n '67 90 23'\n}"; <ide> assert.strictEqual(out, expect); <ide> } <ide>
1
PHP
PHP
remove periods for consistency
36a53758c05494ff8375965bd4610b346d14d7e4
<ide><path>src/Illuminate/Auth/Console/ClearRemindersCommand.php <ide> class ClearRemindersCommand extends Command { <ide> * <ide> * @var string <ide> */ <del> protected $description = 'Flush expired reminders.'; <add> protected $description = 'Flush expired password reminders'; <ide> <ide> /** <ide> * Execute the console command. <ide><path>src/Illuminate/Foundation/Console/RequestMakeCommand.php <ide> class RequestMakeCommand extends Command { <ide> * <ide> * @var string <ide> */ <del> protected $description = 'Create a new form request class.'; <add> protected $description = 'Create a new form request class'; <ide> <ide> /** <ide> * The filesystem instance. <ide><path>src/Illuminate/Foundation/Console/RouteCacheCommand.php <ide> class RouteCacheCommand extends Command { <ide> * <ide> * @var string <ide> */ <del> protected $description = 'Create a route cache file for faster route registration.'; <add> protected $description = 'Create a route cache file for faster route registration'; <ide> <ide> /** <ide> * The filesystem instance. <ide><path>src/Illuminate/Foundation/Console/RouteClearCommand.php <ide> class RouteClearCommand extends Command { <ide> * <ide> * @var string <ide> */ <del> protected $description = 'Remove the route cache file.'; <add> protected $description = 'Remove the route cache file'; <ide> <ide> /** <ide> * The filesystem instance. <ide><path>src/Illuminate/Routing/Console/FilterMakeCommand.php <ide> class FilterMakeCommand extends Command { <ide> * <ide> * @var string <ide> */ <del> protected $description = 'Create a new route filter class.'; <add> protected $description = 'Create a new route filter class'; <ide> <ide> /** <ide> * The filesystem instance.
5
PHP
PHP
fix phpcs and phpstan errors
8f762ebd424cdf4fd84746039024d0d9a928cf76
<ide><path>src/Cache/SimpleCacheEngine.php <ide> class SimpleCacheEngine implements CacheInterface <ide> /** <ide> * The wrapped cache engine object. <ide> * <del> * @param \Cake\Cache\CacheEngine <add> * @var \Cake\Cache\CacheEngine <ide> */ <ide> protected $innerEngine; <ide> <ide> public function __construct($innerEngine) <ide> * <ide> * @param string $key Key to check. <ide> * @return void <del> * @throws \Psr\SimpleCache\InvalidArgumentException When the key is not valid. <add> * @throws \Cake\Cache\InvalidArgumentException When the key is not valid. <ide> */ <ide> protected function ensureValidKey($key) <ide> { <ide> protected function ensureValidKey($key) <ide> * <ide> * @param mixed $keys The keys to check. <ide> * @return void <del> * @throws \Psr\SimpleCache\InvalidArgumentException When the keys are not valid. <add> * @throws \Cake\Cache\InvalidArgumentException When the keys are not valid. <ide> */ <ide> protected function ensureValidKeys($keys) <ide> { <del> if (!is_array($keys) && !($keys instanceOf \Traversable)) { <add> if (!is_array($keys) && !($keys instanceof \Traversable)) { <ide> throw new InvalidArgumentException('A cache key set must be either an array or a Traversable.'); <ide> } <ide> <ide> protected function ensureValidKeys($keys) <ide> * @param string $key The unique key of this item in the cache. <ide> * @param mixed $default Default value to return if the key does not exist. <ide> * @return mixed The value of the item from the cache, or $default in case of cache miss. <del> * @throws \Psr\SimpleCache\InvalidArgumentException If the $key string is not a legal value. <add> * @throws \Cake\Cache\InvalidArgumentException If the $key string is not a legal value. <ide> */ <ide> public function get($key, $default = null) <ide> { <ide> public function get($key, $default = null) <ide> * the driver supports TTL then the library may set a default value <ide> * for it or let the driver take care of that. <ide> * @return bool True on success and false on failure. <del> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * @throws \Cake\Cache\InvalidArgumentException <ide> * MUST be thrown if the $key string is not a legal value. <ide> */ <ide> public function set($key, $value, $ttl = null) <ide> public function set($key, $value, $ttl = null) <ide> * <ide> * @param string $key The unique cache key of the item to delete. <ide> * @return bool True if the item was successfully removed. False if there was an error. <del> * @throws \Psr\SimpleCache\InvalidArgumentException If the $key string is not a legal value. <add> * @throws \Cake\Cache\InvalidArgumentException If the $key string is not a legal value. <ide> */ <ide> public function delete($key) <ide> { <ide> public function clear() <ide> * @param iterable $keys A list of keys that can obtained in a single operation. <ide> * @param mixed $default Default value to return for keys that do not exist. <ide> * @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value. <del> * @throws \Psr\SimpleCache\InvalidArgumentException If $keys is neither an array nor a Traversable, <add> * @throws \Cake\Cache\InvalidArgumentException If $keys is neither an array nor a Traversable, <ide> * or if any of the $keys are not a legal value. <ide> */ <ide> public function getMultiple($keys, $default = null) <ide> public function getMultiple($keys, $default = null) <ide> * the driver supports TTL then the library may set a default value <ide> * for it or let the driver take care of that. <ide> * @return bool True on success and false on failure. <del> * @throws \Psr\SimpleCache\InvalidArgumentException If $values is neither an array nor a Traversable, <add> * @throws \Cake\Cache\InvalidArgumentException If $values is neither an array nor a Traversable, <ide> * or if any of the $values are not a legal value. <ide> */ <ide> public function setMultiple($values, $ttl = null) <ide> public function setMultiple($values, $ttl = null) <ide> * <ide> * @param iterable $keys A list of string-based keys to be deleted. <ide> * @return bool True if the items were successfully removed. False if there was an error. <del> * @throws \Psr\SimpleCache\InvalidArgumentException If $keys is neither an array nor a Traversable, <add> * @throws \Cake\Cache\InvalidArgumentException If $keys is neither an array nor a Traversable, <ide> * or if any of the $keys are not a legal value. <ide> */ <ide> public function deleteMultiple($keys) <ide> public function deleteMultiple($keys) <ide> * <ide> * @param string $key The cache item key. <ide> * @return bool <del> * @throws \Psr\SimpleCache\InvalidArgumentException If the $key string is not a legal value. <add> * @throws \Cake\Cache\InvalidArgumentException If the $key string is not a legal value. <ide> */ <ide> public function has($key) <ide> {
1
Text
Text
add rafaelgss to collaborators
6669b3857f0f43ee0296eb7ac45086cd907b9e94
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Andrey Pechkurov** <<apechkurov@gmail.com>> (he/him) <ide> * [Qard](https://github.com/Qard) - <ide> **Stephen Belanger** <<admin@stephenbelanger.com>> (he/him) <add>* [RafaelGSS](https://github.com/RafaelGSS) - <add> **Rafael Gonzaga** <<rafael.nunu@hotmail.com>> (he/him) <ide> * [RaisinTen](https://github.com/RaisinTen) - <ide> **Darshan Sen** <<raisinten@gmail.com>> (he/him) <ide> * [rexagod](https://github.com/rexagod) -
1
Go
Go
add integration tests for swarm incompatible
d71789828f5c8d2e0f5757f1c003325c4b8a871d
<ide><path>integration-cli/docker_cli_swarm_test.go <ide> package main <ide> <ide> import ( <ide> "encoding/json" <add> "io/ioutil" <ide> "time" <ide> <ide> "github.com/docker/docker/pkg/integration/checker" <ide> func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *check.C) { <ide> c.Assert(err, checker.IsNil, check.Commentf("out: %v", out)) <ide> c.Assert(out, checker.Contains, "Swarm: active") <ide> } <add> <add>func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) { <add> // init swarm mode and stop a daemon <add> d := s.AddDaemon(c, true, true) <add> info, err := d.info() <add> c.Assert(err, checker.IsNil) <add> c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive) <add> c.Assert(d.Stop(), checker.IsNil) <add> <add> // start a daemon with --cluster-store and --cluster-advertise <add> err = d.Start("--cluster-store=consul://consuladdr:consulport/some/path", "--cluster-advertise=1.1.1.1:2375") <add> c.Assert(err, checker.NotNil) <add> content, _ := ioutil.ReadFile(d.logFile.Name()) <add> c.Assert(string(content), checker.Contains, "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode") <add> <add> // start a daemon with --live-restore <add> err = d.Start("--live-restore") <add> c.Assert(err, checker.NotNil) <add> content, _ = ioutil.ReadFile(d.logFile.Name()) <add> c.Assert(string(content), checker.Contains, "--live-restore daemon configuration is incompatible with swarm mode") <add> // restart for teardown <add> c.Assert(d.Start(), checker.IsNil) <add>}
1
Javascript
Javascript
reset history when destroying urlhandlerregistry
e02337265a1fa0f71490811892f17613e26227b9
<ide><path>src/url-handler-registry.js <ide> class UrlHandlerRegistry { <ide> destroy () { <ide> this.emitter.dispose() <ide> this.registrations = new Map() <add> this.history = [] <ide> this._id = 0 <ide> } <ide> }
1
Javascript
Javascript
upgrade tapable for webassemblyparser
7fb34685462342038a36f065cabd5b20f2db3d1a
<ide><path>lib/WebAssemblyParser.js <ide> <ide> // Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API <ide> <del>const Tapable = require("tapable-old"); <add>const Tapable = require("tapable").Tapable; <ide> <ide> class WebAssemblyParser extends Tapable { <ide> constructor(options) { <ide> super(); <add> this.hooks = {}; <ide> this.options = options; <ide> } <ide>
1
Javascript
Javascript
update support comment to match convention
19c1b6109a73bc7d0d5bd84587b5c5a44d3e2a74
<ide><path>src/ajax/xhr.js <ide> jQuery.ajaxTransport(function( options ) { <ide> xhrSuccessStatus[ xhr.status ] || xhr.status, <ide> xhr.statusText, <ide> // Support: IE9 <del> // #11426: When requesting binary data, IE9 will throw an exception <del> // on any attempt to access responseText <add> // Accessing binary-data responseText throws an exception <add> // (#11426) <ide> typeof xhr.responseText === "string" ? { <ide> text: xhr.responseText <ide> } : undefined,
1
Text
Text
update changelog for 2.17.0-beta.3
99b43dc699bede8be3c371b41ca4f1074196ffde
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### 2.17.0-beta.3 (October 23, 2017) <add>- [#15606](https://github.com/emberjs/ember.js/pull/15606) [BUGFIX] Add fs-extra to deps <add>- [#15697](https://github.com/emberjs/ember.js/pull/15697) [BUGFIX] Move accessing meta out of the loop <add>- [#15710](https://github.com/emberjs/ember.js/pull/15710) [BUGFIX] Correctly reset container cache <add> <ide> ### 2.17.0-beta.2 (October 17, 2017) <ide> - [#15613](https://github.com/emberjs/ember.js/pull/15613) [BUGFIX] Don't throw an error, when not all query params are passed to routerService.transitionTo <ide> - [#15707](https://github.com/emberjs/ember.js/pull/15707) [BUGFIX] Fix `canInvoke` for edge cases
1
Ruby
Ruby
move buildoptions to a separate file
5088fdd54324b9ab053794909aab05fa2d81454b
<ide><path>Library/Homebrew/build_options.rb <add>require 'options' <add> <add># This class holds the build-time options defined for a Formula, <add># and provides named access to those options during install. <add>class BuildOptions <add> attr_writer :args <add> include Enumerable <add> <add> def initialize args <add> @args = Array.new(args).extend(HomebrewArgvExtension) <add> @options = Options.new <add> end <add> <add> def add name, description=nil <add> description ||= case name.to_s <add> when "universal" then "Build a universal binary" <add> when "32-bit" then "Build 32-bit only" <add> end.to_s <add> <add> @options << Option.new(name, description) <add> end <add> <add> def has_option? name <add> any? { |opt| opt.name == name } <add> end <add> <add> def empty? <add> @options.empty? <add> end <add> <add> def each(*args, &block) <add> @options.each(*args, &block) <add> end <add> <add> def as_flags <add> @options.as_flags <add> end <add> <add> def include? name <add> @args.include? '--' + name <add> end <add> <add> def head? <add> @args.flag? '--HEAD' <add> end <add> <add> def devel? <add> @args.include? '--devel' <add> end <add> <add> def stable? <add> not (head? or devel?) <add> end <add> <add> # True if the user requested a universal build. <add> def universal? <add> @args.include?('--universal') && has_option?('universal') <add> end <add> <add> # Request a 32-bit only build. <add> # This is needed for some use-cases though we prefer to build Universal <add> # when a 32-bit version is needed. <add> def build_32_bit? <add> @args.include?('--32-bit') && has_option?('32-bit') <add> end <add> <add> def used_options <add> Options.new((as_flags & @args.options_only).map { |o| Option.new(o) }) <add> end <add> <add> def unused_options <add> Options.new((as_flags - @args.options_only).map { |o| Option.new(o) }) <add> end <add>end <ide><path>Library/Homebrew/formula.rb <ide> require 'patches' <ide> require 'compilers' <ide> require 'build_environment' <add>require 'build_options' <ide> require 'extend/set' <ide> <ide> <ide><path>Library/Homebrew/formula_support.rb <ide> require 'download_strategy' <ide> require 'checksums' <ide> require 'version' <del>require 'options' <ide> <ide> class SoftwareSpec <ide> attr_reader :checksum, :mirrors, :specs <ide> def to_s <ide> end.strip <ide> end <ide> end <del> <del># This class holds the build-time options defined for a Formula, <del># and provides named access to those options during install. <del>class BuildOptions <del> attr_writer :args <del> include Enumerable <del> <del> def initialize args <del> @args = Array.new(args).extend(HomebrewArgvExtension) <del> @options = Options.new <del> end <del> <del> def add name, description=nil <del> description ||= case name.to_s <del> when "universal" then "Build a universal binary" <del> when "32-bit" then "Build 32-bit only" <del> end.to_s <del> <del> @options << Option.new(name, description) <del> end <del> <del> def has_option? name <del> any? { |opt| opt.name == name } <del> end <del> <del> def empty? <del> @options.empty? <del> end <del> <del> def each(*args, &block) <del> @options.each(*args, &block) <del> end <del> <del> def as_flags <del> @options.as_flags <del> end <del> <del> def include? name <del> @args.include? '--' + name <del> end <del> <del> def head? <del> @args.flag? '--HEAD' <del> end <del> <del> def devel? <del> @args.include? '--devel' <del> end <del> <del> def stable? <del> not (head? or devel?) <del> end <del> <del> # True if the user requested a universal build. <del> def universal? <del> @args.include?('--universal') && has_option?('universal') <del> end <del> <del> # Request a 32-bit only build. <del> # This is needed for some use-cases though we prefer to build Universal <del> # when a 32-bit version is needed. <del> def build_32_bit? <del> @args.include?('--32-bit') && has_option?('32-bit') <del> end <del> <del> def used_options <del> Options.new((as_flags & @args.options_only).map { |o| Option.new(o) }) <del> end <del> <del> def unused_options <del> Options.new((as_flags - @args.options_only).map { |o| Option.new(o) }) <del> end <del>end
3
Text
Text
remove platform assumption from contributing
868638b90367cb8a20f61995c2ceae656e3f092f
<ide><path>CONTRIBUTING.md <ide> $ git fetch upstream <ide> $ git rebase upstream/master <ide> ``` <ide> <del> <ide> ### Step 5: Test <ide> <ide> Bug fixes and features **should come with tests**. Add your tests in the <ide> `test/parallel/` directory. For guidance on how to write a test for the Node.js <ide> project, see this [guide](./doc/guides/writing_tests.md). Looking at other tests <ide> to see how they should be structured can also help. <ide> <add>To run the tests on Unix / OS X: <add> <ide> ```text <ide> $ ./configure && make -j8 test <ide> ``` <ide> <add>Windows: <add> <add>```text <add>> vcbuild test <add>``` <add> <add>(See the [BUILDING.md](./BUILDING.md) for more details.) <add> <ide> Make sure the linter is happy and that all tests pass. Please, do not submit <ide> patches that fail either check. <ide> <del>Running `make test` will run the linter as well unless one or more tests fail. <del>If you want to run the linter without running tests, use `make lint`. <add>Running `make test`/`vcbuild test` will run the linter as well unless one or <add>more tests fail. <add> <add>If you want to run the linter without running tests, use <add>`make lint`/`vcbuild jslint`. <ide> <ide> If you are updating tests and just want to run a single test to check it, you <ide> can use this syntax to run it exactly as the test harness would:
1
Python
Python
remove broken wheel check in setup.py [ci skip]
856f086ce35e1b8e2abda16c860371543a8b12f2
<ide><path>setup.py <ide> def get_package_data(package): <ide> import pypandoc <ide> except ImportError: <ide> print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.") <del> if os.system("pip freeze | grep wheel"): <del> print("wheel not installed.\nUse `pip install wheel`.\nExiting.") <del> sys.exit() <ide> if os.system("pip freeze | grep twine"): <ide> print("twine not installed.\nUse `pip install twine`.\nExiting.") <ide> sys.exit()
1
Text
Text
add missing line to upgrade guide
a17b504bdbd7b3f1e30877995e361df73b76d1e1
<ide><path>docs/upgrading/upgrading-your-package.md <ide> You can group multiple disposables into a single disposable with a `CompositeDis <ide> <ide> class Something <ide> constructor: -> <add> editor = atom.workspace.getActiveTextEditor() <ide> @disposables.add editor.onDidChange -> <ide> @disposables.add editor.onDidChangePath -> <ide>
1
Text
Text
update react.rendertostring argument type in docs
9c3357eef5f1968e78d77eea8e75722d70856303
<ide><path>docs/docs/ref-01-top-level-api.md <ide> Remove a mounted React component from the DOM and clean up its event handlers an <ide> ### React.renderToString <ide> <ide> ```javascript <del>string renderToString(ReactComponent component) <add>string renderToString(ReactElement element) <ide> ``` <ide> <del>Render a component to its initial HTML. This should only be used on the server. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes. <add>Render a ReactElement to its initial HTML. This should only be used on the server. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes. <ide> <ide> If you call `React.render()` on a node that already has this server-rendered markup, React will preserve it and only attach event handlers, allowing you to have a very performant first-load experience. <ide> <ide> <ide> ### React.renderToStaticMarkup <ide> <ide> ```javascript <del>string renderToStaticMarkup(ReactComponent component) <add>string renderToStaticMarkup(ReactElement element) <ide> ``` <ide> <ide> Similar to `renderToString`, except this doesn't create extra DOM attributes such as `data-react-id`, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes.
1
Java
Java
implement drawimage using drawee
7075744b9437ee6327107a6962f8ba82247f2719
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/DrawImageWithDrawee.java <add>/** <add> * Copyright (c) 2015-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> */ <add> <add>package com.facebook.react.flat; <add> <add>import javax.annotation.Nullable; <add> <add>import android.graphics.Canvas; <add>import android.graphics.PorterDuff; <add>import android.graphics.PorterDuffColorFilter; <add> <add>import com.facebook.drawee.drawable.ScalingUtils.ScaleType; <add>import com.facebook.drawee.generic.GenericDraweeHierarchy; <add>import com.facebook.drawee.generic.RoundingParams; <add>import com.facebook.imagepipeline.request.ImageRequest; <add>import com.facebook.infer.annotation.Assertions; <add>import com.facebook.react.views.image.ImageResizeMode; <add> <add>/** <add> * DrawImageWithDrawee is DrawCommand that can draw a local or remote image. <add> * It uses DraweeRequestHelper internally to fetch and cache the images. <add> */ <add>/* package */ final class DrawImageWithDrawee extends AbstractDrawCommand implements DrawImage { <add> <add> private @Nullable DraweeRequestHelper mRequestHelper; <add> private @Nullable PorterDuffColorFilter mColorFilter; <add> private ScaleType mScaleType = ImageResizeMode.defaultValue(); <add> private float mBorderWidth; <add> private float mBorderRadius; <add> private int mBorderColor; <add> <add> @Override <add> public boolean hasImageRequest() { <add> return mRequestHelper != null; <add> } <add> <add> @Override <add> public void setImageRequest(@Nullable ImageRequest imageRequest) { <add> if (imageRequest == null) { <add> mRequestHelper = null; <add> } else { <add> mRequestHelper = new DraweeRequestHelper(imageRequest); <add> } <add> } <add> <add> @Override <add> public void setTintColor(int tintColor) { <add> if (tintColor == 0) { <add> mColorFilter = null; <add> } else { <add> mColorFilter = new PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP); <add> } <add> } <add> <add> @Override <add> public void setScaleType(ScaleType scaleType) { <add> mScaleType = scaleType; <add> } <add> <add> @Override <add> public ScaleType getScaleType() { <add> return mScaleType; <add> } <add> <add> @Override <add> public void setBorderWidth(float borderWidth) { <add> mBorderWidth = borderWidth; <add> } <add> <add> @Override <add> public float getBorderWidth() { <add> return mBorderWidth; <add> } <add> <add> @Override <add> public void setBorderRadius(float borderRadius) { <add> mBorderRadius = borderRadius; <add> } <add> <add> @Override <add> public float getBorderRadius() { <add> return mBorderRadius; <add> } <add> <add> @Override <add> public void setBorderColor(int borderColor) { <add> mBorderColor = borderColor; <add> } <add> <add> @Override <add> public int getBorderColor() { <add> return mBorderColor; <add> } <add> <add> @Override <add> public void onDraw(Canvas canvas) { <add> Assertions.assumeNotNull(mRequestHelper).getDrawable().draw(canvas); <add> } <add> <add> @Override <add> public void onAttached(FlatViewGroup.InvalidateCallback callback) { <add> GenericDraweeHierarchy hierarchy = Assertions.assumeNotNull(mRequestHelper).getHierarchy(); <add> <add> RoundingParams roundingParams = hierarchy.getRoundingParams(); <add> if (shouldDisplayBorder()) { <add> if (roundingParams == null) { <add> roundingParams = new RoundingParams(); <add> } <add> <add> roundingParams.setBorder(mBorderColor, mBorderWidth); <add> roundingParams.setCornersRadius(mBorderRadius); <add> <add> // changes won't take effect until we re-apply rounding params, so do it now. <add> hierarchy.setRoundingParams(roundingParams); <add> } else if (roundingParams != null) { <add> // clear rounding params <add> hierarchy.setRoundingParams(null); <add> } <add> <add> hierarchy.setActualImageScaleType(mScaleType); <add> hierarchy.setActualImageColorFilter(mColorFilter); <add> <add> hierarchy.getTopLevelDrawable().setBounds( <add> Math.round(getLeft()), <add> Math.round(getTop()), <add> Math.round(getRight()), <add> Math.round(getBottom())); <add> <add> mRequestHelper.attach(callback); <add> } <add> <add> @Override <add> public void onDetached() { <add> Assertions.assumeNotNull(mRequestHelper).detach(); <add> } <add> <add> private boolean shouldDisplayBorder() { <add> return mBorderColor != 0 || mBorderRadius >= 0.5f; <add> } <add>} <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/DraweeRequestHelper.java <add>/** <add> * Copyright (c) 2015-present, Facebook, Inc. <add> * All rights reserved. <add> * <add> * This source code is licensed under the BSD-style license found in the <add> * LICENSE file in the root directory of this source tree. An additional grant <add> * of patent rights can be found in the PATENTS file in the same directory. <add> */ <add> <add>package com.facebook.react.flat; <add> <add> <add>import android.content.res.Resources; <add>import android.graphics.drawable.Drawable; <add> <add>import com.facebook.drawee.controller.AbstractDraweeControllerBuilder; <add>import com.facebook.drawee.generic.GenericDraweeHierarchy; <add>import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; <add>import com.facebook.drawee.interfaces.DraweeController; <add>import com.facebook.drawee.interfaces.DraweeController; <add>import com.facebook.imagepipeline.request.ImageRequest; <add>import com.facebook.infer.annotation.Assertions; <add> <add>/* package */ final class DraweeRequestHelper { <add> <add> private static GenericDraweeHierarchyBuilder sHierarchyBuilder; <add> private static AbstractDraweeControllerBuilder sControllerBuilder; <add> <add> /* package */ static void setResources(Resources resources) { <add> sHierarchyBuilder = new GenericDraweeHierarchyBuilder(resources); <add> } <add> <add> /* package */ static void setDraweeControllerBuilder(AbstractDraweeControllerBuilder builder) { <add> sControllerBuilder = builder; <add> } <add> <add> private final DraweeController mDraweeController; <add> private int mAttachCounter; <add> <add> /* package */ DraweeRequestHelper(ImageRequest imageRequest) { <add> DraweeController controller = sControllerBuilder <add> .setImageRequest(imageRequest) <add> .setCallerContext(RCTImageView.getCallerContext()) <add> .build(); <add> <add> controller.setHierarchy(sHierarchyBuilder.build()); <add> <add> mDraweeController = controller; <add> } <add> <add> /* package */ void attach(FlatViewGroup.InvalidateCallback callback) { <add> ++mAttachCounter; <add> if (mAttachCounter == 1) { <add> getDrawable().setCallback(callback.get()); <add> mDraweeController.onAttach(); <add> } <add> } <add> <add> /* package */ void detach() { <add> --mAttachCounter; <add> if (mAttachCounter == 0) { <add> mDraweeController.onDetach(); <add> } <add> } <add> <add> /* package */ GenericDraweeHierarchy getHierarchy() { <add> return (GenericDraweeHierarchy) Assertions.assumeNotNull(mDraweeController.getHierarchy()); <add> } <add> <add> /* package */ Drawable getDrawable() { <add> return getHierarchy().getTopLevelDrawable(); <add> } <add>} <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java <ide> public int compare(FlatShadowNode lhs, FlatShadowNode rhs) { <ide> } <ide> }; <ide> <del> /** <del> * Temporary storage for elements that need to be moved within a parent. <del> * Only used inside #manageChildren() and always empty outside of it. <del> */ <del> private final ArrayList<FlatShadowNode> mNodesToMove = new ArrayList<>(); <del> private final StateBuilder mStateBuilder; <del> <ide> public static FlatUIImplementation createInstance( <ide> ReactApplicationContext reactContext, <ide> List<ViewManager> viewManagers) { <ide> public static FlatUIImplementation createInstance( <ide> RCTImageView.setCallerContext(callerContext); <ide> } <ide> } <add> DraweeRequestHelper.setResources(reactContext.getResources()); <ide> <ide> TypefaceCache.setAssetManager(reactContext.getAssets()); <ide> <ide> public static FlatUIImplementation createInstance( <ide> FlatUIViewOperationQueue operationsQueue = new FlatUIViewOperationQueue( <ide> reactContext, <ide> nativeViewHierarchyManager); <del> return new FlatUIImplementation(viewManagerRegistry, operationsQueue); <add> return new FlatUIImplementation(reactImageManager, viewManagerRegistry, operationsQueue); <ide> } <ide> <add> /** <add> * Temporary storage for elements that need to be moved within a parent. <add> * Only used inside #manageChildren() and always empty outside of it. <add> */ <add> private final ArrayList<FlatShadowNode> mNodesToMove = new ArrayList<>(); <add> private final StateBuilder mStateBuilder; <add> private @Nullable ReactImageManager mReactImageManager; <add> <ide> private FlatUIImplementation( <add> @Nullable ReactImageManager reactImageManager, <ide> ViewManagerRegistry viewManagers, <ide> FlatUIViewOperationQueue operationsQueue) { <ide> super(viewManagers, operationsQueue); <ide> mStateBuilder = new StateBuilder(operationsQueue); <add> mReactImageManager = reactImageManager; <ide> } <ide> <ide> @Override <ide> protected ReactShadowNode createRootShadowNode() { <add> if (mReactImageManager != null) { <add> // This is not the best place to initialize DraweeRequestHelper, but order of module <add> // initialization is undefined, and this is pretty much the earliest when we are guarantied <add> // that Fresco is initalized and DraweeControllerBuilder can be queried. This also happens <add> // relatively rarely to have any performance considerations. <add> DraweeRequestHelper.setDraweeControllerBuilder( <add> mReactImageManager.getDraweeControllerBuilder()); <add> mReactImageManager = null; <add> } <add> <ide> return new FlatRootShadowNode(); <ide> } <ide> <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java <ide> protected void onLayout(boolean changed, int l, int t, int r, int b) { <ide> <ide> @Override <ide> protected boolean verifyDrawable(Drawable who) { <del> return who == mHotspot || super.verifyDrawable(who); <add> return true; <ide> } <ide> <ide> @Override <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTImageViewManager.java <ide> <ide> /* package */ final class RCTImageViewManager extends FlatViewManager { <ide> <add> private static final boolean USE_IMAGEPIPELINE_DIRECTLY = false; <add> <ide> @Override <ide> public String getName() { <ide> return "RCTImageView"; <ide> } <ide> <ide> @Override <ide> public RCTImageView createShadowNodeInstance() { <del> return new RCTImageView(new DrawImageWithPipeline()); <add> if (USE_IMAGEPIPELINE_DIRECTLY) { <add> return new RCTImageView(new DrawImageWithPipeline()); <add> } else { <add> return new RCTImageView(new DrawImageWithDrawee()); <add> } <ide> } <ide> <ide> @Override
5
Text
Text
add basic blockchain datastructure implementation
ffe14988e865c4754d48b37d6a69fe09e0252792
<ide><path>guide/english/blockchain/basic-implementation/index.md <add>--- <add>title: Basic blockchain implementation <add>--- <add> <add># Basic blockchain implementation using ArrayList of Java <add> <add>> This's a very basic implementation to get knowledge about blockchain. <add> <add>## Quick explanation: <add> <add>Blockchain is a list of blocks with "every block contain verified content of the previous block". <add>Then we use collision-free attribute of the cryptographic hash function to verify "the content of the previous block". <add>This example will use SHA256 hash function, and use built-in ArrayList type of Java. <add> <add>## Basic struture: <add> <add>A block include at least header and data. <add>A header contain the verified information of the previous block, or the bash code in this case. <add>The very first block is called GENESIS block, with the bash code is the its code. <add> <add>> We can see blockhain is data struture base on another struture. <add> <add>## Note: <add> - Since we're using Java, for quickly, the example will use public attribute instead of getter and setter methods. <add> - Data in blockchain could be changed, but it will take a greate cost will the big data. <add> <add>## Hash library <add>We's use the built-in library <add> <add>``` <add>import java.security.*; <add>public class Sha <add>{ <add> public static String hash256(String data) //throws NoSuchAlgorithmException <add> { <add> try <add> { <add> MessageDigest md = MessageDigest.getInstance("SHA-256"); <add> md.update(data.getBytes()); <add> return bytesToHex(md.digest()); <add> } <add> catch(Exception e) <add> { <add> System.out.println(e.toString()); <add> } <add> return "ERROR"; <add> } <add> public static String bytesToHex(byte[] bytes) <add> { <add> StringBuffer result = new StringBuffer(); <add> for (byte byt : bytes) result.append(Integer.toString((byt & 0xff) + 0x100, 16).substring(1)); <add> return result.toString(); <add> } <add>} <add>``` <add> <add>## Create Block <add> <add>> Every block with contain a header is hash code of the previous block. <add> <add>``` <add>public class Block <add>{ <add> //Header <add> public String previousHash; <add> <add> //Data <add> public String data; <add> public Block(String _data, String _previousHash) <add> { <add> this.data = _data; <add> this.previousHash = _previousHash; <add> } <add> public String getHash() <add> { <add> return Sha.hash256(this.previousHash + this.data); <add> } <add> public String toString() <add> { <add> return String.format(" dataValue:\t %s\n previousHash:\t %s\n currrentHash:\t %s\n", this.data, this.previousHash, this.getHash()); <add> } <add>} <add> <add>``` <add> <add>## Create Blockchain <add> <add>``` <add>import java.util.*; <add>public class Blockchain <add>{ <add> public List<Block> blocks; <add> public void add(String _data) <add> { <add> Block previousBlock = this.blocks.get(this.blocks.size()-1); <add> this.blocks.add(new Block(_data, previousBlock.getHash())); <add> } <add> public Blockchain() <add> { <add> this.blocks = new ArrayList<Block>(); <add> this.blocks.add(new Block("GENESIS", Sha.hash256("GENESIS"))); <add> } <add>} <add>``` <add> <add>## Using <add> <add>``` <add>import java.util.*; <add>public class BlockchainDemo <add>{ <add> public static void main(String args[]) <add> { <add> <add> //Generate datas <add> <add> List<String> datas = new ArrayList<String>(); <add> for(int i=0; i<=10; i++) <add> { <add> datas.add(Integer.toString(i)); <add> } <add> <add> //Add blocks in to blockchain with the created datas <add> <add> Blockchain blockchain = new Blockchain(); <add> <add> datas.forEach(_data -> blockchain.add(_data)); <add> <add> blockchain.blocks.forEach(_block -> System.out.println(_block.toString())); <add> } <add>} <add>``` <add> <add>## Verify the blockchain <add> <add>This function will verify if our Blockchain is "trusted", that meant not any block updated <add> <add> <add>``` <add>public static boolean verify(Blockchain _blockchain) <add>{ <add> Blockchain.Block previousBlock = _blockchain.blocks.get(0); <add> boolean res = true; <add> for(int i = 1; i < _blockchain.blocks.size(); i++) <add> { <add> Blockchain.Block currentBlock = _blockchain.blocks.get(i); <add> if ( !previousBlock.getHash().equals(currentBlock.previousHash) ) <add> { <add> System.out.println("\t\tBROKEN"); <add> res = false; <add> } <add> <add> System.out.println(currentBlock.toString()); <add> <add> previousBlock = _blockchain.blocks.get(i); <add> } <add> return res; <add>} <add> <add>```
1
Java
Java
avoid outdated jackson api in tests
7b6293fa052ed67fabc01e013145294c6b9822b0
<ide><path>spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java <ide> private static DeserializerFactoryConfig getDeserializerFactoryConfig(ObjectMapp <ide> <ide> @Test <ide> public void propertyNamingStrategy() { <del> PropertyNamingStrategy strategy = new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy(); <add> PropertyNamingStrategy strategy = new PropertyNamingStrategy.SnakeCaseStrategy(); <ide> ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().propertyNamingStrategy(strategy).build(); <ide> assertThat(objectMapper.getSerializationConfig().getPropertyNamingStrategy()).isSameAs(strategy); <ide> assertThat(objectMapper.getDeserializationConfig().getPropertyNamingStrategy()).isSameAs(strategy); <ide> public void completeSetup() throws JsonMappingException { <ide> JsonSerializer<Number> serializer2 = new NumberSerializer(Integer.class); <ide> <ide> Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json() <del> .modules(new ArrayList<>()) // Disable well-known modules detection <add> .modules(new ArrayList<>()) // Disable well-known modules detection <ide> .serializers(serializer1) <ide> .serializersByType(Collections.singletonMap(Boolean.class, serializer2)) <ide> .deserializersByType(deserializerMap) <ide> public void factory() { <ide> assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class); <ide> } <ide> <del> <ide> @Test <ide> public void visibility() throws JsonProcessingException { <ide> ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json() <ide> public void visibility() throws JsonProcessingException { <ide> assertThat(json).doesNotContain("property3"); <ide> } <ide> <add> <ide> public static class CustomIntegerModule extends Module { <ide> <ide> @Override <ide> public void setList(List<T> list) { <ide> } <ide> } <ide> <add> <ide> public static class JacksonVisibilityBean { <ide> <ide> @SuppressWarnings("unused") <ide> public static class JacksonVisibilityBean { <ide> public String getProperty3() { <ide> return null; <ide> } <del> <ide> } <ide> <add> <ide> static class OffsetDateTimeDeserializer extends JsonDeserializer<OffsetDateTime> { <ide> <ide> private static final String CURRENT_ZONE_OFFSET = OffsetDateTime.now().getOffset().toString(); <ide> public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext <ide> } <ide> } <ide> <add> <ide> @JsonDeserialize <ide> static class DemoPojo { <ide> <ide> public OffsetDateTime getOffsetDateTime() { <ide> public void setOffsetDateTime(OffsetDateTime offsetDateTime) { <ide> this.offsetDateTime = offsetDateTime; <ide> } <del> <ide> } <ide> <add> <ide> @SuppressWarnings("serial") <ide> public static class MyXmlFactory extends XmlFactory { <ide> } <ide> <add> <ide> static class Foo {} <ide> <ide> static class Bar {} <ide><path>spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java <ide> public void defaultModules() throws JsonProcessingException, UnsupportedEncoding <ide> assertThat(new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8")).isEqualTo(timestamp.toString()); <ide> } <ide> <del> @Test // SPR-12634 <del> @SuppressWarnings("unchecked") <add> @Test // SPR-12634 <ide> public void customizeDefaultModulesWithModuleClass() throws JsonProcessingException, UnsupportedEncodingException { <ide> this.factory.setModulesToInstall(CustomIntegerModule.class); <ide> this.factory.afterPropertiesSet(); <ide> public void customizeDefaultModulesWithModuleClass() throws JsonProcessingExcept <ide> assertThat(new String(objectMapper.writeValueAsBytes(4), "UTF-8")).contains("customid"); <ide> } <ide> <del> @Test // SPR-12634 <add> @Test // SPR-12634 <ide> public void customizeDefaultModulesWithSerializer() throws JsonProcessingException, UnsupportedEncodingException { <ide> Map<Class<?>, JsonSerializer<?>> serializers = new HashMap<>(); <ide> serializers.put(Integer.class, new CustomIntegerSerializer()); <ide> private static DeserializerFactoryConfig getDeserializerFactoryConfig(ObjectMapp <ide> <ide> @Test <ide> public void propertyNamingStrategy() { <del> PropertyNamingStrategy strategy = new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy(); <add> PropertyNamingStrategy strategy = new PropertyNamingStrategy.SnakeCaseStrategy(); <ide> this.factory.setPropertyNamingStrategy(strategy); <ide> this.factory.afterPropertiesSet(); <ide> <ide><path>spring-web/src/test/java/org/springframework/http/converter/json/SpringHandlerInstantiatorTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2020 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 com.fasterxml.jackson.databind.jsontype.TypeIdResolver; <ide> import com.fasterxml.jackson.databind.jsontype.TypeSerializer; <ide> import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder; <del>import com.fasterxml.jackson.databind.type.TypeFactory; <ide> import org.junit.jupiter.api.BeforeEach; <ide> import org.junit.jupiter.api.Test; <ide> <ide> public JsonTypeInfo.Id getMechanism() { <ide> return JsonTypeInfo.Id.CUSTOM; <ide> } <ide> <del> // Only needed when compiling against Jackson 2.7; gone in 2.8 <del> public JavaType typeFromId(String s) { <del> return TypeFactory.defaultInstance().constructFromCanonical(s); <del> } <del> <ide> @Override <ide> public String idFromValue(Object value) { <ide> isAutowiredFiledInitialized = (this.capitalizer != null); <ide> public JavaType typeFromId(DatabindContext context, String id) { <ide> return null; <ide> } <ide> <del> // New in Jackson 2.7 <ide> @Override <ide> public String getDescForKnownTypeIds() { <ide> return null;
3
Python
Python
fix broken main branch
c3cd787afe92816b738cef50fd26d3db6aa52fe1
<ide><path>tests/always/test_project_structure.py <ide> class TestAmazonProviderProjectStructure(ExampleCoverageTest): <ide> 'airflow.providers.amazon.aws.sensors.emr.EmrContainerSensor', <ide> # S3 Exasol transfer difficult to test, see: https://github.com/apache/airflow/issues/22632 <ide> 'airflow.providers.amazon.aws.transfers.exasol_to_s3.ExasolToS3Operator', <del> # S3 legitimately missing, needs development <del> 'airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSToS3Operator', <ide> # Glue Catalog sensor difficult to test <ide> 'airflow.providers.amazon.aws.sensors.glue_catalog_partition.GlueCatalogPartitionSensor', <ide> }
1
Text
Text
add mapstatetoprops and a comment to import…
4d569aea20dc745d3588ba104a03cdae122cfd7b
<ide><path>docs/recipes/WritingTests.md <ide> const App = props => { <ide> return <div>{props.user}</div> <ide> } <ide> <add>const mapStateToProps = state => { <add> return state <add>} <add> <ide> export default connect(mapStateToProps)(App) <ide> ``` <ide> <ide> import React from 'react' <ide> import { render as rtlRender } from '@testing-library/react' <ide> import { createStore } from 'redux' <ide> import { Provider } from 'react-redux' <add>// Import your own reducer <add>import reducer from '../reducer' <ide> <ide> function render( <ide> ui,
1
Python
Python
add ediff1d support for empty arrays
371f8c6a1df8b2d244afd50d03e492d79a1372fe
<ide><path>numpy/lib/arraysetops.py <ide> <ide> ## <ide> # 03.11.2005, c <del>def ediff1d( ar1, to_end = None, to_begin = None ): <add>def ediff1d(ary, to_end = None, to_begin = None): <ide> """Array difference with prefixed and/or appended value.""" <del> dar1 = ar1[1:] - ar1[:-1] <del> if to_end and to_begin: <del> shape = (ar1.shape[0] + 1,) + ar1.shape[1:] <del> ed = numpy.empty( shape, dtype = ar1.dtype ) <del> ed[0], ed[-1] = to_begin, to_end <del> ed[1:-1] = dar1 <del> elif to_end: <del> ed = numpy.empty( ar1.shape, dtype = ar1.dtype ) <del> ed[-1] = to_end <del> ed[:-1] = dar1 <del> elif to_begin: <del> ed = numpy.empty( ar1.shape, dtype = ar1.dtype ) <del> ed[0] = to_begin <del> ed[1:] = dar1 <del> else: <del> ed = dar1 <del> <add> ary = numpy.asarray(ary) <add> ed = ary[1:] - ary[:-1] <add> if to_begin is not None: <add> ed = numpy.insert(ed, 0, to_begin) <add> if to_end is not None: <add> ed = numpy.append(ed, to_end) <add> <ide> return ed <ide> <del> <ide> ## <ide> # 01.11.2005, c <ide> # 02.11.2005 <ide> def intersect1d_nu( ar1, ar2 ): <ide> # 01.11.2005, c <ide> def setxor1d( ar1, ar2 ): <ide> """Set exclusive-or of 1D arrays with unique elements.""" <del> aux = numpy.concatenate( (ar1, ar2 ) ) <add> aux = numpy.concatenate((ar1, ar2)) <ide> aux.sort() <del> flag = ediff1d( aux, to_end = 1, to_begin = 1 ) == 0 <del> flag2 = ediff1d( flag, 0 ) == 0 <del> return aux.compress( flag2 ) <add> flag = ediff1d(aux, to_end = 1, to_begin = 1) == 0 <add> flag2 = ediff1d(flag) == 0 <add> return aux.compress(flag2) <ide> <ide> ## <ide> # 03.11.2005, c <ide><path>numpy/lib/function_base.py <ide> def insert(arr, obj, values, axis=None): <ide> newshape = list(arr.shape) <ide> if isinstance(obj, (int, long, integer)): <ide> if (obj < 0): obj += N <del> if (obj < 0 or obj >=N): <add> if (obj < 0 or obj > N or (obj == N and N != 0)): <ide> raise ValueError, "index (%d) out of range (0<=index<=%d) "\ <ide> "in dimension %d" % (obj, N, axis) <ide> newshape[axis] += 1; <ide><path>numpy/lib/tests/test_arraysetops.py <ide> set_package_path() <ide> import numpy <ide> from numpy.lib.arraysetops import * <add>from numpy.lib.arraysetops import ediff1d <ide> restore_path() <ide> <ide> ################################################## <ide> def check_setxor1d( self ): <ide> c = setxor1d( a, b ) <ide> assert_array_equal( c, ec ) <ide> <add> def check_ediff1d(self): <add> zero_elem = numpy.array([]) <add> one_elem = numpy.array([1]) <add> two_elem = numpy.array([1,2]) <add> <add> assert_array_equal([],ediff1d(zero_elem)) <add> assert_array_equal([0],ediff1d(zero_elem,to_begin=0)) <add> assert_array_equal([0],ediff1d(zero_elem,to_end=0)) <add> assert_array_equal([-1,0],ediff1d(zero_elem,to_begin=-1,to_end=0)) <add> assert_array_equal([],ediff1d(one_elem)) <add> assert_array_equal([1],ediff1d(two_elem)) <ide> <ide> ## <ide> # 03.11.2005, c
3
Javascript
Javascript
prevent regression for common shells
b321ab6a38660780a235247972f523cc5a7cf0e3
<ide><path>spec/update-process-env-spec.js <ide> describe('updateProcessEnv(launchEnv)', function () { <ide> }) <ide> <ide> it('allows ATOM_HOME to be overwritten only if the new value is a valid path', function () { <del> newAtomHomePath = temp.mkdirSync('atom-home') <add> let newAtomHomePath = temp.mkdirSync('atom-home') <ide> <ide> process.env = { <ide> WILL_BE_DELETED: 'hi', <ide> describe('updateProcessEnv(launchEnv)', function () { <ide> }) <ide> <ide> it('allows ATOM_SUPPRESS_ENV_PATCHING to be preserved if set', function () { <del> newAtomHomePath = temp.mkdirSync('atom-home') <del> <ide> process.env = { <ide> WILL_BE_DELETED: 'hi', <ide> NODE_ENV: 'the-node-env', <ide> describe('updateProcessEnv(launchEnv)', function () { <ide> it('indicates when the environment should be fetched from the shell', function () { <ide> process.platform = 'darwin' <ide> expect(shouldGetEnvFromShell({SHELL: '/bin/sh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/sh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/bin/bash'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/bash'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/bin/zsh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/zsh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/bin/fish'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/fish'})).toBe(true) <ide> process.platform = 'linux' <ide> expect(shouldGetEnvFromShell({SHELL: '/bin/sh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/sh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/bin/bash'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/bash'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/bin/zsh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/zsh'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/bin/fish'})).toBe(true) <add> expect(shouldGetEnvFromShell({SHELL: '/usr/local/bin/fish'})).toBe(true) <ide> }) <ide> <ide> it('returns false when the shell should not be patched', function () {
1
Text
Text
add release notes for 1.5.4
c4fb0eca923cca5bab8814d72386b9bb339665f1
<ide><path>CHANGELOG.md <add><a name="1.5.4"></a> <add># 1.5.4 graduated-sophistry (2016-04-14) <add> <add> <add>## Bug Fixes <add> <add>- **$compile:** <add> - do not use `noop()` as controller for multiple components <add> ([4c8aeefb](https://github.com/angular/angular.js/commit/4c8aeefb624de7436ad95f3cd525405e0c3f493e), <add> [#14391](https://github.com/angular/angular.js/issues/14391), [#14402](https://github.com/angular/angular.js/issues/14402)) <add> - still trigger `$onChanges` even if the inner value already matches the new value <add> ([d9448dcb](https://github.com/angular/angular.js/commit/d9448dcb9f901ceb04deda1d5f3d5aac8442a718), <add> [#14406](https://github.com/angular/angular.js/issues/14406)) <add> - handle boolean attributes in `@` bindings <add> ([499e1b2a](https://github.com/angular/angular.js/commit/499e1b2adf27f32d671123f8dceadb3df2ad84a9), <add> [#14070](https://github.com/angular/angular.js/issues/14070)) <add> - don't throw if controller is named <add> ([e72990dc](https://github.com/angular/angular.js/commit/e72990dc3714c8b847185ddb64fd5fd00e5cceab)) <add> - ensure that `$onChanges` hook is called correctly <add> ([0ad2b708](https://github.com/angular/angular.js/commit/0ad2b70862d49ecc4355a16d767c0ca9358ecc3e), <add> [#14355](https://github.com/angular/angular.js/issues/14355), [#14359](https://github.com/angular/angular.js/issues/14359)) <add>- **$injector:** ensure functions with overridden `toString()` are annotated properly <add> ([d384834f](https://github.com/angular/angular.js/commit/d384834fdee140a716298bd065f304f8fba4725e), <add> [#14361](https://github.com/angular/angular.js/issues/14361)) <add>- **ngAnimate:** <add> - remove event listeners only after all listeners have been called <add> ([79604f46](https://github.com/angular/angular.js/commit/79604f462899c118a99d610995083ff82d38aa35), <add> [#14321](https://github.com/angular/angular.js/issues/14321)) <add> - fire callbacks when document is hidden <add> ([c7a92d2a](https://github.com/angular/angular.js/commit/c7a92d2a9a436dddd65de721c9837a93e915d939), <add> [#14120](https://github.com/angular/angular.js/issues/14120)) <add> - fire callbacks in the correct order for certain skipped animations <add> ([90da3059](https://github.com/angular/angular.js/commit/90da3059cecfefaecf136b01cd87aee6775a8778)) <add>- **ngClass:** fix watching of an array expression containing an object <add> ([f975d8d4](https://github.com/angular/angular.js/commit/f975d8d4481e0b8cdba553f0e5ad9ec1688adae8), <add> [#14405](https://github.com/angular/angular.js/issues/14405)) <add>- **ngMock:** fix collecting stack trace in `inject()` on IE10+, PhantomJS <add> ([e9c718a4](https://github.com/angular/angular.js/commit/e9c718a465d28b9f2691e3acab944f7c31aa9fb6), <add> [#13591](https://github.com/angular/angular.js/issues/13591), [#13592](https://github.com/angular/angular.js/issues/13592), [#13593](https://github.com/angular/angular.js/issues/13593)) <add>- **ngOptions:** set select value when model matches disabled option <add> ([832eba5f](https://github.com/angular/angular.js/commit/832eba5fc952312e6b99127123e6e75bdf729006), <add> [#12756](https://github.com/angular/angular.js/issues/12756)) <add> <add> <add>## Features <add> <add>- **$compile:** <add> - put custom annotations on DDO <add> ([f338e96c](https://github.com/angular/angular.js/commit/f338e96ccc739efc4b24022eae406c3d5451d422), <add> [#14369](https://github.com/angular/angular.js/issues/14369), [#14279](https://github.com/angular/angular.js/issues/14279), [#14284](https://github.com/angular/angular.js/issues/14284)) <add> - add `isFirstChange()` method to onChanges object <add> ([8d43d8b8](https://github.com/angular/angular.js/commit/8d43d8b8e7aacf97ddb9aa48bff25db57249cdd5), <add> [#14318](https://github.com/angular/angular.js/issues/14318), [#14323](https://github.com/angular/angular.js/issues/14323)) <add>- **$componentController:** provide isolated scope if none is passed (#14425) <add> ([33f817b9](https://github.com/angular/angular.js/commit/33f817b99cb20e566b381e7202235fe99b4a742a), <add> [#14425](https://github.com/angular/angular.js/issues/14425)) <add>- **$http:** <add> - support handling additional XHR events <add> ([01b18450](https://github.com/angular/angular.js/commit/01b18450882da9bb9c903d43c0daddbc03c2c35d) and <add> [56c861c9](https://github.com/angular/angular.js/commit/56c861c9e114c45790865e5635eaae8d32eb649a), <add> [#14367](https://github.com/angular/angular.js/issues/14367), [#11547](https://github.com/angular/angular.js/issues/11547), [#1934](https://github.com/angular/angular.js/issues/1934)) <add>- **$parse:** add the ability to define the identifier characters <add> ([3e7fa191](https://github.com/angular/angular.js/commit/3e7fa19197c54a764225ad27c0c0bf72263daa8d)) <add>- **ngAnimate:** let $animate.off() remove all listeners for an element <add> ([bf6cb8ab](https://github.com/angular/angular.js/commit/bf6cb8ab0d157083a1ed55743e3fffe728daa6f3)) <add>- **ngAria:** add support for aria-readonly based on ngReadonly <add> ([ec0baadc](https://github.com/angular/angular.js/commit/ec0baadcb68a4fa8da27d76b7e6a4e0840acd7fa), <add> [#14140](https://github.com/angular/angular.js/issues/14140), [#14077](https://github.com/angular/angular.js/issues/14077)) <add>- **ngParseExt:** new ngParseExt module <add> ([d08f5c69](https://github.com/angular/angular.js/commit/d08f5c698624f6243685b16f2d458cb9a980ebde)) <add> <add> <add>## Performance Improvements <add> <add>- **$compile:** use createMap() for directive bindings to allow fast `forEach` <add> ([c115b37c](https://github.com/angular/angular.js/commit/c115b37c336f3a5936187279057b29c76078caf2), <add> [#12529](https://github.com/angular/angular.js/issues/12529)) <add>- **ngOptions:** use `documentFragment` to populate `select` options <add> ([6a4124d0](https://github.com/angular/angular.js/commit/6a4124d0fb17cd7fc0e8bf5a1ca4d785a1d11c1c), <add> [#13607](https://github.com/angular/angular.js/issues/13607), [#13239](https://github.com/angular/angular.js/issues/13239), [#12076](https://github.com/angular/angular.js/issues/12076)) <add> <add> <add> <ide> <a name="1.5.3"></a> <ide> # 1.5.3 diplohaplontic-meiosis (2016-03-25) <ide>
1
Go
Go
fix a simple goroutine leak in unit test
3dda7311cd645386fbc46078c0c7cfff3d9da4e8
<ide><path>distribution/xfer/download_test.go <ide> func TestCancelledDownload(t *testing.T) { <ide> descriptors := downloadDescriptors(nil) <ide> _, _, err := ldm.Download(ctx, *image.NewRootFS(), runtime.GOOS, descriptors, progress.ChanOutput(progressChan)) <ide> if err != context.Canceled { <add> close(progressChan) <ide> t.Fatal("expected download to be cancelled") <ide> } <ide>
1
Javascript
Javascript
fix array params
594df987f279ff423b82e96f0aa5fa6ef9bde959
<ide><path>lib/helpers/buildUrl.js <ide> module.exports = function buildUrl(url, params) { <ide> if (val === null || typeof val === 'undefined') { <ide> return; <ide> } <add> <add> if (utils.isArray(val)) { <add> key = key+'[]'; <add> } <add> <ide> if (!utils.isArray(val)) { <ide> val = [val]; <ide> } <ide><path>test/specs/helpers/buildUrl.spec.js <ide> describe('helpers::buildUrl', function () { <ide> it('should support array params', function () { <ide> expect(buildUrl('/foo', { <ide> foo: ['bar', 'baz'] <del> })).toEqual('/foo?foo=bar&foo=baz'); <add> })).toEqual('/foo?foo%5B%5D=bar&foo%5B%5D=baz'); <ide> }); <ide> <ide> it('should support special char params', function () {
2
Ruby
Ruby
update migration version from 5.2 to 7.0
506e357f00698aacf8f4d58b1c0ae26470dcdf32
<ide><path>activestorage/db/migrate/20170806125915_create_active_storage_tables.rb <del>class CreateActiveStorageTables < ActiveRecord::Migration[5.2] <add>class CreateActiveStorageTables < ActiveRecord::Migration[7.0] <ide> def change <ide> # Use Active Record's configured type for primary and foreign keys <ide> primary_key_type, foreign_key_type = primary_and_foreign_key_types
1
Javascript
Javascript
remove debugger workaround for aix
ff975fe1c681f1e68c1d3a7b7fd41ea9b0339acb
<ide><path>test/common/debugger.js <ide> function startCLI(args, flags = [], spawnOpts = {}) { <ide> if (this === child.stderr) { <ide> stderrOutput += chunk; <ide> } <del> // TODO(trott): Figure out why the "breakpoints restored." message appears <del> // in unpredictable places especially on AIX in CI. We shouldn't be <del> // excluding it, but it gets in the way of the output checking for tests. <del> outputBuffer.push(chunk.replace(/\n*\d+ breakpoints restored\.\n*/mg, '')); <add> outputBuffer.push(chunk); <ide> } <ide> <ide> function getOutput() {
1
Javascript
Javascript
fix testswarm username
169b4185bcd34803b4459cb564c04e72bd4ddf1e
<ide><path>grunt.js <ide> module.exports = function( grunt ) { <ide> pollInterval: 10000, <ide> done: this.async() <ide> }, { <del> authUsername: "jqueryui", <add> authUsername: "jquery", <ide> authToken: grunt.file.readJSON( configFile ).jquery.authToken, <ide> jobName: 'jQuery commit #<a href="https://github.com/jquery/jquery/commit/' + commit + '">' + commit + '</a>', <ide> runMax: 4,
1
Java
Java
avoid npe in responsecookie on null domain
a7fe6b8f5c74dd6ea0e531b3ba1e90a455ee15dd
<ide><path>spring-web/src/main/java/org/springframework/http/ResponseCookie.java <ide> public ResponseCookieBuilder domain(String domain) { <ide> <ide> @Nullable <ide> private String initDomain(String domain) { <del> if (lenient) { <add> if (lenient && !StringUtils.isEmpty(domain)) { <ide> String s = domain.trim(); <ide> if (s.startsWith("\"") && s.endsWith("\"")) { <ide> if (s.substring(1, domain.length() - 1).trim().isEmpty()) {
1
PHP
PHP
implement several of the methods needed for psr16
ec42f97f68cc444f9cfbb17736b242213b6300c1
<ide><path>src/Cache/SimpleCacheEngine.php <add><?php <add>namespace Cake\Cache; <add> <add>use Cake\Cache\CacheEngine; <add>use Psr\SimpleCache\CacheInterface; <add>use Psr\SimpleCache\InvalidArgumentException; <add> <add>/** <add> * Wrapper for Cake engines that allow them to support <add> * the PSR16 Simple Cache Interface <add> */ <add>class SimpleCacheEngine implements CacheInterface <add>{ <add> protected $inner; <add> <add> /** <add> * Constructor <add> * <add> * @param \Cake\Cache\CacheEngine $inner The decorated engine. <add> */ <add> public function __construct($inner) <add> { <add> $this->inner = $inner; <add> } <add> <add> /** <add> * Fetches a value from the cache. <add> * <add> * @param string $key The unique key of this item in the cache. <add> * @param mixed $default Default value to return if the key does not exist. <add> * @return mixed The value of the item from the cache, or $default in case of cache miss. <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if the $key string is not a legal value. <add> */ <add> public function get($key, $default = null) <add> { <add> $result = $this->inner->read($key); <add> if ($result === false) { <add> return $default; <add> } <add> <add> return $result; <add> } <add> <add> /** <add> * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. <add> * <add> * @param string $key The key of the item to store. <add> * @param mixed $value The value of the item to store, must be serializable. <add> * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and <add> * the driver supports TTL then the library may set a default value <add> * for it or let the driver take care of that. <add> * @return bool True on success and false on failure. <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if the $key string is not a legal value. <add> */ <add> public function set($key, $value, $ttl = null) <add> { <add> if ($ttl !== null) { <add> $restore = $this->inner->getConfig('duration'); <add> $this->inner->setConfig('duration', $ttl); <add> } <add> try { <add> $result = $this->inner->write($key, $value); <add> <add> return (bool)$result; <add> } finally { <add> if (isset($restore)) { <add> $this->inner->setConfig('duration', $restore); <add> } <add> } <add> } <add> <add> /** <add> * Delete an item from the cache by its unique key. <add> * <add> * @param string $key The unique cache key of the item to delete. <add> * @return bool True if the item was successfully removed. False if there was an error. <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if the $key string is not a legal value. <add> */ <add> public function delete($key) <add> { <add> return $this->inner->delete($key); <add> } <add> <add> /** <add> * Wipes clean the entire cache's keys. <add> * <add> * @return bool True on success and false on failure. <add> */ <add> public function clear() <add> { <add> return $this->inner->clear(false); <add> } <add> <add> /** <add> * Obtains multiple cache items by their unique keys. <add> * <add> * @param iterable $keys A list of keys that can obtained in a single operation. <add> * @param mixed $default Default value to return for keys that do not exist. <add> * @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value. <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if $keys is neither an array nor a Traversable, <add> * or if any of the $keys are not a legal value. <add> */ <add> public function getMultiple($keys, $default = null) <add> { <add> $results = $this->inner->readMany($keys); <add> foreach ($results as $key => $value) { <add> if ($value === false) { <add> $results[$key] = $default; <add> } <add> } <add> <add> return $results; <add> } <add> <add> /** <add> * Persists a set of key => value pairs in the cache, with an optional TTL. <add> * <add> * @param iterable $values A list of key => value pairs for a multiple-set operation. <add> * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and <add> * the driver supports TTL then the library may set a default value <add> * for it or let the driver take care of that. <add> * @return bool True on success and false on failure. <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if $values is neither an array nor a Traversable, <add> * or if any of the $values are not a legal value. <add> */ <add> public function setMultiple($values, $ttl = null) <add> { <add> if ($ttl !== null) { <add> $restore = $this->inner->getConfig('duration'); <add> $this->inner->setConfig('duration', $ttl); <add> } <add> try { <add> return $this->inner->writeMany($values); <add> } finally { <add> if (isset($restore)) { <add> $this->inner->setConfig('duration', $restore); <add> } <add> } <add> } <add> <add> /** <add> * Deletes multiple cache items in a single operation. <add> * <add> * @param iterable $keys A list of string-based keys to be deleted. <add> * @return bool True if the items were successfully removed. False if there was an error. <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if $keys is neither an array nor a Traversable, <add> * or if any of the $keys are not a legal value. <add> */ <add> public function deleteMultiple($keys) <add> { <add> } <add> <add> /** <add> * Determines whether an item is present in the cache. <add> * <add> * NOTE: It is recommended that has() is only to be used for cache warming type purposes <add> * and not to be used within your live applications operations for get/set, as this method <add> * is subject to a race condition where your has() will return true and immediately after, <add> * another script can remove it making the state of your app out of date. <add> * <add> * @param string $key The cache item key. <add> * @return bool <add> * @throws \Psr\SimpleCache\InvalidArgumentException <add> * MUST be thrown if the $key string is not a legal value. <add> */ <add> public function has($key) <add> { <add> } <add>} <ide><path>tests/TestCase/Cache/SimpleCacheEngineTest.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 3.7.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\Cache; <add> <add>use Cake\Cache\Cache; <add>use Cake\Cache\Engine\FileEngine; <add>use Cake\Cache\SimpleCacheEngine; <add>use Cake\TestSuite\TestCase; <add> <add>/** <add> * SimpleCacheEngine class <add> */ <add>class SimpleCacheEngineTest extends TestCase <add>{ <add> public function setUp() <add> { <add> parent::setUp(); <add> <add> $this->inner = new FileEngine(); <add> $this->inner->init([ <add> 'prefix' => '', <add> 'path' => TMP . 'tests', <add> 'duration' => 5, <add> ]); <add> $this->cache = new SimpleCacheEngine($this->inner); <add> } <add> <add> public function tearDown() <add> { <add> parent::tearDown(); <add> <add> $this->inner->clear(false); <add> } <add> <add> public function testGetSuccess() <add> { <add> $this->inner->write('key_one', 'Some Value'); <add> $this->assertSame('Some Value', $this->cache->get('key_one')); <add> $this->assertSame('Some Value', $this->cache->get('key_one', 'default')); <add> } <add> <add> public function testGetNoKey() <add> { <add> $this->assertSame('default', $this->cache->get('no', 'default')); <add> $this->assertNull($this->cache->get('no')); <add> } <add> <add> public function testGetInvalidKey() <add> { <add> $this->markTestIncomplete(); <add> } <add> <add> public function testSetNoTtl() <add> { <add> $this->assertTrue($this->cache->set('key', 'a value')); <add> $this->assertSame('a value', $this->cache->get('key')); <add> } <add> <add> public function testSetWithTtl() <add> { <add> $this->assertTrue($this->cache->set('key', 'a value')); <add> $this->assertTrue($this->cache->set('expired', 'a value', 0)); <add> <add> sleep(1); <add> $this->assertSame('a value', $this->cache->get('key')); <add> $this->assertNull($this->cache->get('expired')); <add> $this->assertNotEquals(0, $this->inner->getConfig('duration')); <add> } <add> <add> public function testSetInvalidKey() <add> { <add> $this->markTestIncomplete(); <add> } <add> <add> public function testDelete() <add> { <add> $this->cache->set('key', 'a value'); <add> $this->assertTrue($this->cache->delete('key')); <add> $this->assertFalse($this->cache->delete('undefined')); <add> } <add> <add> public function testDeleteInvalidKey() <add> { <add> $this->markTestIncomplete(); <add> } <add> <add> public function testClear() <add> { <add> $this->cache->set('key', 'a value'); <add> $this->cache->set('key2', 'other value'); <add> <add> $this->assertTrue($this->cache->clear()); <add> $this->assertNull($this->cache->get('key')); <add> $this->assertNull($this->cache->get('key2')); <add> } <add> <add> public function testGetMultiple() <add> { <add> $this->cache->set('key', 'a value'); <add> $this->cache->set('key2', 'other value'); <add> <add> $results = $this->cache->getMultiple(['key', 'key2', 'no']); <add> $expected = [ <add> 'key' => 'a value', <add> 'key2' => 'other value', <add> 'no' => null, <add> ]; <add> $this->assertSame($expected, $results); <add> } <add> <add> public function testGetMultipleDefault() <add> { <add> $this->cache->set('key', 'a value'); <add> $this->cache->set('key2', 'other value'); <add> <add> $results = $this->cache->getMultiple(['key', 'key2', 'no'], 'default value'); <add> $expected = [ <add> 'key' => 'a value', <add> 'key2' => 'other value', <add> 'no' => 'default value', <add> ]; <add> $this->assertSame($expected, $results); <add> } <add> <add> public function testSetMultiple() <add> { <add> $data = [ <add> 'key' => 'a value', <add> 'key2' => 'other value' <add> ]; <add> $this->cache->setMultiple($data); <add> <add> $results = $this->cache->getMultiple(array_keys($data)); <add> $this->assertSame($data, $results); <add> } <add> <add> public function testSetMultipleWithTtl() <add> { <add> $data = [ <add> 'key' => 'a value', <add> 'key2' => 'other value' <add> ]; <add> $this->cache->setMultiple($data, 0); <add> <add> sleep(1); <add> $results = $this->cache->getMultiple(array_keys($data)); <add> $this->assertNull($results['key']); <add> $this->assertNull($results['key2']); <add> $this->assertGreaterThan(1, $this->inner->getConfig('duration')); <add> } <add>}
2
Python
Python
remove a redundant the
05f18c8d206387c54f00f13cbd34dfb3d7d0c573
<ide><path>numpy/add_newdocs.py <ide> def luf(lamdaexpr, *args, **kwargs): <ide> a low-level method (`ndarray(...)`) for instantiating an array. <ide> <ide> For more information, refer to the `numpy` module and examine the <del> the methods and attributes of an array. <add> methods and attributes of an array. <ide> <ide> Parameters <ide> ----------
1
PHP
PHP
remove code and tests for non string log message
fa745835a795ea97995b026bd7494802c24fcc37
<ide><path>src/Log/Engine/BaseLog.php <ide> namespace Cake\Log\Engine; <ide> <ide> use Cake\Core\InstanceConfigTrait; <del>use Cake\Datasource\EntityInterface; <del>use JsonSerializable; <ide> use Psr\Log\AbstractLogger; <ide> <ide> /** <ide> public function scopes() <ide> } <ide> <ide> /** <del> * Converts to string the provided data so it can be logged. The context <del> * can optionally be used by log engines to interpolate variables <add> * Formats the message to be logged. <add> * <add> * The context can optionally be used by log engines to interpolate variables <ide> * or add additional info to the logged message. <ide> * <del> * @param mixed $data The data to be converted to string and logged. <add> * @param string $message The message to be formatted. <ide> * @param array $context Additional logging information for the message. <ide> * @return string <ide> */ <del> protected function _format($data, array $context = []): string <add> protected function _format(string $message, array $context = []): string <ide> { <del> if (is_string($data)) { <del> return $data; <del> } <del> <del> $isObject = is_object($data); <del> <del> if ($isObject && $data instanceof EntityInterface) { <del> return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); <del> } <del> <del> if ($isObject && method_exists($data, '__toString')) { <del> return (string)$data; <del> } <del> <del> if ($isObject && $data instanceof JsonSerializable) { <del> return json_encode($data, JSON_UNESCAPED_UNICODE); <del> } <del> <del> return print_r($data, true); <add> return $message; <ide> } <ide> } <ide><path>tests/TestCase/Log/Engine/BaseLogTest.php <ide> */ <ide> namespace Cake\Test\TestCase\Log\Engine; <ide> <del>use Cake\ORM\Entity; <ide> use Cake\TestSuite\TestCase; <ide> use Psr\Log\LogLevel; <ide> use TestApp\Log\Engine\TestBaseLog; <ide> public function testLogUnicodeString() <ide> <ide> $this->assertUnescapedUnicode($this->testData, $logged); <ide> } <del> <del> /** <del> * Tests the logging output of an array containing unicode characters. <del> */ <del> public function testLogUnicodeArray() <del> { <del> $logged = $this->logger->log(LogLevel::INFO, $this->testData); <del> <del> $this->assertUnescapedUnicode($this->testData, $logged); <del> } <del> <del> /** <del> * Tests the logging output of an object implementing __toString(). <del> * Note: __toString() will return a single string containing unicode characters. <del> */ <del> public function testLogUnicodeObjectToString() <del> { <del> $stub = $this->getMockBuilder(\stdClass::class) <del> ->setMethods(['__toString']) <del> ->getMock(); <del> $stub->method('__toString') <del> ->willReturn(implode($this->testData)); <del> <del> $logged = $this->logger->log(LogLevel::INFO, $stub); <del> <del> $this->assertUnescapedUnicode($this->testData, $logged); <del> } <del> <del> /** <del> * Tests the logging output of an object implementing jsonSerializable(). <del> * Note: jsonSerializable() will return an array containing unicode characters. <del> */ <del> public function testLogUnicodeObjectJsonSerializable() <del> { <del> $stub = $this->createMock(\JsonSerializable::class); <del> $stub->method('jsonSerialize') <del> ->willReturn($this->testData); <del> <del> $logged = $this->logger->log(LogLevel::INFO, $stub); <del> <del> $this->assertUnescapedUnicode($this->testData, $logged); <del> } <del> <del> /** <del> * Tests the logging output of an entity with property value that contains unicode characters. <del> */ <del> public function testLogUnicodeEntity() <del> { <del> $entity = new Entity(['foo' => implode($this->testData)]); <del> <del> $logged = $this->logger->log(LogLevel::INFO, $entity); <del> <del> $this->assertUnescapedUnicode($this->testData, $logged); <del> } <ide> } <ide><path>tests/TestCase/Log/Engine/FileLogTest.php <ide> <ide> use Cake\Log\Engine\FileLog; <ide> use Cake\TestSuite\TestCase; <del>use TestApp\Log\Object\JsonObject; <del>use TestApp\Log\Object\StringObject; <ide> <ide> /** <ide> * FileLogTest class <ide> public function testLogFileWriting() <ide> <ide> $result = file_get_contents(LOGS . 'random.log'); <ide> $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Random: Test warning/', $result); <del> <del> $object = new StringObject(); <del> $log->log('debug', $object); <del> $this->assertFileExists(LOGS . 'debug.log'); <del> $result = file_get_contents(LOGS . 'debug.log'); <del> $this->assertStringContainsString('Debug: Hey!', $result); <del> <del> $object = new JsonObject(); <del> $log->log('debug', $object); <del> $this->assertFileExists(LOGS . 'debug.log'); <del> $result = file_get_contents(LOGS . 'debug.log'); <del> $this->assertStringContainsString('Debug: ' . json_encode(['hello' => 'world']), $result); <del> <del> $log->log('debug', [1, 2]); <del> $this->assertFileExists(LOGS . 'debug.log'); <del> $result = file_get_contents(LOGS . 'debug.log'); <del> $this->assertStringContainsString('Debug: ' . print_r([1, 2], true), $result); <ide> } <ide> <ide> /** <ide><path>tests/test_app/TestApp/Log/Object/JsonObject.php <del><?php <del>declare(strict_types=1); <del> <del>namespace TestApp\Log\Object; <del> <del>use JsonSerializable; <del> <del>/** <del> * used for testing when an serializable is passed to a logger <del> */ <del>class JsonObject implements JsonSerializable <del>{ <del> /** <del> * String representation of the object <del> * <del> * @return array <del> */ <del> public function jsonSerialize() <del> { <del> return ['hello' => 'world']; <del> } <del>} <ide><path>tests/test_app/TestApp/Log/Object/StringObject.php <del><?php <del>declare(strict_types=1); <del> <del>namespace TestApp\Log\Object; <del> <del>/** <del> * used for testing when an object is passed to a logger <del> */ <del>class StringObject <del>{ <del> /** <del> * String representation of the object <del> * <del> * @return string <del> */ <del> public function __toString() <del> { <del> return 'Hey!'; <del> } <del>}
5
Javascript
Javascript
serialize regexp to string in json. closes #119
690dfe000bf11fa6b39235d9a177dc79948841d4
<ide><path>src/JSON.js <ide> function toJsonArray(buf, obj, pretty, stack){ <ide> var type = typeof obj; <ide> if (obj === _null) { <ide> buf.push($null); <add> } else if (obj instanceof RegExp) { <add> buf.push(angular['String']['quoteUnicode'](obj.toString())); <ide> } else if (type === $function) { <ide> return; <ide> } else if (type === $boolean) { <ide><path>test/JsonSpec.js <ide> describe('json', function(){ <ide> assertEquals('[1,"b"]', toJson([1,"b"])); <ide> }); <ide> <add> it('should parse RegExp', function() { <add> assertEquals('"/foo/"', toJson(/foo/)); <add> assertEquals('[1,"/foo/"]', toJson([1,new RegExp("foo")])); <add> }); <add> <ide> it('should parse IgnoreFunctions', function() { <ide> assertEquals('[null,1]', toJson([function(){},1])); <ide> assertEquals('{}', toJson({a:function(){}}));
2
Javascript
Javascript
run tests in series to avoid timeouts
7ac61441a63efdcf1e3f1951832970c9ac1f1f60
<ide><path>gulpfile.js <ide> gulp.task('lint-js', lintJsTask); <ide> gulp.task('lint', gulp.parallel('lint-html', 'lint-js')); <ide> gulp.task('tsc', typescriptTask); <ide> gulp.task('unittest', unittestTask); <del>gulp.task('test', gulp.parallel('lint', 'tsc', 'unittest')); <add>gulp.task('test', gulp.series('lint', 'tsc', 'unittest')); <ide> gulp.task('library-size', librarySizeTask); <ide> gulp.task('module-sizes', moduleSizesTask); <ide> gulp.task('size', gulp.parallel('library-size', 'module-sizes'));
1
Text
Text
add reason why adding div was bad
0ae42fd4ac2e380f566ee91634bfc41441ad56be
<ide><path>guide/english/react/fragments/index.md <ide> Fragments are a way to return multiple elements from the render method without u <ide> <ide> When attempting to render multiple sibling elements without an enclosing tag in JSX, you will see the error message of `Adjacent JSX elements must be wrapped in an enclosing tag`. <ide> <del>In the past, a frequent solution was to use either a wrapping div or span element. However, version 16.0 of React introduced the addition of `Fragment`, which makes this no longer necessary. <add>In the past, a frequent solution was to use either a wrapping div or span element, which was not elegant as it would increase the size of DOM tree and this is because of the way JSX works as multiple elements should be wrapped in a div. However, version 16.0 of React introduced the addition of `Fragment`, which makes this no longer necessary. <ide> <ide> `Fragment` acts a wrapper without adding unnecessary divs or spans elements to the DOM. You can use it directly from the React import: <ide>
1
Javascript
Javascript
add test case for completion bash flag
288076d4a50df88c600ca6ac006b0e8fb0826780
<ide><path>test/parallel/test-bash-completion.js <add>'use strict'; <add>require('../common'); <add>const assert = require('assert'); <add>const child_process = require('child_process'); <add> <add>const p = child_process.spawnSync( <add> process.execPath, [ '--completion-bash' ]); <add>assert.ifError(p.error); <add>assert.ok(p.stdout.toString().includes( <add> `_node_complete() { <add> local cur_word options <add> cur_word="\${COMP_WORDS[COMP_CWORD]}" <add> if [[ "\${cur_word}" == -* ]] ; then <add> COMPREPLY=( $(compgen -W '`)); <add>assert.ok(p.stdout.toString().includes( <add> `' -- "\${cur_word}") ) <add> return 0 <add> else <add> COMPREPLY=( $(compgen -f "\${cur_word}") ) <add> return 0 <add> fi <add>} <add>complete -F _node_complete node node_g`));
1
Javascript
Javascript
avoid destructuring of environment variables.
2477b1379920accc3a7e9703ba056bd9cdd0f678
<ide><path>examples/with-mongodb/util/mongodb.js <ide> import { MongoClient } from 'mongodb' <ide> <del>const { MONGODB_URI, MONGODB_DB } = process.env <add>const MONGODB_URI = process.env.MONGODB_URI <add>const MONGODB_DB = process.env.MONGODB_DB <ide> <ide> if (!MONGODB_URI) { <ide> throw new Error(
1
Javascript
Javascript
load lightmapscale in objectloader
54f62cb593e99fac6e52b8fba57329ba3c1098cd
<ide><path>src/loaders/ObjectLoader.js <ide> THREE.ObjectLoader.prototype = { <ide> <ide> material.lightMap = getTexture( data.lightMap ); <ide> <add> if ( data.lightMapScale !== undefined ) { <add> material.lightMapScale = data.lightMapScale; <add> } <add> <ide> } <ide> <ide> if ( data.aoMap !== undefined ) {
1
PHP
PHP
remove dead code
e43c525eb2bbe1fb0f49f19d2a191a99c12c2d44
<ide><path>src/Http/ServerRequest.php <ide> class ServerRequest implements ServerRequestInterface <ide> */ <ide> protected $trustedProxies = []; <ide> <del> /** <del> * Contents of php://input <del> * <del> * @var string <del> */ <del> protected $_input; <del> <ide> /** <ide> * The built in detectors used with `is()` can be modified with `addDetector()`. <ide> * <ide> public function allowMethod($methods): bool <ide> throw $e; <ide> } <ide> <del> /** <del> * Read data from php://input, mocked in tests. <del> * <del> * @return string contents of php://input <del> */ <del> protected function _readInput(): string <del> { <del> if (empty($this->_input)) { <del> $fh = fopen('php://input', 'rb'); <del> $content = stream_get_contents($fh); <del> fclose($fh); <del> $this->_input = $content; <del> } <del> <del> return $this->_input; <del> } <del> <ide> /** <ide> * Update the request with a new request data element. <ide> *
1
PHP
PHP
revert new line that casuses styleci failing
a4090a3ad5af8d87625e013d129c68bd82acaff5
<ide><path>src/Illuminate/Notifications/Messages/SimpleMessage.php <ide> class SimpleMessage <ide> <ide> /** <ide> * Greeting at the beginning of the notification. <del> * <ide> * If null, a greeting depending on the level will be displayed. <ide> * <ide> * @var string|null
1
Python
Python
refactor some code in npyio.py
d9ca11117f37d48d07818a3aae3641c023454269
<ide><path>numpy/lib/_datasource.py <ide> def __init__(self): <ide> def _load(self): <ide> if self._loaded: <ide> return <add> <ide> try: <ide> import bz2 <ide> if sys.version_info[0] >= 3: <ide> def _load(self): <ide> self._file_openers[".bz2"] = _python2_bz2open <ide> except ImportError: <ide> pass <add> <ide> try: <ide> import gzip <ide> if sys.version_info[0] >= 3: <ide> def _load(self): <ide> self._file_openers[".gz"] = _python2_gzipopen <ide> except ImportError: <ide> pass <add> <ide> try: <ide> import lzma <ide> self._file_openers[".xz"] = lzma.open <ide> self._file_openers[".lzma"] = lzma.open <del> except ImportError: <add> except (ImportError, AttributeError): <add> # There are incompatible backports of lzma that do not have the <add> # lzma.open attribute, so catch that as well as ImportError. <ide> pass <add> <ide> self._loaded = True <ide> <ide> def keys(self): <ide><path>numpy/lib/_iotools.py <ide> <ide> <ide> def _decode_line(line, encoding=None): <del> """ decode bytes from binary input streams, default to latin1 """ <add> """Decode bytes from binary input streams. <add> <add> Defaults to decoding from 'latin1'. That differs from the behavior of <add> np.compat.asunicode that decodes from 'ascii'. <add> <add> Parameters <add> ---------- <add> line : str or bytes <add> Line to be decoded. <add> <add> Returns <add> ------- <add> decoded_line : unicode <add> Unicode in Python 2, a str (unicode) in Python 3. <add> <add> """ <ide> if type(line) is bytes: <ide> if encoding is None: <ide> line = line.decode('latin1') <ide> class StringConverter(object): <ide> Value to return by default, that is, when the string to be <ide> converted is flagged as missing. If not given, `StringConverter` <ide> tries to supply a reasonable default value. <del> missing_values : sequence of str, optional <del> Sequence of strings indicating a missing value. <add> missing_values : {None, sequence of str}, optional <add> ``None`` or sequence of strings indicating a missing value. If ``None`` <add> then missing values are indicated by empty entries. The default is <add> ``None``. <ide> locked : bool, optional <ide> Whether the StringConverter should be locked to prevent automatic <ide> upgrade or not. Default is False. <ide> def update(self, func, default=None, testing_value=None, <ide> A string representing a standard input value of the converter. <ide> This string is used to help defining a reasonable default <ide> value. <del> missing_values : sequence of str, optional <del> Sequence of strings indicating a missing value. <add> missing_values : {sequence of str, None}, optional <add> Sequence of strings indicating a missing value. If ``None``, then <add> the existing `missing_values` are cleared. The default is `''`. <ide> locked : bool, optional <ide> Whether the StringConverter should be locked to prevent <ide> automatic upgrade or not. Default is False. <ide> def update(self, func, default=None, testing_value=None, <ide> """ <ide> self.func = func <ide> self._locked = locked <add> <ide> # Don't reset the default to None if we can avoid it <ide> if default is not None: <ide> self.default = default <ide> def update(self, func, default=None, testing_value=None, <ide> except (TypeError, ValueError): <ide> tester = None <ide> self.type = self._dtypeortype(self._getdtype(tester)) <del> # Add the missing values to the existing set <del> if missing_values is not None: <del> if isinstance(missing_values, basestring): <del> self.missing_values.add(missing_values) <del> elif hasattr(missing_values, '__iter__'): <del> for val in missing_values: <del> self.missing_values.add(val) <add> <add> # Add the missing values to the existing set or clear it. <add> if missing_values is None: <add> # Clear all missing values even though the ctor initializes it to <add> # {''} when the argument is None. <add> self.missing_values = {} <ide> else: <del> self.missing_values = [] <add> if not np.iterable(missing_values): <add> missing_values = [missing_values] <add> if not all(isinstance(v, basestring) for v in missing_values): <add> raise TypeError("missing_values must be strings or unicode") <add> self.missing_values.update(missing_values) <ide> <ide> <ide> def easy_dtype(ndtype, names=None, defaultfmt="f%i", **validationargs): <ide><path>numpy/lib/npyio.py <ide> def _getconv(dtype): <ide> def floatconv(x): <ide> x.lower() <ide> if '0x' in x: <del> return float.fromhex(asstr(x)) <add> return float.fromhex(x) <ide> return float(x) <ide> <ide> typ = dtype.type <ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None, <ide> each row will be interpreted as an element of the array. In this <ide> case, the number of columns used must match the number of fields in <ide> the data-type. <del> comments : str or sequence, optional <add> comments : str or sequence of str, optional <ide> The characters or list of characters used to indicate the start of a <del> comment; <del> default: '#'. <add> comment. For backwards compatibility, byte strings will be decoded as <add> 'latin1'. The default is '#'. <ide> delimiter : str, optional <del> The string used to separate values. By default, this is any <del> whitespace. <add> The string used to separate values. For backwards compatibility, byte <add> strings will be decoded as 'latin1'. The default is whitespace. <ide> converters : dict, optional <ide> A dictionary mapping column number to a function that will convert <ide> that column to a float. E.g., if column 0 is a date string: <ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None, <ide> ``converters = {3: lambda s: float(s.strip() or 0)}``. Default: None. <ide> skiprows : int, optional <ide> Skip the first `skiprows` lines; default: 0. <del> <ide> usecols : int or sequence, optional <ide> Which columns to read, with 0 being the first. For example, <ide> usecols = (1,4,5) will extract the 2nd, 5th and 6th columns. <ide> The default, None, results in all columns being read. <ide> <del> .. versionadded:: 1.11.0 <del> <del> Also when a single column has to be read it is possible to use <del> an integer instead of a tuple. E.g ``usecols = 3`` reads the <del> fourth column the same way as `usecols = (3,)`` would. <del> <add> .. versionchanged:: 1.11.0 <add> When a single column has to be read it is possible to use <add> an integer instead of a tuple. E.g ``usecols = 3`` reads the <add> fourth column the same way as `usecols = (3,)`` would. <ide> unpack : bool, optional <ide> If True, the returned array is transposed, so that arguments may be <ide> unpacked using ``x, y, z = loadtxt(...)``. When used with a structured <ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None, <ide> if comments is not None: <ide> if isinstance(comments, (basestring, bytes)): <ide> comments = [comments] <del> <ide> comments = [_decode_line(x) for x in comments] <del> <ide> # Compile regex for comments beforehand <ide> comments = (re.escape(comment) for comment in comments) <ide> regex_comments = re.compile('|'.join(comments)) <add> <add> if delimiter is not None: <add> delimiter = _decode_line(delimiter) <add> <ide> user_converters = converters <ide> <ide> if encoding == 'bytes': <ide> def read_data(chunk_size): <ide> # Unused converter specified <ide> continue <ide> if byte_converters: <del> # converters may use decode to workaround numpy's oldd behaviour, <add> # converters may use decode to workaround numpy's old behaviour, <ide> # so encode the string again before passing to the user converter <ide> def tobytes_first(x, conv): <ide> if type(x) is bytes: <ide> def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', <ide> ``numpy.loadtxt``. <ide> <ide> .. versionadded:: 1.7.0 <del> encoding : str, optional <add> encoding : {None, str}, optional <ide> Encoding used to encode the outputfile. Does not apply to output <del> streams. <add> streams. If the encoding is something other than 'bytes' or 'latin1' <add> you will not be able to load the file in NumPy versions < 1.14. Default <add> is 'latin1'. <ide> <ide> .. versionadded:: 1.14.0 <ide> <ide> def genfromtxt(fname, dtype=float, comments='#', delimiter=None, <ide> if conv is bytes: <ide> user_conv = asbytes <ide> elif byte_converters: <del> # converters may use decode to workaround numpy's oldd behaviour, <add> # converters may use decode to workaround numpy's old behaviour, <ide> # so encode the string again before passing to the user converter <ide> def tobytes_first(x, conv): <ide> if type(x) is bytes: <ide> def tobytes_first(x, conv): <ide> user_converters.update(uc_update) <ide> <ide> # Fixme: possible error as following variable never used. <del> #miss_chars = [_.missing_values for _ in converters] <add> # miss_chars = [_.missing_values for _ in converters] <ide> <ide> # Initialize the output lists ... <ide> # ... rows <ide> def tobytes_first(x, conv): <ide> strcolidx = [i for (i, v) in enumerate(column_types) <ide> if v == np.unicode_] <ide> <del> typestr = 'U' <add> type_str = np.unicode_ <ide> if byte_converters and strcolidx: <ide> # convert strings back to bytes for backward compatibility <ide> warnings.warn( <del> "Reading strings without specifying the encoding argument is " <del> "deprecated. Set encoding, use None for the system default.", <add> "Reading unicode strings without specifying the encoding " <add> "argument is deprecated. Set the encoding, use None for the " <add> "system default.", <ide> np.VisibleDeprecationWarning, stacklevel=2) <add> def encode_unicode_cols(row_tup): <add> row = list(row_tup) <add> for i in strcolidx: <add> row[i] = row[i].encode('latin1') <add> return tuple(row) <add> <ide> try: <del> for j in range(len(data)): <del> row = list(data[j]) <del> for i in strcolidx: <del> row[i] = row[i].encode('latin1') <del> data[j] = tuple(row) <del> typestr = 'S' <add> data = [encode_unicode_cols(r) for r in data] <add> type_str = np.bytes_ <ide> except UnicodeEncodeError: <del> # we must use unicode, revert encoding <del> for k in range(0, j + 1): <del> row = list(data[k]) <del> for i in strcolidx: <del> if isinstance(row[i], bytes): <del> row[i] = row[i].decode('latin1') <del> data[k] = tuple(row) <add> pass <add> <ide> <ide> # ... and take the largest number of chars. <ide> for i in strcolidx: <del> column_types[i] = "|%s%i" % (typestr, max(len(row[i]) for row in data)) <add> max_line_length = max(len(row[i]) for row in data) <add> column_types[i] = np.dtype((type_str, max_line_length)) <ide> # <ide> if names is None: <ide> # If the dtype is uniform, don't define names, else use '' <ide> base = set([c.type for c in converters if c._checked]) <ide> if len(base) == 1: <ide> if strcolidx: <del> (ddtype, mdtype) = (typestr, bool) <add> (ddtype, mdtype) = (type_str, bool) <ide> else: <ide> (ddtype, mdtype) = (list(base)[0], bool) <ide> else: <ide> def tobytes_first(x, conv): <ide> # Try to take care of the missing data we missed <ide> names = output.dtype.names <ide> if usemask and names: <del> for (name, conv) in zip(names or (), converters): <add> for (name, conv) in zip(names, converters): <ide> missing_values = [conv(_) for _ in conv.missing_values <ide> if _ != ''] <ide> for mval in missing_values: <ide><path>numpy/lib/tests/test__iotools.py <ide> def test_validate_wo_names(self): <ide> <ide> <ide> def _bytes_to_date(s): <del> if type(s) == bytes: <del> s = s.decode("latin1") <ide> return date(*time.strptime(s, "%Y-%m-%d")[:3]) <ide> <ide>
4
Ruby
Ruby
fix a typo
2c96638c70e98058bee29c9f8b9d1d181b9dce9e
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb <ide> def checkout_and_verify(c) <ide> # <ide> # Normally there is only a single ConnectionHandler instance, accessible via <ide> # ActiveRecord::Base.connection_handler. Active Record models use this to <del> # determine that connection pool that they should use. <add> # determine the connection pool that they should use. <ide> class ConnectionHandler <ide> def initialize <ide> @owner_to_pool = Hash.new { |h,k| h[k] = {} }
1
Javascript
Javascript
remove extra process.exit()
768287489a6d8feb956e8b9f004b08e1b11d62c5
<ide><path>test/parallel/test-http2-connect-options.js <ide> server.listen(0, '127.0.0.1', common.mustCall(() => { <ide> client.close(); <ide> req.close(); <ide> server.close(); <del> process.exit(); <ide> })); <ide> req.end(); <ide> }));
1
Javascript
Javascript
remove error.message from toast
42f9b6fc150fb35ff5c5cddb768f18685c1146f0
<ide><path>client/epics/err-epic.js <ide> export default function errorSaga(actions) { <ide> return actions.filter(({ error }) => !!error) <ide> .map(({ error }) => error) <ide> .doOnNext(error => console.error(error)) <del> .map(error => makeToast({ <del> message: error.message || 'Something went wrong, please try again later' <add> .map(() => makeToast({ <add> message: 'Something went wrong, please try again later' <ide> })); <ide> }
1
Javascript
Javascript
remove existential types from xplat/js
afe0c1daea0aaf7b40b7ded08d6eb6d45b17099c
<ide><path>Libraries/Blob/FileReader.js <ide> class FileReader extends (EventTarget(...READER_EVENTS): any) { <ide> _error: ?Error; <ide> _result: ?ReaderResult; <ide> _aborted: boolean = false; <del> _subscriptions: Array<*> = []; <add> _subscriptions: Array<any> = []; <ide> <ide> constructor() { <ide> super(); <ide><path>Libraries/Lists/VirtualizedList.js <ide> class VirtualizedList extends React.PureComponent<Props, State> { <ide> <ide> type CellRendererProps = { <ide> CellRendererComponent?: ?React.ComponentType<any>, <del> ItemSeparatorComponent: ?React.ComponentType<*>, <add> ItemSeparatorComponent: ?React.ComponentType< <add> any | {highlighted: boolean, leadingItem: ?Item}, <add> >, <ide> cellKey: string, <ide> fillRateHelper: FillRateHelper, <ide> horizontal: ?boolean, <ide><path>Libraries/Lists/__flowtests__/SectionList-flowtest.js <ide> module.exports = { <ide> ]; <ide> }, <ide> <del> testBadInheritedDefaultProp(): React.Element<*> { <add> testBadInheritedDefaultProp(): React.MixedElement { <ide> const sections = []; <ide> return ( <ide> <SectionList <ide> module.exports = { <ide> ); <ide> }, <ide> <del> testMissingData(): React.Element<*> { <add> testMissingData(): React.MixedElement { <ide> // $FlowExpectedError - missing `sections` prop <ide> return <SectionList renderItem={renderMyListItem} />; <ide> }, <ide> <del> testBadSectionsShape(): React.Element<*> { <add> testBadSectionsShape(): React.MixedElement { <ide> const sections = [ <ide> { <ide> key: 'a', <ide> module.exports = { <ide> return <SectionList renderItem={renderMyListItem} sections={sections} />; <ide> }, <ide> <del> testBadSectionsMetadata(): React.Element<*> { <add> testBadSectionsMetadata(): React.MixedElement { <ide> const sections = [ <ide> { <ide> key: 'a', <ide><path>Libraries/Network/XMLHttpRequest.js <ide> <ide> 'use strict'; <ide> <add>import {type EventSubscription} from '../vendor/emitter/EventEmitter'; <add> <ide> import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger'; <ide> <ide> const BlobManager = require('../Blob/BlobManager'); <ide> class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { <ide> upload: XMLHttpRequestEventTarget = new XMLHttpRequestEventTarget(); <ide> <ide> _requestId: ?number; <del> _subscriptions: Array<*>; <add> _subscriptions: Array<EventSubscription>; <ide> <ide> _aborted: boolean = false; <ide> _cachedResponse: Response; <ide><path>Libraries/ReactNative/AppRegistry.js <ide> export type Registry = { <ide> runnables: Runnables, <ide> ... <ide> }; <del>export type WrapperComponentProvider = any => React$ComponentType<*>; <add>export type WrapperComponentProvider = any => React$ComponentType<any>; <ide> <ide> const runnables: Runnables = {}; <ide> let runCount = 1; <ide><path>Libraries/ReactNative/renderApplication.js <ide> function renderApplication<Props: Object>( <ide> RootComponent: React.ComponentType<Props>, <ide> initialProps: Props, <ide> rootTag: any, <del> WrapperComponent?: ?React.ComponentType<*>, <add> WrapperComponent?: ?React.ComponentType<any>, <ide> fabric?: boolean, <ide> showArchitectureIndicator?: boolean, <ide> scopedPerformanceLogger?: IPerformanceLogger, <ide><path>Libraries/ReactPrivate/ReactNativePrivateInterface.js <ide> module.exports = { <ide> return require('../Utilities/differ/deepDiffer'); <ide> }, <ide> get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev< <del> // $FlowFixMe[deprecated-type] - can't properly parameterize the getter's type <del> *, <add> {...} | Array<mixed>, <ide> > { <ide> return require('../Utilities/deepFreezeAndThrowOnMutationInDev'); <ide> }, <ide><path>packages/rn-tester/js/components/TextInlineView.js <ide> type ChangeSizeState = {| <ide> width: number, <ide> |}; <ide> <del>class ChangeImageSize extends React.Component<*, ChangeSizeState> { <add>class ChangeImageSize extends React.Component<mixed, ChangeSizeState> { <ide> state: ChangeSizeState = { <ide> width: 50, <ide> }; <ide> class ChangeImageSize extends React.Component<*, ChangeSizeState> { <ide> } <ide> } <ide> <del>class ChangeViewSize extends React.Component<*, ChangeSizeState> { <add>class ChangeViewSize extends React.Component<mixed, ChangeSizeState> { <ide> state: ChangeSizeState = { <ide> width: 50, <ide> }; <ide> class ChangeViewSize extends React.Component<*, ChangeSizeState> { <ide> } <ide> } <ide> <del>class ChangeInnerViewSize extends React.Component<*, ChangeSizeState> { <add>class ChangeInnerViewSize extends React.Component<mixed, ChangeSizeState> { <ide> state: ChangeSizeState = { <ide> width: 50, <ide> }; <ide><path>packages/rn-tester/js/examples/MultiColumn/MultiColumnExample.js <ide> class MultiColumnExample extends React.PureComponent< <ide> changed: Array<{ <ide> key: string, <ide> isViewable: boolean, <del> item: {columns: Array<*>, ...}, <add> item: {columns: Array<any>, ...}, <ide> index: ?number, <ide> section?: any, <ide> ... <ide><path>packages/rn-tester/js/examples/RTL/RTLExample.js <ide> type RTLSwitcherComponentState = {| <ide> |}; <ide> <ide> function withRTLState(Component) { <del> return class extends React.Component<*, RTLSwitcherComponentState> { <add> return class extends React.Component< <add> {style?: any}, <add> RTLSwitcherComponentState, <add> > { <ide> constructor(...args) { <ide> super(...args); <ide> this.state = { <ide> exports.examples = [ <ide> description: ('In iOS, it depends on active language. ' + <ide> 'In Android, it depends on the text content.': string), <ide> render: function(): React.Element<any> { <add> // $FlowFixMe[speculation-ambiguous] <ide> return <TextAlignmentExample style={styles.fontSizeSmall} />; <ide> }, <ide> }, <ide> exports.examples = [ <ide> 'languages or text content.': string), <ide> render: function(): React.Element<any> { <ide> return ( <add> // $FlowFixMe[speculation-ambiguous] <ide> <TextAlignmentExample <ide> style={[styles.fontSizeSmall, styles.textAlignLeft]} <ide> /> <ide> exports.examples = [ <ide> 'languages or text content.': string), <ide> render: function(): React.Element<any> { <ide> return ( <add> // $FlowFixMe[speculation-ambiguous] <ide> <TextAlignmentExample <ide> style={[styles.fontSizeSmall, styles.textAlignRight]} <ide> /> <ide> exports.examples = [ <ide> title: "Using textAlign: 'right' for TextInput", <ide> description: ('Flip TextInput direction to RTL': string), <ide> render: function(): React.Element<any> { <add> // $FlowFixMe[speculation-ambiguous] <ide> return <TextInputExample style={[styles.textAlignRight]} />; <ide> }, <ide> }, <ide><path>packages/rn-tester/js/examples/SectionList/SectionList-scrollable.js <ide> export function SectionList_scrollable(Props: { <ide> changed: Array<{ <ide> key: string, <ide> isViewable: boolean, <del> item: {columns: Array<*>, ...}, <add> item: {columns: Array<any>, ...}, <ide> index: ?number, <ide> section?: any, <ide> ... <ide><path>packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js <ide> class WithLabel extends React.Component<$FlowFixMeProps> { <ide> <ide> class TextInputAccessoryViewChangeTextExample extends React.Component< <ide> {...}, <del> *, <add> {text: string}, <ide> > { <ide> constructor(props) { <ide> super(props); <ide> class TextInputAccessoryViewChangeTextExample extends React.Component< <ide> <ide> class TextInputAccessoryViewChangeKeyboardExample extends React.Component< <ide> {...}, <del> *, <add> {keyboardType: string, text: string}, <ide> > { <ide> constructor(props) { <ide> super(props); <ide> class TextInputAccessoryViewChangeKeyboardExample extends React.Component< <ide> inputAccessoryViewID={inputAccessoryViewID} <ide> onChangeText={text => this.setState({text})} <ide> value={this.state.text} <add> // $FlowFixMe[incompatible-type] <ide> keyboardType={this.state.keyboardType} <ide> returnKeyType="done" <ide> /> <ide> class TextInputAccessoryViewDefaultDoneButtonExample extends React.Component< <ide> $ReadOnly<{| <ide> keyboardType: KeyboardType, <ide> |}>, <del> *, <add> {text: string}, <ide> > { <ide> constructor(props) { <ide> super(props);
12
Text
Text
fix typo in ac overview guide [ci skip]
57c516f77587ba032600968da52c1b279e18c8fa
<ide><path>guides/source/action_controller_overview.md <ide> root-key because normally it does not exist when calling `new`: <ide> ```ruby <ide> # using `fetch` you can supply a default and use <ide> # the Strong Parameters API from there. <del>params.fetch(blog:, {}).permit(:title, :author) <add>params.fetch(:blog, {}).permit(:title, :author) <ide> ``` <ide> <ide> `accepts_nested_attributes_for` allows you update and destroy the
1
Text
Text
fix backticks in docs
fa3b374c8ad1d589d232abba3b6809993428b57b
<ide><path>website/docs/api/tokenizer.md <ide> it. <ide> <ide> ## Attributes {#attributes} <ide> <del>| Name | Type | Description | <del>| ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | <del>| `vocab` | `Vocab` | The vocab object of the parent `Doc`. | <del>| `prefix_search` | - | A function to find segment boundaries from the start of a string. Returns the length of the segment, or `None`. | <del>| `suffix_search` | - | A function to find segment boundaries from the end of a string. Returns the length of the segment, or `None`. | <del>| `infix_finditer` | - | A function to find internal segment separators, e.g. hyphens. Returns a (possibly empty) list of `re.MatchObject` objects. | <del>| `token_match` | - | A function matching the signature of `re.compile(string).match to find token matches. Returns an`re.MatchObject`or`None. | <del>| `rules` | dict | A dictionary of tokenizer exceptions and special cases. | <add>| Name | Type | Description | <add>| ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- | <add>| `vocab` | `Vocab` | The vocab object of the parent `Doc`. | <add>| `prefix_search` | - | A function to find segment boundaries from the start of a string. Returns the length of the segment, or `None`. | <add>| `suffix_search` | - | A function to find segment boundaries from the end of a string. Returns the length of the segment, or `None`. | <add>| `infix_finditer` | - | A function to find internal segment separators, e.g. hyphens. Returns a (possibly empty) list of `re.MatchObject` objects. | <add>| `token_match` | - | A function matching the signature of `re.compile(string).match` to find token matches. Returns an `re.MatchObject` or `None`. | <add>| `rules` | dict | A dictionary of tokenizer exceptions and special cases. | <ide> <ide> ## Serialization fields {#serialization-fields} <ide>
1
Ruby
Ruby
fix rubocop warnings
e6b057ea76756fa02ee059febf779aec7759f3e3
<ide><path>Library/Homebrew/dev-cmd/edit.rb <ide> def edit <ide> <ide> def library_folders <ide> Dir["#{HOMEBREW_LIBRARY}/*"].reject do |d| <del> case File.basename(d) when "LinkedKegs", "Aliases" then true end <add> case File.basename(d) <add> when "LinkedKegs", "Aliases" then true <add> end <ide> end <ide> end <ide> end
1
Text
Text
add @tamakisquare for work on
daf927ef68ce992055e8b7bc1a07cf03ee67b742
<ide><path>docs/topics/credits.md <ide> The following people have helped make REST framework great. <ide> * Markus Kaiserswerth - [mkai] <ide> * Henry Clifford - [hcliff] <ide> * Thomas Badaud - [badale] <add>* Colin Huang - [tamakisquare] <ide> <ide> Many thanks to everyone who's contributed to the project. <ide> <ide> You can also contact [@_tomchristie][twitter] directly on twitter. <ide> [mkai]: https://github.com/mkai <ide> [hcliff]: https://github.com/hcliff <ide> [badale]: https://github.com/badale <add>[tamakisquare]: https://github.com/tamakisquare
1
Text
Text
fix typo in the wsl setup guide
9ab7b2623f7b09eb83e10c27b05009d03b6c2c2c
<ide><path>docs/how-to-setup-wsl.md <ide> You can check these settings by going to Settings > Languages & Frameworks > Nod <ide> <ide> **Docker Desktop for Windows** allows you to install and run databases like MongoDB and other services like NGINX and more. This is useful to avoid common pitfalls with installing MongoDB or other services directly on Windows or WSL2. <ide> <del>Follow the instructuction on the [official documentation](https://docs.docker.com/docker-for-windows/install) and install Docker Desktop for your Windows distribution. <add>Follow the instructions on the [official documentation](https://docs.docker.com/docker-for-windows/install) and install Docker Desktop for your Windows distribution. <ide> <ide> There are some minimum hardware requirements for the best experience. <ide>
1
Python
Python
add python 3.3 classifier
41171d11ae37c4dfae79f17e1477b7bf8bdc034a
<ide><path>setup.py <ide> def run(self): <ide> 'Programming Language :: Python', <ide> 'Programming Language :: Python :: 2.6', <ide> 'Programming Language :: Python :: 2.7', <add> 'Programming Language :: Python :: 3.3', <ide> 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', <ide> 'Topic :: Software Development :: Libraries :: Python Modules' <ide> ],
1
Python
Python
check nan during training loop
14efeaa5dadb5d78f96a816b521f78aee7dce21f
<ide><path>official/modeling/training/distributed_executor.py <ide> import json <ide> import os <ide> <add>import numpy as np <ide> from absl import flags <ide> from absl import logging <ide> import tensorflow as tf <ide> def _run_callbacks_on_batch_end(batch): <ide> train_loss) <ide> if not isinstance(train_loss, dict): <ide> train_loss = {'total_loss': train_loss} <add> if np.isnan(train_loss['total_loss']): <add> raise ValueError('total loss is NaN.') <ide> <ide> if train_metric: <ide> train_metric_result = train_metric.result()
1
Python
Python
fix filtering in test fetcher utils
5e3b4a70d3d17f2482d50aea230f7ed42b3a8fd0
<ide><path>utils/tests_fetcher.py <ide> def infer_tests_to_run(output_file, diff_with_last_commit=False, filters=None): <ide> # Make sure we did not end up with a test file that was removed <ide> test_files_to_run = [f for f in test_files_to_run if os.path.isfile(f) or os.path.isdir(f)] <ide> if filters is not None: <add> filtered_files = [] <ide> for filter in filters: <del> test_files_to_run = [f for f in test_files_to_run if f.startswith(filter)] <add> filtered_files.extend([f for f in test_files_to_run if f.startswith(filter)]) <add> test_files_to_run = filtered_files <ide> <ide> print(f"\n### TEST TO RUN ###\n{_print_list(test_files_to_run)}") <ide> if len(test_files_to_run) > 0:
1
Go
Go
fix same issue in api.go
a7068510a5ee4af6776221ba00bc332266f97088
<ide><path>api.go <ide> func postBuild(srv *Server, version float64, w http.ResponseWriter, r *http.Requ <ide> remoteURL := r.FormValue("remote") <ide> repoName := r.FormValue("t") <ide> rawSuppressOutput := r.FormValue("q") <del> tag := "" <del> if strings.Contains(repoName, ":") { <del> remoteParts := strings.Split(repoName, ":") <del> tag = remoteParts[1] <del> repoName = remoteParts[0] <del> } <add> repoName, tag := utils.ParseRepositoryTag(repoName) <ide> <ide> var context io.Reader <ide>
1
Java
Java
remove createmountitem code
d451c032844b7ca9691f391356653c920e68b725
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java <ide> import com.facebook.react.fabric.mounting.MountingManager; <ide> import com.facebook.react.fabric.mounting.ViewPool; <ide> import com.facebook.react.fabric.mounting.mountitems.BatchMountItem; <del>import com.facebook.react.fabric.mounting.mountitems.CreateMountItem; <ide> import com.facebook.react.fabric.mounting.mountitems.DeleteMountItem; <ide> import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem; <ide> import com.facebook.react.fabric.mounting.mountitems.InsertMountItem; <ide> private static void loadClasses() { <ide> FabricUIManager.class.getClass(); <ide> GuardedFrameCallback.class.getClass(); <ide> BatchMountItem.class.getClass(); <del> CreateMountItem.class.getClass(); <ide> DeleteMountItem.class.getClass(); <ide> DispatchCommandMountItem.class.getClass(); <ide> InsertMountItem.class.getClass(); <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> import com.facebook.react.fabric.jsi.FabricSoLoader; <ide> import com.facebook.react.fabric.mounting.MountingManager; <ide> import com.facebook.react.fabric.mounting.mountitems.BatchMountItem; <del>import com.facebook.react.fabric.mounting.mountitems.CreateMountItem; <ide> import com.facebook.react.fabric.mounting.mountitems.DeleteMountItem; <ide> import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem; <ide> import com.facebook.react.fabric.mounting.mountitems.InsertMountItem; <ide> public void removeRootView(int reactRootTag) { <ide> mMountingManager.removeRootView(reactRootTag); <ide> mReactContextForRootTag.remove(reactRootTag); <ide> } <del> <del> @DoNotStrip <del> @SuppressWarnings("unused") <del> private MountItem createMountItem( <del> String componentName, int reactRootTag, int reactTag, boolean isVirtual, ReadableMap props) { <del> String component = sComponentNames.get(componentName); <del> if (component == null) { <del> throw new IllegalArgumentException("Unable to find component with name " + componentName); <del> } <del> ThemedReactContext reactContext = mReactContextForRootTag.get(reactRootTag); <del> if (reactContext == null) { <del> throw new IllegalArgumentException("Unable to find ReactContext for root: " + reactRootTag); <del> } <del> return new CreateMountItem(reactContext, component, reactTag, isVirtual, props); <del> } <del> <add> <ide> @Override <ide> public void initialize() { <ide> mEventDispatcher.registerEventEmitter(FABRIC, new FabricEventEmitter(this)); <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/CreateMountItem.java <del>/** <del> * Copyright (c) 2014-present, Facebook, Inc. <del> * <del> * <p>This source code is licensed under the MIT license found in the LICENSE file in the root <del> * directory of this source tree. <del> */ <del>package com.facebook.react.fabric.mounting.mountitems; <del> <del>import com.facebook.react.bridge.ReadableMap; <del>import com.facebook.react.fabric.mounting.MountingManager; <del>import com.facebook.react.uimanager.ThemedReactContext; <del> <del>public class CreateMountItem implements MountItem { <del> <del> private final String mComponentName; <del> private final int mReactTag; <del> private final ThemedReactContext mThemedReactContext; <del> private final boolean mIsVirtual; <del> private final ReadableMap mProps; <del> <del> public CreateMountItem( <del> ThemedReactContext themedReactContext, <del> String componentName, <del> int reactTag, <del> boolean isVirtual, <del> ReadableMap props) { <del> mReactTag = reactTag; <del> mThemedReactContext = themedReactContext; <del> mComponentName = componentName; <del> mIsVirtual = isVirtual; <del> mProps = props; <del> } <del> <del> @Override <del> public void execute(MountingManager mountingManager) { <del> mountingManager.createView(mThemedReactContext, mComponentName, mReactTag, mIsVirtual); <del> if (mProps != null && !mIsVirtual) { <del> mountingManager.updateProps(mReactTag, mProps); <del> } <del> } <del> <del> public String getComponentName() { <del> return mComponentName; <del> } <del> <del> public ThemedReactContext getThemedReactContext() { <del> return mThemedReactContext; <del> } <del> <del> @Override <del> public String toString() { <del> return "CreateMountItem [" + mReactTag + "] " + mComponentName; <del> } <del>}
3
Javascript
Javascript
fix mini typo in with-cookie-auth-fauna-example
1a3adaa5d93730ad9d5fbffbf368d1526007fc3e
<ide><path>examples/with-cookie-auth-fauna/pages/api/signup.js <ide> import { query as q } from 'faunadb' <ide> import { serverClient, serializeFaunaCookie } from '../../utils/fauna-auth' <ide> <del>export default async function signuo(req, res) { <add>export default async function signup(req, res) { <ide> const { email, password } = await req.body <ide> <ide> try {
1
Python
Python
fix distilbert in auto tokenizer
bfe93a5a21a77e0a0f9b35132810aab9d0b1f04c
<ide><path>pytorch_transformers/tokenization_auto.py <ide> def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs): <ide> <ide> Examples:: <ide> <del> config = AutoTokenizer.from_pretrained('bert-base-uncased') # Download vocabulary from S3 and cache. <del> config = AutoTokenizer.from_pretrained('./test/bert_saved_model/') # E.g. tokenizer was saved using `save_pretrained('./test/saved_model/')` <add> tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased') # Download vocabulary from S3 and cache. <add> tokenizer = AutoTokenizer.from_pretrained('./test/bert_saved_model/') # E.g. tokenizer was saved using `save_pretrained('./test/saved_model/')` <ide> <ide> """ <ide> if 'distilbert' in pretrained_model_name_or_path: <ide> return DistilBertTokenizer.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs) <del> if 'roberta' in pretrained_model_name_or_path: <add> elif 'roberta' in pretrained_model_name_or_path: <ide> return RobertaTokenizer.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs) <ide> elif 'bert' in pretrained_model_name_or_path: <ide> return BertTokenizer.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
1
Mixed
Javascript
change common.expectserror() signature
c2e838ee13244dd3dbd98ed86ef1966fe7cd90f1
<ide><path>test/README.md <ide> Platform normalizes the `dd` command <ide> <ide> Check if there is more than 1gb of total memory. <ide> <del>### expectsError(code[, type[, message]]) <del>* `code` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <del> expected error must have this value for its `code` property <del>* `type` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) <del> expected error must be an instance of `type` <del>* `message` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <del> or [&lt;RegExp>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) <del> if a string is provided for `message`, expected error must have it for its <del> `message` property; if a regular expression is provided for `message`, the <del> regular expression must match the `message` property of the expected error <add>### expectsError(settings) <add>* `settings` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add> with the following optional properties: <add> * `code` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> expected error must have this value for its `code` property <add> * `type` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) <add> expected error must be an instance of `type` <add> * `message` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> or [&lt;RegExp>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) <add> if a string is provided for `message`, expected error must have it for its <add> `message` property; if a regular expression is provided for `message`, the <add> regular expression must match the `message` property of the expected error <ide> <ide> * return function suitable for use as a validation function passed as the second <ide> argument to `assert.throws()` <ide><path>test/common.js <ide> exports.WPT = { <ide> }; <ide> <ide> // Useful for testing expected internal/error objects <del>exports.expectsError = function expectsError(code, type, message) { <add>exports.expectsError = function expectsError({code, type, message}) { <ide> return function(error) { <ide> assert.strictEqual(error.code, code); <ide> if (type !== undefined) <ide><path>test/parallel/test-debug-agent.js <ide> const debug = require('_debug_agent'); <ide> <ide> assert.throws( <ide> () => { debug.start(); }, <del> common.expectsError( <del> undefined, <del> assert.AssertionError, <del> 'Debugger agent running without bindings!' <del> ) <add> common.expectsError({ type: assert.AssertionError, <add> message: 'Debugger agent running without bindings!' }) <ide> ); <ide><path>test/parallel/test-http-request-invalid-method-error.js <ide> const http = require('http'); <ide> <ide> assert.throws( <ide> () => { http.request({method: '\0'}); }, <del> common.expectsError(undefined, TypeError, 'Method must be a valid HTTP token') <add> common.expectsError({ type: TypeError, <add> message: 'Method must be a valid HTTP token' }) <ide> ); <ide><path>test/parallel/test-internal-errors.js <ide> assert.throws( <ide> assert.doesNotThrow(() => { <ide> assert.throws(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, common.expectsError('TEST_ERROR_1')); <add> }, common.expectsError({ code: 'TEST_ERROR_1' })); <ide> }); <ide> <ide> assert.doesNotThrow(() => { <ide> assert.throws(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, common.expectsError('TEST_ERROR_1', TypeError, /^Error for testing/)); <add> }, common.expectsError({ code: 'TEST_ERROR_1', <add> type: TypeError, <add> message: /^Error for testing/ })); <ide> }); <ide> <ide> assert.doesNotThrow(() => { <ide> assert.throws(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, common.expectsError('TEST_ERROR_1', TypeError)); <add> }, common.expectsError({ code: 'TEST_ERROR_1', type: TypeError })); <ide> }); <ide> <ide> assert.doesNotThrow(() => { <ide> assert.throws(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, common.expectsError('TEST_ERROR_1', Error)); <add> }, common.expectsError({ code: 'TEST_ERROR_1', type: Error })); <ide> }); <ide> <ide> assert.throws(() => { <ide> assert.throws(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, common.expectsError('TEST_ERROR_1', RangeError)); <add> }, common.expectsError({ code: 'TEST_ERROR_1', type: RangeError })); <ide> }, /^AssertionError: .+ is not the expected type \S/); <ide> <ide> assert.throws(() => { <ide> assert.throws(() => { <ide> throw new errors.TypeError('TEST_ERROR_1', 'a'); <del> }, common.expectsError('TEST_ERROR_1', TypeError, /^Error for testing 2/)); <add> }, common.expectsError({ code: 'TEST_ERROR_1', <add> type: TypeError, <add> message: /^Error for testing 2/ })); <ide> }, /AssertionError: .+ does not match \S/); <ide><path>test/parallel/test-require-invalid-package.js <ide> const assert = require('assert'); <ide> <ide> // Should be an invalid package path. <ide> assert.throws(() => require('package.json'), <del> common.expectsError('MODULE_NOT_FOUND') <add> common.expectsError({ code: 'MODULE_NOT_FOUND' }) <ide> );
6
Python
Python
remove debug code
cd034c8c3428957170f9f6ce3df1ba418c0306d1
<ide><path>official/resnet/keras/keras_common.py <ide> def get_optimizer_loss_and_metrics(): <ide> <ide> <ide> def get_dist_strategy(): <del> if True: # FLAGS.num_gpus == 1 and FLAGS.dist_strat_off: <add> if FLAGS.num_gpus == 1 and FLAGS.dist_strat_off: <ide> print('Not using distribution strategies.') <ide> strategy = None <ide> else:
1
Ruby
Ruby
fix tests for the request refactor
eb49bd694997954783632eada901553f041c9507
<ide><path>actionpack/test/controller/caching_test.rb <ide> def setup <ide> <ide> @request = ActionController::TestRequest.new <ide> @request.host = 'hostname.com' <add> @request.env.delete('PATH_INFO') <ide> <ide> @response = ActionController::TestResponse.new <ide> @controller = PageCachingTestController.new <ide> def test_should_cache_with_trailing_slash_on_url <ide> end <ide> <ide> def test_should_cache_ok_at_custom_path <del> @request.request_uri = "/index.html" <add> @request.env['PATH_INFO'] = '/index.html' <ide> get :ok <ide> assert_response :ok <ide> assert File.exist?("#{FILE_STORE_PATH}/index.html") <ide><path>actionpack/test/controller/test_test.rb <ide> def setup <ide> @controller = TestController.new <ide> @request = ActionController::TestRequest.new <ide> @response = ActionController::TestResponse.new <add> @request.env['PATH_INFO'] = nil <ide> end <ide> <ide> def test_raw_post_handling <ide> def test_process_with_request_uri_with_params <ide> end <ide> <ide> def test_process_with_request_uri_with_params_with_explicit_uri <del> @request.request_uri = "/explicit/uri" <add> @request.env['PATH_INFO'] = "/explicit/uri" <ide> process :test_uri, :id => 7 <ide> assert_equal "/explicit/uri", @response.body <ide> end <ide> def test_process_with_query_string <ide> end <ide> <ide> def test_process_with_query_string_with_explicit_uri <del> @request.request_uri = "/explicit/uri?q=test?extra=question" <add> @request.env['PATH_INFO'] = '/explicit/uri' <add> @request.env['QUERY_STRING'] = 'q=test?extra=question' <ide> process :test_query_string <ide> assert_equal "q=test?extra=question", @response.body <ide> end <ide><path>actionpack/test/template/url_helper_test.rb <ide> # encoding: utf-8 <ide> require 'abstract_unit' <add>require 'active_support/ordered_options' <ide> require 'controller/fake_controllers' <ide> <del>RequestMock = Struct.new("Request", :request_uri, :protocol, :host_with_port, :env) <del> <ide> class UrlHelperTest < ActionView::TestCase <ide> include ActiveSupport::Configurable <ide> DEFAULT_CONFIG = ActionView::DEFAULT_CONFIG <ide> def setup <ide> def url_for(options) <ide> url <ide> end <add> def config <add> ActiveSupport::InheritableOptions.new({}) <add> end <ide> end <add> <ide> @controller = @controller.new <add> @request = @controller.request = ActionDispatch::TestRequest.new <ide> @controller.url = "http://www.example.com" <ide> end <ide> <ide> def test_url_for_escapes_url_once <ide> end <ide> <ide> def test_url_for_with_back <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'}) <add> @request.env['HTTP_REFERER'] = 'http://www.example.com/referer' <ide> assert_equal 'http://www.example.com/referer', url_for(:back) <ide> end <ide> <ide> def test_url_for_with_back_and_no_referer <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {}) <add> @request.env['HOST_NAME'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <ide> assert_equal 'javascript:history.back()', url_for(:back) <ide> end <ide> <ide> def test_link_tag_with_query_and_no_name <ide> end <ide> <ide> def test_link_tag_with_back <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'}) <add> @request.env['HOST_NAME'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <add> @request.env['HTTP_REFERER'] = 'http://www.example.com/referer' <ide> assert_dom_equal "<a href=\"http://www.example.com/referer\">go back</a>", link_to('go back', :back) <ide> end <ide> <ide> def test_link_tag_with_back_and_no_referer <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {}) <add> @request.env['HOST_NAME'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <ide> assert_dom_equal "<a href=\"javascript:history.back()\">go back</a>", link_to('go back', :back) <ide> end <ide> <ide> def test_link_tag_with_back <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'}) <add> @request.env['HOST_NAME'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <add> @request.env['HTTP_REFERER'] = 'http://www.example.com/referer' <ide> assert_dom_equal "<a href=\"http://www.example.com/referer\">go back</a>", link_to('go back', :back) <ide> end <ide> <ide> def test_link_tag_with_back_and_no_referer <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {}) <add> @request.env['HOST_NAME'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <ide> assert_dom_equal "<a href=\"javascript:history.back()\">go back</a>", link_to('go back', :back) <ide> end <ide> <ide> def test_link_to_if <ide> end <ide> <ide> def test_current_page_with_simple_url <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show") <add> @request.env['HTTP_HOST'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <ide> @controller.url = "http://www.example.com/weblog/show" <ide> assert current_page?({ :action => "show", :controller => "weblog" }) <ide> assert current_page?("http://www.example.com/weblog/show") <ide> end <ide> <ide> def test_current_page_ignoring_params <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc&page=1") <add> @request.env['HTTP_HOST'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <add> @request.env['QUERY_STRING'] = 'order=desc&page=1' <ide> @controller.url = "http://www.example.com/weblog/show?order=desc&page=1" <ide> assert current_page?({ :action => "show", :controller => "weblog" }) <ide> assert current_page?("http://www.example.com/weblog/show") <ide> end <ide> <ide> def test_current_page_with_params_that_match <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc&page=1") <add> @request.env['HTTP_HOST'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <add> @request.env['QUERY_STRING'] = 'order=desc&page=1' <ide> @controller.url = "http://www.example.com/weblog/show?order=desc&page=1" <ide> assert current_page?({ :action => "show", :controller => "weblog", :order => "desc", :page => "1" }) <ide> assert current_page?("http://www.example.com/weblog/show?order=desc&amp;page=1") <ide> end <ide> <ide> def test_link_unless_current <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show") <add> @request.env['HTTP_HOST'] = 'www.example.com' <add> @request.env['PATH_INFO'] = '/weblog/show' <ide> @controller.url = "http://www.example.com/weblog/show" <ide> assert_equal "Showing", link_to_unless_current("Showing", { :action => "show", :controller => "weblog" }) <ide> assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/weblog/show") <ide> <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc") <add> @request.env['QUERY_STRING'] = 'order=desc' <ide> @controller.url = "http://www.example.com/weblog/show" <ide> assert_equal "Showing", link_to_unless_current("Showing", { :action => "show", :controller => "weblog" }) <ide> assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/weblog/show") <ide> <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc&page=1") <add> @request.env['QUERY_STRING'] = 'order=desc&page=1' <ide> @controller.url = "http://www.example.com/weblog/show?order=desc&page=1" <ide> assert_equal "Showing", link_to_unless_current("Showing", { :action => "show", :controller => "weblog", :order=>'desc', :page=>'1' }) <ide> assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/weblog/show?order=desc&page=1") <ide> assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/weblog/show?order=desc&page=1") <ide> <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc") <add> @request.env['QUERY_STRING'] = 'order=desc' <ide> @controller.url = "http://www.example.com/weblog/show?order=asc" <ide> assert_equal "<a href=\"http://www.example.com/weblog/show?order=asc\">Showing</a>", link_to_unless_current("Showing", { :action => "show", :controller => "weblog" }) <ide> assert_equal "<a href=\"http://www.example.com/weblog/show?order=asc\">Showing</a>", link_to_unless_current("Showing", "http://www.example.com/weblog/show?order=asc") <ide> <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show?order=desc&page=1") <add> @request.env['QUERY_STRING'] = 'order=desc&page=1' <ide> @controller.url = "http://www.example.com/weblog/show?order=desc&page=2" <ide> assert_equal "<a href=\"http://www.example.com/weblog/show?order=desc&page=2\">Showing</a>", link_to_unless_current("Showing", { :action => "show", :controller => "weblog" }) <ide> assert_equal "<a href=\"http://www.example.com/weblog/show?order=desc&amp;page=2\">Showing</a>", link_to_unless_current("Showing", "http://www.example.com/weblog/show?order=desc&page=2") <ide> <del> <del> @controller.request = RequestMock.new("http://www.example.com/weblog/show") <add> @request.env['QUERY_STRING'] = '' <ide> @controller.url = "http://www.example.com/weblog/list" <ide> assert_equal "<a href=\"http://www.example.com/weblog/list\">Listing</a>", <ide> link_to_unless_current("Listing", :action => "list", :controller => "weblog")
3