content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
PHP
PHP
remove use of logs constant for log package
2c4474aa3359b37b6730ce6461fee292303c45c4
<ide><path>src/Log/Engine/FileLog.php <ide> class FileLog extends BaseLog { <ide> * @var array <ide> */ <ide> protected $_defaultConfig = [ <del> 'path' => LOGS, <add> 'path' => null, <ide> 'file' => null, <ide> 'types' => null, <ide> 'levels' => [], <ide> public function __construct(array $config = []) { <ide> if (!empty($this->_config['path'])) { <ide> $this->_path = $this->_config['path']; <ide> } <del> if (Configure::read('debug') && !is_dir($this->_path)) { <add> if ($this->_path !== null && <add> Configure::read('debug') && <add> !is_dir($this->_path) <add> ) { <ide> mkdir($this->_path, 0775, true); <ide> } <ide> <ide><path>tests/TestCase/Log/Engine/FileLogTest.php <ide> class FileLogTest extends TestCase { <ide> public function testLogFileWriting() { <ide> $this->_deleteLogs(LOGS); <ide> <del> $log = new FileLog(); <add> $log = new FileLog(['path' => LOGS]); <ide> $log->log('warning', 'Test warning'); <ide> $this->assertTrue(file_exists(LOGS . 'error.log')); <ide> <ide><path>tests/TestCase/Log/LogTest.php <ide> public static function configProvider() { <ide> 'className' => 'File', <ide> 'path' => TMP . 'tests', <ide> ]], <del> 'Direct instance' => [new FileLog()], <add> 'Direct instance' => [new FileLog(['path' => LOGS])], <ide> ]; <ide> } <ide> <ide> public function testSelectiveLoggingByLevel() { <ide> } <ide> Log::config('spam', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => 'debug', <ide> 'file' => 'spam', <ide> )); <ide> Log::config('eggs', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('eggs', 'debug', 'error', 'warning'), <ide> 'file' => 'eggs', <ide> )); <ide> public function testSelectiveLoggingByLevel() { <ide> protected function _resetLogConfig() { <ide> Log::config('debug', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('notice', 'info', 'debug'), <ide> 'file' => 'debug', <ide> )); <ide> Log::config('error', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), <ide> 'file' => 'error', <ide> )); <ide> public function testScopedLogging() { <ide> $this->_resetLogConfig(); <ide> Log::config('shops', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('info', 'debug', 'warning'), <ide> 'scopes' => array('transactions', 'orders'), <ide> 'file' => 'shops', <ide> public function testConvenienceScopedLogging() { <ide> $this->_resetLogConfig(); <ide> Log::config('shops', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('info', 'debug', 'notice', 'warning'), <ide> 'scopes' => array('transactions', 'orders'), <ide> 'file' => 'shops', <ide> public function testScopedLoggingExclusive() { <ide> <ide> Log::config('shops', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('debug', 'notice', 'warning'), <ide> 'scopes' => array('transactions', 'orders'), <ide> 'file' => 'shops.log', <ide> )); <ide> Log::config('eggs', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('debug', 'notice', 'warning'), <ide> 'scopes' => array('eggs'), <ide> 'file' => 'eggs.log', <ide> public function testPassingScopeToEngine() { <ide> <ide> Log::config('scope_test', [ <ide> 'engine' => 'TestApp', <add> 'path' => LOGS, <ide> 'types' => array('notice', 'info', 'debug'), <ide> 'scopes' => array('foo', 'bar'), <ide> ]); <ide> public function testConvenienceMethods() { <ide> <ide> Log::config('debug', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('notice', 'info', 'debug'), <ide> 'file' => 'debug', <ide> )); <ide> Log::config('error', array( <ide> 'engine' => 'File', <add> 'path' => LOGS, <ide> 'types' => array('emergency', 'alert', 'critical', 'error', 'warning'), <ide> 'file' => 'error', <ide> ));
3
Java
Java
introduce tests for gh-28228
1d302bf38445e3db559c9618c5ede71ca74bea1a
<ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/JpaEntityListenerTests.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.test.context.junit.jupiter.orm; <add> <add>import java.util.List; <add> <add>import javax.persistence.EntityManager; <add>import javax.persistence.EntityManagerFactory; <add>import javax.persistence.PersistenceContext; <add>import javax.sql.DataSource; <add> <add>import org.junit.jupiter.api.BeforeEach; <add>import org.junit.jupiter.api.Test; <add> <add>import org.springframework.beans.factory.annotation.Autowired; <add>import org.springframework.context.annotation.Bean; <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.jdbc.core.JdbcTemplate; <add>import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; <add>import org.springframework.orm.jpa.JpaTransactionManager; <add>import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; <add>import org.springframework.orm.jpa.vendor.Database; <add>import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; <add>import org.springframework.test.context.jdbc.Sql; <add>import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; <add>import org.springframework.test.context.junit.jupiter.orm.domain.JpaPersonRepository; <add>import org.springframework.test.context.junit.jupiter.orm.domain.Person; <add>import org.springframework.test.context.junit.jupiter.orm.domain.PersonListener; <add>import org.springframework.test.context.junit.jupiter.orm.domain.PersonRepository; <add>import org.springframework.transaction.annotation.EnableTransactionManagement; <add>import org.springframework.transaction.annotation.Transactional; <add> <add>import static org.assertj.core.api.Assertions.assertThat; <add> <add>/** <add> * Transactional tests for JPA entity listener support (a.k.a. lifecycle callback <add> * methods). <add> * <add> * @author Sam Brannen <add> * @since 5.3.18 <add> * @see <a href="https://github.com/spring-projects/spring-framework/issues/28228">issue gh-28228</a> <add> * @see org.springframework.test.context.junit4.orm.HibernateSessionFlushingTests <add> */ <add>@SpringJUnitConfig <add>@Transactional <add>@Sql(statements = "insert into person(id, name) values(0, 'Jane')") <add>class JpaEntityListenerTests { <add> <add> @PersistenceContext <add> EntityManager entityManager; <add> <add> @Autowired <add> JdbcTemplate jdbcTemplate; <add> <add> @Autowired <add> PersonRepository repo; <add> <add> <add> @BeforeEach <add> void setUp() { <add> assertPeople("Jane"); <add> PersonListener.methodsInvoked.clear(); <add> } <add> <add> @Test <add> void find() { <add> Person jane = repo.findByName("Jane"); <add> assertCallbacks("@PostLoad: Jane"); <add> <add> // Does not cause an additional @PostLoad <add> repo.findById(jane.getId()); <add> assertCallbacks("@PostLoad: Jane"); <add> <add> // Clear to cause a new @PostLoad <add> entityManager.clear(); <add> repo.findById(jane.getId()); <add> assertCallbacks("@PostLoad: Jane", "@PostLoad: Jane"); <add> } <add> <add> @Test <add> void save() { <add> Person john = repo.save(new Person("John")); <add> assertCallbacks("@PrePersist: John"); <add> <add> // Flush to cause a @PostPersist <add> entityManager.flush(); <add> assertPeople("Jane", "John"); <add> assertCallbacks("@PrePersist: John", "@PostPersist: John"); <add> <add> // Does not cause a @PostLoad <add> repo.findById(john.getId()); <add> assertCallbacks("@PrePersist: John", "@PostPersist: John"); <add> <add> // Clear to cause a @PostLoad <add> entityManager.clear(); <add> repo.findById(john.getId()); <add> assertCallbacks("@PrePersist: John", "@PostPersist: John", "@PostLoad: John"); <add> } <add> <add> @Test <add> void update() { <add> Person jane = repo.findByName("Jane"); <add> assertCallbacks("@PostLoad: Jane"); <add> <add> jane.setName("Jane Doe"); <add> // Does not cause a @PreUpdate or @PostUpdate <add> repo.save(jane); <add> assertCallbacks("@PostLoad: Jane"); <add> <add> // Flush to cause a @PreUpdate and @PostUpdate <add> entityManager.flush(); <add> assertPeople("Jane Doe"); <add> assertCallbacks("@PostLoad: Jane", "@PreUpdate: Jane Doe", "@PostUpdate: Jane Doe"); <add> } <add> <add> @Test <add> void remove() { <add> Person jane = repo.findByName("Jane"); <add> assertCallbacks("@PostLoad: Jane"); <add> <add> // Does not cause a @PostRemove <add> repo.remove(jane); <add> assertCallbacks("@PostLoad: Jane", "@PreRemove: Jane"); <add> <add> // Flush to cause a @PostRemove <add> entityManager.flush(); <add> assertPeople(); <add> assertCallbacks("@PostLoad: Jane", "@PreRemove: Jane", "@PostRemove: Jane"); <add> } <add> <add> private void assertCallbacks(String... callbacks) { <add> assertThat(PersonListener.methodsInvoked).containsExactly(callbacks); <add> } <add> <add> private void assertPeople(String... expectedNames) { <add> List<String> names = this.jdbcTemplate.queryForList("select name from person", String.class); <add> if (expectedNames.length == 0) { <add> assertThat(names).isEmpty(); <add> } <add> else { <add> assertThat(names).containsExactlyInAnyOrder(expectedNames); <add> } <add> } <add> <add> <add> @Configuration(proxyBeanMethods = false) <add> @EnableTransactionManagement <add> static class Config { <add> <add> @Bean <add> PersonRepository personRepository() { <add> return new JpaPersonRepository(); <add> } <add> <add> @Bean <add> DataSource dataSource() { <add> return new EmbeddedDatabaseBuilder().generateUniqueName(true).build(); <add> } <add> <add> @Bean <add> JdbcTemplate jdbcTemplate(DataSource dataSource) { <add> return new JdbcTemplate(dataSource); <add> } <add> <add> @Bean <add> LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { <add> LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean(); <add> emfb.setDataSource(dataSource); <add> emfb.setPackagesToScan(Person.class.getPackage().getName()); <add> HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter(); <add> hibernateJpaVendorAdapter.setGenerateDdl(true); <add> hibernateJpaVendorAdapter.setDatabase(Database.HSQL); <add> emfb.setJpaVendorAdapter(hibernateJpaVendorAdapter); <add> return emfb; <add> } <add> <add> @Bean <add> JpaTransactionManager transactionManager(EntityManagerFactory emf) { <add> return new JpaTransactionManager(emf); <add> } <add> <add> } <add> <add>} <ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/domain/JpaPersonRepository.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.test.context.junit.jupiter.orm.domain; <add> <add>import javax.persistence.EntityManager; <add>import javax.persistence.PersistenceContext; <add> <add>import org.springframework.stereotype.Repository; <add>import org.springframework.transaction.annotation.Transactional; <add> <add>/** <add> * JPA based implementation of the {@link PersonRepository} API. <add> * <add> * @author Sam Brannen <add> * @since 5.3.18 <add> */ <add>@Transactional <add>@Repository <add>public class JpaPersonRepository implements PersonRepository { <add> <add> @PersistenceContext <add> private EntityManager entityManager; <add> <add> @Override <add> public Person findById(Long id) { <add> return this.entityManager.find(Person.class, id); <add> } <add> <add> @Override <add> public Person findByName(String name) { <add> return this.entityManager.createQuery("from Person where name = :name", Person.class) <add> .setParameter("name", name) <add> .getSingleResult(); <add> } <add> <add> @Override <add> public Person save(Person person) { <add> this.entityManager.persist(person); <add> return person; <add> } <add> <add> @Override <add> public void remove(Person person) { <add> this.entityManager.remove(person); <add> } <add> <add>} <ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/domain/Person.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.test.context.junit.jupiter.orm.domain; <add> <add>import javax.persistence.Entity; <add>import javax.persistence.EntityListeners; <add>import javax.persistence.GeneratedValue; <add>import javax.persistence.GenerationType; <add>import javax.persistence.Id; <add> <add>/** <add> * Person entity. <add> * <add> * @author Sam Brannen <add> * @since 5.3.18 <add> */ <add>@Entity <add>@EntityListeners(PersonListener.class) <add>public class Person { <add> <add> @Id <add> @GeneratedValue(strategy = GenerationType.AUTO) <add> private Long id; <add> <add> private String name; <add> <add> <add> public Person() { <add> } <add> <add> public Person(String name) { <add> this.name = name; <add> } <add> <add> public Long getId() { <add> return this.id; <add> } <add> <add> protected void setId(Long id) { <add> this.id = id; <add> } <add> <add> public String getName() { <add> return this.name; <add> } <add> <add> public void setName(String name) { <add> this.name = name; <add> } <add> <add>} <ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/domain/PersonListener.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.test.context.junit.jupiter.orm.domain; <add> <add>import java.util.ArrayList; <add>import java.util.List; <add> <add>import javax.persistence.PostLoad; <add>import javax.persistence.PostPersist; <add>import javax.persistence.PostRemove; <add>import javax.persistence.PostUpdate; <add>import javax.persistence.PrePersist; <add>import javax.persistence.PreRemove; <add>import javax.persistence.PreUpdate; <add> <add>/** <add> * Person entity listener. <add> * <add> * @author Sam Brannen <add> * @since 5.3.18 <add> */ <add>public class PersonListener { <add> <add> public static final List<String> methodsInvoked = new ArrayList<>(); <add> <add> <add> @PostLoad <add> public void postLoad(Person person) { <add> methodsInvoked.add("@PostLoad: " + person.getName()); <add> } <add> <add> @PrePersist <add> public void prePersist(Person person) { <add> methodsInvoked.add("@PrePersist: " + person.getName()); <add> } <add> <add> @PostPersist <add> public void postPersist(Person person) { <add> methodsInvoked.add("@PostPersist: " + person.getName()); <add> } <add> <add> @PreUpdate <add> public void preUpdate(Person person) { <add> methodsInvoked.add("@PreUpdate: " + person.getName()); <add> } <add> <add> @PostUpdate <add> public void postUpdate(Person person) { <add> methodsInvoked.add("@PostUpdate: " + person.getName()); <add> } <add> <add> @PreRemove <add> public void preRemove(Person person) { <add> methodsInvoked.add("@PreRemove: " + person.getName()); <add> } <add> <add> @PostRemove <add> public void postRemove(Person person) { <add> methodsInvoked.add("@PostRemove: " + person.getName()); <add> } <add> <add>} <ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/orm/domain/PersonRepository.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.test.context.junit.jupiter.orm.domain; <add> <add>/** <add> * Person repository API. <add> * <add> * @author Sam Brannen <add> * @since 5.3.18 <add> */ <add>public interface PersonRepository { <add> <add> Person findById(Long id); <add> <add> Person findByName(String name); <add> <add> Person save(Person person); <add> <add> void remove(Person person); <add> <add>} <ide><path>spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java <ide> /* <del> * Copyright 2002-2019 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> * @author Juergen Hoeller <ide> * @author Vlad Mihalcea <ide> * @since 3.0 <add> * @see org.springframework.test.context.junit.jupiter.orm.JpaEntityListenerTests <ide> */ <ide> @ContextConfiguration <ide> public class HibernateSessionFlushingTests extends AbstractTransactionalJUnit4SpringContextTests {
6
Java
Java
add jdkidgenerator and use it in sockjs client
52b8f34468330372f448ee13475b0a6982ee0809
<ide><path>spring-core/src/main/java/org/springframework/util/AlternativeJdkIdGenerator.java <ide> import java.util.UUID; <ide> <ide> /** <del> * A variation of {@link UUID#randomUUID()} that uses {@link SecureRandom} only for the <del> * initial seed and {@link Random} thereafter. This provides better performance in <del> * exchange for less securely random id's. <add> * An {@link org.springframework.util.IdGenerator IdGenerator} that uses <add> * {@link SecureRandom} for the initial seed and {@link Random} thereafter <add> * instead of calling {@link UUID#randomUUID()} every time as <add> * {@link org.springframework.util.JdkIdGenerator JdkIdGenerator} does. <add> * This provides a better balance between securely random id's and performance. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @author Rob Winch <ide><path>spring-core/src/main/java/org/springframework/util/JdkIdGenerator.java <add>/* <add> * Copyright 2002-2013 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> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.util; <add> <add>import java.util.UUID; <add> <add>/** <add> * An IdGenerator that calls {@link java.util.UUID#randomUUID()}. <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.2 <add> */ <add>public class JdkIdGenerator implements IdGenerator { <add> <add> <add> public UUID generateId() { <add> return UUID.randomUUID(); <add> } <add> <add>} <ide><path>spring-core/src/main/java/org/springframework/util/SimpleIdGenerator.java <add>/* <add> * Copyright 2002-2013 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> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.util; <add> <add>import java.util.UUID; <add>import java.util.concurrent.atomic.AtomicLong; <add> <add>/** <add> * An simple IdGenerator that starts at 1 and increments by 1 with each call. <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.2 <add> */ <add>public class SimpleIdGenerator implements IdGenerator { <add> <add> private final AtomicLong mostSigBits = new AtomicLong(0); <add> <add> private final AtomicLong leastSigBits = new AtomicLong(0); <add> <add> <add> @Override <add> public UUID generateId() { <add> long leastSigBits = this.leastSigBits.incrementAndGet(); <add> if (leastSigBits == 0) { <add> this.mostSigBits.incrementAndGet(); <add> } <add> return new UUID(this.mostSigBits.get(), leastSigBits); <add> } <add> <add>} <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/SockJsUrlInfo.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.net.URI; <ide> import java.util.UUID; <ide> <del>import org.springframework.util.AlternativeJdkIdGenerator; <ide> import org.springframework.util.IdGenerator; <add>import org.springframework.util.JdkIdGenerator; <ide> import org.springframework.web.socket.sockjs.transport.TransportType; <ide> import org.springframework.web.util.UriComponentsBuilder; <ide> <ide> */ <ide> public class SockJsUrlInfo { <ide> <del> private static final IdGenerator idGenerator = new AlternativeJdkIdGenerator(); <add> private static final IdGenerator idGenerator = new JdkIdGenerator(); <ide> <ide> <ide> private final URI sockJsUrl;
4
Javascript
Javascript
get config from one location
64379ee34234273c45df6d7512d8e78450bc8e29
<ide><path>server/build/clean.js <del>import { resolve } from 'path' <del>import del from 'del' <del>import getConfig from '../config' <del> <del>export default function clean (dir) { <del> const dist = getConfig(dir).distDir <del> return del(resolve(dir, dist), { force: true }) <del>} <ide><path>server/build/root-module-relative-path.js <del>// Next.js needs to use module.resolve to generate paths to modules it includes, <del>// but those paths need to be relative to something so that they're portable <del>// across directories and machines. <del>// <del>// This function returns paths relative to the top-level 'node_modules' <del>// directory found in the path. If none is found, returns the complete path. <del> <del>import { sep } from 'path' <del> <del>const RELATIVE_START = `node_modules${sep}` <del> <del>// Pass in the module's `require` object since it's module-specific. <del>export default (moduleRequire) => (path) => { <del> // package.json removed because babel-runtime is resolved as <del> // "babel-runtime/package" <del> const absolutePath = moduleRequire.resolve(path) <del> .replace(/[\\/]package\.json$/, '') <del> <del> const relativeStartIndex = absolutePath.indexOf(RELATIVE_START) <del> <del> if (relativeStartIndex === -1) { <del> return absolutePath <del> } <del> <del> return absolutePath.substring(relativeStartIndex + RELATIVE_START.length) <del>} <ide><path>server/export.js <ide> export default async function (dir, options, configuration) { <ide> // Start the rendering process <ide> const renderOpts = { <ide> dir, <add> dist: config.distDir, <ide> buildStats, <ide> buildId, <ide> nextExport: true, <ide><path>server/hot-reloader.js <ide> import { join, relative, sep } from 'path' <ide> import WebpackDevMiddleware from 'webpack-dev-middleware' <ide> import WebpackHotMiddleware from 'webpack-hot-middleware' <add>import del from 'del' <ide> import onDemandEntryHandler from './on-demand-entry-handler' <ide> import webpack from 'webpack' <ide> import getBaseWebpackConfig from './build/webpack' <del>import clean from './build/clean' <del>import getConfig from './config' <ide> import UUID from 'uuid' <ide> import { <ide> IS_BUNDLED_PAGE, <ide> addCorsSupport <ide> } from './utils' <ide> <ide> export default class HotReloader { <del> constructor (dir, { quiet, conf } = {}) { <add> constructor (dir, { quiet, config } = {}) { <ide> this.dir = dir <ide> this.quiet = quiet <ide> this.middlewares = [] <ide> export default class HotReloader { <ide> // it should be the same value. <ide> this.buildId = UUID.v4() <ide> <del> this.config = getConfig(dir, conf) <add> this.config = config <ide> } <ide> <ide> async run (req, res) { <ide> export default class HotReloader { <ide> } <ide> } <ide> <add> async clean () { <add> return del(join(this.dir, this.config.distDir), { force: true }) <add> } <add> <ide> async start () { <del> await clean(this.dir) <add> await this.clean() <ide> <ide> const configs = await Promise.all([ <ide> getBaseWebpackConfig(this.dir, { dev: true, isServer: false, config: this.config }), <ide> export default class HotReloader { <ide> async reload () { <ide> this.stats = null <ide> <del> await clean(this.dir) <add> await this.clean() <ide> <ide> const configs = await Promise.all([ <ide> getBaseWebpackConfig(this.dir, { dev: true, isServer: false, config: this.config }), <ide><path>server/index.js <ide> export default class Server { <ide> this.dev = dev <ide> this.quiet = quiet <ide> this.router = new Router() <del> this.hotReloader = dev ? this.getHotReloader(this.dir, { quiet, conf }) : null <ide> this.http = null <ide> this.config = getConfig(this.dir, conf) <ide> this.dist = this.config.distDir <ide> <add> this.hotReloader = dev ? this.getHotReloader(this.dir, { quiet, config: this.config }) : null <add> <ide> if (dev) { <ide> updateNotifier(pkg, 'next') <ide> } <ide> export default class Server { <ide> dev, <ide> staticMarkup, <ide> dir: this.dir, <add> dist: this.dist, <ide> hotReloader: this.hotReloader, <ide> buildStats: this.buildStats, <ide> buildId: this.buildId, <ide> export default class Server { <ide> } <ide> } <ide> <del> const dist = getConfig(this.dir).distDir <del> const path = join(this.dir, dist, 'bundles', 'pages', `${page}.js.map`) <add> const path = join(this.dir, this.dist, 'bundles', 'pages', `${page}.js.map`) <ide> await serveStatic(req, res, path) <ide> }, <ide> <ide><path>server/render.js <ide> import send from 'send' <ide> import generateETag from 'etag' <ide> import fresh from 'fresh' <ide> import requirePage from './require' <del>import getConfig from './config' <ide> import { Router } from '../lib/router' <ide> import { loadGetInitialProps, isResSent } from '../lib/utils' <ide> import { getAvailableChunks } from './utils' <ide> async function doRender (req, res, pathname, query, { <ide> hotReloader, <ide> assetPrefix, <ide> availableChunks, <add> dist, <ide> dir = process.cwd(), <ide> dev = false, <ide> staticMarkup = false, <ide> async function doRender (req, res, pathname, query, { <ide> await ensurePage(page, { dir, hotReloader }) <ide> } <ide> <del> const dist = getConfig(dir).distDir <del> <ide> const documentPath = join(dir, dist, 'dist', 'bundles', 'pages', '_document') <ide> <ide> let Component = requirePage(page, {dir, dist})
6
PHP
PHP
add additional test coverage
82b2058d93c05b137a1445338c76bbeb0adf4450
<ide><path>src/Core/ObjectRegistry.php <ide> protected function _checkDuplicate($name, $config) { <ide> <ide> $fail = false; <ide> foreach ($config as $key => $value) { <del> if (isset($existingConfig[$key]) && $existingConfig[$key] !== $value) { <add> if (!array_key_exists($key, $existingConfig)) { <ide> $fail = true; <ide> break; <ide> } <del> if (!array_key_exists($key, $existingConfig)) { <add> if (isset($existingConfig[$key]) && $existingConfig[$key] !== $value) { <ide> $fail = true; <ide> break; <ide> } <ide><path>tests/TestCase/View/HelperRegistryTest.php <ide> public function testLoadMultipleTimesAlreadyConfigured() { <ide> $this->addToAssertionCount(1); <ide> } <ide> <add>/** <add> * Loading a helper overriding defaults to default value <add> * should "just work" <add> * <add> * @return void <add> */ <add> public function testLoadMultipleTimesDefaultConfigValuesWorks() { <add> $this->Helpers->load('Number', ['engine' => 'Cake\I18n\Number']); <add> $this->Helpers->load('Number'); <add> $this->addToAssertionCount(1); <add> } <add> <ide> /** <ide> * Loading a helper with different config, should throw an exception <ide> * <ide> * @expectedException RuntimeException <add> * @expectedExceptionMessage The "Html" alias has already been loaded with the following <ide> * @return void <ide> */ <ide> public function testLoadMultipleTimesDifferentConfigured() { <ide> public function testLoadMultipleTimesDifferentConfigured() { <ide> * Loading a helper with different config, should throw an exception <ide> * <ide> * @expectedException RuntimeException <add> * @expectedExceptionMessage The "Html" alias has already been loaded with the following <ide> * @return void <ide> */ <ide> public function testLoadMultipleTimesDifferentConfigValues() {
2
Ruby
Ruby
use keyword arguments instead of hash
d046390c324142afffbf105075a1f4998c149c14
<ide><path>activesupport/lib/active_support/core_ext/string/inflections.rb <ide> def camelize(first_letter = :upper) <ide> # 'man from the boondocks'.titleize # => "Man From The Boondocks" <ide> # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" <ide> # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" <del> def titleize(options = {}) <del> ActiveSupport::Inflector.titleize(self, options) <add> def titleize(keep_id_suffix: false) <add> ActiveSupport::Inflector.titleize(self, keep_id_suffix: keep_id_suffix) <ide> end <ide> alias_method :titlecase, :titleize <ide> <ide> def classify <ide> # 'author_id'.humanize(capitalize: false) # => "author" <ide> # '_id'.humanize # => "Id" <ide> # 'author_id'.humanize(keep_id_suffix: true) # => "Author Id" <del> def humanize(options = {}) <del> ActiveSupport::Inflector.humanize(self, options) <add> def humanize(capitalize: true, keep_id_suffix: false) <add> ActiveSupport::Inflector.humanize(self, capitalize: capitalize, keep_id_suffix: keep_id_suffix) <ide> end <ide> <ide> # Converts just the first character to uppercase. <ide><path>activesupport/lib/active_support/inflector/methods.rb <ide> def underscore(camel_cased_word) <ide> # <ide> # humanize('ssl_error') # => "SSL error" <ide> # <del> def humanize(lower_case_and_underscored_word, options = {}) <add> def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false) <ide> result = lower_case_and_underscored_word.to_s.dup <ide> <ide> inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) } <ide> <ide> result.sub!(/\A_+/, "".freeze) <del> unless options.fetch(:keep_id_suffix, false) <add> unless keep_id_suffix <ide> result.sub!(/_id\z/, "".freeze) <ide> end <ide> result.tr!("_".freeze, " ".freeze) <ide> def humanize(lower_case_and_underscored_word, options = {}) <ide> "#{inflections.acronyms[match] || match.downcase}" <ide> end <ide> <del> if options.fetch(:capitalize, true) <add> if capitalize <ide> result.sub!(/\A\w/) { |match| match.upcase } <ide> end <ide> <ide> def upcase_first(string) <ide> # titleize('TheManWithoutAPast') # => "The Man Without A Past" <ide> # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark" <ide> # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id" <del> def titleize(word, options = {}) <del> humanize(underscore(word), options).gsub(/\b(?<!\w['’`])[a-z]/) { |match| match.capitalize } <add> def titleize(word, keep_id_suffix: false) <add> humanize(underscore(word), keep_id_suffix: keep_id_suffix).gsub(/\b(?<!\w['’`])[a-z]/) do |match| <add> match.capitalize <add> end <ide> end <ide> <ide> # Creates the name of a table like Rails does for models to table names.
2
Javascript
Javascript
fix driver viewport
b6c587bb9801fba9dcacfe3e3c82a6f967425a67
<ide><path>test/driver.js <ide> function nextPage(task, loadError) { <ide> var renderContext = { <ide> canvasContext: ctx, <ide> textLayer: textLayerBuilder, <del> viewport: page.getViewport(1) <add> viewport: viewport <ide> }; <ide> page.render(renderContext).then(function() { <ide> snapshotCurrentPage(task, false);
1
PHP
PHP
ensure non conflicting placeholders in unit tests
f242029a2fd30dda32bc92cae81545808641b02b
<ide><path>tests/TestCase/Database/ValueBinderTest.php <ide> public function testResetCount() <ide> $this->assertCount(2, $valueBinder->bindings()); <ide> <ide> // Ensure the placeholder generation IS affected by resetCount <del> $valueBinder->placeholder('c'); <del> $valueBinder->placeholder('c'); <del> $result = $valueBinder->placeholder('c'); <del> $this->assertEquals(':c2', $result); <add> $valueBinder->placeholder('param'); <add> $valueBinder->placeholder('param'); <add> $result = $valueBinder->placeholder('param'); <add> $this->assertEquals(':param2', $result); <ide> <ide> $valueBinder->resetCount(); <ide> <del> $placeholder = $valueBinder->placeholder('c'); <del> $this->assertEquals(':c0', $placeholder); <add> $placeholder = $valueBinder->placeholder('param'); <add> $this->assertEquals(':param0', $placeholder); <ide> $this->assertCount(2, $valueBinder->bindings()); <ide> } <ide>
1
Javascript
Javascript
increase timeout on test-repl to 5 seconds
129217a4e92ed24eaa2dd03955d1bc0f4d4d6544
<ide><path>test/simple/test-repl.js <ide> unix_test(); <ide> <ide> timer = setTimeout(function() { <ide> assert.fail('Timeout'); <del>}, 1000); <add>}, 5000);
1
PHP
PHP
use connection aliasing in test suite
b6accd95e105a885d4e61f107c0edc3d56a118b1
<ide><path>Cake/ORM/Association.php <ide> public function target(Table $table = null) { <ide> } <ide> <ide> if ($table === null) { <del> $className = $this->_className; <del> $this->_targetTable = TableRegistry::get($this->_name, compact('className')); <add> $this->_targetTable = TableRegistry::get($this->_name, [ <add> 'className' => $this->_className, <add> ]); <ide> } <ide> return $this->_targetTable; <ide> } <ide><path>Cake/ORM/Table.php <ide> public function __construct(array $config = []) { <ide> $eventManager = $config['eventManager']; <ide> } <ide> $this->_eventManager = $eventManager ?: new EventManager(); <del><<<<<<< HEAD <ide> $this->initialize($config); <ide> } <ide> <ide> /** <del> * This method is meant to be overridden by subclasses so that any initial setting <del> * up for associations, validation rules or any custom logic can be done. <add> * Get the default connection name. <ide> * <del> * ### Example: <add> * This method is used to get the fallback connection name if an <add> * instance is created through the TableRegistry without a connection. <add> * <add> * @return string <add> * @see Cake\ORM\TableRegistry::get() <add> */ <add> public static function defaultConnectionName() { <add> return 'default'; <add> } <add> <add>/** <add> * Initialize a table instance. Called after the constructor. <add> * <add> * You can use this method to define associations, attach behaviors <add> * define validation and do any other initialization logic you need. <ide> * <ide> * {{{ <ide> * public function initialize(array $config) { <ide><path>Cake/ORM/TableRegistry.php <ide> namespace Cake\ORM; <ide> <ide> use Cake\Core\App; <add>use Cake\Database\ConnectionManager; <ide> use Cake\Utility\Inflector; <ide> <ide> /** <ide> public static function config($alias = null, $options = null) { <ide> * If no `table` option is passed, the table name will be the tableized version <ide> * of the provided $alias. <ide> * <add> * If no `connection` option is passed the table's defaultConnectionName() method <add> * will be called to get the default connection name to use. <add> * <ide> * @param string $alias The alias you want to get. <ide> * @param array $options The options you want to build the table with. <ide> * If a table has already been loaded the options will be ignored. <ide> public static function get($alias, $options = []) { <ide> if (isset(static::$_config[$alias])) { <ide> $options = array_merge(static::$_config[$alias], $options); <ide> } <add> if (empty($options['connection'])) { <add> $connectionName = $options['className']::defaultConnectionName(); <add> $options['connection'] = ConnectionManager::get($connectionName); <add> } <ide> return static::$_instances[$alias] = new $options['className']($options); <ide> } <ide> <ide><path>Cake/Test/TestCase/ORM/TableRegistryTest.php <ide> public function testConfig() { <ide> * @return void <ide> */ <ide> public function testGet() { <del> $result = TableRegistry::get('Article', ['table' => 'my_articles']); <add> $result = TableRegistry::get('Article', [ <add> 'table' => 'my_articles', <add> ]); <ide> $this->assertInstanceOf('Cake\ORM\Table', $result); <ide> $this->assertEquals('my_articles', $result->table()); <ide> <del> $result2 = TableRegistry::get('Article', ['table' => 'herp_derp']); <add> $result2 = TableRegistry::get('Article', [ <add> 'table' => 'herp_derp', <add> ]); <ide> $this->assertSame($result, $result2); <ide> $this->assertEquals('my_articles', $result->table()); <ide> } <ide> public function testGet() { <ide> * @return void <ide> */ <ide> public function testGetWithConfig() { <del> TableRegistry::config('Article', ['table' => 'my_articles']); <add> TableRegistry::config('Article', [ <add> 'table' => 'my_articles', <add> ]); <ide> $result = TableRegistry::get('Article'); <ide> $this->assertEquals('my_articles', $result->table(), 'Should use config() data.'); <ide> } <ide><path>Cake/Test/TestCase/ORM/TableTest.php <ide> public function testBelongsToMany() { <ide> 'conditions' => ['b' => 'c'], <ide> 'sort' => ['foo' => 'asc'] <ide> ]; <del> $table = new Table(['table' => 'authors']); <add> $table = new Table(['table' => 'authors', 'connection' => $this->connection]); <ide> $belongsToMany = $table->belongsToMany('tag', $options); <ide> $this->assertInstanceOf('\Cake\ORM\Association\BelongsToMany', $belongsToMany); <ide> $this->assertSame($belongsToMany, $table->association('tag')); <ide> public function testDeleteAllFailure() { <ide> * @return void <ide> */ <ide> public function testFindApplyOptions() { <del> $table = $this->getMock('Cake\ORM\Table', ['_buildQuery'], [['table' => 'users']]); <add> $table = $this->getMock( <add> 'Cake\ORM\Table', <add> ['_buildQuery'], <add> [['table' => 'users', 'connection' => $this->connection]] <add> ); <ide> $query = $this->getMock('Cake\ORM\Query', [], [$this->connection, $table]); <ide> $table->expects($this->once()) <ide> ->method('_buildQuery') <ide> public function testFindThreadedNoHydration() { <ide> * @return void <ide> */ <ide> public function testCallingFindersDirectly() { <del> $table = $this->getMock('\Cake\ORM\Table', ['find']); <add> $table = $this->getMock('\Cake\ORM\Table', ['find'], [], '', false); <ide> $query = $this->getMock('\Cake\ORM\Query', [], [$this->connection, $table]); <ide> $table->expects($this->once()) <ide> ->method('find') <ide> ->with('list', []) <ide> ->will($this->returnValue($query)); <ide> $this->assertSame($query, $table->list()); <ide> <del> $table = $this->getMock('\Cake\ORM\Table', ['find']); <add> $table = $this->getMock('\Cake\ORM\Table', ['find'], [], '', false); <ide> $table->expects($this->once()) <ide> ->method('find') <ide> ->with('threaded', ['order' => ['name' => 'ASC']]) <ide> public function testCallingFindersDirectly() { <ide> * @return void <ide> */ <ide> public function testStackingFinders() { <del> $table = $this->getMock('\Cake\ORM\Table', ['find', 'findList']); <add> $table = $this->getMock('\Cake\ORM\Table', ['find', 'findList'], [], '', false); <ide> $params = [$this->connection, $table]; <ide> $query = $this->getMock('\Cake\ORM\Query', ['addDefaultTypes'], $params); <ide> <ide><path>Cake/TestSuite/Fixture/FixtureManager.php <ide> use Cake\Error; <ide> use Cake\TestSuite\Fixture\TestFixture; <ide> use Cake\TestSuite\TestCase; <del>use Cake\Utility\ClassRegistry; <ide> use Cake\Utility\Inflector; <ide> <ide> /** <ide> class FixtureManager { <ide> * @return void <ide> */ <ide> public function fixturize($test) { <del> if (!$this->_initialized) { <del> ClassRegistry::config(array('ds' => 'test', 'testing' => true)); <del> } <ide> if (empty($test->fixtures) || !empty($this->_processed[get_class($test)])) { <del> $test->db = $this->_db; <ide> return; <ide> } <ide> $this->_initDb(); <ide> public function fixturize($test) { <ide> $this->_processed[get_class($test)] = true; <ide> } <ide> <add>/** <add> * Add aliaes for all non test prefixed connections. <add> * <add> * This allows models to use the test connections without <add> * a pile of configuration work. <add> * <add> * @return void <add> */ <add> protected function _aliasConnections() { <add> $connections = ConnectionManager::configured(); <add> ConnectionManager::alias('test', 'default'); <add> foreach ($connections as $connection) { <add> if ($connection === 'default') { <add> continue; <add> } <add> if (strpos($connection, 'test') === 0) { <add> continue; <add> } <add> $alias = 'test_' . $connection; <add> ConnectionManager::alias($alias, $connection); <add> } <add> } <add> <ide> /** <ide> * Initializes this class with a DataSource object to use as default for all fixtures <ide> * <ide> protected function _initDb() { <ide> if ($this->_initialized) { <ide> return; <ide> } <add> $this->_aliasConnections(); <ide> $db = ConnectionManager::get('test', false); <del> $db->cacheSources = false; <ide> $this->_db = $db; <ide> $this->_initialized = true; <ide> }
6
Text
Text
change cable.coffee to cable.js [ci skip]
017c7f46e0aadffd2e5f02efb5918c0439716a7e
<ide><path>actioncable/README.md <ide> end <ide> <ide> The client-side needs to setup a consumer instance of this connection. That's done like so: <ide> <del>```coffeescript <del># app/assets/javascripts/cable.coffee <del>#= require action_cable <add>```js <add>// app/assets/javascripts/cable.js <add>//= require action_cable <add>//= require_self <add>//= require_tree ./channels <add> <add>(function() { <add> this.App || (this.App = {}); <ide> <del>@App = {} <del>App.cable = ActionCable.createConsumer("ws://cable.example.com") <add> App.cable = ActionCable.createConsumer("ws://cable.example.com"); <add>}).call(this); <ide> ``` <ide> <ide> The `ws://cable.example.com` address must point to your Action Cable server(s), and it <ide><path>guides/source/action_cable_overview.md <ide> established using the following Javascript, which is generated by default in Rai <ide> <ide> #### Connect Consumer <ide> <del>```coffeescript <del># app/assets/javascripts/cable.coffee <del>#= require action_cable <add>```js <add>// app/assets/javascripts/cable.js <add>//= require action_cable <add>//= require_self <add>//= require_tree ./channels <add> <add>(function() { <add> this.App || (this.App = {}); <ide> <del>@App = {} <del>App.cable = ActionCable.createConsumer() <add> App.cable = ActionCable.createConsumer(); <add>}).call(this); <ide> ``` <ide> <ide> This will ready a consumer that'll connect against /cable on your server by default. <ide> App.cable.subscriptions.create "AppearanceChannel", <ide> ``` <ide> <ide> ##### Client-Server Interaction <del>1. **Client** establishes a connection with the **Server** via `App.cable = ActionCable.createConsumer("ws://cable.example.com")`. [*` cable.coffee`*] The **Server** identified this connection instance by `current_user`. <add>1. **Client** establishes a connection with the **Server** via `App.cable = ActionCable.createConsumer("ws://cable.example.com")`. [*` cable.js`*] The **Server** identified this connection instance by `current_user`. <ide> 2. **Client** initiates a subscription to the `Appearance Channel` for their connection via `App.cable.subscriptions.create "AppearanceChannel"`. [*`appearance.coffee`*] <ide> 3. **Server** recognizes a new subscription has been initiated for `AppearanceChannel` channel performs the `subscribed` callback, which calls the `appear` method on the `current_user`. [*`appearance_channel.rb`*] <ide> 4. **Client** recognizes that a subscription has been established and calls `connected` [*`appearance.coffee`*] which in turn calls `@install` and `@appear`. `@appear` calls`AppearanceChannel#appear(data)` on the server, and supplies a data hash of `appearing_on: $("main").data("appearing-on")`. This is possible because the server-side channel instance will automatically expose the public methods declared on the class (minus the callbacks), so that these can be reached as remote procedure calls via a subscription's `perform` method.
2
Text
Text
update emitclose default for fs streams
d548f4d1164a5dc9e1390fcaaafbbf2feddaf28e
<ide><path>doc/api/fs.md <ide> changes: <ide> - v15.4.0 <ide> pr-url: https://github.com/nodejs/node/pull/35922 <ide> description: The `fd` option accepts FileHandle arguments. <add> - version: v14.0.0 <add> pr-url: https://github.com/nodejs/node/pull/31408 <add> description: Change `emitClose` default to `true`. <ide> - version: <ide> - v13.6.0 <ide> - v12.17.0 <ide> changes: <ide> * `fd` {integer|FileHandle} **Default:** `null` <ide> * `mode` {integer} **Default:** `0o666` <ide> * `autoClose` {boolean} **Default:** `true` <del> * `emitClose` {boolean} **Default:** `false` <add> * `emitClose` {boolean} **Default:** `true` <ide> * `start` {integer} <ide> * `end` {integer} **Default:** `Infinity` <ide> * `highWaterMark` {integer} **Default:** `64 * 1024` <ide> If `fd` points to a character device that only supports blocking reads <ide> available. This can prevent the process from exiting and the stream from <ide> closing naturally. <ide> <del>By default, the stream will not emit a `'close'` event after it has been <del>destroyed. This is the opposite of the default for other `Readable` streams. <del>Set the `emitClose` option to `true` to change this behavior. <add>By default, the stream will emit a `'close'` event after it has been <add>destroyed, like most `Readable` streams. Set the `emitClose` option to <add>`false` to change this behavior. <ide> <ide> By providing the `fs` option, it is possible to override the corresponding `fs` <ide> implementations for `open`, `read`, and `close`. When providing the `fs` option, <ide> changes: <ide> - v15.4.0 <ide> pr-url: https://github.com/nodejs/node/pull/35922 <ide> description: The `fd` option accepts FileHandle arguments. <add> - version: v14.0.0 <add> pr-url: https://github.com/nodejs/node/pull/31408 <add> description: Change `emitClose` default to `true`. <ide> - version: <ide> - v13.6.0 <ide> - v12.17.0 <ide> changes: <ide> * `fd` {integer|FileHandle} **Default:** `null` <ide> * `mode` {integer} **Default:** `0o666` <ide> * `autoClose` {boolean} **Default:** `true` <del> * `emitClose` {boolean} **Default:** `false` <add> * `emitClose` {boolean} **Default:** `true` <ide> * `start` {integer} <ide> * `fs` {Object|null} **Default:** `null` <ide> * Returns: {fs.WriteStream} See [Writable Stream][]. <ide> then the file descriptor won't be closed, even if there's an error. <ide> It is the application's responsibility to close it and make sure there's no <ide> file descriptor leak. <ide> <del>By default, the stream will not emit a `'close'` event after it has been <del>destroyed. This is the opposite of the default for other `Writable` streams. <del>Set the `emitClose` option to `true` to change this behavior. <add>By default, the stream will emit a `'close'` event after it has been <add>destroyed, like most `Writable` streams. Set the `emitClose` option to <add>`false` to change this behavior. <ide> <ide> By providing the `fs` option it is possible to override the corresponding `fs` <ide> implementations for `open`, `write`, `writev` and `close`. Overriding `write()`
1
Python
Python
adjust polyfit doc to clarify the meaning of w
5c4aac16b54284a59bc5af34e731be7299cbb1d1
<ide><path>numpy/lib/polynomial.py <ide> def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (M,), optional <del> Weights to apply to the y-coordinates of the sample points. For <del> gaussian uncertainties, use 1/sigma (not 1/sigma**2). <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> cov : bool or str, optional <ide> If given and not `False`, return not just the estimate but also its <ide> covariance matrix. By default, the covariance are scaled by <ide> chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed <ide> to be unreliable except in a relative sense and everything is scaled <ide> such that the reduced chi2 is unity. This scaling is omitted if <ide> ``cov='unscaled'``, as is relevant for the case that the weights are <del> 1/sigma**2, with sigma known to be a reliable estimate of the <add> w = 1/sigma, with sigma known to be a reliable estimate of the <ide> uncertainty. <ide> <ide> Returns <ide><path>numpy/polynomial/_polybase.py <ide> class domain in NumPy 1.4 and ``None`` in later versions. <ide> diagnostic information from the singular value decomposition is <ide> also returned. <ide> w : array_like, shape (M,), optional <del> Weights. If not None the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products <del> ``w[i]*y[i]`` all have the same variance. The default value is <del> None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have <add> the same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> .. versionadded:: 1.5.0 <ide> window : {[beg, end]}, optional <ide><path>numpy/polynomial/chebyshev.py <ide> def chebfit(x, y, deg, rcond=None, full=False, w=None): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (`M`,), optional <del> Weights. If not None, the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products ``w[i]*y[i]`` <del> all have the same variance. The default value is None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> .. versionadded:: 1.5.0 <ide> <ide><path>numpy/polynomial/hermite.py <ide> def hermfit(x, y, deg, rcond=None, full=False, w=None): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (`M`,), optional <del> Weights. If not None, the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products ``w[i]*y[i]`` <del> all have the same variance. The default value is None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> Returns <ide> ------- <ide><path>numpy/polynomial/hermite_e.py <ide> def hermefit(x, y, deg, rcond=None, full=False, w=None): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (`M`,), optional <del> Weights. If not None, the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products ``w[i]*y[i]`` <del> all have the same variance. The default value is None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> Returns <ide> ------- <ide><path>numpy/polynomial/laguerre.py <ide> def lagfit(x, y, deg, rcond=None, full=False, w=None): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (`M`,), optional <del> Weights. If not None, the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products ``w[i]*y[i]`` <del> all have the same variance. The default value is None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> Returns <ide> ------- <ide><path>numpy/polynomial/legendre.py <ide> def legfit(x, y, deg, rcond=None, full=False, w=None): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (`M`,), optional <del> Weights. If not None, the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products ``w[i]*y[i]`` <del> all have the same variance. The default value is None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> .. versionadded:: 1.5.0 <ide> <ide><path>numpy/polynomial/polynomial.py <ide> def polyfit(x, y, deg, rcond=None, full=False, w=None): <ide> diagnostic information from the singular value decomposition (used <ide> to solve the fit's matrix equation) is also returned. <ide> w : array_like, shape (`M`,), optional <del> Weights. If not None, the contribution of each point <del> ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the <del> weights are chosen so that the errors of the products ``w[i]*y[i]`` <del> all have the same variance. The default value is None. <add> Weights. If not None, the weight ``w[i]`` applies to the unsquared <add> residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are <add> chosen so that the errors of the products ``w[i]*y[i]`` all have the <add> same variance. When using inverse-variance weighting, use <add> ``w[i] = 1/sigma(y[i])``. The default value is None. <ide> <ide> .. versionadded:: 1.5.0 <ide>
8
Javascript
Javascript
add profile bundles for www+dom and fbsource+rn/rf
6d6de6011cf329fabe057186e9a65fc8eb4e175c
<ide><path>packages/shared/forks/ReactFeatureFlags.native-fabric-fb.js <ide> export const enableSuspense = false; <ide> export const warnAboutDeprecatedLifecycles = false; <ide> export const warnAboutLegacyContextAPI = __DEV__; <ide> export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; <del>export const enableProfilerTimer = __DEV__; <add>export const enableProfilerTimer = __PROFILE__; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const { <ide> debugRenderPhaseSideEffectsForStrictMode, <ide> warnAboutDeprecatedLifecycles, <ide> replayFailedUnitOfWorkWithInvokeGuardedCallback, <del> enableProfilerTimer, <ide> } = require('ReactFeatureFlags'); <ide> <ide> // The rest of the flags are static for better dead code elimination. <ide> export const enableUserTimingAPI = __DEV__; <ide> export const warnAboutLegacyContextAPI = __DEV__; <add>export const enableProfilerTimer = __PROFILE__; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.persistent.js <ide> export const enableSuspense = false; <ide> export const warnAboutDeprecatedLifecycles = false; <ide> export const warnAboutLegacyContextAPI = false; <ide> export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; <del>export const enableProfilerTimer = false; <add>export const enableProfilerTimer = __PROFILE__; <ide> <ide> // Only used in www builds. <ide> export function addUserTimingListener() { <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const { <ide> enableGetDerivedStateFromCatch, <ide> replayFailedUnitOfWorkWithInvokeGuardedCallback, <ide> warnAboutDeprecatedLifecycles, <del> enableProfilerTimer, <ide> } = require('ReactFeatureFlags'); <ide> <ide> // The rest of the flags are static for better dead code elimination. <ide> export const warnAboutLegacyContextAPI = __DEV__; <ide> // as long as there is more than a single listener. <ide> export let enableUserTimingAPI = __DEV__; <ide> <add>export const enableProfilerTimer = __PROFILE__; <add> <ide> let refCount = 0; <ide> export function addUserTimingListener() { <ide> if (__DEV__) { <ide><path>scripts/rollup/build.js <ide> const { <ide> NODE_PROFILING, <ide> FB_WWW_DEV, <ide> FB_WWW_PROD, <add> FB_WWW_PROFILING, <ide> RN_OSS_DEV, <ide> RN_OSS_PROD, <ide> RN_OSS_PROFILING, <ide> RN_FB_DEV, <ide> RN_FB_PROD, <add> RN_FB_PROFILING, <ide> } = Bundles.bundleTypes; <ide> <ide> const requestedBundleTypes = (argv.type || '') <ide> function getBabelConfig(updateBabelOptions, bundleType, filename) { <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return Object.assign({}, options, { <ide> plugins: options.plugins.concat([ <ide> // Minify invariant messages <ide> function getBabelConfig(updateBabelOptions, bundleType, filename) { <ide> case RN_OSS_PROFILING: <ide> case RN_FB_DEV: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> return Object.assign({}, options, { <ide> plugins: options.plugins.concat([ <ide> // Wrap warning() calls in a __DEV__ check so they are stripped from production. <ide> function getFormat(bundleType) { <ide> case NODE_PROFILING: <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> case RN_OSS_DEV: <ide> case RN_OSS_PROD: <ide> case RN_OSS_PROFILING: <ide> case RN_FB_DEV: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> return `cjs`; <ide> } <ide> } <ide> function getFilename(name, globalName, bundleType) { <ide> case RN_OSS_PROD: <ide> case RN_FB_PROD: <ide> return `${globalName}-prod.js`; <add> case FB_WWW_PROFILING: <add> case RN_FB_PROFILING: <ide> case RN_OSS_PROFILING: <ide> return `${globalName}-profiling.js`; <ide> } <ide> function isProductionBundleType(bundleType) { <ide> case NODE_PROD: <ide> case NODE_PROFILING: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> case RN_OSS_PROD: <ide> case RN_OSS_PROFILING: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> return true; <ide> default: <ide> throw new Error(`Unknown type: ${bundleType}`); <ide> function isProfilingBundleType(bundleType) { <ide> case UMD_DEV: <ide> case UMD_PROD: <ide> return false; <add> case FB_WWW_PROFILING: <ide> case NODE_PROFILING: <add> case RN_FB_PROFILING: <ide> case RN_OSS_PROFILING: <ide> return true; <ide> default: <ide> function getPlugins( <ide> const isProduction = isProductionBundleType(bundleType); <ide> const isProfiling = isProfilingBundleType(bundleType); <ide> const isUMDBundle = bundleType === UMD_DEV || bundleType === UMD_PROD; <del> const isFBBundle = bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD; <add> const isFBBundle = <add> bundleType === FB_WWW_DEV || <add> bundleType === FB_WWW_PROD || <add> bundleType === FB_WWW_PROFILING; <ide> const isRNBundle = <ide> bundleType === RN_OSS_DEV || <ide> bundleType === RN_OSS_PROD || <ide> bundleType === RN_OSS_PROFILING || <ide> bundleType === RN_FB_DEV || <del> bundleType === RN_FB_PROD; <add> bundleType === RN_FB_PROD || <add> bundleType === RN_FB_PROFILING; <ide> const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput; <ide> return [ <ide> // Extract error codes from invariant() messages into a file. <ide> async function createBundle(bundle, bundleType) { <ide> const packageName = Packaging.getPackageName(bundle.entry); <ide> <ide> let resolvedEntry = require.resolve(bundle.entry); <del> if (bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD) { <add> if ( <add> bundleType === FB_WWW_DEV || <add> bundleType === FB_WWW_PROD || <add> bundleType === FB_WWW_PROFILING <add> ) { <ide> const resolvedFBEntry = resolvedEntry.replace('.js', '.fb.js'); <ide> if (fs.existsSync(resolvedFBEntry)) { <ide> resolvedEntry = resolvedFBEntry; <ide> async function createBundle(bundle, bundleType) { <ide> bundle.modulesToStub <ide> ), <ide> // We can't use getters in www. <del> legacy: bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD, <add> legacy: <add> bundleType === FB_WWW_DEV || <add> bundleType === FB_WWW_PROD || <add> bundleType === FB_WWW_PROFILING, <ide> }; <ide> const [mainOutputPath, ...otherOutputPaths] = Packaging.getBundleOutputPaths( <ide> bundleType, <ide> async function buildEverything() { <ide> await createBundle(bundle, NODE_PROFILING); <ide> await createBundle(bundle, FB_WWW_DEV); <ide> await createBundle(bundle, FB_WWW_PROD); <add> await createBundle(bundle, FB_WWW_PROFILING); <ide> await createBundle(bundle, RN_OSS_DEV); <ide> await createBundle(bundle, RN_OSS_PROD); <ide> await createBundle(bundle, RN_OSS_PROFILING); <ide> await createBundle(bundle, RN_FB_DEV); <ide> await createBundle(bundle, RN_FB_PROD); <add> await createBundle(bundle, RN_FB_PROFILING); <ide> } <ide> <ide> await Packaging.copyAllShims(); <ide><path>scripts/rollup/bundles.js <ide> const bundleTypes = { <ide> NODE_PROFILING: 'NODE_PROFILING', <ide> FB_WWW_DEV: 'FB_WWW_DEV', <ide> FB_WWW_PROD: 'FB_WWW_PROD', <add> FB_WWW_PROFILING: 'FB_WWW_PROFILING', <ide> RN_OSS_DEV: 'RN_OSS_DEV', <ide> RN_OSS_PROD: 'RN_OSS_PROD', <ide> RN_OSS_PROFILING: 'RN_OSS_PROFILING', <ide> RN_FB_DEV: 'RN_FB_DEV', <ide> RN_FB_PROD: 'RN_FB_PROD', <add> RN_FB_PROFILING: 'RN_FB_PROFILING', <ide> }; <ide> <ide> const UMD_DEV = bundleTypes.UMD_DEV; <ide> const NODE_PROD = bundleTypes.NODE_PROD; <ide> const NODE_PROFILING = bundleTypes.NODE_PROFILING; <ide> const FB_WWW_DEV = bundleTypes.FB_WWW_DEV; <ide> const FB_WWW_PROD = bundleTypes.FB_WWW_PROD; <add>const FB_WWW_PROFILING = bundleTypes.FB_WWW_PROFILING; <ide> const RN_OSS_DEV = bundleTypes.RN_OSS_DEV; <ide> const RN_OSS_PROD = bundleTypes.RN_OSS_PROD; <ide> const RN_OSS_PROFILING = bundleTypes.RN_OSS_PROFILING; <ide> const RN_FB_DEV = bundleTypes.RN_FB_DEV; <ide> const RN_FB_PROD = bundleTypes.RN_FB_PROD; <add>const RN_FB_PROFILING = bundleTypes.RN_FB_PROFILING; <ide> <ide> const moduleTypes = { <ide> ISOMORPHIC: 'ISOMORPHIC', <ide> const bundles = [ <ide> NODE_PROFILING, <ide> FB_WWW_DEV, <ide> FB_WWW_PROD, <add> FB_WWW_PROFILING, <ide> ], <ide> moduleType: RENDERER, <ide> entry: 'react-dom', <ide> const bundles = [ <ide> /******* React Native *******/ <ide> { <ide> label: 'native-fb', <del> bundleTypes: [RN_FB_DEV, RN_FB_PROD], <add> bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], <ide> moduleType: RENDERER, <ide> entry: 'react-native-renderer', <ide> global: 'ReactNativeRenderer', <ide> const bundles = [ <ide> /******* React Native Fabric *******/ <ide> { <ide> label: 'native-fabric-fb', <del> bundleTypes: [RN_FB_DEV, RN_FB_PROD], <add> bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], <ide> moduleType: RENDERER, <ide> entry: 'react-native-renderer/fabric', <ide> global: 'ReactFabric', <ide><path>scripts/rollup/forks.js <ide> const UMD_DEV = bundleTypes.UMD_DEV; <ide> const UMD_PROD = bundleTypes.UMD_PROD; <ide> const FB_WWW_DEV = bundleTypes.FB_WWW_DEV; <ide> const FB_WWW_PROD = bundleTypes.FB_WWW_PROD; <add>const FB_WWW_PROFILING = bundleTypes.FB_WWW_PROFILING; <ide> const RN_OSS_DEV = bundleTypes.RN_OSS_DEV; <ide> const RN_OSS_PROD = bundleTypes.RN_OSS_PROD; <ide> const RN_OSS_PROFILING = bundleTypes.RN_OSS_PROFILING; <ide> const RN_FB_DEV = bundleTypes.RN_FB_DEV; <ide> const RN_FB_PROD = bundleTypes.RN_FB_PROD; <add>const RN_FB_PROFILING = bundleTypes.RN_FB_PROFILING; <ide> const RENDERER = moduleTypes.RENDERER; <ide> const RECONCILER = moduleTypes.RECONCILER; <ide> <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case RN_FB_DEV: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> return 'shared/forks/ReactFeatureFlags.native-fb.js'; <ide> case RN_OSS_DEV: <ide> case RN_OSS_PROD: <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case RN_FB_DEV: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> return 'shared/forks/ReactFeatureFlags.native-fabric-fb.js'; <ide> case RN_OSS_DEV: <ide> case RN_OSS_PROD: <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'shared/forks/ReactFeatureFlags.www.js'; <ide> } <ide> } <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'shared/forks/ReactScheduler.www.js'; <ide> default: <ide> return null; <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'shared/forks/invariant.www.js'; <ide> default: <ide> return null; <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'shared/forks/lowPriorityWarning.www.js'; <ide> default: <ide> return null; <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'shared/forks/warning.www.js'; <ide> default: <ide> return null; <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'react/src/forks/ReactCurrentOwner.www.js'; <ide> default: <ide> return null; <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return 'shared/forks/invokeGuardedCallback.www.js'; <ide> default: <ide> return null; <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> // Use the www fork which shows an error dialog. <ide> return 'react-reconciler/src/forks/ReactFiberErrorDialog.www.js'; <ide> case RN_OSS_DEV: <ide> case RN_OSS_PROD: <ide> case RN_OSS_PROFILING: <ide> case RN_FB_DEV: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> switch (entry) { <ide> case 'react-native-renderer': <ide> case 'react-native-renderer/fabric': <ide> const forks = Object.freeze({ <ide> switch (bundleType) { <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> // Use the www fork which is integrated with TimeSlice profiling. <ide> return 'react-dom/src/events/forks/EventListener-www.js'; <ide> default: <ide><path>scripts/rollup/packaging.js <ide> const { <ide> NODE_PROFILING, <ide> FB_WWW_DEV, <ide> FB_WWW_PROD, <add> FB_WWW_PROFILING, <ide> RN_OSS_DEV, <ide> RN_OSS_PROD, <ide> RN_OSS_PROFILING, <ide> RN_FB_DEV, <ide> RN_FB_PROD, <add> RN_FB_PROFILING, <ide> } = Bundles.bundleTypes; <ide> <ide> function getPackageName(name) { <ide> function getBundleOutputPaths(bundleType, filename, packageName) { <ide> ]; <ide> case FB_WWW_DEV: <ide> case FB_WWW_PROD: <add> case FB_WWW_PROFILING: <ide> return [`build/facebook-www/${filename}`]; <ide> case RN_OSS_DEV: <ide> case RN_OSS_PROD: <ide> function getBundleOutputPaths(bundleType, filename, packageName) { <ide> } <ide> case RN_FB_DEV: <ide> case RN_FB_PROD: <add> case RN_FB_PROFILING: <ide> switch (packageName) { <ide> case 'react-native-renderer': <ide> return [`build/react-native/fb/${filename}`]; <ide><path>scripts/rollup/wrappers.js <ide> const NODE_PROD = Bundles.bundleTypes.NODE_PROD; <ide> const NODE_PROFILING = Bundles.bundleTypes.NODE_PROFILING; <ide> const FB_WWW_DEV = Bundles.bundleTypes.FB_WWW_DEV; <ide> const FB_WWW_PROD = Bundles.bundleTypes.FB_WWW_PROD; <add>const FB_WWW_PROFILING = Bundles.bundleTypes.FB_WWW_PROFILING; <ide> const RN_OSS_DEV = Bundles.bundleTypes.RN_OSS_DEV; <ide> const RN_OSS_PROD = Bundles.bundleTypes.RN_OSS_PROD; <ide> const RN_OSS_PROFILING = Bundles.bundleTypes.RN_OSS_PROFILING; <ide> const RN_FB_DEV = Bundles.bundleTypes.RN_FB_DEV; <ide> const RN_FB_PROD = Bundles.bundleTypes.RN_FB_PROD; <add>const RN_FB_PROFILING = Bundles.bundleTypes.RN_FB_PROFILING; <ide> <ide> const RECONCILER = Bundles.moduleTypes.RECONCILER; <ide> <ide> ${license} <ide> * @preserve-invariant-messages <ide> */ <ide> <add>${source}`; <add> }, <add> <add> /****************** FB_WWW_PROFILING ******************/ <add> [FB_WWW_PROFILING](source, globalName, filename, moduleType) { <add> return `/** <add>${license} <add> * <add> * @noflow <add> * @preventMunge <add> * @preserve-invariant-messages <add> */ <add> <ide> ${source}`; <ide> }, <ide> <ide> ${license} <ide> * ${'@gen' + 'erated'} <ide> */ <ide> <add>${source}`; <add> }, <add> <add> /****************** RN_FB_PROFILING ******************/ <add> [RN_FB_PROFILING](source, globalName, filename, moduleType) { <add> return `/** <add>${license} <add> * <add> * @noflow <add> * @preventMunge <add> * ${'@gen' + 'erated'} <add> */ <add> <ide> ${source}`; <ide> }, <ide> };
9
Text
Text
clarify text about process not responding
8938d37251d3a48686825b477339ca3991a9d37b
<ide><path>doc/api/process.md <ide> process.on('SIGTERM', handle); <ide> * `'SIGSTOP'` cannot have a listener installed. <ide> * `'SIGBUS'`, `'SIGFPE'`, `'SIGSEGV'` and `'SIGILL'`, when not raised <ide> artificially using kill(2), inherently leave the process in a state from <del> which it is not safe to attempt to call JS listeners. Doing so might lead to <del> the process hanging in an endless loop, since listeners attached using <del> `process.on()` are called asynchronously and therefore unable to correct the <del> underlying problem. <add> which it is not safe to call JS listeners. Doing so might cause the process <add> to stop responding. <ide> * `0` can be sent to test for the existence of a process, it has no effect if <ide> the process exists, but will throw an error if the process does not exist. <ide>
1
Text
Text
add changelog entry for
240e32bbbfb6943ac8d7f3fc4d6a6f685930d9ca
<ide><path>activesupport/CHANGELOG.md <add>* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing. <add> <add> *Adam Rice* <add> <ide> * Deprecate `.halt_callback_chains_on_return_false`. <ide> <ide> *Rafael Mendonça França*
1
Python
Python
use correct status code
dc9384f9b4321f099e380f6b4a04fbe2eeb2b743
<ide><path>rest_framework/exceptions.py <ide> def __init__(self, detail=None): <ide> <ide> <ide> class Unauthenticated(APIException): <del> status_code = status.HTTP_401_UNAUTHENTICATED <add> status_code = status.HTTP_401_UNAUTHORIZED <ide> default_detail = 'Incorrect or absent authentication credentials.' <ide> <ide> def __init__(self, detail=None):
1
Go
Go
remove redundant root.scopedpath(), root.scope
74be0fed6f9febe0eb903d911bd31282ad2b12f2
<ide><path>volume/local/local.go <ide> func New(scope string, rootIdentity idtools.Identity) (*Root, error) { <ide> } <ide> <ide> r := &Root{ <del> scope: scope, <ide> path: rootDirectory, <ide> volumes: make(map[string]*localVolume), <ide> rootIdentity: rootIdentity, <ide> func New(scope string, rootIdentity idtools.Identity) (*Root, error) { <ide> // commands to create/remove dirs within its provided scope. <ide> type Root struct { <ide> m sync.Mutex <del> scope string <ide> path string <ide> quotaCtl *quota.Control <ide> volumes map[string]*localVolume <ide> func (r *Root) Remove(v volume.Volume) error { <ide> realPath = filepath.Dir(lv.path) <ide> } <ide> <del> if !r.scopedPath(realPath) { <del> return errdefs.System(errors.Errorf("Unable to remove a directory outside of the local volume root %s: %s", r.scope, realPath)) <add> if realPath == r.path || !strings.HasPrefix(realPath, r.path) { <add> return errdefs.System(errors.Errorf("unable to remove a directory outside of the local volume root %s: %s", r.path, realPath)) <ide> } <ide> <ide> if err := removePath(realPath); err != nil { <ide><path>volume/local/local_unix.go <ide> import ( <ide> "fmt" <ide> "net" <ide> "os" <del> "path/filepath" <ide> "strings" <ide> "syscall" <ide> "time" <ide> func (o *optsConfig) String() string { <ide> return fmt.Sprintf("type='%s' device='%s' o='%s' size='%d'", o.MountType, o.MountDevice, o.MountOpts, o.Quota.Size) <ide> } <ide> <del>// scopedPath verifies that the path where the volume is located <del>// is under Docker's root and the valid local paths. <del>func (r *Root) scopedPath(realPath string) bool { <del> if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) { <del> return true <del> } <del> return false <del>} <del> <ide> func setOpts(v *localVolume, opts map[string]string) error { <ide> if len(opts) == 0 { <ide> return nil <ide><path>volume/local/local_windows.go <ide> package local // import "github.com/docker/docker/volume/local" <ide> <ide> import ( <ide> "os" <del> "path/filepath" <del> "strings" <ide> "syscall" <ide> "time" <ide> <ide> import ( <ide> <ide> type optsConfig struct{} <ide> <del>// scopedPath verifies that the path where the volume is located <del>// is under Docker's root and the valid local paths. <del>func (r *Root) scopedPath(realPath string) bool { <del> if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) { <del> return true <del> } <del> return false <del>} <del> <ide> func setOpts(v *localVolume, opts map[string]string) error { <ide> if len(opts) > 0 { <ide> return errdefs.InvalidParameter(errors.New("options are not supported on this platform"))
3
Go
Go
deny net host + dns and links with container net
3256050ed44b13694d81e78d24e2c7f6006c4bbd
<ide><path>runconfig/parse.go <ide> import ( <ide> var ( <ide> ErrInvalidWorkingDirectory = fmt.Errorf("The working directory is invalid. It needs to be an absolute path.") <ide> ErrConflictAttachDetach = fmt.Errorf("Conflicting options: -a and -d") <add> ErrConflictContainerNetworkAndLinks = fmt.Errorf("Conflicting options: --net=container can't be used with links. This would result in undefined behavior.") <add> ErrConflictContainerNetworkAndDns = fmt.Errorf("Conflicting options: --net=container can't be used with --dns. This configuration is invalid.") <ide> ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d") <ide> ErrConflictNetworkHostname = fmt.Errorf("Conflicting options: -h and the network mode (--net)") <add> ErrConflictHostNetworkAndDns = fmt.Errorf("Conflicting options: --net=host can't be used with --dns. This configuration is invalid.") <ide> ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: --net=host can't be used with links. This would result in undefined behavior.") <ide> ErrConflictRestartPolicyAndAutoRemove = fmt.Errorf("Conflicting options: --restart and --rm") <ide> ) <ide> func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf <ide> return nil, nil, cmd, ErrConflictHostNetworkAndLinks <ide> } <ide> <add> if *flNetMode == "container" && flLinks.Len() > 0 { <add> return nil, nil, cmd, ErrConflictContainerNetworkAndLinks <add> } <add> <add> if *flNetMode == "host" && flDns.Len() > 0 { <add> return nil, nil, cmd, ErrConflictHostNetworkAndDns <add> } <add> <add> if *flNetMode == "container" && flDns.Len() > 0 { <add> return nil, nil, cmd, ErrConflictContainerNetworkAndDns <add> } <add> <ide> // If neither -d or -a are set, attach to everything by default <ide> if flAttach.Len() == 0 && !*flDetach { <ide> if !*flDetach {
1
Python
Python
fix additional issue
16760602cd1beaf029583db30f8283d4ca864fc0
<ide><path>celery/backends/base.py <ide> def fallback_chord_unlock(self, group_id, body, result=None, <ide> <ide> def apply_chord(self, header, partial_args, group_id, body, <ide> options={}, **kwargs): <del> options['task_id'] = group_id <del> result = header(*partial_args, **options or {}) <add> fixed_options = dict((k,v) for k,v in options.items() if k!='task_id') <add> result = header(*partial_args, task_id=group_id, **fixed_options or {}) <ide> self.fallback_chord_unlock(group_id, body, **kwargs) <ide> return result <ide>
1
Javascript
Javascript
change statsync to accesssync in realpathsync
809bf5e38cdb1fe304da9d413f07e9d7e66ce8f9
<ide><path>lib/fs.js <ide> fs.realpathSync = function realpathSync(p, cache) { <ide> } <ide> } <ide> if (linkTarget === null) { <del> fs.statSync(base); <add> fs.accessSync(base, fs.F_OK); // Throws ELOOP on cyclic links. <ide> linkTarget = fs.readlinkSync(base); <ide> } <ide> resolvedLink = pathModule.resolve(previous, linkTarget);
1
Text
Text
add v3.15.0-beta.2 to changelog
7cf8f50e11cbd1c2e975e9f77bb84847511fd314
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.15.0-beta.2 (November 11, 2019) <add> <add>- [#18539](https://github.com/emberjs/ember.js/pull/18539) [BUGFIX] Add ID to `CapturedRenderNode` <add> <ide> ### v3.15.0-beta.1 (October 31, 2019) <ide> <ide> - [#17948](https://github.com/emberjs/ember.js/pull/17948) [DEPRECATION] Deprecate `Component#isVisible` per [RFC #324](https://github.com/emberjs/rfcs/blob/master/text/0324-deprecate-component-isvisible.md).
1
Javascript
Javascript
remove message from notstrictequal
018375cd4e8381da0133bd2e1010e25386c072d2
<ide><path>test/parallel/test-domain-http-server.js <ide> const server = http.createServer(function(req, res) { <ide> const data = JSON.stringify(objects[req.url.replace(/[^a-z]/g, '')]); <ide> <ide> // this line will throw if you pick an unknown key <del> assert.notStrictEqual(data, undefined, 'Data should not be undefined'); <add> assert.notStrictEqual(data, undefined); <ide> <ide> res.writeHead(200); <ide> res.end(data);
1
PHP
PHP
apply fixes from styleci
d5a71bad602e45e54aef2c15e1cb1b8c20c46535
<ide><path>tests/Pagination/LengthAwarePaginatorTest.php <ide> public function testLengthAwarePaginatorCanGiveMeRelevantPageInformation() <ide> <ide> public function testLengthAwarePaginatorCanGenerateUrls() <ide> { <del> $this->p->setPath('http://website.com'); <del> $this->p->setPageName('foo'); <add> $this->p->setPath('http://website.com'); <add> $this->p->setPageName('foo'); <ide> <ide> $this->assertEquals('http://website.com?foo=2', <ide> $this->p->url($this->p->currentPage())); <ide> <del> $this->assertEquals('http://website.com?foo=1', <add> $this->assertEquals('http://website.com?foo=1', <ide> $this->p->url($this->p->currentPage() - 1)); <ide> <ide> $this->assertEquals('http://website.com?foo=1', <ide> public function testLengthAwarePaginatorCanGenerateUrlsWithQuery() <ide> { <ide> $this->p->setPath('http://website.com?sort_by=date'); <ide> $this->p->setPageName('foo'); <del> <del> $this->assertEquals('http://website.com?sort_by=date&foo=2', <add> <add> $this->assertEquals('http://website.com?sort_by=date&foo=2', <ide> $this->p->url($this->p->currentPage())); <ide> } <ide> <ide> public function testLengthAwarePaginatorCanGenerateUrlsWithoutTrailingSlashes() <ide> { <ide> $this->p->setPath('http://website.com/test'); <ide> $this->p->setPageName('foo'); <del> <del> $this->assertEquals('http://website.com/test?foo=2', <add> <add> $this->assertEquals('http://website.com/test?foo=2', <ide> $this->p->url($this->p->currentPage())); <ide> <del> $this->assertEquals('http://website.com/test?foo=1', <add> $this->assertEquals('http://website.com/test?foo=1', <ide> $this->p->url($this->p->currentPage() - 1)); <ide> <del> $this->assertEquals('http://website.com/test?foo=1', <add> $this->assertEquals('http://website.com/test?foo=1', <ide> $this->p->url($this->p->currentPage() - 2)); <ide> } <ide> } <ide><path>tests/Pagination/PaginatorTest.php <ide> public function testSimplePaginatorReturnsRelevantContextInformation() <ide> $this->assertTrue($p->hasPages()); <ide> $this->assertTrue($p->hasMorePages()); <ide> $this->assertEquals(['item3', 'item4'], $p->items()); <del> <add> <ide> $pageInfo = [ <del> 'per_page' => 2, <del> 'current_page' => 2, <del> 'next_page_url' => '/?page=3', <del> 'prev_page_url' => '/?page=1', <del> 'from' => 3, <del> 'to' => 4, <del> 'data' => ['item3', 'item4'], <del> ]; <add> 'per_page' => 2, <add> 'current_page' => 2, <add> 'next_page_url' => '/?page=3', <add> 'prev_page_url' => '/?page=1', <add> 'from' => 3, <add> 'to' => 4, <add> 'data' => ['item3', 'item4'], <add> ]; <ide> <ide> $this->assertEquals($pageInfo, $p->toArray()); <ide> } <ide> <ide> public function testPaginatorRemovesTrailingSlashes() <ide> { <del> $p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2, <del> ['path' => 'http://website.com/test/']); <add> $p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2, <add> ['path' => 'http://website.com/test/']); <ide> <ide> $this->assertEquals('http://website.com/test?page=1', $p->previousPageUrl()); <ide> } <ide> <ide> public function testPaginatorGeneratesUrlsWithoutTrailingSlash() <ide> { <del> $p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2, <del> ['path' => 'http://website.com/test']); <add> $p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2, <add> ['path' => 'http://website.com/test']); <ide> <ide> $this->assertEquals('http://website.com/test?page=1', $p->previousPageUrl()); <ide> } <ide><path>tests/Pagination/UrlWindowTest.php <ide> namespace Illuminate\Tests\Pagination; <ide> <ide> use PHPUnit\Framework\TestCase; <del>use Illuminate\Pagination\LengthAwarePaginator; <ide> use Illuminate\Pagination\UrlWindow; <add>use Illuminate\Pagination\LengthAwarePaginator; <ide> <ide> class UrlWindowTest extends TestCase <ide> { <ide> public function testPresenterCanGetAUrlRangeForAWindowOfLinks() <ide> } <ide> <ide> $this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [12 => '/?page=12', 13 => '/?page=13']], $window->get()); <del> <add> <ide> /* <ide> * Test Being Near The End Of The List <ide> */ <ide> public function testPresenterCanGetAUrlRangeForAWindowOfLinks() <ide> for ($i = 5; $i <= 13; $i++) { <ide> $last[$i] = '/?page='.$i; <ide> } <del> <add> <ide> $this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => null, 'last' => $last], $window->get()); <ide> } <ide> }
3
PHP
PHP
fix tests for php 7
8021540aaf020f1a2e2fafccba89a4783a9fc262
<ide><path>tests/Queue/QueueBeanstalkdJobTest.php <ide> public function testFailedProperlyCallsTheJobHandler() <ide> $job = $this->getJob(); <ide> $job->getPheanstalkJob()->shouldReceive('getData')->once()->andReturn(json_encode(['job' => 'foo', 'data' => ['data']])); <ide> $job->getContainer()->shouldReceive('make')->once()->with('foo')->andReturn($handler = m::mock('BeanstalkdJobTestFailedTest')); <del> $handler->shouldReceive('failed')->once()->with(['data'], m::type('Throwable')); <add> $handler->shouldReceive('failed')->once()->with(['data'], m::type('Exception')); <ide> <ide> $job->failed(new Exception); <ide> } <ide><path>tests/Queue/QueueWorkerTest.php <ide> public function test_exception_is_reported_if_connection_throws_exception_on_job <ide> $this->exceptionHandler->shouldHaveReceived('report')->with($e); <ide> } <ide> <del> public function test_exception_is_reported_if_connection_throws_fatal_throwable_on_job_pop() <del> { <del> $worker = new InsomniacWorker( <del> new WorkerFakeManager('default', new BrokenQueueConnection($e = new Error('something'))), <del> $this->events, <del> $this->exceptionHandler <del> ); <del> <del> $worker->runNextJob('default', 'queue', $this->workerOptions()); <del> <del> $this->exceptionHandler->shouldHaveReceived('report')->with(Mockery::type(FatalThrowableError::class)); <del> } <del> <ide> public function test_worker_sleeps_when_queue_is_empty() <ide> { <ide> $worker = $this->getWorker('default', ['queue' => []]);
2
Javascript
Javascript
preserve error codes for invariants on www
76b4ba01290f446f4313adf3846954412c6051b8
<ide><path>packages/shared/forks/reactProdInvariant.www.js <add>/** <add> * Copyright (c) 2013-present, Facebook, Inc. <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 <add> */ <add> <add>const invariant = require('invariant'); <add> <add>function reactProdInvariant(code: string): void { <add> const argCount = arguments.length - 1; <add> <add> let message = <add> 'Minified React error #' + <add> code + <add> '; visit ' + <add> 'http://reactjs.org/docs/error-decoder.html?invariant=' + <add> code; <add> <add> for (let argIdx = 0; argIdx < argCount; argIdx++) { <add> message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); <add> } <add> <add> message += <add> ' for the full message or use the non-minified dev environment' + <add> ' for full errors and additional helpful warnings.'; <add> <add> // www doesn't strip this because we mark the React bundle <add> // with @preserve-invariant-messages docblock. <add> const i = invariant; <add> // However, we call it with a different name to avoid <add> // transforming this file itself as part of React's own build. <add> i(false, message); <add>} <add> <add>export default reactProdInvariant; <ide><path>packages/shared/reactProdInvariant.js <ide> function reactProdInvariant(code: string): void { <ide> ' for the full message or use the non-minified dev environment' + <ide> ' for full errors and additional helpful warnings.'; <ide> <add> // Note: if you update the code above, don't forget <add> // to update the www fork in forks/reactProdInvariant.www.js. <add> <ide> const error: Error & {framesToPop?: number} = new Error(message); <ide> error.name = 'Invariant Violation'; <ide> error.framesToPop = 1; // we don't care about reactProdInvariant's own frame <ide><path>scripts/rollup/build.js <ide> function getBabelConfig(updateBabelOptions, bundleType, filename) { <ide> switch (bundleType) { <ide> case FB_DEV: <ide> case FB_PROD: <add> return Object.assign({}, options, { <add> plugins: options.plugins.concat([ <add> // Minify invariant messages <add> require('../error-codes/replace-invariant-error-codes'), <add> // Wrap warning() calls in a __DEV__ check so they are stripped from production. <add> require('../babel/wrap-warning-with-env-check'), <add> ]), <add> }); <ide> case RN_DEV: <ide> case RN_PROD: <ide> return Object.assign({}, options, { <ide><path>scripts/rollup/forks.js <ide> const forks = Object.freeze({ <ide> } <ide> }, <ide> <add> // Route production invariants on www through the www invariant module. <add> 'shared/reactProdInvariant': (bundleType, entry) => { <add> switch (bundleType) { <add> case FB_DEV: <add> case FB_PROD: <add> return 'shared/forks/reactProdInvariant.www.js'; <add> default: <add> return null; <add> } <add> }, <add> <ide> // Different dialogs for caught errors. <ide> 'react-reconciler/src/ReactFiberErrorDialog': (bundleType, entry) => { <ide> switch (bundleType) { <ide><path>scripts/rollup/wrappers.js <ide> ${license} <ide> * <ide> * @noflow <ide> * @preventMunge <add> * @preserve-invariant-messages <ide> */ <ide> <ide> 'use strict'; <ide> ${license} <ide> * <ide> * @noflow <ide> * @preventMunge <add> * @preserve-invariant-messages <ide> */ <ide> <ide> ${source}`;
5
Javascript
Javascript
send fatal error for js exception in eventemitter
db617e56a308de0db09c93e73a05d7627653ff11
<ide><path>Libraries/vendor/emitter/EventEmitter.js <ide> /** <del> * @generated SignedSource<<494e66dea72a3e90b763a5ec50b1e0ca>> <add> * Copyright (c) 2015-present, Facebook, Inc. <add> * All rights reserved. <ide> * <del> * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <del> * !! This file is a check-in of a static_upstream project! !! <del> * !! !! <del> * !! You should not modify this file directly. Instead: !! <del> * !! 1) Use `fjs use-upstream` to temporarily replace this with !! <del> * !! the latest version from upstream. !! <del> * !! 2) Make your changes, test them, etc. !! <del> * !! 3) Use `fjs push-upstream` to copy your changes back to !! <del> * !! static_upstream. !! <del> * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <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. <ide> * <ide> * @providesModule EventEmitter <ide> * @typechecks <ide> class EventEmitter { <ide> // The subscription may have been removed during this event loop. <ide> if (subscription) { <ide> this._currentSubscription = subscription; <del> <del> ErrorUtils.applyWithGuard( <del> subscription.listener, <add> subscription.listener.apply( <ide> subscription.context, <del> Array.prototype.slice.call(arguments, 1), <del> null, <del> 'EventEmitter:' + eventType <add> Array.prototype.slice.call(arguments, 1) <ide> ); <ide> } <ide> }
1
Javascript
Javascript
remove unneeded closure
345f9cc287c2a5d5e3c4ac96a4f3cebc6779dfa4
<ide><path>src/loaders/ObjectLoader.js <ide> Object.assign( ObjectLoader.prototype, { <ide> <ide> }, <ide> <del> parseObject: function () { <add> parseObject: function ( data, geometries, materials ) { <ide> <del> return function parseObject( data, geometries, materials ) { <add> var object; <ide> <del> var object; <add> function getGeometry( name ) { <ide> <del> function getGeometry( name ) { <add> if ( geometries[ name ] === undefined ) { <ide> <del> if ( geometries[ name ] === undefined ) { <del> <del> console.warn( 'THREE.ObjectLoader: Undefined geometry', name ); <del> <del> } <del> <del> return geometries[ name ]; <add> console.warn( 'THREE.ObjectLoader: Undefined geometry', name ); <ide> <ide> } <ide> <del> function getMaterial( name ) { <add> return geometries[ name ]; <ide> <del> if ( name === undefined ) return undefined; <add> } <ide> <del> if ( Array.isArray( name ) ) { <add> function getMaterial( name ) { <ide> <del> var array = []; <add> if ( name === undefined ) return undefined; <ide> <del> for ( var i = 0, l = name.length; i < l; i ++ ) { <add> if ( Array.isArray( name ) ) { <ide> <del> var uuid = name[ i ]; <add> var array = []; <ide> <del> if ( materials[ uuid ] === undefined ) { <add> for ( var i = 0, l = name.length; i < l; i ++ ) { <ide> <del> console.warn( 'THREE.ObjectLoader: Undefined material', uuid ); <add> var uuid = name[ i ]; <ide> <del> } <add> if ( materials[ uuid ] === undefined ) { <ide> <del> array.push( materials[ uuid ] ); <add> console.warn( 'THREE.ObjectLoader: Undefined material', uuid ); <ide> <ide> } <ide> <del> return array; <add> array.push( materials[ uuid ] ); <ide> <ide> } <ide> <del> if ( materials[ name ] === undefined ) { <add> return array; <ide> <del> console.warn( 'THREE.ObjectLoader: Undefined material', name ); <add> } <ide> <del> } <add> if ( materials[ name ] === undefined ) { <ide> <del> return materials[ name ]; <add> console.warn( 'THREE.ObjectLoader: Undefined material', name ); <ide> <ide> } <ide> <del> switch ( data.type ) { <add> return materials[ name ]; <add> <add> } <ide> <del> case 'Scene': <add> switch ( data.type ) { <ide> <del> object = new Scene(); <add> case 'Scene': <ide> <del> if ( data.background !== undefined ) { <add> object = new Scene(); <ide> <del> if ( Number.isInteger( data.background ) ) { <add> if ( data.background !== undefined ) { <ide> <del> object.background = new Color( data.background ); <add> if ( Number.isInteger( data.background ) ) { <ide> <del> } <add> object.background = new Color( data.background ); <ide> <ide> } <ide> <del> if ( data.fog !== undefined ) { <add> } <ide> <del> if ( data.fog.type === 'Fog' ) { <add> if ( data.fog !== undefined ) { <ide> <del> object.fog = new Fog( data.fog.color, data.fog.near, data.fog.far ); <add> if ( data.fog.type === 'Fog' ) { <ide> <del> } else if ( data.fog.type === 'FogExp2' ) { <add> object.fog = new Fog( data.fog.color, data.fog.near, data.fog.far ); <ide> <del> object.fog = new FogExp2( data.fog.color, data.fog.density ); <add> } else if ( data.fog.type === 'FogExp2' ) { <ide> <del> } <add> object.fog = new FogExp2( data.fog.color, data.fog.density ); <ide> <ide> } <ide> <del> break; <add> } <ide> <del> case 'PerspectiveCamera': <add> break; <ide> <del> object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); <add> case 'PerspectiveCamera': <ide> <del> if ( data.focus !== undefined ) object.focus = data.focus; <del> if ( data.zoom !== undefined ) object.zoom = data.zoom; <del> if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge; <del> if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset; <del> if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); <add> object = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far ); <ide> <del> break; <add> if ( data.focus !== undefined ) object.focus = data.focus; <add> if ( data.zoom !== undefined ) object.zoom = data.zoom; <add> if ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge; <add> if ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset; <add> if ( data.view !== undefined ) object.view = Object.assign( {}, data.view ); <ide> <del> case 'OrthographicCamera': <add> break; <ide> <del> object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); <add> case 'OrthographicCamera': <ide> <del> break; <add> object = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far ); <ide> <del> case 'AmbientLight': <add> break; <ide> <del> object = new AmbientLight( data.color, data.intensity ); <add> case 'AmbientLight': <ide> <del> break; <add> object = new AmbientLight( data.color, data.intensity ); <ide> <del> case 'DirectionalLight': <add> break; <ide> <del> object = new DirectionalLight( data.color, data.intensity ); <add> case 'DirectionalLight': <ide> <del> break; <add> object = new DirectionalLight( data.color, data.intensity ); <ide> <del> case 'PointLight': <add> break; <ide> <del> object = new PointLight( data.color, data.intensity, data.distance, data.decay ); <add> case 'PointLight': <ide> <del> break; <add> object = new PointLight( data.color, data.intensity, data.distance, data.decay ); <ide> <del> case 'RectAreaLight': <add> break; <ide> <del> object = new RectAreaLight( data.color, data.intensity, data.width, data.height ); <add> case 'RectAreaLight': <ide> <del> break; <add> object = new RectAreaLight( data.color, data.intensity, data.width, data.height ); <ide> <del> case 'SpotLight': <add> break; <ide> <del> object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay ); <add> case 'SpotLight': <ide> <del> break; <add> object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay ); <ide> <del> case 'HemisphereLight': <add> break; <ide> <del> object = new HemisphereLight( data.color, data.groundColor, data.intensity ); <add> case 'HemisphereLight': <ide> <del> break; <add> object = new HemisphereLight( data.color, data.groundColor, data.intensity ); <ide> <del> case 'SkinnedMesh': <add> break; <ide> <del> console.warn( 'THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.' ); <add> case 'SkinnedMesh': <ide> <del> case 'Mesh': <add> console.warn( 'THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.' ); <ide> <del> var geometry = getGeometry( data.geometry ); <del> var material = getMaterial( data.material ); <add> case 'Mesh': <ide> <del> if ( geometry.bones && geometry.bones.length > 0 ) { <add> var geometry = getGeometry( data.geometry ); <add> var material = getMaterial( data.material ); <ide> <del> object = new SkinnedMesh( geometry, material ); <add> if ( geometry.bones && geometry.bones.length > 0 ) { <ide> <del> } else { <add> object = new SkinnedMesh( geometry, material ); <ide> <del> object = new Mesh( geometry, material ); <add> } else { <ide> <del> } <add> object = new Mesh( geometry, material ); <ide> <del> break; <add> } <ide> <del> case 'LOD': <add> break; <ide> <del> object = new LOD(); <add> case 'LOD': <ide> <del> break; <add> object = new LOD(); <ide> <del> case 'Line': <add> break; <ide> <del> object = new Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode ); <add> case 'Line': <ide> <del> break; <add> object = new Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode ); <ide> <del> case 'LineLoop': <add> break; <ide> <del> object = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) ); <add> case 'LineLoop': <ide> <del> break; <add> object = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) ); <ide> <del> case 'LineSegments': <add> break; <ide> <del> object = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) ); <add> case 'LineSegments': <ide> <del> break; <add> object = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) ); <ide> <del> case 'PointCloud': <del> case 'Points': <add> break; <ide> <del> object = new Points( getGeometry( data.geometry ), getMaterial( data.material ) ); <add> case 'PointCloud': <add> case 'Points': <ide> <del> break; <add> object = new Points( getGeometry( data.geometry ), getMaterial( data.material ) ); <ide> <del> case 'Sprite': <add> break; <ide> <del> object = new Sprite( getMaterial( data.material ) ); <add> case 'Sprite': <ide> <del> break; <add> object = new Sprite( getMaterial( data.material ) ); <ide> <del> case 'Group': <add> break; <ide> <del> object = new Group(); <add> case 'Group': <ide> <del> break; <add> object = new Group(); <ide> <del> default: <add> break; <ide> <del> object = new Object3D(); <add> default: <ide> <del> } <add> object = new Object3D(); <ide> <del> object.uuid = data.uuid; <add> } <ide> <del> if ( data.name !== undefined ) object.name = data.name; <del> if ( data.matrix !== undefined ) { <add> object.uuid = data.uuid; <ide> <del> object.matrix.fromArray( data.matrix ); <del> object.matrix.decompose( object.position, object.quaternion, object.scale ); <add> if ( data.name !== undefined ) object.name = data.name; <add> if ( data.matrix !== undefined ) { <ide> <del> } else { <add> object.matrix.fromArray( data.matrix ); <add> object.matrix.decompose( object.position, object.quaternion, object.scale ); <ide> <del> if ( data.position !== undefined ) object.position.fromArray( data.position ); <del> if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); <del> if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion ); <del> if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); <add> } else { <ide> <del> } <add> if ( data.position !== undefined ) object.position.fromArray( data.position ); <add> if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); <add> if ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion ); <add> if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); <ide> <del> if ( data.castShadow !== undefined ) object.castShadow = data.castShadow; <del> if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow; <add> } <ide> <del> if ( data.shadow ) { <add> if ( data.castShadow !== undefined ) object.castShadow = data.castShadow; <add> if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow; <ide> <del> if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias; <del> if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius; <del> if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize ); <del> if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera ); <add> if ( data.shadow ) { <ide> <del> } <add> if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias; <add> if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius; <add> if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize ); <add> if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera ); <ide> <del> if ( data.visible !== undefined ) object.visible = data.visible; <del> if ( data.userData !== undefined ) object.userData = data.userData; <add> } <ide> <del> if ( data.children !== undefined ) { <add> if ( data.visible !== undefined ) object.visible = data.visible; <add> if ( data.userData !== undefined ) object.userData = data.userData; <ide> <del> var children = data.children; <add> if ( data.children !== undefined ) { <ide> <del> for ( var i = 0; i < children.length; i ++ ) { <add> var children = data.children; <ide> <del> object.add( this.parseObject( children[ i ], geometries, materials ) ); <add> for ( var i = 0; i < children.length; i ++ ) { <ide> <del> } <add> object.add( this.parseObject( children[ i ], geometries, materials ) ); <ide> <ide> } <ide> <del> if ( data.type === 'LOD' ) { <add> } <ide> <del> var levels = data.levels; <add> if ( data.type === 'LOD' ) { <ide> <del> for ( var l = 0; l < levels.length; l ++ ) { <add> var levels = data.levels; <ide> <del> var level = levels[ l ]; <del> var child = object.getObjectByProperty( 'uuid', level.object ); <add> for ( var l = 0; l < levels.length; l ++ ) { <ide> <del> if ( child !== undefined ) { <add> var level = levels[ l ]; <add> var child = object.getObjectByProperty( 'uuid', level.object ); <ide> <del> object.addLevel( child, level.distance ); <add> if ( child !== undefined ) { <ide> <del> } <add> object.addLevel( child, level.distance ); <ide> <ide> } <ide> <ide> } <ide> <del> return object; <add> } <ide> <del> }; <add> return object; <ide> <del> }() <add> } <ide> <ide> } ); <ide>
1
Java
Java
fix javadoc formatting issue in testsocketutils
8e64701cb74aaded6f647d3c9aa0d186b8654b0b
<ide><path>spring-test/src/main/java/org/springframework/test/util/TestSocketUtils.java <ide> public class TestSocketUtils { <ide> /** <ide> * Although {@code TestSocketUtils} consists solely of static utility methods, <ide> * this constructor is intentionally {@code public}. <del> * <h4>Rationale</h4> <add> * <h5>Rationale</h5> <ide> * <p>Static methods from this class may be invoked from within XML <ide> * configuration files using the Spring Expression Language (SpEL) and the <ide> * following syntax.
1
PHP
PHP
remove irrelevant comment
c5b8fca9228cf6f47ced3438746e4e15b7ed263a
<ide><path>src/View/Helper/FormHelper.php <ide> public function allInputs(array $fields = [], array $options = []) { <ide> * You can customize individual inputs through `$fields`. <ide> * {{{ <ide> * $this->Form->inputs([ <del> * 'name' => ['label' => 'custom label'] <add> * 'name' => ['label' => 'custom label'], <add> * 'email' <ide> * ]); <ide> * }}} <ide> * <del> * In the above example, no field would be generated for the title field. <del> * <ide> * @param array $fields An array of customizations for the fields that will be <ide> * generated. This array allows you to set custom types, labels, or other options. <ide> * @param array $options Options array. Valid keys are:
1
PHP
PHP
fix more failures around identifier quoting
d1a0ff17926b031d318eb6c7900db9329aa7a56a
<ide><path>src/Database/Expression/ValuesExpression.php <ide> protected function _columnNames() <ide> { <ide> $columns = []; <ide> foreach ($this->_columns as $col) { <del> $columns[] = trim($col, '`[]"'); <add> if (is_string($col)) { <add> $col = trim($col, '`[]"'); <add> } <add> $columns[] = $col; <ide> } <ide> return $columns; <ide> }
1
Text
Text
update changelog for release (0.19.0)
3f7451ceb7b8386a0c233b869dddea1fea05b12f
<ide><path>CHANGELOG.md <ide> # Changelog <ide> <add>### 0.19.0 (May 30, 2019) <add> <add>Fixes and Functionality: <add> <add>- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski <add>- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issue/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev <add>- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama <add>- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester <add>- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers <add>- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel <add>- Consistent coding style ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez <add>- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov <add>- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#` <add>- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson <add>- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi <add>- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta <add>- Fix failing SauceLabs tests by updating configuration - Emily Morehouse <add> <add>Documentation: <add> <add>- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna <add>- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho <add>- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan <add>- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX <add>- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes <add>- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty <add>- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai <add>- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher <add>- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe <add>- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser <add>- Add issue templates - Emily Morehouse <add>- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko <add>- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan <add>- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer <add> <ide> ### 0.19.0-beta.1 (Aug 9, 2018) <ide> <ide> **NOTE:** This is a beta version of this release. There may be functionality that is broken in
1
Python
Python
update urls.py because of new version of django.
c0f0f66c6d30111f27898008061be8a7b7b20dc3
<ide><path>examples/django/proj/urls.py <ide> from __future__ import absolute_import, unicode_literals <ide> <ide> from django.conf.urls import ( # noqa <del> patterns, include, url, handler404, handler500, <add> include, url, handler404, handler500, <ide> ) <ide> <ide> # Uncomment the next two lines to enable the admin: <ide> # from django.contrib import admin <ide> # admin.autodiscover() <ide> <del>urlpatterns = patterns( <del> '', <add>urlpatterns = [ <ide> # Examples: <ide> # url(r'^$', 'proj.views.home', name='home'), <ide> # url(r'^proj/', include('proj.foo.urls')), <ide> <ide> # Uncomment the next line to enable the admin: <ide> # url(r'^admin/', include(admin.site.urls)), <del>) <add>]
1
Javascript
Javascript
fix extend_prototypes for sproutcore-handlebars
6c6b8f9b21b79c69f6c19ff2f27ac57db72f38b8
<ide><path>packages/sproutcore-handlebars/lib/helpers/binding.js <ide> SC.Handlebars.bindClasses = function(context, classBindings, view, id) { <ide> // Normalize property path to be suitable for use <ide> // as a class name. For exaple, content.foo.barBaz <ide> // becomes bar-baz. <del> return SC.String.dasherize(get(property.split('.'), 'lastObject')); <add> var parts = property.split('.'); <add> return SC.String.dasherize(parts[parts.length-1]); <ide> <ide> // If the value is not NO, undefined, or null, return the current <ide> // value of the property. <ide><path>packages/sproutcore-handlebars/lib/helpers/collection.js <ide> require('sproutcore-handlebars'); <ide> require('sproutcore-handlebars/helpers/view'); <ide> <del>var get = SC.get; <add>var get = SC.get, fmt = SC.String.fmt; <ide> <ide> /** <ide> @name Handlebars.helpers.collection <ide> SC.Handlebars.registerHelper('collection', function(path, options) { <ide> // Otherwise, just default to the standard class. <ide> var collectionClass; <ide> collectionClass = path ? SC.getPath(this, path) : SC.CollectionView; <del> sc_assert("%@ #collection: Could not find %@".fmt(data.view, path), !!collectionClass); <add> sc_assert(fmt("%@ #collection: Could not find %@", data.view, path), !!collectionClass); <ide> <ide> var hash = options.hash, itemHash = {}, match; <ide> <ide> SC.Handlebars.registerHelper('collection', function(path, options) { <ide> var collectionPrototype = get(collectionClass, 'proto'); <ide> delete hash.itemViewClass; <ide> itemViewClass = itemViewPath ? SC.getPath(collectionPrototype, itemViewPath) : collectionPrototype.itemViewClass; <del> sc_assert("%@ #collection: Could not find %@".fmt(data.view, itemViewPath), !!itemViewClass); <add> sc_assert(fmt("%@ #collection: Could not find %@", data.view, itemViewPath), !!itemViewClass); <ide> <ide> // Go through options passed to the {{collection}} helper and extract options <ide> // that configure item views instead of the collection itself. <ide><path>packages/sproutcore-handlebars/tests/each_test.js <ide> test("it updates the view if an item is added", function() { <ide> test("it allows you to access the current context using {{this}}", function() { <ide> view = SC.View.create({ <ide> template: templateFor("{{#each people}}{{this}}{{/each}}"), <del> people: ['Black Francis', 'Joey Santiago', 'Kim Deal', 'David Lovering'] <add> people: SC.NativeArray.apply(['Black Francis', 'Joey Santiago', 'Kim Deal', 'David Lovering']) <ide> }); <ide> <ide> append(view); <ide><path>packages/sproutcore-handlebars/tests/handlebars_test.js <ide> test("should update the block when object passed to #if helper changes", functio <ide> set(view, 'inception', val); <ide> }); <ide> <del> equals(view.$('h1').text(), '', "hides block when conditional is '%@'".fmt(val)); <add> equals(view.$('h1').text(), '', SC.String.fmt("hides block when conditional is '%@'", String(val))); <ide> <ide> SC.run(function() { <ide> set(view, 'inception', true); <ide> test("should update the block when object passed to #unless helper changes", fun <ide> set(view, 'onDrugs', val); <ide> }); <ide> <del> equals(view.$('h1').text(), 'Eat your vegetables', "renders block when conditional is '%@'; %@".fmt(val, SC.typeOf(val))); <add> equals(view.$('h1').text(), 'Eat your vegetables', SC.String.fmt("renders block when conditional is '%@'; %@", String(val), SC.typeOf(val))); <ide> <ide> SC.run(function() { <ide> set(view, 'onDrugs', true); <ide> test("should update the block when object passed to #if helper changes and an in <ide> set(view, 'inception', val); <ide> }); <ide> <del> equals(view.$('h1').text(), 'BOONG?', "renders alternate if %@".fmt(val)); <add> equals(view.$('h1').text(), 'BOONG?', SC.String.fmt("renders alternate if %@", String(val))); <ide> <ide> SC.run(function() { <ide> set(view, 'inception', true); <ide> test("Collection views that specify an example view class have their children be <ide> isCustom: true <ide> }), <ide> <del> content: ['foo'] <add> content: SC.NativeArray.apply(['foo']) <ide> }); <ide> <ide> var parentView = SC.View.create({ <ide> test("Collection views that specify an example view class have their children be <ide> <ide> test("itemViewClass works in the #collection helper", function() { <ide> TemplateTests.ExampleController = SC.ArrayProxy.create({ <del> content: ['alpha'] <add> content: SC.NativeArray.apply(['alpha']) <ide> }); <ide> <ide> TemplateTests.ExampleItemView = SC.View.extend({ <ide> test("itemViewClass works in the #collection helper", function() { <ide> <ide> test("itemViewClass works in the #collection helper relatively", function() { <ide> TemplateTests.ExampleController = SC.ArrayProxy.create({ <del> content: ['alpha'] <add> content: SC.NativeArray.apply(['alpha']) <ide> }); <ide> <ide> TemplateTests.ExampleItemView = SC.View.extend({ <ide> test("the {{this}} helper should not fail on removal", function(){ <ide> view = SC.View.create({ <ide> template: SC.Handlebars.compile('{{#if show}}{{#each list}}{{this}}{{/each}}{{/if}}'), <ide> show: true, <del> list: ['a', 'b', 'c'] <add> list: SC.NativeArray.apply(['a', 'b', 'c']) <ide> }); <ide> <ide> appendView(); <ide><path>packages/sproutcore-handlebars/tests/views/collection_view_test.js <ide> module("sproutcore-handlebars/tests/views/collection_view_test", { <ide> test("passing a block to the collection helper sets it as the template for example views", function() { <ide> TemplateTests.CollectionTestView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo', 'bar', 'baz'] <add> content: SC.NativeArray.apply(['foo', 'bar', 'baz']) <ide> }); <ide> <ide> view = SC.View.create({ <ide> test("collection helper should accept relative paths", function() { <ide> template: SC.Handlebars.compile('{{#collection collection}} <label></label> {{/collection}}'), <ide> collection: SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo', 'bar', 'baz'] <add> content: SC.NativeArray.apply(['foo', 'bar', 'baz']) <ide> }) <ide> }); <ide> <ide> test("empty views should be removed when content is added to the collection (reg <ide> }); <ide> <ide> App.ListController = SC.ArrayProxy.create({ <del> content : [] <add> content : SC.NativeArray.apply([]) <ide> }); <ide> <ide> view = SC.View.create({ <ide> test("empty views should be removed when content is added to the collection (reg <ide> test("if no content is passed, and no 'else' is specified, nothing is rendered", function() { <ide> TemplateTests.CollectionTestView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: [] <add> content: SC.NativeArray.apply([]) <ide> }); <ide> <ide> view = SC.View.create({ <ide> test("if no content is passed, and no 'else' is specified, nothing is rendered", <ide> test("if no content is passed, and 'else' is specified, the else block is rendered", function() { <ide> TemplateTests.CollectionTestView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: [] <add> content: SC.NativeArray.apply([]) <ide> }); <ide> <ide> view = SC.View.create({ <ide> test("if no content is passed, and 'else' is specified, the else block is render <ide> test("a block passed to a collection helper defaults to the content property of the context", function() { <ide> TemplateTests.CollectionTestView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo', 'bar', 'baz'] <add> content: SC.NativeArray.apply(['foo', 'bar', 'baz']) <ide> }); <ide> <ide> view = SC.View.create({ <ide> test("a block passed to a collection helper defaults to the content property of <ide> test("a block passed to a collection helper defaults to the view", function() { <ide> TemplateTests.CollectionTestView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo', 'bar', 'baz'] <add> content: SC.NativeArray.apply(['foo', 'bar', 'baz']) <ide> }); <ide> <ide> view = SC.View.create({ <ide> test("a block passed to a collection helper defaults to the view", function() { <ide> equals(view.$('li:has(label:contains("foo")) + li:has(label:contains("bar")) + li:has(label:contains("baz"))').length, 1, 'precond - one aside element is created for each content item'); <ide> <ide> SC.run(function() { <del> set(firstChild(view), 'content', []); <add> set(firstChild(view), 'content', SC.NativeArray.apply([])); <ide> }); <ide> equals(view.$('label').length, 0, "all list item views should be removed from DOM"); <ide> }); <ide> <ide> test("should include an id attribute if id is set in the options hash", function() { <ide> TemplateTests.CollectionTestView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo', 'bar', 'baz'] <add> content: SC.NativeArray.apply(['foo', 'bar', 'baz']) <ide> }); <ide> <ide> var view = SC.View.create({ <ide> test("should include an id attribute if id is set in the options hash", function <ide> test("should give its item views the class specified by itemClass", function() { <ide> TemplateTests.itemClassTestCollectionView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo', 'bar', 'baz'] <add> content: SC.NativeArray.apply(['foo', 'bar', 'baz']) <ide> }); <ide> var view = SC.View.create({ <ide> template: SC.Handlebars.compile('{{#collection "TemplateTests.itemClassTestCollectionView" itemClass="baz"}}foo{{/collection}}') <ide> test("should give its item views the class specified by itemClass", function() { <ide> test("should give its item views the classBinding specified by itemClassBinding", function() { <ide> TemplateTests.itemClassBindingTestCollectionView = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: [SC.Object.create({ isBaz: false }), SC.Object.create({ isBaz: true }), SC.Object.create({ isBaz: true })] <add> content: SC.NativeArray.apply([SC.Object.create({ isBaz: false }), SC.Object.create({ isBaz: true }), SC.Object.create({ isBaz: true })]) <ide> }); <ide> <ide> var view = SC.View.create({ <ide> test("should give its item views the classBinding specified by itemClassBinding" <ide> }); <ide> <ide> test("should work inside a bound {{#if}}", function() { <del> var testData = [SC.Object.create({ isBaz: false }), SC.Object.create({ isBaz: true }), SC.Object.create({ isBaz: true })]; <add> var testData = SC.NativeArray.apply([SC.Object.create({ isBaz: false }), SC.Object.create({ isBaz: true }), SC.Object.create({ isBaz: true })]); <ide> TemplateTests.ifTestCollectionView = SC.CollectionView.extend({ <ide> tagName: 'ul', <ide> content: testData <ide> test("should pass content as context when using {{#each}} helper", function() { <ide> var view = SC.View.create({ <ide> template: SC.Handlebars.compile('{{#each releases}}Mac OS X {{version}}: {{name}} {{/each}}'), <ide> <del> releases: [ { version: '10.7', <add> releases: SC.NativeArray.apply([ <add> { version: '10.7', <ide> name: 'Lion' }, <ide> { version: '10.6', <ide> name: 'Snow Leopard' }, <ide> { version: '10.5', <del> name: 'Leopard' } ] <add> name: 'Leopard' } <add> ]) <ide> }); <ide> <ide> SC.run(function() { view.appendTo('#qunit-fixture'); }); <ide> test("should pass content as context when using {{#each}} helper", function() { <ide> test("should re-render when the content object changes", function() { <ide> TemplateTests.RerenderTest = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: [] <add> content: SC.NativeArray.apply([]) <ide> }); <ide> <ide> var view = SC.View.create({ <ide> test("should re-render when the content object changes", function() { <ide> }); <ide> <ide> SC.run(function() { <del> set(firstChild(view), 'content', ['bing', 'bat', 'bang']); <add> set(firstChild(view), 'content', SC.NativeArray.apply(['bing', 'bat', 'bang'])); <ide> }); <ide> <ide> SC.run(function() { <del> set(firstChild(view), 'content', ['ramalamadingdong']); <add> set(firstChild(view), 'content', SC.NativeArray.apply(['ramalamadingdong'])); <ide> }); <ide> <ide> equals(view.$('li').length, 1, "rerenders with correct number of items"); <ide> test("should re-render when the content object changes", function() { <ide> <ide> test("select tagName on collection helper automatically sets child tagName to option", function() { <ide> TemplateTests.RerenderTest = SC.CollectionView.extend({ <del> content: ['foo'] <add> content: SC.NativeArray.apply(['foo']) <ide> }); <ide> <ide> var view = SC.View.create({ <ide> test("select tagName on collection helper automatically sets child tagName to op <ide> <ide> test("tagName works in the #collection helper", function() { <ide> TemplateTests.RerenderTest = SC.CollectionView.extend({ <del> content: ['foo', 'bar'] <add> content: SC.NativeArray.apply(['foo', 'bar']) <ide> }); <ide> <ide> var view = SC.View.create({ <ide> test("tagName works in the #collection helper", function() { <ide> equals(view.$('li').length, 2, "rerenders with correct number of items"); <ide> <ide> SC.run(function() { <del> set(firstChild(view), 'content', ['bing', 'bat', 'bang']); <add> set(firstChild(view), 'content', SC.NativeArray.apply(['bing', 'bat', 'bang'])); <ide> }); <ide> <ide> equals(view.$('li').length, 3, "rerenders with correct number of items"); <ide> test("should render nested collections", function() { <ide> <ide> TemplateTests.InnerList = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['one','two','three'] <add> content: SC.NativeArray.apply(['one','two','three']) <ide> }); <ide> <ide> TemplateTests.OuterList = SC.CollectionView.extend({ <ide> tagName: 'ul', <del> content: ['foo'] <add> content: SC.NativeArray.apply(['foo']) <ide> }); <ide> <ide> var view = SC.View.create({ <ide> test("should render multiple, bound nested collections (#68)", function() { <ide> <ide> SC.run(function() { <ide> TemplateTests.contentController = SC.ArrayProxy.create({ <del> content: ['foo','bar'] <add> content: SC.NativeArray.apply(['foo','bar']) <ide> }); <ide> <ide> TemplateTests.InnerList = SC.CollectionView.extend({ <ide> test("should render multiple, bound nested collections (#68)", function() { <ide> <ide> TemplateTests.OuterListItem = SC.View.extend({ <ide> template: SC.Handlebars.compile('{{#collection TemplateTests.InnerList class="inner"}}{{content}}{{/collection}}{{content}}'), <del> innerListContent: function() { return [1,2,3]; }.property().cacheable() <add> innerListContent: function() { return SC.NativeArray.apply([1,2,3]); }.property().cacheable() <ide> }); <ide> <ide> TemplateTests.OuterList = SC.CollectionView.extend({ <ide> test("should allow view objects to be swapped out without throwing an error (#78 <ide> SC.run(function() { <ide> dataset = SC.Object.create({ <ide> ready: true, <del> items: [1,2,3] <add> items: SC.NativeArray.apply([1,2,3]) <ide> }); <ide> TemplateTests.datasetController.set('dataset',dataset); <ide> });
5
Python
Python
add doctests and support for negative numbers
e41d04112fcaaceb286b0fd6d55a162af0893593
<ide><path>maths/extended_euclidean_algorithm.py <ide> <ide> Finds 2 numbers a and b such that it satisfies <ide> the equation am + bn = gcd(m, n) (a.k.a Bezout's Identity) <add> <add>https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm <ide> """ <ide> <ide> # @Author: S. Sharma <silentcat> <ide> # @Date: 2019-02-25T12:08:53-06:00 <ide> # @Email: silentcat@protonmail.com <del># @Last modified by: PatOnTheBack <del># @Last modified time: 2019-07-05 <add># @Last modified by: pikulet <add># @Last modified time: 2020-10-02 <ide> <ide> import sys <add>from typing import Tuple <ide> <ide> <del>def extended_euclidean_algorithm(m, n): <add>def extended_euclidean_algorithm(a: int, b: int) -> Tuple[int, int]: <ide> """ <ide> Extended Euclidean Algorithm. <ide> <ide> Finds 2 numbers a and b such that it satisfies <ide> the equation am + bn = gcd(m, n) (a.k.a Bezout's Identity) <add> <add> >>> extended_euclidean_algorithm(1, 24) <add> (1, 0) <add> <add> >>> extended_euclidean_algorithm(8, 14) <add> (2, -1) <add> <add> >>> extended_euclidean_algorithm(240, 46) <add> (-9, 47) <add> <add> >>> extended_euclidean_algorithm(1, -4) <add> (1, 0) <add> <add> >>> extended_euclidean_algorithm(-2, -4) <add> (-1, 0) <add> <add> >>> extended_euclidean_algorithm(0, -4) <add> (0, -1) <add> <add> >>> extended_euclidean_algorithm(2, 0) <add> (1, 0) <add> <ide> """ <del> a = 0 <del> a_prime = 1 <del> b = 1 <del> b_prime = 0 <del> q = 0 <del> r = 0 <del> if m > n: <del> c = m <del> d = n <del> else: <del> c = n <del> d = m <del> <del> while True: <del> q = int(c / d) <del> r = c % d <del> if r == 0: <del> break <del> c = d <del> d = r <del> <del> t = a_prime <del> a_prime = a <del> a = t - q * a <del> <del> t = b_prime <del> b_prime = b <del> b = t - q * b <del> <del> pair = None <del> if m > n: <del> pair = (a, b) <del> else: <del> pair = (b, a) <del> return pair <add> # base cases <add> if abs(a) == 1: <add> return a, 0 <add> elif abs(b) == 1: <add> return 0, b <add> <add> old_remainder, remainder = a, b <add> old_coeff_a, coeff_a = 1, 0 <add> old_coeff_b, coeff_b = 0, 1 <add> <add> while remainder != 0: <add> quotient = old_remainder // remainder <add> old_remainder, remainder = remainder, old_remainder - quotient * remainder <add> old_coeff_a, coeff_a = coeff_a, old_coeff_a - quotient * coeff_a <add> old_coeff_b, coeff_b = coeff_b, old_coeff_b - quotient * coeff_b <add> <add> # sign correction for negative numbers <add> if a < 0: <add> old_coeff_a = -old_coeff_a <add> if b < 0: <add> old_coeff_b = -old_coeff_b <add> <add> return old_coeff_a, old_coeff_b <ide> <ide> <ide> def main(): <ide> """Call Extended Euclidean Algorithm.""" <ide> if len(sys.argv) < 3: <ide> print("2 integer arguments required") <ide> exit(1) <del> m = int(sys.argv[1]) <del> n = int(sys.argv[2]) <del> print(extended_euclidean_algorithm(m, n)) <add> a = int(sys.argv[1]) <add> b = int(sys.argv[2]) <add> print(extended_euclidean_algorithm(a, b)) <ide> <ide> <ide> if __name__ == "__main__":
1
PHP
PHP
apply fixes from styleci
66d8568d3dd69e468abaaf66d58018c15d0b4dda
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function decrement($column, $amount = 1, array $extra = []) <ide> */ <ide> protected function addUpdatedAtColumn(array $values) <ide> { <del> if (! $this->model->usesTimestamps() || <add> if (! $this->model->usesTimestamps() || <ide> is_null($this->model->getUpdatedAtColumn())) { <ide> return $values; <ide> }
1
Javascript
Javascript
fix tagname extraction
4a94bb9b345946a9efd51adaeedc0f907af4df49
<ide><path>src/Angular.js <ide> function startingTag(element) { <ide> // are not allowed to have children. So we just ignore it. <ide> element.html(''); <ide> } catch(e) {}; <del> return jqLite('<div>').append(element).html().replace(/\<\/[\w\:\-]+\>$/, ''); <add> return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1]; <ide> } <ide> <ide> <ide><path>test/AngularSpec.js <ide> describe('angular', function() { <ide> <ide> describe('startingElementHtml', function(){ <ide> it('should show starting element tag only', function(){ <del> expect(startingTag('<ng-abc x="2"><div>text</div></ng-abc>')).toEqual('<ng-abc x="2">'); <add> expect(startingTag('<ng-abc x="2A"><div>text</div></ng-abc>')). <add> toBeOneOf('<ng-abc x="2A">', '<NG-ABC x="2A">'); <ide> }); <ide> }); <ide>
2
PHP
PHP
remove unused variable
118d50b7eee0f86849b866f055d1e3c823f9f431
<ide><path>tests/Container/ContainerTest.php <ide> public function testBindingsCanBeOverridden() <ide> { <ide> $container = new Container; <ide> $container['foo'] = 'bar'; <del> $foo = $container['foo']; <ide> $container['foo'] = 'baz'; <ide> $this->assertEquals('baz', $container['foo']); <ide> }
1
Java
Java
avoid nullability warnings
15a6373fed1b8acf6dcda7cc2a144de34e32f4cd
<ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/CookieAssertions.java <ide> package org.springframework.test.web.reactive.server; <ide> <ide> import java.time.Duration; <add>import java.util.Objects; <ide> import java.util.function.Consumer; <ide> <ide> import org.hamcrest.Matcher; <ide> public WebTestClient.ResponseSpec sameSite(String name, String expected) { <ide> private ResponseCookie getCookie(String name) { <ide> ResponseCookie cookie = this.exchangeResult.getResponseCookies().getFirst(name); <ide> if (cookie == null) { <del> String message = "No cookie with name '" + name + "'"; <del> this.exchangeResult.assertWithDiagnostics(() -> AssertionErrors.fail(message)); <add> this.exchangeResult.assertWithDiagnostics(() -> <add> AssertionErrors.fail("No cookie with name '" + name + "'")); <ide> } <del> return cookie; <add> return Objects.requireNonNull(cookie); <ide> } <ide> <ide> private String getMessage(String cookie) { <ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/HeaderAssertions.java <ide> /* <del> * Copyright 2002-2020 the original author or authors. <add> * Copyright 2002-2021 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.net.URI; <ide> import java.util.Arrays; <ide> import java.util.List; <add>import java.util.Objects; <ide> import java.util.function.Consumer; <ide> <ide> import org.hamcrest.Matcher; <ide> public WebTestClient.ResponseSpec valueEquals(String headerName, long value) { <ide> String actual = getHeaders().getFirst(headerName); <ide> this.exchangeResult.assertWithDiagnostics(() -> <ide> assertTrue("Response does not contain header '" + headerName + "'", actual != null)); <del> return assertHeader(headerName, value, Long.parseLong(actual)); <add> return assertHeader(headerName, value, Long.parseLong(Objects.requireNonNull(actual))); <ide> } <ide> <ide> /** <ide> private List<String> getRequiredValues(String name) { <ide> this.exchangeResult.assertWithDiagnostics(() -> <ide> AssertionErrors.fail(getMessage(name) + " not found")); <ide> } <del> return values; <add> return Objects.requireNonNull(values); <ide> } <ide> <ide> /**
2
Text
Text
update russian translation
7f85ca71e013469b5d387a5e28fda0cf004084f5
<ide><path>guide/russian/php/loop/index.md <ide> --- <ide> title: Loop <del>localeTitle: петля <add>localeTitle: Цикл <ide> --- <del># PHP Loop <add># PHP Цикл <ide> <ide> Если вам нужно многократно повторять одну и ту же задачу, вы можете использовать цикл, а не добавлять один и тот же код снова и снова. В PHP есть следующие инструкции цикла: <ide> <ide> localeTitle: петля <ide> <ide> Использование `break` внутри цикла может остановить выполнение цикла. <ide> <del># Для цикла <add># Цикл For <ide> <del>Пронумеруйте блок кода с определенным количеством раз. <add>Выполняет блок кода с определенным количеством раз. <ide> <ide> ## Синтаксис <ide> ``` <ide> for (init counter; condition; counter increment or decrement) <ide> } <ide> ``` <ide> <del>## пример <add>## Пример <ide> <ide> ```php <ide> <?php <ide> for (init counter; condition; counter increment or decrement) <ide> > Current loop counter 4. <ide> ``` <ide> <del># Пока цикл <add># Цикл While <ide> <del>Зациклируйте блок кода, если условие истинно. <add>Выполняет блок кода, если условие истинно. <ide> <ide> ## Синтаксис <ide> ``` <ide> while (condition) <ide> } <ide> ``` <ide> <del>## пример <add>## Пример <ide> <ide> ```php <ide> <?php <ide> while (condition) <ide> > The index is 0. <ide> ``` <ide> <del># Do ... While loop <add># Цикл Do ... While <ide> <del>Перемещайтесь через блок кода один и продолжайте цикл, если условие истинно. <add>Гарантированно выполняет первую итерацию цикла и продолжает выполняться, если условие истинно. <ide> <ide> ## Синтаксис <ide> ``` <ide> do <ide> while (condition); <ide> ``` <ide> <del>## пример <add>## Пример <ide> <ide> ```php <ide> <?php <ide> do <ide> <ide> # Цикл Foreach <ide> <del>Прокрутите блок кода для каждого значения в массиве. <add>Выполняет блок кода для каждого значения в массиве. <ide> <ide> ## Синтаксис <ide> ``` <ide> foreach ($array as $value) <ide> } <ide> ``` <ide> <del>## пример <add>## Пример <ide> <ide> ```php <ide> <?php <ide> foreach ($array as $value) <ide> > Hi, my name is Cecily. <ide> > "Hello, Cecily!" <ide> <del>``` <ide>\ No newline at end of file <add>```
1
Ruby
Ruby
accept a block in button helper
0ec88cd1c83bdd66d06c2b475e0ace6c41be475e
<ide><path>actionpack/lib/action_view/helpers/form_helper.rb <ide> def submit(value=nil, options={}) <ide> # post: <ide> # create: "Add %{model}" <ide> # <del> def button(value=nil, options={}) <add> # ==== Examples <add> # button("Create a post") <add> # # => <button name='button' type='submit'>Create post</button> <add> # <add> # button do <add> # content_tag(:strong, 'Ask me!') <add> # end <add> # # => <button name='button' type='submit'> <add> # # <strong>Ask me!</strong> <add> # # </button> <add> # <add> def button(value = nil, options = {}, &block) <ide> value, options = nil, value if value.is_a?(Hash) <ide> value ||= submit_default_value <del> @template.button_tag(value, options) <add> @template.button_tag(value, options, &block) <ide> end <ide> <ide> def emitted_hidden_id? <ide><path>actionpack/test/template/form_helper_test.rb <ide> def test_form_for <ide> concat f.check_box(:secret) <ide> concat f.submit('Create post') <ide> concat f.button('Create post') <add> concat f.button { <add> concat content_tag(:span, 'Create post') <add> } <ide> end <ide> <ide> expected = whole_form("/posts/123", "create-post" , "edit_post", :method => 'patch') do <ide> def test_form_for <ide> "<input name='post[secret]' type='hidden' value='0' />" + <ide> "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" + <ide> "<input name='commit' type='submit' value='Create post' />" + <del> "<button name='button' type='submit'>Create post</button>" <add> "<button name='button' type='submit'>Create post</button>" + <add> "<button name='button' type='submit'><span>Create post</span></button>" <ide> end <ide> <ide> assert_dom_equal expected, output_buffer
2
Javascript
Javascript
remove usage of require('util') in `repl/history`
91be64b9d3a898fd9a611368b84e888de57cd087
<ide><path>lib/internal/repl/history.js <ide> const { Interface } = require('readline'); <ide> const path = require('path'); <ide> const fs = require('fs'); <ide> const os = require('os'); <del>const util = require('util'); <del>const debug = util.debuglog('repl'); <add>const debug = require('internal/util/debuglog').debuglog('repl'); <ide> <ide> // XXX(chrisdickinson): The 15ms debounce value is somewhat arbitrary. <ide> // The debounce is to guard against code pasted into the REPL.
1
Javascript
Javascript
remove unused catch bindings
30f58b92ee88a2c90ab570d68f4ff4628126b5f0
<ide><path>lib/internal/v8_prof_polyfill.js <ide> function macCppfiltNm(out) { <ide> filtered = cp.spawnSync('c++filt', [ '-p' , '-i' ], { <ide> input: entries.join('\n') <ide> }).stdout.toString(); <del> } catch (e) { <add> } catch { <ide> return out; <ide> } <ide>
1
Javascript
Javascript
fix current node tests
c692bd0464f393cb334fb8110e2c3c297df42931
<ide><path>tests/node/app-boot-test.js <ide> global.EmberENV = { <ide> FEATURES: features <ide> }; <ide> <del>var Ember = require(path.join(distPath, 'ember.debug.cjs')); <del>var compile = require(path.join(distPath, 'ember-template-compiler')).compile; <del>Ember.testing = true; <del>var DOMHelper = Ember.HTMLBars.DOMHelper; <add>var Ember, compile, domHelper, run; <ide> var SimpleDOM = require('simple-dom'); <ide> var URL = require('url'); <ide> <ide> function registerDOMHelper(app) { <ide> function registerTemplates(app, templates) { <ide> app.instanceInitializer({ <ide> name: 'register-application-template', <add> <ide> initialize: function(app) { <ide> for (var key in templates) { <ide> app.registry.register('template:' + key, compile(templates[key])); <ide> QUnit.module("App boot", { <ide> Ember = require(emberPath); <ide> compile = require(templateCompilerPath).compile; <ide> Ember.testing = true; <del> DOMHelper = Ember.View.DOMHelper; <add> DOMHelper = Ember.HTMLBars.DOMHelper; <ide> domHelper = createDOMHelper(); <ide> run = Ember.run; <ide> }, <ide><path>tests/node/template-compiler-test.js <ide> test('allows enabling of features', function() { <ide> templateCompiler._Ember.FEATURES['ember-htmlbars-component-generation'] = true; <ide> <ide> templateOutput = templateCompiler.precompile('<some-thing></some-thing>'); <del> ok(templateOutput.match(/component\(env, morph0, context, "some-thing"/), 'component generation can be enabled'); <add> ok(templateOutput.indexOf('["component","some-thing",[],0]') > -1, 'component generation can be enabled'); <ide> } else { <ide> ok(true, 'cannot test features in feature stripped build'); <ide> }
2
Ruby
Ruby
ask reflection for klass join reflection
c8e946683536e2555f98e0fa401b5a9721a9a6cb
<ide><path>activerecord/lib/active_record/associations/join_dependency/join_association.rb <ide> def join_constraints(foreign_table, foreign_klass, join_type, tables, chain) <ide> <ide> predicate_builder = PredicateBuilder.new(TableMetadata.new(klass, table)) <ide> scope_chain_items = reflection.join_scopes(table, predicate_builder) <add> klass_scope = reflection.klass_join_scope(table, predicate_builder) <ide> <del> klass_scope = <del> if klass.current_scope <del> klass.current_scope.clone.tap { |scope| <del> scope.joins_values = [] <del> } <del> else <del> relation = ActiveRecord::Relation.create( <del> klass, <del> table, <del> predicate_builder, <del> ) <del> klass.send(:build_default_scope, relation) <del> end <ide> scope_chain_items.concat [klass_scope].compact <ide> <ide> rel = scope_chain_items.inject(scope_chain_items.shift) do |left, right| <ide><path>activerecord/lib/active_record/reflection.rb <ide> def join_scopes(table, predicate_builder) # :nodoc: <ide> end <ide> end <ide> <add> def klass_join_scope(table, predicate_builder) # :nodoc: <add> if klass.current_scope <add> klass.current_scope.clone.tap { |scope| <add> scope.joins_values = [] <add> } <add> else <add> relation = ActiveRecord::Relation.create( <add> klass, <add> table, <add> predicate_builder, <add> ) <add> klass.send(:build_default_scope, relation) <add> end <add> end <add> <ide> def constraints <ide> chain.map(&:scopes).flatten <ide> end
2
Python
Python
euclidean recursive method + doctests + type hints
bb5552efd0fea2a8e83aef4321d9686acb150b59
<ide><path>other/euclidean_gcd.py <del># https://en.wikipedia.org/wiki/Euclidean_algorithm <add>""" https://en.wikipedia.org/wiki/Euclidean_algorithm """ <ide> <ide> <del>def euclidean_gcd(a, b): <add>def euclidean_gcd(a: int, b: int) -> int: <add> """ <add> Examples: <add> >>> euclidean_gcd(3, 5) <add> 1 <add> <add> >>> euclidean_gcd(6, 3) <add> 3 <add> """ <ide> while b: <del> t = b <del> b = a % b <del> a = t <add> a, b = b, a % b <ide> return a <ide> <ide> <add>def euclidean_gcd_recursive(a: int, b: int) -> int: <add> """ <add> Recursive method for euclicedan gcd algorithm <add> <add> Examples: <add> >>> euclidean_gcd_recursive(3, 5) <add> 1 <add> <add> >>> euclidean_gcd_recursive(6, 3) <add> 3 <add> """ <add> return a if b == 0 else euclidean_gcd_recursive(b, a % b) <add> <add> <ide> def main(): <del> print("GCD(3, 5) = " + str(euclidean_gcd(3, 5))) <del> print("GCD(5, 3) = " + str(euclidean_gcd(5, 3))) <del> print("GCD(1, 3) = " + str(euclidean_gcd(1, 3))) <del> print("GCD(3, 6) = " + str(euclidean_gcd(3, 6))) <del> print("GCD(6, 3) = " + str(euclidean_gcd(6, 3))) <add> print(f"euclidean_gcd(3, 5) = {euclidean_gcd(3, 5)}") <add> print(f"euclidean_gcd(5, 3) = {euclidean_gcd(5, 3)}") <add> print(f"euclidean_gcd(1, 3) = {euclidean_gcd(1, 3)}") <add> print(f"euclidean_gcd(3, 6) = {euclidean_gcd(3, 6)}") <add> print(f"euclidean_gcd(6, 3) = {euclidean_gcd(6, 3)}") <add> <add> print(f"euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3, 5)}") <add> print(f"euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5, 3)}") <add> print(f"euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1, 3)}") <add> print(f"euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3, 6)}") <add> print(f"euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6, 3)}") <ide> <ide> <ide> if __name__ == "__main__":
1
Javascript
Javascript
use fixed version in meteor/package.js
a26229242aef8b023323fb18f74428f661010b6d
<ide><path>meteor/package.js <ide> <ide> var packageName = 'momentjs:moment'; // https://atmospherejs.com/momentjs/moment <ide> <del>var packageJson = JSON.parse(Npm.require("fs").readFileSync('package.json')); <del> <ide> Package.describe({ <ide> name: packageName, <ide> summary: 'Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging', <del> version: packageJson.version, <add> version: '2.15.0', <ide> git: 'https://github.com/moment/moment.git' <ide> }); <ide>
1
Python
Python
update new token classification model
511bce58bd93d2cbc6eef21773b99b7a35b0d814
<ide><path>pytorch_pretrained_bert/modeling.py <ide> def __init__(self, config, num_labels=2): <ide> <ide> def forward(self, input_ids, token_type_ids=None, attention_mask=None, labels=None): <ide> sequence_output, _ = self.bert(input_ids, token_type_ids, attention_mask, output_all_encoded_layers=False) <del> pooled_output = self.dropout(sequence_output) <del> logits = self.classifier(pooled_output) <add> sequence_output = self.dropout(sequence_output) <add> logits = self.classifier(sequence_output) <ide> <ide> if labels is not None: <ide> loss_fct = CrossEntropyLoss()
1
Ruby
Ruby
update the spinner to the latest commands
241b842be101064ea94943dba0ac7831a96284ad
<ide><path>railties/lib/commands/process/spinner.rb <ide> def daemonize <ide> OPTIONS = { <ide> :high_interval => 5.0, <ide> :low_interval => 0.5, <del> :command => File.expand_path(File.dirname(__FILE__) + '/spawner'), <del> :daemon => false <add> :command => File.expand_path(RAILS_ROOT + '/script/run process spawner'), <add> :daemon => false <ide> } <ide> <ide> ARGV.options do |opts|
1
Text
Text
clarify wording and formatting in docs
77cba66c2d95cad54619f5314df22af4f56e4e6d
<ide><path>docs/build-instructions/linux.md <ide> To also install the newly built application, use `--create-debian-package` or `- <ide> ### Ubuntu / Debian <ide> <ide> * Install GNOME headers and other basic prerequisites: <add> <ide> ```sh <ide> sudo apt-get install build-essential git libgnome-keyring-dev fakeroot rpm <ide> ``` <add> <ide> * If `script/bootstrap` exits with an error, you may need to install a newer C++ compiler with C++11: <add> <ide> ```sh <ide> sudo add-apt-repository ppa:ubuntu-toolchain-r/test <ide> sudo apt-get update <ide><path>docs/build-instructions/macos.md <ide> To also install the newly built application, use `script/build --install`. <ide> <ide> * `--code-sign`: signs the application with the GitHub certificate specified in `$ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL`. <ide> * `--compress-artifacts`: zips the generated application as `out/atom-mac.zip`. <del>* `--install`: installs the application at `/Applications/Atom.app`. <add>* `--install`: installs the application at `/Applications/Atom.app` for dev and stable versions or at `/Applications/Atom-Beta.app` for beta versions. <ide> <ide> ## Troubleshooting <ide> <ide><path>docs/build-instructions/windows.md <ide> script\bootstrap <ide> script\build <ide> ``` <ide> <del>To also install the newly built application, use `script/build --create-windows-installer` and launch the generated installers. <add>To also install the newly built application, use `script\build --create-windows-installer` and launch the generated installers. <ide> <ide> ### `script\build` Options <ide> * `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`. <ide> If none of this works, do install Github Desktop and use its Git Shell as it mak <ide> * See the next item. <ide> <ide> * `error MSB8020: The build tools for Visual Studio 201? (Platform Toolset = 'v1?0') cannot be found.` <del> * Try setting the `GYP_MSVS_VERSION` environment variable to 2013 or 2015 depending on what version of Visual Studio you are running and then `script\clean` followed by `script\build` (re-open your command prompt or Powershell window if you set it using the GUI) <add> * Try setting the `GYP_MSVS_VERSION` environment variable to 2013 or 2015 depending on what version of Visual Studio you are running and then `script\clean` followed by `script\bootstrap` (re-open your command prompt or Powershell window if you set it using the GUI) <ide> <ide> * `'node-gyp' is not recognized as an internal or external command, operable program or batch file.` <del> * Try running `npm install -g node-gyp`, and run `script/build` again. <add> * Try running `npm install -g node-gyp`, and run `script\bootstrap` again. <ide> <ide> * Other `node-gyp` errors on first build attempt, even though the right Node.js and Python versions are installed. <ide> * Do try the build command one more time, as experience shows it often works on second try in many of these cases.
3
Text
Text
add notes about git commit messages
5f00372af2e0aa0ec540830ba575fe83ae16017f
<ide><path>CONTRIBUTING.md <ide> reference to all the issues that they address. <ide> <ide> Pull requests must not contain commits from other users or branches. <ide> <add>Commit messages must start with a capitalized and short summary (max. 50 <add>chars) written in the imperative, followed by an optional, more detailed <add>explanatory text which is separated from the summary by an empty line. <add> <ide> Code review comments may be added to your pull request. Discuss, then make the <ide> suggested modifications and push additional commits to your feature branch. Be <ide> sure to post a comment after pushing. The new commits will show up in the pull
1
Text
Text
add a solution for finders keepers challenge
4bc1d74f2ab6d69e75ebf51b70f3325b00513c78
<ide><path>guide/english/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers/index.md <ide> --- <ide> title: Finders Keepers <ide> --- <del>## Problem Explanation <add>![](//discourse-user-assets.s3.amazonaws.com/original/2X/f/ff2fd8ffa014eea28587a8ef4933340d3dcc4b09.jpg) <add> <add>![:triangular_flag_on_post:](https://forum.freecodecamp.com/images/emoji/emoji_one/triangular_flag_on_post.png?v=3 ":triangular_flag_on_post:") Remember to use <a>**`Read-Search-Ask`**</a> if you get stuck. Try to pair program ![:busts_in_silhouette:](https://forum.freecodecamp.com/images/emoji/emoji_one/busts_in_silhouette.png?v=3 ":busts_in_silhouette:") and write your own code ![:pencil:](https://forum.freecodecamp.com/images/emoji/emoji_one/pencil.png?v=3 ":pencil:") <add> <add> <add>## ![:checkered_flag:](https://forum.freecodecamp.com/images/emoji/emoji_one/checkered_flag.png?v=3 ":checkered_flag:") Problem Explanation: <add> <ide> We need to return the element from an array that passes a function. Both the `function` and the `array` are passed into our function `findElement(arr, func)`. <ide> <ide> ## Hint: 1 <ide> Looking through the array can be done with a `for` loop. <ide> Do not forget, if none of the numbers in the array pass the test, it should return `undefined`. <ide> >*try to solve the problem now* <ide> <del>## Basic Solution <add>## ![:beginner:](https://forum.freecodecamp.com/images/emoji/emoji_one/beginner.png?v=3 ":beginner:") Basic Code Solution: <ide> <ide> ```javascript <ide> function findElement(arr, func) { <ide> function findElement(arr, func) { <ide> * The pre-defined function already checks each number for us, so if it is "true", we return that num. <ide> * If none of the numbers in the array pass the function's test, we return undefined. <ide> <add>## ![:sunflower:](https://forum.freecodecamp.com/images/emoji/emoji_one/sunflower.png?v=3 ":sunflower:") Intermediate Code Solution: <add>```javascript <add>function findElement(arr, func) { <add> return arr.find(func); <add>} <add>``` <add> <add>#### Relevant Links <ide> <del>## Advanced Solution <add>* [Array.prototype.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) <add> <add>## ![:rotating_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/rotating_light.png?v=3 ":rotating_light:") Advanced Code Solution: <ide> <ide> ```javascript <ide> function findElement(arr, func) { <ide> function findElement(arr, func) { <ide> 2. Use the function in the 2nd parameter as the callback function in arr.map() <ide> 3. Acquire the index of the first number that meets the condition in the function. <ide> 4. Use that index to display the first available number that meets the condition. <add> <add>## ![:clipboard:](https://forum.freecodecamp.com/images/emoji/emoji_one/clipboard.png?v=3 ":clipboard:") NOTES FOR CONTRIBUTIONS: <add> <add>* ![:warning:](https://forum.freecodecamp.com/images/emoji/emoji_one/warning.png?v=3 ":warning:") **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution. <add>* Add an explanation of your solution. <add>* Categorize the solution in one of the following categories -- **Basic**, **Intermediate** and **Advanced**. ![:traffic_light:](https://forum.freecodecamp.com/images/emoji/emoji_one/traffic_light.png?v=3 ":traffic_light:")
1
PHP
PHP
fix a few bugs
33ff51a81dbd16f62f903568fd8aab94762f34ae
<ide><path>src/Illuminate/Events/CallQueuedHandler.php <ide> public function __construct(Container $container) <ide> */ <ide> public function call(Job $job, array $data) <ide> { <del> $event = $this->setJobIfNecessary(unserialize($data['data'])); <add> $event = $this->setJobIfNecessary($job, unserialize($data['data'])); <ide> <ide> $handler = $this->setJobInstanceIfNecessary( <del> $this->container->make($data['class']) <add> $job, $this->container->make($data['class']) <ide> ); <ide> <ide> call_user_func_array( <ide> public function call(Job $job, array $data) <ide> /** <ide> * Set the job instance of the given class if necessary. <ide> * <add> * @param \Illuminate\Contracts\Queue\Job $job <ide> * @param mixed $instance <ide> * @return mixed <ide> */ <del> protected function setJobInstanceIfNecessary($instance) <add> protected function setJobInstanceIfNecessary(Job $job, $instance) <ide> { <del> if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive($instance))) <add> if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive(get_class($instance)))) <ide> { <ide> $instance->setJob($job); <ide> } <ide><path>src/Illuminate/Queue/CallQueuedHandler.php <ide> public function __construct(Dispatcher $dispatcher) <ide> public function call(Job $job, array $data) <ide> { <ide> $command = $this->setJobInstanceIfNecessary( <del> unserialize($data['command']) <add> $job, unserialize($data['command']) <ide> ); <ide> <ide> $handler = $this->setJobInstanceIfNecessary( <del> $this->dispatcher->resolveHandler($command) <add> $job, $this->dispatcher->resolveHandler($command) <ide> ); <ide> <ide> $method = $this->dispatcher->getHandlerMethod($command); <ide> public function call(Job $job, array $data) <ide> /** <ide> * Set the job instance of the given class if necessary. <ide> * <add> * @param \Illuminate\Contracts\Queue\Job $job <ide> * @param mixed $instance <ide> * @return mixed <ide> */ <del> protected function setJobInstanceIfNecessary($instance) <add> protected function setJobInstanceIfNecessary(Job $job, $instance) <ide> { <del> if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive($instance))) <add> if (in_array('Illuminate\Queue\InteractsWithQueue', class_uses_recursive(get_class($instance)))) <ide> { <ide> $instance->setJob($job); <ide> }
2
Text
Text
add code example to `http.createserver` method
984f7a0bf32f9e329d0b7975042f71212fa823c4
<ide><path>doc/api/http.md <ide> Returns a new instance of [`http.Server`][]. <ide> The `requestListener` is a function which is automatically <ide> added to the [`'request'`][] event. <ide> <add>```cjs <add>const http = require('http'); <add> <add>// Create a local server to receive data from <add>const server = http.createServer((req, res) => { <add> res.writeHead(200, { 'Content-Type': 'application/json' }); <add> res.end(JSON.stringify({ <add> data: 'Hello World!' <add> })); <add>}); <add> <add>server.listen(8000); <add>``` <add> <add>```cjs <add>const http = require('http'); <add> <add>// Create a local server to receive data from <add>const server = http.createServer(); <add> <add>// Listen to the request event <add>server.on('request', (request, res) => { <add> res.writeHead(200, { 'Content-Type': 'application/json' }); <add> res.end(JSON.stringify({ <add> data: 'Hello World!' <add> })); <add>}); <add> <add>server.listen(8000); <add>``` <add> <ide> ## `http.get(options[, callback])` <ide> ## `http.get(url[, options][, callback])` <ide> <!-- YAML
1
Java
Java
create sockjs threadpooltaskscheduler extension
6ad79e03c615d7dca2ab4b2ae7bf8ba6881448bc
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceUtils.java <ide> <ide> package org.springframework.web.socket.config; <ide> <add>import org.springframework.web.socket.sockjs.transport.SockJsThreadPoolTaskScheduler; <ide> import org.w3c.dom.Element; <ide> <ide> import org.springframework.beans.factory.config.BeanDefinition; <ide> import org.springframework.beans.factory.support.ManagedList; <ide> import org.springframework.beans.factory.support.RootBeanDefinition; <ide> import org.springframework.beans.factory.xml.ParserContext; <del>import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; <ide> import org.springframework.util.xml.DomUtils; <ide> import org.springframework.web.socket.server.support.DefaultHandshakeHandler; <ide> import org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService; <ide> import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService; <ide> import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler; <ide> <del>import java.util.concurrent.ExecutorService; <del>import java.util.concurrent.RejectedExecutionHandler; <del>import java.util.concurrent.ScheduledThreadPoolExecutor; <del>import java.util.concurrent.ThreadFactory; <del> <ide> /** <ide> * Provides utility methods for parsing common WebSocket XML namespace elements. <ide> * <ide> public static ManagedList<? super Object> parseBeanSubElements(Element parentEle <ide> return beans; <ide> } <ide> <del> <del> @SuppressWarnings("serial") <del> private static class SockJsThreadPoolTaskScheduler extends ThreadPoolTaskScheduler { <del> <del> @Override <del> protected ExecutorService initializeExecutor(ThreadFactory factory, RejectedExecutionHandler handler) { <del> ExecutorService service = super.initializeExecutor(factory, handler); <del> ((ScheduledThreadPoolExecutor) service).setRemoveOnCancelPolicy(true); <del> return service; <del> } <del> } <del> <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurationSupport.java <ide> import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; <ide> import org.springframework.web.servlet.HandlerMapping; <ide> import org.springframework.web.servlet.handler.AbstractHandlerMapping; <del> <del>import java.util.concurrent.ExecutorService; <del>import java.util.concurrent.RejectedExecutionHandler; <del>import java.util.concurrent.ScheduledThreadPoolExecutor; <del>import java.util.concurrent.ThreadFactory; <add>import org.springframework.web.socket.sockjs.transport.SockJsThreadPoolTaskScheduler; <ide> <ide> /** <ide> * Configuration support for WebSocket request handling. <ide> protected void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { <ide> */ <ide> @Bean <ide> public ThreadPoolTaskScheduler defaultSockJsTaskScheduler() { <del> @SuppressWarnings("serial") <del> ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler() { <del> @Override <del> protected ExecutorService initializeExecutor(ThreadFactory factory, RejectedExecutionHandler handler) { <del> ExecutorService service = super.initializeExecutor(factory, handler); <del> ((ScheduledThreadPoolExecutor) service).setRemoveOnCancelPolicy(true); <del> return service; <del> } <del> }; <add> ThreadPoolTaskScheduler scheduler = new SockJsThreadPoolTaskScheduler(); <ide> scheduler.setThreadNamePrefix("SockJS-"); <ide> return scheduler; <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurationSupport.java <ide> package org.springframework.web.socket.config.annotation; <ide> <ide> import java.util.Collections; <del>import java.util.concurrent.ExecutorService; <del>import java.util.concurrent.RejectedExecutionHandler; <del>import java.util.concurrent.ScheduledThreadPoolExecutor; <del>import java.util.concurrent.ThreadFactory; <ide> <ide> import org.springframework.beans.factory.config.CustomScopeConfigurer; <ide> import org.springframework.context.annotation.Bean; <ide> import org.springframework.messaging.simp.SimpSessionScope; <ide> import org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration; <del>import org.springframework.messaging.simp.user.UserSessionRegistry; <ide> import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; <ide> import org.springframework.web.servlet.HandlerMapping; <ide> import org.springframework.web.socket.WebSocketHandler; <ide> import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; <add>import org.springframework.web.socket.sockjs.transport.SockJsThreadPoolTaskScheduler; <ide> <ide> /** <ide> * Extends {@link AbstractMessageBrokerConfiguration} and adds configuration for <ide> protected void configureWebSocketTransport(WebSocketTransportRegistration regist <ide> */ <ide> @Bean <ide> public ThreadPoolTaskScheduler messageBrokerSockJsTaskScheduler() { <del> @SuppressWarnings("serial") <del> ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler() { <del> @Override <del> protected ExecutorService initializeExecutor(ThreadFactory factory, RejectedExecutionHandler handler) { <del> ExecutorService service = super.initializeExecutor(factory, handler); <del> ((ScheduledThreadPoolExecutor) service).setRemoveOnCancelPolicy(true); <del> return service; <del> } <del> }; <del> scheduler.setPoolSize(Runtime.getRuntime().availableProcessors()); <add> ThreadPoolTaskScheduler scheduler = new SockJsThreadPoolTaskScheduler(); <ide> scheduler.setThreadNamePrefix("MessageBrokerSockJS-"); <ide> return scheduler; <ide> } <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/SockJsThreadPoolTaskScheduler.java <add>/* <add> * Copyright 2002-2014 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> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.socket.sockjs.transport; <add> <add>import org.springframework.lang.UsesJava7; <add>import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; <add>import org.springframework.util.ClassUtils; <add> <add>import java.util.concurrent.ExecutorService; <add>import java.util.concurrent.RejectedExecutionHandler; <add>import java.util.concurrent.ScheduledThreadPoolExecutor; <add>import java.util.concurrent.ThreadFactory; <add> <add>/** <add> * An extension of ThreadPoolTaskScheduler optimized for managing a large number <add> * of task, e.g. setting he pool size to the number of available processors and <add> * setting the setRemoveOnCancelPolicy property of <add> * {@link java.util.concurrent.ScheduledThreadPoolExecutor} available in JDK 1.7 <add> * or higher in order to avoid keeping cancelled tasks around. <add> * <add> * @author Rossen Stoyanchev <add> * @since 4.1 <add> */ <add>@SuppressWarnings("serial") <add>public class SockJsThreadPoolTaskScheduler extends ThreadPoolTaskScheduler { <add> <add> // Check for setRemoveOnCancelPolicy method - available on JDK 7 and higher <add> private static boolean hasRemoveOnCancelPolicyMethod = ClassUtils.hasMethod( <add> ScheduledThreadPoolExecutor.class, "setRemoveOnCancelPolicy", Boolean.class); <add> <add> <add> public SockJsThreadPoolTaskScheduler() { <add> setThreadNamePrefix("SockJS-"); <add> setPoolSize(Runtime.getRuntime().availableProcessors()); <add> } <add> <add> <add> @Override <add> protected ExecutorService initializeExecutor(ThreadFactory factory, RejectedExecutionHandler handler) { <add> ExecutorService service = super.initializeExecutor(factory, handler); <add> configureRemoveOnCancelPolicy((ScheduledThreadPoolExecutor) service); <add> return service; <add> } <add> <add> @UsesJava7 // guard setting removeOnCancelPolicy (safe with 1.6 due to hasRemoveOnCancelPolicyMethod check) <add> private void configureRemoveOnCancelPolicy(ScheduledThreadPoolExecutor service) { <add> if (hasRemoveOnCancelPolicyMethod) { <add> service.setRemoveOnCancelPolicy(true); <add> } <add> } <add> <add>}
4
Ruby
Ruby
correct typos in routing examples
efdfcf13257769cf2d6f9ad85c8538e64007d97b
<ide><path>actionpack/lib/action_dispatch/routing.rb <ide> module ActionDispatch <ide> # You can specify a regular expression to define a format for a parameter. <ide> # <ide> # controller 'geocode' do <del> # match 'geocode/:postalcode' => :show', :constraints => { <add> # match 'geocode/:postalcode' => :show, :constraints => { <ide> # :postalcode => /\d{5}(-\d{4})?/ <ide> # } <ide> # <ide> # Constraints can include the 'ignorecase' and 'extended syntax' regular <ide> # expression modifiers: <ide> # <ide> # controller 'geocode' do <del> # match 'geocode/:postalcode' => :show', :constraints => { <add> # match 'geocode/:postalcode' => :show, :constraints => { <ide> # :postalcode => /hx\d\d\s\d[a-z]{2}/i <ide> # } <ide> # end <ide> # <ide> # controller 'geocode' do <del> # match 'geocode/:postalcode' => :show', :constraints => { <add> # match 'geocode/:postalcode' => :show, :constraints => { <ide> # :postalcode => /# Postcode format <ide> # \d{5} #Prefix <ide> # (-\d{4})? #Suffix
1
Text
Text
fix broken link in code snippet
87eee1e879a7ecbdab32caa09dfa2bfc566d6269
<ide><path>website/docs/recipes/ServerRendering.md <ide> function renderFullPage(html, preloadedState) { <ide> <div id="root">${html}</div> <ide> <script> <ide> // WARNING: See the following for security issues around embedding JSON in HTML: <del> // http://redux.js.org/recipes/ServerRendering.html#security-considerations <add> // https://redux.js.org/recipes/server-rendering/#security-considerations <ide> window.__PRELOADED_STATE__ = ${JSON.stringify(preloadedState).replace( <ide> /</g, <ide> '\\u003c'
1
Go
Go
move disconnectfromnetwork back to daemon/
5bb4d0d9ea6a6c85a3f9a4a147fd7db0101eb725
<ide><path>container/container_unix.go <ide> import ( <ide> "github.com/docker/docker/pkg/nat" <ide> "github.com/docker/docker/pkg/symlink" <ide> "github.com/docker/docker/pkg/system" <del> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/utils" <ide> "github.com/docker/docker/volume" <ide> "github.com/docker/libnetwork" <ide> func (container *Container) SetupWorkingDirectory() error { <ide> return nil <ide> } <ide> <del>// DisconnectFromNetwork disconnects a container from a network <del>func (container *Container) DisconnectFromNetwork(n libnetwork.Network) error { <del> if !container.Running { <del> return derr.ErrorCodeNotRunning.WithArgs(container.ID) <del> } <del> <del> if container.HostConfig.NetworkMode.IsHost() && runconfig.NetworkMode(n.Type()).IsHost() { <del> return runconfig.ErrConflictHostNetwork <del> } <del> <del> if err := container.disconnectFromNetwork(n); err != nil { <del> return err <del> } <del> <del> if err := container.ToDiskLocking(); err != nil { <del> return fmt.Errorf("Error saving container to disk: %v", err) <del> } <del> return nil <del>} <del> <del>func (container *Container) disconnectFromNetwork(n libnetwork.Network) error { <del> var ( <del> ep libnetwork.Endpoint <del> sbox libnetwork.Sandbox <del> ) <del> <del> s := func(current libnetwork.Endpoint) bool { <del> epInfo := current.Info() <del> if epInfo == nil { <del> return false <del> } <del> if sb := epInfo.Sandbox(); sb != nil { <del> if sb.ContainerID() == container.ID { <del> ep = current <del> sbox = sb <del> return true <del> } <del> } <del> return false <del> } <del> n.WalkEndpoints(s) <del> <del> if ep == nil { <del> return fmt.Errorf("container %s is not connected to the network", container.ID) <del> } <del> <del> if err := ep.Leave(sbox); err != nil { <del> return fmt.Errorf("container %s failed to leave network %s: %v", container.ID, n.Name(), err) <del> } <del> <del> if err := ep.Delete(); err != nil { <del> return fmt.Errorf("endpoint delete failed for container %s on network %s: %v", container.ID, n.Name(), err) <del> } <del> <del> delete(container.NetworkSettings.Networks, n.Name()) <del> return nil <del>} <del> <ide> // appendNetworkMounts appends any network mounts to the array of mount points passed in <ide> func appendNetworkMounts(container *Container, volumeMounts []volume.MountPoint) ([]volume.MountPoint, error) { <ide> for _, mnt := range container.NetworkMounts() { <ide><path>container/container_windows.go <ide> package container <ide> import ( <ide> "github.com/docker/docker/daemon/execdriver" <ide> "github.com/docker/docker/volume" <del> "github.com/docker/libnetwork" <ide> ) <ide> <ide> // DefaultPathEnv is deliberately empty on Windows as the default path will be set by <ide> func (container *Container) CreateDaemonEnvironment(linkedEnv []string) []string <ide> return container.Config.Env <ide> } <ide> <del>// DisconnectFromNetwork disconnects a container from the network. <del>func (container *Container) DisconnectFromNetwork(n libnetwork.Network) error { <del> return nil <del>} <del> <ide> // SetupWorkingDirectory initializes the container working directory. <ide> // This is a NOOP In windows. <ide> func (container *Container) SetupWorkingDirectory() error { <ide><path>daemon/container_operations_unix.go <ide> func (daemon *Daemon) connectToNetwork(container *container.Container, idOrName <ide> return nil <ide> } <ide> <add>// DisconnectFromNetwork disconnects container from network n. <add>func (daemon *Daemon) DisconnectFromNetwork(container *container.Container, n libnetwork.Network) error { <add> if !container.Running { <add> return derr.ErrorCodeNotRunning.WithArgs(container.ID) <add> } <add> <add> if container.HostConfig.NetworkMode.IsHost() && runconfig.NetworkMode(n.Type()).IsHost() { <add> return runconfig.ErrConflictHostNetwork <add> } <add> <add> return disconnectFromNetwork(container, n) <add>} <add> <add>func disconnectFromNetwork(container *container.Container, n libnetwork.Network) error { <add> <add> if err := container.ToDiskLocking(); err != nil { <add> return fmt.Errorf("Error saving container to disk: %v", err) <add> } <add> <add> var ( <add> ep libnetwork.Endpoint <add> sbox libnetwork.Sandbox <add> ) <add> <add> s := func(current libnetwork.Endpoint) bool { <add> epInfo := current.Info() <add> if epInfo == nil { <add> return false <add> } <add> if sb := epInfo.Sandbox(); sb != nil { <add> if sb.ContainerID() == container.ID { <add> ep = current <add> sbox = sb <add> return true <add> } <add> } <add> return false <add> } <add> n.WalkEndpoints(s) <add> <add> if ep == nil { <add> return fmt.Errorf("container %s is not connected to the network", container.ID) <add> } <add> <add> if err := ep.Leave(sbox); err != nil { <add> return fmt.Errorf("container %s failed to leave network %s: %v", container.ID, n.Name(), err) <add> } <add> <add> if err := ep.Delete(); err != nil { <add> return fmt.Errorf("endpoint delete failed for container %s on network %s: %v", container.ID, n.Name(), err) <add> } <add> <add> delete(container.NetworkSettings.Networks, n.Name()) <add> return nil <add>} <add> <ide> func (daemon *Daemon) initializeNetworking(container *container.Container) error { <ide> var err error <ide> <ide><path>daemon/container_operations_windows.go <ide> import ( <ide> "github.com/docker/docker/daemon/execdriver" <ide> derr "github.com/docker/docker/errors" <ide> "github.com/docker/docker/layer" <add> "github.com/docker/libnetwork" <ide> ) <ide> <ide> func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) { <ide> func (daemon *Daemon) ConnectToNetwork(container *container.Container, idOrName <ide> return nil <ide> } <ide> <add>// DisconnectFromNetwork disconnects a container from the network. <add>func (daemon *Daemon) DisconnectFromNetwork(container *container.Container, n libnetwork.Network) error { <add> return nil <add>} <add> <ide> func (daemon *Daemon) populateCommand(c *container.Container, env []string) error { <ide> en := &execdriver.Network{ <ide> Interface: nil, <ide><path>daemon/network.go <ide> func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, netwo <ide> if err != nil { <ide> return err <ide> } <del> return container.DisconnectFromNetwork(network) <add> return daemon.DisconnectFromNetwork(container, network) <ide> } <ide> <ide> // GetNetworkDriverList returns the list of plugins drivers
5
Javascript
Javascript
remove some console logs
06b648b402960166943448155c06922a77b5fad0
<ide><path>news/client.js <ide> const App = ( <ide> <ide> render( <ide> App, <del> newsMountPoint, <del> () => console.log('react has rendered and is ready to go go go go go go!!') <add> newsMountPoint <ide> ); <ide><path>news/components/ArticleMeta.js <ide> function pluralise(singular, count) { <ide> function getTimeString(pubDate) { <ide> const now = new Date(Date.now()); <ide> const minuteDiff = differenceInMinutes(now, pubDate); <del> console.log(typeof minuteDiff); <add> <ide> if (minuteDiff < 60) { <ide> return `${minuteDiff} ${pluralise('minute', minuteDiff)} ago`; <ide> }
2
Python
Python
detect broken `yum install python-requests`
8675d5e266daf191ed46d57a5d9b8d56475602a6
<ide><path>libcloud/__init__.py <ide> except ImportError: <ide> have_paramiko = False <ide> <add>try: <add> import requests # NOQA <add> have_requests = True <add>except ImportError: <add> have_requests = False <add> <ide> __all__ = [ <ide> '__version__', <ide> 'enable_debug' <ide> def _init_once(): <ide> <ide> This checks for the LIBCLOUD_DEBUG environment variable, which if it exists <ide> is where we will log debug information about the provider transports. <add> <add> This also checks for known environment/dependency incompatibilities. <ide> """ <ide> path = os.getenv('LIBCLOUD_DEBUG') <ide> if path: <ide> def _init_once(): <ide> if have_paramiko and hasattr(paramiko.util, 'log_to_file'): <ide> paramiko.util.log_to_file(filename=path, level=logging.DEBUG) <ide> <add> # check for broken `yum install python-requests` <add> if have_requests and requests.__version__ == '2.6.0': <add> chardet_version = requests.packages.chardet.__version__ <add> required_chardet_version = '2.3.0' <add> assert chardet_version == required_chardet_version, ( <add> 'Known bad version of requests detected! This can happen when ' <add> 'requests was installed from a source other than PyPI, e.g. via ' <add> 'a package manager such as yum. Please either install requests ' <add> 'from PyPI or run `pip install chardet==%s` to resolve this ' <add> 'issue.' % required_chardet_version <add> ) <add> <ide> <ide> _init_once() <ide><path>libcloud/test/test_init.py <ide> except ImportError: <ide> have_paramiko = False <ide> <add>from mock import patch <add> <ide> import libcloud <ide> from libcloud import _init_once <ide> from libcloud.utils.loggingconnection import LoggingConnection <ide> def test_raises_error(self): <ide> with self.assertRaises(DriverTypeNotFoundError): <ide> libcloud.get_driver('potato', 'potato') <ide> <add> @patch.object(libcloud.requests, '__version__', '2.6.0') <add> @patch.object(libcloud.requests.packages.chardet, '__version__', '2.2.1') <add> def test_detects_bad_yum_install_requests(self, *args): <add> with self.assertRaises(AssertionError): <add> _init_once() <add> <ide> <ide> if __name__ == '__main__': <ide> sys.exit(unittest.main())
2
Javascript
Javascript
increase database timeout
81b77ff8adb8dabcf784a8c61276960c9f949d79
<ide><path>server/datasources.local.js <ide> var secrets = require('../config/secrets'); <ide> module.exports = { <ide> db: { <ide> connector: 'mongodb', <add> timeout: 10000, <ide> url: process.env.MONGOHQ_URL <ide> }, <ide> mail: {
1
Text
Text
add ga note to primary readme
e2af3223131957e48871b09307c856f717d9d7b5
<ide><path>README.md <ide> Thanks to the awesome folks over at [Fastly][fastly], there's a free, CDN hosted <ide> <link href="//vjs.zencdn.net/5.19/video-js.min.css" rel="stylesheet"> <ide> <script src="//vjs.zencdn.net/5.19/video.min.js"></script> <ide> ``` <del> <ide> > For the latest version of video.js and URLs to use, check out the [Getting Started][getting-started] page on our website. <ide> <add>> In the `vjs.zencdn.net` CDN-hosted versions of Video.js we include a [stripped down Google Analytics pixel](https://github.com/videojs/cdn/blob/master/src/analytics.js) that tracks a random sampling (currently 1%) of players loaded from the CDN. This allows us to see (roughly) what browsers are in use in the wild, along with other useful metrics such as OS and device. If you'd like to disable analytics, you can simply include the following global before including Video.js via the free CDN: <add>> <add>> ```html <add>> <script>window.HELP_IMPROVE_VIDEOJS = false;</script> <add>> ``` <add>> Alternatively, you can include Video.js by getting it from [npm](http://videojs.com/getting-started/#download-npm), downloading from [GitHub releases](https://github.com/videojs/video.js/releases) or by including it via [unpkg](https://unpkg.com) or another JavaScript CDN like CDNjs. These releases *do not* include Google Analytics tracking at all. <add>> ```html <add>> <!-- unpkg --> <add>> <link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet"> <add>> <script src="https://unpkg.com/video.js/dist/video.js"><script> <add>> <add>> <!-- cdnjs --> <add>> <link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/6.3.3/video-js.css" rel="stylesheet"> <add>> <script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/6.3.3/video.js"><script> <add>> ``` <add> <ide> Next, using Video.js is as simple as creating a `<video>` element, but with an additional `data-setup` attribute. At a minimum, this attribute must have a value of `'{}'`, but it can include any Video.js [options][options] - just make sure it contains valid JSON! <ide> <ide> ```html
1
Javascript
Javascript
add missing jsdoc @param entry
73d2d90122fb9fe79d4088f537f3a35537785075
<ide><path>lib/internal/policy/manifest.js <ide> const kNoDependencies = new DependencyMapperInstance( <ide> * @param {string} href <ide> * @param {JSONDependencyMap} dependencies <ide> * @param {boolean} cascade <add> * @param {boolean} allowSameHREFScope <ide> * @param {Map<string | null | undefined, DependencyMapperInstance>} store <ide> */ <ide> const insertDependencyMap = (
1
Python
Python
fix tolerance comparing __call__ to np.dot
acbae2cebb13a18412b439ed237fbc23abace69a
<ide><path>tests/keras/layers/test_call.py <ide> def test_layer_call(self): <ide> """Test keras.layers.core.Layer.__call__""" <ide> nb_samples, input_dim, output_dim = 3, 10, 5 <ide> layer = Dense(output_dim, input_dim=input_dim) <del> W = np.asarray(K.eval(layer.W)) <add> W = np.asarray(K.eval(layer.W)).astype(K.floatx()) <ide> X = K.placeholder(ndim=2) <ide> Y = layer(X) <ide> F = K.function([X], [Y]) <ide> <del> x = np.random.randn(nb_samples, input_dim).astype(K.floatx()) <add> x = np.ones((nb_samples, input_dim)).astype(K.floatx()) <ide> y = F([x])[0].astype(K.floatx()) <del> assert_allclose(np.dot(x, W), y) <add> t = np.dot(x, W).astype(K.floatx()) <add> assert_allclose(t, y, rtol=.2) <ide> <ide> def test_sequential_call(self): <ide> """Test keras.models.Sequential.__call__""" <ide> def test_sequential_call(self): <ide> Y = model(X) <ide> F = K.function([X], [Y]) <ide> <del> x = np.random.randn(nb_samples, input_dim).astype(K.floatx()) <add> x = np.ones((nb_samples, input_dim)).astype(K.floatx()) <ide> y1 = F([x])[0].astype(K.floatx()) <ide> y2 = model.predict(x) <ide> # results of __call__ should match model.predict
1
Java
Java
improve uribuilder javadoc on query params
261956fd08fec9f35abbd2a1667e4acbbacdfc31
<ide><path>spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java <ide> public int hashCode() { <ide> /** <ide> * Enumeration used to identify the allowed characters per URI component. <ide> * <p>Contains methods to indicate whether a given character is valid in a specific URI component. <del> * @see <a href="https://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a> <add> * @see <a href="https://tools.ietf.org/html/rfc3986">RFC 3986</a> <ide> */ <ide> enum Type { <ide> <ide><path>spring-web/src/main/java/org/springframework/web/util/UriBuilder.java <ide> public interface UriBuilder { <ide> UriBuilder pathSegment(String... pathSegments) throws IllegalArgumentException; <ide> <ide> /** <del> * Append the given query to the existing query of this builder. <del> * The given query may contain URI template variables. <del> * <p><strong>Note:</strong> The presence of reserved characters can prevent <del> * correct parsing of the URI string. For example if a query parameter <del> * contains {@code '='} or {@code '&'} characters, the query string cannot <del> * be parsed unambiguously. Such values should be substituted for URI <del> * variables to enable correct parsing: <del> * <pre class="code"> <del> * builder.query(&quot;filter={value}&quot;).uriString(&quot;hot&amp;cold&quot;); <del> * </pre> <add> * Parse the given query string into query parameters where parameters are <add> * separated with {@code '&'} and their values, if any, with {@code '='}. <add> * The query may contain URI template variables. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <ide> * @param query the query string <ide> */ <ide> UriBuilder query(String query); <ide> <ide> /** <del> * Set the query of this builder overriding all existing query parameters. <del> * @param query the query string, or {@code null} to remove all query params <add> * Clear existing query parameters and then delegate to {@link #query(String)}. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <add> * @param query the query string; a {@code null} value removes all query parameters. <ide> */ <ide> UriBuilder replaceQuery(@Nullable String query); <ide> <ide> /** <del> * Append the given query parameter to the existing query parameters. The <del> * given name or any of the values may contain URI template variables. If no <add> * Append the given query parameter. Both the parameter name and values may <add> * contain URI template variables to be expanded later from values. If no <ide> * values are given, the resulting URI will contain the query parameter name <del> * only (i.e. {@code ?foo} instead of {@code ?foo=bar}. <add> * only, e.g. {@code "?foo"} instead of {@code "?foo=bar"}. <add> * <p><strong>Note:</strong> encoding, if applied, will only encode characters <add> * that are illegal in a query parameter name or value such as {@code "="} <add> * or {@code "&"}. All others that are legal as per syntax rules in <add> * <a href="https://tools.ietf.org/html/rfc3986">RFC 3986</a> are not <add> * encoded. This includes {@code "+"} which sometimes needs to be encoded <add> * to avoid its interpretation as an encoded space. Stricter encoding may <add> * be applied by using a URI template variable along with stricter encoding <add> * on variable values. For more details please read the <add> * <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#web-uri-encoding">"URI Encoding"</a> <add> * section of the Spring Framework reference. <ide> * @param name the query parameter name <ide> * @param values the query parameter values <ide> * @see #queryParam(String, Collection) <ide> */ <ide> UriBuilder queryParam(String name, Object... values); <ide> <ide> /** <del> * Append the given query parameter to the existing query parameters. The <del> * given name or any of the values may contain URI template variables. If no <del> * values are given, the resulting URI will contain the query parameter name <del> * only (i.e. {@code ?foo} instead of {@code ?foo=bar}. <add> * Variant of {@link #queryParam(String, Object...)} with a Collection. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <ide> * @param name the query parameter name <ide> * @param values the query parameter values <ide> * @since 5.2 <ide> public interface UriBuilder { <ide> UriBuilder queryParam(String name, @Nullable Collection<?> values); <ide> <ide> /** <del> * Add the given query parameters. <add> * Add multiple query parameters and values. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <ide> * @param params the params <ide> */ <ide> UriBuilder queryParams(MultiValueMap<String, String> params); <ide> <ide> /** <del> * Set the query parameter values overriding all existing query values for <del> * the same parameter. If no values are given, the query parameter is removed. <add> * Set the query parameter values replacing existing values, or if no <add> * values are given, the query parameter is removed. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <ide> * @param name the query parameter name <ide> * @param values the query parameter values <ide> * @see #replaceQueryParam(String, Collection) <ide> */ <ide> UriBuilder replaceQueryParam(String name, Object... values); <ide> <ide> /** <del> * Set the query parameter values overriding all existing query values for <del> * the same parameter. If no values are given, the query parameter is removed. <add> * Variant of {@link #replaceQueryParam(String, Object...)} with a Collection. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <ide> * @param name the query parameter name <ide> * @param values the query parameter values <ide> * @since 5.2 <ide> public interface UriBuilder { <ide> UriBuilder replaceQueryParam(String name, @Nullable Collection<?> values); <ide> <ide> /** <del> * Set the query parameter values overriding all existing query values. <add> * Set the query parameter values after removing all existing ones. <add> * <p><strong>Note: </strong> please, review the Javadoc of <add> * {@link #queryParam(String, Object...)} for further notes on the treatment <add> * and encoding of individual query parameters. <ide> * @param params the query parameter name <ide> */ <ide> UriBuilder replaceQueryParams(MultiValueMap<String, String> params); <ide><path>spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java <ide> public UriComponentsBuilder uriComponents(UriComponents uriComponents) { <ide> return this; <ide> } <ide> <del> /** <del> * Set the URI scheme. The given scheme may contain URI template variables, <del> * and may also be {@code null} to clear the scheme of this builder. <del> * @param scheme the URI scheme <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder scheme(@Nullable String scheme) { <ide> this.scheme = scheme; <ide> public UriComponentsBuilder schemeSpecificPart(String ssp) { <ide> return this; <ide> } <ide> <del> /** <del> * Set the URI user info. The given user info may contain URI template variables, <del> * and may also be {@code null} to clear the user info of this builder. <del> * @param userInfo the URI user info <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder userInfo(@Nullable String userInfo) { <ide> this.userInfo = userInfo; <ide> resetSchemeSpecificPart(); <ide> return this; <ide> } <ide> <del> /** <del> * Set the URI host. The given host may contain URI template variables, <del> * and may also be {@code null} to clear the host of this builder. <del> * @param host the URI host <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder host(@Nullable String host) { <ide> this.host = host; <ide> resetSchemeSpecificPart(); <ide> return this; <ide> } <ide> <del> /** <del> * Set the URI port. Passing {@code -1} will clear the port of this builder. <del> * @param port the URI port <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder port(int port) { <ide> Assert.isTrue(port >= -1, "Port must be >= -1"); <ide> public UriComponentsBuilder port(int port) { <ide> return this; <ide> } <ide> <del> /** <del> * Set the URI port. Use this method only when the port needs to be <del> * parameterized with a URI variable. Otherwise use {@link #port(int)}. <del> * Passing {@code null} will clear the port of this builder. <del> * @param port the URI port <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder port(@Nullable String port) { <ide> this.port = port; <ide> resetSchemeSpecificPart(); <ide> return this; <ide> } <ide> <del> /** <del> * Append the given path to the existing path of this builder. <del> * The given path may contain URI template variables. <del> * @param path the URI path <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder path(String path) { <ide> this.pathBuilder.addPath(path); <ide> resetSchemeSpecificPart(); <ide> return this; <ide> } <ide> <del> /** <del> * Append path segments to the existing path. Each path segment may contain <del> * URI template variables and should not contain any slashes. <del> * Use {@code path("/")} subsequently to ensure a trailing slash. <del> * @param pathSegments the URI path segments <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException { <ide> this.pathBuilder.addPathSegments(pathSegments); <ide> resetSchemeSpecificPart(); <ide> return this; <ide> } <ide> <del> /** <del> * Set the path of this builder overriding all existing path and path segment values. <del> * @param path the URI path (a {@code null} value results in an empty path) <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder replacePath(@Nullable String path) { <ide> this.pathBuilder = new CompositePathComponentBuilder(); <ide> public UriComponentsBuilder replacePath(@Nullable String path) { <ide> return this; <ide> } <ide> <del> /** <del> * Append the given query to the existing query of this builder. <del> * The given query may contain URI template variables. <del> * <p><strong>Note:</strong> The presence of reserved characters can prevent <del> * correct parsing of the URI string. For example if a query parameter <del> * contains {@code '='} or {@code '&'} characters, the query string cannot <del> * be parsed unambiguously. Such values should be substituted for URI <del> * variables to enable correct parsing: <del> * <pre class="code"> <del> * UriComponentsBuilder.fromUriString(&quot;/hotels/42&quot;) <del> * .query(&quot;filter={value}&quot;) <del> * .buildAndExpand(&quot;hot&amp;cold&quot;); <del> * </pre> <del> * @param query the query string <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder query(@Nullable String query) { <ide> if (query != null) { <ide> public UriComponentsBuilder query(@Nullable String query) { <ide> return this; <ide> } <ide> <del> /** <del> * Set the query of this builder overriding all existing query parameters. <del> * @param query the query string; a {@code null} value removes all query parameters. <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder replaceQuery(@Nullable String query) { <ide> this.queryParams.clear(); <ide> public UriComponentsBuilder replaceQuery(@Nullable String query) { <ide> return this; <ide> } <ide> <del> /** <del> * Append the given query parameter to the existing query parameters. The <del> * given name or any of the values may contain URI template variables. If no <del> * values are given, the resulting URI will contain the query parameter name <del> * only (i.e. {@code ?foo} instead of {@code ?foo=bar}). <del> * @param name the query parameter name <del> * @param values the query parameter values <del> * @return this UriComponentsBuilder <del> * @see #queryParam(String, Collection) <del> */ <ide> @Override <ide> public UriComponentsBuilder queryParam(String name, Object... values) { <ide> Assert.notNull(name, "Name must not be null"); <ide> public UriComponentsBuilder queryParam(String name, Object... values) { <ide> return this; <ide> } <ide> <del> /** <del> * Append the given query parameter to the existing query parameters. The <del> * given name or any of the values may contain URI template variables. If no <del> * values are given, the resulting URI will contain the query parameter name <del> * only (i.e. {@code ?foo} instead of {@code ?foo=bar}). <del> * @param name the query parameter name <del> * @param values the query parameter values <del> * @return this UriComponentsBuilder <del> * @since 5.2 <del> * @see #queryParam(String, Object...) <del> */ <ide> @Override <ide> public UriComponentsBuilder queryParam(String name, @Nullable Collection<?> values) { <ide> return queryParam(name, values != null ? values.toArray() : EMPTY_VALUES); <ide> } <ide> <ide> /** <del> * Add the given query parameters. <del> * @param params the params <del> * @return this UriComponentsBuilder <add> * {@inheritDoc} <ide> * @since 4.0 <ide> */ <ide> @Override <ide> public UriComponentsBuilder queryParams(@Nullable MultiValueMap<String, String> <ide> return this; <ide> } <ide> <del> /** <del> * Set the query parameter values overriding all existing query values for <del> * the same parameter. If no values are given, the query parameter is removed. <del> * @param name the query parameter name <del> * @param values the query parameter values <del> * @return this UriComponentsBuilder <del> * @see #replaceQueryParam(String, Collection) <del> */ <ide> @Override <ide> public UriComponentsBuilder replaceQueryParam(String name, Object... values) { <ide> Assert.notNull(name, "Name must not be null"); <ide> public UriComponentsBuilder replaceQueryParam(String name, Object... values) { <ide> return this; <ide> } <ide> <del> /** <del> * Set the query parameter values overriding all existing query values for <del> * the same parameter. If no values are given, the query parameter is removed. <del> * @param name the query parameter name <del> * @param values the query parameter values <del> * @return this UriComponentsBuilder <del> * @see #replaceQueryParam(String, Object...) <del> * @since 5.2 <del> */ <ide> @Override <ide> public UriComponentsBuilder replaceQueryParam(String name, @Nullable Collection<?> values) { <ide> return replaceQueryParam(name, values != null ? values.toArray() : EMPTY_VALUES); <ide> } <ide> <ide> /** <del> * Set the query parameter values overriding all existing query values. <del> * @param params the query parameter name <del> * @return this UriComponentsBuilder <add> * {@inheritDoc} <ide> * @since 4.2 <ide> */ <ide> @Override <ide> public UriComponentsBuilder replaceQueryParams(@Nullable MultiValueMap<String, S <ide> return this; <ide> } <ide> <del> /** <del> * Set the URI fragment. The given fragment may contain URI template variables, <del> * and may also be {@code null} to clear the fragment of this builder. <del> * @param fragment the URI fragment <del> * @return this UriComponentsBuilder <del> */ <ide> @Override <ide> public UriComponentsBuilder fragment(@Nullable String fragment) { <ide> if (fragment != null) {
3
Python
Python
remove unused imports
8a29308d0bb7fcfa6947b83fa6522c1eda2b6cbf
<ide><path>spacy/tests/regression/test_issue910.py <ide> from __future__ import unicode_literals <ide> import json <del>import os <ide> import random <ide> import contextlib <ide> import shutil <ide> from pathlib import Path <ide> <ide> <del>import pathlib <ide> from ...gold import GoldParse <ide> from ...pipeline import EntityRecognizer <ide> from ...lang.en import English
1
Python
Python
remove unused patterns import
fb2c09f6ae0d1b2d44f4fb8444fbbb80e69b6a48
<ide><path>tests/test_urlpatterns.py <ide> from __future__ import unicode_literals <ide> from collections import namedtuple <del>from django.conf.urls import patterns, url, include <add>from django.conf.urls import url, include <ide> from django.core import urlresolvers <ide> from django.test import TestCase <ide> from rest_framework.test import APIRequestFactory
1
Text
Text
add links for determining more restrictive license
1173d00bf6316fa4ce98a46a1fcbe9d120d75dcc
<ide><path>docs/Formula-Cookbook.md <ide> If the software is available under multiple licenses, you should list them all i <ide> license ["MIT", "GPL-2.0"] <ide> ``` <ide> <del>Note: only specify multiple licenses if the formula gives the user a choice between the licenses. Formulae that have different licenses for different parts of their software should specify only the more restrictive license. <add>Note: only specify multiple licenses if the formula gives the user a choice between the licenses. Formulae that have different licenses for different parts of their software should specify only the more restrictive license. For help determining which license is more restrictive, take a look [https://choosealicense.com](https://choosealicense.com/licenses/) or the [Comparison of free and open-source software licences Wikipedia page](https://en.wikipedia.org/wiki/Comparison_of_free_and_open-source_software_licences). <ide> <ide> ### Check the build system <ide>
1
Text
Text
add nav to inthewild
57768e643563d0116a8eef5d26a4c03386b1509c
<ide><path>INTHEWILD.md <ide> Currently, **officially** using Airflow: <ide> 1. [Multiply](https://www.multiply.com) [[@nrhvyc](https://github.com/nrhvyc)] <ide> 1. [NEXT Trucking](https://www.nexttrucking.com/) [[@earthmancash2](https://github.com/earthmancash2), [@kppullin](https://github.com/kppullin)] <ide> 1. [National Bank of Canada](https://nbc.ca) [[@brilhana](https://github.com/brilhana)] <add>1. [Nav, Inc.](https://nav.com/) [[@tigerjz32](https://github.com/tigerjz32)] <ide> 1. [Neoway](https://www.neoway.com.br/) [[@neowaylabs](https://github.com/orgs/NeowayLabs/people)] <ide> 1. [Nerdwallet](https://www.nerdwallet.com) <ide> 1. [New Relic](https://www.newrelic.com) [[@marcweil](https://github.com/marcweil)]
1
Javascript
Javascript
move easing effects in separate file + unit tests
56050dc9b7a17130efdbdcd3b8de46b728f25b84
<ide><path>src/chart.js <ide> var Chart = require('./core/core')(); <ide> <ide> require('./helpers/helpers.core')(Chart); <add>require('./helpers/helpers.easing')(Chart); <ide> require('./core/core.helpers')(Chart); <ide> require('./helpers/helpers.time')(Chart); <ide> require('./helpers/helpers.canvas')(Chart); <ide><path>src/core/core.controller.js <ide> module.exports = function(Chart) { <ide> easing: config.easing || animationOptions.easing, <ide> <ide> render: function(chart, animationObject) { <del> var easingFunction = helpers.easingEffects[animationObject.easing]; <add> var easingFunction = helpers.easing.effects[animationObject.easing]; <ide> var currentStep = animationObject.currentStep; <ide> var stepDecimal = currentStep / animationObject.numSteps; <ide> <ide><path>src/core/core.helpers.js <ide> module.exports = function(Chart) { <ide> <ide> return niceFraction * Math.pow(10, exponent); <ide> }; <del> // Easing functions adapted from Robert Penner's easing equations <del> // http://www.robertpenner.com/easing/ <del> var easingEffects = helpers.easingEffects = { <del> linear: function(t) { <del> return t; <del> }, <del> easeInQuad: function(t) { <del> return t * t; <del> }, <del> easeOutQuad: function(t) { <del> return -1 * t * (t - 2); <del> }, <del> easeInOutQuad: function(t) { <del> if ((t /= 1 / 2) < 1) { <del> return 1 / 2 * t * t; <del> } <del> return -1 / 2 * ((--t) * (t - 2) - 1); <del> }, <del> easeInCubic: function(t) { <del> return t * t * t; <del> }, <del> easeOutCubic: function(t) { <del> return 1 * ((t = t / 1 - 1) * t * t + 1); <del> }, <del> easeInOutCubic: function(t) { <del> if ((t /= 1 / 2) < 1) { <del> return 1 / 2 * t * t * t; <del> } <del> return 1 / 2 * ((t -= 2) * t * t + 2); <del> }, <del> easeInQuart: function(t) { <del> return t * t * t * t; <del> }, <del> easeOutQuart: function(t) { <del> return -1 * ((t = t / 1 - 1) * t * t * t - 1); <del> }, <del> easeInOutQuart: function(t) { <del> if ((t /= 1 / 2) < 1) { <del> return 1 / 2 * t * t * t * t; <del> } <del> return -1 / 2 * ((t -= 2) * t * t * t - 2); <del> }, <del> easeInQuint: function(t) { <del> return 1 * (t /= 1) * t * t * t * t; <del> }, <del> easeOutQuint: function(t) { <del> return 1 * ((t = t / 1 - 1) * t * t * t * t + 1); <del> }, <del> easeInOutQuint: function(t) { <del> if ((t /= 1 / 2) < 1) { <del> return 1 / 2 * t * t * t * t * t; <del> } <del> return 1 / 2 * ((t -= 2) * t * t * t * t + 2); <del> }, <del> easeInSine: function(t) { <del> return -1 * Math.cos(t / 1 * (Math.PI / 2)) + 1; <del> }, <del> easeOutSine: function(t) { <del> return 1 * Math.sin(t / 1 * (Math.PI / 2)); <del> }, <del> easeInOutSine: function(t) { <del> return -1 / 2 * (Math.cos(Math.PI * t / 1) - 1); <del> }, <del> easeInExpo: function(t) { <del> return (t === 0) ? 1 : 1 * Math.pow(2, 10 * (t / 1 - 1)); <del> }, <del> easeOutExpo: function(t) { <del> return (t === 1) ? 1 : 1 * (-Math.pow(2, -10 * t / 1) + 1); <del> }, <del> easeInOutExpo: function(t) { <del> if (t === 0) { <del> return 0; <del> } <del> if (t === 1) { <del> return 1; <del> } <del> if ((t /= 1 / 2) < 1) { <del> return 1 / 2 * Math.pow(2, 10 * (t - 1)); <del> } <del> return 1 / 2 * (-Math.pow(2, -10 * --t) + 2); <del> }, <del> easeInCirc: function(t) { <del> if (t >= 1) { <del> return t; <del> } <del> return -1 * (Math.sqrt(1 - (t /= 1) * t) - 1); <del> }, <del> easeOutCirc: function(t) { <del> return 1 * Math.sqrt(1 - (t = t / 1 - 1) * t); <del> }, <del> easeInOutCirc: function(t) { <del> if ((t /= 1 / 2) < 1) { <del> return -1 / 2 * (Math.sqrt(1 - t * t) - 1); <del> } <del> return 1 / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1); <del> }, <del> easeInElastic: function(t) { <del> var s = 1.70158; <del> var p = 0; <del> var a = 1; <del> if (t === 0) { <del> return 0; <del> } <del> if ((t /= 1) === 1) { <del> return 1; <del> } <del> if (!p) { <del> p = 1 * 0.3; <del> } <del> if (a < Math.abs(1)) { <del> a = 1; <del> s = p / 4; <del> } else { <del> s = p / (2 * Math.PI) * Math.asin(1 / a); <del> } <del> return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p)); <del> }, <del> easeOutElastic: function(t) { <del> var s = 1.70158; <del> var p = 0; <del> var a = 1; <del> if (t === 0) { <del> return 0; <del> } <del> if ((t /= 1) === 1) { <del> return 1; <del> } <del> if (!p) { <del> p = 1 * 0.3; <del> } <del> if (a < Math.abs(1)) { <del> a = 1; <del> s = p / 4; <del> } else { <del> s = p / (2 * Math.PI) * Math.asin(1 / a); <del> } <del> return a * Math.pow(2, -10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) + 1; <del> }, <del> easeInOutElastic: function(t) { <del> var s = 1.70158; <del> var p = 0; <del> var a = 1; <del> if (t === 0) { <del> return 0; <del> } <del> if ((t /= 1 / 2) === 2) { <del> return 1; <del> } <del> if (!p) { <del> p = 1 * (0.3 * 1.5); <del> } <del> if (a < Math.abs(1)) { <del> a = 1; <del> s = p / 4; <del> } else { <del> s = p / (2 * Math.PI) * Math.asin(1 / a); <del> } <del> if (t < 1) { <del> return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p)); <del> } <del> return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) * 0.5 + 1; <del> }, <del> easeInBack: function(t) { <del> var s = 1.70158; <del> return 1 * (t /= 1) * t * ((s + 1) * t - s); <del> }, <del> easeOutBack: function(t) { <del> var s = 1.70158; <del> return 1 * ((t = t / 1 - 1) * t * ((s + 1) * t + s) + 1); <del> }, <del> easeInOutBack: function(t) { <del> var s = 1.70158; <del> if ((t /= 1 / 2) < 1) { <del> return 1 / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)); <del> } <del> return 1 / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2); <del> }, <del> easeInBounce: function(t) { <del> return 1 - easingEffects.easeOutBounce(1 - t); <del> }, <del> easeOutBounce: function(t) { <del> if ((t /= 1) < (1 / 2.75)) { <del> return 1 * (7.5625 * t * t); <del> } else if (t < (2 / 2.75)) { <del> return 1 * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75); <del> } else if (t < (2.5 / 2.75)) { <del> return 1 * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375); <del> } <del> return 1 * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375); <del> }, <del> easeInOutBounce: function(t) { <del> if (t < 1 / 2) { <del> return easingEffects.easeInBounce(t * 2) * 0.5; <del> } <del> return easingEffects.easeOutBounce(t * 2 - 1) * 0.5 + 1 * 0.5; <del> } <del> }; <ide> // Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ <ide> helpers.requestAnimFrame = (function() { <ide> if (typeof window === 'undefined') { <ide><path>src/helpers/helpers.easing.js <add>'use strict'; <add> <add>/** <add> * Easing functions adapted from Robert Penner's easing equations. <add> * http://www.robertpenner.com/easing/ <add> */ <add>var effects = { <add> linear: function(t) { <add> return t; <add> }, <add> <add> easeInQuad: function(t) { <add> return t * t; <add> }, <add> <add> easeOutQuad: function(t) { <add> return -t * (t - 2); <add> }, <add> <add> easeInOutQuad: function(t) { <add> if ((t /= 0.5) < 1) { <add> return 0.5 * t * t; <add> } <add> return -0.5 * ((--t) * (t - 2) - 1); <add> }, <add> <add> easeInCubic: function(t) { <add> return t * t * t; <add> }, <add> <add> easeOutCubic: function(t) { <add> return (t = t - 1) * t * t + 1; <add> }, <add> <add> easeInOutCubic: function(t) { <add> if ((t /= 0.5) < 1) { <add> return 0.5 * t * t * t; <add> } <add> return 0.5 * ((t -= 2) * t * t + 2); <add> }, <add> <add> easeInQuart: function(t) { <add> return t * t * t * t; <add> }, <add> <add> easeOutQuart: function(t) { <add> return -((t = t - 1) * t * t * t - 1); <add> }, <add> <add> easeInOutQuart: function(t) { <add> if ((t /= 0.5) < 1) { <add> return 0.5 * t * t * t * t; <add> } <add> return -0.5 * ((t -= 2) * t * t * t - 2); <add> }, <add> <add> easeInQuint: function(t) { <add> return t * t * t * t * t; <add> }, <add> <add> easeOutQuint: function(t) { <add> return (t = t - 1) * t * t * t * t + 1; <add> }, <add> <add> easeInOutQuint: function(t) { <add> if ((t /= 0.5) < 1) { <add> return 0.5 * t * t * t * t * t; <add> } <add> return 0.5 * ((t -= 2) * t * t * t * t + 2); <add> }, <add> <add> easeInSine: function(t) { <add> return -Math.cos(t * (Math.PI / 2)) + 1; <add> }, <add> <add> easeOutSine: function(t) { <add> return Math.sin(t * (Math.PI / 2)); <add> }, <add> <add> easeInOutSine: function(t) { <add> return -0.5 * (Math.cos(Math.PI * t) - 1); <add> }, <add> <add> easeInExpo: function(t) { <add> return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1)); <add> }, <add> <add> easeOutExpo: function(t) { <add> return (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1; <add> }, <add> <add> easeInOutExpo: function(t) { <add> if (t === 0) { <add> return 0; <add> } <add> if (t === 1) { <add> return 1; <add> } <add> if ((t /= 0.5) < 1) { <add> return 0.5 * Math.pow(2, 10 * (t - 1)); <add> } <add> return 0.5 * (-Math.pow(2, -10 * --t) + 2); <add> }, <add> <add> easeInCirc: function(t) { <add> if (t >= 1) { <add> return t; <add> } <add> return -(Math.sqrt(1 - t * t) - 1); <add> }, <add> <add> easeOutCirc: function(t) { <add> return Math.sqrt(1 - (t = t - 1) * t); <add> }, <add> <add> easeInOutCirc: function(t) { <add> if ((t /= 0.5) < 1) { <add> return -0.5 * (Math.sqrt(1 - t * t) - 1); <add> } <add> return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1); <add> }, <add> <add> easeInElastic: function(t) { <add> var s = 1.70158; <add> var p = 0; <add> var a = 1; <add> if (t === 0) { <add> return 0; <add> } <add> if (t === 1) { <add> return 1; <add> } <add> if (!p) { <add> p = 1 * 0.3; <add> } <add> if (a < Math.abs(1)) { <add> a = 1; <add> s = p / 4; <add> } else { <add> s = p / (2 * Math.PI) * Math.asin(1 / a); <add> } <add> return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p)); <add> }, <add> <add> easeOutElastic: function(t) { <add> var s = 1.70158; <add> var p = 0; <add> var a = 1; <add> if (t === 0) { <add> return 0; <add> } <add> if (t === 1) { <add> return 1; <add> } <add> if (!p) { <add> p = 1 * 0.3; <add> } <add> if (a < Math.abs(1)) { <add> a = 1; <add> s = p / 4; <add> } else { <add> s = p / (2 * Math.PI) * Math.asin(1 / a); <add> } <add> return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1; <add> }, <add> <add> easeInOutElastic: function(t) { <add> var s = 1.70158; <add> var p = 0; <add> var a = 1; <add> if (t === 0) { <add> return 0; <add> } <add> if ((t /= 0.5) === 2) { <add> return 1; <add> } <add> if (!p) { <add> p = 0.3 * 1.5; <add> } <add> if (a < Math.abs(1)) { <add> a = 1; <add> s = p / 4; <add> } else { <add> s = p / (2 * Math.PI) * Math.asin(1 / a); <add> } <add> if (t < 1) { <add> return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p)); <add> } <add> return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1; <add> }, <add> easeInBack: function(t) { <add> var s = 1.70158; <add> return t * t * ((s + 1) * t - s); <add> }, <add> <add> easeOutBack: function(t) { <add> var s = 1.70158; <add> return (t = t - 1) * t * ((s + 1) * t + s) + 1; <add> }, <add> <add> easeInOutBack: function(t) { <add> var s = 1.70158; <add> if ((t /= 0.5) < 1) { <add> return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s)); <add> } <add> return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2); <add> }, <add> <add> easeInBounce: function(t) { <add> return 1 - effects.easeOutBounce(1 - t); <add> }, <add> <add> easeOutBounce: function(t) { <add> if (t < (1 / 2.75)) { <add> return 7.5625 * t * t; <add> } <add> if (t < (2 / 2.75)) { <add> return 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75; <add> } <add> if (t < (2.5 / 2.75)) { <add> return 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375; <add> } <add> return 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375; <add> }, <add> <add> easeInOutBounce: function(t) { <add> if (t < 0.5) { <add> return effects.easeInBounce(t * 2) * 0.5; <add> } <add> return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5; <add> } <add>}; <add> <add>module.exports = function(Chart) { <add> /** <add> * @namespace Chart.helpers.easing.effects <add> */ <add> Chart.helpers.easing = { <add> effects: effects <add> }; <add> <add> /** <add> * Provided for backward compatibility, use Chart.helpers.easing.effects instead. <add> * @function Chart.helpers.easingEffects <add> * @deprecated since version 2.7.0 <add> * @todo remove at version 3 <add> * @private <add> */ <add> Chart.helpers.easingEffects = effects; <add> <add> return Chart.helpers.easing; <add>}; <ide><path>test/specs/global.deprecations.tests.js <ide> describe('Deprecations', function() { <ide> }); <ide> }); <ide> <add> describe('Chart.helpers.easingEffects', function() { <add> it('should be defined and an alias of Chart.helpers.easing.effects', function() { <add> expect(Chart.helpers.easingEffects).toBeDefined(); <add> expect(Chart.helpers.easingEffects).toBe(Chart.helpers.easing.effects); <add> }); <add> }); <add> <ide> describe('Chart.helpers.drawRoundedRectangle', function() { <ide> it('should be defined and a function', function() { <ide> expect(Chart.helpers.drawRoundedRectangle).toBeDefined(); <ide><path>test/specs/helpers.easing.tests.js <add>'use strict'; <add> <add>describe('Chart.helpers.easing', function() { <add> var easing = Chart.helpers.easing; <add> <add> describe('effects', function() { <add> var expected = { <add> easeInOutBack: [-0, -0.03751855, -0.09255566, -0.07883348, 0.08992579, 0.5, 0.91007421, 1.07883348, 1.09255566, 1.03751855, 1], <add> easeInOutBounce: [0, 0.03, 0.11375, 0.045, 0.34875, 0.5, 0.65125, 0.955, 0.88625, 0.97, 1], <add> easeInOutCirc: [-0, 0.01010205, 0.04174243, 0.1, 0.2, 0.5, 0.8, 0.9, 0.95825757, 0.98989795, 1], <add> easeInOutCubic: [0, 0.004, 0.032, 0.108, 0.256, 0.5, 0.744, 0.892, 0.968, 0.996, 1], <add> easeInOutElastic: [0, 0.00033916, -0.00390625, 0.02393889, -0.11746158, 0.5, 1.11746158, 0.97606111, 1.00390625, 0.99966084, 1], <add> easeInOutExpo: [0, 0.00195313, 0.0078125, 0.03125, 0.125, 0.5, 0.875, 0.96875, 0.9921875, 0.99804688, 1], <add> easeInOutQuad: [0, 0.02, 0.08, 0.18, 0.32, 0.5, 0.68, 0.82, 0.92, 0.98, 1], <add> easeInOutQuart: [0, 0.0008, 0.0128, 0.0648, 0.2048, 0.5, 0.7952, 0.9352, 0.9872, 0.9992, 1], <add> easeInOutQuint: [0, 0.00016, 0.00512, 0.03888, 0.16384, 0.5, 0.83616, 0.96112, 0.99488, 0.99984, 1], <add> easeInOutSine: [-0, 0.02447174, 0.0954915, 0.20610737, 0.3454915, 0.5, 0.6545085, 0.79389263, 0.9045085, 0.97552826, 1], <add> easeInBack: [-0, -0.01431422, -0.04645056, -0.08019954, -0.09935168, -0.0876975, -0.02902752, 0.09286774, 0.29419776, 0.59117202, 1], <add> easeInBounce: [0, 0.011875, 0.06, 0.069375, 0.2275, 0.234375, 0.09, 0.319375, 0.6975, 0.924375, 1], <add> easeInCirc: [-0, 0.00501256, 0.0202041, 0.0460608, 0.08348486, 0.1339746, 0.2, 0.28585716, 0.4, 0.56411011, 1], <add> easeInCubic: [0, 0.001, 0.008, 0.027, 0.064, 0.125, 0.216, 0.343, 0.512, 0.729, 1], <add> easeInExpo: [0, 0.00195313, 0.00390625, 0.0078125, 0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5, 1], <add> easeInElastic: [0, 0.00195313, -0.00195313, -0.00390625, 0.015625, -0.015625, -0.03125, 0.125, -0.125, -0.25, 1], <add> easeInQuad: [0, 0.01, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1], <add> easeInQuart: [0, 0.0001, 0.0016, 0.0081, 0.0256, 0.0625, 0.1296, 0.2401, 0.4096, 0.6561, 1], <add> easeInQuint: [0, 0.00001, 0.00032, 0.00243, 0.01024, 0.03125, 0.07776, 0.16807, 0.32768, 0.59049, 1], <add> easeInSine: [0, 0.01231166, 0.04894348, 0.10899348, 0.19098301, 0.29289322, 0.41221475, 0.5460095, 0.69098301, 0.84356553, 1], <add> easeOutBack: [0, 0.40882798, 0.70580224, 0.90713226, 1.02902752, 1.0876975, 1.09935168, 1.08019954, 1.04645056, 1.01431422, 1], <add> easeOutBounce: [0, 0.075625, 0.3025, 0.680625, 0.91, 0.765625, 0.7725, 0.930625, 0.94, 0.988125, 1], <add> easeOutCirc: [0, 0.43588989, 0.6, 0.71414284, 0.8, 0.8660254, 0.91651514, 0.9539392, 0.9797959, 0.99498744, 1], <add> easeOutElastic: [0, 1.25, 1.125, 0.875, 1.03125, 1.015625, 0.984375, 1.00390625, 1.00195313, 0.99804688, 1], <add> easeOutExpo: [0, 0.5, 0.75, 0.875, 0.9375, 0.96875, 0.984375, 0.9921875, 0.99609375, 0.99804688, 1], <add> easeOutCubic: [0, 0.271, 0.488, 0.657, 0.784, 0.875, 0.936, 0.973, 0.992, 0.999, 1], <add> easeOutQuad: [0, 0.19, 0.36, 0.51, 0.64, 0.75, 0.84, 0.91, 0.96, 0.99, 1], <add> easeOutQuart: [-0, 0.3439, 0.5904, 0.7599, 0.8704, 0.9375, 0.9744, 0.9919, 0.9984, 0.9999, 1], <add> easeOutQuint: [0, 0.40951, 0.67232, 0.83193, 0.92224, 0.96875, 0.98976, 0.99757, 0.99968, 0.99999, 1], <add> easeOutSine: [0, 0.15643447, 0.30901699, 0.4539905, 0.58778525, 0.70710678, 0.80901699, 0.89100652, 0.95105652, 0.98768834, 1], <add> linear: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1] <add> }; <add> <add> function generate(method) { <add> var fn = easing.effects[method]; <add> var accuracy = Math.pow(10, 8); <add> var count = 10; <add> var values = []; <add> var i; <add> <add> for (i=0; i<=count; ++i) { <add> values.push(Math.round(accuracy * fn(i/count)) / accuracy); <add> } <add> <add> return values; <add> } <add> <add> Object.keys(easing.effects).forEach(function(method) { <add> it ('"' + method + '" should return expected values', function() { <add> expect(generate(method)).toEqual(expected[method]); <add> }); <add> }); <add> }); <add>});
6
PHP
PHP
apply fixes from styleci
332ea7c61f3aebcd2376e9ca4c6b5a5e873cead1
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsTo.php <ide> <ide> use Illuminate\Database\Eloquent\Model; <ide> use Illuminate\Database\Eloquent\Builder; <del>use Illuminate\Database\Query\Expression; <ide> use Illuminate\Database\Eloquent\Collection; <ide> <ide> class BelongsTo extends Relation <ide><path>src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php <ide> <ide> use Illuminate\Database\Eloquent\Model; <ide> use Illuminate\Database\Eloquent\Builder; <del>use Illuminate\Database\Query\Expression; <ide> use Illuminate\Database\Eloquent\Collection; <ide> use Illuminate\Database\Eloquent\SoftDeletes; <ide> use Illuminate\Database\Eloquent\ModelNotFoundException; <ide><path>src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php <ide> <ide> use Illuminate\Database\Eloquent\Model; <ide> use Illuminate\Database\Eloquent\Builder; <del>use Illuminate\Database\Query\Expression; <ide> use Illuminate\Database\Eloquent\Collection; <ide> <ide> abstract class HasOneOrMany extends Relation <ide><path>tests/Database/DatabaseEloquentRelationTest.php <ide> <ide> use Mockery as m; <ide> use PHPUnit\Framework\TestCase; <del>use Illuminate\Database\Grammar; <ide> use Illuminate\Database\Eloquent\Model; <ide> use Illuminate\Database\Eloquent\Builder; <ide> use Illuminate\Database\Eloquent\Relations\HasOne; <ide> use Illuminate\Database\Eloquent\Relations\Relation; <del>use Illuminate\Database\Query\Builder as QueryBuilder; <ide> <ide> class DatabaseEloquentRelationTest extends TestCase <ide> {
4
PHP
PHP
add sane helper methods to uploaded file
7aa750e465816d2fd158085fe578f258600176ff
<ide><path>src/Illuminate/Http/UploadedFile.php <ide> class UploadedFile extends SymfonyUploadedFile <ide> { <ide> use Macroable; <ide> <add> /** <add> * Get the fully qualified path to the file. <add> * <add> * @return string <add> */ <add> public function path() <add> { <add> return $this->getRealPath(); <add> } <add> <add> /** <add> * Get the file's extension. <add> * <add> * @return string <add> */ <add> public function extension() <add> { <add> return $this->guessClientExtension(); <add> } <add> <add> /** <add> * Get a filename for the file that is the MD5 hash of the contents. <add> * <add> * @return string <add> */ <add> public function hashName() <add> { <add> return md5_file($this->path()).'.'.$this->extension(); <add> } <add> <ide> /** <ide> * Create a new file instance from a base instance. <ide> *
1
Python
Python
fix floating ip initialization
f8c1a1646dccb885fda10c6de29fad0585802bd1
<ide><path>libcloud/compute/drivers/openstack.py <ide> def _to_floating_ips(self, obj): <ide> return [self._to_floating_ip(ip) for ip in ip_elements] <ide> <ide> def _to_floating_ip(self, obj): <del> return OpenStack_1_1_FloatingIpAddress(obj['id'], obj['ip'], self, <del> obj['instance_id']) <add> return OpenStack_1_1_FloatingIpAddress(id=obj['id'], <add> ip_address=obj['ip'], <add> pool=None, <add> node_id=obj['instance_id'], <add> driver=self) <ide> <ide> def ex_list_floating_ips(self): <ide> """ <ide> def ex_create_floating_ip(self): <ide> data = resp.object['floating_ip'] <ide> id = data['id'] <ide> ip_address = data['ip'] <del> return OpenStack_1_1_FloatingIpAddress(id, ip_address, self) <add> return OpenStack_1_1_FloatingIpAddress(id=id, <add> ip_address=ip_address, <add> pool=None, <add> node_id=None, <add> driver=self) <ide> <ide> def ex_delete_floating_ip(self, ip): <ide> """ <ide> def _to_floating_ips(self, obj): <ide> return [self._to_floating_ip(ip) for ip in ip_elements] <ide> <ide> def _to_floating_ip(self, obj): <del> return OpenStack_1_1_FloatingIpAddress(obj['id'], obj['ip'], self, <del> obj['instance_id']) <add> return OpenStack_1_1_FloatingIpAddress(id=obj['id'], <add> ip_address=obj['ip'], <add> pool=self, <add> node_id=obj['instance_id'], <add> driver=self.connection.driver) <ide> <ide> def get_floating_ip(self, ip): <ide> """ <ide> def create_floating_ip(self): <ide> data = resp.object['floating_ip'] <ide> id = data['id'] <ide> ip_address = data['ip'] <del> return OpenStack_1_1_FloatingIpAddress(id, ip_address, self) <add> return OpenStack_1_1_FloatingIpAddress(id=id, <add> ip_address=ip_address, <add> pool=self, <add> node_id=None, <add> driver=self.connection.driver) <ide> <ide> def delete_floating_ip(self, ip): <ide> """
1
Javascript
Javascript
add shorthand for defining promise error handlers
a207665dad69248139b150cd3fe8ba13059bffb4
<ide><path>src/ng/q.js <ide> * This method *returns a new promise* which is resolved or rejected via the return value of the <ide> * `successCallback` or `errorCallback`. <ide> * <add> * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)` <add> * <ide> * - `always(callback)` – allows you to observe either the fulfillment or rejection of a promise, <ide> * but to do so without modifying the final value. This is useful to release resources or do some <ide> * clean-up that needs to be done whether the promise was rejected or resolved. See the [full <ide> * you can treat promises attached to a scope as if they were the resulting values. <ide> * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains <ide> * all the important functionality needed for common async tasks. <del> * <add> * <ide> * # Testing <del> * <add> * <ide> * <pre> <ide> * it('should simulate promise', inject(function($q, $rootScope) { <ide> * var deferred = $q.defer(); <ide> * var promise = deferred.promise; <ide> * var resolvedValue; <del> * <add> * <ide> * promise.then(function(value) { resolvedValue = value; }); <ide> * expect(resolvedValue).toBeUndefined(); <del> * <add> * <ide> * // Simulate resolving of promise <ide> * deferred.resolve(123); <ide> * // Note that the 'then' function does not get called synchronously. <ide> * // This is because we want the promise API to always be async, whether or not <ide> * // it got called synchronously or asynchronously. <ide> * expect(resolvedValue).toBeUndefined(); <del> * <add> * <ide> * // Propagate promise resolution to 'then' functions using $apply(). <ide> * $rootScope.$apply(); <ide> * expect(resolvedValue).toEqual(123); <ide> function qFactory(nextTick, exceptionHandler) { <ide> <ide> return result.promise; <ide> }, <add> <add> "catch": function(callback) { <add> return this.then(null, callback); <add> }, <add> <ide> always: function(callback) { <del> <add> <ide> function makePromise(value, resolved) { <ide> var result = defer(); <ide> if (resolved) { <ide> function qFactory(nextTick, exceptionHandler) { <ide> } <ide> return result.promise; <ide> } <del> <add> <ide> function handleCallback(value, isResolved) { <del> var callbackOutput = null; <add> var callbackOutput = null; <ide> try { <ide> callbackOutput = (callback ||defaultCallback)(); <ide> } catch(e) { <ide> return makePromise(e, false); <del> } <add> } <ide> if (callbackOutput && callbackOutput.then) { <ide> return callbackOutput.then(function() { <ide> return makePromise(value, isResolved); <ide> function qFactory(nextTick, exceptionHandler) { <ide> return makePromise(value, isResolved); <ide> } <ide> } <del> <add> <ide> return this.then(function(value) { <ide> return handleCallback(value, true); <ide> }, function(error) { <ide><path>test/ng/qSpec.js <ide> describe('q', function() { <ide> expect(typeof promise.then).toBe('function'); <ide> }); <ide> <add> it('should have a catch method', function() { <add> expect(typeof promise['catch']).toBe('function'); <add> }); <add> <ide> it('should have a always method', function() { <ide> expect(typeof promise.always).toBe('function'); <ide> }); <ide> describe('q', function() { <ide> <ide> }); <ide> }); <add> <add> describe('catch', function() { <add> it('should be a shorthand for defining promise error handlers', function() { <add> promise['catch'](error(1)).then(null, error(2)) <add> syncReject(deferred, 'foo'); <add> expect(logStr()).toBe('error1(foo)->reject(foo); error2(foo)->reject(foo)'); <add> }); <add> }); <ide> }); <ide> }); <ide>
2
Javascript
Javascript
add spec for uimanager
a0879ce49f11812e478d0cda2827f36f325cf972
<ide><path>Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js <ide> const AccessibilityInfo = { <ide> setAccessibilityFocus: function(reactTag: number): void { <ide> UIManager.sendAccessibilityEvent( <ide> reactTag, <del> UIManager.AccessibilityEventTypes.typeViewFocused, <add> UIManager.getConstants().AccessibilityEventTypes.typeViewFocused, <ide> ); <ide> }, <ide> <ide><path>Libraries/ReactNative/NativeUIManager.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {TurboModule} from '../TurboModule/RCTExport'; <add>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; <add> <add>export interface Spec extends TurboModule { <add> +getConstants: () => Object; <add> +getConstantsForViewManager: (viewManagerName: string) => Object; <add> +getDefaultEventTypes: () => Array<string>; <add> +playTouchSound: () => void; <add> +lazilyLoadView: (name: string) => Object; // revisit return <add> +createView: ( <add> reactTag: ?number, <add> viewName: string, <add> rootTag: number, <add> props: Object, <add> ) => void; <add> +updateView: (reactTag: number, viewName: string, props: Object) => void; <add> +focus: (reactTag: ?number) => void; <add> +blur: (reactTag: ?number) => void; <add> +findSubviewIn: ( <add> reactTag: ?number, <add> point: [number, number], <add> callback: ( <add> nativeViewTag: number, <add> left: number, <add> top: number, <add> width: number, <add> height: number, <add> ) => void, <add> ) => void; <add> +dispatchViewManagerCommand: ( <add> reactTag: ?number, <add> commandID: number, <add> commandArgs: ?Array<string | number | boolean>, // is this best? <add> ) => void; <add> +measure: ( <add> reactTag: ?number, <add> callback: ( <add> left: number, <add> top: number, <add> width: number, <add> height: number, <add> pageX: number, <add> pageY: number, <add> ) => void, <add> ) => void; <add> +measureInWindow: ( <add> reactTag: ?number, <add> callback: (x: number, y: number, width: number, height: number) => void, <add> ) => void; <add> +viewIsDescendantOf: ( <add> reactTag: ?number, <add> ancestorReactTag: ?number, <add> callback: (result: Array<boolean>) => void, <add> ) => void; <add> +measureLayout: ( <add> reactTag: ?number, <add> ancestorReactTag: ?number, <add> errorCallback: (error: Object) => void, <add> callback: ( <add> left: number, <add> top: number, <add> width: number, <add> height: number, <add> ) => void, <add> ) => void; <add> +measureLayoutRelativeToParent: ( <add> reactTag: ?number, <add> errorCallback: (error: Object) => void, <add> callback: ( <add> left: number, <add> top: number, <add> width: number, <add> height: number, <add> ) => void, <add> ) => void; <add> +setJSResponder: (reactTag: ?number, blockNativeResponder: boolean) => void; <add> +clearJSResponder: () => void; <add> +configureNextLayoutAnimation: ( <add> config: Object, <add> callback: () => void, // check what is returned here <add> errorCallback: (error: Object) => void, <add> ) => void; <add> +removeSubviewsFromContainerWithID: (containerID: number) => void; <add> +replaceExistingNonRootView: ( <add> reactTag: ?number, <add> newReactTag: ?number, <add> ) => void; <add> +setChildren: (containerTag: ?number, reactTags: Array<number>) => void; <add> +manageChildren: ( <add> containerTag: ?number, <add> moveFromIndices: Array<number>, <add> moveToIndices: Array<number>, <add> addChildReactTags: Array<number>, <add> addAtIndices: Array<number>, <add> removeAtIndices: Array<number>, <add> ) => void; <add> <add> // Android only <add> +setLayoutAnimationEnabledExperimental: (enabled: boolean) => void; <add> +sendAccessibilityEvent: (reactTag: ?number, eventType: number) => void; <add> +showPopupMenu: ( <add> reactTag: ?number, <add> items: Array<string>, <add> error: (error: Object) => void, <add> success: (event: string, selected?: number) => void, <add> ) => void; <add> +dismissPopupMenu: () => void; <add>} <add> <add>export default TurboModuleRegistry.getEnforcing<Spec>('UIManager'); <ide><path>Libraries/ReactNative/UIManager.js <ide> * This source code is licensed under the MIT license found in the <ide> * LICENSE file in the root directory of this source tree. <ide> * <del> * @flow strict-local <add> * @flow <ide> * @format <ide> */ <ide> 'use strict'; <ide> const Platform = require('../Utilities/Platform'); <ide> const UIManagerProperties = require('./UIManagerProperties'); <ide> <ide> const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty'); <del>const invariant = require('invariant'); <ide> <del>const {UIManager} = NativeModules; <add>import NativeUIManager from './NativeUIManager'; <add>import type {Spec} from './NativeUIManager'; <add> <ide> const viewManagerConfigs = {}; <ide> <del>invariant( <del> UIManager, <del> 'UIManager is undefined. The native module config is probably incorrect.', <del>); <add>interface UIManagerJSInterface extends Spec { <add> +getViewManagerConfig: (viewManagerName: string) => Object; <add> // The following are not marked read-only due to logic in UIManagerStatTracker. <add> createView: ( <add> reactTag: ?number, <add> viewName: string, <add> rootTag: number, <add> props: Object, <add> ) => void; <add> updateView: (reactTag: number, viewName: string, props: Object) => void; <add> manageChildren: ( <add> containerTag: ?number, <add> moveFromIndices: Array<number>, <add> moveToIndices: Array<number>, <add> addChildReactTags: Array<number>, <add> addAtIndices: Array<number>, <add> removeAtIndices: Array<number>, <add> ) => void; <add>} <ide> <ide> const triedLoadingConfig = new Set(); <del>UIManager.getViewManagerConfig = function(viewManagerName: string) { <del> if ( <del> viewManagerConfigs[viewManagerName] === undefined && <del> UIManager.getConstantsForViewManager <del> ) { <del> try { <del> viewManagerConfigs[ <del> viewManagerName <del> ] = UIManager.getConstantsForViewManager(viewManagerName); <del> } catch (e) { <del> viewManagerConfigs[viewManagerName] = null; <del> } <del> } <ide> <del> const config = viewManagerConfigs[viewManagerName]; <del> if (config) { <del> return config; <add>let NativeUIManagerConstants = {}; <add>let isNativeUIManagerConstantsSet = false; <add>function getConstants(): Object { <add> if (!isNativeUIManagerConstantsSet) { <add> NativeUIManagerConstants = NativeUIManager.getConstants(); <add> isNativeUIManagerConstantsSet = true; <ide> } <add> return NativeUIManagerConstants; <add>} <add> <add>const UIManagerJS: UIManagerJSInterface = { <add> ...NativeUIManager, <add> getConstants(): Object { <add> return getConstants(); <add> }, <add> getViewManagerConfig: function(viewManagerName: string) { <add> if ( <add> viewManagerConfigs[viewManagerName] === undefined && <add> NativeUIManager.getConstantsForViewManager <add> ) { <add> try { <add> viewManagerConfigs[ <add> viewManagerName <add> ] = NativeUIManager.getConstantsForViewManager(viewManagerName); <add> } catch (e) { <add> viewManagerConfigs[viewManagerName] = null; <add> } <add> } <ide> <del> // If we're in the Chrome Debugger, let's not even try calling the sync <del> // method. <del> if (__DEV__) { <del> if (!global.nativeCallSyncHook) { <add> const config = viewManagerConfigs[viewManagerName]; <add> if (config) { <ide> return config; <ide> } <del> } <ide> <del> if (UIManager.lazilyLoadView && !triedLoadingConfig.has(viewManagerName)) { <del> const result = UIManager.lazilyLoadView(viewManagerName); <del> triedLoadingConfig.add(viewManagerName); <del> if (result.viewConfig) { <del> UIManager[viewManagerName] = result.viewConfig; <del> lazifyViewManagerConfig(viewManagerName); <add> // If we're in the Chrome Debugger, let's not even try calling the sync <add> // method. <add> if (__DEV__) { <add> if (!global.nativeCallSyncHook) { <add> return config; <add> } <ide> } <del> } <ide> <del> return viewManagerConfigs[viewManagerName]; <add> if ( <add> NativeUIManager.lazilyLoadView && <add> !triedLoadingConfig.has(viewManagerName) <add> ) { <add> const result = NativeUIManager.lazilyLoadView(viewManagerName); <add> triedLoadingConfig.add(viewManagerName); <add> if (result.viewConfig) { <add> getConstants()[viewManagerName] = result.viewConfig; <add> lazifyViewManagerConfig(viewManagerName); <add> } <add> } <add> <add> return viewManagerConfigs[viewManagerName]; <add> }, <ide> }; <ide> <ide> function lazifyViewManagerConfig(viewName) { <del> const viewConfig = UIManager[viewName]; <add> const viewConfig = getConstants()[viewName]; <ide> if (viewConfig.Manager) { <ide> viewManagerConfigs[viewName] = viewConfig; <ide> defineLazyObjectProperty(viewConfig, 'Constants', { <ide> function lazifyViewManagerConfig(viewName) { <ide> * namespace instead of UIManager, unlike Android. <ide> */ <ide> if (Platform.OS === 'ios') { <del> Object.keys(UIManager).forEach(viewName => { <add> Object.keys(getConstants()).forEach(viewName => { <ide> lazifyViewManagerConfig(viewName); <ide> }); <del>} else if (UIManager.ViewManagerNames) { <add>} else if (getConstants().ViewManagerNames) { <ide> // We want to add all the view managers to the UIManager. <ide> // However, the way things are set up, the list of view managers is not known at compile time. <ide> // As Prepack runs at compile it, it cannot process this loop. <ide> if (Platform.OS === 'ios') { <ide> residual( <ide> 'void', <ide> (UIManager, defineLazyObjectProperty) => { <del> UIManager.ViewManagerNames.forEach(viewManagerName => { <add> UIManager.getConstants().ViewManagerNames.forEach(viewManagerName => { <ide> defineLazyObjectProperty(UIManager, viewManagerName, { <ide> get: () => UIManager.getConstantsForViewManager(viewManagerName), <ide> }); <ide> }); <ide> }, <del> UIManager, <add> NativeUIManager, <ide> defineLazyObjectProperty, <ide> ); <ide> <ide> if (Platform.OS === 'ios') { <ide> // so that any accesses to unknown properties along the global code will fail <ide> // when Prepack encounters them. <ide> if (global.__makePartial) { <del> global.__makePartial(UIManager); <add> global.__makePartial(NativeUIManager); <ide> } <ide> } <ide> <ide> if (__DEV__) { <del> Object.keys(UIManager).forEach(viewManagerName => { <add> Object.keys(getConstants()).forEach(viewManagerName => { <ide> if (!UIManagerProperties.includes(viewManagerName)) { <ide> if (!viewManagerConfigs[viewManagerName]) { <del> viewManagerConfigs[viewManagerName] = UIManager[viewManagerName]; <add> viewManagerConfigs[viewManagerName] = getConstants()[viewManagerName]; <ide> } <del> defineLazyObjectProperty(UIManager, viewManagerName, { <add> defineLazyObjectProperty(NativeUIManager, viewManagerName, { <ide> get: () => { <ide> console.warn( <ide> `Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` + <ide> `is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`, <ide> ); <del> return UIManager.getViewManagerConfig(viewManagerName); <add> <add> return UIManagerJS.getViewManagerConfig(viewManagerName); <ide> }, <ide> }); <ide> } <ide> }); <ide> } <ide> <del>module.exports = UIManager; <add>module.exports = UIManagerJS; <ide><path>Libraries/ReactNative/UIManagerStatTracker.js <ide> const UIManagerStatTracker = { <ide> remove, <ide> ) { <ide> incStat('manageChildren', 1); <del> incStat('move', Object.keys(moveFrom || []).length); <del> incStat('remove', Object.keys(remove || []).length); <add> incStat('move', moveFrom.length); <add> incStat('remove', remove.length); <ide> manageChildrenOrig(tag, moveFrom, moveTo, addTags, addIndices, remove); <ide> }; <ide> }, <ide><path>Libraries/ReactNative/getNativeComponentAttributes.js <ide> function attachDefaultEventTypes(viewConfig: any) { <ide> // This is supported on UIManager platforms (ex: Android), <ide> // as lazy view managers are not implemented for all platforms. <ide> // See [UIManager] for details on constants and implementations. <del> if (UIManager.ViewManagerNames || UIManager.LazyViewManagersEnabled) { <add> const constants = UIManager.getConstants(); <add> if (constants.ViewManagerNames || constants.LazyViewManagersEnabled) { <ide> // Lazy view managers enabled. <ide> viewConfig = merge(viewConfig, UIManager.getDefaultEventTypes()); <ide> } else { <ide> viewConfig.bubblingEventTypes = merge( <ide> viewConfig.bubblingEventTypes, <del> UIManager.genericBubblingEventTypes, <add> constants.genericBubblingEventTypes, <ide> ); <ide> viewConfig.directEventTypes = merge( <ide> viewConfig.directEventTypes, <del> UIManager.genericDirectEventTypes, <add> constants.genericDirectEventTypes, <ide> ); <ide> } <ide> }
5
Javascript
Javascript
update v8 flag in test
4f8582e5332f0cac61b5f441cdfcac0b5959d775
<ide><path>test/parallel/test-preload.js <ide> childProcess.exec( <ide> // https://github.com/nodejs/node/issues/1691 <ide> process.chdir(common.fixturesDir); <ide> childProcess.exec( <del> nodeBinary + ' ' + '--expose_debug_as=v8debug ' + '--require ' + <add> nodeBinary + ' ' + '--expose_natives_as=v8natives ' + '--require ' + <ide> fixture('cluster-preload.js') + ' ' + 'cluster-preload-test.js', <ide> function(err, stdout, stderr) { <ide> assert.ifError(err);
1
Ruby
Ruby
inline anemic log guard
0dc6527a8be9e2cf74162574b56ef3e84c4b6969
<ide><path>activesupport/lib/active_support/cache.rb <ide> def expanded_version(key) <ide> end <ide> <ide> def instrument(operation, key, options = nil) <del> log { "Cache #{operation}: #{normalize_key(key, options)}#{options.blank? ? "" : " (#{options.inspect})"}" } <add> if logger && logger.debug? && !silence? <add> logger.debug "Cache #{operation}: #{normalize_key(key, options)}#{options.blank? ? "" : " (#{options.inspect})"}" <add> end <ide> <ide> payload = { key: key } <ide> payload.merge!(options) if options.is_a?(Hash) <ide> ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload) { yield(payload) } <ide> end <ide> <del> def log <del> return unless logger && logger.debug? && !silence? <del> logger.debug(yield) <del> end <del> <ide> def handle_expired_entry(entry, key, options) <ide> if entry && entry.expired? <ide> race_ttl = options[:race_condition_ttl].to_i
1
Python
Python
add benchmark logging for wide_deep.
1d76d3ae049e649140dbba9ee6090e57ee4a7755
<ide><path>official/wide_deep/wide_deep.py <ide> <ide> from official.utils.flags import core as flags_core <ide> from official.utils.logs import hooks_helper <add>from official.utils.logs import logger <ide> from official.utils.misc import model_helpers <ide> <ide> <ide> def define_wide_deep_flags(): <ide> """Add supervised learning flags, as well as wide-deep model type.""" <ide> flags_core.define_base() <add> flags_core.define_benchmark() <ide> <ide> flags.adopt_module_key_flags(flags_core) <ide> <ide> def train_input_fn(): <ide> def eval_input_fn(): <ide> return input_fn(test_file, 1, False, flags_obj.batch_size) <ide> <add> run_params = { <add> 'batch_size': flags_obj.batch_size, <add> 'train_epochs': flags_obj.train_epochs, <add> 'model_type': flags_obj.model_type, <add> } <add> <add> benchmark_logger = logger.config_benchmark_logger(flags_obj.benchmark_log_dir) <add> benchmark_logger.log_run_info('wide_deep', 'Census Income', run_params) <add> <ide> loss_prefix = LOSS_PREFIX.get(flags_obj.model_type, '') <ide> train_hooks = hooks_helper.get_train_hooks( <ide> flags_obj.hooks, batch_size=flags_obj.batch_size, <ide> def eval_input_fn(): <ide> results = model.evaluate(input_fn=eval_input_fn) <ide> <ide> # Display evaluation metrics <del> print('Results at epoch', (n + 1) * flags_obj.epochs_between_evals) <del> print('-' * 60) <add> tf.logging.info('Results at epoch %d / %d', <add> (n + 1) * flags_obj.epochs_between_evals, <add> flags_obj.train_epochs) <add> tf.logging.info('-' * 60) <ide> <ide> for key in sorted(results): <del> print('%s: %s' % (key, results[key])) <add> tf.logging.info('%s: %s' % (key, results[key])) <add> <add> benchmark_logger.log_evaluation_result(results) <ide> <ide> if model_helpers.past_stop_threshold( <ide> flags_obj.stop_threshold, results['accuracy']):
1
Python
Python
add numerical integration of x^2 to trapz
4ca8204c5c13b3a5c9482772813e67184f3f47c8
<ide><path>numpy/lib/function_base.py <ide> def trapz(y, x=None, dx=1.0, axis=-1): <ide> <ide> Examples <ide> -------- <del> >>> np.trapz([1,2,3]) <add> Use the trapezoidal rule on evenly spaced points: <add> <add> >>> np.trapz([1, 2, 3]) <ide> 4.0 <del> >>> np.trapz([1,2,3], x=[4,6,8]) <add> <add> The spacing between sample points can be selected by either the <add> ``x`` or ``dx`` arguments: <add> <add> >>> np.trapz([1, 2, 3], x=[4, 6, 8]) <ide> 8.0 <del> >>> np.trapz([1,2,3], dx=2) <add> >>> np.trapz([1, 2, 3], dx=2) <ide> 8.0 <ide> <del> Using a decreasing `x` corresponds to integrating in reverse: <add> Using a decreasing ``x`` corresponds to integrating in reverse: <ide> <del> >>> np.trapz([1,2,3], x=[8,6,4]) <add> >>> np.trapz([1, 2, 3], x=[8, 6, 4]) <ide> -8.0 <ide> <del> More generally `x` is used to integrate along a parametric curve. <del> This finds the area of a circle, noting we repeat the sample which closes <add> More generally ``x`` is used to integrate along a parametric curve. We can <add> estimate the integral :math:`\int_0^1 x^2 = 1/3` using: <add> <add> >>> x = np.linspace(0, 1, num=50) <add> >>> y = x**2 <add> >>> np.trapz(y, x) <add> 0.33340274885464394 <add> <add> Or estimate the area of a circle, noting we repeat the sample which closes <ide> the curve: <ide> <ide> >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) <ide> >>> np.trapz(np.cos(theta), x=np.sin(theta)) <ide> 3.141571941375841 <ide> <add> ``np.trapz`` can be applied along a specified axis to do multiple <add> computations in one call: <add> <ide> >>> a = np.arange(6).reshape(2, 3) <ide> >>> a <ide> array([[0, 1, 2],
1
Ruby
Ruby
build fix when running isolated test
74a191dfc70c885031b3b96f07c1817077831ee9
<ide><path>activesupport/lib/active_support/multibyte/chars.rb <ide> # encoding: utf-8 <add>require 'active_support/json' <ide> require 'active_support/core_ext/string/access' <ide> require 'active_support/core_ext/string/behavior' <ide> require 'active_support/core_ext/module/delegation'
1
Go
Go
remove job from pull and import
6e38a53f96403b4cbd38e49e6b294128ed054a20
<ide><path>api/server/server.go <ide> func postImagesCreate(eng *engine.Engine, version version.Version, w http.Respon <ide> image = r.Form.Get("fromImage") <ide> repo = r.Form.Get("repo") <ide> tag = r.Form.Get("tag") <del> job *engine.Job <ide> ) <ide> authEncoded := r.Header.Get("X-Registry-Auth") <ide> authConfig := &registry.AuthConfig{} <ide> func postImagesCreate(eng *engine.Engine, version version.Version, w http.Respon <ide> authConfig = &registry.AuthConfig{} <ide> } <ide> } <add> <add> d := getDaemon(eng) <add> <ide> if image != "" { //pull <ide> if tag == "" { <ide> image, tag = parsers.ParseRepositoryTag(image) <ide> func postImagesCreate(eng *engine.Engine, version version.Version, w http.Respon <ide> metaHeaders[k] = v <ide> } <ide> } <del> job = eng.Job("pull", image, tag) <del> job.SetenvBool("parallel", version.GreaterThan("1.3")) <del> job.SetenvJson("metaHeaders", metaHeaders) <del> job.SetenvJson("authConfig", authConfig) <add> <add> imagePullConfig := &graph.ImagePullConfig{ <add> Parallel: version.GreaterThan("1.3"), <add> MetaHeaders: metaHeaders, <add> AuthConfig: authConfig, <add> OutStream: utils.NewWriteFlusher(w), <add> } <add> if version.GreaterThan("1.0") { <add> imagePullConfig.Json = true <add> w.Header().Set("Content-Type", "application/json") <add> } else { <add> imagePullConfig.Json = false <add> } <add> <add> if err := d.Repositories().Pull(image, tag, imagePullConfig, eng); err != nil { <add> return err <add> } <ide> } else { //import <ide> if tag == "" { <ide> repo, tag = parsers.ParseRepositoryTag(repo) <ide> } <del> job = eng.Job("import", r.Form.Get("fromSrc"), repo, tag) <del> job.Stdin.Add(r.Body) <del> job.SetenvList("changes", r.Form["changes"]) <del> } <ide> <del> if version.GreaterThan("1.0") { <del> job.SetenvBool("json", true) <del> streamJSON(job, w, true) <del> } else { <del> job.Stdout.Add(utils.NewWriteFlusher(w)) <del> } <del> if err := job.Run(); err != nil { <del> if !job.Stdout.Used() { <add> src := r.Form.Get("fromSrc") <add> imageImportConfig := &graph.ImageImportConfig{ <add> Changes: r.Form["changes"], <add> InConfig: r.Body, <add> OutStream: utils.NewWriteFlusher(w), <add> } <add> if version.GreaterThan("1.0") { <add> imageImportConfig.Json = true <add> w.Header().Set("Content-Type", "application/json") <add> } else { <add> imageImportConfig.Json = false <add> } <add> <add> if err := d.Repositories().Import(src, repo, tag, imageImportConfig, eng); err != nil { <ide> return err <ide> } <del> sf := streamformatter.NewStreamFormatter(version.GreaterThan("1.0")) <del> w.Write(sf.FormatError(err)) <add> <ide> } <ide> <ide> return nil <ide><path>builder/internals.go <ide> import ( <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/builder/parser" <ide> "github.com/docker/docker/daemon" <add> "github.com/docker/docker/graph" <ide> imagepkg "github.com/docker/docker/image" <ide> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/chrootarchive" <ide> func (b *Builder) pullImage(name string) (*imagepkg.Image, error) { <ide> if tag == "" { <ide> tag = "latest" <ide> } <del> job := b.Engine.Job("pull", remote, tag) <add> <ide> pullRegistryAuth := b.AuthConfig <ide> if len(b.AuthConfigFile.Configs) > 0 { <ide> // The request came with a full auth config file, we prefer to use that <ide> func (b *Builder) pullImage(name string) (*imagepkg.Image, error) { <ide> resolvedAuth := b.AuthConfigFile.ResolveAuthConfig(repoInfo.Index) <ide> pullRegistryAuth = &resolvedAuth <ide> } <del> job.SetenvBool("json", b.StreamFormatter.Json()) <del> job.SetenvBool("parallel", true) <del> job.SetenvJson("authConfig", pullRegistryAuth) <del> job.Stdout.Add(ioutils.NopWriteCloser(b.OutOld)) <del> if err := job.Run(); err != nil { <add> <add> imagePullConfig := &graph.ImagePullConfig{ <add> Parallel: true, <add> AuthConfig: pullRegistryAuth, <add> OutStream: ioutils.NopWriteCloser(b.OutOld), <add> Json: b.StreamFormatter.Json(), <add> } <add> <add> if err := b.Daemon.Repositories().Pull(remote, tag, imagePullConfig, b.Engine); err != nil { <ide> return nil, err <ide> } <add> <ide> image, err := b.Daemon.Repositories().LookupImage(name) <ide> if err != nil { <ide> return nil, err <ide><path>graph/import.go <ide> package graph <ide> import ( <ide> "bytes" <ide> "encoding/json" <del> "fmt" <add> "io" <ide> "net/http" <ide> "net/url" <ide> <ide> import ( <ide> "github.com/docker/docker/utils" <ide> ) <ide> <del>func (s *TagStore) CmdImport(job *engine.Job) error { <del> if n := len(job.Args); n != 2 && n != 3 { <del> return fmt.Errorf("Usage: %s SRC REPO [TAG]", job.Name) <del> } <add>type ImageImportConfig struct { <add> Changes []string <add> InConfig io.ReadCloser <add> Json bool <add> OutStream io.Writer <add> //OutStream WriteFlusher <add>} <add> <add>func (s *TagStore) Import(src string, repo string, tag string, imageImportConfig *ImageImportConfig, eng *engine.Engine) error { <ide> var ( <del> src = job.Args[0] <del> repo = job.Args[1] <del> tag string <del> sf = streamformatter.NewStreamFormatter(job.GetenvBool("json")) <add> sf = streamformatter.NewStreamFormatter(imageImportConfig.Json) <ide> archive archive.ArchiveReader <ide> resp *http.Response <ide> stdoutBuffer = bytes.NewBuffer(nil) <ide> newConfig runconfig.Config <ide> ) <del> if len(job.Args) > 2 { <del> tag = job.Args[2] <del> } <ide> <ide> if src == "-" { <del> archive = job.Stdin <add> archive = imageImportConfig.InConfig <ide> } else { <ide> u, err := url.Parse(src) <ide> if err != nil { <ide> func (s *TagStore) CmdImport(job *engine.Job) error { <ide> u.Host = src <ide> u.Path = "" <ide> } <del> job.Stdout.Write(sf.FormatStatus("", "Downloading from %s", u)) <add> imageImportConfig.OutStream.Write(sf.FormatStatus("", "Downloading from %s", u)) <ide> resp, err = httputils.Download(u.String()) <ide> if err != nil { <ide> return err <ide> } <ide> progressReader := progressreader.New(progressreader.Config{ <ide> In: resp.Body, <del> Out: job.Stdout, <add> Out: imageImportConfig.OutStream, <ide> Formatter: sf, <ide> Size: int(resp.ContentLength), <ide> NewLines: true, <ide> func (s *TagStore) CmdImport(job *engine.Job) error { <ide> archive = progressReader <ide> } <ide> <del> buildConfigJob := job.Eng.Job("build_config") <add> buildConfigJob := eng.Job("build_config") <ide> buildConfigJob.Stdout.Add(stdoutBuffer) <del> buildConfigJob.Setenv("changes", job.Getenv("changes")) <add> buildConfigJob.SetenvList("changes", imageImportConfig.Changes) <ide> // FIXME this should be remove when we remove deprecated config param <del> buildConfigJob.Setenv("config", job.Getenv("config")) <add> //buildConfigJob.Setenv("config", job.Getenv("config")) <ide> <ide> if err := buildConfigJob.Run(); err != nil { <ide> return err <ide> func (s *TagStore) CmdImport(job *engine.Job) error { <ide> return err <ide> } <ide> } <del> job.Stdout.Write(sf.FormatStatus("", img.ID)) <add> imageImportConfig.OutStream.Write(sf.FormatStatus("", img.ID)) <ide> logID := img.ID <ide> if tag != "" { <ide> logID = utils.ImageReference(logID, tag) <ide><path>graph/pull.go <ide> import ( <ide> "github.com/docker/docker/utils" <ide> ) <ide> <del>func (s *TagStore) CmdPull(job *engine.Job) error { <del> if n := len(job.Args); n != 1 && n != 2 { <del> return fmt.Errorf("Usage: %s IMAGE [TAG|DIGEST]", job.Name) <del> } <add>type ImagePullConfig struct { <add> Parallel bool <add> MetaHeaders map[string][]string <add> AuthConfig *registry.AuthConfig <add> Json bool <add> OutStream io.Writer <add>} <ide> <add>func (s *TagStore) Pull(image string, tag string, imagePullConfig *ImagePullConfig, eng *engine.Engine) error { <ide> var ( <del> localName = job.Args[0] <del> tag string <del> sf = streamformatter.NewStreamFormatter(job.GetenvBool("json")) <del> authConfig = &registry.AuthConfig{} <del> metaHeaders map[string][]string <add> sf = streamformatter.NewStreamFormatter(imagePullConfig.Json) <ide> ) <ide> <ide> // Resolve the Repository name from fqn to RepositoryInfo <del> repoInfo, err := s.registryService.ResolveRepository(localName) <add> repoInfo, err := s.registryService.ResolveRepository(image) <ide> if err != nil { <ide> return err <ide> } <ide> <del> if len(job.Args) > 1 { <del> tag = job.Args[1] <del> } <del> <del> job.GetenvJson("authConfig", authConfig) <del> job.GetenvJson("metaHeaders", &metaHeaders) <del> <ide> c, err := s.poolAdd("pull", utils.ImageReference(repoInfo.LocalName, tag)) <ide> if err != nil { <ide> if c != nil { <ide> // Another pull of the same repository is already taking place; just wait for it to finish <del> job.Stdout.Write(sf.FormatStatus("", "Repository %s already being pulled by another client. Waiting.", repoInfo.LocalName)) <add> imagePullConfig.OutStream.Write(sf.FormatStatus("", "Repository %s already being pulled by another client. Waiting.", repoInfo.LocalName)) <ide> <-c <ide> return nil <ide> } <ide> func (s *TagStore) CmdPull(job *engine.Job) error { <ide> return err <ide> } <ide> <del> r, err := registry.NewSession(authConfig, registry.HTTPRequestFactory(metaHeaders), endpoint, true) <add> r, err := registry.NewSession(imagePullConfig.AuthConfig, registry.HTTPRequestFactory(imagePullConfig.MetaHeaders), endpoint, true) <ide> if err != nil { <ide> return err <ide> } <ide> func (s *TagStore) CmdPull(job *engine.Job) error { <ide> <ide> if len(repoInfo.Index.Mirrors) == 0 && (repoInfo.Index.Official || endpoint.Version == registry.APIVersion2) { <ide> if repoInfo.Official { <del> j := job.Eng.Job("trust_update_base") <add> j := eng.Job("trust_update_base") <ide> if err = j.Run(); err != nil { <ide> logrus.Errorf("error updating trust base graph: %s", err) <ide> } <ide> } <ide> <ide> logrus.Debugf("pulling v2 repository with local name %q", repoInfo.LocalName) <del> if err := s.pullV2Repository(job.Eng, r, job.Stdout, repoInfo, tag, sf, job.GetenvBool("parallel")); err == nil { <add> if err := s.pullV2Repository(eng, r, imagePullConfig.OutStream, repoInfo, tag, sf, imagePullConfig.Parallel); err == nil { <ide> s.eventsService.Log("pull", logName, "") <ide> return nil <ide> } else if err != registry.ErrDoesNotExist && err != ErrV2RegistryUnavailable { <ide> func (s *TagStore) CmdPull(job *engine.Job) error { <ide> } <ide> <ide> logrus.Debugf("pulling v1 repository with local name %q", repoInfo.LocalName) <del> if err = s.pullRepository(r, job.Stdout, repoInfo, tag, sf, job.GetenvBool("parallel")); err != nil { <add> if err = s.pullRepository(r, imagePullConfig.OutStream, repoInfo, tag, sf, imagePullConfig.Parallel); err != nil { <ide> return err <ide> } <ide> <ide><path>graph/service.go <ide> func (s *TagStore) Install(eng *engine.Engine) error { <ide> "image_export": s.CmdImageExport, <ide> "viz": s.CmdViz, <ide> "load": s.CmdLoad, <del> "import": s.CmdImport, <del> "pull": s.CmdPull, <ide> "push": s.CmdPush, <ide> } { <ide> if err := eng.Register(name, handler); err != nil { <ide><path>integration-cli/utils.go <ide> func runCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode in <ide> if i > 0 { <ide> prevCmd := cmds[i-1] <ide> cmd.Stdin, err = prevCmd.StdoutPipe() <add> <ide> if err != nil { <ide> return "", 0, fmt.Errorf("cannot set stdout pipe for %s: %v", cmd.Path, err) <ide> } <ide><path>integration/runtime_test.go <ide> import ( <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/reexec" <ide> "github.com/docker/docker/pkg/stringid" <add> "github.com/docker/docker/registry" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/utils" <ide> ) <ide> func setupBaseImage() { <ide> // If the unit test is not found, try to download it. <ide> if err := job.Run(); err != nil || img.Get("Id") != unitTestImageID { <ide> // Retrieve the Image <del> job = eng.Job("pull", unitTestImageName) <del> job.Stdout.Add(ioutils.NopWriteCloser(os.Stdout)) <del> if err := job.Run(); err != nil { <add> imagePullConfig := &graph.ImagePullConfig{ <add> Parallel: true, <add> OutStream: ioutils.NopWriteCloser(os.Stdout), <add> AuthConfig: &registry.AuthConfig{}, <add> } <add> d := getDaemon(eng) <add> if err := d.Repositories().Pull(unitTestImageName, "", imagePullConfig, eng); err != nil { <ide> logrus.Fatalf("Unable to pull the test image: %s", err) <ide> } <ide> }
7
Python
Python
remove duplicate normalize_data_format
b3cb261b22a73d195a527592b49ca57e8c9ac9f5
<ide><path>keras/layers/pooling.py <ide> class _Pooling2D(Layer): <ide> def __init__(self, pool_size=(2, 2), strides=None, padding='valid', <ide> data_format=None, **kwargs): <ide> super(_Pooling2D, self).__init__(**kwargs) <del> data_format = conv_utils.normalize_data_format(data_format) <ide> if strides is None: <ide> strides = pool_size <ide> self.pool_size = conv_utils.normalize_tuple(pool_size, 2, 'pool_size')
1
Python
Python
update task.update_state to accept variadic kwargs
6651e145989d6e890c28273d470bf8fb3a2d5c2b
<ide><path>celery/app/task.py <ide> def add_to_chord(self, sig, lazy=False): <ide> self.backend.add_to_chord(self.request.group, result) <ide> return sig.delay() if not lazy else sig <ide> <del> def update_state(self, task_id=None, state=None, meta=None): <add> def update_state(self, task_id=None, state=None, meta=None, **kwargs): <ide> """Update task state. <ide> <ide> Arguments: <ide> def update_state(self, task_id=None, state=None, meta=None): <ide> """ <ide> if task_id is None: <ide> task_id = self.request.id <del> self.backend.store_result(task_id, meta, state) <add> self.backend.store_result(task_id, meta, state, **kwargs) <ide> <ide> def on_success(self, retval, task_id, args, kwargs): <ide> """Success handler. <ide><path>t/unit/tasks/test_tasks.py <ide> def yyy(): <ide> yyy.push_request() <ide> try: <ide> tid = uuid() <del> yyy.update_state(tid, 'FROBULATING', {'fooz': 'baaz'}) <add> # update_state should accept arbitrary kwargs, which are passed to <add> # the backend store_result method <add> yyy.update_state(tid, 'FROBULATING', {'fooz': 'baaz'}, <add> arbitrary_kwarg=None) <ide> assert yyy.AsyncResult(tid).status == 'FROBULATING' <ide> assert yyy.AsyncResult(tid).result == {'fooz': 'baaz'} <ide>
2
PHP
PHP
fix documentation typo
fbcf44403bfa651e4e624922411c6339399c30bf
<ide><path>src/Illuminate/Routing/Router.php <ide> public function currentRouteName() <ide> } <ide> <ide> /** <del> * Alias for the "currentRouteNamed" method. <add> * Alias for the "currentRouteName" method. <ide> * <ide> * @param mixed string <ide> * @return bool
1
Javascript
Javascript
update http test to use common.mustcall
d2626ef6b71d6ecf115a9dee9f3c929fa1acedad
<ide><path>test/parallel/test-http-timeout-overflow.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> 'use strict'; <del>require('../common'); <del>const assert = require('assert'); <del> <add>const common = require('../common'); <ide> const http = require('http'); <ide> <del>let serverRequests = 0; <del>let clientRequests = 0; <del> <del>const server = http.createServer(function(req, res) { <del> serverRequests++; <add>const server = http.createServer(common.mustCall(function(req, res) { <ide> res.writeHead(200, { 'Content-Type': 'text/plain' }); <ide> res.end('OK'); <del>}); <add>})); <ide> <ide> server.listen(0, function() { <ide> function callback() {} <ide> server.listen(0, function() { <ide> }, function(res) { <ide> req.clearTimeout(callback); <ide> <del> res.on('end', function() { <del> clientRequests++; <add> res.on('end', common.mustCall(function() { <ide> server.close(); <del> }); <add> })); <ide> <ide> res.resume(); <ide> }); <ide> server.listen(0, function() { <ide> req.setTimeout(0xffffffff, callback); <ide> req.end(); <ide> }); <del> <del>process.once('exit', function() { <del> assert.strictEqual(clientRequests, 1); <del> assert.strictEqual(serverRequests, 1); <del>});
1
PHP
PHP
move checks closer to the side effects
4ab503aa079419b8315dfa489fd6182db9305240
<ide><path>lib/Cake/Database/Connection.php <ide> class Connection { <ide> * Constructor <ide> * <ide> * @param array $config configuration for connecting to database <del> * @throws Cake\Database\Exception\MissingDriverException if driver class can not be found <del> * @throws Cake\Database\Exception\MissingExtensionException if driver cannot be used <ide> * @return self <ide> */ <ide> public function __construct($config) { <ide> $this->_config = $config; <del> if (!class_exists($config['datasource'])) { <del> throw new MissingDriverException(['driver' => $config['datasource']]); <del> } <ide> <ide> $this->driver($config['datasource'], $config); <del> if (!$this->_driver->enabled()) { <del> throw new MissingExtensionException(['driver' => get_class($this->_driver)]); <del> } <ide> <ide> if (!empty($config['log'])) { <ide> $this->logQueries($config['log']); <ide> public function config() { <ide> * <ide> * @param string|Driver $driver <ide> * @param array|null $config Either config for a new driver or null. <add> * @throws Cake\Database\MissingDriverException When a driver class is missing. <add> * @throws Cake\Database\MissingExtensionException When a driver's PHP extension is missing. <ide> * @return Driver <ide> */ <ide> public function driver($driver = null, $config = null) { <ide> if ($driver === null) { <ide> return $this->_driver; <ide> } <ide> if (is_string($driver)) { <add> if (!class_exists($driver)) { <add> throw new MissingDriverException(['driver' => $driver]); <add> } <ide> $driver = new $driver($config); <ide> } <add> if (!$driver->enabled()) { <add> throw new MissingExtensionException(['driver' => get_class($this->_driver)]); <add> } <ide> return $this->_driver = $driver; <ide> } <ide>
1
Javascript
Javascript
fix mapfunction parameters in mapchildren's jsdoc
9462d0d0404a9a2d2cc6afbef801f0ecf4018560
<ide><path>src/isomorphic/children/ReactChildren.js <ide> function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { <ide> /** <ide> * Maps children that are typically specified as `props.children`. <ide> * <del> * The provided mapFunction(child, key, index) will be called for each <add> * The provided mapFunction(child, index) will be called for each <ide> * leaf child. <ide> * <ide> * @param {?*} children Children tree container.
1
Java
Java
add isopen to websocketsession in webflux
6bb3ad793eedd2f5eda98d5897ab207f081c87ec
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/WebSocketSession.java <ide> public interface WebSocketSession { <ide> */ <ide> Mono<Void> send(Publisher<WebSocketMessage> messages); <ide> <add> /** <add> * Whether the underlying connection is open. <add> * @since 5.3.1 <add> */ <add> boolean isOpen(); <add> <ide> /** <ide> * Close the WebSocket session with {@link CloseStatus#NORMAL}. <ide> */ <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketSession.java <ide> else if (WebSocketMessage.Type.PONG.equals(message.getType())) { <ide> return true; <ide> } <ide> <add> @Override <add> public boolean isOpen() { <add> return getDelegate().isOpen(); <add> } <add> <ide> @Override <ide> public Mono<Void> close(CloseStatus status) { <ide> getDelegate().close(status.getCode(), status.getReason()); <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/ReactorNettyWebSocketSession.java <ide> */ <ide> package org.springframework.web.reactive.socket.adapter; <ide> <add>import java.util.function.Consumer; <add> <ide> import io.netty.handler.codec.http.websocketx.WebSocketFrame; <ide> import org.reactivestreams.Publisher; <ide> import reactor.core.publisher.Flux; <ide> import reactor.core.publisher.Mono; <add>import reactor.netty.Connection; <ide> import reactor.netty.NettyInbound; <ide> import reactor.netty.NettyOutbound; <ide> import reactor.netty.http.websocket.WebsocketInbound; <ide> public Mono<Void> send(Publisher<WebSocketMessage> messages) { <ide> .then(); <ide> } <ide> <add> @Override <add> public boolean isOpen() { <add> DisposedCallback callback = new DisposedCallback(); <add> getDelegate().getInbound().withConnection(callback); <add> return callback.isDisposed(); <add> } <add> <ide> @Override <ide> public Mono<Void> close(CloseStatus status) { <ide> // this will notify WebSocketInbound.receiveCloseStatus() <ide> public WebsocketOutbound getOutbound() { <ide> } <ide> } <ide> <add> <add> private static class DisposedCallback implements Consumer<Connection> { <add> <add> private boolean disposed; <add> <add> public boolean isDisposed() { <add> return this.disposed; <add> } <add> <add> @Override <add> public void accept(Connection connection) { <add> this.disposed = connection.isDisposed(); <add> } <add> } <add> <ide> } <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketSession.java <ide> else if (WebSocketMessage.Type.PONG.equals(message.getType())) { <ide> return true; <ide> } <ide> <add> @Override <add> public boolean isOpen() { <add> return getDelegate().isOpen(); <add> } <add> <ide> @Override <ide> public Mono<Void> close(CloseStatus status) { <ide> try { <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/UndertowWebSocketSession.java <ide> else if (WebSocketMessage.Type.PONG.equals(message.getType())) { <ide> return true; <ide> } <ide> <add> @Override <add> public boolean isOpen() { <add> return getDelegate().isOpen(); <add> } <add> <ide> @Override <ide> public Mono<Void> close(CloseStatus status) { <ide> CloseMessage cm = new CloseMessage(status.getCode(), status.getReason()); <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/WebSocketSession.java <ide> public interface WebSocketSession extends Closeable { <ide> void sendMessage(WebSocketMessage<?> message) throws IOException; <ide> <ide> /** <del> * Return whether the connection is still open. <add> * Whether the underlying connection is open. <ide> */ <ide> boolean isOpen(); <ide>
6
PHP
PHP
move deprecations into constructors
3ddeac9a9f4e40d042f07541924091ae8fb0319f
<ide><path>src/View/Helper/RssHelper.php <ide> */ <ide> namespace Cake\View\Helper; <ide> <del>deprecationWarning('RssHelper is deprecated and will be removed in 4.0.0'); <del> <ide> use Cake\Utility\Xml; <ide> use Cake\View\Helper; <add>use Cake\View\View; <ide> <ide> /** <ide> * RSS Helper class for easy output RSS structures. <ide> class RssHelper extends Helper <ide> */ <ide> public $version = '2.0'; <ide> <add> /** <add> * {@inheritDoc} <add> */ <add> public function __construct(View $view, array $settings = []) <add> { <add> deprecationWarning('RssHelper is deprecated and will be removed in 4.0.0'); <add> parent::__construct($view, $settings); <add> } <add> <ide> /** <ide> * Returns an RSS document wrapped in `<rss />` tags <ide> * <ide><path>src/View/Helper/SessionHelper.php <ide> */ <ide> namespace Cake\View\Helper; <ide> <del>deprecationWarning( <del> 'SessionHelper is deprecated and will be removed in 4.0.0. ' . <del> 'Use request->session() instead.' <del>); <del> <ide> use Cake\View\Helper; <ide> use Cake\View\View; <ide> <ide> class SessionHelper extends Helper <ide> */ <ide> public function __construct(View $View, array $config = []) <ide> { <del> trigger_error('SessionHelper has been deprecated. Use request->session() instead.', E_USER_DEPRECATED); <add> deprecationWarning( <add> 'SessionHelper is deprecated and will be removed in 4.0.0. ' . <add> 'Use request->session() instead.' <add> ); <add> <ide> parent::__construct($View, $config); <ide> } <ide> <ide><path>tests/TestCase/View/Helper/RssHelperTest.php <ide> <ide> /** <ide> * RssHelperTest class <add> * <add> * @group deprecated <ide> */ <ide> class RssHelperTest extends TestCase <ide> { <ide> public function setUp() <ide> { <ide> parent::setUp(); <ide> <del> $errorLevel = error_reporting(); <del> error_reporting(E_ALL ^ E_USER_DEPRECATED); <add> $oldLevel = error_reporting(E_ALL ^ E_USER_DEPRECATED); <ide> <ide> $this->View = new View(); <ide> $this->Rss = new RssHelper($this->View); <ide> <del> error_reporting($errorLevel); <add> error_reporting($oldLevel); <ide> } <ide> <ide> /**
3
PHP
PHP
fix setpriority call for mailchannel
40abea870dbb802b752eb294fad5ab9de1eec1e5
<ide><path>src/Illuminate/Notifications/Channels/MailChannel.php <ide> protected function buildMessage($mailMessage, $notifiable, $notification, $messa <ide> $this->addAttachments($mailMessage, $message); <ide> <ide> if (! is_null($message->priority)) { <del> $mailMessage->setPriority($message->priority); <add> $mailMessage->priority($message->priority); <ide> } <ide> <ide> if ($message->tags) { <ide><path>tests/Integration/Notifications/SendingMailNotificationsTest.php <ide> public function testMailIsSent() <ide> <ide> $message->shouldReceive('subject')->once()->with('Test Mail Notification'); <ide> <del> $message->shouldReceive('setPriority')->once()->with(1); <add> $message->shouldReceive('priority')->once()->with(1); <ide> <ide> $closure($message); <ide> <ide> public function testMailIsSentToNamedAddress() <ide> <ide> $message->shouldReceive('subject')->once()->with('Test Mail Notification'); <ide> <del> $message->shouldReceive('setPriority')->once()->with(1); <add> $message->shouldReceive('priority')->once()->with(1); <ide> <ide> $closure($message); <ide>
2
Text
Text
remove systemtap from tierlist
627497bd50d35d9f4370934ba4a53c289c2b0649
<ide><path>doc/contributing/diagnostic-tooling-support-tiers.md <ide> The tools are currently assigned to Tiers as follows: <ide> | Debugger | Command line Debug Client | ? | Yes | 1 | <ide> | Tracing | trace\_events (API) | No | Yes | 1 | <ide> | Tracing | trace\_gc | No | Yes | 1 | <del>| Tracing | Systemtap | No | Partial | ? | <ide> | F/P/T | appmetrics | No | No | ? | <ide> | M/T | eBPF tracing tool | No | No | ? |
1
Python
Python
change tests to look at array formatting only
a11c16249451c552e70a5ff73406f95b50961aa5
<ide><path>numpy/testing/tests/test_utils.py <ide> def test_error_message(self): <ide> y = np.array([1.00000000002, 2.00000000003, 3.00004]) <ide> <ide> # test with a different amount of decimal digits <del> b = ('\nArrays are not almost equal to 12 decimals\n\n(mismatch ' <del> '100.0%)\n x: array([ 1.00000000001, 2.00000000002, 3.00003 ' <add> # note that we only check for the formatting of the arrays themselves <add> b = ('x: array([ 1.00000000001, 2.00000000002, 3.00003 ' <ide> ' ])\n y: array([ 1.00000000002, 2.00000000003, 3.00004 ])') <ide> try: <ide> self._assert_func(x, y, decimal=12) <ide> except AssertionError as e: <del> self.assertEqual(str(e), b) <add> # remove anything that's not the array string <add> self.assertEqual(str(e).split('%)\n ')[1], b) <ide> <ide> # with the default value of decimal digits, only the 3rd element differs <del> b = ('\nArrays are not almost equal to 7 decimals\n\n(mismatch ' <del> '33.3333333333%)\n x: array([ 1. , 2. , 3.00003])\n y: ' <del> 'array([ 1. , 2. , 3.00004])') <add> # note that we only check for the formatting of the arrays themselves <add> b = ('x: array([ 1. , 2. , 3.00003])\n y: array([ 1. , ' <add> '2. , 3.00004])') <ide> try: <ide> self._assert_func(x, y) <ide> except AssertionError as e: <del> self.assertEqual(str(e), b) <add> # remove anything that's not the array string <add> self.assertEqual(str(e).split('%)\n ')[1], b) <ide> <ide> class TestApproxEqual(unittest.TestCase): <ide> def setUp(self):
1
Javascript
Javascript
fix typos in examples
bcf78ebb18fdf463d69c08fafd5d27be6a0d1423
<ide><path>src/ngAnimate/module.js <ide> * jQuery(element).fadeOut(1000, doneFn); <ide> * } <ide> * } <del> * }] <add> * }]); <ide> * ``` <ide> * <ide> * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as <ide> * // do some cool animation and call the doneFn <ide> * } <ide> * } <del> * }] <add> * }]); <ide> * ``` <ide> * <ide> * ## CSS + JS Animations Together <ide> * jQuery(element).slideIn(1000, doneFn); <ide> * } <ide> * } <del> * }] <add> * }]); <ide> * ``` <ide> * <ide> * ```css <ide> * runner.done(doneFn); <ide> * } <ide> * } <del> * }] <add> * }]); <ide> * ``` <ide> * <ide> * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. <ide> * runner.done(doneFn); <ide> * } <ide> * } <del> * }] <add> * }]); <ide> * ``` <ide> * <ide> * Now we can fill in the rest via our transition CSS code:
1
Javascript
Javascript
use a class for dependency references
8570165c1f8f00a7a513f2b4f8ce54e0af7404c4
<ide><path>lib/Dependency.js <ide> Author Tobias Koppers @sokra <ide> */ <ide> "use strict"; <add> <ide> const compareLocations = require("./compareLocations"); <add>const DependencyReference = require("./dependencies/DependencyReference"); <ide> <ide> class Dependency { <ide> constructor() { <ide> class Dependency { <ide> // Returns the referenced module and export <ide> getReference() { <ide> if (!this.module) return null; <del> return { <del> module: this.module, <del> weak: this.weak, <del> importedNames: true // true: full object, false: only sideeffects/no export, array of strings: the exports with this names <del> }; <add> return new DependencyReference(this.module, true, this.weak); <ide> } <ide> <ide> // Returns the exported names <ide><path>lib/dependencies/DelegatedExportsDependency.js <ide> Author Tobias Koppers @sokra <ide> */ <ide> "use strict"; <add> <add>const DependencyReference = require("./DependencyReference"); <ide> const NullDependency = require("./NullDependency"); <ide> <ide> class DelegatedExportsDependency extends NullDependency { <ide> class DelegatedExportsDependency extends NullDependency { <ide> } <ide> <ide> getReference() { <del> return { <del> module: this.originModule, <del> importedNames: true <del> }; <add> return new DependencyReference(this.originModule, true, false); <ide> } <ide> <ide> getExports() { <ide><path>lib/dependencies/DependencyReference.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add> Author Florent Cailhol @ooflorent <add>*/ <add>"use strict"; <add> <add>class DependencyReference { <add> constructor(module, importedNames, weak) { <add> this.module = module; <add> // true: full object <add> // false: only sideeffects/no export <add> // array of strings: the exports with this names <add> this.importedNames = importedNames; <add> this.weak = weak; <add> } <add>} <add> <add>module.exports = DependencyReference; <ide><path>lib/dependencies/HarmonyExportImportedSpecifierDependency.js <ide> Author Tobias Koppers @sokra <ide> */ <ide> "use strict"; <add> <add>const DependencyReference = require("./DependencyReference"); <ide> const HarmonyImportDependency = require("./HarmonyImportDependency"); <ide> const Template = require("../Template"); <ide> <ide> class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { <ide> <ide> case "reexport-non-harmony-default": <ide> case "reexport-named-default": <del> return { <del> module: mode.module, <del> importedNames: ["default"] <del> }; <add> return new DependencyReference(mode.module, ["default"], false); <ide> <ide> case "reexport-namespace-object": <ide> case "reexport-non-harmony-default-strict": <ide> case "reexport-fake-namespace-object": <ide> case "rexport-non-harmony-undefined": <del> return { <del> module: mode.module, <del> importedNames: true <del> }; <add> return new DependencyReference(mode.module, true, false); <ide> <ide> case "safe-reexport": <ide> case "checked-reexport": <del> return { <del> module: mode.module, <del> importedNames: Array.from(mode.map.values()) <del> }; <add> return new DependencyReference( <add> mode.module, <add> Array.from(mode.map.values()), <add> false <add> ); <ide> <ide> case "dynamic-reexport": <del> return { <del> module: mode.module, <del> importedNames: true <del> }; <add> return new DependencyReference(mode.module, true, false); <ide> <ide> default: <ide> throw new Error(`Unknown mode ${mode.type}`); <ide><path>lib/dependencies/HarmonyImportDependency.js <ide> Author Tobias Koppers @sokra <ide> */ <ide> "use strict"; <add> <add>const DependencyReference = require("./DependencyReference"); <ide> const ModuleDependency = require("./ModuleDependency"); <ide> const Template = require("../Template"); <ide> <ide> class HarmonyImportDependency extends ModuleDependency { <ide> <ide> getReference() { <ide> if (!this.module) return null; <del> <del> return { <del> module: this.module, <del> importedNames: false, <del> weak: this.weak <del> }; <add> return new DependencyReference(this.module, false, this.weak); <ide> } <ide> <ide> getImportVar() { <ide><path>lib/dependencies/HarmonyImportSpecifierDependency.js <ide> Author Tobias Koppers @sokra <ide> */ <ide> "use strict"; <add> <add>const DependencyReference = require("./DependencyReference"); <ide> const HarmonyImportDependency = require("./HarmonyImportDependency"); <ide> <ide> class HarmonyImportSpecifierDependency extends HarmonyImportDependency { <ide> class HarmonyImportSpecifierDependency extends HarmonyImportDependency { <ide> <ide> getReference() { <ide> if (!this.module) return null; <del> return { <del> module: this.module, <del> importedNames: <del> this.id && !this.namespaceObjectAsContext ? [this.id] : true <del> }; <add> return new DependencyReference( <add> this.module, <add> this.id && !this.namespaceObjectAsContext ? [this.id] : true, <add> false <add> ); <ide> } <ide> <ide> getWarnings() { <ide><path>lib/dependencies/RequireIncludeDependency.js <ide> */ <ide> "use strict"; <ide> <add>const DependencyReference = require("./DependencyReference"); <ide> const ModuleDependency = require("./ModuleDependency"); <ide> const Template = require("../Template"); <ide> <ide> class RequireIncludeDependency extends ModuleDependency { <ide> <ide> getReference() { <ide> if (!this.module) return null; <del> return { <del> module: this.module, <del> importedNames: [] // This doesn't use any export <del> }; <add> // This doesn't use any export <add> return new DependencyReference(this.module, [], false); <ide> } <ide> <ide> get type() { <ide><path>lib/dependencies/WebAssemblyImportDependency.js <ide> Author Tobias Koppers @sokra <ide> */ <ide> "use strict"; <add> <add>const DependencyReference = require("./DependencyReference"); <ide> const ModuleDependency = require("./ModuleDependency"); <ide> <ide> class WebAssemblyImportDependency extends ModuleDependency { <ide> class WebAssemblyImportDependency extends ModuleDependency { <ide> <ide> getReference() { <ide> if (!this.module) return null; <del> return { <del> module: this.module, <del> importedNames: [this.name] <del> }; <add> return new DependencyReference(this.module, [this.name], false); <ide> } <ide> <ide> get type() {
8
Text
Text
clarify ctx.query type on getserversideprops
0d98f370aaa6873e40d301b73948b48d58219ce1
<ide><path>docs/basic-features/data-fetching.md <ide> The `context` parameter is an object containing the following keys: <ide> - `params`: If this page uses a dynamic route, `params` contains the route parameters. If the page name is `[id].js` , then `params` will look like `{ id: ... }`. To learn more, take a look at the [Dynamic Routing documentation](/docs/routing/dynamic-routes.md). <ide> - `req`: [The HTTP IncomingMessage object](https://nodejs.org/api/http.html#http_class_http_incomingmessage). <ide> - `res`: [The HTTP response object](https://nodejs.org/api/http.html#http_class_http_serverresponse). <del>- `query`: The query string. <add>- `query`: An object representing the query string. <ide> - `preview`: `preview` is `true` if the page is in the preview mode and `false` otherwise. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md). <ide> - `previewData`: The preview data set by `setPreviewData`. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md). <ide> - `resolvedUrl`: A normalized version of the request URL that strips the `_next/data` prefix for client transitions and includes original query values.
1
Javascript
Javascript
remove unneeded chain declaration
ee5c5630877fb69e6c6263dda814b3d4f00ab971
<ide><path>src/applyMiddleware.js <ide> export default function applyMiddleware(...middlewares) { <ide> `Other middleware would not be applied to this dispatch.` <ide> ) <ide> } <del> let chain = [] <ide> <ide> const middlewareAPI = { <ide> getState: store.getState, <ide> dispatch: (...args) => dispatch(...args) <ide> } <del> chain = middlewares.map(middleware => middleware(middlewareAPI)) <add> const chain = middlewares.map(middleware => middleware(middlewareAPI)) <ide> dispatch = compose(...chain)(store.dispatch) <ide> <ide> return {
1
Javascript
Javascript
fix error for example test cases
f2e1c043722f4e64867b01b4455f9ea686ebf562
<ide><path>test/Examples.test.js <ide> describe("Examples", () => { <ide> } <ide> webpack(options, (err, stats) => { <ide> if (err) return done(err); <del> stats = stats.toJson({ <del> errorDetails: true <del> }); <del> if (stats.errors.length > 0) { <del> return done(new Error(stats.errors[0])); <add> if (stats.hasErrors()) { <add> return done( <add> new Error( <add> stats.toString({ <add> all: false, <add> errors: true, <add> errorDetails: true, <add> errorStacks: true <add> }) <add> ) <add> ); <ide> } <ide> done(); <ide> });
1
Go
Go
fix some comments
d5da7e53303dc1dd5d7d9062bf04318b129fc383
<ide><path>pkg/sysinfo/sysinfo_linux.go <ide> func New(quiet bool, options ...Opt) *SysInfo { <ide> return sysInfo <ide> } <ide> <del>// applyMemoryCgroupInfo reads the memory information from the memory cgroup mount point. <add>// applyMemoryCgroupInfo adds the memory cgroup controller information to the info. <ide> func applyMemoryCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> var warnings []string <ide> mountPoint, ok := cgMounts["memory"] <ide> func applyMemoryCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyCPUCgroupInfo reads the cpu information from the cpu cgroup mount point. <add>// applyCPUCgroupInfo adds the cpu cgroup controller information to the info. <ide> func applyCPUCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> var warnings []string <ide> mountPoint, ok := cgMounts["cpu"] <ide> func applyCPUCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyBlkioCgroupInfo reads the blkio information from the blkio cgroup mount point. <add>// applyBlkioCgroupInfo adds the blkio cgroup controller information to the info. <ide> func applyBlkioCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> var warnings []string <ide> mountPoint, ok := cgMounts["blkio"] <ide> func applyBlkioCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyCPUSetCgroupInfo reads the cpuset information from the cpuset cgroup mount point. <add>// applyCPUSetCgroupInfo adds the cpuset cgroup controller information to the info. <ide> func applyCPUSetCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> var warnings []string <ide> mountPoint, ok := cgMounts["cpuset"] <ide> func applyCPUSetCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyPIDSCgroupInfo reads the pids information from the pids cgroup mount point. <add>// applyPIDSCgroupInfo adds whether the pids cgroup controller is available to the info. <ide> func applyPIDSCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> var warnings []string <ide> _, ok := cgMounts["pids"] <ide> func applyPIDSCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyDevicesCgroupInfo reads the pids information from the devices cgroup mount point. <add>// applyDevicesCgroupInfo adds whether the devices cgroup controller is available to the info. <ide> func applyDevicesCgroupInfo(info *SysInfo, cgMounts map[string]string) []string { <ide> var warnings []string <ide> _, ok := cgMounts["devices"] <ide> func applyNetworkingInfo(info *SysInfo, _ map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyAppArmorInfo adds AppArmor information to the info. <add>// applyAppArmorInfo adds whether AppArmor is enabled to the info. <ide> func applyAppArmorInfo(info *SysInfo, _ map[string]string) []string { <ide> var warnings []string <ide> if _, err := os.Stat("/sys/kernel/security/apparmor"); !os.IsNotExist(err) { <ide> func applyAppArmorInfo(info *SysInfo, _ map[string]string) []string { <ide> return warnings <ide> } <ide> <del>// applyCgroupNsInfo adds cgroup namespace information to the info. <add>// applyCgroupNsInfo adds whether cgroupns is enabled to the info. <ide> func applyCgroupNsInfo(info *SysInfo, _ map[string]string) []string { <ide> var warnings []string <ide> if _, err := os.Stat("/proc/self/ns/cgroup"); !os.IsNotExist(err) {
1
Python
Python
attach existing volume in create_node
5a3c94a3f6e726d660ee93d0e4db19964d28b565
<ide><path>libcloud/compute/drivers/digitalocean.py <ide> def list_volumes(self): <ide> return list(map(self._to_volume, data)) <ide> <ide> def create_node(self, name, size, image, location, ex_create_attr=None, <del> ex_ssh_key_ids=None, ex_user_data=None): <add> ex_ssh_key_ids=None, ex_user_data=None, volumes=[]): <ide> """ <ide> Create a node. <ide> <ide> def create_node(self, name, size, image, location, ex_create_attr=None, <ide> attr = {'name': name, 'size': size.name, 'image': image.id, <ide> 'region': location.id, 'user_data': ex_user_data} <ide> <add> if volumes: <add> attr['volumes'] = volumes <add> <ide> if ex_ssh_key_ids: <ide> warnings.warn("The ex_ssh_key_ids parameter has been deprecated in" <ide> " favor of the ex_create_attr parameter.")
1
Text
Text
add iwildcam link
e79b53e721cd02d3b5dab5bb6e989933a3b77fdb
<ide><path>research/object_detection/g3doc/deepmac.md <ide> Resolution | Mask head | Config name | Mask m <ide> * [DeepMAC Colab](../colab_tutorials/deepmac_colab.ipynb) lets you run a <ide> pre-trained DeepMAC model on user-specified boxes. Note that you are not <ide> restricted to COCO classes! <add>* [iWildCam Notebook](https://www.kaggle.com/vighneshbgoogle/iwildcam-visualize-instance-masks) <add> to visualize instance masks generated by DeepMAC on the iWildCam dataset. <ide> <ide> ## Pre-trained models <ide>
1