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
apply fixes from styleci
0131fd5a395949dceacb2ef57eb21fa0992a1680
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphMany.php <ide> public function match(array $models, Collection $results, $relation) <ide> * @param array $attributes <ide> * @return \Illuminate\Database\Eloquent\Model <ide> */ <del> public function forceCreate(array $attributes = []) <add> public function forceCreate(array $attributes = []) <ide> { <ide> $attributes[$this->getMorphType()] = $this->morphClass; <ide>
1
PHP
PHP
add pdo try again as lost connection message
6f1fdddc9c9afc571f3aca51a67b58828a9e35f7
<ide><path>src/Illuminate/Database/DetectsLostConnections.php <ide> protected function causedByLostConnection(Throwable $e) <ide> 'Connection refused', <ide> 'running with the --read-only option so it cannot execute this statement', <ide> 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', <add> 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', <ide> ]); <ide> } <ide> }
1
Python
Python
change rules.py back
fedd3f1d915afc7ebf31ee8fd9e69e0012ac344e
<ide><path>scipy/f2py/rules.py <ide> ], <ide> 'cleanupfrompyobj':[ # note that this list will be reversed <ide> '\t} /*if (capi_#varname#_tmp == NULL) ... else of #varname#*/', <del> {l_not(isintent_hide):"""\ <add> {l_not(l_or(isintent_out,isintent_hide)):"""\ <ide> \tif((PyObject *)capi_#varname#_tmp!=#varname#_capi) { <ide> \t\tPy_XDECREF(capi_#varname#_tmp); }"""}, <del> {isintent_hide:"""\t\tPy_XDECREF(capi_#varname#_tmp);"""}, <add> {l_and(isintent_hide,l_not(isintent_out)):"""\t\tPy_XDECREF(capi_#varname#_tmp);"""}, <ide> {hasinitvalue:'\t} /*if (f2py_success) of #varname# init*/'}, <ide> ], <ide> '_check':isarray,
1
Text
Text
add issue & pull request template files
2575ed0c1c7229afe01cb966ff715a791934abe8
<ide><path>.github/ISSUE_TEMPLATE.md <add>- [ ] I have read the [guidelines for contributing](https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md) <add>- [ ] I have included an example of my issue on a website such as [JS Bin](http://jsbin.com/), [JS Fiddle](http://jsfiddle.net/), or [Codepen](http://codepen.io/pen/). ([Template](http://codepen.io/pen?template=JXVYzq)) <ide>\ No newline at end of file <ide><path>.github/PULL_REQUEST_TEMPLATE.md <add>- [ ] I have read the [guidelines for contributing](https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md) <add>- [ ] I have included an example of my changes on a website such as [JS Bin](http://jsbin.com/), [JS Fiddle](http://jsfiddle.net/), or [Codepen](http://codepen.io/pen/). ([Template](http://codepen.io/pen?template=JXVYzq)) <ide>\ No newline at end of file
2
PHP
PHP
add dropifexists() support for sql server
7ce580c88bbfc131a5562a8913a8a3c2d8e6546e
<ide><path>src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php <ide> public function compileDrop(Blueprint $blueprint, Fluent $command) <ide> return 'drop table '.$this->wrapTable($blueprint); <ide> } <ide> <add> /** <add> * Compile a drop table (if exists) command. <add> * <add> * @param \Illuminate\Database\Schema\Blueprint $blueprint <add> * @param \Illuminate\Support\Fluent $command <add> * @return string <add> */ <add> public function compileDropIfExists(Blueprint $blueprint, Fluent $command) <add> { <add> return 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = \''.$blueprint->getTable().'\') drop table '.$blueprint->getTable(); <add> } <add> <ide> /** <ide> * Compile a drop column command. <ide> *
1
PHP
PHP
update configuration examples
74b77a4d73a6de6c111da5ca783df86c7da62113
<ide><path>App/Config/cache.php <ide> * <ide> * File storage engine. <ide> * <del> * Cache::config('default', array( <add> * Configure::write('Cache.default', array( <ide> * 'engine' => 'File', //[required] <ide> * 'duration'=> 3600, //[optional] <ide> * 'probability'=> 100, //[optional] <ide> * <ide> * APC (http://pecl.php.net/package/APC) <ide> * <del> * Cache::config('default', array( <add> * Configure::write('Cache.default', array( <ide> * 'engine' => 'Apc', //[required] <ide> * 'duration'=> 3600, //[optional] <ide> * 'probability'=> 100, //[optional] <ide> * <ide> * Xcache (http://xcache.lighttpd.net/) <ide> * <del> * Cache::config('default', array( <add> * Configure::write('Cache.default', array( <ide> * 'engine' => 'Xcache', //[required] <ide> * 'duration'=> 3600, //[optional] <ide> * 'probability'=> 100, //[optional] <ide> * <ide> * Memcache (http://memcached.org/) <ide> * <del> * Cache::config('default', array( <add> * Configure::write('Cache.default', array( <ide> * 'engine' => 'Memcache', //[required] <ide> * 'duration'=> 3600, //[optional] <ide> * 'probability'=> 100, //[optional] <ide> * <ide> * Wincache (http://php.net/wincache) <ide> * <del> * Cache::config('default', array( <add> * Configure::write('Cache.default', array( <ide> * 'engine' => 'Wincache', //[required] <ide> * 'duration'=> 3600, //[optional] <ide> * 'probability'=> 100, //[optional] <ide> * <ide> * Redis (http://http://redis.io/) <ide> * <del> * Cache::config('default', array( <add> * Configure::write('Cache.default', array( <ide> * 'engine' => 'Redis', //[required] <ide> * 'duration'=> 3600, //[optional] <ide> * 'probability'=> 100, //[optional]
1
Text
Text
add 1.4.1 changes
528d7f9568e3b53f3d7e90035d186ff175fdf089
<ide><path>CHANGELOG.md <add><a name="1.4.1"></a> <add># 1.4.1 hyperionic-illumination (2015-06-16) <add> <add> <add>## Bug Fixes <add> <add>- **$compile:** <add> - workaround for IE11 MutationObserver <add> ([f3b1d0b7](https://github.com/angular/angular.js/commit/f3b1d0b723298a5f8ea21d0704405649cce1b5fc), <add> [#11781](https://github.com/angular/angular.js/issues/11781)) <add> - prevent exception when using `watch` as isolated scope binding property in Firefox <add> ([a6339d30](https://github.com/angular/angular.js/commit/a6339d30d1379689da5eec9647a953f64821f8b0), <add> [#11627](https://github.com/angular/angular.js/issues/11627)) <add>- **$location:** do not get caught in infinite digest in IE9 when redirecting in `$locationChangeSuccess` <add> ([91b60226](https://github.com/angular/angular.js/commit/91b602263b96b6fce1331208462e18eb647f4d60), <add> [#11439](https://github.com/angular/angular.js/issues/11439), [#11675](https://github.com/angular/angular.js/issues/11675), [#11935](https://github.com/angular/angular.js/issues/11935), [#12083](https://github.com/angular/angular.js/issues/12083)) <add>- **$parse:** <add> - set null reference properties to `undefined` <add> ([71fc3f4f](https://github.com/angular/angular.js/commit/71fc3f4fa0cd12eff335d57efed7c033554749f4), <add> [#12099](https://github.com/angular/angular.js/issues/12099)) <add> ([d19504a1](https://github.com/angular/angular.js/commit/d19504a179355d7801d59a8db0285a1322e04601), <add> [#11959](https://github.com/angular/angular.js/issues/11959)) <add>- **$sanitize:** dont not remove `tabindex` attribute <add> ([799353c7](https://github.com/angular/angular.js/commit/799353c75de28e6fbf52dac6e0721e85b578575a), <add> [#8371](https://github.com/angular/angular.js/issues/8371), [#5853](https://github.com/angular/angular.js/issues/5853)) <add>- **compile:** assign controller return values correctly for multiple directives <add> ([8caf1802](https://github.com/angular/angular.js/commit/8caf1802e0e93389dec626ef35e04a302aa6c39d), <add> [#12029](https://github.com/angular/angular.js/issues/12029), [#12036](https://github.com/angular/angular.js/issues/12036)) <add>- **copy:** do not copy the same object twice <add> ([0e622f7b](https://github.com/angular/angular.js/commit/0e622f7b5bc3d5d0ab0fbc1a1bc69404bd7216d5)) <add>- **forms:** parse exponential notation in `numberInputType` directive <add> ([ebd0fbba](https://github.com/angular/angular.js/commit/ebd0fbba8ff90bee0cd016d574643d56a7f81ed0), <add> [#12121](https://github.com/angular/angular.js/issues/12121), [#12122](https://github.com/angular/angular.js/issues/12122)) <add>- **linky:** allow case insensitive scheme detection <add> ([8dc09e6d](https://github.com/angular/angular.js/commit/8dc09e6dabb84c2c611cdc9e40adfac989648200), <add> [#12073](https://github.com/angular/angular.js/issues/12073), [#12073](https://github.com/angular/angular.js/issues/12073)) <add>- **ngAria:** <add> - update `aria-valuemin/max` when `min/max` change <add> ([ebaa0f59](https://github.com/angular/angular.js/commit/ebaa0f598501702ae64d59ada0ae492eaf0e2db6), <add> [#11770](https://github.com/angular/angular.js/issues/11770), [#11774](https://github.com/angular/angular.js/issues/11774)) <add> - ensure boolean values for aria-hidden and aria-disabled <add> ([59273354](https://github.com/angular/angular.js/commit/59273354b57dd8d1ad2cd2f4740ffa8923e480f9), <add> [#11365](https://github.com/angular/angular.js/issues/11365)) <add>- **ngModel:** ignore Object.prototype properties on the form validation object <add> ([0934b76b](https://github.com/angular/angular.js/commit/0934b76b72cec86093414834ac4cb7f0946b651d), <add> [#12066](https://github.com/angular/angular.js/issues/12066)) <add>- **ngOptions:** <add> - do not watch properties starting with $ <add> ([34a6da24](https://github.com/angular/angular.js/commit/34a6da24c17356d4ffc70aec3f621a140a9a61ab), <add> [#11930](https://github.com/angular/angular.js/issues/11930), [#12010](https://github.com/angular/angular.js/issues/12010)) <add> - use reference check only when not using trackBy <add> ([d7dc14dc](https://github.com/angular/angular.js/commit/d7dc14dc0cdeb9c187d227e19acc8aca7df9d740), <add> [#11936](https://github.com/angular/angular.js/issues/11936), [#11996](https://github.com/angular/angular.js/issues/11996)) <add> <add> <add>## Features <add> <add>- **$compile:** show module name during `multidir` error <add> ([351fe4b7](https://github.com/angular/angular.js/commit/351fe4b79c50a45a11af2fcd2aa7b6fd3b70058d), <add> [#11775](https://github.com/angular/angular.js/issues/11775)) <add>- **$q:** $q.resolve as an alias for $q.when <add> ([3ef52980](https://github.com/angular/angular.js/commit/3ef529806fef28b41ca4af86a330f39a95699cf6), <add> [#11944](https://github.com/angular/angular.js/issues/11944), [#11987](https://github.com/angular/angular.js/issues/11987)) <add> <add> <add>## Performance Improvements <add> <add>- **$compile:** avoid jquery data calls when there is no data <add> ([9efb0d5e](https://github.com/angular/angular.js/commit/9efb0d5ee961b57c8fc144a3138a15955e4010e2)) <add> <add> <add> <ide> <a name="1.3.16"></a> <ide> # 1.3.16 cookie-oatmealification (2015-06-05) <ide>
1
Ruby
Ruby
fix universal builds on 32-bit cpus
7c158e2350fcf0e649e8c0896957dd698eb281cb
<ide><path>Library/Homebrew/extend/ENV.rb <ide> def universal_binary <ide> append_to_cflags '-arch i386 -arch x86_64' <ide> ENV.O3 if self['CFLAGS'].include? '-O4' # O4 seems to cause the build to fail <ide> ENV.append 'LDFLAGS', '-arch i386 -arch x86_64' <add> <add> # Can't mix "-march" for a 32-bit CPU with "-arch x86_64" <add> remove_from_cflags(/-march=\S*/) if Hardware.is_32_bit? <ide> end <ide> <ide> def prepend key, value, separator = ' ' <ide><path>Library/Homebrew/hardware.rb <ide> def self.cores_as_words <ide> end <ide> end <ide> <add> def self.is_32_bit? <add> not self.is_64_bit? <add> end <add> <ide> def self.is_64_bit? <ide> self.sysctl_bool("hw.cpu64bit_capable") <ide> end
2
Javascript
Javascript
remove $$scope ref
1268fc1a44e1359f670a586e6cbc6774736f0a2d
<ide><path>src/Angular.js <ide> function shivForIE(elementName) { <ide> return elementName; <ide> } <ide> <del>var $$scope = '$scope', <del> $boolean = 'boolean', <add>var $boolean = 'boolean', <ide> $console = 'console', <ide> $length = 'length', <ide> $name = 'name', <ide><path>src/jqLite.js <ide> forEach({ <ide> }, <ide> <ide> scope: function(element) { <del> return jqLite(element).inheritedData($$scope); <add> return jqLite(element).inheritedData('$scope'); <ide> }, <ide> <ide> injector: function(element) {
2
Ruby
Ruby
move transactionmanager to bottom of class
62c75f4eacf6466a3bd1b22f97cda7ab7b597064
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/transaction.rb <ide> module ActiveRecord <ide> module ConnectionAdapters <del> class TransactionManager #:nodoc: <del> def initialize(connection) <del> @stack = [] <del> @connection = connection <del> end <del> <del> def begin_transaction(options = {}) <del> transaction_class = @stack.empty? ? RealTransaction : SavepointTransaction <del> transaction = transaction_class.new(@connection, "active_record_#{@stack.size}", options) <del> <del> @stack.push(transaction) <del> transaction <del> end <del> <del> def commit_transaction <del> @stack.pop.commit <del> end <del> <del> def rollback_transaction <del> @stack.pop.rollback <del> end <del> <del> def within_new_transaction(options = {}) <del> transaction = begin_transaction options <del> yield <del> rescue Exception => error <del> transaction.rollback if transaction <del> raise <del> ensure <del> begin <del> transaction.commit unless error <del> rescue Exception <del> transaction.rollback <del> raise <del> ensure <del> @stack.pop if transaction <del> end <del> end <del> <del> def open_transactions <del> @stack.size <del> end <del> <del> def current_transaction <del> @stack.last || closed_transaction <del> end <del> <del> private <del> <del> def closed_transaction <del> @closed_transaction ||= ClosedTransaction.new <del> end <del> end <del> <del> class Transaction #:nodoc: <del> attr_reader :connection, :state <del> <del> def initialize(connection) <del> @connection = connection <del> @state = TransactionState.new <del> end <del> <del> def savepoint_name <del> nil <del> end <del> end <del> <ide> class TransactionState <ide> attr_reader :parent <ide> <ide> def set_state(state) <ide> end <ide> end <ide> <add> class Transaction #:nodoc: <add> attr_reader :connection, :state <add> <add> def initialize(connection) <add> @connection = connection <add> @state = TransactionState.new <add> end <add> <add> def savepoint_name <add> nil <add> end <add> end <add> <ide> class ClosedTransaction < Transaction #:nodoc: <ide> def initialize; super(nil); end <ide> def closed?; true; end <ide> def perform_commit <ide> connection.release_savepoint(savepoint_name) <ide> end <ide> end <add> <add> class TransactionManager #:nodoc: <add> def initialize(connection) <add> @stack = [] <add> @connection = connection <add> end <add> <add> def begin_transaction(options = {}) <add> transaction_class = @stack.empty? ? RealTransaction : SavepointTransaction <add> transaction = transaction_class.new(@connection, "active_record_#{@stack.size}", options) <add> <add> @stack.push(transaction) <add> transaction <add> end <add> <add> def commit_transaction <add> @stack.pop.commit <add> end <add> <add> def rollback_transaction <add> @stack.pop.rollback <add> end <add> <add> def within_new_transaction(options = {}) <add> transaction = begin_transaction options <add> yield <add> rescue Exception => error <add> transaction.rollback if transaction <add> raise <add> ensure <add> begin <add> transaction.commit unless error <add> rescue Exception <add> transaction.rollback <add> raise <add> ensure <add> @stack.pop if transaction <add> end <add> end <add> <add> def open_transactions <add> @stack.size <add> end <add> <add> def current_transaction <add> @stack.last || closed_transaction <add> end <add> <add> private <add> <add> def closed_transaction <add> @closed_transaction ||= ClosedTransaction.new <add> end <add> end <ide> end <ide> end
1
Ruby
Ruby
improve reliability of homepage audit
59180ec370560d461d9fa44a3e510e9f1ea68375
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_homepage <ide> end <ide> <ide> return unless @online <del> status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0", <del> "--write-out", "%{http_code}", homepage <del> return if status_code.start_with? "20" <add> <add> # The system Curl is too old and unreliable with HTTPS homepages on <add> # Yosemite and below. <add> return unless MacOS.version >= :el_capitan <add> <add> retries = 3 <add> retries.times do <add> status_code, = curl_output "--connect-timeout", "15", <add> "--output", "/dev/null", <add> "--range", "0-0", <add> "--write-out", "%{http_code}", <add> homepage <add> return if status_code.start_with? "20" <add> end <ide> problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})" <ide> end <ide>
1
Java
Java
request streaming for apache httpclient
14ab2c88cc512a92d82db1f8fbb22d53445c6aa2
<ide><path>spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.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.http; <add> <add>import java.io.IOException; <add>import java.io.OutputStream; <add> <add>/** <add> * Represents a HTTP output message that allows for setting a streaming body. <add> * <add> * @author Arjen Poutsma <add> * @since 4.0 <add> */ <add>public interface StreamingHttpOutputMessage extends HttpOutputMessage { <add> <add> /** <add> * Sets the streaming body for this message. <add> * <add> * @param body the streaming body <add> */ <add> void setBody(Body body); <add> <add> /** <add> * Defines the contract for bodies that can be written directly to a <add> * {@link OuputStream}. It is useful with HTTP client libraries that provide indirect <add> * access to an {@link OutputStream} via a callback mechanism. <add> */ <add> public interface Body { <add> <add> /** <add> * Writes this body to the given {@link OuputStream}. <add> * <add> * @param outputStream the output stream to write to <add> * @throws IOException in case of errors <add> */ <add> void writeTo(OutputStream outputStream) throws IOException; <add> <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/http/client/AbstractClientHttpRequest.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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> public final HttpHeaders getHeaders() { <ide> <ide> @Override <ide> public final OutputStream getBody() throws IOException { <del> checkExecuted(); <add> assertNotExecuted(); <ide> return getBodyInternal(this.headers); <ide> } <ide> <ide> public Cookies getCookies() { <ide> <ide> @Override <ide> public final ClientHttpResponse execute() throws IOException { <del> checkExecuted(); <add> assertNotExecuted(); <ide> ClientHttpResponse result = executeInternal(this.headers); <ide> this.executed = true; <ide> return result; <ide> } <ide> <del> private void checkExecuted() { <add> /** <add> * Asserts that this request has not been {@linkplain #execute() executed} yet. <add> * <add> * @throws IllegalStateException if this request has been executed <add> */ <add> protected void assertNotExecuted() { <ide> Assert.state(!this.executed, "ClientHttpRequest already executed"); <ide> } <ide> <ide><path>spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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> public URI getURI() { <ide> <ide> @Override <ide> protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException { <add> addHeaders(this.httpRequest, headers); <add> <add> if (this.httpRequest instanceof HttpEntityEnclosingRequest) { <add> HttpEntityEnclosingRequest entityEnclosingRequest = <add> (HttpEntityEnclosingRequest) this.httpRequest; <add> HttpEntity requestEntity = new ByteArrayEntity(bufferedOutput); <add> entityEnclosingRequest.setEntity(requestEntity); <add> } <add> HttpResponse httpResponse = <add> this.httpClient.execute(this.httpRequest, this.httpContext); <add> return new HttpComponentsClientHttpResponse(httpResponse); <add> } <add> <add> /** <add> * Adds the given headers to the given HTTP request. <add> * <add> * @param httpRequest the request to add the headers to <add> * @param headers the headers to add <add> */ <add> static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) { <ide> for (Map.Entry<String, List<String>> entry : headers.entrySet()) { <ide> String headerName = entry.getKey(); <ide> if (!headerName.equalsIgnoreCase(HTTP.CONTENT_LEN) && <ide> !headerName.equalsIgnoreCase(HTTP.TRANSFER_ENCODING)) { <ide> for (String headerValue : entry.getValue()) { <del> this.httpRequest.addHeader(headerName, headerValue); <add> httpRequest.addHeader(headerName, headerValue); <ide> } <ide> } <ide> } <del> if (this.httpRequest instanceof HttpEntityEnclosingRequest) { <del> HttpEntityEnclosingRequest entityEnclosingRequest = (HttpEntityEnclosingRequest) this.httpRequest; <del> HttpEntity requestEntity = new ByteArrayEntity(bufferedOutput); <del> entityEnclosingRequest.setEntity(requestEntity); <del> } <del> HttpResponse httpResponse = this.httpClient.execute(this.httpRequest, this.httpContext); <del> return new HttpComponentsClientHttpResponse(httpResponse); <ide> } <ide> <ide> } <ide><path>spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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> public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest <ide> <ide> private HttpClient httpClient; <ide> <add> private boolean bufferRequestBody = true; <ide> <ide> /** <ide> * Create a new instance of the HttpComponentsClientHttpRequestFactory with a default <ide> public void setReadTimeout(int timeout) { <ide> getHttpClient().getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, timeout); <ide> } <ide> <add> /** <add> * Indicates whether this request factory should buffer the request body internally. <add> * <add> * <p>Default is {@code true}. When sending large amounts of data via POST or PUT, it is <add> * recommended to change this property to {@code false}, so as not to run out of memory. <add> */ <add> public void setBufferRequestBody(boolean bufferRequestBody) { <add> this.bufferRequestBody = bufferRequestBody; <add> } <add> <ide> @Override <ide> public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException { <ide> HttpUriRequest httpRequest = createHttpUriRequest(httpMethod, uri); <ide> postProcessHttpRequest(httpRequest); <del> return new HttpComponentsClientHttpRequest(getHttpClient(), httpRequest, createHttpContext(httpMethod, uri)); <add> if (bufferRequestBody) { <add> return new HttpComponentsClientHttpRequest(getHttpClient(), httpRequest, <add> createHttpContext(httpMethod, uri)); <add> } <add> else { <add> return new HttpComponentsStreamingClientHttpRequest(getHttpClient(), <add> httpRequest, createHttpContext(httpMethod, uri)); <add> } <ide> } <ide> <ide> /** <ide><path>spring-web/src/main/java/org/springframework/http/client/HttpComponentsStreamingClientHttpRequest.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.http.client; <add> <add>import java.io.IOException; <add>import java.io.InputStream; <add>import java.io.OutputStream; <add>import java.net.URI; <add> <add>import org.apache.http.Header; <add>import org.apache.http.HttpEntity; <add>import org.apache.http.HttpEntityEnclosingRequest; <add>import org.apache.http.HttpResponse; <add>import org.apache.http.client.HttpClient; <add>import org.apache.http.client.methods.HttpUriRequest; <add>import org.apache.http.message.BasicHeader; <add>import org.apache.http.protocol.HttpContext; <add> <add>import org.springframework.http.HttpHeaders; <add>import org.springframework.http.HttpMethod; <add>import org.springframework.http.MediaType; <add>import org.springframework.http.StreamingHttpOutputMessage; <add> <add>/** <add> * {@link ClientHttpRequest} implementation that uses Apache HttpComponents HttpClient to <add> * execute requests. <add> * <add> * <p>Created via the {@link org.springframework.http.client.HttpComponentsClientHttpRequestFactory}. <add> * <add> * @author Arjen Poutsma <add> * @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory#createRequest(java.net.URI, <add> * org.springframework.http.HttpMethod) <add> * @since 4.0 <add> */ <add>final class HttpComponentsStreamingClientHttpRequest extends AbstractClientHttpRequest <add> implements StreamingHttpOutputMessage { <add> <add> private final HttpClient httpClient; <add> <add> private final HttpUriRequest httpRequest; <add> <add> private final HttpContext httpContext; <add> <add> private Body body; <add> <add> public HttpComponentsStreamingClientHttpRequest(HttpClient httpClient, <add> HttpUriRequest httpRequest, HttpContext httpContext) { <add> this.httpClient = httpClient; <add> this.httpRequest = httpRequest; <add> this.httpContext = httpContext; <add> } <add> <add> @Override <add> public HttpMethod getMethod() { <add> return HttpMethod.valueOf(this.httpRequest.getMethod()); <add> } <add> <add> @Override <add> public URI getURI() { <add> return this.httpRequest.getURI(); <add> } <add> <add> @Override <add> public void setBody(Body body) { <add> assertNotExecuted(); <add> this.body = body; <add> } <add> <add> @Override <add> protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException { <add> throw new UnsupportedOperationException( <add> "getBody not supported when bufferRequestBody is false"); <add> } <add> <add> @Override <add> protected ClientHttpResponse executeInternal(HttpHeaders headers) throws IOException { <add> HttpComponentsClientHttpRequest.addHeaders(this.httpRequest, headers); <add> <add> if (this.httpRequest instanceof HttpEntityEnclosingRequest && body != null) { <add> HttpEntityEnclosingRequest entityEnclosingRequest = <add> (HttpEntityEnclosingRequest) this.httpRequest; <add> <add> HttpEntity requestEntity = new StreamingHttpEntity(getHeaders(), body); <add> entityEnclosingRequest.setEntity(requestEntity); <add> } <add> HttpResponse httpResponse = <add> this.httpClient.execute(this.httpRequest, this.httpContext); <add> return new HttpComponentsClientHttpResponse(httpResponse); <add> } <add> <add> private static class StreamingHttpEntity implements HttpEntity { <add> <add> private final HttpHeaders headers; <add> <add> private final StreamingHttpOutputMessage.Body body; <add> <add> private StreamingHttpEntity(HttpHeaders headers, <add> StreamingHttpOutputMessage.Body body) { <add> this.headers = headers; <add> this.body = body; <add> } <add> <add> @Override <add> public boolean isRepeatable() { <add> return false; <add> } <add> <add> @Override <add> public boolean isChunked() { <add> return false; <add> } <add> <add> @Override <add> public long getContentLength() { <add> return headers.getContentLength(); <add> } <add> <add> @Override <add> public Header getContentType() { <add> MediaType contentType = headers.getContentType(); <add> return contentType != null ? <add> new BasicHeader("Content-Type", contentType.toString()) : null; <add> } <add> <add> @Override <add> public Header getContentEncoding() { <add> String contentEncoding = headers.getFirst("Content-Encoding"); <add> return contentEncoding != null ? <add> new BasicHeader("Content-Encoding", contentEncoding) : null; <add> <add> } <add> <add> @Override <add> public InputStream getContent() throws IOException, IllegalStateException { <add> throw new IllegalStateException(); <add> } <add> <add> @Override <add> public void writeTo(OutputStream outputStream) throws IOException { <add> body.writeTo(outputStream); <add> } <add> <add> @Override <add> public boolean isStreaming() { <add> return true; <add> } <add> <add> @Override <add> public void consumeContent() throws IOException { <add> throw new UnsupportedOperationException(); <add> } <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/http/converter/AbstractHttpMessageConverter.java <ide> /* <del> * Copyright 2002-2012 the original author or authors. <add> * Copyright 2002-2013 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> package org.springframework.http.converter; <ide> <ide> import java.io.IOException; <add>import java.io.OutputStream; <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <ide> <add>import org.springframework.http.Cookies; <ide> import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.HttpInputMessage; <ide> import org.springframework.http.HttpOutputMessage; <ide> import org.springframework.http.MediaType; <add>import org.springframework.http.StreamingHttpOutputMessage; <ide> import org.springframework.util.Assert; <ide> <ide> /** <ide> public final T read(Class<? extends T> clazz, HttpInputMessage inputMessage) thr <ide> * on the output message. It then calls {@link #writeInternal}. <ide> */ <ide> @Override <del> public final void write(T t, MediaType contentType, HttpOutputMessage outputMessage) <add> public final void write(final T t, MediaType contentType, HttpOutputMessage outputMessage) <ide> throws IOException, HttpMessageNotWritableException { <ide> <del> HttpHeaders headers = outputMessage.getHeaders(); <add> final HttpHeaders headers = outputMessage.getHeaders(); <ide> if (headers.getContentType() == null) { <ide> if (contentType == null || contentType.isWildcardType() || contentType.isWildcardSubtype()) { <ide> contentType = getDefaultContentType(t); <ide> public final void write(T t, MediaType contentType, HttpOutputMessage outputMess <ide> headers.setContentLength(contentLength); <ide> } <ide> } <del> writeInternal(t, outputMessage); <del> outputMessage.getBody().flush(); <add> if (outputMessage instanceof StreamingHttpOutputMessage) { <add> StreamingHttpOutputMessage streamingOutputMessage = <add> (StreamingHttpOutputMessage) outputMessage; <add> <add> streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() { <add> @Override <add> public void writeTo(final OutputStream outputStream) throws IOException { <add> writeInternal(t, new HttpOutputMessage() { <add> @Override <add> public OutputStream getBody() throws IOException { <add> return outputStream; <add> } <add> <add> @Override <add> public HttpHeaders getHeaders() { <add> return headers; <add> } <add> <add> @Override <add> public Cookies getCookies() { <add> return null; <add> } <add> }); <add> } <add> }); <add> } <add> else { <add> writeInternal(t, outputMessage); <add> outputMessage.getBody().flush(); <add> } <ide> } <ide> <ide> /** <ide><path>spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java <ide> <ide> import java.io.IOException; <ide> import java.io.InputStream; <add>import java.io.OutputStream; <ide> import java.net.URI; <ide> import java.util.Arrays; <ide> import java.util.Enumeration; <ide> import org.junit.Test; <ide> import org.springframework.http.HttpMethod; <ide> import org.springframework.http.HttpStatus; <add>import org.springframework.http.StreamingHttpOutputMessage; <ide> import org.springframework.util.FileCopyUtils; <ide> import org.springframework.util.SocketUtils; <add>import org.springframework.util.StreamUtils; <ide> <ide> import static org.junit.Assert.*; <ide> <ide> public void echo() throws Exception { <ide> request.getHeaders().add(headerName, headerValue1); <ide> String headerValue2 = "value2"; <ide> request.getHeaders().add(headerName, headerValue2); <del> byte[] body = "Hello World".getBytes("UTF-8"); <add> final byte[] body = "Hello World".getBytes("UTF-8"); <ide> request.getHeaders().setContentLength(body.length); <del> FileCopyUtils.copy(body, request.getBody()); <add> if (request instanceof StreamingHttpOutputMessage) { <add> StreamingHttpOutputMessage streamingRequest = <add> (StreamingHttpOutputMessage) request; <add> streamingRequest.setBody(new StreamingHttpOutputMessage.Body() { <add> @Override <add> public void writeTo(OutputStream outputStream) throws IOException { <add> StreamUtils.copy(body, outputStream); <add> } <add> }); <add> } <add> else { <add> StreamUtils.copy(body, request.getBody()); <add> } <ide> ClientHttpResponse response = request.execute(); <ide> try { <ide> assertEquals("Invalid status code", HttpStatus.OK, response.getStatusCode()); <ide> public void echo() throws Exception { <ide> @Test(expected = IllegalStateException.class) <ide> public void multipleWrites() throws Exception { <ide> ClientHttpRequest request = factory.createRequest(new URI(baseUrl + "/echo"), HttpMethod.POST); <del> byte[] body = "Hello World".getBytes("UTF-8"); <del> FileCopyUtils.copy(body, request.getBody()); <add> final byte[] body = "Hello World".getBytes("UTF-8"); <add> if (request instanceof StreamingHttpOutputMessage) { <add> StreamingHttpOutputMessage streamingRequest = <add> (StreamingHttpOutputMessage) request; <add> streamingRequest.setBody(new StreamingHttpOutputMessage.Body() { <add> @Override <add> public void writeTo(OutputStream outputStream) throws IOException { <add> StreamUtils.copy(body, outputStream); <add> } <add> }); <add> } <add> else { <add> StreamUtils.copy(body, request.getBody()); <add> } <add> <ide> ClientHttpResponse response = request.execute(); <ide> try { <ide> FileCopyUtils.copy(body, request.getBody()); <ide><path>spring-web/src/test/java/org/springframework/http/client/StreamingHttpComponentsClientHttpRequestFactoryTests.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.http.client; <add> <add>import org.junit.Test; <add> <add>import org.springframework.http.HttpMethod; <add> <add>public class StreamingHttpComponentsClientHttpRequestFactoryTests <add> extends AbstractHttpRequestFactoryTestCase { <add> <add> @Override <add> protected ClientHttpRequestFactory createRequestFactory() { <add> HttpComponentsClientHttpRequestFactory requestFactory = <add> new HttpComponentsClientHttpRequestFactory(); <add> requestFactory.setBufferRequestBody(false); <add> return requestFactory; <add> } <add> <add> @Override <add> @Test <add> public void httpMethods() throws Exception { <add> assertHttpMethod("patch", HttpMethod.PATCH); <add> } <add> <add>}
8
Javascript
Javascript
replace var with let
f4ea9189501743797d1ab8f5ed07027dd71f59bd
<ide><path>lib/internal/v8_prof_processor.js <ide> const scriptFiles = [ <ide> 'internal/deps/v8/tools/SourceMap', <ide> 'internal/deps/v8/tools/tickprocessor-driver' <ide> ]; <del>var script = ''; <add>let script = ''; <ide> <ide> scriptFiles.forEach((s) => { <ide> script += internalBinding('natives')[s] + '\n';
1
Java
Java
remove use of @safevarargs (breaking java6 build)
a283deb5b791ddea0f94f55814b026ec9c9c5fcc
<ide><path>rxjava-core/src/main/java/rx/Observable.java <ide> public final static <T> Observable<T> from(Iterable<? extends T> iterable, Sched <ide> * @return an Observable that emits the item <ide> * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#from">RxJava Wiki: from()</a> <ide> */ <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1) { <ide> return from(Arrays.asList(t1)); <ide> public final static <T> Observable<T> from(T t1) { <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))} <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2) { <ide> return from(Arrays.asList(t1, t2)); <ide> public final static <T> Observable<T> from(T t1, T t2) { <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3) { <ide> return from(Arrays.asList(t1, t2, t3)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3) { <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4) { <ide> return from(Arrays.asList(t1, t2, t3, t4)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4) { <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5) { <ide> return from(Arrays.asList(t1, t2, t3, t4, t5)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5) { <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6) { <ide> return from(Arrays.asList(t1, t2, t3, t4, t5, t6)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6) { <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7) { <ide> return from(Arrays.asList(t1, t2, t3, t4, t5, t6, t7)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8) { <ide> return from(Arrays.asList(t1, t2, t3, t4, t5, t6, t7, t8)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9) { <ide> return from(Arrays.asList(t1, t2, t3, t4, t5, t6, t7, t8, t9)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T <ide> * @deprecated Use {@link #from(Iterable)} instead such as {@code from(Arrays.asList(t1))}. <ide> */ <ide> @Deprecated <del> @SuppressWarnings("unchecked") <ide> // suppress unchecked because we are using varargs inside the method <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9, T t10) { <ide> return from(Arrays.asList(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10)); <ide> public final static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T <ide> * @return an Observable that emits each item in the source Array <ide> * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#from">RxJava Wiki: from()</a> <ide> */ <del> @SafeVarargs <add> // @SafeVarargs // commenting out until we figure out if we can do Java7 compilation without breaking Android for just this feature <ide> public final static <T> Observable<T> from(T... t1) { <ide> return from(Arrays.asList(t1)); <ide> }
1
Python
Python
fix broken 'binary content' in browseable api
4631b91e144ae758b4417f20b0379ce5b9179ee6
<ide><path>rest_framework/renderers.py <ide> def get_content(self, renderer, data, <ide> renderer_context['indent'] = 4 <ide> content = renderer.render(data, accepted_media_type, renderer_context) <ide> <del> if not isinstance(content, six.text_type): <del> return '[%d bytes of binary content]' <add> if not all(char in string.printable for char in content): <add> return '[%d bytes of binary content]' % len(content) <ide> <ide> return content <ide>
1
Java
Java
fix javadoc for functionx
b5c7957c485e6a97af64e71674765d8bd3e54e07
<ide><path>src/main/java/io/reactivex/functions/Function3.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <add> * @param <T3> the third value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function3<T1, T2, T3, R> { <ide><path>src/main/java/io/reactivex/functions/Function4.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <del> * @param <T4> the second value type <add> * @param <T3> the third value type <add> * @param <T4> the fourth value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function4<T1, T2, T3, T4, R> { <ide><path>src/main/java/io/reactivex/functions/Function5.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <del> * @param <T4> the second value type <del> * @param <T5> the second value type <add> * @param <T3> the third value type <add> * @param <T4> the fourth value type <add> * @param <T5> the fifth value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function5<T1, T2, T3, T4, T5, R> { <ide><path>src/main/java/io/reactivex/functions/Function6.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <del> * @param <T4> the second value type <del> * @param <T5> the second value type <del> * @param <T6> the second value type <add> * @param <T3> the third value type <add> * @param <T4> the fourth value type <add> * @param <T5> the fifth value type <add> * @param <T6> the sixth value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function6<T1, T2, T3, T4, T5, T6, R> { <ide><path>src/main/java/io/reactivex/functions/Function7.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <del> * @param <T4> the second value type <del> * @param <T5> the second value type <del> * @param <T6> the second value type <del> * @param <T7> the second value type <add> * @param <T3> the third value type <add> * @param <T4> the fourth value type <add> * @param <T5> the fifth value type <add> * @param <T6> the sixth value type <add> * @param <T7> the seventh value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function7<T1, T2, T3, T4, T5, T6, T7, R> { <ide><path>src/main/java/io/reactivex/functions/Function8.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <del> * @param <T4> the second value type <del> * @param <T5> the second value type <del> * @param <T6> the second value type <del> * @param <T7> the second value type <del> * @param <T8> the second value type <add> * @param <T3> the third value type <add> * @param <T4> the fourth value type <add> * @param <T5> the fifth value type <add> * @param <T6> the sixth value type <add> * @param <T7> the seventh value type <add> * @param <T8> the eighth value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function8<T1, T2, T3, T4, T5, T6, T7, T8, R> { <ide><path>src/main/java/io/reactivex/functions/Function9.java <ide> * A functional interface (callback) that computes a value based on multiple input values. <ide> * @param <T1> the first value type <ide> * @param <T2> the second value type <del> * @param <T3> the second value type <del> * @param <T4> the second value type <del> * @param <T5> the second value type <del> * @param <T6> the second value type <del> * @param <T7> the second value type <del> * @param <T8> the second value type <del> * @param <T9> the second value type <add> * @param <T3> the third value type <add> * @param <T4> the fourth value type <add> * @param <T5> the fifth value type <add> * @param <T6> the sixth value type <add> * @param <T7> the seventh value type <add> * @param <T8> the eighth value type <add> * @param <T9> the ninth value type <ide> * @param <R> the result type <ide> */ <ide> public interface Function9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> {
7
PHP
PHP
improve illuminate\view\view test coverage
9f654456b101e1d57be8e4f307cff1f96d12a2c4
<ide><path>tests/View/ViewTest.php <ide> public function testSectionsAreNotFlushedWhenNotDoneRendering() <ide> $view->getEnvironment()->shouldReceive('flushSectionsIfDoneRendering')->once(); <ide> <ide> $this->assertEquals('contents', $view->render()); <add> $this->assertEquals('contents', (string)$view); <ide> } <ide> <ide> <ide> public function testViewAcceptsArrayableImplementations() <ide> $this->assertEquals('bar', $view->foo); <ide> $this->assertEquals(array('qux', 'corge'), $view->baz); <ide> } <add> <add> <add> public function testViewGettersSetters() <add> { <add> $view = $this->getView(); <add> $this->assertEquals($view->getName(), 'view'); <add> $this->assertEquals($view->getPath(), 'path'); <add> $this->assertEquals($view->getData()['foo'], 'bar'); <add> $view->setPath('newPath'); <add> $this->assertEquals($view->getPath(), 'newPath'); <add> } <add> <add> <add> public function testViewArrayAccess() <add> { <add> $view = $this->getView(); <add> $this->assertTrue($view instanceof ArrayAccess); <add> $this->assertTrue($view->offsetExists('foo')); <add> $this->assertEquals($view->offsetGet('foo'), 'bar'); <add> $view->offsetSet('foo','baz'); <add> $this->assertEquals($view->offsetGet('foo'), 'baz'); <add> $view->offsetUnset('foo'); <add> $this->assertFalse($view->offsetExists('foo')); <add> } <add> <add> <add> public function testViewMagicMethods() <add> { <add> $view = $this->getView(); <add> $this->assertTrue(isset($view->foo)); <add> $this->assertEquals($view->foo, 'bar'); <add> $view->foo = 'baz'; <add> $this->assertEquals($view->foo, 'baz'); <add> $this->assertEquals($view['foo'], $view->foo); <add> unset($view->foo); <add> $this->assertFalse(isset($view->foo)); <add> $this->assertFalse($view->offsetExists('foo')); <add> } <add> <add> <add> public function testViewBadMethod() <add> { <add> $this->setExpectedException('BadMethodCallException'); <add> $view = $this->getView(); <add> $view->badMethodCall(); <add> } <add> <add> <add> public function testViewGatherDataWithRenderable() <add> { <add> $view = $this->getView(); <add> $view->getEnvironment()->shouldReceive('incrementRender')->once()->ordered(); <add> $view->getEnvironment()->shouldReceive('callComposer')->once()->ordered()->with($view); <add> $view->getEnvironment()->shouldReceive('getShared')->once()->andReturn(array('shared' => 'foo')); <add> $view->getEngine()->shouldReceive('get')->once()->andReturn('contents'); <add> $view->getEnvironment()->shouldReceive('decrementRender')->once()->ordered(); <add> $view->getEnvironment()->shouldReceive('flushSectionsIfDoneRendering')->once(); <add> <add> $view->renderable = m::mock('Illuminate\Support\Contracts\RenderableInterface'); <add> $view->renderable->shouldReceive('render')->once()->andReturn('text'); <add> $view->render(); <add> } <add> <add> <add> public function testViewRenderSections() <add> { <add> $view = $this->getView(); <add> $view->getEnvironment()->shouldReceive('incrementRender')->once()->ordered(); <add> $view->getEnvironment()->shouldReceive('callComposer')->once()->ordered()->with($view); <add> $view->getEnvironment()->shouldReceive('getShared')->once()->andReturn(array('shared' => 'foo')); <add> $view->getEngine()->shouldReceive('get')->once()->andReturn('contents'); <add> $view->getEnvironment()->shouldReceive('decrementRender')->once()->ordered(); <add> $view->getEnvironment()->shouldReceive('flushSectionsIfDoneRendering')->once(); <add> <add> $view->getEnvironment()->shouldReceive('getSections')->once()->andReturn(array('foo','bar')); <add> $sections = $view->renderSections(); <add> $this->assertEquals($sections[0], 'foo'); <add> $this->assertEquals($sections[1], 'bar'); <add> } <add> <add> <add> public function testWithErrors() <add> { <add> $view = $this->getView(); <add> $this->assertTrue($view->withErrors(array('foo'=>'bar','qu'=>'ux')) === $view); <add> $this->assertTrue($view->errors instanceof \Illuminate\Support\MessageBag); <add> $this->assertEquals(reset($view->errors->get('foo')), 'bar'); <add> $this->assertEquals(reset($view->errors->get('qu')), 'ux'); <add> $this->assertTrue($view->withErrors(new \Illuminate\Support\MessageBag(array('foo'=>'baz'))) === $view); <add> $this->assertEquals(reset($view->errors->get('foo')), 'baz'); <add> } <ide> <ide> <ide> protected function getView()
1
PHP
PHP
apply fixes from styleci
4cfbd5716115ec2e6497302badb34f581f8dc4d7
<ide><path>src/Illuminate/Database/Query/Grammars/PostgresGrammar.php <ide> protected function compileLock(Builder $query, $value) <ide> } <ide> <ide> /** <del> * @inheritdoc <add> * {@inheritdoc} <ide> */ <ide> public function compileInsert(Builder $query, array $values) <ide> {
1
Text
Text
expand documentation for --insecure-registries
48f7384d6365c59b4b61d527630aaf88af24f6dd
<ide><path>docs/sources/reference/commandline/cli.md <ide> expect an integer, and they can only be specified once. <ide> -H, --host=[] The socket(s) to bind to in daemon mode or connect to in client mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd. <ide> --icc=true Enable inter-container communication <ide> --insecure-registry=[] Make these registries use http <del> --ip=0.0.0.0 Default IP address to use when binding container ports <add> --ip=0.0.0.0 Default IP address to use when binding container ports <ide> --ip-forward=true Enable net.ipv4.ip_forward <ide> --ip-masq=true Enable IP masquerading for bridge's IP range <ide> --iptables=true Enable Docker's addition of iptables rules <ide> can be disabled with --ip-masq=false. <ide> <ide> <ide> <add>By default docker will assume all registries are securied via TLS. Prior versions <add>of docker used an auto fallback if a registry did not support TLS. This introduces <add>the opportunity for MITM attacks so in Docker 1.2 the user must specify `--insecure-registries` <add>when starting the Docker daemon to state which registries are not using TLS and to communicate <add>with these registries via plain text. If you are running a local registry over plain text <add>on `127.0.0.1:5000` you will be required to specify `--insecure-registries 127.0.0.1:500` <add>when starting the docker daemon to be able to push and pull images to that registry. <add>No automatic fallback will happen after Docker 1.2 to detect if a registry is using <add>HTTP or HTTPS. <add> <ide> Docker supports softlinks for the Docker data directory <ide> (`/var/lib/docker`) and for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be set like this: <ide>
1
PHP
PHP
add array cast for method_cache data
638d2ea7b6d8641d1a3b4579060786c545aa2278
<ide><path>lib/Cake/Model/Datasource/DboSource.php <ide> public function cacheMethod($method, $key, $value = null) { <ide> return $value; <ide> } <ide> if (!$this->_methodCacheChange && empty(self::$methodCache)) { <del> self::$methodCache = Cache::read('method_cache', '_cake_core_'); <add> self::$methodCache = (array)Cache::read('method_cache', '_cake_core_'); <ide> } <ide> if ($value === null) { <ide> return (isset(self::$methodCache[$method][$key])) ? self::$methodCache[$method][$key] : null;
1
Javascript
Javascript
remove deprecated buffer.get/.set methods
101bca988cebce584d5b6098c316a6e7bf89b69d
<ide><path>lib/buffer.js <ide> Buffer.prototype.fill = function fill(val, start, end) { <ide> }; <ide> <ide> <del>// XXX remove in v0.13 <del>Buffer.prototype.get = internalUtil.deprecate(function get(offset) { <del> offset = ~~offset; <del> if (offset < 0 || offset >= this.length) <del> throw new RangeError('Index out of range'); <del> return this[offset]; <del>}, 'Buffer.get is deprecated. Use array indexes instead.'); <del> <del> <del>// XXX remove in v0.13 <del>Buffer.prototype.set = internalUtil.deprecate(function set(offset, v) { <del> offset = ~~offset; <del> if (offset < 0 || offset >= this.length) <del> throw new RangeError('Index out of range'); <del> return this[offset] = v; <del>}, 'Buffer.set is deprecated. Use array indexes instead.'); <del> <del> <ide> // TODO(trevnorris): fix these checks to follow new standard <ide> // write(string, offset = 0, length = buffer.length, encoding = 'utf8') <ide> var writeWarned = false;
1
Python
Python
add docs to google cloud base hook
06208419a361ebc08008c60502aeb997c003bee8
<ide><path>airflow/contrib/hooks/gc_base_hook.py <ide> <ide> from airflow.hooks.base_hook import BaseHook <ide> from airflow.utils import AirflowException <del>from apiclient.discovery import build <ide> from oauth2client.client import SignedJwtAssertionCredentials, GoogleCredentials <ide> <ide> class GoogleCloudBaseHook(BaseHook): <add> """ <add> A base hook for Google cloud-related hooks. Google cloud has a shared REST <add> API client that is built in the same way no matter which service you use. <add> This class helps construct and authorize the credentials needed to then <add> call apiclient.discovery.build() to actually discover and build a client <add> for a Google cloud service. <add> <add> The class also contains some miscellaneous helper functions. <add> """ <add> <ide> def __init__(self, scope, conn_id): <add> """ <add> :param scope: The scope of the hook. <add> :type scope: string <add> :param conn_id: The connection ID to use when fetching connection info. <add> :type conn_id: string <add> """ <ide> self.scope = scope <ide> self.conn_id = conn_id <ide>
1
Mixed
Ruby
call assume_migrated_upto_version on connection
443f8dd5cdb273327a8b03a97c431de67c15ace6
<ide><path>activerecord/CHANGELOG.md <add>* Fix pending migrations error when loading schema and ActiveRecord::Base.table_name_prefix is not blank. <add> <add> Call assume_migrated_upto_version on connection to prevent it from first being picked up in method_missing. <add> In the base class, Migration, method_missing expects the argument to be a table name, and calls proper_table_name <add> on the arguments before sending to connection. If table_name_prefix or table_name_suffix is used, the schema <add> version changes to prefix_version_suffix, breaking `rake test:prepare`. <add> <add> Fixes #10411. <add> <add> *Kyle Stevens* <add> <ide> * Method read_attribute_before_type_cast should accept input as symbol. <ide> <ide> *Neeraj Singh* <ide><path>activerecord/lib/active_record/schema.rb <ide> def define(info, &block) # :nodoc: <ide> <ide> unless info[:version].blank? <ide> initialize_schema_migrations_table <del> assume_migrated_upto_version(info[:version], migrations_paths) <add> connection.assume_migrated_upto_version(info[:version], migrations_paths) <ide> end <ide> end <ide> <ide><path>activerecord/test/cases/ar_schema_test.rb <ide> def setup <ide> <ide> def teardown <ide> @connection.drop_table :fruits rescue nil <add> @connection.drop_table :nep_fruits rescue nil <add> @connection.drop_table :nep_schema_migrations rescue nil <ide> ActiveRecord::SchemaMigration.delete_all rescue nil <ide> end <ide> <ide> def test_schema_define <ide> assert_equal 7, ActiveRecord::Migrator::current_version <ide> end <ide> <add> def test_schema_define_w_table_name_prefix <add> table_name = ActiveRecord::SchemaMigration.table_name <add> ActiveRecord::Base.table_name_prefix = "nep_" <add> ActiveRecord::SchemaMigration.table_name = "nep_#{table_name}" <add> ActiveRecord::Schema.define(:version => 7) do <add> create_table :fruits do |t| <add> t.column :color, :string <add> t.column :fruit_size, :string # NOTE: "size" is reserved in Oracle <add> t.column :texture, :string <add> t.column :flavor, :string <add> end <add> end <add> assert_equal 7, ActiveRecord::Migrator::current_version <add> ensure <add> ActiveRecord::Base.table_name_prefix = "" <add> ActiveRecord::SchemaMigration.table_name = table_name <add> end <add> <ide> def test_schema_raises_an_error_for_invalid_column_type <ide> assert_raise NoMethodError do <ide> ActiveRecord::Schema.define(:version => 8) do
3
Ruby
Ruby
retire check for gcc 4.0 under xcode 4.x
fbff2ee8538aac440e913706b3430c5315e3d1d8
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_gcc_versions <ide> EOS <ide> end <ide> <del> if gcc_40 == nil <del> puts <<-EOS.undent <del> We couldn't detect gcc 4.0.x. Some formulae require this compiler. <add> if MacOS.xcode_version < "4.0" <add> if gcc_40 == nil <add> puts <<-EOS.undent <add> We couldn't detect gcc 4.0.x. Some formulae require this compiler. <ide> <del> EOS <del> elsif gcc_40 < RECOMMENDED_GCC_40 <del> puts <<-EOS.undent <del> Your gcc 4.0.x version is older than the recommended version. It may be advisable <del> to upgrade to the latest release of Xcode. <add> EOS <add> elsif gcc_40 < RECOMMENDED_GCC_40 <add> puts <<-EOS.undent <add> Your gcc 4.0.x version is older than the recommended version. It may be advisable <add> to upgrade to the latest release of Xcode. <ide> <del> EOS <add> EOS <add> end <ide> end <ide> end <ide>
1
Ruby
Ruby
add an option to silence puma in system tests
eba361824d9eb242f186bb711ef82381ac50ef9e
<ide><path>actionpack/lib/action_dispatch/system_testing/server.rb <ide> module ActionDispatch <ide> module SystemTesting <ide> class Server # :nodoc: <add> class << self <add> attr_accessor :silence_puma <add> end <add> <add> self.silence_puma = false <add> <ide> def run <ide> register <ide> setup <ide> def run <ide> private <ide> def register <ide> Capybara.register_server :rails_puma do |app, port, host| <del> Rack::Handler::Puma.run(app, Port: port, Threads: "0:1") <add> Rack::Handler::Puma.run( <add> app, <add> Port: port, <add> Threads: "0:1", <add> Silent: self.class.silence_puma <add> ) <ide> end <ide> end <ide>
1
Go
Go
use sysfs to set hairpin mode
2dd9a6fa754745a069c032ddb6de06e75c9d45bc
<ide><path>libnetwork/drivers/bridge/bridge.go <ide> package bridge <ide> import ( <ide> "errors" <ide> "fmt" <add> "io/ioutil" <ide> "net" <ide> "os/exec" <add> "path/filepath" <ide> "strconv" <ide> "sync" <add> "syscall" <ide> <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/libnetwork/driverapi" <ide> func addToBridge(ifaceName, bridgeName string) error { <ide> return ioctlAddToBridge(iface, master) <ide> } <ide> <add>func setHairpinMode(link netlink.Link, enable bool) error { <add> err := netlink.LinkSetHairpin(link, enable) <add> if err != nil && err != syscall.EINVAL { <add> // If error is not EINVAL something else went wrong, bail out right away <add> return fmt.Errorf("unable to set hairpin mode on %s via netlink: %v", <add> link.Attrs().Name, err) <add> } <add> <add> // Hairpin mode successfully set up <add> if err == nil { <add> return nil <add> } <add> <add> // The netlink method failed with EINVAL which is probably because of an older <add> // kernel. Try one more time via the sysfs method. <add> path := filepath.Join("/sys/class/net", link.Attrs().Name, "brport/hairpin_mode") <add> <add> var val []byte <add> if enable { <add> val = []byte{'1', '\n'} <add> } else { <add> val = []byte{'0', '\n'} <add> } <add> <add> if err := ioutil.WriteFile(path, val, 0644); err != nil { <add> return fmt.Errorf("unable to set hairpin mode on %s via sysfs: %v", link.Attrs().Name, err) <add> } <add> <add> return nil <add>} <add> <ide> func (d *driver) CreateEndpoint(nid, eid types.UUID, epInfo driverapi.EndpointInfo, epOptions map[string]interface{}) error { <ide> var ( <ide> ipv6Addr *net.IPNet <ide> func (d *driver) CreateEndpoint(nid, eid types.UUID, epInfo driverapi.EndpointIn <ide> } <ide> <ide> if !config.EnableUserlandProxy { <del> err = netlink.LinkSetHairpin(host, true) <add> err = setHairpinMode(host, true) <ide> if err != nil { <ide> return err <ide> }
1
Python
Python
use python integer on _count_reduce_items
42dc6537497d563612eab053d9dbf497d210a5a7
<ide><path>numpy/core/_methods.py <ide> def _count_reduce_items(arr, axis, keepdims=False, where=True): <ide> axis = tuple(range(arr.ndim)) <ide> elif not isinstance(axis, tuple): <ide> axis = (axis,) <del> items = nt.intp(1) <add> items = 1 <ide> for ax in axis: <ide> items *= arr.shape[mu.normalize_axis_index(ax, arr.ndim)] <add> items = nt.intp(items) <ide> else: <ide> # TODO: Optimize case when `where` is broadcast along a non-reduction <ide> # axis and full sum is more excessive than needed.
1
Java
Java
resolve nested placeholders via propertyresolver
2ec7834124dfa32d7b90afbb23805433a4567bf5
<ide><path>spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java <ide> public <T> T getProperty(String key, Class<T> targetValueType) { <ide> Object value; <ide> if ((value = propertySource.getProperty(key)) != null) { <ide> Class<?> valueType = value.getClass(); <add> if (String.class.equals(valueType)) { <add> value = this.resolveRequiredPlaceholders((String) value); <add> } <ide> if (debugEnabled) { <ide> logger.debug( <ide> format("Found key '%s' in [%s] with type [%s] and value '%s'", <ide><path>spring-core/src/main/java/org/springframework/util/PropertyPlaceholderHelper.java <ide> else if (this.ignoreUnresolvablePlaceholders) { <ide> startIndex = buf.indexOf(this.placeholderPrefix, endIndex + this.placeholderSuffix.length()); <ide> } <ide> else { <del> throw new IllegalArgumentException("Could not resolve placeholder '" + placeholder + "'"); <add> throw new IllegalArgumentException("Could not resolve placeholder '" + <add> placeholder + "'" + " in string value [" + strVal + "]"); <ide> } <ide> <ide> visitedPlaceholders.remove(originalPlaceholder); <ide><path>spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java <ide> /* <del> * Copyright 2002-2011 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.core.env; <ide> <del>import static org.hamcrest.CoreMatchers.equalTo; <del>import static org.hamcrest.CoreMatchers.is; <del>import static org.hamcrest.CoreMatchers.nullValue; <del>import static org.junit.Assert.assertThat; <del>import static org.junit.Assert.assertTrue; <del>import static org.junit.Assert.fail; <del> <ide> import java.util.HashMap; <ide> import java.util.Map; <ide> import java.util.Properties; <ide> <add>import org.hamcrest.Matchers; <ide> import org.junit.Before; <ide> import org.junit.Test; <add> <ide> import org.springframework.core.convert.ConversionException; <ide> import org.springframework.mock.env.MockPropertySource; <ide> <add>import static org.hamcrest.CoreMatchers.*; <add>import static org.junit.Assert.*; <add> <ide> /** <ide> * Unit tests for {@link PropertySourcesPropertyResolver}. <ide> * <ide> public void setRequiredProperties_andValidateRequiredProperties() { <ide> propertyResolver.validateRequiredProperties(); <ide> } <ide> <add> @Test <add> public void resolveNestedPropertyPlaceholders() { <add> MutablePropertySources ps = new MutablePropertySources(); <add> ps.addFirst(new MockPropertySource() <add> .withProperty("p1", "v1") <add> .withProperty("p2", "v2") <add> .withProperty("p3", "${p1}:${p2}") // nested placeholders <add> .withProperty("p4", "${p3}") // deeply nested placeholders <add> .withProperty("p5", "${p1}:${p2}:${bogus}") // unresolvable placeholder <add> .withProperty("p6", "${p1}:${p2}:${bogus:def}") // unresolvable w/ default <add> .withProperty("pL", "${pR}") // cyclic reference left <add> .withProperty("pR", "${pL}") // cyclic reference right <add> ); <add> PropertySourcesPropertyResolver pr = new PropertySourcesPropertyResolver(ps); <add> assertThat(pr.getProperty("p1"), equalTo("v1")); <add> assertThat(pr.getProperty("p2"), equalTo("v2")); <add> assertThat(pr.getProperty("p3"), equalTo("v1:v2")); <add> assertThat(pr.getProperty("p4"), equalTo("v1:v2")); <add> try { <add> pr.getProperty("p5"); <add> } catch (IllegalArgumentException ex) { <add> assertThat(ex.getMessage(), Matchers.containsString( <add> "Could not resolve placeholder 'bogus' in string value [${p1}:${p2}:${bogus}]")); <add> } <add> assertThat(pr.getProperty("p6"), equalTo("v1:v2:def")); <add> try { <add> pr.getProperty("pL"); <add> } catch (StackOverflowError ex) { <add> // no explicit handling for cyclic references for now <add> } <add> } <add> <add> <ide> static interface SomeType { } <ide> static class SpecificType implements SomeType { } <ide> }
3
Javascript
Javascript
fix quotes in example code
e6f4f4910629334eb4bd5a44f3852e602e20770a
<ide><path>packages/ember-routing/lib/system/route.js <ide> var Route = EmberObject.extend(ActionHandler, Evented, { <ide> <ide> ```javascript <ide> App.Router.map(function() { <del> this.route("index"); <add> this.route('index'); <ide> }); <ide> <ide> App.ApplicationRoute = Ember.Route.extend({
1
Javascript
Javascript
remove unused argument in test-util-inspect.js
c1a94646e734ff173c4848d81ea4d984263c348e
<ide><path>test/parallel/test-util-inspect.js <ide> assert.strictEqual(util.inspect(Object.create(Date.prototype)), 'Date {}'); <ide> <ide> // Test util.inspect.styles and util.inspect.colors. <ide> { <del> function testColorStyle(style, input, implicit) { <add> function testColorStyle(style, input) { <ide> const colorName = util.inspect.styles[style]; <ide> let color = ['', '']; <ide> if (util.inspect.colors[colorName])
1
PHP
PHP
detect lock wait timeout as deadlock
bc0f60b00b8c2c2fba2cc2c48b8a83a0d18f9c0d
<ide><path>src/Illuminate/Database/DetectsDeadlocks.php <ide> protected function causedByDeadlock(Exception $e) <ide> 'database table is locked', <ide> 'A table in the database is locked', <ide> 'has been chosen as the deadlock victim', <add> 'Lock wait timeout exceeded; try restarting transaction', <ide> ]); <ide> } <ide> }
1
Python
Python
fix the test so it doesn't fail under python 2.5
4b755a8bc089a74907ab0efea70d3d41dd1072f5
<ide><path>libcloud/test/test_utils.py <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <ide> <del># Allows unicode literals ('' == unicode) on Python 2, for compatibility with <del># Python 3 <del>from __future__ import unicode_literals <del> <ide> import sys <add>import codecs <ide> import unittest <ide> import warnings <ide> import os.path <ide> <ide> from libcloud.utils.misc import get_driver, set_driver <ide> <del>from libcloud.utils.py3 import PY3 <add>from libcloud.utils.py3 import PY3, PY32 <ide> from libcloud.utils.py3 import StringIO <ide> from libcloud.utils.py3 import b <ide> from libcloud.utils.py3 import urlquote <ide> def test_exhaust_iterator_empty_iterator(self): <ide> <ide> def test_unicode_urlquote(self): <ide> # Regression tests for LIBCLOUD-429 <add> if PY3: <add> # Note: this is a unicode literal <add> val = '\xe9' <add> else: <add> val = codecs.unicode_escape_decode('\xe9')[0] <ide> <del> # Note: this is a unicode literal <del> uri = libcloud.utils.py3.urlquote('\xe9') <add> uri = libcloud.utils.py3.urlquote(val) <ide> self.assertEqual(b(uri), b('%C3%A9')) <ide> <ide> # Unicode without unicode characters
1
Go
Go
pass platform through into layer store
42c5c1a9ec14f00d5a5367131493cbd6de7d72b0
<ide><path>daemon/commit.go <ide> func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str <ide> }() <ide> <ide> var parent *image.Image <add> os := runtime.GOOS <ide> if container.ImageID == "" { <ide> parent = new(image.Image) <ide> parent.RootFS = image.NewRootFS() <ide> func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str <ide> if err != nil { <ide> return "", err <ide> } <add> // To support LCOW, Windows needs to pass the platform in when registering the layer in the store <add> if runtime.GOOS == "windows" { <add> os = parent.OS <add> } <ide> } <ide> <del> l, err := daemon.layerStore.Register(rwTar, parent.RootFS.ChainID()) <add> l, err := daemon.layerStore.Register(rwTar, parent.RootFS.ChainID(), layer.Platform(os)) <ide> if err != nil { <ide> return "", err <ide> } <ide><path>daemon/images.go <ide> package daemon <ide> import ( <ide> "encoding/json" <ide> "fmt" <add> "runtime" <ide> "sort" <ide> "time" <ide> <ide> func (daemon *Daemon) SquashImage(id, parent string) (string, error) { <ide> } <ide> defer ts.Close() <ide> <del> newL, err := daemon.layerStore.Register(ts, parentChainID) <add> // To support LCOW, Windows needs to pass the platform into the store when registering the layer. <add> platform := layer.Platform("") <add> if runtime.GOOS == "windows" { <add> platform = l.Platform() <add> } <add> <add> newL, err := daemon.layerStore.Register(ts, parentChainID, platform) <ide> if err != nil { <ide> return "", errors.Wrap(err, "error registering layer") <ide> } <ide><path>daemon/import.go <ide> func (daemon *Daemon) ImportImage(src string, repository, tag string, msg string <ide> return err <ide> } <ide> // TODO: support windows baselayer? <del> l, err := daemon.layerStore.Register(inflatedLayerData, "") <add> // TODO: LCOW support @jhowardmsft. For now, pass in a null platform when <add> // registering the layer. Windows doesn't currently support import, <add> // but for Linux images, there's no reason it couldn't. However it <add> // would need another CLI flag as there's no meta-data indicating <add> // the OS of the thing being imported. <add> l, err := daemon.layerStore.Register(inflatedLayerData, "", "") <ide> if err != nil { <ide> return err <ide> } <ide><path>distribution/config.go <ide> type ImagePushConfig struct { <ide> type ImageConfigStore interface { <ide> Put([]byte) (digest.Digest, error) <ide> Get(digest.Digest) ([]byte, error) <del> RootFSFromConfig([]byte) (*image.RootFS, error) <add> RootFSAndPlatformFromConfig([]byte) (*image.RootFS, layer.Platform, error) <ide> } <ide> <ide> // PushLayerProvider provides layers to be pushed by ChainID. <ide> type RootFSDownloadManager interface { <ide> // returns the final rootfs. <ide> // Given progress output to track download progress <ide> // Returns function to release download resources <del> Download(ctx context.Context, initialRootFS image.RootFS, layers []xfer.DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) <add> Download(ctx context.Context, initialRootFS image.RootFS, platform layer.Platform, layers []xfer.DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) <ide> } <ide> <ide> type imageConfigStore struct { <ide> func (s *imageConfigStore) Get(d digest.Digest) ([]byte, error) { <ide> return img.RawJSON(), nil <ide> } <ide> <del>func (s *imageConfigStore) RootFSFromConfig(c []byte) (*image.RootFS, error) { <add>func (s *imageConfigStore) RootFSAndPlatformFromConfig(c []byte) (*image.RootFS, layer.Platform, error) { <ide> var unmarshalledConfig image.Image <ide> if err := json.Unmarshal(c, &unmarshalledConfig); err != nil { <del> return nil, err <add> return nil, "", err <ide> } <ide> <ide> // fail immediately on Windows when downloading a non-Windows image <ide> // and vice versa. Exception on Windows if Linux Containers are enabled. <ide> if runtime.GOOS == "windows" && unmarshalledConfig.OS == "linux" && !system.LCOWSupported() { <del> return nil, fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS) <add> return nil, "", fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS) <ide> } else if runtime.GOOS != "windows" && unmarshalledConfig.OS == "windows" { <del> return nil, fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS) <add> return nil, "", fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS) <ide> } <ide> <del> return unmarshalledConfig.RootFS, nil <add> platform := "" <add> if runtime.GOOS == "windows" { <add> platform = unmarshalledConfig.OS <add> } <add> return unmarshalledConfig.RootFS, layer.Platform(platform), nil <ide> } <ide> <ide> type storeLayerProvider struct { <ide><path>distribution/pull_v1.go <ide> func (p *v1Puller) pullImage(ctx context.Context, v1ID, endpoint string, localNa <ide> } <ide> <ide> rootFS := image.NewRootFS() <del> resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, descriptors, p.config.ProgressOutput) <add> resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, "", descriptors, p.config.ProgressOutput) <ide> if err != nil { <ide> return err <ide> } <ide><path>distribution/pull_v2.go <ide> func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Named, unverif <ide> descriptors = append(descriptors, layerDescriptor) <ide> } <ide> <del> resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, descriptors, p.config.ProgressOutput) <add> resultRootFS, release, err := p.config.DownloadManager.Download(ctx, *rootFS, "", descriptors, p.config.ProgressOutput) <ide> if err != nil { <ide> return "", "", err <ide> } <ide> func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s <ide> }() <ide> <ide> var ( <del> configJSON []byte // raw serialized image config <del> downloadedRootFS *image.RootFS // rootFS from registered layers <del> configRootFS *image.RootFS // rootFS from configuration <del> release func() // release resources from rootFS download <add> configJSON []byte // raw serialized image config <add> downloadedRootFS *image.RootFS // rootFS from registered layers <add> configRootFS *image.RootFS // rootFS from configuration <add> release func() // release resources from rootFS download <add> platform layer.Platform // for LCOW when registering downloaded layers <ide> ) <ide> <ide> // https://github.com/docker/docker/issues/24766 - Err on the side of caution, <ide> func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s <ide> // check to block Windows images being pulled on Linux is implemented, it <ide> // may be necessary to perform the same type of serialisation. <ide> if runtime.GOOS == "windows" { <del> configJSON, configRootFS, err = receiveConfig(p.config.ImageStore, configChan, configErrChan) <add> configJSON, configRootFS, platform, err = receiveConfig(p.config.ImageStore, configChan, configErrChan) <ide> if err != nil { <ide> return "", "", err <ide> } <ide> func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s <ide> rootFS image.RootFS <ide> ) <ide> downloadRootFS := *image.NewRootFS() <del> rootFS, release, err = p.config.DownloadManager.Download(ctx, downloadRootFS, descriptors, p.config.ProgressOutput) <add> rootFS, release, err = p.config.DownloadManager.Download(ctx, downloadRootFS, platform, descriptors, p.config.ProgressOutput) <ide> if err != nil { <ide> // Intentionally do not cancel the config download here <ide> // as the error from config download (if there is one) <ide> func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s <ide> } <ide> <ide> if configJSON == nil { <del> configJSON, configRootFS, err = receiveConfig(p.config.ImageStore, configChan, configErrChan) <add> configJSON, configRootFS, _, err = receiveConfig(p.config.ImageStore, configChan, configErrChan) <ide> if err == nil && configRootFS == nil { <ide> err = errRootFSInvalid <ide> } <ide> func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s <ide> return imageID, manifestDigest, nil <ide> } <ide> <del>func receiveConfig(s ImageConfigStore, configChan <-chan []byte, errChan <-chan error) ([]byte, *image.RootFS, error) { <add>func receiveConfig(s ImageConfigStore, configChan <-chan []byte, errChan <-chan error) ([]byte, *image.RootFS, layer.Platform, error) { <ide> select { <ide> case configJSON := <-configChan: <del> rootfs, err := s.RootFSFromConfig(configJSON) <add> rootfs, platform, err := s.RootFSAndPlatformFromConfig(configJSON) <ide> if err != nil { <del> return nil, nil, err <add> return nil, nil, "", err <ide> } <del> return configJSON, rootfs, nil <add> return configJSON, rootfs, platform, nil <ide> case err := <-errChan: <del> return nil, nil, err <add> return nil, nil, "", err <ide> // Don't need a case for ctx.Done in the select because cancellation <ide> // will trigger an error in p.pullSchema2ImageConfig. <ide> } <ide><path>distribution/push_v2.go <ide> func (p *v2Pusher) pushV2Tag(ctx context.Context, ref reference.NamedTagged, id <ide> return fmt.Errorf("could not find image from tag %s: %v", reference.FamiliarString(ref), err) <ide> } <ide> <del> rootfs, err := p.config.ImageStore.RootFSFromConfig(imgConfig) <add> rootfs, _, err := p.config.ImageStore.RootFSAndPlatformFromConfig(imgConfig) <ide> if err != nil { <ide> return fmt.Errorf("unable to get rootfs for image %s: %s", reference.FamiliarString(ref), err) <ide> } <ide><path>distribution/xfer/download.go <ide> type DownloadDescriptorWithRegistered interface { <ide> // Download method is called to get the layer tar data. Layers are then <ide> // registered in the appropriate order. The caller must call the returned <ide> // release function once it is done with the returned RootFS object. <del>func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) { <add>func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS image.RootFS, platform layer.Platform, layers []DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) { <ide> var ( <ide> topLayer layer.Layer <ide> topDownload *downloadTransfer <ide> func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima <ide> // the stack? If so, avoid downloading it more than once. <ide> var topDownloadUncasted Transfer <ide> if existingDownload, ok := downloadsByKey[key]; ok { <del> xferFunc := ldm.makeDownloadFuncFromDownload(descriptor, existingDownload, topDownload) <add> xferFunc := ldm.makeDownloadFuncFromDownload(descriptor, existingDownload, topDownload, platform) <ide> defer topDownload.Transfer.Release(watcher) <ide> topDownloadUncasted, watcher = ldm.tm.Transfer(transferKey, xferFunc, progressOutput) <ide> topDownload = topDownloadUncasted.(*downloadTransfer) <ide> func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima <ide> <ide> var xferFunc DoFunc <ide> if topDownload != nil { <del> xferFunc = ldm.makeDownloadFunc(descriptor, "", topDownload) <add> xferFunc = ldm.makeDownloadFunc(descriptor, "", topDownload, platform) <ide> defer topDownload.Transfer.Release(watcher) <ide> } else { <del> xferFunc = ldm.makeDownloadFunc(descriptor, rootFS.ChainID(), nil) <add> xferFunc = ldm.makeDownloadFunc(descriptor, rootFS.ChainID(), nil, platform) <ide> } <ide> topDownloadUncasted, watcher = ldm.tm.Transfer(transferKey, xferFunc, progressOutput) <ide> topDownload = topDownloadUncasted.(*downloadTransfer) <ide> func (ldm *LayerDownloadManager) Download(ctx context.Context, initialRootFS ima <ide> // complete before the registration step, and registers the downloaded data <ide> // on top of parentDownload's resulting layer. Otherwise, it registers the <ide> // layer on top of the ChainID given by parentLayer. <del>func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, parentLayer layer.ChainID, parentDownload *downloadTransfer) DoFunc { <add>func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, parentLayer layer.ChainID, parentDownload *downloadTransfer, platform layer.Platform) DoFunc { <ide> return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { <ide> d := &downloadTransfer{ <ide> Transfer: NewTransfer(), <ide> func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, <ide> src = fs.Descriptor() <ide> } <ide> if ds, ok := d.layerStore.(layer.DescribableStore); ok { <del> d.layer, err = ds.RegisterWithDescriptor(inflatedLayerData, parentLayer, src) <add> d.layer, err = ds.RegisterWithDescriptor(inflatedLayerData, parentLayer, platform, src) <ide> } else { <del> d.layer, err = d.layerStore.Register(inflatedLayerData, parentLayer) <add> d.layer, err = d.layerStore.Register(inflatedLayerData, parentLayer, platform) <ide> } <ide> if err != nil { <ide> select { <ide> func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor, <ide> // parentDownload. This function does not log progress output because it would <ide> // interfere with the progress reporting for sourceDownload, which has the same <ide> // Key. <del>func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer) DoFunc { <add>func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer, platform layer.Platform) DoFunc { <ide> return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { <ide> d := &downloadTransfer{ <ide> Transfer: NewTransfer(), <ide> func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor Downloa <ide> src = fs.Descriptor() <ide> } <ide> if ds, ok := d.layerStore.(layer.DescribableStore); ok { <del> d.layer, err = ds.RegisterWithDescriptor(layerReader, parentLayer, src) <add> d.layer, err = ds.RegisterWithDescriptor(layerReader, parentLayer, platform, src) <ide> } else { <del> d.layer, err = d.layerStore.Register(layerReader, parentLayer) <add> d.layer, err = d.layerStore.Register(layerReader, parentLayer, platform) <ide> } <ide> if err != nil { <ide> d.err = fmt.Errorf("failed to register layer: %v", err) <ide><path>distribution/xfer/download_test.go <ide> func (ls *mockLayerStore) Map() map[layer.ChainID]layer.Layer { <ide> return layers <ide> } <ide> <del>func (ls *mockLayerStore) Register(reader io.Reader, parentID layer.ChainID) (layer.Layer, error) { <add>func (ls *mockLayerStore) Register(reader io.Reader, parentID layer.ChainID, platform layer.Platform) (layer.Layer, error) { <ide> return ls.RegisterWithDescriptor(reader, parentID, distribution.Descriptor{}) <ide> } <ide> <ide> func TestSuccessfulDownload(t *testing.T) { <ide> } <ide> <ide> layerStore := &mockLayerStore{make(map[layer.ChainID]*mockLayer)} <del> ldm := NewLayerDownloadManager(layerStore, maxDownloadConcurrency, func(m *LayerDownloadManager) { m.waitDuration = time.Millisecond }) <add> lsMap := make(map[string]layer.Store) <add> lsMap[runtime.GOOS] = layerStore <add> ldm := NewLayerDownloadManager(lsMap, maxDownloadConcurrency, func(m *LayerDownloadManager) { m.waitDuration = time.Millisecond }) <ide> <ide> progressChan := make(chan progress.Progress) <ide> progressDone := make(chan struct{}) <ide> func TestSuccessfulDownload(t *testing.T) { <ide> firstDescriptor := descriptors[0].(*mockDownloadDescriptor) <ide> <ide> // Pre-register the first layer to simulate an already-existing layer <del> l, err := layerStore.Register(firstDescriptor.mockTarStream(), "") <add> l, err := layerStore.Register(firstDescriptor.mockTarStream(), "", layer.Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> firstDescriptor.diffID = l.DiffID() <ide> <del> rootFS, releaseFunc, err := ldm.Download(context.Background(), *image.NewRootFS(), descriptors, progress.ChanOutput(progressChan)) <add> rootFS, releaseFunc, err := ldm.Download(context.Background(), *image.NewRootFS(), layer.Platform(runtime.GOOS), descriptors, progress.ChanOutput(progressChan)) <ide> if err != nil { <ide> t.Fatalf("download error: %v", err) <ide> } <ide> func TestSuccessfulDownload(t *testing.T) { <ide> } <ide> <ide> func TestCancelledDownload(t *testing.T) { <del> ldm := NewLayerDownloadManager(&mockLayerStore{make(map[layer.ChainID]*mockLayer)}, maxDownloadConcurrency, func(m *LayerDownloadManager) { m.waitDuration = time.Millisecond }) <add> layerStore := &mockLayerStore{make(map[layer.ChainID]*mockLayer)} <add> lsMap := make(map[string]layer.Store) <add> lsMap[runtime.GOOS] = layerStore <add> ldm := NewLayerDownloadManager(lsMap, maxDownloadConcurrency, func(m *LayerDownloadManager) { m.waitDuration = time.Millisecond }) <ide> <ide> progressChan := make(chan progress.Progress) <ide> progressDone := make(chan struct{}) <ide> func TestCancelledDownload(t *testing.T) { <ide> }() <ide> <ide> descriptors := downloadDescriptors(nil) <del> _, _, err := ldm.Download(ctx, *image.NewRootFS(), descriptors, progress.ChanOutput(progressChan)) <add> _, _, err := ldm.Download(ctx, *image.NewRootFS(), layer.Platform(runtime.GOOS), descriptors, progress.ChanOutput(progressChan)) <ide> if err != context.Canceled { <ide> t.Fatal("expected download to be cancelled") <ide> } <ide><path>image/tarexport/load.go <ide> package tarexport <ide> <ide> import ( <ide> "encoding/json" <add> "errors" <ide> "fmt" <ide> "io" <ide> "io/ioutil" <ide> "os" <ide> "path/filepath" <ide> "reflect" <add> "runtime" <ide> <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/distribution" <ide> func (l *tarexporter) Load(inTar io.ReadCloser, outStream io.Writer, quiet bool) <ide> return fmt.Errorf("invalid manifest, layers length mismatch: expected %d, got %d", expected, actual) <ide> } <ide> <add> // On Windows, validate the platform, defaulting to windows if not present. <add> platform := layer.Platform(img.OS) <add> if runtime.GOOS == "windows" { <add> if platform == "" { <add> platform = "windows" <add> } <add> if (platform != "windows") && (platform != "linux") { <add> return fmt.Errorf("configuration for this image has an unsupported platform: %s", platform) <add> } <add> } <add> <ide> for i, diffID := range img.RootFS.DiffIDs { <ide> layerPath, err := safePath(tmpDir, m.Layers[i]) <ide> if err != nil { <ide> func (l *tarexporter) Load(inTar io.ReadCloser, outStream io.Writer, quiet bool) <ide> r.Append(diffID) <ide> newLayer, err := l.ls.Get(r.ChainID()) <ide> if err != nil { <del> newLayer, err = l.loadLayer(layerPath, rootFS, diffID.String(), m.LayerSources[diffID], progressOutput) <add> newLayer, err = l.loadLayer(layerPath, rootFS, diffID.String(), platform, m.LayerSources[diffID], progressOutput) <ide> if err != nil { <ide> return err <ide> } <ide> func (l *tarexporter) setParentID(id, parentID image.ID) error { <ide> return l.is.SetParent(id, parentID) <ide> } <ide> <del>func (l *tarexporter) loadLayer(filename string, rootFS image.RootFS, id string, foreignSrc distribution.Descriptor, progressOutput progress.Output) (layer.Layer, error) { <add>func (l *tarexporter) loadLayer(filename string, rootFS image.RootFS, id string, platform layer.Platform, foreignSrc distribution.Descriptor, progressOutput progress.Output) (layer.Layer, error) { <ide> // We use system.OpenSequential to use sequential file access on Windows, avoiding <ide> // depleting the standby list. On Linux, this equates to a regular os.Open. <ide> rawTar, err := system.OpenSequential(filename) <ide> func (l *tarexporter) loadLayer(filename string, rootFS image.RootFS, id string, <ide> defer inflatedLayerData.Close() <ide> <ide> if ds, ok := l.ls.(layer.DescribableStore); ok { <del> return ds.RegisterWithDescriptor(inflatedLayerData, rootFS.ChainID(), foreignSrc) <add> return ds.RegisterWithDescriptor(inflatedLayerData, rootFS.ChainID(), platform, foreignSrc) <ide> } <del> return l.ls.Register(inflatedLayerData, rootFS.ChainID()) <add> return l.ls.Register(inflatedLayerData, rootFS.ChainID(), platform) <ide> } <ide> <ide> func (l *tarexporter) setLoadedTag(ref reference.NamedTagged, imgID digest.Digest, outStream io.Writer) error { <ide> func (l *tarexporter) setLoadedTag(ref reference.NamedTagged, imgID digest.Diges <ide> } <ide> <ide> func (l *tarexporter) legacyLoad(tmpDir string, outStream io.Writer, progressOutput progress.Output) error { <add> if runtime.GOOS == "windows" { <add> return errors.New("Windows does not support legacy loading of images") <add> } <add> <ide> legacyLoadedMap := make(map[string]image.ID) <ide> <ide> dirs, err := ioutil.ReadDir(tmpDir) <ide> func (l *tarexporter) legacyLoadImage(oldID, sourceDir string, loadedMap map[str <ide> if err != nil { <ide> return err <ide> } <del> newLayer, err := l.loadLayer(layerPath, *rootFS, oldID, distribution.Descriptor{}, progressOutput) <add> newLayer, err := l.loadLayer(layerPath, *rootFS, oldID, "", distribution.Descriptor{}, progressOutput) <ide> if err != nil { <ide> return err <ide> } <ide><path>layer/layer.go <ide> type CreateRWLayerOpts struct { <ide> // Store represents a backend for managing both <ide> // read-only and read-write layers. <ide> type Store interface { <del> Register(io.Reader, ChainID) (Layer, error) <add> Register(io.Reader, ChainID, Platform) (Layer, error) <ide> Get(ChainID) (Layer, error) <ide> Map() map[ChainID]Layer <ide> Release(Layer) ([]Metadata, error) <ide> type Store interface { <ide> // DescribableStore represents a layer store capable of storing <ide> // descriptors for layers. <ide> type DescribableStore interface { <del> RegisterWithDescriptor(io.Reader, ChainID, distribution.Descriptor) (Layer, error) <add> RegisterWithDescriptor(io.Reader, ChainID, Platform, distribution.Descriptor) (Layer, error) <ide> } <ide> <ide> // MetadataTransaction represents functions for setting layer metadata <ide><path>layer/layer_store.go <ide> func (ls *layerStore) applyTar(tx MetadataTransaction, ts io.Reader, parent stri <ide> return nil <ide> } <ide> <del>func (ls *layerStore) Register(ts io.Reader, parent ChainID) (Layer, error) { <del> return ls.registerWithDescriptor(ts, parent, distribution.Descriptor{}) <add>func (ls *layerStore) Register(ts io.Reader, parent ChainID, platform Platform) (Layer, error) { <add> return ls.registerWithDescriptor(ts, parent, platform, distribution.Descriptor{}) <ide> } <ide> <del>func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, descriptor distribution.Descriptor) (Layer, error) { <add>func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, platform Platform, descriptor distribution.Descriptor) (Layer, error) { <ide> // err is used to hold the error which will always trigger <ide> // cleanup of creates sources but may not be an error returned <ide> // to the caller (already exists). <ide> func (ls *layerStore) registerWithDescriptor(ts io.Reader, parent ChainID, descr <ide> layerStore: ls, <ide> references: map[Layer]struct{}{}, <ide> descriptor: descriptor, <add> platform: platform, <ide> } <ide> <ide> if err = ls.driver.Create(layer.cacheID, pid, nil); err != nil { <ide> func (ls *layerStore) deleteLayer(layer *roLayer, metadata *Metadata) error { <ide> if err != nil { <ide> return err <ide> } <del> <ide> err = ls.store.Remove(layer.chainID) <ide> if err != nil { <ide> return err <ide> func (ls *layerStore) CreateRWLayer(name string, parent ChainID, opts *CreateRWL <ide> if err = ls.driver.CreateReadWrite(m.mountID, pid, createOpts); err != nil { <ide> return nil, err <ide> } <del> <ide> if err = ls.saveMount(m); err != nil { <ide> return nil, err <ide> } <ide><path>layer/layer_store_windows.go <ide> import ( <ide> "github.com/docker/distribution" <ide> ) <ide> <del>func (ls *layerStore) RegisterWithDescriptor(ts io.Reader, parent ChainID, descriptor distribution.Descriptor) (Layer, error) { <del> return ls.registerWithDescriptor(ts, parent, descriptor) <add>func (ls *layerStore) RegisterWithDescriptor(ts io.Reader, parent ChainID, platform Platform, descriptor distribution.Descriptor) (Layer, error) { <add> return ls.registerWithDescriptor(ts, parent, platform, descriptor) <ide> } <ide><path>layer/layer_test.go <ide> func createLayer(ls Store, parent ChainID, layerFunc layerInit) (Layer, error) { <ide> } <ide> defer ts.Close() <ide> <del> layer, err := ls.Register(ts, parent) <add> layer, err := ls.Register(ts, parent, Platform(runtime.GOOS)) <ide> if err != nil { <ide> return nil, err <ide> } <ide> func TestTarStreamStability(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> layer1, err := ls.Register(bytes.NewReader(tar1), "") <add> layer1, err := ls.Register(bytes.NewReader(tar1), "", Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestTarStreamStability(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> layer2, err := ls.Register(bytes.NewReader(tar2), layer1.ChainID()) <add> layer2, err := ls.Register(bytes.NewReader(tar2), layer1.ChainID(), Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestRegisterExistingLayer(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> layer2a, err := ls.Register(bytes.NewReader(tar1), layer1.ChainID()) <add> layer2a, err := ls.Register(bytes.NewReader(tar1), layer1.ChainID(), Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> layer2b, err := ls.Register(bytes.NewReader(tar1), layer1.ChainID()) <add> layer2b, err := ls.Register(bytes.NewReader(tar1), layer1.ChainID(), Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestTarStreamVerification(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> layer1, err := ls.Register(bytes.NewReader(tar1), "") <add> layer1, err := ls.Register(bytes.NewReader(tar1), "", Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> layer2, err := ls.Register(bytes.NewReader(tar2), "") <add> layer2, err := ls.Register(bytes.NewReader(tar2), "", Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>layer/migration_test.go <ide> func TestLayerMigration(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> layer1b, err := ls.Register(bytes.NewReader(tar1), "") <add> layer1b, err := ls.Register(bytes.NewReader(tar1), "", Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> assertReferences(t, layer1a, layer1b) <ide> // Attempt register, should be same <del> layer2a, err := ls.Register(bytes.NewReader(tar2), layer1a.ChainID()) <add> layer2a, err := ls.Register(bytes.NewReader(tar2), layer1a.ChainID(), Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> func TestLayerMigrationNoTarsplit(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> <del> layer1b, err := ls.Register(bytes.NewReader(tar1), "") <add> layer1b, err := ls.Register(bytes.NewReader(tar1), "", Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> assertReferences(t, layer1a, layer1b) <ide> <ide> // Attempt register, should be same <del> layer2a, err := ls.Register(bytes.NewReader(tar2), layer1a.ChainID()) <add> layer2a, err := ls.Register(bytes.NewReader(tar2), layer1a.ChainID(), Platform(runtime.GOOS)) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide><path>plugin/backend_linux.go <ide> func (s *tempConfigStore) Get(d digest.Digest) ([]byte, error) { <ide> return s.config, nil <ide> } <ide> <del>func (s *tempConfigStore) RootFSFromConfig(c []byte) (*image.RootFS, error) { <add>func (s *tempConfigStore) RootFSAndPlatformFromConfig(c []byte) (*image.RootFS, layer.Platform, error) { <ide> return configToRootFS(c) <ide> } <ide> <ide> func (s *pluginConfigStore) Get(d digest.Digest) ([]byte, error) { <ide> return ioutil.ReadAll(rwc) <ide> } <ide> <del>func (s *pluginConfigStore) RootFSFromConfig(c []byte) (*image.RootFS, error) { <add>func (s *pluginConfigStore) RootFSAndPlatformFromConfig(c []byte) (*image.RootFS, layer.Platform, error) { <ide> return configToRootFS(c) <ide> } <ide> <ide><path>plugin/blobstore.go <ide> type downloadManager struct { <ide> configDigest digest.Digest <ide> } <ide> <del>func (dm *downloadManager) Download(ctx context.Context, initialRootFS image.RootFS, layers []xfer.DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) { <add>func (dm *downloadManager) Download(ctx context.Context, initialRootFS image.RootFS, platform layer.Platform, layers []xfer.DownloadDescriptor, progressOutput progress.Output) (image.RootFS, func(), error) { <add> // TODO @jhowardmsft LCOW: May need revisiting. <ide> for _, l := range layers { <ide> b, err := dm.blobStore.New() <ide> if err != nil { <ide> func (dm *downloadManager) Put(dt []byte) (digest.Digest, error) { <ide> func (dm *downloadManager) Get(d digest.Digest) ([]byte, error) { <ide> return nil, fmt.Errorf("digest not found") <ide> } <del>func (dm *downloadManager) RootFSFromConfig(c []byte) (*image.RootFS, error) { <add>func (dm *downloadManager) RootFSAndPlatformFromConfig(c []byte) (*image.RootFS, layer.Platform, error) { <ide> return configToRootFS(c) <ide> } <ide><path>plugin/manager.go <ide> import ( <ide> "path/filepath" <ide> "reflect" <ide> "regexp" <add> "runtime" <ide> "sort" <ide> "strings" <ide> "sync" <ide> import ( <ide> "github.com/docker/docker/pkg/authorization" <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/mount" <add> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/plugin/v2" <ide> "github.com/docker/docker/registry" <ide> "github.com/opencontainers/go-digest" <ide> func isEqualPrivilege(a, b types.PluginPrivilege) bool { <ide> return reflect.DeepEqual(a.Value, b.Value) <ide> } <ide> <del>func configToRootFS(c []byte) (*image.RootFS, error) { <add>func configToRootFS(c []byte) (*image.RootFS, layer.Platform, error) { <add> // TODO @jhowardmsft LCOW - Will need to revisit this. For now, calculate the platform. <add> platform := layer.Platform(runtime.GOOS) <add> if platform == "windows" && system.LCOWSupported() { <add> platform = "linux" <add> } <ide> var pluginConfig types.PluginConfig <ide> if err := json.Unmarshal(c, &pluginConfig); err != nil { <del> return nil, err <add> return nil, "", err <ide> } <ide> // validation for empty rootfs is in distribution code <ide> if pluginConfig.Rootfs == nil { <del> return nil, nil <add> return nil, platform, nil <ide> } <ide> <del> return rootFSFromPlugin(pluginConfig.Rootfs), nil <add> return rootFSFromPlugin(pluginConfig.Rootfs), platform, nil <ide> } <ide> <ide> func rootFSFromPlugin(pluginfs *types.PluginConfigRootfs) *image.RootFS {
18
Python
Python
handle recent tf api changes
5e73db6c00d62ac61cbae9056628a7683122b392
<ide><path>keras/backend/tensorflow_backend.py <ide> def batch_dot(x, y, axes=None): <ide> else: <ide> adj_x = None <ide> adj_y = None <del> out = tf.batch_matmul(x, y, adj_x=adj_x, adj_y=adj_y) <add> try: <add> out = tf.batch_matmul(x, y, adj_a=adj_x, adj_b=adj_y) <add> except TypeError: <add> out = tf.batch_matmul(x, y, adj_x=adj_x, adj_y=adj_y) <ide> if ndim(out) == 1: <ide> out = expand_dims(out, 1) <ide> return out <ide> def normalize_batch_in_training(x, gamma, beta, <ide> target_shape.append(1) <ide> else: <ide> target_shape.append(tf.shape(x)[axis]) <del> target_shape = tf.pack(target_shape) <add> target_shape = tf.stack(target_shape) <ide> <ide> broadcast_mean = tf.reshape(mean, target_shape) <ide> broadcast_var = tf.reshape(var, target_shape) <ide> def concatenate(tensors, axis=-1): <ide> if py_all([is_sparse(x) for x in tensors]): <ide> return tf.sparse_concat(axis, tensors) <ide> else: <del> return tf.concat(axis, [to_dense(x) for x in tensors]) <add> try: <add> return tf.concat_v2([to_dense(x) for x in tensors], axis) <add> except AttributeError: <add> return tf.concat(axis, [to_dense(x) for x in tensors]) <ide> <ide> <ide> def reshape(x, shape): <ide> def repeat_elements(x, rep, axis): <ide> ''' <ide> x_shape = x.get_shape().as_list() <ide> # slices along the repeat axis <del> splits = tf.split(axis, x_shape[axis], x) <add> try: <add> splits = tf.split(value=x, num_or_size_splits=x_shape[axis], axis=axis) <add> except TypeError: <add> splits = tf.split(value=x, num_split=x_shape[axis], split_dim=axis) <ide> # repeat each slice the given number of reps <ide> x_rep = [s for s in splits for i in range(rep)] <del> return tf.concat(axis, x_rep) <add> return concatenate(x_rep, axis) <ide> <ide> <ide> def repeat(x, n): <ide> def repeat(x, n): <ide> ''' <ide> assert ndim(x) == 2 <ide> x = tf.expand_dims(x, 1) <del> pattern = tf.pack([1, n, 1]) <add> pattern = tf.stack([1, n, 1]) <ide> return tf.tile(x, pattern) <ide> <ide> <ide> def batch_flatten(x): <ide> '''Turn a n-D tensor into a 2D tensor where <ide> the first dimension is conserved. <ide> ''' <del> x = tf.reshape(x, tf.pack([-1, prod(shape(x)[1:])])) <add> x = tf.reshape(x, tf.stack([-1, prod(shape(x)[1:])])) <ide> return x <ide> <ide> <ide> def spatial_3d_padding(x, padding=(1, 1, 1), dim_ordering='default'): <ide> return tf.pad(x, pattern) <ide> <ide> <del>def pack(x): <del> return tf.pack(x) <add>def stack(x): <add> return tf.stack(x) <ide> <ide> <ide> def one_hot(indices, nb_classes): <ide> def reverse(x, axes): <ide> ''' <ide> if isinstance(axes, int): <ide> axes = [axes] <del> dims = [True if i in axes else False for i in range(len(x.get_shape()._dims))] <del> return tf.reverse(x, dims) <add> try: <add> return tf.reverse_v2(x, axes) <add> except AttributeError: <add> # Older TF versions. <add> dims = [True if i in axes else False for i in range(len(x.get_shape()._dims))] <add> return tf.reverse(x, dims) <ide> <ide> <ide> # VALUE MANIPULATION <ide> def rnn(step_function, inputs, initial_states, <ide> successive_states = [] <ide> successive_outputs = [] <ide> <del> input_list = tf.unpack(inputs) <add> input_list = tf.unstack(inputs) <ide> if go_backwards: <ide> input_list.reverse() <ide> <ide> if mask is not None: <del> mask_list = tf.unpack(mask) <add> mask_list = tf.unstack(mask) <ide> if go_backwards: <ide> mask_list.reverse() <ide> <ide> for input, mask_t in zip(input_list, mask_list): <ide> output, new_states = step_function(input, states + constants) <ide> <del> # tf.select needs its condition tensor <add> # tf.where needs its condition tensor <ide> # to be the same shape as its two <ide> # result tensors, but in our case <ide> # the condition (mask) tensor is <ide> def rnn(step_function, inputs, initial_states, <ide> # it just repeats the mask along its second dimension <ide> # n times. <ide> tiled_mask_t = tf.tile(mask_t, <del> tf.pack([1, tf.shape(output)[1]])) <add> tf.stack([1, tf.shape(output)[1]])) <ide> <ide> if len(successive_outputs) == 0: <ide> prev_output = zeros_like(output) <ide> else: <ide> prev_output = successive_outputs[-1] <ide> <del> output = tf.select(tiled_mask_t, output, prev_output) <add> output = tf.where(tiled_mask_t, output, prev_output) <ide> <ide> return_states = [] <ide> for state, new_state in zip(states, new_states): <ide> # (see earlier comment for tile explanation) <ide> tiled_mask_t = tf.tile(mask_t, <del> tf.pack([1, tf.shape(new_state)[1]])) <del> return_states.append(tf.select(tiled_mask_t, <del> new_state, <del> state)) <add> tf.stack([1, tf.shape(new_state)[1]])) <add> return_states.append(tf.where(tiled_mask_t, <add> new_state, <add> state)) <ide> states = return_states <ide> successive_outputs.append(output) <ide> successive_states.append(states) <ide> last_output = successive_outputs[-1] <ide> new_states = successive_states[-1] <del> outputs = tf.pack(successive_outputs) <add> outputs = tf.stack(successive_outputs) <ide> else: <ide> for input in input_list: <ide> output, states = step_function(input, states + constants) <ide> successive_outputs.append(output) <ide> successive_states.append(states) <ide> last_output = successive_outputs[-1] <ide> new_states = successive_states[-1] <del> outputs = tf.pack(successive_outputs) <add> outputs = tf.stack(successive_outputs) <ide> <ide> else: <ide> if go_backwards: <del> inputs = tf.reverse(inputs, [True] + [False] * (ndim - 1)) <add> inputs = reverse(inputs, 0) <ide> <ide> states = tuple(initial_states) <ide> <ide> def rnn(step_function, inputs, initial_states, <ide> 'as its first state at time `t` ' <ide> 'the output at time `t-1`).') <ide> if go_backwards: <del> mask = tf.reverse(mask, [True] + [False] * (ndim - 1)) <add> mask = reverse(mask, 0) <ide> <ide> mask_ta = tensor_array_ops.TensorArray( <ide> dtype=tf.bool, <ide> def _step(time, output_ta_t, *states): <ide> for state, new_state in zip(states, new_states): <ide> new_state.set_shape(state.get_shape()) <ide> tiled_mask_t = tf.tile(mask_t, <del> tf.pack([1, tf.shape(output)[1]])) <del> output = tf.select(tiled_mask_t, output, states[0]) <del> new_states = [tf.select(tiled_mask_t, new_states[i], states[i]) for i in range(len(states))] <add> tf.stack([1, tf.shape(output)[1]])) <add> output = tf.where(tiled_mask_t, output, states[0]) <add> new_states = [tf.where(tiled_mask_t, new_states[i], states[i]) for i in range(len(states))] <ide> output_ta_t = output_ta_t.write(time, output) <ide> return (time + 1, output_ta_t) + tuple(new_states) <ide> else: <ide> def elu(x, alpha=1.): <ide> if alpha == 1: <ide> return res <ide> else: <del> return tf.select(x > 0, res, alpha * res) <add> return tf.where(x > 0, res, alpha * res) <ide> <ide> <ide> def softmax(x): <ide> def random_uniform(shape, low=0.0, high=1.0, dtype=_FLOATX, seed=None): <ide> def random_binomial(shape, p=0.0, dtype=_FLOATX, seed=None): <ide> if seed is None: <ide> seed = np.random.randint(10e6) <del> return tf.select(tf.random_uniform(shape, dtype=dtype, seed=seed) <= p, <add> return tf.where(tf.random_uniform(shape, dtype=dtype, seed=seed) <= p, <ide> tf.ones(shape, dtype=dtype), <ide> tf.zeros(shape, dtype=dtype)) <ide> <ide> def ctc_label_dense_to_sparse(labels, label_lengths): <ide> # undocumented feature soon to be made public <ide> from tensorflow.python.ops import functional_ops <ide> label_shape = tf.shape(labels) <del> num_batches_tns = tf.pack([label_shape[0]]) <del> max_num_labels_tns = tf.pack([label_shape[1]]) <add> num_batches_tns = tf.stack([label_shape[0]]) <add> max_num_labels_tns = tf.stack([label_shape[1]]) <ide> <ide> def range_less_than(previous_state, current_input): <ide> return tf.expand_dims(tf.range(label_shape[1]), 0) < tf.fill(max_num_labels_tns, current_input) <ide> def range_less_than(previous_state, current_input): <ide> label_ind = tf.boolean_mask(label_array, dense_mask) <ide> <ide> batch_array = tf.transpose(tf.reshape(tf.tile(tf.range(0, label_shape[0]), <del> max_num_labels_tns), tf.reverse(label_shape, [True]))) <add> max_num_labels_tns), reverse(label_shape, 0))) <ide> batch_ind = tf.boolean_mask(batch_array, dense_mask) <del> indices = tf.transpose(tf.reshape(tf.concat(0, [batch_ind, label_ind]), [2, -1])) <add> indices = tf.transpose(tf.reshape(concatenate([batch_ind, label_ind], axis=0), [2, -1])) <ide> <ide> vals_sparse = tf.gather_nd(labels, indices) <ide> <ide><path>keras/backend/theano_backend.py <ide> def spatial_3d_padding(x, padding=(1, 1, 1), dim_ordering='default'): <ide> return T.set_subtensor(output[indices], x) <ide> <ide> <del>def pack(x): <add>def stack(x): <ide> return T.stack(*x) <ide> <ide> <ide><path>keras/layers/recurrent.py <ide> def time_distributed_dense(x, w, b=None, dropout=None, <ide> x = x + b <ide> # reshape to 3D tensor <ide> if K.backend() == 'tensorflow': <del> x = K.reshape(x, K.pack([-1, timesteps, output_dim])) <add> x = K.reshape(x, K.stack([-1, timesteps, output_dim])) <ide> x.set_shape([None, None, output_dim]) <ide> else: <ide> x = K.reshape(x, (-1, timesteps, output_dim)) <ide><path>tests/keras/backend/test_backends.py <ide> def test_random_normal(self): <ide> mean = 0. <ide> std = 1. <ide> rand = KTF.eval(KTF.random_normal((1000, 1000), mean=mean, std=std)) <del> assert(rand.shape == (1000, 1000)) <del> assert(np.abs(np.mean(rand) - mean) < 0.01) <del> assert(np.abs(np.std(rand) - std) < 0.01) <add> assert rand.shape == (1000, 1000) <add> assert np.abs(np.mean(rand) - mean) < 0.01 <add> assert np.abs(np.std(rand) - std) < 0.01 <ide> <ide> rand = KTH.eval(KTH.random_normal((1000, 1000), mean=mean, std=std)) <del> assert(rand.shape == (1000, 1000)) <del> assert(np.abs(np.mean(rand) - mean) < 0.01) <del> assert(np.abs(np.std(rand) - std) < 0.01) <add> assert rand.shape == (1000, 1000) <add> assert np.abs(np.mean(rand) - mean) < 0.01 <add> assert np.abs(np.std(rand) - std) < 0.01 <ide> <ide> def test_random_uniform(self): <del> min = -1. <del> max = 1. <del> rand = KTF.eval(KTF.random_uniform((1000, 1000), min, max)) <del> assert(rand.shape == (1000, 1000)) <del> assert(np.abs(np.mean(rand)) < 0.01) <del> assert(np.max(rand) <= max) <del> assert(np.min(rand) >= min) <del> <del> rand = KTH.eval(KTH.random_uniform((1000, 1000), min, max)) <del> assert(rand.shape == (1000, 1000)) <del> assert(np.abs(np.mean(rand)) < 0.01) <del> assert(np.max(rand) <= max) <del> assert(np.min(rand) >= min) <add> min_val = -1. <add> max_val = 1. <add> rand = KTF.eval(KTF.random_uniform((1000, 1000), min_val, max_val)) <add> assert rand.shape == (1000, 1000) <add> assert np.abs(np.mean(rand)) < 0.01 <add> assert np.max(rand) <= max_val <add> assert np.min(rand) >= min_val <add> <add> rand = KTH.eval(KTH.random_uniform((1000, 1000), min_val, max_val)) <add> assert rand.shape == (1000, 1000) <add> assert np.abs(np.mean(rand)) < 0.01 <add> assert np.max(rand) <= max_val <add> assert np.min(rand) >= min_val <ide> <ide> def test_random_binomial(self): <ide> p = 0.5 <ide> rand = KTF.eval(KTF.random_binomial((1000, 1000), p)) <del> assert(rand.shape == (1000, 1000)) <del> assert(np.abs(np.mean(rand) - p) < 0.01) <del> assert(np.max(rand) == 1) <del> assert(np.min(rand) == 0) <add> assert rand.shape == (1000, 1000) <add> assert np.abs(np.mean(rand) - p) < 0.01 <add> assert np.max(rand) == 1 <add> assert np.min(rand) == 0 <ide> <ide> rand = KTH.eval(KTH.random_binomial((1000, 1000), p)) <del> assert(rand.shape == (1000, 1000)) <del> assert(np.abs(np.mean(rand) - p) < 0.01) <del> assert(np.max(rand) == 1) <del> assert(np.min(rand) == 0) <add> assert rand.shape == (1000, 1000) <add> assert np.abs(np.mean(rand) - p) < 0.01 <add> assert np.max(rand) == 1 <add> assert np.min(rand) == 0 <ide> <ide> def test_ctc(self): <ide> # simplified version of TensorFlow's test <ide> def test_arange(self): <ide> for test_value in (-20, 0, 1, 10): <ide> t_a = KTF.arange(test_value) <ide> a = KTF.eval(t_a) <del> assert(np.array_equal(a, np.arange(test_value))) <add> assert np.array_equal(a, np.arange(test_value)) <ide> t_b = KTH.arange(test_value) <ide> b = KTH.eval(t_b) <del> assert(np.array_equal(b, np.arange(test_value))) <del> assert(np.array_equal(a, b)) <del> assert(KTF.dtype(t_a) == KTH.dtype(t_b), 'default dtypes are equal') <add> assert np.array_equal(b, np.arange(test_value)) <add> assert np.array_equal(a, b) <add> assert KTF.dtype(t_a) == KTH.dtype(t_b) <ide> for start, stop, step in ((0, 5, 1), (-5, 5, 2), (0, 1, 2)): <ide> a = KTF.eval(KTF.arange(start, stop, step)) <del> assert(np.array_equal(a, np.arange(start, stop, step))) <add> assert np.array_equal(a, np.arange(start, stop, step)) <ide> b = KTH.eval(KTH.arange(start, stop, step)) <del> assert(np.array_equal(b, np.arange(start, stop, step))) <del> assert(np.array_equal(a, b)) <add> assert np.array_equal(b, np.arange(start, stop, step)) <add> assert np.array_equal(a, b) <ide> for dtype in ('int32', 'int64', 'float32', 'float64'): <ide> for backend in (KTF, KTH): <ide> t = backend.arange(10, dtype=dtype) <del> assert(backend.dtype(t) == dtype) <add> assert backend.dtype(t) == dtype <ide> <ide> <ide> if __name__ == '__main__':
4
Text
Text
add code preview for textcat_multilabel [ci skip]
cdc0d669c1715999fa0aaf44e90523ed5368cfa6
<ide><path>website/docs/api/textcategorizer.md <ide> architectures and their arguments and hyperparameters. <ide> %%GITHUB_SPACY/spacy/pipeline/textcat.py <ide> ``` <ide> <add>```python <add>%%GITHUB_SPACY/spacy/pipeline/textcat_multilabel.py <add>``` <add> <ide> ## TextCategorizer.\_\_init\_\_ {#init tag="method"} <ide> <ide> > #### Example
1
Text
Text
add davidcai1993 to collaborators
ddcd93aaeb1485b2b7ddd35f8e96dba1cc372cea
<ide><path>README.md <ide> more information about the governance of the Node.js project, see <ide> **Claudio Rodriguez** &lt;cjrodr@yahoo.com&gt; <ide> * [danbev](https://github.com/danbev) - <ide> **Daniel Bevenius** &lt;daniel.bevenius@gmail.com&gt; <add>* [DavidCai1993](https://github.com/DavidCai1993) - <add>**David Cai** &lt;davidcai1993@yahoo.com&gt; (he/him) <ide> * [edsadr](https://github.com/edsadr) - <ide> **Adrian Estrada** &lt;edsadr@gmail.com&gt; (he/him) <ide> * [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
1
PHP
PHP
remove depreated useroffset
49474778bd6a200265008d57ff742c977231f314
<ide><path>src/Utility/Time.php <ide> public static function toRSS($dateString, $timezone = null) { <ide> * - `end` => The end of relative time telling <ide> * - `relativeString` => The printf compatible string when outputting relative time <ide> * - `absoluteString` => The printf compatible string when outputting absolute time <del> * - `userOffset` => Users offset from GMT (in hours) *Deprecated* use timezone intead. <ide> * - `timezone` => The user timezone the timestamp should be formatted in. <ide> * <ide> * Relative dates look something like this: <ide> public static function timeAgoInWords($dateTime, array $options = []) { <ide> <ide> if (isset($options['timezone'])) { <ide> $timezone = $options['timezone']; <del> } elseif (isset($options['userOffset'])) { <del> $timezone = $options['userOffset']; <ide> } <ide> <ide> if (isset($options['accuracy'])) {
1
Java
Java
delete unused imports and dead code in cglib fork
f732fab8206f83e012fa0f6f6b05089ef3f4d0c8
<ide><path>spring-core/src/main/java/org/springframework/cglib/beans/BulkBean.java <ide> */ <ide> package org.springframework.cglib.beans; <ide> <del>import java.lang.reflect.Constructor; <del>import java.lang.reflect.Method; <del>import java.lang.reflect.Modifier; <ide> import java.security.ProtectionDomain; <del>import java.util.*; <ide> import org.springframework.cglib.core.*; <ide> import org.springframework.asm.ClassVisitor; <ide> <ide><path>spring-core/src/main/java/org/springframework/cglib/beans/BulkBeanEmitter.java <ide> */ <ide> package org.springframework.cglib.beans; <ide> <del>import java.lang.reflect.Constructor; <ide> import java.lang.reflect.Method; <ide> import java.lang.reflect.Modifier; <del>import java.util.*; <ide> import org.springframework.cglib.core.*; <ide> import org.springframework.asm.ClassVisitor; <ide> import org.springframework.asm.Type; <ide><path>spring-core/src/main/java/org/springframework/cglib/beans/BulkBeanException.java <ide> */ <ide> package org.springframework.cglib.beans; <ide> <del>import org.springframework.cglib.core.CodeGenerationException; <del> <ide> @SuppressWarnings({"rawtypes", "unchecked", "serial"}) <ide> public class BulkBeanException extends RuntimeException <ide> { <ide><path>spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java <ide> import java.util.Map; <ide> import java.util.Set; <ide> <del>import org.springframework.asm.Attribute; <ide> import org.springframework.asm.Type; <ide> <ide> /** <ide> public Signature getSignature() { <ide> public Type[] getExceptionTypes() { <ide> return ReflectUtils.getExceptionTypes(member); <ide> } <del> <del> public Attribute getAttribute() { <del> return null; <del> } <ide> }; <ide> } <ide> <ide><path>spring-core/src/main/java/org/springframework/cglib/proxy/Enhancer.java <ide> private void emitMethods(final ClassEmitter ce, List methods, List actualMethods <ide> se.invoke_constructor(THREAD_LOCAL, CSTRUCT_NULL); <ide> se.putfield(THREAD_CALLBACKS_FIELD); <ide> <del> final Object[] state = new Object[1]; <ide> CallbackGenerator.Context context = new CallbackGenerator.Context() { <ide> public ClassLoader getClassLoader() { <ide> return Enhancer.this.getClassLoader();
5
PHP
PHP
improve blowfish docblocks
895fcac0cd2c942f5197027df74fcde949bf6151
<ide><path>lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php <ide> * }}} <ide> * <ide> * When configuring BlowfishAuthenticate you can pass in settings to which fields, model and additional conditions <del> * are used. See BlowfishAuthenticate::$settings for more information. <add> * are used. See FormAuthenticate::$settings for more information. <add> * <add> * For inital password hashing/creation see Security::hash(). Other than how the password is initally hashed, <add> * BlowfishAuthenticate works exactly the same way as FormAuthenticate. <ide> * <ide> * @package Cake.Controller.Component.Auth <ide> * @since CakePHP(tm) v 2.3 <ide><path>lib/Cake/Utility/Security.php <ide> public static function validateAuthKey($authKey) { <ide> } <ide> <ide> /** <del> * Create a hash from string using given method. <del> * Fallback on next available method. <del> * If you are using blowfish, for comparisons simply pass the originally hashed <del> * string as the salt (the salt is prepended to the hash and php handles the <del> * parsing automagically. Do NOT use a constant salt for blowfish. <add> * Create a hash from string using given method or fallback on next available method. <add> * <add> * #### Using Blowfish <add> * <add> * - Creating Hashes: *Do not supply a salt*. Cake handles salt creation for <add> * you ensuring that each hashed password will have a *unique* salt. <add> * - Comparing Hashes: Simply pass the originally hashed password as the salt. <add> * The salt is prepended to the hash and php handles the parsing automagically. <add> * For convenience the BlowfishAuthenticate adapter is available for use with <add> * the AuthComponent. <add> * - Do NOT use a constant salt for blowfish! <add> * <add> * Creating a blowfish/bcrypt hash: <add> * <add> * {{{ <add> * $hash = Security::hash($password, 'blowfish'); <add> * }}} <ide> * <ide> * @param string $string String to hash <del> * @param string $type Method to use (sha1/sha256/md5) <add> * @param string $type Method to use (sha1/sha256/md5/blowfish) <ide> * @param mixed $salt If true, automatically appends the application's salt <ide> * value to $string (Security.salt). If you are using blowfish the salt <ide> * must be false or a previously generated salt. <ide> public static function rijndael($text, $key, $operation) { <ide> * @param integer $length The length of the returned salt <ide> * @return string The generated salt <ide> */ <del> public static function salt($length = 22) { <add> protected static function _salt($length = 22) { <ide> $salt = str_replace( <ide> array('+', '='), <ide> '.', <ide> public static function salt($length = 22) { <ide> } <ide> <ide> /** <del> * One way encryption using php's crypt() function, used with type blowfish in ``Security::hash()`` <add> * One way encryption using php's crypt() function. To use blowfish hashing see ``Security::hash()`` <ide> * <ide> * @param string $password The string to be encrypted. <ide> * @param mixed $salt false to generate a new salt or an existing salt. <add> * @return string The hashed string or an empty string on error. <ide> */ <ide> protected static function _crypt($password, $salt = false) { <ide> if ($salt === false) { <del> $salt = self::salt(22); <add> $salt = self::_salt(22); <ide> $salt = vsprintf('$2a$%02d$%s', array(self::$hashCost, $salt)); <ide> } <ide>
2
Ruby
Ruby
remove reference to ruby 1.8.7
9f42f732a420ba77a5a2193cdc15ebb61ce2dda8
<ide><path>activesupport/lib/active_support/core_ext/array/wrap.rb <ide> class Array <ide> # <ide> # [*object] <ide> # <del> # which for +nil+ returns <tt>[nil]</tt> (Ruby 1.8.7) or <tt>[]</tt> (Ruby <del> # 1.9), and calls to <tt>Array(object)</tt> otherwise. <add> # which for +nil+ returns <tt>[]</tt>, and calls to <tt>Array(object)</tt> otherwise. <ide> # <ide> # Thus, in this case the behavior may be different for +nil+, and the differences with <ide> # <tt>Kernel#Array</tt> explained above apply to the rest of <tt>object</tt>s.
1
PHP
PHP
fix broken error message
d7fefb1f9a1eda6f1134e008de1fb33010e2cb43
<ide><path>lib/Cake/Cache/Cache.php <ide> public static function write($key, $value, $config = 'default') { <ide> "%s cache was unable to write '%s' to %s cache", <ide> $config, <ide> $key, <del> $settings['engine'] <add> get_class($engine) <ide> ), <ide> E_USER_WARNING <ide> );
1
Text
Text
remove version from docs. use latest
93f777821a9f9c0475f8669c165fa3149766c4b3
<ide><path>docs/getting-started/README.md <ide> First, we need to have a canvas in our page. <ide> Now that we have a canvas we can use, we need to include Chart.js in our page. <ide> <ide> ```html <del><script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script> <add><script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <ide> ``` <ide> <ide> Now, we can create a chart. We add a script to our page:
1
Go
Go
remove redundant config & secret integration tests
ef490e0368a5282ddfe50736d841f721e0c480c9
<ide><path>integration-cli/docker_cli_config_create_test.go <del>// +build !windows <del> <del>package main <del> <del>import ( <del> "io/ioutil" <del> "os" <del> "strings" <del> <del> "github.com/docker/docker/integration-cli/checker" <del> "github.com/go-check/check" <del>) <del> <del>func (s *DockerSwarmSuite) TestConfigCreateWithFile(c *check.C) { <del> d := s.AddDaemon(c, true, true) <del> <del> testFile, err := ioutil.TempFile("", "configCreateTest") <del> c.Assert(err, checker.IsNil) // ensure temp file is created <del> defer os.Remove(testFile.Name()) <del> <del> testData := "TESTINGDATA" <del> _, err = testFile.Write([]byte(testData)) <del> c.Assert(err, checker.IsNil) // ensure temp file is written <del> <del> testName := "test_config" <del> out, err := d.Cmd("config", "create", testName, testFile.Name()) <del> c.Assert(err, checker.IsNil, check.Commentf("%s", out)) <del> c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") <del> <del> id := strings.TrimSpace(out) <del> config := d.GetConfig(c, id) <del> c.Assert(config.Spec.Name, checker.Equals, testName) <del>} <ide><path>integration-cli/docker_cli_secret_create_test.go <del>// +build !windows <del> <del>package main <del> <del>import ( <del> "io/ioutil" <del> "os" <del> "strings" <del> <del> "github.com/docker/docker/integration-cli/checker" <del> "github.com/go-check/check" <del>) <del> <del>func (s *DockerSwarmSuite) TestSecretCreateWithFile(c *check.C) { <del> d := s.AddDaemon(c, true, true) <del> <del> testFile, err := ioutil.TempFile("", "secretCreateTest") <del> c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file")) <del> defer os.Remove(testFile.Name()) <del> <del> testData := "TESTINGDATA" <del> _, err = testFile.Write([]byte(testData)) <del> c.Assert(err, checker.IsNil, check.Commentf("failed to write to temporary file")) <del> <del> testName := "test_secret" <del> out, err := d.Cmd("secret", "create", testName, testFile.Name()) <del> c.Assert(err, checker.IsNil) <del> c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf("%s", out)) <del> <del> id := strings.TrimSpace(out) <del> secret := d.GetSecret(c, id) <del> c.Assert(secret.Spec.Name, checker.Equals, testName) <del>}
2
Python
Python
fix sample_weight for binacc
b96f9fdc2d5d0d375809ad9c16608830b01fc59a
<ide><path>keras/metrics/metrics.py <ide> def binary_accuracy(y_true, y_pred, threshold=0.5): <ide> prediction values are 1 or 0. <ide> <ide> Returns: <del> Binary accuracy values. shape = `[batch_size, d0, .. dN-1]` <add> Binary accuracy values. shape = `[batch_size, d0, .. dN]` <ide> """ <ide> y_pred = tf.convert_to_tensor(y_pred) <ide> threshold = tf.cast(threshold, y_pred.dtype) <ide> y_pred = tf.cast(y_pred > threshold, y_pred.dtype) <del> return backend.mean(tf.equal(y_true, y_pred), axis=-1) <add> return tf.cast(tf.equal(y_true, y_pred), tf.int8) <ide> <ide> <ide> @keras_export('keras.metrics.categorical_accuracy')
1
Go
Go
use global random *rand.rand instance in pkg
51cdcf3c9df04a34945c976cfe2bdbad6fee122a
<ide><path>pkg/namesgenerator/names-generator.go <ide> package namesgenerator <ide> <ide> import ( <ide> "fmt" <del> "math/rand" <ide> <ide> "github.com/docker/docker/pkg/random" <ide> ) <ide> var ( <ide> // Ada Yonath - an Israeli crystallographer, the first woman from the Middle East to win a Nobel prize in the sciences. https://en.wikipedia.org/wiki/Ada_Yonath <ide> "yonath", <ide> } <del> <del> rnd = rand.New(random.NewSource()) <ide> ) <ide> <ide> // GetRandomName generates a random name from the list of adjectives and surnames in this package <ide> // formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random <ide> // integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3` <ide> func GetRandomName(retry int) string { <add> rnd := random.Rand <ide> begin: <ide> name := fmt.Sprintf("%s_%s", left[rnd.Intn(len(left))], right[rnd.Intn(len(right))]) <ide> if name == "boring_wozniak" /* Steve Wozniak is not boring */ { <ide><path>pkg/stringutils/stringutils.go <ide> func GenerateRandomAlphaOnlyString(n int) string { <ide> // make a really long string <ide> letters := []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") <ide> b := make([]byte, n) <del> r := rand.New(random.NewSource()) <ide> for i := range b { <del> b[i] = letters[r.Intn(len(letters))] <add> b[i] = letters[random.Rand.Intn(len(letters))] <ide> } <ide> return string(b) <ide> }
2
Ruby
Ruby
add missing require for `ipaddr`
52a692fed072f9834561ecbeccaea1f6df0d1bf1
<ide><path>actionpack/test/dispatch/host_authorization_test.rb <ide> # frozen_string_literal: true <ide> <ide> require "abstract_unit" <add>require "ipaddr" <ide> <ide> class HostAuthorizationTest < ActionDispatch::IntegrationTest <ide> App = -> env { [200, {}, %w(Success)] }
1
Ruby
Ruby
remove unnecessary comment
4650a7916b94adde2fbc2271ad54692573d2d3de
<ide><path>lib/active_job/queue_adapters/resque_adapter.rb <ide> def queue(job, *args) <ide> end <ide> <ide> def queue_at(job, timestamp, *args) <del> # requires resque-scheduler <ide> Resque.enqueue_at timestamp, JobWrapper.new(job), job, *args <ide> end <ide> end
1
Ruby
Ruby
reduce pathname conversions in #include?
6524dfc17b95c2944829f8264300cf60d49f5250
<ide><path>Library/Homebrew/metafiles.rb <ide> def should_list? file <ide> <ide> private <ide> <del> def include? p <del> p = p.to_s # Might be a pathname <del> p = p.downcase <del> path = Pathname.new(p) <del> if @exts.include? path.extname <del> p = path.basename(path.extname) <add> def include?(path) <add> path = path.to_s.downcase <add> ext = File.extname(path) <add> <add> if EXTENSIONS.include?(ext) <add> file = File.basename(path, ext) <ide> else <del> p = path.basename <add> file = File.basename(path) <ide> end <del> p = p.to_s <del> return @metafiles.include? p <del> end <ide> <add> return @metafiles.include?(file) <add> end <ide> end
1
Javascript
Javascript
throw error when pixels don't match
a21030a5024640738b3ba1069110dc73a5d8858a
<ide><path>src/image.js <ide> var PDFImage = (function pdfImage() { <ide> var opacityPos = 0; <ide> var length = width * height * 4; <ide> <add> // Is there a one-to-one correspondence between pixels in the loop below? <add> if (length !== 4*comps.length/3) <add> error('Number of image pixels mismatch'); <add> <ide> for (var i = 0; i < length; i += 4) { <ide> buffer[i] = comps[compsPos++]; <ide> buffer[i + 1] = comps[compsPos++];
1
PHP
PHP
fix illegal offset caused by translatebehavior
beced84d2d96b7580c78c1243255b683a670de29
<ide><path>lib/Cake/Model/BehaviorCollection.php <ide> public function load($behavior, $config = array()) { <ide> $alias = $behavior; <ide> $behavior = $config['className']; <ide> } <add> $configDisabled = isset($config['enabled']) && $config['enabled'] === false; <add> unset($config['enabled'], $config['className']); <add> <ide> list($plugin, $name) = pluginSplit($behavior, true); <ide> if (!isset($alias)) { <ide> $alias = $name; <ide> public function load($behavior, $config = array()) { <ide> } <ide> } <ide> <del> $configDisabled = isset($config['enabled']) && $config['enabled'] === false; <ide> if (!in_array($alias, $this->_enabled) && !$configDisabled) { <ide> $this->enable($alias); <ide> } elseif ($configDisabled) { <ide><path>lib/Cake/Test/Case/Model/BehaviorCollectionTest.php <ide> class BehaviorCollectionTest extends CakeTestCase { <ide> */ <ide> public $fixtures = array( <ide> 'core.apple', 'core.sample', 'core.article', 'core.user', 'core.comment', <del> 'core.attachment', 'core.tag', 'core.articles_tag' <add> 'core.attachment', 'core.tag', 'core.articles_tag', 'core.translate' <ide> ); <ide> <add>/** <add> * Test load() with enabled => false <add> * <add> */ <add> public function testLoadDisabled() { <add> $Apple = new Apple(); <add> $this->assertSame($Apple->Behaviors->attached(), array()); <add> <add> $Apple->Behaviors->load('Translate', array('enabled' => false)); <add> $this->assertTrue($Apple->Behaviors->attached('Translate')); <add> $this->assertFalse($Apple->Behaviors->enabled('Translate')); <add> } <add> <ide> /** <ide> * Tests loading aliased behaviors <ide> */
2
PHP
PHP
apply fixes from styleci
e045e7df6e407428534a914caa8ae58db53ca5b9
<ide><path>src/Illuminate/Console/Scheduling/CallbackEvent.php <ide> public function run(Container $container) <ide> return; <ide> } <ide> <del> register_shutdown_function(function() { <add> register_shutdown_function(function () { <ide> $this->removeMutex(); <ide> }); <ide>
1
Python
Python
check all deprecation messages in airflow.contrib
75790d8cc46b3482203619cd06bebae74e5837f7
<ide><path>airflow/contrib/utils/log/__init__.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> """ <del>This module is deprecated. Please use `airflow.utils.log`. <add>This package is deprecated. Please use `airflow.utils.log`. <ide> """ <ide> <ide> import warnings <ide><path>tests/test_project_structure.py <ide> def test_reference_to_providers_from_core(self): <ide> self.assert_file_not_contains(filename, "providers") <ide> <ide> def test_deprecated_packages(self): <del> for directory in ["hooks", "operators", "secrets", "sensors", "task_runner"]: <del> path_pattern = f"{ROOT_FOLDER}/airflow/contrib/{directory}/*.py" <del> <del> for filename in glob.glob(path_pattern, recursive=True): <del> if filename.endswith("/__init__.py"): <del> self.assert_file_contains(filename, "This package is deprecated.") <del> else: <del> self.assert_file_contains(filename, "This module is deprecated.") <add> path_pattern = f"{ROOT_FOLDER}/airflow/contrib/**/*.py" <add> <add> for filename in glob.glob(path_pattern, recursive=True): <add> if filename.endswith("/__init__.py"): <add> self.assert_file_contains(filename, "This package is deprecated.") <add> else: <add> self.assert_file_contains(filename, "This module is deprecated.") <ide> <ide> def assert_file_not_contains(self, filename: str, pattern: str): <ide> with open(filename, 'rb', 0) as file, mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as content:
2
Text
Text
use badges from shields.io
39a6e86e39a141fb6847605f968b129b6f72f7ba
<ide><path>README.md <ide> [![webpack](http://webpack.github.io/assets/logo.png)](http://webpack.github.io) <ide> <del>[![NPM version](https://badge.fury.io/js/webpack.png)](http://badge.fury.io/js/webpack) [![Gitter chat](http://img.shields.io/gitter/webpack/webpack.png)](https://gitter.im/webpack/webpack) [![Gittip donate button](http://img.shields.io/gittip/sokra.png)](https://www.gittip.com/sokra/) <add>[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Gittip donate button][gittip-image]][gittip-url] <ide> <ide> [documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top) <ide> <ide> function loadTemplateAsync (name, callback) { <ide> <ide> ## Tests <ide> <del>You can run the Node tests with `npm test`. [![build status (linux)](https://secure.travis-ci.org/webpack/webpack.png)](http://travis-ci.org/webpack/webpack) [![Build status (windows)](https://ci.appveyor.com/api/projects/status/vatlasj366jiyuh6/branch/master)](https://ci.appveyor.com/project/sokra/webpack/branch/master) <add>You can run the Node tests with `npm test`. [![Build status (linux)][travis-image]][travis-url] [![Build status (windows)][appveyor-image]][appveyor-url] [![Test coverage][coveralls-image]][coveralls-url] <ide> <ide> You can run the browser tests: <ide> <ide> This is a free-time project. The time I invest in it fluctuates. If you use webp <ide> <ide> I'm very thankful for every dollar. If you leave your username or email, I may show my thanks by giving you extra support. <ide> <del>[![Donate to sokra](http://img.shields.io/donate/sokra.png)](http://sokra.github.io/) <add>[![Donate to sokra][donate-image]][donate-url] <ide> <ide> <ide> ## Dependencies <ide> I'm very thankful for every dollar. If you leave your username or email, I may s <ide> * [mkdirp](https://github.com/substack/node-mkdirp) <ide> * [clone](https://github.com/pvorb/node-clone) <ide> <del>[![Dependency Status](https://david-dm.org/webpack/webpack.png)](https://david-dm.org/webpack/webpack) <add>[![Dependency status][david-image]][david-url] <add> <add>[travis-url]: http://travis-ci.org/webpack/webpack <add>[travis-image]: https://img.shields.io/travis/webpack/webpack.svg <add>[appveyor-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master <add>[appveyor-image]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true <add>[coveralls-url]: https://coveralls.io/r/webpack/webpack/ <add>[coveralls-image]: https://img.shields.io/coveralls/webpack/webpack.svg <add>[npm-url]: https://npmjs.org/package/webpack <add>[npm-image]: https://img.shields.io/npm/v/webpack.svg <add>[david-url]: https://david-dm.org/webpack/webpack <add>[david-image]: https://img.shields.io/david/webpack/webpack.svg <add>[donate-url]: http://sokra.github.io/ <add>[donate-image]: https://img.shields.io/badge/donate-sokra-brightgreen.svg <add>[gittip-url]: https://www.gittip.com/sokra/ <add>[gittip-image]: http://img.shields.io/gittip/sokra.svg <add>[gitter-url]: https://gitter.im/webpack/webpack <add>[gitter-image]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
1
Text
Text
replace repl.it with replit.com
d8ca6db29e5c67d317522bfa0bce578b47f393bf
<ide><path>curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/exercise-tracker.md <ide> dashedName: exercise-tracker <ide> Build a full stack JavaScript app that is functionally similar to this: <https://exercise-tracker.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-exercisetracker) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.md <ide> dashedName: file-metadata-microservice <ide> Build a full stack JavaScript app that is functionally similar to this: <https://file-metadata-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-filemetadata) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.md <ide> dashedName: request-header-parser-microservice <ide> Build a full stack JavaScript app that is functionally similar to this: <https://request-header-parser-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-headerparser/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-headerparser) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/timestamp-microservice.md <ide> dashedName: timestamp-microservice <ide> Build a full stack JavaScript app that is functionally similar to this: <https://timestamp-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-timestamp) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice.md <ide> dashedName: url-shortener-microservice <ide> Build a full stack JavaScript app that is functionally similar to this: <https://url-shortener-microservice.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-urlshortener/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-urlshortener) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/meet-the-node-console.md <ide> dashedName: meet-the-node-console <ide> Working on these challenges will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-express/) and complete these challenges locally. <del>- Use [our Repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-express) to complete these challenges. <add>- Use [our Replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-express) to complete these challenges. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. <ide> <ide> During the development process, it is important to be able to check what’s going on in your code. <ide> <del>Node is just a JavaScript environment. Like client side JavaScript, you can use the console to display useful debug information. On your local machine, you would see console output in a terminal. On Repl.it, a terminal is open in the right pane by default. <add>Node is just a JavaScript environment. Like client side JavaScript, you can use the console to display useful debug information. On your local machine, you would see console output in a terminal. On Replit.com, a terminal is open in the right pane by default. <ide> <ide> We recommend to keep the terminal open while working at these challenges. By reading the output in the terminal, you can see any errors that may occur. <ide> <ide><path>curriculum/challenges/english/05-apis-and-microservices/basic-node-and-express/start-a-working-express-server.md <ide> will serve the string 'Response String'. <ide> <ide> # --instructions-- <ide> <del>Use the `app.get()` method to serve the string "Hello Express" to GET requests matching the `/` (root) path. Be sure that your code works by looking at the logs, then see the results in the preview if you are using Repl.it. <add>Use the `app.get()` method to serve the string "Hello Express" to GET requests matching the `/` (root) path. Be sure that your code works by looking at the logs, then see the results in the preview if you are using Replit.com. <ide> <ide> **Note:** All the code for these lessons should be added in between the few lines of code we have started you off with. <ide> <ide><path>curriculum/challenges/english/05-apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package.md <ide> dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-packa <ide> Working on these challenges will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-npm/) and complete these challenges locally. <del>- Use [our Repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-npm) to complete these challenges. <add>- Use [our Replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-npm) to complete these challenges. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/05-apis-and-microservices/mongodb-and-mongoose/create-a-model.md <ide> dashedName: create-a-model <ide> <ide> First of all we need a Schema. Each schema maps to a MongoDB collection. It defines the shape of the documents within that collection. Schemas are building block for Models. They can be nested to create complex models, but in this case we'll keep things simple. A model allows you to create instances of your objects, called documents. <ide> <del>Repl.it is a real server, and in real servers the interactions with the database happen in handler functions. These functions are executed when some event happens (e.g. someone hits an endpoint on your API). We’ll follow the same approach in these exercises. The `done()` function is a callback that tells us that we can proceed after completing an asynchronous operation such as inserting, searching, updating, or deleting. It's following the Node convention, and should be called as `done(null, data)` on success, or `done(err)` on error. <add>Replit.com is a real server, and in real servers the interactions with the database happen in handler functions. These functions are executed when some event happens (e.g. someone hits an endpoint on your API). We’ll follow the same approach in these exercises. The `done()` function is a callback that tells us that we can proceed after completing an asynchronous operation such as inserting, searching, updating, or deleting. It's following the Node convention, and should be called as `done(null, data)` on success, or `done(err)` on error. <ide> <ide> Warning - When interacting with remote services, errors may occur! <ide> <ide><path>curriculum/challenges/english/05-apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose.md <ide> dashedName: install-and-set-up-mongoose <ide> Working on these challenges will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-mongomongoose/) and complete these challenges locally. <del>- Use [our Repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-mongomongoose) to complete these challenges. <add>- Use [our Replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose) to complete these challenges. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. <ide><path>curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/implementation-of-social-authentication.md <ide> The basic path this kind of authentication will follow in your app is: <ide> <ide> Strategies with OAuth require you to have at least a *Client ID* and a *Client Secret* which is a way for the service to verify who the authentication request is coming from and if it is valid. These are obtained from the site you are trying to implement authentication with, such as GitHub, and are unique to your app--**THEY ARE NOT TO BE SHARED** and should never be uploaded to a public repository or written directly in your code. A common practice is to put them in your `.env` file and reference them like so: `process.env.GITHUB_CLIENT_ID`. For this challenge we're going to use the GitHub strategy. <ide> <del>Obtaining your *Client ID and Secret* from GitHub is done in your account profile settings under 'developer settings', then '[OAuth applications](https://github.com/settings/developers)'. Click 'Register a new application', name your app, paste in the url to your Repl.it homepage (**Not the project code's url**), and lastly, for the callback url, paste in the same url as the homepage but with `/auth/github/callback` added on. This is where users will be redirected for us to handle after authenticating on GitHub. Save the returned information as `'GITHUB_CLIENT_ID'` and `'GITHUB_CLIENT_SECRET'` in your `.env` file. <add>Obtaining your *Client ID and Secret* from GitHub is done in your account profile settings under 'developer settings', then '[OAuth applications](https://github.com/settings/developers)'. Click 'Register a new application', name your app, paste in the url to your Replit.com homepage (**Not the project code's url**), and lastly, for the callback url, paste in the same url as the homepage but with `/auth/github/callback` added on. This is where users will be redirected for us to handle after authenticating on GitHub. Save the returned information as `'GITHUB_CLIENT_ID'` and `'GITHUB_CLIENT_SECRET'` in your `.env` file. <ide> <ide> In your `routes.js` file, add `showSocialAuth: true` to the homepage route, after `showRegistration: true`. Now, create 2 routes accepting GET requests: `/auth/github` and `/auth/github/callback`. The first should only call passport to authenticate `'github'`. The second should call passport to authenticate `'github'` with a failure redirect to `/`, and then if that is successful redirect to `/profile` (similar to our last project). <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/set-up-a-template-engine.md <ide> dashedName: set-up-a-template-engine <ide> Working on these challenges will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-advancednode/) and complete these challenges locally. <del>- Use [our Repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-advancednode) to complete these challenges. <add>- Use [our Replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-advancednode) to complete these challenges. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.md <ide> dashedName: assert-deep-equality-with--deepequal-and--notdeepequal <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `deepEqual()` asserts that two objects are deep equal. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/compare-the-properties-of-two-elements.md <ide> dashedName: compare-the-properties-of-two-elements <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/learn-how-javascript-assertions-work.md <ide> dashedName: learn-how-javascript-assertions-work <ide> Working on these challenges will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-mochachai/) and complete these challenges locally. <del>- Use [our Repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-mochachai) to complete these challenges. <add>- Use [our Replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-mochachai) to complete these challenges. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method.md <ide> dashedName: run-functional-tests-on-an-api-response-using-chai-http-iii---put-me <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> In the next example we'll see how to send data in a request payload (body). We are going to test a PUT request. The `'/travellers'` endpoint accepts a JSON object taking the structure: <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method.md <ide> dashedName: run-functional-tests-on-an-api-response-using-chai-http-iv---put-met <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). This exercise is similar to the preceding one. Look at it for the details. <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). This exercise is similar to the preceding one. Look at it for the details. <ide> <ide> Now that you have seen how it is done, it is your turn to do it from scratch. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http-ii.md <ide> dashedName: run-functional-tests-on-api-endpoints-using-chai-http-ii <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http.md <ide> dashedName: run-functional-tests-on-api-endpoints-using-chai-http <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> Mocha allows testing asyncronous operations. There is a small (BIG) difference. Can you spot it? <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii.md <ide> dashedName: run-functional-tests-using-a-headless-browser-ii <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser.md <ide> dashedName: run-functional-tests-using-a-headless-browser <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> In the HTML main view we provided a input form. It sends data to the `PUT /travellers` endpoint that we used above with an Ajax request. When the request successfully completes, the client code appends a `<div>` containing the info returned by the call to the DOM. Here is an example of how to interact with this form: <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/simulate-actions-using-a-headless-browser.md <ide> dashedName: simulate-actions-using-a-headless-browser <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> In the next challenges we are going to simulate the human interaction with a page using a device called 'Headless Browser'. <ide> <ide> A headless browser is a web browser without a graphical user interface. This kind of tool is particularly useful for testing web pages, as it is able to render and understand HTML, CSS, and JavaScript the same way a browser would. <ide> <del>For these challenges we are using Zombie.JS. It's a lightweight browser which is totally based on JS, without relying on additional binaries to be installed. This feature makes it usable in an environment such as Repl.it. There are many other (more powerful) options. <add>For these challenges we are using Zombie.JS. It's a lightweight browser which is totally based on JS, without relying on additional binaries to be installed. This feature makes it usable in an environment such as Replit.com. There are many other (more powerful) options. <ide> <ide> Mocha allows you to prepare the ground running some code before the actual tests. This can be useful for example to create items in the database, which will be used in the successive tests. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-for-truthiness.md <ide> dashedName: test-for-truthiness <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `isTrue()` will test for the boolean value `true` and `isNotTrue()` will pass when given anything but the boolean value of `true`. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-string-contains-a-substring.md <ide> dashedName: test-if-a-string-contains-a-substring <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `include()` and `notInclude()` work for strings too! `include()` asserts that the actual string contains the expected substring. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-falls-within-a-specific-range.md <ide> dashedName: test-if-a-value-falls-within-a-specific-range <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> ```javascript <ide> .approximately(actual, expected, delta, [message]) <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-a-string.md <ide> dashedName: test-if-a-value-is-a-string <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `isString` or `isNotString` asserts that the actual value is a string. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-an-array.md <ide> dashedName: test-if-a-value-is-an-array <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-value-is-of-a-specific-data-structure-type.md <ide> dashedName: test-if-a-value-is-of-a-specific-data-structure-type <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `#typeOf` asserts that value's type is the given string, as determined by `Object.prototype.toString`. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-a-variable-or-function-is-defined.md <ide> dashedName: test-if-a-variable-or-function-is-defined <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-array-contains-an-item.md <ide> dashedName: test-if-an-array-contains-an-item <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-has-a-property.md <ide> dashedName: test-if-an-object-has-a-property <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `property` asserts that the actual object has a given property. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-an-object-is-an-instance-of-a-constructor.md <ide> dashedName: test-if-an-object-is-an-instance-of-a-constructor <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `#instanceOf` asserts that an object is an instance of a constructor. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md <ide> dashedName: test-if-one-value-is-below-or-at-least-as-large-as-another <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/use-assert.isok-and-assert.isnotok.md <ide> dashedName: use-assert-isok-and-assert-isnotok <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `isOk()` will test for a truthy value, and `isNotOk()` will test for a falsy value. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/use-regular-expressions-to-test-a-string.md <ide> dashedName: use-regular-expressions-to-test-a-string <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `match()` asserts that the actual value matches the second argument regular expression. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-double-equals-to-assert-equality.md <ide> dashedName: use-the-double-equals-to-assert-equality <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `equal()` compares objects using `==`. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-and-testing-with-chai/use-the-triple-equals-to-assert-strict-equality.md <ide> dashedName: use-the-triple-equals-to-assert-strict-equality <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). <ide> <ide> `strictEqual()` compares objects using `===`. <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/american-british-translator.md <ide> dashedName: american-british-translator <ide> Build a full stack JavaScript app that is functionally similar to this: <https://american-british-translator.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-american-british-english-translator/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-american-british-english-translator) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-american-british-english-translator) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide> When you are done, make sure a working demo of your project is hosted somewhere <ide> - Complete the `/api/translate` route in `/routes/api.js` <ide> - Create all of the unit/functional tests in `tests/1_unit-tests.js` and `tests/2_functional-tests.js` <ide> - See the JavaScript files in `/components` for the different spelling and terms your application should translate <del>- To run the tests on Repl.it, set `NODE_ENV` to `test` without quotes in the `.env` file <del>- To run the tests in the console, use the command `npm run test`. To open the Repl.it console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <add>- To run the tests on Replit.com, set `NODE_ENV` to `test` without quotes in the `.env` file <add>- To run the tests in the console, use the command `npm run test`. To open the Replit.com console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <ide> <ide> Write the following tests in `tests/1_unit-tests.js`: <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/issue-tracker.md <ide> dashedName: issue-tracker <ide> Build a full stack JavaScript app that is functionally similar to this: <https://issue-tracker.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-issuetracker/) and complete your project locally. <del>- Use [this repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-issuetracker) to complete your project. <add>- Use [this replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-issuetracker) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide> When you are done, make sure a working demo of your project is hosted somewhere <ide> - Create all of the functional tests in `tests/2_functional-tests.js` <ide> - Copy the `sample.env` file to `.env` and set the variables appropriately <ide> - To run the tests uncomment `NODE_ENV=test` in your `.env` file <del>- To run the tests in the console, use the command `npm run test`. To open the Repl.it console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <add>- To run the tests in the console, use the command `npm run test`. To open the Replit.com console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <ide> <ide> Write the following tests in `tests/2_functional-tests.js`: <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md <ide> dashedName: metric-imperial-converter <ide> Build a full stack JavaScript app that is functionally similar to this: <https://metric-imperial-converter.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-metricimpconverter) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-metricimpconverter) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide> When you are done, make sure a working demo of your project is hosted somewhere <ide> - Complete the necessary routes in `/routes/api.js` <ide> - Copy the `sample.env` file to `.env` and set the variables appropriately <ide> - To run the tests uncomment `NODE_ENV=test` in your `.env` file <del>- To run the tests in the console, use the command `npm run test`. To open the Repl.it console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <add>- To run the tests in the console, use the command `npm run test`. To open the Replit.com console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <ide> <ide> Write the following tests in `tests/1_unit-tests.js`: <ide> <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/personal-library.md <ide> dashedName: personal-library <ide> Build a full stack JavaScript app that is functionally similar to this: <https://personal-library.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-library) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-library)) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-library)) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/sudoku-solver.md <ide> dashedName: sudoku-solver <ide> Build a full stack JavaScript app that is functionally similar to this: <https://sudoku-solver.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freecodecamp/boilerplate-project-sudoku-solver) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-sudoku-solver) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-sudoku-solver) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide> When you are done, make sure a working demo of your project is hosted somewhere <ide> - All routing logic can go into `/routes/api.js` <ide> - See the `puzzle-strings.js` file in `/controllers` for some sample puzzles your application should solve <ide> - To run the challenge tests on this page, set `NODE_ENV` to `test` without quotes in the `.env` file <del>- To run the tests in the console, use the command `npm run test`. To open the Repl.it console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <add>- To run the tests in the console, use the command `npm run test`. To open the Replit.com console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell" <ide> <ide> Write the following tests in `tests/1_unit-tests.js`: <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md <ide> dashedName: arithmetic-formatter <ide> <ide> Create a function that receives a list of strings that are arithmetic problems and returns the problems arranged vertically and side-by-side. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-arithmetic-formatter). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/budget-app.md <ide> dashedName: budget-app <ide> <ide> Create a "Category" class that can be used to create different budget categories. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-budget-app). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-budget-app). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/polygon-area-calculator.md <ide> dashedName: polygon-area-calculator <ide> <ide> In this project you will use object oriented programming to create a Rectangle class and a Square class. The Square class should be a subclass of Rectangle and inherit methods and attributes. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-polygon-area-calculator). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-polygon-area-calculator). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md <ide> dashedName: probability-calculator <ide> <ide> Write a program to determine the approximate probability of drawing certain balls randomly from a hat. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-probability-calculator). After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-probability-calculator). After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project: <ide> <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator.md <ide> dashedName: time-calculator <ide> <ide> Write a function named "add_time" that can add a duration to a start time and return the result. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-time-calculator). After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-time-calculator). After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project: <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.md <ide> dashedName: demographic-data-analyzer <ide> <ide> In this challenge you must analyze demographic data using Pandas. You are given a dataset of demographic data that was extracted from the 1994 Census database. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-demographic-data-analyzer). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/mean-variance-standard-deviation-calculator.md <ide> dashedName: mean-variance-standard-deviation-calculator <ide> <ide> Create a function that uses Numpy to output the mean, variance, and standard deviation of the rows, columns, and elements in a 3 x 3 matrix. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-mean-variance-standard-deviation-calculator). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-mean-variance-standard-deviation-calculator). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md <ide> dashedName: medical-data-visualizer <ide> <ide> In this project, you will visualize and make calculations from medical examination data using matplotlib, seaborn, and pandas. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-medical-data-visualizer). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-medical-data-visualizer). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md <ide> dashedName: page-view-time-series-visualizer <ide> <ide> For this project you will visualize time series data using a line chart, bar chart, and box plots. You will use Pandas, matplotlib, and seaborn to visualize a dataset containing the number of page views each day on the freeCodeCamp.org forum from 2016-05-09 to 2019-12-03. The data visualizations will help you understand the patterns in visits and identify yearly and monthly growth. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md <ide> dashedName: sea-level-predictor <ide> <ide> In this project, you will analyze a dataset of the global average sea level change since 1880. You will use the data to predict the sea level change through year 2050. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-sea-level-predictor). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-sea-level-predictor). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/anonymous-message-board.md <ide> Build a full stack JavaScript app that is functionally similar to this: <https:/ <ide> Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-messageboard/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-messageboard) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-messageboard) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/port-scanner.md <ide> dashedName: port-scanner <ide> <ide> Create a port scanner using Python. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-port-scanner). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-port-scanner). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/secure-real-time-multiplayer-game.md <ide> dashedName: secure-real-time-multiplayer-game <ide> Develop a 2D real time multiplayer game using the HTML Canvas API and [Socket.io](https://socket.io/) that is functionally similar to this: <https://secure-real-time-multiplayer-game.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/sha-1-password-cracker.md <ide> dashedName: sha-1-password-cracker <ide> <ide> For this project you will learn about the importance of good security by creating a password cracker to figure out passwords that were hashed using SHA-1. <ide> <del>You can access [the full project description and starter code on Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-SHA-1-password-cracker). <add>You can access [the full project description and starter code on Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/stock-price-checker.md <ide> Since all reliable stock price APIs require an API key, we've built a workaround <ide> Working on this project will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-stockchecker/) and complete your project locally. <del>- Use [our repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-project-stockchecker) to complete your project. <add>- Use [our replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-stockchecker) to complete your project. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your projects source code in the `GitHub Link` field. <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/ask-browsers-to-access-your-site-via-https-only-with-helmet.hsts.md <ide> dashedName: ask-browsers-to-access-your-site-via-https-only-with-helmet-hsts <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> HTTP Strict Transport Security (HSTS) is a web security policy which helps to protect websites against protocol downgrade attacks and cookie hijacking. If your website can be accessed via HTTPS you can ask user’s browsers to avoid using insecure HTTP. By setting the header Strict-Transport-Security, you tell the browsers to use HTTPS for the future requests in a specified amount of time. This will work for the requests coming after the initial request. <ide> <ide> # --instructions-- <ide> <del>Configure `helmet.hsts()` to use HTTPS for the next 90 days. Pass the config object `{maxAge: timeInSeconds, force: true}`. You can create a variable `ninetyDaysInSeconds = 90*24*60*60;` to use for the `timeInSeconds`. Repl.it already has hsts enabled. To override its settings you need to set the field "force" to true in the config object. We will intercept and restore the Repl.it header, after inspecting it for testing. <add>Configure `helmet.hsts()` to use HTTPS for the next 90 days. Pass the config object `{maxAge: timeInSeconds, force: true}`. You can create a variable `ninetyDaysInSeconds = 90*24*60*60;` to use for the `timeInSeconds`. Replit.com already has hsts enabled. To override its settings you need to set the field "force" to true in the config object. We will intercept and restore the Replit.com header, after inspecting it for testing. <ide> <ide> Note: Configuring HTTPS on a custom website requires the acquisition of a domain, and a SSL/TLS Certificate. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/avoid-inferring-the-response-mime-type-with-helmet.nosniff.md <ide> dashedName: avoid-inferring-the-response-mime-type-with-helmet-nosniff <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). Browsers can use content or MIME sniffing to override response `Content-Type` headers to guess and process the data using an implicit content type. While this can be convenient in some scenarios, it can also lead to some dangerous attacks. This middleware sets the X-Content-Type-Options header to `nosniff`, instructing the browser to not bypass the provided `Content-Type`. <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). Browsers can use content or MIME sniffing to override response `Content-Type` headers to guess and process the data using an implicit content type. While this can be convenient in some scenarios, it can also lead to some dangerous attacks. This middleware sets the X-Content-Type-Options header to `nosniff`, instructing the browser to not bypass the provided `Content-Type`. <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/configure-helmet-using-the-parent-helmet-middleware.md <ide> dashedName: configure-helmet-using-the-parent-helmet-middleware <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> `app.use(helmet())` will automatically include all the middleware introduced above, except `noCache()`, and `contentSecurityPolicy()`, but these can be enabled if necessary. You can also disable or configure any other middleware individually, using a configuration object. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.md <ide> dashedName: disable-client-side-caching-with-helmet-nocache <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> If you are releasing an update for your website, and you want the users to always download the newer version, you can (try to) disable caching on client’s browser. It can be useful in development too. Caching has performance benefits, which you will lose, so only use this option when there is a real need. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/disable-dns-prefetching-with-helmet.dnsprefetchcontrol.md <ide> dashedName: disable-dns-prefetching-with-helmet-dnsprefetchcontrol <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> To improve performance, most browsers prefetch DNS records for the links in a page. In that way the destination ip is already known when the user clicks on a link. This may lead to over-use of the DNS service (if you own a big website, visited by millions people…), privacy issues (one eavesdropper could infer that you are on a certain page), or page statistics alteration (some links may appear visited even if they are not). If you have high security needs you can disable DNS prefetching, at the cost of a performance penalty. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously.md <ide> dashedName: hash-and-compare-passwords-asynchronously <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-bcrypt), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-bcrypt), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). <ide> <ide> As hashing is designed to be computationally intensive, it is recommended to do so asynchronously on your server as to avoid blocking incoming connections while you hash. All you have to do to hash a password asynchronous is call <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/hash-and-compare-passwords-synchronously.md <ide> dashedName: hash-and-compare-passwords-synchronously <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-bcrypt), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-bcrypt), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). <ide> <ide> Hashing synchronously is just as easy to do but can cause lag if using it server side with a high cost or with hashing done very often. Hashing with this method is as easy as calling <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/hide-potentially-dangerous-information-using-helmet.hidepoweredby.md <ide> dashedName: hide-potentially-dangerous-information-using-helmet-hidepoweredby <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> Hackers can exploit known vulnerabilities in Express/Node if they see that your site is powered by Express. `X-Powered-By: Express` is sent in every request coming from Express by default. Use the `helmet.hidePoweredBy()` middleware to remove the X-Powered-By header. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/install-and-require-helmet.md <ide> dashedName: install-and-require-helmet <ide> Working on these challenges will involve you writing your code using one of the following methods: <ide> <ide> - Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-infosec/) and complete these challenges locally. <del>- Use [our Repl.it starter project](https://repl.it/github/freeCodeCamp/boilerplate-infosec) to complete these challenges. <add>- Use [our Replit.com starter project](https://replit.com/github/freeCodeCamp/boilerplate-infosec) to complete these challenges. <ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo. <ide> <ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-clickjacking-with-helmet.frameguard.md <ide> dashedName: mitigate-the-risk-of-clickjacking-with-helmet-frameguard <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> Your page could be put in a `<frame>` or `<iframe>` without your consent. This can result in clickjacking attacks, among other things. Clickjacking is a technique of tricking a user into interacting with a page different from what the user thinks it is. This can be obtained executing your page in a malicious context, by mean of iframing. In that context a hacker can put a hidden layer over your page. Hidden buttons can be used to run bad scripts. This middleware sets the X-Frame-Options header. It restricts who can put your site in a frame. It has three modes: DENY, SAMEORIGIN, and ALLOW-FROM. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet.xssfilter.md <ide> dashedName: mitigate-the-risk-of-cross-site-scripting-xss-attacks-with-helmet-xs <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> Cross-site scripting (XSS) is a frequent type of attack where malicious scripts are injected into vulnerable pages, with the purpose of stealing sensitive data like session cookies, or passwords. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/prevent-ie-from-opening-untrusted-html-with-helmet.ienoopen.md <ide> dashedName: prevent-ie-from-opening-untrusted-html-with-helmet-ienoopen <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> Some web applications will serve untrusted HTML for download. Some versions of Internet Explorer by default open those HTML files in the context of your site. This means that an untrusted HTML page could start doing bad things in the context of your pages. This middleware sets the X-Download-Options header to noopen. This will prevent IE users from executing downloads in the trusted site’s context. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/set-a-content-security-policy-with-helmet.contentsecuritypolicy.md <ide> dashedName: set-a-content-security-policy-with-helmet-contentsecuritypolicy <ide> <ide> # --description-- <ide> <del>As a reminder, this project is being built upon the following starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <add>As a reminder, this project is being built upon the following starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-infosec), or cloned from [GitHub](https://github.com/freeCodeCamp/boilerplate-infosec/). <ide> <ide> This challenge highlights one promising new defense that can significantly reduce the risk and impact of many type of attacks in modern browsers. By setting and configuring a Content Security Policy you can prevent the injection of anything unintended into your page. This will protect your app from XSS vulnerabilities, undesired tracking, malicious frames, and much more. CSP works by defining an allowed list of content sources which are trusted. You can configure them for each kind of resource a web page may need (scripts, stylesheets, fonts, frames, media, and so on…). There are multiple directives available, so a website owner can have a granular control. See HTML 5 Rocks, KeyCDN for more details. Unfortunately CSP is unsupported by older browser. <ide> <ide><path>curriculum/challenges/english/09-information-security/information-security-with-helmetjs/understand-bcrypt-hashes.md <ide> dashedName: understand-bcrypt-hashes <ide> <ide> # --description-- <ide> <del>For the following challenges, you will be working with a new starter project that is different from the previous one. You can find the new starter project on [Repl.it](https://repl.it/github/freeCodeCamp/boilerplate-bcrypt), or clone it from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). <add>For the following challenges, you will be working with a new starter project that is different from the previous one. You can find the new starter project on [Replit.com](https://replit.com/github/freeCodeCamp/boilerplate-bcrypt), or clone it from [GitHub](https://github.com/freeCodeCamp/boilerplate-bcrypt/). <ide> <ide> BCrypt hashes are very secure. A hash is basically a fingerprint of the original data- always unique. This is accomplished by feeding the original data into an algorithm and returning a fixed length result. To further complicate this process and make it more secure, you can also *salt* your hash. Salting your hash involves adding random data to the original data before the hashing process which makes it even harder to crack the hash. <ide> <ide><path>curriculum/challenges/english/10-coding-interview-prep/take-home-projects/build-a-pinterest-clone.md <ide> dashedName: build-a-pinterest-clone <ide> <ide> # --description-- <ide> <del>**Objective:** Build a [Repl.it](https://repl.it/) app that is functionally similar to this: <https://build-a-pinterest-clone.freecodecamp.rocks/>. <add>**Objective:** Build a [Replit.com](https://replit.com/) app that is functionally similar to this: <https://build-a-pinterest-clone.freecodecamp.rocks/>. <ide> <ide> Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. <ide> <ide><path>curriculum/challenges/english/10-coding-interview-prep/take-home-projects/manage-a-book-trading-club.md <ide> dashedName: manage-a-book-trading-club <ide> <ide> # --description-- <ide> <del>**Objective:** Build a [Repl.it](https://repl.it/) app that is functionally similar to this: <https://manage-a-book-trading-club.freecodecamp.rocks/>. <add>**Objective:** Build a [Replit.com](https://replit.com/) app that is functionally similar to this: <https://manage-a-book-trading-club.freecodecamp.rocks/>. <ide> <ide> Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. <ide> <ide><path>curriculum/challenges/english/10-coding-interview-prep/take-home-projects/p2p-video-chat-application.md <ide> dashedName: p2p-video-chat-application <ide> <ide> # --description-- <ide> <del>**Objective:** Build a [Repl.it](https://repl.it/) app that is functionally similar to this: <https://p2p-video-chat-application.freecodecamp.rocks/>. <add>**Objective:** Build a [Replit.com](https://replit.com/) app that is functionally similar to this: <https://p2p-video-chat-application.freecodecamp.rocks/>. <ide> <ide> Fulfill the below [user stories](https://en.wikipedia.org/wiki/User_story). Use whichever libraries or APIs you need. Give it your own personal style. <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md <ide> dashedName: rock-paper-scissors <ide> <ide> For this challenge, you will create a program to play Rock, Paper, Scissors. A program that picks at random will usually win 50% of the time. To pass this challenge your program must play matches against four different bots, winning at least 60% of the games in each match. <ide> <del>You can access [the full project description and starter code on repl.it](https://repl.it/github/freeCodeCamp/boilerplate-rock-paper-scissors). <add>You can access [the full project description and starter code on replit.com](https://replit.com/github/freeCodeCamp/boilerplate-rock-paper-scissors). <ide> <ide> After going to that link, fork the project. Once you complete the project based on the instructions in 'README.md', submit your project link below. <ide>
75
Text
Text
fix atom engine semver in upgrading docs
4361b672148ed73a643031c9131b52198450bc0b
<ide><path>docs/upgrading/upgrading-your-package.md <ide> When you are deprecation free and all done converting, upgrade the `engines` fie <ide> ```json <ide> { <ide> "engines": { <del> "atom": ">=0.174.0, <2.0.0" <add> "atom": ">=0.174.0 <2.0.0" <ide> } <ide> } <ide> ```
1
Ruby
Ruby
use capture instead of yield in link_to_unless
e13e8dcf44fd27332ecd4e5c943d3d09efb58c96
<ide><path>actionpack/lib/action_view/helpers/url_helper.rb <ide> def link_to_unless_current(name, options = {}, html_options = {}, &block) <ide> def link_to_unless(condition, name, options = {}, html_options = {}, &block) <ide> if condition <ide> if block_given? <del> block.arity <= 1 ? yield(name) : yield(name, options, html_options) <add> block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block) <ide> else <ide> name <ide> end
1
Text
Text
add thanks for the react org
5ce1fea75ae39972ea4ee646b5899044fde4aa8d
<ide><path>docs/acknowledgements.md <ide> We'd like to thank all of our contributors: <ide> {% endfor %} <ide> </div> <ide> <del>In addition, we're grateful to [Jeff Barczewski](https://github.com/jeffbski) for allowing us to use the [react](https://www.npmjs.com/package/react) package name on npm and to [Christopher Aue](http://christopheraue.net/) for letting us use the [reactjs.com](http://reactjs.com/) domain name and the [@reactjs](https://twitter.com/reactjs) username on Twitter. We'd also like to thank [ProjectMoon](https://github.com/ProjectMoon) for letting us use the [flux](https://www.npmjs.com/package/flux) package name on npm. <add>In addition, we're grateful to <add> - [Jeff Barczewski](https://github.com/jeffbski) for allowing us to use the [react](https://www.npmjs.com/package/react) package name on npm. <add> - [Christopher Aue](http://christopheraue.net/) for letting us use the [reactjs.com](http://reactjs.com/) domain name and the [@reactjs](https://twitter.com/reactjs) username on Twitter. <add> - [ProjectMoon](https://github.com/ProjectMoon) for letting us use the [flux](https://www.npmjs.com/package/flux) package name on npm. <add> - Shane Anderson for allowing us to use the [react](https://github.com/react) org on GitHub.
1
Javascript
Javascript
run eslint --fix
a093cfa158c741b8b86f4a4ec017a715650e9dbf
<ide><path>test/configCases/plugins/define-plugin/webpack.config.js <ide> module.exports = { <ide> "typeof suppe": "typeof wurst", <ide> wurst: "suppe", <ide> suppe: "wurst", <del> RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE: DefinePlugin.runtimeValue(function(currentModule) { <del> return typeof currentModule === 'object'; <del> }) <add> RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE: DefinePlugin.runtimeValue( <add> function(currentModule) { <add> return typeof currentModule === "object"; <add> } <add> ) <ide> }) <ide> ] <ide> };
1
Javascript
Javascript
use batchinator in windowedlistview
6fb149596aafbbe096e268427636305a185981ea
<ide><path>Libraries/Experimental/WindowedListView.js <ide> */ <ide> 'use strict'; <ide> <add>const Batchinator = require('Batchinator'); <ide> const IncrementalGroup = require('IncrementalGroup'); <ide> const React = require('React'); <ide> const ScrollView = require('ScrollView'); <ide> type Props = { <ide> */ <ide> recomputeRowsBatchingPeriod: number, <ide> /** <del> * Called when rows will be mounted/unmounted. Mounted rows always form a contiguous block so it is expressed as a <del> * range of start plus count. <add> * Called when rows will be mounted/unmounted. Mounted rows always form a contiguous block so it <add> * is expressed as a range of start plus count. <ide> */ <ide> onMountedRowsWillChange?: (firstIdx: number, count: number) => void, <ide> /** <del> * Change this when you want to make sure the WindowedListView will re-render, for example when the result of <del> * `renderScrollComponent` might change. It will be compared in `shouldComponentUpdate`. <add> * Change this when you want to make sure the WindowedListView will re-render, for example when <add> * the result of `renderScrollComponent` might change. It will be compared in <add> * `shouldComponentUpdate`. <ide> */ <ide> shouldUpdateToken?: string, <ide> }; <ide> type State = { <ide> class WindowedListView extends React.Component { <ide> props: Props; <ide> state: State; <add> /** <add> * Recomputing which rows to render is batched up and run asynchronously to avoid wastful updates, <add> * e.g. from multiple layout updates in rapid succession. <add> */ <add> _computeRowsToRenderBatcher: Batchinator; <ide> _firstVisible: number = -1; <ide> _lastVisible: number = -1; <ide> _scrollOffsetY: number = 0; <ide> class WindowedListView extends React.Component { <ide> _rowFramesDirty: boolean = false; <ide> _hasCalledOnEndReached: boolean = false; <ide> _willComputeRowsToRender: boolean = false; <del> _timeoutHandle: number = 0; <del> _incrementPending: boolean = false; <ide> _viewableRows: Array<number> = []; <ide> _cellsInProgress: Set<string> = new Set(); <ide> _scrollRef: ?Object; <ide> class WindowedListView extends React.Component { <ide> viewablePercentThreshold: 50, <ide> renderScrollComponent: (props) => <ScrollView {...props} />, <ide> disableIncrementalRendering: false, <del> recomputeRowsBatchingPeriod: 10, // This should capture most events that will happen in one frame <add> recomputeRowsBatchingPeriod: 10, // This should capture most events that happen within a frame <ide> }; <ide> <ide> constructor(props: Props) { <ide> class WindowedListView extends React.Component { <ide> this.props.numToRenderAhead < this.props.maxNumToRender, <ide> 'WindowedListView: numToRenderAhead must be less than maxNumToRender' <ide> ); <add> this._computeRowsToRenderBatcher = new Batchinator( <add> () => this._computeRowsToRender(this.props), <add> this.props.recomputeRowsBatchingPeriod, <add> ); <ide> this.state = { <ide> firstRow: 0, <ide> lastRow: Math.min(this.props.data.length, this.props.initialNumToRender) - 1, <ide> class WindowedListView extends React.Component { <ide> const newDataSubset = newProps.data.slice(newState.firstRow, newState.lastRow + 1); <ide> const prevDataSubset = this.props.data.slice(this.state.firstRow, this.state.lastRow + 1); <ide> if (newDataSubset.length !== prevDataSubset.length) { <del> DEBUG && infoLog(' yes, subset length: ', {newLen: newDataSubset.length, oldLen: prevDataSubset.length}); <add> DEBUG && infoLog( <add> ' yes, subset length: ', <add> {newLen: newDataSubset.length, oldLen: prevDataSubset.length} <add> ); <ide> return true; <ide> } <ide> for (let idx = 0; idx < newDataSubset.length; idx++) { <ide> if (newDataSubset[idx].rowData !== prevDataSubset[idx].rowData || <ide> newDataSubset[idx].rowKey !== prevDataSubset[idx].rowKey) { <del> DEBUG && infoLog(' yes, data change: ', {idx, new: newDataSubset[idx], old: prevDataSubset[idx]}); <add> DEBUG && infoLog( <add> ' yes, data change: ', <add> {idx, new: newDataSubset[idx], old: prevDataSubset[idx]} <add> ); <ide> return true; <ide> } <ide> } <ide> DEBUG && infoLog(' knope'); <ide> return false; <ide> } <ide> componentWillReceiveProps() { <del> this._enqueueComputeRowsToRender(); <add> this._computeRowsToRenderBatcher.schedule(); <ide> } <ide> _onMomentumScrollEnd = (e: Object) => { <ide> this._onScroll(e); <ide> class WindowedListView extends React.Component { <ide> // We don't want to enqueue any updates if any cells are in the middle of an incremental render, <ide> // because it would just be wasted work. <ide> if (this._cellsInProgress.size === 0) { <del> this._enqueueComputeRowsToRender(); <add> this._computeRowsToRenderBatcher.schedule(); <ide> } <ide> if (this.props.onViewableRowsChanged && Object.keys(this._rowFrames).length) { <ide> const viewableRows = ViewabilityHelper.computeViewableRows( <ide> class WindowedListView extends React.Component { <ide> _onNewLayout = (params: {rowKey: string, layout: Object}) => { <ide> const {rowKey, layout} = params; <ide> if (DEBUG) { <del> const layoutPrev = this._rowFrames[rowKey] || {}; <add> const prev = this._rowFrames[rowKey] || {}; <ide> infoLog( <ide> 'record layout for row: ', <del> {k: rowKey, h: layout.height, y: layout.y, x: layout.x, hp: layoutPrev.height, yp: layoutPrev.y} <add> {k: rowKey, h: layout.height, y: layout.y, x: layout.x, hp: prev.height, yp: prev.y} <ide> ); <ide> if (this._rowFrames[rowKey]) { <ide> const deltaY = Math.abs(this._rowFrames[rowKey].y - layout.y); <ide> const deltaH = Math.abs(this._rowFrames[rowKey].height - layout.height); <ide> if (deltaY > 2 || deltaH > 2) { <ide> const dataEntry = this.props.data.find((datum) => datum.rowKey === rowKey); <del> console.warn('layout jump: ', {dataEntry, prevLayout: this._rowFrames[rowKey], newLayout: layout}); <add> console.warn( <add> 'layout jump: ', <add> {dataEntry, prevLayout: this._rowFrames[rowKey], newLayout: layout} <add> ); <ide> } <ide> } <ide> } <ide> this._rowFrames[rowKey] = {...layout, offscreenLayoutDone: true}; <ide> this._rowFramesDirty = true; <ide> if (this._cellsInProgress.size === 0) { <del> this._enqueueComputeRowsToRender(); <add> this._computeRowsToRenderBatcher.schedule(); <ide> } <ide> }; <ide> _onWillUnmountCell = (rowKey: string) => { <ide> class WindowedListView extends React.Component { <ide> } <ide> }; <ide> /** <del> * This is used to keep track of cells that are in the process of rendering. If any cells are in progress, then <del> * other updates are skipped because they will just be wasted work. <add> * This is used to keep track of cells that are in the process of rendering. If any cells are in <add> * progress, then other updates are skipped because they will just be wasted work. <ide> */ <ide> _onProgressChange = ({rowKey, inProgress}: {rowKey: string, inProgress: boolean}) => { <ide> if (inProgress) { <ide> class WindowedListView extends React.Component { <ide> this._cellsInProgress.delete(rowKey); <ide> } <ide> }; <del> /** <del> * Recomputing which rows to render is batched up and run asynchronously to avoid wastful updates, e.g. from multiple <del> * layout updates in rapid succession. <del> */ <del> _enqueueComputeRowsToRender(): void { <del> if (!this._willComputeRowsToRender) { <del> this._willComputeRowsToRender = true; // batch up computations <del> clearTimeout(this._timeoutHandle); <del> this._timeoutHandle = setTimeout( <del> () => { <del> this._willComputeRowsToRender = false; <del> this._incrementPending = false; <del> this._computeRowsToRender(this.props); <del> }, <del> this.props.recomputeRowsBatchingPeriod <del> ); <del> } <del> } <ide> componentWillUnmount() { <del> clearTimeout(this._timeoutHandle); <add> this._computeRowsToRenderBatcher.dispose(); <ide> } <ide> _computeRowsToRender(props: Object): void { <ide> const totalRows = props.data.length; <ide> class WindowedListView extends React.Component { <ide> } <ide> this._updateVisibleRows(firstVisible, lastVisible); <ide> <del> // Unfortuantely, we can't use <Incremental> to simplify our increment logic in this function because we need to <del> // make sure that cells are rendered in the right order one at a time when scrolling back up. <add> // Unfortuantely, we can't use <Incremental> to simplify our increment logic in this function <add> // because we need to make sure that cells are rendered in the right order one at a time when <add> // scrolling back up. <ide> <ide> const numRendered = lastRow - this.state.firstRow + 1; <ide> // Our last row target that we will approach incrementally <ide> class WindowedListView extends React.Component { <ide> totalRows - 1, // Don't render past the end <ide> ); <ide> // Increment the last row one at a time per JS event loop <del> if (!this._incrementPending) { <del> if (targetLastRow > this.state.lastRow) { <del> lastRow++; <del> this._incrementPending = true; <del> } else if (targetLastRow < this.state.lastRow) { <del> lastRow--; <del> this._incrementPending = true; <del> } <add> if (targetLastRow > this.state.lastRow) { <add> lastRow++; <add> } else if (targetLastRow < this.state.lastRow) { <add> lastRow--; <ide> } <ide> // Once last row is set, figure out the first row <ide> const firstRow = Math.max( <ide> class WindowedListView extends React.Component { <ide> const rowsShouldChange = firstRow !== this.state.firstRow || lastRow !== this.state.lastRow; <ide> if (this._rowFramesDirty || rowsShouldChange) { <ide> if (rowsShouldChange) { <del> props.onMountedRowsWillChange && props.onMountedRowsWillChange(firstRow, lastRow - firstRow + 1); <add> props.onMountedRowsWillChange && <add> props.onMountedRowsWillChange(firstRow, lastRow - firstRow + 1); <ide> infoLog( <ide> 'WLV: row render range will change:', <ide> {firstRow, firstVis: this._firstVisible, lastVis: this._lastVisible, lastRow}, <ide> class WindowedListView extends React.Component { <ide> const rowFrames = this._rowFrames; <ide> const rows = []; <ide> let spacerHeight = 0; <del> // Incremental rendering is a tradeoff between throughput and responsiveness. When we have plenty of buffer (say 50% <del> // of the target), we render incrementally to keep the app responsive. If we are dangerously low on buffer (say <del> // below 25%) we always disable incremental to try to catch up as fast as possible. In the middle, we only disable <del> // incremental while scrolling since it's unlikely the user will try to press a button while scrolling. We also <del> // ignore the "buffer" size when we are bumped up against the edge of the available data. <add> // Incremental rendering is a tradeoff between throughput and responsiveness. When we have <add> // plenty of buffer (say 50% of the target), we render incrementally to keep the app responsive. <add> // If we are dangerously low on buffer (say below 25%) we always disable incremental to try to <add> // catch up as fast as possible. In the middle, we only disable incremental while scrolling <add> // since it's unlikely the user will try to press a button while scrolling. We also ignore the <add> // "buffer" size when we are bumped up against the edge of the available data. <ide> const firstBuffer = firstRow === 0 ? Infinity : this._firstVisible - firstRow; <del> const lastBuffer = lastRow === this.props.data.length - 1 ? Infinity : lastRow - this._lastVisible; <add> const lastBuffer = lastRow === this.props.data.length - 1 <add> ? Infinity <add> : lastRow - this._lastVisible; <ide> const minBuffer = Math.min(firstBuffer, lastBuffer); <ide> const disableIncrementalRendering = this.props.disableIncrementalRendering || <ide> (this._isScrolling && minBuffer < this.props.numToRenderAhead * 0.5) || <ide> (minBuffer < this.props.numToRenderAhead * 0.25); <ide> // Render mode is sticky while the component is mounted. <ide> for (let ii = firstRow; ii <= lastRow; ii++) { <ide> const rowKey = this.props.data[ii].rowKey; <del> if (this._rowRenderMode[rowKey] === 'sync' || (disableIncrementalRendering && this._rowRenderMode[rowKey] !== 'async')) { <add> if ( <add> this._rowRenderMode[rowKey] === 'sync' || <add> (disableIncrementalRendering && this._rowRenderMode[rowKey] !== 'async') <add> ) { <ide> this._rowRenderMode[rowKey] = 'sync'; <ide> } else { <ide> this._rowRenderMode[rowKey] = 'async'; <ide> class WindowedListView extends React.Component { <ide> if (!rowFrames[rowKey]) { <ide> break; // if rowFrame missing, no following ones will exist so quit early <ide> } <del> // Look for the first row where offscreen layout is done (only true for mounted rows) or it will be rendered <del> // synchronously and set the spacer height such that it will offset all the unmounted rows before that one using <del> // the saved frame data. <add> // Look for the first row where offscreen layout is done (only true for mounted rows) or it <add> // will be rendered synchronously and set the spacer height such that it will offset all the <add> // unmounted rows before that one using the saved frame data. <ide> if (rowFrames[rowKey].offscreenLayoutDone || this._rowRenderMode[rowKey] === 'sync') { <ide> if (ii > 0) { <ide> const prevRowKey = this.props.data[ii - 1].rowKey; <ide> class WindowedListView extends React.Component { <ide> } <ide> } <ide> let showIndicator = false; <del> if (spacerHeight > (this.state.boundaryIndicatorHeight || 0) && this.props.renderWindowBoundaryIndicator) { <add> if ( <add> spacerHeight > (this.state.boundaryIndicatorHeight || 0) && <add> this.props.renderWindowBoundaryIndicator <add> ) { <ide> showIndicator = true; <ide> spacerHeight -= this.state.boundaryIndicatorHeight || 0; <ide> } <ide> DEBUG && infoLog('render top spacer with height ', spacerHeight); <ide> rows.push(<View key="sp-top" style={{height: spacerHeight}} />); <ide> if (this.props.renderWindowBoundaryIndicator) { <del> // Always render it, even if removed, so that we can get the height right away and don't waste time creating/ <del> // destroying it. Should see if there is a better spinner option that is not as expensive. <add> // Always render it, even if removed, so that we can get the height right away and don't waste <add> // time creating/ destroying it. Should see if there is a better spinner option that is not as <add> // expensive. <ide> rows.push( <ide> <View <ide> style={!showIndicator && styles.remove} <ide> type CellProps = { <ide> */ <ide> asyncRowPerfEventName: ?string, <ide> /** <del> * Initially false to indicate the cell should be rendered "offscreen" with position: absolute so that incremental <del> * rendering doesn't cause things to jump around. Once onNewLayout is called after offscreen rendering has completed, <del> * includeInLayout will be set true and the finished cell can be dropped into place. <add> * Initially false to indicate the cell should be rendered "offscreen" with position: absolute so <add> * that incremental rendering doesn't cause things to jump around. Once onNewLayout is called <add> * after offscreen rendering has completed, includeInLayout will be set true and the finished cell <add> * can be dropped into place. <ide> * <del> * This is coordinated outside this component so the parent can syncronize this re-render with managing the <del> * placeholder sizing. <add> * This is coordinated outside this component so the parent can syncronize this re-render with <add> * managing the placeholder sizing. <ide> */ <ide> includeInLayout: boolean, <ide> /** <del> * Updates the parent with the latest layout. Only called when incremental rendering is done and triggers the parent <del> * to re-render this row with includeInLayout true. <add> * Updates the parent with the latest layout. Only called when incremental rendering is done and <add> * triggers the parent to re-render this row with includeInLayout true. <ide> */ <ide> onNewLayout: (params: {rowKey: string, layout: Object}) => void, <ide> /** <del> * Used to track when rendering is in progress so the parent can avoid wastedful re-renders that are just going to be <del> * invalidated once the cell finishes. <add> * Used to track when rendering is in progress so the parent can avoid wastedful re-renders that <add> * are just going to be invalidated once the cell finishes. <ide> */ <ide> onProgressChange: (progress: {rowKey: string, inProgress: boolean}) => void, <ide> /** <del> * Used to invalidate the layout so the parent knows it needs to compensate for the height in the placeholder size. <add> * Used to invalidate the layout so the parent knows it needs to compensate for the height in the <add> * placeholder size. <ide> */ <ide> onWillUnmount: (rowKey: string) => void, <ide> }; <ide> class CellRenderer extends React.Component { <ide> componentWillMount() { <ide> if (this.props.asyncRowPerfEventName) { <ide> this._perfUpdateID = g_perf_update_id++; <del> this._asyncCookie = Systrace.beginAsyncEvent(this.props.asyncRowPerfEventName + this._perfUpdateID); <add> this._asyncCookie = Systrace.beginAsyncEvent( <add> this.props.asyncRowPerfEventName + this._perfUpdateID <add> ); <ide> // $FlowFixMe(>=0.28.0) <del> infoLog(`perf_asynctest_${this.props.asyncRowPerfEventName}_start ${this._perfUpdateID} ${Date.now()}`); <add> infoLog(`perf_asynctest_${this.props.asyncRowPerfEventName}_start ${this._perfUpdateID} ` + <add> `${Date.now()}`); <ide> } <ide> if (this.props.includeInLayout) { <ide> this._includeInLayoutLatch = true; <ide> class CellRenderer extends React.Component { <ide> invariant(!this._offscreenRenderDone, 'should only finish rendering once'); <ide> this._offscreenRenderDone = true; <ide> <del> // If this is not called before calling onNewLayout, the number of inProgress cells will remain non-zero, <del> // and thus the onNewLayout call will not fire the needed state change update. <add> // If this is not called before calling onNewLayout, the number of inProgress cells will remain <add> // non-zero, and thus the onNewLayout call will not fire the needed state change update. <ide> this.props.onProgressChange({rowKey: this.props.rowKey, inProgress: false}); <ide> <del> // If an onLayout event hasn't come in yet, then we skip here and assume it will come in later. This happens <del> // when Incremental is disabled and _onOffscreenRenderDone is called faster than layout can happen. <del> this._lastLayout && this.props.onNewLayout({rowKey: this.props.rowKey, layout: this._lastLayout}); <add> // If an onLayout event hasn't come in yet, then we skip here and assume it will come in later. <add> // This happens when Incremental is disabled and _onOffscreenRenderDone is called faster than <add> // layout can happen. <add> this._lastLayout && <add> this.props.onNewLayout({rowKey: this.props.rowKey, layout: this._lastLayout}); <ide> <ide> DEBUG && infoLog('\n >>>>> display row ' + this.props.rowIndex + '\n\n\n'); <ide> if (this.props.asyncRowPerfEventName) { <del> // Note this doesn't include the native render time but is more accurate than also including the JS render <del> // time of anything that has been queued up. <del> Systrace.endAsyncEvent(this.props.asyncRowPerfEventName + this._perfUpdateID, this._asyncCookie); <add> // Note this doesn't include the native render time but is more accurate than also including <add> // the JS render time of anything that has been queued up. <add> Systrace.endAsyncEvent( <add> this.props.asyncRowPerfEventName + this._perfUpdateID, <add> this._asyncCookie <add> ); <ide> // $FlowFixMe(>=0.28.0) <del> infoLog(`perf_asynctest_${this.props.asyncRowPerfEventName}_end ${this._perfUpdateID} ${Date.now()}`); <add> infoLog(`perf_asynctest_${this.props.asyncRowPerfEventName}_end ${this._perfUpdateID} ` + <add> `${Date.now()}`); <ide> } <ide> } <ide> _onOffscreenRenderDone = () => {
1
Python
Python
use min version for huggingface-hub dependency
7390d9de63903f786d99f3fa38c6e2aa6f650f7e
<ide><path>setup.py <ide> "flax>=0.3.4", <ide> "fugashi>=1.0", <ide> "GitPython<3.1.19", <del> "huggingface-hub==0.0.12", <add> "huggingface-hub>=0.0.12", <ide> "importlib_metadata", <ide> "ipadic>=1.0.0,<2.0", <ide> "isort>=5.5.4", <ide><path>src/transformers/dependency_versions_table.py <ide> "flax": "flax>=0.3.4", <ide> "fugashi": "fugashi>=1.0", <ide> "GitPython": "GitPython<3.1.19", <del> "huggingface-hub": "huggingface-hub==0.0.12", <add> "huggingface-hub": "huggingface-hub>=0.0.12", <ide> "importlib_metadata": "importlib_metadata", <ide> "ipadic": "ipadic>=1.0.0,<2.0", <ide> "isort": "isort>=5.5.4",
2
Java
Java
fix issue with new line handling in stompdecoder
3c0c0c0597e19b66d6cfebbf93b42f1c1fb2b4e5
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2020 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public List<Message<byte[]>> decode(ByteBuffer byteBuffer, <ide> Message<byte[]> message = decodeMessage(byteBuffer, partialMessageHeaders); <ide> if (message != null) { <ide> messages.add(message); <add> skipEol(byteBuffer); <add> if (!byteBuffer.hasRemaining()) { <add> break; <add> } <ide> } <ide> else { <ide> break; <ide> public List<Message<byte[]>> decode(ByteBuffer byteBuffer, <ide> @Nullable <ide> private Message<byte[]> decodeMessage(ByteBuffer byteBuffer, @Nullable MultiValueMap<String, String> headers) { <ide> Message<byte[]> decodedMessage = null; <del> skipLeadingEol(byteBuffer); <add> skipEol(byteBuffer); <ide> <ide> // Explicit mark/reset access via Buffer base type for compatibility <ide> // with covariant return type on JDK 9's ByteBuffer... <ide> private void initHeaders(StompHeaderAccessor headerAccessor) { <ide> <ide> /** <ide> * Skip one ore more EOL characters at the start of the given ByteBuffer. <del> * Those are STOMP heartbeat frames. <add> * STOMP, section 2.1 says: "The NULL octet can be optionally followed by <add> * multiple EOLs." <ide> */ <del> protected void skipLeadingEol(ByteBuffer byteBuffer) { <add> protected void skipEol(ByteBuffer byteBuffer) { <ide> while (true) { <ide> if (!tryConsumeEndOfLine(byteBuffer)) { <ide> break; <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompDecoderTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2020 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.messaging.simp.stomp; <ide> <del>import java.io.UnsupportedEncodingException; <ide> import java.nio.ByteBuffer; <ide> import java.util.List; <ide> <ide> public void decodeFrameWithNoBody() { <ide> } <ide> <ide> @Test <del> public void decodeFrame() throws UnsupportedEncodingException { <add> public void decodeFrame() { <ide> Message<byte[]> frame = decode("SEND\ndestination:test\n\nThe body of the message\0"); <ide> StompHeaderAccessor headers = StompHeaderAccessor.wrap(frame); <ide> <ide> public void decodeFrameBodyNotAllowed() { <ide> decode("CONNECT\naccept-version:1.2\n\nThe body of the message\0")); <ide> } <ide> <add> @Test // gh-23713 <add> public void decodeFramesWithExtraNewLines() { <add> String frame1 = "SEND\ndestination:test\n\nbody\0\n\n\n"; <add> ByteBuffer buffer = ByteBuffer.wrap((frame1).getBytes()); <add> <add> final List<Message<byte[]>> messages = decoder.decode(buffer); <add> <add> assertThat(messages.size()).isEqualTo(1); <add> assertThat(StompHeaderAccessor.wrap(messages.get(0)).getCommand()).isEqualTo(StompCommand.SEND); <add> } <add> <ide> @Test <ide> public void decodeMultipleFramesFromSameBuffer() { <ide> String frame1 = "SEND\ndestination:test\n\nThe body of the message\0"; <ide> public void decodeMultipleFramesFromSameBuffer() { <ide> assertThat(StompHeaderAccessor.wrap(messages.get(1)).getCommand()).isEqualTo(StompCommand.DISCONNECT); <ide> } <ide> <del> // SPR-13111 <del> <del> @Test <add> @Test // SPR-13111 <ide> public void decodeFrameWithHeaderWithEmptyValue() { <ide> String accept = "accept-version:1.1\n"; <ide> String valuelessKey = "key:\n";
2
Text
Text
fix example code in active job guide [ci skip]
ec1c608b5d16b4ebe81169fb64d5dce56dc3a096
<ide><path>guides/source/active_job_basics.md <ide> Here's what a job looks like: <ide> class GuestsCleanupJob < ActiveJob::Base <ide> queue_as :default <ide> <del> def perform <add> def perform(*args) <ide> # Do something later <ide> end <ide> end
1
Text
Text
add target in challeges link
ec761dbdfadbd9d501ab792875d32138236f712c
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.md <ide> You can nest links within other text elements. <ide> <ide> ```html <ide> <p> <del> Here's a <a target="_blank" href="http://freecodecamp.org"> link to freecodecamp.org</a> for you to follow. <add> Here's a <a target="_blank" href="https://www.freecodecamp.org"> link to freecodecamp.org</a> for you to follow. <ide> </p> <ide> ``` <ide> <ide> Next is the *anchor* element `<a>` (which requires a closing tag `</a>`): <ide> `target` is an anchor tag attribute that specifies where to open the link. The value `_blank` specifies to open the link in a new tab. The `href` is an anchor tag attribute that contains the URL address of the link: <ide> <ide> ```html <del><a href="http://freecodecamp.org"> ... </a> <add><a href="https://www.freecodecamp.org" target="_blank"> ... </a> <ide> ``` <ide> <ide> The text, `link to freecodecamp.org`, within the `a` element is called <dfn>anchor text</dfn>, and will display the link to click: <ide> <ide> ```html <del><a href=" ... ">link to freecodecamp.org</a> <add><a href=" ... " target="...">link to freecodecamp.org</a> <ide> ``` <ide> <ide> The final output of the example will look like this: <ide> <del>Here's a [link to freecodecamp.org](http://freecodecamp.org) for you to follow. <add>Here's a <a href="https://www.freecodecamp.org" target="_blank">link to freecodecamp.org</a> for you to follow. <ide> <ide> # --instructions-- <ide> <ide> assert( <ide> ); <ide> ``` <ide> <del>The `a` element should link to "`https://freecatphotoapp.com`". <add>The `a` element should link to "`https://www.freecatphotoapp.com`". <ide> <ide> ```js <ide> assert( <del> $('a[href="https://freecatphotoapp.com"]').length === 1 <add> $('a[href="https://www.freecatphotoapp.com"]').length === 1 <ide> ); <ide> ``` <ide> <ide> Your `a` element should be nested within your new `p` element. <ide> <ide> ```js <ide> assert( <del> $('a[href="https://freecatphotoapp.com"]').parent().is('p') <add> $('a[href="https://www.freecatphotoapp.com"]').parent().is('p') <ide> ); <ide> ``` <ide> <ide> Your `p` element should have the text `View more ` (with a space after it). <ide> <ide> ```js <ide> assert( <del> $('a[href="https://freecatphotoapp.com"]') <add> $('a[href="https://www.freecatphotoapp.com"]') <ide> .parent() <ide> .text() <ide> .match(/View\smore\s/gi) <ide> assert( <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <del> <a href="https://freecatphotoapp.com" target="_blank">cat photos</a> <add> <a href="https://www.freecatphotoapp.com" target="_blank">cat photos</a> <ide> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <ide> <ide> assert( <ide> ```html <ide> <h2>CatPhotoApp</h2> <ide> <main> <del> <p>View more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a></p> <add> <p>View more <a target="_blank" href="https://www.freecatphotoapp.com">cat photos</a></p> <ide> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <ide>
1
Text
Text
add link to docker.com in readme.md
f63ec3d87467419a94f827939a1eaefa03b2f181
<ide><path>README.md <ide> Moby is NOT recommended for: <ide> <ide> - Application developers looking for an easy way to run their applications in containers. We recommend Docker CE instead. <ide> - Enterprise IT and development teams looking for a ready-to-use, commercially supported container platform. We recommend Docker EE instead. <del>- Anyone curious about containers and looking for an easy way to learn. We recommend the docker.com website instead. <add>- Anyone curious about containers and looking for an easy way to learn. We recommend the [docker.com](https://www.docker.com/) website instead. <ide> <ide> # Transitioning to Moby <ide>
1
Javascript
Javascript
refactor the line drawing code. tests are broken
05523b01b0207fd6d6ce00a45d8c6f773df4137d
<ide><path>src/elements/element.line.js <ide> <ide> <ide> Chart.elements.Line = Chart.Element.extend({ <del> draw: function() { <del> <del> var vm = this._view; <add> lineToNextPoint: function(previousPoint, point, nextPoint) { <ide> var ctx = this._chart.ctx; <del> var first = this._children[0]; <del> var last = this._children[this._children.length - 1]; <del> <del> ctx.save(); <del> <del> // Draw the background first (so the border is always on top) <del> helpers.each(this._children, function(point, index) { <ide> <del> var previous = helpers.previousItem(this._children, index); <del> var next = helpers.nextItem(this._children, index); <del> <del> // First point moves to it's starting position no matter what <del> if (!index) { <del> ctx.moveTo(point._view.x, vm.scaleZero); <del> } <del> <del> // Skip this point, draw to scaleZero, move to next point, and draw to next point <del> if (point._view.skip && !this.loop) { <del> ctx.lineTo(previous._view.x, vm.scaleZero); <del> ctx.moveTo(next._view.x, vm.scaleZero); <del> return; <del> } <del> <del> // The previous line was skipped, so just draw a normal straight line to the point <del> if (previous._view.skip) { <del> ctx.lineTo(point._view.x, point._view.y); <del> return; <add> if (point._view.skip) { <add> if (this.loop) { <add> // Go to center <add> ctx.lineTo(this._view.scaleZero.x, this._view.scaleZero.y); <add> } else { <add> ctx.lineTo(previousPoint._view.x, this._view.scaleZero); <add> ctx.moveTo(next._view.x, this._view.scaleZero); <ide> } <del> <del> // Draw a bezier to point <del> if (vm.tension > 0 && index) { <del> //ctx.lineTo(point._view.x, point._view.y); <add> } else if (previousPoint._view.skip) { <add> ctx.lineTo(point._view.x, point._view.y); <add> } else { <add> // Line between points <add> //if (point !== nextPoint) { <ide> ctx.bezierCurveTo( <del> previous._view.controlPointNextX, <del> previous._view.controlPointNextY, <add> previousPoint._view.controlPointNextX, <add> previousPoint._view.controlPointNextY, <ide> point._view.controlPointPreviousX, <ide> point._view.controlPointPreviousY, <ide> point._view.x, <ide> point._view.y <ide> ); <del> return; <del> } <add> //} else { <add> // Drawing to the last point in the line <ide> <del> // Draw a straight line to the point <del> ctx.lineTo(point._view.x, point._view.y); <add> //} <add> } <add> }, <ide> <del> }, this); <add> draw: function() { <ide> <del> // For radial scales, loop back around to the first point <del> if (this._loop) { <del> // Draw a bezier line <del> if (vm.tension > 0 && !first._view.skip) { <del> ctx.bezierCurveTo( <del> last._view.controlPointNextX, <del> last._view.controlPointNextY, <del> first._view.controlPointPreviousX, <del> first._view.controlPointPreviousY, <del> first._view.x, <del> first._view.y <del> ); <del> return; <del> } <del> // Draw a straight line <del> ctx.lineTo(first._view.x, first._view.y); <del> } <add> var vm = this._view; <add> var ctx = this._chart.ctx; <add> var first = this._children[0]; <add> var last = this._children[this._children.length - 1]; <add> <add> ctx.save(); <ide> <ide> // If we had points and want to fill this line, do so. <ide> if (this._children.length > 0 && vm.fill) { <del> //Round off the line by going to the base of the chart, back to the start, then fill. <del> ctx.lineTo(this._children[this._children.length - 1]._view.x, vm.scaleZero); <del> ctx.lineTo(this._children[0]._view.x, vm.scaleZero); <add> // Draw the background first (so the border is always on top) <add> ctx.beginPath(); <add> <add> helpers.each(this._children, function(point, index) { <add> var previous = helpers.previousItem(this._children, index/*, this._loop*/); <add> var next = helpers.nextItem(this._children, index/*, this._loop*/); <add> <add> // First point moves to it's starting position no matter what <add> if (index === 0) { <add> ctx.moveTo(point._view.x, vm.scaleZero); <add> ctx.lineTo(point._view.x, point._view.y); <add> } else { <add> this.lineToNextPoint(previous, point, next); <add> } <add> }, this); <add> <add> // For radial scales, loop back around to the first point <add> if (this._loop) { <add> if (!first._view.skip) { <add> // Draw a bezier line <add> ctx.bezierCurveTo( <add> last._view.controlPointNextX, <add> last._view.controlPointNextY, <add> first._view.controlPointPreviousX, <add> first._view.controlPointPreviousY, <add> first._view.x, <add> first._view.y <add> ); <add> } else { <add> // Go to center <add> ctx.lineTo(this._view.scaleZero.x, this._view.scaleZero.y); <add> } <add> } else { <add> //Round off the line by going to the base of the chart, back to the start, then fill. <add> ctx.lineTo(this._children[this._children.length - 1]._view.x, vm.scaleZero); <add> ctx.lineTo(this._children[0]._view.x, vm.scaleZero); <add> } <add> <ide> ctx.fillStyle = vm.backgroundColor || Chart.defaults.global.defaultColor; <ide> ctx.closePath(); <ide> ctx.fill(); <ide> } <ide> <del> <ide> // Now draw the line between all the points with any borders <ide> ctx.lineCap = vm.borderCapStyle || Chart.defaults.global.elements.line.borderCapStyle; <ide> <ide> var previous = helpers.previousItem(this._children, index); <ide> var next = helpers.nextItem(this._children, index); <ide> <del> if (!index) { <del> ctx.moveTo(point._view.x, vm.scaleZero); <del> } <del> <del> // Skip this point and move to the next points zeroPoint <del> if (point._view.skip && !this.loop) { <del> ctx.moveTo(next._view.x, vm.scaleZero); <del> return; <del> } <del> <del> // Previous point was skipped, just move to the point <del> if (previous._view.skip) { <del> ctx.moveTo(point._view.x, point._view.y); <del> return; <del> } <del> <del> // If First point, move to the point ahead of time (so a line doesn't get drawn up the left axis) <del> if (!index) { <add> if (index === 0) { <ide> ctx.moveTo(point._view.x, point._view.y); <add> } else { <add> this.lineToNextPoint(previous, point, next); <ide> } <del> <del> // Draw a bezier line to the point <del> if (vm.tension > 0 && index) { <del> ctx.bezierCurveTo( <del> previous._view.controlPointNextX, <del> previous._view.controlPointNextY, <del> point._view.controlPointPreviousX, <del> point._view.controlPointPreviousY, <del> point._view.x, <del> point._view.y <del> ); <del> return; <del> } <del> <del> // Draw a straight line to the point <del> ctx.lineTo(point._view.x, point._view.y); <del> <ide> }, this); <ide> <del> if (this._loop && !first._view.skip) { <del> <del> // Draw a bezier line to the first point <del> if (vm.tension > 0) { <add> if (this._loop) { <add> if (!first._view.skip) { <add> // Draw a bezier line <ide> ctx.bezierCurveTo( <ide> last._view.controlPointNextX, <ide> last._view.controlPointNextY, <ide> first._view.x, <ide> first._view.y <ide> ); <del> return; <add> } else { <add> // Go to center <add> ctx.lineTo(this._view.scaleZero.x, this._view.scaleZero.y); <ide> } <del> <del> // Draw a straight line to the first point <del> ctx.lineTo(first._view.x, first._view.y); <ide> } <ide> <ide> ctx.stroke();
1
PHP
PHP
simplify the code in the string class
f886d874a639410efbea6fec81e78e1bdc9b069c
<ide><path>lib/Cake/Utility/String.php <ide> public static function uuid() { <ide> } elseif ($node !== '127.0.0.1') { <ide> $node = ip2long($node); <ide> } else { <del> $node = null; <del> } <del> <del> if (empty($node)) { <ide> $node = crc32(Configure::read('Security.salt')); <ide> } <ide> <ide> public static function uuid() { <ide> } <ide> <ide> list($timeMid, $timeLow) = explode(' ', microtime()); <del> $uuid = sprintf( <add> return sprintf( <ide> "%08x-%04x-%04x-%02x%02x-%04x%08x", (int)$timeLow, (int)substr($timeMid, 2) & 0xffff, <ide> mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3f) | 0x80, mt_rand(0, 0xff), $pid, $node <ide> ); <del> <del> return $uuid; <ide> } <ide> <ide> /** <ide> public static function tokenize($data, $separator = ',', $leftBound = '(', $righ <ide> $open = true; <ide> } else { <ide> $depth--; <del> $open = false; <ide> } <ide> } <ide> } <ide> public static function tokenize($data, $separator = ',', $leftBound = '(', $righ <ide> } <ide> <ide> if (!empty($results)) { <del> $data = array_map('trim', $results); <del> } else { <del> $data = array(); <add> return array_map('trim', $results); <ide> } <del> return $data; <add> <add> return array(); <ide> } <ide> <ide> /** <ide> public static function insert($str, $data, $options = array()) { <ide> $str = substr_replace($str, $val, $pos, 1); <ide> } <ide> return ($options['clean']) ? String::cleanInsert($str, $options) : $str; <del> } else { <del> asort($data); <add> } <ide> <del> $hashKeys = array(); <del> foreach ($data as $key => $value) { <del> $hashKeys[] = crc32($key); <del> } <add> asort($data); <ide> <del> $tempData = array_combine(array_keys($data), array_values($hashKeys)); <del> krsort($tempData); <del> foreach ($tempData as $key => $hashVal) { <del> $key = sprintf($format, preg_quote($key, '/')); <del> $str = preg_replace($key, $hashVal, $str); <del> } <del> $dataReplacements = array_combine($hashKeys, array_values($data)); <del> foreach ($dataReplacements as $tmpHash => $tmpValue) { <del> $tmpValue = (is_array($tmpValue)) ? '' : $tmpValue; <del> $str = str_replace($tmpHash, $tmpValue, $str); <del> } <add> $hashKeys = array(); <add> foreach ($data as $key => $value) { <add> $hashKeys[] = crc32($key); <add> } <add> <add> $tempData = array_combine(array_keys($data), array_values($hashKeys)); <add> krsort($tempData); <add> foreach ($tempData as $key => $hashVal) { <add> $key = sprintf($format, preg_quote($key, '/')); <add> $str = preg_replace($key, $hashVal, $str); <add> } <add> $dataReplacements = array_combine($hashKeys, array_values($data)); <add> foreach ($dataReplacements as $tmpHash => $tmpValue) { <add> $tmpValue = (is_array($tmpValue)) ? '' : $tmpValue; <add> $str = str_replace($tmpHash, $tmpValue, $str); <ide> } <ide> <ide> if (!isset($options['format']) && isset($options['before'])) { <ide> public static function highlight($text, $phrase, $options = array()) { <ide> } <ide> <ide> return preg_replace($replace, $with, $text); <del> } else { <del> $phrase = '(' . preg_quote($phrase, '|') . ')'; <del> if ($html) { <del> $phrase = "(?![^<]+>)$phrase(?![^<]+>)"; <del> } <add> } <ide> <del> return preg_replace(sprintf($options['regex'], $phrase), $format, $text); <add> $phrase = '(' . preg_quote($phrase, '|') . ')'; <add> if ($html) { <add> $phrase = "(?![^<]+>)$phrase(?![^<]+>)"; <ide> } <add> <add> return preg_replace(sprintf($options['regex'], $phrase), $format, $text); <ide> } <ide> <ide> /** <ide> class_exists('Multibyte'); <ide> <ide> if (mb_strlen($text) <= $length) { <ide> return $text; <del> } else { <del> $truncate = mb_substr($text, mb_strlen($text) - $length + mb_strlen($ellipsis)); <ide> } <add> <add> $truncate = mb_substr($text, mb_strlen($text) - $length + mb_strlen($ellipsis)); <ide> if (!$exact) { <ide> $spacepos = mb_strpos($truncate, ' '); <ide> $truncate = $spacepos === false ? '' : trim(mb_substr($truncate, $spacepos)); <ide> class_exists('Multibyte'); <ide> } else { <ide> if (mb_strlen($text) <= $length) { <ide> return $text; <del> } else { <del> $truncate = mb_substr($text, 0, $length - mb_strlen($ellipsis)); <ide> } <add> $truncate = mb_substr($text, 0, $length - mb_strlen($ellipsis)); <ide> } <ide> if (!$exact) { <ide> $spacepos = mb_strrpos($truncate, ' '); <ide> public static function excerpt($text, $phrase, $radius = 100, $ellipsis = '...') <ide> public static function toList($list, $and = 'and', $separator = ', ') { <ide> if (count($list) > 1) { <ide> return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop($list); <del> } else { <del> return array_pop($list); <ide> } <del> } <ide> <add> return array_pop($list); <add> } <ide> }
1
Ruby
Ruby
add tap? method
4c0fd46329a3180d079f34377584ccd5568b99aa
<ide><path>Library/Homebrew/formula.rb <ide> def self.factory name <ide> Formulary.factory name <ide> end <ide> <add> def tap? <add> !!path.realpath.to_s.match(HOMEBREW_TAP_DIR_REGEX) <add> end <add> <ide> def tap <ide> if path.realpath.to_s =~ HOMEBREW_TAP_DIR_REGEX <ide> "#$1/#$2"
1
Ruby
Ruby
run actionview tests in parallel
df4ab6e1037361a5cddff33ac725a27595f19438
<ide><path>actionview/test/abstract_unit.rb <ide> def stderr_logger <ide> end <ide> <ide> class ActiveSupport::TestCase <add> parallelize <add> <ide> include ActiveSupport::Testing::MethodCallAssertions <ide> <ide> private <ide><path>actionview/test/active_record_unit.rb <ide> def setup <ide> self.able_to_connect = false <ide> end <ide> <add> def reconnect <add> return unless able_to_connect <add> ActiveRecord::Base.connection.reconnect! <add> load_schema <add> end <add> <ide> private <ide> def setup_connection <ide> if Object.const_defined?(:ActiveRecord) <ide> def run(*args) <ide> end <ide> <ide> ActiveRecordTestConnector.setup <add> <add>ActiveSupport::Testing::Parallelization.after_fork_hook do <add> ActiveRecordTestConnector.reconnect <add>end
2
PHP
PHP
add assertresponsesuccess() to also cover 3xx
10e23f44f819a793b3d6d35930757ff8055d6613
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> public function assertResponseOk() <ide> $this->_assertStatus(200, 204, 'Status code is not between 200 and 204'); <ide> } <ide> <add> /** <add> * Asserts that the response status code is in the 2xx/3xx range. <add> * <add> * @return void <add> */ <add> public function assertResponseSuccess() <add> { <add> $this->_assertStatus(200, 308, 'Status code is not between 200 and 308'); <add> } <add> <ide> /** <ide> * Asserts that the response status code is in the 4xx range. <ide> * <ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php <ide> public function testAssertResponseStatusCodes() <ide> $this->_response->statusCode(204); <ide> $this->assertResponseOk(); <ide> <add> $this->_response->statusCode(202); <add> $this->assertResponseSuccess(); <add> <add> $this->_response->statusCode(302); <add> $this->assertResponseSuccess(); <add> <ide> $this->_response->statusCode(400); <ide> $this->assertResponseError(); <ide>
2
Ruby
Ruby
construct joins by walking the outer join tree
7894ae39c8313d83d64d5a058470ec1ef4ed22e1
<ide><path>activerecord/lib/active_record/associations/join_dependency.rb <ide> def apply_tables!(node) <ide> end <ide> <ide> def join_constraints(outer_joins) <del> outer_joins.each { |oj| merge_outer_joins! oj } <del> make_joins join_root <add> if outer_joins.any? <add> oj = outer_joins.first <add> <add> if join_root.match? oj.join_root <add> outer_joins.each { |oj| merge_outer_joins! oj } <add> make_joins join_root <add> else <add> make_joins(join_root) + outer_joins.flat_map { |join| <add> join.join_root.children.flat_map { |child| <add> make_the_joins(join_root, child) <add> } <add> } <add> end <add> else <add> make_joins join_root <add> end <ide> end <ide> <ide> class Aliases <ide> def instantiate(result_set, aliases) <ide> <ide> private <ide> <add> def make_the_joins(parent, child) <add> chain = child.reflection.chain <add> foreign_table = parent.table <add> foreign_klass = parent.base_klass <add> tables = table_aliases_for(parent, child) <add> join_type = Arel::OuterJoin <add> <add> joins = child.join_constraints(foreign_table, foreign_klass, child, join_type, tables, child.reflection.scope_chain, chain) <add> joins.concat child.children.flat_map { |c| make_the_joins(child, c) } <add> end <add> <ide> def make_joins(node) <ide> node.children.flat_map { |child| <ide> chain = child.reflection.chain <ide> def make_joins(node) <ide> } <ide> end <ide> <del> def construct_tables!(parent, node) <del> node.tables = node.reflection.chain.map { |reflection| <add> def table_aliases_for(parent, node) <add> node.reflection.chain.map { |reflection| <ide> alias_tracker.aliased_table_for( <ide> reflection.table_name, <ide> table_alias_for(reflection, parent, reflection != node.reflection) <ide> ) <del> } unless node.tables <add> } <add> end <add> <add> def construct_tables!(parent, node) <add> node.tables = table_aliases_for(parent, node) unless node.tables <ide> node.children.each { |child| construct_tables! node, child } <ide> end <ide>
1
Go
Go
add meminfo to the system pkg
e0c9d7b654221a0d4e5a310b0f9a0adb9ef69aa0
<ide><path>pkg/system/meminfo.go <add>package system <add> <add>// MemInfo contains memory statistics of the host system. <add>type MemInfo struct { <add> // Total usable RAM (i.e. physical RAM minus a few reserved bits and the <add> // kernel binary code). <add> MemTotal int64 <add> <add> // Amount of free memory. <add> MemFree int64 <add> <add> // Total amount of swap space available. <add> SwapTotal int64 <add> <add> // Amount of swap space that is currently unused. <add> SwapFree int64 <add>} <ide><path>pkg/system/meminfo_linux.go <add>package system <add> <add>import ( <add> "bufio" <add> "errors" <add> "io" <add> "os" <add> "strconv" <add> "strings" <add> <add> "github.com/docker/docker/pkg/units" <add>) <add> <add>var ( <add> ErrMalformed = errors.New("malformed file") <add>) <add> <add>// Retrieve memory statistics of the host system and parse them into a MemInfo <add>// type. <add>func ReadMemInfo() (*MemInfo, error) { <add> file, err := os.Open("/proc/meminfo") <add> if err != nil { <add> return nil, err <add> } <add> defer file.Close() <add> return parseMemInfo(file) <add>} <add> <add>func parseMemInfo(reader io.Reader) (*MemInfo, error) { <add> meminfo := &MemInfo{} <add> scanner := bufio.NewScanner(reader) <add> for scanner.Scan() { <add> // Expected format: ["MemTotal:", "1234", "kB"] <add> parts := strings.Fields(scanner.Text()) <add> <add> // Sanity checks: Skip malformed entries. <add> if len(parts) < 3 || parts[2] != "kB" { <add> continue <add> } <add> <add> // Convert to bytes. <add> size, err := strconv.Atoi(parts[1]) <add> if err != nil { <add> continue <add> } <add> bytes := int64(size) * units.KiB <add> <add> switch parts[0] { <add> case "MemTotal:": <add> meminfo.MemTotal = bytes <add> case "MemFree:": <add> meminfo.MemFree = bytes <add> case "SwapTotal:": <add> meminfo.SwapTotal = bytes <add> case "SwapFree:": <add> meminfo.SwapFree = bytes <add> } <add> <add> } <add> <add> // Handle errors that may have occurred during the reading of the file. <add> if err := scanner.Err(); err != nil { <add> return nil, err <add> } <add> <add> return meminfo, nil <add>} <ide><path>pkg/system/meminfo_linux_test.go <add>package system <add> <add>import ( <add> "strings" <add> "testing" <add> <add> "github.com/docker/docker/pkg/units" <add>) <add> <add>func TestMemInfo(t *testing.T) { <add> const input = ` <add> MemTotal: 1 kB <add> MemFree: 2 kB <add> SwapTotal: 3 kB <add> SwapFree: 4 kB <add> Malformed1: <add> Malformed2: 1 <add> Malformed3: 2 MB <add> Malformed4: X kB <add> ` <add> meminfo, err := parseMemInfo(strings.NewReader(input)) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if meminfo.MemTotal != 1*units.KiB { <add> t.Fatalf("Unexpected MemTotal: %d", meminfo.MemTotal) <add> } <add> if meminfo.MemFree != 2*units.KiB { <add> t.Fatalf("Unexpected MemFree: %d", meminfo.MemFree) <add> } <add> if meminfo.SwapTotal != 3*units.KiB { <add> t.Fatalf("Unexpected SwapTotal: %d", meminfo.SwapTotal) <add> } <add> if meminfo.SwapFree != 4*units.KiB { <add> t.Fatalf("Unexpected SwapFree: %d", meminfo.SwapFree) <add> } <add>} <ide><path>pkg/system/meminfo_unsupported.go <add>// +build !linux <add> <add>package system <add> <add>func ReadMemInfo() (*MemInfo, error) { <add> return nil, ErrNotSupportedPlatform <add>}
4
Text
Text
improve the changelog entry
2c3362829f10a1c1d38dd14fc04d66f40de13a43
<ide><path>activerecord/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <del>* Fix a problem wrong exception is occured <del> when raising no translatable exception in PostgreSQL. <add>* Fix bug that raises the wrong exception when the exception handled by PostgreSQL adapter <add> doesn't respond to `#result`. <add> Fixes #8617. <ide> <ide> *kennyj* <ide>
1
Ruby
Ruby
add passthrough method and tests
e88f6b9da9fab7dde364a8049b023b736b6ef002
<ide><path>Library/Homebrew/cli/args.rb <ide> def option_to_name(option) <ide> end <ide> <ide> def cli_args <del> return @cli_args unless @cli_args.nil? <add> return @cli_args if @cli_args <ide> <ide> @cli_args = [] <ide> processed_options.each do |short, long| <ide> option = long || short <ide> switch = "#{option_to_name(option)}?".to_sym <ide> flag = option_to_name(option).to_sym <del> if @table[switch].instance_of? TrueClass <del> @cli_args << option <del> elsif @table[flag].instance_of? TrueClass <add> if @table[switch] == true || @table[flag] == true <ide> @cli_args << option <ide> elsif @table[flag].instance_of? String <ide> @cli_args << option + "=" + @table[flag] <ide> def options_only <ide> def flags_only <ide> @flags_only ||= cli_args.select { |arg| arg.start_with?("--") } <ide> end <add> <add> def passthrough <add> options_only - CLI::Parser.global_options.values.map(&:first).flatten <add> end <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/cmd/cat.rb <ide> def cat <ide> raise "`brew cat` doesn't support multiple arguments" if args.remaining.size > 1 <ide> <ide> cd HOMEBREW_REPOSITORY <del> cat_args = Homebrew.args.options_only - CLI::Parser.global_options.values.map(&:first).flatten <del> safe_system "cat", formulae.first.path, *cat_args <add> safe_system "cat", formulae.first.path, *Homebrew.args.passthrough <ide> end <ide> end <ide><path>Library/Homebrew/cmd/list.rb <ide> def list <ide> puts Formatter.columns(full_names) <ide> else <ide> ENV["CLICOLOR"] = nil <del> ls_args = Homebrew.args.options_only - CLI::Parser.global_options.values.map(&:first).flatten <del> safe_system "ls", *ls_args << HOMEBREW_CELLAR <add> safe_system "ls", *Homebrew.args.passthrough << HOMEBREW_CELLAR <ide> end <ide> elsif args.verbose? || !$stdout.tty? <ide> system_command! "find", args: ARGV.kegs.map(&:to_s) + %w[-not -type d -print], print_stdout: true <ide><path>Library/Homebrew/test/cli/parser_spec.rb <ide> parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) <ide> expect(Homebrew.args.flags_only).to eq %w[--foo --bar=value --verbose] <ide> end <add> <add> it "#passthrough" do <add> parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) <add> expect(Homebrew.args.passthrough).to eq %w[--foo --bar=value -s] <add> end <ide> end <ide> end
4
Javascript
Javascript
add some semicolons for linting.
8aed0cd67ec7c52a689bd729ad4ec9ee4a80b45b
<ide><path>src/isomorphic/classic/types/checkReactTypeSpec.js <ide> if ( <ide> // https://github.com/facebook/react/issues/7240 <ide> // Remove the inline requires when we don't need them anymore: <ide> // https://github.com/facebook/react/pull/7178 <del> ReactComponentTreeHook = require('ReactComponentTreeHook') <add> ReactComponentTreeHook = require('ReactComponentTreeHook'); <ide> } <ide> <ide> var loggedTypeFailures = {}; <ide><path>src/renderers/shared/stack/reconciler/ReactChildReconciler.js <ide> if ( <ide> // https://github.com/facebook/react/issues/7240 <ide> // Remove the inline requires when we don't need them anymore: <ide> // https://github.com/facebook/react/pull/7178 <del> ReactComponentTreeHook = require('ReactComponentTreeHook') <add> ReactComponentTreeHook = require('ReactComponentTreeHook'); <ide> } <ide> <ide> function instantiateChild(childInstances, child, name, selfDebugID) { <ide><path>src/shared/utils/flattenChildren.js <ide> if ( <ide> // https://github.com/facebook/react/issues/7240 <ide> // Remove the inline requires when we don't need them anymore: <ide> // https://github.com/facebook/react/pull/7178 <del> ReactComponentTreeHook = require('ReactComponentTreeHook') <add> ReactComponentTreeHook = require('ReactComponentTreeHook'); <ide> } <ide> <ide> /**
3
Javascript
Javascript
fix ie9 canplaytype error. fixes #519
db97df69dcac407b011b04c1552c06a7d3bf4390
<ide><path>src/js/media/html5.js <ide> vjs.Html5.prototype.defaultMuted = function(){ return this.el_.defaultMuted; }; <ide> /* HTML5 Support Testing ---------------------------------------------------- */ <ide> <ide> vjs.Html5.isSupported = function(){ <del> return !!document.createElement('video').canPlayType; <add> return !!vjs.TEST_VID.canPlayType; <ide> }; <ide> <ide> vjs.Html5.canPlaySource = function(srcObj){ <del> return !!document.createElement('video').canPlayType(srcObj.type); <add> // IE9 on Windows 7 without MediaPlayer throws an error here <add> // https://github.com/videojs/video.js/issues/519 <add> try { <add> return !!vjs.TEST_VID.canPlayType(srcObj.type); <add> } catch(e) { <add> return ''; <add> } <ide> // TODO: Check Type <ide> // If no Type, check ext <ide> // Check Media Type
1
Go
Go
update systemd to match fs backend
5b094530c09bca403819c06635c2f7fbaf98b937
<ide><path>daemon/execdriver/native/configuration/parse.go <ide> var actions = map[string]Action{ <ide> "cgroups.memory_swap": memorySwap, // set the memory swap limit <ide> "cgroups.cpuset.cpus": cpusetCpus, // set the cpus used <ide> <add> "systemd.slice": systemdSlice, // set parent Slice used for systemd unit <add> <ide> "apparmor_profile": apparmorProfile, // set the apparmor profile to apply <ide> <ide> "fs.readonly": readonlyFs, // make the rootfs of the container read only <ide> func cpusetCpus(container *libcontainer.Container, context interface{}, value st <ide> return nil <ide> } <ide> <add>func systemdSlice(container *libcontainer.Container, context interface{}, value string) error { <add> if container.Cgroups == nil { <add> return fmt.Errorf("cannot set slice when cgroups are disabled") <add> } <add> container.Cgroups.Slice = value <add> <add> return nil <add>} <add> <ide> func apparmorProfile(container *libcontainer.Container, context interface{}, value string) error { <ide> container.Context["apparmor_profile"] = value <ide> return nil <ide><path>pkg/cgroups/cgroups.go <ide> type Cgroup struct { <ide> CpusetCpus string `json:"cpuset_cpus,omitempty"` // CPU to use <ide> Freezer string `json:"freezer,omitempty"` // set the freeze value for the process <ide> <del> UnitProperties [][2]string `json:"unit_properties,omitempty"` // systemd unit properties <add> Slice string `json:"slice,omitempty"` // Parent slice to use for systemd <ide> } <ide> <ide> type ActiveCgroup interface { <ide><path>pkg/cgroups/systemd/apply_nosystemd.go <ide> func UseSystemd() bool { <ide> return false <ide> } <ide> <del>func systemdApply(c *Cgroup, pid int) (cgroups.ActiveCgroup, error) { <add>func Apply(c *Cgroup, pid int) (cgroups.ActiveCgroup, error) { <ide> return nil, fmt.Errorf("Systemd not supported") <ide> } <ide><path>pkg/cgroups/systemd/apply_systemd.go <ide> package systemd <ide> <ide> import ( <del> "fmt" <ide> "io/ioutil" <add> "os" <ide> "path/filepath" <add> "strconv" <ide> "strings" <ide> "sync" <ide> <ide> import ( <ide> ) <ide> <ide> type systemdCgroup struct { <add> cleanupDirs []string <ide> } <ide> <ide> type DeviceAllow struct { <ide> func getIfaceForUnit(unitName string) string { <ide> return "Unit" <ide> } <ide> <add>type cgroupArg struct { <add> File string <add> Value string <add>} <add> <ide> func Apply(c *cgroups.Cgroup, pid int) (cgroups.ActiveCgroup, error) { <ide> var ( <ide> unitName = c.Parent + "-" + c.Name + ".scope" <ide> slice = "system.slice" <ide> properties []systemd1.Property <add> cpuArgs []cgroupArg <add> cpusetArgs []cgroupArg <add> memoryArgs []cgroupArg <add> res systemdCgroup <ide> ) <ide> <del> for _, v := range c.UnitProperties { <del> switch v[0] { <del> case "Slice": <del> slice = v[1] <del> default: <del> return nil, fmt.Errorf("Unknown unit propery %s", v[0]) <add> // First set up things not supported by systemd <add> <add> // -1 disables memorySwap <add> if c.MemorySwap >= 0 && (c.Memory != 0 || c.MemorySwap > 0) { <add> memorySwap := c.MemorySwap <add> <add> if memorySwap == 0 { <add> // By default, MemorySwap is set to twice the size of RAM. <add> memorySwap = c.Memory * 2 <ide> } <add> <add> memoryArgs = append(memoryArgs, cgroupArg{"memory.memsw.limit_in_bytes", strconv.FormatInt(memorySwap, 10)}) <add> } <add> <add> if c.CpusetCpus != "" { <add> cpusetArgs = append(cpusetArgs, cgroupArg{"cpuset.cpus", c.CpusetCpus}) <add> } <add> <add> if c.Slice != "" { <add> slice = c.Slice <ide> } <ide> <ide> properties = append(properties, <ide> func Apply(c *cgroups.Cgroup, pid int) (cgroups.ActiveCgroup, error) { <ide> })}) <ide> } <ide> <del> // Always enable accounting, this gets us the same behaviour as the raw implementation, <add> // Always enable accounting, this gets us the same behaviour as the fs implementation, <ide> // plus the kernel has some problems with joining the memory cgroup at a later time. <ide> properties = append(properties, <ide> systemd1.Property{"MemoryAccounting", dbus.MakeVariant(true)}, <del> systemd1.Property{"CPUAccounting", dbus.MakeVariant(true)}) <add> systemd1.Property{"CPUAccounting", dbus.MakeVariant(true)}, <add> systemd1.Property{"BlockIOAccounting", dbus.MakeVariant(true)}) <ide> <ide> if c.Memory != 0 { <ide> properties = append(properties, <ide> func Apply(c *cgroups.Cgroup, pid int) (cgroups.ActiveCgroup, error) { <ide> return nil, err <ide> } <ide> } <del> return &systemdCgroup{}, nil <add> <add> if len(cpuArgs) != 0 { <add> mountpoint, err := cgroups.FindCgroupMountpoint("cpu") <add> if err != nil { <add> return nil, err <add> } <add> <add> path := filepath.Join(mountpoint, cgroup) <add> <add> for _, arg := range cpuArgs { <add> if err := ioutil.WriteFile(filepath.Join(path, arg.File), []byte(arg.Value), 0700); err != nil { <add> return nil, err <add> } <add> } <add> } <add> <add> if len(memoryArgs) != 0 { <add> mountpoint, err := cgroups.FindCgroupMountpoint("memory") <add> if err != nil { <add> return nil, err <add> } <add> <add> path := filepath.Join(mountpoint, cgroup) <add> <add> for _, arg := range memoryArgs { <add> if err := ioutil.WriteFile(filepath.Join(path, arg.File), []byte(arg.Value), 0700); err != nil { <add> return nil, err <add> } <add> } <add> } <add> <add> if len(cpusetArgs) != 0 { <add> // systemd does not atm set up the cpuset controller, so we must manually <add> // join it. Additionally that is a very finicky controller where each <add> // level must have a full setup as the default for a new directory is "no cpus", <add> // so we avoid using any hierarchies here, creating a toplevel directory. <add> mountpoint, err := cgroups.FindCgroupMountpoint("cpuset") <add> if err != nil { <add> return nil, err <add> } <add> initPath, err := cgroups.GetInitCgroupDir("cpuset") <add> if err != nil { <add> return nil, err <add> } <add> <add> rootPath := filepath.Join(mountpoint, initPath) <add> <add> path := filepath.Join(mountpoint, initPath, c.Parent+"-"+c.Name) <add> <add> res.cleanupDirs = append(res.cleanupDirs, path) <add> <add> if err := os.MkdirAll(path, 0755); err != nil && !os.IsExist(err) { <add> return nil, err <add> } <add> <add> foundCpus := false <add> foundMems := false <add> <add> for _, arg := range cpusetArgs { <add> if arg.File == "cpuset.cpus" { <add> foundCpus = true <add> } <add> if arg.File == "cpuset.mems" { <add> foundMems = true <add> } <add> if err := ioutil.WriteFile(filepath.Join(path, arg.File), []byte(arg.Value), 0700); err != nil { <add> return nil, err <add> } <add> } <add> <add> // These are required, if not specified inherit from parent <add> if !foundCpus { <add> s, err := ioutil.ReadFile(filepath.Join(rootPath, "cpuset.cpus")) <add> if err != nil { <add> return nil, err <add> } <add> <add> if err := ioutil.WriteFile(filepath.Join(path, "cpuset.cpus"), s, 0700); err != nil { <add> return nil, err <add> } <add> } <add> <add> // These are required, if not specified inherit from parent <add> if !foundMems { <add> s, err := ioutil.ReadFile(filepath.Join(rootPath, "cpuset.mems")) <add> if err != nil { <add> return nil, err <add> } <add> <add> if err := ioutil.WriteFile(filepath.Join(path, "cpuset.mems"), s, 0700); err != nil { <add> return nil, err <add> } <add> } <add> <add> if err := ioutil.WriteFile(filepath.Join(path, "cgroup.procs"), []byte(strconv.Itoa(pid)), 0700); err != nil { <add> return nil, err <add> } <add> } <add> <add> return &res, nil <ide> } <ide> <ide> func (c *systemdCgroup) Cleanup() error { <del> // systemd cleans up, we don't need to do anything <add> // systemd cleans up, we don't need to do much <add> <add> for _, path := range c.cleanupDirs { <add> os.RemoveAll(path) <add> } <add> <ide> return nil <ide> }
4
Text
Text
add a readme.md with usage instructions
4433f7a6a15015cce40233b9d657bca22265e31c
<ide><path>script/update-server/README.md <add># Atom Update Test Server <add> <add>This folder contains a simple implementation of Atom's update server to be used for testing the update process with local builds. <add> <add>## How to use it <add> <add>1. Since you probably want to try upgrading an installed Atom release to a newer version, start your shell and set the `ATOM_RELEASE_VERSION` environment var to the desired version: <add> <add> **Windows** <add> ``` <add> set ATOM_RELEASE_VERSION="1.32.0-beta1" <add> ``` <add> <add> **macOS** <add> ``` <add> export ATOM_RELEASE_VERSION="1.32.0-beta1" <add> ``` <add> <add>2. Run a full build of Atom such that the necessary release artifacts are in the `out` folder: <add> <add> **Windows** <add> ``` <add> script/build --create-windows-installer <add> ``` <add> <add> **macOS** <add> ``` <add> script/build --compress-artifacts <add> ``` <add> <add>3. Start up the server in this folder: <add> <add> ``` <add> npm install <add> npm start <add> ``` <add> <add> **NOTE:** You can customize the port by setting the `PORT` environment variable. <add> <add>4. Start Atom from the command line with the `ATOM_UPDATE_URL_PREFIX` environment variable set to `http://localhost:3456` (change this to reflect any `PORT` override you might have used) <add> <add>5. Open the About page and try to update Atom. The update server will write output to the console when requests are received.
1
PHP
PHP
add a dockblock
ac64ea3cd7a74c3f417c11942eb55cc37e4a1fc7
<ide><path>src/Console/CommandFactory.php <ide> <ide> use InvalidArgumentException; <ide> <add>/** <add> * This is a factory for creating Command and Shell instances. <add> * <add> * This factory can be replaced or extended if you need to customize building <add> * your command and shell objects. <add> */ <ide> class CommandFactory implements CommandFactoryInterface <ide> { <ide>
1
Mixed
Text
allow access to nested secrets by method calls
94d1d52c0307fdd2aeb8f62652a8a5f4a9ab99cc
<ide><path>activesupport/CHANGELOG.md <add>* Allow nested access to keys on `Rails.application.credentials` <add> <add> Previously only top level keys in `credentials.yml.enc` could be accessed with method calls. Now any key can. <add> <add> For example, given these secrets: <add> <add> ```yml <add> aws: <add> access_key_id: 123 <add> secret_access_key: 345 <add> ``` <add> <add> `Rails.application.credentials.aws.access_key_id` will now return the same thing as `Rails.application.credentials.aws[:access_key_id]` <add> <add> *Alex Ghiculescu* <add> <ide> * Added a faster and more compact `ActiveSupport::Cache` serialization format. <ide> <ide> It can be enabled with `config.active_support.cache_format_version = 7.0` or <ide><path>activesupport/lib/active_support/encrypted_configuration.rb <ide> def config <ide> end <ide> <ide> private <add> def deep_transform(hash) <add> hash.transform_values { |value| value.is_a?(Hash) ? ActiveSupport::InheritableOptions.new(deep_transform(value)) : value } <add> end <add> <ide> def options <del> @options ||= ActiveSupport::InheritableOptions.new(config) <add> @options ||= ActiveSupport::InheritableOptions.new(deep_transform(config)) <ide> end <ide> <ide> def deserialize(config) <ide><path>activesupport/test/encrypted_configuration_test.rb <ide> class EncryptedConfigurationTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "reading configuration by key file" do <del> @credentials.write({ something: { good: true } }.to_yaml) <add> @credentials.write({ something: { good: true, bad: false, nested: { foo: "bar" } } }.to_yaml) <ide> <ide> assert @credentials.something[:good] <add> assert_not @credentials.something[:bad] <add> assert @credentials.something.good <add> assert_not @credentials.something.bad <add> assert_equal "bar", @credentials.dig(:something, :nested, :foo) <add> assert_equal "bar", @credentials.something.nested.foo <ide> end <ide> <ide> test "reading comment-only configuration" do <ide><path>guides/source/security.md <ide> For example, with the following decrypted `config/credentials.yml.enc`: <ide> ```yaml <ide> secret_key_base: 3b7cd72... <ide> some_api_key: SOMEKEY <add>system: <add> access_key_id: 1234AB <ide> ``` <ide> <del>`Rails.application.credentials.some_api_key` returns `"SOMEKEY"`. <add>`Rails.application.credentials.some_api_key` returns `"SOMEKEY"`. `Rails.application.credentials.system.access_key_id` returns `"1234AB"`. <ide> <ide> If you want an exception to be raised when some key is blank, you can use the bang <ide> version:
4
Python
Python
add rokenizer test for zero length string
0ae05f77ab568c155bc3ddc704f5c115ca7fc18b
<ide><path>tests/test_tokenizer.py <ide> def EN(): <ide> return English().tokenizer <ide> <add>def test_no_word(EN): <add> tokens = EN(u'') <add> assert len(tokens) == 0 <add> <ide> def test_single_word(EN): <ide> tokens = EN(u'hello') <ide> assert tokens[0].orth_ == 'hello'
1
Ruby
Ruby
add keg_only_style tests
bf491e5102f52847ba93aad0dc0f2976f86395d6
<ide><path>Library/Homebrew/test/dev-cmd/audit_spec.rb <ide> def caveats <ide> .to eq(["Don't recommend setuid in the caveats, suggest sudo instead."]) <ide> end <ide> <add> describe "#audit_keg_only_style" do <add> specify "keg_only_needs_downcasing" do <add> fa = formula_auditor "foo", <<-EOS.undent, strict: true <add> class Foo < Formula <add> url "http://example.com/foo-1.0.tgz" <add> <add> keg_only "Because why not" <add> end <add> EOS <add> <add> fa.audit_keg_only_style <add> expect(fa.problems) <add> .to eq(["'Because' from the keg_only reason should be 'because'.\n"]) <add> end <add> <add> specify "keg_only_redundant_period" do <add> fa = formula_auditor "foo", <<-EOS.undent, strict: true <add> class Foo < Formula <add> url "http://example.com/foo-1.0.tgz" <add> <add> keg_only "because this line ends in a period." <add> end <add> EOS <add> <add> fa.audit_keg_only_style <add> expect(fa.problems) <add> .to eq(["keg_only reason should not end with a period."]) <add> end <add> <add> specify "keg_only_handles_block_correctly" do <add> fa = formula_auditor "foo", <<-EOS.undent, strict: true <add> class Foo < Formula <add> url "http://example.com/foo-1.0.tgz" <add> <add> keg_only <<-EOF.undent <add> this line starts with a lowercase word. <add> <add> This line does not but that shouldn't be a <add> problem <add> EOF <add> end <add> EOS <add> <add> fa.audit_keg_only_style <add> expect(fa.problems) <add> .to eq([]) <add> end <add> <add> specify "keg_only_handles_whitelist_correctly" do <add> fa = formula_auditor "foo", <<-EOS.undent, strict: true <add> class Foo < Formula <add> url "http://example.com/foo-1.0.tgz" <add> <add> keg_only "Apple ships foo in the CLT package" <add> end <add> EOS <add> <add> fa.audit_keg_only_style <add> expect(fa.problems) <add> .to eq([]) <add> end <add> end <add> <ide> describe "#audit_homepage" do <ide> specify "homepage URLs" do <ide> fa = formula_auditor "foo", <<-EOS.undent, online: true
1
Python
Python
extract code present in both branches
0eb34b8f19b8585c53ebcdb6ed4d4d66aad7fa9b
<ide><path>numpy/core/numerictypes.py <ide> def _set_up_aliases(): <ide> ('clongfloat', 'clongdouble'), <ide> ('longcomplex', 'clongdouble'), <ide> ('bool_', 'bool'), <add> ('bytes_', 'string'), <add> ('string_', 'string'), <ide> ('unicode_', 'unicode'), <ide> ('object_', 'object')] <ide> if sys.version_info[0] >= 3: <del> type_pairs.extend([('bytes_', 'string'), <del> ('str_', 'unicode'), <del> ('string_', 'string')]) <add> type_pairs.extend([('str_', 'unicode')]) <ide> else: <del> type_pairs.extend([('str_', 'string'), <del> ('string_', 'string'), <del> ('bytes_', 'string')]) <add> type_pairs.extend([('str_', 'string')]) <ide> for alias, t in type_pairs: <ide> allTypes[alias] = allTypes[t] <ide> sctypeDict[alias] = sctypeDict[t]
1
Python
Python
remove the docker timeout workaround
3154935138748a8ac89aa4c8fde848e31610941b
<ide><path>airflow/providers/docker/operators/docker_swarm.py <ide> """Run ephemeral Docker Swarm services""" <ide> from typing import List, Optional, Union <ide> <del>import requests <ide> from docker import types <ide> <ide> from airflow.exceptions import AirflowException <ide> def _stream_logs_to_output(self) -> None: <ide> while True: <ide> try: <ide> log = next(logs) <del> # TODO: Remove this clause once https://github.com/docker/docker-py/issues/931 is fixed <del> except requests.exceptions.ConnectionError: <del> # If the service log stream stopped sending messages, check if it the service has <del> # terminated. <del> if self._has_service_terminated(): <del> break <ide> except StopIteration: <ide> # If the service log stream terminated, stop fetching logs further. <ide> break <ide><path>setup.py <ide> def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version <ide> 'sphinxcontrib-spelling==7.2.1', <ide> ] <ide> docker = [ <del> 'docker', <add> 'docker>=5.0.3', <ide> ] <ide> drill = ['sqlalchemy-drill>=1.1.0', 'sqlparse>=0.4.1'] <ide> druid = [ <ide><path>tests/providers/docker/operators/test_docker_swarm.py <ide> from unittest import mock <ide> <ide> import pytest <del>import requests <ide> from docker import APIClient, types <ide> from parameterized import parameterized <ide> <ide> def test_non_complete_service_raises_error(self, status, types_mock, client_clas <ide> operator.execute(None) <ide> assert str(ctx.value) == msg <ide> <del> @mock.patch('airflow.providers.docker.operators.docker.APIClient') <del> @mock.patch('airflow.providers.docker.operators.docker_swarm.types') <del> def test_logging_with_requests_timeout(self, types_mock, client_class_mock): <del> <del> mock_obj = mock.Mock() <del> <del> def _client_tasks_side_effect(): <del> for _ in range(2): <del> yield [{'Status': {'State': 'pending'}}] <del> while True: <del> yield [{'Status': {'State': 'complete'}}] <del> <del> def _client_service_logs_effect(): <del> yield b'Testing is awesome.' <del> raise requests.exceptions.ConnectionError('') <del> <del> client_mock = mock.Mock(spec=APIClient) <del> client_mock.create_service.return_value = {'ID': 'some_id'} <del> client_mock.service_logs.return_value = _client_service_logs_effect() <del> client_mock.images.return_value = [] <del> client_mock.pull.return_value = [b'{"status":"pull log"}'] <del> client_mock.tasks.side_effect = _client_tasks_side_effect() <del> types_mock.TaskTemplate.return_value = mock_obj <del> types_mock.ContainerSpec.return_value = mock_obj <del> types_mock.RestartPolicy.return_value = mock_obj <del> types_mock.Resources.return_value = mock_obj <del> <del> client_class_mock.return_value = client_mock <del> <del> operator = DockerSwarmOperator( <del> api_version='1.19', <del> command='env', <del> environment={'UNIT': 'TEST'}, <del> image='ubuntu:latest', <del> mem_limit='128m', <del> user='unittest', <del> task_id='unittest', <del> auto_remove=True, <del> tty=True, <del> enable_logging=True, <del> ) <del> operator.execute(None) <del> <del> client_mock.service_logs.assert_called_once_with( <del> 'some_id', follow=True, stdout=True, stderr=True, is_tty=True <del> ) <del> <ide> def test_on_kill(self): <ide> client_mock = mock.Mock(spec=APIClient) <ide>
3
Ruby
Ruby
restore the entry#bytesize comments removed in
93e53886539fc837091bebe1a9071b93b2274635
<ide><path>activesupport/lib/active_support/cache.rb <ide> def expires_at=(value) <ide> end <ide> end <ide> <del> def bytesize # :nodoc: <add> # Returns the size of the cached value. This could be less than <add> # <tt>value.bytesize</tt> if the data is compressed. <add> def bytesize <ide> case value <ide> when NilClass <ide> 0
1
Ruby
Ruby
use array maths rather than *args
e1beb7d2878cb55a045731b4a4c0c7a6046b3c09
<ide><path>activerecord/lib/active_record/associations/association_collection.rb <ide> def load_target <ide> if i <ide> @target.delete_at(i).tap do |t| <ide> keys = ["id"] + t.changes.keys + (f.attribute_names - t.attribute_names) <del> f.attributes.except(*keys).each do |k,v| <del> t.send("#{k}=", v) <add> # FIXME: this call to attributes causes many NoMethodErrors <add> attributes = f.attributes <add> (attributes.keys - keys).each do |k| <add> t.send("#{k}=", attributes[k]) <ide> end <ide> end <ide> else
1
Javascript
Javascript
add protection against directory traversal attacks
64cb8c6b982956da9cc41d0d61bbc4f98ab28ac1
<ide><path>test/webserver.js <ide> WebServer.prototype = { <ide> _handler: function (req, res) { <ide> var url = req.url.replace(/\/\//g, '/'); <ide> var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url); <del> var pathPart = decodeURI(urlParts[1]), queryPart = urlParts[3]; <add> // guard against directory traversal attacks, <add> // e.g. /../../../../../../../etc/passwd <add> // which let you make GET requests for files outside of this.root <add> var pathPart = path.normalize(decodeURI(urlParts[1])); <add> var queryPart = urlParts[3]; <ide> var verbose = this.verbose; <ide> <ide> var methodHooks = this.hooks[req.method];
1
Java
Java
update javadoc of asynchandlerinterceptor
18039785aeacc3ca76c70014b11fb30923a54941
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/AsyncHandlerInterceptor.java <ide> /* <del> * Copyright 2002-2012 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 org.springframework.web.method.HandlerMethod; <ide> <ide> /** <del> * Extends {@code HandlerInterceptor} with a callback method invoked during <del> * asynchronous request handling. <add> * Extends {@code HandlerInterceptor} with a callback method invoked after the <add> * start of asynchronous request handling. <ide> * <del> * <p>When a handler starts asynchronous request handling, the DispatcherServlet <del> * exits without invoking {@code postHandle} and {@code afterCompletion}, as it <del> * normally does, since the results of request handling (e.g. ModelAndView) <del> * will. be produced concurrently in another thread. In such scenarios, <del> * {@link #afterConcurrentHandlingStarted(HttpServletRequest, HttpServletResponse, Object)} <del> * is invoked instead allowing implementations to perform tasks such as cleaning <del> * up thread bound attributes. <add> * <p>When a handler starts an asynchronous request, the DispatcherServlet <add> * exits without invoking {@code postHandle} and {@code afterCompletion} as it <add> * normally does since the results of request handling (e.g. ModelAndView) <add> * is likely not yet ready and will be produced concurrently from another thread. <add> * In such scenarios, {@link #afterConcurrentHandlingStarted} is invoked instead <add> * allowing implementations to perform tasks such as cleaning up thread bound <add> * attributes before releasing the thread to the Servlet container. <ide> * <ide> * <p>When asynchronous handling completes, the request is dispatched to the <ide> * container for further processing. At this stage the DispatcherServlet invokes <del> * {@code preHandle}, {@code postHandle} and {@code afterCompletion} as usual. <add> * {@code preHandle}, {@code postHandle} and {@code afterCompletion}. <add> * To distinguish between the initial request and the subsequent dispatch <add> * after asynchronous handling completes, interceptors can check whether the <add> * {@code javax.servlet.DispatcherType} of {@link javax.servlet.ServletRequest} <add> * is "REQUEST" or "ASYNC". <add> * <add> * <p>Note that {@code HandlerInterceptor} implementations may be need to do work <add> * when an async request times out or completes with a network error. For such <add> * cases the Servlet container does not dispatch and therefore the <add> * {@code postHandle} and {@code afterCompletion} methods will not be invoked. <add> * Instead interceptors can register to track an asynchronous request through <add> * the {@code registerCallbackInterceptor} and {@code registerDeferredResultInterceptor} <add> * methods on {@link org.springframework.web.context.request.async.WebAsyncManager <add> * WebAsyncManager}. This can be done proactively on every request from <add> * {@code preHandle} regardless of whether async request processing will start. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 3.2 <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerInterceptor.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> public interface HandlerInterceptor { <ide> /** <ide> * Intercept the execution of a handler. Called after HandlerMapping determined <ide> * an appropriate handler object, but before HandlerAdapter invokes the handler. <add> * <ide> * <p>DispatcherServlet processes a handler in an execution chain, consisting <ide> * of any number of interceptors, with the handler itself at the end. <ide> * With this method, each interceptor can decide to abort the execution chain, <ide> * typically sending a HTTP error or writing a custom response. <add> * <add> * <p><strong>Note:</strong> special considerations apply for asynchronous <add> * request processing. For more details see <add> * {@link org.springframework.web.servlet.AsyncHandlerInterceptor}. <add> * <ide> * @param request current HTTP request <ide> * @param response current HTTP response <ide> * @param handler chosen handler to execute, for type and/or instance evaluation <ide> boolean preHandle(HttpServletRequest request, HttpServletResponse response, Obje <ide> * Intercept the execution of a handler. Called after HandlerAdapter actually <ide> * invoked the handler, but before the DispatcherServlet renders the view. <ide> * Can expose additional model objects to the view via the given ModelAndView. <add> * <ide> * <p>DispatcherServlet processes a handler in an execution chain, consisting <ide> * of any number of interceptors, with the handler itself at the end. <ide> * With this method, each interceptor can post-process an execution, <ide> * getting applied in inverse order of the execution chain. <add> * <add> * <p><strong>Note:</strong> special considerations apply for asynchronous <add> * request processing. For more details see <add> * {@link org.springframework.web.servlet.AsyncHandlerInterceptor}. <add> * <ide> * @param request current HTTP request <ide> * @param response current HTTP response <ide> * @param handler handler (or {@link HandlerMethod}) that started async <ide> void postHandle(HttpServletRequest request, HttpServletResponse response, Object <ide> * Callback after completion of request processing, that is, after rendering <ide> * the view. Will be called on any outcome of handler execution, thus allows <ide> * for proper resource cleanup. <add> * <ide> * <p>Note: Will only be called if this interceptor's {@code preHandle} <ide> * method has successfully completed and returned {@code true}! <add> * <ide> * <p>As with the {@code postHandle} method, the method will be invoked on each <ide> * interceptor in the chain in reverse order, so the first interceptor will be <ide> * the last to be invoked. <add> * <add> * <p><strong>Note:</strong> special considerations apply for asynchronous <add> * request processing. For more details see <add> * {@link org.springframework.web.servlet.AsyncHandlerInterceptor}. <add> * <ide> * @param request current HTTP request <ide> * @param response current HTTP response <ide> * @param handler handler (or {@link HandlerMethod}) that started async
2
Python
Python
update pavement.py and setup.py for numpy 1.13.0
b33a5ee781bb4a775e5ccef1fdf88b61339becba
<ide><path>pavement.py <ide> #----------------------------------- <ide> <ide> # Source of the release notes <del>RELEASE_NOTES = 'doc/release/1.12.0-notes.rst' <add>RELEASE_NOTES = 'doc/release/1.13.0-notes.rst' <ide> <ide> # Start/end of the log (from git) <del>LOG_START = 'maintenance/1.11.x' <add>LOG_START = 'maintenance/1.12.x' <ide> LOG_END = 'master' <ide> <ide> <ide> if sys.platform =="darwin": <ide> WINDOWS_PYTHON = { <ide> "3.4": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python34/python.exe"], <del> "3.3": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python33/python.exe"], <del> "3.2": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python32/python.exe"], <ide> "2.7": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"], <del> "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], <ide> } <ide> WINDOWS_ENV = os.environ <ide> WINDOWS_ENV["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/X11/lib:/usr/lib" <ide> MAKENSIS = ["wine", "makensis"] <ide> elif sys.platform == "win32": <ide> WINDOWS_PYTHON = { <ide> "3.4": ["C:\Python34\python.exe"], <del> "3.3": ["C:\Python33\python.exe"], <del> "3.2": ["C:\Python32\python.exe"], <ide> "2.7": ["C:\Python27\python.exe"], <del> "2.6": ["C:\Python26\python.exe"], <ide> } <ide> # XXX: find out which env variable is necessary to avoid the pb with python <ide> # 2.6 and random module when importing tempfile <ide> else: <ide> WINDOWS_PYTHON = { <ide> "3.4": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python34/python.exe"], <del> "3.3": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python33/python.exe"], <del> "3.2": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python32/python.exe"], <ide> "2.7": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"], <del> "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"], <ide> } <ide> WINDOWS_ENV = os.environ <ide> MAKENSIS = ["wine", "makensis"] <ide><path>setup.py <ide> Programming Language :: Python :: 3 <ide> Programming Language :: Python :: 3.4 <ide> Programming Language :: Python :: 3.5 <add>Programming Language :: Python :: 3.6 <ide> Programming Language :: Python :: Implementation :: CPython <ide> Topic :: Software Development <ide> Topic :: Scientific/Engineering <ide> """ <ide> <ide> MAJOR = 1 <del>MINOR = 12 <add>MINOR = 13 <ide> MICRO = 0 <ide> ISRELEASED = False <ide> VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
2
Text
Text
add documentation for `docker stack ps`
970ab9a224658e17894a7673189ad9d2491a592d
<ide><path>docs/reference/commandline/stack_config.md <ide> Displays the configuration of a stack. <ide> * [stack deploy](stack_deploy.md) <ide> * [stack rm](stack_rm.md) <ide> * [stack services](stack_services.md) <del>* [stack tasks](stack_tasks.md) <add>* [stack ps](stack_ps.md) <ide> * [stack ls](stack_ls.md) <ide><path>docs/reference/commandline/stack_deploy.md <ide> axqh55ipl40h vossibility-stack_vossibility-collector 1 icecrime/vossibility-co <ide> * [stack config](stack_config.md) <ide> * [stack rm](stack_rm.md) <ide> * [stack services](stack_services.md) <del>* [stack tasks](stack_tasks.md) <add>* [stack ps](stack_ps.md) <ide> * [stack ls](stack_ls.md) <ide><path>docs/reference/commandline/stack_ls.md <ide> myapp 2 <ide> * [stack config](stack_config.md) <ide> * [stack deploy](stack_deploy.md) <ide> * [stack rm](stack_rm.md) <del>* [stack tasks](stack_tasks.md) <add>* [stack ps](stack_ps.md) <add><path>docs/reference/commandline/stack_ps.md <del><path>docs/reference/commandline/stack_tasks.md <ide> <!--[metadata]> <ide> +++ <del>title = "stack tasks" <del>description = "The stack tasks command description and usage" <del>keywords = ["stack, tasks"] <add>title = "stack ps" <add>description = "The stack ps command description and usage" <add>keywords = ["stack, ps"] <ide> advisory = "experimental" <ide> [menu.main] <ide> parent = "smn_cli" <ide> +++ <ide> <![end-metadata]--> <ide> <del># stack tasks (experimental) <add># stack ps (experimental) <ide> <ide> ```markdown <del>Usage: docker stack tasks [OPTIONS] STACK <add>Usage: docker stack ps [OPTIONS] STACK <ide> <ide> List the tasks in the stack <ide> <ide> Options: <ide> -a, --all Display all tasks <ide> -f, --filter value Filter output based on conditions provided <del> --help Print usage <ide> --no-resolve Do not map IDs to Names <add> --no-trunc Do not truncate output <ide> ``` <ide> <ide> Lists the tasks that are running as part of the specified stack. This <ide><path>docs/reference/commandline/stack_rm.md <ide> a manager node. <ide> * [stack config](stack_config.md) <ide> * [stack deploy](stack_deploy.md) <ide> * [stack services](stack_services.md) <del>* [stack tasks](stack_tasks.md) <add>* [stack ps](stack_ps.md) <ide> * [stack ls](stack_ls.md) <ide><path>docs/reference/commandline/stack_services.md <ide> dn7m7nhhfb9y myapp_db 1/1 mysql@sha256:a9a5b559f8821fe73d58c3606c8 <ide> <ide> The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there <ide> is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`). <del>Multiple filter flags are combined as an `OR` filter. <add>Multiple filter flags are combined as an `OR` filter. <ide> <ide> The following command shows both the `web` and `db` services: <ide> <ide> The currently supported filters are: <ide> * [stack config](stack_config.md) <ide> * [stack deploy](stack_deploy.md) <ide> * [stack rm](stack_rm.md) <del>* [stack tasks](stack_tasks.md) <add>* [stack ps](stack_ps.md) <ide> * [stack ls](stack_ls.md)
6
Java
Java
fix checks for already set padding
9724eaeb42da451305a057969fe4c6a24ea5fb36
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatARTSurfaceViewShadowNode.java <ide> public void resetPaddingChanged() { <ide> <ide> @Override <ide> public void setPadding(int spacingType, float padding) { <del> if (getPadding(spacingType) != padding) { <add> if (getStylePadding(spacingType) != padding) { <ide> super.setPadding(spacingType, padding); <ide> mPaddingChanged = true; <ide> markUpdated(); <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatReactModalShadowNode.java <ide> public void resetPaddingChanged() { <ide> <ide> @Override <ide> public void setPadding(int spacingType, float padding) { <del> if (getPadding(spacingType) != padding) { <add> if (getStylePadding(spacingType) != padding) { <ide> super.setPadding(spacingType, padding); <ide> mPaddingChanged = true; <ide> markUpdated(); <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/NativeViewWrapper.java <ide> public void addChildAt(ReactShadowNode child, int i) { <ide> <ide> @Override <ide> public void setPadding(int spacingType, float padding) { <del> if (getPadding(spacingType) != padding) { <add> if (getStylePadding(spacingType) != padding) { <ide> super.setPadding(spacingType, padding); <ide> mPaddingChanged = true; <ide> markUpdated(); <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java <ide> public final float getPadding(int spacingType) { <ide> return mYogaNode.getLayoutPadding(YogaEdge.fromInt(spacingType)); <ide> } <ide> <add> public final float getStylePadding(int spacingType) { <add> return mYogaNode.getPadding(YogaEdge.fromInt(spacingType)).value; <add> } <add> <ide> public void setDefaultPadding(int spacingType, float padding) { <ide> mDefaultPadding.set(spacingType, padding); <ide> updatePadding();
4
Go
Go
fix docker daemon restart with paused container
9a9724ad5616dc1a29efabe8082bde043c1a2bc9
<ide><path>daemon/daemon.go <ide> import ( <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/namesgenerator" <ide> "github.com/docker/docker/pkg/nat" <add> "github.com/docker/docker/pkg/signal" <ide> "github.com/docker/docker/pkg/stringid" <ide> "github.com/docker/docker/pkg/sysinfo" <ide> "github.com/docker/docker/pkg/system" <ide> func (daemon *Daemon) Shutdown() error { <ide> <ide> go func() { <ide> defer group.Done() <del> // If container failed to exit in 10 seconds of SIGTERM, then using the force <del> if err := c.Stop(10); err != nil { <del> logrus.Errorf("Stop container %s with error: %v", c.ID, err) <add> // TODO(windows): Handle docker restart with paused containers <add> if c.IsPaused() { <add> // To terminate a process in freezer cgroup, we should send <add> // SIGTERM to this process then unfreeze it, and the process will <add> // force to terminate immediately. <add> logrus.Debugf("Found container %s is paused, sending SIGTERM before unpause it", c.ID) <add> sig, ok := signal.SignalMap["TERM"] <add> if !ok { <add> logrus.Warnf("System does not support SIGTERM") <add> return <add> } <add> if err := daemon.Kill(c, int(sig)); err != nil { <add> logrus.Debugf("sending SIGTERM to container %s with error: %v", c.ID, err) <add> return <add> } <add> if err := c.Unpause(); err != nil { <add> logrus.Debugf("Failed to unpause container %s with error: %v", c.ID, err) <add> return <add> } <add> if _, err := c.WaitStop(10 * time.Second); err != nil { <add> logrus.Debugf("container %s failed to exit in 10 second of SIGTERM, sending SIGKILL to force", c.ID) <add> sig, ok := signal.SignalMap["KILL"] <add> if !ok { <add> logrus.Warnf("System does not support SIGKILL") <add> return <add> } <add> daemon.Kill(c, int(sig)) <add> } <add> } else { <add> // If container failed to exit in 10 seconds of SIGTERM, then using the force <add> if err := c.Stop(10); err != nil { <add> logrus.Errorf("Stop container %s with error: %v", c.ID, err) <add> } <ide> } <ide> c.WaitStop(-1 * time.Second) <ide> logrus.Debugf("container stopped %s", c.ID) <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) { <ide> c.Fatalf("Unexpected log-opt: %s, expected map[max-size:1k]", cfg) <ide> } <ide> } <add> <add>func (s *DockerDaemonSuite) TestDaemonRestartWithPausedContainer(c *check.C) { <add> if err := s.d.StartWithBusybox(); err != nil { <add> c.Fatal(err) <add> } <add> if out, err := s.d.Cmd("run", "-i", "-d", "--name", "test", "busybox", "top"); err != nil { <add> c.Fatal(err, out) <add> } <add> if out, err := s.d.Cmd("pause", "test"); err != nil { <add> c.Fatal(err, out) <add> } <add> if err := s.d.Restart(); err != nil { <add> c.Fatal(err) <add> } <add> <add> errchan := make(chan error) <add> go func() { <add> out, err := s.d.Cmd("start", "test") <add> if err != nil { <add> errchan <- fmt.Errorf("%v:\n%s", err, out) <add> } <add> name := strings.TrimSpace(out) <add> if name != "test" { <add> errchan <- fmt.Errorf("Paused container start error on docker daemon restart, expected 'test' but got '%s'", name) <add> } <add> close(errchan) <add> }() <add> <add> select { <add> case <-time.After(5 * time.Second): <add> c.Fatal("Waiting on start a container timed out") <add> case err := <-errchan: <add> if err != nil { <add> c.Fatal(err) <add> } <add> } <add> <add>}
2
Javascript
Javascript
add etc1 compressed texture support
0dd332ed4bfe289361a37db7177aa7a1d24567ee
<ide><path>examples/js/loaders/DDSLoader.js <ide> THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) { <ide> var FOURCC_DXT1 = fourCCToInt32( "DXT1" ); <ide> var FOURCC_DXT3 = fourCCToInt32( "DXT3" ); <ide> var FOURCC_DXT5 = fourCCToInt32( "DXT5" ); <add> var FOURCC_ETC1 = fourCCToInt32( "ETC1" ); <ide> <ide> var headerLengthInt = 31; // The header length in 32 bit ints <ide> <ide> THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) { <ide> dds.format = THREE.RGBA_S3TC_DXT5_Format; <ide> break; <ide> <add> case FOURCC_ETC1: <add> <add> blockBytes = 8; <add> dds.format = THREE.RGB_ETC1_Format; <add> break; <add> <ide> default: <ide> <ide> if ( header[ off_RGBBitCount ] === 32 <ide><path>src/Three.js <ide> THREE.RGB_PVRTC_2BPPV1_Format = 2101; <ide> THREE.RGBA_PVRTC_4BPPV1_Format = 2102; <ide> THREE.RGBA_PVRTC_2BPPV1_Format = 2103; <ide> <add>// ETC compressed texture formats <add> <add>THREE.RGB_ETC1_Format = 2151; <add> <ide> // Loop styles for AnimationAction <ide> <ide> THREE.LoopOnce = 2200; <ide><path>src/renderers/WebGLRenderer.js <ide> THREE.WebGLRenderer = function ( parameters ) { <ide> <ide> } <ide> <add> extension = extensions.get( 'WEBGL_compressed_texture_etc1' ); <add> <add> if ( extension !== null ) { <add> <add> if ( p === THREE.RGB_ETC1_Format ) return extension.COMPRESSED_RGB_ETC1_WEBGL; <add> <add> } <add> <ide> extension = extensions.get( 'EXT_blend_minmax' ); <ide> <ide> if ( extension !== null ) { <ide><path>src/renderers/webgl/WebGLExtensions.js <ide> THREE.WebGLExtensions = function ( gl ) { <ide> extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); <ide> break; <ide> <add> case 'WEBGL_compressed_texture_etc1': <add> extension = gl.getExtension( 'WEBGL_compressed_texture_etc1' ); <add> break; <add> <ide> default: <ide> extension = gl.getExtension( name ); <ide> <ide><path>src/renderers/webgl/WebGLState.js <ide> THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) { <ide> compressedTextureFormats = []; <ide> <ide> if ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || <del> extensions.get( 'WEBGL_compressed_texture_s3tc' ) ) { <add> extensions.get( 'WEBGL_compressed_texture_s3tc' ) || <add> extensions.get( 'WEBGL_compressed_texture_etc1' )) { <ide> <ide> var formats = gl.getParameter( gl.COMPRESSED_TEXTURE_FORMATS ); <ide>
5
Javascript
Javascript
remove duplicate line
0f95a93a2c1928c4524521c52cc4c88d48612fe4
<ide><path>lib/tls.js <ide> Server.prototype.setOptions = function(options) { <ide> if (options.secureProtocol) this.secureProtocol = options.secureProtocol; <ide> if (options.crl) this.crl = options.crl; <ide> if (options.ciphers) this.ciphers = options.ciphers; <del> if (options.secureProtocol) this.secureProtocol = options.secureProtocol; <ide> var secureOptions = options.secureOptions || 0; <ide> if (options.honorCipherOrder) { <ide> secureOptions |= constants.SSL_OP_CIPHER_SERVER_PREFERENCE;
1
Javascript
Javascript
fix double fullscreenchange event
1c0fa32b3a866b17ae51fca6b67d81c37e0a1973
<ide><path>src/js/fullscreen-api.js <ide> const apiMap = [ <ide> <ide> const specApi = apiMap[0]; <ide> let browserApi; <del>let prefixedAPI = true; <add>let prefixedAPI = false; <ide> <ide> // determine the supported set of functions <ide> for (let i = 0; i < apiMap.length; i++) { <ide> if (browserApi) { <ide> FullscreenApi[specApi[i]] = browserApi[i]; <ide> } <ide> <del> prefixedAPI = browserApi[0] !== specApi[0]; <add> prefixedAPI = browserApi[0] === specApi[0]; <ide> } <ide> <ide> export default FullscreenApi; <ide><path>src/js/player.js <ide> class Player extends Component { <ide> this.reportUserActivity(); <ide> <ide> this.one('play', this.listenForUserActivity_); <del> <del> if (FullscreenApi.fullscreenchange) { <del> this.on(FullscreenApi.fullscreenchange, this.handleFullscreenChange_); <del> <del> if (IE_VERSION || browser.IS_FIREFOX && prefixedFS) { <del> this.on(document, FullscreenApi.fullscreenchange, this.handleFullscreenChange_); <del> } <del> } <del> <ide> this.on('stageclick', this.handleStageClick_); <ide> <ide> this.breakpoints(this.options_.breakpoints); <ide> class Player extends Component { <ide> // prevent dispose from being called twice <ide> this.off('dispose'); <ide> <del> // make sure to remove fs handler on IE from the document <del> if (IE_VERSION || browser.IS_FIREFOX && prefixedFS) { <del> this.off(document, FullscreenApi.fullscreenchange, this.handleFullscreenChange_); <del> } <del> <ide> if (this.styleEl_ && this.styleEl_.parentNode) { <ide> this.styleEl_.parentNode.removeChild(this.styleEl_); <ide> this.styleEl_ = null; <ide> class Player extends Component { <ide> } <ide> <ide> /** <del> * Fired when the player switches in or out of fullscreen mode <del> * <ide> * @private <del> * @listens Player#fullscreenchange <del> * @listens Player#webkitfullscreenchange <del> * @listens Player#mozfullscreenchange <del> * @listens Player#MSFullscreenChange <del> * @fires Player#fullscreenchange <ide> */ <del> handleFullscreenChange_(event = {}, retriggerEvent = true) { <add> toggleFullscreenClass_() { <ide> if (this.isFullscreen()) { <ide> this.addClass('vjs-fullscreen'); <ide> } else { <ide> this.removeClass('vjs-fullscreen'); <ide> } <del> <del> if (prefixedFS && retriggerEvent) { <del> /** <del> * @event Player#fullscreenchange <del> * @type {EventTarget~Event} <del> */ <del> this.trigger('fullscreenchange'); <del> } <ide> } <ide> <ide> /** <ide> class Player extends Component { <ide> // If cancelling fullscreen, remove event listener. <ide> if (this.isFullscreen() === false) { <ide> Events.off(document, fsApi.fullscreenchange, Fn.bind(this, this.documentFullscreenChange_)); <del> if (prefixedFS) { <del> this.handleFullscreenChange_({}, false); <del> } else { <del> this.on(FullscreenApi.fullscreenchange, this.handleFullscreenChange_); <del> } <add> } <add> <add> if (!prefixedFS) { <add> /** <add> * @event Player#fullscreenchange <add> * @type {EventTarget~Event} <add> */ <add> this.trigger('fullscreenchange'); <ide> } <ide> } <ide> <ide> class Player extends Component { <ide> if (data) { <ide> this.isFullscreen(data.isFullscreen); <ide> } <add> <ide> /** <ide> * Fired when going in and out of fullscreen. <ide> * <ide> class Player extends Component { <ide> isFullscreen(isFS) { <ide> if (isFS !== undefined) { <ide> this.isFullscreen_ = !!isFS; <add> this.toggleFullscreenClass_(); <ide> return; <ide> } <ide> return !!this.isFullscreen_; <ide> class Player extends Component { <ide> // the browser supports going fullscreen at the element level so we can <ide> // take the controls fullscreen as well as the video <ide> <del> if (!prefixedFS) { <del> this.off(FullscreenApi.fullscreenchange, this.handleFullscreenChange_); <del> } <del> <ide> // Trigger fullscreenchange event after change <ide> // We have to specifically add this each time, and remove <ide> // when canceling fullscreen. Otherwise if there's multiple <ide> class Player extends Component { <ide> <ide> // Check for browser element fullscreen support <ide> if (fsApi.requestFullscreen) { <del> // remove the document level handler if we're getting called directly. <del> Events.off(document, fsApi.fullscreenchange, Fn.bind(this, this.documentFullscreenChange_)); <ide> document[fsApi.exitFullscreen](); <ide> } else if (this.tech_.supportsFullScreen()) { <ide> this.techCall_('exitFullScreen');
2
PHP
PHP
fix token bug in eloquent auth driver
6ba37d42d8a1ce757fd65af253b52e9ddd52a451
<ide><path>laravel/auth/drivers/eloquent.php <ide> public function retrieve($token) <ide> { <ide> return $this->model()->find($token); <ide> } <del> else if (get_class($token) == Config::get('auth.model')) <add> else if (is_object($token) and get_class($token) == Config::get('auth.model')) <ide> { <ide> return $token; <ide> }
1
Python
Python
update ec2 constants
2dcf4340084539bcac598fb0991baccb33709c74
<ide><path>libcloud/compute/constants.py <ide> "name": "f1.2xlarge", <ide> "ram": 124928 <ide> }, <add> "f1.4xlarge": { <add> "bandwidth": 10, <add> "disk": 940, <add> "extra": { <add> "currentGeneration": "Yes", <add> "ecu": "52", <add> "instanceFamily": "FPGA Instances", <add> "instanceType": "f1.4xlarge", <add> "memory": "244 GiB", <add> "networkPerformance": "10 Gigabit", <add> "normalizationSizeFactor": "32", <add> "physicalProcessor": "Intel Xeon E5-2686 v4 (Broadwell)", <add> "processorArchitecture": "64-bit", <add> "servicecode": "AmazonEC2", <add> "servicename": "Amazon Elastic Compute Cloud", <add> "storage": "1 x 940 GB", <add> "vcpu": "16" <add> }, <add> "id": "f1.4xlarge", <add> "name": "f1.4xlarge", <add> "ram": 249856 <add> }, <ide> "g2.2xlarge": { <ide> "bandwidth": None, <ide> "disk": 60, <ide> "name": "g3.8xlarge", <ide> "ram": 249856 <ide> }, <add> "g3s.xlarge": { <add> "bandwidth": 10, <add> "disk": 0, <add> "extra": { <add> "currentGeneration": "Yes", <add> "ecu": "13", <add> "instanceFamily": "GPU instance", <add> "instanceType": "g3s.xlarge", <add> "memory": "30.5 GiB", <add> "networkPerformance": "10 Gigabit", <add> "normalizationSizeFactor": "1", <add> "physicalProcessor": "Intel Xeon E5-2686 v4 (Broadwell)", <add> "processorArchitecture": "64-bit", <add> "servicecode": "AmazonEC2", <add> "servicename": "Amazon Elastic Compute Cloud", <add> "storage": "EBS only", <add> "vcpu": "4" <add> }, <add> "id": "g3s.xlarge", <add> "name": "g3s.xlarge", <add> "ram": 31232 <add> }, <ide> "h1.16xlarge": { <ide> "bandwidth": 25, <ide> "disk": 16000, <ide> "disk": 0, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "345", <add> "ecu": "347", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5.24xlarge", <ide> "memory": "768 GiB", <ide> "disk": 0, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "31", <add> "ecu": "38", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5.2xlarge", <ide> "memory": "64 GiB", <ide> "disk": 0, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "60", <add> "ecu": "71", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5.4xlarge", <ide> "memory": "128 GiB", <ide> "disk": 0, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "8", <add> "ecu": "10", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5.large", <ide> "memory": "16 GiB", <ide> "disk": 0, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "16", <add> "ecu": "19", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5.xlarge", <ide> "memory": "32 GiB", <ide> "disk": 3600, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "345", <add> "ecu": "347", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5d.24xlarge", <ide> "memory": "768 GiB", <ide> "disk": 300, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "31", <add> "ecu": "38", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5d.2xlarge", <ide> "memory": "64 GiB", <ide> "disk": 600, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "60", <add> "ecu": "71", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5d.4xlarge", <ide> "memory": "128 GiB", <ide> "disk": 75, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "8", <add> "ecu": "10", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5d.large", <ide> "memory": "16 GiB", <ide> "disk": 150, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "16", <add> "ecu": "19", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "r5d.xlarge", <ide> "memory": "32 GiB", <ide> "disk": 1800, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "235", <add> "ecu": "271", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "z1d.12xlarge", <ide> "memory": "384 GiB", <ide> "disk": 300, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "43", <add> "ecu": "53", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "z1d.2xlarge", <ide> "memory": "64 GiB", <ide> "disk": 450, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "65", <add> "ecu": "75", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "z1d.3xlarge", <ide> "memory": "96 GiB", <ide> "disk": 900, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "128", <add> "ecu": "134", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "z1d.6xlarge", <ide> "memory": "192 GiB", <ide> "disk": 75, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "11", <add> "ecu": "15", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "z1d.large", <ide> "memory": "16 GiB", <ide> "disk": 150, <ide> "extra": { <ide> "currentGeneration": "Yes", <del> "ecu": "21", <add> "ecu": "28", <ide> "instanceFamily": "Memory optimized", <ide> "instanceType": "z1d.xlarge", <ide> "memory": "32 GiB", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "hs1.8xlarge", <ide> "i2.2xlarge", <ide> "i2.4xlarge", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t1.micro", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "t2.medium", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t1.micro", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "hs1.8xlarge", <ide> "i2.2xlarge", <ide> "i2.4xlarge", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t1.micro", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "d2.4xlarge", <ide> "d2.8xlarge", <ide> "d2.xlarge", <add> "g3.16xlarge", <add> "g3.4xlarge", <add> "g3.8xlarge", <ide> "i3.16xlarge", <ide> "i3.2xlarge", <ide> "i3.4xlarge", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "t2.medium", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "i2.2xlarge", <ide> "i2.4xlarge", <ide> "i2.8xlarge", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "t2.medium", <ide> "d2.xlarge", <ide> "f1.16xlarge", <ide> "f1.2xlarge", <add> "f1.4xlarge", <ide> "g2.2xlarge", <ide> "g2.8xlarge", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "h1.16xlarge", <ide> "h1.2xlarge", <ide> "h1.4xlarge", <ide> "r5.4xlarge", <ide> "r5.large", <ide> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t1.micro", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "t2.medium", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "t2.medium", <ide> "d2.xlarge", <ide> "f1.16xlarge", <ide> "f1.2xlarge", <add> "f1.4xlarge", <ide> "g2.2xlarge", <ide> "g2.8xlarge", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "h1.16xlarge", <ide> "h1.2xlarge", <ide> "h1.4xlarge", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "h1.16xlarge", <ide> "h1.2xlarge", <ide> "h1.4xlarge", <ide> "c5.9xlarge", <ide> "c5.large", <ide> "c5.xlarge", <add> "c5d.18xlarge", <add> "c5d.2xlarge", <add> "c5d.4xlarge", <add> "c5d.9xlarge", <add> "c5d.large", <add> "c5d.xlarge", <ide> "cc2.8xlarge", <ide> "d2.2xlarge", <ide> "d2.4xlarge", <ide> "d2.8xlarge", <ide> "d2.xlarge", <ide> "f1.16xlarge", <ide> "f1.2xlarge", <add> "f1.4xlarge", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <ide> "m5.4xlarge", <ide> "m5.large", <ide> "m5.xlarge", <add> "m5d.12xlarge", <add> "m5d.24xlarge", <add> "m5d.2xlarge", <add> "m5d.4xlarge", <add> "m5d.large", <add> "m5d.xlarge", <ide> "p2.16xlarge", <ide> "p2.8xlarge", <ide> "p2.xlarge", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <ide> "t1.micro", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "r4.8xlarge", <ide> "r4.large", <ide> "r4.xlarge", <add> "r5.12xlarge", <add> "r5.24xlarge", <add> "r5.2xlarge", <add> "r5.4xlarge", <add> "r5.large", <add> "r5.xlarge", <add> "r5d.12xlarge", <add> "r5d.24xlarge", <add> "r5d.2xlarge", <add> "r5d.4xlarge", <add> "r5d.large", <add> "r5d.xlarge", <ide> "t1.micro", <ide> "t2.2xlarge", <ide> "t2.large", <ide> "d2.xlarge", <ide> "f1.16xlarge", <ide> "f1.2xlarge", <add> "f1.4xlarge", <ide> "g2.2xlarge", <ide> "g2.8xlarge", <ide> "g3.16xlarge", <ide> "g3.4xlarge", <ide> "g3.8xlarge", <add> "g3s.xlarge", <ide> "h1.16xlarge", <ide> "h1.2xlarge", <ide> "h1.4xlarge",
1
Ruby
Ruby
remove ancient tests for cgi parsing bug
63b4fe53abec586e122cde629adde5000a517f9c
<ide><path>actionpack/test/controller/request/url_encoded_params_parsing_test.rb <ide> def teardown <ide> assert_parses expected, query <ide> end <ide> <del> test "parses params with non alphanumeric name" do <del> query = "a/b[c]=d" <del> expected = { "a/b" => { "c" => "d" }} <del> assert_parses expected, query <del> end <del> <del> test "parses params with single brackets in the middle" do <del> query = "a/b[c]d=e" <del> expected = { "a/b" => {} } <del> assert_parses expected, query <del> end <del> <del> test "parses params with separated brackets" do <del> query = "a/b@[c]d[e]=f" <del> expected = { "a/b@" => { }} <del> assert_parses expected, query <del> end <del> <del> test "parses params with separated brackets and array" do <del> query = "a/b@[c]d[e][]=f" <del> expected = { "a/b@" => { }} <del> assert_parses expected, query <del> end <del> <del> test "parses params with unmatched brackets and array" do <del> query = "a/b@[c][d[e][]=f" <del> expected = { "a/b@" => { "c" => { }}} <del> assert_parses expected, query <del> end <del> <ide> test "parses params with nil key" do <ide> query = "=&test2=value1" <ide> expected = { "test2" => "value1" }
1
Javascript
Javascript
update $route to reflect $location changes
22cb600280cecabf719ba1878719c907aa01ba18
<ide><path>src/service/route.js <ide> * @property {Array.<Object>} routes Array of all configured routes. <ide> * <ide> * @description <del> * Watches `$location.hashPath` and tries to map the hash to an existing route <add> * Watches `$location.url()` and tries to map the path to an existing route <ide> * definition. It is used for deep-linking URLs to controllers and views (HTML partials). <ide> * <ide> * The `$route` service is typically used in conjunction with {@link angular.widget.ng:view ng:view} <ide> * @example <ide> This example shows how changing the URL hash causes the <tt>$route</tt> <ide> to match a route against the URL, and the <tt>[[ng:include]]</tt> pulls in the partial. <del> Try changing the URL in the input box to see changes. <ide> <ide> <doc:example> <ide> <doc:source jsfiddle="false"> <ide> <a href="#/Book/Moby/ch/1">Moby: Ch1</a> | <ide> <a href="#/Book/Gatsby">Gatsby</a> | <ide> <a href="#/Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a><br/> <del> $location.hashPath: <input type="text" name="$location.hashPath" size="80" /> <add> <pre>$location.path() = {{$location.path()}}</pre> <ide> <pre>$route.current.template = {{$route.current.template}}</pre> <ide> <pre>$route.current.params = {{$route.current.params}}</pre> <ide> <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre> <ide> angularServiceInject('$route', function($location, $routeParams) { <ide> * {@link angular.widget.ng:view ng:view} or <ide> * {@link angular.widget.ng:include ng:include} widgets. <ide> * - `redirectTo` – {(string|function())=} – value to update <del> * {@link angular.service.$location $location} hash with and trigger route redirection. <add> * {@link angular.service.$location $location} path with and trigger route redirection. <ide> * <ide> * If `redirectTo` is a function, it will be called with the following parameters: <ide> * <ide> * - `{Object.<string>}` - route parameters extracted from the current <del> * `$location.hashPath` by applying the current route template. <del> * - `{string}` - current `$location.hash` <del> * - `{string}` - current `$location.hashPath` <del> * - `{string}` - current `$location.hashSearch` <add> * `$location.path()` by applying the current route template. <add> * - `{string}` - current `$location.path()` <add> * - `{Object}` - current `$location.search()` <ide> * <ide> * The custom `redirectTo` function is expected to return a string which will be used <del> * to update `$location.hash`. <add> * to update `$location.path()` and `$location.search()`. <ide> * <del> * - `[reloadOnSearch=true]` - {boolean=} - reload route when $location.hashSearch <del> * changes. <add> * - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search() <add> * changes. <ide> * <ide> * If the option is set to false and url in the browser changes, then <ide> * $routeUpdate event is emited on the current route scope. You can use this event to <ide> angularServiceInject('$route', function($location, $routeParams) { <ide> } <ide> }; <ide> <del> <del> <del> this.$watch(function(){ return dirty + $location.hash; }, updateRoute); <add> this.$watch(function() { return dirty + $location.url(); }, updateRoute); <ide> <ide> return $route; <ide> <ide> angularServiceInject('$route', function($location, $routeParams) { <ide> $route.current = next; <ide> if (next) { <ide> if (next.redirectTo) { <del> $location.update(isString(next.redirectTo) <del> ? {hashSearch: next.params, hashPath: interpolate(next.redirectTo, next.params)} <del> : {hash: next.redirectTo(next.pathParams, <del> $location.hash, $location.hashPath, $location.hashSearch)}); <add> if (isString(next.redirectTo)) { <add> $location.path(interpolate(next.redirectTo, next.params)).search(next.params) <add> .replace(); <add> } else { <add> $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search())) <add> .replace(); <add> } <ide> } else { <ide> copy(next.params, $routeParams); <ide> next.scope = parentScope.$new(next.controller); <ide> angularServiceInject('$route', function($location, $routeParams) { <ide> // Match a route <ide> var params, match; <ide> forEach(routes, function(route, path) { <del> if (!match && (params = matcher($location.hashPath, path))) { <add> if (!match && (params = matcher($location.path(), path))) { <ide> match = inherit(route, { <del> params: extend({}, $location.hashSearch, params), <add> params: extend({}, $location.search(), params), <ide> pathParams: params}); <ide> match.$route = route; <ide> } <ide><path>src/service/routeParams.js <ide> * <ide> * @description <ide> * Current set of route parameters. The route parameters are a combination of the <del> * {@link angular.service.$location $location} `hashSearch`, and `path`. The `path` parameters <add> * {@link angular.service.$location $location} `search()`, and `path()`. The `path` parameters <ide> * are extracted when the {@link angular.service.$route $route} path is matched. <ide> * <del> * In case of parameter name collision, `path` params take precedence over `hashSearch` params. <add> * In case of parameter name collision, `path` params take precedence over `search` params. <ide> * <ide> * The service guarantees that the identity of the `$routeParams` object will remain unchanged <ide> * (but its properties will likely change) even when a route change occurs. <ide><path>test/ScenarioSpec.js <ide> describe("ScenarioSpec: Compilation", function(){ <ide> expect(jqLite(scope.$element).text()).toEqual('123'); <ide> }); <ide> }); <del> <del> describe("configuration", function(){ <del> it("should take location object", function(){ <del> var url = "http://server/#?book=moby"; <del> scope = angular.compile("<div>{{$location}}</div>")(); <del> var $location = scope.$service('$location'); <del> var $browser = scope.$service('$browser'); <del> expect($location.hashSearch.book).toBeUndefined(); <del> $browser.url(url); <del> $browser.poll(); <del> expect($location.hashSearch.book).toEqual('moby'); <del> }); <del> }); <ide> }); <ide><path>test/service/routeParamsSpec.js <ide> describe('$routeParams', function(){ <ide> $route.when('/foo'); <ide> $route.when('/bar/:barId'); <ide> <del> $location.hash = '/foo?a=b'; <add> $location.path('/foo').search('a=b'); <ide> scope.$digest(); <ide> expect($routeParams).toEqual({a:'b'}); <ide> <del> $location.hash = '/bar/123?x=abc'; <add> $location.path('/bar/123').search('x=abc'); <ide> scope.$digest(); <ide> expect($routeParams).toEqual({barId:'123', x:'abc'}); <ide> }); <ide> describe('$routeParams', function(){ <ide> $route.when('/foo'); <ide> $route.when('/bar/:barId'); <ide> <del> $location.hash = '/foo?a=b'; <add> $location.path('/foo').search('a=b'); <ide> scope.$digest(); <ide> expect(scope.$service('$routeParams')).toBe(firstRouteParams); <ide> <del> $location.hash = '/bar/123?x=abc'; <add> $location.path('/bar/123').search('x=abc'); <ide> scope.$digest(); <ide> expect(scope.$service('$routeParams')).toBe(firstRouteParams); <ide> }); <ide><path>test/service/routeSpec.js <ide> 'use strict'; <ide> <ide> describe('$route', function() { <del> var scope; <add> var scope, $route, $location; <ide> <ide> beforeEach(function(){ <ide> scope = angular.scope(); <del> }); <del> <del> <del> afterEach(function(){ <del> dealoc(scope); <add> $location = scope.$service('$location'); <add> $route = scope.$service('$route'); <ide> }); <ide> <ide> <ide> it('should route and fire change event', function(){ <ide> var log = '', <del> $location, $route, <ide> lastRoute, <ide> nextRoute; <ide> <ide> function BookChapter() { <ide> log += '<init>;'; <ide> } <del> scope = compile('<div></div>')(); <del> $location = scope.$service('$location'); <del> $route = scope.$service('$route'); <add> <ide> $route.when('/Book/:book/Chapter/:chapter', {controller: BookChapter, template:'Chapter.html'}); <ide> $route.when('/Blank'); <ide> scope.$on('$beforeRouteChange', function(event, next, current){ <ide> describe('$route', function() { <ide> expect(nextRoute).toBe(current); <ide> }); <ide> <del> $location.update('http://server#/Book/Moby/Chapter/Intro?p=123'); <add> $location.path('/Book/Moby/Chapter/Intro').search('p=123'); <ide> scope.$digest(); <ide> expect(log).toEqual('before();<init>;after();'); <ide> expect($route.current.params).toEqual({book:'Moby', chapter:'Intro', p:'123'}); <ide> var lastId = $route.current.scope.$id; <ide> <ide> log = ''; <del> $location.update('http://server#/Blank?ignore'); <add> $location.path('/Blank').search('ignore'); <ide> scope.$digest(); <ide> expect(log).toEqual('before();after();'); <ide> expect($route.current.params).toEqual({ignore:true}); <ide> expect($route.current.scope.$id).not.toEqual(lastId); <ide> <ide> log = ''; <del> $location.update('http://server#/NONE'); <add> $location.path('/NONE'); <ide> scope.$digest(); <ide> expect(log).toEqual('before();after();'); <ide> expect($route.current).toEqual(null); <ide> describe('$route', function() { <ide> expect($route.current.template).toEqual('instant update'); <ide> }); <ide> <add> it('should change route even when only search param changes', function() { <add> var callback = jasmine.createSpy('onRouteChange'); <add> <add> $route.when('/test', {template: 'test.html'}); <add> scope.$on('$beforeRouteChange', callback); <add> $location.path('/test'); <add> scope.$digest(); <add> callback.reset(); <add> <add> $location.search({any: true}); <add> scope.$digest(); <add> <add> expect(callback).toHaveBeenCalled(); <add> }); <add> <ide> <ide> it('should allow routes to be defined with just templates without controllers', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> onChangeSpy = jasmine.createSpy('onChange'); <add> var onChangeSpy = jasmine.createSpy('onChange'); <ide> <ide> $route.when('/foo', {template: 'foo.html'}); <ide> scope.$on('$beforeRouteChange', onChangeSpy); <ide> expect($route.current).toBeUndefined(); <ide> expect(onChangeSpy).not.toHaveBeenCalled(); <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> scope.$digest(); <ide> <ide> expect($route.current.template).toEqual('foo.html'); <ide> describe('$route', function() { <ide> <ide> <ide> it('should handle unknown routes with "otherwise" route definition', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> onChangeSpy = jasmine.createSpy('onChange'); <add> var onChangeSpy = jasmine.createSpy('onChange'); <ide> <ide> function NotFoundCtrl() {this.notFoundProp = 'not found!';} <ide> <ide> describe('$route', function() { <ide> expect($route.current).toBeUndefined(); <ide> expect(onChangeSpy).not.toHaveBeenCalled(); <ide> <del> $location.updateHash('/unknownRoute'); <add> $location.path('/unknownRoute'); <ide> scope.$digest(); <ide> <ide> expect($route.current.template).toBe('404.html'); <ide> describe('$route', function() { <ide> expect(onChangeSpy).toHaveBeenCalled(); <ide> <ide> onChangeSpy.reset(); <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> scope.$digest(); <ide> <ide> expect($route.current.template).toEqual('foo.html'); <ide> describe('$route', function() { <ide> }); <ide> <ide> it('should $destroy old routes', function(){ <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'); <del> <ide> $route.when('/foo', {template: 'foo.html', controller: function(){ this.name = 'FOO';}}); <ide> $route.when('/bar', {template: 'bar.html', controller: function(){ this.name = 'BAR';}}); <ide> $route.when('/baz', {template: 'baz.html'}); <ide> <ide> expect(scope.$childHead).toEqual(null); <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> scope.$digest(); <ide> expect(scope.$$childHead).toBeTruthy(); <ide> expect(scope.$$childHead).toEqual(scope.$$childTail); <ide> <del> $location.updateHash('/bar'); <add> $location.path('/bar'); <ide> scope.$digest(); <ide> expect(scope.$$childHead).toBeTruthy(); <ide> expect(scope.$$childHead).toEqual(scope.$$childTail); <del> return <ide> <del> $location.updateHash('/baz'); <add> $location.path('/baz'); <ide> scope.$digest(); <ide> expect(scope.$$childHead).toBeTruthy(); <ide> expect(scope.$$childHead).toEqual(scope.$$childTail); <ide> <del> $location.updateHash('/'); <add> $location.path('/'); <ide> scope.$digest(); <ide> expect(scope.$$childHead).toEqual(null); <ide> expect(scope.$$childTail).toEqual(null); <ide> }); <ide> <ide> <ide> describe('redirection', function() { <del> <ide> it('should support redirection via redirectTo property by updating $location', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $browser = scope.$service('$browser'), <del> $route = scope.$service('$route'), <del> onChangeSpy = jasmine.createSpy('onChange'); <add> var onChangeSpy = jasmine.createSpy('onChange'); <ide> <del> $route.when('', {redirectTo: '/foo'}); <add> $route.when('/', {redirectTo: '/foo'}); <ide> $route.when('/foo', {template: 'foo.html'}); <ide> $route.when('/bar', {template: 'bar.html'}); <ide> $route.when('/baz', {redirectTo: '/bar'}); <ide> describe('$route', function() { <ide> expect($route.current).toBeUndefined(); <ide> expect(onChangeSpy).not.toHaveBeenCalled(); <ide> <del> scope.$digest(); //triggers initial route change - match the redirect route <del> $browser.defer.flush(); //triger route change - match the route we redirected to <del> <del> expect($location.hash).toBe('/foo'); <del> expect($route.current.template).toBe('foo.html'); <del> expect(onChangeSpy.callCount).toBe(2); <del> <del> <del> onChangeSpy.reset(); <del> $location.updateHash(''); <del> scope.$digest(); //match the redirect route + update $browser <del> $browser.defer.flush(); //match the route we redirected to <del> <del> expect($location.hash).toBe('/foo'); <add> $location.path('/'); <add> scope.$digest(); <add> expect($location.path()).toBe('/foo'); <ide> expect($route.current.template).toBe('foo.html'); <ide> expect(onChangeSpy.callCount).toBe(2); <ide> <ide> onChangeSpy.reset(); <del> $location.updateHash('/baz'); <del> scope.$digest(); //match the redirect route + update $browser <del> $browser.defer.flush(); //match the route we redirected to <del> <del> expect($location.hash).toBe('/bar'); <add> $location.path('/baz'); <add> scope.$digest(); <add> expect($location.path()).toBe('/bar'); <ide> expect($route.current.template).toBe('bar.html'); <ide> expect(onChangeSpy.callCount).toBe(2); <ide> }); <ide> <ide> <del> it('should interpolate route variables in the redirected hashPath from the original hashPath', <del> function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $browser = scope.$service('$browser'), <del> $route = scope.$service('$route'); <del> <add> it('should interpolate route vars in the redirected path from original path', function() { <ide> $route.when('/foo/:id/foo/:subid/:extraId', {redirectTo: '/bar/:id/:subid/23'}); <ide> $route.when('/bar/:id/:subid/:subsubid', {template: 'bar.html'}); <del> scope.$digest(); <ide> <del> $location.updateHash('/foo/id1/foo/subid3/gah'); <del> scope.$digest(); //triggers initial route change - match the redirect route <del> $browser.defer.flush(); //triger route change - match the route we redirected to <add> $location.path('/foo/id1/foo/subid3/gah'); <add> scope.$digest(); <ide> <del> expect($location.hash).toBe('/bar/id1/subid3/23?extraId=gah'); <del> expect($route.current.template).toBe('bar.html'); <add> expect($location.path()).toEqual('/bar/id1/subid3/23'); <add> expect($location.search()).toEqual({extraId: 'gah'}); <add> expect($route.current.template).toEqual('bar.html'); <ide> }); <ide> <ide> <del> it('should interpolate route variables in the redirected hashPath from the original hashSearch', <del> function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $browser = scope.$service('$browser'), <del> $route = scope.$service('$route'); <del> <add> it('should interpolate route vars in the redirected path from original search', function() { <ide> $route.when('/bar/:id/:subid/:subsubid', {template: 'bar.html'}); <ide> $route.when('/foo/:id/:extra', {redirectTo: '/bar/:id/:subid/99'}); <del> scope.$digest(); <ide> <del> $location.hash = '/foo/id3/eId?subid=sid1&appended=true'; <del> scope.$digest(); //triggers initial route change - match the redirect route <del> $browser.defer.flush(); //triger route change - match the route we redirected to <add> $location.path('/foo/id3/eId').search('subid=sid1&appended=true'); <add> scope.$digest(); <ide> <del> expect($location.hash).toBe('/bar/id3/sid1/99?appended=true&extra=eId'); <del> expect($route.current.template).toBe('bar.html'); <add> expect($location.path()).toEqual('/bar/id3/sid1/99'); <add> expect($location.search()).toEqual({appended: 'true', extra: 'eId'}); <add> expect($route.current.template).toEqual('bar.html'); <ide> }); <ide> <ide> <ide> it('should allow custom redirectTo function to be used', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $browser = scope.$service('$browser'), <del> $route = scope.$service('$route'); <del> <ide> $route.when('/bar/:id/:subid/:subsubid', {template: 'bar.html'}); <del> $route.when('/foo/:id', <del> {redirectTo: customRedirectFn}); <del> scope.$digest(); <add> $route.when('/foo/:id', {redirectTo: customRedirectFn}); <ide> <del> $location.hash = '/foo/id3?subid=sid1&appended=true'; <del> scope.$digest(); //triggers initial route change - match the redirect route <del> $browser.defer.flush(); //triger route change - match the route we redirected to <add> $location.path('/foo/id3').search('subid=sid1&appended=true'); <add> scope.$digest(); <ide> <del> expect($location.hash).toBe('custom'); <add> expect($location.path()).toEqual('/custom'); <ide> <del> function customRedirectFn(routePathParams, hash, hashPath, hashSearch) { <add> function customRedirectFn(routePathParams, path, search) { <ide> expect(routePathParams).toEqual({id: 'id3'}); <del> expect(hash).toEqual($location.hash); <del> expect(hashPath).toEqual($location.hashPath); <del> expect(hashSearch).toEqual($location.hashSearch); <del> return 'custom'; <add> expect(path).toEqual($location.path()); <add> expect(search).toEqual($location.search()); <add> return '/custom'; <ide> } <ide> }); <add> <add> it('should replace the url when redirecting', function() { <add> $route.when('/bar/:id', {template: 'bar.html'}); <add> $route.when('/foo/:id/:extra', {redirectTo: '/bar/:id'}); <add> <add> var replace; <add> scope.$watch(function() { <add> if (isUndefined(replace)) replace = $location.$$replace; <add> }); <add> <add> $location.path('/foo/id3/eId'); <add> scope.$digest(); <add> <add> expect($location.path()).toEqual('/bar/id3'); <add> expect(replace).toBe(true); <add> }); <ide> }); <ide> <ide> <ide> describe('reloadOnSearch', function() { <del> it('should reload a route when reloadOnSearch is enabled and hashSearch changes', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> $rouetParams = scope.$service('$routeParams'), <add> it('should reload a route when reloadOnSearch is enabled and .search() changes', function() { <add> var $rouetParams = scope.$service('$routeParams'), <ide> reloaded = jasmine.createSpy('route reload'); <ide> <ide> $route.when('/foo', {controller: FooCtrl}); <ide> describe('$route', function() { <ide> reloaded(); <ide> } <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> scope.$digest(); <ide> expect(reloaded).toHaveBeenCalled(); <ide> expect($rouetParams).toEqual({}); <ide> reloaded.reset(); <ide> <ide> // trigger reload <del> $location.hashSearch.foo = 'bar'; <add> $location.search({foo: 'bar'}); <ide> scope.$digest(); <ide> expect(reloaded).toHaveBeenCalled(); <ide> expect($rouetParams).toEqual({foo:'bar'}); <ide> }); <ide> <ide> <del> it('should not reload a route when reloadOnSearch is disabled and only hashSearch changes', <add> it('should not reload a route when reloadOnSearch is disabled and only .search() changes', <ide> function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> reloaded = jasmine.createSpy('route reload'), <add> var reloaded = jasmine.createSpy('route reload'), <ide> routeUpdateEvent = jasmine.createSpy('route reload'); <ide> <ide> $route.when('/foo', {controller: FooCtrl, reloadOnSearch: false}); <ide> describe('$route', function() { <ide> <ide> expect(reloaded).not.toHaveBeenCalled(); <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> scope.$digest(); <ide> expect(reloaded).toHaveBeenCalled(); <ide> expect(routeUpdateEvent).not.toHaveBeenCalled(); <ide> reloaded.reset(); <ide> <ide> // don't trigger reload <del> $location.hashSearch.foo = 'bar'; <add> $location.search({foo: 'bar'}); <ide> scope.$digest(); <ide> expect(reloaded).not.toHaveBeenCalled(); <ide> expect(routeUpdateEvent).toHaveBeenCalled(); <ide> }); <ide> <ide> <ide> it('should reload reloadOnSearch route when url differs only in route path param', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> reloaded = jasmine.createSpy('routeReload'), <add> var reloaded = jasmine.createSpy('routeReload'), <ide> onRouteChange = jasmine.createSpy('onRouteChange'); <ide> <ide> $route.when('/foo/:fooId', {controller: FooCtrl, reloadOnSearch: false}); <ide> describe('$route', function() { <ide> expect(reloaded).not.toHaveBeenCalled(); <ide> expect(onRouteChange).not.toHaveBeenCalled(); <ide> <del> $location.updateHash('/foo/aaa'); <add> $location.path('/foo/aaa'); <ide> scope.$digest(); <ide> expect(reloaded).toHaveBeenCalled(); <ide> expect(onRouteChange).toHaveBeenCalled(); <ide> reloaded.reset(); <ide> onRouteChange.reset(); <ide> <del> $location.updateHash('/foo/bbb'); <add> $location.path('/foo/bbb'); <ide> scope.$digest(); <ide> expect(reloaded).toHaveBeenCalled(); <ide> expect(onRouteChange).toHaveBeenCalled(); <ide> reloaded.reset(); <ide> onRouteChange.reset(); <ide> <del> $location.hashSearch.foo = 'bar'; <add> $location.search({foo: 'bar'}); <ide> scope.$digest(); <ide> expect(reloaded).not.toHaveBeenCalled(); <ide> expect(onRouteChange).not.toHaveBeenCalled(); <ide> }); <ide> <ide> <del> it('should update route params when reloadOnSearch is disabled and hashSearch', function() { <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> routeParams = jasmine.createSpy('routeParams'); <add> it('should update params when reloadOnSearch is disabled and .search() changes', function() { <add> var routeParams = jasmine.createSpy('routeParams'); <ide> <ide> $route.when('/foo', {controller: FooCtrl}); <ide> $route.when('/bar/:barId', {controller: FooCtrl, reloadOnSearch: false}); <ide> describe('$route', function() { <ide> <ide> expect(routeParams).not.toHaveBeenCalled(); <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> scope.$digest(); <ide> expect(routeParams).toHaveBeenCalledWith({}); <ide> routeParams.reset(); <ide> <ide> // trigger reload <del> $location.hashSearch.foo = 'bar'; <add> $location.search({foo: 'bar'}); <ide> scope.$digest(); <ide> expect(routeParams).toHaveBeenCalledWith({foo: 'bar'}); <ide> routeParams.reset(); <ide> <del> $location.updateHash('/bar/123'); <add> $location.path('/bar/123').search({}); <ide> scope.$digest(); <ide> expect(routeParams).toHaveBeenCalledWith({barId: '123'}); <ide> routeParams.reset(); <ide> <ide> // don't trigger reload <del> $location.hashSearch.foo = 'bar'; <add> $location.search({foo: 'bar'}); <ide> scope.$digest(); <ide> expect(routeParams).toHaveBeenCalledWith({barId: '123', foo: 'bar'}); <ide> }); <ide> describe('$route', function() { <ide> describe('reload', function(){ <ide> <ide> it('should reload even if reloadOnSearch is false', function(){ <del> var scope = angular.scope(), <del> $location = scope.$service('$location'), <del> $route = scope.$service('$route'), <del> $routeParams = scope.$service('$routeParams'), <add> var $routeParams = scope.$service('$routeParams'), <ide> count = 0; <ide> <ide> $route.when('/bar/:barId', {controller: FooCtrl, reloadOnSearch: false}); <ide> <ide> function FooCtrl() { count ++; } <ide> <del> $location.updateHash('/bar/123'); <add> $location.path('/bar/123'); <ide> scope.$digest(); <ide> expect($routeParams).toEqual({barId:'123'}); <ide> expect(count).toEqual(1); <ide> <del> $location.hash = '/bar/123?a=b'; <add> $location.path('/bar/123').search('a=b'); <ide> scope.$digest(); <ide> expect($routeParams).toEqual({barId:'123', a:'b'}); <ide> expect(count).toEqual(1); <ide><path>test/widgetsSpec.js <ide> describe("widget", function(){ <ide> <ide> <ide> it('should do nothing when no routes are defined', function() { <del> $location.updateHash('/unknown'); <add> $location.path('/unknown'); <ide> rootScope.$digest(); <ide> expect(rootScope.$element.text()).toEqual(''); <ide> }); <ide> describe("widget", function(){ <ide> <ide> expect(rootScope.$element.text()).toEqual(''); <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> $browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>'); <ide> rootScope.$digest(); <ide> rootScope.$digest(); <ide> $browser.xhr.flush(); <ide> expect(rootScope.$element.text()).toEqual('4'); <ide> <del> $location.updateHash('/bar'); <add> $location.path('/bar'); <ide> $browser.xhr.expectGET('myUrl2').respond('angular is da best'); <ide> rootScope.$digest(); <ide> rootScope.$digest(); <ide> describe("widget", function(){ <ide> it('should remove all content when location changes to an unknown route', function() { <ide> $route.when('/foo', {controller: angular.noop, template: 'myUrl1'}); <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> $browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>'); <ide> rootScope.$digest(); <ide> rootScope.$digest(); <ide> $browser.xhr.flush(); <ide> expect(rootScope.$element.text()).toEqual('4'); <ide> <del> $location.updateHash('/unknown'); <add> $location.path('/unknown'); <ide> rootScope.$digest(); <ide> rootScope.$digest(); <ide> expect(rootScope.$element.text()).toEqual(''); <ide> describe("widget", function(){ <ide> $route.when('/foo', {controller: angular.noop, template: 'myUrl1'}); <ide> rootScope.parentVar = 'parent'; <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> $browser.xhr.expectGET('myUrl1').respond('<div>{{parentVar}}</div>'); <ide> rootScope.$digest(); <ide> rootScope.$digest(); <ide> describe("widget", function(){ <ide> var myApp = angular.scope(); <ide> var $browser = myApp.$service('$browser'); <ide> $browser.xhr.expectGET('includePartial.html').respond('view: <ng:view></ng:view>'); <del> $browser.url('http://server/#/foo'); <add> myApp.$service('$location').path('/foo'); <ide> <ide> var $route = myApp.$service('$route'); <ide> $route.when('/foo', {controller: angular.noop, template: 'viewPartial.html'}); <ide> describe("widget", function(){ <ide> this.log.push('child'); <ide> }; <ide> <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> $browser.xhr.expectGET('viewPartial.html'). <ide> respond('<div ng:init="log.push(\'init\')">' + <ide> '<div ng:controller="ChildCtrl"></div>' + <ide> describe("widget", function(){ <ide> <ide> expect(rootScope.log).toEqual(['parent', 'init', 'child']); <ide> <del> $location.updateHash(''); <add> $location.path('/'); <ide> rootScope.$apply(); <ide> expect(rootScope.log).toEqual(['parent', 'init', 'child']); <ide> <ide> rootScope.log = []; <del> $location.updateHash('/foo'); <add> $location.path('/foo'); <ide> rootScope.$apply(); <ide> $browser.defer.flush(); <ide>
6
PHP
PHP
fix incorrect pluralization of human
ac6d5cc70f2932de5eee17638ac7cd6c264ca9b0
<ide><path>lib/Cake/Test/Case/Utility/InflectorTest.php <ide> public function testInflectingSingulars() { <ide> * @return void <ide> */ <ide> public function testInflectingPlurals() { <add> $this->assertEquals(Inflector::pluralize('axman'), 'axmen'); <add> $this->assertEquals(Inflector::pluralize('man'), 'men'); <add> $this->assertEquals(Inflector::pluralize('woman'), 'women'); <add> $this->assertEquals(Inflector::pluralize('human'), 'humans'); <ide> $this->assertEquals(Inflector::pluralize('categoria'), 'categorias'); <ide> $this->assertEquals(Inflector::pluralize('house'), 'houses'); <ide> $this->assertEquals(Inflector::pluralize('powerhouse'), 'powerhouses'); <ide><path>lib/Cake/Utility/Inflector.php <ide> class Inflector { <ide> '/sis$/i' => 'ses', <ide> '/([ti])um$/i' => '\1a', <ide> '/(p)erson$/i' => '\1eople', <del> '/(m)an$/i' => '\1en', <add> '/(?<!u)(m)an$/i' => '\1en', <ide> '/(c)hild$/i' => '\1hildren', <ide> '/(buffal|tomat)o$/i' => '\1\2oes', <ide> '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
2
Javascript
Javascript
ignore dst for day, week, month and year diffs
5cf3e300465d2a465cba1902372aebd2f4649768
<ide><path>moment.js <ide> units = normalizeUnits(units); <ide> <ide> if (units === 'year' || units === 'month') { <add> // average number of days in the months in the given dates <ide> diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2 <add> // difference in months <ide> output = ((this.year() - that.year()) * 12) + (this.month() - that.month()); <del> output += ((this - moment(this).startOf('month')) - (that - moment(that).startOf('month'))) / diff; <add> // adjust by taking difference in days, average number of days <add> // and dst in the given months. <add> output += ((this - moment(this).startOf('month')) - <add> (that - moment(that).startOf('month'))) / diff; <add> // same as above but with zones, to negate all dst <add> output -= ((this.zone() - moment(this).startOf('month').zone()) - <add> (that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff; <ide> if (units === 'year') { <ide> output = output / 12; <ide> } <ide> } else { <del> diff = (this - that) - zoneDiff; <add> diff = (this - that); <ide> output = units === 'second' ? diff / 1e3 : // 1000 <ide> units === 'minute' ? diff / 6e4 : // 1000 * 60 <ide> units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60 <del> units === 'day' ? diff / 864e5 : // 1000 * 60 * 60 * 24 <del> units === 'week' ? diff / 6048e5 : // 1000 * 60 * 60 * 24 * 7 <add> units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst <add> units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst <ide> diff; <ide> } <ide> return asFloat ? output : absRound(output); <ide><path>test/moment/diff.js <ide> exports.diff = { <ide> }, <ide> <ide> "diff across DST" : function(test) { <del> test.expect(2); <add> test.expect(9); <ide> <ide> test.equal(moment([2012, 2, 24]).diff([2012, 2, 10], 'weeks', true), 2, "diff weeks across DST"); <del> test.equal(moment([2012, 2, 24]).diff([2012, 2, 10], 'days', true), 14, "diff weeks across DST"); <add> test.equal(moment([2012, 2, 24]).diff([2012, 2, 10], 'days', true), 14, "diff days across DST"); <add> test.equal(moment([2012, 2, 11]).diff([2012, 2, 11, 12], 'hours', true), -11, "diff hours across DST"); <add> test.equal(moment([2012, 2, 11]).diff([2012, 2, 11, 12], 'days', true), -0.5, "diff days across DST"); <add> test.equal(moment([2012, 2, 11]).diff([2012, 2, 11, 12], 'months', true), -1/62, "diff months across DST (half day in 31 day month)"); <add> test.equal(moment([2012, 2, 11]).diff([2012, 2, 11, 12], 'months', true), -1/62, "diff months across DST (half day in 31 day month)"); <add> test.equal(moment([2013, 10, 2]).diff([2013, 10, 17], 'months', true), -0.5, 'diff months across DST (15 days in 30 day month)') <add> test.equal(moment([2013, 10, 2]).diff([2013, 10, 17], 'days', true), -15, 'diff days across DST') <add> test.equal(moment([2013, 10, 2]).diff([2013, 10, 17], 'hours', true), -15 * 24 - 1, 'diff hours across DST (15 days minus 1 hour DST)') <ide> test.done(); <ide> }, <ide>
2