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 |
|---|---|---|---|---|---|
Text | Text | use ## for intro heading | c089fc20746b7d6aa06e0483550c702899e5c222 | <ide><path>docs/intro.md
<del># Welcome to the Atom guide
<add>## Welcome to the Atom guide | 1 |
Python | Python | use keepdims in favor of re-inserting dimensions | 4bdcbab61d996a1839ee521c0ca92457d00f876e | <ide><path>numpy/lib/arraypad.py
<ide> def _prepend_max(arr, pad_amt, num, axis=-1):
<ide> max_slice = tuple(slice(None) if i != axis else slice(num)
<ide> for (i, x) in enumerate(arr.shape))
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate max, reshape to add singleton dimension back
<del> max_chunk = arr[max_slice].max(axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate max
<add> max_chunk = arr[max_slice].max(axis=axis, keepdims=True)
<ide>
<ide> # Concatenate `arr` with `max_chunk`, extended along `axis` by `pad_amt`
<ide> return np.concatenate((max_chunk.repeat(pad_amt, axis=axis), arr),
<ide> def _append_max(arr, pad_amt, num, axis=-1):
<ide> else:
<ide> max_slice = tuple(slice(None) for x in arr.shape)
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate max, reshape to add singleton dimension back
<del> max_chunk = arr[max_slice].max(axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate max
<add> max_chunk = arr[max_slice].max(axis=axis, keepdims=True)
<ide>
<ide> # Concatenate `arr` with `max_chunk`, extended along `axis` by `pad_amt`
<ide> return np.concatenate((arr, max_chunk.repeat(pad_amt, axis=axis)),
<ide> def _prepend_mean(arr, pad_amt, num, axis=-1):
<ide> mean_slice = tuple(slice(None) if i != axis else slice(num)
<ide> for (i, x) in enumerate(arr.shape))
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate mean, reshape to add singleton dimension back
<del> mean_chunk = arr[mean_slice].mean(axis).reshape(pad_singleton)
<add> # Extract slice, calculate mean
<add> mean_chunk = arr[mean_slice].mean(axis, keepdims=True)
<ide> _round_ifneeded(mean_chunk, arr.dtype)
<ide>
<ide> # Concatenate `arr` with `mean_chunk`, extended along `axis` by `pad_amt`
<ide> def _append_mean(arr, pad_amt, num, axis=-1):
<ide> else:
<ide> mean_slice = tuple(slice(None) for x in arr.shape)
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate mean, reshape to add singleton dimension back
<del> mean_chunk = arr[mean_slice].mean(axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate mean
<add> mean_chunk = arr[mean_slice].mean(axis=axis, keepdims=True)
<ide> _round_ifneeded(mean_chunk, arr.dtype)
<ide>
<ide> # Concatenate `arr` with `mean_chunk`, extended along `axis` by `pad_amt`
<ide> def _prepend_med(arr, pad_amt, num, axis=-1):
<ide> med_slice = tuple(slice(None) if i != axis else slice(num)
<ide> for (i, x) in enumerate(arr.shape))
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate median, reshape to add singleton dimension back
<del> med_chunk = np.median(arr[med_slice], axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate median
<add> med_chunk = np.median(arr[med_slice], axis=axis, keepdims=True)
<ide> _round_ifneeded(med_chunk, arr.dtype)
<ide>
<ide> # Concatenate `arr` with `med_chunk`, extended along `axis` by `pad_amt`
<ide> def _append_med(arr, pad_amt, num, axis=-1):
<ide> else:
<ide> med_slice = tuple(slice(None) for x in arr.shape)
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate median, reshape to add singleton dimension back
<del> med_chunk = np.median(arr[med_slice], axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate median
<add> med_chunk = np.median(arr[med_slice], axis=axis, keepdims=True)
<ide> _round_ifneeded(med_chunk, arr.dtype)
<ide>
<ide> # Concatenate `arr` with `med_chunk`, extended along `axis` by `pad_amt`
<ide> def _prepend_min(arr, pad_amt, num, axis=-1):
<ide> min_slice = tuple(slice(None) if i != axis else slice(num)
<ide> for (i, x) in enumerate(arr.shape))
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate min, reshape to add singleton dimension back
<del> min_chunk = arr[min_slice].min(axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate min
<add> min_chunk = arr[min_slice].min(axis=axis, keepdims=True)
<ide>
<ide> # Concatenate `arr` with `min_chunk`, extended along `axis` by `pad_amt`
<ide> return np.concatenate((min_chunk.repeat(pad_amt, axis=axis), arr),
<ide> def _append_min(arr, pad_amt, num, axis=-1):
<ide> else:
<ide> min_slice = tuple(slice(None) for x in arr.shape)
<ide>
<del> # Shape to restore singleton dimension after slicing
<del> pad_singleton = tuple(x if i != axis else 1
<del> for (i, x) in enumerate(arr.shape))
<del>
<del> # Extract slice, calculate min, reshape to add singleton dimension back
<del> min_chunk = arr[min_slice].min(axis=axis).reshape(pad_singleton)
<add> # Extract slice, calculate min
<add> min_chunk = arr[min_slice].min(axis=axis, keepdims=True)
<ide>
<ide> # Concatenate `arr` with `min_chunk`, extended along `axis` by `pad_amt`
<ide> return np.concatenate((arr, min_chunk.repeat(pad_amt, axis=axis)), | 1 |
Javascript | Javascript | define a launcher for ie11 (saucelabs) | 041057232206e07164ed0aa4ecb9abe0f3fc23f4 | <ide><path>karma-shared.conf.js
<ide> module.exports = function(config, specificOptions) {
<ide> platform: 'Windows 2012',
<ide> version: '10'
<ide> },
<add> 'SL_IE_11': {
<add> base: 'SauceLabs',
<add> browserName: 'internet explorer',
<add> platform: 'Windows 8.1',
<add> version: '11'
<add> },
<ide>
<ide> 'BS_Chrome': {
<ide> base: 'BrowserStack', | 1 |
Javascript | Javascript | add jshint to the test task | 3e79c9b09850899038f8609649de60ec326b8d10 | <ide><path>Gruntfile.js
<ide> module.exports = function(grunt) {
<ide>
<ide>
<ide> //alias tasks
<del> grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e']);
<add> grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e']);
<ide> grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
<ide> grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
<ide> grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']); | 1 |
Python | Python | isolate numeric compatibility to numpy.linalg.old | db77da02aced7b10bd3fd8306cf66d88a0e8800e | <ide><path>numpy/lib/convertcode.py
<ide> def fromstr(filestr):
<ide> filestr, fromall2 = changeimports(filestr, 'numerix', 'numpy')
<ide> filestr, fromall3 = changeimports(filestr, 'numpy_base', 'numpy')
<ide> filestr, fromall3 = changeimports(filestr, 'MLab', 'numpy.lib.mlab')
<del> filestr, fromall3 = changeimports(filestr, 'LinearAlgebra', 'numpy.linalg')
<add> filestr, fromall3 = changeimports(filestr, 'LinearAlgebra',
<add> 'numpy.linalg.old')
<ide> filestr, fromall3 = changeimports(filestr, 'RNG', 'numpy.random')
<ide> filestr, fromall3 = changeimports(filestr, 'RandomArray', 'numpy.random')
<ide> filestr, fromall3 = changeimports(filestr, 'FFT', 'numpy.dft')
<ide><path>numpy/linalg/linalg.py
<ide> # only accesses the following LAPACK functions: dgesv, zgesv, dgeev,
<ide> # zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, dpotrf.
<ide>
<del>__all__ = ['LinAlgError', 'solve_linear_equations', 'solve',
<del> 'inverse', 'inv', 'cholesky_decomposition', 'cholesky', 'eigenvalues',
<del> 'eigvals', 'Heigenvalues', 'eigvalsh', 'generalized_inverse', 'pinv',
<del> 'determinant', 'det', 'singular_value_decomposition', 'svd',
<del> 'eigenvectors', 'eig', 'Heigenvectors', 'eigh','lstsq', 'norm',
<del> 'linear_least_squares'
<add>__all__ = ['solve',
<add> 'inv', 'cholesky',
<add> 'eigvals',
<add> 'eigvalsh', 'pinv',
<add> 'det', 'svd',
<add> 'eig', 'eigh','lstsq', 'norm',
<ide> ]
<ide>
<ide> from numpy.core import *
<ide> from numpy.lib import *
<ide> import lapack_lite
<ide>
<del># Error object
<del>class LinAlgError(Exception):
<del> pass
<del>
<ide> # Helper routines
<ide> _lapack_type = {'f': 0, 'd': 1, 'F': 2, 'D': 3}
<ide> _lapack_letter = ['s', 'd', 'c', 'z']
<ide> def _assertSquareness(*arrays):
<ide> if max(a.shape) != min(a.shape):
<ide> raise LinAlgError, 'Array must be square'
<ide>
<del>
<ide> # Linear equations
<ide>
<del>def solve_linear_equations(a, b):
<add>def solve(a, b):
<ide> one_eq = len(b.shape) == 1
<ide> if one_eq:
<ide> b = b[:, NewAxis]
<ide> def solve_linear_equations(a, b):
<ide>
<ide> # Matrix inversion
<ide>
<del>def inverse(a):
<add>def inv(a):
<ide> a, wrap = _makearray(a)
<ide> return wrap(solve_linear_equations(a, identity(a.shape[0])))
<ide>
<del>
<ide> # Cholesky decomposition
<ide>
<del>def cholesky_decomposition(a):
<add>def cholesky(a):
<ide> _assertRank2(a)
<ide> _assertSquareness(a)
<ide> t =_commonType(a)
<ide> def cholesky_decomposition(a):
<ide>
<ide>
<ide> # Eigenvalues
<del>
<del>def eigenvalues(a):
<add>def eigvals(a):
<ide> _assertRank2(a)
<ide> _assertSquareness(a)
<ide> t =_commonType(a)
<ide> def eigenvalues(a):
<ide> return w
<ide>
<ide>
<del>def Heigenvalues(a, UPLO='L'):
<add>def eigvalsh(a, UPLO='L'):
<ide> _assertRank2(a)
<ide> _assertSquareness(a)
<ide> t =_commonType(a)
<ide> def svd(a, full_matrices=1, compute_uv=1):
<ide>
<ide> # Generalized inverse
<ide>
<del>def generalized_inverse(a, rcond = 1.e-10):
<add>def pinv(a, rcond = 1.e-10):
<ide> a, wrap = _makearray(a)
<ide> if a.dtype.char in typecodes['Complex']:
<ide> a = conjugate(a)
<ide> def generalized_inverse(a, rcond = 1.e-10):
<ide>
<ide> # Determinant
<ide>
<del>def determinant(a):
<add>def det(a):
<ide> a = asarray(a)
<ide> _assertRank2(a)
<ide> _assertSquareness(a)
<ide> def determinant(a):
<ide>
<ide> # Linear Least Squares
<ide>
<del>def linear_least_squares(a, b, rcond=1.e-10):
<add>def lstsq(a, b, rcond=1.e-10):
<ide> """returns x,resids,rank,s
<ide> where x minimizes 2-norm(|b - Ax|)
<ide> resids is the sum square residuals
<ide> def linear_least_squares(a, b, rcond=1.e-10):
<ide> resids = sum((transpose(bstar)[n:,:])**2).copy()
<ide> return wrap(x),resids,results['rank'],s[:min(n,m)].copy()
<ide>
<del>def singular_value_decomposition(A, full_matrices=0):
<del> return svd(A, full_matrices)
<del>
<del>def eigenvectors(A):
<del> w, v = eig(A)
<del> return w, transpose(v)
<del>
<del>def Heigenvectors(A):
<del> w, v = eigh(A)
<del> return w, transpose(v)
<del>
<ide> def norm(x, ord=None):
<ide> """ norm(x, ord=None) -> n
<ide>
<ide> def norm(x, ord=None):
<ide> else:
<ide> raise ValueError, "Improper number of dimensions to norm."
<ide>
<del>
<del>
<del>inv = inverse
<del>solve = solve_linear_equations
<del>cholesky = cholesky_decomposition
<del>eigvals = eigenvalues
<del>eigvalsh = Heigenvalues
<del>pinv = generalized_inverse
<del>det = determinant
<del>lstsq = linear_least_squares
<del>
<ide> if __name__ == '__main__':
<ide> def test(a, b):
<ide>
<ide> print "All numbers printed should be (almost) zero:"
<ide>
<del> x = solve_linear_equations(a, b)
<add> x = solve(a, b)
<ide> check = b - matrixmultiply(a, x)
<ide> print check
<ide>
<ide>
<del> a_inv = inverse(a)
<add> a_inv = inv(a)
<ide> check = matrixmultiply(a, a_inv)-identity(a.shape[0])
<ide> print check
<ide>
<ide>
<del> ev = eigenvalues(a)
<add> ev = eigvals(a)
<ide>
<ide> evalues, evectors = eig(a)
<ide> check = ev-evalues
<ide> def test(a, b):
<ide> print check
<ide>
<ide>
<del> a_ginv = generalized_inverse(a)
<add> a_ginv = pinv(a)
<ide> check = matrixmultiply(a, a_ginv)-identity(a.shape[0])
<ide> print check
<ide>
<ide>
<del> det = determinant(a)
<add> det = det(a)
<ide> check = det-multiply.reduce(evalues)
<ide> print check
<ide>
<del> x, residuals, rank, sv = linear_least_squares(a, b)
<add> x, residuals, rank, sv = lstsq(a, b)
<ide> check = b - matrixmultiply(a, x)
<ide> print check
<ide> print rank-a.shape[0]
<ide><path>numpy/linalg/old.py
<add>
<add>"""Backward compatible with LinearAlgebra from Numeric
<add>"""
<add># This module is a lite version of the linalg.py module in SciPy which contains
<add># high-level Python interface to the LAPACK library. The lite version
<add># only accesses the following LAPACK functions: dgesv, zgesv, dgeev,
<add># zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, dpotrf.
<add>
<add>
<add>__all__ = ['LinAlgError', 'solve_linear_equations',
<add> 'inverse', 'cholesky_decomposition', 'eigenvalues',
<add> 'Heigenvalues', 'generalized_inverse',
<add> 'determinant', 'singular_value_decomposition',
<add> 'eigenvectors', 'Heigenvectors',
<add> 'linear_least_squares'
<add> ]
<add>
<add>from numpy.core import transpose
<add>import numpy.linalg as linalg
<add>
<add># Error object
<add>class LinAlgError(Exception):
<add> pass
<add>
<add># Linear equations
<add>
<add>def solve_linear_equations(a, b):
<add> return linalg.solve(a,b)
<add>
<add># Matrix inversion
<add>
<add>def inverse(a):
<add> return linalg.inv(a)
<add>
<add># Cholesky decomposition
<add>
<add>def cholesky_decomposition(a):
<add> return linalg.cholesky(a)
<add>
<add># Eigenvalues
<add>
<add>def eigenvalues(a):
<add> return linalg.eigvals(a)
<add>
<add>def Heigenvalues(a, UPLO='L'):
<add> return linalg.eigvalsh(a,UPLO)
<add>
<add># Eigenvectors
<add>
<add>def eigenvectors(A):
<add> w, v = linalg.eig(A)
<add> return w, transpose(v)
<add>
<add>def Heigenvectors(A):
<add> w, v = linalg.eigh(A)
<add> return w, transpose(v)
<add>
<add># Generalized inverse
<add>
<add>def generalized_inverse(a, rcond = 1.e-10):
<add> return linalg.pinv(a, rcond)
<add>
<add># Determinant
<add>
<add>def determinant(a):
<add> return linalg.det(a)
<add>
<add># Linear Least Squares
<add>
<add>def linear_least_squares(a, b, rcond=1.e-10):
<add> """returns x,resids,rank,s
<add>where x minimizes 2-norm(|b - Ax|)
<add> resids is the sum square residuals
<add> rank is the rank of A
<add> s is the rank of the singular values of A in descending order
<add>
<add>If b is a matrix then x is also a matrix with corresponding columns.
<add>If the rank of A is less than the number of columns of A or greater than
<add>the number of rows, then residuals will be returned as an empty array
<add>otherwise resids = sum((b-dot(A,x)**2).
<add>Singular values less than s[0]*rcond are treated as zero.
<add>"""
<add> return linalg.lstsq(a,b,rcond)
<add>
<add>def singular_value_decomposition(A, full_matrices=0):
<add> return linalg.svd(A, full_matrices) | 3 |
Ruby | Ruby | fix strange messages for `rails g foo` | 3215c6b743fa6fc99ad371c1fcbbbbb8c9f2bc61 | <ide><path>railties/lib/rails/generators.rb
<ide> def self.invoke(namespace, args=ARGV, config={})
<ide> options = sorted_groups.flat_map(&:last)
<ide> suggestions = options.sort_by {|suggested| levenshtein_distance(namespace.to_s, suggested) }.first(3)
<ide> msg = "Could not find generator '#{namespace}'. "
<del> msg << "Maybe you meant #{ suggestions.map {|s| "'#{s}'"}.to_sentence(last_word_connector: " or ") }\n"
<add> msg << "Maybe you meant #{ suggestions.map {|s| "'#{s}'"}.to_sentence(last_word_connector: " or ", locale: :en) }\n"
<ide> msg << "Run `rails generate --help` for more options."
<ide> puts msg
<ide> end | 1 |
Javascript | Javascript | create links to forumtopicids or search | 16551d2ad6e2f097eea1cef4722e637bf673d8ad | <ide><path>client/src/templates/Challenges/classic/Show.js
<ide> class ShowClassic extends Component {
<ide> }
<ide>
<ide> getGuideUrl() {
<del> const {
<del> fields: { slug }
<del> } = this.getChallenge();
<del> return createGuideUrl(slug);
<add> const { forumTopicId, title } = this.getChallenge();
<add> return forumTopicId
<add> ? 'https://www.freecodecamp.org/forum/t/' + forumTopicId
<add> : createGuideUrl(title);
<ide> }
<ide>
<ide> getVideoUrl = () => this.getChallenge().videoUrl;
<ide> export const query = graphql`
<ide> instructions
<ide> challengeType
<ide> videoUrl
<add> forumTopicId
<ide> fields {
<ide> slug
<ide> blockName
<ide><path>client/src/templates/Challenges/utils/index.js
<ide> const guideBase = 'https://www.freecodecamp.org/forum/search?q=';
<ide>
<del>export function createGuideUrl(slug = '') {
<del> return (
<del> guideBase +
<del> slug.substring(slug.lastIndexOf('/') + 1) +
<del> '%20%40camperbot%20%23guide'
<del> );
<add>export function createGuideUrl(title = '') {
<add> return guideBase + title + '%20in%3Atitle%20order%3Aviews';
<ide> }
<ide>
<ide> export function isGoodXHRStatus(status) { | 2 |
Mixed | PHP | allow starter closure for bundles | 7af5afc4b5d6af58149dc0ca4c85451a142ba39a | <ide><path>laravel/bundle.php
<ide> public static function start($bundle)
<ide>
<ide> // Each bundle may have a start script which is responsible for preparing
<ide> // the bundle for use by the application. The start script may register
<del> // any classes the bundle uses with the auto-loader, etc.
<del> if (file_exists($path = static::path($bundle).'start'.EXT))
<add> // any classes the bundle uses with the auto-loader class, etc.
<add> if ( ! is_null($starter = static::option($bundle, 'starter')))
<add> {
<add> $starter();
<add> }
<add> elseif (file_exists($path = static::path($bundle).'start'.EXT))
<ide> {
<ide> require $path;
<ide> }
<ide><path>laravel/documentation/changes.md
<ide> - Added `array_pluck` helper, similar to pluck method in Underscore.js.
<ide> - Allow the registration of custom cache and session drivers.
<ide> - Allow the specification of a separate asset base URL for using CDNs.
<add>- Allow a `starter` Closure to be defined in `bundles.php` to be run on Bundle::start.
<ide>
<ide> <a name="upgrade-3.2"></a>
<ide> ## Upgrading From 3.1 | 2 |
Text | Text | add note about vendoring dependencies | 8ac3cd0e7078055a92e27c0f2e98138e1f2bfab4 | <ide><path>docs/Acceptable-Formulae.md
<ide> Clang is the default C/C++ compiler on macOS (and has been for a long time). Sof
<ide> ### Stuff that requires heavy manual pre/post-install intervention
<ide> We're a package manager so we want to do things like resolve dependencies and set up applications for our users. If things require too much manual intervention then they aren't useful in a package manager.
<ide>
<add>## Stuff that requires vendored versions of homebrew formulae
<add>Homebrew formula should avoid having multiple, separate, upstream projects bundled together in a single package to avoid having shipping outdated/insecure versions of software that is already a formula.
<add>
<add>For more info see [Debian](https://www.debian.org/doc/debian-policy/ch-source.html#s-embeddedfiles) and [Fedora's](https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling) stance on this.
<add>
<ide> ### Sometimes there are exceptions
<ide> Even if all criteria are met we may not accept the formula.
<ide> Documentation tends to lag behind current decision-making. Although some | 1 |
Javascript | Javascript | add test for missing `close`/`finish` event | 9436a860cb599be0e3f64d3bccfa81e389aa9fa8 | <ide><path>test/parallel/test-http-response-close-event-race.js
<add>var common = require('../common');
<add>var assert = require('assert');
<add>var http = require('http');
<add>
<add>var clientRequest = null;
<add>var eventCount = 0;
<add>var testTickCount = 3;
<add>
<add>var server = http.createServer(function(req, res) {
<add> console.log('server: request');
<add>
<add> res.on('finish', function() {
<add> console.log('server: response finish');
<add> eventCount++;
<add> });
<add> res.on('close', function() {
<add> console.log('server: response close');
<add> eventCount++;
<add> });
<add>
<add> console.log('client: aborting request');
<add> clientRequest.abort();
<add>
<add> var ticks = 0;
<add> function tick() {
<add> console.log('server: tick ' + ticks +
<add> (req.connection.destroyed ? ' (connection destroyed!)' : ''));
<add>
<add> if (ticks < testTickCount) {
<add> ticks++;
<add> setImmediate(tick);
<add> } else {
<add> sendResponse();
<add> }
<add> }
<add> tick();
<add>
<add> function sendResponse() {
<add> console.log('server: sending response');
<add> res.writeHead(200, {'Content-Type': 'text/plain'});
<add> res.end('Response\n');
<add> console.log('server: res.end() returned');
<add>
<add> handleResponseEnd();
<add> }
<add>});
<add>
<add>server.on('listening', function() {
<add> console.log('server: listening on port ' + common.PORT);
<add> console.log('-----------------------------------------------------');
<add> startRequest();
<add>});
<add>
<add>server.on('connection', function(connection) {
<add> console.log('server: connection');
<add> connection.on('close', function() {
<add> console.log('server: connection close');
<add> });
<add>});
<add>
<add>server.on('close', function() {
<add> console.log('server: close');
<add>});
<add>
<add>server.listen(common.PORT);
<add>
<add>function startRequest() {
<add> console.log('client: starting request - testing with %d ticks after abort()',
<add> testTickCount);
<add> eventCount = 0;
<add>
<add> var options = {port: common.PORT, path: '/'};
<add> clientRequest = http.get(options, function() {});
<add> clientRequest.on('error', function() {});
<add>}
<add>
<add>function handleResponseEnd() {
<add> setImmediate(function() {
<add> setImmediate(function() {
<add> assert.equal(eventCount, 1);
<add>
<add> if (testTickCount > 0) {
<add> testTickCount--;
<add> startRequest();
<add> } else {
<add> server.close();
<add> }
<add> });
<add> });
<add>} | 1 |
Go | Go | fix daemon tests | 6d36431e2395867d7bb101dbfd4340e132fd5438 | <ide><path>integration-cli/docker_cli_daemon_experimental_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) {
<ide> c.Fatalf("Could not install plugin: %v %s", err, out)
<ide> }
<ide>
<add> defer func() {
<add> if out, err := s.d.Cmd("plugin", "disable", pluginName); err != nil {
<add> c.Fatalf("Could not disable plugin: %v %s", err, out)
<add> }
<add> if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
<add> c.Fatalf("Could not remove plugin: %v %s", err, out)
<add> }
<add> }()
<add>
<ide> if err := s.d.Restart(); err != nil {
<ide> c.Fatalf("Could not restart daemon: %v", err)
<ide> }
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) {
<ide> c.Fatalf("Could not install plugin: %v %s", err, out)
<ide> }
<ide>
<add> defer func() {
<add> if out, err := s.d.Cmd("plugin", "remove", pluginName); err != nil {
<add> c.Fatalf("Could not remove plugin: %v %s", err, out)
<add> }
<add> }()
<add>
<ide> if err := s.d.Restart(); err != nil {
<ide> c.Fatalf("Could not restart daemon: %v", err)
<ide> }
<ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check
<ide> }
<ide> cid = strings.TrimSpace(cid)
<ide>
<add> pid, err := s.d.Cmd("inspect", "-f", "{{.State.Pid}}", cid)
<add> t.Assert(err, check.IsNil)
<add> pid = strings.TrimSpace(pid)
<add>
<ide> // Kill the daemon
<ide> if err := s.d.Kill(); err != nil {
<ide> t.Fatal(err)
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check
<ide>
<ide> // Give time to containerd to process the command if we don't
<ide> // the exit event might be received after we do the inspect
<del> pidCmd := exec.Command("pidof", "top")
<add> pidCmd := exec.Command("kill", "-0", pid)
<ide> _, ec, _ := runCommandWithOutput(pidCmd)
<ide> for ec == 0 {
<del> time.Sleep(3 * time.Second)
<add> time.Sleep(1 * time.Second)
<ide> _, ec, _ = runCommandWithOutput(pidCmd)
<ide> }
<ide>
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che
<ide> }
<ide> cid = strings.TrimSpace(cid)
<ide>
<add> pid, err := s.d.Cmd("inspect", "-f", "{{.State.Pid}}", cid)
<add> t.Assert(err, check.IsNil)
<add> pid = strings.TrimSpace(pid)
<add>
<ide> // pause the container
<ide> if _, err := s.d.Cmd("pause", cid); err != nil {
<ide> t.Fatal(cid, err)
<ide> func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che
<ide>
<ide> // Give time to containerd to process the command if we don't
<ide> // the resume event might be received after we do the inspect
<del> pidCmd := exec.Command("pidof", "top")
<add> pidCmd := exec.Command("kill", "-0", pid)
<ide> _, ec, _ := runCommandWithOutput(pidCmd)
<ide> for ec == 0 {
<del> time.Sleep(3 * time.Second)
<add> time.Sleep(1 * time.Second)
<ide> _, ec, _ = runCommandWithOutput(pidCmd)
<ide> }
<ide> | 2 |
Ruby | Ruby | add a note on custom validation contexts | 2bb0abbec0e4abe843131f188129a1189b1bf714 | <ide><path>activemodel/lib/active_model/validations.rb
<ide> module ClassMethods
<ide> #
<ide> # Options:
<ide> # * <tt>:on</tt> - Specifies the contexts where this validation is active.
<del> # You can pass a symbol or an array of symbols.
<del> # (e.g. <tt>on: :create</tt> or <tt>on: :custom_validation_context</tt> or
<add> # Runs in all validation contexts by default (nil). You can pass a symbol
<add> # or an array of symbols. (e.g. <tt>on: :create</tt> or
<add> # <tt>on: :custom_validation_context</tt> or
<ide> # <tt>on: [:create, :custom_validation_context]</tt>)
<ide> # * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+.
<ide> # * <tt>:allow_blank</tt> - Skip validation if attribute is blank.
<ide> def validates_each(*attr_names, &block)
<ide> #
<ide> # Options:
<ide> # * <tt>:on</tt> - Specifies the contexts where this validation is active.
<del> # You can pass a symbol or an array of symbols.
<del> # (e.g. <tt>on: :create</tt> or <tt>on: :custom_validation_context</tt> or
<add> # Runs in all validation contexts by default (nil). You can pass a symbol
<add> # or an array of symbols. (e.g. <tt>on: :create</tt> or
<add> # <tt>on: :custom_validation_context</tt> or
<ide> # <tt>on: [:create, :custom_validation_context]</tt>)
<ide> # * <tt>:if</tt> - Specifies a method, proc or string to call to determine
<ide> # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
<ide><path>activemodel/lib/active_model/validations/validates.rb
<ide> module ClassMethods
<ide> #
<ide> # There is also a list of options that could be used along with validators:
<ide> #
<del> # * <tt>:on</tt> - Specifies when this validation is active. Runs in all
<del> # validation contexts by default (+nil+), other options are <tt>:create</tt>
<del> # and <tt>:update</tt>.
<add> # * <tt>:on</tt> - Specifies the contexts where this validation is active.
<add> # Runs in all validation contexts by default (nil). You can pass a symbol
<add> # or an array of symbols. (e.g. <tt>on: :create</tt> or
<add> # <tt>on: :custom_validation_context</tt> or
<add> # <tt>on: [:create, :custom_validation_context]</tt>)
<ide> # * <tt>:if</tt> - Specifies a method, proc or string to call to determine
<ide> # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
<ide> # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
<ide><path>activemodel/lib/active_model/validations/with.rb
<ide> module ClassMethods
<ide> # end
<ide> #
<ide> # Configuration options:
<del> # * <tt>:on</tt> - Specifies when this validation is active
<del> # (<tt>:create</tt> or <tt>:update</tt>).
<add> # * <tt>:on</tt> - Specifies the contexts where this validation is active.
<add> # Runs in all validation contexts by default (nil). You can pass a symbol
<add> # or an array of symbols. (e.g. <tt>on: :create</tt> or
<add> # <tt>on: :custom_validation_context</tt> or
<add> # <tt>on: [:create, :custom_validation_context]</tt>)
<ide> # * <tt>:if</tt> - Specifies a method, proc or string to call to determine
<ide> # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
<ide> # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>).
<ide><path>activerecord/lib/active_record/validations/associated.rb
<ide> module ClassMethods
<ide> # Configuration options:
<ide> #
<ide> # * <tt>:message</tt> - A custom error message (default is: "is invalid").
<del> # * <tt>:on</tt> - Specifies when this validation is active. Runs in all
<del> # validation contexts by default (+nil+), other options are <tt>:create</tt>
<del> # and <tt>:update</tt>.
<add> # * <tt>:on</tt> - Specifies the contexts where this validation is active.
<add> # Runs in all validation contexts by default (nil). You can pass a symbol
<add> # or an array of symbols. (e.g. <tt>on: :create</tt> or
<add> # <tt>on: :custom_validation_context</tt> or
<add> # <tt>on: [:create, :custom_validation_context]</tt>)
<ide> # * <tt>:if</tt> - Specifies a method, proc or string to call to determine
<ide> # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
<ide> # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
<ide><path>activerecord/lib/active_record/validations/presence.rb
<ide> module ClassMethods
<ide> #
<ide> # Configuration options:
<ide> # * <tt>:message</tt> - A custom error message (default is: "can't be blank").
<del> # * <tt>:on</tt> - Specifies when this validation is active. Runs in all
<del> # validation contexts by default (+nil+), other options are <tt>:create</tt>
<del> # and <tt>:update</tt>.
<add> # * <tt>:on</tt> - Specifies the contexts where this validation is active.
<add> # Runs in all validation contexts by default (nil). You can pass a symbol
<add> # or an array of symbols. (e.g. <tt>on: :create</tt> or
<add> # <tt>on: :custom_validation_context</tt> or
<add> # <tt>on: [:create, :custom_validation_context]</tt>)
<ide> # * <tt>:if</tt> - Specifies a method, proc or string to call to determine if
<ide> # the validation should occur (e.g. <tt>if: :allow_validation</tt>, or
<ide> # <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, proc | 5 |
Javascript | Javascript | fix missed renaming of settiming to applyanimation | 9ca853d4d1f587a50d26e3860869a57501ae19f2 | <ide><path>Libraries/CustomComponents/NavigationExperimental/NavigationCardStack.js
<ide> class NavigationCardStack extends React.Component {
<ide> navigationState={this.props.navigationState}
<ide> renderOverlay={this.props.renderOverlay}
<ide> renderScene={this._renderScene}
<del> setTiming={this._applyAnimation}
<add> applyAnimation={this._applyAnimation}
<ide> style={[styles.animatedView, this.props.style]}
<ide> />
<ide> ); | 1 |
PHP | PHP | add test for fix in | aca66f9007c96bb1e4d207c7cdf43ac1de28f74a | <ide><path>tests/TestCase/Network/Http/ClientTest.php
<ide> public function testGetSimpleWithHeadersAndCookies()
<ide> $this->assertSame($result, $response);
<ide> }
<ide>
<add> /**
<add> * test get request with no data
<add> *
<add> * @return void
<add> */
<add> public function testGetNoData()
<add> {
<add> $response = new Response();
<add>
<add> $mock = $this->getMockBuilder('Cake\Http\Client\Adapter\Stream')
<add> ->setMethods(['send'])
<add> ->getMock();
<add> $mock->expects($this->once())
<add> ->method('send')
<add> ->with($this->callback(function ($request) {
<add> $this->assertEquals(Request::METHOD_GET, $request->getMethod());
<add> $this->assertEmpty($request->getHeaderLine('Content-Type'), 'Should have no content-type set');
<add> $this->assertEquals(
<add> 'http://cakephp.org/search',
<add> $request->getUri() . ''
<add> );
<add>
<add> return true;
<add> }))
<add> ->will($this->returnValue([$response]));
<add>
<add> $http = new Client([
<add> 'host' => 'cakephp.org',
<add> 'adapter' => $mock
<add> ]);
<add> $result = $http->get('/search');
<add> $this->assertSame($result, $response);
<add> }
<add>
<ide> /**
<ide> * test get request with querystring data
<ide> * | 1 |
PHP | PHP | update exception message | 5a3e67a56edf4c0ab288d55fd2cec97d3d889f3d | <ide><path>src/Http/Cookie/Cookie.php
<ide> protected static function dateTimeInstance($expires): ?DateTimeInterface
<ide>
<ide> if (!is_string($expires) && !is_int($expires)) {
<ide> throw new InvalidArgumentException(sprintf(
<del> 'Invalid type `%s` for expires.',
<add> 'Invalid type `%s` for expires. Expected an string, integer or DateTime object.',
<ide> getTypeName($expires)
<ide> ));
<ide> } | 1 |
PHP | PHP | apply fixes from styleci | 127a83d8d2b1f3842b685982ac531936ef3030c4 | <ide><path>src/Illuminate/Http/Request.php
<ide> protected function getInputSource()
<ide> * @param \Illuminate\Http\Request|null $to
<ide> * @return static
<ide> */
<del> public static function createFrom(Request $from, $to = null)
<add> public static function createFrom(self $from, $to = null)
<ide> {
<ide> $request = $to ?: new static;
<ide> | 1 |
Go | Go | add workaround for gcr auth issue | bcd8298c35f53f79b42c6e089e8da114ddb5c57e | <ide><path>builder/builder-next/adapters/containerimage/pull.go
<ide> import (
<ide> "io/ioutil"
<ide> "runtime"
<ide> "sync"
<add> "sync/atomic"
<ide> "time"
<ide>
<ide> "github.com/containerd/containerd/content"
<ide> type SourceOpt struct {
<ide>
<ide> type imageSource struct {
<ide> SourceOpt
<del> g flightcontrol.Group
<add> g flightcontrol.Group
<add> resolverCache *resolverCache
<ide> }
<ide>
<ide> // NewSource creates a new image source
<ide> func NewSource(opt SourceOpt) (source.Source, error) {
<ide> is := &imageSource{
<del> SourceOpt: opt,
<add> SourceOpt: opt,
<add> resolverCache: newResolverCache(),
<ide> }
<ide>
<ide> return is, nil
<ide> func (is *imageSource) ID() string {
<ide> }
<ide>
<ide> func (is *imageSource) getResolver(ctx context.Context, rfn resolver.ResolveOptionsFunc, ref string, sm *session.Manager) remotes.Resolver {
<add> if res := is.resolverCache.Get(ctx, ref); res != nil {
<add> return res
<add> }
<add>
<ide> opt := docker.ResolverOptions{
<ide> Client: tracing.DefaultClient,
<ide> }
<ide> func (is *imageSource) getResolver(ctx context.Context, rfn resolver.ResolveOpti
<ide> }
<ide> opt.Credentials = is.getCredentialsFromSession(ctx, sm)
<ide> r := docker.NewResolver(opt)
<add> r = is.resolverCache.Add(ctx, ref, r)
<ide> return r
<ide> }
<ide>
<ide> func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
<ide> }
<ide>
<ide> platform := platforms.Only(p.platform)
<add> // workaround for GCR bug that requires a request to manifest endpoint for authentication to work.
<add> // if current resolver has not used manifests do a dummy request.
<add> // in most cases resolver should be cached and extra request is not needed.
<add> ensureManifestRequested(ctx, p.resolver, p.ref)
<add>
<ide> var (
<ide> schema1Converter *schema1.Converter
<ide> handlers []images.Handler
<ide> func resolveModeToString(rm source.ResolveMode) string {
<ide> }
<ide> return ""
<ide> }
<add>
<add>type resolverCache struct {
<add> mu sync.Mutex
<add> m map[string]cachedResolver
<add>}
<add>
<add>type cachedResolver struct {
<add> timeout time.Time
<add> remotes.Resolver
<add> counter int64
<add>}
<add>
<add>func (cr *cachedResolver) Resolve(ctx context.Context, ref string) (name string, desc ocispec.Descriptor, err error) {
<add> atomic.AddInt64(&cr.counter, 1)
<add> return cr.Resolver.Resolve(ctx, ref)
<add>}
<add>
<add>func (r *resolverCache) Add(ctx context.Context, ref string, resolver remotes.Resolver) remotes.Resolver {
<add> r.mu.Lock()
<add> defer r.mu.Unlock()
<add>
<add> ref = r.domain(ref) + "-" + session.FromContext(ctx)
<add>
<add> cr, ok := r.m[ref]
<add> cr.timeout = time.Now().Add(time.Minute)
<add> if ok {
<add> return &cr
<add> }
<add>
<add> cr.Resolver = resolver
<add> r.m[ref] = cr
<add> return &cr
<add>}
<add>
<add>func (r *resolverCache) domain(refStr string) string {
<add> ref, err := distreference.ParseNormalizedNamed(refStr)
<add> if err != nil {
<add> return refStr
<add> }
<add> return distreference.Domain(ref)
<add>}
<add>
<add>func (r *resolverCache) Get(ctx context.Context, ref string) remotes.Resolver {
<add> r.mu.Lock()
<add> defer r.mu.Unlock()
<add>
<add> ref = r.domain(ref) + "-" + session.FromContext(ctx)
<add>
<add> cr, ok := r.m[ref]
<add> if !ok {
<add> return nil
<add> }
<add> return &cr
<add>}
<add>
<add>func (r *resolverCache) clean(now time.Time) {
<add> r.mu.Lock()
<add> for k, cr := range r.m {
<add> if now.After(cr.timeout) {
<add> delete(r.m, k)
<add> }
<add> }
<add> r.mu.Unlock()
<add>}
<add>
<add>func newResolverCache() *resolverCache {
<add> rc := &resolverCache{
<add> m: map[string]cachedResolver{},
<add> }
<add> t := time.NewTicker(time.Minute)
<add> go func() {
<add> for {
<add> rc.clean(<-t.C)
<add> }
<add> }()
<add> return rc
<add>}
<add>
<add>func ensureManifestRequested(ctx context.Context, res remotes.Resolver, ref string) {
<add> cr, ok := res.(*cachedResolver)
<add> if !ok {
<add> return
<add> }
<add> if atomic.LoadInt64(&cr.counter) == 0 {
<add> res.Resolve(ctx, ref)
<add> }
<add>} | 1 |
PHP | PHP | remove the server file | 80fb944e45801cec81b459f73892dbfc80c39de6 | <ide><path>server.php
<del><?php
<del>
<del>$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
<del>
<del>$uri = urldecode($uri);
<del>
<del>$public = __DIR__ . '/public';
<del>
<del>$requested = $public . $uri;
<del>
<del>// This file allows us to emulate Apache's "mod_rewrite" functionality from the
<del>// built-in PHP web server. This provides a convenient way to test a Laravel
<del>// application without having installed a "real" web server software here.
<del>if ($uri !== '/' and file_exists($requested))
<del>{
<del> return false;
<del>}
<del>
<del>require_once $public . '/index.php'; | 1 |
Javascript | Javascript | fix polyfill for ie11 | 55e89e759a1a81a2815cbcc53359197dbcb41779 | <ide><path>packages/next/build/babel/preset.js
<ide> module.exports = (context, opts = {}) => ({
<ide> [require('@babel/plugin-proposal-class-properties'), opts['class-properties'] || {}],
<ide> require('@babel/plugin-proposal-object-rest-spread'),
<ide> [require('@babel/plugin-transform-runtime'), {
<del> helpers: false,
<add> corejs: 2,
<add> helpers: true,
<ide> regenerator: true,
<add> useESModules: !isTest,
<ide> ...opts['transform-runtime']
<ide> }],
<ide> [require('styled-jsx/babel'), styledJsxOptions(opts['styled-jsx'])], | 1 |
Python | Python | add a --timer argument to runtests | 0a2614309f261c4a6043d410d8d14612da3f7025 | <ide><path>runtests.py
<ide> $ python runtests.py --ipython
<ide> $ python runtests.py --python somescript.py
<ide> $ python runtests.py --bench
<add> $ python runtests.py --timer 20
<ide>
<ide> Run a debugger:
<ide>
<ide> def main(argv):
<ide> parser.add_argument("--coverage", action="store_true", default=False,
<ide> help=("report coverage of project code. HTML output goes "
<ide> "under build/coverage"))
<add> parser.add_argument("--timer", action="store", default=0, type=int,
<add> help=("Time N slowest test"))
<ide> parser.add_argument("--gcov", action="store_true", default=False,
<ide> help=("enable C code coverage via gcov (requires GCC). "
<ide> "gcov output goes to build/**/*.gc*"))
<ide> def main(argv):
<ide> help="Arguments to pass to Nose, Python or shell")
<ide> args = parser.parse_args(argv)
<ide>
<add> if args.timer == 0:
<add> timer = False
<add> elif args.timer == -1:
<add> timer = True
<add> elif args.timer > 0:
<add> timer = int(args.timer)
<add> else:
<add> raise ValueError("--timer value should be an integer, -1 or >0")
<add> args.timer = timer
<add>
<ide> if args.bench_compare:
<ide> args.bench = True
<ide> args.no_build = True # ASV does the building
<ide> def test(*a, **kw):
<ide> extra_argv=extra_argv,
<ide> doctests=args.doctests,
<ide> raise_warnings=args.raise_warnings,
<del> coverage=args.coverage)
<add> coverage=args.coverage,
<add> timer=args.timer)
<ide> finally:
<ide> os.chdir(cwd)
<ide> | 1 |
Javascript | Javascript | fix public paths | 10bee0f025d5b780c4e0d3f0eb65c9d279f35b85 | <ide><path>webpack.config.js
<ide> module.exports = {
<ide> chunkFilename: __DEV__ ?
<ide> '[name].js' :
<ide> '[name]-[chunkhash].js',
<del> path: path.join(__dirname, '/public/js'),
<del> publicPath: '/js'
<add> path: path.join(__dirname, '/public/js/')
<ide> },
<ide> resolve: {
<ide> alias: { | 1 |
Python | Python | use integer literal instead of float | 10d28b6dc9cda2be1ca1236515a5936c3571207b | <ide><path>numpy/lib/polynomial.py
<ide> def __init__(self, c_or_r, r=False, variable=None):
<ide> raise ValueError("Polynomial must be 1d only.")
<ide> c_or_r = trim_zeros(c_or_r, trim='f')
<ide> if len(c_or_r) == 0:
<del> c_or_r = NX.array([0.], dtype=c_or_r.dtype)
<add> c_or_r = NX.array([0], dtype=c_or_r.dtype)
<ide> self._coeffs = c_or_r
<ide> if variable is None:
<ide> variable = 'x' | 1 |
Text | Text | fix dotcloud link | f2fd765450e024808a3019bdc118f87c97446f97 | <ide><path>README.md
<ide> databases, and backend services without depending on a particular stack
<ide> or provider.
<ide>
<ide> Docker began as an open-source implementation of the deployment engine which
<del>powers [dotCloud](https://www.dotcloud.com), a popular Platform-as-a-Service.
<del>It benefits directly from the experience accumulated over several years
<del>of large-scale operation and support of hundreds of thousands of
<del>applications and databases.
<add>powered [dotCloud](http://web.archive.org/web/20130530031104/https://www.dotcloud.com/),
<add>a popular Platform-as-a-Service. It benefits directly from the experience
<add>accumulated over several years of large-scale operation and support of hundreds
<add>of thousands of applications and databases.
<ide>
<del>
<add>
<ide>
<ide> ## Security Disclosure
<ide> | 1 |
Javascript | Javascript | add rafflecopter to whitelist | 4066872b8daee4ac46a1441a979c9bf4bd0fbda1 | <ide><path>app.js
<ide> var trusted = [
<ide> '*.twimg.com',
<ide> "*.githubusercontent.com",
<ide> "'unsafe-eval'",
<del> "'unsafe-inline'"
<add> "'unsafe-inline'",
<add> "*.rafflecopter.com"
<ide> ];
<ide> //var connectSrc;
<ide> //if (process.env.NODE_ENV === 'development') { | 1 |
PHP | PHP | fix some docblocks | 85ed20ecf8a11a4a801c71d3d36a325c4714ff58 | <ide><path>src/ORM/Query.php
<ide> class Query extends DatabaseQuery implements JsonSerializable, QueryInterface
<ide> * Whether the user select any fields before being executed, this is used
<ide> * to determined if any fields should be automatically be selected.
<ide> *
<del> * @var bool
<add> * @var bool|null
<ide> */
<ide> protected $_hasFields;
<ide>
<ide> /**
<ide> * Tracks whether or not the original query should include
<ide> * fields from the top level table.
<ide> *
<del> * @var bool
<add> * @var bool|null
<ide> */
<ide> protected $_autoFields;
<ide>
<ide> class Query extends DatabaseQuery implements JsonSerializable, QueryInterface
<ide> * A callable function that can be used to calculate the total amount of
<ide> * records this query will match when not using `limit`
<ide> *
<del> * @var callable
<add> * @var callable|null
<ide> */
<ide> protected $_counter;
<ide>
<ide> /**
<ide> * Instance of a class responsible for storing association containments and
<ide> * for eager loading them when this query is executed
<ide> *
<del> * @var \Cake\ORM\EagerLoader
<add> * @var \Cake\ORM\EagerLoader|null
<ide> */
<ide> protected $_eagerLoader;
<ide>
<ide> public function disableAutoFields()
<ide> * By default calling select() will disable auto-fields. You can re-enable
<ide> * auto-fields with enableAutoFields().
<ide> *
<del> * @return bool The current value.
<add> * @return bool|null The current value. Returns null if neither enabled or disabled yet.
<ide> */
<ide> public function isAutoFieldsEnabled()
<ide> {
<ide> public function isAutoFieldsEnabled()
<ide> *
<ide> * @deprecated 3.4.0 Use enableAutoFields()/isAutoFieldsEnabled() instead.
<ide> * @param bool|null $value The value to set or null to read the current value.
<del> * @return bool|$this Either the current value or the query object.
<add> * @return bool|null|$this Either the current value or the query object.
<ide> */
<ide> public function autoFields($value = null)
<ide> { | 1 |
PHP | PHP | fix incorrect docblock | ce1b387de298c10db8a37e95dca53ad88448955b | <ide><path>lib/Cake/Test/Case/Network/Email/MailTransportTest.php
<ide> <?php
<ide> /**
<del> * SmtpTransportTest file
<add> * MailTransportTest file
<ide> *
<ide> * PHP 5
<ide> * | 1 |
Text | Text | update chinese hyperlinks | 869e08e7e08877379efe5d30fda02d81ed171595 | <ide><path>docs/devops.md
<ide> Currently a public beta testing version is available at:
<ide> | :---------- | :------- | :--------------------------------------- |
<ide> | Learn | English | <https://www.freecodecamp.dev> |
<ide> | | Espanol | <https://www.freecodecamp.dev/espanol> |
<del>| | Chinese | <https://chinese.freecodecamp.dev> |
<add>| | Chinese | <https://www.freecodecamp.dev/chinese> |
<ide> | News | English | <https://www.freecodecamp.dev/news> |
<ide> | Forum | English | <https://forum.freecodecamp.dev> |
<del>| | Chinese | <https://chinese.freecodecamp.dev/forum> |
<add>| | Chinese | <https://freecodecamp.dev/chinese/forum> |
<ide> | API | - | `https://api.freecodecamp.dev` |
<ide>
<ide> > [!NOTE]
<ide><path>docs/index.md
<ide> We are localizing freeCodeCamp.org to major world languages.
<ide>
<ide> Certifications are already live in some major world languages like below:
<ide>
<del>- [Chinese (中文)](https://chinese.freecodecamp.org/learn)
<add>- [Chinese (中文)](https://www.freecodecamp.org/chinese/learn)
<ide> - [Spanish (Español)](https://www.freecodecamp.org/espanol/learn)
<ide> - [Italian (Italiano)](https://www.freecodecamp.org/italian/learn)
<ide> - [Portuguese (Português)](https://www.freecodecamp.org/portuguese/learn) | 2 |
PHP | PHP | fix whitespace error | 44b7d013ae304a05699179bb4ea0077956c57e10 | <ide><path>lib/Cake/Utility/Validation.php
<ide> public static function date($check, $format = 'ymd', $regex = null) {
<ide> $separator . '((1[6-9]|[2-9]\\d)\\d{2})$%';
<ide>
<ide> $regex['my'] = '%^(' . $month . $separator . $year . ')$%';
<del> $regex['ym'] = '%^(' . $year . $separator . $month . ')$%';
<add> $regex['ym'] = '%^(' . $year . $separator . $month . ')$%';
<ide> $regex['y'] = '%^(' . $fourDigitYear . ')$%';
<ide>
<ide> $format = (is_array($format)) ? array_values($format) : array($format); | 1 |
Javascript | Javascript | improve code in test-vm-preserves-property | 89c8f58921f9fed3f2f284bc5c66e3877782b2f3 | <ide><path>test/parallel/test-vm-preserves-property.js
<ide> 'use strict';
<ide>
<ide> require('../common');
<del>var assert = require('assert');
<add>const assert = require('assert');
<ide>
<del>var vm = require('vm');
<add>const vm = require('vm');
<ide>
<del>var x = {};
<add>const x = {};
<ide> Object.defineProperty(x, 'prop', {
<ide> configurable: false,
<ide> enumerable: false,
<ide> writable: false,
<ide> value: 'val'
<ide> });
<del>var o = vm.createContext(x);
<add>const o = vm.createContext(x);
<ide>
<del>var code = 'Object.getOwnPropertyDescriptor(this, "prop")';
<del>var res = vm.runInContext(code, o, 'test');
<add>const code = 'Object.getOwnPropertyDescriptor(this, "prop")';
<add>const res = vm.runInContext(code, o, 'test');
<ide>
<ide> assert(res);
<del>assert.equal(typeof res, 'object');
<del>assert.equal(res.value, 'val');
<del>assert.equal(res.configurable, false, 'should not be configurable');
<del>assert.equal(res.enumerable, false, 'should not be enumerable');
<del>assert.equal(res.writable, false, 'should not be writable');
<add>assert.strictEqual(typeof res, 'object');
<add>assert.strictEqual(res.value, 'val');
<add>assert.strictEqual(res.configurable, false, 'should not be configurable');
<add>assert.strictEqual(res.enumerable, false, 'should not be enumerable');
<add>assert.strictEqual(res.writable, false, 'should not be writable'); | 1 |
Text | Text | add batch_size to data formats docs | 972820e2b3ea76d57a6971fa6feede83dfd56fd9 | <ide><path>website/docs/api/data-formats.md
<ide> your config and check that it's valid, you can run the
<ide> > before_creation = null
<ide> > after_creation = null
<ide> > after_pipeline_creation = null
<add>> batch_size = 1000
<ide> >
<ide> > [nlp.tokenizer]
<ide> > @tokenizers = "spacy.Tokenizer.v1"
<ide> Defines the `nlp` object, its tokenizer and
<ide> | `after_creation` | Optional [callback](/usage/training#custom-code-nlp-callbacks) to modify `nlp` object right after it's initialized. Defaults to `null`. ~~Optional[Callable[[Language], Language]]~~ |
<ide> | `after_pipeline_creation` | Optional [callback](/usage/training#custom-code-nlp-callbacks) to modify `nlp` object after the pipeline components have been added. Defaults to `null`. ~~Optional[Callable[[Language], Language]]~~ |
<ide> | `tokenizer` | The tokenizer to use. Defaults to [`Tokenizer`](/api/tokenizer). ~~Callable[[str], Doc]~~ |
<add>| `batch_size` | Default batch size for [`Language.pipe`](/api/language#pipe) and [`Language.evaluate`](/api/language#evaluate). ~~int~~ |
<ide>
<ide> ### components {#config-components tag="section"}
<ide> | 1 |
PHP | PHP | fix styleci issue | a3eebe0c883759b2503b77195e66cd863fce5948 | <ide><path>src/Illuminate/Http/Client/PendingRequest.php
<ide> public function createClient($handlerStack)
<ide> }
<ide>
<ide> /**
<del> * add handlers to the handler stack
<add> * add handlers to the handler stack.
<ide> *
<ide> * @param \GuzzleHttp\HandlerStack $handlerStack
<ide> * @return \GuzzleHttp\HandlerStack
<ide> public function setClient(Client $client)
<ide> }
<ide>
<ide> /**
<del> * set the handler function
<add> * set the handler function.
<ide> *
<ide> * @param callable $handler
<ide> * @return $this
<ide><path>src/Illuminate/Http/Client/Pool.php
<ide> class Pool
<ide> protected $factory;
<ide>
<ide> /**
<del> * The handler function for Guzzle client
<add> * The handler function for Guzzle client.
<ide> *
<ide> * @var callable
<ide> */
<ide><path>tests/Http/HttpClientTest.php
<ide> public function testTheRequestSendingAndResponseReceivedEventsAreFiredWhenAReque
<ide> ];
<ide> });
<ide>
<del>
<ide> m::close();
<ide> }
<ide> | 3 |
Javascript | Javascript | improve arrayutils by removing unnecessary slices | bde32ee1de36c01551c13a5669b16a6e9a98f4b8 | <ide><path>packages/ember-metal/lib/array.js
<ide> var arrayIndexOf = Ember.arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ?
<ide> var slice = [].slice;
<ide>
<ide> Ember.ArrayUtils = {
<del> map: function(obj) {
<del> var args = slice.call(arguments, 1);
<del> return obj.map ? obj.map.apply(obj, args) : arrayMap.apply(obj, args);
<add> map: function(obj, callback, thisArg) {
<add> return obj.map ? obj.map.call(obj, callback, thisArg) : arrayMap.call(obj, callback, thisArg);
<ide> },
<ide>
<del> forEach: function(obj) {
<del> var args = slice.call(arguments, 1);
<del> return obj.forEach ? obj.forEach.apply(obj, args) : arrayForEach.apply(obj, args);
<add> forEach: function(obj, callback, thisArg) {
<add> return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : arrayForEach.call(obj, callback, thisArg);
<ide> },
<ide>
<ide> indexOf: function(obj, element, index) {
<ide> return obj.indexOf ? obj.indexOf.call(obj, element, index) : arrayIndexOf.call(obj, element, index);
<ide> },
<ide>
<del> indexesOf: function(obj) {
<del> var args = slice.call(arguments, 1);
<del> return args[0] === undefined ? [] : Ember.ArrayUtils.map(args[0], function(item) {
<add> indexesOf: function(obj, element) {
<add> return element === undefined ? [] : Ember.ArrayUtils.map(element, function(item) {
<ide> return Ember.ArrayUtils.indexOf(obj, item);
<ide> });
<ide> }, | 1 |
Javascript | Javascript | use dynamic flag in test renderer in www | b899819e77cf0b7fccafaa4bb70363c430b574df | <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
<ide> import invariant from 'shared/invariant';
<ide> import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
<ide> import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent';
<ide>
<add>// Re-export dynamic flags from the www version.
<add>export const {revertPassiveEffectsChange} = require('ReactFeatureFlags');
<add>
<ide> export const debugRenderPhaseSideEffects = false;
<ide> export const debugRenderPhaseSideEffectsForStrictMode = false;
<ide> export const enableUserTimingAPI = __DEV__;
<ide> export const disableJavaScriptURLs = false;
<ide> export const disableYielding = false;
<ide> export const enableEventAPI = true;
<ide> export const enableJSXTransformAPI = true;
<del>export const revertPassiveEffectsChange = false;
<ide>
<ide> // Only used in www builds.
<ide> export function addUserTimingListener() { | 1 |
Python | Python | use temporary file in gcstos3operator | 2c5f636e5cfac7cc246d6ed93660bf0f8e968982 | <ide><path>airflow/providers/amazon/aws/hooks/s3.py
<ide> def check_for_bucket(self, bucket_name: Optional[str] = None) -> bool:
<ide> return False
<ide>
<ide> @provide_bucket_name
<del> def get_bucket(self, bucket_name: Optional[str] = None) -> str:
<add> def get_bucket(self, bucket_name: Optional[str] = None) -> object:
<ide> """
<ide> Returns a boto3.S3.Bucket object
<ide>
<ide><path>airflow/providers/amazon/aws/transfers/gcs_to_s3.py
<ide> def execute(self, context: 'Context') -> List[str]:
<ide> if files:
<ide>
<ide> for file in files:
<del> file_bytes = hook.download(object_name=file, bucket_name=self.bucket)
<del>
<del> dest_key = self.dest_s3_key + file
<del> self.log.info("Saving file to %s", dest_key)
<del>
<del> s3_hook.load_bytes(
<del> file_bytes, key=dest_key, replace=self.replace, acl_policy=self.s3_acl_policy
<del> )
<add> with hook.provide_file(object_name=file, bucket_name=self.bucket) as local_tmp_file:
<add> dest_key = self.dest_s3_key + file
<add> self.log.info("Saving file to %s", dest_key)
<add>
<add> s3_hook.load_file(
<add> filename=local_tmp_file.name,
<add> key=dest_key,
<add> replace=self.replace,
<add> acl_policy=self.s3_acl_policy,
<add> )
<ide>
<ide> self.log.info("All done, uploaded %d files to S3", len(files))
<ide> else:
<ide><path>tests/providers/amazon/aws/transfers/test_gcs_to_s3.py
<ide> # under the License.
<ide>
<ide> import unittest
<add>from tempfile import NamedTemporaryFile
<ide> from unittest import mock
<ide>
<ide> from airflow.providers.amazon.aws.hooks.s3 import S3Hook
<ide> class TestGCSToS3Operator(unittest.TestCase):
<ide>
<ide> # Test1: incremental behaviour (just some files missing)
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<del> def test_execute_incremental(self, mock_hook, mock_hook2):
<add> def test_execute_incremental(self, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<del> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=False,
<del> )
<del> # create dest bucket
<del> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<del> bucket = hook.get_bucket('bucket')
<del> bucket.create()
<del> bucket.put_object(Key=MOCK_FILES[0], Body=b'testing')
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=False,
<add> )
<add> # create dest bucket
<add> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<add> bucket = hook.get_bucket('bucket')
<add> bucket.create()
<add> bucket.put_object(Key=MOCK_FILES[0], Body=b'testing')
<ide>
<del> # we expect all except first file in MOCK_FILES to be uploaded
<del> # and all the MOCK_FILES to be present at the S3 bucket
<del> uploaded_files = operator.execute(None)
<del> assert sorted(MOCK_FILES[1:]) == sorted(uploaded_files)
<del> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<add> # we expect all except first file in MOCK_FILES to be uploaded
<add> # and all the MOCK_FILES to be present at the S3 bucket
<add> uploaded_files = operator.execute(None)
<add> assert sorted(MOCK_FILES[1:]) == sorted(uploaded_files)
<add> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<ide>
<ide> # Test2: All the files are already in origin and destination without replace
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<del> def test_execute_without_replace(self, mock_hook, mock_hook2):
<add> def test_execute_without_replace(self, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<del> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=False,
<del> )
<del> # create dest bucket with all the files
<del> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<del> bucket = hook.get_bucket('bucket')
<del> bucket.create()
<del> for mock_file in MOCK_FILES:
<del> bucket.put_object(Key=mock_file, Body=b'testing')
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=False,
<add> )
<add> # create dest bucket with all the files
<add> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<add> bucket = hook.get_bucket('bucket')
<add> bucket.create()
<add> for mock_file in MOCK_FILES:
<add> bucket.put_object(Key=mock_file, Body=b'testing')
<ide>
<del> # we expect nothing to be uploaded
<del> # and all the MOCK_FILES to be present at the S3 bucket
<del> uploaded_files = operator.execute(None)
<del> assert [] == uploaded_files
<del> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<add> # we expect nothing to be uploaded
<add> # and all the MOCK_FILES to be present at the S3 bucket
<add> uploaded_files = operator.execute(None)
<add> assert [] == uploaded_files
<add> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<ide>
<ide> # Test3: There are no files in destination bucket
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<del> def test_execute(self, mock_hook, mock_hook2):
<add> def test_execute(self, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<del> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=False,
<del> )
<del> # create dest bucket without files
<del> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<del> bucket = hook.get_bucket('bucket')
<del> bucket.create()
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=False,
<add> )
<add> # create dest bucket without files
<add> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<add> bucket = hook.get_bucket('bucket')
<add> bucket.create()
<ide>
<del> # we expect all MOCK_FILES to be uploaded
<del> # and all MOCK_FILES to be present at the S3 bucket
<del> uploaded_files = operator.execute(None)
<del> assert sorted(MOCK_FILES) == sorted(uploaded_files)
<del> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<add> # we expect all MOCK_FILES to be uploaded
<add> # and all MOCK_FILES to be present at the S3 bucket
<add> uploaded_files = operator.execute(None)
<add> assert sorted(MOCK_FILES) == sorted(uploaded_files)
<add> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<ide>
<ide> # Test4: Destination and Origin are in sync but replace all files in destination
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<del> def test_execute_with_replace(self, mock_hook, mock_hook2):
<add> def test_execute_with_replace(self, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<del> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=True,
<del> )
<del> # create dest bucket with all the files
<del> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<del> bucket = hook.get_bucket('bucket')
<del> bucket.create()
<del> for mock_file in MOCK_FILES:
<del> bucket.put_object(Key=mock_file, Body=b'testing')
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=True,
<add> )
<add> # create dest bucket with all the files
<add> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<add> bucket = hook.get_bucket('bucket')
<add> bucket.create()
<add> for mock_file in MOCK_FILES:
<add> bucket.put_object(Key=mock_file, Body=b'testing')
<ide>
<del> # we expect all MOCK_FILES to be uploaded and replace the existing ones
<del> # and all MOCK_FILES to be present at the S3 bucket
<del> uploaded_files = operator.execute(None)
<del> assert sorted(MOCK_FILES) == sorted(uploaded_files)
<del> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<add> # we expect all MOCK_FILES to be uploaded and replace the existing ones
<add> # and all MOCK_FILES to be present at the S3 bucket
<add> uploaded_files = operator.execute(None)
<add> assert sorted(MOCK_FILES) == sorted(uploaded_files)
<add> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<ide>
<ide> # Test5: Incremental sync with replace
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<del> def test_execute_incremental_with_replace(self, mock_hook, mock_hook2):
<add> def test_execute_incremental_with_replace(self, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<del> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=True,
<del> )
<del> # create dest bucket with just two files (the first two files in MOCK_FILES)
<del> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<del> bucket = hook.get_bucket('bucket')
<del> bucket.create()
<del> for mock_file in MOCK_FILES[:2]:
<del> bucket.put_object(Key=mock_file, Body=b'testing')
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=True,
<add> )
<add> # create dest bucket with just two files (the first two files in MOCK_FILES)
<add> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<add> bucket = hook.get_bucket('bucket')
<add> bucket.create()
<add> for mock_file in MOCK_FILES[:2]:
<add> bucket.put_object(Key=mock_file, Body=b'testing')
<ide>
<del> # we expect all the MOCK_FILES to be uploaded and replace the existing ones
<del> # and all MOCK_FILES to be present at the S3 bucket
<del> uploaded_files = operator.execute(None)
<del> assert sorted(MOCK_FILES) == sorted(uploaded_files)
<del> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<add> # we expect all the MOCK_FILES to be uploaded and replace the existing ones
<add> # and all MOCK_FILES to be present at the S3 bucket
<add> uploaded_files = operator.execute(None)
<add> assert sorted(MOCK_FILES) == sorted(uploaded_files)
<add> assert sorted(MOCK_FILES) == sorted(hook.list_keys('bucket', delimiter='/'))
<ide>
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.S3Hook')
<del> def test_execute_should_handle_with_default_dest_s3_extra_args(self, s3_mock_hook, mock_hook, mock_hook2):
<add> def test_execute_should_handle_with_default_dest_s3_extra_args(self, s3_mock_hook, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<ide> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<ide> s3_mock_hook.return_value = mock.Mock()
<ide> s3_mock_hook.parse_s3_url.return_value = mock.Mock()
<ide>
<ide> def test_execute_should_handle_with_default_dest_s3_extra_args(self, s3_mock_hoo
<ide> s3_mock_hook.assert_called_once_with(aws_conn_id='aws_default', extra_args={}, verify=None)
<ide>
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.S3Hook')
<del> def test_execute_should_pass_dest_s3_extra_args_to_s3_hook(self, s3_mock_hook, mock_hook, mock_hook2):
<add> def test_execute_should_pass_dest_s3_extra_args_to_s3_hook(self, s3_mock_hook, mock_hook):
<ide> mock_hook.return_value.list.return_value = MOCK_FILES
<del> mock_hook.return_value.download.return_value = b"testing"
<del> mock_hook2.return_value.list.return_value = MOCK_FILES
<del> s3_mock_hook.return_value = mock.Mock()
<del> s3_mock_hook.parse_s3_url.return_value = mock.Mock()
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<add> s3_mock_hook.return_value = mock.Mock()
<add> s3_mock_hook.parse_s3_url.return_value = mock.Mock()
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=True,
<del> dest_s3_extra_args={
<del> "ContentLanguage": "value",
<del> },
<del> )
<del> operator.execute(None)
<del> s3_mock_hook.assert_called_once_with(
<del> aws_conn_id='aws_default', extra_args={'ContentLanguage': 'value'}, verify=None
<del> )
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=True,
<add> dest_s3_extra_args={
<add> "ContentLanguage": "value",
<add> },
<add> )
<add> operator.execute(None)
<add> s3_mock_hook.assert_called_once_with(
<add> aws_conn_id='aws_default', extra_args={'ContentLanguage': 'value'}, verify=None
<add> )
<ide>
<ide> # Test6: s3_acl_policy parameter is set
<ide> @mock_s3
<del> @mock.patch('airflow.providers.google.cloud.operators.gcs.GCSHook')
<ide> @mock.patch('airflow.providers.amazon.aws.transfers.gcs_to_s3.GCSHook')
<del> @mock.patch('airflow.providers.amazon.aws.hooks.s3.S3Hook.load_bytes')
<del> def test_execute_with_s3_acl_policy(self, mock_load_bytes, mock_gcs_hook, mock_gcs_hook2):
<add> @mock.patch('airflow.providers.amazon.aws.hooks.s3.S3Hook.load_file')
<add> def test_execute_with_s3_acl_policy(self, mock_load_file, mock_gcs_hook):
<ide> mock_gcs_hook.return_value.list.return_value = MOCK_FILES
<del> mock_gcs_hook.return_value.download.return_value = b"testing"
<del> mock_gcs_hook2.return_value.list.return_value = MOCK_FILES
<add> with NamedTemporaryFile() as f:
<add> gcs_provide_file = mock_gcs_hook.return_value.provide_file
<add> gcs_provide_file.return_value.__enter__.return_value.name = f.name
<ide>
<del> operator = GCSToS3Operator(
<del> task_id=TASK_ID,
<del> bucket=GCS_BUCKET,
<del> prefix=PREFIX,
<del> delimiter=DELIMITER,
<del> dest_aws_conn_id="aws_default",
<del> dest_s3_key=S3_BUCKET,
<del> replace=False,
<del> s3_acl_policy=S3_ACL_POLICY,
<del> )
<add> operator = GCSToS3Operator(
<add> task_id=TASK_ID,
<add> bucket=GCS_BUCKET,
<add> prefix=PREFIX,
<add> delimiter=DELIMITER,
<add> dest_aws_conn_id="aws_default",
<add> dest_s3_key=S3_BUCKET,
<add> replace=False,
<add> s3_acl_policy=S3_ACL_POLICY,
<add> )
<ide>
<del> # Create dest bucket without files
<del> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<del> bucket = hook.get_bucket('bucket')
<del> bucket.create()
<add> # Create dest bucket without files
<add> hook = S3Hook(aws_conn_id='airflow_gcs_test')
<add> bucket = hook.get_bucket('bucket')
<add> bucket.create()
<ide>
<del> operator.execute(None)
<add> operator.execute(None)
<ide>
<del> # Make sure the acl_policy parameter is passed to the upload method
<del> _, kwargs = mock_load_bytes.call_args
<del> assert kwargs['acl_policy'] == S3_ACL_POLICY
<add> # Make sure the acl_policy parameter is passed to the upload method
<add> _, kwargs = mock_load_file.call_args
<add> assert kwargs['acl_policy'] == S3_ACL_POLICY | 3 |
Javascript | Javascript | fix merge errors from rebase | ab9310982827fb9ff38168fcc26535e0159c01cf | <ide><path>common/models/user.js
<ide> module.exports = function(User) {
<ide> to: user.email,
<ide> from: 'team@freecodecamp.org',
<ide> subject: 'Welcome to freeCodeCamp!',
<del> protocol: isDev ? null : 'https',
<del> host: isDev ? devHost : 'freecodecamp.org',
<del> port: isDev ? null : 443,
<add> protocol: getProtocol(),
<add> host: getHost(),
<add> port: getPort(),
<ide> template: path.join(
<ide> __dirname,
<ide> '..',
<ide> module.exports = function(User) {
<ide> from: getEmailSender(),
<ide> subject: 'freeCodeCamp - Authentication Request!',
<ide> text: renderAuthEmail({
<add> host,
<ide> loginEmail,
<ide> loginToken
<ide> })
<ide> module.exports = function(User) {
<ide> `;
<ide> });
<ide> });
<del>
<del> return dedent`
<del> If you entered a valid email, a magic link is on its way.
<del> Please follow that link to sign in.
<del> `;
<ide> });
<ide> })
<ide> .catch(err => {
<ide><path>server/boot/user.js
<ide> import moment from 'moment-timezone';
<ide> import { Observable } from 'rx';
<ide> import debugFactory from 'debug';
<ide> import emoji from 'node-emoji';
<del>import uuid from 'node-uuid';
<ide>
<ide> import {
<ide> frontEndChallengeId,
<ide> module.exports = function(app) {
<ide> });
<ide> }
<ide>
<del> function getEmailSignup(req, res) {
<del> if (req.user) {
<del> return res.redirect('/');
<del> }
<del> if (isSignUpDisabled) {
<del> return res.render('account/beta', {
<del> title: 'New sign ups are disabled'
<del> });
<del> }
<del> return res.render('account/email-signup', {
<del> title: 'Sign up for freeCodeCamp using your Email Address'
<del> });
<del> }
<del>
<ide> function getAccount(req, res) {
<ide> const { username } = req.user;
<ide> return res.redirect('/' + username); | 2 |
Javascript | Javascript | avoid unnecessary usage of var | b5f0b49b9b04ec5d452b78aba5ff5a49dcc1e377 | <ide><path>lib/os.js
<ide> platform[SymbolToPrimitive] = () => process.platform;
<ide> * @returns {string}
<ide> */
<ide> function tmpdir() {
<del> var path;
<add> let path;
<ide> if (isWindows) {
<ide> path = process.env.TEMP ||
<ide> process.env.TMP ||
<ide> function getCIDR(address, netmask, family) {
<ide> }
<ide>
<ide> const parts = StringPrototypeSplit(netmask, split);
<del> for (var i = 0; i < parts.length; i++) {
<add> for (let i = 0; i < parts.length; i++) {
<ide> if (parts[i] !== '') {
<ide> const binary = NumberParseInt(parts[i], range);
<ide> const tmp = countBinaryOnes(binary);
<ide> function networkInterfaces() {
<ide>
<ide> if (data === undefined)
<ide> return result;
<del> for (var i = 0; i < data.length; i += 7) {
<add> for (let i = 0; i < data.length; i += 7) {
<ide> const name = data[i];
<ide> const entry = {
<ide> address: data[i + 1], | 1 |
Text | Text | fix code + link on utility/readme.md | 54a87e06ba728677f5cc46804914646b97b1c2d7 | <ide><path>src/Utility/README.md
<ide> A ``Hash`` (as in PHP arrays) class, capable of extracting data using an intuiti
<ide>
<ide> ```php
<ide> $things = [
<del> ['name' => 'Mark', 'age' => 15],
<del> ['name' => 'Susan', 'age' => 30]
<del> ['name' => 'Lucy', 'age' => 25]
<add> ['name' => 'Mark', 'age' => 15],
<add> ['name' => 'Susan', 'age' => 30]
<add> ['name' => 'Lucy', 'age' => 25]
<ide> ];
<ide>
<del>$bigPeople = Hash::extract('{n}[age>21].name', $things);
<add>$bigPeople = Hash::extract($things, '{n}[age>21].name');
<ide>
<ide> // $bigPeople will contain ['Susan', 'Lucy']
<ide> ```
<ide>
<del>Check the [official Hash class documentation](http://book.cakephp.org/3.0/en/core-utility-libraries/hash.html)
<add>Check the [official Hash class documentation](http://book.cakephp.org/3.0/en/core-libraries/hash.html)
<ide>
<ide> ### Inflector
<ide>
<ide> echo Inflector::pluralize('Apple'); // echoes Apples
<ide> echo Inflector::singularize('People'); // echoes Person
<ide> ```
<ide>
<del>Check the [official Inflector class documentation](http://book.cakephp.org/3.0/en/core-utility-libraries/inflector.html)
<add>Check the [official Inflector class documentation](http://book.cakephp.org/3.0/en/core-libraries/inflector.html)
<ide>
<ide> ### String
<ide>
<ide> This is the song
<ide> that never ends.
<ide> ```
<ide>
<del>Check the [official String class documentation](http://book.cakephp.org/3.0/en/core-utility-libraries/string.html)
<add>Check the [official String class documentation](http://book.cakephp.org/3.0/en/core-libraries/string.html)
<ide>
<ide> ### Security
<ide>
<ide> $result = Security::encrypt($value, $key);
<ide> Security::decrypt($result, $key);
<ide> ```
<ide>
<del>Check the [official Security class documentation](http://book.cakephp.org/3.0/en/core-utility-libraries/security.html)
<add>Check the [official Security class documentation](http://book.cakephp.org/3.0/en/core-libraries/security.html)
<ide>
<ide> ### Xml
<ide>
<ide> $data = array(
<ide> $xml = Xml::build($data);
<ide> ```
<ide>
<del>Check the [official Xml class documentation](http://book.cakephp.org/3.0/en/core-utility-libraries/xml.html)
<add>Check the [official Xml class documentation](http://book.cakephp.org/3.0/en/core-libraries/xml.html) | 1 |
Javascript | Javascript | add rowspan dom property | bcc6b524fb136bdc857e64d380659624193911e1 | <ide><path>src/dom/DefaultDOMPropertyConfig.js
<ide> var DefaultDOMPropertyConfig = {
<ide> readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
<ide> required: HAS_BOOLEAN_VALUE,
<ide> role: MUST_USE_ATTRIBUTE,
<add> rowSpan: null,
<ide> scrollLeft: MUST_USE_PROPERTY,
<ide> scrollTop: MUST_USE_PROPERTY,
<ide> selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | 1 |
Java | Java | fix checkstyle errors | a606fb4b212aeabf632bb22fe863bcbf9fcac9fc | <ide><path>spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java
<ide>
<ide> import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.core.io.buffer.DefaultDataBufferFactory;
<del>import org.springframework.core.testfixture.io.buffer.DataBufferTestUtils;
<ide> import org.springframework.http.HttpCookie;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpMethod;
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java
<ide> import org.springframework.core.io.buffer.DataBufferUtils;
<ide> import org.springframework.core.io.buffer.DefaultDataBuffer;
<ide> import org.springframework.core.io.buffer.DefaultDataBufferFactory;
<del>import org.springframework.core.testfixture.io.buffer.DataBufferTestUtils;
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.HttpRange;
<ide> import org.springframework.http.MediaType;
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java
<ide> package org.springframework.web.reactive.result.method.annotation;
<ide>
<ide> import java.net.URI;
<del>import java.nio.charset.StandardCharsets;
<ide> import java.time.Duration;
<ide> import java.time.Instant;
<ide> import java.time.temporal.ChronoUnit;
<ide> import org.springframework.core.ResolvableType;
<ide> import org.springframework.core.codec.ByteBufferEncoder;
<ide> import org.springframework.core.codec.CharSequenceEncoder;
<del>import org.springframework.core.testfixture.io.buffer.DataBufferTestUtils;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.HttpStatus; | 3 |
Text | Text | add rich trott to the ctc | dae5bf0127e7b1fdd80996c9fe995f7941d8ebb1 | <ide><path>README.md
<ide> information about the governance of the Node.js project, see
<ide> * [rvagg](https://github.com/rvagg) - **Rod Vagg** <rod@vagg.org>
<ide> * [shigeki](https://github.com/shigeki) - **Shigeki Ohtsu** <ohtsu@iij.ad.jp>
<ide> * [trevnorris](https://github.com/trevnorris) - **Trevor Norris** <trev.norris@gmail.com>
<add>* [Trott](https://github.com/Trott) - **Rich Trott** <rtrott@gmail.com>
<ide>
<ide> ### Collaborators
<ide>
<ide> information about the governance of the Node.js project, see
<ide> * [thealphanerd](https://github.com/thealphanerd) - **Myles Borins** <myles.borins@gmail.com>
<ide> * [thefourtheye](https://github.com/thefourtheye) - **Sakthipriyan Vairamani** <thechargingvolcano@gmail.com>
<ide> * [thlorenz](https://github.com/thlorenz) - **Thorsten Lorenz** <thlorenz@gmx.de>
<del>* [Trott](https://github.com/Trott) - **Rich Trott** <rtrott@gmail.com>
<ide> * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com>
<ide> * [vkurchatkin](https://github.com/vkurchatkin) - **Vladimir Kurchatkin** <vladimir.kurchatkin@gmail.com>
<ide> * [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <yosuke.furukawa@gmail.com> | 1 |
PHP | PHP | add default config properties for cache engines | 2dcf3e692a98e3df24670b8a6ad1a9c74ac2e04a | <ide><path>Cake/Cache/CacheEngine.php
<ide> abstract class CacheEngine {
<ide> */
<ide> protected $_config = [];
<ide>
<add>/**
<add> * Default configuration
<add> *
<add> * These settings apply to all cache engines, and can be overriden by a specific cache
<add> * engine or runtime settings
<add> *
<add> * @var array
<add> */
<add> protected static $_defaultConfig = [
<add> 'prefix' => 'cake_',
<add> 'duration' => 3600,
<add> 'probability' => 100,
<add> 'groups' => []
<add> ];
<add>
<ide> /**
<ide> * Contains the compiled string with all groups
<ide> * prefixes to be prepended to every key in this cache engine
<ide> abstract class CacheEngine {
<ide> /**
<ide> * Initialize the cache engine
<ide> *
<del> * Called automatically by the cache frontend
<add> * Called automatically by the cache frontend. Merge the runtime config with the defaults
<add> * for the specific cache engine, and the general defaults before use
<ide> *
<ide> * @param array $config Associative array of parameters for the engine
<ide> * @return boolean True if the engine has been successfully initialized, false if not
<ide> */
<ide> public function init($config = []) {
<del> $config += $this->_config + [
<del> 'prefix' => 'cake_',
<del> 'duration' => 3600,
<del> 'probability' => 100,
<del> 'groups' => []
<del> ];
<add> $config += $this->_config + static::$_defaultConfig + self::$_defaultConfig;
<ide> $this->_config = $config;
<ide> if (!empty($this->_config['groups'])) {
<ide> sort($this->_config['groups']);
<ide><path>Cake/Cache/Engine/FileEngine.php
<ide> class FileEngine extends CacheEngine {
<ide> */
<ide> protected $_config = [];
<ide>
<add>/**
<add> * _defaultConfig
<add> *
<add> * @var mixed
<add> */
<add> protected static $_defaultConfig = [
<add> 'path' => CACHE,
<add> 'prefix' => 'cake_',
<add> 'lock' => true,
<add> 'serialize' => true,
<add> 'isWindows' => false,
<add> 'mask' => 0664
<add> ];
<add>
<ide> /**
<ide> * True unless FileEngine::__active(); fails
<ide> *
<ide> class FileEngine extends CacheEngine {
<ide> * @return boolean True if the engine has been successfully initialized, false if not
<ide> */
<ide> public function init($config = []) {
<del> $config += [
<del> 'path' => CACHE,
<del> 'prefix' => 'cake_',
<del> 'lock' => true,
<del> 'serialize' => true,
<del> 'isWindows' => false,
<del> 'mask' => 0664
<del> ];
<ide> parent::init($config);
<ide>
<ide> if (DS === '\\') {
<ide><path>Cake/Cache/Engine/MemcachedEngine.php
<ide> class MemcachedEngine extends CacheEngine {
<ide> */
<ide> protected $_config = [];
<ide>
<add>/**
<add> * Default config
<add> *
<add> * The defaults used unless overriden by runtime configuration
<add> *
<add> * @var array
<add> */
<add> protected static $_defaultConfig = [
<add> 'servers' => ['127.0.0.1'],
<add> 'compress' => false,
<add> 'persistent' => false,
<add> 'login' => null,
<add> 'password' => null,
<add> 'serialize' => 'php'
<add> ];
<add>
<ide> /**
<ide> * List of available serializer engines
<ide> *
<ide> public function init($config = []) {
<ide> if (!isset($config['prefix'])) {
<ide> $config['prefix'] = Inflector::slug(APP_DIR) . '_';
<ide> }
<del> $config += [
<del> 'servers' => ['127.0.0.1'],
<del> 'compress' => false,
<del> 'persistent' => false,
<del> 'login' => null,
<del> 'password' => null,
<del> 'serialize' => 'php'
<del> ];
<ide> parent::init($config);
<ide>
<ide> if (!is_array($this->_config['servers'])) {
<ide><path>Cake/Cache/Engine/RedisEngine.php
<ide> class RedisEngine extends CacheEngine {
<ide> */
<ide> protected $_config = [];
<ide>
<add>/**
<add> * Default config
<add> *
<add> * The defaults used unless overriden by runtime configuration
<add> *
<add> * @var array
<add> */
<add> protected static $_defaultConfig = [
<add> 'prefix' => null,
<add> 'server' => '127.0.0.1',
<add> 'database' => 0,
<add> 'port' => 6379,
<add> 'password' => false,
<add> 'timeout' => 0,
<add> 'persistent' => true
<add> ];
<add>
<ide> /**
<ide> * Initialize the Cache Engine
<ide> *
<ide> public function init($config = []) {
<ide> if (!class_exists('Redis')) {
<ide> return false;
<ide> }
<del> parent::init(array_merge([
<del> 'prefix' => null,
<del> 'server' => '127.0.0.1',
<del> 'database' => 0,
<del> 'port' => 6379,
<del> 'password' => false,
<del> 'timeout' => 0,
<del> 'persistent' => true
<del> ], $config)
<del> );
<add> parent::init($config);
<ide>
<ide> return $this->_connect();
<ide> }
<ide><path>Cake/Cache/Engine/XcacheEngine.php
<ide> class XcacheEngine extends CacheEngine {
<ide> */
<ide> protected $_config = [];
<ide>
<add>/**
<add> * Default config
<add> *
<add> * @var array
<add> */
<add> protected static $_defaultConfig = [
<add> 'prefix' => null,
<add> 'PHP_AUTH_USER' => 'user',
<add> 'PHP_AUTH_PW' => 'password'
<add> ];
<add>
<ide> /**
<ide> * Initialize the Cache Engine
<ide> *
<ide> class XcacheEngine extends CacheEngine {
<ide> */
<ide> public function init($config = []) {
<ide> if (php_sapi_name() !== 'cli') {
<del> parent::init(array_merge([
<del> 'prefix' => Inflector::slug(APP_DIR) . '_',
<del> 'PHP_AUTH_USER' => 'user',
<del> 'PHP_AUTH_PW' => 'password'
<del> ], $config)
<del> );
<add> if (!isset($config['prefix'])) {
<add> $config['prefix'] = Inflector::slug(APP_DIR) . '_';
<add> }
<add> parent::init($config);
<ide> return function_exists('xcache_info');
<ide> }
<ide> return false; | 5 |
Javascript | Javascript | fix linting errors | e5449ee65fa3a8812b4f126ef04b56de16a4fc68 | <ide><path>server/boot/challenge.js
<ide> const dasherize = utils.dasherize;
<ide> const unDasherize = utils.unDasherize;
<ide> const getMDNLinks = utils.getMDNLinks;
<ide>
<add>/*
<ide> function makeChallengesUnique(challengeArr) {
<ide> // clone and reverse challenges
<ide> // then filter by unique id's
<ide> // then reverse again
<ide> return _.uniq(challengeArr.slice().reverse(), 'id').reverse();
<ide> }
<add>*/
<ide> function numberWithCommas(x) {
<ide> return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
<ide> }
<ide> module.exports = function(app) {
<ide> dashedName: dasherize(blockArray[0].block),
<ide> challenges: blockArray,
<ide> completed: completedCount / blockArray.length * 100,
<del> time: blockArray[0] && blockArray[0].time || "???"
<add> time: blockArray[0] && blockArray[0].time || '???'
<ide> };
<ide> })
<ide> .filter(({ name }) => name !== 'Hikes')
<ide> module.exports = function(app) {
<ide> res.render('challengeMap/show', {
<ide> blocks,
<ide> daysRunning,
<del> globalCompletedCount: numberWithCommas(5612952 + (Math.floor((Date.now() - 1446268581061) / 3000))),
<add> globalCompletedCount: numberWithCommas(
<add> 5612952 + (Math.floor((Date.now() - 1446268581061) / 3000))
<add> ),
<ide> camperCount,
<ide> lastCompleted,
<ide> title: "A map of all Free Code Camp's Challenges" | 1 |
Java | Java | fix typos in test code | bd3499671c7067c176898a02f70b9cdd78628911 | <ide><path>spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java
<ide> void copyPropertiesHonorsGenericTypeMatchesForUpperBoundedWildcard() {
<ide> * {@code Number} can NOT be copied to {@code Integer}.
<ide> */
<ide> @Test
<del> void copyPropertiesDoesNotCopyeFromSuperTypeToSubType() {
<add> void copyPropertiesDoesNotCopyFromSuperTypeToSubType() {
<ide> NumberHolder numberHolder = new NumberHolder();
<ide> numberHolder.setNumber(Integer.valueOf(42));
<ide> IntegerHolder integerHolder = new IntegerHolder();
<ide><path>spring-context/src/test/java/org/springframework/context/annotation/ParserStrategyUtilsTests.java
<ide> public void instantiateClassWhenHasNoArgsConstructorCallsAware() {
<ide> }
<ide>
<ide> @Test
<del> public void instantiateClassWhenHasSingleContructorInjectsParams() {
<add> public void instantiateClassWhenHasSingleConstructorInjectsParams() {
<ide> ArgsConstructor instance = instantiateClass(ArgsConstructor.class);
<ide> assertThat(instance.environment).isSameAs(this.environment);
<ide> assertThat(instance.beanFactory).isSameAs(this.registry);
<ide> public void instantiateClassWhenHasSingleContructorInjectsParams() {
<ide> }
<ide>
<ide> @Test
<del> public void instantiateClassWhenHasSingleContructorAndAwareInjectsParamsAndCallsAware() {
<add> public void instantiateClassWhenHasSingleConstructorAndAwareInjectsParamsAndCallsAware() {
<ide> ArgsConstructorAndAware instance = instantiateClass(ArgsConstructorAndAware.class);
<ide> assertThat(instance.environment).isSameAs(this.environment);
<ide> assertThat(instance.setEnvironment).isSameAs(this.environment);
<ide> public void instantiateClassWhenHasMultipleConstructorsUsesNoArgsConstructor() {
<ide> }
<ide>
<ide> @Test
<del> public void instantiateClassWhenHasMutlipleConstructorsAndNotDefaultThrowsException() {
<add> public void instantiateClassWhenHasMultipleConstructorsAndNotDefaultThrowsException() {
<ide> assertThatExceptionOfType(BeanInstantiationException.class).isThrownBy(() ->
<ide> instantiateClass(MultipleConstructorsWithNoDefault.class));
<ide> }
<add><path>spring-core/src/test/java/org/springframework/core/annotation/AnnotationBackCompatibilityTests.java
<del><path>spring-core/src/test/java/org/springframework/core/annotation/AnnotationBackCompatibiltyTests.java
<ide> * @author Phillip Webb
<ide> * @since 5.2
<ide> */
<del>class AnnotationBackCompatibiltyTests {
<add>class AnnotationBackCompatibilityTests {
<ide>
<ide> @Test
<ide> void multiplRoutesToMetaAnnotation() {
<ide><path>spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java
<ide> void inheritedAnnotationsStrategyOnClassHierarchyScansInCorrectOrder() {
<ide> }
<ide>
<ide> @Test
<del> void inheritedAnnotationsStrategyOnClassWhenHasAnnotationOnBothClassesIncudesOnlyOne() {
<add> void inheritedAnnotationsStrategyOnClassWhenHasAnnotationOnBothClassesIncludesOnlyOne() {
<ide> Class<?> source = WithSingleSuperclassAndDoubleInherited.class;
<ide> assertThat(Arrays.stream(source.getAnnotations()).map(
<ide> Annotation::annotationType).map(Class::getName)).containsExactly(
<ide><path>spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java
<ide> void getActiveProfiles_fromSystemProperties_withMultipleProfiles() {
<ide> }
<ide>
<ide> @Test
<del> void getActiveProfiles_fromSystemProperties_withMulitpleProfiles_withWhitespace() {
<add> void getActiveProfiles_fromSystemProperties_withMultipleProfiles_withWhitespace() {
<ide> System.setProperty(ACTIVE_PROFILES_PROPERTY_NAME, " bar , baz "); // notice whitespace
<ide> assertThat(environment.getActiveProfiles()).contains("bar", "baz");
<ide> System.clearProperty(ACTIVE_PROFILES_PROPERTY_NAME);
<ide><path>spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java
<ide> public void testSetListElementValue() {
<ide> }
<ide>
<ide> @Test
<del> public void testSetGenericListElementValueTypeCoersion() {
<add> public void testSetGenericListElementValueTypeCoercion() {
<ide> // TODO currently failing since setValue does a getValue and "Wien" string != PlaceOfBirth - check with andy
<ide> setValue("placesLivedList[0]", "Wien");
<ide> }
<ide>
<ide> @Test
<del> public void testSetGenericListElementValueTypeCoersionOK() {
<add> public void testSetGenericListElementValueTypeCoercionOK() {
<ide> setValue("booleanList[0]", "true", Boolean.TRUE);
<ide> }
<ide>
<ide> public void testIndexingIntoUnsupportedType() {
<ide> }
<ide>
<ide> @Test
<del> public void testSetPropertyTypeCoersion() {
<add> public void testSetPropertyTypeCoercion() {
<ide> setValue("publicBoolean", "true", Boolean.TRUE);
<ide> }
<ide>
<ide> @Test
<del> public void testSetPropertyTypeCoersionThroughSetter() {
<add> public void testSetPropertyTypeCoercionThroughSetter() {
<ide> setValue("SomeProperty", "true", Boolean.TRUE);
<ide> }
<ide>
<ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookupTests.java
<ide> public void setDataSourcesIsAnIdempotentOperation() throws Exception {
<ide> @Test
<ide> public void addingDataSourcePermitsOverride() throws Exception {
<ide> Map<String, DataSource> dataSources = new HashMap<>();
<del> StubDataSource overridenDataSource = new StubDataSource();
<add> StubDataSource overriddenDataSource = new StubDataSource();
<ide> StubDataSource expectedDataSource = new StubDataSource();
<del> dataSources.put(DATA_SOURCE_NAME, overridenDataSource);
<add> dataSources.put(DATA_SOURCE_NAME, overriddenDataSource);
<ide> MapDataSourceLookup lookup = new MapDataSourceLookup();
<ide> lookup.setDataSources(dataSources);
<ide> lookup.addDataSource(DATA_SOURCE_NAME, expectedDataSource); // must override existing entry
<ide><path>spring-jdbc/src/test/java/org/springframework/jdbc/support/DatabaseStartupValidatorTests.java
<ide> void shouldUseJdbc4IsValidByDefault() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> void shouldCallValidatonTwiceWhenNotValid() throws Exception {
<add> void shouldCallValidationTwiceWhenNotValid() throws Exception {
<ide> given(connection.isValid(1)).willReturn(false, true);
<ide>
<ide> validator.afterPropertiesSet();
<ide> void shouldCallValidatonTwiceWhenNotValid() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> void shouldCallValidatonTwiceInCaseOfException() throws Exception {
<add> void shouldCallValidationTwiceInCaseOfException() throws Exception {
<ide> given(connection.isValid(1)).willThrow(new SQLException("Test")).willReturn(true);
<ide>
<ide> validator.afterPropertiesSet();
<ide> void useValidationQueryInsteadOfIsValid() throws Exception {
<ide>
<ide> @Test
<ide> @SuppressWarnings("deprecation")
<del> void shouldExecuteValidatonTwiceOnError() throws Exception {
<add> void shouldExecuteValidationTwiceOnError() throws Exception {
<ide> String validationQuery = "SELECT NOW() FROM DUAL";
<ide> Statement statement = mock(Statement.class);
<ide> given(connection.createStatement()).willReturn(statement);
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java
<ide> public void createWithSubscribeNativeHeaders() {
<ide> }
<ide>
<ide> @Test
<del> public void createWithUnubscribeNativeHeaders() {
<add> public void createWithUnsubscribeNativeHeaders() {
<ide> MultiValueMap<String, String> extHeaders = new LinkedMultiValueMap<>();
<ide> extHeaders.add(StompHeaderAccessor.STOMP_ID_HEADER, "s1");
<ide>
<ide><path>spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java
<ide> public void unmarshalPartialStaxSourceXmlStreamReader() throws Exception {
<ide>
<ide> @Test
<ide> @SuppressWarnings("unchecked")
<del> public void unmarshalAnXmlReferingToAWrappedXmlElementDecl() throws Exception {
<add> public void unmarshalAnXmlReferringToAWrappedXmlElementDecl() throws Exception {
<ide> // SPR-10714
<ide> unmarshaller = new Jaxb2Marshaller();
<ide> unmarshaller.setPackagesToScan(new String[] { "org.springframework.oxm.jaxb" });
<ide><path>spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/lookup/MapConnectionFactoryLookupUnitTests.java
<ide> public class MapConnectionFactoryLookupUnitTests {
<ide> private static final String CONNECTION_FACTORY_NAME = "connectionFactory";
<ide>
<ide> @Test
<del> public void getConnectionFactorysReturnsUnmodifiableMap() {
<add> public void getConnectionFactoriesReturnsUnmodifiableMap() {
<ide> MapConnectionFactoryLookup lookup = new MapConnectionFactoryLookup();
<ide> Map<String, ConnectionFactory> connectionFactories = lookup.getConnectionFactories();
<ide>
<ide><path>spring-test/src/test/java/org/springframework/test/context/junit/jupiter/AutowiredConfigurationErrorsIntegrationTests.java
<ide> class AutowiredConfigurationErrorsIntegrationTests {
<ide> AutowiredRepeatedTestMethod.class,
<ide> AutowiredParameterizedTestMethod.class
<ide> })
<del> void autowiredTestMethodsTestTemplateMethodsAndLifecyleMethods(Class<?> testClass) {
<add> void autowiredTestMethodsTestTemplateMethodsAndLifecycleMethods(Class<?> testClass) {
<ide> testEventsFor(testClass)
<ide> .assertStatistics(stats -> stats.started(1).succeeded(0).failed(1))
<ide> .assertThatEvents().haveExactly(1,
<ide> void autowiredAndNonAutowiredTestMethods() {
<ide> NonStaticAutowiredBeforeAllMethod.class,
<ide> NonStaticAutowiredAfterAllMethod.class
<ide> })
<del> void autowiredNonStaticClassLevelLifecyleMethods(Class<?> testClass) {
<add> void autowiredNonStaticClassLevelLifecycleMethods(Class<?> testClass) {
<ide> containerEventsFor(testClass)
<ide> .assertStatistics(stats -> stats.started(2).succeeded(1).failed(1))
<ide> .assertThatEvents().haveExactly(1,
<ide><path>spring-test/src/test/java/org/springframework/test/context/support/ActiveProfilesUtilsTests.java
<ide> void resolveActiveProfilesWithMergedInheritedResolver() {
<ide> * @since 4.0
<ide> */
<ide> @Test
<del> void resolveActiveProfilesWithOverridenInheritedResolver() {
<add> void resolveActiveProfilesWithOverriddenInheritedResolver() {
<ide> assertResolvedProfiles(OverriddenInheritedFooActiveProfilesResolverTestCase.class, "bar");
<ide> }
<ide>
<ide><path>spring-test/src/test/java/org/springframework/test/context/support/DirtiesContextTestExecutionListenerTests.java
<ide> void declaredViaMetaAnnotationWithOverrides() throws Exception {
<ide>
<ide> @Test
<ide> void declaredViaMetaAnnotationWithOverriddenAttributes() throws Exception {
<del> assertAfterClass(DirtiesContextViaMetaAnnotationWithOverridenAttributes.class);
<add> assertAfterClass(DirtiesContextViaMetaAnnotationWithOverriddenAttributes.class);
<ide> }
<ide> }
<ide>
<ide> void test() {
<ide> }
<ide>
<ide> @MetaDirtyWithOverrides(classMode = AFTER_CLASS, hierarchyMode = EXHAUSTIVE)
<del> static class DirtiesContextViaMetaAnnotationWithOverridenAttributes {
<add> static class DirtiesContextViaMetaAnnotationWithOverriddenAttributes {
<ide>
<ide> void test() {
<ide> }
<ide><path>spring-test/src/test/java/org/springframework/test/web/reactive/server/DefaultControllerSpecTests.java
<ide> public void controllerAdviceWithClassArgument() {
<ide> @Test
<ide> public void configurerConsumers() {
<ide> TestConsumer<ArgumentResolverConfigurer> argumentResolverConsumer = new TestConsumer<>();
<del> TestConsumer<RequestedContentTypeResolverBuilder> contenTypeResolverConsumer = new TestConsumer<>();
<add> TestConsumer<RequestedContentTypeResolverBuilder> contentTypeResolverConsumer = new TestConsumer<>();
<ide> TestConsumer<CorsRegistry> corsRegistryConsumer = new TestConsumer<>();
<ide> TestConsumer<FormatterRegistry> formatterConsumer = new TestConsumer<>();
<ide> TestConsumer<ServerCodecConfigurer> codecsConsumer = new TestConsumer<>();
<ide> public void configurerConsumers() {
<ide>
<ide> new DefaultControllerSpec(new MyController())
<ide> .argumentResolvers(argumentResolverConsumer)
<del> .contentTypeResolver(contenTypeResolverConsumer)
<add> .contentTypeResolver(contentTypeResolverConsumer)
<ide> .corsMappings(corsRegistryConsumer)
<ide> .formatters(formatterConsumer)
<ide> .httpMessageCodecs(codecsConsumer)
<ide> public void configurerConsumers() {
<ide> .build();
<ide>
<ide> assertThat(argumentResolverConsumer.getValue()).isNotNull();
<del> assertThat(contenTypeResolverConsumer.getValue()).isNotNull();
<add> assertThat(contentTypeResolverConsumer.getValue()).isNotNull();
<ide> assertThat(corsRegistryConsumer.getValue()).isNotNull();
<ide> assertThat(formatterConsumer.getValue()).isNotNull();
<ide> assertThat(codecsConsumer.getValue()).isNotNull();
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingDataBindingIntegrationTests.java
<ide> public String handleDateParam(@RequestParam Date date) {
<ide> }
<ide>
<ide> @ModelAttribute
<del> public Mono<Foo> addFooAttribute(@PathVariable("id") Optional<Long> optiponalId) {
<del> return optiponalId.map(id -> Mono.just(new Foo(id))).orElse(Mono.empty());
<add> public Mono<Foo> addFooAttribute(@PathVariable("id") Optional<Long> optionalId) {
<add> return optionalId.map(id -> Mono.just(new Foo(id))).orElse(Mono.empty());
<ide> }
<ide>
<ide> @PostMapping("/foos/{id}")
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportTests.java
<ide> public void defaultLocaleResolverConfiguration() {
<ide> }
<ide>
<ide> @Test
<del> public void defaultThemeResolverfiguration() {
<add> public void defaultThemeResolverConfiguration() {
<ide> ApplicationContext context = initContext(WebConfig.class);
<ide> ThemeResolver themeResolver = context.getBean(THEME_RESOLVER_BEAN_NAME, ThemeResolver.class);
<ide>
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java
<ide> void matchCustomCondition() {
<ide> }
<ide>
<ide> @Test
<del> void compareToWithImpicitVsExplicitHttpMethodDeclaration() {
<add> void compareToWithImplicitVsExplicitHttpMethodDeclaration() {
<ide> RequestMappingInfo noMethods = RequestMappingInfo.paths().build();
<ide> RequestMappingInfo oneMethod = RequestMappingInfo.paths().methods(GET).build();
<ide> RequestMappingInfo oneMethodOneParam = RequestMappingInfo.paths().methods(GET).params("foo").build();
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java
<ide> public void createQueryStringOneParam() throws JspException {
<ide> }
<ide>
<ide> @Test
<del> public void createQueryStringOneParamForExsistingQueryString() throws JspException {
<add> public void createQueryStringOneParamForExistingQueryString() throws JspException {
<ide> List<Param> params = new ArrayList<>();
<ide> Set<String> usedParams = new HashSet<>();
<ide> | 19 |
Python | Python | fix typo on line 126 | 6b2b476f8633504e4c032dc948ab7dda04cd3d3f | <ide><path>scheduling/shortest_job_first.py
<ide> def calculate_average_times(
<ide> processes = list(range(1, no_of_processes + 1))
<ide>
<ide> for i in range(no_of_processes):
<del> print("Enter the arrival time and brust time for process:--" + str(i + 1))
<add> print("Enter the arrival time and burst time for process:--" + str(i + 1))
<ide> arrival_time[i], burst_time[i] = map(int, input().split())
<ide>
<ide> waiting_time = calculate_waitingtime(arrival_time, burst_time, no_of_processes) | 1 |
Python | Python | fix data parallelism in trainer | 04dc65e5c6adbfe43944beedfa12fb6b7bec0e60 | <ide><path>src/transformers/training_args.py
<ide> class TrainingArguments:
<ide> default=0.0, metadata={"help": "The label smoothing epsilon to apply (zero means no label smoothing)."}
<ide> )
<ide> adafactor: bool = field(default=False, metadata={"help": "Whether or not to replace Adam by Adafactor."})
<del> _n_gpu: int = field(init=False, repr=False, default=0)
<add> _n_gpu: int = field(init=False, repr=False, default=-1)
<ide>
<ide> def __post_init__(self):
<ide> if self.disable_tqdm is None:
<ide> def _setup_devices(self) -> Tuple["torch.device", int]:
<ide> # GPUs available in the environment, so `CUDA_VISIBLE_DEVICES=1,2` with `cuda:0`
<ide> # will use the first GPU in that env, i.e. GPU#1
<ide> device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
<add> # Sometimes the line in the postinit has not been run before we end up here, so just checking we're not at
<add> # the default value.
<add> if self._n_gpu == -1:
<add> self._n_gpu = torch.cuda.device_count()
<ide> n_gpu = self._n_gpu
<ide> else:
<ide> # Here, we'll use torch.distributed.
<ide><path>tests/test_trainer.py
<ide> require_sentencepiece,
<ide> require_tokenizers,
<ide> require_torch,
<add> require_torch_multi_gpu,
<ide> slow,
<ide> )
<ide> from transformers.utils.hp_naming import TrialShortNamer
<ide> def test_train_and_eval_dataloaders(self):
<ide> new_eval_dataset = RegressionDataset(length=128)
<ide> self.assertEqual(len(trainer.get_eval_dataloader(new_eval_dataset)), 128 // (32 * n_gpu))
<ide>
<add> @require_torch_multi_gpu
<add> def test_data_is_not_parallelized_when_model_is_parallel(self):
<add> model = RegressionModel()
<add> # Make the Trainer believe it's a parallelized model
<add> model.is_parallelizable = True
<add> model.model_parallel = True
<add> trainer = Trainer(model=model, train_dataset=RegressionDataset(), eval_dataset=RegressionDataset())
<add> # Check the Trainer was fooled
<add> self.assertTrue(trainer.is_model_parallel)
<add>
<add> # The batch size of the training and evaluation dataloaders should be 16, not 16 * n_gpu
<add> self.assertEqual(trainer.get_train_dataloader().batch_size, 16)
<add> self.assertEqual(len(trainer.get_train_dataloader()), 64 // 16)
<add> self.assertEqual(trainer.get_eval_dataloader().batch_size, 16)
<add> self.assertEqual(len(trainer.get_eval_dataloader()), 64 // 16)
<add>
<ide> def test_evaluate(self):
<ide> trainer = get_regression_trainer(a=1.5, b=2.5, compute_metrics=AlmostAccuracy())
<ide> results = trainer.evaluate() | 2 |
Javascript | Javascript | remove modules that require intl | 540b79605b7c383a6343afdce6322bc256c3023e | <ide><path>benchmark/fixtures/require-builtins.js
<ide> const list = [
<ide> 'http',
<ide> 'http2',
<ide> 'https',
<del> 'inspector',
<ide> 'module',
<ide> 'net',
<ide> 'os',
<ide> const list = [
<ide> 'string_decoder',
<ide> 'timers',
<ide> 'tls',
<del> 'trace_events',
<ide> 'tty',
<ide> 'url',
<ide> 'util', | 1 |
PHP | PHP | add trailing [] to multi select | bd448bc54ab0924239bc7cedb9398345547fbe36 | <ide><path>Cake/View/Input/SelectBox.php
<ide> public function render($data) {
<ide> unset($data['disabled']);
<ide> }
<ide>
<add> $template = 'select';
<add> if (!empty($data['multiple'])) {
<add> $template = 'selectMultiple';
<add> unset($data['multiple']);
<add> }
<ide> $attrs = $this->_templates->formatAttributes($data);
<del> return $this->_templates->format('select', [
<add> return $this->_templates->format($template, [
<ide> 'name' => $name,
<ide> 'attrs' => $attrs,
<ide> 'content' => implode('', $options),
<ide><path>Test/TestCase/View/Input/SelectBoxTest.php
<ide> public function setUp() {
<ide> parent::setUp();
<ide> $templates = [
<ide> 'select' => '<select name="{{name}}"{{attrs}}>{{content}}</select>',
<add> 'selectMultiple' => '<select name="{{name}}[]" multiple="multiple"{{attrs}}>{{content}}</select>',
<ide> 'option' => '<option value="{{name}}"{{attrs}}>{{value}}</option>',
<ide> 'optgroup' => '<optgroup label="{{label}}"{{attrs}}>{{content}}</optgroup>',
<ide> ];
<ide> public function testRenderMultipleSelect() {
<ide> $result = $select->render($data);
<ide> $expected = [
<ide> 'select' => [
<del> 'name' => 'Birds[name]',
<add> 'name' => 'Birds[name][]',
<ide> 'id' => 'BirdName',
<ide> 'multiple' => 'multiple',
<ide> ],
<ide> public function testRenderMultipleSelected() {
<ide> $data = [
<ide> 'multiple' => true,
<ide> 'id' => 'BirdName',
<del> 'name' => 'Birds[name]',
<add> 'name' => 'Birds[name][]',
<ide> 'value' => ['1', '2', 'burp'],
<ide> 'options' => [
<ide> 1 => 'one',
<ide> public function testRenderMultipleSelected() {
<ide> $result = $select->render($data);
<ide> $expected = [
<ide> 'select' => [
<del> 'name' => 'Birds[name]',
<add> 'name' => 'Birds[name][]',
<ide> 'multiple' => 'multiple',
<ide> 'id' => 'BirdName'
<ide> ], | 2 |
Python | Python | use info module for spacy.info() | cd94ea109536c8cb06cba8d875c2ae1754e31654 | <ide><path>spacy/__init__.py
<ide> from pathlib import Path
<ide> from .util import set_lang_class, get_lang_class, parse_package_meta
<ide> from .deprecated import resolve_model_name
<add>from .info import info
<ide>
<ide> from . import en
<ide> from . import de
<ide> def load(name, **overrides):
<ide> return cls(**overrides)
<ide>
<ide>
<del>def info(name):
<del> meta = parse_package_meta(util.get_data_path(), name, require=True)
<del> print(json.dumps(meta, indent=2))
<add>def info(name, markdown):
<add> info(name, markdown) | 1 |
Java | Java | abersnaze/rxjava into string-observable | 3c156d4096f35bda55eb5f38265e2ef050259ea1 | <ide><path>rxjava-contrib/rxjava-string/src/main/java/rx/observables/StringObservable.java
<ide> /**
<ide> * Copyright 2013 Netflix, Inc.
<del> *
<add> *
<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> * You may obtain a copy of the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<ide> * Unless required by applicable law or agreed to in writing, software
<ide> * distributed under the License is distributed on an "AS IS" BASIS,
<ide> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<ide> */
<ide> package rx.observables;
<ide>
<add>import java.io.IOException;
<add>import java.io.InputStream;
<add>import java.io.Reader;
<ide> import java.nio.ByteBuffer;
<ide> import java.nio.CharBuffer;
<ide> import java.nio.charset.CharacterCodingException;
<ide> import java.util.regex.Pattern;
<ide>
<ide> import rx.Observable;
<del>import rx.Observable.OnSubscribeFunc;
<del>import rx.Observer;
<del>import rx.Subscription;
<add>import rx.Observable.OnSubscribe;
<add>import rx.Subscriber;
<add>import rx.operators.Operator;
<ide> import rx.util.functions.Func1;
<ide> import rx.util.functions.Func2;
<ide>
<ide> public class StringObservable {
<add> public static Observable<byte[]> from(final InputStream i) {
<add> return from(i, 8 * 1024);
<add> }
<add>
<add> public static Observable<byte[]> from(final InputStream i, final int size) {
<add> return Observable.create(new OnSubscribe<byte[]>() {
<add> @Override
<add> public void call(Subscriber<? super byte[]> o) {
<add> byte[] buffer = new byte[size];
<add> try {
<add> if (o.isUnsubscribed())
<add> return;
<add> int n = 0;
<add> n = i.read(buffer);
<add> while (n != -1 && !o.isUnsubscribed()) {
<add> o.onNext(Arrays.copyOf(buffer, n));
<add> n = i.read(buffer);
<add> }
<add> } catch (IOException e) {
<add> o.onError(e);
<add> }
<add> if (o.isUnsubscribed())
<add> return;
<add> o.onCompleted();
<add> }
<add> });
<add> }
<add>
<add> public static Observable<String> from(final Reader i) {
<add> return from(i, 8 * 1024);
<add> }
<add>
<add> public static Observable<String> from(final Reader i, final int size) {
<add> return Observable.create(new OnSubscribe<String>() {
<add> @Override
<add> public void call(Subscriber<? super String> o) {
<add> char[] buffer = new char[size];
<add> try {
<add> if (o.isUnsubscribed())
<add> return;
<add> int n = 0;
<add> n = i.read(buffer);
<add> while (n != -1 && !o.isUnsubscribed()) {
<add> o.onNext(new String(buffer));
<add> n = i.read(buffer);
<add> }
<add> } catch (IOException e) {
<add> o.onError(e);
<add> }
<add> if (o.isUnsubscribed())
<add> return;
<add> o.onCompleted();
<add> }
<add> });
<add> }
<add>
<ide> /**
<del> * Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams and where handles when a multibyte character spans two chunks.
<add> * Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams
<add> * and where handles when a multibyte character spans two chunks.
<ide> *
<ide> * @param src
<ide> * @param charsetName
<ide> public static Observable<String> decode(Observable<byte[]> src, String charsetNa
<ide> }
<ide>
<ide> /**
<del> * Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams and where handles when a multibyte character spans two chunks.
<add> * Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams
<add> * and where handles when a multibyte character spans two chunks.
<ide> *
<ide> * @param src
<ide> * @param charset
<ide> public static Observable<String> decode(Observable<byte[]> src, Charset charset)
<ide> }
<ide>
<ide> /**
<del> * Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams and where handles when a multibyte character spans two chunks.
<add> * Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams
<add> * and where handles when a multibyte character spans two chunks.
<ide> * This method allows for more control over how malformed and unmappable characters are handled.
<ide> *
<ide> * @param src
<ide> * @param charsetDecoder
<ide> * @return
<ide> */
<ide> public static Observable<String> decode(final Observable<byte[]> src, final CharsetDecoder charsetDecoder) {
<del> return Observable.create(new OnSubscribeFunc<String>() {
<add> return src.lift(new Operator<String, byte[]>() {
<ide> @Override
<del> public Subscription onSubscribe(final Observer<? super String> observer) {
<del> return src.subscribe(new Observer<byte[]>() {
<add> public Subscriber<? super byte[]> call(final Subscriber<? super String> o) {
<add> return new Subscriber<byte[]>(o) {
<ide> private ByteBuffer leftOver = null;
<ide>
<ide> @Override
<ide> public void onCompleted() {
<ide> if (process(null, leftOver, true))
<del> observer.onCompleted();
<add> o.onCompleted();
<ide> }
<ide>
<ide> @Override
<ide> public void onError(Throwable e) {
<ide> if (process(null, leftOver, true))
<del> observer.onError(e);
<add> o.onError(e);
<ide> }
<ide>
<ide> @Override
<ide> public boolean process(byte[] next, ByteBuffer last, boolean endOfInput) {
<ide> cr.throwException();
<ide> }
<ide> catch (CharacterCodingException e) {
<del> observer.onError(e);
<add> o.onError(e);
<ide> return false;
<ide> }
<ide> }
<ide> public boolean process(byte[] next, ByteBuffer last, boolean endOfInput) {
<ide>
<ide> String string = cb.toString();
<ide> if (!string.isEmpty())
<del> observer.onNext(string);
<add> o.onNext(string);
<ide>
<ide> return true;
<ide> }
<del> });
<add> };
<ide> }
<ide> });
<ide> }
<ide> public byte[] call(String str) {
<ide> }
<ide>
<ide> /**
<del> * Gather up all of the strings in to one string to be able to use it as one message. Don't use this on infinite streams.
<add> * Gather up all of the strings in to one string to be able to use it as one message. Don't use
<add> * this on infinite streams.
<ide> *
<ide> * @param src
<ide> * @return
<ide> */
<ide> public static Observable<String> stringConcat(Observable<String> src) {
<del> return src.aggregate(new Func2<String, String, String>() {
<add> return src.reduce(new Func2<String, String, String>() {
<ide> @Override
<ide> public String call(String a, String b) {
<ide> return a + b;
<ide> public String call(String a, String b) {
<ide> */
<ide> public static Observable<String> split(final Observable<String> src, String regex) {
<ide> final Pattern pattern = Pattern.compile(regex);
<del> return Observable.create(new OnSubscribeFunc<String>() {
<add>
<add> return src.lift(new Operator<String, String>() {
<ide> @Override
<del> public Subscription onSubscribe(final Observer<? super String> observer) {
<del> return src.subscribe(new Observer<String>() {
<add> public Subscriber<? super String> call(final Subscriber<? super String> o) {
<add> return new Subscriber<String>(o) {
<ide> private String leftOver = null;
<ide>
<ide> @Override
<ide> public void onCompleted() {
<ide> output(leftOver);
<del> observer.onCompleted();
<add> if (!o.isUnsubscribed())
<add> o.onCompleted();
<ide> }
<ide>
<ide> @Override
<ide> public void onError(Throwable e) {
<ide> output(leftOver);
<del> observer.onError(e);
<add> if (!o.isUnsubscribed())
<add> o.onError(e);
<ide> }
<ide>
<ide> @Override
<ide> public void onNext(String segment) {
<ide> }
<ide>
<ide> private int emptyPartCount = 0;
<add>
<ide> /**
<ide> * when limit == 0 trailing empty parts are not emitted.
<add> *
<ide> * @param part
<ide> */
<ide> private void output(String part) {
<ide> if (part.isEmpty()) {
<ide> emptyPartCount++;
<ide> }
<ide> else {
<del> for(; emptyPartCount>0; emptyPartCount--)
<del> observer.onNext("");
<del> observer.onNext(part);
<add> for (; emptyPartCount > 0; emptyPartCount--)
<add> if (!o.isUnsubscribed())
<add> o.onNext("");
<add> if (!o.isUnsubscribed())
<add> o.onNext(part);
<ide> }
<ide> }
<del> });
<add> };
<ide> }
<ide> });
<ide> }
<add>
<ide> /**
<ide> * Concatenates the sequence of values by adding a separator
<ide> * between them and emitting the result once the source completes.
<ide> private void output(String part) {
<ide> * {@link java.lang.String#valueOf(java.lang.Object)} calls.
<ide> * <p>
<ide> * For example:
<add> *
<ide> * <pre>
<del> * Observable<Object> source = Observable.from("a", 1, "c");
<del> * Observable<String> result = join(source, ", ");
<add> * Observable<Object> source = Observable.from("a", 1, "c");
<add> * Observable<String> result = join(source, ", ");
<ide> * </pre>
<ide> *
<ide> * will yield a single element equal to "a, 1, c".
<ide> *
<del> * @param source the source sequence of CharSequence values
<del> * @param separator the separator to a
<add> * @param source
<add> * the source sequence of CharSequence values
<add> * @param separator
<add> * the separator to a
<ide> * @return an Observable which emits a single String value having the concatenated
<ide> * values of the source observable with the separator between elements
<ide> */
<ide> public static <T> Observable<String> join(final Observable<T> source, final CharSequence separator) {
<del> return Observable.create(new OnSubscribeFunc<String>() {
<del>
<add> return source.lift(new Operator<String, T>() {
<ide> @Override
<del> public Subscription onSubscribe(final Observer<? super String> t1) {
<del> return source.subscribe(new Observer<T>() {
<add> public Subscriber<T> call(final Subscriber<? super String> o) {
<add> return new Subscriber<T>(o) {
<ide> boolean mayAddSeparator;
<ide> StringBuilder b = new StringBuilder();
<add>
<ide> @Override
<del> public void onNext(T args) {
<del> if (mayAddSeparator) {
<del> b.append(separator);
<del> }
<del> mayAddSeparator = true;
<del> b.append(String.valueOf(args));
<add> public void onCompleted() {
<add> String str = b.toString();
<add> b = null;
<add> if (!o.isUnsubscribed())
<add> o.onNext(str);
<add> if (!o.isUnsubscribed())
<add> o.onCompleted();
<ide> }
<ide>
<ide> @Override
<ide> public void onError(Throwable e) {
<ide> b = null;
<del> t1.onError(e);
<add> if (!o.isUnsubscribed())
<add> o.onError(e);
<ide> }
<ide>
<ide> @Override
<del> public void onCompleted() {
<del> String str = b.toString();
<del> b = null;
<del> t1.onNext(str);
<del> t1.onCompleted();
<add> public void onNext(Object t) {
<add> if (mayAddSeparator) {
<add> b.append(separator);
<add> }
<add> mayAddSeparator = true;
<add> b.append(String.valueOf(t));
<ide> }
<del> });
<add> };
<ide> }
<ide> });
<ide> }
<ide><path>rxjava-contrib/rxjava-string/src/test/java/rx/observables/StringObservableTest.java
<ide> /**
<ide> * Copyright 2013 Netflix, Inc.
<del> *
<add> *
<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> * You may obtain a copy of the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<ide> * Unless required by applicable law or agreed to in writing, software
<ide> * distributed under the License is distributed on an "AS IS" BASIS,
<ide> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<ide> import java.nio.charset.Charset;
<ide> import java.nio.charset.CharsetDecoder;
<ide> import java.nio.charset.MalformedInputException;
<add>import java.util.Arrays;
<ide>
<ide> import org.junit.Test;
<ide>
<ide> public void testEncode() {
<ide> public void testSplitOnCollon() {
<ide> testSplit("boo:and:foo", ":", 0, "boo", "and", "foo");
<ide> }
<add>
<ide> @Test
<ide> public void testSplitOnOh() {
<ide> testSplit("boo:and:foo", "o", 0, "b", "", ":and:f");
<ide> public void testSplit(String str, String regex, int limit, String... parts) {
<ide> for (int i = 0; i < str.length(); i++) {
<ide> String a = str.substring(0, i);
<ide> String b = str.substring(i, str.length());
<del> testSplit(a+"|"+b, regex, limit, Observable.from(a, b), parts);
<add> testSplit(a + "|" + b, regex, limit, Observable.from(a, b), parts);
<ide> }
<ide> }
<ide>
<ide> public void testSplit(String message, String regex, int limit, Observable<String> src, String... parts) {
<ide> Observable<String> act = StringObservable.split(src, regex);
<ide> Observable<String> exp = Observable.from(parts);
<del> AssertObservable.assertObservableEqualsBlocking("when input is "+message+" and limit = "+ limit, exp, act);
<add> AssertObservable.assertObservableEqualsBlocking("when input is " + message + " and limit = " + limit, exp, act);
<ide> }
<del>
<add>
<ide> @Test
<ide> public void testJoinMixed() {
<del> Observable<Object> source = Observable.<Object>from("a", 1, "c");
<del>
<add> Observable<Object> source = Observable.<Object> from(Arrays.asList("a", 1, "c"));
<add>
<ide> Observable<String> result = StringObservable.join(source, ", ");
<del>
<add>
<ide> Observer<Object> observer = mock(Observer.class);
<del>
<add>
<ide> result.subscribe(new TestObserver<Object>(observer));
<del>
<add>
<ide> verify(observer, times(1)).onNext("a, 1, c");
<ide> verify(observer, times(1)).onCompleted();
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> }
<add>
<ide> @Test
<ide> public void testJoinWithEmptyString() {
<ide> Observable<String> source = Observable.from("", "b", "c");
<del>
<add>
<ide> Observable<String> result = StringObservable.join(source, ", ");
<del>
<add>
<ide> Observer<Object> observer = mock(Observer.class);
<del>
<add>
<ide> result.subscribe(new TestObserver<Object>(observer));
<del>
<add>
<ide> verify(observer, times(1)).onNext(", b, c");
<ide> verify(observer, times(1)).onCompleted();
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> }
<add>
<ide> @Test
<ide> public void testJoinWithNull() {
<ide> Observable<String> source = Observable.from("a", null, "c");
<del>
<add>
<ide> Observable<String> result = StringObservable.join(source, ", ");
<del>
<add>
<ide> Observer<Object> observer = mock(Observer.class);
<del>
<add>
<ide> result.subscribe(new TestObserver<Object>(observer));
<del>
<add>
<ide> verify(observer, times(1)).onNext("a, null, c");
<ide> verify(observer, times(1)).onCompleted();
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> }
<add>
<ide> @Test
<ide> public void testJoinSingle() {
<ide> Observable<String> source = Observable.from("a");
<del>
<add>
<ide> Observable<String> result = StringObservable.join(source, ", ");
<del>
<add>
<ide> Observer<Object> observer = mock(Observer.class);
<del>
<add>
<ide> result.subscribe(new TestObserver<Object>(observer));
<del>
<add>
<ide> verify(observer, times(1)).onNext("a");
<ide> verify(observer, times(1)).onCompleted();
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> }
<add>
<ide> @Test
<ide> public void testJoinEmpty() {
<ide> Observable<String> source = Observable.empty();
<del>
<add>
<ide> Observable<String> result = StringObservable.join(source, ", ");
<del>
<add>
<ide> Observer<Object> observer = mock(Observer.class);
<del>
<add>
<ide> result.subscribe(new TestObserver<Object>(observer));
<del>
<add>
<ide> verify(observer, times(1)).onNext("");
<ide> verify(observer, times(1)).onCompleted();
<ide> verify(observer, never()).onError(any(Throwable.class));
<ide> }
<add>
<ide> @Test
<ide> public void testJoinThrows() {
<del> Observable<String> source = Observable.concat(Observable.just("a"), Observable.<String>error(new RuntimeException("Forced failure")));
<del>
<add> Observable<String> source = Observable.concat(Observable.just("a"), Observable.<String> error(new RuntimeException("Forced failure")));
<add>
<ide> Observable<String> result = StringObservable.join(source, ", ");
<del>
<add>
<ide> Observer<Object> observer = mock(Observer.class);
<del>
<add>
<ide> result.subscribe(new TestObserver<Object>(observer));
<del>
<add>
<ide> verify(observer, never()).onNext("a");
<ide> verify(observer, never()).onCompleted();
<ide> verify(observer, times(1)).onError(any(Throwable.class)); | 2 |
Ruby | Ruby | add high sierra symbol | 5a9dad0bf0534ac4a9e16a57e6d2b17c96b2244a | <ide><path>Library/Homebrew/os/mac/version.rb
<ide> module OS
<ide> module Mac
<ide> class Version < ::Version
<ide> SYMBOLS = {
<add> high_sierra: "10.13",
<ide> sierra: "10.12",
<ide> el_capitan: "10.11",
<ide> yosemite: "10.10", | 1 |
Python | Python | add support for gp3 and io2 volumes | c84b341c86bc1e2c18ecb0db28967908d04c6824 | <ide><path>libcloud/compute/drivers/ec2.py
<ide> }
<ide>
<ide> VALID_EC2_REGIONS = REGION_DETAILS_PARTIAL.keys()
<del>VALID_VOLUME_TYPES = ['standard', 'io1', 'gp2', 'st1', 'sc1']
<add>VALID_VOLUME_TYPES = ['standard', 'io1', 'io2', 'gp2', 'gp3', 'st1', 'sc1']
<ide>
<ide>
<ide> class EC2NodeLocation(NodeLocation):
<ide> def destroy_node(self, node):
<ide>
<ide> def create_volume(self, size, name, location=None, snapshot=None,
<ide> ex_volume_type='standard', ex_iops=None,
<del> ex_encrypted=False, ex_kms_key_id=None):
<add> ex_encrypted=False, ex_kms_key_id=None,
<add> ex_throughput=None):
<ide> """
<ide> Create a new volume.
<ide>
<ide> def create_volume(self, size, name, location=None, snapshot=None,
<ide> :param ex_volume_type: Type of volume to create.
<ide> :type ex_volume_type: ``str``
<ide>
<del> :param iops: The number of I/O operations per second (IOPS)
<add> :param ex_iops: The number of I/O operations per second (IOPS)
<ide> that the volume supports. Only used if ex_volume_type
<del> is io1.
<del> :type iops: ``int``
<add> is io1, io2 or gp3.
<add> :type ex_iops: ``int``
<ide>
<ide> :param ex_encrypted: Specifies whether the volume should be encrypted.
<ide> :type ex_encrypted: ``bool``
<ide> def create_volume(self, size, name, location=None, snapshot=None,
<ide> Only used if encrypted is set to True.
<ide> :type ex_kms_key_id: ``str``
<ide>
<add> :param ex_throughput: The throughput to provision for a volume, with a
<add> maximum of 1,000 MiB/s. Only used if ex_volume_type
<add> is gp3.
<add> :type ex_throughput: ``int``
<add>
<ide> :return: The newly created volume.
<ide> :rtype: :class:`StorageVolume`
<ide> """
<ide> def create_volume(self, size, name, location=None, snapshot=None,
<ide> if ex_volume_type:
<ide> params['VolumeType'] = ex_volume_type
<ide>
<del> if ex_volume_type == 'io1' and ex_iops:
<add> if ex_volume_type in ['io1', 'io2', 'gp3'] and ex_iops:
<ide> params['Iops'] = ex_iops
<ide>
<ide> if ex_encrypted:
<ide> def create_volume(self, size, name, location=None, snapshot=None,
<ide> if ex_kms_key_id is not None:
<ide> params['KmsKeyId'] = ex_kms_key_id
<ide>
<add> if ex_volume_type == 'gp3' and ex_throughput:
<add> params['Throughput'] = ex_throughput
<add>
<ide> volume = self._to_volume(
<ide> self.connection.request(self.path, params=params).object,
<ide> name=name)
<ide><path>libcloud/test/compute/test_ec2.py
<ide> def test_list_volumes(self):
<ide>
<ide> def test_create_volume(self):
<ide> location = self.driver.list_locations()[0]
<del> vol = self.driver.create_volume(10, 'vol', location)
<add> vol = self.driver.create_volume(10, 'vol', location=location)
<ide>
<ide> self.assertEqual(10, vol.size)
<ide> self.assertEqual('vol', vol.name)
<ide> self.assertEqual('creating', vol.extra['state'])
<ide> self.assertTrue(isinstance(vol.extra['create_time'], datetime))
<ide> self.assertEqual(False, vol.extra['encrypted'])
<ide>
<add> expected_msg = "Invalid volume type specified: invalid-type"
<add> self.assertRaisesRegex(ValueError, expected_msg, self.driver.create_volume,
<add> 10, 'invalid-vol', location=location, ex_volume_type='invalid-type')
<add>
<ide> def test_create_encrypted_volume(self):
<ide> location = self.driver.list_locations()[0]
<ide> vol = self.driver.create_volume( | 2 |
Text | Text | correct doc sentence [ci skip] | 2816494f5acdfb08d3b0fa54d91e2f41d9acbbe5 | <ide><path>guides/source/active_record_querying.md
<ide> Client.unscoped {
<ide> Dynamic Finders
<ide> ---------------
<ide>
<del>For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called `first_name` on your `Client` model for example, you get `find_by_first_name` for free from Active Record. If you have a `locked` field on the `Client` model, you also get `find_by_locked` and methods.
<add>For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called `first_name` on your `Client` model for example, you get `find_by_first_name` for free from Active Record. If you have a `locked` field on the `Client` model, you also get `find_by_locked` method.
<ide>
<ide> You can specify an exclamation point (`!`) on the end of the dynamic finders to get them to raise an `ActiveRecord::RecordNotFound` error if they do not return any records, like `Client.find_by_name!("Ryan")`
<ide> | 1 |
Java | Java | remove okhttp from release build for instagram | e1e86a1174d57f75d7b314fe151c46cbac6800f2 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/webworkers/WebWorkers.java
<ide> public static MessageQueueThread createWebWorkerThread(int id, MessageQueueThrea
<ide> * NB: We write to a temp file instead of returning a String because, depending on the size of the
<ide> * worker script, allocating the full script string on the Java heap can cause an OOM.
<ide> */
<del> @DoNotStrip
<ide> public static void downloadScriptToFileSync(String url, String outFileName) {
<ide> if (!ReactBuildConfig.DEBUG) {
<ide> throw new RuntimeException( | 1 |
Ruby | Ruby | remove unnecessary reduce in duration#inspect | 3cfb05daa4f1e76eaca0a79fc9df340af02ee3dc | <ide><path>activesupport/lib/active_support/duration.rb
<ide> def inspect #:nodoc:
<ide> return "0 seconds" if parts.empty?
<ide>
<ide> parts.
<del> reduce(::Hash.new(0)) { |h, (l, r)| h[l] += r; h }.
<ide> sort_by { |unit, _ | PARTS.index(unit) }.
<ide> map { |unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}" }.
<ide> to_sentence(locale: ::I18n.default_locale) | 1 |
Python | Python | add fibonacci series using recursion | 8fb4df5367b5c03d2851532063f6fa781fe2f980 | <ide><path>Maths/fibonacciSeries.py
<add># Fibonacci Sequence Using Recursion
<add>
<add>def recur_fibo(n):
<add> if n <= 1:
<add> return n
<add> else:
<add> return(recur_fibo(n-1) + recur_fibo(n-2))
<add>
<add>limit = int(input("How many terms to include in fionacci series:"))
<add>
<add>if limit <= 0:
<add> print("Plese enter a positive integer")
<add>else:
<add> print("Fibonacci series:")
<add> for i in range(limit):
<add> print(recur_fibo(i)) | 1 |
Ruby | Ruby | add missing require | 302fdb7677b95ac1c428bd5c545252bc52ac2313 | <ide><path>activesupport/lib/active_support/current_attributes.rb
<ide>
<ide> require "active_support/callbacks"
<ide> require "active_support/core_ext/enumerable"
<add>require "active_support/core_ext/module/delegation"
<ide>
<ide> module ActiveSupport
<ide> # Abstract super class that provides a thread-isolated attributes singleton, which resets automatically | 1 |
PHP | PHP | fix bug in soft delete scope application | acf0fb9bbf24972defafc2844b9a524e0855306e | <ide><path>src/Illuminate/Database/Eloquent/Builder.php
<ide> public function withGlobalScope($identifier, $scope)
<ide> {
<ide> $this->scopes[$identifier] = $scope;
<ide>
<add> if (method_exists($scope, 'extend')) {
<add> $scope->extend($this);
<add> }
<add>
<ide> return $this;
<ide> }
<ide>
<ide><path>src/Illuminate/Database/Eloquent/SoftDeletingScope.php
<ide> class SoftDeletingScope implements Scope
<ide> public function apply(Builder $builder, Model $model)
<ide> {
<ide> $builder->whereNull($model->getQualifiedDeletedAtColumn());
<del>
<del> $this->extend($builder);
<ide> }
<ide>
<ide> /**
<ide><path>tests/Database/DatabaseSoftDeletingScopeTest.php
<ide> public function testApplyingScopeToABuilder()
<ide> $model = m::mock('Illuminate\Database\Eloquent\Model');
<ide> $model->shouldReceive('getQualifiedDeletedAtColumn')->once()->andReturn('table.deleted_at');
<ide> $builder->shouldReceive('whereNull')->once()->with('table.deleted_at');
<del> $scope->shouldReceive('extend')->once();
<ide>
<ide> $scope->apply($builder, $model);
<ide> } | 3 |
PHP | PHP | add test that covers the deprecated locale method | 5f7d23291cb28d4a1721e022ee0614bdbcc9d7f9 | <ide><path>tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php
<ide> public function testFindSingleLocaleWithgetConditions()
<ide> $this->assertEquals($expected, $row->toArray());
<ide> }
<ide>
<add> /**
<add> * Tests the deprecated locale method.
<add> *
<add> * @group deprecated
<add> * @return void
<add> */
<add> public function testLocale()
<add> {
<add> $this->deprecated(function () {
<add> $table = $this->getTableLocator()->get('Articles');
<add> $table->addBehavior('Translate');
<add>
<add> $this->assertEquals('en_US', $table->locale());
<add>
<add> $table->locale('fr_FR');
<add> $this->assertEquals('fr_FR', $table->locale());
<add>
<add> $table->locale(false);
<add> $this->assertEquals('en_US', $table->locale());
<add>
<add> I18n::setLocale('fr_FR');
<add> $this->assertEquals('fr_FR', $table->locale());
<add> });
<add> }
<add>
<ide> /**
<ide> * Tests the locale setter/getter.
<ide> * | 1 |
Text | Text | fix few typos | 478a14a61934e617988f70aaf692fcd6d7b1e226 | <ide><path>website/docs/usage/layers-architectures.md
<ide> overview of the `TrainablePipe` methods used by
<ide>
<ide> </Infobox>
<ide>
<del>### Example: Entity elation extraction component {#component-rel}
<add>### Example: Entity relation extraction component {#component-rel}
<ide>
<ide> This section outlines an example use-case of implementing a **novel relation
<ide> extraction component** from scratch. We'll implement a binary relation
<ide> we can define our relation model in a config file as such:
<ide> # ...
<ide>
<ide> [model.get_candidates]
<del>@misc = "rel_cand_generator.v2"
<add>@misc = "rel_cand_generator.v1"
<ide> max_length = 20
<ide>
<ide> [model.create_candidate_tensor]
<ide> Before the model can be used, it needs to be
<ide> [initialized](/usage/training#initialization). This function receives a callback
<ide> to access the full **training data set**, or a representative sample. This data
<ide> set can be used to deduce all **relevant labels**. Alternatively, a list of
<del>labels can be provided to `initialize`, or you can call the
<del>`RelationExtractoradd_label` directly. The number of labels defines the output
<add>labels can be provided to `initialize`, or you can call
<add>`RelationExtractor.add_label` directly. The number of labels defines the output
<ide> dimensionality of the network, and will be used to do
<ide> [shape inference](https://thinc.ai/docs/usage-models#validation) throughout the
<ide> layers of the neural network. This is triggered by calling
<ide> and its internal model can be trained and used to make predictions.
<ide> During training, the function [`update`](/api/pipe#update) is invoked which
<ide> delegates to
<ide> [`Model.begin_update`](https://thinc.ai/docs/api-model#begin_update) and a
<del>[`get_loss`](/api/pipe#get_loss) function that **calculate the loss** for a
<add>[`get_loss`](/api/pipe#get_loss) function that **calculates the loss** for a
<ide> batch of examples, as well as the **gradient** of loss that will be used to
<ide> update the weights of the model layers. Thinc provides several
<ide> [loss functions](https://thinc.ai/docs/api-loss) that can be used for the | 1 |
Javascript | Javascript | add projectseptember app in showcase | d3929c62d9bcba174c6261a877247e1d0234b22c | <ide><path>website/src/react-native/showcase.js
<ide> var apps = [
<ide> link: 'https://itunes.apple.com/us/app/posyt-anonymously-meet-right/id1037842845?mt=8',
<ide> author: 'Posyt.com',
<ide> },
<add> {
<add> name: 'Project September',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple49/v4/88/0f/3b/880f3b7f-8aa0-de64-6b6f-f0ec6d6591e4/icon175x175.jpeg',
<add> link: 'https://itunes.apple.com/us/app/project-september/id1074075331?ls=1&mt=8',
<add> author: 'ProjectSeptember.com',
<add> },
<ide> {
<ide> name: 'Raindrop.io',
<ide> icon: 'http://a5.mzstatic.com/us/r30/Purple3/v4/f0/a4/57/f0a4574e-4a59-033f-05ff-5c421f0a0b00/icon175x175.png', | 1 |
Javascript | Javascript | throw error when compiling multiple roots | 04a62e83bcd4067749fa5e2eb0181bc43500169c | <ide><path>src/Compiler.js
<ide> Compiler.prototype = {
<ide> var index = 0,
<ide> template,
<ide> parent = templateElement.parent();
<add> if (templateElement.length > 1) {
<add> // https://github.com/angular/angular.js/issues/338
<add> throw Error("Cannot compile multiple element roots: " +
<add> jqLite('<div>').append(templateElement.clone()).html());
<add> }
<ide> if (parent && parent[0]) {
<ide> parent = parent[0];
<ide> for(var i = 0; i < parent.childNodes.length; i++) {
<ide><path>test/BinderSpec.js
<ide> describe('Binder', function(){
<ide> });
<ide>
<ide> it('ChangingRadioUpdatesModel', function(){
<del> var scope = this.compile('<input type="radio" name="model.price" value="A" checked>' +
<del> '<input type="radio" name="model.price" value="B">');
<add> var scope = this.compile('<div><input type="radio" name="model.price" value="A" checked>' +
<add> '<input type="radio" name="model.price" value="B"></div>');
<ide> scope.$eval();
<ide> assertEquals(scope.model.price, 'A');
<ide> });
<ide><path>test/CompilerSpec.js
<ide> describe('compiler', function(){
<ide> dealoc(scope);
<ide> });
<ide>
<add> it('should not allow compilation of multiple roots', function(){
<add> expect(function(){
<add> compiler.compile('<div>A</div><span></span>');
<add> }).toThrow("Cannot compile multiple element roots: " + ie("<div>A</div><span></span>"));
<add> function ie(text) {
<add> return msie ? uppercase(text) : text;
<add> }
<add> });
<add>
<ide> it('should recognize a directive', function(){
<ide> var e = jqLite('<div directive="expr" ignore="me"></div>');
<ide> directives.directive = function(expression, element){
<ide><path>test/service/invalidWidgetsSpec.js
<ide> describe('$invalidWidgets', function() {
<ide>
<ide>
<ide> it("should count number of invalid widgets", function(){
<del> var element = jqLite('<input name="price" ng:required ng:validate="number"></input>');
<add> var element = jqLite('<input name="price" ng:required ng:validate="number">');
<ide> jqLite(document.body).append(element);
<ide> scope = compile(element)();
<ide> var $invalidWidgets = scope.$service('$invalidWidgets'); | 4 |
Javascript | Javascript | pass maxdigits to labelfn | 291bf4d835ccc348530a488522d285541b897d69 | <ide><path>src/text-editor-component.js
<ide> class LineNumberGutterComponent {
<ide> number = softWrapped ? '•' : bufferRow + 1
<ide> number = NBSP_CHARACTER.repeat(maxDigits - number.length) + number
<ide> } else {
<del> number = this.props.labelFn({bufferRow, screenRow, foldable, softWrapped})
<add> number = this.props.labelFn({bufferRow, screenRow, foldable, softWrapped, maxDigits})
<ide> }
<ide> }
<ide>
<ide><path>src/text-editor.js
<ide> class TextEditor {
<ide> // * `screenRow` {Number} indicating the zero-indexed screen index.
<ide> // * `foldable` {Boolean} that is `true` if a fold may be created here.
<ide> // * `softWrapped` {Boolean} if this screen row is the soft-wrapped continuation of the same buffer row.
<add> // * `maxDigits` {Number} the maximum number of digits necessary to represent any known screen row.
<ide> // * `onMouseDown` (optional) {Function} to be called when a mousedown event is received by a line-number
<ide> // element within this `type: 'line-number'` {Gutter}. If unspecified, the default behavior is to select the
<ide> // clicked buffer row. | 2 |
Java | Java | expose mapped handler as an exchange attribute | 67330dfc23564ac830e6b33143cf48bd824dfa67 | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/HandlerMapping.java
<ide> public interface HandlerMapping {
<ide>
<ide> /**
<del> * Name of the {@link ServerWebExchange} attribute that contains the
<del> * best matching pattern within the handler mapping.
<del> * <p>Note: This attribute is not required to be supported by all
<del> * HandlerMapping implementations. URL-based HandlerMappings will
<del> * typically support it, but handlers should not necessarily expect
<del> * this request attribute to be present in all scenarios.
<add> * Name of the {@link ServerWebExchange#getAttributes() attribute} that
<add> * contains the mapped handler for the best matching pattern.
<add> */
<add> String BEST_MATCHING_HANDLER_ATTRIBUTE = HandlerMapping.class.getName() + ".bestMatchingHandler";
<add>
<add> /**
<add> * Name of the {@link ServerWebExchange#getAttributes() attribute} that
<add> * contains the best matching pattern within the handler mapping.
<ide> */
<ide> String BEST_MATCHING_PATTERN_ATTRIBUTE = HandlerMapping.class.getName() + ".bestMatchingPattern";
<ide>
<ide> /**
<del> * Name of the {@link ServerWebExchange} attribute that contains the path
<del> * within the handler mapping, in case of a pattern match, or the full
<del> * relevant URI (typically within the DispatcherServlet's mapping) else.
<add> * Name of the {@link ServerWebExchange#getAttributes() attribute} that
<add> * contains the path within the handler mapping, in case of a pattern match
<add> * such as {@code "/static/**"} or the full relevant URI otherwise.
<ide> * <p>Note: This attribute is not required to be supported by all
<ide> * HandlerMapping implementations. URL-based HandlerMappings will
<del> * typically support it, but handlers should not necessarily expect
<add> * typically support it but handlers should not necessarily expect
<ide> * this request attribute to be present in all scenarios.
<ide> */
<ide> String PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE = HandlerMapping.class.getName() + ".pathWithinHandlerMapping";
<ide>
<ide> /**
<del> * Name of the {@link ServerWebExchange} attribute that contains the URI
<del> * templates map, mapping variable names to values.
<add> * Name of the {@link ServerWebExchange#getAttributes() attribute} that
<add> * contains the URI templates map mapping variable names to values.
<ide> * <p>Note: This attribute is not required to be supported by all
<ide> * HandlerMapping implementations. URL-based HandlerMappings will
<ide> * typically support it, but handlers should not necessarily expect
<ide> public interface HandlerMapping {
<ide> String URI_TEMPLATE_VARIABLES_ATTRIBUTE = HandlerMapping.class.getName() + ".uriTemplateVariables";
<ide>
<ide> /**
<del> * Name of the {@link ServerWebExchange} attribute that contains a map with
<del> * URI matrix variables.
<add> * Name of the {@link ServerWebExchange#getAttributes() attribute} that
<add> * contains a map with URI variable names and a corresponding MultiValueMap
<add> * of URI matrix variables for each.
<ide> * <p>Note: This attribute is not required to be supported by all
<ide> * HandlerMapping implementations and may also not be present depending on
<ide> * whether the HandlerMapping is configured to keep matrix variable content
<ide> public interface HandlerMapping {
<ide> String MATRIX_VARIABLES_ATTRIBUTE = HandlerMapping.class.getName() + ".matrixVariables";
<ide>
<ide> /**
<del> * Name of the {@link ServerWebExchange} attribute that contains the set of
<del> * producible MediaTypes applicable to the mapped handler.
<add> * Name of the {@link ServerWebExchange#getAttributes() attribute} containing
<add> * the set of producible MediaType's applicable to the mapped handler.
<ide> * <p>Note: This attribute is not required to be supported by all
<ide> * HandlerMapping implementations. Handlers should not necessarily expect
<ide> * this request attribute to be present in all scenarios.
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractUrlHandlerMapping.java
<ide> private Object handleMatch(Object handler, PathPattern bestMatch, String pathWit
<ide>
<ide> validateHandler(handler, exchange);
<ide>
<del> exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, pathWithinMapping);
<add> exchange.getAttributes().put(BEST_MATCHING_HANDLER_ATTRIBUTE, handler);
<ide> exchange.getAttributes().put(BEST_MATCHING_PATTERN_ATTRIBUTE, bestMatch);
<add> exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, pathWithinMapping);
<ide>
<ide> return handler;
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java
<ide> protected HandlerMethod lookupHandlerMethod(String lookupPath, ServerWebExchange
<ide> lookupPath + "': {" + m1 + ", " + m2 + "}");
<ide> }
<ide> }
<del> handleMatch(bestMatch.mapping, lookupPath, exchange);
<add> handleMatch(bestMatch.mapping, bestMatch.handlerMethod, lookupPath, exchange);
<ide> return bestMatch.handlerMethod;
<ide> }
<ide> else {
<ide> private void addMatchingMappings(Collection<T> mappings, List<Match> matches, Se
<ide> /**
<ide> * Invoked when a matching mapping is found.
<ide> * @param mapping the matching mapping
<add> * @param handlerMethod the matching method
<ide> * @param lookupPath the lookup path within the current mapping
<ide> * @param exchange the current exchange
<ide> */
<del> protected void handleMatch(T mapping, String lookupPath, ServerWebExchange exchange) {
<add> protected void handleMatch(T mapping, HandlerMethod handlerMethod, String lookupPath,
<add> ServerWebExchange exchange) {
<ide> }
<ide>
<ide> /**
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMapping.java
<ide> protected Comparator<RequestMappingInfo> getMappingComparator(final ServerWebExc
<ide> * @see HandlerMapping#PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE
<ide> */
<ide> @Override
<del> protected void handleMatch(RequestMappingInfo info, String lookupPath, ServerWebExchange exchange) {
<del> super.handleMatch(info, lookupPath, exchange);
<add> protected void handleMatch(RequestMappingInfo info, HandlerMethod handlerMethod, String lookupPath,
<add> ServerWebExchange exchange) {
<add>
<add> super.handleMatch(info, handlerMethod, lookupPath, exchange);
<ide>
<ide> PathPattern bestPattern;
<ide> Map<String, String> uriVariables;
<ide> protected void handleMatch(RequestMappingInfo info, String lookupPath, ServerWeb
<ide> ));
<ide> }
<ide>
<add> exchange.getAttributes().put(BEST_MATCHING_HANDLER_ATTRIBUTE, handlerMethod);
<ide> exchange.getAttributes().put(BEST_MATCHING_PATTERN_ATTRIBUTE, bestPattern);
<ide> exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriVariables);
<ide>
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
<ide> import org.springframework.stereotype.Controller;
<add>import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.MultiValueMap;
<ide> import org.springframework.web.bind.annotation.GetMapping;
<ide> import org.springframework.web.bind.annotation.PutMapping;
<ide> import static org.junit.Assert.assertEquals;
<ide> import static org.junit.Assert.assertNotNull;
<ide> import static org.junit.Assert.assertNull;
<add>import static org.junit.Assert.assertSame;
<ide> import static org.junit.Assert.assertThat;
<ide> import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.get;
<ide> import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.method;
<ide> import static org.springframework.web.method.MvcAnnotationPredicates.getMapping;
<ide> import static org.springframework.web.method.MvcAnnotationPredicates.requestMapping;
<ide> import static org.springframework.web.method.ResolvableMethod.on;
<add>import static org.springframework.web.reactive.HandlerMapping.BEST_MATCHING_HANDLER_ATTRIBUTE;
<add>import static org.springframework.web.reactive.HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE;
<ide> import static org.springframework.web.reactive.result.method.RequestMappingInfo.paths;
<ide>
<ide> /**
<ide> */
<ide> public class RequestMappingInfoHandlerMappingTests {
<ide>
<add> private static final HandlerMethod handlerMethod = new HandlerMethod(new TestController(),
<add> ClassUtils.getMethod(TestController.class, "dummy"));
<add>
<ide> private TestRequestMappingInfoHandlerMapping handlerMapping;
<ide>
<ide>
<ide> public void getHandlerTestInvalidContentType() throws Exception {
<ide> Mono<Object> mono = this.handlerMapping.getHandler(exchange);
<ide>
<ide> assertError(mono, UnsupportedMediaTypeStatusException.class,
<del> ex -> assertEquals("Response status 415 with reason \"Invalid mime type \"bogus\": does not contain '/'\"",
<del> ex.getMessage()));
<add> ex -> assertEquals("Response status 415 with reason \"Invalid mime type \"bogus\": " +
<add> "does not contain '/'\"", ex.getMessage()));
<ide> }
<ide>
<ide> @Test // SPR-8462
<ide> public void handleMatchUriTemplateVariables() throws Exception {
<ide> String lookupPath = exchange.getRequest().getPath().pathWithinApplication().value();
<ide>
<ide> RequestMappingInfo key = paths("/{path1}/{path2}").build();
<del> this.handlerMapping.handleMatch(key, lookupPath, exchange);
<add> this.handlerMapping.handleMatch(key, handlerMethod, lookupPath, exchange);
<ide>
<ide> String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
<ide> Map<String, String> uriVariables = (Map<String, String>) exchange.getAttributes().get(name);
<ide> public void handleMatchUriTemplateVariablesDecode() throws Exception {
<ide> ServerWebExchange exchange = method(HttpMethod.GET, url).toExchange();
<ide>
<ide> String lookupPath = exchange.getRequest().getPath().pathWithinApplication().value();
<del> this.handlerMapping.handleMatch(key, lookupPath, exchange);
<add> this.handlerMapping.handleMatch(key, handlerMethod, lookupPath, exchange);
<ide>
<ide> String name = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
<ide> @SuppressWarnings("unchecked")
<ide> public void handleMatchBestMatchingPatternAttribute() throws Exception {
<ide> RequestMappingInfo key = paths("/{path1}/2", "/**").build();
<ide> ServerWebExchange exchange = get("/1/2").toExchange();
<ide> String lookupPath = exchange.getRequest().getPath().pathWithinApplication().value();
<del> this.handlerMapping.handleMatch(key, lookupPath, exchange);
<add> this.handlerMapping.handleMatch(key, handlerMethod, lookupPath, exchange);
<ide>
<del> PathPattern bestMatch = (PathPattern) exchange.getAttributes()
<del> .get(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
<add> PathPattern bestMatch = (PathPattern) exchange.getAttributes().get(BEST_MATCHING_PATTERN_ATTRIBUTE);
<ide> assertEquals("/{path1}/2", bestMatch.getPatternString());
<add>
<add> HandlerMethod mapped = (HandlerMethod) exchange.getAttributes().get(BEST_MATCHING_HANDLER_ATTRIBUTE);
<add> assertSame(handlerMethod, mapped);
<ide> }
<ide>
<ide> @Test
<ide> public void handleMatchBestMatchingPatternAttributeNoPatternsDefined() throws Exception {
<ide> RequestMappingInfo key = paths().build();
<ide> ServerWebExchange exchange = get("/1/2").toExchange();
<ide> String lookupPath = exchange.getRequest().getPath().pathWithinApplication().value();
<del> this.handlerMapping.handleMatch(key, lookupPath, exchange);
<add> this.handlerMapping.handleMatch(key, handlerMethod, lookupPath, exchange);
<ide>
<del> PathPattern bestMatch = (PathPattern) exchange.getAttributes()
<del> .get(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
<add> PathPattern bestMatch = (PathPattern) exchange.getAttributes().get(BEST_MATCHING_PATTERN_ATTRIBUTE);
<ide> assertEquals("/1/2", bestMatch.getPatternString());
<ide> }
<ide>
<ide> private <T> void assertError(Mono<Object> mono, final Class<T> exceptionClass, f
<ide> .consumeErrorWith(error -> {
<ide> assertEquals(exceptionClass, error.getClass());
<ide> consumer.accept((T) error);
<del>
<ide> })
<ide> .verify();
<ide> }
<ide> private void testMediaTypeNotAcceptable(String url) throws Exception {
<ide> private void handleMatch(ServerWebExchange exchange, String pattern) {
<ide> RequestMappingInfo info = paths(pattern).build();
<ide> String lookupPath = exchange.getRequest().getPath().pathWithinApplication().value();
<del> this.handlerMapping.handleMatch(info, lookupPath, exchange);
<add> this.handlerMapping.handleMatch(info, handlerMethod, lookupPath, exchange);
<ide> }
<ide>
<ide> @SuppressWarnings("unchecked")
<ide> private MultiValueMap<String, String> getMatrixVariables(ServerWebExchange exchange, String uriVarName) {
<del> String attrName = HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE;
<del> return ((Map<String, MultiValueMap<String, String>>) exchange.getAttributes().get(attrName)).get(uriVarName);
<add> return ((Map<String, MultiValueMap<String, String>>) exchange.getAttributes()
<add> .get(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE)).get(uriVarName);
<ide> }
<ide>
<ide> @SuppressWarnings("unchecked")
<ide> private Map<String, String> getUriTemplateVariables(ServerWebExchange exchange) {
<del> String attrName = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
<del> return (Map<String, String>) exchange.getAttributes().get(attrName);
<add> return (Map<String, String>) exchange.getAttributes()
<add> .get(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
<ide> }
<ide>
<ide>
<ide> public HttpHeaders fooOptions() {
<ide> headers.add("Allow", "PUT,POST");
<ide> return headers;
<ide> }
<add>
<add> public void dummy() { }
<ide> }
<ide>
<ide>
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerMapping.java
<ide> public interface HandlerMapping {
<ide>
<ide> /**
<ide> * Name of the {@link HttpServletRequest} attribute that contains a map with
<del> * URI matrix variables.
<add> * URI variable names and a corresponding MultiValueMap of URI matrix
<add> * variables for each.
<ide> * <p>Note: This attribute is not required to be supported by all
<ide> * HandlerMapping implementations and may also not be present depending on
<ide> * whether the HandlerMapping is configured to keep matrix variable content
<del> * in the request URI.
<ide> */
<ide> String MATRIX_VARIABLES_ATTRIBUTE = HandlerMapping.class.getName() + ".matrixVariables";
<ide> | 6 |
Mixed | Javascript | add a non-destroying iterator to readable | df85d37050bf2c2681e00d4c80b0907fe4c19da2 | <ide><path>doc/api/stream.md
<ide> async function print(readable) {
<ide> print(fs.createReadStream('file')).catch(console.error);
<ide> ```
<ide>
<del>If the loop terminates with a `break` or a `throw`, the stream will be
<del>destroyed. In other terms, iterating over a stream will consume the stream
<add>If the loop terminates with a `break`, `return`, or a `throw`, the stream will
<add>be destroyed. In other terms, iterating over a stream will consume the stream
<ide> fully. The stream will be read in chunks of size equal to the `highWaterMark`
<ide> option. In the code example above, data will be in a single chunk if the file
<ide> has less then 64KB of data because no `highWaterMark` option is provided to
<ide> [`fs.createReadStream()`][].
<ide>
<add>##### `readable.iterator([options])`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `options` {Object}
<add> * `destroyOnReturn` {boolean} When set to `false`, calling `return` on the
<add> async iterator, or exiting a `for await...of` iteration using a `break`,
<add> `return`, or `throw` will not destroy the stream. **Default:** `true`.
<add> * `destroyOnError` {boolean} When set to `false`, if the stream emits an
<add> error while it's being iterated, the iterator will not destroy the stream.
<add> **Default:** `true`.
<add>* Returns: {AsyncIterator} to consume the stream.
<add>
<add>The iterator created by this method gives users the option to cancel the
<add>destruction of the stream if the `for await...of` loop is exited by `return`,
<add>`break`, or `throw`, or if the iterator should destroy the stream if the stream
<add>emitted an error during iteration.
<add>
<add>```js
<add>const { Readable } = require('stream');
<add>
<add>async function printIterator(readable) {
<add> for await (const chunk of readable.iterator({ destroyOnReturn: false })) {
<add> console.log(chunk); // 1
<add> break;
<add> }
<add>
<add> console.log(readable.destroyed); // false
<add>
<add> for await (const chunk of readable.iterator({ destroyOnReturn: false })) {
<add> console.log(chunk); // Will print 2 and then 3
<add> }
<add>
<add> console.log(readable.destroyed); // True, stream was totally consumed
<add>}
<add>
<add>async function printSymbolAsyncIterator(readable) {
<add> for await (const chunk of readable) {
<add> console.log(chunk); // 1
<add> break;
<add> }
<add>
<add> console.log(readable.destroyed); // true
<add>}
<add>
<add>async function showBoth() {
<add> await printIterator(Readable.from([1, 2, 3]));
<add> await printSymbolAsyncIterator(Readable.from([1, 2, 3]));
<add>}
<add>
<add>showBoth();
<add>```
<add>
<ide> ### Duplex and transform streams
<ide>
<ide> #### Class: `stream.Duplex`
<ide><path>lib/internal/streams/readable.js
<ide> const {
<ide> ERR_METHOD_NOT_IMPLEMENTED,
<ide> ERR_STREAM_UNSHIFT_AFTER_END_EVENT
<ide> } = require('internal/errors').codes;
<add>const { validateObject } = require('internal/validators');
<ide>
<ide> const kPaused = Symbol('kPaused');
<ide>
<ide> Readable.prototype.wrap = function(stream) {
<ide> };
<ide>
<ide> Readable.prototype[SymbolAsyncIterator] = function() {
<del> let stream = this;
<add> return streamToAsyncIterator(this);
<add>};
<ide>
<add>Readable.prototype.iterator = function(options) {
<add> if (options !== undefined) {
<add> validateObject(options, 'options');
<add> }
<add> return streamToAsyncIterator(this, options);
<add>};
<add>
<add>function streamToAsyncIterator(stream, options) {
<ide> if (typeof stream.read !== 'function') {
<ide> // v1 stream
<ide> const src = stream;
<ide> Readable.prototype[SymbolAsyncIterator] = function() {
<ide> }).wrap(src);
<ide> }
<ide>
<del> const iter = createAsyncIterator(stream);
<add> const iter = createAsyncIterator(stream, options);
<ide> iter.stream = stream;
<ide> return iter;
<del>};
<add>}
<ide>
<del>async function* createAsyncIterator(stream) {
<add>async function* createAsyncIterator(stream, options) {
<ide> let callback = nop;
<ide>
<add> const opts = {
<add> destroyOnReturn: true,
<add> destroyOnError: true,
<add> ...options,
<add> };
<add>
<ide> function next(resolve) {
<ide> if (this === stream) {
<ide> callback();
<ide> async function* createAsyncIterator(stream) {
<ide> next.call(this);
<ide> });
<ide>
<add> let errorThrown = false;
<ide> try {
<ide> while (true) {
<ide> const chunk = stream.destroyed ? null : stream.read();
<ide> async function* createAsyncIterator(stream) {
<ide> }
<ide> }
<ide> } catch (err) {
<del> destroyImpl.destroyer(stream, err);
<add> if (opts.destroyOnError) {
<add> destroyImpl.destroyer(stream, err);
<add> }
<add> errorThrown = true;
<ide> throw err;
<ide> } finally {
<del> if (state.autoDestroy || !endEmitted) {
<del> // TODO(ronag): ERR_PREMATURE_CLOSE?
<del> destroyImpl.destroyer(stream, null);
<add> if (!errorThrown && opts.destroyOnReturn) {
<add> if (state.autoDestroy || !endEmitted) {
<add> // TODO(ronag): ERR_PREMATURE_CLOSE?
<add> destroyImpl.destroyer(stream, null);
<add> }
<ide> }
<ide> }
<ide> }
<ide><path>test/parallel/test-stream-readable-async-iterators.js
<ide> async function tests() {
<ide> });
<ide> }
<ide>
<add>// AsyncIterator non-destroying iterator
<add>{
<add> function createReadable() {
<add> return Readable.from((async function* () {
<add> await Promise.resolve();
<add> yield 5;
<add> await Promise.resolve();
<add> yield 7;
<add> await Promise.resolve();
<add> })());
<add> }
<add>
<add> function createErrorReadable() {
<add> const opts = { read() { throw new Error('inner'); } };
<add> return new Readable(opts);
<add> }
<add>
<add> // Check default destroys on return
<add> (async function() {
<add> const readable = createReadable();
<add> for await (const chunk of readable.iterator()) {
<add> assert.strictEqual(chunk, 5);
<add> break;
<add> }
<add>
<add> assert.ok(readable.destroyed);
<add> })().then(common.mustCall());
<add>
<add> // Check explicit destroying on return
<add> (async function() {
<add> const readable = createReadable();
<add> for await (const chunk of readable.iterator({ destroyOnReturn: true })) {
<add> assert.strictEqual(chunk, 5);
<add> break;
<add> }
<add>
<add> assert.ok(readable.destroyed);
<add> })().then(common.mustCall());
<add>
<add> // Check default destroys on error
<add> (async function() {
<add> const readable = createErrorReadable();
<add> try {
<add> // eslint-disable-next-line no-unused-vars
<add> for await (const chunk of readable) { }
<add> assert.fail('should have thrown');
<add> } catch (err) {
<add> assert.strictEqual(err.message, 'inner');
<add> }
<add>
<add> assert.ok(readable.destroyed);
<add> })().then(common.mustCall());
<add>
<add> // Check explicit destroys on error
<add> (async function() {
<add> const readable = createErrorReadable();
<add> const opts = { destroyOnError: true, destroyOnReturn: false };
<add> try {
<add> // eslint-disable-next-line no-unused-vars
<add> for await (const chunk of readable.iterator(opts)) { }
<add> assert.fail('should have thrown');
<add> } catch (err) {
<add> assert.strictEqual(err.message, 'inner');
<add> }
<add>
<add> assert.ok(readable.destroyed);
<add> })().then(common.mustCall());
<add>
<add> // Check explicit non-destroy with return true
<add> (async function() {
<add> const readable = createErrorReadable();
<add> const opts = { destroyOnError: false, destroyOnReturn: true };
<add> try {
<add> // eslint-disable-next-line no-unused-vars
<add> for await (const chunk of readable.iterator(opts)) { }
<add> assert.fail('should have thrown');
<add> } catch (err) {
<add> assert.strictEqual(err.message, 'inner');
<add> }
<add>
<add> assert.ok(!readable.destroyed);
<add> })().then(common.mustCall());
<add>
<add> // Check explicit non-destroy with return true
<add> (async function() {
<add> const readable = createReadable();
<add> const opts = { destroyOnReturn: false };
<add> for await (const chunk of readable.iterator(opts)) {
<add> assert.strictEqual(chunk, 5);
<add> break;
<add> }
<add>
<add> assert.ok(!readable.destroyed);
<add>
<add> for await (const chunk of readable.iterator(opts)) {
<add> assert.strictEqual(chunk, 7);
<add> }
<add>
<add> assert.ok(readable.destroyed);
<add> })().then(common.mustCall());
<add>
<add> // Check non-object options.
<add> {
<add> const readable = createReadable();
<add> assert.throws(
<add> () => readable.iterator(42),
<add> {
<add> code: 'ERR_INVALID_ARG_TYPE',
<add> name: 'TypeError',
<add> message: 'The "options" argument must be of type object. Received ' +
<add> 'type number (42)',
<add> }
<add> );
<add> }
<add>}
<add>
<ide> {
<ide> let _req;
<ide> const server = http.createServer((request, response) => { | 3 |
Javascript | Javascript | fix lint errors | 9c16e5c67313077dd1b75ccfaf6e006e7c072dec | <ide><path>spec/integration/helpers/start-atom.js
<ide> const buildAtomClient = async (args, env) => {
<ide> host: 'localhost',
<ide> port: ChromedriverPort,
<ide> capabilities: {
<del> browserName: 'chrome', //Webdriverio will figure it out on it's own, but I will leave it in case it's helpful in the future https://webdriver.io/docs/configurationfile.html
<add> browserName: 'chrome', // Webdriverio will figure it out on it's own, but I will leave it in case it's helpful in the future https://webdriver.io/docs/configurationfile.html
<ide> 'goog:chromeOptions': {
<ide> binary: AtomLauncherPath,
<ide> args: [
<ide> Logs:\n${chromedriverLogs.join('\n')}`);
<ide> try {
<ide> client = await buildAtomClient(args, env);
<ide> } catch (error) {
<del> console.log(error)
<ide> jasmine
<ide> .getEnv()
<ide> .currentSpec.fail(`Unable to build Atom client.\n${error}`);
<ide><path>src/crash-reporter-start.js
<ide> module.exports = function(params) {
<ide> const arch = os.arch();
<ide> const { uploadToServer, releaseChannel } = params;
<ide>
<del> const parsedUploadToServer = uploadToServer !== null? uploadToServer : false;
<add> const parsedUploadToServer = uploadToServer !== null ? uploadToServer : false;
<ide>
<ide> crashReporter.start({
<ide> productName: 'Atom',
<ide><path>src/module-cache.js
<ide> function registerBuiltins(devMode) {
<ide> const rendererBuiltins = [
<ide> 'crash-reporter',
<ide> 'ipc-renderer',
<del> 'remote',
<del> //'screen' Deprecated https://www.electronjs.org/docs/breaking-changes#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote
<add> 'remote'
<add> // 'screen' Deprecated https://www.electronjs.org/docs/breaking-changes#api-changed-electronscreen-in-the-renderer-process-should-be-accessed-via-remote
<ide> ];
<ide> for (const builtin of rendererBuiltins) {
<ide> cache.builtins[builtin] = path.join(rendererRoot, `${builtin}.js`); | 3 |
Ruby | Ruby | parenthesize argument(s) for future version' | eca31da253471f2f8fc2893e35281aa0c7a357ed | <ide><path>Library/Homebrew/formula.rb
<ide> def initialize url, specs=nil
<ide> # Returns a suitable DownloadStrategy class that can be
<ide> # used to retreive this software package.
<ide> def download_strategy
<del> return detect_download_strategy @url if @using.nil?
<add> return detect_download_strategy(@url) if @using.nil?
<ide>
<ide> # If a class is passed, assume it is a download strategy
<ide> return @using if @using.kind_of? Class | 1 |
Python | Python | add a test case for new method | 5685a7b0339d7f697cbcdb8f0e8e0a74c956a26b | <ide><path>libcloud/test/compute/test_gce.py
<ide> def test_ex_instancegroup_set_named_ports(self):
<ide> {'name': 'foo',
<ide> 'port': 4444})
<ide>
<add> def test_ex_instancegroupmanager_set_autohealing_policies(self):
<add> kwargs = {'host': 'lchost',
<add> 'path': '/lc',
<add> 'port': 8000,
<add> 'interval': 10,
<add> 'timeout': 10,
<add> 'unhealthy_threshold': 4,
<add> 'healthy_threshold': 3,
<add> 'description': 'test healthcheck'}
<add> healthcheck_name = 'lchealthcheck'
<add> hc = self.driver.ex_create_healthcheck(healthcheck_name, **kwargs)
<add>
<add> ig_name = 'myinstancegroup'
<add> ig_zone = 'us-central1-a'
<add> manager = self.driver.ex_get_instancegroupmanager(ig_name, ig_zone)
<add>
<add> res = self.driver.ex_instancegroupmanager_set_autohealingpolicies(
<add> manager=manager, healthcheck=hc, initialdelaysec=2)
<add> self.assertTrue(res)
<add>
<add> res = manager.set_autohealingpolicies(healthcheck=hc, initialdelaysec=2)
<add> self.assertTrue(res)
<add>
<ide> def test_ex_create_instancegroupmanager(self):
<ide> name = 'myinstancegroup'
<ide> zone = 'us-central1-a'
<ide> def _zones_us_central1_a_instanceGroups_myinstancegroup_shared_network(
<ide>
<ide> def _zones_us_central1_a_instanceGroupManagers_myinstancegroup(
<ide> self, method, url, body, headers):
<del> body = self.fixtures.load(
<del> 'zones_us-central1-a_instanceGroupManagers_myinstancegroup.json')
<add> if method == 'PATCH':
<add> # test_ex_instancegroupmanager_set_autohealing_policies
<add> body = self.fixtures.load(
<add> 'zones_us-central1-a_operations_operation_zones_us-central1-a_instanceGroupManagers_insert_post.json')
<add> else:
<add> body = self.fixtures.load(
<add> 'zones_us-central1-a_instanceGroupManagers_myinstancegroup.json')
<ide> return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
<ide>
<ide> def _zones_us_central1_a_instanceGroupManagers_myinstancegroup_shared_network( | 1 |
Python | Python | fix metaclass usage for py3 | 83f76585725fd380b61f35576bb1c307fe2a1a5e | <ide><path>flask/views.py
<ide> :license: BSD, see LICENSE for more details.
<ide> """
<ide> from .globals import request
<add>from ._compat import with_metaclass
<ide>
<ide>
<ide> http_method_funcs = frozenset(['get', 'post', 'head', 'options',
<ide> def __new__(cls, name, bases, d):
<ide> return rv
<ide>
<ide>
<del>class MethodView(View):
<add>class MethodView(with_metaclass(MethodViewType, View)):
<ide> """Like a regular class-based view but that dispatches requests to
<ide> particular methods. For instance if you implement a method called
<ide> :meth:`get` it means you will response to ``'GET'`` requests and
<ide> def post(self):
<ide>
<ide> app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))
<ide> """
<del> __metaclass__ = MethodViewType
<del>
<ide> def dispatch_request(self, *args, **kwargs):
<ide> meth = getattr(self, request.method.lower(), None)
<ide> # if the request method is HEAD and we don't have a handler for it | 1 |
PHP | PHP | allow modulus of 0 | a61b5ae0d9830df5819d03af4e47c3c256a5dce0 | <ide><path>src/View/Helper/PaginatorHelper.php
<ide> public function numbers(array $options = [])
<ide> $templater->{$method}($options['templates']);
<ide> }
<ide>
<del> if ($options['modulus'] && $params['pageCount'] > $options['modulus']) {
<add> if ($options['modulus'] !== false && $params['pageCount'] > $options['modulus']) {
<ide> $out = $this->_modulusNumbers($templater, $params, $options);
<ide> } else {
<ide> $out = $this->_numbers($templater, $params, $options);
<ide><path>tests/TestCase/View/Helper/PaginatorHelperTest.php
<ide> public function testNumbersModulus()
<ide> ['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
<ide> ];
<ide> $this->assertHtml($expected, $result);
<add>
<add> $this->Paginator->request->params['paging']['Client']['page'] = 3;
<add> $result = $this->Paginator->numbers(['first' => 2, 'modulus' => 0, 'last' => 2]);
<add> $expected = [
<add> ['li' => []], ['a' => ['href' => '/index']], '1', '/a', '/li',
<add> ['li' => []], ['a' => ['href' => '/index?page=2']], '2', '/a', '/li',
<add> ['li' => ['class' => 'active']], '<a href=""', '3', '/a', '/li',
<add> ['li' => ['class' => 'ellipsis']], '...', '/li',
<add> ['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
<add> ['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
<add> ];
<add> $this->assertHtml($expected, $result);
<ide> }
<ide>
<ide> /** | 2 |
Javascript | Javascript | fix a lint error | d8905b524d2ff3d7590b56ed990e6602de526793 | <ide><path>web/viewer.js
<ide> var PageView = function(container, content, id, pageWidth, pageHeight,
<ide> for (var i = 0; i < links.length; i++) {
<ide> var link = document.createElement('a');
<ide> link.style.left = (Math.floor(links[i].x - this.x) * scale) + 'px';
<del> link.style.top = (Math.floor(links[i].y - this.y) * scale) + 'px';
<add> link.style.top = (Math.floor(links[i].y - this.y) * scale) + 'px';
<ide> link.style.width = Math.ceil(links[i].width * scale) + 'px';
<ide> link.style.height = Math.ceil(links[i].height * scale) + 'px';
<ide> link.href = links[i].url || ''; | 1 |
Text | Text | update v2.2 page [ci skip] | 66aa0d479fa8710bc81257d4b18a11a0fe65f73d | <ide><path>website/docs/usage/v2-2.md
<ide> menu:
<ide>
<ide> spaCy v2.2 features improved statistical models, new pretrained models for
<ide> Norwegian and Lithuanian, better Dutch NER, as well as a new mechanism for
<del>storing language data that makes the installation about **7× smaller** on
<del>disk. We've also added a new class to efficiently **serialize annotations**, an
<del>improved and **10× faster** phrase matching engine, built-in scoring and
<del>**CLI training for text classification**, a new command to analyze and **debug
<del>training data**, data augmentation during training and more. For the full
<del>changelog, see the
<add>storing language data that makes the installation about **5-10× smaller**
<add>on disk. We've also added a new class to efficiently **serialize annotations**,
<add>an improved and **10× faster** phrase matching engine, built-in scoring
<add>and **CLI training for text classification**, a new command to analyze and
<add>**debug training data**, data augmentation during training and more. For the
<add>full changelog, see the
<ide> [release notes on GitHub](https://github.com/explosion/spaCy/releases/tag/v2.2.0).
<ide>
<ide> <!-- For more details and a behind-the-scenes look at the new release,
<ide> checks. They're also fully serializable out-of-the-box. All large data resources
<ide> like lemmatization tables have been moved to a separate package,
<ide> [`spacy-lookups-data`](https://github.com/explosion/spacy-lookups-data) that can
<ide> be installed alongside the core library. This allowed us to make the spaCy
<del>installation roughly **7× smaller on disk**. [Pretrained models](/models)
<del>now include their data files, so you only need to install the lookups if you
<del>want to build blank models or use lemmatization with languages that don't yet
<del>ship with pretrained models.
<add>installation **5-10× smaller on disk** (depending on your platform).
<add>[Pretrained models](/models) now include their data files, so you only need to
<add>install the lookups if you want to build blank models or use lemmatization with
<add>languages that don't yet ship with pretrained models.
<ide>
<ide> <Infobox>
<ide> | 1 |
Ruby | Ruby | use default argument in test | e4af759bf3ee621e9ad37ad71c637c24501205a5 | <ide><path>railties/test/application/rake/multi_dbs_test.rb
<ide> def db_migrate_and_schema_cache_dump_and_schema_cache_clear
<ide> end
<ide> end
<ide>
<del> def db_migrate_and_schema_dump_and_load(schema_format)
<add> def db_migrate_and_schema_dump_and_load(schema_format = "ruby")
<ide> add_to_config "config.active_record.schema_format = :#{schema_format}"
<ide> require "#{app_path}/config/environment"
<ide>
<ide> def generate_models_for_animals
<ide> end
<ide>
<ide> test "db:migrate and db:schema:dump and db:schema:load works on all databases" do
<del> db_migrate_and_schema_dump_and_load "ruby"
<add> db_migrate_and_schema_dump_and_load
<ide> end
<ide>
<ide> test "db:migrate and db:schema:dump and db:schema:load works on all databases with sql option" do
<ide> class TwoMigration < ActiveRecord::Migration::Current
<ide> ENV.delete "RAILS_ENV"
<ide> ENV.delete "RACK_ENV"
<ide>
<del> db_migrate_and_schema_dump_and_load "ruby"
<add> db_migrate_and_schema_dump_and_load
<ide>
<ide> app_file "db/seeds.rb", <<-RUBY
<ide> print Book.connection.pool.db_config.database | 1 |
Javascript | Javascript | simplify the output scale for css zoom | 52e429550ce43edbedb6f94795f41478f06dca6f | <ide><path>web/page_view.js
<ide> var PageView = function pageView(container, id, scale,
<ide> var outputScale = getOutputScale(ctx);
<ide>
<ide> if (USE_ONLY_CSS_ZOOM) {
<del> // Use a scale that will give a 100% width canvas.
<del> outputScale.sx *= 1 / (viewport.scale / CSS_UNITS);
<del> outputScale.sy *= 1 / (viewport.scale / CSS_UNITS);
<add> var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });
<add> // Use a scale that will make the canvas be the original intended size
<add> // of the page.
<add> outputScale.sx *= actualSizeViewport.width / viewport.width;
<add> outputScale.sy *= actualSizeViewport.height / viewport.height;
<ide> outputScale.scaled = true;
<ide> }
<ide> | 1 |
Python | Python | use translatable error strings. refs | 6cb6510132b319c96b28bea732032aaf2d495895 | <ide><path>rest_framework/exceptions.py
<ide> (`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
<ide> """
<ide> from __future__ import unicode_literals
<add>
<add>from django.utils.translation import ugettext_lazy as _
<add>from django.utils.translation import ungettext_lazy
<ide> from rest_framework import status
<add>from rest_framework.compat import force_text
<ide> import math
<ide>
<ide>
<ide> class APIException(Exception):
<ide> Subclasses should provide `.status_code` and `.default_detail` properties.
<ide> """
<ide> status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
<del> default_detail = 'A server error occured'
<add> default_detail = _('A server error occured')
<ide>
<ide> def __init__(self, detail=None):
<del> self.detail = detail or self.default_detail
<add> if detail is not None:
<add> self.detail = force_text(detail)
<add> else:
<add> self.detail = force_text(self.default_detail)
<ide>
<ide> def __str__(self):
<ide> return self.detail
<ide> def __str__(self):
<ide> # from rest_framework import serializers
<ide> # raise serializers.ValidationError('Value was invalid')
<ide>
<add>def force_text_recursive(data):
<add> if isinstance(data, list):
<add> return [
<add> force_text_recursive(item) for item in data
<add> ]
<add> elif isinstance(data, dict):
<add> return dict([
<add> (key, force_text_recursive(value))
<add> for key, value in data.items()
<add> ])
<add> return force_text(data)
<add>
<add>
<ide> class ValidationError(APIException):
<ide> status_code = status.HTTP_400_BAD_REQUEST
<ide>
<ide> def __init__(self, detail):
<ide> # The details should always be coerced to a list if not already.
<ide> if not isinstance(detail, dict) and not isinstance(detail, list):
<ide> detail = [detail]
<del> self.detail = detail
<add> self.detail = force_text_recursive(detail)
<ide>
<ide> def __str__(self):
<ide> return str(self.detail)
<ide>
<ide>
<ide> class ParseError(APIException):
<ide> status_code = status.HTTP_400_BAD_REQUEST
<del> default_detail = 'Malformed request.'
<add> default_detail = _('Malformed request.')
<ide>
<ide>
<ide> class AuthenticationFailed(APIException):
<ide> status_code = status.HTTP_401_UNAUTHORIZED
<del> default_detail = 'Incorrect authentication credentials.'
<add> default_detail = _('Incorrect authentication credentials.')
<ide>
<ide>
<ide> class NotAuthenticated(APIException):
<ide> status_code = status.HTTP_401_UNAUTHORIZED
<del> default_detail = 'Authentication credentials were not provided.'
<add> default_detail = _('Authentication credentials were not provided.')
<ide>
<ide>
<ide> class PermissionDenied(APIException):
<ide> status_code = status.HTTP_403_FORBIDDEN
<del> default_detail = 'You do not have permission to perform this action.'
<add> default_detail = _('You do not have permission to perform this action.')
<ide>
<ide>
<ide> class MethodNotAllowed(APIException):
<ide> status_code = status.HTTP_405_METHOD_NOT_ALLOWED
<del> default_detail = "Method '%s' not allowed."
<add> default_detail = _("Method '%s' not allowed.")
<ide>
<ide> def __init__(self, method, detail=None):
<del> self.detail = detail or (self.default_detail % method)
<add> if detail is not None:
<add> self.detail = force_text(detail)
<add> else:
<add> self.detail = force_text(self.default_detail) % method
<ide>
<ide>
<ide> class NotAcceptable(APIException):
<ide> status_code = status.HTTP_406_NOT_ACCEPTABLE
<del> default_detail = "Could not satisfy the request Accept header"
<add> default_detail = _('Could not satisfy the request Accept header')
<ide>
<ide> def __init__(self, detail=None, available_renderers=None):
<del> self.detail = detail or self.default_detail
<add> if detail is not None:
<add> self.detail = force_text(detail)
<add> else:
<add> self.detail = force_text(self.default_detail)
<ide> self.available_renderers = available_renderers
<ide>
<ide>
<ide> class UnsupportedMediaType(APIException):
<ide> status_code = status.HTTP_415_UNSUPPORTED_MEDIA_TYPE
<del> default_detail = "Unsupported media type '%s' in request."
<add> default_detail = _("Unsupported media type '%s' in request.")
<ide>
<ide> def __init__(self, media_type, detail=None):
<del> self.detail = detail or (self.default_detail % media_type)
<add> if detail is not None:
<add> self.detail = force_text(detail)
<add> else:
<add> self.detail = force_text(self.default_detail) % media_type
<ide>
<ide>
<ide> class Throttled(APIException):
<ide> status_code = status.HTTP_429_TOO_MANY_REQUESTS
<del> default_detail = 'Request was throttled.'
<del> extra_detail = " Expected available in %d second%s."
<add> default_detail = _('Request was throttled.')
<add> extra_detail = ungettext_lazy(
<add> 'Expected available in %(wait)d second.',
<add> 'Expected available in %(wait)d seconds.',
<add> 'wait'
<add> )
<ide>
<ide> def __init__(self, wait=None, detail=None):
<add> if detail is not None:
<add> self.detail = force_text(detail)
<add> else:
<add> self.detail = force_text(self.default_detail)
<add>
<ide> if wait is None:
<del> self.detail = detail or self.default_detail
<ide> self.wait = None
<ide> else:
<del> format = (detail or self.default_detail) + self.extra_detail
<del> self.detail = format % (wait, wait != 1 and 's' or '')
<ide> self.wait = math.ceil(wait)
<add> self.detail += ' ' + force_text(
<add> self.extra_detail % {'wait': self.wait}
<add> ) | 1 |
Python | Python | remove tests in old structure | 36a41720af85ec282054bd3db1d160d7e151e73c | <ide><path>tests/test_graph_model.py
<del>from __future__ import print_function
<del>import pytest
<del>import numpy as np
<del>import os
<del>np.random.seed(1337)
<del>
<del>from keras.models import Graph, Sequential
<del>from keras.layers import containers
<del>from keras.layers.core import Dense, Activation
<del>from keras.utils.test_utils import get_test_data
<del>
<del>(X_train, y_train), (X_test, y_test) = get_test_data(nb_train=1000,
<del> nb_test=200,
<del> input_shape=(32,),
<del> classification=False,
<del> output_shape=(4,))
<del>(X2_train, y2_train), (X2_test, y2_test) = get_test_data(nb_train=1000,
<del> nb_test=200,
<del> input_shape=(32,),
<del> classification=False,
<del> output_shape=(1,))
<del>
<del>
<del>def test_1o_1i():
<del> # test a non-sequential graph with 1 input and 1 output
<del> np.random.seed(1337)
<del>
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del>
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input1')
<del> graph.add_node(Dense(4), name='dense3', input='dense1')
<del>
<del> graph.add_output(name='output1',
<del> inputs=['dense2', 'dense3'],
<del> merge_mode='sum')
<del> graph.compile('rmsprop', {'output1': 'mse'})
<del>
<del> history = graph.fit({'input1': X_train, 'output1': y_train},
<del> nb_epoch=10)
<del> out = graph.predict({'input1': X_test})
<del> assert(type(out == dict))
<del> assert(len(out) == 1)
<del> loss = graph.test_on_batch({'input1': X_test, 'output1': y_test})
<del> loss = graph.train_on_batch({'input1': X_test, 'output1': y_test})
<del> loss = graph.evaluate({'input1': X_test, 'output1': y_test})
<del> assert(loss < 2.5)
<del>
<del> # test validation split
<del> history = graph.fit({'input1': X_train, 'output1': y_train},
<del> validation_split=0.2, nb_epoch=1)
<del> # test validation data
<del> history = graph.fit({'input1': X_train, 'output1': y_train},
<del> validation_data={'input1': X_train, 'output1': y_train},
<del> nb_epoch=1)
<del>
<del>
<del>def test_1o_1i_2():
<del> # test a more complex non-sequential graph with 1 input and 1 output
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del>
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2-0', input='input1')
<del> graph.add_node(Activation('relu'), name='dense2', input='dense2-0')
<del>
<del> graph.add_node(Dense(16), name='dense3', input='dense2')
<del> graph.add_node(Dense(4), name='dense4', inputs=['dense1', 'dense3'],
<del> merge_mode='sum')
<del>
<del> graph.add_output(name='output1', inputs=['dense2', 'dense4'],
<del> merge_mode='sum')
<del> graph.compile('rmsprop', {'output1': 'mse'})
<del>
<del> history = graph.fit({'input1': X_train, 'output1': y_train},
<del> nb_epoch=10)
<del> out = graph.predict({'input1': X_train})
<del> assert(type(out == dict))
<del> assert(len(out) == 1)
<del>
<del> loss = graph.test_on_batch({'input1': X_test, 'output1': y_test})
<del> loss = graph.train_on_batch({'input1': X_test, 'output1': y_test})
<del> loss = graph.evaluate({'input1': X_test, 'output1': y_test})
<del> assert(loss < 2.5)
<del>
<del> graph.get_config(verbose=1)
<del>
<del>
<del>def test_1o_2i():
<del> # test a non-sequential graph with 2 inputs and 1 output
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del> graph.add_input(name='input2', input_shape=(32,))
<del>
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input2')
<del> graph.add_node(Dense(4), name='dense3', input='dense1')
<del>
<del> graph.add_output(name='output1', inputs=['dense2', 'dense3'],
<del> merge_mode='sum')
<del> graph.compile('rmsprop', {'output1': 'mse'})
<del>
<del> history = graph.fit({'input1': X_train, 'input2': X2_train, 'output1': y_train},
<del> nb_epoch=10)
<del> out = graph.predict({'input1': X_test, 'input2': X2_test})
<del> assert(type(out == dict))
<del> assert(len(out) == 1)
<del>
<del> loss = graph.test_on_batch({'input1': X_test, 'input2': X2_test, 'output1': y_test})
<del> loss = graph.train_on_batch({'input1': X_test, 'input2': X2_test, 'output1': y_test})
<del> loss = graph.evaluate({'input1': X_test, 'input2': X2_test, 'output1': y_test})
<del> assert(loss < 3.0)
<del>
<del> graph.get_config(verbose=1)
<del>
<del>
<del>def test_2o_1i_weights():
<del> # test a non-sequential graph with 1 input and 2 outputs
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del>
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input1')
<del> graph.add_node(Dense(1), name='dense3', input='dense1')
<del>
<del> graph.add_output(name='output1', input='dense2')
<del> graph.add_output(name='output2', input='dense3')
<del> graph.compile('rmsprop', {'output1': 'mse', 'output2': 'mse'})
<del>
<del> history = graph.fit({'input1': X_train, 'output1': y_train, 'output2': y2_train},
<del> nb_epoch=10)
<del> out = graph.predict({'input1': X_test})
<del> assert(type(out == dict))
<del> assert(len(out) == 2)
<del> loss = graph.test_on_batch({'input1': X_test, 'output1': y_test, 'output2': y2_test})
<del> loss = graph.train_on_batch({'input1': X_test, 'output1': y_test, 'output2': y2_test})
<del> loss = graph.evaluate({'input1': X_test, 'output1': y_test, 'output2': y2_test})
<del> assert(loss < 4.)
<del>
<del> # test weight saving
<del> fname = 'test_2o_1i_weights_temp.h5'
<del> graph.save_weights(fname, overwrite=True)
<del>
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input1')
<del> graph.add_node(Dense(1), name='dense3', input='dense1')
<del> graph.add_output(name='output1', input='dense2')
<del> graph.add_output(name='output2', input='dense3')
<del> graph.compile('rmsprop', {'output1': 'mse', 'output2': 'mse'})
<del> graph.load_weights('test_2o_1i_weights_temp.h5')
<del> os.remove(fname)
<del>
<del> nloss = graph.evaluate({'input1': X_test, 'output1': y_test, 'output2': y2_test})
<del> assert(loss == nloss)
<del>
<del>
<del>def test_2o_1i_sample_weights():
<del> # test a non-sequential graph with 1 input and 2 outputs with sample weights
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del>
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input1')
<del> graph.add_node(Dense(1), name='dense3', input='dense1')
<del>
<del> graph.add_output(name='output1', input='dense2')
<del> graph.add_output(name='output2', input='dense3')
<del>
<del> weights1 = np.random.uniform(size=y_train.shape[0])
<del> weights2 = np.random.uniform(size=y2_train.shape[0])
<del> weights1_test = np.random.uniform(size=y_test.shape[0])
<del> weights2_test = np.random.uniform(size=y2_test.shape[0])
<del>
<del> graph.compile('rmsprop', {'output1': 'mse', 'output2': 'mse'})
<del>
<del> history = graph.fit({'input1': X_train, 'output1': y_train, 'output2': y2_train},
<del> nb_epoch=10,
<del> sample_weight={'output1': weights1, 'output2': weights2})
<del> out = graph.predict({'input1': X_test})
<del> assert(type(out == dict))
<del> assert(len(out) == 2)
<del> loss = graph.test_on_batch({'input1': X_test, 'output1': y_test, 'output2': y2_test},
<del> sample_weight={'output1': weights1_test, 'output2': weights2_test})
<del> loss = graph.train_on_batch({'input1': X_train, 'output1': y_train, 'output2': y2_train},
<del> sample_weight={'output1': weights1, 'output2': weights2})
<del> loss = graph.evaluate({'input1': X_train, 'output1': y_train, 'output2': y2_train},
<del> sample_weight={'output1': weights1, 'output2': weights2})
<del>
<del>
<del>def test_recursive():
<del> # test layer-like API
<del>
<del> graph = containers.Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input1')
<del> graph.add_node(Dense(4), name='dense3', input='dense1')
<del> graph.add_output(name='output1', inputs=['dense2', 'dense3'],
<del> merge_mode='sum')
<del>
<del> seq = Sequential()
<del> seq.add(Dense(32, input_shape=(32,)))
<del> seq.add(graph)
<del> seq.add(Dense(4))
<del>
<del> seq.compile('rmsprop', 'mse')
<del>
<del> history = seq.fit(X_train, y_train, batch_size=10, nb_epoch=10)
<del> loss = seq.evaluate(X_test, y_test)
<del> assert(loss < 2.5)
<del>
<del> loss = seq.evaluate(X_test, y_test, show_accuracy=True)
<del> pred = seq.predict(X_test)
<del> seq.get_config(verbose=1)
<del>
<del>
<del>def test_create_output():
<del> # test create_output argument
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del>
<del> graph.add_node(Dense(16), name='dense1', input='input1')
<del> graph.add_node(Dense(4), name='dense2', input='input1')
<del> graph.add_node(Dense(4), name='dense3', input='dense1')
<del> graph.add_node(Dense(4), name='output1', inputs=['dense2', 'dense3'],
<del> merge_mode='sum', create_output=True)
<del> graph.compile('rmsprop', {'output1': 'mse'})
<del>
<del> history = graph.fit({'input1': X_train, 'output1': y_train},
<del> nb_epoch=10)
<del> out = graph.predict({'input1': X_test})
<del> assert(type(out == dict))
<del> assert(len(out) == 1)
<del>
<del> loss = graph.test_on_batch({'input1': X_test, 'output1': y_test})
<del> loss = graph.train_on_batch({'input1': X_test, 'output1': y_test})
<del> loss = graph.evaluate({'input1': X_test, 'output1': y_test})
<del> assert(loss < 2.5)
<del>
<del>
<del>def test_count_params():
<del> # test count params
<del>
<del> nb_units = 100
<del> nb_classes = 2
<del>
<del> graph = Graph()
<del> graph.add_input(name='input1', input_shape=(32,))
<del> graph.add_input(name='input2', input_shape=(32,))
<del> graph.add_node(Dense(nb_units),
<del> name='dense1', input='input1')
<del> graph.add_node(Dense(nb_classes),
<del> name='dense2', input='input2')
<del> graph.add_node(Dense(nb_classes),
<del> name='dense3', input='dense1')
<del> graph.add_output(name='output', inputs=['dense2', 'dense3'],
<del> merge_mode='sum')
<del>
<del> n = 32 * nb_units + nb_units
<del> n += 32 * nb_classes + nb_classes
<del> n += nb_units * nb_classes + nb_classes
<del>
<del> assert(n == graph.count_params())
<del>
<del> graph.compile('rmsprop', {'output': 'binary_crossentropy'})
<del>
<del> assert(n == graph.count_params())
<del>
<del>
<del>if __name__ == '__main__':
<del> pytest.main([__file__])
<ide><path>tests/test_sequential_model.py
<del>from __future__ import absolute_import
<del>from __future__ import print_function
<del>import pytest
<del>import numpy as np
<del>np.random.seed(1337)
<del>
<del>from keras import backend as K
<del>from keras.models import Sequential, model_from_json, model_from_yaml
<del>from keras.layers.core import Dense, Activation, Merge, Lambda, LambdaMerge
<del>from keras.utils import np_utils
<del>from keras.utils.test_utils import get_test_data
<del>import os
<del>
<del>input_dim = 32
<del>nb_hidden = 16
<del>nb_class = 4
<del>batch_size = 32
<del>nb_epoch = 1
<del>
<del>train_samples = 2000
<del>test_samples = 500
<del>
<del>(X_train, y_train), (X_test, y_test) = get_test_data(nb_train=train_samples,
<del> nb_test=test_samples,
<del> input_shape=(input_dim,),
<del> classification=True,
<del> nb_class=4)
<del>y_test = np_utils.to_categorical(y_test)
<del>y_train = np_utils.to_categorical(y_train)
<del>
<del>
<del>def test_sequential():
<del> model = Sequential()
<del> model.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> model.add(Activation('relu'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=1, validation_data=(X_test, y_test))
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=2, validation_data=(X_test, y_test))
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=2, validation_split=0.1)
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=1, validation_split=0.1)
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0)
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=1, shuffle=False)
<del>
<del> model.train_on_batch(X_train[:32], y_train[:32])
<del>
<del> loss = model.evaluate(X_train, y_train, verbose=0)
<del> assert(loss < 0.7)
<del>
<del> model.predict(X_test, verbose=0)
<del> model.predict_classes(X_test, verbose=0)
<del> model.predict_proba(X_test, verbose=0)
<del> model.get_config(verbose=0)
<del>
<del> fname = 'test_sequential_temp.h5'
<del> model.save_weights(fname, overwrite=True)
<del> model = Sequential()
<del> model.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> model.add(Activation('relu'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del> model.load_weights(fname)
<del> os.remove(fname)
<del>
<del> nloss = model.evaluate(X_train, y_train, verbose=0)
<del> assert(loss == nloss)
<del>
<del> # test json serialization
<del> json_data = model.to_json()
<del> model = model_from_json(json_data)
<del>
<del> # test yaml serialization
<del> yaml_data = model.to_yaml()
<del> model = model_from_yaml(yaml_data)
<del>
<del>
<del>def test_merge_sum():
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([left, right], mode='sum'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_data=([X_test, X_test], y_test))
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_data=([X_test, X_test], y_test))
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0, shuffle=False)
<del>
<del> loss = model.evaluate([X_train, X_train], y_train, verbose=0)
<del> assert(loss < 0.7)
<del>
<del> model.predict([X_test, X_test], verbose=0)
<del> model.predict_classes([X_test, X_test], verbose=0)
<del> model.predict_proba([X_test, X_test], verbose=0)
<del> model.get_config(verbose=0)
<del>
<del> # test weight saving
<del> fname = 'test_merge_sum_temp.h5'
<del> model.save_weights(fname, overwrite=True)
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del> model = Sequential()
<del> model.add(Merge([left, right], mode='sum'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.load_weights(fname)
<del> os.remove(fname)
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> nloss = model.evaluate([X_train, X_train], y_train, verbose=0)
<del> assert(loss == nloss)
<del>
<del>
<del>def test_merge_dot():
<del> if K._BACKEND == 'tensorflow':
<del> return
<del>
<del> left = Sequential()
<del> left.add(Dense(input_dim=input_dim, output_dim=nb_hidden))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(input_dim=input_dim, output_dim=nb_hidden))
<del> right.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([left, right], mode='dot', dot_axes=1))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del>
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> left = Sequential()
<del> left.add(Dense(input_dim=input_dim, output_dim=nb_hidden))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(input_dim=input_dim, output_dim=nb_hidden))
<del> right.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([left, right], mode='dot', dot_axes=([1], [1])))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del>
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del>
<del>def test_merge_concat():
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([left, right], mode='concat'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_data=([X_test, X_test], y_test))
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_data=([X_test, X_test], y_test))
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0, shuffle=False)
<del>
<del> loss = model.evaluate([X_train, X_train], y_train, verbose=0)
<del> assert(loss < 0.7)
<del>
<del> model.predict([X_test, X_test], verbose=0)
<del> model.predict_classes([X_test, X_test], verbose=0)
<del> model.predict_proba([X_test, X_test], verbose=0)
<del> model.get_config(verbose=0)
<del>
<del> fname = 'test_merge_concat_temp.h5'
<del> model.save_weights(fname, overwrite=True)
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([left, right], mode='concat'))
<del>
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del>
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del> model.load_weights(fname)
<del> os.remove(fname)
<del>
<del> nloss = model.evaluate([X_train, X_train], y_train, verbose=0)
<del> assert(loss == nloss)
<del>
<del>
<del>def test_merge_recursivity():
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del>
<del> righter = Sequential()
<del> righter.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> righter.add(Activation('relu'))
<del>
<del> intermediate = Sequential()
<del> intermediate.add(Merge([left, right], mode='sum'))
<del> intermediate.add(Dense(nb_hidden))
<del> intermediate.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([intermediate, righter], mode='sum'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> model.fit([X_train, X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_data=([X_test, X_test, X_test], y_test))
<del> model.fit([X_train, X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_data=([X_test, X_test, X_test], y_test))
<del> model.fit([X_train, X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0)
<del> model.fit([X_train, X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0, shuffle=False)
<del>
<del> loss = model.evaluate([X_train, X_train, X_train], y_train, verbose=0)
<del> assert(loss < 0.7)
<del>
<del> model.predict([X_test, X_test, X_test], verbose=0)
<del> model.predict_classes([X_test, X_test, X_test], verbose=0)
<del> model.predict_proba([X_test, X_test, X_test], verbose=0)
<del> model.get_config(verbose=0)
<del>
<del> fname = 'test_merge_recursivity_temp.h5'
<del> model.save_weights(fname, overwrite=True)
<del> model.load_weights(fname)
<del> os.remove(fname)
<del>
<del> nloss = model.evaluate([X_train, X_train, X_train], y_train, verbose=0)
<del> assert(loss == nloss)
<del>
<del>
<del>def test_merge_overlap():
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(Merge([left, left], mode='sum'))
<del> model.add(Dense(nb_class))
<del> model.add(Activation('softmax'))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=1, validation_data=(X_test, y_test))
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=2, validation_data=(X_test, y_test))
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=2, validation_split=0.1)
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=1, validation_split=0.1)
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0)
<del> model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=1, shuffle=False)
<del>
<del> model.train_on_batch(X_train[:32], y_train[:32])
<del>
<del> loss = model.evaluate(X_train, y_train, verbose=0)
<del> assert(loss < 0.7)
<del> model.predict(X_test, verbose=0)
<del> model.predict_classes(X_test, verbose=0)
<del> model.predict_proba(X_test, verbose=0)
<del> model.get_config(verbose=0)
<del>
<del> fname = 'test_merge_overlap_temp.h5'
<del> model.save_weights(fname, overwrite=True)
<del> model.load_weights(fname)
<del> os.remove(fname)
<del>
<del> nloss = model.evaluate(X_train, y_train, verbose=0)
<del> assert(loss == nloss)
<del>
<del>
<del>def test_lambda():
<del> def func(X):
<del> s = X[0]
<del> for i in range(1, len(X)):
<del> s += X[i]
<del> return s
<del>
<del> def activation(X):
<del> return K.softmax(X)
<del>
<del> def output_shape(input_shapes):
<del> return input_shapes[0]
<del>
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del>
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del>
<del> model = Sequential()
<del> model.add(LambdaMerge([left, right], function=func,
<del> output_shape=output_shape))
<del> model.add(Dense(nb_class))
<del> model.add(Lambda(activation))
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del>
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_data=([X_test, X_test], y_test))
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_data=([X_test, X_test], y_test))
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=True, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_split=0.1)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0)
<del> model.fit([X_train, X_train], y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=0, shuffle=False)
<del>
<del> loss = model.evaluate([X_train, X_train], y_train, verbose=0)
<del> assert(loss < 0.7)
<del>
<del> model.predict([X_test, X_test], verbose=0)
<del> model.predict_classes([X_test, X_test], verbose=0)
<del> model.predict_proba([X_test, X_test], verbose=0)
<del> model.get_config(verbose=0)
<del>
<del> # test weight saving
<del> fname = 'test_lambda_temp.h5'
<del> model.save_weights(fname, overwrite=True)
<del> left = Sequential()
<del> left.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> left.add(Activation('relu'))
<del> right = Sequential()
<del> right.add(Dense(nb_hidden, input_shape=(input_dim,)))
<del> right.add(Activation('relu'))
<del> model = Sequential()
<del> model.add(LambdaMerge([left, right], function=func,
<del> output_shape=output_shape))
<del> model.add(Dense(nb_class))
<del> model.add(Lambda(activation))
<del> model.load_weights(fname)
<del> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<del> os.remove(fname)
<del>
<del> nloss = model.evaluate([X_train, X_train], y_train, verbose=0)
<del> assert(loss == nloss)
<del>
<del>
<del>def test_count_params():
<del> input_dim = 20
<del> nb_units = 10
<del> nb_classes = 2
<del>
<del> n = input_dim * nb_units + nb_units
<del> n += nb_units * nb_units + nb_units
<del> n += nb_units * nb_classes + nb_classes
<del>
<del> model = Sequential()
<del> model.add(Dense(nb_units, input_shape=(input_dim,)))
<del> model.add(Dense(nb_units))
<del> model.add(Dense(nb_classes))
<del> model.add(Activation('softmax'))
<del>
<del> assert(n == model.count_params())
<del>
<del> model.compile('sgd', 'binary_crossentropy')
<del>
<del> assert(n == model.count_params())
<del>
<del>
<del>if __name__ == '__main__':
<del> pytest.main([__file__]) | 2 |
PHP | PHP | fix shaky test | b17f5337affb28802c861e8f8af4fb1d5bec2582 | <ide><path>tests/Integration/Http/ThrottleRequestsTest.php
<ide> public function getEnvironmentSetUp($app)
<ide>
<ide> public function test_lock_opens_immediately_after_decay()
<ide> {
<del> Carbon::setTestNow(null);
<add> Carbon::setTestNow(Carbon::create(2018, 1, 1, 0, 0, 0));
<ide>
<ide> Route::get('/', function () {
<ide> return 'yes';
<ide> public function test_lock_opens_immediately_after_decay()
<ide> $this->assertEquals(2, $response->headers->get('X-RateLimit-Limit'));
<ide> $this->assertEquals(0, $response->headers->get('X-RateLimit-Remaining'));
<ide>
<del> Carbon::setTestNow(
<del> Carbon::now()->addSeconds(58)
<del> );
<add> Carbon::setTestNow(Carbon::create(2018, 1, 1, 0, 0, 58));
<ide>
<ide> try {
<ide> $this->withoutExceptionHandling()->get('/'); | 1 |
Text | Text | replace some words | 33d0db176a23bb18a322ad27f696596007aa96e5 | <ide><path>curriculum/challenges/russian/03-front-end-libraries/front-end-libraries-projects/build-a-drum-machine.russian.md
<ide> localeTitle: Построение барабанной машины
<ide> ---
<ide>
<ide> ## Description
<del><section id="description"> <strong>Цель.</strong> Создайте приложение <a href="https://codepen.io" target="_blank">CodePen.io</a> , функционально похожее на это: <a href="https://codepen.io/freeCodeCamp/full/MJyNMd" target="_blank">https://codepen.io/freeCodeCamp/full/MJyNMd</a> . Выполните приведенные здесь <a href="https://en.wikipedia.org/wiki/User_story" target="_blank">истории пользователей</a> и получите все тесты для прохождения. Дайте ему свой личный стиль. Вы можете использовать любое сочетание HTML, JavaScript, CSS, Bootstrap, SASS, React, Redux и jQuery для завершения этого проекта. Вы должны использовать фреймворк frontend (например, React), потому что этот раздел посвящен изучению интерфейсных фреймворков. Дополнительные технологии, не перечисленные выше, не рекомендуются, и использование их на свой страх и риск. Мы смотрим на поддержку других интерфейсных фреймворков, таких как Angular и Vue, но в настоящее время они не поддерживаются. Мы примем и попытаемся исправить все отчеты о проблемах, которые используют предлагаемый стек технологий для этого проекта. Счастливое кодирование! <strong>User Story # 1:</strong> Я должен видеть внешний контейнер с соответствующим <code>id="drum-machine"</code> который содержит все остальные элементы. <strong>User Story # 2:</strong> Внутри <code>#drum-machine</code> я вижу элемент с соответствующим <code>id="display"</code> . <strong>User Story # 3:</strong> В <code>#drum-machine</code> я могу увидеть 9 кликабельных элементов ударной площадки, каждая из которых имеет имя класса <code>drum-pad</code> , уникальный идентификатор, который описывает аудиоклип, который будет настроен на ударную площадку для запуска, и внутренний текст, который соответствует одной из следующих клавиш на клавиатуре: Q, W, E, A, S, D, Z, X, C. Барабанные площадки должны быть в этом порядке. <strong>User Story # 4:</strong> внутри каждого <code>.drum-pad</code> должен быть <code>audio</code> элемент HTML5, который имеет атрибут <code>src</code> указывающий на аудиоклип, имя класса <code>clip</code> и идентификатор, соответствующий внутреннему тексту его родительского <code>.drum-pad</code> (например, <code>id="Q"</code> , <code>id="W"</code> , <code>id="E"</code> и т. д.). <strong>User Story # 5:</strong> Когда я нажимаю элемент <code>.drum-pad</code> , должен запускаться аудиоклип, содержащийся в его дочернем <code>audio</code> элементе. <strong>User Story # 6:</strong> Когда я <code>.drum-pad</code> клавишу триггера, связанную с каждым <code>.drum-pad</code> , должен запускаться аудиоклип, содержащийся в его дочернем <code>audio</code> элементе (например, нажатие клавиши Q должно запускать ударную панель, содержащую строку «Q», нажатие клавиши W должно запускать ударную панель, содержащую строку «W» и т. д.). <strong>User Story # 7:</strong> Когда <code>.drum-pad</code> , строка, описывающая связанный аудиоклип, отображается как внутренний текст элемента <code>#display</code> (каждая строка должна быть уникальной). Вы можете создать свой проект, <a href="http://codepen.io/freeCodeCamp/pen/MJjpwO" target="_blank">нажимая эту ручку CodePen</a> . Или вы можете использовать эту ссылку CDN для запуска тестов в любой среде: <code>https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js</code> Как только вы закончите, отправьте URL-адрес своей рабочей проект с прохождением всех его тестов. Не забудьте использовать метод <a href="https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask,</a> если вы застряли. </section>
<add>
<add><section id="description"> <strong>Цель.</strong> Создайте приложение <a href="https://codepen.io" target="_blank">CodePen.io</a> , функционально похожее на это: <a href="https://codepen.io/freeCodeCamp/full/MJyNMd" target="_blank">https://codepen.io/freeCodeCamp/full/MJyNMd</a> . Выполните приведенные ниже <a href="https://en.wikipedia.org/wiki/User_story" target="_blank">истории пользователей</a> и получите все тесты для прохождения. Придайте ему свой личный стиль. Вы можете использовать любое сочетание HTML, JavaScript, CSS, Bootstrap, SASS, React, Redux и jQuery для завершения этого проекта. Вы должны использовать фреймворк frontend (например, React), потому что этот раздел посвящен изучению интерфейсных фреймворков. Дополнительные технологии, не перечисленные выше, не рекомендуются, и используются на свой страх и риск. Мы смотрим на поддержку других интерфейсных фреймворков, таких как Angular и Vue, но в настоящее время они не поддерживаются. Мы примем и попытаемся исправить все отчеты о проблемах, которые используют предлагаемый стек технологий для этого проекта. Счастливое кодирование! <strong>User Story # 1:</strong> Я должен видеть внешний контейнер с соответствующим <code>id="drum-machine"</code> который содержит все остальные элементы. <strong>User Story # 2:</strong> Внутри <code>#drum-machine</code> я вижу элемент с соответствующим <code>id="display"</code> . <strong>User Story # 3:</strong> В <code>#drum-machine</code> я могу увидеть 9 кликабельных элементов ударной площадки, каждая из которых имеет имя класса <code>drum-pad</code> , уникальный идентификатор, который описывает аудиоклип, который будет настроен на ударную площадку для запуска, и внутренний текст, который соответствует одной из следующих клавиш на клавиатуре: Q, W, E, A, S, D, Z, X, C. Барабанные площадки должны быть в этом порядке. <strong>User Story # 4:</strong> внутри каждого <code>.drum-pad</code> должен быть <code>audio</code> элемент HTML5, который имеет атрибут <code>src</code> указывающий на аудиоклип, имя класса <code>clip</code> и идентификатор, соответствующий внутреннему тексту его родительского <code>.drum-pad</code> (например, <code>id="Q"</code> , <code>id="W"</code> , <code>id="E"</code> и т. д.). <strong>User Story # 5:</strong> Когда я нажимаю элемент <code>.drum-pad</code> , должен запускаться аудиоклип, содержащийся в его дочернем <code>audio</code> элементе. <strong>User Story # 6:</strong> Когда я <code>.drum-pad</code> клавишу триггера, связанную с каждым <code>.drum-pad</code> , должен запускаться аудиоклип, содержащийся в его дочернем <code>audio</code> элементе (например, нажатие клавиши Q должно запускать ударную панель, содержащую строку «Q», нажатие клавиши W должно запускать ударную панель, содержащую строку «W» и т. д.). <strong>User Story # 7:</strong> Когда <code>.drum-pad</code> , строка, описывающая связанный аудиоклип, отображается как внутренний текст элемента <code>#display</code> (каждая строка должна быть уникальной). Вы можете создать свой проект, <a href="http://codepen.io/freeCodeCamp/pen/MJjpwO" target="_blank">нажимая эту ручку CodePen</a> . Или вы можете использовать эту ссылку CDN для запуска тестов в любой среде: <code>https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js</code> Как только вы закончите, отправьте URL-адрес своей рабочей проект с прохождением всех его тестов. Не забудьте использовать метод <a href="https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target="_blank">Read-Search-Ask,</a> если вы застряли. </section>
<add>
<ide>
<ide> ## Instructions
<ide> <section id="instructions"> | 1 |
Javascript | Javascript | add https options to rn cli server | 2c32acb755730ac20775aec4aad50d853d0577bf | <ide><path>local-cli/server/runServer.js
<ide> const defaultSourceExts = require('metro-bundler/build/defaults').sourceExts;
<ide> const defaultPlatforms = require('metro-bundler/build/defaults').platforms;
<ide> const defaultProvidesModuleNodeModules = require('metro-bundler/build/defaults')
<ide> .providesModuleNodeModules;
<add>const fs = require('fs');
<ide> const getDevToolsMiddleware = require('./middleware/getDevToolsMiddleware');
<ide> const http = require('http');
<add>const https = require('https');
<ide> const indexPageMiddleware = require('./middleware/indexPage');
<ide> const loadRawBodyMiddleware = require('./middleware/loadRawBodyMiddleware');
<ide> const messageSocket = require('./util/messageSocket.js');
<ide> function runServer(
<ide>
<ide> app.use(connect.logger()).use(connect.errorHandler());
<ide>
<del> const serverInstance = http
<del> .createServer(app)
<del> .listen(args.port, args.host, 511, function() {
<del> attachHMRServer({
<del> httpServer: serverInstance,
<del> path: '/hot',
<del> packagerServer,
<del> });
<del>
<del> wsProxy = webSocketProxy.attachToServer(
<del> serverInstance,
<del> '/debugger-proxy',
<del> );
<del> ms = messageSocket.attachToServer(serverInstance, '/message');
<del> inspectorProxy.attachToServer(serverInstance, '/inspector');
<del> readyCallback(packagerServer._reporter);
<add> if (args.https && (!args.key || !args.cert)) {
<add> throw new Error('Cannot use https without specifying key and cert options');
<add> }
<add>
<add> const serverInstance = args.https
<add> ? https.createServer(
<add> {
<add> key: fs.readFileSync(args.key),
<add> cert: fs.readFileSync(args.cert),
<add> },
<add> app,
<add> )
<add> : http.createServer(app);
<add>
<add> serverInstance.listen(args.port, args.host, 511, function() {
<add> attachHMRServer({
<add> httpServer: serverInstance,
<add> path: '/hot',
<add> packagerServer,
<ide> });
<add>
<add> wsProxy = webSocketProxy.attachToServer(serverInstance, '/debugger-proxy');
<add> ms = messageSocket.attachToServer(serverInstance, '/message');
<add> inspectorProxy.attachToServer(serverInstance, '/inspector');
<add> readyCallback(packagerServer._reporter);
<add> });
<ide> // Disable any kind of automatic timeout behavior for incoming
<ide> // requests in case it takes the packager more than the default
<ide> // timeout of 120 seconds to respond to a request.
<ide><path>local-cli/server/server.js
<ide> module.exports = {
<ide> }, {
<ide> command: '--verbose',
<ide> description: 'Enables logging',
<add> }, {
<add> command: '--https',
<add> description: 'Enables https connections to the server',
<add> }, {
<add> command: '--key [path]',
<add> description: 'Path to custom SSL key',
<add> }, {
<add> command: '--cert [path]',
<add> description: 'Path to custom SSL cert',
<ide> }],
<ide> };
<ide><path>local-cli/server/util/attachHMRServer.js
<ide> const url = require('url');
<ide>
<ide> import type {ResolutionResponse} from './getInverseDependencies';
<ide> import type {Server as HTTPServer} from 'http';
<add>import type {Server as HTTPSServer} from 'https';
<ide>
<ide> const blacklist = [
<ide> 'Libraries/Utilities/HMRClient.js',
<ide> type PackagerServer<TModule> = {
<ide> };
<ide>
<ide> type HMROptions<TModule> = {
<del> httpServer: HTTPServer,
<add> httpServer: HTTPServer | HTTPSServer,
<ide> packagerServer: PackagerServer<TModule>,
<ide> path: string,
<ide> };
<ide><path>local-cli/server/util/inspectorProxy.js
<ide> const WebSocket = require('ws');
<ide> const debug = require('debug')('RNP:InspectorProxy');
<ide> const launchChrome = require('./launchChrome');
<ide>
<add>import type {Server as HTTPSServer} from 'https';
<add>
<ide> type DevicePage = {
<ide> id: string,
<ide> title: string,
<ide> type Address = {
<ide> port: number,
<ide> };
<ide>
<add>type Server = http.Server | HTTPSServer;
<add>
<ide> const DEVICE_TIMEOUT = 30000;
<ide>
<ide> // FIXME: This is the url we want to use as it more closely matches the actual protocol we use.
<ide> class InspectorProxy {
<ide> this._devicesCounter = 0;
<ide> }
<ide>
<del> attachToServer(server: http.Server, pathPrefix: string) {
<add> attachToServer(server: Server, pathPrefix: string) {
<ide> this._createPageHandler(server, pathPrefix + '/page');
<ide> this._createDeviceHandler(server, pathPrefix + '/device');
<ide> this._createPagesListHandler(server, pathPrefix + '/');
<ide> class InspectorProxy {
<ide> }
<ide> }
<ide>
<del> _createDeviceHandler(server: http.Server, path: string) {
<add> _createDeviceHandler(server: Server, path: string) {
<ide> const wss = new WebSocket.Server({
<ide> server,
<ide> path,
<ide> class InspectorProxy {
<ide> });
<ide> }
<ide>
<del> _createPageHandler(server: http.Server, path: string) {
<add> _createPageHandler(server: Server, path: string) {
<ide> const wss = new WebSocket.Server({
<ide> server,
<ide> path,
<ide> class InspectorProxy {
<ide> });
<ide> }
<ide>
<del> _createPagesJsonHandler(server: http.Server, path: string) {
<add> _createPagesJsonHandler(server: Server, path: string) {
<ide> server.on('request', (request: http.IncomingMessage, response: http.ServerResponse) => {
<ide> if (request.url === path) {
<ide> this._getPages(server.address()).then((result: Array<Page>) => {
<ide> class InspectorProxy {
<ide> });
<ide> }
<ide>
<del> _createPagesListHandler(server: http.Server, path: string) {
<add> _createPagesListHandler(server: Server, path: string) {
<ide> server.on('request', (request: http.IncomingMessage, response: http.ServerResponse) => {
<ide> if (request.url === path) {
<ide> this._getPages(server.address()).then((result: Array<Page>) => { | 4 |
Javascript | Javascript | fix resource stack for deep stacks | 2ba93e1db4992e73af42c47b445a54c2a767bd6e | <ide><path>lib/internal/async_hooks.js
<ide> function hasAsyncIdStack() {
<ide> // This is the equivalent of the native push_async_ids() call.
<ide> function pushAsyncContext(asyncId, triggerAsyncId, resource) {
<ide> const offset = async_hook_fields[kStackLength];
<add> execution_async_resources[offset] = resource;
<ide> if (offset * 2 >= async_wrap.async_ids_stack.length)
<ide> return pushAsyncContext_(asyncId, triggerAsyncId);
<ide> async_wrap.async_ids_stack[offset * 2] = async_id_fields[kExecutionAsyncId];
<ide> async_wrap.async_ids_stack[offset * 2 + 1] = async_id_fields[kTriggerAsyncId];
<del> execution_async_resources[offset] = resource;
<ide> async_hook_fields[kStackLength]++;
<ide> async_id_fields[kExecutionAsyncId] = asyncId;
<ide> async_id_fields[kTriggerAsyncId] = triggerAsyncId;
<ide><path>test/parallel/test-async-local-storage-deep-stack.js
<add>'use strict';
<add>const common = require('../common');
<add>const { AsyncLocalStorage } = require('async_hooks');
<add>
<add>// Regression test for: https://github.com/nodejs/node/issues/34556
<add>
<add>const als = new AsyncLocalStorage();
<add>
<add>const done = common.mustCall();
<add>
<add>function run(count) {
<add> if (count !== 0) return als.run({}, run, --count);
<add> done();
<add>}
<add>run(1000); | 2 |
Mixed | Ruby | keep inner join when merging relations | 249ddd0c39e6f24145ae1150d4c8eec9f11219b1 | <ide><path>activerecord/CHANGELOG.md
<add>* Merging two relations representing nested joins no longer transforms the joins of
<add> the merged relation into LEFT OUTER JOIN. Example to clarify:
<add>
<add> ```
<add> Author.joins(:posts).merge(Post.joins(:comments))
<add> # Before the change:
<add> #=> SELECT ... FROM authors INNER JOIN posts ON ... LEFT OUTER JOIN comments ON...
<add>
<add> # After the change:
<add> #=> SELECT ... FROM authors INNER JOIN posts ON ... INNER JOIN comments ON...
<add> ```
<add>
<add> TODO: Add to the Rails 5.2 upgrade guide
<add>
<add> *Maxime Handfield Lapointe*
<add>
<ide> * `ActiveRecord::Persistence#touch` does not work well when optimistic locking enabled and
<ide> `locking_column`, without default value, is null in the database.
<ide>
<ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def reflections
<ide> join_root.drop(1).map!(&:reflection)
<ide> end
<ide>
<del> def join_constraints(outer_joins, join_type)
<add> def join_constraints(joins_to_add, join_type)
<ide> joins = join_root.children.flat_map { |child|
<ide> make_join_constraints(join_root, child, join_type)
<ide> }
<ide>
<del> joins.concat outer_joins.flat_map { |oj|
<add> joins.concat joins_to_add.flat_map { |oj|
<ide> if join_root.match? oj.join_root
<ide> walk join_root, oj.join_root
<ide> else
<ide> oj.join_root.children.flat_map { |child|
<del> make_outer_joins oj.join_root, child
<add> make_join_constraints(oj.join_root, child, join_type)
<ide> }
<ide> end
<ide> }
<ide><path>activerecord/test/cases/relation_test.rb
<ide>
<ide> module ActiveRecord
<ide> class RelationTest < ActiveRecord::TestCase
<del> fixtures :posts, :comments, :authors, :author_addresses
<add> fixtures :posts, :comments, :authors, :author_addresses, :ratings
<ide>
<ide> FakeKlass = Struct.new(:table_name, :name) do
<ide> extend ActiveRecord::Delegation::DelegateCache
<ide> def test_merging_readonly_false
<ide> def test_relation_merging_with_merged_joins_as_symbols
<ide> special_comments_with_ratings = SpecialComment.joins(:ratings)
<ide> posts_with_special_comments_with_ratings = Post.group("posts.id").joins(:special_comments).merge(special_comments_with_ratings)
<del> assert_equal({ 2 => 1, 4 => 3, 5 => 1 }, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count)
<add> assert_equal({ 4 => 2 }, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count)
<add> end
<add>
<add> def test_relation_merging_with_merged_symbol_joins_keeps_inner_joins
<add> queries = capture_sql { authors_with_commented_posts = Author.joins(:posts).merge(Post.joins(:comments)).to_a }
<add>
<add> nb_inner_join = queries.sum { |sql| sql.scan(/INNER\s+JOIN/i).size }
<add> assert_equal 2, nb_inner_join, "Wrong amount of INNER JOIN in query"
<add> assert queries.none? { |sql| /LEFT\s+(OUTER)?\s+JOIN/i.match?(sql) }, "Shouldn't have any LEFT JOIN in query"
<add> end
<add>
<add> def test_relation_merging_with_merged_symbol_joins_has_correct_size_and_count
<add> # Has one entry per comment
<add> merged_authors_with_commented_posts_relation = Author.joins(:posts).merge(Post.joins(:comments))
<add>
<add> post_ids_with_author = Post.joins(:author).pluck(:id)
<add> manual_comments_on_post_that_have_author = Comment.where(post_id: post_ids_with_author).pluck(:id)
<add>
<add> assert_equal manual_comments_on_post_that_have_author.size, merged_authors_with_commented_posts_relation.count
<add> assert_equal manual_comments_on_post_that_have_author.size, merged_authors_with_commented_posts_relation.to_a.size
<ide> end
<ide>
<ide> def test_relation_merging_with_joins_as_join_dependency_pick_proper_parent | 3 |
Javascript | Javascript | reduce size by eliminating single-use variable | 0aa832afec04215ed5e14b1cc5fc287ad7939792 | <ide><path>src/manipulation.js
<ide> var
<ide>
<ide> // checked="checked" or checked
<ide> rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
<del> rscriptTypeMasked = /^true\/(.*)/,
<ide> rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
<ide>
<ide> // Prefer a tbody over its parent table for containing new rows
<ide> function disableScript( elem ) {
<ide> return elem;
<ide> }
<ide> function restoreScript( elem ) {
<del> var match = rscriptTypeMasked.exec( elem.type );
<del>
<del> if ( match ) {
<del> elem.type = match[ 1 ];
<add> if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
<add> elem.type = elem.type.slice( 5 );
<ide> } else {
<ide> elem.removeAttribute( "type" );
<ide> } | 1 |
PHP | PHP | fix cs error | cf569b9c15834c4e070d799ca80a438795d80cb4 | <ide><path>src/Auth/AbstractPasswordHasher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/BaseAuthenticate.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/BaseAuthorize.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/BasicAuthenticate.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/ControllerAuthorize.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/DefaultPasswordHasher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/DigestAuthenticate.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/FallbackPasswordHasher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/FormAuthenticate.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> *
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide><path>src/Auth/PasswordHasherFactory.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/Storage/MemoryStorage.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/Storage/SessionStorage.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/Storage/StorageInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Auth/WeakPasswordHasher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Cache.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/CacheEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/CacheEngineInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/CacheRegistry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/ApcuEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/ArrayEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/FileEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/MemcachedEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/NullEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/RedisEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/Engine/WincacheEngine.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Cache/InvalidArgumentException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Collection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/CollectionInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/CollectionTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/ExtractTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/BufferedIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/ExtractIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/FilterIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/InsertIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/MapReduce.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/NestIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/NoChildrenIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/ReplaceIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/SortIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/StoppableIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/TreeIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/TreePrinter.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/UnfoldIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/Iterator/ZipIterator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Collection/functions.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Command/CacheClearAllCommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Command/CacheClearCommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Command/CacheListCommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Command/HelpCommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Command/UpgradeCommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Command/VersionCommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Arguments.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Command.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/CommandCollection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Console/CommandCollectionAwareInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Console/CommandFactory.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Console/CommandFactoryInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Console/CommandRunner.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Console/CommandScanner.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Console/ConsoleErrorHandler.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ConsoleInput.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ConsoleInputArgument.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ConsoleInputOption.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ConsoleInputSubcommand.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * ConsoleInputSubcommand file
<ide> *
<ide><path>src/Console/ConsoleIo.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ConsoleOptionParser.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ConsoleOutput.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Exception/ConsoleException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Exception/MissingHelperException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Exception/MissingShellException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Exception/MissingShellMethodException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Exception/MissingTaskException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Exception/StopException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/HelpFormatter.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Helper.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/HelperRegistry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/Shell.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/ShellDispatcher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Console/TaskRegistry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Component.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Component/AuthComponent.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Component/FlashComponent.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Component/PaginatorComponent.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Component/RequestHandlerComponent.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Component/SecurityComponent.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/ComponentRegistry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Controller.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/ErrorController.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Exception/AuthSecurityException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Exception/MissingActionException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Exception/MissingComponentException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Controller/Exception/SecurityException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/App.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/BasePlugin.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/ClassLoader.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Configure.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Configure/ConfigEngineInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Configure/Engine/IniConfig.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Configure/Engine/JsonConfig.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Configure/Engine/PhpConfig.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Configure/FileConfigTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/ConsoleApplicationInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/ConventionsTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Exception/Exception.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Exception/MissingPluginException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/HttpApplicationInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/InstanceConfigTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/ObjectRegistry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Plugin.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/PluginApplicationInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/PluginCollection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/PluginInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Retry/CommandRetry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/Retry/RetryStrategyInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/StaticConfigTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Core/functions.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Connection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Dialect/MysqlDialectTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Dialect/PostgresDialectTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Dialect/SqliteDialectTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Dialect/SqlserverDialectTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Dialect/TupleComparisonTranslatorTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Driver.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Driver/Mysql.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Driver/Postgres.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Driver/Sqlite.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Driver/Sqlserver.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/DriverInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Exception.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Exception/MissingConnectionException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Exception/MissingDriverException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Exception/MissingExtensionException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Exception/NestedTransactionRollbackException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/BetweenExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/CaseExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/Comparison.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/FieldInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/FieldTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/FunctionExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/IdentifierExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/OrderByExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/OrderClauseExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/QueryExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/TupleComparison.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/UnaryExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Expression/ValuesExpression.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/ExpressionInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/FieldTypeConverter.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/FunctionsBuilder.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/IdentifierQuoter.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Log/LoggedQuery.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Log/LoggingStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Log/QueryLogger.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Query.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/QueryCompiler.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Retry/ReconnectStrategy.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/BaseSchema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/CachedCollection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/Collection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/CollectionInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/MysqlSchema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/PostgresSchema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/SqlGeneratorInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Database/Schema/SqliteSchema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/SqlserverSchema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/TableSchema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Schema/TableSchemaAwareInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Database/Schema/TableSchemaInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Database/SchemaCache.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/SqlDialectTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/SqliteCompiler.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/SqlserverCompiler.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/BufferResultsTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/BufferedStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/CallbackStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/MysqlStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/PDOStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/SqliteStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/SqlserverStatement.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Statement/StatementDecorator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/StatementInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> // @deprecated Backwards compatibility alias. Will be removed in 5.0
<ide> class_alias('Cake\Database\TypeFactory', 'Cake\Database\Type');
<ide><path>src/Database/Type/BaseType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/BatchCastingInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/BinaryType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/BinaryUuidType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/BoolType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/DateTimeType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/DateType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/DecimalType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/ExpressionTypeCasterTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/ExpressionTypeInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/FloatType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/IntegerType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/JsonType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/OptionalConvertInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/StringType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/TimeType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/Type/UuidType.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypeConverterTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypeFactory.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypeInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypeMap.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypeMapTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypedResultInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/TypedResultTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Database/ValueBinder.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/ConnectionInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/ConnectionManager.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/ConnectionRegistry.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/EntityInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/EntityTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/Exception/InvalidPrimaryKeyException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/Exception/MissingDatasourceConfigException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/Exception/MissingDatasourceException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/Exception/MissingModelException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/Exception/PageOutOfBoundsException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Datasource/Exception/RecordNotFoundException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/FactoryLocator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/FixtureInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/InvalidPropertyInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/ModelAwareTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/Paginator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Datasource/PaginatorInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Datasource/QueryCacher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/QueryInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/QueryTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/RepositoryInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/ResultSetDecorator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/ResultSetInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/RuleInvoker.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/RulesAwareTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/RulesChecker.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Datasource/SchemaInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Error/BaseErrorHandler.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Error/Debugger.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Error/ErrorHandler.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * ErrorHandler class
<ide> *
<ide><path>src/Error/ExceptionRenderer.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Error/ExceptionRendererInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Error/FatalErrorException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Error/Middleware/ErrorHandlerMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Decorator/AbstractDecorator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Decorator/ConditionDecorator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Decorator/SubjectFilterDecorator.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/Event.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventDispatcherInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventDispatcherTrait.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventList.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventListenerInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventManager.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Event/EventManagerInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Filesystem/File.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Filesystem/Filesystem.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Filesystem/Folder.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Form/Form.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Form/Schema.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/ActionDispatcher.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/BaseApplication.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/CallbackStream.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Adapter/Curl.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Adapter/Stream.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/AdapterInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Auth/Basic.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Auth/Digest.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Auth/Oauth.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Exception/ClientException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Exception/NetworkException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Exception/RequestException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/FormData.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/FormDataPart.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Message.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Request.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Client/Response.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/ControllerFactory.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Cookie/Cookie.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Http/Cookie/CookieCollection.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Http/Cookie/CookieInterface.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Http/CorsBuilder.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/BadRequestException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/ConflictException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/ForbiddenException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/GoneException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/HttpException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/InternalErrorException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/InvalidCsrfTokenException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/MethodNotAllowedException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/NotAcceptableException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/NotFoundException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/NotImplementedException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/ServiceUnavailableException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/UnauthorizedException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Exception/UnavailableForLegalReasonsException.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Middleware/BodyParserMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Http/Middleware/CallableDecoratorMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Middleware/CsrfProtectionMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Http/Middleware/DoublePassDecoratorMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide><path>src/Http/Middleware/EncryptedCookieMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<ide><path>src/Http/Middleware/SecurityHeadersMiddleware.php
<ide> <?php
<ide> declare(strict_types=1);
<add>
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | 300 |
Javascript | Javascript | use dots reporter for sauce | 8bc02f72c9a756ae1e8ac11f6435db9a74141207 | <ide><path>Gruntfile.js
<ide> module.exports = function (grunt) {
<ide> browsers: ['Firefox'],
<ide> },
<ide> sauce: {
<add> options: {reporters: ['dots']},
<ide> singleRun: true,
<ide> browsers: [
<ide> 'sl_chrome_win_xp', | 1 |
Javascript | Javascript | remove console.log statement | e03b0b0dcf85dc44ec21c8aefe3cc26f4b92fc91 | <ide><path>test/binCases/errors/parse/test.js
<ide> module.exports = function testAssertions(code, stdout, stderr) {
<ide> code.should.be.eql(2);
<ide>
<del> console.log(stdout);
<ide> stdout[0].should.containEql("Hash: ");
<ide> stdout[1].should.containEql("Version: ");
<ide> stdout[2].should.containEql("Time: "); | 1 |
Ruby | Ruby | add test coverage to module setup extensions | 783deae99a4850f597135146b19e7ee4622da94e | <ide><path>activesupport/test/core_ext/module/setup_test.rb
<add>require 'abstract_unit'
<add>require 'active_support/core/time'
<add>require 'active_support/core_ext/module/setup'
<add>
<add>class SetupTest < Test::Unit::TestCase
<add> module Baz
<add> module ClassMethods
<add> def baz
<add> "baz"
<add> end
<add>
<add> def setup=(value)
<add> @@setup = value
<add> end
<add>
<add> def setup
<add> @@setup
<add> end
<add> end
<add>
<add> setup do
<add> self.setup = true
<add> end
<add>
<add> def baz
<add> "baz"
<add> end
<add> end
<add>
<add> module Bar
<add> depends_on Baz
<add>
<add> def bar
<add> "bar"
<add> end
<add>
<add> def baz
<add> "bar+" + super
<add> end
<add> end
<add>
<add> def setup
<add> @klass = Class.new
<add> end
<add>
<add> def test_module_is_included_normally
<add> @klass.use(Baz)
<add> assert_equal "baz", @klass.new.baz
<add> assert_equal SetupTest::Baz, @klass.included_modules[0]
<add>
<add> @klass.use(Baz)
<add> assert_equal "baz", @klass.new.baz
<add> assert_equal SetupTest::Baz, @klass.included_modules[0]
<add> end
<add>
<add> def test_class_methods_are_extended
<add> @klass.use(Baz)
<add> assert_equal "baz", @klass.baz
<add> assert_equal SetupTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0]
<add> end
<add>
<add> def test_setup_block_is_ran
<add> @klass.use(Baz)
<add> assert_equal true, @klass.setup
<add> end
<add>
<add> def test_modules_dependencies_are_met
<add> @klass.use(Bar)
<add> assert_equal "bar", @klass.new.bar
<add> assert_equal "bar+baz", @klass.new.baz
<add> assert_equal "baz", @klass.baz
<add> assert_equal [SetupTest::Bar, SetupTest::Baz], @klass.included_modules[0..1]
<add> end
<add>end | 1 |
Ruby | Ruby | add brew doctor check for dyld vars | a634dc6a2c2e0a4027f2fa4e95a111f88e00c1a7 | <ide><path>Library/Homebrew/brew_doctor.rb
<ide> def check_for_config_scripts
<ide> end
<ide> end
<ide>
<add>def check_for_dyld_vars
<add> if ENV['DYLD_LIBRARY_PATH']
<add> puts <<-EOS.undent
<add> Setting DYLD_LIBARY_PATH can break dynamic linking.
<add> You should probably unset it.
<add>
<add> EOS
<add> end
<add>end
<add>
<ide> def brew_doctor
<ide> read, write = IO.pipe
<ide>
<ide> def brew_doctor
<ide> check_pkg_config_paths
<ide> check_for_gettext
<ide> check_for_config_scripts
<add> check_for_dyld_vars
<ide>
<ide> exit! 0
<ide> else | 1 |
Ruby | Ruby | remove some caching | 099fd0efc47225afde9394d5f4225fc8ddcd4ae8 | <ide><path>actionpack/lib/action_dispatch/routing/url_for.rb
<ide> def url_for(options = nil)
<ide> protected
<ide>
<ide> def optimize_routes_generation?
<del> return @_optimized_routes if defined?(@_optimized_routes)
<del> @_optimized_routes = _routes.optimize_routes_generation? && default_url_options.empty?
<add> _routes.optimize_routes_generation? && default_url_options.empty?
<ide> end
<ide>
<ide> def _with_routes(routes) | 1 |
Python | Python | add on_gpu() check | 83e285fd00b3dba52c3a829010ac6d9f6e6610bc | <ide><path>keras/layers/convolutional.py
<ide>
<ide> import theano
<ide> import theano.tensor as T
<del>if theano.config.device[:3] == 'gpu':
<del> from theano.sandbox.cuda import dnn
<ide>
<ide> from .. import activations, initializations, regularizers, constraints
<del>from ..utils.theano_utils import shared_zeros
<add>from ..utils.theano_utils import shared_zeros, on_gpu
<ide> from ..layers.core import Layer
<ide>
<add>if on_gpu():
<add> from theano.sandbox.cuda import dnn
<add>
<ide>
<ide> class Convolution1D(Layer):
<ide> def __init__(self, input_dim, nb_filter, filter_length,
<ide> def __init__(self, nb_filter, stack_size, nb_row, nb_col,
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<ide> border_mode = self.border_mode
<del> if dnn.dnn_available() and theano.config.device[:3] == 'gpu':
<add> if on_gpu() and dnn.dnn_available():
<ide> if border_mode == 'same':
<ide> assert(self.subsample == (1, 1))
<ide> pad_x = (self.nb_row - self.subsample[0]) // 2
<ide><path>keras/utils/theano_utils.py
<ide> def ndim_tensor(ndim):
<ide> elif ndim == 4:
<ide> return T.tensor4()
<ide> return T.matrix()
<add>
<add>
<add>def on_gpu():
<add> return theano.config.device[:3] == 'gpu' | 2 |
Text | Text | add some info on `tty#setrawmode()` | a0a6ff2ea5afc93c5d6b592ebecc17ff5b4ffa6a | <ide><path>doc/api/tty.md
<ide> raw device. Defaults to `false`.
<ide> added: v0.7.7
<ide> -->
<ide>
<add>Allows configuration of `tty.ReadStream` so that it operates as a raw device.
<add>
<add>When in raw mode, input is always available character-by-character, not
<add>including modifiers. Additionally, all special processing of characters by the
<add>terminal is disabled, including echoing input characters.
<add>Note that `CTRL`+`C` will no longer cause a `SIGINT` when in this mode.
<add>
<ide> * `mode` {boolean} If `true`, configures the `tty.ReadStream` to operate as a
<ide> raw device. If `false`, configures the `tty.ReadStream` to operate in its
<ide> default mode. The `readStream.isRaw` property will be set to the resulting | 1 |
Go | Go | add tests for docker stats versioning | 8ceded6d0384bef32dfddf800057fa08d910e95e | <ide><path>integration-cli/docker_api_stats_test.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/pkg/integration/checker"
<add> "github.com/docker/docker/pkg/version"
<ide> "github.com/go-check/check"
<ide> )
<ide>
<add>var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors rx_packets tx_bytes tx_dropped tx_errors tx_packets", " ")
<add>
<ide> func (s *DockerSuite) TestApiStatsNoStreamGetCpu(c *check.C) {
<ide> testRequires(c, DaemonIsLinux)
<ide> out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;do echo 'Hello'; usleep 100000; done")
<ide> func (s *DockerSuite) TestApiStatsNetworkStats(c *check.C) {
<ide> check.Commentf("Reported less Txbytes than expected. Expected >= %d. Found %d. %s", expRxPkts, postRxPackets, pingouts))
<ide> }
<ide>
<add>func (s *DockerSuite) TestApiStatsNetworkStatsVersioning(c *check.C) {
<add> testRequires(c, SameHostDaemon)
<add> testRequires(c, DaemonIsLinux)
<add> // Run container for 30 secs
<add> out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
<add> id := strings.TrimSpace(out)
<add> c.Assert(waitRun(id), checker.IsNil)
<add>
<add> for i := 17; i <= 21; i++ {
<add> apiVersion := fmt.Sprintf("v1.%d", i)
<add> for _, statsJSONBlob := range getVersionedStats(c, id, 3, apiVersion) {
<add> if version.Version(apiVersion).LessThan("v1.21") {
<add> c.Assert(jsonBlobHasLTv121NetworkStats(statsJSONBlob), checker.Equals, true,
<add> check.Commentf("Stats JSON blob from API %s %#v does not look like a <v1.21 API stats structure", apiVersion, statsJSONBlob))
<add> } else {
<add> c.Assert(jsonBlobHasGTE121NetworkStats(statsJSONBlob), checker.Equals, true,
<add> check.Commentf("Stats JSON blob from API %s %#v does not look like a >=v1.21 API stats structure", apiVersion, statsJSONBlob))
<add> }
<add> }
<add> }
<add>}
<add>
<ide> func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats {
<ide> var st *types.StatsJSON
<ide>
<ide> func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats {
<ide> return st.Networks
<ide> }
<ide>
<add>// getVersionedNetworkStats returns a slice of numStats stats results for the
<add>// container with id id using an API call with version apiVersion. Since the
<add>// stats result type differs between API versions, we simply return
<add>// []map[string]interface{}.
<add>func getVersionedStats(c *check.C, id string, numStats int, apiVersion string) []map[string]interface{} {
<add> stats := make([]map[string]interface{}, numStats)
<add>
<add> requestPath := fmt.Sprintf("/%s/containers/%s/stats?stream=true", apiVersion, id)
<add> _, body, err := sockRequestRaw("GET", requestPath, nil, "")
<add> c.Assert(err, checker.IsNil)
<add> defer body.Close()
<add>
<add> statsDecoder := json.NewDecoder(body)
<add> for i := range stats {
<add> err = statsDecoder.Decode(&stats[i])
<add> c.Assert(err, checker.IsNil, check.Commentf("failed to decode %dth stat: %s", i, err))
<add> }
<add>
<add> return stats
<add>}
<add>
<add>func jsonBlobHasLTv121NetworkStats(blob map[string]interface{}) bool {
<add> networkStatsIntfc, ok := blob["network"]
<add> if !ok {
<add> return false
<add> }
<add> networkStats, ok := networkStatsIntfc.(map[string]interface{})
<add> if !ok {
<add> return false
<add> }
<add> for _, expectedKey := range expectedNetworkInterfaceStats {
<add> if _, ok := networkStats[expectedKey]; !ok {
<add> return false
<add> }
<add> }
<add> return true
<add>}
<add>
<add>func jsonBlobHasGTE121NetworkStats(blob map[string]interface{}) bool {
<add> networksStatsIntfc, ok := blob["networks"]
<add> if !ok {
<add> return false
<add> }
<add> networksStats, ok := networksStatsIntfc.(map[string]interface{})
<add> if !ok {
<add> return false
<add> }
<add> for _, networkInterfaceStatsIntfc := range networksStats {
<add> networkInterfaceStats, ok := networkInterfaceStatsIntfc.(map[string]interface{})
<add> if !ok {
<add> return false
<add> }
<add> for _, expectedKey := range expectedNetworkInterfaceStats {
<add> if _, ok := networkInterfaceStats[expectedKey]; !ok {
<add> return false
<add> }
<add> }
<add> }
<add> return true
<add>}
<add>
<ide> func (s *DockerSuite) TestApiStatsContainerNotFound(c *check.C) {
<ide> testRequires(c, DaemonIsLinux)
<ide> | 1 |
Javascript | Javascript | add test for `jquery.isplainobject(localstorage)` | ce6c83f710c28108ccb4d50a7b924baa890dc961 | <ide><path>test/unit/core.js
<ide> QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)"
<ide> assert.equal( jQuery.isPlainObject( Object( Symbol() ) ), false, "Symbol inside an object" );
<ide> } );
<ide>
<add>QUnit.test( "isPlainObject(localStorage)", function( assert ) {
<add> assert.expect( 1 );
<add>
<add> assert.equal( jQuery.isPlainObject( localStorage ), false );
<add>} );
<add>
<ide> QUnit[ "assign" in Object ? "test" : "skip" ]( "isPlainObject(Object.assign(...))",
<ide> function( assert ) {
<ide> assert.expect( 1 ); | 1 |
Text | Text | remove comments before tests | 7d7a1127a7ea1dbe5dbb5f836902b7ba6430983b | <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.english.md
<ide> Refactor the function <code>setGear</code> inside the object <code>bicycle</code
<ide> ```yml
<ide> tests:
<ide> - text: Traditional function expression should not be used.
<del> testString: getUserInput => assert(!getUserInput('index').match(/function/));
<add> testString: getUserInput => assert(!removeJSComments(code).match(/function/));
<ide> - text: <code>setGear</code> should be a declarative function.
<del> testString: getUserInput => assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/));
<add> testString: assert(typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/));
<ide> - text: <code>bicycle.setGear(48)</code> should change the <code>gear</code> value to 48.
<ide> testString: assert((new bicycle.setGear(48)).gear === 48);
<ide>
<ide> console.log(bicycle.gear);
<ide>
<ide> </div>
<ide>
<add>### After Test
<add><div id='js-teardown'>
<add>
<add>```js
<add>const removeJSComments = str => str.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
<add>```
<add>
<add></div>
<add>
<ide> </section>
<ide>
<ide> ## Solution | 1 |
Text | Text | fix mistake in http2stream.respondwithfile | 51bc7fa59896d1b1623255b5f3c0122e88f99676 | <ide><path>doc/api/http2.md
<ide> of the given file:
<ide>
<ide> If an error occurs while attempting to read the file data, the `Http2Stream`
<ide> will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`
<del>code.
<add>code. If the `onError` callback is defined it will be called, otherwise
<add>the stream will be destroyed.
<ide>
<ide> Example using a file path:
<ide>
<ide> server.on('stream', (stream) => {
<ide>
<ide> stream.respondWithFile('/some/file',
<ide> { 'content-type': 'text/plain' },
<del> { statCheck });
<add> { statCheck, onError });
<ide> });
<ide> ```
<ide> | 1 |
Python | Python | fix runtime dtype | 170eb70b77cf8334856492b9a6cc969cf35c5704 | <ide><path>official/vision/beta/projects/panoptic_maskrcnn/configs/panoptic_deeplab.py
<ide> def panoptic_deeplab_coco() -> cfg.ExperimentConfig:
<ide>
<ide> config = cfg.ExperimentConfig(
<ide> runtime=cfg.RuntimeConfig(
<del> mixed_precision_dtype='float32', enable_xla=True),
<add> mixed_precision_dtype='bfloat16', enable_xla=True),
<ide> task=PanopticDeeplabTask(
<ide> init_checkpoint='gs://cloud-tpu-checkpoints/vision-2.0/deeplab/deeplab_resnet50_imagenet/ckpt-62400', # pylint: disable=line-too-long
<ide> init_checkpoint_modules=['backbone'], | 1 |
Ruby | Ruby | optimize some code around merge | 056685373493b8431905202f1d7947759b783386 | <ide><path>activerecord/lib/active_record/associations/through_association.rb
<ide> module ThroughAssociation #:nodoc:
<ide> def target_scope
<ide> scope = super
<ide> chain[1..-1].each do |reflection|
<del> scope = scope.merge(
<add> scope.merge!(
<ide> reflection.klass.all.with_default_scope.
<ide> except(:select, :create_with, :includes, :preload, :joins, :eager_load)
<ide> ) | 1 |
Go | Go | remove redundant period | cb5b8767b6988855daa1a264202be929c24c6177 | <ide><path>api/client/run.go
<ide> import (
<ide> )
<ide>
<ide> const (
<del> errCmdNotFound = "not found or does not exist."
<del> errCmdCouldNotBeInvoked = "could not be invoked."
<add> errCmdNotFound = "not found or does not exist"
<add> errCmdCouldNotBeInvoked = "could not be invoked"
<ide> )
<ide>
<ide> func (cid *cidFile) Close() error {
<ide> func (cid *cidFile) Write(id string) error {
<ide> // if container start fails with 'command cannot be invoked' error, return 126
<ide> // return 125 for generic docker daemon failures
<ide> func runStartContainerErr(err error) error {
<del> trimmedErr := strings.Trim(err.Error(), "Error response from daemon: ")
<add> trimmedErr := strings.TrimPrefix(err.Error(), "Error response from daemon: ")
<ide> statusError := Cli.StatusError{StatusCode: 125}
<del>
<ide> if strings.HasPrefix(trimmedErr, "Container command") {
<ide> if strings.Contains(trimmedErr, errCmdNotFound) {
<ide> statusError = Cli.StatusError{StatusCode: 127}
<ide><path>daemon/start.go
<ide> func (daemon *Daemon) containerStart(container *container.Container) (err error)
<ide> strings.Contains(err.Error(), "no such file or directory") ||
<ide> strings.Contains(err.Error(), "system cannot find the file specified") {
<ide> container.ExitCode = 127
<del> err = fmt.Errorf("Container command '%s' not found or does not exist.", container.Path)
<add> err = fmt.Errorf("Container command '%s' not found or does not exist", container.Path)
<ide> }
<ide> // set to 126 for container cmd can't be invoked errors
<ide> if strings.Contains(err.Error(), syscall.EACCES.Error()) {
<ide> container.ExitCode = 126
<del> err = fmt.Errorf("Container command '%s' could not be invoked.", container.Path)
<add> err = fmt.Errorf("Container command '%s' could not be invoked", container.Path)
<ide> }
<ide>
<ide> container.Reset(false) | 2 |
Text | Text | add more examples on how to set key-value pairs | 3a82e9f8571d229c730e74df749136c222cafaa2 | <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.english.md
<ide> forumTopicId: 301153
<ide>
<ide> ## Description
<ide> <section id='description'>
<del>At their most basic, objects are just collections of <dfn>key-value pairs</dfn>, or in other words, pieces of data mapped to unique identifiers that we call <dfn>properties</dfn> or <dfn>keys</dfn>. Let's take a look at a very simple example:
<add>At their most basic, objects are just collections of <dfn>key-value</dfn> pairs. In other words, they are pieces of data (<dfn>values</dfn>) mapped to unique identifiers called <dfn>properties</dfn> (<dfn>keys</dfn>). Take a look at an example:
<ide>
<ide> ```js
<del>let FCC_User = {
<del> username: 'awesome_coder',
<del> followers: 572,
<del> points: 1741,
<del> completedProjects: 15
<add>const tekkenCharacter = {
<add> player: 'Hwoarang',
<add> fightingStyle: 'Tae Kwon Doe',
<add> human: true
<ide> };
<ide> ```
<ide>
<del>The above code defines an object called <code>FCC_User</code> that has four <dfn>properties</dfn>, each of which map to a specific value. If we wanted to know the number of <code>followers</code> <code>FCC_User</code> has, we can access that property by writing:
<add>The above code defines a Tekken video game character object called <code>tekkenCharacter</code>. It has three properties, each of which map to a specific value. If you want to add an additional property, such as "origin", it can be done by assigning <code>origin</code> to the object:
<ide>
<ide> ```js
<del>let userData = FCC_User.followers;
<del>// userData equals 572
<add>tekkenCharacter.origin = 'South Korea';
<ide> ```
<ide>
<del>This is called <dfn>dot notation</dfn>. Alternatively, we can also access the property with brackets, like so:
<add>This uses dot notation. If you were to observe the <code>tekkenCharacter</code> object, it will now include the <code>origin</code> property. Hwoarang also had distinct orange hair. You can add this property with bracket notation by doing:
<ide>
<ide> ```js
<del>let userData = FCC_User['followers'];
<del>// userData equals 572
<add>tekkenCharacter['hair color'] = 'dyed orange';
<add>```
<add>
<add>Bracket notation is required if your property has a space in it or if you want to use a variable to name the property. In the above case, the property is enclosed in quotes to denote it as a string and will be added exactly as shown. Without quotes, it will be evaluated as a variable and the name of the property will be whatever value the variable is. Here's an example with a variable:
<add>
<add>```js
<add>const eyes = 'eye color';
<add>
<add>tekkenCharacter[eyes] = 'brown';
<add>```
<add>
<add>After adding all the examples, the object will look like this:
<add>
<add>```js
<add>{
<add> player: 'Hwoarang',
<add> fightingStyle: 'Tae Kwon Doe',
<add> human: true,
<add> origin: 'South Korea',
<add> 'hair color': 'dyed orange',
<add> 'eye color': 'brown'
<add>};
<ide> ```
<ide>
<del>Notice that with <dfn>bracket notation</dfn>, we enclosed <code>followers</code> in quotes. This is because the brackets actually allow us to pass a variable in to be evaluated as a property name (hint: keep this in mind for later!). Had we passed <code>followers</code> in without the quotes, the JavaScript engine would have attempted to evaluate it as a variable, and a <code>ReferenceError: followers is not defined</code> would have been thrown.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>Using the same syntax, we can also <em><strong>add new</strong></em> key-value pairs to objects. We've created a <code>foods</code> object with three entries. Add three more entries: <code>bananas</code> with a value of <code>13</code>, <code>grapes</code> with a value of <code>35</code>, and <code>strawberries</code> with a value of <code>27</code>.
<add> A <code>foods</code> object has been created with three entries. Using the syntax of your choice, add three more entries to it: <code>bananas</code> with a value of <code>13</code>, <code>grapes</code> with a value of <code>35</code>, and <code>strawberries</code> with a value of <code>27</code>.
<ide> </section>
<ide>
<ide> ## Tests | 1 |
PHP | PHP | change method names and vars | 2b2cde66defa59ffa02ca117262983acae8eda46 | <ide><path>src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
<ide> protected function getConfigurationFiles(Application $app)
<ide> $configPath = realpath($app->configPath());
<ide>
<ide> foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
<del> $nesting = $this->getConfigurationNesting($file, $configPath);
<add> $directory = $this->getNestedDirectory($file, $configPath);
<ide>
<del> $files[$nesting.basename($file->getRealPath(), '.php')] = $file->getRealPath();
<add> $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
<ide> }
<ide>
<ide> return $files;
<ide> protected function getConfigurationFiles(Application $app)
<ide> * @param string $configPath
<ide> * @return string
<ide> */
<del> protected function getConfigurationNesting(SplFileInfo $file, $configPath)
<add> protected function getNestedDirectory(SplFileInfo $file, $configPath)
<ide> {
<ide> $directory = $file->getPath();
<ide>
<del> if ($tree = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) {
<del> $tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.';
<add> if ($nested = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) {
<add> $nested = str_replace(DIRECTORY_SEPARATOR, '.', $nested).'.';
<ide> }
<ide>
<del> return $tree;
<add> return $nested;
<ide> }
<ide> } | 1 |
Ruby | Ruby | add xcode 4.3.3 | b9f4b682b507d093bb779a5d5355edc93c22b3cb | <ide><path>Library/Homebrew/utils.rb
<ide> def prefer_64_bit?
<ide> "4.2" => {:llvm_build_version=>2336, :clang_version=>"3.0", :clang_build_version=>211},
<ide> "4.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318},
<ide> "4.3.1" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318},
<del> "4.3.2" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}
<add> "4.3.2" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318},
<add> "4.3.3" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}
<ide> }
<ide>
<ide> def compilers_standard? | 1 |
PHP | PHP | add $_ids option in association | e94a17740303b46c116ad57092127a6406a267b7 | <ide><path>src/ORM/Marshaller.php
<ide> protected function _mergeBelongsToMany($original, $assoc, $value, $options)
<ide> {
<ide> $hasIds = array_key_exists('_ids', $value);
<ide> $associated = isset($options['associated']) ? $options['associated'] : [];
<add> $_ids = array_key_exists('_ids', $options) && $options['_ids'];
<add>
<ide> if ($hasIds && is_array($value['_ids'])) {
<ide> return $this->_loadAssociatedByIds($assoc, $value['_ids']);
<ide> }
<del> if ($hasIds) {
<add> if ($hasIds || $_ids) {
<ide> return [];
<ide> }
<ide> | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.