content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
PHP
PHP
add table options to mysql
2b90e7dbc75cccae5f7b1fc76eba57bf6fcbe049
<ide><path>lib/Cake/Database/Schema/MysqlSchema.php <ide> public function dropTableSql(Table $table) { <ide> */ <ide> public function createTableSql(Table $table, $columns, $constraints, $indexes) { <ide> $content = implode(",\n", array_merge($columns, $constraints, $indexes)); <del> return [sprintf("CREATE TABLE `%s` (\n%s\n)", $table->name(), $content)]; <add> $content = sprintf("CREATE TABLE `%s` (\n%s\n)", $table->name(), $content); <add> $options = $table->options(); <add> if (isset($options['engine'])) { <add> $content .= sprintf(" ENGINE=%s", $options['engine']); <add> } <add> if (isset($options['charset'])) { <add> $content .= sprintf(" DEFAULT CHARSET=%s", $options['charset']); <add> } <add> if (isset($options['collate'])) { <add> $content .= sprintf(" COLLATE=%s", $options['collate']); <add> } <add> return [$content]; <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/TestCase/Database/Schema/MysqlSchemaTest.php <ide> public function testCreateSql() { <ide> ->addConstraint('primary', [ <ide> 'type' => 'primary', <ide> 'columns' => ['id'] <add> ]) <add> ->options([ <add> 'engine' => 'InnoDB', <add> 'charset' => 'utf8', <add> 'collate' => 'utf8_general_ci', <ide> ]); <ide> <ide> $expected = <<<SQL <ide> public function testCreateSql() { <ide> `body` TEXT, <ide> `created` DATETIME, <ide> PRIMARY KEY (`id`) <del>) <add>) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci <ide> SQL; <ide> $result = $table->createSql($connection); <ide> $this->assertCount(1, $result);
2
Python
Python
remove layer creation
237a543595c68ba2bc2bbdb64c11e4a811879b21
<ide><path>official/nlp/modeling/layers/on_device_embedding_test.py <ide> def test_one_hot_layer_invocation_with_mixed_precision(self): <ide> output = model.predict(input_data) <ide> self.assertEqual(tf.float16, output.dtype) <ide> <del> def test_use_scale_layer_creation(self): <del> vocab_size = 31 <del> embedding_width = 27 <del> test_layer = on_device_embedding.OnDeviceEmbedding( <del> vocab_size=vocab_size, embedding_width=embedding_width, use_scale=True) <del> # Create a 2-dimensional input (the first dimension is implicit). <del> sequence_length = 23 <del> input_tensor = tf.keras.Input(shape=(sequence_length), dtype=tf.int32) <del> output_tensor = test_layer(input_tensor) <del> <del> # The output should be the same as the input, save that it has an extra <del> # embedding_width dimension on the end. <del> expected_output_shape = [None, sequence_length, embedding_width] <del> self.assertEqual(expected_output_shape, output_tensor.shape.as_list()) <del> self.assertEqual(output_tensor.dtype, tf.float32) <del> <del> def test_use_scale_layer_creation_with_mixed_precision(self): <del> vocab_size = 31 <del> embedding_width = 27 <del> policy = tf.keras.mixed_precision.experimental.Policy("mixed_float16") <del> test_layer = on_device_embedding.OnDeviceEmbedding( <del> vocab_size=vocab_size, embedding_width=embedding_width, dtype=policy, <del> use_scale=True) <del> # Create a 2-dimensional input (the first dimension is implicit). <del> sequence_length = 23 <del> input_tensor = tf.keras.Input(shape=(sequence_length), dtype=tf.int32) <del> output_tensor = test_layer(input_tensor) <del> <del> # The output should be the same as the input, save that it has an extra <del> # embedding_width dimension on the end. <del> expected_output_shape = [None, sequence_length, embedding_width] <del> self.assertEqual(expected_output_shape, output_tensor.shape.as_list()) <del> self.assertEqual(output_tensor.dtype, tf.float16) <del> <ide> def test_use_scale_layer_invocation(self): <ide> vocab_size = 31 <ide> embedding_width = 27
1
Python
Python
fix incorrect env_variables keyword
3c806ff32d48e5b7a40b92500969a0597106d7db
<ide><path>dev/breeze/src/airflow_breeze/utils/docker_command_utils.py <ide> def get_env_variables_for_docker_commands(params: Union[ShellParams, BuildCiPara <ide> # Set constant defaults if not defined <ide> for variable in DOCKER_VARIABLE_CONSTANTS: <ide> constant_param_value = DOCKER_VARIABLE_CONSTANTS[variable] <del> if not env_variables.get(constant_param_value): <add> if not env_variables.get(variable): <ide> env_variables[variable] = str(constant_param_value) <ide> update_expected_environment_variables(env_variables) <ide> return env_variables
1
Javascript
Javascript
move setupallowedflags() into per_thread.js
36f483b79b56db9da62c15db4bb3293032ac2073
<ide><path>lib/internal/bootstrap/node.js <ide> <ide> perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE); <ide> <del> setupAllowedFlags(); <add> perThreadSetup.setupAllowedFlags(); <ide> <ide> startExecution(); <ide> } <ide> new vm.Script(source, { displayErrors: true, filename }); <ide> } <ide> <del> function setupAllowedFlags() { <del> // This builds process.allowedNodeEnvironmentFlags <del> // from data in the config binding <del> <del> const replaceUnderscoresRegex = /_/g; <del> const leadingDashesRegex = /^--?/; <del> const trailingValuesRegex = /=.*$/; <del> <del> // Save references so user code does not interfere <del> const replace = Function.call.bind(String.prototype.replace); <del> const has = Function.call.bind(Set.prototype.has); <del> const test = Function.call.bind(RegExp.prototype.test); <del> <del> const get = () => { <del> const { <del> envSettings: { kAllowedInEnvironment } <del> } = internalBinding('options'); <del> const { options, aliases } = NativeModule.require('internal/options'); <del> <del> const allowedNodeEnvironmentFlags = []; <del> for (const [name, info] of options) { <del> if (info.envVarSettings === kAllowedInEnvironment) { <del> allowedNodeEnvironmentFlags.push(name); <del> } <del> } <del> <del> for (const [ from, expansion ] of aliases) { <del> let isAccepted = true; <del> for (const to of expansion) { <del> if (!to.startsWith('-') || to === '--') continue; <del> const recursiveExpansion = aliases.get(to); <del> if (recursiveExpansion) { <del> if (recursiveExpansion[0] === to) <del> recursiveExpansion.splice(0, 1); <del> expansion.push(...recursiveExpansion); <del> continue; <del> } <del> isAccepted = options.get(to).envVarSettings === kAllowedInEnvironment; <del> if (!isAccepted) break; <del> } <del> if (isAccepted) { <del> let canonical = from; <del> if (canonical.endsWith('=')) <del> canonical = canonical.substr(0, canonical.length - 1); <del> if (canonical.endsWith(' <arg>')) <del> canonical = canonical.substr(0, canonical.length - 4); <del> allowedNodeEnvironmentFlags.push(canonical); <del> } <del> } <del> <del> const trimLeadingDashes = (flag) => replace(flag, leadingDashesRegex, ''); <del> <del> // Save these for comparison against flags provided to <del> // process.allowedNodeEnvironmentFlags.has() which lack leading dashes. <del> // Avoid interference w/ user code by flattening `Set.prototype` into <del> // each object. <del> const nodeFlags = Object.defineProperties( <del> new Set(allowedNodeEnvironmentFlags.map(trimLeadingDashes)), <del> Object.getOwnPropertyDescriptors(Set.prototype) <del> ); <del> <del> class NodeEnvironmentFlagsSet extends Set { <del> constructor(...args) { <del> super(...args); <del> <del> // the super constructor consumes `add`, but <del> // disallow any future adds. <del> this.add = () => this; <del> } <del> <del> delete() { <del> // noop, `Set` API compatible <del> return false; <del> } <del> <del> clear() { <del> // noop <del> } <del> <del> has(key) { <del> // This will return `true` based on various possible <del> // permutations of a flag, including present/missing leading <del> // dash(es) and/or underscores-for-dashes. <del> // Strips any values after `=`, inclusive. <del> // TODO(addaleax): It might be more flexible to run the option parser <del> // on a dummy option set and see whether it rejects the argument or <del> // not. <del> if (typeof key === 'string') { <del> key = replace(key, replaceUnderscoresRegex, '-'); <del> if (test(leadingDashesRegex, key)) { <del> key = replace(key, trailingValuesRegex, ''); <del> return has(this, key); <del> } <del> return has(nodeFlags, key); <del> } <del> return false; <del> } <del> } <del> <del> Object.freeze(NodeEnvironmentFlagsSet.prototype.constructor); <del> Object.freeze(NodeEnvironmentFlagsSet.prototype); <del> <del> return process.allowedNodeEnvironmentFlags = Object.freeze( <del> new NodeEnvironmentFlagsSet( <del> allowedNodeEnvironmentFlags <del> )); <del> }; <del> <del> Object.defineProperty(process, 'allowedNodeEnvironmentFlags', { <del> get, <del> set(value) { <del> Object.defineProperty(this, 'allowedNodeEnvironmentFlags', { <del> value, <del> configurable: true, <del> enumerable: true, <del> writable: true <del> }); <del> }, <del> enumerable: true, <del> configurable: true <del> }); <del> } <del> <ide> startup(); <ide> }); <ide><path>lib/internal/process/per_thread.js <ide> function setupUncaughtExceptionCapture(exceptionHandlerState, <ide> }; <ide> } <ide> <add>const replaceUnderscoresRegex = /_/g; <add>const leadingDashesRegex = /^--?/; <add>const trailingValuesRegex = /=.*$/; <add> <add>// Save references so user code does not interfere <add>const replace = Function.call.bind(String.prototype.replace); <add>const has = Function.call.bind(Set.prototype.has); <add>const test = Function.call.bind(RegExp.prototype.test); <add> <add>// This builds the initial process.allowedNodeEnvironmentFlags <add>// from data in the config binding. <add>function buildAllowedFlags() { <add> const { <add> envSettings: { kAllowedInEnvironment } <add> } = internalBinding('options'); <add> const { options, aliases } = require('internal/options'); <add> <add> const allowedNodeEnvironmentFlags = []; <add> for (const [name, info] of options) { <add> if (info.envVarSettings === kAllowedInEnvironment) { <add> allowedNodeEnvironmentFlags.push(name); <add> } <add> } <add> <add> for (const [ from, expansion ] of aliases) { <add> let isAccepted = true; <add> for (const to of expansion) { <add> if (!to.startsWith('-') || to === '--') continue; <add> const recursiveExpansion = aliases.get(to); <add> if (recursiveExpansion) { <add> if (recursiveExpansion[0] === to) <add> recursiveExpansion.splice(0, 1); <add> expansion.push(...recursiveExpansion); <add> continue; <add> } <add> isAccepted = options.get(to).envVarSettings === kAllowedInEnvironment; <add> if (!isAccepted) break; <add> } <add> if (isAccepted) { <add> let canonical = from; <add> if (canonical.endsWith('=')) <add> canonical = canonical.substr(0, canonical.length - 1); <add> if (canonical.endsWith(' <arg>')) <add> canonical = canonical.substr(0, canonical.length - 4); <add> allowedNodeEnvironmentFlags.push(canonical); <add> } <add> } <add> <add> const trimLeadingDashes = (flag) => replace(flag, leadingDashesRegex, ''); <add> <add> // Save these for comparison against flags provided to <add> // process.allowedNodeEnvironmentFlags.has() which lack leading dashes. <add> // Avoid interference w/ user code by flattening `Set.prototype` into <add> // each object. <add> const nodeFlags = Object.defineProperties( <add> new Set(allowedNodeEnvironmentFlags.map(trimLeadingDashes)), <add> Object.getOwnPropertyDescriptors(Set.prototype) <add> ); <add> <add> class NodeEnvironmentFlagsSet extends Set { <add> constructor(...args) { <add> super(...args); <add> <add> // the super constructor consumes `add`, but <add> // disallow any future adds. <add> this.add = () => this; <add> } <add> <add> delete() { <add> // noop, `Set` API compatible <add> return false; <add> } <add> <add> clear() { <add> // noop <add> } <add> <add> has(key) { <add> // This will return `true` based on various possible <add> // permutations of a flag, including present/missing leading <add> // dash(es) and/or underscores-for-dashes. <add> // Strips any values after `=`, inclusive. <add> // TODO(addaleax): It might be more flexible to run the option parser <add> // on a dummy option set and see whether it rejects the argument or <add> // not. <add> if (typeof key === 'string') { <add> key = replace(key, replaceUnderscoresRegex, '-'); <add> if (test(leadingDashesRegex, key)) { <add> key = replace(key, trailingValuesRegex, ''); <add> return has(this, key); <add> } <add> return has(nodeFlags, key); <add> } <add> return false; <add> } <add> } <add> <add> Object.freeze(NodeEnvironmentFlagsSet.prototype.constructor); <add> Object.freeze(NodeEnvironmentFlagsSet.prototype); <add> <add> return process.allowedNodeEnvironmentFlags = Object.freeze( <add> new NodeEnvironmentFlagsSet( <add> allowedNodeEnvironmentFlags <add> )); <add>} <add> <add>function setupAllowedFlags() { <add> Object.defineProperty(process, 'allowedNodeEnvironmentFlags', { <add> get: buildAllowedFlags, <add> set(value) { <add> // If the user tries to set this to another value, override <add> // this completely to that value. <add> Object.defineProperty(this, 'allowedNodeEnvironmentFlags', { <add> value, <add> configurable: true, <add> enumerable: true, <add> writable: true <add> }); <add> }, <add> enumerable: true, <add> configurable: true <add> }); <add>} <add> <ide> module.exports = { <add> setupAllowedFlags, <ide> setupAssert, <ide> setupCpuUsage, <ide> setupHrtime,
2
Javascript
Javascript
add custom redirect back
aa62fdbfe98f872785f792108c6d55582da7e12d
<ide><path>api-server/server/boot/authentication.js <ide> module.exports = function enableAuthentication(app) { <ide> } else { <ide> api.get( <ide> '/signin', <add> (req, res, next) => { <add> if (req && req.query && req.query.returnTo) { <add> req.query.returnTo = `${homeLocation}/${req.query.returnTo}`; <add> } <add> return next(); <add> }, <ide> ifUserRedirect, <del> passport.authenticate('auth0-login', {}) <add> (req, res, next) => { <add> const state = req.query.returnTo <add> ? Buffer.from(req.query.returnTo).toString('base64') <add> : null; <add> return passport.authenticate('auth0-login', { state })(req, res, next); <add> } <ide> ); <ide> <ide> api.get( <ide><path>api-server/server/component-passport.js <ide> export const createPassportCallbackAuthenticator = (strategy, config) => ( <ide> res, <ide> next <ide> ) => { <add> const returnTo = <add> req && req.query && req.query.state <add> ? Buffer.from(req.query.state, 'base64').toString('utf-8') <add> : `${homeLocation}/learn`; <ide> return passport.authenticate( <ide> strategy, <ide> { session: false }, <ide> export const createPassportCallbackAuthenticator = (strategy, config) => ( <ide> if (!user || !userInfo) { <ide> return res.redirect('/signin'); <ide> } <del> const redirect = `${homeLocation}/learn`; <add> const redirect = `${returnTo}`; <ide> <ide> const { accessToken } = userInfo; <ide> const { provider } = config; <ide><path>api-server/server/passport-providers.js <ide> export default { <ide> authPath: '/auth/auth0', <ide> callbackPath: '/auth/auth0/callback', <ide> useCustomCallback: true, <add> passReqToCallback: true, <add> state: false, <ide> successRedirect: successRedirect, <ide> failureRedirect: failureRedirect, <ide> scope: ['openid profile email'], <ide><path>api-server/server/utils/middleware.js <ide> export function ifNotVerifiedRedirectToUpdateEmail(req, res, next) { <ide> } <ide> <ide> export function ifUserRedirectTo(path = `${homeLocation}/`, status) { <del> status = status === 302 ? 302 : 301; <add> status = status === 301 ? 301 : 302; <ide> return (req, res, next) => { <ide> const { accessToken } = getAccessTokenFromRequest(req); <ide> if (req.user && accessToken) { <add> if (req.query && req.query.returnTo) { <add> return res.status(status).redirect(req.query.returnTo); <add> } <ide> return res.status(status).redirect(path); <ide> } <ide> if (req.user && !accessToken) { <ide><path>client/src/client-only-routes/ShowSettings.js <ide> export function ShowSettings(props) { <ide> } <ide> <ide> if (!showLoading && !isSignedIn) { <del> return navigate(`${apiLocation}/signin`); <add> return navigate(`${apiLocation}/signin?returnTo=settings`); <ide> } <ide> <ide> return ( <ide><path>client/src/client-only-routes/ShowSettings.test.js <ide> describe('<ShowSettings />', () => { <ide> const shallow = new ShallowRenderer(); <ide> shallow.render(<ShowSettings {...loggedOutProps} />); <ide> expect(navigate).toHaveBeenCalledTimes(1); <del> expect(navigate).toHaveBeenCalledWith(`${apiLocation}/signin`); <add> expect(navigate).toHaveBeenCalledWith( <add> `${apiLocation}/signin?returnTo=settings` <add> ); <ide> expect(true).toBeTruthy(); <ide> }); <ide> }); <ide><path>client/src/pages/donate.js <ide> export class DonatePage extends Component { <ide> } <ide> <ide> if (!showLoading && !isSignedIn) { <del> return navigate(`${apiLocation}/signin`); <add> return navigate(`${apiLocation}/signin?returnTo=donate`); <ide> } <ide> <ide> return ( <ide><path>client/src/pages/donate.test.js <ide> describe('<ShowSettings />', () => { <ide> const shallow = new ShallowRenderer(); <ide> shallow.render(<DonatePage {...loggedOutProps} />); <ide> expect(navigate).toHaveBeenCalledTimes(1); <del> expect(navigate).toHaveBeenCalledWith(`${apiLocation}/signin`); <add> expect(navigate).toHaveBeenCalledWith( <add> `${apiLocation}/signin?returnTo=donate` <add> ); <ide> expect(true).toBeTruthy(); <ide> }); <ide> }); <ide><path>client/src/pages/portfolio.js <ide> function ProfilePage(props) { <ide> return <Loader fullScreen={true} />; <ide> } <ide> if (!showLoading && !isSignedIn) { <del> return navigate(`${apiLocation}/signin`); <add> return navigate(`${apiLocation}/signin?returnTo=portfolio`); <ide> } <ide> const RedirecUser = createRedirect('/' + username); <ide> return <RedirecUser />;
9
Mixed
Text
fix docker start help message
3c37f88aff42c1d900d18d1a8c81fc857e650d44
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) CmdStart(args ...string) error { <ide> cErr chan error <ide> tty bool <ide> <del> cmd = cli.Subcmd("start", "CONTAINER [CONTAINER...]", "Restart a stopped container", true) <add> cmd = cli.Subcmd("start", "CONTAINER [CONTAINER...]", "Start one or more stopped containers", true) <ide> attach = cmd.Bool([]string{"a", "-attach"}, false, "Attach STDOUT/STDERR and forward signals") <ide> openStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Attach container's STDIN") <ide> ) <ide><path>docs/man/docker-start.1.md <ide> % Docker Community <ide> % JUNE 2014 <ide> # NAME <del>docker-start - Restart a stopped container <add>docker-start - Start one or more stopped containers <ide> <ide> # SYNOPSIS <ide> **docker start** <ide> CONTAINER [CONTAINER...] <ide> <ide> # DESCRIPTION <ide> <del>Start a stopped container. <add>Start one or more stopped containers. <ide> <ide> # OPTIONS <ide> **-a**, **--attach**=*true*|*false* <ide><path>docs/sources/reference/commandline/cli.md <ide> more details on finding shared images from the command line. <ide> <ide> Usage: docker start [OPTIONS] CONTAINER [CONTAINER...] <ide> <del> Restart a stopped container <add> Start one or more stopped containers <ide> <ide> -a, --attach=false Attach STDOUT/STDERR and forward signals <ide> -i, --interactive=false Attach container's STDIN
3
PHP
PHP
fix incorrect doc blocks
54e960669353122023d99482f40817ba2cd4367c
<ide><path>Cake/ORM/Association/BelongsToMany.php <ide> public function attachTo(Query $query, array $options = []) { <ide> /** <ide> * Get the relationship type. <ide> * <del> * @return string MANY_TO_ONE <add> * @return string <ide> */ <ide> public function type() { <ide> return self::MANY_TO_MANY; <ide><path>Cake/ORM/Association/HasMany.php <ide> public function save(Entity $entity, $options = []) { <ide> /** <ide> * Get the relationship type. <ide> * <del> * @return string MANY_TO_ONE <add> * @return string <ide> */ <ide> public function type() { <ide> return self::ONE_TO_MANY;
2
Javascript
Javascript
preserve existing defaults
fde84f272acf441fbfb8d51931c2484e1d34c805
<ide><path>src/core/core.typedRegistry.js <ide> export default class TypedRegistry { <ide> return scope; <ide> } <ide> <del> if (Object.keys(defaults.get(scope)).length) { <del> throw new Error('Can not register "' + id + '", because "defaults.' + scope + '" would collide with existing defaults'); <del> } <del> <ide> items[id] = item; <ide> registerDefaults(item, scope, parentScope); <ide> <ide> export default class TypedRegistry { <ide> } <ide> <ide> function registerDefaults(item, scope, parentScope) { <del> // Inherit the parent's defaults <del> const itemDefaults = parentScope <del> ? Object.assign({}, defaults.get(parentScope), item.defaults) <del> : item.defaults; <add> // Inherit the parent's defaults and keep existing defaults <add> const itemDefaults = Object.assign( <add> Object.create(null), <add> parentScope && defaults.get(parentScope), <add> item.defaults, <add> defaults.get(scope) <add> ); <ide> <ide> defaults.set(scope, itemDefaults); <ide> <ide><path>test/specs/core.registry.tests.js <ide> describe('Chart.registry', function() { <ide> expect(afterUnregisterCount).withContext('afterUnregister').toBe(4); <ide> }); <ide> <del> it('should not register anything that would collide with existing defaults', function() { <del> Chart.defaults.controllers.test = {test: true}; <add> it('should preserve existing defaults', function() { <add> Chart.defaults.controllers.test = {test1: true}; <add> <ide> class testController extends Chart.DatasetController {} <ide> testController.id = 'test'; <del> expect(function() { <del> Chart.register(testController); <del> }).toThrow(new Error('Can not register "test", because "defaults.controllers.test" would collide with existing defaults')); <del> delete Chart.defaults.controllers.test; <add> testController.defaults = {test1: false, test2: true}; <add> <add> Chart.register(testController); <add> expect(Chart.defaults.controllers.test).toEqual({test1: true, test2: true}); <add> <add> Chart.unregister(testController); <add> expect(Chart.defaults.controllers.test).not.toBeDefined(); <ide> }); <ide> <ide> describe('should handle multiple items', function() {
2
Text
Text
update pr-url for dep0022 eol
17e3f3be763cb440bb315911f3e926044ddb128c
<ide><path>doc/api/deprecations.md <ide> The `Server.listenFD()` method was deprecated and removed. Please use <ide> <!-- YAML <ide> changes: <ide> - version: REPLACEME <del> pr-url: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/31169 <ide> description: End-of-Life. <ide> - version: v7.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/6739
1
PHP
PHP
add tests to dispatchshell
baf4147d6757b1c1d7de2d4d706d92c23a822142
<ide><path>tests/TestCase/Console/ShellTest.php <ide> public function testDispatchShellArgsParser() <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add> /** <add> * test calling a shell that dispatch another one <add> * <add> * @return void <add> */ <add> public function testDispatchShell() <add> { <add> $Shell = new TestingDispatchShell(); <add> ob_start(); <add> $Shell->runCommand(['test_task'], true); <add> $result = ob_get_clean(); <add> <add> $expected = <<<TEXT <add><info>Welcome to CakePHP Console</info> <add>I am a test task, I dispatch another Shell <add>I am a dispatched Shell <add> <add>TEXT; <add> $this->assertEquals($expected, $result); <add> <add> ob_start(); <add> $Shell->runCommand(['test_task_dispatch_array'], true); <add> $result = ob_get_clean(); <add> $this->assertEquals($expected, $result); <add> <add> ob_start(); <add> $Shell->runCommand(['test_task_dispatch_command_string'], true); <add> $result = ob_get_clean(); <add> $this->assertEquals($expected, $result); <add> <add> ob_start(); <add> $Shell->runCommand(['test_task_dispatch_command_array'], true); <add> $result = ob_get_clean(); <add> $this->assertEquals($expected, $result); <add> <add> $expected = <<<TEXT <add><info>Welcome to CakePHP Console</info> <add>I am a test task, I dispatch another Shell <add>I am a dispatched Shell. My param `foo` has the value `bar` <add> <add>TEXT; <add> <add> ob_start(); <add> $Shell->runCommand(['test_task_dispatch_with_param'], true); <add> $result = ob_get_clean(); <add> $this->assertEquals($expected, $result); <add> <add> $expected = <<<TEXT <add><info>Welcome to CakePHP Console</info> <add>I am a test task, I dispatch another Shell <add>I am a dispatched Shell. My param `foo` has the value `bar` <add>My param `fooz` has the value `baz` <add> <add>TEXT; <add> ob_start(); <add> $Shell->runCommand(['test_task_dispatch_with_multiple_params'], true); <add> $result = ob_get_clean(); <add> $this->assertEquals($expected, $result); <add> <add> $expected = <<<TEXT <add><info>Welcome to CakePHP Console</info> <add>I am a test task, I dispatch another Shell <add><info>Welcome to CakePHP Console</info> <add>I am a dispatched Shell <add> <add>TEXT; <add> ob_start(); <add> $Shell->runCommand(['test_task_dispatch_with_requested_off'], true); <add> $result = ob_get_clean(); <add> $this->assertEquals($expected, $result); <add> } <add> <ide> /** <ide> * Test that runCommand() doesn't call public methods when the second arg is false. <ide> * <ide> public function testRunCommandHittingTaskInSubcommand() <ide> $shell->runCommand(['slice', 'one']); <ide> } <ide> <del> /** <del> * test calling a shell that dispatch another one <del> * <del> * @return void <del> */ <del> public function testDispatchShell() <del> { <del> $Shell = new TestingDispatchShell(); <del> ob_start(); <del> $Shell->runCommand(['test_task'], true); <del> $result = ob_get_clean(); <del> <del> $expected = <<<TEXT <del><info>Welcome to CakePHP Console</info> <del>I am a test task, I dispatch another Shell <del>I am a dispatched Shell <del> <del>TEXT; <del> $this->assertEquals($expected, $result); <del> } <del> <ide> /** <ide> * test wrapBlock wrapping text. <ide> * <ide><path>tests/test_app/TestApp/Shell/TestingDispatchShell.php <ide> public function out($message = null, $newlines = 1, $level = Shell::NORMAL) <ide> } <ide> <ide> public function testTask() <add> { <add> $this->out('I am a test task, I dispatch another Shell'); <add> Configure::write('App.namespace', 'TestApp'); <add> $this->dispatchShell('testing_dispatch dispatch_test_task'); <add> } <add> <add> public function testTaskDispatchArray() <ide> { <ide> $this->out('I am a test task, I dispatch another Shell'); <ide> Configure::write('App.namespace', 'TestApp'); <ide> $this->dispatchShell('testing_dispatch', 'dispatch_test_task'); <ide> } <ide> <add> public function testTaskDispatchCommandString() <add> { <add> $this->out('I am a test task, I dispatch another Shell'); <add> Configure::write('App.namespace', 'TestApp'); <add> $this->dispatchShell(['command' => 'testing_dispatch dispatch_test_task']); <add> } <add> <add> public function testTaskDispatchCommandArray() <add> { <add> $this->out('I am a test task, I dispatch another Shell'); <add> Configure::write('App.namespace', 'TestApp'); <add> $this->dispatchShell(['command' => ['testing_dispatch', 'dispatch_test_task']]); <add> } <add> <add> public function testTaskDispatchWithParam() <add> { <add> $this->out('I am a test task, I dispatch another Shell'); <add> Configure::write('App.namespace', 'TestApp'); <add> $this->dispatchShell([ <add> 'command' => ['testing_dispatch', 'dispatch_test_task_param'], <add> 'extra' => [ <add> 'foo' => 'bar' <add> ] <add> ]); <add> } <add> <add> public function testTaskDispatchWithMultipleParams() <add> { <add> $this->out('I am a test task, I dispatch another Shell'); <add> Configure::write('App.namespace', 'TestApp'); <add> $this->dispatchShell([ <add> 'command' => ['testing_dispatch dispatch_test_task_params'], <add> 'extra' => [ <add> 'foo' => 'bar', <add> 'fooz' => 'baz' <add> ] <add> ]); <add> } <add> <add> public function testTaskDispatchWithRequestedOff() <add> { <add> $this->out('I am a test task, I dispatch another Shell'); <add> Configure::write('App.namespace', 'TestApp'); <add> $this->dispatchShell([ <add> 'command' => ['testing_dispatch', 'dispatch_test_task'], <add> 'extra' => [ <add> 'requested' => false <add> ] <add> ]); <add> } <add> <ide> public function dispatchTestTask() <ide> { <ide> $this->out('I am a dispatched Shell'); <ide> } <add> <add> public function dispatchTestTaskParam() <add> { <add> $this->out('I am a dispatched Shell. My param `foo` has the value `' . $this->param('foo') . '`'); <add> } <add> <add> public function dispatchTestTaskParams() <add> { <add> $this->out('I am a dispatched Shell. My param `foo` has the value `' . $this->param('foo') . '`'); <add> $this->out('My param `fooz` has the value `' . $this->param('fooz') . '`'); <add> } <ide> }
2
Python
Python
add check for methods
68a1acf41586bb65538af84ce9c74ec5e0872750
<ide><path>numpy/lib/arraysetops.py <ide> def in1d(ar1, ar2, assume_unique=False, invert=False, method='auto'): <ide> integer_arrays = (np.issubdtype(ar1.dtype, np.integer) and <ide> np.issubdtype(ar2.dtype, np.integer)) <ide> <add> if method not in ['auto', 'sort', 'dictionary']: <add> raise ValueError( <add> "Invalid method: {0}. ".format(method) <add> + "Please use 'auto', 'sort' or 'dictionary'.") <add> <ide> if integer_arrays and method in ['auto', 'dictionary']: <ide> ar2_min = np.min(ar2) <ide> ar2_max = np.max(ar2) <ide> def in1d(ar1, ar2, assume_unique=False, invert=False, method='auto'): <ide> ar2_min] <ide> <ide> return outgoing_array <add> elif method == 'dictionary': <add> raise ValueError( <add> "'dictionary' method is only supported for non-integer arrays. " <add> "Please select 'sort' or 'auto' for the method." <add> ) <ide> <ide> <ide> # Check if one of the arrays may contain arbitrary objects
1
Python
Python
update dutch language data
90f6ff12c95d54a6f90adf6374d0d1b1ccd0fd1b
<ide><path>spacy/nl/language_data.py <ide> <ide> <ide> #TODO Make tokenizer excpetions for Dutch <del>TOKENIZER_EXCEPTIONS = { <del> "''": [ <del> { <del> "F": "''" <del> } <del> ], <del> "'S": [ <del> { <del> "F": "'S", <del> "L": "es" <del> } <del> ], <del> "'n": [ <del> { <del> "F": "'n", <del> "L": "ein" <del> } <del> ], <del> "'ne": [ <del> { <del> "F": "'ne", <del> "L": "eine" <del> } <del> ], <del> "'nen": [ <del> { <del> "F": "'nen", <del> "L": "einen" <del> } <del> ], <del> "'s": [ <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "(:": [ <del> { <del> "F": "(:" <del> } <del> ], <del> "(=": [ <del> { <del> "F": "(=" <del> } <del> ], <del> "(^_^)": [ <del> { <del> "F": "(^_^)" <del> } <del> ], <del> "-_-": [ <del> { <del> "F": "-_-" <del> } <del> ], <del> "-__-": [ <del> { <del> "F": "-__-" <del> } <del> ], <del> ":')": [ <del> { <del> "F": ":')" <del> } <del> ], <del> ":(": [ <del> { <del> "F": ":(" <del> } <del> ], <del> ":((": [ <del> { <del> "F": ":((" <del> } <del> ], <del> ":(((": [ <del> { <del> "F": ":(((" <del> } <del> ], <del> ":)": [ <del> { <del> "F": ":)" <del> } <del> ], <del> ":))": [ <del> { <del> "F": ":))" <del> } <del> ], <del> ":-)": [ <del> { <del> "F": ":-)" <del> } <del> ], <del> ":-/": [ <del> { <del> "F": ":-/" <del> } <del> ], <del> ":-P": [ <del> { <del> "F": ":-P" <del> } <del> ], <del> ":/": [ <del> { <del> "F": ":/" <del> } <del> ], <del> ":0": [ <del> { <del> "F": ":0" <del> } <del> ], <del> ":3": [ <del> { <del> "F": ":3" <del> } <del> ], <del> ":>": [ <del> { <del> "F": ":>" <del> } <del> ], <del> ":O": [ <del> { <del> "F": ":O" <del> } <del> ], <del> ":P": [ <del> { <del> "F": ":P" <del> } <del> ], <del> ":Y": [ <del> { <del> "F": ":Y" <del> } <del> ], <del> ":]": [ <del> { <del> "F": ":]" <del> } <del> ], <del> ":p": [ <del> { <del> "F": ":p" <del> } <del> ], <del> ";(": [ <del> { <del> "F": ";(" <del> } <del> ], <del> ";)": [ <del> { <del> "F": ";)" <del> } <del> ], <del> ";-)": [ <del> { <del> "F": ";-)" <del> } <del> ], <del> ";-p": [ <del> { <del> "F": ";-p" <del> } <del> ], <del> ";D": [ <del> { <del> "F": ";D" <del> } <del> ], <del> ";p": [ <del> { <del> "F": ";p" <del> } <del> ], <del> "<3": [ <del> { <del> "F": "<3" <del> } <del> ], <del> "<33": [ <del> { <del> "F": "<33" <del> } <del> ], <del> "<333": [ <del> { <del> "F": "<333" <del> } <del> ], <del> "<space>": [ <del> { <del> "F": "SP" <del> } <del> ], <del> "=)": [ <del> { <del> "F": "=)" <del> } <del> ], <del> "=3": [ <del> { <del> "F": "=3" <del> } <del> ], <del> "=D": [ <del> { <del> "F": "=D" <del> } <del> ], <del> "=[[": [ <del> { <del> "F": "=[[" <del> } <del> ], <del> "=]": [ <del> { <del> "F": "=]" <del> } <del> ], <del> "A.C.": [ <del> { <del> "F": "A.C." <del> } <del> ], <del> "A.D.": [ <del> { <del> "F": "A.D." <del> } <del> ], <del> "A.G.": [ <del> { <del> "F": "A.G." <del> } <del> ], <del> "Abb.": [ <del> { <del> "F": "Abb." <del> } <del> ], <del> "Abk.": [ <del> { <del> "F": "Abk." <del> } <del> ], <del> "Abs.": [ <del> { <del> "F": "Abs." <del> } <del> ], <del> "Abt.": [ <del> { <del> "F": "Abt." <del> } <del> ], <del> "Apr.": [ <del> { <del> "F": "Apr." <del> } <del> ], <del> "Aug.": [ <del> { <del> "F": "Aug." <del> } <del> ], <del> "B.A.": [ <del> { <del> "F": "B.A." <del> } <del> ], <del> "B.Sc.": [ <del> { <del> "F": "B.Sc." <del> } <del> ], <del> "Bd.": [ <del> { <del> "F": "Bd." <del> } <del> ], <del> "Betr.": [ <del> { <del> "F": "Betr." <del> } <del> ], <del> "Bf.": [ <del> { <del> "F": "Bf." <del> } <del> ], <del> "Bhf.": [ <del> { <del> "F": "Bhf." <del> } <del> ], <del> "Biol.": [ <del> { <del> "F": "Biol." <del> } <del> ], <del> "Bsp.": [ <del> { <del> "F": "Bsp." <del> } <del> ], <del> "Chr.": [ <del> { <del> "F": "Chr." <del> } <del> ], <del> "Cie.": [ <del> { <del> "F": "Cie." <del> } <del> ], <del> "Co.": [ <del> { <del> "F": "Co." <del> } <del> ], <del> "D.C.": [ <del> { <del> "F": "D.C." <del> } <del> ], <del> "Dez.": [ <del> { <del> "F": "Dez." <del> } <del> ], <del> "Di.": [ <del> { <del> "F": "Di." <del> } <del> ], <del> "Dipl.": [ <del> { <del> "F": "Dipl." <del> } <del> ], <del> "Dipl.-Ing.": [ <del> { <del> "F": "Dipl.-Ing." <del> } <del> ], <del> "Do.": [ <del> { <del> "F": "Do." <del> } <del> ], <del> "Dr.": [ <del> { <del> "F": "Dr." <del> } <del> ], <del> "Fa.": [ <del> { <del> "F": "Fa." <del> } <del> ], <del> "Fam.": [ <del> { <del> "F": "Fam." <del> } <del> ], <del> "Feb.": [ <del> { <del> "F": "Feb." <del> } <del> ], <del> "Fr.": [ <del> { <del> "F": "Fr." <del> } <del> ], <del> "Frl.": [ <del> { <del> "F": "Frl." <del> } <del> ], <del> "G.m.b.H.": [ <del> { <del> "F": "G.m.b.H." <del> } <del> ], <del> "Gebr.": [ <del> { <del> "F": "Gebr." <del> } <del> ], <del> "Hbf.": [ <del> { <del> "F": "Hbf." <del> } <del> ], <del> "Hg.": [ <del> { <del> "F": "Hg." <del> } <del> ], <del> "Hr.": [ <del> { <del> "F": "Hr." <del> } <del> ], <del> "Hrgs.": [ <del> { <del> "F": "Hrgs." <del> } <del> ], <del> "Hrn.": [ <del> { <del> "F": "Hrn." <del> } <del> ], <del> "Hrsg.": [ <del> { <del> "F": "Hrsg." <del> } <del> ], <del> "Ing.": [ <del> { <del> "F": "Ing." <del> } <del> ], <del> "Jan.": [ <del> { <del> "F": "Jan." <del> } <del> ], <del> "Jh.": [ <del> { <del> "F": "Jh." <del> } <del> ], <del> "Jhd.": [ <del> { <del> "F": "Jhd." <del> } <del> ], <del> "Jr.": [ <del> { <del> "F": "Jr." <del> } <del> ], <del> "Jul.": [ <del> { <del> "F": "Jul." <del> } <del> ], <del> "Jun.": [ <del> { <del> "F": "Jun." <del> } <del> ], <del> "K.O.": [ <del> { <del> "F": "K.O." <del> } <del> ], <del> "L.A.": [ <del> { <del> "F": "L.A." <del> } <del> ], <del> "M.A.": [ <del> { <del> "F": "M.A." <del> } <del> ], <del> "M.Sc.": [ <del> { <del> "F": "M.Sc." <del> } <del> ], <del> "Mi.": [ <del> { <del> "F": "Mi." <del> } <del> ], <del> "Mio.": [ <del> { <del> "F": "Mio." <del> } <del> ], <del> "Mo.": [ <del> { <del> "F": "Mo." <del> } <del> ], <del> "Mr.": [ <del> { <del> "F": "Mr." <del> } <del> ], <del> "Mrd.": [ <del> { <del> "F": "Mrd." <del> } <del> ], <del> "Mrz.": [ <del> { <del> "F": "Mrz." <del> } <del> ], <del> "MwSt.": [ <del> { <del> "F": "MwSt." <del> } <del> ], <del> "M\u00e4r.": [ <del> { <del> "F": "M\u00e4r." <del> } <del> ], <del> "N.Y.": [ <del> { <del> "F": "N.Y." <del> } <del> ], <del> "N.Y.C.": [ <del> { <del> "F": "N.Y.C." <del> } <del> ], <del> "Nov.": [ <del> { <del> "F": "Nov." <del> } <del> ], <del> "Nr.": [ <del> { <del> "F": "Nr." <del> } <del> ], <del> "O.K.": [ <del> { <del> "F": "O.K." <del> } <del> ], <del> "Okt.": [ <del> { <del> "F": "Okt." <del> } <del> ], <del> "Orig.": [ <del> { <del> "F": "Orig." <del> } <del> ], <del> "P.S.": [ <del> { <del> "F": "P.S." <del> } <del> ], <del> "Pkt.": [ <del> { <del> "F": "Pkt." <del> } <del> ], <del> "Prof.": [ <del> { <del> "F": "Prof." <del> } <del> ], <del> "R.I.P.": [ <del> { <del> "F": "R.I.P." <del> } <del> ], <del> "Red.": [ <del> { <del> "F": "Red." <del> } <del> ], <del> "S'": [ <del> { <del> "F": "S'", <del> "L": "sie" <del> } <del> ], <del> "Sa.": [ <del> { <del> "F": "Sa." <del> } <del> ], <del> "Sep.": [ <del> { <del> "F": "Sep." <del> } <del> ], <del> "Sept.": [ <del> { <del> "F": "Sept." <del> } <del> ], <del> "So.": [ <del> { <del> "F": "So." <del> } <del> ], <del> "St.": [ <del> { <del> "F": "St." <del> } <del> ], <del> "Std.": [ <del> { <del> "F": "Std." <del> } <del> ], <del> "Str.": [ <del> { <del> "F": "Str." <del> } <del> ], <del> "Tel.": [ <del> { <del> "F": "Tel." <del> } <del> ], <del> "Tsd.": [ <del> { <del> "F": "Tsd." <del> } <del> ], <del> "U.S.": [ <del> { <del> "F": "U.S." <del> } <del> ], <del> "U.S.A.": [ <del> { <del> "F": "U.S.A." <del> } <del> ], <del> "U.S.S.": [ <del> { <del> "F": "U.S.S." <del> } <del> ], <del> "Univ.": [ <del> { <del> "F": "Univ." <del> } <del> ], <del> "V_V": [ <del> { <del> "F": "V_V" <del> } <del> ], <del> "Vol.": [ <del> { <del> "F": "Vol." <del> } <del> ], <del> "\\\")": [ <del> { <del> "F": "\\\")" <del> } <del> ], <del> "\\n": [ <del> { <del> "F": "\\n", <del> "L": "<nl>", <del> "pos": "SP" <del> } <del> ], <del> "\\t": [ <del> { <del> "F": "\\t", <del> "L": "<tab>", <del> "pos": "SP" <del> } <del> ], <del> "^_^": [ <del> { <del> "F": "^_^" <del> } <del> ], <del> "a.": [ <del> { <del> "F": "a." <del> } <del> ], <del> "a.D.": [ <del> { <del> "F": "a.D." <del> } <del> ], <del> "a.M.": [ <del> { <del> "F": "a.M." <del> } <del> ], <del> "a.Z.": [ <del> { <del> "F": "a.Z." <del> } <del> ], <del> "abzgl.": [ <del> { <del> "F": "abzgl." <del> } <del> ], <del> "adv.": [ <del> { <del> "F": "adv." <del> } <del> ], <del> "al.": [ <del> { <del> "F": "al." <del> } <del> ], <del> "allg.": [ <del> { <del> "F": "allg." <del> } <del> ], <del> "auf'm": [ <del> { <del> "F": "auf", <del> "L": "auf" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "b.": [ <del> { <del> "F": "b." <del> } <del> ], <del> "betr.": [ <del> { <del> "F": "betr." <del> } <del> ], <del> "biol.": [ <del> { <del> "F": "biol." <del> } <del> ], <del> "bspw.": [ <del> { <del> "F": "bspw." <del> } <del> ], <del> "bzgl.": [ <del> { <del> "F": "bzgl." <del> } <del> ], <del> "bzw.": [ <del> { <del> "F": "bzw." <del> } <del> ], <del> "c.": [ <del> { <del> "F": "c." <del> } <del> ], <del> "ca.": [ <del> { <del> "F": "ca." <del> } <del> ], <del> "co.": [ <del> { <del> "F": "co." <del> } <del> ], <del> "d.": [ <del> { <del> "F": "d." <del> } <del> ], <del> "d.h.": [ <del> { <del> "F": "d.h." <del> } <del> ], <del> "dgl.": [ <del> { <del> "F": "dgl." <del> } <del> ], <del> "du's": [ <del> { <del> "F": "du", <del> "L": "du" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "e.": [ <del> { <del> "F": "e." <del> } <del> ], <del> "e.V.": [ <del> { <del> "F": "e.V." <del> } <del> ], <del> "e.g.": [ <del> { <del> "F": "e.g." <del> } <del> ], <del> "ebd.": [ <del> { <del> "F": "ebd." <del> } <del> ], <del> "ehem.": [ <del> { <del> "F": "ehem." <del> } <del> ], <del> "eigtl.": [ <del> { <del> "F": "eigtl." <del> } <del> ], <del> "engl.": [ <del> { <del> "F": "engl." <del> } <del> ], <del> "entspr.": [ <del> { <del> "F": "entspr." <del> } <del> ], <del> "er's": [ <del> { <del> "F": "er", <del> "L": "er" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "erm.": [ <del> { <del> "F": "erm." <del> } <del> ], <del> "etc.": [ <del> { <del> "F": "etc." <del> } <del> ], <del> "ev.": [ <del> { <del> "F": "ev." <del> } <del> ], <del> "evtl.": [ <del> { <del> "F": "evtl." <del> } <del> ], <del> "f.": [ <del> { <del> "F": "f." <del> } <del> ], <del> "frz.": [ <del> { <del> "F": "frz." <del> } <del> ], <del> "g.": [ <del> { <del> "F": "g." <del> } <del> ], <del> "geb.": [ <del> { <del> "F": "geb." <del> } <del> ], <del> "gegr.": [ <del> { <del> "F": "gegr." <del> } <del> ], <del> "gem.": [ <del> { <del> "F": "gem." <del> } <del> ], <del> "ggf.": [ <del> { <del> "F": "ggf." <del> } <del> ], <del> "ggfs.": [ <del> { <del> "F": "ggfs." <del> } <del> ], <del> "gg\u00fc.": [ <del> { <del> "F": "gg\u00fc." <del> } <del> ], <del> "h.": [ <del> { <del> "F": "h." <del> } <del> ], <del> "h.c.": [ <del> { <del> "F": "h.c." <del> } <del> ], <del> "hinter'm": [ <del> { <del> "F": "hinter", <del> "L": "hinter" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "hrsg.": [ <del> { <del> "F": "hrsg." <del> } <del> ], <del> "i.": [ <del> { <del> "F": "i." <del> } <del> ], <del> "i.A.": [ <del> { <del> "F": "i.A." <del> } <del> ], <del> "i.G.": [ <del> { <del> "F": "i.G." <del> } <del> ], <del> "i.O.": [ <del> { <del> "F": "i.O." <del> } <del> ], <del> "i.Tr.": [ <del> { <del> "F": "i.Tr." <del> } <del> ], <del> "i.V.": [ <del> { <del> "F": "i.V." <del> } <del> ], <del> "i.d.R.": [ <del> { <del> "F": "i.d.R." <del> } <del> ], <del> "i.e.": [ <del> { <del> "F": "i.e." <del> } <del> ], <del> "ich's": [ <del> { <del> "F": "ich", <del> "L": "ich" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "ihr's": [ <del> { <del> "F": "ihr", <del> "L": "ihr" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "incl.": [ <del> { <del> "F": "incl." <del> } <del> ], <del> "inkl.": [ <del> { <del> "F": "inkl." <del> } <del> ], <del> "insb.": [ <del> { <del> "F": "insb." <del> } <del> ], <del> "j.": [ <del> { <del> "F": "j." <del> } <del> ], <del> "jr.": [ <del> { <del> "F": "jr." <del> } <del> ], <del> "jun.": [ <del> { <del> "F": "jun." <del> } <del> ], <del> "jur.": [ <del> { <del> "F": "jur." <del> } <del> ], <del> "k.": [ <del> { <del> "F": "k." <del> } <del> ], <del> "kath.": [ <del> { <del> "F": "kath." <del> } <del> ], <del> "l.": [ <del> { <del> "F": "l." <del> } <del> ], <del> "lat.": [ <del> { <del> "F": "lat." <del> } <del> ], <del> "lt.": [ <del> { <del> "F": "lt." <del> } <del> ], <del> "m.": [ <del> { <del> "F": "m." <del> } <del> ], <del> "m.E.": [ <del> { <del> "F": "m.E." <del> } <del> ], <del> "m.M.": [ <del> { <del> "F": "m.M." <del> } <del> ], <del> "max.": [ <del> { <del> "F": "max." <del> } <del> ], <del> "min.": [ <del> { <del> "F": "min." <del> } <del> ], <del> "mind.": [ <del> { <del> "F": "mind." <del> } <del> ], <del> "mtl.": [ <del> { <del> "F": "mtl." <del> } <del> ], <del> "n.": [ <del> { <del> "F": "n." <del> } <del> ], <del> "n.Chr.": [ <del> { <del> "F": "n.Chr." <del> } <del> ], <del> "nat.": [ <del> { <del> "F": "nat." <del> } <del> ], <del> "o.": [ <del> { <del> "F": "o." <del> } <del> ], <del> "o.O": [ <del> { <del> "F": "o.O" <del> } <del> ], <del> "o.a.": [ <del> { <del> "F": "o.a." <del> } <del> ], <del> "o.g.": [ <del> { <del> "F": "o.g." <del> } <del> ], <del> "o.k.": [ <del> { <del> "F": "o.k." <del> } <del> ], <del> "o.\u00c4.": [ <del> { <del> "F": "o.\u00c4." <del> } <del> ], <del> "o.\u00e4.": [ <del> { <del> "F": "o.\u00e4." <del> } <del> ], <del> "o_O": [ <del> { <del> "F": "o_O" <del> } <del> ], <del> "o_o": [ <del> { <del> "F": "o_o" <del> } <del> ], <del> "orig.": [ <del> { <del> "F": "orig." <del> } <del> ], <del> "p.": [ <del> { <del> "F": "p." <del> } <del> ], <del> "p.a.": [ <del> { <del> "F": "p.a." <del> } <del> ], <del> "p.s.": [ <del> { <del> "F": "p.s." <del> } <del> ], <del> "pers.": [ <del> { <del> "F": "pers." <del> } <del> ], <del> "phil.": [ <del> { <del> "F": "phil." <del> } <del> ], <del> "q.": [ <del> { <del> "F": "q." <del> } <del> ], <del> "q.e.d.": [ <del> { <del> "F": "q.e.d." <del> } <del> ], <del> "r.": [ <del> { <del> "F": "r." <del> } <del> ], <del> "rer.": [ <del> { <del> "F": "rer." <del> } <del> ], <del> "r\u00f6m.": [ <del> { <del> "F": "r\u00f6m." <del> } <del> ], <del> "s'": [ <del> { <del> "F": "s'", <del> "L": "sie" <del> } <del> ], <del> "s.": [ <del> { <del> "F": "s." <del> } <del> ], <del> "s.o.": [ <del> { <del> "F": "s.o." <del> } <del> ], <del> "sen.": [ <del> { <del> "F": "sen." <del> } <del> ], <del> "sie's": [ <del> { <del> "F": "sie", <del> "L": "sie" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "sog.": [ <del> { <del> "F": "sog." <del> } <del> ], <del> "std.": [ <del> { <del> "F": "std." <del> } <del> ], <del> "stellv.": [ <del> { <del> "F": "stellv." <del> } <del> ], <del> "t.": [ <del> { <del> "F": "t." <del> } <del> ], <del> "t\u00e4gl.": [ <del> { <del> "F": "t\u00e4gl." <del> } <del> ], <del> "u.": [ <del> { <del> "F": "u." <del> } <del> ], <del> "u.U.": [ <del> { <del> "F": "u.U." <del> } <del> ], <del> "u.a.": [ <del> { <del> "F": "u.a." <del> } <del> ], <del> "u.s.w.": [ <del> { <del> "F": "u.s.w." <del> } <del> ], <del> "u.v.m.": [ <del> { <del> "F": "u.v.m." <del> } <del> ], <del> "unter'm": [ <del> { <del> "F": "unter", <del> "L": "unter" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "usf.": [ <del> { <del> "F": "usf." <del> } <del> ], <del> "usw.": [ <del> { <del> "F": "usw." <del> } <del> ], <del> "uvm.": [ <del> { <del> "F": "uvm." <del> } <del> ], <del> "v.": [ <del> { <del> "F": "v." <del> } <del> ], <del> "v.Chr.": [ <del> { <del> "F": "v.Chr." <del> } <del> ], <del> "v.a.": [ <del> { <del> "F": "v.a." <del> } <del> ], <del> "v.l.n.r.": [ <del> { <del> "F": "v.l.n.r." <del> } <del> ], <del> "vgl.": [ <del> { <del> "F": "vgl." <del> } <del> ], <del> "vllt.": [ <del> { <del> "F": "vllt." <del> } <del> ], <del> "vlt.": [ <del> { <del> "F": "vlt." <del> } <del> ], <del> "vor'm": [ <del> { <del> "F": "vor", <del> "L": "vor" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ], <del> "vs.": [ <del> { <del> "F": "vs." <del> } <del> ], <del> "w.": [ <del> { <del> "F": "w." <del> } <del> ], <del> "wir's": [ <del> { <del> "F": "wir", <del> "L": "wir" <del> }, <del> { <del> "F": "'s", <del> "L": "es" <del> } <del> ], <del> "wiss.": [ <del> { <del> "F": "wiss." <del> } <del> ], <del> "x.": [ <del> { <del> "F": "x." <del> } <del> ], <del> "xD": [ <del> { <del> "F": "xD" <del> } <del> ], <del> "xDD": [ <del> { <del> "F": "xDD" <del> } <del> ], <del> "y.": [ <del> { <del> "F": "y." <del> } <del> ], <del> "z.": [ <del> { <del> "F": "z." <del> } <del> ], <del> "z.B.": [ <del> { <del> "F": "z.B." <del> } <del> ], <del> "z.Bsp.": [ <del> { <del> "F": "z.Bsp." <del> } <del> ], <del> "z.T.": [ <del> { <del> "F": "z.T." <del> } <del> ], <del> "z.Z.": [ <del> { <del> "F": "z.Z." <del> } <del> ], <del> "z.Zt.": [ <del> { <del> "F": "z.Zt." <del> } <del> ], <del> "z.b.": [ <del> { <del> "F": "z.b." <del> } <del> ], <del> "zzgl.": [ <del> { <del> "F": "zzgl." <del> } <del> ], <del> "\u00e4.": [ <del> { <del> "F": "\u00e4." <del> } <del> ], <del> "\u00f6.": [ <del> { <del> "F": "\u00f6." <del> } <del> ], <del> "\u00f6sterr.": [ <del> { <del> "F": "\u00f6sterr." <del> } <del> ], <del> "\u00fc.": [ <del> { <del> "F": "\u00fc." <del> } <del> ], <del> "\u00fcber'm": [ <del> { <del> "F": "\u00fcber", <del> "L": "\u00fcber" <del> }, <del> { <del> "F": "'m", <del> "L": "dem" <del> } <del> ] <del>} <add>TOKENIZER_EXCEPTIONS = {} <ide> <ide> #TODO insert TAG_MAP for Dutch <ide> TAG_MAP = { <del>"$(": {"pos": "PUNCT", "PunctType": "Brck"}, <del>"$,": {"pos": "PUNCT", "PunctType": "Comm"}, <del>"$.": {"pos": "PUNCT", "PunctType": "Peri"}, <del>"ADJA": {"pos": "ADJ"}, <del>"ADJD": {"pos": "ADJ", "Variant": "Short"}, <del>"ADV": {"pos": "ADV"}, <del>"APPO": {"pos": "ADP", "AdpType": "Post"}, <del>"APPR": {"pos": "ADP", "AdpType": "Prep"}, <del>"APPRART": {"pos": "ADP", "AdpType": "Prep", "PronType": "Art"}, <del>"APZR": {"pos": "ADP", "AdpType": "Circ"}, <del>"ART": {"pos": "DET", "PronType": "Art"}, <del>"CARD": {"pos": "NUM", "NumType": "Card"}, <del>"FM": {"pos": "X", "Foreign": "Yes"}, <del>"ITJ": {"pos": "INTJ"}, <del>"KOKOM": {"pos": "CONJ", "ConjType": "Comp"}, <del>"KON": {"pos": "CONJ"}, <del>"KOUI": {"pos": "SCONJ"}, <del>"KOUS": {"pos": "SCONJ"}, <del>"NE": {"pos": "PROPN"}, <del>"NNE": {"pos": "PROPN"}, <del>"NN": {"pos": "NOUN"}, <del>"PAV": {"pos": "ADV", "PronType": "Dem"}, <del>"PROAV": {"pos": "ADV", "PronType": "Dem"}, <del>"PDAT": {"pos": "DET", "PronType": "Dem"}, <del>"PDS": {"pos": "PRON", "PronType": "Dem"}, <del>"PIAT": {"pos": "DET", "PronType": "Ind,Neg,Tot"}, <del>"PIDAT": {"pos": "DET", "AdjType": "Pdt", "PronType": "Ind,Neg,Tot"}, <del>"PIS": {"pos": "PRON", "PronType": "Ind,Neg,Tot"}, <del>"PPER": {"pos": "PRON", "PronType": "Prs"}, <del>"PPOSAT": {"pos": "DET", "Poss": "Yes", "PronType": "Prs"}, <del>"PPOSS": {"pos": "PRON", "Poss": "Yes", "PronType": "Prs"}, <del>"PRELAT": {"pos": "DET", "PronType": "Rel"}, <del>"PRELS": {"pos": "PRON", "PronType": "Rel"}, <del>"PRF": {"pos": "PRON", "PronType": "Prs", "Reflex": "Yes"}, <del>"PTKA": {"pos": "PART"}, <del>"PTKANT": {"pos": "PART", "PartType": "Res"}, <del>"PTKNEG": {"pos": "PART", "Negative": "Neg"}, <del>"PTKVZ": {"pos": "PART", "PartType": "Vbp"}, <del>"PTKZU": {"pos": "PART", "PartType": "Inf"}, <del>"PWAT": {"pos": "DET", "PronType": "Int"}, <del>"PWAV": {"pos": "ADV", "PronType": "Int"}, <del>"PWS": {"pos": "PRON", "PronType": "Int"}, <del>"TRUNC": {"pos": "X", "Hyph": "Yes"}, <del>"VAFIN": {"pos": "AUX", "Mood": "Ind", "VerbForm": "Fin"}, <del>"VAIMP": {"pos": "AUX", "Mood": "Imp", "VerbForm": "Fin"}, <del>"VAINF": {"pos": "AUX", "VerbForm": "Inf"}, <del>"VAPP": {"pos": "AUX", "Aspect": "Perf", "VerbForm": "Part"}, <del>"VMFIN": {"pos": "VERB", "Mood": "Ind", "VerbForm": "Fin", "VerbType": "Mod"}, <del>"VMINF": {"pos": "VERB", "VerbForm": "Inf", "VerbType": "Mod"}, <del>"VMPP": {"pos": "VERB", "Aspect": "Perf", "VerbForm": "Part", "VerbType": "Mod"}, <del>"VVFIN": {"pos": "VERB", "Mood": "Ind", "VerbForm": "Fin"}, <del>"VVIMP": {"pos": "VERB", "Mood": "Imp", "VerbForm": "Fin"}, <del>"VVINF": {"pos": "VERB", "VerbForm": "Inf"}, <del>"VVIZU": {"pos": "VERB", "VerbForm": "Inf"}, <del>"VVPP": {"pos": "VERB", "Aspect": "Perf", "VerbForm": "Part"}, <del>"XY": {"pos": "X"}, <del>"SP": {"pos": "SPACE"} <add> "VNW(pers,pron,nomin,red,3p,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,obl,vol,3,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "N(soort,ev,basis,gen)": { <add> "pos": "NOUN" <add> }, <add> "WW(pv,tgw,mv)": { <add> "pos": "VERB" <add> }, <add> "VNW(pers,pron,obl,vol,2v,ev)": { <add> "pos": "PRON" <add> }, <add> "LID(onbep,stan,agr)": { <add> "pos": "DET" <add> }, <add> "VNW(pers,pron,stan,nadr,2v,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,pron,stan,vol,3o,ev)": { <add> "pos": "PRON" <add> }, <add> "LID(bep,dial)": { <add> "pos": "DET" <add> }, <add> "VNW(pers,pron,nomin,red,1,ev)": { <add> "pos": "PRON" <add> }, <add> "WW(inf,nom,zonder,zonder-n)": { <add> "pos": "VERB" <add> }, <add> "VNW(pr,pron,obl,vol,1,ev)": { <add> "pos": "PRON" <add> }, <add> "SPEC(enof)": { <add> "pos": "X" <add> }, <add> "VNW(onbep,det,stan,nom,met-e,mv-n)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,stan,nom,met-e,zonder-n)": { <add> "pos": "PRON" <add> }, <add> "VNW(vb,det,stan,prenom,zonder,evon)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,vol,1,mv,prenom,zonder,evon)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,nom,met-e,zonder-n,sup)": { <add> "pos": "PRON" <add> }, <add> "TW(hoofd,nom,mv-n,basis)": { <add> "pos": "NUM" <add> }, <add> "VNW(onbep,pron,dial)": { <add> "pos": "PRON" <add> }, <add> "VNW(aanw,det,stan,nom,met-e,mv-n)": { <add> "pos": "PRON" <add> }, <add> "N(soort,ev,dim,onz,stan)": { <add> "pos": "NOUN" <add> }, <add> "VNW(aanw,pron,gen,vol,3o,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,vol,3,mv,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,vrij,zonder,basis)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,vol,1,ev,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "WW(pv,tgw,ev)": { <add> "pos": "VERB" <add> }, <add> "ADJ(vrij,comp,zonder)": { <add> "pos": "ADJ" <add> }, <add> "VZ(fin)": { <add> "pos": "ADP" <add> }, <add> "VNW(onbep,grad,stan,prenom,met-e,agr,sup)": { <add> "pos": "PRON" <add> }, <add> "WW(inf,vrij,zonder)": { <add> "pos": "VERB" <add> }, <add> "ADJ(nom,basis,zonder,zonder-n)": { <add> "pos": "ADJ" <add> }, <add> "VNW(pers,pron,obl,vol,3,getal,fem)": { <add> "pos": "PRON" <add> }, <add> "VNW(refl,pron,obl,red,3,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,prenom,zonder,agr,comp)": { <add> "pos": "PRON" <add> }, <add> "VNW(recip,pron,gen,vol,persoon,mv)": { <add> "pos": "PRON" <add> }, <add> "ADJ(prenom,basis,met-e,bijz)": { <add> "pos": "ADJ" <add> }, <add> "N(soort,ev,basis,onz,stan)": { <add> "pos": "NOUN" <add> }, <add> "VNW(bez,det,stan,vol,3,ev,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "WW(pv,verl,ev)": { <add> "pos": "VERB" <add> }, <add> "TW(rang,prenom,stan)": { <add> "pos": "ADJ" <add> }, <add> "VNW(pr,pron,obl,vol,1,mv)": { <add> "pos": "PRON" <add> }, <add> "ADJ(nom,sup,zonder,zonder-n)": { <add> "pos": "ADJ" <add> }, <add> "VNW(pr,pron,obl,red,1,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(aanw,det,dat,nom,met-e,zonder-n)": { <add> "pos": "PRON" <add> }, <add> "WW(pv,conj,ev)": { <add> "pos": "VERB" <add> }, <add> "SPEC(afk)": { <add> "pos": "X" <add> }, <add> "TW(rang,nom,zonder-n)": { <add> "pos": "ADJ" <add> }, <add> "VNW(onbep,det,gen,prenom,met-e,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(vb,pron,gen,vol,3p,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(betr,pron,stan,vol,3,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,red,1,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(vb,pron,stan,vol,3o,ev)": { <add> "pos": "PRON" <add> }, <add> "WW(pv,verl,mv)": { <add> "pos": "VERB" <add> }, <add> "TW(hoofd,prenom,stan)": { <add> "pos": "NUM" <add> }, <add> "VNW(aanw,det,stan,prenom,met-e,rest)": { <add> "pos": "PRON" <add> }, <add> "VNW(vb,det,stan,prenom,met-e,rest)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,vol,3p,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(pr,pron,obl,vol,2,getal)": { <add> "pos": "PRON" <add> }, <add> "ADJ(prenom,basis,zonder)": { <add> "pos": "ADJ" <add> }, <add> "TSW()": { <add> "pos": "INTJ" <add> }, <add> "VNW(betr,det,stan,nom,zonder,zonder-n)": { <add> "pos": "PRON" <add> }, <add> "VZ(init)": { <add> "pos": "ADP" <add> }, <add> "VNW(pers,pron,nomin,nadr,3v,ev,fem)": { <add> "pos": "PRON" <add> }, <add> "ADJ(vrij,dim,zonder)": { <add> "pos": "ADJ" <add> }, <add> "TW(hoofd,dial)": { <add> "pos": "NUM" <add> }, <add> "VNW(onbep,grad,stan,prenom,met-e,agr,basis)": { <add> "pos": "PRON" <add> }, <add> "TW(hoofd,nom,zonder-n,dim)": { <add> "pos": "NUM" <add> }, <add> "ADJ(prenom,comp,zonder)": { <add> "pos": "ADJ" <add> }, <add> "WW(od,prenom,met-e)": { <add> "pos": "VERB" <add> }, <add> "VNW(bez,det,dial)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,red,3,ev,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "VNW(aanw,det,stan,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "N(soort,mv,basis)": { <add> "pos": "NOUN" <add> }, <add> "VNW(onbep,pron,gen,vol,3p,ev)": { <add> "pos": "PRON" <add> }, <add> "LID(onbep,dial)": { <add> "pos": "DET" <add> }, <add> "VNW(bez,det,stan,vol,2v,ev,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "N(soort,ev,basis,genus,stan)": { <add> "pos": "NOUN" <add> }, <add> "VNW(aanw,det,dial)": { <add> "pos": "PRON" <add> }, <add> "N(soort,ev,basis,dat)": { <add> "pos": "NOUN" <add> }, <add> "VNW(onbep,det,stan,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "LID(bep,gen,rest3)": { <add> "pos": "DET" <add> }, <add> "TSW(dial)": { <add> "pos": "INTJ" <add> }, <add> "ADJ(nom,basis,met-e,mv-n)": { <add> "pos": "ADJ" <add> }, <add> "VNW(onbep,grad,stan,prenom,met-e,mv,basis)": { <add> "pos": "PRON" <add> }, <add> "BW(dial)": { <add> "pos": "ADV" <add> }, <add> "ADJ(nom,comp,met-e,mv-n)": { <add> "pos": "ADJ" <add> }, <add> "LID(bep,stan,evon)": { <add> "pos": "DET" <add> }, <add> "WW(vd,nom,met-e,mv-n)": { <add> "pos": "VERB" <add> }, <add> "VNW(onbep,grad,stan,nom,zonder,zonder-n,sup)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,obl,nadr,3p,mv)": { <add> "pos": "PRON" <add> }, <add> "WW(vd,prenom,met-e)": { <add> "pos": "VERB" <add> }, <add> "VNW(bez,det,stan,vol,3m,ev,prenom,met-e,rest)": { <add> "pos": "PRON" <add> }, <add> "VG(neven)": { <add> "pos": "CONJ" <add> }, <add> "VNW(pers,pron,nomin,vol,2b,getal)": { <add> "pos": "PRON" <add> }, <add> "WW(pv,verl,met-t)": { <add> "pos": "VERB" <add> }, <add> "VNW(recip,pron,obl,vol,persoon,mv)": { <add> "pos": "PRON" <add> }, <add> "ADJ(prenom,comp,met-e,stan)": { <add> "pos": "ADJ" <add> }, <add> "VNW(onbep,grad,stan,prenom,met-e,agr,comp)": { <add> "pos": "PRON" <add> }, <add> "ADJ(nom,comp,met-e,zonder-n,stan)": { <add> "pos": "ADJ" <add> }, <add> "SPEC(deeleigen)": { <add> "pos": "X" <add> }, <add> "VNW(vb,pron,stan,vol,3p,getal)": { <add> "pos": "PRON" <add> }, <add> "ADJ(postnom,basis,zonder)": { <add> "pos": "ADJ" <add> }, <add> "WW(od,nom,met-e,zonder-n)": { <add> "pos": "VERB" <add> }, <add> "VNW(vrag,pron,dial)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,nom,met-e,zonder-n,basis)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,vol,2,getal,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,dial)": { <add> "pos": "PRON" <add> }, <add> "TW(rang,dial)": { <add> "pos": "ADJ" <add> }, <add> "VNW(onbep,det,stan,prenom,zonder,evon)": { <add> "pos": "PRON" <add> }, <add> "N(soort,dial)": { <add> "pos": "NOUN" <add> }, <add> "VNW(excl,pron,stan,vol,3,getal)": { <add> "pos": "PRON" <add> }, <add> "WW(vd,vrij,zonder)": { <add> "pos": "VERB" <add> }, <add> "SPEC(vreemd)": { <add> "pos": "X" <add> }, <add> "VNW(aanw,adv-pron,stan,red,3,getal)": { <add> "pos": "PRON" <add> }, <add> "WW(vd,nom,met-e,zonder-n)": { <add> "pos": "VERB" <add> }, <add> "VNW(aanw,adv-pron,obl,vol,3o,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(aanw,det,stan,nom,met-e,zonder-n)": { <add> "pos": "PRON" <add> }, <add> "ADJ(dial)": { <add> "pos": "ADJ" <add> }, <add> "ADJ(vrij,sup,zonder)": { <add> "pos": "ADJ" <add> }, <add> "ADJ(nom,sup,met-e,mv-n)": { <add> "pos": "ADJ" <add> }, <add> "LID(bep,gen,evmo)": { <add> "pos": "DET" <add> }, <add> "VNW(onbep,grad,stan,nom,met-e,mv-n,basis)": { <add> "pos": "PRON" <add> }, <add> "VG(onder,dial)": { <add> "pos": "SCONJ" <add> }, <add> "ADJ(vrij,basis,zonder)": { <add> "pos": "ADJ" <add> }, <add> "ADJ(postnom,basis,met-s)": { <add> "pos": "ADJ" <add> }, <add> "VNW(aanw,pron,stan,vol,3,getal)": { <add> "pos": "PRON" <add> }, <add> "VG(onder)": { <add> "pos": "SCONJ" <add> }, <add> "WW(od,prenom,zonder)": { <add> "pos": "VERB" <add> }, <add> "VNW(pers,pron,nomin,red,3,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,vrij,zonder,comp)": { <add> "pos": "PRON" <add> }, <add> "VNW(betr,pron,gen,vol,3o,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(aanw,det,stan,vrij,zonder)": { <add> "pos": "PRON" <add> }, <add> "LET()": { <add> "pos": "PUNCT" <add> }, <add> "VNW(pers,pron,nomin,vol,1,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(refl,pron,obl,nadr,3,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,red,2,getal)": { <add> "pos": "PRON" <add> }, <add> "N(soort,mv,dim)": { <add> "pos": "NOUN" <add> }, <add> "VNW(pers,pron,stan,red,3,ev,fem)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,obl,nadr,3m,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,adv-pron,obl,vol,3o,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,vol,2v,ev)": { <add> "pos": "PRON" <add> }, <add> "ADJ(nom,basis,met-e,zonder-n,stan)": { <add> "pos": "ADJ" <add> }, <add> "SPEC(symb)": { <add> "pos": "X" <add> }, <add> "VNW(aanw,pron,gen,vol,3m,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(refl,pron,dial)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,stan,prenom,met-e,evz)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,obl,red,3,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,stan,nom,zonder,zonder-n)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,stan,prenom,met-e,rest)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,stan,prenom,met-e,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,red,2v,ev)": { <add> "pos": "PRON" <add> }, <add> "ADJ(prenom,basis,met-e,stan)": { <add> "pos": "ADJ" <add> }, <add> "VNW(bez,det,stan,red,1,ev,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "SPEC(afgebr)": { <add> "pos": "X" <add> }, <add> "VNW(onbep,pron,stan,vol,3p,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,nom,met-e,mv-n,sup)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,det,stan,prenom,met-e,agr)": { <add> "pos": "PRON" <add> }, <add> "WW(pv,tgw,met-t)": { <add> "pos": "VERB" <add> }, <add> "VNW(aanw,det,stan,prenom,zonder,rest)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,stan,red,3,ev,onz)": { <add> "pos": "PRON" <add> }, <add> "WW(vd,prenom,zonder)": { <add> "pos": "VERB" <add> }, <add> "VNW(pers,pron,nomin,vol,1,mv)": { <add> "pos": "PRON" <add> }, <add> "WW(od,nom,met-e,mv-n)": { <add> "pos": "VERB" <add> }, <add> "VNW(aanw,pron,stan,vol,3o,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,dial)": { <add> "pos": "PRON" <add> }, <add> "VNW(pr,pron,obl,red,2v,getal)": { <add> "pos": "PRON" <add> }, <add> "ADJ(nom,basis,zonder,mv-n)": { <add> "pos": "ADJ" <add> }, <add> "VNW(onbep,det,stan,vrij,zonder)": { <add> "pos": "PRON" <add> }, <add> "LID(bep,stan,rest)": { <add> "pos": "DET" <add> }, <add> "VNW(pers,pron,nomin,vol,3v,ev,fem)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,vol,3,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,stan,red,3,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,nadr,2v,mv,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "ADJ(nom,sup,met-e,zonder-n,stan)": { <add> "pos": "ADJ" <add> }, <add> "VNW(pers,pron,obl,vol,3p,mv)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,vol,1,mv,prenom,met-e,rest)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,grad,stan,vrij,zonder,sup)": { <add> "pos": "PRON" <add> }, <add> "VNW(bez,det,stan,red,2v,ev,prenom,zonder,agr)": { <add> "pos": "PRON" <add> }, <add> "TW(hoofd,vrij)": { <add> "pos": "NUM" <add> }, <add> "VNW(onbep,grad,stan,prenom,zonder,agr,basis)": { <add> "pos": "PRON" <add> }, <add> "VNW(aanw,det,stan,prenom,zonder,evon)": { <add> "pos": "PRON" <add> }, <add> "VNW(onbep,adv-pron,gen,red,3,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(pers,pron,nomin,vol,2,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(pr,pron,obl,nadr,1,ev)": { <add> "pos": "PRON" <add> }, <add> "VNW(pr,pron,obl,nadr,2v,getal)": { <add> "pos": "PRON" <add> }, <add> "VNW(vb,det,stan,nom,met-e,zonder-n)": { <add> "pos": "PRON" <add> }, <add> "VNW(betr,pron,stan,vol,persoon,getal)": { <add> "pos": "PRON" <add> }, <add> "TW(hoofd,nom,zonder-n,basis)": { <add> "pos": "NUM" <add> }, <add> "VNW(vb,pron,gen,vol,3m,ev)": { <add> "pos": "PRON" <add> }, <add> "WW(inf,prenom,zonder)": { <add> "pos": "VERB" <add> }, <add> "TW(rang,nom,mv-n)": { <add> "pos": "ADJ" <add> }, <add> "SPEC(meta)": { <add> "pos": "X" <add> }, <add> "LID(bep,dat,evmo)": { <add> "pos": "DET" <add> }, <add> "N(soort,ev,basis,zijd,stan)": { <add> "pos": "NOUN" <add> }, <add> "VNW(pers,pron,nomin,nadr,3m,ev,masc)": { <add> "pos": "PRON" <add> }, <add> "WW(od,vrij,zonder)": { <add> "pos": "VERB" <add> }, <add> "VNW(vb,adv-pron,obl,vol,3o,getal)": { <add> "pos": "PRON" <add> }, <add> "ADJ(prenom,sup,zonder)": { <add> "pos": "ADJ" <add> }, <add> "BW()": { <add> "pos": "ADV" <add> }, <add> "VZ(versm)": { <add> "pos": "ADP" <add> }, <add> "ADJ(prenom,sup,met-e,stan)": { <add> "pos": "ADJ" <add> } <ide> }
1
Ruby
Ruby
add cvsrequirement and subversionrequirement
baa3d187d63d5a9bb17fd4dbc052a899b597c2b8
<ide><path>Library/Homebrew/dependency_collector.rb <ide> def resource_dep(spec, tags) <ide> elsif strategy <= BazaarDownloadStrategy <ide> Dependency.new("bazaar", tags) <ide> elsif strategy <= CVSDownloadStrategy <del> Dependency.new("cvs", tags) if MacOS.version >= :mavericks || !MacOS::Xcode.provides_cvs? <add> CVSRequirement.new(tags) <add> elsif strategy <= SubversionDownloadStrategy <add> SubversionRequirement.new(tags) <ide> elsif strategy < AbstractDownloadStrategy <ide> # allow unknown strategies to pass through <ide> else <ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def provides_gcc? <ide> version < "4.3" <ide> end <ide> <del> def provides_cvs? <del> version < "5.0" <del> end <del> <ide> def default_prefix? <ide> if version < "4.3" <ide> prefix.to_s.start_with? "/Developer" <ide><path>Library/Homebrew/requirements.rb <ide> def message <ide> end <ide> end <ide> <add>class CVSRequirement < Requirement <add> fatal true <add> default_formula "cvs" <add> satisfy { which "cvs" } <add>end <add> <ide> class MercurialRequirement < Requirement <ide> fatal true <ide> default_formula "mercurial" <del> <ide> satisfy { which("hg") } <ide> end <ide> <ide> class GitRequirement < Requirement <ide> default_formula "git" <ide> satisfy { Utils.git_available? } <ide> end <add> <add>class SubversionRequirement < Requirement <add> fatal true <add> default_formula "subversion" <add> satisfy { Utils.svn_available? } <add>end <ide><path>Library/Homebrew/test/dependency_collector_spec.rb <ide> def find_requirement(klass) <ide> expect(subject.add(resource)).to be_an_instance_of(GitRequirement) <ide> end <ide> <add> it "creates a resource dependency from a CVS URL" do <add> resource = Resource.new <add> resource.url(":pserver:anonymous:@example.com:/cvsroot/foo/bar", using: :cvs) <add> expect(subject.add(resource)).to be_an_instance_of(CVSRequirement) <add> end <add> <add> it "creates a resource dependency from a Subversion URL" do <add> resource = Resource.new <add> resource.url("svn://example.com/foo/bar") <add> expect(subject.add(resource)).to be_an_instance_of(SubversionRequirement) <add> end <add> <ide> it "creates a resource dependency from a '.7z' URL" do <ide> resource = Resource.new <ide> resource.url("http://example.com/foo.7z")
4
Ruby
Ruby
ignore validation errors
1fecd418e4e93a0bb7c92496746ba75f1d80acd8
<ide><path>Library/Homebrew/cmd/versions.rb <ide> def text_from_sha sha <ide> end <ide> <ide> IGNORED_EXCEPTIONS = [SyntaxError, TypeError, NameError, <del> ArgumentError, FormulaSpecificationError] <add> ArgumentError, FormulaSpecificationError, <add> FormulaValidationError,] <ide> <ide> def version_for_sha sha <ide> formula_for_sha(sha) {|f| f.version }
1
Go
Go
remove deprecated pkg/mount
97a235196ef097d7ac53a7c7bb342b1409383779
<ide><path>pkg/mount/deprecated.go <del>package mount // import "github.com/docker/docker/pkg/mount" <del> <del>// Deprecated: this package is not maintained and will be removed. <del>// Use github.com/moby/sys/mount and github.com/moby/sys/mountinfo instead. <del> <del>import ( <del> "github.com/moby/sys/mountinfo" <del>) <del> <del>//nolint:golint <del>type ( <del> // FilterFunc is a type. <del> // Deprecated: use github.com/moby/sys/mountinfo instead. <del> FilterFunc = func(*Info) (skip, stop bool) <del> <del> // Info is a type <del> // Deprecated: use github.com/moby/sys/mountinfo instead. <del> Info struct { <del> ID, Parent, Major, Minor int <del> Root, Mountpoint, Opts, Optional, Fstype, Source, VfsOpts string <del> } <del>) <del> <del>// Deprecated: use github.com/moby/sys/mountinfo instead. <del>//nolint:golint <del>var ( <del> Mounted = mountinfo.Mounted <del> PrefixFilter = mountinfo.PrefixFilter <del> SingleEntryFilter = mountinfo.SingleEntryFilter <del> ParentsFilter = mountinfo.ParentsFilter <del> FstypeFilter = mountinfo.FSTypeFilter <del>) <del> <del>// GetMounts is a function. <del>// <del>// Deprecated: use github.com/moby/sys/mountinfo.GetMounts() instead. <del>//nolint:golint <del>func GetMounts(f FilterFunc) ([]*Info, error) { <del> fi := func(i *mountinfo.Info) (skip, stop bool) { <del> return f(toLegacyInfo(i)) <del> } <del> <del> mounts, err := mountinfo.GetMounts(fi) <del> if err != nil { <del> return nil, err <del> } <del> mi := make([]*Info, len(mounts)) <del> for i, m := range mounts { <del> mi[i] = toLegacyInfo(m) <del> } <del> return mi, nil <del>} <del> <del>func toLegacyInfo(m *mountinfo.Info) *Info { <del> return &Info{ <del> ID: m.ID, <del> Parent: m.Parent, <del> Major: m.Major, <del> Minor: m.Minor, <del> Root: m.Root, <del> Mountpoint: m.Mountpoint, <del> Opts: m.Options, <del> Fstype: m.FSType, <del> Source: m.Source, <del> VfsOpts: m.VFSOptions, <del> } <del>} <ide><path>pkg/mount/deprecated_linux.go <del>package mount // import "github.com/docker/docker/pkg/mount" <del> <del>import ( <del> sysmount "github.com/moby/sys/mount" <del>) <del> <del>// Deprecated: use github.com/moby/sys/mount instead. <del>//nolint:golint <del>var ( <del> MakeMount = sysmount.MakeMount <del> MakeShared = sysmount.MakeShared <del> MakeRShared = sysmount.MakeRShared <del> MakePrivate = sysmount.MakePrivate <del> MakeRPrivate = sysmount.MakeRPrivate <del> MakeSlave = sysmount.MakeSlave <del> MakeRSlave = sysmount.MakeRSlave <del> MakeUnbindable = sysmount.MakeUnbindable <del> MakeRUnbindable = sysmount.MakeRUnbindable <del>) <ide><path>pkg/mount/deprecated_unix.go <del>//go:build !darwin && !windows <del>// +build !darwin,!windows <del> <del>package mount // import "github.com/docker/docker/pkg/mount" <del> <del>// Deprecated: this package is not maintained and will be removed. <del>// Use github.com/moby/sys/mount and github.com/moby/sys/mountinfo instead. <del> <del>import ( <del> sysmount "github.com/moby/sys/mount" <del>) <del> <del>// Deprecated: use github.com/moby/sys/mount instead. <del>//nolint:golint <del>var ( <del> Mount = sysmount.Mount <del> ForceMount = sysmount.Mount // a deprecated synonym <del> Unmount = sysmount.Unmount <del> RecursiveUnmount = sysmount.RecursiveUnmount <del>) <del> <del>// Deprecated: use github.com/moby/sys/mount instead. <del>//nolint:golint <del>const ( <del> RDONLY = sysmount.RDONLY <del> NOSUID = sysmount.NOSUID <del> NOEXEC = sysmount.NOEXEC <del> SYNCHRONOUS = sysmount.SYNCHRONOUS <del> NOATIME = sysmount.NOATIME <del> BIND = sysmount.BIND <del> DIRSYNC = sysmount.DIRSYNC <del> MANDLOCK = sysmount.MANDLOCK <del> NODEV = sysmount.NODEV <del> NODIRATIME = sysmount.NODIRATIME <del> UNBINDABLE = sysmount.UNBINDABLE <del> RUNBINDABLE = sysmount.RUNBINDABLE <del> PRIVATE = sysmount.PRIVATE <del> RPRIVATE = sysmount.RPRIVATE <del> SHARED = sysmount.SHARED <del> RSHARED = sysmount.RSHARED <del> SLAVE = sysmount.SLAVE <del> RSLAVE = sysmount.RSLAVE <del> RBIND = sysmount.RBIND <del> RELATIME = sysmount.RELATIME <del> REMOUNT = sysmount.REMOUNT <del> STRICTATIME = sysmount.STRICTATIME <del>) <del> <del>// Deprecated: use github.com/moby/sys/mount instead. <del>//nolint:golint <del>var ( <del> MergeTmpfsOptions = sysmount.MergeTmpfsOptions <del>)
3
Mixed
Ruby
show helpful messages on invalid param. encodings
3f81b3753ffdca8617422e518e1fddd581f5a712
<ide><path>actionpack/CHANGELOG.md <add>* Show helpful message in `BadRequest` exceptions due to invalid path <add> parameter encodings. <add> <add> Fixes #21923. <add> <add> *Agis Anastasopoulos* <add> <ide> * Deprecate `config.static_cache_control` in favor of <ide> `config.public_file_server.headers` <ide> <ide><path>actionpack/lib/action_controller/metal/exceptions.rb <ide> class ActionControllerError < StandardError #:nodoc: <ide> class BadRequest < ActionControllerError #:nodoc: <ide> attr_reader :original_exception <ide> <del> def initialize(type = nil, e = nil) <del> return super() unless type && e <del> <del> super("Invalid #{type} parameters: #{e.message}") <add> def initialize(msg = nil, e = nil) <add> super(msg) <ide> @original_exception = e <del> set_backtrace e.backtrace <add> set_backtrace e.backtrace if e <ide> end <ide> end <ide> <ide><path>actionpack/lib/action_dispatch/http/request.rb <ide> def check_path_parameters! <ide> path_parameters.each do |key, value| <ide> next unless value.respond_to?(:valid_encoding?) <ide> unless value.valid_encoding? <del> raise ActionController::BadRequest, "Invalid parameter: #{key} => #{value}" <add> raise ActionController::BadRequest, "Invalid parameter encoding: #{key} => #{value.inspect}" <ide> end <ide> end <ide> end <ide> def GET <ide> set_header k, Request::Utils.normalize_encode_params(super || {}) <ide> end <ide> rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e <del> raise ActionController::BadRequest.new(:query, e) <add> raise ActionController::BadRequest.new("Invalid query parameters: #{e.message}", e) <ide> end <ide> alias :query_parameters :GET <ide> <ide> def POST <ide> self.request_parameters = Request::Utils.normalize_encode_params(super || {}) <ide> raise <ide> rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e <del> raise ActionController::BadRequest.new(:request, e) <add> raise ActionController::BadRequest.new("Invalid request parameters: #{e.message}", e) <ide> end <ide> alias :request_parameters :POST <ide> <ide><path>actionpack/test/dispatch/request_test.rb <ide> class RequestParameters < BaseRequestTest <ide> end <ide> end <ide> <add> test "path parameters with invalid UTF8 encoding" do <add> request = stub_request( <add> "action_dispatch.request.path_parameters" => { foo: "\xBE" } <add> ) <add> <add> err = assert_raises(ActionController::BadRequest) do <add> request.check_path_parameters! <add> end <add> <add> assert_match "Invalid parameter encoding", err.message <add> assert_match "foo", err.message <add> assert_match "\\xBE", err.message <add> end <add> <ide> test "parameters not accessible after rack parse error of invalid UTF8 character" do <ide> request = stub_request("QUERY_STRING" => "foo%81E=1") <ide>
4
Python
Python
fix qa pipeline on windows
28c77ddf3bd39f3e528f41d94a67b88ad967173a
<ide><path>src/transformers/pipelines.py <ide> def __call__(self, *args, **kwargs): <ide> with torch.no_grad(): <ide> # Retrieve the score for the context tokens only (removing question tokens) <ide> fw_args = {k: torch.tensor(v, device=self.device) for (k, v) in fw_args.items()} <add> # On Windows, the default int type in numpy is np.int32 so we get some non-long tensors. <add> fw_args = {k: v.long() if v.dtype == torch.int32 else v for (k, v) in fw_args.items()} <ide> start, end = self.model(**fw_args)[:2] <ide> start, end = start.cpu().numpy(), end.cpu().numpy() <ide>
1
Ruby
Ruby
push master with tags
b33203604efbc4aead76233fe8c7a39e537b7b1b
<ide><path>Library/Contributions/cmd/brew-test-bot.rb <ide> def run <ide> <ide> remote = "[email protected]:BrewTestBot/homebrew.git" <ide> tag = pr ? "pr-#{pr}" : "testing-#{number}" <del> safe_system "git push --force #{remote} :refs/tags/#{tag}" <add> safe_system "git push --force #{remote} master:master :refs/tags/#{tag}" <ide> <ide> path = "/home/frs/project/m/ma/machomebrew/Bottles/" <ide> url = "BrewTestBot,[email protected]:#{path}"
1
PHP
PHP
add setvalidators method
cbe3b38bd9e7bd2935691eacccbd1df249ecb1c1
<ide><path>src/Illuminate/Routing/Route.php <ide> public static function getValidators() <ide> ); <ide> } <ide> <add> /** <add> * Set the route validators. <add> * <add> * @param array $validators <add> * <add> * @return void <add> */ <add> public static function setValidators($validators) <add> { <add> // set validators to match the route. <add> static::$validators = $validators; <add> } <add> <ide> /** <ide> * Add before filters to the route. <ide> *
1
Text
Text
add note for image responsive layout
09baca03ad4cfba9706e5ed0f8ee5118c0040d24
<ide><path>docs/api-reference/next/image.md <ide> but maintain the original dimensions for larger viewports. <ide> <ide> When `responsive`, the image will scale the dimensions down for smaller <ide> viewports and scale up for larger viewports. <add>Note: the responsive layout may not work correctly if the parent element uses a display value other than `block` such as `display: flex` or `display: grid`. <ide> <ide> When `fill`, the image will stretch both width and height to the dimensions of <ide> the parent element, provided the parent element is relative. This is usually paired with the [`objectFit`](#objectFit) property.
1
Python
Python
change string to f-string
54d8c9f50228da85f79755e2891a368e572425ad
<ide><path>numpy/tests/test_public_api.py <ide> def test_all_modules_are_expected(): <ide> modnames.append(modname) <ide> <ide> if modnames: <del> raise AssertionError("Found unexpected modules: {}".format(modnames)) <add> raise AssertionError(f'Found unexpected modules: {modnames}') <ide> <ide> <ide> # Stuff that clearly shouldn't be in the API and is detected by the next test
1
Python
Python
standardize creation of bytestrings in dtype tests
f723325b6f36868dfa483ff777e0447c229ffc42
<ide><path>numpy/core/tests/test_dtype.py <ide> def test_dtype_from_bytes(self): <ide> assert_dtype_equal(np.dtype(b'f'), np.dtype('float32')) <ide> <ide> # Bytes with non-ascii values raise errors <del> assert_raises(TypeError, np.dtype, bytes([255])) <add> assert_raises(TypeError, np.dtype, b'\xff') <ide> assert_raises(TypeError, np.dtype, b's\xff') <ide> <ide> def test_bad_param(self):
1
PHP
PHP
fix undefined variable
59a77e609756bec6d970e75a0500ae52e6fe685e
<ide><path>src/Illuminate/Cache/RedisTaggedCache.php <ide> public function increment($key, $value = 1) <ide> */ <ide> public function decrement($key, $value = 1) <ide> { <del> $this->pushStandardKeys($s->tags->getNamespace(), $key); <add> $this->pushStandardKeys($this->tags->getNamespace(), $key); <ide> <ide> parent::decrement($key, $value); <ide> }
1
Java
Java
add onbackpressurebuffer with capacity
1d15fea659d5f84bd666b164f3bf6ebcbb91327d
<ide><path>src/main/java/rx/Observable.java <ide> import java.util.*; <ide> import java.util.concurrent.*; <ide> <add>import rx.annotations.Beta; <ide> import rx.annotations.Experimental; <ide> import rx.exceptions.*; <ide> import rx.functions.*; <ide> public final Observable<T> onBackpressureBuffer() { <ide> return lift(new OperatorOnBackpressureBuffer<T>()); <ide> } <ide> <add> /** <add> * Instructs an Observable that is emitting items faster than its observer can consume them to buffer <add> * up to a given amount of items until they can be emitted. The resulting Observable will {@code onError} emitting a <add> * {@link java.nio.BufferOverflowException} as soon as the buffer's capacity is exceeded, dropping all <add> * undelivered items, and unsubscribing from the source. <add> * <p> <add> * <img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt=""> <add> * <dl> <add> * <dt><b>Scheduler:</b></dt> <add> * <dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd> <add> * </dl> <add> * <add> * @return the source Observable modified to buffer items up to the given capacity. <add> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a> <add> * @Beta <add> */ <add> @Beta <add> public final Observable<T> onBackpressureBuffer(long capacity) { <add> return lift(new OperatorOnBackpressureBuffer<T>(capacity)); <add> } <add> <add> /** <add> * Instructs an Observable that is emitting items faster than its observer can consume them to buffer <add> * up to a given amount of items until they can be emitted. The resulting Observable will {@code onError} emitting a <add> * {@link java.nio.BufferOverflowException} as soon as the buffer's capacity is exceeded, dropping all <add> * undelivered items, unsubscribing from the source, and notifying the producer with {@code onOverflow}. <add> * <p> <add> * <img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt=""> <add> * <dl> <add> * <dt><b>Scheduler:</b></dt> <add> * <dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd> <add> * </dl> <add> * <add> * @return the source Observable modified to buffer items up to the given capacity. <add> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a> <add> * @Beta <add> */ <add> @Beta <add> public final Observable<T> onBackpressureBuffer(long capacity, Action0 onOverflow) { <add> return lift(new OperatorOnBackpressureBuffer<T>(capacity, onOverflow)); <add> } <add> <ide> /** <ide> * Instructs an Observable that is emitting items faster than its observer can consume them to discard, <ide> * rather than emit, those items that its observer is not prepared to observe. <ide><path>src/main/java/rx/internal/operators/OperatorOnBackpressureBuffer.java <ide> <ide> import java.util.Queue; <ide> import java.util.concurrent.ConcurrentLinkedQueue; <add>import java.util.concurrent.atomic.AtomicBoolean; <ide> import java.util.concurrent.atomic.AtomicLong; <ide> <ide> import rx.Observable.Operator; <ide> import rx.Producer; <ide> import rx.Subscriber; <add>import rx.exceptions.MissingBackpressureException; <add>import rx.functions.Action0; <ide> <ide> public class OperatorOnBackpressureBuffer<T> implements Operator<T, T> { <ide> <ide> private final NotificationLite<T> on = NotificationLite.instance(); <ide> <add> private final Long capacity; <add> private final Action0 onOverflow; <add> <add> public OperatorOnBackpressureBuffer() { <add> this.capacity = null; <add> this.onOverflow = null; <add> } <add> <add> public OperatorOnBackpressureBuffer(long capacity) { <add> this(capacity, null); <add> } <add> <add> public OperatorOnBackpressureBuffer(long capacity, Action0 onOverflow) { <add> if (capacity <= 0) { <add> throw new IllegalArgumentException("Buffer capacity must be > 0"); <add> } <add> this.capacity = capacity; <add> this.onOverflow = onOverflow; <add> } <add> <ide> @Override <ide> public Subscriber<? super T> call(final Subscriber<? super T> child) { <ide> // TODO get a different queue implementation <del> // TODO start with size hint <ide> final ConcurrentLinkedQueue<Object> queue = new ConcurrentLinkedQueue<Object>(); <add> final AtomicLong capacity = (this.capacity == null) ? null : new AtomicLong(this.capacity); <ide> final AtomicLong wip = new AtomicLong(); <ide> final AtomicLong requested = new AtomicLong(); <ide> <ide> public Subscriber<? super T> call(final Subscriber<? super T> child) { <ide> @Override <ide> public void request(long n) { <ide> if (requested.getAndAdd(n) == 0) { <del> pollQueue(wip, requested, queue, child); <add> pollQueue(wip, requested, capacity, queue, child); <ide> } <ide> } <ide> <ide> }); <ide> // don't pass through subscriber as we are async and doing queue draining <ide> // a parent being unsubscribed should not affect the children <ide> Subscriber<T> parent = new Subscriber<T>() { <add> <add> private AtomicBoolean saturated = new AtomicBoolean(false); <add> <ide> @Override <ide> public void onStart() { <ide> request(Long.MAX_VALUE); <ide> } <ide> <ide> @Override <ide> public void onCompleted() { <del> queue.offer(on.completed()); <del> pollQueue(wip, requested, queue, child); <add> if (!saturated.get()) { <add> queue.offer(on.completed()); <add> pollQueue(wip, requested, capacity, queue, child); <add> } <ide> } <ide> <ide> @Override <ide> public void onError(Throwable e) { <del> queue.offer(on.error(e)); <del> pollQueue(wip, requested, queue, child); <add> if (!saturated.get()) { <add> queue.offer(on.error(e)); <add> pollQueue(wip, requested, capacity, queue, child); <add> } <ide> } <ide> <ide> @Override <ide> public void onNext(T t) { <add> if (!assertCapacity()) { <add> return; <add> } <ide> queue.offer(on.next(t)); <del> pollQueue(wip, requested, queue, child); <add> pollQueue(wip, requested, capacity, queue, child); <ide> } <ide> <add> private boolean assertCapacity() { <add> if (capacity == null) { <add> return true; <add> } <add> <add> long currCapacity; <add> do { <add> currCapacity = capacity.get(); <add> if (currCapacity <= 0) { <add> if (saturated.compareAndSet(false, true)) { <add> unsubscribe(); <add> child.onError(new MissingBackpressureException( <add> "Overflowed buffer of " <add> + OperatorOnBackpressureBuffer.this.capacity)); <add> if (onOverflow != null) { <add> onOverflow.call(); <add> } <add> } <add> return false; <add> } <add> // ensure no other thread stole our slot, or retry <add> } while (!capacity.compareAndSet(currCapacity, currCapacity - 1)); <add> return true; <add> } <ide> }; <ide> <ide> // if child unsubscribes it should unsubscribe the parent, but not the other way around <ide> public void onNext(T t) { <ide> return parent; <ide> } <ide> <del> private void pollQueue(AtomicLong wip, AtomicLong requested, Queue<Object> queue, Subscriber<? super T> child) { <add> private void pollQueue(AtomicLong wip, AtomicLong requested, AtomicLong capacity, Queue<Object> queue, Subscriber<? super T> child) { <ide> // TODO can we do this without putting everything in the queue first so we can fast-path the case when we don't need to queue? <ide> if (requested.get() > 0) { <ide> // only one draining at a time <ide> private void pollQueue(AtomicLong wip, AtomicLong requested, Queue<Object> queue <ide> requested.incrementAndGet(); <ide> return; <ide> } <add> if (capacity != null) { // it's bounded <add> capacity.incrementAndGet(); <add> } <ide> on.accept(child, o); <ide> } else { <ide> // we hit the end ... so increment back to 0 again <ide><path>src/test/java/rx/internal/operators/OperatorOnBackpressureBufferTest.java <ide> */ <ide> package rx.internal.operators; <ide> <del>import static org.junit.Assert.assertEquals; <del> <ide> import java.util.concurrent.CountDownLatch; <add>import java.util.concurrent.TimeUnit; <ide> <ide> import org.junit.Test; <ide> <ide> import rx.Observable; <ide> import rx.Observable.OnSubscribe; <ide> import rx.Observer; <ide> import rx.Subscriber; <add>import rx.Subscription; <add>import rx.exceptions.MissingBackpressureException; <add>import rx.functions.Action0; <ide> import rx.observers.TestSubscriber; <ide> import rx.schedulers.Schedulers; <ide> <add>import static org.junit.Assert.assertEquals; <add>import static org.junit.Assert.assertTrue; <add> <ide> public class OperatorOnBackpressureBufferTest { <ide> <ide> @Test <ide> public void onNext(Long t) { <ide> assertEquals(499, ts.getOnNextEvents().get(499).intValue()); <ide> } <ide> <add> @Test(expected = IllegalArgumentException.class) <add> public void testFixBackpressureBufferNegativeCapacity() throws InterruptedException { <add> Observable.empty().onBackpressureBuffer(-1); <add> } <add> <add> @Test(expected = IllegalArgumentException.class) <add> public void testFixBackpressureBufferZeroCapacity() throws InterruptedException { <add> Observable.empty().onBackpressureBuffer(-1); <add> } <add> <add> @Test <add> public void testFixBackpressureBoundedBuffer() throws InterruptedException { <add> final CountDownLatch l1 = new CountDownLatch(100); <add> final CountDownLatch backpressureCallback = new CountDownLatch(1); <add> TestSubscriber<Long> ts = new TestSubscriber<Long>(new Observer<Long>() { <add> <add> @Override <add> public void onCompleted() { } <add> <add> @Override <add> public void onError(Throwable e) { } <add> <add> @Override <add> public void onNext(Long t) { <add> l1.countDown(); <add> } <add> <add> }); <add> <add> ts.requestMore(100); <add> Subscription s = infinite.subscribeOn(Schedulers.computation()) <add> .onBackpressureBuffer(500, new Action0() { <add> @Override <add> public void call() { <add> backpressureCallback.countDown(); <add> } <add> }).take(1000).subscribe(ts); <add> l1.await(); <add> <add> ts.requestMore(50); <add> <add> assertTrue(backpressureCallback.await(500, TimeUnit.MILLISECONDS)); <add> assertTrue(ts.getOnErrorEvents().get(0) instanceof MissingBackpressureException); <add> <add> int size = ts.getOnNextEvents().size(); <add> assertTrue(size <= 150); // will get up to 50 more <add> assertTrue(ts.getOnNextEvents().get(size-1) == size-1); <add> assertTrue(s.isUnsubscribed()); <add> } <add> <ide> static final Observable<Long> infinite = Observable.create(new OnSubscribe<Long>() { <ide> <ide> @Override <ide> public void call(Subscriber<? super Long> s) { <ide> } <ide> <ide> }); <add> <ide> }
3
Javascript
Javascript
bind events in scatter chart
42e2c237d4e17db68929e47c9146ba023dca69ad
<ide><path>src/Chart.Scatter.js <ide> name: "Scatter", <ide> defaults: defaultConfig, <ide> initialize: function() { <add> <add> // Events <add> helpers.bindEvents(this, this.options.events, this.events); <add> <ide> //Custom Point Defaults <ide> helpers.each(this.data.datasets, function(dataset, datasetIndex) { <ide> dataset.metaDataset = new Chart.Line({
1
Mixed
Text
add a specific config for the update command
a4f6920731c6af27a7e89c3da8d0e6fd309de90a
<ide><path>api/server/router/container/container_routes.go <ide> package container <ide> <ide> import ( <add> "encoding/json" <ide> "fmt" <ide> "io" <ide> "net/http" <ide> func (s *containerRouter) postContainerUpdate(ctx context.Context, w http.Respon <ide> return err <ide> } <ide> <del> _, hostConfig, _, err := runconfig.DecodeContainerConfig(r.Body) <del> if err != nil { <add> var updateConfig container.UpdateConfig <add> <add> decoder := json.NewDecoder(r.Body) <add> if err := decoder.Decode(&updateConfig); err != nil { <ide> return err <ide> } <ide> <add> hostConfig := &container.HostConfig{ <add> Resources: updateConfig.Resources, <add> } <add> <ide> name := vars["name"] <ide> warnings, err := s.backend.ContainerUpdate(name, hostConfig) <ide> if err != nil { <ide><path>docs/reference/api/docker_remote_api.md <ide> This section lists each version from latest to oldest. Each listing includes a <ide> <ide> [Docker Remote API v1.22](docker_remote_api_v1.22.md) documentation <ide> <add>* `POST /container/(name)/update` updates the resources of a container. <ide> * `GET /containers/json` supports filter `isolation` on Windows. <ide> * `GET /containers/json` now returns the list of networks of containers. <ide> * `GET /info` Now returns `Architecture` and `OSType` fields, providing information <ide> This section lists each version from latest to oldest. Each listing includes a <ide> * `GET /volumes` lists volumes from all volume drivers. <ide> * `POST /volumes/create` to create a volume. <ide> * `GET /volumes/(name)` get low-level information about a volume. <del>* `DELETE /volumes/(name)`remove a volume with the specified name. <add>* `DELETE /volumes/(name)` remove a volume with the specified name. <ide> * `VolumeDriver` was moved from `config` to `HostConfig` to make the configuration portable. <ide> * `GET /images/(name)/json` now returns information about an image's `RepoTags` and `RepoDigests`. <ide> * The `config` option now accepts the field `StopSignal`, which specifies the signal to use to kill a container. <ide><path>docs/reference/api/docker_remote_api_v1.22.md <ide> Update resource configs of one or more containers. <ide> Content-Type: application/json <ide> <ide> { <del> "HostConfig": { <add> "UpdateConfig": { <ide> "Resources": { <ide> "BlkioWeight": 300, <ide> "CpuShares": 512,
3
Javascript
Javascript
add test for view controller changes
6a6824860686ec8f18adc0fa739258f92df14cec
<ide><path>packages/ember-views/tests/views/view/controller_test.js <ide> QUnit.test('controller property should be inherited from nearest ancestor with c <ide> grandchild.destroy(); <ide> }); <ide> }); <add> <add>QUnit.test('controller changes are passed to descendants', function() { <add> var grandparent = ContainerView.create(); <add> var parent = ContainerView.create(); <add> var child = ContainerView.create(); <add> var grandchild = ContainerView.create(); <add> <add> run(function() { <add> grandparent.set('controller', {}); <add> <add> grandparent.pushObject(parent); <add> parent.pushObject(child); <add> child.pushObject(grandchild); <add> }); <add> <add> var parentCount = 0; <add> var childCount = 0; <add> var grandchildCount = 0; <add> <add> parent.addObserver('controller', parent, function() { parentCount++; }); <add> child.addObserver('controller', child, function() { childCount++; }); <add> grandchild.addObserver('controller', grandchild, function() { grandchildCount++; }); <add> <add> run(function() { grandparent.set('controller', {}); }); <add> <add> equal(parentCount, 1); <add> equal(childCount, 1); <add> equal(grandchildCount, 1); <add> <add> run(function() { grandparent.set('controller', {}); }); <add> <add> equal(parentCount, 2); <add> equal(childCount, 2); <add> equal(grandchildCount, 2); <add> <add> run(function() { <add> grandparent.destroy(); <add> parent.destroy(); <add> child.destroy(); <add> grandchild.destroy(); <add> }); <add>});
1
Text
Text
change typo on step 76
3edc38e05402e85f3b4eb6ff7f4a7c677793052e
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f46fc57528aa1c4b5ea7c2e.md <ide> dashedName: step-76 <ide> <ide> # --description-- <ide> <del>Changing the `bottom-margin` to `5px` looks great. However, now the space between the `Cinnamon Roll` menu item and the second `hr` element does not match the space between the top `hr` element and the `Coffee` heading. <add>Changing the `margin-bottom` to `5px` looks great. However, now the space between the `Cinnamon Roll` menu item and the second `hr` element does not match the space between the top `hr` element and the `Coffee` heading. <ide> <ide> Add some more space by creating a class named `bottom-line` using `25px` for the `margin-top` property. <ide>
1
PHP
PHP
fix code style
e336ecac583c6607a3719c362dc3a745e3fd7c0a
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function qualifyColumn($column) <ide> * @param array|mixed $columns <ide> * @return array <ide> */ <del> public function qualifyColumns($columns) <add> public function qualifyColumns($columns) <ide> { <ide> $columns = is_array($columns) ? $columns : func_get_args(); <ide> $qualifiedArray = []; <del> foreach($columns as $column) { <add> foreach ($columns as $column) { <ide> $qualifiedArray[] = $this->qualifyColumn($column); <ide> } <ide> return $qualifiedArray;
1
PHP
PHP
use a callback in findorcreate instead of an array
1f0eb1e800a72d06d64670e48b6fd637cb191f3e
<ide><path>src/ORM/Table.php <ide> public function get($primaryKey, $options = []) { <ide> * the $defaults. When a new entity is created, it will be saved. <ide> * <ide> * @param array $search The criteria to find existing records by. <del> * @param array $defaults The array of defaults to patch into <del> * the new entity if it is created. <add> * @param callable $callback A callback that will be invoked for newly <add> * created entities. This callback will be called *before* the entity <add> * is persisted. <ide> * @return \Cake\Datasource\EntityInterface An entity. <ide> */ <del> public function findOrCreate($search, $defaults = []) { <add> public function findOrCreate($search, callable $callback = null) { <ide> $query = $this->find()->where($search); <ide> $row = $query->first(); <ide> if ($row) { <ide> return $row; <ide> } <del> $entity = $this->newEntity($search + $defaults); <add> $entity = $this->newEntity($search); <add> if ($callback) { <add> $callback($entity); <add> } <ide> return $this->save($entity); <ide> } <ide> <ide><path>tests/TestCase/ORM/TableTest.php <ide> public function testDebugInfo() { <ide> } <ide> <ide> /** <del> * Test the findOrNew method. <add> * Test the findOrCreate method. <ide> * <ide> * @return void <ide> */ <del> public function testFindOrNew() { <add> public function testFindOrCreate() { <ide> $articles = TableRegistry::get('Articles'); <del> $article = $articles->findOrCreate(['title' => 'Not there'], ['body' => 'New body']); <add> $article = $articles->findOrCreate(['title' => 'Not there'], function ($article) { <add> $article->body = 'New body'; <add> }); <ide> <ide> $this->assertFalse($article->isNew()); <ide> $this->assertNotNull($article->id); <ide> $this->assertEquals('Not there', $article->title); <ide> $this->assertEquals('New body', $article->body); <ide> <del> $article = $articles->findOrCreate(['title' => 'First Article'], ['body' => 'New body']); <add> $article = $articles->findOrCreate(['title' => 'First Article'], function ($article) { <add> $this->fail('Should not be called for existing entities.'); <add> }); <ide> <ide> $this->assertFalse($article->isNew()); <ide> $this->assertNotNull($article->id); <ide> $this->assertEquals('First Article', $article->title); <del> $this->assertNotEquals('New body', $article->body); <ide> <ide> $article = $articles->findOrCreate( <ide> ['author_id' => 2, 'title' => 'First Article'], <del> ['published' => 'N', 'body' => 'New body'] <add> function ($article) { <add> $article->set(['published' => 'N', 'body' => 'New body']); <add> } <ide> ); <ide> $this->assertFalse($article->isNew()); <ide> $this->assertNotNull($article->id);
2
Javascript
Javascript
remove unnecessary comma in convolutionshader
67986fe8f2892733300066fc1bcbbbf767486106
<ide><path>examples/js/shaders/ConvolutionShader.js <ide> THREE.ConvolutionShader = { <ide> defines: { <ide> <ide> "KERNEL_SIZE_FLOAT": "25.0", <del> "KERNEL_SIZE_INT": "25", <add> "KERNEL_SIZE_INT": "25" <ide> <ide> }, <ide>
1
Go
Go
implement fallback operation for driver.diff()
e82f8c1661f3fa18e4dc6ca3aebe4dcc46e8961b
<ide><path>container.go <ide> func (container *Container) ExportRw() (archive.Archive, error) { <ide> if container.runtime == nil { <ide> return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID) <ide> } <del> return container.runtime.driver.Diff(container.ID) <add> <add> return container.runtime.Diff(container) <ide> } <ide> <ide> func (container *Container) Export() (archive.Archive, error) { <ide><path>devmapper/driver.go <ide> package devmapper <ide> <ide> import ( <ide> "fmt" <del> "github.com/dotcloud/docker/archive" <ide> "github.com/dotcloud/docker/graphdriver" <ide> "os" <ide> "path" <ide> func (d *Driver) Get(id string) (string, error) { <ide> return mp, nil <ide> } <ide> <del>func (d *Driver) Diff(id string) (archive.Archive, error) { <del> return nil, fmt.Errorf("Not implemented") <del>} <del> <ide> func (d *Driver) DiffSize(id string) (int64, error) { <ide> return -1, fmt.Errorf("Not implemented") <ide> } <ide><path>graphdriver/driver.go <ide> type Driver interface { <ide> <ide> Get(id string) (dir string, err error) <ide> <del> Diff(id string) (archive.Archive, error) <ide> DiffSize(id string) (bytes int64, err error) <ide> <ide> Cleanup() error <ide> type Changer interface { <ide> Changes(id string) ([]archive.Change, error) <ide> } <ide> <add>type Differ interface { <add> Diff(id string) (archive.Archive, error) <add>} <add> <ide> var ( <ide> // All registred drivers <ide> drivers map[string]InitFunc <ide><path>graphdriver/dummy/driver.go <ide> func (d *Driver) Get(id string) (string, error) { <ide> return dir, nil <ide> } <ide> <del>func (d *Driver) Diff(id string) (archive.Archive, error) { <del> p, err := d.Get(id) <del> if err != nil { <del> return nil, err <del> } <del> return archive.Tar(p, archive.Uncompressed) <del>} <del> <ide> func (d *Driver) DiffSize(id string) (int64, error) { <ide> return -1, fmt.Errorf("Not implemented") <ide> } <ide><path>runtime.go <ide> import ( <ide> "os" <ide> "os/exec" <ide> "path" <add> "path/filepath" <ide> "sort" <ide> "strings" <ide> "time" <ide> func (runtime *Runtime) Changes(container *Container) ([]archive.Change, error) <ide> return archive.ChangesDirs(cDir, initDir) <ide> } <ide> <add>func (runtime *Runtime) Diff(container *Container) (archive.Archive, error) { <add> if differ, ok := runtime.driver.(graphdriver.Differ); ok { <add> return differ.Diff(container.ID) <add> } <add> <add> changes, err := runtime.Changes(container) <add> if err != nil { <add> return nil, err <add> } <add> <add> cDir, err := runtime.driver.Get(container.ID) <add> if err != nil { <add> return nil, fmt.Errorf("Error getting container rootfs %s from driver %s: %s", container.ID, container.runtime.driver, err) <add> } <add> <add> files := make([]string, 0) <add> deletions := make([]string, 0) <add> for _, change := range changes { <add> if change.Kind == archive.ChangeModify || change.Kind == archive.ChangeAdd { <add> files = append(files, change.Path) <add> } <add> if change.Kind == archive.ChangeDelete { <add> base := filepath.Base(change.Path) <add> dir := filepath.Dir(change.Path) <add> deletions = append(deletions, filepath.Join(dir, ".wh."+base)) <add> } <add> } <add> <add> return archive.TarFilter(cDir, archive.Uncompressed, files, false, deletions) <add>} <add> <ide> func linkLxcStart(root string) error { <ide> sourcePath, err := exec.LookPath("lxc-start") <ide> if err != nil {
5
Javascript
Javascript
disable an element directive test on ie8
726e0c246bfbece82fcf606493e64b97d3e6e711
<ide><path>test/ng/directive/ngRepeatSpec.js <ide> describe('ngRepeat', function() { <ide> })); <ide> <ide> <del> it('should work when placed on a root element of element directive with ASYNC replaced template', <del> inject(function($templateCache, $compile, $rootScope) { <del> $compileProvider.directive('replaceMeWithRepeater', function() { <del> return { <del> restrict: 'E', <del> replace: true, <del> templateUrl: 'replace-me-with-repeater.html' <del> }; <del> }); <del> $templateCache.put('replace-me-with-repeater.html', '<div ng-repeat="i in [1,2,3]">{{i}}</div>'); <del> element = $compile('<div><replace-me-with-repeater></replace-me-with-repeater></div>')($rootScope); <del> expect(element.text()).toBe(''); <del> $rootScope.$apply(); <del> expect(element.text()).toBe('123'); <del> })); <add> if (!msie || msie > 8) { <add> // only IE>8 supports element directives <add> <add> it('should work when placed on a root element of element directive with ASYNC replaced template', <add> inject(function($templateCache, $compile, $rootScope) { <add> $compileProvider.directive('replaceMeWithRepeater', function() { <add> return { <add> restrict: 'E', <add> replace: true, <add> templateUrl: 'replace-me-with-repeater.html' <add> }; <add> }); <add> $templateCache.put('replace-me-with-repeater.html', '<div ng-repeat="i in [1,2,3]">{{i}}</div>'); <add> element = $compile('<div><replace-me-with-repeater></replace-me-with-repeater></div>')($rootScope); <add> expect(element.text()).toBe(''); <add> $rootScope.$apply(); <add> expect(element.text()).toBe('123'); <add> })); <add> } <ide> }); <ide> <ide>
1
Javascript
Javascript
make public certs always viewable
2785875941f83847269eb062ba07701f0c4b5d44
<ide><path>api-server/server/middlewares/request-authorization.js <ide> import { wrapHandledError } from '../utils/create-handled-error'; <ide> const apiProxyRE = /^\/internal\/|^\/external\//; <ide> const newsShortLinksRE = /^\/internal\/n\/|^\/internal\/p\?/; <ide> const loopbackAPIPathRE = /^\/internal\/api\//; <add>const showCertRe = /^\/internal\/certificate\/showCert\//; <ide> <del>const _whiteListREs = [newsShortLinksRE, loopbackAPIPathRE]; <add>const _whiteListREs = [newsShortLinksRE, loopbackAPIPathRE, showCertRe]; <ide> <ide> export function isWhiteListedPath(path, whiteListREs = _whiteListREs) { <ide> return whiteListREs.some(re => re.test(path));
1
Javascript
Javascript
add node_unique_id value to err message
0662ebeef99b9ce233b0c683e762e8c76ce69785
<ide><path>test/parallel/test-cluster-basic.js <ide> const assert = require('assert'); <ide> const cluster = require('cluster'); <ide> <ide> assert.strictEqual('NODE_UNIQUE_ID' in process.env, false, <del> 'NODE_UNIQUE_ID should be removed on startup'); <add> `NODE_UNIQUE_ID (${process.env.NODE_UNIQUE_ID})` + <add> 'should be removed on startup'); <ide> <ide> function forEach(obj, fn) { <ide> Object.keys(obj).forEach((name, index) => {
1
Text
Text
use oxford comma
da74c312e65e5cccabdae26b2867cc1074ec88a4
<ide><path>README.md <ide> or packaging just about any resource or asset. <ide> <ide> **TL;DR** <ide> <del>* Bundles [ES Modules](http://www.2ality.com/2014/09/es6-modules-final.html), [CommonJS](http://wiki.commonjs.org/) and [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules (even combined). <add>* Bundles [ES Modules](http://www.2ality.com/2014/09/es6-modules-final.html), [CommonJS](http://wiki.commonjs.org/), and [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules (even combined). <ide> * Can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time). <ide> * Dependencies are resolved during compilation, reducing the runtime size. <ide> * Loaders can preprocess files while compiling, e.g. TypeScript to JavaScript, Handlebars strings to compiled functions, images to Base64, etc.
1
Go
Go
remove unused haswin32ksupport()
be463cbd6c7a3eaec327016490345e7e2724e234
<ide><path>pkg/system/syscall_windows.go <ide> import ( <ide> "unsafe" <ide> <ide> "github.com/sirupsen/logrus" <del> "golang.org/x/sys/windows" <ide> ) <ide> <ide> const ( <ide> // Deprecated: use github.com/docker/pkg/idtools.SeTakeOwnershipPrivilege <ide> SeTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege" <del>) <del> <del>const ( <ide> // Deprecated: use github.com/docker/pkg/idtools.ContainerAdministratorSidString <ide> ContainerAdministratorSidString = "S-1-5-93-2-1" <ide> // Deprecated: use github.com/docker/pkg/idtools.ContainerUserSidString <ide> ContainerUserSidString = "S-1-5-93-2-2" <ide> ) <ide> <del>var ( <del> ntuserApiset = windows.NewLazyDLL("ext-ms-win-ntuser-window-l1-1-0") <del> procGetVersionExW = modkernel32.NewProc("GetVersionExW") <del>) <add>var procGetVersionExW = modkernel32.NewProc("GetVersionExW") <ide> <ide> // https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa <ide> // TODO: use golang.org/x/sys/windows.OsVersionInfoEx (needs OSVersionInfoSize to be exported) <ide> func IsWindowsClient() bool { <ide> const verNTWorkstation = 0x00000001 // VER_NT_WORKSTATION <ide> return osviex.ProductType == verNTWorkstation <ide> } <del> <del>// HasWin32KSupport determines whether containers that depend on win32k can <del>// run on this machine. Win32k is the driver used to implement windowing. <del>func HasWin32KSupport() bool { <del> // For now, check for ntuser API support on the host. In the future, a host <del> // may support win32k in containers even if the host does not support ntuser <del> // APIs. <del> return ntuserApiset.Load() == nil <del>} <ide><path>pkg/system/syscall_windows_test.go <del>package system // import "github.com/docker/docker/pkg/system" <del> <del>import "testing" <del> <del>func TestHasWin32KSupport(t *testing.T) { <del> s := HasWin32KSupport() // make sure this doesn't panic <del> <del> t.Logf("win32k: %v", s) // will be different on different platforms -- informative only <del>}
2
Javascript
Javascript
use const where applicable in usestrictplugin
1d3265445c891336f0ef5a537ac6adb01169f862
<ide><path>lib/UseStrictPlugin.js <ide> class UseStrictPlugin { <ide> apply(compiler) { <ide> compiler.plugin("compilation", (compilation, params) => { <ide> params.normalModuleFactory.plugin("parser", (parser) => { <del> let parserInstance = parser; <add> const parserInstance = parser; <ide> parser.plugin("program", (ast) => { <del> let firstNode = ast.body[0]; <del> let dep; <add> const firstNode = ast.body[0]; <ide> if(firstNode && <ide> firstNode.type === "ExpressionStatement" && <ide> firstNode.expression.type === "Literal" && <ide> firstNode.expression.value === "use strict") { <ide> // Remove "use strict" expression. It will be added later by the renderer again. <ide> // This is necessary in order to not break the strict mode when webpack prepends code. <ide> // @see https://github.com/webpack/webpack/issues/1970 <del> dep = new ConstDependency("", firstNode.range); <add> const dep = new ConstDependency("", firstNode.range); <ide> dep.loc = firstNode.loc; <ide> parserInstance.state.current.addDependency(dep); <ide> parserInstance.state.module.strict = true;
1
PHP
PHP
use method instead of property for config
b3098bddfb78a5fdb753b276986511cc1180d365
<ide><path>tests/test_app/Plugin/TestPlugin/src/Model/Table/TestPluginCommentsTable.php <ide> */ <ide> class TestPluginCommentsTable extends Table { <ide> <del> protected $_table = 'test_plugin_comments'; <add> public function initialize(array $config) { <add> $this->table('test_plugin_comments'); <add> } <ide> <ide> }
1
PHP
PHP
remove unneeded code
d9be4bfe0367a8e07eed4931bdabf135292abb1b
<ide><path>src/Illuminate/Queue/Jobs/JobName.php <ide> public static function resolve($name, $payload) <ide> return $payload['displayName']; <ide> } <ide> <del> if ($name === 'Illuminate\Queue\CallQueuedHandler@call') { <del> return Arr::get($payload, 'data.commandName', $name); <del> } <del> <ide> return $name; <ide> } <ide> }
1
Javascript
Javascript
add function support to the `domain` property
8fc521cb028ffaec6b1a0fd2af9df4105d169511
<ide><path>d3.chart.js <ide> d3.chart.boxplot = function() { <ide> <ide> // Compute the new x-scale. <ide> var x1 = d3.scale.linear() <del> .domain(domain || [min, max]) <add> .domain(domain ? domain.call(this, d, i) : [min, max]) <ide> .range([height, 0]); <ide> <ide> // Retrieve the old x-scale, if this is an update. <ide> d3.chart.boxplot = function() { <ide> <ide> boxplot.domain = function(x) { <ide> if (!arguments.length) return domain; <del> domain = x; <add> domain = d3.functor(x); <ide> return boxplot; <ide> }; <ide> <ide><path>d3.chart.min.js <del>(function(){function f(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function e(a){return function(b){return"translate("+a(b)+",0)"}}function d(a){return a.measures}function c(a){return a.markers}function b(a){return a.ranges}function a(a,b){return a-b}d3.chart={},d3.chart.boxplot=function(){function h(a){a.each(function(a,h){a=a.slice(),a.sort(f);var i=a.length,j=a[0],k=a[Math.floor(.25*i)],l=a[Math.floor(.5*i)],m=a[Math.floor(.75*i)],n=a[i-1],o=d3.select(this),p=d3.scale.linear().domain(e||[j,n]).range([c,0]),q=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(p.range());this.__chart__=p;var r=o.selectAll("line.center").data([[j,n]]);r.enter().append("svg:line").attr("class","center").attr("x1",b/2).attr("y1",function(a){return q(a[0])}).attr("x2",b/2).attr("y2",function(a){return q(a[1])}).transition().duration(d).attr("y1",function(a){return p(a[0])}).attr("y2",function(a){return p(a[1])}),r.transition().duration(d).attr("y1",function(a){return p(a[0])}).attr("y2",function(a){return p(a[1])}),r.exit().remove();var s=o.selectAll("rect.box").data([[k,m]]);s.enter().append("svg:rect").attr("class","box").attr("x",0).attr("y",function(a){return q(a[1])}).attr("width",b).attr("height",function(a){return q(a[0])-q(a[1])}).transition().duration(d).attr("y",function(a){return p(a[1])}).attr("height",function(a){return p(a[0])-p(a[1])}),s.transition().duration(d).attr("y",function(a){return p(a[1])}).attr("height",function(a){return p(a[0])-p(a[1])}),s.exit().remove();var t=o.selectAll("line.marker").data([j,l,n]);t.enter().append("svg:line").attr("class","marker").attr("x1",0).attr("y1",q).attr("x2",b).attr("y2",q).transition().duration(d).attr("y1",p).attr("y2",p),t.transition().duration(d).attr("y1",p).attr("y2",p),t.exit().remove();var u=g||p.tickFormat(8),v=o.selectAll("text").data([j,k,l,m,n]);v.enter().append("svg:text").attr("dy",".3em").attr("dx",function(a,b){return b&1?8:-8}).attr("x",function(a,c){return c&1?b:0}).attr("y",q).attr("text-anchor",function(a,b){return b&1?"start":"end"}).text(u).transition().duration(d).attr("y",p),v.text(u).transition().duration(d).attr("y",p)})}var b=1,c=1,d=0,e=null,f=a,g=null;h.width=function(a){if(!arguments.length)return b;b=a;return h},h.height=function(a){if(!arguments.length)return c;c=a;return h},h.tickFormat=function(a){if(!arguments.length)return g;g=a;return h},h.duration=function(a){if(!arguments.length)return d;d=a;return h},h.domain=function(a){if(!arguments.length)return e;e=a;return h},h.sort=function(a){if(!arguments.length)return f;f=a;return h};return h},d3.chart.bullet=function(){function o(a){a.each(function(a,b){var c=i.call(this,a,b).slice().sort(d3.descending),d=j.call(this,a,b).slice().sort(d3.descending),o=k.call(this,a,b).slice().sort(d3.descending),p=d3.select(this),q=d3.scale.linear().domain([0,Math.max(c[0],d[0],o[0])]).range(g?[l,0]:[0,l]),r=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(q.range());this.__chart__=q;var s=f(r),t=f(q),u=p.selectAll("rect.range").data(c);u.enter().append("svg:rect").attr("class",function(a,b){return"range s"+b}).attr("width",s).attr("height",m).attr("x",g?r:0).transition().duration(h).attr("width",t).attr("x",g?q:0),u.transition().duration(h).attr("x",g?q:0).attr("width",t).attr("height",m);var v=p.selectAll("rect.measure").data(o);v.enter().append("svg:rect").attr("class",function(a,b){return"measure s"+b}).attr("width",s).attr("height",m/3).attr("x",g?r:0).attr("y",m/3).transition().duration(h).attr("width",t).attr("x",g?q:0),v.transition().duration(h).attr("width",t).attr("height",m/3).attr("x",g?q:0).attr("y",m/3);var w=p.selectAll("line.marker").data(d);w.enter().append("svg:line").attr("class","marker").attr("x1",r).attr("x2",r).attr("y1",m/6).attr("y2",m*5/6).transition().duration(h).attr("x1",q).attr("x2",q),w.transition().duration(h).attr("x1",q).attr("x2",q).attr("y1",m/6).attr("y2",m*5/6);var x=n||q.tickFormat(8),y=p.selectAll("g.tick").data(q.ticks(8),function(a){return this.textContent||x(a)}),z=y.enter().append("svg:g").attr("class","tick").attr("transform",e(r)).attr("opacity",1e-6);z.append("svg:line").attr("y1",m).attr("y2",m*7/6),z.append("svg:text").attr("text-anchor","middle").attr("dy","1em").attr("y",m*7/6).text(x),z.transition().duration(h).attr("transform",e(q)).attr("opacity",1);var A=y.transition().duration(h).attr("transform",e(q)).attr("opacity",1);A.select("line").attr("y1",m).attr("y2",m*7/6),A.select("text").attr("y",m*7/6),y.exit().transition().duration(h).attr("transform",e(q)).attr("opacity",1e-6).remove()})}var a="left",g=!1,h=0,i=b,j=c,k=d,l=380,m=30,n=null;o.orient=function(b){if(!arguments.length)return a;a=b,g=a=="right"||a=="bottom";return o},o.ranges=function(a){if(!arguments.length)return i;i=a;return o},o.markers=function(a){if(!arguments.length)return j;j=a;return o},o.measures=function(a){if(!arguments.length)return k;k=a;return o},o.width=function(a){if(!arguments.length)return l;l=a;return o},o.height=function(a){if(!arguments.length)return m;m=a;return o},o.tickFormat=function(a){if(!arguments.length)return n;n=a;return o},o.duration=function(a){if(!arguments.length)return h;h=a;return o};return o}})() <ide>\ No newline at end of file <add>(function(){function f(a){var b=a(0);return function(c){return Math.abs(a(c)-b)}}function e(a){return function(b){return"translate("+a(b)+",0)"}}function d(a){return a.measures}function c(a){return a.markers}function b(a){return a.ranges}function a(a,b){return a-b}d3.chart={},d3.chart.boxplot=function(){function h(a){a.each(function(a,h){a=a.slice(),a.sort(f);var i=a.length,j=a[0],k=a[Math.floor(.25*i)],l=a[Math.floor(.5*i)],m=a[Math.floor(.75*i)],n=a[i-1],o=d3.select(this),p=d3.scale.linear().domain(e?e.call(this,a,h):[j,n]).range([c,0]),q=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(p.range());this.__chart__=p;var r=o.selectAll("line.center").data([[j,n]]);r.enter().append("svg:line").attr("class","center").attr("x1",b/2).attr("y1",function(a){return q(a[0])}).attr("x2",b/2).attr("y2",function(a){return q(a[1])}).transition().duration(d).attr("y1",function(a){return p(a[0])}).attr("y2",function(a){return p(a[1])}),r.transition().duration(d).attr("y1",function(a){return p(a[0])}).attr("y2",function(a){return p(a[1])}),r.exit().remove();var s=o.selectAll("rect.box").data([[k,m]]);s.enter().append("svg:rect").attr("class","box").attr("x",0).attr("y",function(a){return q(a[1])}).attr("width",b).attr("height",function(a){return q(a[0])-q(a[1])}).transition().duration(d).attr("y",function(a){return p(a[1])}).attr("height",function(a){return p(a[0])-p(a[1])}),s.transition().duration(d).attr("y",function(a){return p(a[1])}).attr("height",function(a){return p(a[0])-p(a[1])}),s.exit().remove();var t=o.selectAll("line.marker").data([j,l,n]);t.enter().append("svg:line").attr("class","marker").attr("x1",0).attr("y1",q).attr("x2",b).attr("y2",q).transition().duration(d).attr("y1",p).attr("y2",p),t.transition().duration(d).attr("y1",p).attr("y2",p),t.exit().remove();var u=g||p.tickFormat(8),v=o.selectAll("text").data([j,k,l,m,n]);v.enter().append("svg:text").attr("dy",".3em").attr("dx",function(a,b){return b&1?8:-8}).attr("x",function(a,c){return c&1?b:0}).attr("y",q).attr("text-anchor",function(a,b){return b&1?"start":"end"}).text(u).transition().duration(d).attr("y",p),v.text(u).transition().duration(d).attr("y",p)})}var b=1,c=1,d=0,e=null,f=a,g=null;h.width=function(a){if(!arguments.length)return b;b=a;return h},h.height=function(a){if(!arguments.length)return c;c=a;return h},h.tickFormat=function(a){if(!arguments.length)return g;g=a;return h},h.duration=function(a){if(!arguments.length)return d;d=a;return h},h.domain=function(a){if(!arguments.length)return e;e=d3.functor(a);return h},h.sort=function(a){if(!arguments.length)return f;f=a;return h};return h},d3.chart.bullet=function(){function o(a){a.each(function(a,b){var c=i.call(this,a,b).slice().sort(d3.descending),d=j.call(this,a,b).slice().sort(d3.descending),o=k.call(this,a,b).slice().sort(d3.descending),p=d3.select(this),q=d3.scale.linear().domain([0,Math.max(c[0],d[0],o[0])]).range(g?[l,0]:[0,l]),r=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(q.range());this.__chart__=q;var s=f(r),t=f(q),u=p.selectAll("rect.range").data(c);u.enter().append("svg:rect").attr("class",function(a,b){return"range s"+b}).attr("width",s).attr("height",m).attr("x",g?r:0).transition().duration(h).attr("width",t).attr("x",g?q:0),u.transition().duration(h).attr("x",g?q:0).attr("width",t).attr("height",m);var v=p.selectAll("rect.measure").data(o);v.enter().append("svg:rect").attr("class",function(a,b){return"measure s"+b}).attr("width",s).attr("height",m/3).attr("x",g?r:0).attr("y",m/3).transition().duration(h).attr("width",t).attr("x",g?q:0),v.transition().duration(h).attr("width",t).attr("height",m/3).attr("x",g?q:0).attr("y",m/3);var w=p.selectAll("line.marker").data(d);w.enter().append("svg:line").attr("class","marker").attr("x1",r).attr("x2",r).attr("y1",m/6).attr("y2",m*5/6).transition().duration(h).attr("x1",q).attr("x2",q),w.transition().duration(h).attr("x1",q).attr("x2",q).attr("y1",m/6).attr("y2",m*5/6);var x=n||q.tickFormat(8),y=p.selectAll("g.tick").data(q.ticks(8),function(a){return this.textContent||x(a)}),z=y.enter().append("svg:g").attr("class","tick").attr("transform",e(r)).attr("opacity",1e-6);z.append("svg:line").attr("y1",m).attr("y2",m*7/6),z.append("svg:text").attr("text-anchor","middle").attr("dy","1em").attr("y",m*7/6).text(x),z.transition().duration(h).attr("transform",e(q)).attr("opacity",1);var A=y.transition().duration(h).attr("transform",e(q)).attr("opacity",1);A.select("line").attr("y1",m).attr("y2",m*7/6),A.select("text").attr("y",m*7/6),y.exit().transition().duration(h).attr("transform",e(q)).attr("opacity",1e-6).remove()})}var a="left",g=!1,h=0,i=b,j=c,k=d,l=380,m=30,n=null;o.orient=function(b){if(!arguments.length)return a;a=b,g=a=="right"||a=="bottom";return o},o.ranges=function(a){if(!arguments.length)return i;i=a;return o},o.markers=function(a){if(!arguments.length)return j;j=a;return o},o.measures=function(a){if(!arguments.length)return k;k=a;return o},o.width=function(a){if(!arguments.length)return l;l=a;return o},o.height=function(a){if(!arguments.length)return m;m=a;return o},o.tickFormat=function(a){if(!arguments.length)return n;n=a;return o},o.duration=function(a){if(!arguments.length)return h;h=a;return o};return o}})() <ide>\ No newline at end of file <ide><path>src/chart/boxplot.js <ide> d3.chart.boxplot = function() { <ide> <ide> // Compute the new x-scale. <ide> var x1 = d3.scale.linear() <del> .domain(domain || [min, max]) <add> .domain(domain ? domain.call(this, d, i) : [min, max]) <ide> .range([height, 0]); <ide> <ide> // Retrieve the old x-scale, if this is an update. <ide> d3.chart.boxplot = function() { <ide> <ide> boxplot.domain = function(x) { <ide> if (!arguments.length) return domain; <del> domain = x; <add> domain = d3.functor(x); <ide> return boxplot; <ide> }; <ide>
3
Javascript
Javascript
allow context menu when controls are disabled
d45a042cf962e9b1aa9441810ba118647b48aacb
<ide><path>examples/js/controls/OrbitControls.js <ide> THREE.OrbitControls = function ( object, domElement ) { <ide> <ide> function onContextMenu( event ) { <ide> <add> if ( scope.enabled === false ) return; <add> <ide> event.preventDefault(); <ide> <ide> }
1
Ruby
Ruby
pass the env hash into the builderror constructor
a607c71123ff42fe7060f8c49a12a247c13104a6
<ide><path>Library/Homebrew/exceptions.rb <ide> def message <ide> class BuildError < Homebrew::InstallationError <ide> attr_reader :command, :env <ide> <del> def initialize formula, cmd, args <add> def initialize(formula, cmd, args, env) <ide> @command = cmd <del> @env = ENV.to_hash <add> @env = env <ide> args = args.map{ |arg| arg.to_s.gsub " ", "\\ " }.join(" ") <ide> super formula, "Failed executing: #{command} #{args}" <ide> end <ide><path>Library/Homebrew/formula.rb <ide> def system cmd, *args <ide> log.puts <ide> require 'cmd/config' <ide> Homebrew.dump_build_config(log) <del> raise BuildError.new(self, cmd, args) <add> raise BuildError.new(self, cmd, args, ENV.to_hash) <ide> end <ide> ensure <ide> log.close unless log.closed?
2
Javascript
Javascript
remove unneeded `override_container_key`
9ee5e9cb327b716fe7b83c6daa1a6d215c79f1cc
<ide><path>packages/ember-runtime/lib/system/object.js <ide> import Observable from '../mixins/observable'; <ide> import { assert } from 'ember-debug'; <ide> import { DEBUG } from 'ember-env-flags'; <ide> <del>let OVERRIDE_CONTAINER_KEY = symbol('OVERRIDE_CONTAINER_KEY'); <ide> let OVERRIDE_OWNER = symbol('OVERRIDE_OWNER'); <ide> <ide> /** <ide> const EmberObject = CoreObject.extend(Observable, { <ide> _debugContainerKey: descriptor({ <ide> enumerable: false, <ide> get() { <del> if (this[OVERRIDE_CONTAINER_KEY]) { <del> return this[OVERRIDE_CONTAINER_KEY]; <del> } <del> <ide> let meta = peekMeta(this); <ide> let { factory } = meta; <ide>
1
Text
Text
fix title for v0.8.23 release
50be39792af00c2d1e2ce74bc50f5e561a8681a2
<ide><path>doc/blog/release/v0.8.23.md <ide> date: Mon Apr 8 17:32:26 PDT 2013 <ide> version: 0.8.23 <ide> category: release <del>title: Node v0.8.23 (Stable) <del>slug: node-v0-8-23-stable <add>title: Node v0.8.23 (Legacy) <add>slug: node-v0-8-23-legacy <ide> <del>2013.04.09, Version 0.8.23 (maintenance) <add>2013.04.09, Version 0.8.23 (Legacy) <ide> <ide> * npm: Upgrade to v1.2.18 <ide>
1
Python
Python
remove order_by from autofilterset
ab213cbc41114ec9417630d5298546102a706b96
<ide><path>rest_framework/filters.py <ide> class AutoFilterSet(self.default_filter_set): <ide> class Meta: <ide> model = queryset.model <ide> fields = filter_fields <del> order_by = True <ide> return AutoFilterSet <ide> <ide> return None
1
Python
Python
get language name first if no model path exists
5610fdcc064877174f383654b615c1c97b2ff96d
<ide><path>spacy/__init__.py <ide> def load(name, **overrides): <ide> model_name = resolve_model_name(name) <ide> model_path = data_path / model_name <ide> if not model_path.exists(): <add> lang_name = util.get_lang_class(name).lang <ide> model_path = None <ide> util.print_msg( <del> "Only loading the '{}' tokenizer.".format(name), <add> "Only loading the '{}' tokenizer.".format(lang_name), <ide> title="Warning: no model found for '{}'".format(name)) <ide> else: <ide> model_path = util.ensure_path(overrides['path'])
1
Text
Text
use consistent new lines
6924dac6cef7a0eae661903a17b1d35e22166c27
<ide><path>doc/guides/maintaining-V8.md <ide> Original commit message: <ide> Refs: https://github.com/v8/v8/commit/a51f429772d1e796744244128c9feeab4c26a854 <ide> PR-URL: https://github.com/nodejs/node/pull/7833 <ide> ``` <add> <ide> * Open a PR against the `v6.x-staging` branch in the Node.js repo. Launch the <ide> normal and [V8 CI] using the Node.js CI system. We only needed to backport to <ide> `v6.x` as the other LTS branches weren't affected by this bug. <ide><path>doc/guides/writing-and-running-benchmarks.md <ide> arrays/zero-int.js n=25 type=Buffer: 90.49906662339653 <ide> ``` <ide> <ide> It is possible to execute more groups by adding extra process arguments. <add> <ide> ```console <ide> $ node benchmark/run.js arrays buffers <ide> ``` <ide> function main(conf) { <ide> ``` <ide> <ide> Supported options keys are: <add> <ide> * `port` - defaults to `common.PORT` <ide> * `path` - defaults to `/` <ide> * `connections` - number of concurrent connections to use, defaults to 100 <ide><path>doc/guides/writing-tests.md <ide> the upstream project, send another PR here to update Node.js accordingly. <ide> Be sure to update the hash in the URL following `WPT Refs:`. <ide> <ide> ## C++ Unit test <add> <ide> C++ code can be tested using [Google Test][]. Most features in Node.js can be <ide> tested using the methods described previously in this document. But there are <ide> cases where these might not be enough, for example writing code for Node.js <ide> that will only be called when Node.js is embedded. <ide> <ide> ### Adding a new test <add> <ide> The unit test should be placed in `test/cctest` and be named with the prefix <ide> `test` followed by the name of unit being tested. For example, the code below <ide> would be placed in `test/cctest/test_env.cc`: <ide> static void at_exit_callback(void* arg) { <ide> ``` <ide> <ide> Next add the test to the `sources` in the `cctest` target in node.gyp: <add> <ide> ```console <ide> 'sources': [ <ide> 'test/cctest/test_env.cc', <ide> ... <ide> ], <ide> ``` <add> <ide> Note that the only sources that should be included in the cctest target are <ide> actual test or helper source files. There might be a need to include specific <ide> object files that are compiled by the `node` target and this can be done by <ide> adding them to the `libraries` section in the cctest target. <ide> <ide> The test can be executed by running the `cctest` target: <add> <ide> ```console <ide> $ make cctest <ide> ``` <ide><path>doc/onboarding-extras.md <ide> When things need extra attention, are controversial, or `semver-major`: <ide> <ide> If you cannot find who to cc for a file, `git shortlog -n -s <file>` may help. <ide> <del> <ide> ## Labels <ide> <ide> ### By Subsystem <ide> part(s) of the codebase it touches. <ide> <ide> There may be more than one subsystem valid for any particular issue / PR. <ide> <del> <ide> ### General <ide> <ide> Please use these when possible / appropriate <ide> need to be attached anymore, as only important bugfixes will be included. <ide> * `arm`, `mips`, `s390`, `ppc` <ide> * No x86{_64}, since that is the implied default <ide> <del> <ide> ## Updating Node.js from Upstream <ide> <ide> * `git remote add upstream git://github.com/nodejs/node.git` <ide> to update from nodejs/node: <ide> * `git remote update -p` OR `git fetch --all` (I prefer the former) <ide> * `git merge --ff-only upstream/master` (or `REMOTENAME/BRANCH`) <ide> <del> <ide> ## best practices <ide> <ide> * commit often, out to your github fork (origin), open a PR <ide><path>doc/onboarding.md <ide> onboarding session. <ide> [here](https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md). <ide> <ide> ## Reviewing PRs <add> <ide> * The primary goal is for the codebase to improve. <ide> * Secondary (but not far off) is for the person submitting code to succeed. A <ide> pull request from a new contributor is an opportunity to grow the community.
5
Ruby
Ruby
fix "uninitialized constant envconfig" errors
9f296aa6ac308a32f4602de4421fd2a0f561c103
<ide><path>Library/Homebrew/bintray.rb <ide> def open_api(url, *extra_curl_args, auth: true) <ide> args = extra_curl_args <ide> <ide> if auth <del> raise UsageError, "HOMEBREW_BINTRAY_USER is unset." unless (user = EnvConfig.bintray_user) <del> raise UsageError, "HOMEBREW_BINTRAY_KEY is unset." unless (key = EnvConfig.bintray_key) <add> raise UsageError, "HOMEBREW_BINTRAY_USER is unset." unless (user = Homebrew::EnvConfig.bintray_user) <add> raise UsageError, "HOMEBREW_BINTRAY_KEY is unset." unless (key = Homebrew::EnvConfig.bintray_key) <ide> <ide> args += ["--user", "#{user}:#{key}"] <ide> end
1
Python
Python
add tests of nextafter around 0
78df10f58d8963829865515f98695f04a1f76e00
<ide><path>numpy/core/tests/test_umath.py <ide> def test_nextafterf(): <ide> def test_nextafterl(): <ide> return _test_nextafter(np.longdouble) <ide> <add>def test_nextafter_0(): <add> for t, direction in itertools.product(np.sctypes['float'], (1, -1)): <add> tiny = np.finfo(t).tiny <add> assert_(0. < direction * np.nextafter(t(0), t(direction)) < tiny) <add> assert_equal(np.nextafter(t(0), t(direction)) / t(2.1), direction * 0.0) <add> <ide> def _test_spacing(t): <ide> one = t(1) <ide> eps = np.finfo(t).eps
1
Text
Text
add readline.emitkeypressevents note
ac3477971fda14db00dedec6ac752b6da8a07bf8
<ide><path>doc/api/readline.md <ide> autocompletion is disabled when copy-pasted input is detected. <ide> <ide> If the `stream` is a [TTY][], then it must be in raw mode. <ide> <add>*Note*: This is automatically called by any readline instance on its `input` <add>if the `input` is a terminal. Closing the `readline` instance does not stop <add>the `input` from emitting `'keypress'` events. <add> <ide> ```js <ide> readline.emitKeypressEvents(process.stdin); <ide> if (process.stdin.isTTY)
1
Javascript
Javascript
put legacy _handle accessors on prototypes
e83d7e8d88e48cb17a6517f0a85d6bc1480c9f3f
<ide><path>lib/internal/crypto/cipher.js <ide> function getUIntOption(options, key) { <ide> function createCipherBase(cipher, credential, options, decipher, iv) { <ide> const authTagLength = getUIntOption(options, 'authTagLength'); <ide> <del> legacyNativeHandle(this, new CipherBase(decipher)); <add> this[kHandle] = new CipherBase(decipher); <ide> if (iv === undefined) { <ide> this[kHandle].init(cipher, credential, authTagLength); <ide> } else { <ide> Cipher.prototype.setAAD = function setAAD(aadbuf, options) { <ide> return this; <ide> }; <ide> <add>legacyNativeHandle(Cipher); <add> <ide> function Cipheriv(cipher, key, iv, options) { <ide> if (!(this instanceof Cipheriv)) <ide> return new Cipheriv(cipher, key, iv, options); <ide> function addCipherPrototypeFunctions(constructor) { <ide> <ide> inherits(Cipheriv, LazyTransform); <ide> addCipherPrototypeFunctions(Cipheriv); <add>legacyNativeHandle(Cipheriv); <ide> <ide> function Decipher(cipher, password, options) { <ide> if (!(this instanceof Decipher)) <ide> function Decipher(cipher, password, options) { <ide> <ide> inherits(Decipher, LazyTransform); <ide> addCipherPrototypeFunctions(Decipher); <add>legacyNativeHandle(Decipher); <ide> <ide> <ide> function Decipheriv(cipher, key, iv, options) { <ide> function Decipheriv(cipher, key, iv, options) { <ide> <ide> inherits(Decipheriv, LazyTransform); <ide> addCipherPrototypeFunctions(Decipheriv); <add>legacyNativeHandle(Decipheriv); <ide> <ide> module.exports = { <ide> Cipher, <ide><path>lib/internal/crypto/diffiehellman.js <ide> function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) { <ide> else if (typeof generator !== 'number') <ide> generator = toBuf(generator, genEncoding); <ide> <del> legacyNativeHandle(this, new _DiffieHellman(sizeOrKey, generator)); <add> this[kHandle] = new _DiffieHellman(sizeOrKey, generator); <ide> Object.defineProperty(this, 'verifyError', { <ide> enumerable: true, <ide> value: this[kHandle].verifyError, <ide> function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) { <ide> function DiffieHellmanGroup(name) { <ide> if (!(this instanceof DiffieHellmanGroup)) <ide> return new DiffieHellmanGroup(name); <del> legacyNativeHandle(this, new _DiffieHellmanGroup(name)); <add> this[kHandle] = new _DiffieHellmanGroup(name); <ide> Object.defineProperty(this, 'verifyError', { <ide> enumerable: true, <ide> value: this[kHandle].verifyError, <ide> DiffieHellman.prototype.setPrivateKey = function setPrivateKey(key, encoding) { <ide> return this; <ide> }; <ide> <add>legacyNativeHandle(DiffieHellman); <add>legacyNativeHandle(DiffieHellmanGroup); <add> <ide> <ide> function ECDH(curve) { <ide> if (!(this instanceof ECDH)) <ide> return new ECDH(curve); <ide> <ide> validateString(curve, 'curve'); <del> legacyNativeHandle(this, new _ECDH(curve)); <add> this[kHandle] = new _ECDH(curve); <ide> } <ide> <ide> ECDH.prototype.computeSecret = DiffieHellman.prototype.computeSecret; <ide> ECDH.prototype.getPublicKey = function getPublicKey(encoding, format) { <ide> return encode(key, encoding); <ide> }; <ide> <add>legacyNativeHandle(ECDH); <add> <ide> ECDH.convertKey = function convertKey(key, curve, inEnc, outEnc, format) { <ide> if (typeof key !== 'string' && !isArrayBufferView(key)) { <ide> throw new ERR_INVALID_ARG_TYPE( <ide><path>lib/internal/crypto/hash.js <ide> function Hash(algorithm, options) { <ide> if (!(this instanceof Hash)) <ide> return new Hash(algorithm, options); <ide> validateString(algorithm, 'algorithm'); <del> legacyNativeHandle(this, new _Hash(algorithm)); <add> this[kHandle] = new _Hash(algorithm); <ide> this[kState] = { <ide> [kFinalized]: false <ide> }; <ide> Hash.prototype.digest = function digest(outputEncoding) { <ide> return ret; <ide> }; <ide> <add>legacyNativeHandle(Hash); <add> <ide> <ide> function Hmac(hmac, key, options) { <ide> if (!(this instanceof Hmac)) <ide> function Hmac(hmac, key, options) { <ide> throw new ERR_INVALID_ARG_TYPE('key', <ide> ['string', 'TypedArray', 'DataView'], key); <ide> } <del> legacyNativeHandle(this, new _Hmac()); <add> this[kHandle] = new _Hmac(); <ide> this[kHandle].init(hmac, toBuf(key)); <ide> this[kState] = { <ide> [kFinalized]: false <ide> Hmac.prototype.digest = function digest(outputEncoding) { <ide> Hmac.prototype._flush = Hash.prototype._flush; <ide> Hmac.prototype._transform = Hash.prototype._transform; <ide> <add>legacyNativeHandle(Hmac); <add> <ide> module.exports = { <ide> Hash, <ide> Hmac <ide><path>lib/internal/crypto/sig.js <ide> function Sign(algorithm, options) { <ide> if (!(this instanceof Sign)) <ide> return new Sign(algorithm, options); <ide> validateString(algorithm, 'algorithm'); <del> legacyNativeHandle(this, new _Sign()); <add> this[kHandle] = new _Sign(); <ide> this[kHandle].init(algorithm); <ide> <ide> Writable.call(this, options); <ide> Sign.prototype.update = function update(data, encoding) { <ide> return this; <ide> }; <ide> <add>legacyNativeHandle(Sign); <add> <ide> function getPadding(options) { <ide> return getIntOption('padding', RSA_PKCS1_PADDING, options); <ide> } <ide> function Verify(algorithm, options) { <ide> if (!(this instanceof Verify)) <ide> return new Verify(algorithm, options); <ide> validateString(algorithm, 'algorithm'); <del> legacyNativeHandle(this, new _Verify()); <add> this[kHandle] = new _Verify(); <ide> this[kHandle].init(algorithm); <ide> <ide> Writable.call(this, options); <ide> Verify.prototype.verify = function verify(options, signature, sigEncoding) { <ide> return this[kHandle].verify(key, signature, rsaPadding, pssSaltLength); <ide> }; <ide> <add>legacyNativeHandle(Verify); <add> <ide> module.exports = { <ide> Sign, <ide> Verify <ide><path>lib/internal/crypto/util.js <ide> const { <ide> <ide> const kHandle = Symbol('kHandle'); <ide> <del>function legacyNativeHandle(obj, handle) { <del> obj[kHandle] = handle; <del> Object.defineProperty(obj, '_handle', { <del> get: deprecate(() => handle, <del> `${obj.constructor.name}._handle is deprecated. Use the ` + <del> 'public API instead.', 'DEP0117'), <del> set: deprecate((h) => obj[kHandle] = handle = h, <del> `${obj.constructor.name}._handle is deprecated. Use the ` + <del> 'public API instead.', 'DEP0117'), <add>function legacyNativeHandle(clazz) { <add> Object.defineProperty(clazz.prototype, '_handle', { <add> get: deprecate(function() { return this[kHandle]; }, <add> `${clazz.name}._handle is deprecated. Use the public API ` + <add> 'instead.', 'DEP0117'), <add> set: deprecate(function(h) { this[kHandle] = h; }, <add> `${clazz.name}._handle is deprecated. Use the public API ` + <add> 'instead.', 'DEP0117'), <ide> enumerable: false <ide> }); <ide> }
5
Python
Python
use six.moves.range instead of range
b2fc63b3fcd1cd7732b732d07b108cec64bf75de
<ide><path>lm_1b/lm_1b_eval.py <ide> """ <ide> import os <ide> import sys <add>import six <ide> <ide> import numpy as np <ide> import tensorflow as tf <ide> def _SampleModel(prefix_words, vocab): <ide> <ide> prefix = [vocab.word_to_id(w) for w in prefix_words.split()] <ide> prefix_char_ids = [vocab.word_to_char_ids(w) for w in prefix_words.split()] <del> for _ in range(FLAGS.num_samples): <add> for _ in six.moves.range(FLAGS.num_samples): <ide> inputs = np.zeros([BATCH_SIZE, NUM_TIMESTEPS], np.int32) <ide> char_ids_inputs = np.zeros( <ide> [BATCH_SIZE, NUM_TIMESTEPS, vocab.max_word_length], np.int32) <ide> def _DumpEmb(vocab): <ide> sys.stderr.write('Finished softmax weights\n') <ide> <ide> all_embs = np.zeros([vocab.size, 1024]) <del> for i in range(vocab.size): <add> for i in six.moves.range(vocab.size): <ide> input_dict = {t['inputs_in']: inputs, <ide> t['targets_in']: targets, <ide> t['target_weights_in']: weights} <ide> def _DumpSentenceEmbedding(sentence, vocab): <ide> inputs = np.zeros([BATCH_SIZE, NUM_TIMESTEPS], np.int32) <ide> char_ids_inputs = np.zeros( <ide> [BATCH_SIZE, NUM_TIMESTEPS, vocab.max_word_length], np.int32) <del> for i in range(len(word_ids)): <add> for i in six.moves.range(len(word_ids)): <ide> inputs[0, 0] = word_ids[i] <ide> char_ids_inputs[0, 0, :] = char_ids[i] <ide>
1
Java
Java
fix checkstyle violations
f2a541511185dd960852d15b87fd18524dfc312b
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java <ide> else if (arg instanceof TypedStringValue) { <ide> * {@code null}) <ide> * @param parameterIndex the index of the parameter in the constructor or method <ide> * that declares the parameter <del> * @see #resolveDependency <ide> * @since 5.2 <add> * @see #resolveDependency <ide> */ <ide> public static boolean isAutowirable(Parameter parameter, int parameterIndex) { <ide> Assert.notNull(parameter, "Parameter must not be null"); <ide> public static boolean isAutowirable(Parameter parameter, int parameterIndex) { <ide> * the dependency (must not be {@code null}) <ide> * @return the resolved object, or {@code null} if none found <ide> * @throws BeansException if dependency resolution failed <add> * @since 5.2 <ide> * @see #isAutowirable <ide> * @see Autowired#required <ide> * @see SynthesizingMethodParameter#forExecutable(Executable, int) <ide> * @see AutowireCapableBeanFactory#resolveDependency(DependencyDescriptor, String) <del> * @since 5.2 <ide> */ <ide> @Nullable <ide> public static Object resolveDependency(
1
Python
Python
fix activity regularization in rnns
f9202817f3e2f65c83910015552da88969b44dbc
<ide><path>keras/__init__.py <ide> from __future__ import absolute_import <add> <add>from . import activations <add>from . import applications <ide> from . import backend <ide> from . import datasets <ide> from . import engine <ide><path>keras/layers/recurrent.py <ide> def __init__(self, units, <ide> self.kernel_regularizer = regularizers.get(kernel_regularizer) <ide> self.recurrent_regularizer = regularizers.get(recurrent_regularizer) <ide> self.bias_regularizer = regularizers.get(bias_regularizer) <add> self.activity_regularizer = regularizers.get(activity_regularizer) <ide> <ide> self.kernel_constraint = constraints.get(kernel_constraint) <ide> self.recurrent_constraint = constraints.get(recurrent_constraint) <ide> def get_config(self): <ide> 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), <ide> 'recurrent_regularizer': regularizers.serialize(self.recurrent_regularizer), <ide> 'bias_regularizer': regularizers.serialize(self.bias_regularizer), <add> 'activity_regularizer': regularizers.serialize(self.activity_regularizer), <ide> 'kernel_constraint': constraints.serialize(self.kernel_constraint), <ide> 'recurrent_constraint': constraints.serialize(self.recurrent_constraint), <ide> 'bias_constraint': constraints.serialize(self.bias_constraint), <ide> def __init__(self, units, <ide> self.kernel_regularizer = regularizers.get(kernel_regularizer) <ide> self.recurrent_regularizer = regularizers.get(recurrent_regularizer) <ide> self.bias_regularizer = regularizers.get(bias_regularizer) <add> self.activity_regularizer = regularizers.get(activity_regularizer) <ide> <ide> self.kernel_constraint = constraints.get(kernel_constraint) <ide> self.recurrent_constraint = constraints.get(recurrent_constraint) <ide> def get_config(self): <ide> 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), <ide> 'recurrent_regularizer': regularizers.serialize(self.recurrent_regularizer), <ide> 'bias_regularizer': regularizers.serialize(self.bias_regularizer), <add> 'activity_regularizer': regularizers.serialize(self.activity_regularizer), <ide> 'kernel_constraint': constraints.serialize(self.kernel_constraint), <ide> 'recurrent_constraint': constraints.serialize(self.recurrent_constraint), <ide> 'bias_constraint': constraints.serialize(self.bias_constraint), <ide> def __init__(self, units, <ide> self.kernel_regularizer = regularizers.get(kernel_regularizer) <ide> self.recurrent_regularizer = regularizers.get(recurrent_regularizer) <ide> self.bias_regularizer = regularizers.get(bias_regularizer) <add> self.activity_regularizer = regularizers.get(activity_regularizer) <ide> <ide> self.kernel_constraint = constraints.get(kernel_constraint) <ide> self.recurrent_constraint = constraints.get(recurrent_constraint) <ide> def get_config(self): <ide> 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer), <ide> 'recurrent_regularizer': regularizers.serialize(self.recurrent_regularizer), <ide> 'bias_regularizer': regularizers.serialize(self.bias_regularizer), <add> 'activity_regularizer': regularizers.serialize(self.activity_regularizer), <ide> 'kernel_constraint': constraints.serialize(self.kernel_constraint), <ide> 'recurrent_constraint': constraints.serialize(self.recurrent_constraint), <ide> 'bias_constraint': constraints.serialize(self.bias_constraint), <ide><path>keras/utils/vis_utils.py <ide> """Utilities related to model visualization.""" <ide> import os <ide> <del>from ..layers.wrappers import Wrapper <del>from ..models import Sequential <del> <ide> try: <ide> # pydot-ng is a fork of pydot that is better maintained. <ide> import pydot_ng as pydot <ide> def model_to_dot(model, show_shapes=False, show_layer_names=True): <ide> # Returns <ide> A `pydot.Dot` instance representing the Keras model. <ide> """ <add> from ..layers.wrappers import Wrapper <add> from ..models import Sequential <add> <ide> _check_pydot() <ide> dot = pydot.Dot() <ide> dot.set('rankdir', 'TB') <ide><path>tests/keras/layers/recurrent_test.py <ide> def test_regularizer(layer_class): <ide> batch_input_shape=(num_samples, timesteps, embedding_dim), <ide> kernel_regularizer=regularizers.l1(0.01), <ide> recurrent_regularizer=regularizers.l1(0.01), <add> activity_regularizer='l1', <ide> bias_regularizer='l2') <ide> layer.build((None, None, 2)) <ide> assert len(layer.losses) == 3 <ide> layer(K.variable(np.ones((2, 3, 2)))) <del> assert len(layer.losses) == 3 <add> assert len(layer.losses) == 4 <ide> <ide> <ide> @keras_test
4
Text
Text
update documentation for compose/swarm/network
fe1f210c42ba2978bd00450d2e91b23f040b8e5e
<ide><path>experimental/compose_swarm_networking.md <ide> You’ll also need a [Docker Hub](https://hub.docker.com/account/signup/) accoun <ide> <ide> Set the `DIGITALOCEAN_ACCESS_TOKEN` environment variable to a valid Digital Ocean API token, which you can generate in the [API panel](https://cloud.digitalocean.com/settings/applications). <ide> <del> DIGITALOCEAN_ACCESS_TOKEN=abc12345 <add> export DIGITALOCEAN_ACCESS_TOKEN=abc12345 <ide> <ide> Start a consul server: <ide> <del> docker-machine create -d digitalocean --engine-install-url https://experimental.docker.com consul <del> docker $(docker-machine config consul) run -d -p 8500:8500 -h consul progrium/consul -server -bootstrap <add> docker-machine --debug create \ <add> -d digitalocean \ <add> --engine-install-url="https://experimental.docker.com" \ <add> consul <add> <add> docker $(docker-machine config consul) run -d \ <add> -p "8500:8500" \ <add> -h "consul" \ <add> progrium/consul -server -bootstrap <ide> <ide> (In a real world setting you’d set up a distributed consul, but that’s beyond the scope of this guide!) <ide> <ide> Create a Swarm token: <ide> <del> SWARM_TOKEN=$(docker run swarm create) <del> <del>Create a Swarm master: <del> <del> docker-machine create -d digitalocean --swarm --swarm-master --swarm-discovery=token://$SWARM_TOKEN --engine-install-url="https://experimental.docker.com" --digitalocean-image "ubuntu-14-10-x64" --engine-opt=default-network=overlay:multihost --engine-label=com.docker.network.driver.overlay.bind_interface=eth0 --engine-opt=kv-store=consul:$(docker-machine ip consul):8500 swarm-0 <add> export SWARM_TOKEN=$(docker run swarm create) <add> <add>Next, you create a Swarm master with Machine: <add> <add> docker-machine --debug create \ <add> -d digitalocean \ <add> --digitalocean-image="ubuntu-14-10-x64" \ <add> --engine-install-url="https://experimental.docker.com" \ <add> --engine-opt="default-network=overlay:multihost" \ <add> --engine-opt="kv-store=consul:$(docker-machine ip consul):8500" \ <add> --engine-label="com.docker.network.driver.overlay.bind_interface=eth0" \ <add> swarm-0 <add> <add>Usually Machine can create Swarms for you, but it doesn't yet fully support multi-host networks yet, so you'll have to start up the Swarm manually: <add> <add> docker $(docker-machine config swarm-0) run -d \ <add> --restart="always" \ <add> --net="bridge" \ <add> swarm:latest join \ <add> --addr "$(docker-machine ip swarm-0):2376" \ <add> "token://$SWARM_TOKEN" <add> <add> docker $(docker-machine config swarm-0) run -d \ <add> --restart="always" \ <add> --net="bridge" \ <add> -p "3376:3376" \ <add> -v "/etc/docker:/etc/docker" \ <add> swarm:latest manage \ <add> --tlsverify \ <add> --tlscacert="/etc/docker/ca.pem" \ <add> --tlscert="/etc/docker/server.pem" \ <add> --tlskey="/etc/docker/server-key.pem" \ <add> -H "tcp://0.0.0.0:3376" \ <add> --strategy spread \ <add> "token://$SWARM_TOKEN" <ide> <ide> Create a Swarm node: <ide> <del> docker-machine create -d digitalocean --swarm --swarm-discovery=token://$SWARM_TOKEN --engine-install-url="https://experimental.docker.com" --digitalocean-image "ubuntu-14-10-x64" --engine-opt=default-network=overlay:multihost --engine-label=com.docker.network.driver.overlay.bind_interface=eth0 --engine-opt=kv-store=consul:$(docker-machine ip consul):8500 --engine-label com.docker.network.driver.overlay.neighbor_ip=$(docker-machine ip swarm-0) swarm-1 <add> docker-machine --debug create \ <add> -d digitalocean \ <add> --digitalocean-image="ubuntu-14-10-x64" \ <add> --engine-install-url="https://experimental.docker.com" \ <add> --engine-opt="default-network=overlay:multihost" \ <add> --engine-opt="kv-store=consul:$(docker-machine ip consul):8500" \ <add> --engine-label="com.docker.network.driver.overlay.bind_interface=eth0" \ <add> --engine-label="com.docker.network.driver.overlay.neighbor_ip=$(docker-machine ip swarm-0)" \ <add> swarm-1 <add> <add> docker $(docker-machine config swarm-1) run -d \ <add> --restart="always" \ <add> --net="bridge" \ <add> swarm:latest join \ <add> --addr "$(docker-machine ip swarm-1):2376" \ <add> "token://$SWARM_TOKEN" <ide> <ide> You can create more Swarm nodes if you want - it’s best to give them sensible names (swarm-2, swarm-3, etc). <ide> <ide> Finally, point Docker at your swarm: <ide> <del> eval "$(docker-machine env --swarm swarm-0)" <add> export DOCKER_HOST=tcp://"$(docker-machine ip swarm-0):3376" <add> export DOCKER_TLS_VERIFY=1 <add> export DOCKER_CERT_PATH="$HOME/.docker/machine/machines/swarm-0" <ide> <ide> ## Run containers and get them communicating <ide>
1
PHP
PHP
fix missing class errors
962fe7c571ae7b7c38a95a796cb1d97bec65422c
<ide><path>lib/Cake/Test/Case/Controller/ComponentCollectionTest.php <ide> * @since CakePHP(tm) v 2.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <del> <add>App::uses('CakeResponse', 'Network'); <ide> App::uses('CookieComponent', 'Controller/Component'); <ide> App::uses('SecurityComponent', 'Controller/Component'); <ide> App::uses('ComponentCollection', 'Controller'); <ide><path>lib/Cake/Test/Case/Model/DbAclTest.php <ide> * @since CakePHP(tm) v 1.2.0.4206 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <del> <del>App::uses('AclComponent', 'Controller/Component'); <add>App::uses('DbAcl', 'Controller/Component/Acl'); <ide> App::uses('AclNode', 'Model'); <del>class_exists('AclComponent'); <ide> <ide> /** <ide> * DB ACL wrapper test class
2
Mixed
Ruby
add note regarding "trix-content" class
e0d57541ab9daae14eab6da82175b4a3160d1ed3
<ide><path>actiontext/app/helpers/action_text/tag_helper.rb <ide> module TagHelper <ide> # that Trix will write to on changes, so the content will be sent on form submissions. <ide> # <ide> # ==== Options <del> # * <tt>:class</tt> - Defaults to "trix-content" which ensures default styling is applied. <add> # * <tt>:class</tt> - Defaults to "trix-content" so that default styles will be applied. <add> # Setting this to a different value will prevent default styles from being applied. <ide> # <ide> # ==== Example <ide> # <ide><path>guides/source/action_text_overview.md <ide> end <ide> <ide> **Note:** you don't need to add a `content` field to your `messages` table. <ide> <del>Then refer to this field in the form for the model: <add>Then use [`rich_text_area`] to refer to this field in the form for the model: <ide> <ide> ```erb <ide> <%# app/views/messages/_form.html.erb %> <ide> class MessagesController < ApplicationController <ide> end <ide> ``` <ide> <add>[`rich_text_area`]: https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-rich_text_area <add> <ide> ## Rendering Rich Text content <ide> <ide> Action Text will sanitize and render rich content on your behalf.
2
PHP
PHP
add missing tests
e1e9772b6685ff1d0258282ebc70d57a38bcab7b
<ide><path>src/Console/Command/Task/ModelTask.php <ide> public function execute() { <ide> if (empty($this->args)) { <ide> $this->out(__d('cake_console', 'Choose a model to bake from the following:')); <ide> foreach ($this->listAll() as $table) { <del> $this->out('- ' . $table); <add> $this->out('- ' . $this->_modelName($table)); <ide> } <ide> return true; <ide> } <ide> public function getDisplayField($model) { <ide> */ <ide> public function getPrimaryKey($model) { <ide> if (!empty($this->params['primary-key'])) { <del> return (array)$this->params['primary-key']; <add> $fields = explode(',', $this->params['primary-key']); <add> return array_values(array_filter(array_map('trim', $fields))); <ide> } <ide> return (array)$model->primaryKey(); <ide> } <ide> public function getBehaviors($model) { <ide> return $behaviors; <ide> } <ide> <del>/** <del> * Generate a key value list of options and a prompt. <del> * <del> * @param array $options Array of options to use for the selections. indexes must start at 0 <del> * @param string $prompt Prompt to use for options list. <del> * @param integer $default The default option for the given prompt. <del> * @return integer Result of user choice. <del> */ <del> public function inOptions($options, $prompt = null, $default = null) { <del> $valid = false; <del> $max = count($options); <del> while (!$valid) { <del> $len = strlen(count($options) + 1); <del> foreach ($options as $i => $option) { <del> $this->out(sprintf("%${len}d. %s", $i + 1, $option)); <del> } <del> if (empty($prompt)) { <del> $prompt = __d('cake_console', 'Make a selection from the choices above'); <del> } <del> $choice = $this->in($prompt, null, $default); <del> if (intval($choice) > 0 && intval($choice) <= $max) { <del> $valid = true; <del> } <del> } <del> return $choice - 1; <del> } <del> <ide> /** <ide> * Bake an entity class. <ide> * <ide><path>tests/TestCase/Console/Command/Task/ModelTaskTest.php <ide> public function testFieldsWhiteList() { <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add>/** <add> * Test getting primary key <add> * <add> * @return void <add> */ <add> public function testGetPrimaryKey() { <add> $model = TableRegistry::get('BakeArticles'); <add> $result = $this->Task->getPrimaryKey($model); <add> $expected = ['id']; <add> $this->assertEquals($expected, $result); <add> <add> $this->Task->params['primary-key'] = 'id, , account_id'; <add> $result = $this->Task->getPrimaryKey($model); <add> $expected = ['id', 'account_id']; <add> $this->assertEquals($expected, $result); <add> } <ide> /** <ide> * test getting validation rules with the no-validation rule. <ide> * <ide> public function testGetBehaviors() { <ide> $this->assertEquals(['Timestamp'], $result); <ide> } <ide> <add>/** <add> * Test getDisplayField() method. <add> * <add> * @return void <add> */ <add> public function testGetDisplayField() { <add> $model = TableRegistry::get('BakeArticles'); <add> $result = $this->Task->getDisplayField($model); <add> $this->assertEquals('title', $result); <add> <add> $this->Task->params['display-field'] = 'custom'; <add> $result = $this->Task->getDisplayField($model); <add> $this->assertEquals('custom', $result); <add> } <add> <ide> /** <ide> * Ensure that the fixture object is correctly called. <ide> * <ide> public function testBakeEntityWithPlugin() { <ide> $this->Task->bakeEntity($model); <ide> } <ide> <add>/** <add> * test that execute with no args <add> * <add> * @return void <add> */ <add> public function testExecuteNoArgs() { <add> $this->_useMockedOut(); <add> $this->Task->connection = 'test'; <add> $this->Task->path = '/my/path/'; <add> <add> $this->Task->expects($this->at(0)) <add> ->method('out') <add> ->with($this->stringContains('Choose a model to bake from the following:')); <add> $this->Task->expects($this->at(1)) <add> ->method('out') <add> ->with('- BakeArticles'); <add> $this->Task->execute(); <add> } <add> <ide> /** <ide> * test that execute passes runs bake depending with named model. <ide> *
2
Javascript
Javascript
make `rsvpafter` a private randomized queue name
c345bfc40317d6d4e93c73ff34f42c431d379c5f
<ide><path>packages/ember-metal/lib/run_loop.js <add>import { privatize as P } from 'container'; <ide> import { assert, deprecate, isTesting } from 'ember-debug'; <ide> import { <ide> onErrorTarget <ide> const backburner = new Backburner( <ide> <ide> // used to re-throw unhandled RSVP rejection errors specifically in this <ide> // position to avoid breaking anything rendered in the other sections <del> 'rsvpAfter' <add> P`rsvpAfter` <ide> ], <ide> { <ide> sync: { <ide><path>packages/ember-runtime/lib/ext/rsvp.js <ide> import { <ide> getDispatchOverride <ide> } from 'ember-metal'; <ide> import { assert } from 'ember-debug'; <add>import { privatize as P } from 'container'; <ide> <ide> const backburner = run.backburner; <ide> <ide> RSVP.configure('async', (callback, promise) => { <ide> }); <ide> <ide> RSVP.configure('after', cb => { <del> backburner.schedule('rsvpAfter', null, cb); <add> backburner.schedule(P`rsvpAfter`, null, cb); <ide> }); <ide> <ide> RSVP.on('error', onerrorDefault);
2
Text
Text
add clarification of routing to a dynamic route
d0c57cf6b3473c2a280ab03059a24f20555e9d3f
<ide><path>docs/routing/dynamic-routes.md <ide> The `query` objects are as follows: <ide> - `pages/post/[pid].js` - Will match `/post/1`, `/post/abc`, etc. But not `/post/create` <ide> - `pages/post/[...slug].js` - Will match `/post/1/2`, `/post/a/b/c`, etc. But not `/post/create`, `/post/abc` <ide> - Pages that are statically optimized by [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md) will be hydrated without their route parameters provided, i.e `query` will be an empty object (`{}`). <add>- When routing to a dynamic route using `Link` or `router`, you will need to specify the `href` as the dynamic route, for example `/post/[pid]` and `as` as the decorator for the URL, for example `/post/abc`. <ide> <ide> After hydration, Next.js will trigger an update to your application to provide the route parameters in the `query` object.
1
Ruby
Ruby
show upgradeable dependents during dry run
bcdb0c769888dc1af4b4074fd237e98478779880
<ide><path>Library/Homebrew/cmd/install.rb <ide> def install <ide> Cleanup.install_formula_clean!(f) <ide> end <ide> <del> Upgrade.check_installed_dependents(args: args) <add> Upgrade.check_installed_dependents(installed_formulae, args: args) <ide> <ide> Homebrew.messages.display_messages(display_times: args.display_times?) <ide> rescue FormulaUnreadableError, FormulaClassUnavailableError, <ide><path>Library/Homebrew/cmd/reinstall.rb <ide> def reinstall <ide> Cleanup.install_formula_clean!(f) <ide> end <ide> <del> Upgrade.check_installed_dependents(args: args) <add> Upgrade.check_installed_dependents(formulae, args: args) <ide> <ide> if casks.any? <ide> Cask::Cmd::Reinstall.reinstall_casks( <ide><path>Library/Homebrew/cmd/upgrade.rb <ide> def upgrade_outdated_formulae(formulae, args:) <ide> <ide> Upgrade.upgrade_formulae(formulae_to_install, args: args) <ide> <del> Upgrade.check_installed_dependents(args: args) <add> Upgrade.check_installed_dependents(formulae_to_install, args: args) <ide> <ide> Homebrew.messages.display_messages(display_times: args.display_times?) <ide> end <ide><path>Library/Homebrew/upgrade.rb <ide> def check_broken_dependents(installed_formulae) <ide> end <ide> end <ide> <del> def check_installed_dependents(args:) <add> def check_installed_dependents(formulae, args:) <ide> return if Homebrew::EnvConfig.no_installed_dependents_check? <ide> <del> installed_formulae = FormulaInstaller.installed.to_a <add> installed_formulae = args.dry_run? ? formulae : FormulaInstaller.installed.to_a <ide> return if installed_formulae.empty? <ide> <ide> already_broken_dependents = check_broken_dependents(installed_formulae)
4
Mixed
Javascript
convert tooltip to a plugin
5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e
<ide><path>docs/configuration/tooltip.md <ide> Example: <ide> ```javascript <ide> /** <ide> * Custom positioner <del> * @function Chart.Tooltip.positioners.custom <add> * @function Tooltip.positioners.custom <ide> * @param elements {Chart.Element[]} the tooltip elements <ide> * @param eventPosition {Point} the position of the event in canvas coordinates <ide> * @returns {Point} the tooltip position <ide> */ <del>Chart.Tooltip.positioners.custom = function(elements, eventPosition) { <del> /** @type {Chart.Tooltip} */ <add>const tooltipPlugin = Chart.plugins.getAll().find(p => p.id === 'tooltip'); <add>tooltipPlugin.positioners.custom = function(elements, eventPosition) { <add> /** @type {Tooltip} */ <ide> var tooltip = this; <ide> <ide> /* ... */ <ide> Allows filtering of [tooltip items](#tooltip-item-interface). Must implement at <ide> <ide> ## Tooltip Callbacks <ide> <del>The tooltip label configuration is nested below the tooltip configuration using the `callbacks` key. The tooltip has the following callbacks for providing text. For all functions, `this` will be the tooltip object created from the `Chart.Tooltip` constructor. <add>The tooltip label configuration is nested below the tooltip configuration using the `callbacks` key. The tooltip has the following callbacks for providing text. For all functions, `this` will be the tooltip object created from the `Tooltip` constructor. <ide> <ide> All functions are called with the same arguments: a [tooltip item](#tooltip-item-interface) and the `data` object passed to the chart. All functions must return either a string or an array of strings. Arrays of strings are treated as multiple lines of text. <ide> <ide><path>docs/getting-started/v3-migration.md <ide> Animation system was completely rewritten in Chart.js v3. Each property can now <ide> * `Chart.Controller` <ide> * `Chart.prototype.generateLegend` <ide> * `Chart.types` <add>* `Chart.Tooltip` is now provided by the tooltip plugin. The positioners can be accessed from `tooltipPlugin.positioners` <ide> * `DatasetController.addElementAndReset` <ide> * `DatasetController.createMetaData` <ide> * `DatasetController.createMetaDataset` <ide><path>src/core/core.controller.js <ide> import layouts from './core.layouts'; <ide> import platform from '../platforms/platform'; <ide> import plugins from './core.plugins'; <ide> import scaleService from '../core/core.scaleService'; <del>import Tooltip from './core.tooltip'; <ide> <ide> const valueOrDefault = helpers.valueOrDefault; <ide> <ide> function updateConfig(chart) { <ide> chart._animationsDisabled = isAnimationDisabled(newOptions); <ide> chart.ensureScalesHaveIDs(); <ide> chart.buildOrUpdateScales(); <del> <del> chart.tooltip.initialize(); <ide> } <ide> <ide> const KNOWN_POSITIONS = new Set(['top', 'bottom', 'left', 'right', 'chartArea']); <ide> class Chart { <ide> me.resize(true); <ide> } <ide> <del> me.initToolTip(); <del> <ide> // After init plugin notification <ide> plugins.notify(me, 'afterInit'); <ide> <ide> class Chart { <ide> */ <ide> reset() { <ide> this.resetElements(); <del> this.tooltip.initialize(); <add> plugins.notify(this, 'reset'); <ide> } <ide> <ide> update(mode) { <ide> class Chart { <ide> layers[i].draw(me.chartArea); <ide> } <ide> <del> me._drawTooltip(); <del> <ide> plugins.notify(me, 'afterDraw'); <ide> } <ide> <ide> class Chart { <ide> plugins.notify(me, 'afterDatasetDraw', [args]); <ide> } <ide> <del> /** <del> * Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw` <del> * hook, in which case, plugins will not be called on `afterTooltipDraw`. <del> * @private <del> */ <del> _drawTooltip() { <del> const me = this; <del> const tooltip = me.tooltip; <del> const args = { <del> tooltip: tooltip <del> }; <del> <del> if (plugins.notify(me, 'beforeTooltipDraw', [args]) === false) { <del> return; <del> } <del> <del> tooltip.draw(me.ctx); <del> <del> plugins.notify(me, 'afterTooltipDraw', [args]); <del> } <del> <ide> /** <ide> * Get the single element that was clicked on <ide> * @return An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw <ide> class Chart { <ide> return this.canvas.toDataURL.apply(this.canvas, arguments); <ide> } <ide> <del> initToolTip() { <del> this.tooltip = new Tooltip({_chart: this}); <del> } <del> <ide> /** <ide> * @private <ide> */ <ide> class Chart { <ide> */ <ide> eventHandler(e) { <ide> const me = this; <del> const tooltip = me.tooltip; <ide> <ide> if (plugins.notify(me, 'beforeEvent', [e]) === false) { <ide> return; <ide> } <ide> <ide> me.handleEvent(e); <ide> <del> if (tooltip) { <del> tooltip.handleEvent(e); <del> } <del> <ide> plugins.notify(me, 'afterEvent', [e]); <ide> <ide> me.render(); <ide><path>src/core/core.plugins.js <ide> export default { <ide> * @param {Chart.Controller} chart - The chart instance. <ide> * @param {object} options - The plugin options. <ide> */ <add>/** <add> * @method IPlugin#reset <add> * @desc Called during chart reset <add> * @param {Chart.Controller} chart - The chart instance. <add> * @param {object} options - The plugin options. <add> * @since version 3.0.0 <add> */ <ide> /** <ide> * @method IPlugin#beforeDatasetsUpdate <ide> * @desc Called before updating the `chart` datasets. If any plugin returns `false`, <ide><path>src/index.js <ide> import pluginsCore from './core/core.plugins'; <ide> import Scale from './core/core.scale'; <ide> import scaleService from './core/core.scaleService'; <ide> import Ticks from './core/core.ticks'; <del>import Tooltip from './core/core.tooltip'; <ide> <ide> Chart.helpers = helpers; <ide> Chart._adapters = _adapters; <ide> Chart.plugins = pluginsCore; <ide> Chart.Scale = Scale; <ide> Chart.scaleService = scaleService; <ide> Chart.Ticks = Ticks; <del>Chart.Tooltip = Tooltip; <ide> <ide> // Register built-in scales <ide> import scales from './scales'; <ide><path>src/plugins/index.js <ide> import filler from './plugin.filler'; <ide> import legend from './plugin.legend'; <ide> import title from './plugin.title'; <add>import tooltip from './plugin.tooltip'; <ide> <ide> export default { <ide> filler, <ide> legend, <del> title <add> title, <add> tooltip <ide> }; <add><path>src/plugins/plugin.tooltip.js <del><path>src/core/core.tooltip.js <ide> 'use strict'; <ide> <del>import defaults from './core.defaults'; <del>import Element from './core.element'; <add>import Animations from '../core/core.animations'; <add>import defaults from '../core/core.defaults'; <add>import Element from '../core/core.element'; <add>import plugins from '../core/core.plugins'; <ide> import helpers from '../helpers/index'; <del>import Animations from './core.animations'; <ide> <ide> const valueOrDefault = helpers.valueOrDefault; <ide> const getRtlHelper = helpers.rtl.getRtlAdapter; <ide> class Tooltip extends Element { <ide> */ <ide> Tooltip.positioners = positioners; <ide> <del>export default Tooltip; <add>export default { <add> id: 'tooltip', <add> _element: Tooltip, <add> positioners, <add> <add> afterInit: function(chart) { <add> const tooltipOpts = chart.options.tooltips; <add> <add> if (tooltipOpts) { <add> chart.tooltip = new Tooltip({_chart: chart}); <add> } <add> }, <add> <add> beforeUpdate: function(chart) { <add> if (chart.tooltip) { <add> chart.tooltip.initialize(); <add> } <add> }, <add> <add> reset: function(chart) { <add> if (chart.tooltip) { <add> chart.tooltip.initialize(); <add> } <add> }, <add> <add> afterDraw: function(chart) { <add> const tooltip = chart.tooltip; <add> const args = { <add> tooltip <add> }; <add> <add> if (plugins.notify(chart, 'beforeTooltipDraw', [args]) === false) { <add> return; <add> } <add> <add> tooltip.draw(chart.ctx); <add> <add> plugins.notify(chart, 'afterTooltipDraw', [args]); <add> }, <add> <add> afterEvent: function(chart, e) { <add> if (chart.tooltip) { <add> chart.tooltip.handleEvent(e); <add> } <add> } <add>}; <ide><path>test/specs/global.namespace.tests.js <ide> describe('Chart namespace', function() { <ide> expect(Chart.Scale instanceof Object).toBeTruthy(); <ide> expect(Chart.scaleService instanceof Object).toBeTruthy(); <ide> expect(Chart.Ticks instanceof Object).toBeTruthy(); <del> expect(Chart.Tooltip instanceof Object).toBeTruthy(); <del> expect(Chart.Tooltip.positioners instanceof Object).toBeTruthy(); <ide> }); <ide> }); <ide> <add><path>test/specs/plugin.tooltip.tests.js <del><path>test/specs/core.tooltip.tests.js <ide> // Test the rectangle element <add>const tooltipPlugin = Chart.plugins.getAll().find(p => p.id === 'tooltip'); <add>const Tooltip = tooltipPlugin._element; <add> <ide> describe('Core.Tooltip', function() { <ide> describe('auto', jasmine.fixture.specs('core.tooltip')); <ide> <ide> describe('Core.Tooltip', function() { <ide> describe('positioners', function() { <ide> it('Should call custom positioner with correct parameters and scope', function(done) { <ide> <del> Chart.Tooltip.positioners.test = function() { <add> tooltipPlugin.positioners.test = function() { <ide> return {x: 0, y: 0}; <ide> }; <ide> <del> spyOn(Chart.Tooltip.positioners, 'test').and.callThrough(); <add> spyOn(tooltipPlugin.positioners, 'test').and.callThrough(); <ide> <ide> var chart = window.acquireChart({ <ide> type: 'line', <ide> describe('Core.Tooltip', function() { <ide> var datasetIndex = 0; <ide> var meta = chart.getDatasetMeta(datasetIndex); <ide> var point = meta.data[pointIndex]; <del> var fn = Chart.Tooltip.positioners.test; <add> var fn = tooltipPlugin.positioners.test; <ide> <ide> afterEvent(chart, 'mousemove', function() { <ide> expect(fn.calls.count()).toBe(1); <ide> expect(fn.calls.first().args[0] instanceof Array).toBe(true); <ide> expect(Object.prototype.hasOwnProperty.call(fn.calls.first().args[1], 'x')).toBe(true); <ide> expect(Object.prototype.hasOwnProperty.call(fn.calls.first().args[1], 'y')).toBe(true); <del> expect(fn.calls.first().object instanceof Chart.Tooltip).toBe(true); <add> expect(fn.calls.first().object instanceof Tooltip).toBe(true); <ide> <ide> done(); <ide> }); <ide> describe('Core.Tooltip', function() { <ide> ]; <ide> <ide> var mockContext = window.createMockContext(); <del> var tooltip = new Chart.Tooltip({ <add> var tooltip = new Tooltip({ <ide> _chart: { <ide> options: { <ide> tooltips: {
9
Python
Python
prevent etxtbsy errors
110e499fe7dc65429a2fade29fe1573c35d97059
<ide><path>tools/install.py <ide> def try_copy(path, dst): <ide> source_path, target_path = mkpaths(path, dst) <ide> print 'installing %s' % target_path <ide> try_mkdir_r(os.path.dirname(target_path)) <add> try_unlink(target_path) # prevent ETXTBSY errors <ide> return shutil.copy2(source_path, target_path) <ide> <ide> def try_remove(path, dst):
1
Ruby
Ruby
remove the compiler gcc-4.3
13816a56875225b65812817d548aec161d2395d9
<ide><path>Library/Homebrew/compilers.rb <ide> # @private <ide> module CompilerConstants <del> GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze <del> GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|[5-8])$/ <add> GNU_GCC_VERSIONS = %w[4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze <add> GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/ <ide> COMPILER_SYMBOL_MAP = { <ide> "gcc" => :gcc, <ide> "gcc-4.0" => :gcc_4_0, <ide> def inspect <ide> create(:gcc_4_0), <ide> create(:gcc_4_2), <ide> create(:clang) { build 425 }, <del> create(gcc: "4.3"), <ide> create(gcc: "4.4"), <ide> create(gcc: "4.5"), <ide> create(gcc: "4.6"), <ide> def inspect <ide> create(:clang) { build 600 }, <ide> create(:gcc_4_0), <ide> create(:gcc_4_2), <del> create(gcc: "4.3"), <ide> create(gcc: "4.4"), <ide> create(gcc: "4.5"), <ide> create(gcc: "4.6"),
1
Ruby
Ruby
feature detect based on ruby version
239f5606308a6ba11c6a591694eadc7920d4c4d1
<ide><path>actionview/lib/action_view/template/resolver.rb <ide> def query(path, details, formats) <ide> } <ide> end <ide> <del> if File.const_defined? :FNM_EXTGLOB <add> if RUBY_VERSION >= '2.2.0' <ide> def find_template_paths(query) <ide> Dir[query].reject { |filename| <ide> File.directory?(filename) ||
1
Text
Text
update examples for fs.access()
b4ca3a4dba8226ef380db20b8395fdb5cbffee19
<ide><path>doc/api/fs.md <ide> no effect on Windows (will behave like `fs.constants.F_OK`). <ide> <ide> The final argument, `callback`, is a callback function that is invoked with <ide> a possible error argument. If any of the accessibility checks fail, the error <del>argument will be an `Error` object. The following example checks if the file <del>`/etc/passwd` can be read and written by the current process. <add>argument will be an `Error` object. The following examples check if <add>`package.json` exists, and if it is readable or writable. <ide> <ide> ```js <del>fs.access('/etc/passwd', fs.constants.R_OK | fs.constants.W_OK, (err) => { <del> console.log(err ? 'no access!' : 'can read/write'); <add>const file = 'package.json'; <add> <add>// Check if the file exists in the current directory. <add>fs.access(file, fs.constants.F_OK, (err) => { <add> console.log(`${file} ${err ? 'does not exist' : 'exists'}`); <add>}); <add> <add>// Check if the file is readable. <add>fs.access(file, fs.constants.R_OK, (err) => { <add> console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); <add>}); <add> <add>// Check if the file is writable. <add>fs.access(file, fs.constants.W_OK, (err) => { <add> console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); <add>}); <add> <add>// Check if the file exists in the current directory, and if it is writable. <add>fs.access(file, fs.constants.F_OK | fs.constants.W_OK, (err) => { <add> if (err) { <add> console.error( <add> `${file} ${err.code === 'ENOENT' ? 'does not exist' : 'is read-only'}`); <add> } else { <add> console.log(`${file} exists, and it is writable`); <add> } <ide> }); <ide> ``` <ide>
1
Go
Go
add integration test for pulling a manifest list
ad6c1b76497c4b39953b5af28f83a21a2eb36bf7
<ide><path>integration-cli/docker_cli_pull_local_test.go <ide> package main <ide> <ide> import ( <add> "encoding/json" <ide> "fmt" <add> "io/ioutil" <add> "os" <ide> "os/exec" <add> "path/filepath" <add> "runtime" <ide> "strings" <ide> <add> "github.com/docker/distribution" <add> "github.com/docker/distribution/digest" <add> "github.com/docker/distribution/manifest" <add> "github.com/docker/distribution/manifest/manifestlist" <add> "github.com/docker/distribution/manifest/schema2" <ide> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/go-check/check" <ide> ) <ide> func (s *DockerRegistrySuite) TestPullFallbackOn404(c *check.C) { <ide> <ide> c.Assert(out, checker.Contains, "v1 ping attempt") <ide> } <add> <add>func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) { <add> pushDigest, err := setupImage(c) <add> c.Assert(err, checker.IsNil, check.Commentf("error setting up image")) <add> <add> // Inject a manifest list into the registry <add> manifestList := &manifestlist.ManifestList{ <add> Versioned: manifest.Versioned{ <add> SchemaVersion: 2, <add> MediaType: manifestlist.MediaTypeManifestList, <add> }, <add> Manifests: []manifestlist.ManifestDescriptor{ <add> { <add> Descriptor: distribution.Descriptor{ <add> Digest: "sha256:1a9ec845ee94c202b2d5da74a24f0ed2058318bfa9879fa541efaecba272e86b", <add> Size: 3253, <add> MediaType: schema2.MediaTypeManifest, <add> }, <add> Platform: manifestlist.PlatformSpec{ <add> Architecture: "bogus_arch", <add> OS: "bogus_os", <add> }, <add> }, <add> { <add> Descriptor: distribution.Descriptor{ <add> Digest: pushDigest, <add> Size: 3253, <add> MediaType: schema2.MediaTypeManifest, <add> }, <add> Platform: manifestlist.PlatformSpec{ <add> Architecture: runtime.GOARCH, <add> OS: runtime.GOOS, <add> }, <add> }, <add> }, <add> } <add> <add> manifestListJSON, err := json.MarshalIndent(manifestList, "", " ") <add> c.Assert(err, checker.IsNil, check.Commentf("error marshalling manifest list")) <add> <add> manifestListDigest := digest.FromBytes(manifestListJSON) <add> hexDigest := manifestListDigest.Hex() <add> <add> registryV2Path := filepath.Join(s.reg.dir, "docker", "registry", "v2") <add> <add> // Write manifest list to blob store <add> blobDir := filepath.Join(registryV2Path, "blobs", "sha256", hexDigest[:2], hexDigest) <add> err = os.MkdirAll(blobDir, 0755) <add> c.Assert(err, checker.IsNil, check.Commentf("error creating blob dir")) <add> blobPath := filepath.Join(blobDir, "data") <add> err = ioutil.WriteFile(blobPath, []byte(manifestListJSON), 0644) <add> c.Assert(err, checker.IsNil, check.Commentf("error writing manifest list")) <add> <add> // Add to revision store <add> revisionDir := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "revisions", "sha256", hexDigest) <add> err = os.Mkdir(revisionDir, 0755) <add> c.Assert(err, checker.IsNil, check.Commentf("error creating revision dir")) <add> revisionPath := filepath.Join(revisionDir, "link") <add> err = ioutil.WriteFile(revisionPath, []byte(manifestListDigest.String()), 0644) <add> c.Assert(err, checker.IsNil, check.Commentf("error writing revision link")) <add> <add> // Update tag <add> tagPath := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "tags", "latest", "current", "link") <add> err = ioutil.WriteFile(tagPath, []byte(manifestListDigest.String()), 0644) <add> c.Assert(err, checker.IsNil, check.Commentf("error writing tag link")) <add> <add> // Verify that the image can be pulled through the manifest list. <add> out, _ := dockerCmd(c, "pull", repoName) <add> <add> // The pull output includes "Digest: <digest>", so find that <add> matches := digestRegex.FindStringSubmatch(out) <add> c.Assert(matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out)) <add> pullDigest := matches[1] <add> <add> // Make sure the pushed and pull digests match <add> c.Assert(manifestListDigest.String(), checker.Equals, pullDigest) <add> <add> // Was the image actually created? <add> dockerCmd(c, "inspect", repoName) <add> <add> dockerCmd(c, "rmi", repoName) <add>}
1
PHP
PHP
add facade blocks
9ed157fbba83ff8925b01ee7de7c836ca97cd15c
<ide><path>src/Illuminate/Support/Facades/Storage.php <ide> * @method static array allDirectories(string|null $directory = null) <ide> * @method static bool makeDirectory(string $path) <ide> * @method static bool deleteDirectory(string $directory) <add> * @method static string url(string $path) <add> * @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = []) <ide> * @method static \Illuminate\Contracts\Filesystem\Filesystem assertExists(string|array $path) <ide> * @method static \Illuminate\Contracts\Filesystem\Filesystem assertMissing(string|array $path) <ide> *
1
Javascript
Javascript
add switch test component and more testids
d1f09f7390a89a951299b718e860ef0fdd3b8de9
<ide><path>packages/rn-tester/js/examples/Switch/SwitchExample.js <ide> class ColorSwitchExample extends React.Component<{...}, $FlowFixMeState> { <ide> return ( <ide> <View> <ide> <Switch <add> testID="initial-false-switch" <ide> onValueChange={value => this.setState({colorFalseSwitchIsOn: value})} <ide> style={{marginBottom: 10}} <ide> thumbColor="#0000ff" <ide> class ColorSwitchExample extends React.Component<{...}, $FlowFixMeState> { <ide> value={this.state.colorFalseSwitchIsOn} <ide> /> <ide> <Switch <add> testID="initial-true-switch" <ide> onValueChange={value => this.setState({colorTrueSwitchIsOn: value})} <ide> thumbColor="#0000ff" <ide> trackColor={{ <ide> class EventSwitchExample extends React.Component<{...}, $FlowFixMeState> { <ide> <View style={{flexDirection: 'row', justifyContent: 'space-around'}}> <ide> <View> <ide> <Switch <add> testID="event-switch-top" <ide> onValueChange={value => this.setState({eventSwitchIsOn: value})} <ide> style={{marginBottom: 10}} <ide> value={this.state.eventSwitchIsOn} <ide> /> <ide> <Switch <add> testID="event-switch-bottom" <ide> onValueChange={value => this.setState({eventSwitchIsOn: value})} <ide> style={{marginBottom: 10}} <ide> value={this.state.eventSwitchIsOn} <ide> class EventSwitchExample extends React.Component<{...}, $FlowFixMeState> { <ide> </View> <ide> <View> <ide> <Switch <add> testID="event-switch-regression-top" <ide> onValueChange={value => <ide> this.setState({eventSwitchRegressionIsOn: value}) <ide> } <ide> style={{marginBottom: 10}} <ide> value={this.state.eventSwitchRegressionIsOn} <ide> /> <ide> <Switch <add> testID="event-switch-regression-bottom" <ide> onValueChange={value => <ide> this.setState({eventSwitchRegressionIsOn: value}) <ide> } <ide> exports.description = 'Native boolean input'; <ide> exports.examples = [ <ide> { <ide> title: 'Switches can be set to true or false', <add> name: 'basic', <ide> render(): React.Element<any> { <ide> return <BasicSwitchExample />; <ide> }, <ide> }, <ide> { <ide> title: 'Switches can be disabled', <add> name: 'disabled', <ide> render(): React.Element<any> { <ide> return <DisabledSwitchExample />; <ide> }, <ide> }, <ide> { <ide> title: 'Change events can be detected', <add> name: 'events', <ide> render(): React.Element<any> { <ide> return <EventSwitchExample />; <ide> }, <ide> }, <ide> { <ide> title: 'Switches are controlled components', <add> name: 'controlled', <ide> render(): React.Element<any> { <del> return <Switch />; <add> return <Switch testID="controlled-switch" />; <ide> }, <ide> }, <ide> { <ide> title: 'Custom colors can be provided', <add> name: 'custom-colors', <ide> render(): React.Element<any> { <ide> return <ColorSwitchExample />; <ide> },
1
Text
Text
add active model info to 5.1 release notes
87367703b35bddf9b63cc96ced90a75e214e5a77
<ide><path>guides/source/5_1_release_notes.md <ide> Please refer to the [Changelog][active-model] for detailed changes. <ide> <ide> ### Removals <ide> <del>### Deprecations <add>* Removed deprecated methods in `ActiveModel::Errors`. <add> ([commit](https://github.com/rails/rails/commit/9de6457ab0767ebab7f2c8bc583420fda072e2bd)) <add> <add>* Removed deprecated `:tokenizer` option in the length validator. <add> ([commit](https://github.com/rails/rails/commit/6a78e0ecd6122a6b1be9a95e6c4e21e10e429513)) <add> <add>* Remove deprecated behavior that halts callbacks when the return value is false. <add> ([commit](https://github.com/rails/rails/commit/3a25cdca3e0d29ee2040931d0cb6c275d612dffe)) <ide> <ide> ### Notable changes <ide> <add>* The original string assigned to a model attribute is no longer incorrectly <add> frozen. <add> ([Pull Request](https://github.com/rails/rails/pull/28729)) <add> <ide> Active Job <ide> ----------- <ide>
1
Python
Python
improve performance of np.full (gh-16644)
14d3173931cd958495bf592e0078213a6a66ab1d
<ide><path>numpy/core/numeric.py <ide> def full(shape, fill_value, dtype=None, order='C'): <ide> <ide> """ <ide> if dtype is None: <del> dtype = array(fill_value).dtype <add> fill_value = asarray(fill_value) <add> dtype = fill_value.dtype <ide> a = empty(shape, dtype, order) <ide> multiarray.copyto(a, fill_value, casting='unsafe') <ide> return a <ide><path>numpy/core/tests/test_api.py <ide> def test_broadcast_arrays(): <ide> result = np.broadcast_arrays(a, b) <ide> assert_equal(result[0], np.array([(1, 2, 3), (1, 2, 3), (1, 2, 3)], dtype='u4,u4,u4')) <ide> assert_equal(result[1], np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], dtype='u4,u4,u4')) <add> <add>@pytest.mark.parametrize(["shape", "fill_value", "expected_output"], <add> [((2, 2), [5.0, 6.0], np.array([[5.0, 6.0], [5.0, 6.0]])), <add> ((3, 2), [1.0, 2.0], np.array([[1.0, 2.0], [1.0, 2.0], [1.0, 2.0]]))]) <add>def test_full_from_list(shape, fill_value, expected_output): <add> output = np.full(shape, fill_value) <add> assert_equal(output, expected_output)
2
Ruby
Ruby
revert a writer for `bindparam#value`
b691c2147565cd3e7c4574e01a00ded55317df8d
<ide><path>activerecord/lib/arel/nodes/bind_param.rb <ide> module Arel # :nodoc: all <ide> module Nodes <ide> class BindParam < Node <del> attr_accessor :value <add> attr_reader :value <ide> <ide> def initialize(value) <ide> @value = value
1
Ruby
Ruby
update upsert_all documentation [ci skip]
8049fa19fb0c0a390061ca9420d4495efd24249b
<ide><path>activerecord/lib/active_record/persistence.rb <ide> def upsert(attributes, returning: nil, unique_by: nil) <ide> # <ide> # ==== Examples <ide> # <del> # # Given a Unique Index on books.isbn and the following record: <add> # # Given a unique index on <tt>books.isbn</tt> and the following record: <ide> # Book.create!(title: 'Rework', author: 'David', isbn: '1') <ide> # <ide> # # Insert multiple records, allowing new records with the same ISBN <ide> def upsert(attributes, returning: nil, unique_by: nil) <ide> # Book.upsert_all([ <ide> # { title: 'Eloquent Ruby', author: 'Russ', isbn: '1' }, <ide> # { title: 'Clean Code', author: 'Robert', isbn: '2' } <del> # ], <del> # unique_by: { columns: %w[ isbn ] }) <add> # ], unique_by: { columns: %w[ isbn ] }) <ide> # <ide> def upsert_all(attributes, returning: nil, unique_by: nil) <ide> InsertAll.new(self, attributes, on_duplicate: :update, returning: returning, unique_by: unique_by).execute
1
Java
Java
remove cookie support from serverhttprequest
4c0490a070f1b70755384472a13a6bca9e210ca1
<ide><path>spring-web/src/main/java/org/springframework/http/Cookie.java <del>/* <del> * Copyright 2002-2013 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.http; <del> <del> <del>/** <del> * Representation of a cookie value parsed from a "Cookie" request header or a <del> * "Set-Cookie" response header. <del> * <del> * @author Rossen Stoyanchev <del> * @since 4.0 <del> * <del> * @see http://www.ietf.org/rfc/rfc2109.txt <del> */ <del>public interface Cookie { <del> <del> /** <del> * Returns the name of the cookie. <del> */ <del> String getName(); <del> <del> /** <del> * Returns the value of the cookie. <del> */ <del> String getValue(); <del> <del> /** <del> * Returns the path on the server to which the browser returns this cookie. <del> */ <del> String getPath(); <del> <del> /** <del> * Returns the comment describing the purpose of this cookie. <del> */ <del> String getComment(); <del> <del> /** <del> * Returns the domain name set for this cookie. <del> */ <del> String getDomain(); <del> <del> /** <del> * Returns the maximum age of the cookie, specified in seconds. <del> */ <del> int getMaxAge(); <del> <del> /** <del> * Returns <code>true</code> if the browser is sending cookies only over a <del> * secure protocol, or <code>false</code> if the browser can send cookies <del> * using any protocol. <del> */ <del> boolean isSecure(); <del> <del> /** <del> * Sets the version of the cookie protocol this cookie complies with. <del> */ <del> int getVersion(); <del> <del>} <ide><path>spring-web/src/main/java/org/springframework/http/server/ServerHttpRequest.java <ide> <ide> import java.net.InetSocketAddress; <ide> import java.security.Principal; <del>import java.util.Map; <ide> <del>import org.springframework.http.Cookie; <ide> import org.springframework.http.HttpInputMessage; <ide> import org.springframework.http.HttpRequest; <ide> import org.springframework.util.MultiValueMap; <ide> public interface ServerHttpRequest extends HttpRequest, HttpInputMessage { <ide> */ <ide> MultiValueMap<String, String> getQueryParams(); <ide> <del> /** <del> * Return the cookie values parsed from the "Cookie" request header. <del> */ <del> Map<String, Cookie> getCookies(); <del> <ide> /** <ide> * Return a {@link java.security.Principal} instance containing the name of the <ide> * authenticated user. If the user has not been authenticated, the method returns <ide><path>spring-web/src/main/java/org/springframework/http/server/ServletServerCookie.java <del>/* <del> * Copyright 2002-2012 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del>package org.springframework.http.server; <del> <del>import org.springframework.http.Cookie; <del> <del> <del>/** <del> * A {@link Cookie} that wraps a {@link javax.servlet.http.Cookie}. <del> * <del> * @author Rossen Stoyanchev <del> * @since 4.0 <del> */ <del>public class ServletServerCookie implements Cookie { <del> <del> private final javax.servlet.http.Cookie servletCookie; <del> <del> <del> public ServletServerCookie(javax.servlet.http.Cookie servletCookie) { <del> this.servletCookie = servletCookie; <del> } <del> <del> @Override <del> public String getName() { <del> return this.servletCookie.getName(); <del> } <del> <del> @Override <del> public String getValue() { <del> return this.servletCookie.getValue(); <del> } <del> <del> @Override <del> public String getPath() { <del> return this.servletCookie.getPath(); <del> } <del> <del> @Override <del> public String getComment() { <del> return this.servletCookie.getComment(); <del> } <del> <del> @Override <del> public String getDomain() { <del> return this.servletCookie.getDomain(); <del> } <del> <del> @Override <del> public int getMaxAge() { <del> return this.servletCookie.getMaxAge(); <del> } <del> <del> @Override <del> public boolean isSecure() { <del> return this.servletCookie.getSecure(); <del> } <del> <del> @Override <del> public int getVersion() { <del> return this.servletCookie.getVersion(); <del> } <del> <del> @Override <del> public String toString() { <del> return "ServletServerCookie [servletCookie=" + this.servletCookie + "]"; <del> } <del>} <ide><path>spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java <ide> import java.nio.charset.Charset; <ide> import java.security.Principal; <ide> import java.util.Arrays; <del>import java.util.Collections; <ide> import java.util.Enumeration; <ide> import java.util.HashMap; <ide> import java.util.Iterator; <ide> <ide> import javax.servlet.http.HttpServletRequest; <ide> <del>import org.springframework.http.Cookie; <ide> import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.HttpMethod; <ide> import org.springframework.http.MediaType; <ide> public class ServletServerHttpRequest implements ServerHttpRequest { <ide> <ide> private HttpHeaders headers; <ide> <del> private Map<String, Cookie> cookies; <del> <ide> private MultiValueMap<String, String> queryParams; <ide> <ide> private ServerHttpAsyncRequestControl asyncRequestControl; <ide> <add> <ide> /** <ide> * Construct a new instance of the ServletServerHttpRequest based on the given {@link HttpServletRequest}. <ide> * @param servletRequest the servlet request <ide> public InetSocketAddress getRemoteAddress() { <ide> return new InetSocketAddress(this.servletRequest.getRemoteHost(), this.servletRequest.getRemotePort()); <ide> } <ide> <del> @Override <del> public Map<String, Cookie> getCookies() { <del> if (this.cookies == null) { <del> this.cookies = new HashMap<String, Cookie>(); <del> if (this.servletRequest.getCookies() != null) { <del> for (javax.servlet.http.Cookie cookie : this.servletRequest.getCookies()) { <del> this.cookies.put(cookie.getName(), new ServletServerCookie(cookie)); <del> } <del> } <del> this.cookies = Collections.unmodifiableMap(this.cookies); <del> } <del> return this.cookies; <del> } <del> <ide> @Override <ide> public MultiValueMap<String, String> getQueryParams() { <ide> if (this.queryParams == null) { <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsService.java <ide> import java.util.concurrent.ConcurrentHashMap; <ide> import java.util.concurrent.ScheduledFuture; <ide> <del>import org.springframework.http.Cookie; <add>import org.springframework.http.HttpHeaders; <ide> import org.springframework.http.HttpMethod; <ide> import org.springframework.http.HttpStatus; <ide> import org.springframework.http.server.ServerHttpRequest; <ide> protected void handleTransportRequest(ServerHttpRequest request, ServerHttpRespo <ide> } <ide> <ide> if (transportType.sendsSessionCookie() && isDummySessionCookieEnabled()) { <del> Cookie cookie = request.getCookies().get("JSESSIONID"); <del> String value = (cookie != null) ? cookie.getValue() : "dummy"; <del> response.getHeaders().set("Set-Cookie", "JSESSIONID=" + value + ";path=/"); <add> String cookieValue = getJsessionIdCookieValue(request.getHeaders()); <add> response.getHeaders().set("Set-Cookie", "JSESSIONID=" + cookieValue + ";path=/"); <ide> } <ide> <ide> if (transportType.supportsCors()) { <ide> public void run() { <ide> }, getDisconnectDelay()); <ide> } <ide> <add> private String getJsessionIdCookieValue(HttpHeaders headers) { <add> List<String> rawCookies = headers.get("Cookie"); <add> if (!CollectionUtils.isEmpty(rawCookies)) { <add> for (String rawCookie : rawCookies) { <add> if (rawCookie.startsWith("JSESSIONID=")) { <add> int start = "JSESSIONID=".length(); <add> int end = rawCookie.indexOf(';'); <add> return (end != -1) ? rawCookie.substring(start, end) : rawCookie.substring(start); <add> } <add> } <add> } <add> return "dummy"; <add> } <add> <ide> <ide> private final SockJsServiceConfig sockJsServiceConfig = new SockJsServiceConfig() { <ide>
5
PHP
PHP
remove comment bloat from route\finder
0767fa50276240047a1747163b2368afb0250a95
<ide><path>system/route/finder.php <ide> public static function find($name) <ide> return static::$names[$name]; <ide> } <ide> <del> // We haven't located the route before, so we'll need to iterate through each <del> // route to find the matching name. <ide> $arrayIterator = new \RecursiveArrayIterator(static::$routes); <ide> $recursiveIterator = new \RecursiveIteratorIterator($arrayIterator); <ide>
1
Javascript
Javascript
remove unused variables
03e9f84933fe610b04b107cf1f83d17485e8906e
<ide><path>lib/_http_client.js <ide> var parsers = common.parsers; <ide> var freeParser = common.freeParser; <ide> var debug = common.debug; <ide> <del>var IncomingMessage = require('_http_incoming').IncomingMessage; <ide> var OutgoingMessage = require('_http_outgoing').OutgoingMessage; <ide> <ide> var Agent = require('_http_agent'); <ide><path>lib/_stream_transform.js <ide> var util = require('util'); <ide> util.inherits(Transform, Duplex); <ide> <ide> <del>function TransformState(options, stream) { <add>function TransformState(stream) { <ide> this.afterTransform = function(er, data) { <ide> return afterTransform(stream, er, data); <ide> }; <ide> function Transform(options) { <ide> <ide> Duplex.call(this, options); <ide> <del> this._transformState = new TransformState(options, this); <add> this._transformState = new TransformState(this); <ide> <ide> // when the writable side finishes, then flush out anything remaining. <ide> var stream = this; <ide><path>lib/_tls_legacy.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> var assert = require('assert'); <del>var crypto = require('crypto'); <ide> var events = require('events'); <ide> var stream = require('stream'); <ide> var tls = require('tls'); <ide> function onnewsession(key, session) { <ide> } <ide> <ide> <del>function onnewsessiondone() { <del> if (!this.server) return; <del> <del> // Cycle through data <del> this.cleartext.read(0); <del> this.encrypted.read(0); <del>} <del> <del> <ide> function onocspresponse(resp) { <ide> this.emit('OCSPResponse', resp); <ide> } <ide><path>lib/child_process.js <ide> function spawnSync(/*file, args, options*/) { <ide> var opts = normalizeSpawnArguments.apply(null, arguments); <ide> <ide> var options = opts.options; <del> var envPairs = opts.envPairs; <ide> <ide> var i; <ide> <ide><path>lib/domain.js <ide> function intercepted(_this, self, cb, fnargs) { <ide> return; <ide> } <ide> <del> var len = fnargs.length; <ide> var args = []; <ide> var i, ret; <ide> <ide> function bound(_this, self, cb, fnargs) { <ide> if (self._disposed) <ide> return; <ide> <del> var len = fnargs.length; <del> var args = []; <del> var i, ret; <add> var ret; <ide> <ide> self.enter(); <ide> if (fnargs.length > 0) <ide><path>lib/fs.js <ide> var kMaxLength = require('smalloc').kMaxLength; <ide> <ide> var O_APPEND = constants.O_APPEND || 0; <ide> var O_CREAT = constants.O_CREAT || 0; <del>var O_DIRECTORY = constants.O_DIRECTORY || 0; <ide> var O_EXCL = constants.O_EXCL || 0; <del>var O_NOCTTY = constants.O_NOCTTY || 0; <del>var O_NOFOLLOW = constants.O_NOFOLLOW || 0; <ide> var O_RDONLY = constants.O_RDONLY || 0; <ide> var O_RDWR = constants.O_RDWR || 0; <del>var O_SYMLINK = constants.O_SYMLINK || 0; <ide> var O_SYNC = constants.O_SYNC || 0; <ide> var O_TRUNC = constants.O_TRUNC || 0; <ide> var O_WRONLY = constants.O_WRONLY || 0; <ide><path>lib/http.js <ide> var util = require('util'); <ide> var EventEmitter = require('events').EventEmitter; <ide> <ide> <del>var incoming = require('_http_incoming'); <del>var IncomingMessage = exports.IncomingMessage = incoming.IncomingMessage; <add>exports.IncomingMessage = require('_http_incoming').IncomingMessage; <ide> <ide> <ide> var common = require('_http_common'); <ide> exports.METHODS = util._extend([], common.methods).sort(); <ide> exports.parsers = common.parsers; <ide> <ide> <del>var outgoing = require('_http_outgoing'); <del>var OutgoingMessage = exports.OutgoingMessage = outgoing.OutgoingMessage; <add>exports.OutgoingMessage = require('_http_outgoing').OutgoingMessage; <ide> <ide> <ide> var server = require('_http_server'); <ide> exports.STATUS_CODES = server.STATUS_CODES; <ide> <ide> var agent = require('_http_agent'); <ide> var Agent = exports.Agent = agent.Agent; <del>var globalAgent = exports.globalAgent = agent.globalAgent; <add>exports.globalAgent = agent.globalAgent; <ide> <ide> var client = require('_http_client'); <ide> var ClientRequest = exports.ClientRequest = client.ClientRequest; <ide><path>lib/net.js <ide> Socket.prototype._write = function(data, encoding, cb) { <ide> this._writeGeneric(false, data, encoding, cb); <ide> }; <ide> <del>// Important: this should have the same values as in src/stream_wrap.h <del>function getEncodingId(encoding) { <del> switch (encoding) { <del> case 'buffer': <del> return 0; <del> <del> case 'utf8': <del> case 'utf-8': <del> return 1; <del> <del> case 'ascii': <del> return 2; <del> <del> case 'ucs2': <del> case 'ucs-2': <del> case 'utf16le': <del> case 'utf-16le': <del> return 3; <del> <del> default: <del> return 0; <del> } <del>} <del> <ide> function createWriteReq(req, handle, data, encoding) { <ide> switch (encoding) { <ide> case 'buffer': <ide><path>lib/repl.js <ide> REPLServer.prototype.complete = function(line, callback) { <ide> } <ide> <ide> // Resolve expr and get its completions. <del> var obj, memberGroups = []; <add> var memberGroups = []; <ide> if (!expr) { <ide> // If context is instance of vm.ScriptContext <ide> // Get global vars synchronously <ide><path>lib/tracing.js <ide> var inErrorTick = false; <ide> <ide> // Needs to be the same as src/env.h <ide> var kHasListener = 0; <del>var kWatchedProviders = 1; <ide> <ide> // Flags to determine what async listeners are available. <ide> var HAS_CREATE_AL = 1 << 0; <ide> function unloadContext() { <ide> function runAsyncQueue(context) { <ide> var queue = new Array(); <ide> var data = new Array(); <del> var ccQueue, i, item, queueItem, value; <add> var ccQueue, i, queueItem, value; <ide> <ide> context._asyncQueue = queue; <ide> context._asyncData = data; <ide><path>lib/zlib.js <ide> Zlib.prototype._transform = function(chunk, encoding, cb) { <ide> } <ide> } <ide> <del> var self = this; <ide> this._processChunk(chunk, flushFlag, cb); <ide> }; <ide>
11
Ruby
Ruby
fix typo at form_helper docs [ci skip]
724db9eb6236eb21051d85438b62e452765ee291
<ide><path>actionview/lib/action_view/helpers/form_helper.rb <ide> def default_form_builder <ide> # end <ide> # <ide> # The above code creates a new method +div_radio_button+ which wraps a div <del> # around the a new radio button. Note that when options are passed in, you <del> # must called +objectify_options+ in order for the model object to get <add> # around the new radio button. Note that when options are passed in, you <add> # must call +objectify_options+ in order for the model object to get <ide> # correctly passed to the method. If +objectify_options+ is not called, <ide> # then the newly created helper will not be linked back to the model. <ide> #
1
Javascript
Javascript
add securepair for handling of a ssl/tls stream
1128c0bf67221b3b3d6ba729ee212648521c226d
<ide><path>lib/crypto.js <ide> exports.createVerify = function(algorithm) { <ide> }; <ide> <ide> exports.RootCaCerts = RootCaCerts; <add> <add>var securepair = require('securepair'); <add>exports.createPair = securepair.createSecurePair; <ide><path>lib/securepair.js <add>var util = require('util'); <add>var events = require('events'); <add>var stream = require('stream'); <add>var assert = process.assert; <add> <add>var debugLevel = parseInt(process.env.NODE_DEBUG, 16); <add> <add>function debug () { <add> if (debugLevel & 0x2) { <add> util.error.apply(this, arguments); <add> } <add>} <add> <add>/* Lazy Loaded crypto object */ <add>var SecureStream = null; <add> <add>/** <add> * Provides a pair of streams to do encrypted communication. <add> */ <add> <add>function SecurePair(credentials, is_server) <add>{ <add> if (!(this instanceof SecurePair)) { <add> return new SecurePair(credentials, is_server); <add> } <add> <add> var self = this; <add> <add> try { <add> SecureStream = process.binding('crypto').SecureStream; <add> } <add> catch (e) { <add> throw new Error('node.js not compiled with openssl crypto support.'); <add> } <add> <add> events.EventEmitter.call(this); <add> <add> this._secureEstablished = false; <add> this._is_server = is_server ? true : false; <add> this._enc_write_state = true; <add> this._clear_write_state = true; <add> this._done = false; <add> <add> var crypto = require("crypto"); <add> <add> if (!credentials) { <add> this.credentials = crypto.createCredentials(); <add> } <add> else { <add> this.credentials = credentials; <add> } <add> <add> if (!this._is_server) { <add> /* For clients, we will always have either a given ca list or be using default one */ <add> this.credentials.shouldVerify = true; <add> } <add> <add> this._secureEstablished = false; <add> this._encIn_pending = []; <add> this._clearIn_pending = []; <add> <add> this._ssl = new SecureStream(this.credentials.context, <add> this._is_server ? true : false, <add> this.credentials.shouldVerify); <add> <add> <add> /* Acts as a r/w stream to the cleartext side of the stream. */ <add> this.cleartext = new stream.Stream(); <add> <add> /* Acts as a r/w stream to the encrypted side of the stream. */ <add> this.encrypted = new stream.Stream(); <add> <add> this.cleartext.write = function(data) { <add> debug('clearIn data'); <add> self._clearIn_pending.push(data); <add> self._cycle(); <add> return self._cleartext_write_state; <add> }; <add> <add> this.cleartext.pause = function() { <add> self._cleartext_write_state = false; <add> }; <add> <add> this.cleartext.resume = function() { <add> self._cleartext_write_state = true; <add> }; <add> <add> this.cleartext.end = function(err) { <add> debug('cleartext end'); <add> if (!self._done) { <add> self._ssl.shutdown(); <add> self._cycle(); <add> } <add> self._destroy(err); <add> }; <add> <add> this.encrypted.write = function(data) { <add> debug('encIn data'); <add> self._encIn_pending.push(data); <add> self._cycle(); <add> return self._encrypted_write_state; <add> }; <add> <add> this.encrypted.pause = function() { <add> self._encrypted_write_state = false; <add> }; <add> <add> this.encrypted.resume = function() { <add> self._encrypted_write_state = true; <add> }; <add> <add> this.encrypted.end = function(err) { <add> debug('encrypted end'); <add> if (!self._done) { <add> self._ssl.shutdown(); <add> self._cycle(); <add> } <add> self._destroy(err); <add> }; <add> <add> this.cleartext.on('end', function(err) { <add> debug('clearIn end'); <add> if (!self._done) { <add> self._ssl.shutdown(); <add> self._cycle(); <add> } <add> self._destroy(err); <add> }); <add> <add> this.cleartext.on('close', function() { <add> debug('source close'); <add> self.emit('close'); <add> self._destroy(); <add> }); <add> <add> this.encrypted.on('end', function() { <add> if (!self._done) { <add> self._error(new Error('Encrypted stream ended before secure pair was done')); <add> } <add> }); <add> <add> this.encrypted.on('close', function() { <add> if (!self._done) { <add> self._error(new Error('Encrypted stream closed before secure pair was done')); <add> } <add> }); <add> <add> this.cleartext.on('drain', function() { <add> debug('source drain'); <add> self._cycle(); <add> self.encrypted.resume(); <add> }); <add> <add> this.encrypted.on('drain', function() { <add> debug('target drain'); <add> self._cycle(); <add> self.cleartext.resume(); <add> }); <add> <add> process.nextTick(function() { <add> self._ssl.start(); <add> self._cycle(); <add> }); <add>} <add> <add>util.inherits(SecurePair, events.EventEmitter); <add> <add>exports.createSecurePair = function(credentials, is_server) <add>{ <add> var pair = new SecurePair(credentials, is_server); <add> return pair; <add>}; <add> <add>/** <add> * Attempt to cycle OpenSSLs buffers in various directions. <add> * <add> * An SSL Connection can be viewed as four separate piplines, <add> * interacting with one has no connection to the behavoir of <add> * any of the other 3 -- This might not sound reasonable, <add> * but consider things like mid-stream renegotiation of <add> * the ciphers. <add> * <add> * The four pipelines, using terminology of the client (server is just reversed): <add> * 1) Encrypted Output stream (Writing encrypted data to peer) <add> * 2) Encrypted Input stream (Reading encrypted data from peer) <add> * 3) Cleartext Output stream (Decrypted content from the peer) <add> * 4) Cleartext Input stream (Cleartext content to send to the peer) <add> * <add> * This function attempts to pull any available data out of the Cleartext <add> * input stream (#4), and the Encrypted input stream (#2). Then it pushes <add> * any data available from the cleartext output stream (#3), and finally <add> * from the Encrypted output stream (#1) <add> * <add> * It is called whenever we do something with OpenSSL -- post reciving content, <add> * trying to flush, trying to change ciphers, or shutting down the connection. <add> * <add> * Because it is also called everywhere, we also check if the connection <add> * has completed negotiation and emit 'secure' from here if it has. <add> */ <add>SecurePair.prototype._cycle = function() { <add> if (this._done) { <add> return; <add> } <add> <add> var self = this; <add> var rv; <add> var tmp; <add> var bytesRead; <add> var bytesWritten; <add> var chunkBytes; <add> var chunk = null; <add> var pool = null; <add> <add> while (this._encIn_pending.length > 0) { <add> tmp = this._encIn_pending.shift(); <add> <add> try { <add> rv = this._ssl.encIn(tmp, 0, tmp.length); <add> } catch (e) { <add> return this._error(e); <add> } <add> <add> if (rv === 0) { <add> this._encIn_pending.unshift(tmp); <add> break; <add> } <add> <add> assert(rv === tmp.length); <add> } <add> <add> while (this._clearIn_pending.length > 0) { <add> tmp = this._clearIn_pending.shift(); <add> try { <add> rv = this._ssl.clearIn(tmp, 0, tmp.length); <add> } catch (e) { <add> return this._error(e); <add> } <add> <add> if (rv === 0) { <add> this._clearIn_pending.unshift(tmp); <add> break; <add> } <add> <add> assert(rv === tmp.length); <add> } <add> <add> function mover(reader, writer, checker) { <add> var bytesRead; <add> var pool; <add> var chunkBytes; <add> do { <add> bytesRead = 0; <add> chunkBytes = 0; <add> pool = new Buffer(4096); <add> pool.used = 0; <add> <add> do { <add> try { <add> chunkBytes = reader(pool, <add> pool.used + bytesRead, <add> pool.length - pool.used - bytesRead) <add> } catch (e) { <add> return self._error(e); <add> } <add> if (chunkBytes >= 0) { <add> bytesRead += chunkBytes; <add> } <add> } while ((chunkBytes > 0) && (pool.used + bytesRead < pool.length)); <add> <add> if (bytesRead > 0) { <add> chunk = pool.slice(0, bytesRead); <add> writer(chunk); <add> } <add> } while (checker(bytesRead)); <add> } <add> <add> mover( <add> function(pool, offset, length) { <add> return self._ssl.clearOut(pool, offset, length); <add> }, <add> function(chunk) { <add> self.cleartext.emit('data', chunk); <add> }, <add> function(bytesRead) { <add> return bytesRead > 0 && self._cleartext_write_state === true; <add> }); <add> <add> mover( <add> function(pool, offset, length) { <add> return self._ssl.encOut(pool, offset, length); <add> }, <add> function(chunk) { <add> self.encrypted.emit('data', chunk); <add> }, <add> function(bytesRead) { <add> return bytesRead > 0 && self._encrypted_write_state === true; <add> }); <add> <add> if (!this._secureEstablished && this._ssl.isInitFinished()) { <add> this._secureEstablished = true; <add> debug('secure established'); <add> this.emit('secure'); <add> this._cycle(); <add> } <add>}; <add> <add>SecurePair.prototype._destroy = function(err) <add>{ <add> if (!this._done) { <add> this._done = true; <add> this._ssl.close(); <add> delete this._ssl; <add> this.emit('end', err); <add> } <add>}; <add> <add>SecurePair.prototype._error = function (err) <add>{ <add> this.emit('error', err); <add>}; <add> <add>SecurePair.prototype.getPeerCertificate = function (err) <add>{ <add> return this._ssl.getPeerCertificate(); <add>}; <add> <add>SecurePair.prototype.getCipher = function (err) <add>{ <add> return this._ssl.getCurrentCipher(); <add>};
2
Javascript
Javascript
prevent the error callback from being called twice
813b5e78b0624e42bb2649694cd694f5c793d563
<ide><path>src/core.js <ide> function getPdf(arg, callback) { <ide> if ('progress' in params) <ide> xhr.onprogress = params.progress || undefined; <ide> <del> if ('error' in params) <add> var calledErrorBack = false; <add> <add> if ('error' in params && !calledErrorBack) { <add> calledErrorBack = true; <ide> xhr.onerror = params.error || undefined; <add> } <ide> <ide> xhr.onreadystatechange = function getPdfOnreadystatechange(e) { <ide> if (xhr.readyState === 4) { <ide> if (xhr.status === xhr.expected) { <ide> var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse || <ide> xhr.responseArrayBuffer || xhr.response); <ide> callback(data); <del> } else if (params.error) { <add> } else if (params.error && !calledErrorBack) { <add> calledErrorBack = true; <ide> params.error(e); <ide> } <ide> }
1
Javascript
Javascript
add fast path for simple url parsing
4b59db008cec1bfcca2783f4b27c630c9c3fdd73
<ide><path>lib/url.js <ide> function Url() { <ide> var protocolPattern = /^([a-z0-9.+-]+:)/i, <ide> portPattern = /:[0-9]*$/, <ide> <add> // Special case for a simple path URL <add> simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, <add> <ide> // RFC 2396: characters reserved for delimiting URLs. <ide> // We actually just auto-escape these. <ide> delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], <ide> Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { <ide> // This is to support parse stuff like " http://foo.com \n" <ide> rest = rest.trim(); <ide> <add> if (!slashesDenoteHost && hashSplit.length === 1) { <add> // Try fast path regexp <add> var simplePath = simplePathPattern.exec(rest); <add> if (simplePath) { <add> this.path = rest; <add> this.href = rest; <add> this.pathname = simplePath[1]; <add> if (simplePath[2]) { <add> this.search = simplePath[2]; <add> if (parseQueryString) { <add> this.query = querystring.parse(this.search); <add> } else { <add> this.query = this.search.substr(1); <add> } <add> } <add> return this; <add> } <add> } <add> <ide> var proto = protocolPattern.exec(rest); <ide> if (proto) { <ide> proto = proto[0];
1
Python
Python
fix apveyor tests
93d826e74ca9e056d211af920998da17f63eee92
<ide><path>t/unit/utils/test_sysinfo.py <ide> import os <del>import posix <add>import importlib <ide> <ide> import pytest <ide> <ide> from celery.utils.sysinfo import df, load_average <ide> <add>try: <add> posix = importlib.import_module('posix') <add>except Exception: <add> posix = None <add> <ide> <ide> @pytest.mark.skipif( <ide> not hasattr(os, 'getloadavg'),
1
Java
Java
use set.of() for constant sets where appropriate
917c41fd52f655fc4a7c4448e1164afd7e77d21a
<ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov <ide> private static final int STEP_REFERENCE_PCUT_BINDING = 7; <ide> private static final int STEP_FINISHED = 8; <ide> <del> private static final Set<String> singleValuedAnnotationPcds = new HashSet<>(); <add> private static final Set<String> singleValuedAnnotationPcds = Set.of( <add> "@this", <add> "@target", <add> "@within", <add> "@withincode", <add> "@annotation"); <add> <ide> private static final Set<String> nonReferencePointcutTokens = new HashSet<>(); <ide> <ide> <ide> static { <del> singleValuedAnnotationPcds.add("@this"); <del> singleValuedAnnotationPcds.add("@target"); <del> singleValuedAnnotationPcds.add("@within"); <del> singleValuedAnnotationPcds.add("@withincode"); <del> singleValuedAnnotationPcds.add("@annotation"); <del> <ide> Set<PointcutPrimitive> pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives(); <ide> for (PointcutPrimitive primitive : pointcutPrimitives) { <ide> nonReferencePointcutTokens.add(primitive.getName()); <ide><path>spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java <ide> import java.lang.reflect.Method; <ide> import java.lang.reflect.Proxy; <ide> import java.util.Arrays; <del>import java.util.HashSet; <ide> import java.util.Map; <ide> import java.util.Set; <ide> import java.util.concurrent.ConcurrentHashMap; <ide> public class AspectJExpressionPointcut extends AbstractExpressionPointcut <ide> implements ClassFilter, IntroductionAwareMethodMatcher, BeanFactoryAware { <ide> <del> private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES = new HashSet<>(); <del> <del> static { <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.ARGS); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.REFERENCE); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.THIS); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.TARGET); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.WITHIN); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_ANNOTATION); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_WITHIN); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_ARGS); <del> SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_TARGET); <del> } <del> <add> private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES = Set.of( <add> PointcutPrimitive.EXECUTION, <add> PointcutPrimitive.ARGS, <add> PointcutPrimitive.REFERENCE, <add> PointcutPrimitive.THIS, <add> PointcutPrimitive.TARGET, <add> PointcutPrimitive.WITHIN, <add> PointcutPrimitive.AT_ANNOTATION, <add> PointcutPrimitive.AT_WITHIN, <add> PointcutPrimitive.AT_ARGS, <add> PointcutPrimitive.AT_TARGET); <ide> <ide> private static final Log logger = LogFactory.getLog(AspectJExpressionPointcut.class); <ide> <ide><path>spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java <ide> package org.springframework.context.annotation; <ide> <ide> import java.io.IOException; <del>import java.util.HashSet; <ide> import java.util.Map; <ide> import java.util.Set; <ide> <ide> public abstract class ConfigurationClassUtils { <ide> <ide> private static final Log logger = LogFactory.getLog(ConfigurationClassUtils.class); <ide> <del> private static final Set<String> candidateIndicators = new HashSet<>(8); <add> private static final Set<String> candidateIndicators = Set.of( <add> Component.class.getName(), <add> ComponentScan.class.getName(), <add> Import.class.getName(), <add> ImportResource.class.getName()); <ide> <del> static { <del> candidateIndicators.add(Component.class.getName()); <del> candidateIndicators.add(ComponentScan.class.getName()); <del> candidateIndicators.add(Import.class.getName()); <del> candidateIndicators.add(ImportResource.class.getName()); <del> } <ide> <ide> /** <ide> * Initialize a configuration class proxy for the specified class. <ide><path>spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> import java.io.Serializable; <ide> import java.util.ArrayList; <del>import java.util.HashSet; <ide> import java.util.LinkedHashSet; <ide> import java.util.List; <ide> import java.util.Map; <ide> */ <ide> public class SpringValidatorAdapter implements SmartValidator, jakarta.validation.Validator { <ide> <del> private static final Set<String> internalAnnotationAttributes = new HashSet<>(4); <add> private static final Set<String> internalAnnotationAttributes = Set.of("message", "groups", "payload"); <ide> <del> static { <del> internalAnnotationAttributes.add("message"); <del> internalAnnotationAttributes.add("groups"); <del> internalAnnotationAttributes.add("payload"); <del> } <ide> <ide> @Nullable <ide> private jakarta.validation.Validator targetValidator; <ide><path>spring-core/src/main/java/org/springframework/core/CollectionFactory.java <ide> */ <ide> public final class CollectionFactory { <ide> <del> private static final Set<Class<?>> approximableCollectionTypes = new HashSet<>(); <add> private static final Set<Class<?>> approximableCollectionTypes = Set.of( <add> // Standard collection interfaces <add> Collection.class, <add> List.class, <add> Set.class, <add> SortedSet.class, <add> NavigableSet.class, <add> // Common concrete collection classes <add> ArrayList.class, <add> LinkedList.class, <add> HashSet.class, <add> LinkedHashSet.class, <add> TreeSet.class, <add> EnumSet.class); <ide> <del> private static final Set<Class<?>> approximableMapTypes = new HashSet<>(); <del> <del> <del> static { <del> // Standard collection interfaces <del> approximableCollectionTypes.add(Collection.class); <del> approximableCollectionTypes.add(List.class); <del> approximableCollectionTypes.add(Set.class); <del> approximableCollectionTypes.add(SortedSet.class); <del> approximableCollectionTypes.add(NavigableSet.class); <del> approximableMapTypes.add(Map.class); <del> approximableMapTypes.add(SortedMap.class); <del> approximableMapTypes.add(NavigableMap.class); <del> <del> // Common concrete collection classes <del> approximableCollectionTypes.add(ArrayList.class); <del> approximableCollectionTypes.add(LinkedList.class); <del> approximableCollectionTypes.add(HashSet.class); <del> approximableCollectionTypes.add(LinkedHashSet.class); <del> approximableCollectionTypes.add(TreeSet.class); <del> approximableCollectionTypes.add(EnumSet.class); <del> approximableMapTypes.add(HashMap.class); <del> approximableMapTypes.add(LinkedHashMap.class); <del> approximableMapTypes.add(TreeMap.class); <del> approximableMapTypes.add(EnumMap.class); <del> } <add> private static final Set<Class<?>> approximableMapTypes = Set.of( <add> // Standard map interfaces <add> Map.class, <add> SortedMap.class, <add> NavigableMap.class, <add> // Common concrete map classes <add> HashMap.class, <add> LinkedHashMap.class, <add> TreeMap.class, <add> EnumMap.class); <ide> <ide> <ide> private CollectionFactory() { <ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslator.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> package org.springframework.jdbc.support; <ide> <ide> import java.sql.SQLException; <del>import java.util.HashSet; <ide> import java.util.Set; <ide> <ide> import org.springframework.dao.ConcurrencyFailureException; <ide> */ <ide> public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLExceptionTranslator { <ide> <del> private static final Set<String> BAD_SQL_GRAMMAR_CODES = new HashSet<>(8); <del> <del> private static final Set<String> DATA_INTEGRITY_VIOLATION_CODES = new HashSet<>(8); <del> <del> private static final Set<String> DATA_ACCESS_RESOURCE_FAILURE_CODES = new HashSet<>(8); <del> <del> private static final Set<String> TRANSIENT_DATA_ACCESS_RESOURCE_CODES = new HashSet<>(8); <del> <del> private static final Set<String> CONCURRENCY_FAILURE_CODES = new HashSet<>(4); <del> <del> <del> static { <del> BAD_SQL_GRAMMAR_CODES.add("07"); // Dynamic SQL error <del> BAD_SQL_GRAMMAR_CODES.add("21"); // Cardinality violation <del> BAD_SQL_GRAMMAR_CODES.add("2A"); // Syntax error direct SQL <del> BAD_SQL_GRAMMAR_CODES.add("37"); // Syntax error dynamic SQL <del> BAD_SQL_GRAMMAR_CODES.add("42"); // General SQL syntax error <del> BAD_SQL_GRAMMAR_CODES.add("65"); // Oracle: unknown identifier <del> <del> DATA_INTEGRITY_VIOLATION_CODES.add("01"); // Data truncation <del> DATA_INTEGRITY_VIOLATION_CODES.add("02"); // No data found <del> DATA_INTEGRITY_VIOLATION_CODES.add("22"); // Value out of range <del> DATA_INTEGRITY_VIOLATION_CODES.add("23"); // Integrity constraint violation <del> DATA_INTEGRITY_VIOLATION_CODES.add("27"); // Triggered data change violation <del> DATA_INTEGRITY_VIOLATION_CODES.add("44"); // With check violation <del> <del> DATA_ACCESS_RESOURCE_FAILURE_CODES.add("08"); // Connection exception <del> DATA_ACCESS_RESOURCE_FAILURE_CODES.add("53"); // PostgreSQL: insufficient resources (e.g. disk full) <del> DATA_ACCESS_RESOURCE_FAILURE_CODES.add("54"); // PostgreSQL: program limit exceeded (e.g. statement too complex) <del> DATA_ACCESS_RESOURCE_FAILURE_CODES.add("57"); // DB2: out-of-memory exception / database not started <del> DATA_ACCESS_RESOURCE_FAILURE_CODES.add("58"); // DB2: unexpected system error <del> <del> TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("JW"); // Sybase: internal I/O error <del> TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("JZ"); // Sybase: unexpected I/O error <del> TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("S1"); // DB2: communication failure <del> <del> CONCURRENCY_FAILURE_CODES.add("40"); // Transaction rollback <del> CONCURRENCY_FAILURE_CODES.add("61"); // Oracle: deadlock <del> } <add> private static final Set<String> BAD_SQL_GRAMMAR_CODES = Set.of( <add> "07", // Dynamic SQL error <add> "21", // Cardinality violation <add> "2A", // Syntax error direct SQL <add> "37", // Syntax error dynamic SQL <add> "42", // General SQL syntax error <add> "65" // Oracle: unknown identifier <add> ); <add> <add> private static final Set<String> DATA_INTEGRITY_VIOLATION_CODES = Set.of( <add> "01", // Data truncation <add> "02", // No data found <add> "22", // Value out of range <add> "23", // Integrity constraint violation <add> "27", // Triggered data change violation <add> "44" // With check violation <add> ); <add> <add> private static final Set<String> DATA_ACCESS_RESOURCE_FAILURE_CODES = Set.of( <add> "08", // Connection exception <add> "53", // PostgreSQL: insufficient resources (e.g. disk full) <add> "54", // PostgreSQL: program limit exceeded (e.g. statement too complex) <add> "57", // DB2: out-of-memory exception / database not started <add> "58" // DB2: unexpected system error <add> ); <add> <add> private static final Set<String> TRANSIENT_DATA_ACCESS_RESOURCE_CODES = Set.of( <add> "JW", // Sybase: internal I/O error <add> "JZ", // Sybase: unexpected I/O error <add> "S1" // DB2: communication failure <add> ); <add> <add> private static final Set<String> CONCURRENCY_FAILURE_CODES = Set.of( <add> "40", // Transaction rollback <add> "61" // Oracle: deadlock <add> ); <ide> <ide> <ide> @Override <ide><path>spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java <ide> import java.lang.reflect.InvocationTargetException; <ide> import java.lang.reflect.Method; <ide> import java.lang.reflect.Proxy; <del>import java.util.HashSet; <ide> import java.util.LinkedHashMap; <ide> import java.util.Map; <ide> import java.util.Set; <ide> public abstract class SharedEntityManagerCreator { <ide> <ide> private static final Map<Class<?>, Class<?>[]> cachedQueryInterfaces = new ConcurrentReferenceHashMap<>(4); <ide> <del> private static final Set<String> transactionRequiringMethods = new HashSet<>(8); <del> <del> private static final Set<String> queryTerminatingMethods = new HashSet<>(8); <del> <del> static { <del> transactionRequiringMethods.add("joinTransaction"); <del> transactionRequiringMethods.add("flush"); <del> transactionRequiringMethods.add("persist"); <del> transactionRequiringMethods.add("merge"); <del> transactionRequiringMethods.add("remove"); <del> transactionRequiringMethods.add("refresh"); <del> <del> queryTerminatingMethods.add("execute"); // JPA 2.1 StoredProcedureQuery <del> queryTerminatingMethods.add("executeUpdate"); <del> queryTerminatingMethods.add("getSingleResult"); <del> queryTerminatingMethods.add("getResultStream"); <del> queryTerminatingMethods.add("getResultList"); <del> queryTerminatingMethods.add("list"); // Hibernate Query.list() method <del> } <add> private static final Set<String> transactionRequiringMethods = Set.of( <add> "joinTransaction", <add> "flush", <add> "persist", <add> "merge", <add> "remove", <add> "refresh"); <add> <add> private static final Set<String> queryTerminatingMethods = Set.of( <add> "execute", // JPA 2.1 StoredProcedureQuery <add> "executeUpdate", <add> "getSingleResult", <add> "getResultStream", <add> "getResultList", <add> "list" // Hibernate Query.list() method <add> ); <ide> <ide> <ide> /** <ide><path>spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesScanner.java <ide> public final class PersistenceManagedTypesScanner { <ide> <ide> private static final String PACKAGE_INFO_SUFFIX = ".package-info"; <ide> <del> private static final Set<AnnotationTypeFilter> entityTypeFilters; <add> private static final Set<AnnotationTypeFilter> entityTypeFilters = new LinkedHashSet<>(4); <ide> <ide> static { <del> entityTypeFilters = new LinkedHashSet<>(8); <ide> entityTypeFilters.add(new AnnotationTypeFilter(Entity.class, false)); <ide> entityTypeFilters.add(new AnnotationTypeFilter(Embeddable.class, false)); <ide> entityTypeFilters.add(new AnnotationTypeFilter(MappedSuperclass.class, false)); <ide><path>spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java <ide> public class MergedContextConfiguration implements Serializable { <ide> private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0]; <ide> <ide> private static final Set<Class<? extends ApplicationContextInitializer<?>>> EMPTY_INITIALIZER_CLASSES = <del> Collections.<Class<? extends ApplicationContextInitializer<?>>> emptySet(); <add> Collections.emptySet(); <ide> <del> private static final Set<ContextCustomizer> EMPTY_CONTEXT_CUSTOMIZERS = Collections.<ContextCustomizer> emptySet(); <add> private static final Set<ContextCustomizer> EMPTY_CONTEXT_CUSTOMIZERS = Collections.emptySet(); <ide> <ide> <ide> private final Class<?> testClass; <ide><path>spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java <ide> import java.io.InputStream; <ide> import java.io.OutputStream; <ide> import java.io.StringReader; <del>import java.util.HashSet; <ide> import java.util.Set; <ide> <ide> import javax.xml.parsers.DocumentBuilder; <ide> private static final XMLResolver NO_OP_XML_RESOLVER = <ide> (publicID, systemID, base, ns) -> InputStream.nullInputStream(); <ide> <del> private static final Set<Class<?>> SUPPORTED_CLASSES = new HashSet<>(8); <del> <del> static { <del> SUPPORTED_CLASSES.add(DOMSource.class); <del> SUPPORTED_CLASSES.add(SAXSource.class); <del> SUPPORTED_CLASSES.add(StAXSource.class); <del> SUPPORTED_CLASSES.add(StreamSource.class); <del> SUPPORTED_CLASSES.add(Source.class); <del> } <add> private static final Set<Class<?>> SUPPORTED_CLASSES = Set.of( <add> DOMSource.class, <add> SAXSource.class, <add> StAXSource.class, <add> StreamSource.class, <add> Source.class); <ide> <ide> <ide> private final TransformerFactory transformerFactory = TransformerFactory.newInstance(); <ide><path>spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.web.server.adapter; <ide> <del>import java.util.Arrays; <del>import java.util.HashSet; <ide> import java.util.Map; <ide> import java.util.Set; <ide> import java.util.function.Function; <ide> public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa <ide> private static final String DISCONNECTED_CLIENT_LOG_CATEGORY = <ide> "org.springframework.web.server.DisconnectedClient"; <ide> <del> // Similar declaration exists in AbstractSockJsSession.. <del> private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS = new HashSet<>( <del> Arrays.asList("AbortedException", "ClientAbortException", "EOFException", "EofException")); <add> // Similar declaration exists in AbstractSockJsSession. <add> private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS = <add> Set.of("AbortedException", "ClientAbortException", "EOFException", "EofException"); <ide> <ide> <ide> private static final Log logger = LogFactory.getLog(HttpWebHandlerAdapter.class); <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/SockJsClient.java <ide> import java.net.URI; <ide> import java.security.Principal; <ide> import java.util.ArrayList; <del>import java.util.HashSet; <ide> import java.util.List; <ide> import java.util.Map; <ide> import java.util.Set; <ide> public class SockJsClient implements WebSocketClient, Lifecycle { <ide> <ide> private static final Log logger = LogFactory.getLog(SockJsClient.class); <ide> <del> private static final Set<String> supportedProtocols = new HashSet<>(4); <del> <del> static { <del> supportedProtocols.add("ws"); <del> supportedProtocols.add("wss"); <del> supportedProtocols.add("http"); <del> supportedProtocols.add("https"); <del> } <add> private static final Set<String> supportedProtocols = Set.of("ws", "wss", "http", "https"); <ide> <ide> <ide> private final List<Transport> transports;
12
Python
Python
remove unnecessary copy of convolve inputs
8724ed764fbcab88b4962aeda23c84fba972ac4b
<ide><path>numpy/core/numeric.py <ide> def convolve(a,v,mode='full'): <ide> array([ 2.5]) <ide> <ide> """ <del> a, v = array(a, ndmin=1), array(v, ndmin=1) <add> a, v = array(a, copy=False, ndmin=1), array(v, copy=False, ndmin=1) <ide> if (len(v) > len(a)): <ide> a, v = v, a <ide> if len(a) == 0 : <ide><path>numpy/core/tests/test_numeric.py <ide> def test_object(self): <ide> z = np.correlate(self.y, self.x, 'full', old_behavior=self.old_behavior) <ide> assert_array_almost_equal(z, self.z2) <ide> <add> def test_no_overwrite(self): <add> d = np.ones(100) <add> k = np.ones(3) <add> np.correlate(d, k) <add> assert_array_equal(d, np.ones(100)) <add> assert_array_equal(k, np.ones(3)) <add> <ide> class TestCorrelate(_TestCorrelate): <ide> old_behavior = True <ide> def _setup(self, dt): <ide> def test_complex(self): <ide> z = np.correlate(y, x, 'full', old_behavior=self.old_behavior) <ide> assert_array_almost_equal(z, r_z) <ide> <add>class TestConvolve(TestCase): <add> def test_object(self): <add> d = [1.] * 100 <add> k = [1.] * 3 <add> assert_array_almost_equal(np.convolve(d, k)[2:-2], np.full(98, 3)) <add> <add> def test_no_overwrite(self): <add> d = np.ones(100) <add> k = np.ones(3) <add> np.convolve(d, k) <add> assert_array_equal(d, np.ones(100)) <add> assert_array_equal(k, np.ones(3)) <add> <ide> class TestArgwhere(object): <ide> def test_2D(self): <ide> x = np.arange(6).reshape((2, 3))
2
Mixed
Javascript
support some and every
5badf46f2a9363e6762900e18d4f85541738f738
<ide><path>doc/api/stream.md <ide> import { Resolver } from 'dns/promises'; <ide> await Readable.from([1, 2, 3, 4]).toArray(); // [1, 2, 3, 4] <ide> <ide> // Make dns queries concurrently using .map and collect <del>// the results into an aray using toArray <add>// the results into an array using toArray <ide> const dnsResults = await Readable.from([ <ide> 'nodejs.org', <ide> 'openjsf.org', <ide> const dnsResults = await Readable.from([ <ide> }, { concurrency: 2 }).toArray(); <ide> ``` <ide> <add>### `readable.some(fn[, options])` <add> <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>> Stability: 1 - Experimental <add> <add>* `fn` {Function|AsyncFunction} a function to call on each item of the stream. <add> * `data` {any} a chunk of data from the stream. <add> * `options` {Object} <add> * `signal` {AbortSignal} aborted if the stream is destroyed allowing to <add> abort the `fn` call early. <add>* `options` {Object} <add> * `concurrency` {number} the maximum concurrent invocation of `fn` to call <add> on the stream at once. **Default:** `1`. <add> * `signal` {AbortSignal} allows destroying the stream if the signal is <add> aborted. <add>* Returns: {Promise} a promise evaluating to `true` if `fn` returned a truthy <add> value for at least one of the chunks. <add> <add>This method is similar to `Array.prototype.some` and calls `fn` on each chunk <add>in the stream until the awaited return value is `true` (or any truthy value). <add>Once an `fn` call on a chunk awaited return value is truthy, the stream is <add>destroyed and the promise is fulfilled with `true`. If none of the `fn` <add>calls on the chunks return a truthy value, the promise is fulfilled with <add>`false`. <add> <add>```mjs <add>import { Readable } from 'stream'; <add>import { stat } from 'fs/promises'; <add> <add>// With a synchronous predicate. <add>await Readable.from([1, 2, 3, 4]).some((x) => x > 2); // true <add>await Readable.from([1, 2, 3, 4]).some((x) => x < 0); // false <add> <add>// With an asynchronous predicate, making at most 2 file checks at a time. <add>const anyBigFile = await Readable.from([ <add> 'file1', <add> 'file2', <add> 'file3', <add>]).some(async (fileName) => { <add> const stats = await stat(fileName); <add> return stat.size > 1024 * 1024; <add>}, { concurrency: 2 }); <add>console.log(anyBigFile); // `true` if any file in the list is bigger than 1MB <add>console.log('done'); // Stream has finished <add>``` <add> <add>### `readable.every(fn[, options])` <add> <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>> Stability: 1 - Experimental <add> <add>* `fn` {Function|AsyncFunction} a function to call on each item of the stream. <add> * `data` {any} a chunk of data from the stream. <add> * `options` {Object} <add> * `signal` {AbortSignal} aborted if the stream is destroyed allowing to <add> abort the `fn` call early. <add>* `options` {Object} <add> * `concurrency` {number} the maximum concurrent invocation of `fn` to call <add> on the stream at once. **Default:** `1`. <add> * `signal` {AbortSignal} allows destroying the stream if the signal is <add> aborted. <add>* Returns: {Promise} a promise evaluating to `true` if `fn` returned a truthy <add> value for all of the chunks. <add> <add>This method is similar to `Array.prototype.every` and calls `fn` on each chunk <add>in the stream to check if all awaited return values are truthy value for `fn`. <add>Once an `fn` call on a chunk awaited return value is falsy, the stream is <add>destroyed and the promise is fulfilled with `false`. If all of the `fn` calls <add>on the chunks return a truthy value, the promise is fulfilled with `true`. <add> <add>```mjs <add>import { Readable } from 'stream'; <add>import { stat } from 'fs/promises'; <add> <add>// With a synchronous predicate. <add>await Readable.from([1, 2, 3, 4]).every((x) => x > 2); // false <add>await Readable.from([1, 2, 3, 4]).every((x) => x > 0); // true <add> <add>// With an asynchronous predicate, making at most 2 file checks at a time. <add>const allBigFiles = await Readable.from([ <add> 'file1', <add> 'file2', <add> 'file3', <add>]).every(async (fileName) => { <add> const stats = await stat(fileName); <add> return stat.size > 1024 * 1024; <add>}, { concurrency: 2 }); <add>// `true` if all files in the list are bigger than 1MiB <add>console.log(allBigFiles); <add>console.log('done'); // Stream has finished <add>``` <add> <ide> ### Duplex and transform streams <ide> <ide> #### Class: `stream.Duplex` <ide><path>lib/internal/streams/operators.js <ide> const { <ide> AbortError, <ide> } = require('internal/errors'); <ide> const { validateInteger } = require('internal/validators'); <add>const { kWeakHandler } = require('internal/event_target'); <ide> <ide> const { <ide> ArrayPrototypePush, <ide> async function * map(fn, options) { <ide> const signalOpt = { signal }; <ide> <ide> const abort = () => ac.abort(); <add> if (options?.signal?.aborted) { <add> abort(); <add> } <add> <ide> options?.signal?.addEventListener('abort', abort); <ide> <ide> let next; <ide> async function * map(fn, options) { <ide> } <ide> } <ide> <add>async function some(fn, options) { <add> // https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.some <add> // Note that some does short circuit but also closes the iterator if it does <add> const ac = new AbortController(); <add> if (options?.signal) { <add> if (options.signal.aborted) { <add> ac.abort(); <add> } <add> options.signal.addEventListener('abort', () => ac.abort(), { <add> [kWeakHandler]: this, <add> once: true, <add> }); <add> } <add> const mapped = this.map(fn, { ...options, signal: ac.signal }); <add> for await (const result of mapped) { <add> if (result) { <add> ac.abort(); <add> return true; <add> } <add> } <add> return false; <add>} <add> <add>async function every(fn, options) { <add> if (typeof fn !== 'function') { <add> throw new ERR_INVALID_ARG_TYPE( <add> 'fn', ['Function', 'AsyncFunction'], fn); <add> } <add> // https://en.wikipedia.org/wiki/De_Morgan%27s_laws <add> return !(await some.call(this, async (x) => { <add> return !(await fn(x)); <add> }, options)); <add>} <add> <ide> async function forEach(fn, options) { <ide> if (typeof fn !== 'function') { <ide> throw new ERR_INVALID_ARG_TYPE( <ide> module.exports.streamReturningOperators = { <ide> }; <ide> <ide> module.exports.promiseReturningOperators = { <add> every, <ide> forEach, <ide> toArray, <add> some, <ide> }; <ide><path>test/parallel/test-stream-some-every.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const { <add> Readable, <add>} = require('stream'); <add>const assert = require('assert'); <add> <add>function oneTo5() { <add> return Readable.from([1, 2, 3, 4, 5]); <add>} <add> <add>function oneTo5Async() { <add> return oneTo5().map(async (x) => { <add> await Promise.resolve(); <add> return x; <add> }); <add>} <add>{ <add> // Some and every work with a synchronous stream and predicate <add> (async () => { <add> assert.strictEqual(await oneTo5().some((x) => x > 3), true); <add> assert.strictEqual(await oneTo5().every((x) => x > 3), false); <add> assert.strictEqual(await oneTo5().some((x) => x > 6), false); <add> assert.strictEqual(await oneTo5().every((x) => x < 6), true); <add> assert.strictEqual(await Readable.from([]).some((x) => true), false); <add> assert.strictEqual(await Readable.from([]).every((x) => true), true); <add> })().then(common.mustCall()); <add>} <add> <add>{ <add> // Some and every work with an asynchronous stream and synchronous predicate <add> (async () => { <add> assert.strictEqual(await oneTo5Async().some((x) => x > 3), true); <add> assert.strictEqual(await oneTo5Async().every((x) => x > 3), false); <add> assert.strictEqual(await oneTo5Async().some((x) => x > 6), false); <add> assert.strictEqual(await oneTo5Async().every((x) => x < 6), true); <add> })().then(common.mustCall()); <add>} <add> <add>{ <add> // Some and every work on asynchronous streams with an asynchronous predicate <add> (async () => { <add> assert.strictEqual(await oneTo5().some(async (x) => x > 3), true); <add> assert.strictEqual(await oneTo5().every(async (x) => x > 3), false); <add> assert.strictEqual(await oneTo5().some(async (x) => x > 6), false); <add> assert.strictEqual(await oneTo5().every(async (x) => x < 6), true); <add> })().then(common.mustCall()); <add>} <add> <add>{ <add> // Some and every short circuit <add> (async () => { <add> await oneTo5().some(common.mustCall((x) => x > 2, 3)); <add> await oneTo5().every(common.mustCall((x) => x < 3, 3)); <add> // When short circuit isn't possible the whole stream is iterated <add> await oneTo5().some(common.mustCall((x) => x > 6, 5)); <add> // The stream is destroyed afterwards <add> const stream = oneTo5(); <add> await stream.some(common.mustCall((x) => x > 2, 3)); <add> assert.strictEqual(stream.destroyed, true); <add> })().then(common.mustCall()); <add>} <add> <add>{ <add> // Support for AbortSignal <add> const ac = new AbortController(); <add> assert.rejects(Readable.from([1, 2, 3]).some( <add> () => new Promise(() => {}), <add> { signal: ac.signal } <add> ), { <add> name: 'AbortError', <add> }).then(common.mustCall()); <add> ac.abort(); <add>} <add>{ <add> // Support for pre-aborted AbortSignal <add> assert.rejects(Readable.from([1, 2, 3]).some( <add> () => new Promise(() => {}), <add> { signal: AbortSignal.abort() } <add> ), { <add> name: 'AbortError', <add> }).then(common.mustCall()); <add>} <add>{ <add> // Error cases <add> assert.rejects(async () => { <add> await Readable.from([1]).every(1); <add> }, /ERR_INVALID_ARG_TYPE/).then(common.mustCall()); <add> assert.rejects(async () => { <add> await Readable.from([1]).every((x) => x, { <add> concurrency: 'Foo' <add> }); <add> }, /ERR_OUT_OF_RANGE/).then(common.mustCall()); <add>}
3
Ruby
Ruby
add current ruby globals
d39280bdf7aca09ea7c6d9acf927bd95b6d1e499
<ide><path>Library/Homebrew/extend/fileutils.rb <ide> def copy_metadata(path) <ide> end <ide> end <ide> <del> RUBY_BIN = '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin' <del> <ide> def rake *args <del> system "#{RUBY_BIN}/rake", *args <add> system RUBY_BIN/'rake', *args <ide> end <ide> <ide> def ruby *args <del> system "#{RUBY_BIN}/ruby", *args <add> system RUBY_PATH, *args <ide> end <ide> end <ide><path>Library/Homebrew/formula_installer.rb <ide> def build <ide> begin <ide> read.close <ide> exec '/usr/bin/nice', <del> '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby', <add> RUBY_PATH, <ide> '-W0', <ide> '-I', Pathname.new(__FILE__).dirname, <ide> '-rbuild', <ide><path>Library/Homebrew/global.rb <ide> require 'utils' <ide> require 'exceptions' <ide> require 'set' <add>require 'rbconfig' <ide> <ide> ARGV.extend(HomebrewArgvExtension) <ide> <ide> def mkpath <ide> <ide> HOMEBREW_LOGS = Pathname.new('~/Library/Logs/Homebrew/').expand_path <ide> <add>RUBY_CONFIG = RbConfig::CONFIG <add>RUBY_BIN = Pathname.new("#{RUBY_CONFIG['bindir']}") <add>RUBY_PATH = RUBY_BIN/RUBY_CONFIG['ruby_install_name'] + RUBY_CONFIG['EXEEXT'] <add> <ide> if RUBY_PLATFORM =~ /darwin/ <ide> MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp <ide> MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f
3
PHP
PHP
fix return type
916f0d64df114f368a334451ec931bc5b886bca6
<ide><path>src/Datasource/ModelAwareTrait.php <ide> protected function _setModelClass($name) <ide> * <ide> * @param string|null $modelClass Name of model class to load. Defaults to $this->modelClass <ide> * @param string|null $modelType The type of repository to load. Defaults to the modelType() value. <del> * @return object The model instance created. <add> * @return \Cake\ORM\Table The model instance created. <ide> * @throws \Cake\Datasource\Exception\MissingModelException If the model class cannot be found. <ide> * @throws \InvalidArgumentException When using a type that has not been registered. <ide> * @throws \UnexpectedValueException If no model type has been defined
1
Javascript
Javascript
remove extra semicolons
0ec093cd410b8797b02055a445d650f72fd16796
<ide><path>lib/_debugger.js <ide> Client.prototype.mirrorObject = function(handle, depth, cb) { <ide> }); <ide> cb(null, mirror); <ide> } <del> }; <add> } <ide> }); <ide> return; <ide> } else if (handle.type === 'function') { <ide> function Interface(stdin, stdout, args) { <ide> } else { <ide> self.repl.context[key] = fn; <ide> } <del> }; <add> } <ide> <ide> // Copy all prototype methods in repl context <ide> // Setup them as getters if possible <ide><path>lib/events.js <ide> function listenerCount(type) { <ide> } <ide> <ide> return 0; <del>}; <add>} <ide> <ide> // About 1.5x faster than the two-arg version of Array#splice(). <ide> function spliceOne(list, index) { <ide><path>lib/net.js <ide> function createServerHandle(address, port, addressType, fd) { <ide> } <ide> <ide> return handle; <del>}; <add>} <ide> exports._createServerHandle = createServerHandle; <ide> <ide> <ide><path>lib/tls.js <ide> function convertProtocols(protocols) { <ide> }, 0); <ide> <ide> return buff; <del>}; <add>} <ide> <ide> exports.convertNPNProtocols = function(protocols, out) { <ide> // If protocols is Array - translate it into buffer <ide><path>test/common.js <ide> function leakedGlobals() { <ide> leaked.push(val); <ide> <ide> return leaked; <del>}; <add>} <ide> exports.leakedGlobals = leakedGlobals; <ide> <ide> // Turn this off if the test should not check for global leaks. <ide><path>test/debugger/helper-debugger-repl.js <ide> function addTest(input, output) { <ide> } else { <ide> quit(); <ide> } <del> }; <add> } <ide> expected.push({input: input, lines: output, callback: next}); <ide> } <ide> <ide><path>test/parallel/test-child-process-spawnsync-input.js <ide> var ret; <ide> function checkSpawnSyncRet(ret) { <ide> assert.strictEqual(ret.status, 0); <ide> assert.strictEqual(ret.error, undefined); <del>}; <add>} <ide> <ide> function verifyBufOutput(ret) { <ide> checkSpawnSyncRet(ret); <ide><path>test/parallel/test-http-1.0-keep-alive.js <ide> function check(tests) { <ide> current++; <ide> if (ctx.expectClose) return; <ide> conn.removeListener('close', onclose); <del> conn.removeListener('data', ondata);; <add> conn.removeListener('data', ondata); <ide> connected(); <ide> } <ide> conn.on('data', ondata); <ide><path>test/parallel/test-stream-big-packet.js <ide> var passed = false; <ide> <ide> function PassThrough() { <ide> stream.Transform.call(this); <del>}; <add>} <ide> util.inherits(PassThrough, stream.Transform); <ide> PassThrough.prototype._transform = function(chunk, encoding, done) { <ide> this.push(chunk); <ide> PassThrough.prototype._transform = function(chunk, encoding, done) { <ide> <ide> function TestStream() { <ide> stream.Transform.call(this); <del>}; <add>} <ide> util.inherits(TestStream, stream.Transform); <ide> TestStream.prototype._transform = function(chunk, encoding, done) { <ide> if (!passed) { <ide><path>test/parallel/test-stream-pipe-without-listenerCount.js <ide> r.on('error', common.mustCall(noop)); <ide> w.on('error', common.mustCall(noop)); <ide> r.pipe(w); <ide> <del>function noop() {}; <add>function noop() {} <ide><path>test/parallel/test-stream-writable-change-default-encoding.js <ide> var util = require('util'); <ide> function MyWritable(fn, options) { <ide> stream.Writable.call(this, options); <ide> this.fn = fn; <del>}; <add>} <ide> <ide> util.inherits(MyWritable, stream.Writable); <ide> <ide><path>test/parallel/test-stream-writable-decoded-encoding.js <ide> var util = require('util'); <ide> function MyWritable(fn, options) { <ide> stream.Writable.call(this, options); <ide> this.fn = fn; <del>}; <add>} <ide> <ide> util.inherits(MyWritable, stream.Writable); <ide> <ide> MyWritable.prototype._write = function(chunk, encoding, callback) { <ide> callback(); <ide> }; <ide> <del>;(function decodeStringsTrue() { <add>(function decodeStringsTrue() { <ide> var m = new MyWritable(function(isBuffer, type, enc) { <ide> assert(isBuffer); <ide> assert.equal(type, 'object'); <ide> MyWritable.prototype._write = function(chunk, encoding, callback) { <ide> m.end(); <ide> })(); <ide> <del>;(function decodeStringsFalse() { <add>(function decodeStringsFalse() { <ide> var m = new MyWritable(function(isBuffer, type, enc) { <ide> assert(!isBuffer); <ide> assert.equal(type, 'string'); <ide><path>test/parallel/test-stream2-base64-single-char-read-end.js <ide> src._read = function(n) { <ide> src.push(new Buffer('1')); <ide> src.push(null); <ide> }); <del> }; <add> } <ide> }; <ide> <ide> dst._write = function(chunk, enc, cb) { <ide><path>test/parallel/test-stream3-pause-then-read.js <ide> function read100() { <ide> function readn(n, then) { <ide> console.error('read %d', n); <ide> expectEndingData -= n; <del> ;(function read() { <add> (function read() { <ide> var c = r.read(n); <ide> if (!c) <ide> r.once('readable', read); <ide><path>test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js <ide> server.listen(common.PORT, common.localhostIPv4, function() { <ide> if (nbClientsEnded === 2) { <ide> server.close(); <ide> } <del> }; <add> } <ide> <ide> const client1 = net.connect({ port: common.PORT }); <ide> client1.on('end', addEndedClient); <ide><path>test/parallel/test-tls-alpn-server-client.js <ide> function runTest(clientsOptions, serverOptions, cb) { <ide> cb(results); <ide> } <ide> }); <del> }; <add> } <ide> <ide> } <ide> <ide><path>test/parallel/test-tls-npn-server-client.js <ide> function startTest() { <ide> <ide> callback(); <ide> }); <del> }; <add> } <ide> <ide> connectClient(clientsOptions[0], function() { <ide> connectClient(clientsOptions[1], function() { <ide><path>test/parallel/test-tls-sni-option.js <ide> function startTest() { <ide> else <ide> connectClient(i + 1, callback); <ide> } <del> }; <add> } <ide> <ide> connectClient(0, function() { <ide> server.close(); <ide><path>test/parallel/test-tls-sni-server-client.js <ide> function startTest() { <ide> // Continue <ide> start(); <ide> }); <del> }; <add> } <ide> <ide> start(); <ide> } <ide><path>test/parallel/test-url.js <ide> var throws = [ <ide> ]; <ide> for (var i = 0; i < throws.length; i++) { <ide> assert.throws(function() { url.format(throws[i]); }, TypeError); <del>}; <add>} <ide> assert(url.format('') === ''); <ide> assert(url.format({}) === ''); <ide><path>test/parallel/test-zlib-flush-drain.js <ide> deflater.flush(function(err) { <ide> }); <ide> <ide> deflater.on('drain', function() { <del> drainCount++;; <add> drainCount++; <ide> }); <ide> <ide> process.once('exit', function() { <ide><path>test/pummel/test-tls-server-large-request.js <ide> var options = { <ide> function Mediator() { <ide> stream.Writable.call(this); <ide> this.buf = ''; <del>}; <add>} <ide> util.inherits(Mediator, stream.Writable); <ide> <ide> Mediator.prototype._write = function write(data, enc, cb) { <ide><path>test/sequential/test-child-process-fork-getconnections.js <ide> if (process.argv[2] === 'child') { <ide> process.on('message', function(m, socket) { <ide> function sendClosed(id) { <ide> process.send({ id: id, status: 'closed'}); <del> }; <add> } <ide> <ide> if (m.cmd === 'new') { <ide> assert(socket); <ide> if (process.argv[2] === 'child') { <ide> }); <ide> sent++; <ide> child.send({ id: i, cmd: 'close' }); <del> }; <add> } <ide> <ide> let closeEmitted = false; <ide> server.on('close', function() { <ide><path>test/sequential/test-tcp-wrap-listen.js <ide> server.onconnection = function(err, client) { <ide> writeCount++; <ide> console.log('write ' + writeCount); <ide> maybeCloseClient(); <del> }; <add> } <ide> <ide> sliceCount++; <ide> } else {
24
Java
Java
add reference counting for undertowdatabuffer
cdd346222c1325ff0197159bc4e2ac5e7568a9e3
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpRequest.java <ide> import java.net.URISyntaxException; <ide> import java.nio.ByteBuffer; <ide> import java.nio.charset.Charset; <add>import java.util.concurrent.atomic.AtomicInteger; <ide> import java.util.function.IntPredicate; <ide> import javax.net.ssl.SSLSession; <ide> <ide> private static class UndertowDataBuffer implements PooledDataBuffer { <ide> <ide> private final PooledByteBuffer pooledByteBuffer; <ide> <add> private final AtomicInteger refCount; <add> <ide> public UndertowDataBuffer(DataBuffer dataBuffer, PooledByteBuffer pooledByteBuffer) { <ide> this.dataBuffer = dataBuffer; <ide> this.pooledByteBuffer = pooledByteBuffer; <add> this.refCount = new AtomicInteger(1); <add> } <add> <add> private UndertowDataBuffer(DataBuffer dataBuffer, PooledByteBuffer pooledByteBuffer, <add> AtomicInteger refCount) { <add> this.refCount = refCount; <add> this.dataBuffer = dataBuffer; <add> this.pooledByteBuffer = pooledByteBuffer; <ide> } <ide> <ide> @Override <ide> public boolean isAllocated() { <del> return this.pooledByteBuffer.isOpen(); <add> return this.refCount.get() > 0; <ide> } <ide> <ide> @Override <ide> public PooledDataBuffer retain() { <add> this.refCount.incrementAndGet(); <add> DataBufferUtils.retain(this.dataBuffer); <ide> return this; <ide> } <ide> <ide> @Override <ide> public boolean release() { <del> boolean result; <del> try { <del> result = DataBufferUtils.release(this.dataBuffer); <del> } <del> finally { <del> this.pooledByteBuffer.close(); <add> int refCount = this.refCount.decrementAndGet(); <add> if (refCount == 0) { <add> try { <add> return DataBufferUtils.release(this.dataBuffer); <add> } <add> finally { <add> this.pooledByteBuffer.close(); <add> } <ide> } <del> return result && this.pooledByteBuffer.isOpen(); <add> return false; <ide> } <ide> <ide> @Override <ide> public int writePosition() { <ide> <ide> @Override <ide> public DataBuffer writePosition(int writePosition) { <del> return this.dataBuffer.writePosition(writePosition); <add> this.dataBuffer.writePosition(writePosition); <add> return this; <ide> } <ide> <ide> @Override <ide> public int capacity() { <ide> <ide> @Override <ide> public DataBuffer capacity(int newCapacity) { <del> return this.dataBuffer.capacity(newCapacity); <add> this.dataBuffer.capacity(newCapacity); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer ensureCapacity(int capacity) { <del> return this.dataBuffer.ensureCapacity(capacity); <add> this.dataBuffer.ensureCapacity(capacity); <add> return this; <ide> } <ide> <ide> @Override <ide> public byte read() { <ide> <ide> @Override <ide> public DataBuffer read(byte[] destination) { <del> return this.dataBuffer.read(destination); <add> this.dataBuffer.read(destination); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer read(byte[] destination, int offset, int length) { <del> return this.dataBuffer.read(destination, offset, length); <add> this.dataBuffer.read(destination, offset, length); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer write(byte b) { <del> return this.dataBuffer.write(b); <add> this.dataBuffer.write(b); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer write(byte[] source) { <del> return this.dataBuffer.write(source); <add> this.dataBuffer.write(source); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer write(byte[] source, int offset, int length) { <del> return this.dataBuffer.write(source, offset, length); <add> this.dataBuffer.write(source, offset, length); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer write(DataBuffer... buffers) { <del> return this.dataBuffer.write(buffers); <add> this.dataBuffer.write(buffers); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer write(ByteBuffer... byteBuffers) { <del> return this.dataBuffer.write(byteBuffers); <add> this.dataBuffer.write(byteBuffers); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer write(CharSequence charSequence, Charset charset) { <del> return this.dataBuffer.write(charSequence, charset); <add> this.dataBuffer.write(charSequence, charset); <add> return this; <ide> } <ide> <ide> @Override <ide> public DataBuffer slice(int index, int length) { <del> return this.dataBuffer.slice(index, length); <add> DataBuffer slice = this.dataBuffer.slice(index, length); <add> return new UndertowDataBuffer(slice, this.pooledByteBuffer, this.refCount); <ide> } <ide> <ide> @Override
1
Javascript
Javascript
remove `inherits()` usage
dcc82b37b631d636e0fefc8272c357ec4a7d6df2
<ide><path>lib/_http_agent.js <ide> function Agent(options) { <ide> } <ide> }); <ide> } <del> <del>util.inherits(Agent, EventEmitter); <add>Object.setPrototypeOf(Agent.prototype, EventEmitter.prototype); <ide> <ide> Agent.defaultMaxSockets = Infinity; <ide> <ide><path>lib/_http_client.js <ide> function ClientRequest(input, options, cb) { <ide> <ide> this._deferToConnect(null, null, () => this._flush()); <ide> } <del> <del>util.inherits(ClientRequest, OutgoingMessage); <del> <add>Object.setPrototypeOf(ClientRequest.prototype, OutgoingMessage.prototype); <ide> <ide> ClientRequest.prototype._finish = function _finish() { <ide> DTRACE_HTTP_CLIENT_REQUEST(this, this.connection); <ide><path>lib/_http_incoming.js <ide> <ide> 'use strict'; <ide> <del>const util = require('util'); <ide> const Stream = require('stream'); <ide> <ide> function readStart(socket) { <ide> function IncomingMessage(socket) { <ide> // read by the user, so there's no point continuing to handle it. <ide> this._dumped = false; <ide> } <del>util.inherits(IncomingMessage, Stream.Readable); <del> <add>Object.setPrototypeOf(IncomingMessage.prototype, Stream.Readable.prototype); <ide> <ide> IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) { <ide> if (callback) <ide><path>lib/_http_outgoing.js <ide> function OutgoingMessage() { <ide> <ide> this._onPendingData = noopPendingOutput; <ide> } <del>util.inherits(OutgoingMessage, Stream); <add>Object.setPrototypeOf(OutgoingMessage.prototype, Stream.prototype); <ide> <ide> <ide> Object.defineProperty(OutgoingMessage.prototype, '_headers', { <ide><path>lib/_http_server.js <ide> function ServerResponse(req) { <ide> this.shouldKeepAlive = false; <ide> } <ide> } <del>util.inherits(ServerResponse, OutgoingMessage); <add>Object.setPrototypeOf(ServerResponse.prototype, OutgoingMessage.prototype); <ide> <ide> ServerResponse.prototype._finish = function _finish() { <ide> DTRACE_HTTP_SERVER_RESPONSE(this.connection); <ide><path>lib/_stream_duplex.js <ide> <ide> module.exports = Duplex; <ide> <del>const util = require('util'); <ide> const Readable = require('_stream_readable'); <ide> const Writable = require('_stream_writable'); <ide> <del>util.inherits(Duplex, Readable); <add>Object.setPrototypeOf(Duplex.prototype, Readable.prototype); <ide> <ide> { <ide> // Allow the keys array to be GC'ed. <ide><path>lib/_stream_passthrough.js <ide> module.exports = PassThrough; <ide> <ide> const Transform = require('_stream_transform'); <del>const util = require('util'); <del>util.inherits(PassThrough, Transform); <add>Object.setPrototypeOf(PassThrough.prototype, Transform.prototype); <ide> <ide> function PassThrough(options) { <ide> if (!(this instanceof PassThrough)) <ide><path>lib/_stream_readable.js <ide> const { emitExperimentalWarning } = require('internal/util'); <ide> let StringDecoder; <ide> let createReadableStreamAsyncIterator; <ide> <del>util.inherits(Readable, Stream); <add>Object.setPrototypeOf(Readable.prototype, Stream.prototype); <ide> <ide> const { errorOrDestroy } = destroyImpl; <ide> const kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; <ide><path>lib/_stream_transform.js <ide> const { <ide> ERR_TRANSFORM_WITH_LENGTH_0 <ide> } = require('internal/errors').codes; <ide> const Duplex = require('_stream_duplex'); <del>const util = require('util'); <del>util.inherits(Transform, Duplex); <add>Object.setPrototypeOf(Transform.prototype, Duplex.prototype); <ide> <ide> <ide> function afterTransform(er, data) { <ide><path>lib/_stream_writable.js <ide> module.exports = Writable; <ide> Writable.WritableState = WritableState; <ide> <del>const util = require('util'); <ide> const internalUtil = require('internal/util'); <ide> const Stream = require('stream'); <ide> const { Buffer } = require('buffer'); <ide> const { <ide> <ide> const { errorOrDestroy } = destroyImpl; <ide> <del>util.inherits(Writable, Stream); <add>Object.setPrototypeOf(Writable.prototype, Stream.prototype); <ide> <ide> function nop() {} <ide> <ide><path>lib/dgram.js <ide> function Socket(type, listener) { <ide> sendBufferSize <ide> }; <ide> } <del>util.inherits(Socket, EventEmitter); <add>Object.setPrototypeOf(Socket.prototype, EventEmitter.prototype); <ide> <ide> <ide> function createSocket(type, listener) { <ide><path>lib/https.js <ide> function Agent(options) { <ide> list: [] <ide> }; <ide> } <del>inherits(Agent, HttpAgent); <add>Object.setPrototypeOf(Agent.prototype, HttpAgent.prototype); <ide> Agent.prototype.createConnection = createConnection; <ide> <ide> Agent.prototype.getName = function getName(options) { <ide><path>lib/internal/child_process.js <ide> function ChildProcess() { <ide> maybeClose(this); <ide> }; <ide> } <del>util.inherits(ChildProcess, EventEmitter); <add>Object.setPrototypeOf(ChildProcess.prototype, EventEmitter.prototype); <ide> <ide> <ide> function flushStdio(subprocess) { <ide><path>lib/internal/cluster/worker.js <ide> 'use strict'; <ide> const EventEmitter = require('events'); <del>const util = require('util'); <ide> <ide> module.exports = Worker; <ide> <ide> function Worker(options) { <ide> } <ide> } <ide> <del>util.inherits(Worker, EventEmitter); <add>Object.setPrototypeOf(Worker.prototype, EventEmitter.prototype); <ide> <ide> Worker.prototype.kill = function() { <ide> this.destroy.apply(this, arguments); <ide><path>lib/internal/crypto/cipher.js <ide> const { <ide> const assert = require('assert'); <ide> const LazyTransform = require('internal/streams/lazy_transform'); <ide> <del>const { inherits } = require('util'); <ide> const { deprecate, normalizeEncoding } = require('internal/util'); <ide> <ide> // Lazy loaded for startup performance. <ide> function Cipher(cipher, password, options) { <ide> createCipher.call(this, cipher, password, options, true); <ide> } <ide> <del>inherits(Cipher, LazyTransform); <add>Object.setPrototypeOf(Cipher.prototype, LazyTransform.prototype); <ide> <ide> Cipher.prototype._transform = function _transform(chunk, encoding, callback) { <ide> this.push(this[kHandle].update(chunk, encoding)); <ide> function addCipherPrototypeFunctions(constructor) { <ide> constructor.prototype.setAAD = Cipher.prototype.setAAD; <ide> } <ide> <del>inherits(Cipheriv, LazyTransform); <add>Object.setPrototypeOf(Cipheriv.prototype, LazyTransform.prototype); <ide> addCipherPrototypeFunctions(Cipheriv); <ide> legacyNativeHandle(Cipheriv); <ide> <ide> function Decipher(cipher, password, options) { <ide> createCipher.call(this, cipher, password, options, false); <ide> } <ide> <del>inherits(Decipher, LazyTransform); <add>Object.setPrototypeOf(Decipher.prototype, LazyTransform.prototype); <ide> addCipherPrototypeFunctions(Decipher); <ide> legacyNativeHandle(Decipher); <ide> <ide> function Decipheriv(cipher, key, iv, options) { <ide> createCipherWithIV.call(this, cipher, key, options, false, iv); <ide> } <ide> <del>inherits(Decipheriv, LazyTransform); <add>Object.setPrototypeOf(Decipheriv.prototype, LazyTransform.prototype); <ide> addCipherPrototypeFunctions(Decipheriv); <ide> legacyNativeHandle(Decipheriv); <ide> <ide><path>lib/internal/crypto/hash.js <ide> const { <ide> ERR_INVALID_ARG_TYPE <ide> } = require('internal/errors').codes; <ide> const { validateString } = require('internal/validators'); <del>const { inherits } = require('util'); <ide> const { normalizeEncoding } = require('internal/util'); <ide> const { isArrayBufferView } = require('internal/util/types'); <ide> const LazyTransform = require('internal/streams/lazy_transform'); <ide> function Hash(algorithm, options) { <ide> LazyTransform.call(this, options); <ide> } <ide> <del>inherits(Hash, LazyTransform); <add>Object.setPrototypeOf(Hash.prototype, LazyTransform.prototype); <ide> <ide> Hash.prototype._transform = function _transform(chunk, encoding, callback) { <ide> this[kHandle].update(chunk, encoding); <ide> function Hmac(hmac, key, options) { <ide> LazyTransform.call(this, options); <ide> } <ide> <del>inherits(Hmac, LazyTransform); <add>Object.setPrototypeOf(Hmac.prototype, LazyTransform.prototype); <ide> <ide> Hmac.prototype.update = Hash.prototype.update; <ide> <ide><path>lib/internal/crypto/sig.js <ide> const { <ide> validateArrayBufferView, <ide> } = require('internal/crypto/util'); <ide> const { Writable } = require('stream'); <del>const { inherits } = require('util'); <ide> <ide> function Sign(algorithm, options) { <ide> if (!(this instanceof Sign)) <ide> function Sign(algorithm, options) { <ide> Writable.call(this, options); <ide> } <ide> <del>inherits(Sign, Writable); <add>Object.setPrototypeOf(Sign.prototype, Writable.prototype); <ide> <ide> Sign.prototype._write = function _write(chunk, encoding, callback) { <ide> this.update(chunk, encoding); <ide> function Verify(algorithm, options) { <ide> Writable.call(this, options); <ide> } <ide> <del>inherits(Verify, Writable); <add>Object.setPrototypeOf(Verify.prototype, Writable.prototype); <ide> <ide> Verify.prototype._write = Sign.prototype._write; <ide> Verify.prototype.update = Sign.prototype.update; <ide><path>lib/internal/fs/streams.js <ide> const { <ide> } = require('internal/fs/utils'); <ide> const { Readable, Writable } = require('stream'); <ide> const { toPathIfFileURL } = require('internal/url'); <del>const util = require('util'); <ide> <ide> const kMinPoolSpace = 128; <ide> <ide> function ReadStream(path, options) { <ide> } <ide> }); <ide> } <del>util.inherits(ReadStream, Readable); <add>Object.setPrototypeOf(ReadStream.prototype, Readable.prototype); <ide> <ide> ReadStream.prototype.open = function() { <ide> fs.open(this.path, this.flags, this.mode, (er, fd) => { <ide> function WriteStream(path, options) { <ide> if (typeof this.fd !== 'number') <ide> this.open(); <ide> } <del>util.inherits(WriteStream, Writable); <add>Object.setPrototypeOf(WriteStream.prototype, Writable.prototype); <ide> <ide> WriteStream.prototype._final = function(callback) { <ide> if (this.autoClose) { <ide><path>lib/internal/fs/sync_write_stream.js <ide> 'use strict'; <ide> <ide> const { Writable } = require('stream'); <del>const { inherits } = require('util'); <ide> const { closeSync, writeSync } = require('fs'); <ide> <ide> function SyncWriteStream(fd, options) { <ide> function SyncWriteStream(fd, options) { <ide> this.on('end', () => this._destroy()); <ide> } <ide> <del>inherits(SyncWriteStream, Writable); <add>Object.setPrototypeOf(SyncWriteStream.prototype, Writable.prototype); <ide> <ide> SyncWriteStream.prototype._write = function(chunk, encoding, cb) { <ide> writeSync(this.fd, chunk, 0, chunk.length); <ide><path>lib/internal/fs/watchers.js <ide> const { <ide> const { toNamespacedPath } = require('path'); <ide> const { validateUint32 } = require('internal/validators'); <ide> const { toPathIfFileURL } = require('internal/url'); <del>const util = require('util'); <ide> const assert = require('assert'); <ide> <ide> const kOldStatus = Symbol('kOldStatus'); <ide> function StatWatcher(bigint) { <ide> this[kOldStatus] = -1; <ide> this[kUseBigint] = bigint; <ide> } <del>util.inherits(StatWatcher, EventEmitter); <add>Object.setPrototypeOf(StatWatcher.prototype, EventEmitter.prototype); <ide> <ide> function onchange(newStatus, stats) { <ide> const self = this[owner_symbol]; <ide> function FSWatcher() { <ide> } <ide> }; <ide> } <del>util.inherits(FSWatcher, EventEmitter); <add>Object.setPrototypeOf(FSWatcher.prototype, EventEmitter.prototype); <ide> <ide> <ide> // FIXME(joyeecheung): this method is not documented. <ide><path>lib/internal/streams/legacy.js <ide> 'use strict'; <ide> <ide> const EE = require('events'); <del>const util = require('util'); <ide> <ide> function Stream() { <ide> EE.call(this); <ide> } <del>util.inherits(Stream, EE); <add>Object.setPrototypeOf(Stream.prototype, EE.prototype); <ide> <ide> Stream.prototype.pipe = function(dest, options) { <ide> var source = this; <ide><path>lib/net.js <ide> function Server(options, connectionListener) { <ide> this.allowHalfOpen = options.allowHalfOpen || false; <ide> this.pauseOnConnect = !!options.pauseOnConnect; <ide> } <del>util.inherits(Server, EventEmitter); <add>Object.setPrototypeOf(Server.prototype, EventEmitter.prototype); <ide> <ide> <ide> function toNumber(x) { return (x = Number(x)) >= 0 ? x : false; } <ide><path>lib/perf_hooks.js <ide> const { <ide> const { AsyncResource } = require('async_hooks'); <ide> const L = require('internal/linkedlist'); <ide> const kInspect = require('internal/util').customInspectSymbol; <del>const { inherits } = require('util'); <ide> <ide> const kCallback = Symbol('callback'); <ide> const kTypes = Symbol('types'); <ide> class PerformanceNodeTiming { <ide> }; <ide> } <ide> } <del>// Use this instead of Extends because we want PerformanceEntry in the <del>// prototype chain but we do not want to use the PerformanceEntry <del>// constructor for this. <del>inherits(PerformanceNodeTiming, PerformanceEntry); <add>Object.setPrototypeOf( <add> PerformanceNodeTiming.prototype, PerformanceEntry.prototype); <ide> <ide> const nodeTiming = new PerformanceNodeTiming(); <ide> <ide><path>lib/readline.js <ide> const { <ide> ERR_INVALID_CURSOR_POS, <ide> ERR_INVALID_OPT_VALUE <ide> } = require('internal/errors').codes; <del>const { debug, inherits } = require('util'); <add>const { debug } = require('util'); <ide> const { emitExperimentalWarning } = require('internal/util'); <ide> const { Buffer } = require('buffer'); <ide> const EventEmitter = require('events'); <ide> function Interface(input, output, completer, terminal) { <ide> input.resume(); <ide> } <ide> <del>inherits(Interface, EventEmitter); <add>Object.setPrototypeOf(Interface.prototype, EventEmitter.prototype); <ide> <ide> Object.defineProperty(Interface.prototype, 'columns', { <ide> configurable: true, <ide><path>lib/repl.js <ide> const { <ide> } = require('internal/deps/acorn/dist/acorn'); <ide> const internalUtil = require('internal/util'); <ide> const util = require('util'); <del>const { inherits } = util; <ide> const Stream = require('stream'); <ide> const vm = require('vm'); <ide> const path = require('path'); <ide> function REPLServer(prompt, <ide> <ide> // handle multiline history <ide> if (self[kBufferedCommandSymbol].length) <del> REPLServer.super_.prototype.multilineHistory.call(self, false); <add> Interface.prototype.multilineHistory.call(self, false); <ide> else { <del> REPLServer.super_.prototype.multilineHistory.call(self, true); <add> Interface.prototype.multilineHistory.call(self, true); <ide> } <ide> <ide> // Clear buffer if no SyntaxErrors <ide> function REPLServer(prompt, <ide> <ide> self.displayPrompt(); <ide> } <del>inherits(REPLServer, Interface); <add>Object.setPrototypeOf(REPLServer.prototype, Interface.prototype); <ide> exports.REPLServer = REPLServer; <ide> <ide> exports.REPL_MODE_SLOPPY = Symbol('repl-sloppy'); <ide> REPLServer.prototype.displayPrompt = function(preserveCursor) { <ide> const len = this.lines.level.length ? this.lines.level.length - 1 : 0; <ide> const levelInd = '..'.repeat(len); <ide> prompt += levelInd + ' '; <del> REPLServer.super_.prototype.undoHistory.call(this); <add> Interface.prototype.undoHistory.call(this); <ide> } <ide> <ide> // Do not overwrite `_initialPrompt` here <del> REPLServer.super_.prototype.setPrompt.call(this, prompt); <add> Interface.prototype.setPrompt.call(this, prompt); <ide> this.prompt(preserveCursor); <ide> }; <ide> <ide> // When invoked as an API method, overwrite _initialPrompt <ide> REPLServer.prototype.setPrompt = function setPrompt(prompt) { <ide> this._initialPrompt = prompt; <del> REPLServer.super_.prototype.setPrompt.call(this, prompt); <add> Interface.prototype.setPrompt.call(this, prompt); <ide> }; <ide> <ide> REPLServer.prototype.turnOffEditorMode = util.deprecate( <ide> function ArrayStream() { <ide> this.emit('data', `${data[n]}\n`); <ide> }; <ide> } <del>util.inherits(ArrayStream, Stream); <add>Object.setPrototypeOf(ArrayStream.prototype, Stream.prototype); <ide> ArrayStream.prototype.readable = true; <ide> ArrayStream.prototype.writable = true; <ide> ArrayStream.prototype.resume = function() {}; <ide> function addStandardGlobals(completionGroups, filter) { <ide> <ide> function _turnOnEditorMode(repl) { <ide> repl.editorMode = true; <del> REPLServer.super_.prototype.setPrompt.call(repl, ''); <add> Interface.prototype.setPrompt.call(repl, ''); <ide> } <ide> <ide> function _turnOffEditorMode(repl) { <ide> function regexpEscape(s) { <ide> function Recoverable(err) { <ide> this.err = err; <ide> } <del>inherits(Recoverable, SyntaxError); <add>Object.setPrototypeOf(Recoverable.prototype, SyntaxError.prototype); <ide> exports.Recoverable = Recoverable; <ide><path>lib/zlib.js <ide> const Transform = require('_stream_transform'); <ide> const { <ide> deprecate, <ide> _extend, <del> inherits, <ide> types: { <ide> isAnyArrayBuffer, <ide> isArrayBufferView <ide> function Zlib(opts, mode) { <ide> this._info = opts && opts.info; <ide> this.once('end', this.close); <ide> } <del>inherits(Zlib, Transform); <add>Object.setPrototypeOf(Zlib.prototype, Transform.prototype); <ide> <ide> Object.defineProperty(Zlib.prototype, '_closed', { <ide> configurable: true, <ide> function Deflate(opts) { <ide> return new Deflate(opts); <ide> Zlib.call(this, opts, DEFLATE); <ide> } <del>inherits(Deflate, Zlib); <add>Object.setPrototypeOf(Deflate.prototype, Zlib.prototype); <ide> <ide> function Inflate(opts) { <ide> if (!(this instanceof Inflate)) <ide> return new Inflate(opts); <ide> Zlib.call(this, opts, INFLATE); <ide> } <del>inherits(Inflate, Zlib); <add>Object.setPrototypeOf(Inflate.prototype, Zlib.prototype); <ide> <ide> function Gzip(opts) { <ide> if (!(this instanceof Gzip)) <ide> return new Gzip(opts); <ide> Zlib.call(this, opts, GZIP); <ide> } <del>inherits(Gzip, Zlib); <add>Object.setPrototypeOf(Gzip.prototype, Zlib.prototype); <ide> <ide> function Gunzip(opts) { <ide> if (!(this instanceof Gunzip)) <ide> return new Gunzip(opts); <ide> Zlib.call(this, opts, GUNZIP); <ide> } <del>inherits(Gunzip, Zlib); <add>Object.setPrototypeOf(Gunzip.prototype, Zlib.prototype); <ide> <ide> function DeflateRaw(opts) { <ide> if (opts && opts.windowBits === 8) opts.windowBits = 9; <ide> if (!(this instanceof DeflateRaw)) <ide> return new DeflateRaw(opts); <ide> Zlib.call(this, opts, DEFLATERAW); <ide> } <del>inherits(DeflateRaw, Zlib); <add>Object.setPrototypeOf(DeflateRaw.prototype, Zlib.prototype); <ide> <ide> function InflateRaw(opts) { <ide> if (!(this instanceof InflateRaw)) <ide> return new InflateRaw(opts); <ide> Zlib.call(this, opts, INFLATERAW); <ide> } <del>inherits(InflateRaw, Zlib); <add>Object.setPrototypeOf(InflateRaw.prototype, Zlib.prototype); <ide> <ide> function Unzip(opts) { <ide> if (!(this instanceof Unzip)) <ide> return new Unzip(opts); <ide> Zlib.call(this, opts, UNZIP); <ide> } <del>inherits(Unzip, Zlib); <add>Object.setPrototypeOf(Unzip.prototype, Zlib.prototype); <ide> <ide> function createConvenienceMethod(ctor, sync) { <ide> if (sync) {
26
Javascript
Javascript
use const where applicable in defineplugin
bb5184bf494b468ab10833dae047dbcf3df5e9a9
<ide><path>lib/DefinePlugin.js <ide> class DefinePlugin { <ide> } <ide> <ide> apply(compiler) { <del> let definitions = this.definitions; <add> const definitions = this.definitions; <ide> compiler.plugin("compilation", (compilation, params) => { <ide> compilation.dependencyFactories.set(ConstDependency, new NullFactory()); <ide> compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); <ide> <ide> params.normalModuleFactory.plugin("parser", (parser) => { <ide> (function walkDefinitions(definitions, prefix) { <ide> Object.keys(definitions).forEach((key) => { <del> let code = definitions[key]; <add> const code = definitions[key]; <ide> if(code && typeof code === "object" && !(code instanceof RegExp)) { <ide> walkDefinitions(code, prefix + key + "."); <ide> applyObjectDefine(prefix + key, code); <ide> class DefinePlugin { <ide> <ide> function stringifyObj(obj) { <ide> return "__webpack_require__.i({" + Object.keys(obj).map((key) => { <del> let code = obj[key]; <add> const code = obj[key]; <ide> return JSON.stringify(key) + ":" + toCode(code); <ide> }).join(",") + "})"; <ide> } <ide> class DefinePlugin { <ide> } <ide> <ide> function applyDefine(key, code) { <del> let isTypeof = /^typeof\s+/.test(key); <add> const isTypeof = /^typeof\s+/.test(key); <ide> if(isTypeof) key = key.replace(/^typeof\s+/, ""); <ide> let recurse = false; <ide> let recurseTypeof = false; <ide> class DefinePlugin { <ide> parser.plugin("can-rename " + key, ParserHelpers.approve); <ide> parser.plugin("evaluate Identifier " + key, (expr) => { <ide> if(recurse) return; <del> let res = parser.evaluate(code); <add> const res = parser.evaluate(code); <ide> recurse = false; <ide> res.setRange(expr.range); <ide> return res; <ide> }); <ide> parser.plugin("expression " + key, ParserHelpers.toConstantDependency(code)); <ide> } <del> let typeofCode = isTypeof ? code : "typeof (" + code + ")"; <add> const typeofCode = isTypeof ? code : "typeof (" + code + ")"; <ide> parser.plugin("evaluate typeof " + key, (expr) => { <ide> if(recurseTypeof) return; <del> let res = parser.evaluate(typeofCode); <add> const res = parser.evaluate(typeofCode); <ide> recurseTypeof = false; <ide> res.setRange(expr.range); <ide> return res; <ide> }); <ide> parser.plugin("typeof " + key, (expr) => { <del> let res = parser.evaluate(typeofCode); <add> const res = parser.evaluate(typeofCode); <ide> if(!res.isString()) return; <ide> return ParserHelpers.toConstantDependency(JSON.stringify(res.string)).bind(parser)(expr); <ide> }); <ide> } <ide> <ide> function applyObjectDefine(key, obj) { <del> let code = stringifyObj(obj); <add> const code = stringifyObj(obj); <ide> parser.plugin("can-rename " + key, ParserHelpers.approve); <ide> parser.plugin("evaluate Identifier " + key, (expr) => new BasicEvaluatedExpression().setRange(expr.range)); <ide> parser.plugin("evaluate typeof " + key, ParserHelpers.evaluateToString("object"));
1
Mixed
Text
use https for the homepage
93441743794a3d44f90bc53438ca31add960f757
<ide><path>Library/Homebrew/global.rb <ide> <ide> HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"] <ide> HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"] <del>HOMEBREW_WWW = "http://brew.sh".freeze <add>HOMEBREW_WWW = "https://brew.sh".freeze <ide> <ide> require "config" <ide> <ide><path>README.md <ide> # Homebrew <del>Features, usage and installation instructions are [summarised on the homepage](http://brew.sh). Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is [explained here](docs/Formula-Cookbook.md#homebrew-terminology). <add>Features, usage and installation instructions are [summarised on the homepage](https://brew.sh). Terminology (e.g. the difference between a Cellar, Tap, Cask and so forth) is [explained here](docs/Formula-Cookbook.md#homebrew-terminology). <ide> <ide> ## Update Bug <ide> If Homebrew was updated on Aug 10-11th 2016 and `brew update` always says `Already up-to-date.` you need to run: <ide><path>docs/Installation.md <ide> # Installation <ide> <ide> The suggested and easiest way to install Homebrew is on the <del>[homepage](http://brew.sh). <add>[homepage](https://brew.sh). <ide> <ide> The standard script installs Homebrew to `/usr/local` so that <ide> [you don’t need sudo](FAQ.md) when you <ide> Apple Developer account on older versions of Mac OS X. Sign up for free <ide> [here](https://developer.apple.com/register/index.action). <ide> <ide> <a name="4"><sup>4</sup></a> The one-liner installation method found on <del>[brew.sh](http://brew.sh) requires a Bourne-compatible shell (e.g. bash or <add>[brew.sh](https://brew.sh) requires a Bourne-compatible shell (e.g. bash or <ide> zsh). Notably, fish, tcsh and csh will not work.
3
Ruby
Ruby
fix edge case handling in `check_binary_arches`
c7badb1e5413052def6fdade669fe6da55689222
<ide><path>Library/Homebrew/formula_cellar_checks.rb <ide> def check_binary_arches(formula) <ide> mismatches_expected = formula.tap.blank? || tap_audit_exception(:mismatched_binary_allowlist, formula.name) <ide> return if compatible_universal_binaries.empty? && mismatches_expected <ide> <add> return if universal_binaries_expected && mismatches_expected <add> <ide> s = "" <ide> <ide> if mismatches.present? && !mismatches_expected
1
Ruby
Ruby
remove unused require
416d85b65e4f49f7e86f24c56bc1ec7441e90f2c
<ide><path>actionpack/lib/action_controller/metal/implicit_render.rb <del>require "active_support/core_ext/string/strip" <del> <ide> module ActionController <ide> # Handles implicit rendering for a controller action that does not <ide> # explicitly respond with +render+, +respond_to+, +redirect+, or +head+. <ide><path>actionpack/lib/action_dispatch/testing/integration.rb <ide> require "uri" <ide> require "active_support/core_ext/kernel/singleton_class" <ide> require "active_support/core_ext/object/try" <del>require "active_support/core_ext/string/strip" <ide> require "rack/test" <ide> require "minitest" <ide> <ide><path>activemodel/lib/active_model/validations/length.rb <del>require "active_support/core_ext/string/strip" <del> <ide> module ActiveModel <ide> module Validations <ide> class LengthValidator < EachValidator # :nodoc: <ide><path>activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb <del>require "active_support/core_ext/string/strip" <del> <ide> module ActiveRecord <ide> module AttributeMethods <ide> module TimeZoneConversion <ide><path>activerecord/test/cases/helper.rb <ide> require "cases/test_case" <ide> require "active_support/dependencies" <ide> require "active_support/logger" <del>require "active_support/core_ext/string/strip" <ide> <ide> require "support/config" <ide> require "support/connection" <ide><path>activesupport/lib/active_support/cache.rb <ide> require "active_support/core_ext/numeric/time" <ide> require "active_support/core_ext/object/to_param" <ide> require "active_support/core_ext/string/inflections" <del>require "active_support/core_ext/string/strip" <ide> <ide> module ActiveSupport <ide> # See ActiveSupport::Cache::Store for documentation. <ide><path>railties/test/application/rake/dbs_test.rb <ide> require "isolation/abstract_unit" <del>require "active_support/core_ext/string/strip" <ide> <ide> module ApplicationTests <ide> module RakeTests <ide><path>railties/test/application/rake/framework_test.rb <ide> require "isolation/abstract_unit" <del>require "active_support/core_ext/string/strip" <ide> <ide> module ApplicationTests <ide> module RakeTests
8
Python
Python
support config overrides via environment variables
5497acf49aef93a1d6d451da11cc9f3d2841b345
<ide><path>spacy/cli/_util.py <ide> from contextlib import contextmanager <ide> from thinc.config import Config, ConfigValidationError <ide> from configparser import InterpolationError <add>import os <ide> <ide> from ..schemas import ProjectConfigSchema, validate <del>from ..util import import_file, run_command, make_tempdir, registry <add>from ..util import import_file, run_command, make_tempdir, registry, logger <ide> <ide> if TYPE_CHECKING: <ide> from pathy import Pathy # noqa: F401 <ide> def setup_cli() -> None: <ide> command(prog_name=COMMAND) <ide> <ide> <del>def parse_config_overrides(args: List[str]) -> Dict[str, Any]: <add>def parse_config_env_overrides( <add> *, prefix: str = "SPACY_CONFIG_", dot: str = "__" <add>) -> Dict[str, Any]: <add> """Generate a dictionary of config overrides based on environment variables, <add> e.g. SPACY_CONFIG_TRAINING__BATCH_SIZE=123 overrides the training.batch_size <add> setting. <add> <add> prefix (str): The env variable prefix for config overrides. <add> dot (str): String used to represent the "dot", e.g. in training.batch_size. <add> RETURNS (Dict[str, Any]): The parsed dict, keyed by nested config setting. <add> """ <add> result = {} <add> for env_key, value in os.environ.items(): <add> if env_key.startswith(prefix): <add> opt = env_key[len(prefix) :].lower().replace(dot, ".") <add> if "." in opt: <add> result[opt] = try_json_loads(value) <add> return result <add> <add> <add>def parse_config_overrides(args: List[str], env_vars: bool = True) -> Dict[str, Any]: <ide> """Generate a dictionary of config overrides based on the extra arguments <ide> provided on the CLI, e.g. --training.batch_size to override <ide> "training.batch_size". Arguments without a "." are considered invalid, <ide> since the config only allows top-level sections to exist. <ide> <ide> args (List[str]): The extra arguments from the command line. <add> env_vars (bool): Include environment variables. <ide> RETURNS (Dict[str, Any]): The parsed dict, keyed by nested config setting. <ide> """ <del> result = {} <add> env_overrides = parse_config_env_overrides() if env_vars else {} <add> cli_overrides = {} <ide> while args: <ide> opt = args.pop(0) <ide> err = f"Invalid CLI argument '{opt}'" <ide> def parse_config_overrides(args: List[str]) -> Dict[str, Any]: <ide> value = "true" <ide> else: <ide> value = args.pop(0) <del> # Just like we do in the config, we're calling json.loads on the <del> # values. But since they come from the CLI, it'd be unintuitive to <del> # explicitly mark strings with escaped quotes. So we're working <del> # around that here by falling back to a string if parsing fails. <del> # TODO: improve logic to handle simple types like list of strings? <del> try: <del> result[opt] = srsly.json_loads(value) <del> except ValueError: <del> result[opt] = str(value) <add> if opt not in env_overrides: <add> cli_overrides[opt] = try_json_loads(value) <ide> else: <ide> msg.fail(f"{err}: override option should start with --", exits=1) <del> return result <add> if cli_overrides: <add> logger.debug(f"Config overrides from CLI: {list(cli_overrides)}") <add> if env_overrides: <add> logger.debug(f"Config overrides from env variables: {list(env_overrides)}") <add> return {**cli_overrides, **env_overrides} <add> <add> <add>def try_json_loads(value: Any) -> Any: <add> # Just like we do in the config, we're calling json.loads on the <add> # values. But since they come from the CLI, it'd be unintuitive to <add> # explicitly mark strings with escaped quotes. So we're working <add> # around that here by falling back to a string if parsing fails. <add> # TODO: improve logic to handle simple types like list of strings? <add> try: <add> return srsly.json_loads(value) <add> except ValueError: <add> return str(value) <ide> <ide> <ide> def load_project_config(path: Path, interpolate: bool = True) -> Dict[str, Any]: <ide><path>spacy/tests/test_cli.py <ide> import pytest <ide> from click import NoSuchOption <del> <ide> from spacy.training import docs_to_json, biluo_tags_from_offsets <ide> from spacy.training.converters import iob2docs, conll_ner2docs, conllu2docs <ide> from spacy.schemas import ProjectConfigSchema, RecommendationSchema, validate <ide> from spacy.cli.init_config import init_config, RECOMMENDATIONS <ide> from spacy.cli._util import validate_project_commands, parse_config_overrides <ide> from spacy.cli._util import load_project_config, substitute_project_variables <del>from spacy.cli._util import string_to_list <add>from spacy.cli._util import string_to_list, parse_config_env_overrides <ide> from thinc.config import ConfigValidationError <ide> import srsly <add>import os <ide> <ide> from .util import make_tempdir <ide> <ide> def test_parse_config_overrides_invalid_2(args): <ide> parse_config_overrides(args) <ide> <ide> <add>def test_parse_cli_overrides(): <add> prefix = "SPACY_CONFIG_" <add> dot = "__" <add> os.environ[f"{prefix}TRAINING{dot}BATCH_SIZE"] = "123" <add> os.environ[f"{prefix}FOO{dot}BAR{dot}BAZ"] = "hello" <add> os.environ[prefix] = "bad" <add> result = parse_config_env_overrides(prefix=prefix, dot=dot) <add> assert len(result) == 2 <add> assert result["training.batch_size"] == 123 <add> assert result["foo.bar.baz"] == "hello" <add> <add> <ide> @pytest.mark.parametrize("lang", ["en", "nl"]) <ide> @pytest.mark.parametrize( <ide> "pipeline", [["tagger", "parser", "ner"], [], ["ner", "textcat", "sentencizer"]]
2
Ruby
Ruby
fix cache extension for github tarballs
924f92300fb6221bfd7bed20b0571db7a3b8f71b
<ide><path>Library/Homebrew/download_strategy.rb <ide> def chdir <ide> <ide> def ext <ide> # GitHub uses odd URLs for zip files, so check for those <del> rx=%r[http://(www\.)?github\.com/.*/(zip|tar)ball/] <add> rx=%r[https?://(www\.)?github\.com/.*/(zip|tar)ball/] <ide> if rx.match @url <ide> if $2 == 'zip' <ide> '.zip'
1
Python
Python
fix first axis dim validation in multi-input model
32b10a8832bd0a0f3ae9e362ef9a77ee8b9b739c
<ide><path>keras/engine/training.py <ide> def standardize_input_data(data, names, shapes=None, check_batch_dim=True, <ide> # check shapes compatibility <ide> if shapes: <ide> for i in range(len(names)): <del> if not i and not check_batch_dim: <del> # skip the first axis <del> continue <ide> array = arrays[i] <ide> if len(array.shape) != len(shapes[i]): <ide> raise Exception('Error when checking ' + exception_prefix + <ide> ': expected ' + names[i] + <ide> ' to have ' + str(len(shapes[i])) + <ide> ' dimensions, but got array with shape ' + <ide> str(array.shape)) <del> for dim, ref_dim in zip(array.shape, shapes[i]): <add> for j, (dim, ref_dim) in enumerate(zip(array.shape, shapes[i])): <add> if not j and not check_batch_dim: <add> # skip the first axis <add> continue <ide> if ref_dim: <ide> if ref_dim != dim: <ide> raise Exception('Error when checking ' + exception_prefix +
1
PHP
PHP
remove test code
be61e3e3c86f69cb7713d3af54396c8ee2fa931f
<ide><path>tests/Notifications/NotificationSlackChannelTest.php <ide> public function testSmsIsSentViaNexmo() <ide> $http = Mockery::mock('GuzzleHttp\Client') <ide> ); <ide> <del> // $http->shouldReceive('post')->andReturnUsing(function (...$args) { <del> // dd($args); <del> // }); <del> <ide> $http->shouldReceive('post')->with('url', [ <ide> 'json' => [ <ide> 'attachments' => [
1
Javascript
Javascript
remove return type from constructor
1f8c0c88609c655541d525ed1f9e5e37255fbac7
<ide><path>Libraries/Events/EventPolyfill.js <ide> class EventPolyfill implements IEvent { <ide> // data with the other in sync. <ide> _syntheticEvent: mixed; <ide> <del> constructor(type: string, eventInitDict?: Event$Init): void { <add> constructor(type: string, eventInitDict?: Event$Init) { <ide> this.type = type; <ide> this.bubbles = !!(eventInitDict?.bubbles || false); <ide> this.cancelable = !!(eventInitDict?.cancelable || false);
1
Go
Go
fix a deadlock in cmdstream
58befe3081726ef74ea09198cd9488fb42c51f51
<ide><path>archive.go <ide> func CmdStream(cmd *exec.Cmd) (io.Reader, error) { <ide> return nil, err <ide> } <ide> pipeR, pipeW := io.Pipe() <add> errChan := make(chan []byte) <ide> go func() { <del> _, err := io.Copy(pipeW, stdout) <del> if err != nil { <del> pipeW.CloseWithError(err) <del> } <ide> errText, e := ioutil.ReadAll(stderr) <ide> if e != nil { <ide> errText = []byte("(...couldn't fetch stderr: " + e.Error() + ")") <ide> } <add> errChan <- errText <add> }() <add> go func() { <add> _, err := io.Copy(pipeW, stdout) <add> if err != nil { <add> pipeW.CloseWithError(err) <add> } <add> errText := <-errChan <ide> if err := cmd.Wait(); err != nil { <del> // FIXME: can this block if stderr outputs more than the size of StderrPipe()'s buffer? <ide> pipeW.CloseWithError(errors.New(err.Error() + ": " + string(errText))) <ide> } else { <ide> pipeW.Close() <ide><path>archive_test.go <ide> package docker <ide> <ide> import ( <add> "io" <ide> "io/ioutil" <ide> "os" <ide> "os/exec" <ide> "testing" <ide> ) <ide> <add>func TestCmdStreamLargeStderr(t *testing.T) { <add> // This test checks for deadlock; thus, the main failure mode of this test is deadlocking. <add> cmd := exec.Command("/bin/sh", "-c", "dd if=/dev/zero bs=1k count=1000 of=/dev/stderr; echo hello") <add> out, err := CmdStream(cmd) <add> if err != nil { <add> t.Fatalf("Failed to start command: " + err.Error()) <add> } <add> _, err = io.Copy(ioutil.Discard, out) <add> if err != nil { <add> t.Fatalf("Command should not have failed (err=%s...)", err.Error()[:100]) <add> } <add>} <add> <ide> func TestCmdStreamBad(t *testing.T) { <ide> badCmd := exec.Command("/bin/sh", "-c", "echo hello; echo >&2 error couldn\\'t reverse the phase pulser; exit 1") <ide> out, err := CmdStream(badCmd)
2