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 |
|---|---|---|---|---|---|
Javascript | Javascript | remove more special code for ie8 | 5d695e5566212d93da0fc1281d5d39ffee0039a3 | <ide><path>src/Angular.js
<ide> function forEach(obj, iterator, context) {
<ide> if (obj) {
<ide> if (isFunction(obj)) {
<ide> for (key in obj) {
<del> // Need to check if hasOwnProperty exists,
<del> // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
<del> if (key !== 'prototype' && key !== 'length' && key !== 'name' &&
<del> (!obj.hasOwnProperty || obj.hasOwnProperty(key))
<del> ) {
<add> if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) {
<ide> iterator.call(context, obj[key], key, obj);
<ide> }
<ide> }
<ide><path>test/AngularSpec.js
<ide> describe('angular', function() {
<ide> expect(log).toEqual(['0:a', '1:c']);
<ide> });
<ide>
<del> if (document.querySelectorAll) {
<del> it('should handle the result of querySelectorAll in IE8 as it has no hasOwnProperty function', function() {
<del> document.body.innerHTML = "<p>" +
<del> "<a name='x'>a</a>" +
<del> "<a name='y'>b</a>" +
<del> "<a name='x'>c</a>" +
<del> "</p>";
<del>
<del> var htmlCollection = document.querySelectorAll('[name="x"]'),
<del> log = [];
<del>
<del> forEach(htmlCollection, function(value, key) { log.push(key + ':' + value.innerHTML); });
<del> expect(log).toEqual(['0:a', '1:c']);
<del> });
<del> }
<del>
<ide> it('should handle arguments objects like arrays', function() {
<ide> var args,
<ide> log = []; | 2 |
Text | Text | update determinant article | f9052e66b87c2c72621929d5d260318a53e84d5e | <ide><path>guide/english/mathematics/determinant-of-a-matrix/index.md
<ide> title: Determinant of a Matrix
<ide> ---
<ide> ## Determinant of a Matrix
<ide>
<del>This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/determinant-of-a-matrix/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<add><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
<add>The elements of a square matrix can be used to compute a special value called the determinant. It is denoted by det(A) or |A|. The determinant is only defined for a square matrix, i.e a matrix with identical number of rows and columns.
<ide>
<del><a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<add>The determinant of a 2x2 matrix is the simplest case(a 1x1 matrix is just the number itself).
<add>It is found by multiplying the opposite corners and subtracting them.
<ide>
<del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
<add>
<add>
<add>Subsequent square matrices are just extensions of a 2x2 matrix and can be easily found by reducing them recursively as 2x2 matrices. The determinant of a 3x3 matrix is given below.
<add>
<add><img src= http://www.statisticslectures.com/images/third1.gif width='300' height='100'>
<add>
<add>The steps to find the determinant for a 3x3 matrix are:
<add>- Choose a row or column to go along (say the 1st row)
<add>- Multiply 'a' by the 2x2 determinant formed without a's row or column.
<add>- Next do the same with b. Here make sure to multiply this value by -1. You will need to multiply -1 to every alternate element in the row.
<add>- Continue this till you do this for all elements in the row.
<add>- Simplify the expression by finding the individual 2x2 determinants
<add>- The value you obtain is the final value of the determinant of the matrix.
<add>
<add>This method can similarly be applied to any nxn square matrix by breking it down into basic 2x2 matrices and finding their determinants.
<add>
<add>Exercise - Try finding the determinant of the following 3x3 matrix
<add>
<add><img src="https://cdn.kastatic.org/ka-exercise-screenshots/matrix_determinant_3x3_256.png">
<add>
<add>
<add>Answer = 27
<ide>
<ide> #### More Information:
<ide> <!-- Please add any articles you think might be helpful to read before writing the article -->
<ide>
<del>
<add>https://en.wikipedia.org/wiki/Determinant
<add>https://mathinsight.org/determinant_matrix | 1 |
Python | Python | fix a typo | cdb7c87fd133b6e99916919b525e9d277a3913dd | <ide><path>libcloud/test/compute/test_ikoula.py
<ide> from libcloud.test import unittest
<ide>
<ide>
<del>class ExoscaleNodeDriverTestCase(CloudStackCommonTestCase, unittest.TestCase):
<add>class IkoulaNodeDriverTestCase(CloudStackCommonTestCase, unittest.TestCase):
<ide> driver_klass = IkoulaNodeDriver
<ide>
<ide> if __name__ == '__main__': | 1 |
Go | Go | fix ndots configuration | 78627b6f14cf68345b621ed148602bf540f4ceae | <ide><path>libnetwork/sandbox_dns_unix.go
<ide> func (sb *sandbox) rebuildDNS() error {
<ide> dnsOpt:
<ide> for _, resOpt := range resOptions {
<ide> if strings.Contains(resOpt, "ndots") {
<del> for _, option := range dnsOptionsList {
<add> for i, option := range dnsOptionsList {
<ide> if strings.Contains(option, "ndots") {
<ide> parts := strings.Split(option, ":")
<ide> if len(parts) != 2 {
<ide> dnsOpt:
<ide> if num, err := strconv.Atoi(parts[1]); err != nil {
<ide> return fmt.Errorf("invalid number for ndots option %v", option)
<ide> } else if num > 0 {
<add> // if the user sets ndots, we mark it as set but we remove the option to guarantee
<add> // that into the container land only ndots:0
<ide> sb.ndotsSet = true
<add> dnsOptionsList = append(dnsOptionsList[:i], dnsOptionsList[i+1:]...)
<ide> break dnsOpt
<ide> }
<ide> } | 1 |
Python | Python | update tis with a proper lock | 3caa539092d3a4196083d1db829fa1ed7d83fa95 | <ide><path>airflow/jobs/scheduler_job.py
<ide> def _change_state_for_tis_without_dagrun(
<ide> # We need to do this for mysql as well because it can cause deadlocks
<ide> # as discussed in https://issues.apache.org/jira/browse/AIRFLOW-2516
<ide> if self.using_sqlite or self.using_mysql:
<del> tis_to_change: List[TI] = with_row_locks(query).all()
<add> tis_to_change: List[TI] = with_row_locks(query, of=TI,
<add> **skip_locked(session=session)).all()
<ide> for ti in tis_to_change:
<ide> ti.set_state(new_state, session=session)
<ide> tis_changed += 1 | 1 |
Javascript | Javascript | add example for touchableopacity.js | fa1b533c56b5e25fead69adda932a276e7e0fafd | <ide><path>Libraries/Components/Touchable/TouchableOpacity.js
<ide> var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
<ide> * );
<ide> * },
<ide> * ```
<add> * ### Example
<add> *
<add> * ```ReactNativeWebPlayer
<add> * import React, { Component } from 'react'
<add> * import {
<add> * AppRegistry,
<add> * StyleSheet,
<add> * TouchableOpacity,
<add> * Text,
<add> * View,
<add> * } from 'react-native'
<add> *
<add> * class App extends Component {
<add> * constructor(props) {
<add> * super(props)
<add> * this.state = { count: 0 }
<add> * }
<add> *
<add> * onPress = () => {
<add> * this.setState({
<add> * count: this.state.count+1
<add> * })
<add> * }
<add> *
<add> * render() {
<add> * return (
<add> * <View style={styles.container}>
<add> * <TouchableOpacity
<add> * style={styles.button}
<add> * onPress={this.onPress}
<add> * >
<add> * <Text> Touch Here </Text>
<add> * </TouchableOpacity>
<add> * <View style={[styles.countContainer]}>
<add> * <Text style={[styles.countText]}>
<add> * { this.state.count !== 0 ? this.state.count: null}
<add> * </Text>
<add> * </View>
<add> * </View>
<add> * )
<add> * }
<add> * }
<add> *
<add> * const styles = StyleSheet.create({
<add> * container: {
<add> * flex: 1,
<add> * justifyContent: 'center',
<add> * paddingHorizontal: 10
<add> * },
<add> * button: {
<add> * alignItems: 'center',
<add> * backgroundColor: '#DDDDDD',
<add> * padding: 10
<add> * },
<add> * countContainer: {
<add> * alignItems: 'center',
<add> * padding: 10
<add> * },
<add> * countText: {
<add> * color: '#FF00FF'
<add> * }
<add> * })
<add> *
<add> * AppRegistry.registerComponent('App', () => App)
<add> * ```
<add> *
<ide> */
<ide> var TouchableOpacity = createReactClass({
<ide> displayName: 'TouchableOpacity', | 1 |
PHP | PHP | add additional documentation for `ids` option | ee8436b2abc9b799d5fcc2314bd3405f0738394c | <ide><path>src/ORM/Marshaller.php
<ide> protected function _buildPropertyMap($options)
<ide> /**
<ide> * Hydrate one entity and its associated data.
<ide> *
<del> * When marshalling HasMany or BelongsToMany associations, `_ids` format can be used.
<del> * `ids` option can also be used to determine whether the association must use the `_ids`
<del> * format.
<del> *
<ide> * ### Options:
<ide> *
<ide> * * associated: Associations listed here will be marshalled as well.
<ide> * * fieldList: A whitelist of fields to be assigned to the entity. If not present,
<ide> * the accessible fields list in the entity will be used.
<ide> * * accessibleFields: A list of fields to allow or deny in entity accessible fields.
<ide> *
<add> * The above options can be used in each nested `associated` array. In addition to the above
<add> * options you can also use the `ids` option for HasMany and BelongsToMany associations.
<add> * When true this option restricts the request data to only be read from `_ids`.
<add> *
<add> * ```
<add> * $result = $marshaller->one($data, [
<add> * 'associated' => ['Tags' => ['ids' => true]]
<add> * ]);
<add> * ```
<add> *
<ide> * @param array $data The data to hydrate.
<ide> * @param array $options List of options
<ide> * @return \Cake\ORM\Entity
<ide> protected function _loadBelongsToMany($assoc, $ids)
<ide> * the accessible fields list in the entity will be used.
<ide> * * accessibleFields: A list of fields to allow or deny in entity accessible fields.
<ide> *
<add> * The above options can be used in each nested `associated` array. In addition to the above
<add> * options you can also use the `ids` option for HasMany and BelongsToMany associations.
<add> * When true this option restricts the request data to only be read from `_ids`.
<add> *
<add> * ```
<add> * $result = $marshaller->merge($entity, $data, [
<add> * 'associated' => ['Tags' => ['ids' => true]]
<add> * ]);
<add> * ```
<add> *
<ide> * @param \Cake\Datasource\EntityInterface $entity the entity that will get the
<ide> * data merged in
<ide> * @param array $data key value list of fields to be merged into the entity | 1 |
PHP | PHP | fix unauthenticated return docblock | b02b368a732aefbcdc2a739800880334ed247d11 | <ide><path>src/Illuminate/Foundation/Exceptions/Handler.php
<ide> protected function prepareException(Exception $e)
<ide> *
<ide> * @param \Illuminate\Http\Request $request
<ide> * @param \Illuminate\Auth\AuthenticationException $exception
<del> * @return \Illuminate\Http\Response
<add> * @return \Symfony\Component\HttpFoundation\Response
<ide> */
<ide> protected function unauthenticated($request, AuthenticationException $exception)
<ide> { | 1 |
Python | Python | remove duplicate entry in __all__ | 1434cadef35c24f6a1d62b7f9c81383089ebf02c | <ide><path>celery/worker/state.py
<ide> __all__ = [
<ide> 'SOFTWARE_INFO', 'reserved_requests', 'active_requests',
<ide> 'total_count', 'revoked', 'task_reserved', 'maybe_shutdown',
<del> 'task_accepted', 'task_reserved', 'task_ready', 'Persistent',
<add> 'task_accepted', 'task_ready', 'Persistent',
<ide> ]
<ide>
<ide> #: Worker software/platform information. | 1 |
Javascript | Javascript | fix coding style in src/core/chunked_stream.js | 53bbdcb0a1e85b1746046018eebf9f5941d17966 | <ide><path>src/core/chunked_stream.js
<ide> var ChunkedStream = (function ChunkedStreamClosure() {
<ide> return this.numChunksLoaded === this.numChunks;
<ide> },
<ide>
<del> onReceiveData: function(begin, chunk) {
<add> onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
<ide> var end = begin + chunk.byteLength;
<ide>
<ide> assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
<ide> // Using this.length is inaccurate here since this.start can be moved
<ide> // See ChunkedStream.moveStart()
<ide> var length = this.bytes.length;
<ide> assert(end % this.chunkSize === 0 || end === length,
<del> 'Bad end offset: ' + end);
<add> 'Bad end offset: ' + end);
<ide>
<ide> this.bytes.set(new Uint8Array(chunk), begin);
<ide> var chunkSize = this.chunkSize;
<ide> var ChunkedStream = (function ChunkedStreamClosure() {
<ide> }
<ide> },
<ide>
<del> onReceiveInitialData: function (data) {
<add> onReceiveInitialData: function ChunkedStream_onReceiveInitialData(data) {
<ide> this.bytes.set(data);
<ide> this.initialDataLength = data.length;
<del> var endChunk = this.end === data.length ?
<del> this.numChunks : Math.floor(data.length / this.chunkSize);
<add> var endChunk = (this.end === data.length ?
<add> this.numChunks : Math.floor(data.length / this.chunkSize));
<ide> for (var i = 0; i < endChunk; i++) {
<ide> this.loadedChunks[i] = true;
<ide> ++this.numChunksLoaded;
<ide> var ChunkedStream = (function ChunkedStreamClosure() {
<ide> }
<ide>
<ide> var end = pos + length;
<del> if (end > strEnd)
<add> if (end > strEnd) {
<ide> end = strEnd;
<add> }
<ide> this.ensureRange(pos, end);
<ide>
<ide> this.pos = end;
<ide> var ChunkedStream = (function ChunkedStreamClosure() {
<ide> },
<ide>
<ide> skip: function ChunkedStream_skip(n) {
<del> if (!n)
<add> if (!n) {
<ide> n = 1;
<add> }
<ide> this.pos += n;
<ide> },
<ide>
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide> }
<ide>
<ide> if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
<del> groupedChunks.push({
<del> beginChunk: beginChunk, endChunk: prevChunk + 1});
<add> groupedChunks.push({ beginChunk: beginChunk,
<add> endChunk: prevChunk + 1 });
<ide> beginChunk = chunk;
<ide> }
<ide> if (i + 1 === chunks.length) {
<del> groupedChunks.push({
<del> beginChunk: beginChunk, endChunk: chunk + 1});
<add> groupedChunks.push({ beginChunk: beginChunk,
<add> endChunk: chunk + 1 });
<ide> }
<ide>
<ide> prevChunk = chunk;
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide> },
<ide>
<ide> onProgress: function ChunkedStreamManager_onProgress(args) {
<del> var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize +
<del> args.loaded;
<add> var bytesLoaded = (this.stream.numChunksLoaded * this.chunkSize +
<add> args.loaded);
<ide> this.msgHandler.send('DocProgress', {
<ide> loaded: bytesLoaded,
<ide> total: this.length | 1 |
Python | Python | return group_id as well | ef952650c41519c6363362d2740cd384535f2d27 | <ide><path>libcloud/compute/drivers/ec2.py
<ide> def ex_list_security_groups(self):
<ide> namespace=NAMESPACE):
<ide> name = findtext(element=group, xpath='groupName',
<ide> namespace=NAMESPACE)
<del> groups.append(name)
<add> id = findtext(element=group, xpath='groupId',
<add> namespace=NAMESPACE)
<add> group = {'name': name, 'id': id}
<add> groups.append(group)
<ide>
<ide> return groups
<ide> | 1 |
Text | Text | add a note rather than repeating the full command | f717f6bf7ef4f9b6e95932744ac89e07ed0f0c52 | <ide><path>street/README.md
<ide> sudo pip install numpy
<ide>
<ide> Build the LSTM op:
<ide>
<del>Linux
<ide> ```
<ide> cd cc
<ide> TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
<ide> g++ -std=c++11 -shared rnn_ops.cc -o rnn_ops.so -fPIC -I $TF_INC -O3 -mavx
<ide> ```
<del>Mac
<del>```
<del>cd cc
<del>TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
<del>g++ -std=c++11 -shared rnn_ops.cc -o rnn_ops.so -fPIC -I $TF_INC -O3 -mavx -undefined dynamic_lookup
<del>```
<add>
<add>(Note: if running on Mac, add `-undefined dynamic_lookup` to the end of your
<add>`g++` command.)
<ide>
<ide> Run the unittests:
<ide> | 1 |
Javascript | Javascript | support more options in startup benchmark | 1698fc96af2d58dce414cd22b7d9898f30efde3e | <ide><path>benchmark/fixtures/require-cachable.js
<add>'use strict';
<add>
<add>const list = require('internal/bootstrap/cache');
<add>const {
<add> isMainThread
<add>} = require('worker_threads');
<add>
<add>for (const key of list.cachableBuiltins) {
<add> if (!isMainThread && key === 'trace_events') {
<add> continue;
<add> }
<add> require(key);
<add>}
<ide><path>benchmark/misc/startup.js
<ide> 'use strict';
<ide> const common = require('../common.js');
<del>const spawn = require('child_process').spawn;
<add>const { spawn } = require('child_process');
<ide> const path = require('path');
<del>const emptyJsFile = path.resolve(__dirname, '../../test/fixtures/semicolon.js');
<ide>
<del>const bench = common.createBenchmark(startNode, {
<del> dur: [1]
<add>let Worker; // Lazy loaded in main
<add>
<add>const bench = common.createBenchmark(main, {
<add> dur: [1],
<add> script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
<add> mode: ['process', 'worker']
<add>}, {
<add> flags: ['--expose-internals', '--experimental-worker'] // for workers
<ide> });
<ide>
<del>function startNode({ dur }) {
<del> var go = true;
<del> var starts = 0;
<add>function spawnProcess(script) {
<add> const cmd = process.execPath || process.argv[0];
<add> const argv = ['--expose-internals', script];
<add> return spawn(cmd, argv);
<add>}
<add>
<add>function spawnWorker(script) {
<add> return new Worker(script, { stderr: true, stdout: true });
<add>}
<add>
<add>function start(state, script, bench, getNode) {
<add> const node = getNode(script);
<add> let stdout = '';
<add> let stderr = '';
<add>
<add> node.stdout.on('data', (data) => {
<add> stdout += data;
<add> });
<add>
<add> node.stderr.on('data', (data) => {
<add> stderr += data;
<add> });
<add>
<add> node.on('exit', (code) => {
<add> if (code !== 0) {
<add> console.error('------ stdout ------');
<add> console.error(stdout);
<add> console.error('------ stderr ------');
<add> console.error(stderr);
<add> throw new Error(`Error during node startup, exit code ${code}`);
<add> }
<add> state.throughput++;
<add>
<add> if (state.go) {
<add> start(state, script, bench, getNode);
<add> } else {
<add> bench.end(state.throughput);
<add> }
<add> });
<add>}
<add>
<add>function main({ dur, script, mode }) {
<add> const state = {
<add> go: true,
<add> throughput: 0
<add> };
<ide>
<ide> setTimeout(function() {
<del> go = false;
<add> state.go = false;
<ide> }, dur * 1000);
<ide>
<del> bench.start();
<del> start();
<del>
<del> function start() {
<del> const node = spawn(process.execPath || process.argv[0], [emptyJsFile]);
<del> node.on('exit', function(exitCode) {
<del> if (exitCode !== 0) {
<del> throw new Error('Error during node startup');
<del> }
<del> starts++;
<del>
<del> if (go)
<del> start();
<del> else
<del> bench.end(starts);
<del> });
<add> script = path.resolve(__dirname, '../../', `${script}.js`);
<add> if (mode === 'worker') {
<add> Worker = require('worker_threads').Worker;
<add> bench.start();
<add> start(state, script, bench, spawnWorker);
<add> } else {
<add> bench.start();
<add> start(state, script, bench, spawnProcess);
<ide> }
<ide> }
<ide><path>test/parallel/test-benchmark-misc.js
<ide> runBenchmark('misc', [
<ide> 'n=1',
<ide> 'type=',
<ide> 'val=magyarország.icom.museum',
<add> 'script=test/fixtures/semicolon',
<add> 'mode=worker'
<ide> ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); | 3 |
Ruby | Ruby | fix tap regex | 52de3f9d8d6c5bf6ed193d643c23e35f143c6cd6 | <ide><path>Library/Homebrew/dev-cmd/extract.rb
<ide> def extract_args
<ide> def extract
<ide> args = extract_args.parse
<ide>
<del> if args.named.first =~ HOMEBREW_TAP_FORMULA_REGEX
<del> name = Regexp.last_match(3).downcase
<del> source_tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
<add> if (match = args.named.first.match(HOMEBREW_TAP_FORMULA_REGEX))
<add> name = match[3].downcase
<add> source_tap = Tap.fetch(match[1], match[2])
<ide> raise TapFormulaUnavailableError.new(source_tap, name) unless source_tap.installed?
<ide> else
<ide> name = args.named.first.downcase | 1 |
Text | Text | correct old virtual size | 1ab7d76f30f3cf693c986eb827ad49a6554d806d | <ide><path>docs/reference/commandline/commit.md
<ide> created. Supported `Dockerfile` instructions:
<ide> $ docker commit c3f279d17e0a svendowideit/testimage:version3
<ide> f5283438590d
<ide> $ docker images
<del> REPOSITORY TAG ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG ID CREATED SIZE
<ide> svendowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB
<ide>
<ide> ## Commit a container with new configurations
<ide><path>docs/reference/commandline/images.md
<ide> parent = "smn_cli"
<ide> -q, --quiet Only show numeric IDs
<ide>
<ide> The default `docker images` will show all top level
<del>images, their repository and tags, and their virtual size.
<add>images, their repository and tags, and their size.
<ide>
<ide> Docker images have intermediate layers that increase reusability,
<ide> decrease disk usage, and speed up `docker build` by
<ide> allowing each step to be cached. These intermediate layers are not shown
<ide> by default.
<ide>
<del>The `VIRTUAL SIZE` is the cumulative space taken up by the image and all
<add>The `SIZE` is the cumulative space taken up by the image and all
<ide> its parent images. This is also the disk space used by the contents of the
<ide> Tar file created when you `docker save` an image.
<ide>
<ide> An image will be listed more than once if it has multiple repository names
<ide> or tags. This single image (identifiable by its matching `IMAGE ID`)
<del>uses up the `VIRTUAL SIZE` listed only once.
<add>uses up the `SIZE` listed only once.
<ide>
<ide> ### Listing the most recently created images
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> <none> <none> 77af4d6b9913 19 hours ago 1.089 GB
<ide> committ latest b6fa739cedf5 19 hours ago 1.089 GB
<ide> <none> <none> 78a85c484f71 19 hours ago 1.089 GB
<ide> given repository.
<ide> For example, to list all images in the "java" repository, run this command :
<ide>
<ide> $ docker images java
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> java 8 308e519aac60 6 days ago 824.5 MB
<ide> java 7 493d82594c15 3 months ago 656.3 MB
<ide> java latest 2711b1d6f3aa 5 months ago 603.9 MB
<ide> repository and tag are listed. To find all local images in the "java"
<ide> repository with tag "8" you can use:
<ide>
<ide> $ docker images java:8
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> java 8 308e519aac60 6 days ago 824.5 MB
<ide>
<ide> If nothing matches `REPOSITORY[:TAG]`, the list is empty.
<ide>
<ide> $ docker images java:0
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide>
<ide> ## Listing the full length image IDs
<ide>
<ide> $ docker images --no-trunc
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> <none> <none> 77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182 19 hours ago 1.089 GB
<ide> committest latest b6fa739cedf5ea12a620a439402b6004d057da800f91c7524b5086a5e4749c9f 19 hours ago 1.089 GB
<ide> <none> <none> 78a85c484f71509adeaace20e72e941f6bdd2b25b4c75da8693efd9f61a37921 19 hours ago 1.089 GB
<ide> unchanged, the digest value is predictable. To list image digest values, use
<ide> the `--digests` flag:
<ide>
<ide> $ docker images --digests
<del> REPOSITORY TAG DIGEST IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
<ide> localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB
<ide>
<ide> When pushing or pulling to a 2.0 registry, the `push` or `pull` command
<ide> The currently supported filters are:
<ide>
<ide> $ docker images --filter "dangling=true"
<ide>
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> <none> <none> 8abc22fbb042 4 weeks ago 0 B
<ide> <none> <none> 48e5f45168b9 4 weeks ago 2.489 MB
<ide> <none> <none> bf747efa0e2f 4 weeks ago 0 B
<ide> The following filter matches images with the `com.example.version` label regardl
<ide>
<ide> $ docker images --filter "label=com.example.version"
<ide>
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> match-me-1 latest eeae25ada2aa About a minute ago 188.3 MB
<ide> match-me-2 latest eeae25ada2aa About a minute ago 188.3 MB
<ide>
<ide> The following filter matches images with the `com.example.version` label with the `1.0` value.
<ide>
<ide> $ docker images --filter "label=com.example.version=1.0"
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> match-me latest eeae25ada2aa About a minute ago 188.3 MB
<ide>
<ide> In this example, with the `0.1` value, it returns an empty set because no matches were found.
<ide>
<ide> $ docker images --filter "label=com.example.version=0.1"
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide>
<ide> ## Formatting
<ide>
<ide><path>docs/reference/commandline/load.md
<ide> Loads a tarred repository from a file or the standard input stream.
<ide> Restores both images and tags.
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> $ docker load < busybox.tar.gz
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> busybox latest 769b9341d937 7 weeks ago 2.489 MB
<ide> $ docker load --input fedora.tar
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> busybox latest 769b9341d937 7 weeks ago 2.489 MB
<ide> fedora rawhide 0d20aec6529d 7 weeks ago 387 MB
<ide> fedora 20 58394af37342 7 weeks ago 385.5 MB
<ide><path>docs/reference/commandline/rmi.md
<ide> command untags and removes all images that match the specified ID.
<ide> An image pulled by digest has no tag associated with it:
<ide>
<ide> $ docker images --digests
<del> REPOSITORY TAG DIGEST IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
<ide> localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB
<ide>
<ide> To remove an image using its digest:
<ide><path>docs/userguide/containers/dockerimages.md
<ide> Let's start with listing the images you have locally on our host. You can
<ide> do this using the `docker images` command like so:
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> ubuntu 14.04 1d073211c498 3 days ago 187.9 MB
<ide> busybox latest 2c5ac3f849df 5 days ago 1.113 MB
<ide> training/webapp latest 54bb4e8718e8 5 months ago 348.7 MB
<ide> You can then look at our new `ouruser/sinatra` image using the `docker images`
<ide> command.
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> training/sinatra latest 5bc342fa0b91 10 hours ago 446.7 MB
<ide> ouruser/sinatra v2 3c59e02ddd1a 10 hours ago 446.7 MB
<ide> ouruser/sinatra latest 5db5f8471261 10 hours ago 446.7 MB
<ide> user name, the repository name and the new tag.
<ide> Now, see your new tag using the `docker images` command.
<ide>
<ide> $ docker images ouruser/sinatra
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> ouruser/sinatra latest 5db5f8471261 11 hours ago 446.7 MB
<ide> ouruser/sinatra devel 5db5f8471261 11 hours ago 446.7 MB
<ide> ouruser/sinatra v2 5db5f8471261 11 hours ago 446.7 MB
<ide> unchanged, the digest value is predictable. To list image digest values, use
<ide> the `--digests` flag:
<ide>
<ide> $ docker images --digests | head
<del> REPOSITORY TAG DIGEST IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
<ide> ouruser/sinatra latest sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 5db5f8471261 11 hours ago 446.7 MB
<ide>
<ide> When pushing or pulling to a 2.0 registry, the `push` or `pull` command
<ide><path>docs/userguide/storagedriver/imagesandcontainers.md
<ide> single 8GB general purpose SSD EBS volume. The Docker data directory
<ide> (`/var/lib/docker`) was consuming 2GB of space.
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> jenkins latest 285c9f0f9d3d 17 hours ago 708.5 MB
<ide> mysql latest d39c3fa09ced 8 days ago 360.3 MB
<ide> mongo latest a74137af4532 13 days ago 317.4 MB
<ide> command.
<ide> 5. Run the `docker images` command to verify the new `changed-ubuntu` image is
<ide> 6. in the Docker host's local storage area.
<ide>
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> changed-ubuntu latest 03b964f68d06 33 seconds ago 131.4 MB
<ide> ubuntu 15.04 013f3d01d247 6 weeks ago 131.3 MB
<ide>
<ide><path>man/docker-images.1.md
<ide> To list the images in a local repository (not the registry) run:
<ide>
<ide> The list will contain the image repository name, a tag for the image, and an
<ide> image ID, when it was created and its virtual size. Columns: REPOSITORY, TAG,
<del>IMAGE ID, CREATED, and VIRTUAL SIZE.
<add>IMAGE ID, CREATED, and SIZE.
<ide>
<ide> The `docker images` command takes an optional `[REPOSITORY[:TAG]]` argument
<ide> that restricts the list to images that match the argument. If you specify
<ide><path>man/docker-load.1.md
<ide> Restores both images and tags.
<ide> # EXAMPLES
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> busybox latest 769b9341d937 7 weeks ago 2.489 MB
<ide> $ docker load --input fedora.tar
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> busybox latest 769b9341d937 7 weeks ago 2.489 MB
<ide> fedora rawhide 0d20aec6529d 7 weeks ago 387 MB
<ide> fedora 20 58394af37342 7 weeks ago 385.5 MB
<ide><path>man/docker-pull.1.md
<ide> Note that if the image is previously downloaded then the status would be
<ide> Status: Downloaded newer image for fedora
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB
<ide> fedora 20 105182bb5e8b 5 days ago 372.7 MB
<ide> fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB
<ide> Note that if the image is previously downloaded then the status would be
<ide> Status: Downloaded newer image for debian:latest
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> debian latest 4a5e6db8c069 5 days ago 125.1 MB
<ide>
<ide>
<ide> Note that if the image is previously downloaded then the status would be
<ide> Status: Downloaded newer image for registry.hub.docker.com/fedora:20
<ide>
<ide> $ docker images
<del> REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<add> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> fedora 20 3f2fed40e4b0 4 days ago 372.7 MB
<ide>
<ide> | 9 |
Python | Python | expand error message | 2700ba66d9bbf83218c9e4de5effdadf36b48842 | <ide><path>src/transformers/utils/hub.py
<ide> def move_cache(cache_dir=None, new_cache_dir=None, token=None):
<ide> except Exception as e:
<ide> trace = "\n".join(traceback.format_tb(e.__traceback__))
<ide> logger.error(
<del> f"There was a problem when trying to move your cache:\n\n{trace}\n\nPlease file an issue at "
<del> "https://github.com/huggingface/transformers/issues/new/choose and copy paste this whole message and we "
<del> "will do our best to help."
<add> f"There was a problem when trying to move your cache:\n\n{trace}\n{e.__class__.__name__}: {e}\n\nPlease "
<add> "file an issue at https://github.com/huggingface/transformers/issues/new/choose and copy paste this whole "
<add> "message and we will do our best to help."
<ide> )
<ide>
<ide> try: | 1 |
Go | Go | adjust test to match its comment | 95bcb8924ac2cbe0fb625a604d2c6d5a8e2fa06a | <ide><path>networkdriver/network_test.go
<ide> func TestNetworkOverlaps(t *testing.T) {
<ide> //netY starts before and ends at same IP of netX
<ide> AssertOverlap("172.16.1.1/24", "172.16.0.1/23", t)
<ide> //netY starts before and ends outside of netX
<del> AssertOverlap("172.16.1.1/24", "172.16.0.1/23", t)
<add> AssertOverlap("172.16.1.1/24", "172.16.0.1/22", t)
<ide> //netY starts and ends before netX
<ide> AssertNoOverlap("172.16.1.1/25", "172.16.0.1/24", t)
<ide> //netX starts and ends before netY | 1 |
Go | Go | try other port on any error from map | a00a1a1fca020d21cb677439160e018bda5c3835 | <ide><path>daemon/networkdriver/bridge/driver.go
<ide> import (
<ide> log "github.com/Sirupsen/logrus"
<ide> "github.com/docker/docker/daemon/networkdriver"
<ide> "github.com/docker/docker/daemon/networkdriver/ipallocator"
<del> "github.com/docker/docker/daemon/networkdriver/portallocator"
<ide> "github.com/docker/docker/daemon/networkdriver/portmapper"
<ide> "github.com/docker/docker/engine"
<ide> "github.com/docker/docker/nat"
<ide> func AllocatePort(job *engine.Job) engine.Status {
<ide> if host, err = portmapper.Map(container, ip, hostPort); err == nil {
<ide> break
<ide> }
<del>
<del> if allocerr, ok := err.(portallocator.ErrPortAlreadyAllocated); ok {
<del> // There is no point in immediately retrying to map an explicitly
<del> // chosen port.
<del> if hostPort != 0 {
<del> job.Logf("Failed to bind %s for container address %s: %s", allocerr.IPPort(), container.String(), allocerr.Error())
<del> break
<del> }
<del>
<del> // Automatically chosen 'free' port failed to bind: move on the next.
<del> job.Logf("Failed to bind %s for container address %s. Trying another port.", allocerr.IPPort(), container.String())
<del> } else {
<del> // some other error during mapping
<del> job.Logf("Received an unexpected error during port allocation: %s", err.Error())
<add> // There is no point in immediately retrying to map an explicitly
<add> // chosen port.
<add> if hostPort != 0 {
<add> job.Logf("Failed to allocate and map port %d: %s", hostPort, err)
<ide> break
<ide> }
<add> job.Logf("Failed to allocate and map port: %s, retry: %d", err, i+1)
<ide> }
<ide>
<ide> if err != nil {
<ide><path>integration-cli/docker_cli_run_test.go
<ide> func TestRunTLSverify(t *testing.T) {
<ide>
<ide> logDone("run - verify tls is set for --tlsverify")
<ide> }
<add>
<add>func TestRunPortFromDockerRangeInUse(t *testing.T) {
<add> defer deleteAllContainers()
<add> // first find allocator current position
<add> cmd := exec.Command(dockerBinary, "run", "-d", "-p", ":80", "busybox", "top")
<add> out, _, err := runCommandWithOutput(cmd)
<add> if err != nil {
<add> t.Fatal(out, err)
<add> }
<add> id := strings.TrimSpace(out)
<add> cmd = exec.Command(dockerBinary, "port", id)
<add> out, _, err = runCommandWithOutput(cmd)
<add> if err != nil {
<add> t.Fatal(out, err)
<add> }
<add> out = strings.TrimSpace(out)
<add> out = strings.Split(out, ":")[1]
<add> lastPort, err := strconv.Atoi(out)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> port := lastPort + 1
<add> l, err := net.Listen("tcp", ":"+strconv.Itoa(port))
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> defer l.Close()
<add> cmd = exec.Command(dockerBinary, "run", "-d", "-p", ":80", "busybox", "top")
<add> out, _, err = runCommandWithOutput(cmd)
<add> if err != nil {
<add> t.Fatalf(out, err)
<add> }
<add> id = strings.TrimSpace(out)
<add> cmd = exec.Command(dockerBinary, "port", id)
<add> out, _, err = runCommandWithOutput(cmd)
<add> if err != nil {
<add> t.Fatal(out, err)
<add> }
<add>
<add> logDone("run - find another port if port from autorange already bound")
<add>} | 2 |
Python | Python | correct greedy generation when doing beam search | 2fdc7f6ce8e15793568645b46e4badf7dbe4ecd8 | <ide><path>src/transformers/modeling_utils.py
<ide> def generate(
<ide> else:
<ide> assert input_ids.dim() == 2, "Input prompt should be of shape (batch_size, sequence length)."
<ide>
<add> if do_sample is False:
<add> if num_beams == 1:
<add> # no_beam_search greedy generation conditions
<add> assert (
<add> num_return_sequences == 1
<add> ), "Greedy decoding will always produce the same output for num_beams == 1 and num_return_sequences > 1. Please set num_return_sequences = 1"
<add>
<add> else:
<add> # beam_search greedy generation conditions
<add> assert (
<add> num_beams >= num_return_sequences
<add> ), "Greedy beam search decoding cannot return more sequences than it has beams. Please set num_beams >= num_return_sequences"
<add>
<ide> if pad_token_id is None and eos_token_ids is not None:
<ide> logger.warning(
<ide> "Setting `pad_token_id` to {} (first `eos_token_id`) to generate sequence".format(eos_token_ids[0])
<ide> def generate(
<ide> cur_len = input_ids.shape[1]
<ide> vocab_size = self.config.vocab_size
<ide>
<del> if num_return_sequences != 1:
<add> if num_return_sequences != 1 and do_sample:
<ide> # Expand input to num return sequences
<ide> input_ids = input_ids.unsqueeze(1).expand(batch_size, num_return_sequences, cur_len)
<ide> input_ids = input_ids.contiguous().view(
<ide> def generate(
<ide> pad_token_id,
<ide> eos_token_ids,
<ide> effective_batch_size,
<add> num_return_sequences,
<ide> length_penalty,
<ide> num_beams,
<ide> vocab_size,
<ide> def _generate_no_beam_search(
<ide> All returned sequence are generated independantly.
<ide> """
<ide> # current position / max lengths / length of generated sentences / unfinished sentences
<add>
<ide> unfinished_sents = input_ids.new(batch_size).fill_(1)
<ide> sent_lengths = input_ids.new(batch_size).fill_(max_length)
<ide>
<ide> def _generate_beam_search(
<ide> pad_token_id,
<ide> eos_token_ids,
<ide> batch_size,
<add> num_return_sequences,
<ide> length_penalty,
<ide> num_beams,
<ide> vocab_size,
<ide> ):
<ide> """ Generate sequences for each example with beam search.
<ide> """
<add>
<ide> # Expand input to num beams
<ide> # assert input_ids.shape == (batch_size * num_beams, cur_len)
<ide> input_ids = input_ids.unsqueeze(1).expand(batch_size, num_beams, cur_len)
<ide> def _generate_beam_search(
<ide> input_ids[batch_idx * num_beams + beam_id, :cur_len].clone(), score.item()
<ide> )
<ide>
<add> # depending on whether greedy generation is wanted or not define different output_batch_size and output_num_return_sequences_per_batch
<add> output_batch_size = batch_size if do_sample else batch_size * num_return_sequences
<add> output_num_return_sequences_per_batch = 1 if do_sample else num_return_sequences
<add>
<ide> # select the best hypotheses
<del> sent_lengths = input_ids.new(batch_size)
<add> sent_lengths = input_ids.new(output_batch_size)
<ide> best = []
<ide>
<add> # retrieve best hypotheses
<ide> for i, hypotheses in enumerate(generated_hyps):
<del> best_hyp = max(hypotheses.beams, key=lambda x: x[0])[1]
<del> sent_lengths[i] = len(best_hyp)
<del> best.append(best_hyp)
<add> sorted_hyps = sorted(hypotheses.beams, key=lambda x: x[0])
<add> for j in range(output_num_return_sequences_per_batch):
<add> effective_batch_idx = output_num_return_sequences_per_batch * i + j
<add> best_hyp = sorted_hyps.pop()[1]
<add> sent_lengths[effective_batch_idx] = len(best_hyp)
<add> best.append(best_hyp)
<ide>
<ide> # shorter batches are filled with pad_token
<ide> if sent_lengths.min().item() != sent_lengths.max().item():
<ide> assert pad_token_id is not None, "`Pad_token_id` has to be defined"
<ide> sent_max_len = min(sent_lengths.max().item() + 1, max_length)
<del> decoded = input_ids.new(batch_size, sent_max_len).fill_(pad_token_id)
<add> decoded = input_ids.new(output_batch_size, sent_max_len).fill_(pad_token_id)
<ide>
<ide> # fill with hypothesis and eos_token_id if necessary
<ide> for i, hypo in enumerate(best):
<ide><path>tests/test_modeling_common.py
<ide> def test_lm_head_model_random_generate(self):
<ide> # batch_size = 1, num_beams > 1
<ide> self._check_generated_tokens(model.generate(max_length=5, num_beams=3))
<ide>
<add> with self.assertRaises(AssertionError):
<add> # generating multiple sequences when greedy no beam generation
<add> # is not allowed as it would always generate the same sequences
<add> model.generate(input_ids, do_sample=False, num_return_sequences=2)
<add>
<add> with self.assertRaises(AssertionError):
<add> # generating more sequences than having beams leads is not possible
<add> model.generate(input_ids, do_sample=False, num_return_sequences=3, num_beams=2)
<add>
<ide> # batch_size > 1, sample
<ide> self._check_generated_tokens(model.generate(input_ids, num_return_sequences=3))
<ide> # batch_size > 1, greedy
<del> self._check_generated_tokens(model.generate(input_ids, do_sample=False, num_return_sequences=3))
<add> self._check_generated_tokens(model.generate(input_ids, do_sample=False))
<ide> # batch_size > 1, num_beams > 1, sample
<ide> self._check_generated_tokens(model.generate(input_ids, num_beams=3, num_return_sequences=3,))
<ide> # batch_size > 1, num_beams > 1, greedy | 2 |
Ruby | Ruby | add headversion tests | 00cdd5f481d409b1874b95c7f149c717ffb0259f | <ide><path>Library/Homebrew/test/test_versions.rb
<ide> def test_comparing_regular_versions
<ide>
<ide> def test_HEAD
<ide> assert_operator version("HEAD"), :>, version("1.2.3")
<add> assert_operator version("HEAD-abcdef"), :>, version("1.2.3")
<ide> assert_operator version("1.2.3"), :<, version("HEAD")
<add> assert_operator version("1.2.3"), :<, version("HEAD-fedcba")
<add> assert_operator version("HEAD-abcdef"), :==, version("HEAD-fedcba")
<add> assert_operator version("HEAD"), :==, version("HEAD-fedcba")
<ide> end
<ide>
<ide> def test_comparing_alpha_versions
<ide> def test_no_version
<ide> assert_version_nil "foo"
<ide> end
<ide>
<add> def test_create
<add> v = Version.create("1.20")
<add> refute_predicate v, :head?
<add> assert_equal "1.20", v.to_str
<add> end
<add>
<ide> def test_version_all_dots
<ide> assert_version_detected "1.14", "http://example.com/foo.bar.la.1.14.zip"
<ide> end
<ide> def test_from_url
<ide> "http://github.com/foo/bar.git", {:tag => "v1.2.3"}
<ide> end
<ide> end
<add>
<add>class HeadVersionTests < Homebrew::TestCase
<add> def test_create_head
<add> v1 = Version.create("HEAD-abcdef")
<add> v2 = Version.create("HEAD")
<add>
<add> assert_predicate v1, :head?
<add> assert_predicate v2, :head?
<add> end
<add>
<add> def test_commit_assigned
<add> v = HeadVersion.new("HEAD-abcdef")
<add> assert_equal "abcdef", v.commit
<add> assert_equal "HEAD-abcdef", v.to_str
<add> end
<add>
<add> def test_no_commit
<add> v = HeadVersion.new("HEAD")
<add> assert_nil v.commit
<add> assert_equal "HEAD", v.to_str
<add> end
<add>
<add> def test_update_commit
<add> v1 = HeadVersion.new("HEAD-abcdef")
<add> v2 = HeadVersion.new("HEAD")
<add>
<add> v1.update_commit("ffffff")
<add> assert_equal "ffffff", v1.commit
<add> assert_equal "HEAD-ffffff", v1.to_str
<add>
<add> v2.update_commit("ffffff")
<add> assert_equal "ffffff", v2.commit
<add> assert_equal "HEAD-ffffff", v2.to_str
<add> end
<add>end
<ide><path>Library/Homebrew/test/testing_env.rb
<ide> module Homebrew
<ide> module VersionAssertions
<ide> def version(v)
<del> Version.new(v)
<add> Version.create(v)
<ide> end
<ide>
<ide> def assert_version_equal(expected, actual) | 2 |
Ruby | Ruby | use xquartz when present | a07085df2def6bc25ee0d118e86b10e49c68aab0 | <ide><path>Library/Homebrew/extend/ENV.rb
<ide> def libxml2
<ide> def x11
<ide> opoo "You do not have X11 installed, this formula may not build." unless MacOS.x11_installed?
<ide>
<del> if MacOS.clt_installed?
<del> # For Xcode < 4.3 clt_installed? is true. So here is the old style /usr/X11:
<del> # There are some config scripts (e.g. freetype) here that should go in the path
<del> # (note we don't use MacOS.sdk_path here, because there is no ./usr/bin in there)
<del> prepend 'PATH', "/usr/X11/bin", ':'
<del> # CPPFLAGS are the C-PreProcessor flags, *not* C++!
<del> append 'CPPFLAGS', "-I/usr/X11/include"
<del> # Even without Xcode or the CLTs, /usr/X11/lib is there
<del> append 'LDFLAGS', "-L/usr/X11/lib"
<add> # There are some config scripts here that should go in the PATH. This
<add> # path is always under MacOS.x11_prefix, even for Xcode-only systems.
<add> prepend 'PATH', MacOS.x11_prefix/'bin', ':'
<add>
<add> # Similarily, pkgconfig files are only found under MacOS.x11_prefix.
<add> prepend 'PKG_CONFIG_PATH', MacOS.x11_prefix/'lib/pkgconfig', ':'
<add> prepend 'PKG_CONFIG_PATH', MacOS.x11_prefix/'share/pkgconfig', ':'
<add>
<add> append 'LDFLAGS', "-L#{MacOS.x11_prefix}/lib"
<add> append 'CMAKE_PREFIX_PATH', MacOS.x11_prefix, ':'
<add>
<add> # We prefer XQuartz if it is installed. Otherwise, we look for Apple's
<add> # X11. For Xcode-only systems, the headers are found in the SDK.
<add> prefix = if MacOS.x11_prefix.to_s == '/opt/X11' or MacOS.clt_installed?
<add> MacOS.x11_prefix
<ide> else
<del> # For Xcode 4.3 and above *without* CLT, we find the includes in the SDK:
<del> # Only the SDK has got include files. (they are no longer in /usr/X11/include !)
<del> # Todo: do we need to add cairo, fontconfig, GL, libpng15, pixman-1, VG, xcb, too?
<del> append 'CFLAGS', "-I#{MacOS.sdk_path}/usr/X11/include"
<del> append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/X11/include"
<del> append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/X11/include/freetype2"
<del> # The libs are still in /usr/X11/lib but to be consistent with the includes, we use the SDK, right?
<del> append 'LDFLAGS', "-L#{MacOS.sdk_path}/usr/X11/lib"
<del> append 'CMAKE_INCLUDE_PATH', "#{MacOS.sdk_path}/usr/X11/include", ':'
<add> MacOS.sdk_path/'usr/X11'
<add> end
<add>
<add> append 'CPPFLAGS', "-I#{prefix}/include"
<add>
<add> append 'CMAKE_PREFIX_PATH', prefix, ':'
<add> append 'CMAKE_INCLUDE_PATH', prefix/'include', ':'
<add>
<add> unless MacOS.clt_installed?
<add> append 'CPPFLAGS', "-I#{prefix}/include/freetype2"
<add> append 'CFLAGS', "-I#{prefix}/include"
<ide> end
<ide> end
<ide> alias_method :libpng, :x11
<ide><path>Library/Homebrew/macos.rb
<ide> def clang_build_version
<ide> end
<ide> end
<ide>
<add> def x11_prefix
<add> @x11_prefix ||= if Pathname.new('/opt/X11/lib/libpng.dylib').exist?
<add> Pathname.new('/opt/X11')
<add> elsif Pathname.new('/usr/X11/lib/libpng.dylib').exist?
<add> Pathname.new('/usr/X11')
<add> end
<add> end
<add>
<ide> def x11_installed?
<del> # Even if only Xcode (without CLT) is installed, this dylib is there.
<del> Pathname.new('/usr/X11/lib/libpng.dylib').exist?
<add> not x11_prefix.nil?
<ide> end
<ide>
<ide> def macports_or_fink_installed? | 2 |
Javascript | Javascript | fix scrollview static viewconfigs | 922219a852b7101acef54c8a9e97dad27fabfbec | <ide><path>Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js
<ide> export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
<ide> removeClippedSubviews: true,
<ide> borderTopRightRadius: true,
<ide> borderLeftColor: {process: require('../../StyleSheet/processColor')},
<add> pointerEvents: true,
<ide> },
<ide> };
<ide>
<ide><path>Libraries/Components/ScrollView/ScrollViewNativeComponent.js
<ide> export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
<ide> removeClippedSubviews: true,
<ide> borderTopRightRadius: true,
<ide> borderLeftColor: {process: require('../../StyleSheet/processColor')},
<add> pointerEvents: true,
<ide> },
<ide> }
<ide> : { | 2 |
Text | Text | formalize `auto` usage in c++ style guide | aba7677e826065fc1f1025ee2db5faee035fd515 | <ide><path>CPP_STYLE_GUIDE.md
<ide> * [Ownership and Smart Pointers](#ownership-and-smart-pointers)
<ide> * [Others](#others)
<ide> * [Type casting](#type-casting)
<add> * [Using `auto`](#using-auto)
<ide> * [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included)
<ide> * [Avoid throwing JavaScript errors in C++ methods](#avoid-throwing-javascript-errors-in-c)
<ide> * [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods)
<ide> Never use `std::auto_ptr`. Instead, use `std::unique_ptr`.
<ide> - Use `static_cast` for casting whenever it works
<ide> - `reinterpret_cast` is okay if `static_cast` is not appropriate
<ide>
<add>### Using `auto`
<add>
<add>Being explicit about types is usually preferred over using `auto`.
<add>
<add>Use `auto` to avoid type names that are noisy, obvious, or unimportant. When
<add>doing so, keep in mind that explicit types often help with readability and
<add>verifying the correctness of code.
<add>
<add>```cpp
<add>for (const auto& item : some_map) {
<add> const KeyType& key = item.first;
<add> const ValType& value = item.second;
<add> // The rest of the loop can now just refer to key and value,
<add> // a reader can see the types in question, and we've avoided
<add> // the too-common case of extra copies in this iteration.
<add>}
<add>```
<add>
<ide> ### Do not include `*.h` if `*-inl.h` has already been included
<ide>
<ide> Do | 1 |
Mixed | Javascript | modify getreport() to return an object | bff7a46f31f1da259071a1f4bd51aca726d5926e | <ide><path>doc/api/process.md
<ide> added: v11.8.0
<ide> -->
<ide>
<ide> * `err` {Error} A custom error used for reporting the JavaScript stack.
<del>* Returns: {string}
<add>* Returns: {Object}
<ide>
<del>Returns a JSON-formatted diagnostic report for the running process. The report's
<del>JavaScript stack trace is taken from `err`, if present.
<add>Returns a JavaScript Object representation of a diagnostic report for the
<add>running process. The report's JavaScript stack trace is taken from `err`, if
<add>present.
<ide>
<ide> ```js
<ide> const data = process.report.getReport();
<del>console.log(data);
<add>console.log(data.header.nodeJsVersion);
<add>
<add>// Similar to process.report.writeReport()
<add>const fs = require('fs');
<add>fs.writeFileSync(util.inspect(data), 'my-report.log', 'utf8');
<ide> ```
<ide>
<ide> Additional documentation is available in the [report documentation][].
<ide><path>doc/api/report.md
<ide> try {
<ide> // Any other code
<ide> ```
<ide>
<del>The content of the diagnostic report can be returned as a JSON-compatible object
<add>The content of the diagnostic report can be returned as a JavaScript Object
<ide> via an API call from a JavaScript application:
<ide>
<ide> ```js
<ide> const report = process.report.getReport();
<del>console.log(report);
<add>console.log(typeof report === 'object'); // true
<add>
<add>// Similar to process.report.writeReport() output
<add>console.log(JSON.stringify(report, null, 2));
<ide> ```
<ide>
<ide> This function takes an optional additional argument `err` - an `Error` object
<ide> that will be used as the context for the JavaScript stack printed in the report.
<ide>
<ide> ```js
<ide> const report = process.report.getReport(new Error('custom error'));
<del>console.log(report);
<add>console.log(typeof report === 'object'); // true
<ide> ```
<ide>
<ide> The API versions are useful when inspecting the runtime state from within
<ide> Node.js report completed
<ide> >
<ide> ```
<ide>
<del>When a report is triggered, start and end messages are issued to stderr
<add>When a report is written, start and end messages are issued to stderr
<ide> and the filename of the report is returned to the caller. The default filename
<ide> includes the date, time, PID and a sequence number. The sequence number helps
<ide> in associating the report dump with the runtime state if generated multiple
<ide><path>lib/internal/process/report.js
<ide> const {
<ide> } = require('internal/errors').codes;
<ide> const { validateSignalName, validateString } = require('internal/validators');
<ide> const nr = internalBinding('report');
<add>const { JSON } = primordials;
<ide> const report = {
<ide> writeReport(file, err) {
<ide> if (typeof file === 'object' && file !== null) {
<ide> const report = {
<ide> else if (err === null || typeof err !== 'object')
<ide> throw new ERR_INVALID_ARG_TYPE('err', 'Object', err);
<ide>
<del> return nr.getReport(err.stack);
<add> return JSON.parse(nr.getReport(err.stack));
<ide> },
<ide> get directory() {
<ide> return nr.getDirectory();
<ide><path>test/addons/worker-addon/test.js
<ide> switch (process.argv[2]) {
<ide> }
<ide>
<ide> // Use process.report to figure out if we might be running under musl libc.
<del>const glibc = JSON.parse(process.report.getReport()).header.glibcVersionRuntime;
<add>const glibc = process.report.getReport().header.glibcVersionRuntime;
<ide> assert(typeof glibc === 'string' || glibc === undefined, glibc);
<ide>
<ide> const libcMayBeMusl = common.isLinux && glibc === undefined;
<ide><path>test/common/README.md
<ide> functionality.
<ide> Returns an array of diagnotic report file names found in `dir`. The files should
<ide> have been generated by a process whose PID matches `pid`.
<ide>
<del>### validate(report)
<add>### validate(filepath)
<ide>
<del>* `report` [<string>] Diagnostic report file name to validate.
<add>* `filepath` [<string>] Diagnostic report filepath to validate.
<ide>
<ide> Validates the schema of a diagnostic report file whose path is specified in
<del>`report`. If the report fails validation, an exception is thrown.
<add>`filepath`. If the report fails validation, an exception is thrown.
<ide>
<del>### validateContent(data)
<add>### validateContent(report)
<ide>
<del>* `data` [<string>] Contents of a diagnostic report file.
<add>* `report` [<Object|string>] JSON contents of a diagnostic report file, the
<add>parsed Object thereof, or the result of `process.report.getReport()`.
<ide>
<ide> Validates the schema of a diagnostic report whose content is specified in
<del>`data`. If the report fails validation, an exception is thrown.
<add>`report`. If the report fails validation, an exception is thrown.
<ide>
<ide> ## tick Module
<ide>
<ide><path>test/common/report.js
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide> const os = require('os');
<ide> const path = require('path');
<add>const util = require('util');
<ide>
<ide> function findReports(pid, dir) {
<ide> // Default filenames are of the form
<ide> function findReports(pid, dir) {
<ide> return results;
<ide> }
<ide>
<del>function validate(report) {
<del> const data = fs.readFileSync(report, 'utf8');
<del>
<del> validateContent(data);
<add>function validate(filepath) {
<add> validateContent(JSON.parse(fs.readFileSync(filepath, 'utf8')));
<ide> }
<ide>
<del>function validateContent(data) {
<add>function validateContent(report) {
<add> if (typeof report === 'string') {
<add> try {
<add> report = JSON.parse(report);
<add> } catch {
<add> throw new TypeError(
<add> 'validateContent() expects a JSON string or JavaScript Object');
<add> }
<add> }
<ide> try {
<del> _validateContent(data);
<add> _validateContent(report);
<ide> } catch (err) {
<del> err.stack += `\n------\nFailing Report:\n${data}`;
<add> try {
<add> err.stack += util.format('\n------\nFailing Report:\n%O', report);
<add> } catch {}
<ide> throw err;
<ide> }
<ide> }
<ide>
<del>function _validateContent(data) {
<add>function _validateContent(report) {
<ide> const isWindows = process.platform === 'win32';
<del> const report = JSON.parse(data);
<ide>
<ide> // Verify that all sections are present as own properties of the report.
<ide> const sections = ['header', 'javascriptStack', 'nativeStack',
<ide><path>test/report/test-report-uv-handles.js
<ide> if (process.argv[2] === 'child') {
<ide> const server = http.createServer((req, res) => {
<ide> req.on('end', () => {
<ide> // Generate the report while the connection is active.
<del> console.log(process.report.getReport());
<add> console.log(JSON.stringify(process.report.getReport(), null, 2));
<ide> child_process.kill();
<ide>
<ide> res.writeHead(200, { 'Content-Type': 'text/plain' }); | 7 |
Java | Java | remove duplicate checks in responsecookietests | 4aa013c5083fa1ccc1ca5ea77b43d4d41fb6a8be | <ide><path>spring-web/src/test/java/org/springframework/http/ResponseCookieTests.java
<ide> public void domainChecks() {
<ide> Arrays.asList("abc", "abc.org", "abc-def.org", "abc3.org", ".abc.org")
<ide> .forEach(domain -> ResponseCookie.from("n", "v").domain(domain).build());
<ide>
<del> Arrays.asList("-abc.org", "abc.org.", "abc.org-", "-abc.org", "abc.org-")
<add> Arrays.asList("-abc.org", "abc.org.", "abc.org-")
<ide> .forEach(domain -> assertThatThrownBy(() -> ResponseCookie.from("n", "v").domain(domain).build())
<ide> .hasMessageContaining("Invalid first/last char"));
<ide> | 1 |
Javascript | Javascript | fix double semicolon | 962c7582ff47a67ba2021ea1010e487a3728ad2f | <ide><path>test/ContextDependencyTemplateAsId.test.js
<ide> describe("ContextDependencyTemplateAsId", () => {
<ide>
<ide> it("replaces source with missing module error", () => {
<ide> env.source.replace.callCount.should.be.exactly(1);
<del> sinon.assert.calledWith(env.source.replace, 1, 24, '!(function webpackMissingModule() { var e = new Error("Cannot find module \\"myModule\\""); e.code = \'MODULE_NOT_FOUND\';; throw e; }())');
<add> sinon.assert.calledWith(env.source.replace, 1, 24, '!(function webpackMissingModule() { var e = new Error("Cannot find module \\"myModule\\""); e.code = \'MODULE_NOT_FOUND\'; throw e; }())');
<ide> });
<ide> });
<ide> | 1 |
Text | Text | add the actual command in this example | d8d38f234563a3be0b23cc94df3a9453eacfdee8 | <ide><path>docs/userguide/networkingcontainers.md
<ide> The network named `bridge` is a special network. Unless you tell it otherwise, D
<ide> Inspecting the network is an easy way to find out the container's IP address.
<ide>
<ide> ```bash
<add>$ docker network inspect bridge
<ide> [
<ide> {
<ide> "Name": "bridge", | 1 |
Python | Python | fix lint issues | 7522e4dc3bb7678ee800d13ce615f863d8a3fcbd | <ide><path>official/resnet/keras/resnet_cifar_model.py
<ide> from __future__ import division
<ide> from __future__ import print_function
<ide>
<del>import warnings
<del>
<ide> import tensorflow as tf
<add>from tensorflow.python.keras import backend
<add>from tensorflow.python.keras import layers
<ide>
<ide>
<ide> BATCH_NORM_DECAY = 0.997
<ide> def resnet56(classes=100, training=None):
<ide> """Instantiates the ResNet56 architecture.
<ide>
<ide> Arguments:
<del> input_shape: optional shape tuple
<ide> classes: optional number of classes to classify images into
<ide> training: Only used if training keras model with Estimator. In other
<ide> scenarios it is handled automatically.
<ide> def resnet56(classes=100, training=None):
<ide> if backend.image_data_format() == 'channels_first':
<ide> input_shape = (3, 32, 32)
<ide> bn_axis = 1
<del> else: # channel_last
<add> else: # channel_last
<ide> input_shape = (32, 32, 3)
<ide> bn_axis = 3
<ide>
<add> img_input = layers.Input(shape=input_shape)
<ide> x = tf.keras.layers.ZeroPadding2D(padding=(1, 1), name='conv1_pad')(img_input)
<ide> x = tf.keras.layers.Conv2D(16, (3, 3),
<ide> strides=(1, 1), | 1 |
Mixed | Ruby | keep part when scope option has value | fb9117e190e39872fff7ae5d6b96bfb26ef8b32c | <ide><path>actionpack/CHANGELOG.md
<add>* Keep part when scope option has value
<add>
<add> When a route was defined within an optional scope, if that route didn't
<add> take parameters the scope was lost when using path helpers. This commit
<add> ensures scope is kept both when the route takes parameters or when it
<add> doesn't.
<add>
<add> Fixes #33219
<add>
<add> *Alberto Almagro*
<add>
<ide> * Added `deep_transform_keys` and `deep_transform_keys!` methods to ActionController::Parameters.
<ide>
<ide> *Gustavo Gutierrez*
<ide><path>actionpack/lib/action_dispatch/journey/formatter.rb
<ide> def extract_parameterized_parts(route, options, recall, parameterize = nil)
<ide> parameterized_parts = recall.merge(options)
<ide>
<ide> keys_to_keep = route.parts.reverse_each.drop_while { |part|
<del> !options.key?(part) || (options[part] || recall[part]).nil?
<add> !(options.key?(part) || route.scope_options.key?(part)) || (options[part] || recall[part]).nil?
<ide> } | route.required_parts
<ide>
<ide> parameterized_parts.delete_if do |bad_key, _|
<ide><path>actionpack/lib/action_dispatch/journey/route.rb
<ide> module ActionDispatch
<ide> # :stopdoc:
<ide> module Journey
<ide> class Route
<del> attr_reader :app, :path, :defaults, :name, :precedence
<add> attr_reader :app, :path, :defaults, :name, :precedence, :constraints,
<add> :internal, :scope_options
<ide>
<del> attr_reader :constraints, :internal
<ide> alias :conditions :constraints
<ide>
<ide> module VerbMatchers
<ide> def self.verb_matcher(verb)
<ide>
<ide> def self.build(name, app, path, constraints, required_defaults, defaults)
<ide> request_method_match = verb_matcher(constraints.delete(:request_method))
<del> new name, app, path, constraints, required_defaults, defaults, request_method_match, 0
<add> new name, app, path, constraints, required_defaults, defaults, request_method_match, 0, {}
<ide> end
<ide>
<ide> ##
<ide> # +path+ is a path constraint.
<ide> # +constraints+ is a hash of constraints to be applied to this route.
<del> def initialize(name, app, path, constraints, required_defaults, defaults, request_method_match, precedence, internal = false)
<add> def initialize(name, app, path, constraints, required_defaults, defaults, request_method_match, precedence, scope_options, internal = false)
<ide> @name = name
<ide> @app = app
<ide> @path = path
<ide> def initialize(name, app, path, constraints, required_defaults, defaults, reques
<ide> @decorated_ast = nil
<ide> @precedence = precedence
<ide> @path_formatter = @path.build_formatter
<add> @scope_options = scope_options
<ide> @internal = internal
<ide> end
<ide>
<ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> class Mapping #:nodoc:
<ide> ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
<ide> OPTIONAL_FORMAT_REGEX = %r{(?:\(\.:format\)+|\.:format|/)\Z}
<ide>
<del> attr_reader :requirements, :defaults
<del> attr_reader :to, :default_controller, :default_action
<del> attr_reader :required_defaults, :ast
<add> attr_reader :requirements, :defaults, :to, :default_controller,
<add> :default_action, :required_defaults, :ast, :scope_options
<ide>
<ide> def self.build(scope, set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
<ide> options = scope[:options].merge(options) if scope[:options]
<ide>
<ide> defaults = (scope[:defaults] || {}).dup
<ide> scope_constraints = scope[:constraints] || {}
<add> scope_options = scope[:options] || {}
<ide>
<del> new set, ast, defaults, controller, default_action, scope[:module], to, formatted, scope_constraints, scope[:blocks] || [], via, options_constraints, anchor, options
<add> new set, ast, defaults, controller, default_action, scope[:module], to, formatted, scope_constraints, scope_options, scope[:blocks] || [], via, options_constraints, anchor, options
<ide> end
<ide>
<ide> def self.check_via(via)
<ide> def self.optional_format?(path, format)
<ide> format != false && path !~ OPTIONAL_FORMAT_REGEX
<ide> end
<ide>
<del> def initialize(set, ast, defaults, controller, default_action, modyoule, to, formatted, scope_constraints, blocks, via, options_constraints, anchor, options)
<add> def initialize(set, ast, defaults, controller, default_action, modyoule, to, formatted, scope_constraints, scope_options, blocks, via, options_constraints, anchor, options)
<ide> @defaults = defaults
<ide> @set = set
<ide>
<ide> def initialize(set, ast, defaults, controller, default_action, modyoule, to, for
<ide> @anchor = anchor
<ide> @via = via
<ide> @internal = options.delete(:internal)
<add> @scope_options = scope_options
<ide>
<ide> path_params = ast.find_all(&:symbol?).map(&:to_sym)
<ide>
<ide> def initialize(set, ast, defaults, controller, default_action, modyoule, to, for
<ide>
<ide> def make_route(name, precedence)
<ide> Journey::Route.new(name, application, path, conditions, required_defaults,
<del> defaults, request_method, precedence, @internal)
<add> defaults, request_method, precedence, scope_options, @internal)
<ide> end
<ide>
<ide> def application
<ide><path>actionpack/test/dispatch/routing_test.rb
<ide> def assert_params(params)
<ide> end
<ide> end
<ide>
<add>class TestOptionalScopesWithOrWithoutParams < ActionDispatch::IntegrationTest
<add> Routes = ActionDispatch::Routing::RouteSet.new.tap do |app|
<add> app.draw do
<add> scope module: "test_optional_scopes_with_or_without_params" do
<add> scope "(:locale)", locale: /en|es/ do
<add> get "home", to: "home#index"
<add> get "with_param/:foo", to: "home#with_param", as: "with_param"
<add> get "without_param", to: "home#without_param"
<add> end
<add> end
<add> end
<add> end
<add>
<add> class HomeController < ActionController::Base
<add> include Routes.url_helpers
<add>
<add> def index
<add> render inline: "<%= with_param_path(foo: 'bar') %> | <%= without_param_path %>"
<add> end
<add>
<add> def with_param; end
<add> def without_param; end
<add> end
<add>
<add> APP = build_app Routes
<add>
<add> def app
<add> APP
<add> end
<add>
<add> def test_stays_unscoped_with_or_without_params
<add> get "/home"
<add> assert_equal "/with_param/bar | /without_param", response.body
<add> end
<add>
<add> def test_preserves_scope_with_or_without_params
<add> get "/es/home"
<add> assert_equal "/es/with_param/bar | /es/without_param", response.body
<add> end
<add>end
<add>
<ide> class TestPathParameters < ActionDispatch::IntegrationTest
<ide> Routes = ActionDispatch::Routing::RouteSet.new.tap do |app|
<ide> app.draw do | 5 |
Javascript | Javascript | remove log info when turbomodule cannot be found | 8a5ee96354a8e6f785e207c7e81f3ea6cb8ed29b | <ide><path>Libraries/TurboModule/TurboModuleRegistry.js
<ide> function requireModule<T: TurboModule>(name: string): ?T {
<ide>
<ide> if (turboModuleProxy != null) {
<ide> const module: ?T = turboModuleProxy(name);
<del> if (module == null) {
<del> // Common fixes: Verify the TurboModule is registered in the native binary, and adopts the code generated type-safe Spec base class.
<del> // Safe to ignore when caused by importing legacy modules that are unused.
<del> console.info(
<del> 'Unable to get TurboModule for ' +
<del> name +
<del> '. Safe to ignore if module works.',
<del> );
<del> }
<ide> return module;
<ide> }
<ide> | 1 |
Ruby | Ruby | start generalization of uploaders | 3e8c6c8e67b8296b013c535e6d46da6238345236 | <ide><path>Library/Homebrew/cmd/test-bot.rb
<ide> def test_bot
<ide> ENV['HOMEBREW_LOGS'] = "#{Dir.pwd}/logs"
<ide> end
<ide>
<del> if ARGV.include? '--ci-pr-upload' or ARGV.include? '--ci-testing-upload'
<add> if ARGV.include? '--ci-upload' or ARGV.include? '--ci-pr-upload' or ARGV.include? '--ci-testing-upload'
<ide> jenkins = ENV['JENKINS_HOME']
<ide> job = ENV['UPSTREAM_JOB_NAME']
<ide> id = ENV['UPSTREAM_BUILD_ID']
<ide> def test_bot
<ide> safe_system "git", "checkout", "-f", "master"
<ide> safe_system "git", "reset", "--hard", "origin/master"
<ide> safe_system "brew", "update"
<del>
<del> if ARGV.include? '--ci-pr-upload'
<del> safe_system "brew", "pull", "--clean", pr
<del> end
<add> safe_system "brew", "pull", "--clean", pr if pr
<ide>
<ide> ENV["GIT_AUTHOR_NAME"] = ENV["GIT_COMMITTER_NAME"]
<ide> ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"] | 1 |
Javascript | Javascript | fix the arguments order in assert.strictequal | d12d023df43084d118ab196054fac57ec1dfb81a | <ide><path>test/parallel/test-fs-write-string-coerce.js
<ide> fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) {
<ide> fs.write(fd, data, 0, 'utf8', common.mustCall(function(err, written) {
<ide> console.log('write done');
<ide> assert.ifError(err);
<del> assert.strictEqual(Buffer.byteLength(expected), written);
<add> assert.strictEqual(written, Buffer.byteLength(expected));
<ide> fs.closeSync(fd);
<ide> const found = fs.readFileSync(fn, 'utf8');
<ide> console.log(`expected: "${expected}"`);
<ide> console.log(`found: "${found}"`);
<ide> fs.unlinkSync(fn);
<del> assert.strictEqual(expected, found);
<add> assert.strictEqual(found, expected);
<ide> }));
<ide> })); | 1 |
Ruby | Ruby | remove duplicate html_escape docs | 9147613ce09710e70790ac45d3b20c3ef6c1fa46 | <ide><path>activesupport/lib/active_support/core_ext/string/output_safety.rb
<ide> def html_escape(s)
<ide> end
<ide> end
<ide> else
<del> # A utility method for escaping HTML tag characters.
<del> # This method is also aliased as <tt>h</tt>.
<del> #
<del> # In your ERB templates, use this method to escape any unsafe content. For example:
<del> # <%=h @person.name %>
<del> #
<del> # ==== Example:
<del> # puts html_escape("is a > 0 & a < 10?")
<del> # # => is a > 0 & a < 10?
<del> def html_escape(s)
<add> def html_escape(s) #:nodoc:
<ide> s = s.to_s
<ide> if s.html_safe?
<ide> s | 1 |
Ruby | Ruby | add alias info for runner command | d0355ed5a9d137456d0c3f574894732fe66811e7 | <ide><path>railties/lib/rails/commands.rb
<ide> benchmarker See how fast a piece of code runs
<ide> profiler Get profile information from a piece of code
<ide> plugin Install a plugin
<del> runner Run a piece of code in the application environment
<add> runner Run a piece of code in the application environment (short-cut alias: "r")
<ide>
<ide> All commands can be run with -h for more information.
<ide> EOT | 1 |
Ruby | Ruby | fix rubocop warnings | 219c373115dea67d7753ab51e1e95f5f41e8e9f8 | <ide><path>Library/Homebrew/test/test_dependency_collector.rb
<ide> def find_dependency(name)
<ide> end
<ide>
<ide> def find_requirement(klass)
<del> @d.requirements.find { |req| klass === req }
<add> @d.requirements.find { |req| req.is_a? klass }
<ide> end
<ide>
<ide> def setup | 1 |
Text | Text | use correct folder name | c9e498f36fd110c7308f05dff88bd60b6bd9db11 | <ide><path>docs/creating-a-package.md
<ide> key mappings your package needs to load. If not specified, mappings in the
<ide> _keymaps_ directory are added alphabetically.
<ide> - `menus`(**Optional**): an Array of Strings identifying the order of
<ide> the menu mappings your package needs to load. If not specified, mappings
<del>in the _keymap_ directory are added alphabetically.
<add>in the _menus_ directory are added alphabetically.
<ide> - `snippets` (**Optional**): an Array of Strings identifying the order of the
<ide> snippets your package needs to load. If not specified, snippets in the
<ide> _snippets_ directory are added alphabetically. | 1 |
Ruby | Ruby | specify protocol for external links | 61f157e11c4e04a67f888848cda6bdbe7b46c466 | <ide><path>activesupport/lib/active_support/json/decoding.rb
<ide> module JSON
<ide>
<ide> class << self
<ide> # Parses a JSON string (JavaScript Object Notation) into a hash.
<del> # See www.json.org for more info.
<add> # See http://www.json.org for more info.
<ide> #
<ide> # ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
<ide> # => {"team" => "rails", "players" => "36"}
<ide><path>activesupport/lib/active_support/json/encoding.rb
<ide> class << self
<ide>
<ide> module JSON
<ide> # Dumps objects in JSON (JavaScript Object Notation).
<del> # See www.json.org for more info.
<add> # See http://www.json.org for more info.
<ide> #
<ide> # ActiveSupport::JSON.encode({ team: 'rails', players: '36' })
<ide> # # => "{\"team\":\"rails\",\"players\":\"36\"}" | 2 |
Javascript | Javascript | remove unused variables | 517811764d3a37806f3e5c4f0c6ca6527e2c189c | <ide><path>test/widget/inputSpec.js
<ide> describe('widget: input', function() {
<ide> }));
<ide>
<ide> it('should throw an error of Controller not declared in scope', inject(function($rootScope, $compile) {
<del> var input, $formFactory;
<add> var input;
<ide> var element = angular.element('<input type="@DontExist" ng:model="abc">');
<ide> var error;
<ide> try { | 1 |
PHP | PHP | convert the socket class to use the config trait | c1efe239a9cf9b76287f608a6784bb6c26f30aee | <ide><path>src/Network/Socket.php
<ide> */
<ide> namespace Cake\Network;
<ide>
<add>use Cake\Core\InstanceConfigTrait;
<ide> use Cake\Error;
<ide> use Cake\Validation\Validation;
<ide>
<ide> */
<ide> class Socket {
<ide>
<add> use InstanceConfigTrait;
<add>
<ide> /**
<ide> * Object description
<ide> *
<ide> class Socket {
<ide> public $description = 'Remote DataSource Network Socket Interface';
<ide>
<ide> /**
<del> * Base configuration settings for the socket connection
<add> * Default configuration settings for the socket connection
<ide> *
<ide> * @var array
<ide> */
<del> protected $_baseConfig = array(
<add> protected $_defaultConfig = array(
<ide> 'persistent' => false,
<ide> 'host' => 'localhost',
<ide> 'protocol' => 'tcp',
<ide> 'port' => 80,
<ide> 'timeout' => 30
<ide> );
<ide>
<del>/**
<del> * Configuration settings for the socket connection
<del> *
<del> * @var array
<del> */
<del> public $config = array();
<del>
<ide> /**
<ide> * Reference to socket connection resource
<ide> *
<ide> class Socket {
<ide> * @see Socket::$_baseConfig
<ide> */
<ide> public function __construct($config = array()) {
<del> $this->config = array_merge($this->_baseConfig, $config);
<del> if (!is_numeric($this->config['protocol'])) {
<del> $this->config['protocol'] = getprotobyname($this->config['protocol']);
<add> $this->config($config);
<add>
<add> if (!is_numeric($this->_config['protocol'])) {
<add> $this->_config['protocol'] = getprotobyname($this->_config['protocol']);
<ide> }
<ide> }
<ide>
<ide> public function connect() {
<ide> }
<ide>
<ide> $scheme = null;
<del> if (isset($this->config['request']['uri']) && $this->config['request']['uri']['scheme'] === 'https') {
<add> if (isset($this->_config['request']['uri']) && $this->_config['request']['uri']['scheme'] === 'https') {
<ide> $scheme = 'ssl://';
<ide> }
<ide>
<del> if (!empty($this->config['context'])) {
<del> $context = stream_context_create($this->config['context']);
<add> if (!empty($this->_config['context'])) {
<add> $context = stream_context_create($this->_config['context']);
<ide> } else {
<ide> $context = stream_context_create();
<ide> }
<ide>
<ide> $connectAs = STREAM_CLIENT_CONNECT;
<del> if ($this->config['persistent']) {
<add> if ($this->_config['persistent']) {
<ide> $connectAs |= STREAM_CLIENT_PERSISTENT;
<ide> }
<ide>
<ide> set_error_handler(array($this, '_connectionErrorHandler'));
<ide> $this->connection = stream_socket_client(
<del> $scheme . $this->config['host'] . ':' . $this->config['port'],
<add> $scheme . $this->_config['host'] . ':' . $this->_config['port'],
<ide> $errNum,
<ide> $errStr,
<del> $this->config['timeout'],
<add> $this->_config['timeout'],
<ide> $connectAs,
<ide> $context
<ide> );
<ide> public function connect() {
<ide>
<ide> $this->connected = is_resource($this->connection);
<ide> if ($this->connected) {
<del> stream_set_timeout($this->connection, $this->config['timeout']);
<add> stream_set_timeout($this->connection, $this->_config['timeout']);
<ide> }
<ide> return $this->connected;
<ide> }
<ide> public function context() {
<ide> * @return string Host name
<ide> */
<ide> public function host() {
<del> if (Validation::ip($this->config['host'])) {
<del> return gethostbyaddr($this->config['host']);
<add> if (Validation::ip($this->_config['host'])) {
<add> return gethostbyaddr($this->_config['host']);
<ide> }
<ide> return gethostbyaddr($this->address());
<ide> }
<ide> public function host() {
<ide> * @return string IP address
<ide> */
<ide> public function address() {
<del> if (Validation::ip($this->config['host'])) {
<del> return $this->config['host'];
<add> if (Validation::ip($this->_config['host'])) {
<add> return $this->_config['host'];
<ide> }
<del> return gethostbyname($this->config['host']);
<add> return gethostbyname($this->_config['host']);
<ide> }
<ide>
<ide> /**
<ide> public function address() {
<ide> * @return array IP addresses
<ide> */
<ide> public function addresses() {
<del> if (Validation::ip($this->config['host'])) {
<del> return array($this->config['host']);
<add> if (Validation::ip($this->_config['host'])) {
<add> return array($this->_config['host']);
<ide> }
<del> return gethostbynamel($this->config['host']);
<add> return gethostbynamel($this->_config['host']);
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Network/SocketTest.php
<ide> public function tearDown() {
<ide> */
<ide> public function testConstruct() {
<ide> $this->Socket = new Socket();
<del> $config = $this->Socket->config;
<add> $config = $this->Socket->config();
<ide> $this->assertSame($config, array(
<ide> 'persistent' => false,
<ide> 'host' => 'localhost',
<ide> public function testConstruct() {
<ide> $this->Socket->reset();
<ide> $this->Socket->__construct(array('host' => 'foo-bar'));
<ide> $config['host'] = 'foo-bar';
<del> $this->assertSame($this->Socket->config, $config);
<add> $this->assertSame($this->Socket->config(), $config);
<ide>
<ide> $this->Socket = new Socket(array('host' => 'www.cakephp.org', 'port' => 23, 'protocol' => 'udp'));
<del> $config = $this->Socket->config;
<add> $config = $this->Socket->config();
<ide>
<ide> $config['host'] = 'www.cakephp.org';
<ide> $config['port'] = 23;
<ide> $config['protocol'] = 17;
<ide>
<del> $this->assertSame($this->Socket->config, $config);
<add> $this->assertSame($this->Socket->config(), $config);
<ide> }
<ide>
<ide> /**
<ide> public static function invalidConnections() {
<ide> * return void
<ide> */
<ide> public function testInvalidConnection($data) {
<del> $this->Socket->config = array_merge($this->Socket->config, $data);
<add> $this->Socket->config($data);
<ide> $this->Socket->connect();
<ide> }
<ide>
<ide> public function testReset() {
<ide> );
<ide> $anotherSocket = new Socket($config);
<ide> $anotherSocket->reset();
<del> $this->assertEquals(array(), $anotherSocket->config);
<add>
<add> $expected = [
<add> 'persistent' => false,
<add> 'host' => 'localhost',
<add> 'protocol' => 'tcp',
<add> 'port' => 80,
<add> 'timeout' => 30
<add> ];
<add> $this->assertEquals(
<add> $expected,
<add> $anotherSocket->config(),
<add> 'Reset should cause config to return the defaults defined in _defaultConfig'
<add> );
<ide> }
<ide>
<ide> /** | 2 |
Go | Go | extract container store from the daemon | 3c82fad44112dc73861f325bbecd68b9922b0ad3 | <add><path>container/history.go
<del><path>daemon/history.go
<del>package daemon
<add>package container
<ide>
<del>import (
<del> "sort"
<del>
<del> "github.com/docker/docker/container"
<del>)
<add>import "sort"
<ide>
<ide> // History is a convenience type for storing a list of containers,
<del>// ordered by creation date.
<del>type History []*container.Container
<add>// sorted by creation date in descendant order.
<add>type History []*Container
<ide>
<add>// Len returns the number of containers in the history.
<ide> func (history *History) Len() int {
<ide> return len(*history)
<ide> }
<ide>
<add>// Less compares two containers and returns true if the second one
<add>// was created before the first one.
<ide> func (history *History) Less(i, j int) bool {
<ide> containers := *history
<ide> return containers[j].Created.Before(containers[i].Created)
<ide> }
<ide>
<add>// Swap switches containers i and j positions in the history.
<ide> func (history *History) Swap(i, j int) {
<ide> containers := *history
<ide> containers[i], containers[j] = containers[j], containers[i]
<ide> }
<ide>
<ide> // Add the given container to history.
<del>func (history *History) Add(container *container.Container) {
<add>func (history *History) Add(container *Container) {
<ide> *history = append(*history, container)
<ide> }
<ide>
<add>// sort orders the history by creation date in descendant order.
<ide> func (history *History) sort() {
<ide> sort.Sort(history)
<ide> }
<ide><path>container/memory_store.go
<add>package container
<add>
<add>import "sync"
<add>
<add>// memoryStore implements a Store in memory.
<add>type memoryStore struct {
<add> s map[string]*Container
<add> sync.Mutex
<add>}
<add>
<add>// NewMemoryStore initializes a new memory store.
<add>func NewMemoryStore() Store {
<add> return &memoryStore{
<add> s: make(map[string]*Container),
<add> }
<add>}
<add>
<add>// Add appends a new container to the memory store.
<add>// It overrides the id if it existed before.
<add>func (c *memoryStore) Add(id string, cont *Container) {
<add> c.Lock()
<add> c.s[id] = cont
<add> c.Unlock()
<add>}
<add>
<add>// Get returns a container from the store by id.
<add>func (c *memoryStore) Get(id string) *Container {
<add> c.Lock()
<add> res := c.s[id]
<add> c.Unlock()
<add> return res
<add>}
<add>
<add>// Delete removes a container from the store by id.
<add>func (c *memoryStore) Delete(id string) {
<add> c.Lock()
<add> delete(c.s, id)
<add> c.Unlock()
<add>}
<add>
<add>// List returns a sorted list of containers from the store.
<add>// The containers are ordered by creation date.
<add>func (c *memoryStore) List() []*Container {
<add> containers := new(History)
<add> c.Lock()
<add> for _, cont := range c.s {
<add> containers.Add(cont)
<add> }
<add> c.Unlock()
<add> containers.sort()
<add> return *containers
<add>}
<add>
<add>// Size returns the number of containers in the store.
<add>func (c *memoryStore) Size() int {
<add> c.Lock()
<add> defer c.Unlock()
<add> return len(c.s)
<add>}
<add>
<add>// First returns the first container found in the store by a given filter.
<add>func (c *memoryStore) First(filter StoreFilter) *Container {
<add> c.Lock()
<add> defer c.Unlock()
<add> for _, cont := range c.s {
<add> if filter(cont) {
<add> return cont
<add> }
<add> }
<add> return nil
<add>}
<add>
<add>// ApplyAll calls the reducer function with every container in the store.
<add>// This operation is asyncronous in the memory store.
<add>func (c *memoryStore) ApplyAll(apply StoreReducer) {
<add> c.Lock()
<add> defer c.Unlock()
<add>
<add> wg := new(sync.WaitGroup)
<add> for _, cont := range c.s {
<add> wg.Add(1)
<add> go func(container *Container) {
<add> apply(container)
<add> wg.Done()
<add> }(cont)
<add> }
<add>
<add> wg.Wait()
<add>}
<add>
<add>var _ Store = &memoryStore{}
<ide><path>container/memory_store_test.go
<add>package container
<add>
<add>import (
<add> "testing"
<add> "time"
<add>)
<add>
<add>func TestNewMemoryStore(t *testing.T) {
<add> s := NewMemoryStore()
<add> m, ok := s.(*memoryStore)
<add> if !ok {
<add> t.Fatalf("store is not a memory store %v", s)
<add> }
<add> if m.s == nil {
<add> t.Fatal("expected store map to not be nil")
<add> }
<add>}
<add>
<add>func TestAddContainers(t *testing.T) {
<add> s := NewMemoryStore()
<add> s.Add("id", NewBaseContainer("id", "root"))
<add> if s.Size() != 1 {
<add> t.Fatalf("expected store size 1, got %v", s.Size())
<add> }
<add>}
<add>
<add>func TestGetContainer(t *testing.T) {
<add> s := NewMemoryStore()
<add> s.Add("id", NewBaseContainer("id", "root"))
<add> c := s.Get("id")
<add> if c == nil {
<add> t.Fatal("expected container to not be nil")
<add> }
<add>}
<add>
<add>func TestDeleteContainer(t *testing.T) {
<add> s := NewMemoryStore()
<add> s.Add("id", NewBaseContainer("id", "root"))
<add> s.Delete("id")
<add> if c := s.Get("id"); c != nil {
<add> t.Fatalf("expected container to be nil after removal, got %v", c)
<add> }
<add>
<add> if s.Size() != 0 {
<add> t.Fatalf("expected store size to be 0, got %v", s.Size())
<add> }
<add>}
<add>
<add>func TestListContainers(t *testing.T) {
<add> s := NewMemoryStore()
<add>
<add> cont := NewBaseContainer("id", "root")
<add> cont.Created = time.Now()
<add> cont2 := NewBaseContainer("id2", "root")
<add> cont2.Created = time.Now().Add(24 * time.Hour)
<add>
<add> s.Add("id", cont)
<add> s.Add("id2", cont2)
<add>
<add> list := s.List()
<add> if len(list) != 2 {
<add> t.Fatalf("expected list size 2, got %v", len(list))
<add> }
<add> if list[0].ID != "id2" {
<add> t.Fatalf("expected older container to be first, got %v", list[0].ID)
<add> }
<add>}
<add>
<add>func TestFirstContainer(t *testing.T) {
<add> s := NewMemoryStore()
<add>
<add> s.Add("id", NewBaseContainer("id", "root"))
<add> s.Add("id2", NewBaseContainer("id2", "root"))
<add>
<add> first := s.First(func(cont *Container) bool {
<add> return cont.ID == "id2"
<add> })
<add>
<add> if first == nil {
<add> t.Fatal("expected container to not be nil")
<add> }
<add> if first.ID != "id2" {
<add> t.Fatalf("expected id2, got %v", first)
<add> }
<add>}
<add>
<add>func TestApplyAllContainer(t *testing.T) {
<add> s := NewMemoryStore()
<add>
<add> s.Add("id", NewBaseContainer("id", "root"))
<add> s.Add("id2", NewBaseContainer("id2", "root"))
<add>
<add> s.ApplyAll(func(cont *Container) {
<add> if cont.ID == "id2" {
<add> cont.ID = "newID"
<add> }
<add> })
<add>
<add> cont := s.Get("id2")
<add> if cont == nil {
<add> t.Fatal("expected container to not be nil")
<add> }
<add> if cont.ID != "newID" {
<add> t.Fatalf("expected newID, got %v", cont)
<add> }
<add>}
<ide><path>container/store.go
<add>package container
<add>
<add>// StoreFilter defines a function to filter
<add>// container in the store.
<add>type StoreFilter func(*Container) bool
<add>
<add>// StoreReducer defines a function to
<add>// manipulate containers in the store
<add>type StoreReducer func(*Container)
<add>
<add>// Store defines an interface that
<add>// any container store must implement.
<add>type Store interface {
<add> // Add appends a new container to the store.
<add> Add(string, *Container)
<add> // Get returns a container from the store by the identifier it was stored with.
<add> Get(string) *Container
<add> // Delete removes a container from the store by the identifier it was stored with.
<add> Delete(string)
<add> // List returns a list of containers from the store.
<add> List() []*Container
<add> // Size returns the number of containers in the store.
<add> Size() int
<add> // First returns the first container found in the store by a given filter.
<add> First(StoreFilter) *Container
<add> // ApplyAll calls the reducer function with every container in the store.
<add> ApplyAll(StoreReducer)
<add>}
<ide><path>daemon/daemon.go
<ide> func (e ErrImageDoesNotExist) Error() string {
<ide> return fmt.Sprintf("no such id: %s", e.RefOrID)
<ide> }
<ide>
<del>type contStore struct {
<del> s map[string]*container.Container
<del> sync.Mutex
<del>}
<del>
<del>func (c *contStore) Add(id string, cont *container.Container) {
<del> c.Lock()
<del> c.s[id] = cont
<del> c.Unlock()
<del>}
<del>
<del>func (c *contStore) Get(id string) *container.Container {
<del> c.Lock()
<del> res := c.s[id]
<del> c.Unlock()
<del> return res
<del>}
<del>
<del>func (c *contStore) Delete(id string) {
<del> c.Lock()
<del> delete(c.s, id)
<del> c.Unlock()
<del>}
<del>
<del>func (c *contStore) List() []*container.Container {
<del> containers := new(History)
<del> c.Lock()
<del> for _, cont := range c.s {
<del> containers.Add(cont)
<del> }
<del> c.Unlock()
<del> containers.sort()
<del> return *containers
<del>}
<del>
<ide> // Daemon holds information about the Docker daemon.
<ide> type Daemon struct {
<ide> ID string
<ide> repository string
<del> containers *contStore
<add> containers container.Store
<ide> execCommands *exec.Store
<ide> referenceStore reference.Store
<ide> downloadManager *xfer.LayerDownloadManager
<ide> func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo
<ide>
<ide> d.ID = trustKey.PublicKey().KeyID()
<ide> d.repository = daemonRepo
<del> d.containers = &contStore{s: make(map[string]*container.Container)}
<add> d.containers = container.NewMemoryStore()
<ide> d.execCommands = exec.NewStore()
<ide> d.referenceStore = referenceStore
<ide> d.distributionMetadataStore = distributionMetadataStore
<ide> func (daemon *Daemon) shutdownContainer(c *container.Container) error {
<ide> func (daemon *Daemon) Shutdown() error {
<ide> daemon.shutdown = true
<ide> if daemon.containers != nil {
<del> group := sync.WaitGroup{}
<ide> logrus.Debug("starting clean shutdown of all containers...")
<del> for _, cont := range daemon.List() {
<del> if !cont.IsRunning() {
<del> continue
<add> daemon.containers.ApplyAll(func(c *container.Container) {
<add> if !c.IsRunning() {
<add> return
<ide> }
<del> logrus.Debugf("stopping %s", cont.ID)
<del> group.Add(1)
<del> go func(c *container.Container) {
<del> defer group.Done()
<del> if err := daemon.shutdownContainer(c); err != nil {
<del> logrus.Errorf("Stop container error: %v", err)
<del> return
<del> }
<del> logrus.Debugf("container stopped %s", c.ID)
<del> }(cont)
<del> }
<del> group.Wait()
<add> logrus.Debugf("stopping %s", c.ID)
<add> if err := daemon.shutdownContainer(c); err != nil {
<add> logrus.Errorf("Stop container error: %v", err)
<add> return
<add> }
<add> logrus.Debugf("container stopped %s", c.ID)
<add> })
<ide> }
<ide>
<ide> // trigger libnetwork Stop only if it's initialized
<ide><path>daemon/daemon_test.go
<ide> func TestGetContainer(t *testing.T) {
<ide> },
<ide> }
<ide>
<del> store := &contStore{
<del> s: map[string]*container.Container{
<del> c1.ID: c1,
<del> c2.ID: c2,
<del> c3.ID: c3,
<del> c4.ID: c4,
<del> c5.ID: c5,
<del> },
<del> }
<add> store := container.NewMemoryStore()
<add> store.Add(c1.ID, c1)
<add> store.Add(c2.ID, c2)
<add> store.Add(c3.ID, c3)
<add> store.Add(c4.ID, c4)
<add> store.Add(c5.ID, c5)
<ide>
<ide> index := truncindex.NewTruncIndex([]string{})
<ide> index.Add(c1.ID)
<ide><path>daemon/delete_test.go
<ide> func TestContainerDoubleDelete(t *testing.T) {
<ide> repository: tmp,
<ide> root: tmp,
<ide> }
<del> daemon.containers = &contStore{s: make(map[string]*container.Container)}
<add> daemon.containers = container.NewMemoryStore()
<ide>
<ide> container := &container.Container{
<ide> CommonContainer: container.CommonContainer{
<ide><path>daemon/image_delete.go
<ide> func isImageIDPrefix(imageID, possiblePrefix string) bool {
<ide> // getContainerUsingImage returns a container that was created using the given
<ide> // imageID. Returns nil if there is no such container.
<ide> func (daemon *Daemon) getContainerUsingImage(imageID image.ID) *container.Container {
<del> for _, container := range daemon.List() {
<del> if container.ImageID == imageID {
<del> return container
<del> }
<del> }
<del>
<del> return nil
<add> return daemon.containers.First(func(c *container.Container) bool {
<add> return c.ImageID == imageID
<add> })
<ide> }
<ide>
<ide> // removeImageRef attempts to parse and remove the given image reference from
<ide> func (daemon *Daemon) checkImageDeleteConflict(imgID image.ID, mask conflictType
<ide>
<ide> if mask&conflictRunningContainer != 0 {
<ide> // Check if any running container is using the image.
<del> for _, container := range daemon.List() {
<del> if !container.IsRunning() {
<del> // Skip this until we check for soft conflicts later.
<del> continue
<del> }
<del>
<del> if container.ImageID == imgID {
<del> return &imageDeleteConflict{
<del> imgID: imgID,
<del> hard: true,
<del> used: true,
<del> message: fmt.Sprintf("image is being used by running container %s", stringid.TruncateID(container.ID)),
<del> }
<add> running := func(c *container.Container) bool {
<add> return c.IsRunning() && c.ImageID == imgID
<add> }
<add> if container := daemon.containers.First(running); container != nil {
<add> return &imageDeleteConflict{
<add> imgID: imgID,
<add> hard: true,
<add> used: true,
<add> message: fmt.Sprintf("image is being used by running container %s", stringid.TruncateID(container.ID)),
<ide> }
<ide> }
<ide> }
<ide> func (daemon *Daemon) checkImageDeleteConflict(imgID image.ID, mask conflictType
<ide>
<ide> if mask&conflictStoppedContainer != 0 {
<ide> // Check if any stopped containers reference this image.
<del> for _, container := range daemon.List() {
<del> if container.IsRunning() {
<del> // Skip this as it was checked above in hard conflict conditions.
<del> continue
<del> }
<del>
<del> if container.ImageID == imgID {
<del> return &imageDeleteConflict{
<del> imgID: imgID,
<del> used: true,
<del> message: fmt.Sprintf("image is being used by stopped container %s", stringid.TruncateID(container.ID)),
<del> }
<add> stopped := func(c *container.Container) bool {
<add> return !c.IsRunning() && c.ImageID == imgID
<add> }
<add> if container := daemon.containers.First(stopped); container != nil {
<add> return &imageDeleteConflict{
<add> imgID: imgID,
<add> used: true,
<add> message: fmt.Sprintf("image is being used by stopped container %s", stringid.TruncateID(container.ID)),
<ide> }
<ide> }
<ide> }
<ide><path>daemon/info.go
<ide> import (
<ide> "os"
<ide> "runtime"
<ide> "strings"
<add> "sync/atomic"
<ide> "time"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/docker/docker/container"
<ide> "github.com/docker/docker/dockerversion"
<ide> "github.com/docker/docker/pkg/fileutils"
<ide> "github.com/docker/docker/pkg/parsers/kernel"
<ide> func (daemon *Daemon) SystemInfo() (*types.Info, error) {
<ide> initPath := utils.DockerInitPath("")
<ide> sysInfo := sysinfo.New(true)
<ide>
<del> var cRunning, cPaused, cStopped int
<del> for _, c := range daemon.List() {
<add> var cRunning, cPaused, cStopped int32
<add> daemon.containers.ApplyAll(func(c *container.Container) {
<ide> switch c.StateString() {
<ide> case "paused":
<del> cPaused++
<add> atomic.AddInt32(&cPaused, 1)
<ide> case "running":
<del> cRunning++
<add> atomic.AddInt32(&cRunning, 1)
<ide> default:
<del> cStopped++
<add> atomic.AddInt32(&cStopped, 1)
<ide> }
<del> }
<add> })
<ide>
<ide> v := &types.Info{
<ide> ID: daemon.ID,
<del> Containers: len(daemon.List()),
<del> ContainersRunning: cRunning,
<del> ContainersPaused: cPaused,
<del> ContainersStopped: cStopped,
<add> Containers: int(cRunning + cPaused + cStopped),
<add> ContainersRunning: int(cRunning),
<add> ContainersPaused: int(cPaused),
<add> ContainersStopped: int(cStopped),
<ide> Images: len(daemon.imageStore.Map()),
<ide> Driver: daemon.GraphDriverName(),
<ide> DriverStatus: daemon.layerStore.DriverStatus(),
<ide><path>daemon/links_test.go
<ide> func TestMigrateLegacySqliteLinks(t *testing.T) {
<ide> },
<ide> }
<ide>
<del> store := &contStore{
<del> s: map[string]*container.Container{
<del> c1.ID: c1,
<del> c2.ID: c2,
<del> },
<del> }
<add> store := container.NewMemoryStore()
<add> store.Add(c1.ID, c1)
<add> store.Add(c2.ID, c2)
<ide>
<ide> d := &Daemon{root: tmpDir, containers: store}
<ide> db, err := graphdb.NewSqliteConn(filepath.Join(d.root, "linkgraph.db")) | 10 |
Javascript | Javascript | catch all requests in custom server | 53f4f82e4c69fc9fcdd98d9c952ab0ff97665fa7 | <ide><path>examples/custom-server-express/server.js
<ide> app.prepare().then(() => {
<ide> return app.render(req, res, '/posts', { id: req.params.id })
<ide> })
<ide>
<del> server.get('*', (req, res) => {
<add> server.all('*', (req, res) => {
<ide> return handle(req, res)
<ide> })
<ide>
<ide><path>examples/custom-server-fastify/server.js
<ide> fastify.register((fastify, opts, next) => {
<ide> })
<ide> })
<ide>
<del> fastify.get('/*', (req, reply) => {
<add> fastify.all('/*', (req, reply) => {
<ide> return app.handleRequest(req.req, reply.res).then(() => {
<ide> reply.sent = true
<ide> })
<ide><path>examples/custom-server-hapi/server.js
<ide> app.prepare().then(async () => {
<ide> })
<ide>
<ide> server.route({
<del> method: 'GET',
<add> method: '*',
<ide> path: '/{p*}' /* catch all route */,
<ide> handler: defaultHandlerWrapper(app)
<ide> })
<ide><path>examples/custom-server-koa/server.js
<ide> app.prepare().then(() => {
<ide> ctx.respond = false
<ide> })
<ide>
<del> router.get('*', async ctx => {
<add> router.all('*', async ctx => {
<ide> await handle(ctx.req, ctx.res)
<ide> ctx.respond = false
<ide> })
<ide><path>examples/custom-server-polka/server.js
<ide> app.prepare().then(() => {
<ide>
<ide> server.get('/b', (req, res) => app.render(req, res, '/b', req.query))
<ide>
<del> server.get('*', (req, res) => handle(req, res))
<add> server.all('*', (req, res) => handle(req, res))
<ide>
<ide> server.listen(port, err => {
<ide> if (err) throw err | 5 |
Javascript | Javascript | remove first arg from intercepted fn | 6530310ed59c1056aa71c17133b5dbee87e2415c | <ide><path>lib/domain.js
<ide> Domain.prototype.bind = function(cb, interceptError) {
<ide> // slower for less common case: cb(er, foo, bar, baz, ...)
<ide> args = new Array(len - 1);
<ide> for (var i = 1; i < len; i++) {
<del> args[i] = arguments[i - 1];
<add> args[i - 1] = arguments[i];
<ide> }
<ide> break;
<ide> }
<ide><path>test/simple/test-domain.js
<ide> function fn2(data) {
<ide> var bound = d.intercept(fn2);
<ide> bound(null, 'data');
<ide>
<add>// intercepted should never pass first argument to callback
<add>// even if arguments length is more than 2.
<add>function fn3(data, data2) {
<add> assert.equal(data, 'data', 'should not be null err argument');
<add> assert.equal(data2, 'data2', 'should not be data argument');
<add>}
<add>
<add>bound = d.intercept(fn3);
<add>bound(null, 'data', 'data2');
<ide>
<ide> // throwing in a bound fn is also caught,
<ide> // even if it's asynchronous, by hitting the | 2 |
Python | Python | fix tests + first example of doc | 31e5b5ff2276c61af7eebb4c353934f8f675d728 | <ide><path>transformers/tokenization_utils.py
<ide> def from_pretrained(cls, *inputs, **kwargs):
<ide> pretrained_model_name_or_path: either:
<ide>
<ide> - a string with the `shortcut name` of a predefined tokenizer to load from cache or download, e.g.: ``bert-base-uncased``.
<add> - a string with the `identifier name` of a predefined tokenizer that was user-uploaded to our S3, e.g.: ``dbmz/bert-base-german-cased``.
<ide> - a path to a `directory` containing vocabulary files required by the tokenizer, for instance saved using the :func:`~transformers.PreTrainedTokenizer.save_pretrained` method, e.g.: ``./my_model_directory/``.
<ide> - (not applicable to all derived classes) a path or url to a single saved vocabulary file if and only if the tokenizer only requires a single vocabulary file (e.g. Bert, XLNet), e.g.: ``./my_model_directory/vocab.txt``.
<ide>
<ide> def from_pretrained(cls, *inputs, **kwargs):
<ide> # Download vocabulary from S3 and cache.
<ide> tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
<ide>
<add> # Download vocabulary from S3 (user-uploaded) and cache.
<add> tokenizer = BertTokenizer.from_pretrained('dbmz/bert-base-german-cased')
<add>
<ide> # If vocabulary files are in a directory (e.g. tokenizer was saved using `save_pretrained('./test/saved_model/')`)
<ide> tokenizer = BertTokenizer.from_pretrained('./test/saved_model/')
<ide>
<ide> def _from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
<ide> if os.path.isdir(pretrained_model_name_or_path):
<ide> # If a directory is provided we look for the standard filenames
<ide> full_file_name = os.path.join(pretrained_model_name_or_path, file_name)
<add> if not os.path.exists(full_file_name):
<add> logger.info("Didn't find file {}. We won't load it.".format(full_file_name))
<add> full_file_name = None
<ide> elif os.path.isfile(pretrained_model_name_or_path) or is_remote_url(pretrained_model_name_or_path):
<ide> # If a path to a file is provided we use it (will only work for non-BPE tokenizer using a single vocabulary file)
<ide> full_file_name = pretrained_model_name_or_path | 1 |
Javascript | Javascript | fix document title syncing | c4ba7ac46a04a1b6f838aa4f2a196c4da81011bd | <ide><path>client/sagas/title-saga.js
<ide> // () =>
<ide> // (next: (action: Action) => Object) =>
<ide> // titleSage(action: Action) => Object|Void
<del>export default (doc) => () => next => {
<add>export default ({ doc }) => ({ getState }) => next => {
<ide> return function titleSage(action) {
<ide> // get next state
<ide> const result = next(action);
<del> if (action !== 'updateTitle') {
<add> if (action.type !== 'app.updateTitle') {
<ide> return result;
<ide> }
<del> const newTitle = result.app.title;
<add> const state = getState();
<add> const newTitle = state.app.title;
<ide> doc.title = newTitle;
<ide> return result;
<ide> }; | 1 |
Go | Go | remove aliases for deprecated pkg/pubsub | 76ce3fd9c941f5222d515f4ae8c459cecd4aa614 | <ide><path>pkg/pubsub/publisher.go
<del>package pubsub // import "github.com/docker/docker/pkg/pubsub"
<del>
<del>import "github.com/moby/pubsub"
<del>
<del>// NewPublisher creates a new pub/sub publisher to broadcast messages.
<del>// The duration is used as the send timeout as to not block the publisher publishing
<del>// messages to other clients if one client is slow or unresponsive.
<del>// The buffer is used when creating new channels for subscribers.
<del>//
<del>// Deprecated: use github.com/moby/pubsub.NewPublisher
<del>var NewPublisher = pubsub.NewPublisher
<del>
<del>// Publisher is basic pub/sub structure. Allows to send events and subscribe
<del>// to them. Can be safely used from multiple goroutines.
<del>//
<del>// Deprecated: use github.com/moby/pubsub.Publisher
<del>type Publisher = pubsub.Publisher | 1 |
Text | Text | fix the description for the `select_all` [ci skip] | 0efc132a8153dbaf0951ce55457abe43dd5a309b | <ide><path>guides/source/active_record_querying.md
<ide> Client.find_by_sql("SELECT * FROM clients
<ide>
<ide> ### `select_all`
<ide>
<del>`find_by_sql` has a close relative called `connection#select_all`. `select_all` will retrieve objects from the database using custom SQL just like `find_by_sql` but will not instantiate them. Instead, you will get an array of hashes where each hash indicates a record.
<add>`find_by_sql` has a close relative called `connection#select_all`. `select_all` will retrieve objects from the database using custom SQL just like `find_by_sql` but will not instantiate them. This method will return an instance of `ActiveRecord::Result` class and calling `to_hash` on this object would return you an array of hashes where each hash indicates a record.
<ide>
<ide> ```ruby
<del>Client.connection.select_all("SELECT first_name, created_at FROM clients WHERE id = '1'")
<add>Client.connection.select_all("SELECT first_name, created_at FROM clients WHERE id = '1'").to_hash
<ide> # => [
<ide> # {"first_name"=>"Rafael", "created_at"=>"2012-11-10 23:23:45.281189"},
<ide> # {"first_name"=>"Eileen", "created_at"=>"2013-12-09 11:22:35.221282"} | 1 |
Javascript | Javascript | use larger buffer in net-error-twice | 9479399d3b42f5e35715ebbc73b2c120db430bd9 | <ide><path>test/simple/test-net-error-twice.js
<ide> var common = require('../common');
<ide> var assert = require('assert');
<ide> var net = require('net');
<ide>
<del>var buf = new Buffer(2 * 1024 * 1024);
<add>var buf = new Buffer(10 * 1024 * 1024);
<ide>
<ide> buf.fill(0x62);
<ide> | 1 |
Mixed | Ruby | add negative scopes for all enum values | 55a7051a5a2935c0ced79afc5c81ef7db9e0dd73 | <ide><path>activerecord/CHANGELOG.md
<add>* Add negative scopes for all enum values.
<add>
<add> Example:
<add>
<add> class Post < ActiveRecord::Base
<add> enum status: %i[ drafted active trashed ]
<add> end
<add>
<add> Post.not_drafted # => where.not(status: :drafted)
<add> Post.not_active # => where.not(status: :active)
<add> Post.not_trashed # => where.not(status: :trashed)
<add>
<add> *DHH*
<add>
<ide> * Fix different `count` calculation when using `size` with manual `select` with DISTINCT.
<ide>
<ide> Fixes #35214.
<ide><path>activerecord/lib/active_record/enum.rb
<ide> module ActiveRecord
<ide> # as well. With the above example:
<ide> #
<ide> # Conversation.active
<add> # Conversation.not_active
<ide> # Conversation.archived
<add> # Conversation.not_archived
<ide> #
<ide> # Of course, you can also query them directly if the scopes don't fit your
<ide> # needs:
<ide> def enum(definitions)
<ide> define_method("#{value_method_name}!") { update!(attr => value) }
<ide>
<ide> # scope :active, -> { where(status: 0) }
<add> # scope :not_active, -> { where.not(status: 0) }
<ide> if enum_scopes != false
<ide> klass.send(:detect_enum_conflict!, name, value_method_name, true)
<ide> klass.scope value_method_name, -> { where(attr => value) }
<add>
<add> klass.send(:detect_enum_conflict!, name, "not_#{value_method_name}", true)
<add> klass.scope "not_#{value_method_name}", -> { where.not(attr => value) }
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/enum_test.rb
<ide> class EnumTest < ActiveRecord::TestCase
<ide> assert_equal books(:ddd), Book.forgotten.first
<ide> assert_equal books(:rfr), authors(:david).unpublished_books.first
<ide> end
<add>
<add> test "find via negative scope" do
<add> assert Book.not_published.exclude?(@book)
<add> assert Book.not_proposed.include?(@book)
<add> end
<ide>
<ide> test "find via where with values" do
<ide> published, written = Book.statuses[:published], Book.statuses[:written] | 3 |
Javascript | Javascript | fix challenge ordering | ad93e49b7d7f22d6cb3f112565d8a4f70b7cdcb0 | <ide><path>server/services/map.js
<ide> function cachedMap(Block) {
<ide> }, {})
<ide> .map(map => normalize(map, mapSchema))
<ide> .map(map => {
<add> // make sure challenges are in the right order
<add> map.entities.block = Object.keys(map.entities.block)
<add> // turn map into array
<add> .map(key => map.entities.block[key])
<add> // perform re-order
<add> .map(block => {
<add> block.challenges = block.challenges.reduce((accu, dashedName) => {
<add> const index = map.entities.challenge[dashedName].suborder;
<add> accu[index - 1] = dashedName;
<add> return accu;
<add> }, []);
<add> return block;
<add> })
<add> // turn back into map
<add> .reduce((blockMap, block) => {
<add> blockMap[block.dashedName] = block;
<add> return blockMap;
<add> }, {});
<add> return map;
<add> })
<add> .map(map => {
<add> // re-order superBlocks result
<ide> const result = Object.keys(map.result).reduce((result, supName) => {
<ide> const index = map.entities.superBlock[supName].order;
<ide> result[index] = supName; | 1 |
Go | Go | add check for memoryswap when create | 72f356be6a662ed92e04ba9c58acac63c5a15264 | <ide><path>daemon/create.go
<ide> func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status {
<ide> if config.Memory > 0 && config.MemorySwap > 0 && config.MemorySwap < config.Memory {
<ide> return job.Errorf("Minimum memoryswap limit should be larger than memory limit, see usage.\n")
<ide> }
<add> if config.Memory == 0 && config.MemorySwap > 0 {
<add> return job.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage.\n")
<add> }
<ide>
<ide> var hostConfig *runconfig.HostConfig
<ide> if job.EnvExists("HostConfig") { | 1 |
Javascript | Javascript | consolidate buffer.read() in a file | 8a25e31fbe8e18ae66ca919be8e208309552dac9 | <ide><path>test/parallel/test-buffer-alloc.js
<ide> assert.throws(() => Buffer.alloc(8).writeFloatLE(0, 5), RangeError);
<ide> assert.throws(() => Buffer.alloc(16).writeDoubleLE(0, 9), RangeError);
<ide>
<ide> // attempt to overflow buffers, similar to previous bug in array buffers
<del>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff),
<del> RangeError);
<ide> assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, 0xffffffff),
<ide> RangeError);
<del>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff),
<del> RangeError);
<ide> assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, 0xffffffff),
<ide> RangeError);
<ide>
<ide>
<ide> // ensure negative values can't get past offset
<del>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError);
<ide> assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), RangeError);
<del>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError);
<ide> assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), RangeError);
<ide>
<del>// offset checks
<del>{
<del> const buf = Buffer.allocUnsafe(0);
<del>
<del> assert.throws(() => buf.readUInt8(0), RangeError);
<del> assert.throws(() => buf.readInt8(0), RangeError);
<del>}
<del>
<del>{
<del> const buf = Buffer.from([0xFF]);
<del>
<del> assert.strictEqual(buf.readUInt8(0), 255);
<del> assert.strictEqual(buf.readInt8(0), -1);
<del>}
<del>
<del>[16, 32].forEach((bits) => {
<del> const buf = Buffer.allocUnsafe(bits / 8 - 1);
<del>
<del> assert.throws(() => buf[`readUInt${bits}BE`](0),
<del> RangeError,
<del> `readUInt${bits}BE()`);
<del>
<del> assert.throws(() => buf[`readUInt${bits}LE`](0),
<del> RangeError,
<del> `readUInt${bits}LE()`);
<del>
<del> assert.throws(() => buf[`readInt${bits}BE`](0),
<del> RangeError,
<del> `readInt${bits}BE()`);
<del>
<del> assert.throws(() => buf[`readInt${bits}LE`](0),
<del> RangeError,
<del> `readInt${bits}LE()`);
<del>});
<del>
<del>[16, 32].forEach((bits) => {
<del> const buf = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF]);
<del>
<del> assert.strictEqual(buf[`readUInt${bits}BE`](0),
<del> (0xFFFFFFFF >>> (32 - bits)));
<del>
<del> assert.strictEqual(buf[`readUInt${bits}LE`](0),
<del> (0xFFFFFFFF >>> (32 - bits)));
<del>
<del> assert.strictEqual(buf[`readInt${bits}BE`](0),
<del> (0xFFFFFFFF >> (32 - bits)));
<del>
<del> assert.strictEqual(buf[`readInt${bits}LE`](0),
<del> (0xFFFFFFFF >> (32 - bits)));
<del>});
<del>
<del>// test for common read(U)IntLE/BE
<del>{
<del> const buf = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06]);
<del>
<del> assert.strictEqual(buf.readUIntLE(0, 1), 0x01);
<del> assert.strictEqual(buf.readUIntBE(0, 1), 0x01);
<del> assert.strictEqual(buf.readUIntLE(0, 3), 0x030201);
<del> assert.strictEqual(buf.readUIntBE(0, 3), 0x010203);
<del> assert.strictEqual(buf.readUIntLE(0, 5), 0x0504030201);
<del> assert.strictEqual(buf.readUIntBE(0, 5), 0x0102030405);
<del> assert.strictEqual(buf.readUIntLE(0, 6), 0x060504030201);
<del> assert.strictEqual(buf.readUIntBE(0, 6), 0x010203040506);
<del> assert.strictEqual(buf.readIntLE(0, 1), 0x01);
<del> assert.strictEqual(buf.readIntBE(0, 1), 0x01);
<del> assert.strictEqual(buf.readIntLE(0, 3), 0x030201);
<del> assert.strictEqual(buf.readIntBE(0, 3), 0x010203);
<del> assert.strictEqual(buf.readIntLE(0, 5), 0x0504030201);
<del> assert.strictEqual(buf.readIntBE(0, 5), 0x0102030405);
<del> assert.strictEqual(buf.readIntLE(0, 6), 0x060504030201);
<del> assert.strictEqual(buf.readIntBE(0, 6), 0x010203040506);
<del>}
<ide>
<ide> // test for common write(U)IntLE/BE
<ide> {
<ide><path>test/parallel/test-buffer-read-noassert.js
<del>'use strict';
<del>require('../common');
<del>const assert = require('assert');
<del>
<del>// testing basic buffer read functions
<del>const buf = Buffer.from([0xa4, 0xfd, 0x48, 0xea, 0xcf, 0xff, 0xd9, 0x01, 0xde]);
<del>
<del>function read(buff, funx, args, expected) {
<del>
<del> assert.strictEqual(buff[funx](...args), expected);
<del> assert.throws(
<del> () => buff[funx](-1),
<del> /^RangeError: Index out of range$/
<del> );
<del>
<del> assert.doesNotThrow(
<del> () => assert.strictEqual(buff[funx](...args, true), expected),
<del> 'noAssert does not change return value for valid ranges'
<del>);
<del>
<del>}
<del>
<del>// testing basic functionality of readDoubleBE() and readDOubleLE()
<del>read(buf, 'readDoubleBE', [1], -3.1827727774563287e+295);
<del>read(buf, 'readDoubleLE', [1], -6.966010051009108e+144);
<del>
<del>// testing basic functionality of readFLoatBE() and readFloatLE()
<del>read(buf, 'readFloatBE', [1], -1.6691549692541768e+37);
<del>read(buf, 'readFloatLE', [1], -7861303808);
<del>
<del>// testing basic functionality of readInt8()
<del>read(buf, 'readInt8', [1], -3);
<del>
<del>// testing basic functionality of readInt16BE() and readInt16LE()
<del>read(buf, 'readInt16BE', [1], -696);
<del>read(buf, 'readInt16LE', [1], 0x48fd);
<del>
<del>// testing basic functionality of readInt32BE() and readInt32LE()
<del>read(buf, 'readInt32BE', [1], -45552945);
<del>read(buf, 'readInt32LE', [1], -806729475);
<del>
<del>// testing basic functionality of readIntBE() and readIntLE()
<del>read(buf, 'readIntBE', [1, 1], -3);
<del>read(buf, 'readIntLE', [2, 1], 0x48);
<del>
<del>// testing basic functionality of readUInt8()
<del>read(buf, 'readUInt8', [1], 0xfd);
<del>
<del>// testing basic functionality of readUInt16BE() and readUInt16LE()
<del>read(buf, 'readUInt16BE', [2], 0x48ea);
<del>read(buf, 'readUInt16LE', [2], 0xea48);
<del>
<del>// testing basic functionality of readUInt32BE() and readUInt32LE()
<del>read(buf, 'readUInt32BE', [1], 0xfd48eacf);
<del>read(buf, 'readUInt32LE', [1], 0xcfea48fd);
<del>
<del>// testing basic functionality of readUIntBE() and readUIntLE()
<del>read(buf, 'readUIntBE', [2, 0], 0xfd);
<del>read(buf, 'readUIntLE', [2, 0], 0x48);
<ide><path>test/parallel/test-buffer-read.js
<add>'use strict';
<add>require('../common');
<add>const assert = require('assert');
<add>
<add>// testing basic buffer read functions
<add>const buf = Buffer.from([0xa4, 0xfd, 0x48, 0xea, 0xcf, 0xff, 0xd9, 0x01, 0xde]);
<add>
<add>function read(buff, funx, args, expected) {
<add>
<add> assert.strictEqual(buff[funx](...args), expected);
<add> assert.throws(
<add> () => buff[funx](-1),
<add> /^RangeError: Index out of range$/
<add> );
<add>
<add> assert.doesNotThrow(
<add> () => assert.strictEqual(buff[funx](...args, true), expected),
<add> 'noAssert does not change return value for valid ranges'
<add>);
<add>
<add>}
<add>
<add>// testing basic functionality of readDoubleBE() and readDOubleLE()
<add>read(buf, 'readDoubleBE', [1], -3.1827727774563287e+295);
<add>read(buf, 'readDoubleLE', [1], -6.966010051009108e+144);
<add>
<add>// testing basic functionality of readFLoatBE() and readFloatLE()
<add>read(buf, 'readFloatBE', [1], -1.6691549692541768e+37);
<add>read(buf, 'readFloatLE', [1], -7861303808);
<add>
<add>// testing basic functionality of readInt8()
<add>read(buf, 'readInt8', [1], -3);
<add>
<add>// testing basic functionality of readInt16BE() and readInt16LE()
<add>read(buf, 'readInt16BE', [1], -696);
<add>read(buf, 'readInt16LE', [1], 0x48fd);
<add>
<add>// testing basic functionality of readInt32BE() and readInt32LE()
<add>read(buf, 'readInt32BE', [1], -45552945);
<add>read(buf, 'readInt32LE', [1], -806729475);
<add>
<add>// testing basic functionality of readIntBE() and readIntLE()
<add>read(buf, 'readIntBE', [1, 1], -3);
<add>read(buf, 'readIntLE', [2, 1], 0x48);
<add>
<add>// testing basic functionality of readUInt8()
<add>read(buf, 'readUInt8', [1], 0xfd);
<add>
<add>// testing basic functionality of readUInt16BE() and readUInt16LE()
<add>read(buf, 'readUInt16BE', [2], 0x48ea);
<add>read(buf, 'readUInt16LE', [2], 0xea48);
<add>
<add>// testing basic functionality of readUInt32BE() and readUInt32LE()
<add>read(buf, 'readUInt32BE', [1], 0xfd48eacf);
<add>read(buf, 'readUInt32LE', [1], 0xcfea48fd);
<add>
<add>// testing basic functionality of readUIntBE() and readUIntLE()
<add>read(buf, 'readUIntBE', [2, 0], 0xfd);
<add>read(buf, 'readUIntLE', [2, 0], 0x48);
<add>
<add>// attempt to overflow buffers, similar to previous bug in array buffers
<add>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff),
<add> RangeError);
<add>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff),
<add> RangeError);
<add>
<add>// ensure negative values can't get past offset
<add>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError);
<add>assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError);
<add>
<add>// offset checks
<add>{
<add> const buf = Buffer.allocUnsafe(0);
<add>
<add> assert.throws(() => buf.readUInt8(0), RangeError);
<add> assert.throws(() => buf.readInt8(0), RangeError);
<add>}
<add>
<add>{
<add> const buf = Buffer.from([0xFF]);
<add>
<add> assert.strictEqual(buf.readUInt8(0), 255);
<add> assert.strictEqual(buf.readInt8(0), -1);
<add>}
<add>
<add>[16, 32].forEach((bits) => {
<add> const buf = Buffer.allocUnsafe(bits / 8 - 1);
<add>
<add> assert.throws(() => buf[`readUInt${bits}BE`](0),
<add> RangeError,
<add> `readUInt${bits}BE()`);
<add>
<add> assert.throws(() => buf[`readUInt${bits}LE`](0),
<add> RangeError,
<add> `readUInt${bits}LE()`);
<add>
<add> assert.throws(() => buf[`readInt${bits}BE`](0),
<add> RangeError,
<add> `readInt${bits}BE()`);
<add>
<add> assert.throws(() => buf[`readInt${bits}LE`](0),
<add> RangeError,
<add> `readInt${bits}LE()`);
<add>});
<add>
<add>[16, 32].forEach((bits) => {
<add> const buf = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF]);
<add>
<add> assert.strictEqual(buf[`readUInt${bits}BE`](0),
<add> (0xFFFFFFFF >>> (32 - bits)));
<add>
<add> assert.strictEqual(buf[`readUInt${bits}LE`](0),
<add> (0xFFFFFFFF >>> (32 - bits)));
<add>
<add> assert.strictEqual(buf[`readInt${bits}BE`](0),
<add> (0xFFFFFFFF >> (32 - bits)));
<add>
<add> assert.strictEqual(buf[`readInt${bits}LE`](0),
<add> (0xFFFFFFFF >> (32 - bits)));
<add>});
<add>
<add>// test for common read(U)IntLE/BE
<add>{
<add> const buf = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06]);
<add>
<add> assert.strictEqual(buf.readUIntLE(0, 1), 0x01);
<add> assert.strictEqual(buf.readUIntBE(0, 1), 0x01);
<add> assert.strictEqual(buf.readUIntLE(0, 3), 0x030201);
<add> assert.strictEqual(buf.readUIntBE(0, 3), 0x010203);
<add> assert.strictEqual(buf.readUIntLE(0, 5), 0x0504030201);
<add> assert.strictEqual(buf.readUIntBE(0, 5), 0x0102030405);
<add> assert.strictEqual(buf.readUIntLE(0, 6), 0x060504030201);
<add> assert.strictEqual(buf.readUIntBE(0, 6), 0x010203040506);
<add> assert.strictEqual(buf.readIntLE(0, 1), 0x01);
<add> assert.strictEqual(buf.readIntBE(0, 1), 0x01);
<add> assert.strictEqual(buf.readIntLE(0, 3), 0x030201);
<add> assert.strictEqual(buf.readIntBE(0, 3), 0x010203);
<add> assert.strictEqual(buf.readIntLE(0, 5), 0x0504030201);
<add> assert.strictEqual(buf.readIntBE(0, 5), 0x0102030405);
<add> assert.strictEqual(buf.readIntLE(0, 6), 0x060504030201);
<add> assert.strictEqual(buf.readIntBE(0, 6), 0x010203040506);
<add>} | 3 |
Python | Python | fix loading lstm weights without bias | dea301923dfce820701818214965f0acb82907a3 | <ide><path>keras/engine/topology.py
<ide> def preprocess_weights_for_loading(layer, weights,
<ide> weights[1] = np.transpose(weights[1], (3, 2, 0, 1))
<ide>
<ide> # convert the weights of CuDNNLSTM so that they could be loaded into LSTM
<del> if layer.__class__.__name__ == 'LSTM':
<add> if layer.__class__.__name__ == 'LSTM' and len(weights) == 3:
<ide> # determine if we're loading a CuDNNLSTM layer from the number of bias weights:
<ide> # CuDNNLSTM has (units * 8) weights; while LSTM has (units * 4)
<add> # if there's no bias weight in the file, skip this conversion
<ide> units = weights[1].shape[0]
<ide> bias = weights[2]
<ide> if len(bias) == units * 8:
<ide><path>tests/test_model_saving.py
<ide> def test_saving_recurrent_layer_with_init_state():
<ide> loaded_model = load_model(fname)
<ide> os.remove(fname)
<ide>
<add>
<add>@keras_test
<add>def test_saving_recurrent_layer_without_bias():
<add> vector_size = 8
<add> input_length = 20
<add>
<add> input_x = Input(shape=(input_length, vector_size))
<add> lstm = LSTM(vector_size, use_bias=False)(input_x)
<add> model = Model(inputs=[input_x], outputs=[lstm])
<add>
<add> _, fname = tempfile.mkstemp('.h5')
<add> model.save(fname)
<add>
<add> loaded_model = load_model(fname)
<add> os.remove(fname)
<add>
<add>
<ide> if __name__ == '__main__':
<ide> pytest.main([__file__]) | 2 |
Text | Text | add russian translation of some parts | 86e5463f0b861e51bdd610ed0b26c346e3ec1f31 | <ide><path>curriculum/challenges/russian/03-front-end-libraries/react/create-a-stateless-functional-component.russian.md
<ide> localeTitle: Создание функционального компонент
<ide> ---
<ide>
<ide> ## Description
<del>undefined
<add>Компоненты - это ядро React. Всё в React является компонентом, и здесь вы научитесь, как их создавать.
<add>
<add>Существуют два способа создания React компонентов. Первый способ - это использовать JavaScript функцию. Определяя компонент таким образом, вы создаете *функциональный компонент без учета состояния*. Концепт состояния в приложении будет рассмотрен в дальнейших главах. Сейчас думайте о компоненте без учета состояния, как о компоненте, которая может получать данные и рендерить их, но не управляет или следить за изменениями в данных.
<ide>
<ide> ## Instructions
<ide> undefined
<ide> undefined
<ide>
<ide> ```yml
<ide> tests:
<del> - text: ''
<add> - text: '<code>MyComponent</code> должен возвращать JSX.'
<ide> testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.length === 1; })(), "<code>MyComponent</code> should return JSX.");'
<del> - text: ''
<add> - text: '<code>MyComponent</code> должен вернуть элемент <code>div</code>.'
<ide> testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.children().type() === "div" })(), "<code>MyComponent</code> should return a <code>div</code> element.");'
<del> - text: ''
<add> - text: 'Элемент <code>div</code> должен содержать строку текста.'
<ide> testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.find("div").text() !== ""; })(), "The <code>div</code> element should contain a string of text.");'
<ide>
<ide> ``` | 1 |
Javascript | Javascript | clarify documentation for $broadcast | bffe6fa8a60d2b42685c56442a02e0881f00d810 | <ide><path>src/ng/rootScope.js
<ide> function $RootScopeProvider(){
<ide> * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
<ide> * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
<ide> *
<del> * @param {string} name Event name to emit.
<add> * @param {string} name Event name to broadcast.
<ide> * @param {...*} args Optional set of arguments which will be passed onto the event listeners.
<ide> * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
<ide> */ | 1 |
Ruby | Ruby | remove autoload to unused constant | fff5567803a575b54db5200edf648eea0b020e08 | <ide><path>activejob/lib/active_job.rb
<ide> module ActiveJob
<ide>
<ide> autoload :TestCase
<ide> autoload :TestHelper
<del> autoload :QueryTags
<ide> end | 1 |
Java | Java | add allowedoriginpatterns to sockjs config | ae75db265704103eab8bad8ca388d2d1cd9ed846 | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/SockJsServiceRegistration.java
<ide> public class SockJsServiceRegistration {
<ide>
<ide> private final List<String> allowedOrigins = new ArrayList<>();
<ide>
<add> private final List<String> allowedOriginPatterns = new ArrayList<>();
<add>
<ide> @Nullable
<ide> private Boolean suppressCors;
<ide>
<ide> protected SockJsServiceRegistration setAllowedOrigins(String... allowedOrigins)
<ide> return this;
<ide> }
<ide>
<add> /**
<add> * Configure allowed {@code Origin} pattern header values.
<add> * @since 5.3.2
<add> */
<add> protected SockJsServiceRegistration setAllowedOriginPatterns(String... allowedOriginPatterns) {
<add> this.allowedOriginPatterns.clear();
<add> if (!ObjectUtils.isEmpty(allowedOriginPatterns)) {
<add> this.allowedOriginPatterns.addAll(Arrays.asList(allowedOriginPatterns));
<add> }
<add> return this;
<add> }
<add>
<ide> /**
<ide> * This option can be used to disable automatic addition of CORS headers for
<ide> * SockJS requests.
<ide> protected SockJsService getSockJsService() {
<ide> service.setSuppressCors(this.suppressCors);
<ide> }
<ide> service.setAllowedOrigins(this.allowedOrigins);
<add> service.setAllowedOriginPatterns(this.allowedOriginPatterns);
<ide>
<ide> if (this.messageCodec != null) {
<ide> service.setMessageCodec(this.messageCodec);
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/StompWebSocketEndpointRegistration.java
<ide> public interface StompWebSocketEndpointRegistration {
<ide> */
<ide> StompWebSocketEndpointRegistration setAllowedOrigins(String... origins);
<ide>
<add> /**
<add> * Configure allowed {@code Origin} header values.
<add> *
<add> * @see org.springframework.web.cors.CorsConfiguration#setAllowedOriginPatterns(java.util.List)
<add> */
<add> StompWebSocketEndpointRegistration setAllowedOriginPatterns(String... originPatterns);
<add>
<ide> }
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompWebSocketEndpointRegistration.java
<ide> public class WebMvcStompWebSocketEndpointRegistration implements StompWebSocketE
<ide>
<ide> private final List<String> allowedOrigins = new ArrayList<>();
<ide>
<add> private final List<String> allowedOriginPatterns = new ArrayList<>();
<add>
<ide> @Nullable
<ide> private SockJsServiceRegistration registration;
<ide>
<ide> public StompWebSocketEndpointRegistration setAllowedOrigins(String... allowedOri
<ide> return this;
<ide> }
<ide>
<add> @Override
<add> public StompWebSocketEndpointRegistration setAllowedOriginPatterns(String... allowedOriginPatterns) {
<add> this.allowedOriginPatterns.clear();
<add> if (!ObjectUtils.isEmpty(allowedOriginPatterns)) {
<add> this.allowedOriginPatterns.addAll(Arrays.asList(allowedOriginPatterns));
<add> }
<add> return this;
<add> }
<add>
<ide> @Override
<ide> public SockJsServiceRegistration withSockJS() {
<ide> this.registration = new SockJsServiceRegistration();
<ide> public SockJsServiceRegistration withSockJS() {
<ide> if (!this.allowedOrigins.isEmpty()) {
<ide> this.registration.setAllowedOrigins(StringUtils.toStringArray(this.allowedOrigins));
<ide> }
<add> if (!this.allowedOriginPatterns.isEmpty()) {
<add> this.registration.setAllowedOriginPatterns(StringUtils.toStringArray(this.allowedOriginPatterns));
<add> }
<ide> return this.registration;
<ide> }
<ide>
<ide> protected HandshakeInterceptor[] getInterceptors() {
<ide> List<HandshakeInterceptor> interceptors = new ArrayList<>(this.interceptors.size() + 1);
<ide> interceptors.addAll(this.interceptors);
<del> interceptors.add(new OriginHandshakeInterceptor(this.allowedOrigins));
<add> OriginHandshakeInterceptor originHandshakeInterceptor = new OriginHandshakeInterceptor(this.allowedOrigins);
<add> interceptors.add(originHandshakeInterceptor);
<add>
<add> if (!ObjectUtils.isEmpty(this.allowedOriginPatterns)) {
<add> originHandshakeInterceptor.setAllowedOriginPatterns(this.allowedOriginPatterns);
<add> }
<add>
<ide> return interceptors.toArray(new HandshakeInterceptor[0]);
<ide> }
<ide>
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptor.java
<ide>
<ide> package org.springframework.web.socket.server.support;
<ide>
<add>import java.util.ArrayList;
<ide> import java.util.Collection;
<ide> import java.util.Collections;
<del>import java.util.LinkedHashSet;
<add>import java.util.HashSet;
<add>import java.util.List;
<ide> import java.util.Map;
<del>import java.util.Set;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<ide> import org.springframework.http.server.ServerHttpResponse;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.Assert;
<add>import org.springframework.web.cors.CorsConfiguration;
<ide> import org.springframework.web.socket.WebSocketHandler;
<ide> import org.springframework.web.socket.server.HandshakeInterceptor;
<ide> import org.springframework.web.util.WebUtils;
<ide> public class OriginHandshakeInterceptor implements HandshakeInterceptor {
<ide>
<ide> protected final Log logger = LogFactory.getLog(getClass());
<ide>
<del> private final Set<String> allowedOrigins = new LinkedHashSet<>();
<add> private final CorsConfiguration corsConfiguration = new CorsConfiguration();
<ide>
<ide>
<ide> /**
<ide> public OriginHandshakeInterceptor(Collection<String> allowedOrigins) {
<ide> */
<ide> public void setAllowedOrigins(Collection<String> allowedOrigins) {
<ide> Assert.notNull(allowedOrigins, "Allowed origins Collection must not be null");
<del> this.allowedOrigins.clear();
<del> this.allowedOrigins.addAll(allowedOrigins);
<add> this.corsConfiguration.setAllowedOrigins(new ArrayList<>(allowedOrigins));
<ide> }
<ide>
<ide> /**
<ide> public void setAllowedOrigins(Collection<String> allowedOrigins) {
<ide> * @see #setAllowedOrigins
<ide> */
<ide> public Collection<String> getAllowedOrigins() {
<del> return Collections.unmodifiableSet(this.allowedOrigins);
<add> if (this.corsConfiguration.getAllowedOrigins() == null) {
<add> return Collections.emptyList();
<add> }
<add> return Collections.unmodifiableSet(new HashSet<>(this.corsConfiguration.getAllowedOrigins()));
<add> }
<add>
<add> /**
<add> * Configure allowed {@code Origin} pattern header values.
<add> *
<add> * @see CorsConfiguration#setAllowedOriginPatterns(List)
<add> */
<add> public void setAllowedOriginPatterns(Collection<String> allowedOriginPatterns) {
<add> Assert.notNull(allowedOriginPatterns, "Allowed origin patterns Collection must not be null");
<add> this.corsConfiguration.setAllowedOriginPatterns(new ArrayList<>(allowedOriginPatterns));
<add> }
<add>
<add> /**
<add> * Return the allowed {@code Origin} pattern header values.
<add> *
<add> * @since 5.3.2
<add> * @see CorsConfiguration#getAllowedOriginPatterns()
<add> */
<add> public Collection<String> getAllowedOriginPatterns() {
<add> if (this.corsConfiguration.getAllowedOriginPatterns() == null) {
<add> return Collections.emptyList();
<add> }
<add> return Collections.unmodifiableSet(new HashSet<>(this.corsConfiguration.getAllowedOriginPatterns()));
<ide> }
<ide>
<ide>
<ide> @Override
<ide> public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response,
<ide> WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception {
<ide>
<del> if (!WebUtils.isSameOrigin(request) && !WebUtils.isValidOrigin(request, this.allowedOrigins)) {
<add> if (!WebUtils.isSameOrigin(request) && this.corsConfiguration.checkOrigin(request.getHeaders().getOrigin()) == null) {
<ide> response.setStatusCode(HttpStatus.FORBIDDEN);
<ide> if (logger.isDebugEnabled()) {
<ide> logger.debug("Handshake request rejected, Origin header value " +
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java
<ide> public abstract class AbstractSockJsService implements SockJsService, CorsConfig
<ide>
<ide> protected final Set<String> allowedOrigins = new LinkedHashSet<>();
<ide>
<add> protected final Set<String> allowedOriginPatterns = new LinkedHashSet<>();
<add>
<ide> private final SockJsRequestHandler infoHandler = new InfoHandler();
<ide>
<ide> private final SockJsRequestHandler iframeHandler = new IframeHandler();
<ide> public void setAllowedOrigins(Collection<String> allowedOrigins) {
<ide> this.allowedOrigins.addAll(allowedOrigins);
<ide> }
<ide>
<add> /**
<add> * Configure allowed {@code Origin} header values.
<add> *
<add> * @see org.springframework.web.cors.CorsConfiguration#setAllowedOriginPatterns(java.util.List)
<add> */
<add> public void setAllowedOriginPatterns(Collection<String> allowedOriginPatterns) {
<add> Assert.notNull(allowedOriginPatterns, "Allowed origin patterns Collection must not be null");
<add> this.allowedOriginPatterns.clear();
<add> this.allowedOriginPatterns.addAll(allowedOriginPatterns);
<add> }
<add>
<ide> /**
<ide> * Return configure allowed {@code Origin} header values.
<ide> * @since 4.1.2
<ide> public Collection<String> getAllowedOrigins() {
<ide> return Collections.unmodifiableSet(this.allowedOrigins);
<ide> }
<ide>
<add> /**
<add> * Return configure allowed {@code Origin} pattern header values.
<add> * @since 5.3.2
<add> * @see #setAllowedOriginPatterns
<add> */
<add> public Collection<String> getAllowedOriginPatterns() {
<add> return Collections.unmodifiableSet(this.allowedOriginPatterns);
<add> }
<add>
<ide>
<ide> /**
<ide> * This method determines the SockJS path and handles SockJS static URLs.
<ide> public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
<ide> if (!this.suppressCors && (request.getHeader(HttpHeaders.ORIGIN) != null)) {
<ide> CorsConfiguration config = new CorsConfiguration();
<ide> config.setAllowedOrigins(new ArrayList<>(this.allowedOrigins));
<add> config.setAllowedOriginPatterns(new ArrayList<>(this.allowedOriginPatterns));
<ide> config.addAllowedMethod("*");
<ide> config.setAllowCredentials(true);
<ide> config.setMaxAge(ONE_YEAR);
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebMvcStompWebSocketEndpointRegistrationTests.java
<ide> public void allowedOriginsWithSockJsService() {
<ide> assertThat(sockJsService.shouldSuppressCors()).isFalse();
<ide> }
<ide>
<add> @Test
<add> public void allowedOriginPatterns() {
<add> WebMvcStompWebSocketEndpointRegistration registration =
<add> new WebMvcStompWebSocketEndpointRegistration(new String[] {"/foo"}, this.handler, this.scheduler);
<add>
<add> String origin = "https://*.mydomain.com";
<add> registration.setAllowedOriginPatterns(origin).withSockJS();
<add>
<add> MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
<add> assertThat(mappings.size()).isEqualTo(1);
<add> SockJsHttpRequestHandler requestHandler = (SockJsHttpRequestHandler)mappings.entrySet().iterator().next().getKey();
<add> assertThat(requestHandler.getSockJsService()).isNotNull();
<add> DefaultSockJsService sockJsService = (DefaultSockJsService)requestHandler.getSockJsService();
<add> assertThat(sockJsService.getAllowedOriginPatterns().contains(origin)).isTrue();
<add>
<add> registration =
<add> new WebMvcStompWebSocketEndpointRegistration(new String[] {"/foo"}, this.handler, this.scheduler);
<add> registration.withSockJS().setAllowedOriginPatterns(origin);
<add> mappings = registration.getMappings();
<add> assertThat(mappings.size()).isEqualTo(1);
<add> requestHandler = (SockJsHttpRequestHandler)mappings.entrySet().iterator().next().getKey();
<add> assertThat(requestHandler.getSockJsService()).isNotNull();
<add> sockJsService = (DefaultSockJsService)requestHandler.getSockJsService();
<add> assertThat(sockJsService.getAllowedOriginPatterns().contains(origin)).isTrue();
<add> }
<add>
<ide> @Test // SPR-12283
<ide> public void disableCorsWithSockJsService() {
<ide> WebMvcStompWebSocketEndpointRegistration registration = | 6 |
Python | Python | update documentation docstring embedding | 39357b3045fd73a066b93ccfff2d16763e211b40 | <ide><path>keras/layers/embeddings.py
<ide> class Embedding(Layer):
<ide> model = Sequential()
<ide> model.add(Embedding(1000, 64, input_length=10))
<ide> # the model will take as input an integer matrix of size (batch, input_length).
<del> # the largest integer (i.e. word index) in the input should be no larger than 1000 (vocabulary size).
<add> # the largest integer (i.e. word index) in the input should be no larger than 999 (vocabulary size).
<ide> # now model.output_shape == (None, 10, 64), where None is the batch dimension.
<ide>
<ide> input_array = np.random.randint(1000, size=(32, 10))
<ide> class Embedding(Layer):
<ide> ```
<ide>
<ide> # Arguments
<del> input_dim: int >= 0. Size of the vocabulary, ie.
<add> input_dim: int > 0. Size of the vocabulary, ie.
<ide> 1 + maximum integer index occurring in the input data.
<ide> output_dim: int >= 0. Dimension of the dense embedding.
<ide> init: name of initialization function for the weights
<ide> class Embedding(Layer):
<ide> This is useful for [recurrent layers](recurrent.md) which may take
<ide> variable length input. If this is `True` then all subsequent layers
<ide> in the model need to support masking or an exception will be raised.
<add> If mask_zero is set to True, as a consequence, index 0 cannot be
<add> used in the vocabulary (input_dim should equal |vocabulary| + 2).
<ide> input_length: Length of input sequences, when it is constant.
<ide> This argument is required if you are going to connect
<ide> `Flatten` then `Dense` layers upstream | 1 |
Ruby | Ruby | support postgresql 10 `pg_sequence` | 47cb924d9122fc00deeb9aa4db7a92685ae9e7ef | <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
<ide> def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
<ide>
<ide> if pk && sequence
<ide> quoted_sequence = quote_table_name(sequence)
<add> max_pk = select_value("select MAX(#{quote_column_name pk}) from #{quote_table_name(table)}")
<add> if max_pk.nil?
<add> if postgresql_version >= 100000
<add> minvalue = select_value("SELECT seqmin from pg_sequence where seqrelid = '#{quoted_sequence}'::regclass")
<add> else
<add> minvalue = select_value("SELECT min_value FROM #{quoted_sequence}")
<add> end
<add> end
<ide>
<ide> select_value(<<-end_sql, "SCHEMA")
<del> SELECT setval('#{quoted_sequence}', (SELECT COALESCE(MAX(#{quote_column_name pk})+(SELECT increment_by FROM #{quoted_sequence}), (SELECT min_value FROM #{quoted_sequence})) FROM #{quote_table_name(table)}), false)
<add> SELECT setval('#{quoted_sequence}', #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false})
<ide> end_sql
<ide> end
<ide> end | 1 |
Python | Python | avoid excessive data copy in resultset.join_native | b7f77a45e48e4d4ad3d5446a813279751169391c | <ide><path>celery/result.py
<ide> def join_native(self, timeout=None, propagate=True,
<ide> result backends.
<ide>
<ide> """
<del> results_index = dict(
<add> results_index = None if callback else dict(
<ide> (task_id, i) for i, task_id in enumerate(self.results)
<ide> )
<ide> acc = None if callback else [None for _ in range(len(self))] | 1 |
Python | Python | add sin function to maths | 80f1da235b0a467dc9b31aa8a56dd3a792a59d7c | <ide><path>maths/sin.py
<add>"""
<add>Calculate sin function.
<add>
<add>It's not a perfect function so I am rounding the result to 10 decimal places by default.
<add>
<add>Formula: sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...
<add>Where: x = angle in randians.
<add>
<add>Source:
<add> https://www.homeschoolmath.net/teaching/sine_calculator.php
<add>
<add>"""
<add>
<add>from math import factorial, radians
<add>
<add>
<add>def sin(
<add> angle_in_degrees: float, accuracy: int = 18, rounded_values_count: int = 10
<add>) -> float:
<add> """
<add> Implement sin function.
<add>
<add> >>> sin(0.0)
<add> 0.0
<add> >>> sin(90.0)
<add> 1.0
<add> >>> sin(180.0)
<add> 0.0
<add> >>> sin(270.0)
<add> -1.0
<add> >>> sin(0.68)
<add> 0.0118679603
<add> >>> sin(1.97)
<add> 0.0343762121
<add> >>> sin(64.0)
<add> 0.8987940463
<add> >>> sin(9999.0)
<add> -0.9876883406
<add> >>> sin(-689.0)
<add> 0.5150380749
<add> >>> sin(89.7)
<add> 0.9999862922
<add> """
<add> # Simplify the angle to be between 360 and -360 degrees.
<add> angle_in_degrees = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0)
<add>
<add> # Converting from degrees to radians
<add> angle_in_radians = radians(angle_in_degrees)
<add>
<add> result = angle_in_radians
<add> a = 3
<add> b = -1
<add>
<add> for _ in range(accuracy):
<add> result += (b * (angle_in_radians**a)) / factorial(a)
<add>
<add> b = -b # One positive term and the next will be negative and so on...
<add> a += 2 # Increased by 2 for every term.
<add>
<add> return round(result, rounded_values_count)
<add>
<add>
<add>if __name__ == "__main__":
<add> __import__("doctest").testmod() | 1 |
Text | Text | update shallow routing docs | 2b1f959b7d5ad980f8903cbb648d3d2f134b0195 | <ide><path>docs/routing/shallow-routing.md
<ide> description: You can use shallow routing to change the URL without triggering a
<ide> </ul>
<ide> </details>
<ide>
<del>Shallow routing allows you to change the URL without running [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md).
<add>Shallow routing allows you to change the URL without running data fetching methods again, that includes [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering), [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation), and [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md).
<ide>
<ide> You'll receive the updated `pathname` and the `query` via the [`router` object](/docs/api-reference/next/router.md#router-object) (added by [`useRouter`](/docs/api-reference/next/router.md#useRouter) or [`withRouter`](/docs/api-reference/next/router.md#withRouter)), without losing state.
<ide>
<ide> Shallow routing **only** works for same page URL changes. For example, let's ass
<ide> Router.push('/?counter=10', '/about?counter=10', { shallow: true })
<ide> ```
<ide>
<del>Since that's a new page, it'll unload the current page, load the new one and call `getInitialProps` even though we asked to do shallow routing.
<add>Since that's a new page, it'll unload the current page, load the new one and wait for data fetching even though we asked to do shallow routing. | 1 |
Ruby | Ruby | create method for accessing xcode version | f8127143cfdf44345853ef9292c9e08035324fff | <ide><path>Library/Homebrew/cmd/--config.rb
<ide> def gcc_40
<ide> end
<ide>
<ide> def xcode_version
<del> `xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/
<del> $1
<add> @xcode_version || MacOS.xcode_version
<ide> end
<ide>
<ide> def llvm_recommendation
<ide><path>Library/Homebrew/utils.rb
<ide> def xcode_prefix
<ide> end
<ide> end
<ide>
<add> def xcode_version
<add> `xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/
<add> $1
<add> end
<add>
<ide> def llvm_build_version
<ide> unless xcode_prefix.to_s.empty?
<ide> llvm_gcc_path = xcode_prefix/"usr/bin/llvm-gcc" | 2 |
Java | Java | fix javadoc in acceptheaderlocaleresolver | f03ccd5cc98e94cf528c9b46cea687af8f59487a | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java
<ide> /*
<del> * Copyright 2002-2020 the original author or authors.
<add> * Copyright 2002-2021 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public List<Locale> getSupportedLocales() {
<ide> /**
<ide> * Configure a fixed default locale to fall back on if the request does not
<ide> * have an "Accept-Language" header.
<del> * <p>By default this is not set in which case when there is "Accept-Language"
<add> * <p>By default this is not set in which case when there is no "Accept-Language"
<ide> * header, the default locale for the server is used as defined in
<ide> * {@link HttpServletRequest#getLocale()}.
<ide> * @param defaultLocale the default locale to use | 1 |
Python | Python | add some missing notes to array_api | b5ac835f2e1d1188d2f0ab961cadbb74e1e488d0 | <ide><path>numpy/array_api/_sorting_functions.py
<ide> import numpy as np
<ide>
<ide>
<add># Note: the descending keyword argument is new in this function
<ide> def argsort(
<ide> x: Array, /, *, axis: int = -1, descending: bool = False, stable: bool = True
<ide> ) -> Array:
<ide> def argsort(
<ide> res = max_i - res
<ide> return Array._new(res)
<ide>
<del>
<add># Note: the descending keyword argument is new in this function
<ide> def sort(
<ide> x: Array, /, *, axis: int = -1, descending: bool = False, stable: bool = True
<ide> ) -> Array: | 1 |
Javascript | Javascript | fix layout tests | 8578ade9755a3ddf4e9436e89e09502f1bae9d83 | <ide><path>packages/ember-views/tests/views/view/layout_test.js
<ide> import Registry from "container/registry";
<ide> import { get } from "ember-metal/property_get";
<ide> import run from "ember-metal/run_loop";
<ide> import EmberView from "ember-views/views/view";
<add>import { compile } from "ember-template-compiler";
<add>import { registerHelper } from "ember-htmlbars/helpers";
<ide>
<ide> var registry, container, view;
<ide>
<ide> QUnit.test("Layout views return throw if their layout cannot be found", function
<ide> }, /cantBeFound/);
<ide> });
<ide>
<del>QUnit.skip("should call the function of the associated layout", function() {
<add>QUnit.test("should use the template of the associated layout", function() {
<ide> var templateCalled = 0;
<ide> var layoutCalled = 0;
<ide>
<del> registry.register('template:template', function() { templateCalled++; });
<del> registry.register('template:layout', function() { layoutCalled++; });
<add> registerHelper('call-template', function() {
<add> templateCalled++;
<add> });
<add>
<add> registerHelper('call-layout', function() {
<add> layoutCalled++;
<add> });
<add>
<add> registry.register('template:template', compile("{{call-template}}"));
<add> registry.register('template:layout', compile("{{call-layout}}"));
<ide>
<ide> view = EmberView.create({
<ide> container: container,
<ide> QUnit.skip("should call the function of the associated layout", function() {
<ide> equal(layoutCalled, 1, "layout is called when layout is present");
<ide> });
<ide>
<del>QUnit.skip("should call the function of the associated template with itself as the context", function() {
<del> registry.register('template:testTemplate', function(dataSource) {
<del> return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>";
<del> });
<add>QUnit.test("should use the associated template with itself as the context", function() {
<add> registry.register('template:testTemplate', compile(
<add> "<h1 id='twas-called'>template was called for {{personName}}</h1>"
<add> ));
<ide>
<ide> view = EmberView.create({
<ide> container: container,
<ide> QUnit.skip("should call the function of the associated template with itself as t
<ide> view.createElement();
<ide> });
<ide>
<del> equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), "the named template was called with the view as the data source");
<add> equal("template was called for Tom DAAAALE", view.$('#twas-called').text(),
<add> "the named template was called with the view as the data source");
<ide> });
<ide>
<del>QUnit.skip("should fall back to defaultTemplate if neither template nor templateName are provided", function() {
<del> var View;
<del>
<del> View = EmberView.extend({
<del> defaultLayout(dataSource) { return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; }
<add>QUnit.test("should fall back to defaultLayout if neither template nor templateName are provided", function() {
<add> var View = EmberView.extend({
<add> defaultLayout: compile('used default layout')
<ide> });
<ide>
<del> view = View.create({
<del> context: {
<del> personName: "Tom DAAAALE"
<del> }
<del> });
<add> view = View.create();
<ide>
<ide> run(function() {
<ide> view.createElement();
<ide> });
<ide>
<del> equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), "the named template was called with the view as the data source");
<add> equal("used default layout", view.$().text(),
<add> "the named template was called with the view as the data source");
<ide> });
<ide>
<del>QUnit.skip("should not use defaultLayout if layout is provided", function() {
<del> var View;
<del>
<del> View = EmberView.extend({
<del> layout() { return "foo"; },
<del> defaultLayout(dataSource) { return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; }
<add>QUnit.test("should not use defaultLayout if layout is provided", function() {
<add> var View = EmberView.extend({
<add> layout: compile("used layout"),
<add> defaultLayout: compile("used default layout")
<ide> });
<ide>
<ide> view = View.create();
<ide> run(function() {
<ide> view.createElement();
<ide> });
<ide>
<del>
<del> equal("foo", view.$().text(), "default layout was not printed");
<add> equal("used layout", view.$().text(), "default layout was not printed");
<ide> });
<del>
<del>QUnit.skip("the template property is available to the layout template", function() {
<del> view = EmberView.create({
<del> template(context, options) {
<del> options.data.buffer.push(" derp");
<del> },
<del>
<del> layout(context, options) {
<del> options.data.buffer.push("Herp");
<del> get(options.data.view, 'template')(context, options);
<del> }
<del> });
<del>
<del> run(function() {
<del> view.createElement();
<del> });
<del>
<del> equal("Herp derp", view.$().text(), "the layout has access to the template");
<del>});
<del> | 1 |
Ruby | Ruby | resolve multi-level gcc symlinks | f437c9040b08d1950aeaedb8417e22752b285c25 | <ide><path>Library/Homebrew/extend/ENV.rb
<ide> def gcc args = {}
<ide> @compiler = :gcc
<ide>
<ide> raise "GCC could not be found" if args[:force] and not File.exist? ENV['CC'] \
<del> or (File.symlink? ENV['CC'] \
<del> and File.readlink(ENV['CC']) =~ /llvm/)
<add> or (Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/)
<ide> end
<ide> alias_method :gcc_4_2, :gcc
<ide> | 1 |
Go | Go | remove use of deprecated dial.dualstack | ff408210da8ebcb6d3c333b6270b921442bcc1da | <ide><path>distribution/registry.go
<ide> func NewV2Repository(
<ide> direct := &net.Dialer{
<ide> Timeout: 30 * time.Second,
<ide> KeepAlive: 30 * time.Second,
<del> DualStack: true,
<ide> }
<ide>
<ide> // TODO(dmcgowan): Call close idle connections when complete, use keep alive
<ide><path>registry/registry.go
<ide> func NewTransport(tlsConfig *tls.Config) *http.Transport {
<ide> direct := &net.Dialer{
<ide> Timeout: 30 * time.Second,
<ide> KeepAlive: 30 * time.Second,
<del> DualStack: true,
<ide> }
<ide>
<ide> base := &http.Transport{ | 2 |
Mixed | Ruby | fix incorrect class name [ci skip] | 5e87e1faf646fed6139650f2a3adb13a3d09ccd9 | <ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def hash_filter(params, filter)
<ide> #
<ide> # class PeopleController < ActionController::Base
<ide> # # Using "Person.create(params[:person])" would raise an
<del> # # ActiveModel::ForbiddenAttributes exception because it'd
<add> # # ActiveModel::ForbiddenAttributesError exception because it'd
<ide> # # be using mass assignment without an explicit permit step.
<ide> # # This is the recommended form:
<ide> # def create
<ide><path>guides/source/action_controller_overview.md
<ide> predefined raise/rescue flow to end up as a 400 Bad Request.
<ide>
<ide> ```ruby
<ide> class PeopleController < ActionController::Base
<del> # This will raise an ActiveModel::ForbiddenAttributes exception
<add> # This will raise an ActiveModel::ForbiddenAttributesError exception
<ide> # because it's using mass assignment without an explicit permit
<ide> # step.
<ide> def create | 2 |
PHP | PHP | remove useless option from isunique rule | eed8df1ebdd918ddfc5a395e2587ba1dace3f6d2 | <ide><path>src/ORM/Rule/IsUnique.php
<ide> class IsUnique
<ide> /**
<ide> * Constructor.
<ide> *
<del> * ### Options
<del> *
<del> * - `allowMultipleNulls` Set to false to disallow multiple null values in
<del> * multi-column unique rules. By default this is `true` to emulate how SQL UNIQUE
<del> * keys work.
<del> *
<ide> * @param string[] $fields The list of fields to check uniqueness for
<del> * @param array $options The additional options for this rule.
<ide> */
<del> public function __construct(array $fields, array $options = [])
<add> public function __construct(array $fields)
<ide> {
<ide> $this->_fields = $fields;
<del> $this->_options = $options + ['allowMultipleNulls' => true];
<ide> }
<ide>
<ide> /**
<ide> public function __invoke(EntityInterface $entity, array $options): bool
<ide> if (!$entity->extract($this->_fields, true)) {
<ide> return true;
<ide> }
<del> $allowMultipleNulls = $this->_options['allowMultipleNulls'];
<ide>
<ide> $alias = $options['repository']->getAlias();
<del> $conditions = $this->_alias($alias, $entity->extract($this->_fields), $allowMultipleNulls);
<add> $conditions = $this->_alias($alias, $entity->extract($this->_fields));
<ide> if ($entity->isNew() === false) {
<ide> $keys = (array)$options['repository']->getPrimaryKey();
<del> $keys = $this->_alias($alias, $entity->extract($keys), $allowMultipleNulls);
<add> $keys = $this->_alias($alias, $entity->extract($keys));
<ide> if (array_filter($keys, 'strlen')) {
<ide> $conditions['NOT'] = $keys;
<ide> }
<ide> public function __invoke(EntityInterface $entity, array $options): bool
<ide> /**
<ide> * Add a model alias to all the keys in a set of conditions.
<ide> *
<del> * Null values will be omitted from the generated conditions,
<del> * as SQL UNIQUE indexes treat `NULL != NULL`
<del> *
<ide> * @param string $alias The alias to add.
<ide> * @param array $conditions The conditions to alias.
<del> * @param bool $multipleNulls Whether or not to allow multiple nulls.
<ide> * @return array
<ide> */
<del> protected function _alias(string $alias, array $conditions, bool $multipleNulls): array
<add> protected function _alias(string $alias, array $conditions): array
<ide> {
<ide> $aliased = [];
<ide> foreach ($conditions as $key => $value) {
<del> if ($multipleNulls) {
<del> $aliased["$alias.$key"] = $value;
<del> } else {
<del> $aliased["$alias.$key IS"] = $value;
<del> }
<add> $aliased["$alias.$key IS"] = $value;
<ide> }
<ide>
<ide> return $aliased;
<ide><path>src/ORM/RulesChecker.php
<ide> class RulesChecker extends BaseRulesChecker
<ide> * ```
<ide> *
<ide> * @param string[] $fields The list of fields to check for uniqueness.
<del> * @param string|array|null $message The error message to show in case the rule does not pass. Can
<del> * also be an array of options. When an array, the 'message' key can be used to provide a message.
<add> * @param string|null $message The error message to show in case the rule does not pass.
<ide> * @return \Cake\Datasource\RuleInvoker
<ide> */
<ide> public function isUnique(array $fields, $message = null): RuleInvoker
<ide> {
<del> $options = [];
<del> if (is_array($message)) {
<del> $options = $message + ['message' => null];
<del> $message = $options['message'];
<del> unset($options['message']);
<del> }
<ide> if (!$message) {
<ide> if ($this->_useI18n) {
<ide> $message = __d('cake', 'This value is already in use');
<ide> public function isUnique(array $fields, $message = null): RuleInvoker
<ide>
<ide> $errorField = current($fields);
<ide>
<del> return $this->_addError(new IsUnique($fields, $options), '_isUnique', compact('errorField', 'message'));
<add> return $this->_addError(new IsUnique($fields), '_isUnique', compact('errorField', 'message'));
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/ORM/RulesCheckerIntegrationTest.php
<ide> public function testIsUniqueAllowMultipleNulls()
<ide>
<ide> $table = $this->getTableLocator()->get('SpecialTags');
<ide> $rules = $table->rulesChecker();
<del> $rules->add($rules->isUnique(['author_id'], [
<del> 'allowMultipleNulls' => false,
<del> 'message' => 'All fields are required',
<del> ]));
<add> $rules->add($rules->isUnique(['author_id'], 'All fields are required'));
<ide>
<ide> $this->assertFalse($table->save($entity));
<ide> $this->assertEquals(['_isUnique' => 'All fields are required'], $entity->getError('author_id'));
<ide> public function testIsUniqueMultipleFieldsAllowMultipleNulls()
<ide>
<ide> $table = $this->getTableLocator()->get('SpecialTags');
<ide> $rules = $table->rulesChecker();
<del> $rules->add($rules->isUnique(['author_id', 'article_id'], [
<del> 'allowMultipleNulls' => false,
<del> 'message' => 'Nope',
<del> ]));
<add> $rules->add($rules->isUnique(['author_id', 'article_id'], 'Nope'));
<ide>
<ide> $this->assertFalse($table->save($entity));
<ide> $this->assertEquals(['author_id' => ['_isUnique' => 'Nope']], $entity->getErrors()); | 3 |
PHP | PHP | extract files from json data in test helper | a82df4e4b88eb548e899bc73bd7270d4301c59d9 | <ide><path>src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
<ide> use Illuminate\Http\Request;
<ide> use Illuminate\Contracts\View\View;
<ide> use PHPUnit_Framework_Assert as PHPUnit;
<add>use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile;
<ide>
<ide> trait MakesHttpRequests
<ide> {
<ide> public function withoutMiddleware()
<ide> */
<ide> public function json($method, $uri, array $data = [], array $headers = [])
<ide> {
<add> $files = [];
<add>
<add> foreach ($data as $key => $value) {
<add> if ($value instanceof SymfonyUploadedFile) {
<add> $files[$key] = $value;
<add>
<add> unset($data[$key]);
<add> }
<add> }
<add>
<ide> $content = json_encode($data);
<ide>
<ide> $headers = array_merge([
<ide> public function json($method, $uri, array $data = [], array $headers = [])
<ide> ], $headers);
<ide>
<ide> $this->call(
<del> $method, $uri, [], [], [], $this->transformHeadersToServerVars($headers), $content
<add> $method, $uri, [], [], $files, $this->transformHeadersToServerVars($headers), $content
<ide> );
<ide>
<ide> return $this; | 1 |
Text | Text | harmonize yaml comments style in deprecations.md | 4cc06922dcf2d9a2afacc5ff3fe2b5c5fff71517 | <ide><path>doc/api/deprecations.md
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/31164
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v1.6.0
<ide> The `_linklist` module is deprecated. Please use a userland alternative.
<ide> changes:
<ide> - version: v14.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/31165
<del> description: End-of-Life
<add> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.15
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/17882
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<del> - version: 0.4.0
<add> - version: v0.4.0
<ide> commit: 9c7f89bf56abd37a796fea621ad2e47dd33d2b82
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/25279
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.14
<ide> to the `constants` property exposed by the relevant module. For instance,
<ide> changes:
<ide> - version: v14.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/31166
<del> description: End-of-Life (for `digest === null`)
<add> description: End-of-Life (for `digest === null`).
<ide> - version: v11.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/22861
<ide> description: Runtime deprecation (for `digest === null`).
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/21153
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.13
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/21153
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.13
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/15412
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.7
<ide> changes:
<ide> - version: v8.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/9683
<ide> description: End-of-Life.
<del> - version: v6.0.0
<del> pr-url: https://github.com/nodejs/node/pull/4525
<del> description: Runtime deprecation.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4525
<add> description: Runtime deprecation.
<ide> - version: v0.1.96
<ide> commit: c93e0aaf062081db3ec40ac45b3e2c979d5759d6
<ide> description: Documentation-only deprecation.
<ide> changes:
<ide> - version: v8.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/9683
<ide> description: End-of-Life.
<del> - version: v6.0.0
<del> pr-url: https://github.com/nodejs/node/pull/4525
<del> description: Runtime deprecation.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<add> - version: v6.0.0
<add> pr-url: https://github.com/nodejs/node/pull/4525
<add> description: Runtime deprecation.
<ide> - version: v0.1.96
<ide> commit: c93e0aaf062081db3ec40ac45b3e2c979d5759d6
<ide> description: Documentation-only deprecation.
<ide> The [`fs.readSync()`][] legacy `String` interface is deprecated. Use the
<ide> changes:
<ide> - version: v14.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/31167
<del> description: End-of-Life
<add> description: End-of-Life.
<ide> - version: v6.12.0
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/26973
<ide> description: Removed functionality.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v1.8.1
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/33647
<ide> description: Server.connections has been removed.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.9.7
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/27127
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.7.12
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/25280
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.6.0
<ide> The `REPLServer.prototype.convertToContext()` API has been removed.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v1.0.0
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/25377
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.3
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/25377
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.3
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/25377
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.3
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/25377
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.3
<ide> API is not useful.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v1.4.2
<ide> The [`domain`][] module is deprecated and should not be used.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v3.2.0
<ide> deprecated. Please use [`emitter.listenerCount(eventName)`][] instead.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v1.0.0
<ide> The [`fs.exists(path, callback)`][] API is deprecated. Please use
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.4.7
<ide> The [`fs.lchmod(path, mode, callback)`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.4.7
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/21498
<ide> description: Deprecation revoked.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.4.7
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/21498
<ide> description: Deprecation revoked.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.4.7
<ide> revoked because the requisite supporting APIs were added in libuv.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.10.6
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/13876
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v3.0.0
<ide> changes:
<ide> pr-url: https://github.com/nodejs/node/pull/17882
<ide> description: End-of-Life.
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version: v0.11.3
<ide> The [`tls.SecurePair`][] class is deprecated. Please use
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> instead.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isBoolean()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isBuffer()`][] API is deprecated. Please use
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isDate()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isError()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isFunction()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isNull()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isNullOrUndefined()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> Type: Documentation-only
<ide>
<ide> The [`util.isNumber()`][] API is deprecated.
<ide>
<del>### DEP0053 `util.isObject()`
<add>### DEP0053: `util.isObject()`
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isObject()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isPrimitive()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isRegExp()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isString()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> The [`util.isSymbol()`][] API is deprecated.
<ide> <!-- YAML
<ide> changes:
<ide> - version:
<del> - v4.8.6
<ide> - v6.12.0
<add> - v4.8.6
<ide> pr-url: https://github.com/nodejs/node/pull/10116
<ide> description: A deprecation code has been assigned.
<ide> - version:
<del> - v3.3.1
<ide> - v4.0.0
<add> - v3.3.1
<ide> pr-url: https://github.com/nodejs/node/pull/2447
<ide> description: Documentation-only deprecation.
<ide> -->
<ide> alternative.
<ide> ### DEP0062: `node --debug`
<ide> <!-- YAML
<ide> changes:
<del> - version: v8.0.0
<del> pr-url: https://github.com/nodejs/node/pull/10970
<del> description: Runtime deprecation.
<ide> - version: v12.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/25828
<ide> description: End-of-Life.
<add> - version: v8.0.0
<add> pr-url: https://github.com/nodejs/node/pull/10970
<add> description: Runtime deprecation.
<ide> -->
<ide>
<ide> Type: End-of-Life
<ide> code modification is necessary if that is done.
<ide> ### DEP0085: AsyncHooks sensitive API
<ide> <!-- YAML
<ide> changes:
<del> - version: 10.0.0
<add> - version: v10.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/17147
<ide> description: End-of-Life.
<ide> - version:
<del> - v8.10.0
<ide> - v9.4.0
<add> - v8.10.0
<ide> pr-url: https://github.com/nodejs/node/pull/16972
<ide> description: Runtime deprecation.
<ide> -->
<ide> Use the `AsyncResource` API instead. See
<ide> ### DEP0086: Remove `runInAsyncIdScope`
<ide> <!-- YAML
<ide> changes:
<del> - version: 10.0.0
<add> - version: v10.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/17147
<ide> description: End-of-Life.
<ide> - version:
<del> - v8.10.0
<ide> - v9.4.0
<add> - v8.10.0
<ide> pr-url: https://github.com/nodejs/node/pull/16972
<ide> description: Runtime deprecation.
<ide> -->
<ide> should start using the `async_context` variant of `MakeCallback` or
<ide> changes:
<ide> - version: v12.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/26530
<del> description: End-of-Life
<add> description: End-of-Life.
<ide> - version:
<del> - v8.12.0
<del> - v9.6.0
<ide> - v10.0.0
<add> - v9.6.0
<add> - v8.12.0
<ide> pr-url: https://github.com/nodejs/node/pull/18632
<ide> description: Runtime deprecation.
<ide> -->
<ide> The `produceCachedData` option is deprecated. Use
<ide> ### DEP0111: `process.binding()`
<ide> <!-- YAML
<ide> changes:
<del> - version: v10.9.0
<del> pr-url: https://github.com/nodejs/node/pull/22004
<del> description: Documentation-only deprecation.
<ide> - version: v11.12.0
<ide> pr-url: https://github.com/nodejs/node/pull/26500
<ide> description: Added support for `--pending-deprecation`.
<add> - version: v10.9.0
<add> pr-url: https://github.com/nodejs/node/pull/22004
<add> description: Documentation-only deprecation.
<ide> -->
<ide>
<ide> Type: Documentation-only (supports [`--pending-deprecation`][])
<ide> an officially supported API.
<ide> changes:
<ide> - version: v13.0.0
<ide> pr-url: https://github.com/nodejs/node/pull/29061
<add> description: Runtime deprecation.
<ide> -->
<ide>
<ide> Type: Runtime | 1 |
Python | Python | fix wrong error message in `load_model` | e21c1fa7d39df780c44ff53247c68cc3892a4d2b | <ide><path>keras/models.py
<ide> def load_model(filepath, custom_objects=None):
<ide> ValueError: In case of an invalid savefile.
<ide> """
<ide> if h5py is None:
<del> raise ImportError('`save_model` requires h5py.')
<add> raise ImportError('`load_model` requires h5py.')
<ide>
<ide> if not custom_objects:
<ide> custom_objects = {} | 1 |
PHP | PHP | remove new password validation from broker | 88ec20dbaac61453f1f48e4013af3b3d96ad0729 | <ide><path>src/Illuminate/Auth/Passwords/PasswordBroker.php
<ide> class PasswordBroker implements PasswordBrokerContract
<ide> */
<ide> protected $users;
<ide>
<del> /**
<del> * The custom password validator callback.
<del> *
<del> * @var \Closure
<del> */
<del> protected $passwordValidator;
<del>
<ide> /**
<ide> * Create a new password broker instance.
<ide> *
<ide> * @param \Illuminate\Auth\Passwords\TokenRepositoryInterface $tokens
<ide> * @param \Illuminate\Contracts\Auth\UserProvider $users
<ide> * @return void
<ide> */
<del> public function __construct(TokenRepositoryInterface $tokens,
<del> UserProvider $users)
<add> public function __construct(TokenRepositoryInterface $tokens, UserProvider $users)
<ide> {
<ide> $this->users = $users;
<ide> $this->tokens = $tokens;
<ide> public function sendResetLink(array $credentials)
<ide> */
<ide> public function reset(array $credentials, Closure $callback)
<ide> {
<add> $user = $this->validateReset($credentials);
<add>
<ide> // If the responses from the validate method is not a user instance, we will
<ide> // assume that it is a redirect and simply return it from this method and
<ide> // the user is properly redirected having an error message on the post.
<del> $user = $this->validateReset($credentials);
<del>
<ide> if (! $user instanceof CanResetPasswordContract) {
<ide> return $user;
<ide> }
<ide> protected function validateReset(array $credentials)
<ide> return static::INVALID_USER;
<ide> }
<ide>
<del> if (! $this->validateNewPassword($credentials)) {
<del> return static::INVALID_PASSWORD;
<del> }
<del>
<ide> if (! $this->tokens->exists($user, $credentials['token'])) {
<ide> return static::INVALID_TOKEN;
<ide> }
<ide>
<ide> return $user;
<ide> }
<ide>
<del> /**
<del> * Set a custom password validator.
<del> *
<del> * @param \Closure $callback
<del> * @return void
<del> */
<del> public function validator(Closure $callback)
<del> {
<del> $this->passwordValidator = $callback;
<del> }
<del>
<del> /**
<del> * Determine if the passwords match for the request.
<del> *
<del> * @param array $credentials
<del> * @return bool
<del> */
<del> public function validateNewPassword(array $credentials)
<del> {
<del> if (isset($this->passwordValidator)) {
<del> [$password, $confirm] = [
<del> $credentials['password'],
<del> $credentials['password_confirmation'],
<del> ];
<del>
<del> return call_user_func(
<del> $this->passwordValidator, $credentials
<del> ) && $password === $confirm;
<del> }
<del>
<del> return $this->validatePasswordWithDefaults($credentials);
<del> }
<del>
<del> /**
<del> * Determine if the passwords are valid for the request.
<del> *
<del> * @param array $credentials
<del> * @return bool
<del> */
<del> protected function validatePasswordWithDefaults(array $credentials)
<del> {
<del> [$password, $confirm] = [
<del> $credentials['password'],
<del> $credentials['password_confirmation'],
<del> ];
<del>
<del> return $password === $confirm && mb_strlen($password) > 0;
<del> }
<del>
<ide> /**
<ide> * Get the user for the given credentials.
<ide> *
<ide><path>src/Illuminate/Contracts/Auth/PasswordBroker.php
<ide> interface PasswordBroker
<ide> */
<ide> const INVALID_USER = 'passwords.user';
<ide>
<del> /**
<del> * Constant representing an invalid password.
<del> *
<del> * @var string
<del> */
<del> const INVALID_PASSWORD = 'passwords.password';
<del>
<ide> /**
<ide> * Constant representing an invalid token.
<ide> *
<ide> public function sendResetLink(array $credentials);
<ide> * @return mixed
<ide> */
<ide> public function reset(array $credentials, Closure $callback);
<del>
<del> /**
<del> * Set a custom password validator.
<del> *
<del> * @param \Closure $callback
<del> * @return void
<del> */
<del> public function validator(Closure $callback);
<del>
<del> /**
<del> * Determine if the passwords match for the request.
<del> *
<del> * @param array $credentials
<del> * @return bool
<del> */
<del> public function validateNewPassword(array $credentials);
<ide> }
<ide><path>tests/Auth/AuthPasswordBrokerTest.php
<ide> public function testRedirectIsReturnedByResetWhenUserCredentialsInvalid()
<ide> }));
<ide> }
<ide>
<del> public function testRedirectReturnedByRemindWhenPasswordsDontMatch()
<del> {
<del> $creds = ['password' => 'foo', 'password_confirmation' => 'bar'];
<del> $broker = $this->getBroker($mocks = $this->getMocks());
<del> $mocks['users']->shouldReceive('retrieveByCredentials')->once()->with($creds)->andReturn($user = m::mock(CanResetPassword::class));
<del>
<del> $this->assertEquals(PasswordBrokerContract::INVALID_PASSWORD, $broker->reset($creds, function () {
<del> //
<del> }));
<del> }
<del>
<del> public function testRedirectReturnedByRemindWhenPasswordNotSet()
<del> {
<del> $creds = ['password' => null, 'password_confirmation' => null];
<del> $broker = $this->getBroker($mocks = $this->getMocks());
<del> $mocks['users']->shouldReceive('retrieveByCredentials')->once()->with($creds)->andReturn($user = m::mock(CanResetPassword::class));
<del>
<del> $this->assertEquals(PasswordBrokerContract::INVALID_PASSWORD, $broker->reset($creds, function () {
<del> //
<del> }));
<del> }
<del>
<del> public function testRedirectReturnedByRemindWhenPasswordDoesntPassValidator()
<del> {
<del> $creds = ['password' => 'abcdef', 'password_confirmation' => 'abcdef'];
<del> $broker = $this->getBroker($mocks = $this->getMocks());
<del> $broker->validator(function ($credentials) {
<del> return strlen($credentials['password']) >= 7;
<del> });
<del> $mocks['users']->shouldReceive('retrieveByCredentials')->once()->with($creds)->andReturn($user = m::mock(CanResetPassword::class));
<del>
<del> $this->assertEquals(PasswordBrokerContract::INVALID_PASSWORD, $broker->reset($creds, function () {
<del> //
<del> }));
<del> }
<del>
<ide> public function testRedirectReturnedByRemindWhenRecordDoesntExistInTable()
<ide> {
<ide> $creds = ['token' => 'token'];
<del> $broker = $this->getMockBuilder(PasswordBroker::class)->setMethods(['validateNewPassword'])->setConstructorArgs(array_values($mocks = $this->getMocks()))->getMock();
<add> $broker = $this->getBroker($mocks = $this->getMocks());
<ide> $mocks['users']->shouldReceive('retrieveByCredentials')->once()->with(Arr::except($creds, ['token']))->andReturn($user = m::mock(CanResetPassword::class));
<del> $broker->expects($this->once())->method('validateNewPassword')->will($this->returnValue(true));
<ide> $mocks['tokens']->shouldReceive('exists')->with($user, 'token')->andReturn(false);
<ide>
<ide> $this->assertEquals(PasswordBrokerContract::INVALID_TOKEN, $broker->reset($creds, function () { | 3 |
Javascript | Javascript | increase max listener limit on ipcrenderer | a4dc088ceb6b39f59ef4ba8c518c387ce8659b4f | <ide><path>src/ipc-helpers.js
<ide> exports.on = function (emitter, eventName, callback) {
<ide> exports.call = function (channel, ...args) {
<ide> if (!ipcRenderer) {
<ide> ipcRenderer = require('electron').ipcRenderer
<add> ipcRenderer.setMaxListeners(20)
<ide> }
<ide>
<ide> var responseChannel = getResponseChannel(channel) | 1 |
Javascript | Javascript | add missing events to viewproptypes | 41a940392cea497bc5eb627b24083d0211d1eb89 | <ide><path>Libraries/Components/View/ViewPropTypes.js
<ide> const stylePropType = StyleSheetPropType(ViewStylePropTypes);
<ide> export type ViewLayout = Layout;
<ide> export type ViewLayoutEvent = LayoutEvent;
<ide>
<add>type DirectEventProps = $ReadOnly<{|
<add> onAccessibilityAction?: Function,
<add> onAccessibilityTap?: Function,
<add> onLayout?: ?(event: LayoutEvent) => void,
<add> onMagicTap?: Function,
<add>|}>;
<add>
<add>type TouchEventProps = $ReadOnly<{|
<add> onTouchCancel?: ?Function,
<add> onTouchCancelCapture?: ?Function,
<add> onTouchEnd?: ?Function,
<add> onTouchEndCapture?: ?Function,
<add> onTouchMove?: ?Function,
<add> onTouchMoveCapture?: ?Function,
<add> onTouchStart?: ?Function,
<add> onTouchStartCapture?: ?Function,
<add>|}>;
<add>
<add>type GestureResponderEventProps = $ReadOnly<{|
<add> onMoveShouldSetResponder?: ?Function,
<add> onMoveShouldSetResponderCapture?: ?Function,
<add> onResponderGrant?: ?Function,
<add> onResponderMove?: ?Function,
<add> onResponderReject?: ?Function,
<add> onResponderRelease?: ?Function,
<add> onResponderStart?: ?Function,
<add> onResponderTerminate?: ?Function,
<add> onResponderTerminationRequest?: ?Function,
<add> onStartShouldSetResponder?: ?Function,
<add> onStartShouldSetResponderCapture?: ?Function,
<add>|}>;
<add>
<ide> export type ViewProps = $ReadOnly<{|
<add> ...DirectEventProps,
<add> ...GestureResponderEventProps,
<add> ...TouchEventProps,
<add>
<ide> // There's no easy way to create a different type if (Platform.isTVOS):
<ide> // so we must include TVViewProps
<ide> ...TVViewProps,
<ide> export type ViewProps = $ReadOnly<{|
<ide> accessibilityViewIsModal?: boolean,
<ide> accessibilityElementsHidden?: boolean,
<ide> children?: ?React.Node,
<del> onAccessibilityAction?: Function,
<del> onAccessibilityTap?: Function,
<del> onMagicTap?: Function,
<ide> testID?: ?string,
<ide> nativeID?: string,
<del> onLayout?: ?(event: LayoutEvent) => void,
<del> onResponderGrant?: ?Function,
<del> onResponderMove?: ?Function,
<del> onResponderReject?: ?Function,
<del> onResponderRelease?: ?Function,
<del> onResponderTerminate?: ?Function,
<del> onResponderTerminationRequest?: ?Function,
<del> onStartShouldSetResponder?: ?Function,
<del> onStartShouldSetResponderCapture?: ?Function,
<del> onMoveShouldSetResponder?: ?Function,
<del> onMoveShouldSetResponderCapture?: ?Function,
<ide> hitSlop?: ?EdgeInsetsProp,
<ide> pointerEvents?: null | 'box-none' | 'none' | 'box-only' | 'auto',
<ide> style?: stylePropType, | 1 |
Javascript | Javascript | add test cases with many exports | ccf32f214e41db34430ade7e73dd6b2ed58307b1 | <ide><path>test/cases/optimize/many-exports-100/chunk1.js
<add>import {
<add> x00,
<add> x01,
<add> x02,
<add> x03,
<add> x04,
<add> x05,
<add> x06,
<add> x07,
<add> x08,
<add> x09,
<add> x10,
<add> x11,
<add> x12,
<add> x13,
<add> x14,
<add> x15,
<add> x16,
<add> x17,
<add> x18,
<add> x19,
<add> x20,
<add> x21,
<add> x22,
<add> x23,
<add> x24,
<add> x25,
<add> x26,
<add> x27,
<add> x28,
<add> x29,
<add> x30,
<add> x31,
<add> x32,
<add> x33,
<add> x34,
<add> x35,
<add> x36,
<add> x37,
<add> x38,
<add> x39,
<add> x40,
<add> x41,
<add> x42,
<add> x43,
<add> x44,
<add> x45,
<add> x46,
<add> x47,
<add> x48,
<add> x49
<add>} from "./module";
<add>
<add>export default () => {
<add> expect(x00).toBe("x00");
<add> expect(x01).toBe("x01");
<add> expect(x02).toBe("x02");
<add> expect(x03).toBe("x03");
<add> expect(x04).toBe("x04");
<add> expect(x05).toBe("x05");
<add> expect(x06).toBe("x06");
<add> expect(x07).toBe("x07");
<add> expect(x08).toBe("x08");
<add> expect(x09).toBe("x09");
<add> expect(x10).toBe("x10");
<add> expect(x11).toBe("x11");
<add> expect(x12).toBe("x12");
<add> expect(x13).toBe("x13");
<add> expect(x14).toBe("x14");
<add> expect(x15).toBe("x15");
<add> expect(x16).toBe("x16");
<add> expect(x17).toBe("x17");
<add> expect(x18).toBe("x18");
<add> expect(x19).toBe("x19");
<add> expect(x20).toBe("x20");
<add> expect(x21).toBe("x21");
<add> expect(x22).toBe("x22");
<add> expect(x23).toBe("x23");
<add> expect(x24).toBe("x24");
<add> expect(x25).toBe("x25");
<add> expect(x26).toBe("x26");
<add> expect(x27).toBe("x27");
<add> expect(x28).toBe("x28");
<add> expect(x29).toBe("x29");
<add> expect(x30).toBe("x30");
<add> expect(x31).toBe("x31");
<add> expect(x32).toBe("x32");
<add> expect(x33).toBe("x33");
<add> expect(x34).toBe("x34");
<add> expect(x35).toBe("x35");
<add> expect(x36).toBe("x36");
<add> expect(x37).toBe("x37");
<add> expect(x38).toBe("x38");
<add> expect(x39).toBe("x39");
<add> expect(x40).toBe("x40");
<add> expect(x41).toBe("x41");
<add> expect(x42).toBe("x42");
<add> expect(x43).toBe("x43");
<add> expect(x44).toBe("x44");
<add> expect(x45).toBe("x45");
<add> expect(x46).toBe("x46");
<add> expect(x47).toBe("x47");
<add> expect(x48).toBe("x48");
<add> expect(x49).toBe("x49");
<add>};
<ide><path>test/cases/optimize/many-exports-100/chunk2.js
<add>import {
<add> y00,
<add> y01,
<add> y02,
<add> y03,
<add> y04,
<add> y05,
<add> y06,
<add> y07,
<add> y08,
<add> y09,
<add> y10,
<add> y11,
<add> y12,
<add> y13,
<add> y14,
<add> y15,
<add> y16,
<add> y17,
<add> y18,
<add> y19,
<add> y20,
<add> y21,
<add> y22,
<add> y23,
<add> y24,
<add> y25,
<add> y26,
<add> y27,
<add> y28,
<add> y29,
<add> y30,
<add> y31,
<add> y32,
<add> y33,
<add> y34,
<add> y35,
<add> y36,
<add> y37,
<add> y38,
<add> y39,
<add> y40,
<add> y41,
<add> y42,
<add> y43,
<add> y44,
<add> y45,
<add> y46,
<add> y47,
<add> y48,
<add> y49
<add>} from "./module";
<add>
<add>export default () => {
<add> expect(y00).toBe("y00");
<add> expect(y01).toBe("y01");
<add> expect(y02).toBe("y02");
<add> expect(y03).toBe("y03");
<add> expect(y04).toBe("y04");
<add> expect(y05).toBe("y05");
<add> expect(y06).toBe("y06");
<add> expect(y07).toBe("y07");
<add> expect(y08).toBe("y08");
<add> expect(y09).toBe("y09");
<add> expect(y10).toBe("y10");
<add> expect(y11).toBe("y11");
<add> expect(y12).toBe("y12");
<add> expect(y13).toBe("y13");
<add> expect(y14).toBe("y14");
<add> expect(y15).toBe("y15");
<add> expect(y16).toBe("y16");
<add> expect(y17).toBe("y17");
<add> expect(y18).toBe("y18");
<add> expect(y19).toBe("y19");
<add> expect(y20).toBe("y20");
<add> expect(y21).toBe("y21");
<add> expect(y22).toBe("y22");
<add> expect(y23).toBe("y23");
<add> expect(y24).toBe("y24");
<add> expect(y25).toBe("y25");
<add> expect(y26).toBe("y26");
<add> expect(y27).toBe("y27");
<add> expect(y28).toBe("y28");
<add> expect(y29).toBe("y29");
<add> expect(y30).toBe("y30");
<add> expect(y31).toBe("y31");
<add> expect(y32).toBe("y32");
<add> expect(y33).toBe("y33");
<add> expect(y34).toBe("y34");
<add> expect(y35).toBe("y35");
<add> expect(y36).toBe("y36");
<add> expect(y37).toBe("y37");
<add> expect(y38).toBe("y38");
<add> expect(y39).toBe("y39");
<add> expect(y40).toBe("y40");
<add> expect(y41).toBe("y41");
<add> expect(y42).toBe("y42");
<add> expect(y43).toBe("y43");
<add> expect(y44).toBe("y44");
<add> expect(y45).toBe("y45");
<add> expect(y46).toBe("y46");
<add> expect(y47).toBe("y47");
<add> expect(y48).toBe("y48");
<add> expect(y49).toBe("y49");
<add>};
<ide><path>test/cases/optimize/many-exports-100/index.js
<add>it("should mangle all exports correctly x", () => {
<add> return import("./chunk1").then(({ default: test }) => {
<add> test();
<add> });
<add>});
<add>it("should mangle all exports correctly y", () => {
<add> return import("./chunk2").then(({ default: test }) => {
<add> test();
<add> });
<add>});
<ide><path>test/cases/optimize/many-exports-100/module.js
<add>export const x00 = "x00";
<add>export const x01 = "x01";
<add>export const x02 = "x02";
<add>export const x03 = "x03";
<add>export const x04 = "x04";
<add>export const x05 = "x05";
<add>export const x06 = "x06";
<add>export const x07 = "x07";
<add>export const x08 = "x08";
<add>export const x09 = "x09";
<add>export const x10 = "x10";
<add>export const x11 = "x11";
<add>export const x12 = "x12";
<add>export const x13 = "x13";
<add>export const x14 = "x14";
<add>export const x15 = "x15";
<add>export const x16 = "x16";
<add>export const x17 = "x17";
<add>export const x18 = "x18";
<add>export const x19 = "x19";
<add>export const x20 = "x20";
<add>export const x21 = "x21";
<add>export const x22 = "x22";
<add>export const x23 = "x23";
<add>export const x24 = "x24";
<add>export const x25 = "x25";
<add>export const x26 = "x26";
<add>export const x27 = "x27";
<add>export const x28 = "x28";
<add>export const x29 = "x29";
<add>export const x30 = "x30";
<add>export const x31 = "x31";
<add>export const x32 = "x32";
<add>export const x33 = "x33";
<add>export const x34 = "x34";
<add>export const x35 = "x35";
<add>export const x36 = "x36";
<add>export const x37 = "x37";
<add>export const x38 = "x38";
<add>export const x39 = "x39";
<add>export const x40 = "x40";
<add>export const x41 = "x41";
<add>export const x42 = "x42";
<add>export const x43 = "x43";
<add>export const x44 = "x44";
<add>export const x45 = "x45";
<add>export const x46 = "x46";
<add>export const x47 = "x47";
<add>export const x48 = "x48";
<add>export const x49 = "x49";
<add>
<add>export const y00 = "y00";
<add>export const y01 = "y01";
<add>export const y02 = "y02";
<add>export const y03 = "y03";
<add>export const y04 = "y04";
<add>export const y05 = "y05";
<add>export const y06 = "y06";
<add>export const y07 = "y07";
<add>export const y08 = "y08";
<add>export const y09 = "y09";
<add>export const y10 = "y10";
<add>export const y11 = "y11";
<add>export const y12 = "y12";
<add>export const y13 = "y13";
<add>export const y14 = "y14";
<add>export const y15 = "y15";
<add>export const y16 = "y16";
<add>export const y17 = "y17";
<add>export const y18 = "y18";
<add>export const y19 = "y19";
<add>export const y20 = "y20";
<add>export const y21 = "y21";
<add>export const y22 = "y22";
<add>export const y23 = "y23";
<add>export const y24 = "y24";
<add>export const y25 = "y25";
<add>export const y26 = "y26";
<add>export const y27 = "y27";
<add>export const y28 = "y28";
<add>export const y29 = "y29";
<add>export const y30 = "y30";
<add>export const y31 = "y31";
<add>export const y32 = "y32";
<add>export const y33 = "y33";
<add>export const y34 = "y34";
<add>export const y35 = "y35";
<add>export const y36 = "y36";
<add>export const y37 = "y37";
<add>export const y38 = "y38";
<add>export const y39 = "y39";
<add>export const y40 = "y40";
<add>export const y41 = "y41";
<add>export const y42 = "y42";
<add>export const y43 = "y43";
<add>export const y44 = "y44";
<add>export const y45 = "y45";
<add>export const y46 = "y46";
<add>export const y47 = "y47";
<add>export const y48 = "y48";
<add>export const y49 = "y49";
<ide><path>test/cases/optimize/many-exports-120/chunk1.js
<add>import {
<add> x00,
<add> x01,
<add> x02,
<add> x03,
<add> x04,
<add> x05,
<add> x06,
<add> x07,
<add> x08,
<add> x09,
<add> x10,
<add> x11,
<add> x12,
<add> x13,
<add> x14,
<add> x15,
<add> x16,
<add> x17,
<add> x18,
<add> x19,
<add> x20,
<add> x21,
<add> x22,
<add> x23,
<add> x24,
<add> x25,
<add> x26,
<add> x27,
<add> x28,
<add> x29,
<add> x30,
<add> x31,
<add> x32,
<add> x33,
<add> x34,
<add> x35,
<add> x36,
<add> x37,
<add> x38,
<add> x39,
<add> x40,
<add> x41,
<add> x42,
<add> x43,
<add> x44,
<add> x45,
<add> x46,
<add> x47,
<add> x48,
<add> x49,
<add> x50,
<add> x51,
<add> x52,
<add> x53,
<add> x54,
<add> x55,
<add> x56,
<add> x57,
<add> x58,
<add> x59
<add>} from "./module";
<add>
<add>export default () => {
<add> expect(x00).toBe("x00");
<add> expect(x01).toBe("x01");
<add> expect(x02).toBe("x02");
<add> expect(x03).toBe("x03");
<add> expect(x04).toBe("x04");
<add> expect(x05).toBe("x05");
<add> expect(x06).toBe("x06");
<add> expect(x07).toBe("x07");
<add> expect(x08).toBe("x08");
<add> expect(x09).toBe("x09");
<add> expect(x10).toBe("x10");
<add> expect(x11).toBe("x11");
<add> expect(x12).toBe("x12");
<add> expect(x13).toBe("x13");
<add> expect(x14).toBe("x14");
<add> expect(x15).toBe("x15");
<add> expect(x16).toBe("x16");
<add> expect(x17).toBe("x17");
<add> expect(x18).toBe("x18");
<add> expect(x19).toBe("x19");
<add> expect(x20).toBe("x20");
<add> expect(x21).toBe("x21");
<add> expect(x22).toBe("x22");
<add> expect(x23).toBe("x23");
<add> expect(x24).toBe("x24");
<add> expect(x25).toBe("x25");
<add> expect(x26).toBe("x26");
<add> expect(x27).toBe("x27");
<add> expect(x28).toBe("x28");
<add> expect(x29).toBe("x29");
<add> expect(x30).toBe("x30");
<add> expect(x31).toBe("x31");
<add> expect(x32).toBe("x32");
<add> expect(x33).toBe("x33");
<add> expect(x34).toBe("x34");
<add> expect(x35).toBe("x35");
<add> expect(x36).toBe("x36");
<add> expect(x37).toBe("x37");
<add> expect(x38).toBe("x38");
<add> expect(x39).toBe("x39");
<add> expect(x40).toBe("x40");
<add> expect(x41).toBe("x41");
<add> expect(x42).toBe("x42");
<add> expect(x43).toBe("x43");
<add> expect(x44).toBe("x44");
<add> expect(x45).toBe("x45");
<add> expect(x46).toBe("x46");
<add> expect(x47).toBe("x47");
<add> expect(x48).toBe("x48");
<add> expect(x49).toBe("x49");
<add> expect(x50).toBe("x50");
<add> expect(x51).toBe("x51");
<add> expect(x52).toBe("x52");
<add> expect(x53).toBe("x53");
<add> expect(x54).toBe("x54");
<add> expect(x55).toBe("x55");
<add> expect(x56).toBe("x56");
<add> expect(x57).toBe("x57");
<add> expect(x58).toBe("x58");
<add> expect(x59).toBe("x59");
<add>};
<ide><path>test/cases/optimize/many-exports-120/chunk2.js
<add>import {
<add> y00,
<add> y01,
<add> y02,
<add> y03,
<add> y04,
<add> y05,
<add> y06,
<add> y07,
<add> y08,
<add> y09,
<add> y10,
<add> y11,
<add> y12,
<add> y13,
<add> y14,
<add> y15,
<add> y16,
<add> y17,
<add> y18,
<add> y19,
<add> y20,
<add> y21,
<add> y22,
<add> y23,
<add> y24,
<add> y25,
<add> y26,
<add> y27,
<add> y28,
<add> y29,
<add> y30,
<add> y31,
<add> y32,
<add> y33,
<add> y34,
<add> y35,
<add> y36,
<add> y37,
<add> y38,
<add> y39,
<add> y40,
<add> y41,
<add> y42,
<add> y43,
<add> y44,
<add> y45,
<add> y46,
<add> y47,
<add> y48,
<add> y49,
<add> y50,
<add> y51,
<add> y52,
<add> y53,
<add> y54,
<add> y55,
<add> y56,
<add> y57,
<add> y58,
<add> y59
<add>} from "./module";
<add>
<add>export default () => {
<add> expect(y00).toBe("y00");
<add> expect(y01).toBe("y01");
<add> expect(y02).toBe("y02");
<add> expect(y03).toBe("y03");
<add> expect(y04).toBe("y04");
<add> expect(y05).toBe("y05");
<add> expect(y06).toBe("y06");
<add> expect(y07).toBe("y07");
<add> expect(y08).toBe("y08");
<add> expect(y09).toBe("y09");
<add> expect(y10).toBe("y10");
<add> expect(y11).toBe("y11");
<add> expect(y12).toBe("y12");
<add> expect(y13).toBe("y13");
<add> expect(y14).toBe("y14");
<add> expect(y15).toBe("y15");
<add> expect(y16).toBe("y16");
<add> expect(y17).toBe("y17");
<add> expect(y18).toBe("y18");
<add> expect(y19).toBe("y19");
<add> expect(y20).toBe("y20");
<add> expect(y21).toBe("y21");
<add> expect(y22).toBe("y22");
<add> expect(y23).toBe("y23");
<add> expect(y24).toBe("y24");
<add> expect(y25).toBe("y25");
<add> expect(y26).toBe("y26");
<add> expect(y27).toBe("y27");
<add> expect(y28).toBe("y28");
<add> expect(y29).toBe("y29");
<add> expect(y30).toBe("y30");
<add> expect(y31).toBe("y31");
<add> expect(y32).toBe("y32");
<add> expect(y33).toBe("y33");
<add> expect(y34).toBe("y34");
<add> expect(y35).toBe("y35");
<add> expect(y36).toBe("y36");
<add> expect(y37).toBe("y37");
<add> expect(y38).toBe("y38");
<add> expect(y39).toBe("y39");
<add> expect(y40).toBe("y40");
<add> expect(y41).toBe("y41");
<add> expect(y42).toBe("y42");
<add> expect(y43).toBe("y43");
<add> expect(y44).toBe("y44");
<add> expect(y45).toBe("y45");
<add> expect(y46).toBe("y46");
<add> expect(y47).toBe("y47");
<add> expect(y48).toBe("y48");
<add> expect(y49).toBe("y49");
<add> expect(y50).toBe("y50");
<add> expect(y51).toBe("y51");
<add> expect(y52).toBe("y52");
<add> expect(y53).toBe("y53");
<add> expect(y54).toBe("y54");
<add> expect(y55).toBe("y55");
<add> expect(y56).toBe("y56");
<add> expect(y57).toBe("y57");
<add> expect(y58).toBe("y58");
<add> expect(y59).toBe("y59");
<add>};
<ide><path>test/cases/optimize/many-exports-120/index.js
<add>it("should mangle all exports correctly x", () => {
<add> return import("./chunk1").then(({ default: test }) => {
<add> test();
<add> });
<add>});
<add>it("should mangle all exports correctly y", () => {
<add> return import("./chunk2").then(({ default: test }) => {
<add> test();
<add> });
<add>});
<ide><path>test/cases/optimize/many-exports-120/module.js
<add>export const x00 = "x00";
<add>export const x01 = "x01";
<add>export const x02 = "x02";
<add>export const x03 = "x03";
<add>export const x04 = "x04";
<add>export const x05 = "x05";
<add>export const x06 = "x06";
<add>export const x07 = "x07";
<add>export const x08 = "x08";
<add>export const x09 = "x09";
<add>export const x10 = "x10";
<add>export const x11 = "x11";
<add>export const x12 = "x12";
<add>export const x13 = "x13";
<add>export const x14 = "x14";
<add>export const x15 = "x15";
<add>export const x16 = "x16";
<add>export const x17 = "x17";
<add>export const x18 = "x18";
<add>export const x19 = "x19";
<add>export const x20 = "x20";
<add>export const x21 = "x21";
<add>export const x22 = "x22";
<add>export const x23 = "x23";
<add>export const x24 = "x24";
<add>export const x25 = "x25";
<add>export const x26 = "x26";
<add>export const x27 = "x27";
<add>export const x28 = "x28";
<add>export const x29 = "x29";
<add>export const x30 = "x30";
<add>export const x31 = "x31";
<add>export const x32 = "x32";
<add>export const x33 = "x33";
<add>export const x34 = "x34";
<add>export const x35 = "x35";
<add>export const x36 = "x36";
<add>export const x37 = "x37";
<add>export const x38 = "x38";
<add>export const x39 = "x39";
<add>export const x40 = "x40";
<add>export const x41 = "x41";
<add>export const x42 = "x42";
<add>export const x43 = "x43";
<add>export const x44 = "x44";
<add>export const x45 = "x45";
<add>export const x46 = "x46";
<add>export const x47 = "x47";
<add>export const x48 = "x48";
<add>export const x49 = "x49";
<add>export const x50 = "x50";
<add>export const x51 = "x51";
<add>export const x52 = "x52";
<add>export const x53 = "x53";
<add>export const x54 = "x54";
<add>export const x55 = "x55";
<add>export const x56 = "x56";
<add>export const x57 = "x57";
<add>export const x58 = "x58";
<add>export const x59 = "x59";
<add>
<add>export const y00 = "y00";
<add>export const y01 = "y01";
<add>export const y02 = "y02";
<add>export const y03 = "y03";
<add>export const y04 = "y04";
<add>export const y05 = "y05";
<add>export const y06 = "y06";
<add>export const y07 = "y07";
<add>export const y08 = "y08";
<add>export const y09 = "y09";
<add>export const y10 = "y10";
<add>export const y11 = "y11";
<add>export const y12 = "y12";
<add>export const y13 = "y13";
<add>export const y14 = "y14";
<add>export const y15 = "y15";
<add>export const y16 = "y16";
<add>export const y17 = "y17";
<add>export const y18 = "y18";
<add>export const y19 = "y19";
<add>export const y20 = "y20";
<add>export const y21 = "y21";
<add>export const y22 = "y22";
<add>export const y23 = "y23";
<add>export const y24 = "y24";
<add>export const y25 = "y25";
<add>export const y26 = "y26";
<add>export const y27 = "y27";
<add>export const y28 = "y28";
<add>export const y29 = "y29";
<add>export const y30 = "y30";
<add>export const y31 = "y31";
<add>export const y32 = "y32";
<add>export const y33 = "y33";
<add>export const y34 = "y34";
<add>export const y35 = "y35";
<add>export const y36 = "y36";
<add>export const y37 = "y37";
<add>export const y38 = "y38";
<add>export const y39 = "y39";
<add>export const y40 = "y40";
<add>export const y41 = "y41";
<add>export const y42 = "y42";
<add>export const y43 = "y43";
<add>export const y44 = "y44";
<add>export const y45 = "y45";
<add>export const y46 = "y46";
<add>export const y47 = "y47";
<add>export const y48 = "y48";
<add>export const y49 = "y49";
<add>export const y50 = "y50";
<add>export const y51 = "y51";
<add>export const y52 = "y52";
<add>export const y53 = "y53";
<add>export const y54 = "y54";
<add>export const y55 = "y55";
<add>export const y56 = "y56";
<add>export const y57 = "y57";
<add>export const y58 = "y58";
<add>export const y59 = "y59";
<ide><path>test/cases/optimize/many-exports-40/chunk1.js
<add>import {
<add> x00,
<add> x01,
<add> x02,
<add> x03,
<add> x04,
<add> x05,
<add> x06,
<add> x07,
<add> x08,
<add> x09,
<add> x10,
<add> x11,
<add> x12,
<add> x13,
<add> x14,
<add> x15,
<add> x16,
<add> x17,
<add> x18,
<add> x19
<add>} from "./module";
<add>
<add>export default () => {
<add> expect(x00).toBe("x00");
<add> expect(x01).toBe("x01");
<add> expect(x02).toBe("x02");
<add> expect(x03).toBe("x03");
<add> expect(x04).toBe("x04");
<add> expect(x05).toBe("x05");
<add> expect(x06).toBe("x06");
<add> expect(x07).toBe("x07");
<add> expect(x08).toBe("x08");
<add> expect(x09).toBe("x09");
<add> expect(x10).toBe("x10");
<add> expect(x11).toBe("x11");
<add> expect(x12).toBe("x12");
<add> expect(x13).toBe("x13");
<add> expect(x14).toBe("x14");
<add> expect(x15).toBe("x15");
<add> expect(x16).toBe("x16");
<add> expect(x17).toBe("x17");
<add> expect(x18).toBe("x18");
<add> expect(x19).toBe("x19");
<add>};
<ide><path>test/cases/optimize/many-exports-40/chunk2.js
<add>import {
<add> y00,
<add> y01,
<add> y02,
<add> y03,
<add> y04,
<add> y05,
<add> y06,
<add> y07,
<add> y08,
<add> y09,
<add> y10,
<add> y11,
<add> y12,
<add> y13,
<add> y14,
<add> y15,
<add> y16,
<add> y17,
<add> y18,
<add> y19
<add>} from "./module";
<add>
<add>export default () => {
<add> expect(y00).toBe("y00");
<add> expect(y01).toBe("y01");
<add> expect(y02).toBe("y02");
<add> expect(y03).toBe("y03");
<add> expect(y04).toBe("y04");
<add> expect(y05).toBe("y05");
<add> expect(y06).toBe("y06");
<add> expect(y07).toBe("y07");
<add> expect(y08).toBe("y08");
<add> expect(y09).toBe("y09");
<add> expect(y10).toBe("y10");
<add> expect(y11).toBe("y11");
<add> expect(y12).toBe("y12");
<add> expect(y13).toBe("y13");
<add> expect(y14).toBe("y14");
<add> expect(y15).toBe("y15");
<add> expect(y16).toBe("y16");
<add> expect(y17).toBe("y17");
<add> expect(y18).toBe("y18");
<add> expect(y19).toBe("y19");
<add>};
<ide><path>test/cases/optimize/many-exports-40/index.js
<add>it("should mangle all exports correctly x", () => {
<add> return import("./chunk1").then(({ default: test }) => {
<add> test();
<add> });
<add>});
<add>it("should mangle all exports correctly y", () => {
<add> return import("./chunk2").then(({ default: test }) => {
<add> test();
<add> });
<add>});
<ide><path>test/cases/optimize/many-exports-40/module.js
<add>export const x00 = "x00";
<add>export const x01 = "x01";
<add>export const x02 = "x02";
<add>export const x03 = "x03";
<add>export const x04 = "x04";
<add>export const x05 = "x05";
<add>export const x06 = "x06";
<add>export const x07 = "x07";
<add>export const x08 = "x08";
<add>export const x09 = "x09";
<add>export const x10 = "x10";
<add>export const x11 = "x11";
<add>export const x12 = "x12";
<add>export const x13 = "x13";
<add>export const x14 = "x14";
<add>export const x15 = "x15";
<add>export const x16 = "x16";
<add>export const x17 = "x17";
<add>export const x18 = "x18";
<add>export const x19 = "x19";
<add>
<add>export const y00 = "y00";
<add>export const y01 = "y01";
<add>export const y02 = "y02";
<add>export const y03 = "y03";
<add>export const y04 = "y04";
<add>export const y05 = "y05";
<add>export const y06 = "y06";
<add>export const y07 = "y07";
<add>export const y08 = "y08";
<add>export const y09 = "y09";
<add>export const y10 = "y10";
<add>export const y11 = "y11";
<add>export const y12 = "y12";
<add>export const y13 = "y13";
<add>export const y14 = "y14";
<add>export const y15 = "y15";
<add>export const y16 = "y16";
<add>export const y17 = "y17";
<add>export const y18 = "y18";
<add>export const y19 = "y19"; | 12 |
Javascript | Javascript | use numeric module ids for ios ra-bundles | bff0b1f9d65c25fea67294773ce91c47452eac56 | <ide><path>local-cli/bundle/output/unbundle/as-indexed-file.js
<ide> function writeBuffers(stream, buffers) {
<ide> });
<ide> }
<ide>
<del>function moduleToBuffer(name, code, encoding) {
<add>function moduleToBuffer(id, code, encoding) {
<ide> return {
<del> name,
<add> id,
<ide> linesCount: code.split('\n').length,
<ide> buffer: Buffer.concat([
<ide> Buffer(code, encoding),
<ide> function buildModuleTable(buffers) {
<ide>
<ide> const offsetTable = [tableLengthBuffer];
<ide> for (let i = 0; i < numBuffers; i++) {
<del> const {name, linesCount, buffer: {length}} = buffers[i];
<add> const {id, linesCount, buffer: {length}} = buffers[i];
<ide>
<ide> const entry = Buffer.concat([
<del> Buffer(i === 0 ? MAGIC_STARTUP_MODULE_ID : name, 'utf8'),
<add> Buffer(i === 0 ? MAGIC_STARTUP_MODULE_ID : id, 'utf8'),
<ide> nullByteBuffer,
<ide> uInt32Buffer(currentOffset),
<ide> uInt32Buffer(currentLine),
<ide> function buildModuleBuffers(startupCode, modules, encoding) {
<ide> [moduleToBuffer('', startupCode, encoding, true)].concat(
<ide> modules.map(module =>
<ide> moduleToBuffer(
<del> module.name,
<add> String(module.id),
<ide> module.code + '\n', // each module starts on a newline
<ide> encoding,
<ide> ) | 1 |
PHP | PHP | call parent boot | ad695e20bc1a616737295211575b0709bbf7dd44 | <ide><path>app/Providers/EventServiceProvider.php
<ide> class EventServiceProvider extends ServiceProvider {
<ide> */
<ide> public function boot(DispatcherContract $events)
<ide> {
<add> parent::boot($events);
<add>
<ide> //
<ide> }
<ide> | 1 |
PHP | PHP | set $options as an empty array per default | 2cb7711ed9179d3bb34b3860a0ebc9319c610da7 | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> protected function finishSave(array $options)
<ide> * Perform a model update operation.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<add> * @param array $options
<ide> * @return bool|null
<ide> */
<del> protected function performUpdate(Builder $query, array $options)
<add> protected function performUpdate(Builder $query, array $options = [])
<ide> {
<ide> $dirty = $this->getDirty();
<ide>
<ide> protected function performUpdate(Builder $query, array $options)
<ide> * Perform a model insert operation.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<add> * @param array $options
<ide> * @return bool
<ide> */
<del> protected function performInsert(Builder $query, array $options)
<add> protected function performInsert(Builder $query, array $options = [])
<ide> {
<ide> if ($this->fireModelEvent('creating') === false) return false;
<ide> | 1 |
Text | Text | move new changelog entry to the top [ci skip] | 41f8a9a03a495e0cdad93515b3b0ed25d494654c | <ide><path>activesupport/CHANGELOG.md
<add>* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
<add> raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
<add> Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
<add> when calling `#to_time`.
<add>
<add> *Kevin McPhillips* & *Andrew White*
<add>
<ide> * Remove implicit coercion deprecation of durations
<ide>
<ide> In #28204 we deprecated implicit conversion of durations to a numeric which
<ide>
<ide> ## Rails 5.1.0.beta1 (February 23, 2017) ##
<ide>
<del>* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
<del> raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
<del> Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
<del> when calling `#to_time`.
<del>
<del> *Kevin McPhillips* & *Andrew White*
<del>
<ide> * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
<ide>
<ide> *Adam Rice* | 1 |
Python | Python | attempt workaround 2 for pylint bug on travis ci | 83f92914771f76ea67475b63ce2a45eeb9735e46 | <ide><path>libcloud/common/dimensiondata.py
<ide> from base64 import b64encode
<ide> from time import sleep
<ide>
<del>from distutils.version import LooseVersion # pylint: disable=import-error
<add>from distutils.version import LooseVersion # pylint: disable-msg=E0611
<ide> from libcloud.utils.py3 import httplib
<ide> from libcloud.utils.py3 import b
<ide> from libcloud.common.base import ConnectionUserAndKey, XmlResponse, RawResponse | 1 |
Ruby | Ruby | remove duplicate frozen_string_literal comment | 2c35dce71cf16eb8e72bde174d6b52a8ec6b9739 | <ide><path>activesupport/lib/active_support/core_ext/range/include_time_with_zone.rb
<ide> # frozen_string_literal: true
<ide>
<del># frozen_string_literal: true
<del>
<ide> ActiveSupport::Deprecation.warn(<<-MSG.squish)
<ide> `active_support/core_ext/range/include_time_with_zone` is deprecated and will be removed in Rails 7.1.
<ide> MSG | 1 |
Javascript | Javascript | add coverage for utf8checkincomplete() | 48f88696858bd353f3471c7c8b161b2e23f7660b | <ide><path>test/parallel/test-string-decoder.js
<ide> assert.strictEqual(decoder.write(Buffer.from('F1', 'hex')), '');
<ide> assert.strictEqual(decoder.write(Buffer.from('41F2', 'hex')), '\ufffdA');
<ide> assert.strictEqual(decoder.end(), '\ufffd');
<ide>
<add>// Additional utf8Text test
<add>decoder = new StringDecoder('utf8');
<add>assert.strictEqual(decoder.text(Buffer.from([0x41]), 2), '');
<ide>
<ide> // Additional UTF-16LE surrogate pair tests
<ide> decoder = new StringDecoder('utf16le'); | 1 |
Java | Java | add head support in mvc/webflux resource handling | 9adfa5e8b0f0cd65a0b14740e0a0f9832d80edcb | <ide><path>spring-web/src/main/java/org/springframework/http/codec/ResourceHttpMessageWriter.java
<ide> public Mono<Void> write(Publisher<? extends Resource> inputStream, ResolvableTyp
<ide> private Mono<Void> writeResource(Resource resource, ResolvableType type, @Nullable MediaType mediaType,
<ide> ReactiveHttpOutputMessage message, Map<String, Object> hints) {
<ide>
<del> HttpHeaders headers = message.getHeaders();
<del> MediaType resourceMediaType = getResourceMediaType(mediaType, resource, hints);
<del> headers.setContentType(resourceMediaType);
<del>
<del> if (headers.getContentLength() < 0) {
<del> long length = lengthOf(resource);
<del> if (length != -1) {
<del> headers.setContentLength(length);
<del> }
<del> }
<add> addHeaders(message, resource, mediaType, hints);
<ide>
<ide> return zeroCopy(resource, null, message, hints)
<ide> .orElseGet(() -> {
<ide> Mono<Resource> input = Mono.just(resource);
<ide> DataBufferFactory factory = message.bufferFactory();
<del> Flux<DataBuffer> body = this.encoder.encode(input, factory, type, resourceMediaType, hints);
<add> Flux<DataBuffer> body = this.encoder.encode(input, factory, type, message.getHeaders().getContentType(), hints);
<ide> if (logger.isDebugEnabled()) {
<ide> body = body.doOnNext(buffer -> Hints.touchDataBuffer(buffer, hints, logger));
<ide> }
<ide> return message.writeWith(body);
<ide> });
<ide> }
<ide>
<add> /**
<add> * Adds the default headers for the given resource to the given message.
<add> * @since 6.0
<add> */
<add> public void addHeaders(ReactiveHttpOutputMessage message, Resource resource, @Nullable MediaType contentType, Map<String, Object> hints) {
<add> HttpHeaders headers = message.getHeaders();
<add> MediaType resourceMediaType = getResourceMediaType(contentType, resource, hints);
<add> headers.setContentType(resourceMediaType);
<add>
<add> if (headers.getContentLength() < 0) {
<add> long length = lengthOf(resource);
<add> if (length != -1) {
<add> headers.setContentLength(length);
<add> }
<add> }
<add> headers.set(HttpHeaders.ACCEPT_RANGES, "bytes");
<add> }
<add>
<ide> private static MediaType getResourceMediaType(
<ide> @Nullable MediaType mediaType, Resource resource, Map<String, Object> hints) {
<ide>
<ide><path>spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java
<ide> protected Long getContentLength(Resource resource, @Nullable MediaType contentTy
<ide> return (contentLength < 0 ? null : contentLength);
<ide> }
<ide>
<add> /**
<add> * Adds the default headers for the given resource to the given message.
<add> * @since 6.0
<add> */
<add> public void addDefaultHeaders(HttpOutputMessage message, Resource resource, @Nullable MediaType contentType) throws IOException {
<add> addDefaultHeaders(message.getHeaders(), resource, contentType);
<add> }
<add>
<ide> @Override
<ide> protected void writeInternal(Resource resource, HttpOutputMessage outputMessage)
<ide> throws IOException, HttpMessageNotWritableException {
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceWebHandler.java
<ide> public Mono<Void> handle(ServerWebExchange exchange) {
<ide> // Content phase
<ide> ResourceHttpMessageWriter writer = getResourceHttpMessageWriter();
<ide> Assert.state(writer != null, "No ResourceHttpMessageWriter");
<del> return writer.write(Mono.just(resource),
<del> null, ResolvableType.forClass(Resource.class), mediaType,
<del> exchange.getRequest(), exchange.getResponse(),
<del> Hints.from(Hints.LOG_PREFIX_HINT, exchange.getLogPrefix()));
<add> if (HttpMethod.HEAD == httpMethod) {
<add> writer.addHeaders(exchange.getResponse(), resource, mediaType,
<add> Hints.from(Hints.LOG_PREFIX_HINT, exchange.getLogPrefix()));
<add> return exchange.getResponse().setComplete();
<add> }
<add> else {
<add> return writer.write(Mono.just(resource),
<add> null, ResolvableType.forClass(Resource.class), mediaType,
<add> exchange.getRequest(), exchange.getResponse(),
<add> Hints.from(Hints.LOG_PREFIX_HINT, exchange.getLogPrefix()));
<add> }
<ide> }
<ide> catch (IOException ex) {
<ide> return Mono.error(ex);
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java
<ide> public void getResourceHttpHeader() throws Exception {
<ide> assertThat(headers.containsKey("Last-Modified")).isTrue();
<ide> assertThat(resourceLastModifiedDate("test/foo.css") / 1000).isEqualTo(headers.getLastModified() / 1000);
<ide> assertThat(headers.getFirst("Accept-Ranges")).isEqualTo("bytes");
<del> assertThat(headers.get("Accept-Ranges").size()).isEqualTo(1);
<add> assertThat(headers.get("Accept-Ranges")).hasSize(1);
<add>
<add> StepVerifier.create(exchange.getResponse().getBody())
<add> .verifyComplete();
<ide> }
<ide>
<ide> @Test
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java
<ide> public void handleRequest(HttpServletRequest request, HttpServletResponse respon
<ide> ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(response);
<ide> if (request.getHeader(HttpHeaders.RANGE) == null) {
<ide> Assert.state(this.resourceHttpMessageConverter != null, "Not initialized");
<del> this.resourceHttpMessageConverter.write(resource, mediaType, outputMessage);
<add>
<add> if (HttpMethod.HEAD.matches(request.getMethod())) {
<add> this.resourceHttpMessageConverter.addDefaultHeaders(outputMessage, resource, mediaType);
<add> outputMessage.flush();
<add> }
<add> else {
<add> this.resourceHttpMessageConverter.write(resource, mediaType, outputMessage);
<add> }
<ide> }
<ide> else {
<ide> Assert.state(this.resourceRegionHttpMessageConverter != null, "Not initialized");
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandlerTests.java
<ide> public void getResourceHttpHeader() throws Exception {
<ide> assertThat(this.response.containsHeader("Last-Modified")).isTrue();
<ide> assertThat(this.response.getDateHeader("Last-Modified") / 1000).isEqualTo(resourceLastModified("test/foo.css") / 1000);
<ide> assertThat(this.response.getHeader("Accept-Ranges")).isEqualTo("bytes");
<del> assertThat(this.response.getHeaders("Accept-Ranges").size()).isEqualTo(1);
<add> assertThat(this.response.getHeaders("Accept-Ranges")).hasSize(1);
<add> assertThat(this.response.getContentAsByteArray()).isEmpty();
<ide> }
<ide>
<ide> @Test | 6 |
Ruby | Ruby | fix typo in submit_tag helper documentation | 19c91d7b72a8fbf5a315868c7089c1ecf499e811 | <ide><path>actionpack/lib/action_view/helpers/form_tag_helper.rb
<ide> def radio_button_tag(name, value, checked = false, options = {})
<ide> # # => <input class="form_submit" name="commit" type="submit" />
<ide> #
<ide> # submit_tag "Edit", :disable_with => "Editing...", :class => "edit_button"
<del> # # => <input class="edit_button" data-disable_with="Editing..." name="commit" type="submit" value="Edit" />
<add> # # => <input class="edit_button" data-disable-with="Editing..." name="commit" type="submit" value="Edit" />
<ide> #
<ide> # submit_tag "Save", :confirm => "Are you sure?"
<ide> # # => <input name='commit' type='submit' value='Save' data-confirm="Are you sure?" /> | 1 |
Java | Java | fix nvc for androidprogressbar | ae6a84e70deff13dd778435193d95aa4b019024c | <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java
<ide> private final WeakHashMap<Integer, Pair<Integer, Integer>> mMeasuredStyles = new WeakHashMap<>();
<ide>
<ide> /* package */ static final String PROP_STYLE = "styleAttr";
<add> /* package */ static final String PROP_ATTR = "typeAttr";
<ide> /* package */ static final String PROP_INDETERMINATE = "indeterminate";
<ide> /* package */ static final String PROP_PROGRESS = "progress";
<ide> /* package */ static final String PROP_ANIMATING = "animating";
<ide> public void setTestID(ProgressBarContainerView view, @Nullable String value) {
<ide> }
<ide>
<ide> @Override
<add> @ReactProp(name = PROP_ATTR)
<ide> public void setTypeAttr(ProgressBarContainerView view, @Nullable String value) {}
<ide>
<ide> @Override | 1 |
Python | Python | check exception details in refguide_check.py | 70f97a5040e20642b68e45d30e030a89ac89e665 | <ide><path>numpy/core/multiarray.py
<ide> def bincount(x, weights=None, minlength=None):
<ide>
<ide> >>> np.bincount(np.arange(5, dtype=float))
<ide> Traceback (most recent call last):
<del> File "<stdin>", line 1, in <module>
<del> TypeError: array cannot be safely cast to required type
<add> ...
<add> TypeError: Cannot cast array data from dtype('float64') to dtype('int64')
<add> according to the rule 'safe'
<ide>
<ide> A possible use of ``bincount`` is to perform sums over
<ide> variable-size chunks of an array, using the ``weights`` keyword.
<ide><path>tools/refguide_check.py
<ide> def _run_doctests(tests, full_name, verbose, doctest_warnings):
<ide>
<ide> Returns: list of [(success_flag, output), ...]
<ide> """
<del> flags = NORMALIZE_WHITESPACE | ELLIPSIS | IGNORE_EXCEPTION_DETAIL
<add> flags = NORMALIZE_WHITESPACE | ELLIPSIS
<ide> runner = DTRunner(full_name, checker=Checker(), optionflags=flags,
<ide> verbose=verbose)
<ide> | 2 |
Python | Python | remove tf setup requirement | 7b76bed70c1e9528bddbfe0019da550865d0963a | <ide><path>keras/__init__.py
<add>
<add>try:
<add> from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
<add>except ImportError:
<add> raise ImportError(
<add> 'Keras requires TensorFlow 2.2 or higher. '
<add> 'Install TensorFlow via `pip install tensorflow`')
<add>
<ide> from . import utils
<ide> from . import activations
<ide> from . import applications
<ide> from .models import Model
<ide> from .models import Sequential
<ide>
<del>from tensorflow.keras import __version__
<add>__version__ = '2.4.2'
<ide><path>setup.py
<ide> '''
<ide>
<ide> setup(name='Keras',
<del> version='2.4.1',
<add> version='2.4.2',
<ide> description='Deep Learning for humans',
<ide> long_description=long_description,
<ide> author='Francois Chollet',
<ide> author_email='francois.chollet@gmail.com',
<ide> url='https://github.com/keras-team/keras',
<del> download_url='https://github.com/keras-team/keras/tarball/2.4.1',
<add> download_url='https://github.com/keras-team/keras/tarball/2.4.2',
<ide> license='MIT',
<del> install_requires=['tensorflow',
<del> 'numpy>=1.9.1',
<add> install_requires=['numpy>=1.9.1',
<ide> 'scipy>=0.14',
<ide> 'pyyaml',
<ide> 'h5py'], | 2 |
Java | Java | add checknotmodified support for responseentity | 638e6cc7f8f817b0271711a5ee48dbba8b58a7e0 | <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandler.java
<ide> */
<ide> package org.springframework.web.reactive.result.method.annotation;
<ide>
<add>import java.time.Instant;
<add>import java.util.Arrays;
<ide> import java.util.List;
<ide> import java.util.Optional;
<ide>
<ide> import org.springframework.core.ResolvableType;
<ide> import org.springframework.http.HttpEntity;
<ide> import org.springframework.http.HttpHeaders;
<add>import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.RequestEntity;
<ide> import org.springframework.http.ResponseEntity;
<ide> import org.springframework.http.codec.HttpMessageWriter;
<ide> public class ResponseEntityResultHandler extends AbstractMessageWriterResultHandler
<ide> implements HandlerResultHandler {
<ide>
<add> private static final List<HttpMethod> SAFE_METHODS = Arrays.asList(HttpMethod.GET, HttpMethod.HEAD);
<add>
<ide>
<ide> /**
<ide> * Constructor with {@link HttpMessageWriter}s and a
<ide> public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result)
<ide> .forEach(entry -> responseHeaders.put(entry.getKey(), entry.getValue()));
<ide> }
<ide>
<add> String etag = entityHeaders.getETag();
<add> Instant lastModified = Instant.ofEpochMilli(entityHeaders.getLastModified());
<add> HttpMethod httpMethod = exchange.getRequest().getMethod();
<add> if (SAFE_METHODS.contains(httpMethod) && exchange.checkNotModified(etag, lastModified)) {
<add> exchange.getResponse().setComplete();
<add> return Mono.empty();
<add> }
<add>
<ide> return writeBody(httpEntity.getBody(), bodyType, exchange);
<ide> });
<ide> }
<ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java
<ide> import java.net.URI;
<ide> import java.nio.charset.StandardCharsets;
<ide> import java.time.Duration;
<add>import java.time.Instant;
<add>import java.time.temporal.ChronoUnit;
<ide> import java.util.ArrayList;
<ide> import java.util.Arrays;
<ide> import java.util.List;
<ide> import org.springframework.core.codec.ByteBufferEncoder;
<ide> import org.springframework.core.codec.CharSequenceEncoder;
<ide> import org.springframework.core.io.buffer.support.DataBufferTestUtils;
<add>import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.HttpStatus;
<ide> import org.springframework.http.ResponseEntity;
<ide> import org.springframework.http.codec.xml.Jaxb2XmlEncoder;
<ide> import org.springframework.http.server.reactive.MockServerHttpRequest;
<ide> import org.springframework.http.server.reactive.MockServerHttpResponse;
<del>import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.tests.TestSubscriber;
<ide> import org.springframework.util.ObjectUtils;
<ide> import org.springframework.web.reactive.HandlerResult;
<ide> import org.springframework.web.server.ServerWebExchange;
<ide> import org.springframework.web.server.adapter.DefaultServerWebExchange;
<ide> import org.springframework.web.server.session.MockWebSessionManager;
<add>import org.springframework.web.server.session.WebSessionManager;
<ide>
<del>import static org.junit.Assert.*;
<del>import static org.springframework.core.ResolvableType.*;
<add>import static org.junit.Assert.assertEquals;
<add>import static org.junit.Assert.assertFalse;
<add>import static org.junit.Assert.assertNull;
<add>import static org.junit.Assert.assertTrue;
<add>import static org.springframework.core.ResolvableType.forClassWithGenerics;
<add>import static org.springframework.http.ResponseEntity.ok;
<ide>
<ide> /**
<ide> * Unit tests for {@link ResponseEntityResultHandler}. When adding a test also
<ide> public class ResponseEntityResultHandlerTests {
<ide>
<ide> private ResponseEntityResultHandler resultHandler;
<ide>
<add> private MockServerHttpRequest request;
<add>
<ide> private MockServerHttpResponse response = new MockServerHttpResponse();
<ide>
<ide> private ServerWebExchange exchange;
<ide> public class ResponseEntityResultHandlerTests {
<ide> @Before
<ide> public void setUp() throws Exception {
<ide> this.resultHandler = createHandler();
<del> ServerHttpRequest request = new MockServerHttpRequest(HttpMethod.GET, new URI("/path"));
<del> this.exchange = new DefaultServerWebExchange(request, this.response, new MockWebSessionManager());
<add> this.request = new MockServerHttpRequest(HttpMethod.GET, new URI("/path"));
<add> WebSessionManager manager = new MockWebSessionManager();
<add> this.exchange = new DefaultServerWebExchange(this.request, this.response, manager);
<ide> }
<ide>
<ide> private ResponseEntityResultHandler createHandler(HttpMessageWriter<?>... writers) {
<ide> public void headers() throws Exception {
<ide>
<ide> @Test
<ide> public void handleReturnTypes() throws Exception {
<del> Object returnValue = ResponseEntity.ok("abc");
<add> Object returnValue = ok("abc");
<ide> ResolvableType returnType = responseEntity(String.class);
<ide> testHandle(returnValue, returnType);
<ide>
<del> returnValue = Mono.just(ResponseEntity.ok("abc"));
<add> returnValue = Mono.just(ok("abc"));
<ide> returnType = forClassWithGenerics(Mono.class, responseEntity(String.class));
<ide> testHandle(returnValue, returnType);
<ide>
<del> returnValue = Mono.just(ResponseEntity.ok("abc"));
<add> returnValue = Mono.just(ok("abc"));
<ide> returnType = forClassWithGenerics(Single.class, responseEntity(String.class));
<ide> testHandle(returnValue, returnType);
<ide>
<del> returnValue = Mono.just(ResponseEntity.ok("abc"));
<add> returnValue = Mono.just(ok("abc"));
<ide> returnType = forClassWithGenerics(CompletableFuture.class, responseEntity(String.class));
<ide> testHandle(returnValue, returnType);
<ide> }
<ide>
<add> @Test
<add> public void handleReturnValueLastModified() throws Exception {
<add> Instant currentTime = Instant.now().truncatedTo(ChronoUnit.SECONDS);
<add> Instant oneMinAgo = currentTime.minusSeconds(60);
<add> this.request.getHeaders().setIfModifiedSince(currentTime.toEpochMilli());
<add>
<add> ResponseEntity<String> entity = ok().lastModified(oneMinAgo.toEpochMilli()).body("body");
<add> HandlerResult result = handlerResult(entity, responseEntity(String.class));
<add> this.resultHandler.handleResult(this.exchange, result).block(Duration.ofSeconds(5));
<add>
<add> assertConditionalResponse(HttpStatus.NOT_MODIFIED, null, null, oneMinAgo);
<add> }
<add>
<add> @Test
<add> public void handleReturnValueEtag() throws Exception {
<add> String etagValue = "\"deadb33f8badf00d\"";
<add> this.request.getHeaders().setIfNoneMatch(etagValue);
<add>
<add> ResponseEntity<String> entity = ok().eTag(etagValue).body("body");
<add> HandlerResult result = handlerResult(entity, responseEntity(String.class));
<add> this.resultHandler.handleResult(this.exchange, result).block(Duration.ofSeconds(5));
<add>
<add> assertConditionalResponse(HttpStatus.NOT_MODIFIED, null, etagValue, Instant.MIN);
<add> }
<add>
<add> @Test // SPR-14559
<add> public void handleReturnValueEtagInvalidIfNoneMatch() throws Exception {
<add> this.request.getHeaders().setIfNoneMatch("unquoted");
<add>
<add> ResponseEntity<String> entity = ok().eTag("\"deadb33f8badf00d\"").body("body");
<add> HandlerResult result = handlerResult(entity, responseEntity(String.class));
<add> this.resultHandler.handleResult(this.exchange, result).block(Duration.ofSeconds(5));
<add>
<add> assertEquals(HttpStatus.OK, this.response.getStatusCode());
<add> assertResponseBody("body");
<add> }
<add>
<add> @Test
<add> public void handleReturnValueETagAndLastModified() throws Exception {
<add> String eTag = "\"deadb33f8badf00d\"";
<add> this.request.getHeaders().setIfNoneMatch(eTag);
<add>
<add> Instant currentTime = Instant.now().truncatedTo(ChronoUnit.SECONDS);
<add> Instant oneMinAgo = currentTime.minusSeconds(60);
<add> this.request.getHeaders().setIfModifiedSince(currentTime.toEpochMilli());
<add>
<add> ResponseEntity<String> entity = ok().eTag(eTag).lastModified(oneMinAgo.toEpochMilli()).body("body");
<add> HandlerResult result = handlerResult(entity, responseEntity(String.class));
<add> this.resultHandler.handleResult(this.exchange, result).block(Duration.ofSeconds(5));
<add>
<add> assertConditionalResponse(HttpStatus.NOT_MODIFIED, null, eTag, oneMinAgo);
<add> }
<add>
<add> @Test
<add> public void handleReturnValueChangedETagAndLastModified() throws Exception {
<add> String etag = "\"deadb33f8badf00d\"";
<add> String newEtag = "\"changed-etag-value\"";
<add> this.request.getHeaders().setIfNoneMatch(etag);
<add>
<add> Instant currentTime = Instant.now().truncatedTo(ChronoUnit.SECONDS);
<add> Instant oneMinAgo = currentTime.minusSeconds(60);
<add> this.request.getHeaders().setIfModifiedSince(currentTime.toEpochMilli());
<add>
<add> ResponseEntity<String> entity = ok().eTag(newEtag).lastModified(oneMinAgo.toEpochMilli()).body("body");
<add> HandlerResult result = handlerResult(entity, responseEntity(String.class));
<add> this.resultHandler.handleResult(this.exchange, result).block(Duration.ofSeconds(5));
<add>
<add> assertConditionalResponse(HttpStatus.OK, "body", newEtag, oneMinAgo);
<add> }
<add>
<ide>
<ide> private void testHandle(Object returnValue, ResolvableType type) {
<ide> HandlerResult result = handlerResult(returnValue, type);
<ide> private void assertResponseBody(String responseBody) {
<ide> DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)));
<ide> }
<ide>
<add> private void assertConditionalResponse(HttpStatus status, String body, String etag, Instant lastModified) {
<add> assertEquals(status, this.response.getStatusCode());
<add> if (body != null) {
<add> assertResponseBody(body);
<add> }
<add> else {
<add> assertNull(this.response.getBody());
<add> }
<add> if (etag != null) {
<add> assertEquals(1, this.response.getHeaders().get(HttpHeaders.ETAG).size());
<add> assertEquals(etag, this.response.getHeaders().getETag());
<add> }
<add> if (lastModified.isAfter(Instant.EPOCH)) {
<add> assertEquals(1, this.response.getHeaders().get(HttpHeaders.LAST_MODIFIED).size());
<add> assertEquals(lastModified.toEpochMilli(), this.response.getHeaders().getLastModified());
<add> }
<add> }
<add>
<ide>
<ide> @SuppressWarnings("unused")
<ide> private static class TestController { | 2 |
PHP | PHP | add windows support for withoutoverlapping | 6f3b61b5fd71c0d9632ac48d1473e3832ee019b8 | <ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> public function buildCommand()
<ide> $redirect = $this->shouldAppendOutput ? ' >> ' : ' > ';
<ide>
<ide> if ($this->withoutOverlapping) {
<del> $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$output.' 2>&1 &';
<add> if ($this->isWindowsEnvironment()){
<add> $command = '(echo \'\' > "'.$this->mutexPath().'" & '.$this->command.' & del "'.$this->mutexPath().'")'. $redirect.$output.' 2>&1 &';
<add> } else {
<add> $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$output.' 2>&1 &';
<add> }
<ide> } else {
<ide> $command = $this->command.$redirect.$output.' 2>&1 &';
<ide> }
<ide>
<ide> return $this->user ? 'sudo -u '.$this->user.' '.$command : $command;
<ide> }
<ide>
<add> /**
<add> * Determine if the current enviroment is windows
<add> *
<add> * @return boolean
<add> */
<add> protected function isWindowsEnvironment()
<add> {
<add> return (substr(strtoupper(php_uname('s')), 0, 3) === 'WIN');
<add> }
<add>
<ide> /**
<ide> * Get the mutex path for the scheduled command.
<ide> *
<ide> * @return string
<ide> */
<ide> protected function mutexPath()
<ide> {
<del> return storage_path('framework/schedule-'.sha1($this->expression.$this->command));
<add> return storage_path('framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command));
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | remove unused code | a1337320ea99b5e941d2b6bb2416fd973a3ae445 | <ide><path>client/next.js
<ide> import { render } from 'react-dom'
<ide> import HeadManager from './head-manager'
<ide> import { rehydrate } from '../lib/css'
<ide> import Router from '../lib/router'
<del>import DefaultApp from '../lib/app'
<add>import App from '../lib/app'
<ide> import evalScript from '../lib/eval-script'
<ide>
<ide> const {
<del> __NEXT_DATA__: { app, component, props, ids, err }
<add> __NEXT_DATA__: { component, props, ids, err }
<ide> } = window
<ide>
<del>const App = app ? evalScript(app).default : DefaultApp
<ide> const Component = evalScript(component).default
<ide>
<ide> export const router = new Router(window.location.href, { Component, ctx: { err } }) | 1 |
Ruby | Ruby | remove most uses of `column#cast_type` | 155b1b7fe3a1d231fb98a6fb04a21f6eb190b98f | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
<ide> def insert_fixture(fixture, table_name)
<ide> columns = schema_cache.columns_hash(table_name)
<ide>
<ide> binds = fixture.map do |name, value|
<del> Relation::QueryAttribute.new(name, value, columns[name].cast_type)
<add> type = lookup_cast_type_from_column(columns[name])
<add> Relation::QueryAttribute.new(name, value, type)
<ide> end
<ide> key_list = fixture.keys.map { |name| quote_column_name(name) }
<ide> value_list = prepare_binds_for_database(binds).map do |value|
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
<ide> def quote(value, column = nil)
<ide> https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
<ide> for more information.
<ide> MSG
<del> value = column.cast_type.type_cast_for_database(value)
<add> value = type_cast_from_column(column, value)
<ide> end
<ide>
<ide> _quote(value)
<ide> def type_cast(value, column = nil)
<ide> end
<ide>
<ide> if column
<del> value = column.cast_type.type_cast_for_database(value)
<add> value = type_cast_from_column(column, value)
<ide> end
<ide>
<ide> _type_cast(value)
<ide> def type_cast(value, column = nil)
<ide> raise TypeError, "can't cast #{value.class}#{to_type}"
<ide> end
<ide>
<add> # If you are having to call this function, you are likely doing something
<add> # wrong. The column does not have sufficient type information if the user
<add> # provided a custom type on the class level either explicitly (via
<add> # `attribute`) or implicitly (via `serialize`,
<add> # `time_zone_aware_attributes`). In almost all cases, the sql type should
<add> # only be used to change quoting behavior, when the primitive to
<add> # represent the type doesn't sufficiently reflect the differences
<add> # (varchar vs binary) for example. The type used to get this primitive
<add> # should have been provided before reaching the connection adapter.
<add> def type_cast_from_column(column, value) # :nodoc:
<add> if column
<add> type = lookup_cast_type_from_column(column)
<add> type.type_cast_for_database(value)
<add> else
<add> value
<add> end
<add> end
<add>
<add> # See docs for +type_cast_from_column+
<add> def lookup_cast_type_from_column(column) # :nodoc:
<add> lookup_cast_type(column.sql_type)
<add> end
<add>
<ide> # Quotes a string, escaping any ' (single quote) and \ (backslash)
<ide> # characters.
<ide> def quote_string(s)
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/column.rb
<ide> module ActiveRecord
<ide> module ConnectionAdapters
<ide> # PostgreSQL-specific extensions to column definitions in a table.
<ide> class PostgreSQLColumn < Column #:nodoc:
<del> attr_reader :array
<add> attr_reader :array, :oid, :fmod
<ide> alias :array? :array
<ide>
<del> def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil)
<add> def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil, oid = nil, fmod = nil)
<ide> if sql_type =~ /\[\]$/
<ide> @array = true
<ide> sql_type = sql_type[0..sql_type.length - 3]
<ide> else
<ide> @array = false
<ide> end
<del> super
<add> @oid = oid
<add> @fmod = fmod
<add> super(name, default, cast_type, sql_type, null, default_function)
<ide> end
<ide>
<ide> def serial?
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
<ide> def quote_default_value(value, column) #:nodoc:
<ide> if column.type == :uuid && value =~ /\(\)/
<ide> value
<ide> else
<del> value = column.cast_type.type_cast_for_database(value)
<add> value = type_cast_from_column(column, value)
<ide> quote(value)
<ide> end
<ide> end
<ide>
<add> def lookup_cast_type_from_column(column) # :nodoc:
<add> type_map.lookup(column.oid, column.fmod, column.sql_type)
<add> end
<add>
<ide> private
<ide>
<ide> def _quote(value)
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
<ide> def indexes(table_name, name = nil)
<ide> def columns(table_name)
<ide> # Limit, precision, and scale are all handled by the superclass.
<ide> column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod|
<del> oid = get_oid_type(oid.to_i, fmod.to_i, column_name, type)
<del> default_value = extract_value_from_default(oid, default)
<add> oid = oid.to_i
<add> fmod = fmod.to_i
<add> cast_type = get_oid_type(oid, fmod, column_name, type)
<add> default_value = extract_value_from_default(cast_type, default)
<ide> default_function = extract_default_function(default_value, default)
<del> new_column(column_name, default_value, oid, type, notnull == 'f', default_function)
<add> new_column(column_name, default_value, cast_type, type, notnull == 'f', default_function, oid, fmod)
<ide> end
<ide> end
<ide>
<del> def new_column(name, default, cast_type, sql_type = nil, null = true, default_function = nil) # :nodoc:
<del> PostgreSQLColumn.new(name, default, cast_type, sql_type, null, default_function)
<add> def new_column(name, default, cast_type, sql_type = nil, null = true, default_function = nil, oid = nil, fmod = nil) # :nodoc:
<add> PostgreSQLColumn.new(name, default, cast_type, sql_type, null, default_function, oid, fmod)
<ide> end
<ide>
<ide> # Returns the current database name.
<ide><path>activerecord/lib/active_record/type_caster/connection.rb
<ide> def initialize(klass, table_name)
<ide>
<ide> def type_cast_for_database(attribute_name, value)
<ide> return value if value.is_a?(Arel::Nodes::BindParam)
<del> type = type_for(attribute_name)
<del> type.type_cast_for_database(value)
<add> column = column_for(attribute_name)
<add> connection.type_cast_from_column(column, value)
<ide> end
<ide>
<ide> protected
<ide> def type_cast_for_database(attribute_name, value)
<ide>
<ide> private
<ide>
<del> def type_for(attribute_name)
<add> def column_for(attribute_name)
<ide> if connection.schema_cache.table_exists?(table_name)
<del> column_for(attribute_name).cast_type
<del> else
<del> Type::Value.new
<add> connection.schema_cache.columns_hash(table_name)[attribute_name.to_s]
<ide> end
<ide> end
<del>
<del> def column_for(attribute_name)
<del> connection.schema_cache.columns_hash(table_name)[attribute_name.to_s]
<del> end
<ide> end
<ide> end
<ide> end | 6 |
Go | Go | fix golint error | e02a3d9f5ba3bd9fa7f21596a6ee784bb58053f9 | <ide><path>daemon/reload.go
<ide> func (daemon *Daemon) Reload(conf *config.Config) (err error) {
<ide> if err := daemon.reloadLiveRestore(conf, attributes); err != nil {
<ide> return err
<ide> }
<del> if err := daemon.reloadNetworkDiagnosticPort(conf, attributes); err != nil {
<del> return err
<del> }
<del> return nil
<add> return daemon.reloadNetworkDiagnosticPort(conf, attributes)
<ide> }
<ide>
<ide> // reloadDebug updates configuration with Debug option | 1 |
Ruby | Ruby | remove collection ivar | 76ea105ca1e9c14d0bce9ddb330369792f720438 | <ide><path>actionview/lib/action_view/renderer/collection_renderer.rb
<ide> def each_with_info
<ide> end
<ide>
<ide> def render_collection_with_partial(collection, partial, context, block)
<del> @collection = build_collection_iterator(collection, partial, context)
<add> collection = build_collection_iterator(collection, partial, context)
<ide>
<ide> if @options[:cached] && !partial
<ide> raise NotImplementedError, "render caching requires a template. Please specify a partial when rendering"
<ide> def render_collection_with_partial(collection, partial, context, block)
<ide> layout = find_template(layout.to_s, template_keys(partial))
<ide> end
<ide>
<del> render_collection(context, template, partial, layout)
<add> render_collection(collection, context, template, partial, layout)
<ide> end
<ide>
<ide> def render_collection_derive_partial(collection, context, block)
<ide> def build_collection_iterator(collection, path, context)
<ide> end
<ide> end
<ide>
<del> def render_collection(view, template, path, layout)
<add> def render_collection(collection, view, template, path, layout)
<ide> identifier = (template && template.identifier) || path
<del> instrument(:collection, identifier: identifier, count: @collection.size) do |payload|
<add> instrument(:collection, identifier: identifier, count: collection.size) do |payload|
<ide> spacer = if @options.key?(:spacer_template)
<ide> spacer_template = find_template(@options[:spacer_template], @locals.keys)
<ide> build_rendered_template(spacer_template.render(view, @locals), spacer_template)
<ide> def render_collection(view, template, path, layout)
<ide> end
<ide>
<ide> collection_body = if template
<del> cache_collection_render(payload, view, template, @collection) do |collection|
<add> cache_collection_render(payload, view, template, collection) do |collection|
<ide> collection_with_template(view, template, layout, collection)
<ide> end
<ide> else
<del> collection_with_template(view, nil, layout, @collection)
<add> collection_with_template(view, nil, layout, collection)
<ide> end
<ide>
<ide> return RenderedCollection.empty(@lookup_context.formats.first) if collection_body.empty? | 1 |
Text | Text | update broken link to dashboard | 8399dd543aec2b7becf9d593f94084155de2502d | <ide><path>tools/dashboard/README.md
<ide> 
<ide>
<del># contribute
<add># Contribute
<ide>
<del>Tools to help maintain [freeCodeCamp.org](https://www.freecodecamp.org)'s Open Source Codebase on GitHub. Dashboard is available at https://contribute.freecodecamp.org/home
<add>Tools to help maintain [freeCodeCamp.org](https://www.freecodecamp.org)'s Open Source Codebase on GitHub. We are currently working on creating a tools dashboard for helping you review PRs and translations. Hangout with us in the [contributor's chat room](https://gitter.im/FreeCodeCamp/Contributors) to learn more. | 1 |
Text | Text | fix column names on customer model | f73d9c2473f4810f33a6487ed4059f431a0afc67 | <ide><path>guides/source/active_record_querying.md
<ide> SELECT DISTINCT status FROM orders
<ide> => ["shipped", "being_packed", "cancelled"]
<ide>
<ide> irb> Customer.pluck(:id, :first_name)
<del>SELECT customers.id, customers.name FROM customers
<add>SELECT customers.id, customers.first_name FROM customers
<ide> => [[1, "David"], [2, "Fran"], [3, "Jose"]]
<ide> ```
<ide>
<ide> Customer.select(:id).map { |c| c.id }
<ide> # or
<ide> Customer.select(:id).map(&:id)
<ide> # or
<del>Customer.select(:id, :name).map { |c| [c.id, c.first_name] }
<add>Customer.select(:id, :first_name).map { |c| [c.id, c.first_name] }
<ide> ```
<ide>
<ide> with:
<ide> one of those records exists.
<ide> ```ruby
<ide> Customer.exists?(id: [1,2,3])
<ide> # or
<del>Customer.exists?(name: ['Jane', 'Sergei'])
<add>Customer.exists?(first_name: ['Jane', 'Sergei'])
<ide> ```
<ide>
<ide> It's even possible to use `exists?` without any arguments on a model or a relation. | 1 |
Text | Text | fix typo in testing guide | e50debf1ae0c7211f48b93693ec7e49eafd1e487 | <ide><path>guides/source/testing.md
<ide> class UserMailerTest < ActionMailer::TestCase
<ide> end
<ide> ```
<ide>
<del>In the test we send the email and store the returned object in the `email`
<add>In the test we create the email and store the returned object in the `email`
<ide> variable. We then ensure that it was sent (the first assert), then, in the
<ide> second batch of assertions, we ensure that the email does indeed contain what we
<ide> expect. The helper `read_fixture` is used to read in the content from this file. | 1 |
Java | Java | equalize copy of channelsendoperator | 003247dc40dd0a194c69ce51aa64dd1a0dd69657 | <ide><path>spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/ChannelSendOperator.java
<ide> public final void onComplete() {
<ide> else if (this.state == State.NEW) {
<ide> this.completed = true;
<ide> this.state = State.FIRST_SIGNAL_RECEIVED;
<del> writeFunction.apply(this).subscribe(this.writeCompletionBarrier);
<add> Publisher<Void> result;
<add> try {
<add> result = writeFunction.apply(this);
<add> }
<add> catch (Throwable ex) {
<add> this.writeCompletionBarrier.onError(ex);
<add> return;
<add> }
<add> result.subscribe(this.writeCompletionBarrier);
<ide> }
<ide> else {
<ide> this.completed = true; | 1 |
PHP | PHP | remove comments, and fix debug transport for email | 212028cda2978e14bb16c931478eee67f6f83b9e | <ide><path>lib/Cake/Network/Email/DebugTransport.php
<ide> class DebugTransport extends AbstractTransport {
<ide> * @return array
<ide> */
<ide> public function send(CakeEmail $email) {
<del> $headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'));
<add> $headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'));
<ide> $headers = $this->_headersToString($headers);
<ide> $message = implode("\r\n", (array)$email->message());
<ide> return array('headers' => $headers, 'message' => $message);
<ide><path>lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
<ide> public function testSend() {
<ide> $headers = "From: CakePHP Test <noreply@cakephp.org>\r\n";
<ide> $headers .= "To: CakePHP <cake@cakephp.org>\r\n";
<ide> $headers .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>\r\n";
<del> $headers .= "Bcc: phpnut@cakephp.org\r\n";
<ide> $headers .= "X-Mailer: CakePHP Email\r\n";
<ide> $headers .= "Date: " . date(DATE_RFC2822) . "\r\n";
<ide> $headers .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>\r\n";
<ide> $headers .= "Subject: Testing Message\r\n";
<ide> $headers .= "MIME-Version: 1.0\r\n";
<ide> $headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
<del> $headers .= "Content-Transfer-Encoding: 7bit";
<add> $headers .= "Content-Transfer-Encoding: 8bit";
<ide>
<ide> $data = "First Line\r\n";
<ide> $data .= "Second Line\r\n";
<ide><path>lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
<ide> public function testSendData() {
<ide> $data = "From: CakePHP Test <noreply@cakephp.org>\r\n";
<ide> $data .= "To: CakePHP <cake@cakephp.org>\r\n";
<ide> $data .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>\r\n";
<del> //$data .= "Bcc: phpnut@cakephp.org\r\n";
<ide> $data .= "X-Mailer: CakePHP Email\r\n";
<ide> $data .= "Date: " . date(DATE_RFC2822) . "\r\n";
<ide> $data .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>\r\n"; | 3 |
Javascript | Javascript | add colorwrite to material copy method | 4847d475f77e3435e9ca95c1ce2a122d6d6c5355 | <ide><path>src/materials/Material.js
<ide> THREE.Material.prototype = {
<ide> this.depthTest = source.depthTest;
<ide> this.depthWrite = source.depthWrite;
<ide>
<add> this.colorWrite = source.colorWrite;
<add>
<ide> this.precision = source.precision;
<ide>
<ide> this.polygonOffset = source.polygonOffset; | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.