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
Ruby
Ruby
add inspect to cxxstdlib
cf3c12dd5b23d8b44c56303ba1e4796be8b3b3c0
<ide><path>Library/Homebrew/cxxstdlib.rb <ide> def type_string <ide> type.to_s.gsub(/cxx$/, 'c++') <ide> end <ide> <add> def inspect <add> "#<#{self.class.name}: #{compiler} #{type}>" <add> end <add> <ide> class AppleStdlib < CxxStdlib <ide> def apple_compiler? <ide> true
1
PHP
PHP
reset error_reporting value
41de250084b3156b2f1eaf33f740274737f3f6f3
<ide><path>tests/TestCase/Controller/ControllerTest.php <ide> class ControllerTest extends TestCase <ide> 'core.posts' <ide> ]; <ide> <add> /** <add> * error level property <add> * <add> */ <add> private static $error_level; <add> <ide> /** <ide> * reset environment. <ide> * <ide> public function tearDown() <ide> { <ide> parent::tearDown(); <ide> Plugin::unload(); <add> error_reporting(self::$error_level); <add> } <add> <add> /** <add> * setUpBeforeClass <add> * <add> * @return void <add> */ <add> public static function setUpBeforeClass() <add> { <add> self::$error_level = error_reporting(); <add> } <add> <add> /** <add> * tearDownAfterClass <add> * <add> * @return void <add> */ <add> public static function tearDownAfterClass() <add> { <add> error_reporting(self::$error_level); <ide> } <ide> <ide> /** <ide> public function testBeforeRenderViewVariables() <ide> public function testDeprecatedViewProperty($property, $getter, $setter, $value) <ide> { <ide> $controller = new AnotherTestController(); <del> $error_level = error_reporting(); <ide> error_reporting(E_ALL ^ E_USER_DEPRECATED); <ide> $controller->$property = $value; <ide> $this->assertSame($value, $controller->$property); <ide> $this->assertSame($value, $controller->viewBuilder()->{$getter}()); <del> error_reporting($error_level); <ide> } <ide> <ide> /** <ide> public function testDeprecatedViewProperty($property, $getter, $setter, $value) <ide> */ <ide> public function testDeprecatedViewPropertySetterMessage($property, $getter, $setter, $value) <ide> { <del> $error_level = error_reporting(); <ide> error_reporting(E_ALL); <ide> $controller = new AnotherTestController(); <ide> $controller->$property = $value; <del> error_reporting($error_level); <ide> } <ide> <ide> /** <ide> public function testDeprecatedViewPropertySetterMessage($property, $getter, $set <ide> */ <ide> public function testDeprecatedViewPropertyGetterMessage($property, $getter, $setter, $value) <ide> { <del> $error_level = error_reporting(); <ide> error_reporting(E_ALL); <ide> $controller = new AnotherTestController(); <ide> $controller->viewBuilder()->{$setter}($value); <ide> $result = $controller->$property; <del> error_reporting($error_level); <ide> } <ide> <ide> /**
1
Mixed
Javascript
add optional detail to process emitwarning
dd20e68b0feb966c2a7439c947bbb4d46e3b19fe
<ide><path>doc/api/process.md <ide> process's [`ChildProcess.disconnect()`][]. <ide> If the Node.js process was not spawned with an IPC channel, <ide> `process.disconnect()` will be `undefined`. <ide> <add>## process.emitWarning(warning[, options]) <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>* `warning` {string|Error} The warning to emit. <add>* `options` {Object} <add> * `type` {string} When `warning` is a String, `type` is the name to use <add> for the *type* of warning being emitted. Default: `Warning`. <add> * `code` {string} A unique identifier for the warning instance being emitted. <add> * `ctor` {Function} When `warning` is a String, `ctor` is an optional <add> function used to limit the generated stack trace. Default <add> `process.emitWarning` <add> * `detail` {string} Additional text to include with the error. <add> <add>The `process.emitWarning()` method can be used to emit custom or application <add>specific process warnings. These can be listened for by adding a handler to the <add>[`process.on('warning')`][process_warning] event. <add> <add>```js <add>// Emit a warning with a code and additional detail. <add>process.emitWarning('Something happened!', { <add> code: 'MY_WARNING', <add> detail: 'This is some additional information' <add>}); <add>// Emits: <add>// (node:56338) [MY_WARNING] Warning: Something happened! <add>// This is some additional information <add>``` <add> <add>In this example, an `Error` object is generated internally by <add>`process.emitWarning()` and passed through to the <add>[`process.on('warning')`][process_warning] event. <add> <add>```js <add>process.on('warning', (warning) => { <add> console.warn(warning.name); // 'Warning' <add> console.warn(warning.message); // 'Something happened!' <add> console.warn(warning.code); // 'MY_WARNING' <add> console.warn(warning.stack); // Stack trace <add> console.warn(warning.detail); // 'This is some additional information' <add>}); <add>``` <add> <add>If `warning` is passed as an `Error` object, the `options` argument is ignored. <add> <ide> ## process.emitWarning(warning[, type[, code]][, ctor]) <ide> <!-- YAML <ide> added: v6.0.0 <ide> specific process warnings. These can be listened for by adding a handler to the <ide> [`process.on('warning')`][process_warning] event. <ide> <ide> ```js <del>// Emit a warning using a string... <add>// Emit a warning using a string. <ide> process.emitWarning('Something happened!'); <ide> // Emits: (node: 56338) Warning: Something happened! <ide> ``` <ide> <ide> ```js <del>// Emit a warning using a string and a type... <add>// Emit a warning using a string and a type. <ide> process.emitWarning('Something Happened!', 'CustomWarning'); <ide> // Emits: (node:56338) CustomWarning: Something Happened! <ide> ``` <ide> If `warning` is passed as an `Error` object, it will be passed through to the <ide> `code` and `ctor` arguments will be ignored): <ide> <ide> ```js <del>// Emit a warning using an Error object... <del>const myWarning = new Error('Warning! Something happened!'); <add>// Emit a warning using an Error object. <add>const myWarning = new Error('Something happened!'); <ide> // Use the Error name property to specify the type name <ide> myWarning.name = 'CustomWarning'; <ide> myWarning.code = 'WARN001'; <ide> <ide> process.emitWarning(myWarning); <del>// Emits: (node:56338) [WARN001] CustomWarning: Warning! Something happened! <add>// Emits: (node:56338) [WARN001] CustomWarning: Something happened! <ide> ``` <ide> <ide> A `TypeError` is thrown if `warning` is anything other than a string or `Error` <ide><path>lib/internal/process/warning.js <ide> function setupProcessWarnings() { <ide> if (isDeprecation && process.noDeprecation) return; <ide> const trace = process.traceProcessWarnings || <ide> (isDeprecation && process.traceDeprecation); <add> let msg = `${prefix}`; <add> if (warning.code) <add> msg += `[${warning.code}] `; <ide> if (trace && warning.stack) { <del> if (warning.code) { <del> output(`${prefix}[${warning.code}] ${warning.stack}`); <del> } else { <del> output(`${prefix}${warning.stack}`); <del> } <add> msg += `${warning.stack}`; <ide> } else { <ide> const toString = <ide> typeof warning.toString === 'function' ? <ide> warning.toString : Error.prototype.toString; <del> if (warning.code) { <del> output(`${prefix}[${warning.code}] ${toString.apply(warning)}`); <del> } else { <del> output(`${prefix}${toString.apply(warning)}`); <del> } <add> msg += `${toString.apply(warning)}`; <ide> } <add> if (typeof warning.detail === 'string') { <add> msg += `\n${warning.detail}`; <add> } <add> output(msg); <ide> }); <ide> } <ide> <ide> // process.emitWarning(error) <ide> // process.emitWarning(str[, type[, code]][, ctor]) <add> // process.emitWarning(str[, options]) <ide> process.emitWarning = function(warning, type, code, ctor) { <ide> const errors = lazyErrors(); <del> if (typeof type === 'function') { <add> var detail; <add> if (type !== null && typeof type === 'object' && !Array.isArray(type)) { <add> ctor = type.ctor; <add> code = type.code; <add> if (typeof type.detail === 'string') <add> detail = type.detail; <add> type = type.type || 'Warning'; <add> } else if (typeof type === 'function') { <ide> ctor = type; <ide> code = undefined; <ide> type = 'Warning'; <ide> function setupProcessWarnings() { <ide> warning = new Error(warning); <ide> warning.name = String(type || 'Warning'); <ide> if (code !== undefined) warning.code = code; <add> if (detail !== undefined) warning.detail = detail; <ide> Error.captureStackTrace(warning, ctor || process.emitWarning); <ide> } <ide> if (!(warning instanceof Error)) { <ide><path>test/parallel/test-process-emitwarning.js <ide> <ide> const common = require('../common'); <ide> const assert = require('assert'); <del>const util = require('util'); <add> <add>const testMsg = 'A Warning'; <add>const testCode = 'CODE001'; <add>const testDetail = 'Some detail'; <add>const testType = 'CustomWarning'; <ide> <ide> process.on('warning', common.mustCall((warning) => { <ide> assert(warning); <ide> assert(/^(Warning|CustomWarning)/.test(warning.name)); <del> assert.strictEqual(warning.message, 'A Warning'); <del> if (warning.code) assert.strictEqual(warning.code, 'CODE001'); <del>}, 8)); <del> <del>process.emitWarning('A Warning'); <del>process.emitWarning('A Warning', 'CustomWarning'); <del>process.emitWarning('A Warning', CustomWarning); <del>process.emitWarning('A Warning', 'CustomWarning', CustomWarning); <del>process.emitWarning('A Warning', 'CustomWarning', 'CODE001'); <del> <del>function CustomWarning() { <del> Error.call(this); <del> this.name = 'CustomWarning'; <del> this.message = 'A Warning'; <del> this.code = 'CODE001'; <del> Error.captureStackTrace(this, CustomWarning); <add> assert.strictEqual(warning.message, testMsg); <add> if (warning.code) assert.strictEqual(warning.code, testCode); <add> if (warning.detail) assert.strictEqual(warning.detail, testDetail); <add>}, 15)); <add> <add>class CustomWarning extends Error { <add> constructor() { <add> super(); <add> this.name = testType; <add> this.message = testMsg; <add> this.code = testCode; <add> Error.captureStackTrace(this, CustomWarning); <add> } <ide> } <del>util.inherits(CustomWarning, Error); <del>process.emitWarning(new CustomWarning()); <add> <add>[ <add> [testMsg], <add> [testMsg, testType], <add> [testMsg, CustomWarning], <add> [testMsg, testType, CustomWarning], <add> [testMsg, testType, testCode], <add> [testMsg, { type: testType }], <add> [testMsg, { type: testType, code: testCode }], <add> [testMsg, { type: testType, code: testCode, detail: testDetail }], <add> [new CustomWarning()], <add> // detail will be ignored for the following. No errors thrown <add> [testMsg, { type: testType, code: testCode, detail: true }], <add> [testMsg, { type: testType, code: testCode, detail: [] }], <add> [testMsg, { type: testType, code: testCode, detail: null }], <add> [testMsg, { type: testType, code: testCode, detail: 1 }] <add>].forEach((i) => { <add> assert.doesNotThrow(() => process.emitWarning.apply(null, i)); <add>}); <ide> <ide> const warningNoToString = new CustomWarning(); <ide> warningNoToString.toString = null; <ide> assert.throws(() => process.emitWarning(1), expectedError); <ide> assert.throws(() => process.emitWarning({}), expectedError); <ide> assert.throws(() => process.emitWarning(true), expectedError); <ide> assert.throws(() => process.emitWarning([]), expectedError); <del>assert.throws(() => process.emitWarning('', {}), expectedError); <ide> assert.throws(() => process.emitWarning('', '', {}), expectedError); <ide> assert.throws(() => process.emitWarning('', 1), expectedError); <ide> assert.throws(() => process.emitWarning('', '', 1), expectedError);
3
Python
Python
fix hyperparameter_search doc
d20cbb886bd6ea5fe85b3b43112044562f9c3620
<ide><path>src/transformers/trainer.py <ide> def hyperparameter_search( <ide> **kwargs <ide> ) -> BestRun: <ide> """ <del> Launch an hyperparameter search using ``optuna`` or ``Ray Tune``. The optimized quantity is determined by the <del> method, which is the evaluation loss when no metric is provided, the sum of all metrics otherwise (you can <del> change that behavior by subclassing and overriding this method). <add> Launch an hyperparameter search using ``optuna`` or ``Ray Tune``. The optimized quantity is determined by <add> :obj:`compute_objectie`, which defaults to a function returning the evaluation loss when no metric is provided, <add> the sum of all metrics otherwise. <ide> <ide> Args: <ide> hp_space (:obj:`Callable[["optuna.Trial"], Dict[str, float]]`, `optional`): <ide> def hyperparameter_search( <ide> Additional keyword arguments passed along to :obj:`optuna.create_study` or :obj:`ray.tune.run`. For <ide> more information see: <ide> <del> - the documentation of `optuna.create_stufy <https://optuna.readthedocs.io/en/stable/reference/alias_generated/optuna.create_study.html#optuna.create_study>`__ <add> - the documentation of `optuna.create_study <https://optuna.readthedocs.io/en/stable/reference/alias_generated/optuna.create_study.html#optuna.create_study>`__ <ide> - the documentation of `tune.run <https://docs.ray.io/en/latest/tune/api_docs/execution.html#tune-run>`__ <ide> <ide> Returns:
1
Javascript
Javascript
prevent cursor up and cursor down from scrolling
9be5d8affd61d600ce5b1790b23a9caf28d5fc40
<ide><path>examples/js/controls/OrbitControls.js <ide> THREE.OrbitControls = function ( object, domElement ) { <ide> <ide> //console.log( 'handleKeyDown' ); <ide> <add> // prevent the browser from scrolling on cursor up/down <add> <add> event.preventDefault(); <add> <ide> switch ( event.keyCode ) { <ide> <ide> case scope.keys.UP:
1
PHP
PHP
fix bug in pivot class
e4fa40a23f71d9b9643d29d6149727a7aa3cdca3
<ide><path>src/Illuminate/Database/Eloquent/Relations/Pivot.php <ide> protected function setKeysForSaveQuery($query) <ide> { <ide> $query->where($this->foreignKey, $this->getAttribute($this->foreignKey)); <ide> <del> $query->where($this->otherKey, $this->getAttribute($this->otherKey)); <add> return $query->where($this->otherKey, $this->getAttribute($this->otherKey)); <ide> } <ide> <ide> /**
1
Javascript
Javascript
replace s_client in test-https-ci-reneg-attack
43c2a13c9334dad4b1f911dfcb455e8f8a9e4611
<ide><path>test/pummel/test-https-ci-reneg-attack.js <ide> if (!common.opensslCli) <ide> common.skip('node compiled without OpenSSL CLI.'); <ide> <ide> const assert = require('assert'); <del>const spawn = require('child_process').spawn; <ide> const tls = require('tls'); <ide> const https = require('https'); <ide> const fixtures = require('../common/fixtures'); <ide> function test(next) { <ide> }); <ide> <ide> server.listen(0, function() { <del> const cmd = `s_client -connect 127.0.0.1:${server.address().port}`; <del> const args = cmd.split(' '); <del> const child = spawn(common.opensslCli, args); <del> <del> child.stdout.resume(); <del> child.stderr.resume(); <add> const agent = https.Agent({ <add> keepAlive: true, <add> }); <ide> <del> // Count handshakes, start the attack after the initial handshake is done <del> let handshakes = 0; <add> let client; <ide> let renegs = 0; <ide> <del> child.stderr.on('data', function(data) { <del> handshakes += ((String(data)).match(/verify return:1/g) || []).length; <del> if (handshakes === 2) spam(); <del> renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length; <del> }); <add> const options = { <add> rejectUnauthorized: false, <add> agent <add> }; <ide> <del> child.on('exit', function() { <del> assert.strictEqual(renegs, tls.CLIENT_RENEG_LIMIT + 1); <del> server.close(); <del> process.nextTick(next); <del> }); <add> const { port } = server.address(); <add> <add> https.get(`https://localhost:${port}/`, options, (res) => { <add> client = res.socket; <ide> <del> let closed = false; <del> child.stdin.on('error', function(err) { <del> switch (err.code) { <del> case 'ECONNRESET': <del> case 'EPIPE': <del> break; <del> default: <del> assert.strictEqual(err.code, 'ECONNRESET'); <del> break; <add> client.on('close', function(hadErr) { <add> assert.strictEqual(hadErr, false); <add> assert.strictEqual(renegs, tls.CLIENT_RENEG_LIMIT + 1); <add> server.close(); <add> process.nextTick(next); <add> }); <add> <add> client.on('error', function(err) { <add> console.log('CLIENT ERR', err); <add> throw err; <add> }); <add> <add> spam(); <add> <add> // simulate renegotiation attack <add> function spam() { <add> client.renegotiate({}, (err) => { <add> assert.ifError(err); <add> assert.ok(renegs <= tls.CLIENT_RENEG_LIMIT); <add> setImmediate(spam); <add> }); <add> renegs++; <ide> } <del> closed = true; <del> }); <del> child.stdin.on('close', function() { <del> closed = true; <ide> }); <ide> <del> // simulate renegotiation attack <del> function spam() { <del> if (closed) return; <del> child.stdin.write('R\n'); <del> setTimeout(spam, 50); <del> } <ide> }); <ide> }
1
Ruby
Ruby
remove unused code
ad44ece292d477e05321fff6037a4423c0e53c2f
<ide><path>actionpack/lib/action_view/helpers/form_helper.rb <ide> def instantiate_builder(record_name, record_object, options, &block) <ide> end <ide> end <ide> <del> class InstanceTag <del> include Helpers::ActiveModelInstanceTag, Helpers::TagHelper, Helpers::FormTagHelper <del> <del> attr_reader :object, :method_name, :object_name <del> <del> def initialize(object_name, method_name, template_object, object = nil) <del> @object_name, @method_name = object_name.to_s.dup, method_name.to_s.dup <del> @template_object = template_object <del> <del> @object_name.sub!(/\[\]$/,"") || @object_name.sub!(/\[\]\]$/,"]") <del> @object = retrieve_object(object) <del> @auto_index = retrieve_autoindex(Regexp.last_match.pre_match) if Regexp.last_match <del> end <del> <del> def retrieve_object(object) <del> if object <del> object <del> elsif @template_object.instance_variable_defined?("@#{@object_name}") <del> @template_object.instance_variable_get("@#{@object_name}") <del> end <del> rescue NameError <del> # As @object_name may contain the nested syntax (item[subobject]) we need to fallback to nil. <del> nil <del> end <del> <del> def retrieve_autoindex(pre_match) <del> object = self.object || @template_object.instance_variable_get("@#{pre_match}") <del> if object && object.respond_to?(:to_param) <del> object.to_param <del> else <del> raise ArgumentError, "object[] naming but object param and @object var don't exist or don't respond to to_param: #{object.inspect}" <del> end <del> end <del> <del> def value(object) <del> object.send @method_name if object <del> end <del> end <del> <ide> class FormBuilder <ide> # The methods which wrap a form helper call. <ide> class_attribute :field_helpers
1
Ruby
Ruby
avoid shot circuit return
aba688ed5c3d31cc6337a2c772ea30853fe89a90
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb <ide> def type_cast(value, column, array_member = false) <ide> <ide> case value <ide> when Range <del> return super(value, column) unless /range$/ =~ column.sql_type <del> PostgreSQLColumn.range_to_string(value) <add> if /range$/ =~ column.sql_type <add> PostgreSQLColumn.range_to_string(value) <add> else <add> super(value, column) <add> end <ide> when NilClass <ide> if column.array && array_member <ide> 'NULL' <ide> def type_cast(value, column, array_member = false) <ide> when 'point' then PostgreSQLColumn.point_to_string(value) <ide> when 'json' then PostgreSQLColumn.json_to_string(value) <ide> else <del> return super(value, column) unless column.array <del> PostgreSQLColumn.array_to_string(value, column, self) <add> if column.array <add> PostgreSQLColumn.array_to_string(value, column, self) <add> else <add> super(value, column) <add> end <ide> end <ide> when String <del> return super(value, column) unless 'bytea' == column.sql_type <del> { :value => value, :format => 1 } <add> if 'bytea' == column.sql_type <add> { value: value, format: 1 } <add> else <add> super(value, column) <add> end <ide> when Hash <ide> case column.sql_type <ide> when 'hstore' then PostgreSQLColumn.hstore_to_string(value) <ide> when 'json' then PostgreSQLColumn.json_to_string(value) <ide> else super(value, column) <ide> end <ide> when IPAddr <del> return super(value, column) unless ['inet','cidr'].include? column.sql_type <del> PostgreSQLColumn.cidr_to_string(value) <add> if ['inet','cidr'].include? column.sql_type <add> PostgreSQLColumn.cidr_to_string(value) <add> else <add> super(value, column) <add> end <ide> else <ide> super(value, column) <ide> end
1
Javascript
Javascript
remove temporary variables
f035349d9deed70872f46e7b11af4a7631533f91
<ide><path>src/geometries/ExtrudeGeometry.js <ide> function ExtrudeBufferGeometry( shapes, options ) { <ide> <ide> t = b / bevelSegments; <ide> z = bevelThickness * Math.cos( t * Math.PI / 2 ); <del> var s = Math.sin( t * Math.PI / 2 ); <del> bs = bevelSize * s + bevelBaseSize; <add> bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelBaseSize; <ide> <ide> // contract shape <ide> <ide> function ExtrudeBufferGeometry( shapes, options ) { <ide> <ide> t = b / bevelSegments; <ide> z = bevelThickness * Math.cos( t * Math.PI / 2 ); <del> var s = Math.sin( t * Math.PI / 2 ); <del> bs = bevelSize * s + bevelBaseSize; <add> bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelBaseSize; <ide> <ide> // contract shape <ide>
1
Javascript
Javascript
add integration test
460b099a631a9159297a8520be97f00af11c8632
<ide><path>lib/Watching.js <ide> class Watching { <ide> this.watcher.pause(); <ide> this.watcher = null; <ide> } <add> <ide> if (this.running) { <ide> this.invalid = true; <ide> return false; <ide> class Watching { <ide> <ide> suspend() { <ide> this.suspended = true; <add> this.invalid = false; <ide> } <ide> <ide> resume() { <ide><path>test/WatchSuspend.test.js <ide> describe("WatchSuspend", () => { <ide> <ide> jest.setTimeout(5000); <ide> <del> describe("suspend ans resume watcher", () => { <add> describe("suspend and resume watcher", () => { <ide> const fixturePath = path.join( <ide> __dirname, <ide> "fixtures", <ide> "temp-watch-" + Date.now() <ide> ); <ide> const filePath = path.join(fixturePath, "file.js"); <add> const outputPath = path.join(fixturePath, "bundle.js"); <ide> let compiler = null; <ide> let watching = null; <add> let onChange = null; <ide> <ide> beforeAll(() => { <ide> try { <ide> describe("WatchSuspend", () => { <ide> } catch (e) { <ide> // skip <ide> } <del> }); <del> <del> afterAll(done => { <del> watching.close(); <del> compiler = null; <del> setTimeout(() => { <del> try { <del> fs.unlinkSync(filePath); <del> } catch (e) { <del> // skip <del> } <del> try { <del> fs.rmdirSync(fixturePath); <del> } catch (e) { <del> // skip <del> } <del> done(); <del> }, 100); // cool down a bit <del> }); <del> <del> it("should compile successfully", done => { <ide> compiler = webpack({ <ide> mode: "development", <ide> entry: filePath, <ide> describe("WatchSuspend", () => { <ide> filename: "bundle.js" <ide> } <ide> }); <del> watching = compiler.watch({ aggregateTimeout: 50 }, err => { <del> expect(err).toBe(null); <del> done(); <add> watching = compiler.watch({ aggregateTimeout: 50 }, () => {}); <add> compiler.hooks.done.tap("WatchSuspendTest", () => { <add> if (onChange) onChange(); <ide> }); <ide> }); <ide> <add> afterAll(() => { <add> watching.close(); <add> compiler = null; <add> try { <add> fs.unlinkSync(filePath); <add> } catch (e) { <add> // skip <add> } <add> try { <add> fs.rmdirSync(fixturePath); <add> } catch (e) { <add> // skip <add> } <add> }); <add> <add> it("should compile successfully", done => { <add> onChange = () => { <add> expect(fs.readFileSync(outputPath, "utf-8")).toContain("'foo'"); <add> onChange = null; <add> done(); <add> }; <add> }); <add> <ide> it("should suspend compilation", done => { <del> const spy = jest.fn(); <add> onChange = jest.fn(); <ide> watching.suspend(); <ide> fs.writeFileSync(filePath, "'bar'", "utf-8"); <del> compiler.hooks.compilation.tap("WatchSuspendTest", spy); <del> // compiler.hooks.done.tap("WatchSuspendTest", spy); <ide> setTimeout(() => { <del> expect(spy.mock.calls.length).toBe(0); <add> expect(onChange.mock.calls.length).toBe(0); <add> onChange = null; <ide> done(); <del> }, 100); // 2x aggregateTimeout <add> }, 1000); <ide> }); <ide> <ide> it("should resume compilation", done => { <del> compiler.hooks.done.tap("WatchSuspendTest", () => { <del> const outputPath = path.join(fixturePath, "bundle.js"); <add> onChange = () => { <ide> expect(fs.readFileSync(outputPath, "utf-8")).toContain("'bar'"); <add> onChange = null; <ide> done(); <del> }); <add> }; <ide> watching.resume(); <ide> }); <ide> });
2
Javascript
Javascript
fix lint errors
43e92fa71897bc8aff6a4322e9101c1279661667
<ide><path>tasks/transpile.js <ide> module.exports = function (grunt) { <ide> grunt.log.ok('build/umd/min/moment-with-locales.custom.js'); <ide> }).then(function () { <ide> var moment = require('../build/umd/min/moment-with-locales.custom.js'); <del> if (moment.locales().filter(locale => locale !== 'en').length !== localeFiles.length) { <add> if (moment.locales().filter(function (locale) { <add> return locale !== 'en'; <add> }).length !== localeFiles.length) { <ide> throw new Error( <ide> 'You probably specified locales requiring ' + <ide> 'parent locale, but didn\'t specify parent');
1
Go
Go
hold logfile lock less on readlogs
a67e1599096a6810fe5e40791e7ece317c9ba67f
<ide><path>daemon/logger/loggerutils/logfile.go <ide> func (w *LogFile) readLogsLocked(currentPos logPos, config logger.ReadConfig, wa <ide> // <ide> // This method must only be called with w.fsopMu locked for reading. <ide> func (w *LogFile) openRotatedFiles(config logger.ReadConfig) (files []readAtCloser, err error) { <add> type rotatedFile struct { <add> f *os.File <add> compressed bool <add> } <add> <add> var q []rotatedFile <ide> defer func() { <del> w.fsopMu.RUnlock() <del> if err == nil { <del> return <del> } <del> for _, f := range files { <del> f.Close() <add> if err != nil { <add> for _, qq := range q { <add> qq.f.Close() <add> } <add> for _, f := range files { <add> f.Close() <add> } <ide> } <ide> }() <ide> <del> for i := w.maxFiles; i > 1; i-- { <del> var f readAtCloser <del> f, err = open(fmt.Sprintf("%s.%d", w.f.Name(), i-1)) <del> if err != nil { <del> if !errors.Is(err, fs.ErrNotExist) { <del> return nil, errors.Wrap(err, "error opening rotated log file") <del> } <add> q, err = func() (q []rotatedFile, err error) { <add> defer w.fsopMu.RUnlock() <ide> <del> f, err = w.maybeDecompressFile(fmt.Sprintf("%s.%d.gz", w.f.Name(), i-1), config) <add> q = make([]rotatedFile, 0, w.maxFiles) <add> for i := w.maxFiles; i > 1; i-- { <add> var f rotatedFile <add> f.f, err = open(fmt.Sprintf("%s.%d", w.f.Name(), i-1)) <ide> if err != nil { <ide> if !errors.Is(err, fs.ErrNotExist) { <del> return nil, err <add> return nil, errors.Wrap(err, "error opening rotated log file") <add> } <add> f.compressed = true <add> f.f, err = open(fmt.Sprintf("%s.%d.gz", w.f.Name(), i-1)) <add> if err != nil { <add> if !errors.Is(err, fs.ErrNotExist) { <add> return nil, errors.Wrap(err, "error opening file for decompression") <add> } <add> continue <ide> } <del> continue <del> } else if f == nil { <del> // The log before `config.Since` does not need to read <del> continue <ide> } <add> q = append(q, f) <ide> } <del> files = append(files, f) <add> return q, nil <add> }() <add> if err != nil { <add> return nil, err <ide> } <ide> <add> for len(q) > 0 { <add> qq := q[0] <add> q = q[1:] <add> if qq.compressed { <add> defer qq.f.Close() <add> f, err := w.maybeDecompressFile(qq.f, config) <add> if err != nil { <add> return nil, err <add> } <add> if f != nil { <add> // The log before `config.Since` does not need to read <add> files = append(files, f) <add> } <add> } else { <add> files = append(files, qq.f) <add> } <add> } <ide> return files, nil <ide> } <ide> <del>func (w *LogFile) maybeDecompressFile(fileName string, config logger.ReadConfig) (readAtCloser, error) { <del> cf, err := open(fileName) <del> if err != nil { <del> return nil, errors.Wrap(err, "error opening file for decompression") <del> } <del> defer cf.Close() <del> <add>func (w *LogFile) maybeDecompressFile(cf *os.File, config logger.ReadConfig) (readAtCloser, error) { <ide> rc, err := gzip.NewReader(cf) <ide> if err != nil { <ide> return nil, errors.Wrap(err, "error making gzip reader for compressed log file")
1
Java
Java
apply consistent ordering in hierarchical contexts
0d2bfc926f425c1c1219e38e5f06a5a9dca04e13
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java <ide> public FactoryAwareOrderSourceProvider(Map<Object, String> instancesToBeanNames) <ide> @Nullable <ide> public Object getOrderSource(Object obj) { <ide> String beanName = this.instancesToBeanNames.get(obj); <del> if (beanName == null || !containsBeanDefinition(beanName)) { <add> if (beanName == null) { <ide> return null; <ide> } <del> RootBeanDefinition beanDefinition = getMergedLocalBeanDefinition(beanName); <del> List<Object> sources = new ArrayList<>(2); <del> Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); <del> if (factoryMethod != null) { <del> sources.add(factoryMethod); <add> try { <add> RootBeanDefinition beanDefinition = (RootBeanDefinition) getMergedBeanDefinition(beanName); <add> List<Object> sources = new ArrayList<>(2); <add> Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); <add> if (factoryMethod != null) { <add> sources.add(factoryMethod); <add> } <add> Class<?> targetType = beanDefinition.getTargetType(); <add> if (targetType != null && targetType != obj.getClass()) { <add> sources.add(targetType); <add> } <add> return sources.toArray(); <ide> } <del> Class<?> targetType = beanDefinition.getTargetType(); <del> if (targetType != null && targetType != obj.getClass()) { <del> sources.add(targetType); <add> catch (NoSuchBeanDefinitionException ex) { <add> return null; <ide> } <del> return sources.toArray(); <ide> } <ide> } <ide> <ide><path>spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java <ide> void autowireBeanByTypePrimaryTakesPrecedenceOverPriority() { <ide> assertThat(bean.getSpouse()).isEqualTo(lbf.getBean("spouse")); <ide> } <ide> <add> @Test <add> void beanProviderWithParentBeanFactoryReuseOrder() { <add> DefaultListableBeanFactory parentBf = new DefaultListableBeanFactory(); <add> parentBf.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE); <add> parentBf.registerBeanDefinition("regular", new RootBeanDefinition(TestBean.class)); <add> parentBf.registerBeanDefinition("test", new RootBeanDefinition(HighPriorityTestBean.class)); <add> lbf.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE); <add> lbf.setParentBeanFactory(parentBf); <add> lbf.registerBeanDefinition("low", new RootBeanDefinition(LowPriorityTestBean.class)); <add> List<Class<?>> orderedTypes = lbf.getBeanProvider(TestBean.class).orderedStream() <add> .map(Object::getClass).collect(Collectors.toList()); <add> assertThat(orderedTypes).containsExactly( <add> HighPriorityTestBean.class, LowPriorityTestBean.class, TestBean.class); <add> } <add> <ide> @Test <ide> void autowireExistingBeanByName() { <ide> RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); <ide><path>spring-context/src/test/java/org/springframework/context/annotation/Gh29105Tests.java <add>/* <add> * Copyright 2002-2022 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * https://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.context.annotation; <add> <add>import java.util.List; <add>import java.util.stream.Collectors; <add> <add>import org.junit.jupiter.api.Test; <add> <add>import org.springframework.core.annotation.Order; <add> <add>import static org.assertj.core.api.Assertions.assertThat; <add> <add>/** <add> * Tests for gh-29105. <add> * <add> * @author Stephane Nicoll <add> */ <add>public class Gh29105Tests { <add> <add> @Test <add> void beanProviderWithParentContextReuseOrder() { <add> AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(); <add> parent.register(DefaultConfiguration.class); <add> parent.register(CustomConfiguration.class); <add> parent.refresh(); <add> <add> AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext(); <add> child.setParent(parent); <add> child.register(DefaultConfiguration.class); <add> child.refresh(); <add> <add> List<Class<?>> orderedTypes = child.getBeanProvider(MyService.class) <add> .orderedStream().map(Object::getClass).collect(Collectors.toList()); <add> assertThat(orderedTypes).containsExactly(CustomService.class, DefaultService.class); <add> } <add> <add> <add> interface MyService {} <add> <add> static class CustomService implements MyService {} <add> <add> static class DefaultService implements MyService {} <add> <add> <add> @Configuration <add> static class CustomConfiguration { <add> <add> @Bean <add> @Order(-1) <add> CustomService customService() { <add> return new CustomService(); <add> } <add> <add> } <add> <add> @Configuration <add> static class DefaultConfiguration { <add> <add> @Bean <add> @Order(0) <add> DefaultService defaultService() { <add> return new DefaultService(); <add> } <add> <add> } <add>}
3
Text
Text
add new included libs doc
c71bccd72c9c017ced0c5fc2b74dae71e05369df
<ide><path>docs/packages/included_libraries.md <add># Included Libraries <add> <add>All packages can `require` the following popular libraries in their packages: <add> <add>* [SpacePen](https://github.com/nathansobo/space-pen) (as `require 'space-pen'`) <add>* [jQuery](http://jquery.com/) (as `require 'jquery'`) <add>* [Underscore](http://underscorejs.org/) (as `require 'underscore'`) <add> <add>You can get an idea of the full list by browsing Atom's _node_modules_ folder.
1
Javascript
Javascript
restore original styles when removing hover
da3aa68f38b9db25156c3b32c56098f9ca70f4d8
<ide><path>karma.conf.js <ide> module.exports = function(karma) { <ide> // These settings deal with browser disconnects. We had seen test flakiness from Firefox <ide> // [Firefox 56.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms. <ide> // https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551 <del> browserNoActivityTimeout: 60000, <ide> browserDisconnectTolerance: 3 <ide> }; <ide> <ide><path>src/controllers/controller.bar.js <ide> module.exports = function(Chart) { <ide> <ide> helpers.canvas.unclipArea(chart.ctx); <ide> }, <del> <del> setHoverStyle: function(rectangle) { <del> var dataset = this.chart.data.datasets[rectangle._datasetIndex]; <del> var index = rectangle._index; <del> var custom = rectangle.custom || {}; <del> var model = rectangle._model; <del> <del> model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); <del> model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor)); <del> model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); <del> }, <del> <del> removeHoverStyle: function(rectangle) { <del> var dataset = this.chart.data.datasets[rectangle._datasetIndex]; <del> var index = rectangle._index; <del> var custom = rectangle.custom || {}; <del> var model = rectangle._model; <del> var rectangleElementOptions = this.chart.options.elements.rectangle; <del> <del> model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor); <del> model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor); <del> model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth); <del> } <ide> }); <ide> <ide> Chart.controllers.horizontalBar = Chart.controllers.bar.extend({ <ide><path>src/controllers/controller.bubble.js <ide> module.exports = function(Chart) { <ide> setHoverStyle: function(point) { <ide> var model = point._model; <ide> var options = point._options; <del> <add> point.$previousStyle = { <add> backgroundColor: model.backgroundColor, <add> borderColor: model.borderColor, <add> borderWidth: model.borderWidth, <add> radius: model.radius <add> }; <ide> model.backgroundColor = helpers.valueOrDefault(options.hoverBackgroundColor, helpers.getHoverColor(options.backgroundColor)); <ide> model.borderColor = helpers.valueOrDefault(options.hoverBorderColor, helpers.getHoverColor(options.borderColor)); <ide> model.borderWidth = helpers.valueOrDefault(options.hoverBorderWidth, options.borderWidth); <ide> model.radius = options.radius + options.hoverRadius; <ide> }, <ide> <del> /** <del> * @protected <del> */ <del> removeHoverStyle: function(point) { <del> var model = point._model; <del> var options = point._options; <del> <del> model.backgroundColor = options.backgroundColor; <del> model.borderColor = options.borderColor; <del> model.borderWidth = options.borderWidth; <del> model.radius = options.radius; <del> }, <del> <ide> /** <ide> * @private <ide> */ <ide><path>src/controllers/controller.doughnut.js <ide> module.exports = function(Chart) { <ide> }); <ide> <ide> var model = arc._model; <add> <ide> // Resets the visual styles <del> this.removeHoverStyle(arc); <add> var custom = arc.custom || {}; <add> var valueOrDefault = helpers.valueAtIndexOrDefault; <add> var elementOpts = this.chart.options.elements.arc; <add> model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor); <add> model.borderColor = custom.borderColor ? custom.borderColor : valueOrDefault(dataset.borderColor, index, elementOpts.borderColor); <add> model.borderWidth = custom.borderWidth ? custom.borderWidth : valueOrDefault(dataset.borderWidth, index, elementOpts.borderWidth); <ide> <ide> // Set correct angles if not resetting <ide> if (!reset || !animationOpts.animateRotate) { <ide> module.exports = function(Chart) { <ide> arc.pivot(); <ide> }, <ide> <del> removeHoverStyle: function(arc) { <del> Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); <del> }, <del> <ide> calculateTotal: function() { <ide> var dataset = this.getDataset(); <ide> var meta = this.getMeta(); <ide><path>src/controllers/controller.line.js <ide> module.exports = function(Chart) { <ide> } <ide> }, <ide> <del> setHoverStyle: function(point) { <add> setHoverStyle: function(element) { <ide> // Point <del> var dataset = this.chart.data.datasets[point._datasetIndex]; <del> var index = point._index; <del> var custom = point.custom || {}; <del> var model = point._model; <add> var dataset = this.chart.data.datasets[element._datasetIndex]; <add> var index = element._index; <add> var custom = element.custom || {}; <add> var model = element._model; <add> <add> element.$previousStyle = { <add> backgroundColor: model.backgroundColor, <add> borderColor: model.borderColor, <add> borderWidth: model.borderWidth, <add> radius: model.radius <add> }; <ide> <del> model.radius = custom.hoverRadius || helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); <ide> model.backgroundColor = custom.hoverBackgroundColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); <ide> model.borderColor = custom.hoverBorderColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor)); <ide> model.borderWidth = custom.hoverBorderWidth || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth); <add> model.radius = custom.hoverRadius || helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); <ide> }, <del> <del> removeHoverStyle: function(point) { <del> var me = this; <del> var dataset = me.chart.data.datasets[point._datasetIndex]; <del> var index = point._index; <del> var custom = point.custom || {}; <del> var model = point._model; <del> <del> // Compatibility: If the properties are defined with only the old name, use those values <del> if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) { <del> dataset.pointRadius = dataset.radius; <del> } <del> <del> model.radius = custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, me.chart.options.elements.point.radius); <del> model.backgroundColor = me.getPointBackgroundColor(point, index); <del> model.borderColor = me.getPointBorderColor(point, index); <del> model.borderWidth = me.getPointBorderWidth(point, index); <del> } <ide> }); <ide> }; <ide><path>src/controllers/controller.polarArea.js <ide> module.exports = function(Chart) { <ide> }); <ide> <ide> // Apply border and fill style <del> me.removeHoverStyle(arc); <add> var elementOpts = this.chart.options.elements.arc; <add> var custom = arc.custom || {}; <add> var valueOrDefault = helpers.valueAtIndexOrDefault; <add> var model = arc._model; <ide> <del> arc.pivot(); <del> }, <add> model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor); <add> model.borderColor = custom.borderColor ? custom.borderColor : valueOrDefault(dataset.borderColor, index, elementOpts.borderColor); <add> model.borderWidth = custom.borderWidth ? custom.borderWidth : valueOrDefault(dataset.borderWidth, index, elementOpts.borderWidth); <ide> <del> removeHoverStyle: function(arc) { <del> Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); <add> arc.pivot(); <ide> }, <ide> <ide> countVisibleElements: function() { <ide><path>src/controllers/controller.radar.js <ide> module.exports = function(Chart) { <ide> var index = point._index; <ide> var model = point._model; <ide> <add> point.$previousStyle = { <add> backgroundColor: model.backgroundColor, <add> borderColor: model.borderColor, <add> borderWidth: model.borderWidth, <add> radius: model.radius <add> }; <add> <ide> model.radius = custom.hoverRadius ? custom.hoverRadius : helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); <ide> model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); <ide> model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor)); <ide> model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth); <ide> }, <del> <del> removeHoverStyle: function(point) { <del> var dataset = this.chart.data.datasets[point._datasetIndex]; <del> var custom = point.custom || {}; <del> var index = point._index; <del> var model = point._model; <del> var pointElementOptions = this.chart.options.elements.point; <del> <del> model.radius = custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius); <del> model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor); <del> model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor); <del> model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth); <del> } <ide> }); <ide> }; <ide><path>src/core/core.datasetController.js <ide> module.exports = function(Chart) { <ide> } <ide> }, <ide> <del> removeHoverStyle: function(element, elementOpts) { <del> var dataset = this.chart.data.datasets[element._datasetIndex]; <del> var index = element._index; <del> var custom = element.custom || {}; <del> var valueOrDefault = helpers.valueAtIndexOrDefault; <del> var model = element._model; <del> <del> model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor); <del> model.borderColor = custom.borderColor ? custom.borderColor : valueOrDefault(dataset.borderColor, index, elementOpts.borderColor); <del> model.borderWidth = custom.borderWidth ? custom.borderWidth : valueOrDefault(dataset.borderWidth, index, elementOpts.borderWidth); <add> removeHoverStyle: function(element) { <add> helpers.merge(element._model, element.$previousStyle || {}); <add> delete element.$previousStyle; <ide> }, <ide> <ide> setHoverStyle: function(element) { <ide> module.exports = function(Chart) { <ide> var getHoverColor = helpers.getHoverColor; <ide> var model = element._model; <ide> <add> element.$previousStyle = { <add> backgroundColor: model.backgroundColor, <add> borderColor: model.borderColor, <add> borderWidth: model.borderWidth <add> }; <add> <ide> model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : valueOrDefault(dataset.hoverBackgroundColor, index, getHoverColor(model.backgroundColor)); <ide> model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : valueOrDefault(dataset.hoverBorderColor, index, getHoverColor(model.borderColor)); <ide> model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : valueOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); <ide><path>test/specs/controller.bar.tests.js <ide> describe('Chart.controllers.bar', function() { <ide> <ide> var meta = chart.getDatasetMeta(1); <ide> var bar = meta.data[0]; <add> var helpers = window.Chart.helpers; <ide> <ide> // Change default <ide> chart.options.elements.rectangle.backgroundColor = 'rgb(128, 128, 128)'; <ide> chart.options.elements.rectangle.borderColor = 'rgb(15, 15, 15)'; <ide> chart.options.elements.rectangle.borderWidth = 3.14; <ide> <del> // Remove to defaults <add> chart.update(); <add> expect(bar._model.backgroundColor).toBe('rgb(128, 128, 128)'); <add> expect(bar._model.borderColor).toBe('rgb(15, 15, 15)'); <add> expect(bar._model.borderWidth).toBe(3.14); <add> meta.controller.setHoverStyle(bar); <add> expect(bar._model.backgroundColor).toBe(helpers.getHoverColor('rgb(128, 128, 128)')); <add> expect(bar._model.borderColor).toBe(helpers.getHoverColor('rgb(15, 15, 15)')); <add> expect(bar._model.borderWidth).toBe(3.14); <ide> meta.controller.removeHoverStyle(bar); <ide> expect(bar._model.backgroundColor).toBe('rgb(128, 128, 128)'); <ide> expect(bar._model.borderColor).toBe('rgb(15, 15, 15)'); <ide> describe('Chart.controllers.bar', function() { <ide> chart.data.datasets[1].borderColor = ['rgb(9, 9, 9)', 'rgb(0, 0, 0)']; <ide> chart.data.datasets[1].borderWidth = [2.5, 5]; <ide> <add> chart.update(); <add> expect(bar._model.backgroundColor).toBe('rgb(255, 255, 255)'); <add> expect(bar._model.borderColor).toBe('rgb(9, 9, 9)'); <add> expect(bar._model.borderWidth).toBe(2.5); <add> meta.controller.setHoverStyle(bar); <add> expect(bar._model.backgroundColor).toBe(helpers.getHoverColor('rgb(255, 255, 255)')); <add> expect(bar._model.borderColor).toBe(helpers.getHoverColor('rgb(9, 9, 9)')); <add> expect(bar._model.borderWidth).toBe(2.5); <ide> meta.controller.removeHoverStyle(bar); <ide> expect(bar._model.backgroundColor).toBe('rgb(255, 255, 255)'); <ide> expect(bar._model.borderColor).toBe('rgb(9, 9, 9)'); <ide> describe('Chart.controllers.bar', function() { <ide> borderWidth: 1.5 <ide> }; <ide> <add> chart.update(); <add> expect(bar._model.backgroundColor).toBe('rgb(255, 0, 0)'); <add> expect(bar._model.borderColor).toBe('rgb(0, 255, 0)'); <add> expect(bar._model.borderWidth).toBe(1.5); <add> meta.controller.setHoverStyle(bar); <add> expect(bar._model.backgroundColor).toBe(helpers.getHoverColor('rgb(255, 0, 0)')); <add> expect(bar._model.borderColor).toBe(helpers.getHoverColor('rgb(0, 255, 0)')); <add> expect(bar._model.borderWidth).toBe(1.5); <ide> meta.controller.removeHoverStyle(bar); <ide> expect(bar._model.backgroundColor).toBe('rgb(255, 0, 0)'); <ide> expect(bar._model.borderColor).toBe('rgb(0, 255, 0)'); <ide><path>test/specs/controller.doughnut.tests.js <ide> describe('Chart.controllers.doughnut', function() { <ide> var meta = chart.getDatasetMeta(0); <ide> var arc = meta.data[0]; <ide> <add> chart.update(); <add> meta.controller.setHoverStyle(arc); <ide> meta.controller.removeHoverStyle(arc); <ide> expect(arc._model.backgroundColor).toBe('rgb(255, 0, 0)'); <ide> expect(arc._model.borderColor).toBe('rgb(0, 0, 255)'); <ide> describe('Chart.controllers.doughnut', function() { <ide> chart.data.datasets[0].borderColor = 'rgb(18, 18, 18)'; <ide> chart.data.datasets[0].borderWidth = 1.56; <ide> <add> chart.update(); <add> meta.controller.setHoverStyle(arc); <ide> meta.controller.removeHoverStyle(arc); <ide> expect(arc._model.backgroundColor).toBe('rgb(9, 9, 9)'); <ide> expect(arc._model.borderColor).toBe('rgb(18, 18, 18)'); <ide> describe('Chart.controllers.doughnut', function() { <ide> chart.data.datasets[0].borderColor = ['rgb(18, 18, 18)']; <ide> chart.data.datasets[0].borderWidth = [0.1, 1.56]; <ide> <add> chart.update(); <add> meta.controller.setHoverStyle(arc); <ide> meta.controller.removeHoverStyle(arc); <ide> expect(arc._model.backgroundColor).toBe('rgb(255, 255, 255)'); <ide> expect(arc._model.borderColor).toBe('rgb(18, 18, 18)'); <ide> describe('Chart.controllers.doughnut', function() { <ide> borderWidth: 3.14159, <ide> }; <ide> <add> chart.update(); <add> meta.controller.setHoverStyle(arc); <ide> meta.controller.removeHoverStyle(arc); <ide> expect(arc._model.backgroundColor).toBe('rgb(7, 7, 7)'); <ide> expect(arc._model.borderColor).toBe('rgb(17, 17, 17)'); <ide><path>test/specs/controller.line.tests.js <ide> describe('Chart.controllers.line', function() { <ide> chart.options.elements.point.radius = 1.01; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(45, 46, 47)'); <ide> expect(point._model.borderColor).toBe('rgb(50, 51, 52)'); <ide> expect(point._model.borderWidth).toBe(10.1); <ide> describe('Chart.controllers.line', function() { <ide> chart.data.datasets[0].pointBorderWidth = 2.1; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(77, 79, 81)'); <ide> expect(point._model.borderColor).toBe('rgb(123, 125, 127)'); <ide> expect(point._model.borderWidth).toBe(2.1); <ide> describe('Chart.controllers.line', function() { <ide> chart.data.datasets[0].radius = 20; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(77, 79, 81)'); <ide> expect(point._model.borderColor).toBe('rgb(123, 125, 127)'); <ide> expect(point._model.borderWidth).toBe(2.1); <ide> describe('Chart.controllers.line', function() { <ide> }; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(0, 0, 0)'); <ide> expect(point._model.borderColor).toBe('rgb(10, 10, 10)'); <ide> expect(point._model.borderWidth).toBe(5.5); <ide><path>test/specs/controller.polarArea.tests.js <ide> describe('Chart.controllers.polarArea', function() { <ide> chart.options.elements.arc.borderColor = 'rgb(50, 51, 52)'; <ide> chart.options.elements.arc.borderWidth = 10.1; <ide> <add> meta.controller.setHoverStyle(arc); <add> chart.update(); <add> expect(arc._model.backgroundColor).toBe('rgb(45, 46, 47)'); <add> expect(arc._model.borderColor).toBe('rgb(50, 51, 52)'); <add> expect(arc._model.borderWidth).toBe(10.1); <add> <ide> meta.controller.removeHoverStyle(arc); <add> chart.update(); <ide> expect(arc._model.backgroundColor).toBe('rgb(45, 46, 47)'); <ide> expect(arc._model.borderColor).toBe('rgb(50, 51, 52)'); <ide> expect(arc._model.borderWidth).toBe(10.1); <ide> describe('Chart.controllers.polarArea', function() { <ide> chart.data.datasets[0].borderWidth = 2.1; <ide> <ide> meta.controller.removeHoverStyle(arc); <add> chart.update(); <ide> expect(arc._model.backgroundColor).toBe('rgb(77, 79, 81)'); <ide> expect(arc._model.borderColor).toBe('rgb(123, 125, 127)'); <ide> expect(arc._model.borderWidth).toBe(2.1); <ide> describe('Chart.controllers.polarArea', function() { <ide> }; <ide> <ide> meta.controller.removeHoverStyle(arc); <add> chart.update(); <ide> expect(arc._model.backgroundColor).toBe('rgb(0, 0, 0)'); <ide> expect(arc._model.borderColor).toBe('rgb(10, 10, 10)'); <ide> expect(arc._model.borderWidth).toBe(5.5); <ide><path>test/specs/controller.radar.tests.js <ide> describe('Chart.controllers.radar', function() { <ide> chart.options.elements.point.radius = 1.01; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(45, 46, 47)'); <ide> expect(point._model.borderColor).toBe('rgb(50, 51, 52)'); <ide> expect(point._model.borderWidth).toBe(10.1); <ide> describe('Chart.controllers.radar', function() { <ide> chart.data.datasets[0].pointBorderWidth = 2.1; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(77, 79, 81)'); <ide> expect(point._model.borderColor).toBe('rgb(123, 125, 127)'); <ide> expect(point._model.borderWidth).toBe(2.1); <ide> describe('Chart.controllers.radar', function() { <ide> }; <ide> <ide> meta.controller.removeHoverStyle(point); <add> chart.update(); <ide> expect(point._model.backgroundColor).toBe('rgb(0, 0, 0)'); <ide> expect(point._model.borderColor).toBe('rgb(10, 10, 10)'); <ide> expect(point._model.borderWidth).toBe(5.5);
13
Mixed
Text
clarify what docker diff shows
4497801c8a35ca2be9467419c5addff5166442d0
<ide><path>cli/command/container/diff.go <ide> func NewDiffCommand(dockerCli *command.DockerCli) *cobra.Command { <ide> <ide> return &cobra.Command{ <ide> Use: "diff CONTAINER", <del> Short: "Inspect changes on a container's filesystem", <add> Short: "Inspect changes to files or directories on a container's filesystem", <ide> Args: cli.ExactArgs(1), <ide> RunE: func(cmd *cobra.Command, args []string) error { <ide> opts.container = args[0] <ide><path>docs/reference/commandline/diff.md <ide> keywords: "list, changed, files, container" <ide> will be rejected. <ide> --> <ide> <del># diff <add>## diff <ide> <ide> ```markdown <ide> Usage: docker diff CONTAINER <ide> <del>Inspect changes on a container's filesystem <add>Inspect changes to files or directories on a container's filesystem <ide> <ide> Options: <ide> --help Print usage <ide> ``` <ide> <del>List the changed files and directories in a container᾿s filesystem. <del> There are 3 events that are listed in the `diff`: <add>List the changed files and directories in a container᾿s filesystem since the <add>container was created. Three different types of change are tracked: <ide> <del>1. `A` - Add <del>2. `D` - Delete <del>3. `C` - Change <add>| Symbol | Description | <add>|--------|---------------------------------| <add>| `A` | A file or directory was added | <add>| `D` | A file or directory was deleted | <add>| `C` | A file or directory was changed | <ide> <del>For example: <add>You can use the full or shortened container ID or the container name set using <add>`docker run --name` option. <ide> <del> $ docker diff 7bb0e258aefe <add>## Examples <ide> <del> C /dev <del> A /dev/kmsg <del> C /etc <del> A /etc/mtab <del> A /go <del> A /go/src <del> A /go/src/github.com <del> A /go/src/github.com/docker <del> A /go/src/github.com/docker/docker <del> A /go/src/github.com/docker/docker/.git <del> .... <add>Inspect the changes to an `nginx` container: <add> <add>```bash <add>$ docker diff 1fdfd1f54c1b <add> <add>C /dev <add>C /dev/console <add>C /dev/core <add>C /dev/stdout <add>C /dev/fd <add>C /dev/ptmx <add>C /dev/stderr <add>C /dev/stdin <add>C /run <add>A /run/nginx.pid <add>C /var/lib/nginx/tmp <add>A /var/lib/nginx/tmp/client_body <add>A /var/lib/nginx/tmp/fastcgi <add>A /var/lib/nginx/tmp/proxy <add>A /var/lib/nginx/tmp/scgi <add>A /var/lib/nginx/tmp/uwsgi <add>C /var/log/nginx <add>A /var/log/nginx/access.log <add>A /var/log/nginx/error.log <add>``` <ide><path>man/docker-diff.1.md <ide> % Docker Community <ide> % JUNE 2014 <ide> # NAME <del>docker-diff - Inspect changes on a container's filesystem <add>docker-diff - Inspect changes to files or directories on a container's filesystem <ide> <ide> # SYNOPSIS <ide> **docker diff** <ide> [**--help**] <ide> CONTAINER <ide> <ide> # DESCRIPTION <del>Inspect changes on a container's filesystem. You can use the full or <del>shortened container ID or the container name set using <add>List the changed files and directories in a container᾿s filesystem since the <add>container was created. Three different types of change are tracked: <add> <add>| Symbol | Description | <add>|--------|---------------------------------| <add>| `A` | A file or directory was added | <add>| `D` | A file or directory was deleted | <add>| `C` | A file or directory was changed | <add> <add>You can use the full or shortened container ID or the container name set using <ide> **docker run --name** option. <ide> <ide> # OPTIONS <ide> **--help** <ide> Print usage statement <ide> <ide> # EXAMPLES <del>Inspect the changes to on a nginx container: <del> <del> # docker diff 1fdfd1f54c1b <del> C /dev <del> C /dev/console <del> C /dev/core <del> C /dev/stdout <del> C /dev/fd <del> C /dev/ptmx <del> C /dev/stderr <del> C /dev/stdin <del> C /run <del> A /run/nginx.pid <del> C /var/lib/nginx/tmp <del> A /var/lib/nginx/tmp/client_body <del> A /var/lib/nginx/tmp/fastcgi <del> A /var/lib/nginx/tmp/proxy <del> A /var/lib/nginx/tmp/scgi <del> A /var/lib/nginx/tmp/uwsgi <del> C /var/log/nginx <del> A /var/log/nginx/access.log <del> A /var/log/nginx/error.log <add> <add>Inspect the changes to an `nginx` container: <add> <add>```bash <add>$ docker diff 1fdfd1f54c1b <add> <add>C /dev <add>C /dev/console <add>C /dev/core <add>C /dev/stdout <add>C /dev/fd <add>C /dev/ptmx <add>C /dev/stderr <add>C /dev/stdin <add>C /run <add>A /run/nginx.pid <add>C /var/lib/nginx/tmp <add>A /var/lib/nginx/tmp/client_body <add>A /var/lib/nginx/tmp/fastcgi <add>A /var/lib/nginx/tmp/proxy <add>A /var/lib/nginx/tmp/scgi <add>A /var/lib/nginx/tmp/uwsgi <add>C /var/log/nginx <add>A /var/log/nginx/access.log <add>A /var/log/nginx/error.log <add>``` <ide> <ide> <ide> # HISTORY
3
Python
Python
fix handling of deadlocked jobs
2e0421a28347de9a24bb14f37d33988c50b901b2
<ide><path>airflow/bin/cli.py <ide> def process_subdir(subdir): <ide> def get_dag(args): <ide> dagbag = DagBag(process_subdir(args.subdir)) <ide> if args.dag_id not in dagbag.dags: <del> raise AirflowException('dag_id could not be found') <add> raise AirflowException( <add> 'dag_id could not be found: {}'.format(args.dag_id)) <ide> return dagbag.dags[args.dag_id] <ide> <ide> <ide><path>airflow/jobs.py <ide> def process_dag(self, dag, executor): <ide> skip_tis = {(ti[0], ti[1]) for ti in qry.all()} <ide> <ide> descartes = [obj for obj in product(dag.tasks, active_runs)] <add> could_not_run = set() <ide> self.logger.info('Checking dependencies on {} tasks instances, minus {} ' <ide> 'skippable ones'.format(len(descartes), len(skip_tis))) <ide> for task, dttm in descartes: <ide> def process_dag(self, dag, executor): <ide> elif ti.is_runnable(flag_upstream_failed=True): <ide> self.logger.debug('Firing task: {}'.format(ti)) <ide> executor.queue_task_instance(ti, pickle_id=pickle_id) <add> else: <add> could_not_run.add(ti) <add> <add> # this type of deadlock happens when dagruns can't even start and so <add> # the TI's haven't been persisted to the database. <add> if len(could_not_run) == len(descartes): <add> self.logger.error( <add> 'Dag runs are deadlocked for DAG: {}'.format(dag.dag_id)) <add> (session <add> .query(models.DagRun) <add> .filter( <add> models.DagRun.dag_id == dag.dag_id, <add> models.DagRun.state == State.RUNNING, <add> models.DagRun.execution_date.in_(active_runs)) <add> .update( <add> {models.DagRun.state: State.FAILED}, <add> synchronize_session='fetch')) <ide> <ide> # Releasing the lock <ide> self.logger.debug("Unlocking DAG (scheduler_lock)") <ide> def _execute(self): <ide> <ide> # Build a list of all instances to run <ide> tasks_to_run = {} <del> failed = [] <del> succeeded = [] <del> started = [] <del> wont_run = [] <del> not_ready_to_run = set() <add> failed = set() <add> succeeded = set() <add> started = set() <add> skipped = set() <add> not_ready = set() <add> deadlocked = set() <ide> <ide> for task in self.dag.tasks: <ide> if (not self.include_adhoc) and task.adhoc: <ide> def _execute(self): <ide> session.commit() <ide> <ide> # Triggering what is ready to get triggered <del> deadlocked = False <ide> while tasks_to_run and not deadlocked: <del> <add> not_ready.clear() <ide> for key, ti in list(tasks_to_run.items()): <ide> <ide> ti.refresh_from_db() <ide> ignore_depends_on_past = ( <ide> self.ignore_first_depends_on_past and <ide> ti.execution_date == (start_date or ti.start_date)) <ide> <del> # Did the task finish without failing? -- then we're done <del> if ( <del> ti.state in (State.SUCCESS, State.SKIPPED) and <del> key in tasks_to_run): <del> succeeded.append(key) <del> tasks_to_run.pop(key) <add> # The task was already marked successful or skipped by a <add> # different Job. Don't rerun it. <add> if key not in started: <add> if ti.state == State.SUCCESS: <add> succeeded.add(key) <add> tasks_to_run.pop(key) <add> continue <add> elif ti.state == State.SKIPPED: <add> skipped.add(key) <add> tasks_to_run.pop(key) <add> continue <ide> <del> # Is the task runnable? -- the run it <del> elif ti.is_queueable( <add> # Is the task runnable? -- then run it <add> if ti.is_queueable( <ide> include_queued=True, <ide> ignore_depends_on_past=ignore_depends_on_past, <ide> flag_upstream_failed=True): <add> self.logger.debug('Sending {} to executor'.format(ti)) <ide> executor.queue_task_instance( <ide> ti, <ide> mark_success=self.mark_success, <ide> pickle_id=pickle_id, <ide> ignore_dependencies=self.ignore_dependencies, <ide> ignore_depends_on_past=ignore_depends_on_past, <ide> pool=self.pool) <del> ti.state = State.RUNNING <del> if key not in started: <del> started.append(key) <del> if ti in not_ready_to_run: <del> not_ready_to_run.remove(ti) <del> <del> # Mark the task as not ready to run. If the set of tasks <del> # that aren't ready ever equals the set of tasks to run, <del> # then the backfill is deadlocked <add> started.add(key) <add> <add> # Mark the task as not ready to run <ide> elif ti.state in (State.NONE, State.UPSTREAM_FAILED): <del> not_ready_to_run.add(ti) <del> if not_ready_to_run == set(tasks_to_run.values()): <del> msg = 'BackfillJob is deadlocked: no tasks can be run.' <del> if any( <del> t.are_dependencies_met() != <del> t.are_dependencies_met( <del> ignore_depends_on_past=True) <del> for t in tasks_to_run.values()): <del> msg += ( <del> ' Some of the tasks that were unable to ' <del> 'run have "depends_on_past=True". Try running ' <del> 'the backfill with the option ' <del> '"ignore_first_depends_on_past=True" ' <del> ' or passing "-I" at the command line.') <del> self.logger.error(msg) <del> deadlocked = True <del> wont_run.extend(not_ready_to_run) <del> tasks_to_run.clear() <add> self.logger.debug('Added {} to not_ready'.format(ti)) <add> not_ready.add(key) <ide> <ide> self.heartbeat() <ide> executor.heartbeat() <ide> <add> # If the set of tasks that aren't ready ever equals the set of <add> # tasks to run, then the backfill is deadlocked <add> if not_ready and not_ready == set(tasks_to_run): <add> deadlocked.update(tasks_to_run.values()) <add> tasks_to_run.clear() <add> <ide> # Reacting to events <ide> for key, state in list(executor.get_event_buffer().items()): <ide> dag_id, task_id, execution_date = key <ide> def _execute(self): <ide> <ide> # task reports skipped <ide> elif ti.state == State.SKIPPED: <del> wont_run.append(key) <add> skipped.add(key) <ide> self.logger.error("Skipping {} ".format(key)) <ide> <ide> # anything else is a failure <ide> else: <del> failed.append(key) <add> failed.add(key) <ide> self.logger.error("Task instance {} failed".format(key)) <ide> <ide> tasks_to_run.pop(key) <ide> def _execute(self): <ide> if ti.state == State.SUCCESS: <ide> self.logger.info( <ide> 'Task instance {} succeeded'.format(key)) <del> succeeded.append(key) <add> succeeded.add(key) <ide> tasks_to_run.pop(key) <ide> <ide> # task reports failure <ide> elif ti.state == State.FAILED: <ide> self.logger.error("Task instance {} failed".format(key)) <del> failed.append(key) <add> failed.add(key) <ide> tasks_to_run.pop(key) <ide> <ide> # this probably won't ever be triggered <del> elif key in not_ready_to_run: <del> continue <add> elif ti in not_ready: <add> self.logger.info( <add> "{} wasn't expected to run, but it did".format(ti)) <ide> <ide> # executor reports success but task does not - this is weird <ide> elif ti.state not in ( <ide> def _execute(self): <ide> ti.handle_failure(msg) <ide> tasks_to_run.pop(key) <ide> <del> msg = ( <del> "[backfill progress] " <del> "waiting: {0} | " <del> "succeeded: {1} | " <del> "kicked_off: {2} | " <del> "failed: {3} | " <del> "wont_run: {4} ").format( <del> len(tasks_to_run), <del> len(succeeded), <del> len(started), <del> len(failed), <del> len(wont_run)) <add> msg = ' | '.join([ <add> "[backfill progress]", <add> "waiting: {0}", <add> "succeeded: {1}", <add> "kicked_off: {2}", <add> "failed: {3}", <add> "skipped: {4}", <add> "deadlocked: {5}" <add> ]).format( <add> len(tasks_to_run), <add> len(succeeded), <add> len(started), <add> len(failed), <add> len(skipped), <add> len(deadlocked)) <ide> self.logger.info(msg) <ide> <ide> executor.end() <ide> session.close() <add> <add> err = '' <ide> if failed: <del> msg = ( <del> "------------------------------------------\n" <del> "Some tasks instances failed, " <del> "here's the list:\n{}".format(failed)) <del> raise AirflowException(msg) <del> self.logger.info("All done. Exiting.") <add> err += ( <add> "---------------------------------------------------\n" <add> "Some task instances failed:\n{}\n".format(failed)) <add> if deadlocked: <add> err += ( <add> '---------------------------------------------------\n' <add> 'BackfillJob is deadlocked.') <add> deadlocked_depends_on_past = any( <add> t.are_dependencies_met() != t.are_dependencies_met( <add> ignore_depends_on_past=True) <add> for t in deadlocked) <add> if deadlocked_depends_on_past: <add> err += ( <add> 'Some of the deadlocked tasks were unable to run because ' <add> 'of "depends_on_past" relationships. Try running the ' <add> 'backfill with the option ' <add> '"ignore_first_depends_on_past=True" or passing "-I" at ' <add> 'the command line.') <add> err += ' These tasks were unable to run:\n{}\n'.format(deadlocked) <add> if err: <add> raise AirflowException(err) <add> <add> self.logger.info("Backfill done. Exiting.") <ide> <ide> <ide> class LocalTaskJob(BaseJob): <ide><path>airflow/models.py <ide> def get_active_runs(self): <ide> # AND there are unfinished tasks... <ide> any(ti.state in State.unfinished() for ti in task_instances) and <ide> # AND none of them have dependencies met... <del> all(not ti.are_dependencies_met() for ti in task_instances <add> all(not ti.are_dependencies_met(session=session) <add> for ti in task_instances <ide> if ti.state in State.unfinished())) <ide> <ide> for run in active_runs: <ide><path>airflow/utils/state.py <ide> def runnable(cls): <ide> cls.QUEUED <ide> ] <ide> <add> @classmethod <add> def finished(cls): <add> """ <add> A list of states indicating that a task started and completed a <add> run attempt. Note that the attempt could have resulted in failure or <add> have been interrupted; in any case, it is no longer running. <add> """ <add> return [ <add> cls.SUCCESS, <add> cls.SHUTDOWN, <add> cls.FAILED, <add> cls.SKIPPED, <add> ] <add> <ide> @classmethod <ide> def unfinished(cls): <add> """ <add> A list of states indicating that a task either has not completed <add> a run or has not even started. <add> """ <ide> return [ <ide> cls.NONE, <ide> cls.QUEUED, <ide><path>tests/dags/test_issue_1225.py <ide> def fail(): <ide> depends_on_past=True, <ide> dag=dag6,) <ide> dag6_task2.set_upstream(dag6_task1) <add> <add> <add># DAG tests that a deadlocked subdag is properly caught <add>dag7 = DAG(dag_id='test_subdag_deadlock', default_args=default_args) <add>subdag7 = DAG(dag_id='test_subdag_deadlock.subdag', default_args=default_args) <add>subdag7_task1 = PythonOperator( <add> task_id='test_subdag_fail', <add> dag=subdag7, <add> python_callable=fail) <add>subdag7_task2 = DummyOperator( <add> task_id='test_subdag_dummy_1', <add> dag=subdag7,) <add>subdag7_task3 = DummyOperator( <add> task_id='test_subdag_dummy_2', <add> dag=subdag7) <add>dag7_subdag1 = SubDagOperator( <add> task_id='subdag', <add> dag=dag7, <add> subdag=subdag7) <add>subdag7_task1.set_downstream(subdag7_task2) <add>subdag7_task2.set_downstream(subdag7_task3) <ide><path>tests/jobs.py <ide> def setUp(self): <ide> self.dagbag = DagBag() <ide> <ide> def test_backfill_examples(self): <add> """ <add> Test backfilling example dags <add> """ <ide> dags = [ <ide> dag for dag in self.dagbag.dags.values() <ide> if dag.dag_id in ('example_bash_operator',)] <ide> def test_backfill_examples(self): <ide> <ide> def test_trap_executor_error(self): <ide> """ <del> Test for https://github.com/airbnb/airflow/pull/1220 <add> Test that errors setting up tasks (before tasks run) are caught <ide> <del> Test that errors setting up tasks (before tasks run) are properly <del> caught <add> Test for https://github.com/airbnb/airflow/pull/1220 <ide> """ <ide> dag = self.dagbag.get_dag('test_raise_executor_error') <add> dag.clear() <ide> job = BackfillJob( <ide> dag=dag, <ide> start_date=DEFAULT_DATE, <ide> def run_with_timeout(): <ide> <ide> def test_backfill_pooled_task(self): <ide> """ <del> Test for https://github.com/airbnb/airflow/pull/1225 <del> <ide> Test that queued tasks are executed by BackfillJob <add> <add> Test for https://github.com/airbnb/airflow/pull/1225 <ide> """ <ide> session = settings.Session() <ide> pool = Pool(pool='test_backfill_pooled_task_pool', slots=1) <ide> session.add(pool) <ide> session.commit() <ide> <ide> dag = self.dagbag.get_dag('test_backfill_pooled_task_dag') <add> dag.clear() <ide> <ide> job = BackfillJob( <ide> dag=dag, <ide> def test_backfill_pooled_task(self): <ide> self.assertEqual(ti.state, State.SUCCESS) <ide> <ide> def test_backfill_depends_on_past(self): <add> """ <add> Test that backfill resects ignore_depends_on_past <add> """ <ide> dag = self.dagbag.get_dag('test_depends_on_past') <add> dag.clear() <ide> run_date = DEFAULT_DATE + datetime.timedelta(days=5) <del> # import ipdb; ipdb.set_trace() <del> BackfillJob(dag=dag, start_date=run_date, end_date=run_date).run() <ide> <del> # ti should not have run <del> ti = TI(dag.tasks[0], run_date) <del> ti.refresh_from_db() <del> self.assertIs(ti.state, None) <add> # backfill should deadlock <add> self.assertRaisesRegexp( <add> AirflowException, <add> 'BackfillJob is deadlocked', <add> BackfillJob(dag=dag, start_date=run_date, end_date=run_date).run) <ide> <ide> BackfillJob( <ide> dag=dag, <ide> start_date=run_date, <ide> end_date=run_date, <ide> ignore_first_depends_on_past=True).run() <ide> <del> # ti should have run <add> # ti should have succeeded <ide> ti = TI(dag.tasks[0], run_date) <ide> ti.refresh_from_db() <ide> self.assertEquals(ti.state, State.SUCCESS) <ide> <ide> def test_cli_backfill_depends_on_past(self): <add> """ <add> Test that CLI respects -I argument <add> """ <ide> dag_id = 'test_dagrun_states_deadlock' <ide> run_date = DEFAULT_DATE + datetime.timedelta(days=1) <ide> args = [ <ide> def test_cli_backfill_depends_on_past(self): <ide> run_date.isoformat(), <ide> ] <ide> dag = self.dagbag.get_dag(dag_id) <add> dag.clear() <ide> <del> self.assertRaisesRegex( <add> self.assertRaisesRegexp( <ide> AirflowException, <ide> 'BackfillJob is deadlocked', <ide> cli.backfill, <ide> def evaluate_dagrun( <ide> <ide> scheduler = SchedulerJob() <ide> dag = self.dagbag.get_dag(dag_id) <add> dag.clear() <ide> dr = scheduler.schedule_dag(dag) <ide> if advance_execution_date: <ide> # run a second time to schedule a dagrun after the start_date <ide> def evaluate_dagrun( <ide> <ide> def test_dagrun_fail(self): <ide> """ <del> Test that a DagRun with one failed task and one incomplete root task <del> is marked a failure <add> DagRuns with one failed and one incomplete root task -> FAILED <ide> """ <ide> self.evaluate_dagrun( <ide> dag_id='test_dagrun_states_fail', <ide> def test_dagrun_fail(self): <ide> <ide> def test_dagrun_success(self): <ide> """ <del> Test that a DagRun with one failed task and one successful root task <del> is marked a success <add> DagRuns with one failed and one successful root task -> SUCCESS <ide> """ <ide> self.evaluate_dagrun( <ide> dag_id='test_dagrun_states_success', <ide> def test_dagrun_success(self): <ide> <ide> def test_dagrun_root_fail(self): <ide> """ <del> Test that a DagRun with one successful root task and one failed root <del> task is marked a failure <add> DagRuns with one successful and one failed root task -> FAILED <ide> """ <ide> self.evaluate_dagrun( <ide> dag_id='test_dagrun_states_root_fail', <ide> def test_dagrun_root_fail(self): <ide> <ide> def test_dagrun_deadlock(self): <ide> """ <add> Deadlocked DagRun is marked a failure <add> <ide> Test that a deadlocked dagrun is marked as a failure by having <ide> depends_on_past and an execution_date after the start_date <ide> """ <ide> def test_dagrun_deadlock(self): <ide> <ide> def test_dagrun_deadlock_ignore_depends_on_past_advance_ex_date(self): <ide> """ <add> DagRun is marked a success if ignore_first_depends_on_past=True <add> <ide> Test that an otherwise-deadlocked dagrun is marked as a success <ide> if ignore_first_depends_on_past=True and the dagrun execution_date <ide> is after the start_date. <ide><path>tests/models.py <ide> def run_with_error(ti): <ide> def test_depends_on_past(self): <ide> dagbag = models.DagBag() <ide> dag = dagbag.get_dag('test_depends_on_past') <add> dag.clear() <ide> task = dag.tasks[0] <ide> run_date = task.start_date + datetime.timedelta(days=5) <ide> ti = TI(task, run_date) <ide><path>tests/operators/subdag_operator.py <ide> def test_subdag_pools(self): <ide> session.delete(pool_10) <ide> session.commit() <ide> <add> def test_subdag_deadlock(self): <add> dagbag = DagBag() <add> dag = dagbag.get_dag('test_subdag_deadlock') <add> dag.clear() <add> subdag = dagbag.get_dag('test_subdag_deadlock.subdag') <add> subdag.clear() <ide> <del>if __name__ == "__main__": <del> unittest.main() <add> # first make sure subdag is deadlocked <add> self.assertRaisesRegexp(AirflowException, 'deadlocked', subdag.run, start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) <add> <add> # now make sure dag picks up the subdag error <add> subdag.clear() <add> self.assertRaises(AirflowException, dag.run, start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) <ide><path>tests/utils.py <ide> class LogUtilsTest(unittest.TestCase): <ide> <ide> def test_gcs_url_parse(self): <add> """ <add> Test GCS url parsing <add> """ <ide> logging.info( <ide> 'About to create a GCSLog object without a connection. This will ' <ide> 'log an error but testing will proceed.')
9
Text
Text
use serial comma in errors docs
d72dcb0db451c23df6fa793799e87f63e5e24465
<ide><path>doc/api/errors.md <ide> time. <ide> > Stability: 1 - Experimental <ide> <ide> The `--input-type` flag was used to attempt to execute a file. This flag can <del>only be used with input via `--eval`, `--print` or `STDIN`. <add>only be used with input via `--eval`, `--print`, or `STDIN`. <ide> <ide> <a id="ERR_INSPECTOR_ALREADY_ACTIVATED"></a> <ide> <ide> performing another operation. <ide> <ide> ### `ERR_INVALID_SYNC_FORK_INPUT` <ide> <del>A `Buffer`, `TypedArray`, `DataView` or `string` was provided as stdio input to <add>A `Buffer`, `TypedArray`, `DataView`, or `string` was provided as stdio input to <ide> an asynchronous fork. See the documentation for the [`child_process`][] module <ide> for more information. <ide>
1
Text
Text
add v3.20.1 to changelog
eff98d676611a5e366f19ebce62fca5c7b10a4c2
<ide><path>CHANGELOG.md <ide> - [#18993](https://github.com/emberjs/ember.js/pull/18993) [DEPRECATION] Deprecate `getWithDefault` per [RFC #554](https://github.com/emberjs/rfcs/blob/master/text/0554-deprecate-getwithdefault.md). <ide> - [#17571](https://github.com/emberjs/ember.js/pull/17571) [BUGFIX] Avoid tampering `queryParam` argument in RouterService#isActive <ide> <add>### v3.20.1 (July 13, 2020) <add> <add>- [#19040](https://github.com/emberjs/ember.js/pull/19040) [BUGFIX] Fix a memory leak that occurred when changing the array passed to `{{each}}` <add> <ide> ### v3.20.0 (July 13, 2020) <ide> <ide> - [#18867](https://github.com/emberjs/ember.js/pull/18867) / [#18927](https://github.com/emberjs/ember.js/pull/18927) / [#18928](https://github.com/emberjs/ember.js/pull/18928) [FEATURE] [Promote `{{in-element}}` to public API](https://github.com/emberjs/rfcs/blob/master/text/0287-promote-in-element-to-public-api.md) RFC.
1
Text
Text
add info for problem 54 - project euler
0ae1df30c7d22cac8a8b7fc2e660882b3dcfabeb
<ide><path>curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-54-poker-hands.md <ide> Consider the following five hands dealt to two players: <ide> |<strong>4</strong>|4D 6S 9H QH QC <br> Pair of Queens <br> Highest card Nine|3D 6D 7H QD QS <br> Pair of Queens <br> Highest card Seven|Player 1| <ide> |<strong>5</strong>|2H 2D 4C 4D 4S <br> Full House <br> with Three Fours|3C 3D 3S 9S 9D <br> Full House <br> with Three Threes|Player 1| <ide> <add>The global array (`handsArr`) passed to the function, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner. <add> <ide> How many hands does Player 1 win? <ide> <ide> </section>
1
Ruby
Ruby
convert remaining usage of whitelist and blacklist
0efecd913c07104e8fba82d5044c1ad824af68d5
<ide><path>actionpack/lib/action_controller/metal/live.rb <ide> def make_response!(request) <ide> # Note: SSEs are not currently supported by IE. However, they are supported <ide> # by Chrome, Firefox, Opera, and Safari. <ide> class SSE <del> WHITELISTED_OPTIONS = %w( retry event id ) <add> PERMITTED_OPTIONS = %w( retry event id ) <ide> <ide> def initialize(stream, options = {}) <ide> @stream = stream <ide> def write(object, options = {}) <ide> def perform_write(json, options) <ide> current_options = @options.merge(options).stringify_keys <ide> <del> WHITELISTED_OPTIONS.each do |option_name| <add> PERMITTED_OPTIONS.each do |option_name| <ide> if (option_value = current_options[option_name]) <ide> @stream.write "#{option_name}: #{option_value}\n" <ide> end <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> module Base <ide> # <ide> # match 'json_only', constraints: { format: 'json' }, via: :get <ide> # <del> # class Whitelist <add> # class PermitList <ide> # def matches?(request) request.remote_ip == '1.2.3.4' end <ide> # end <del> # match 'path', to: 'c#a', constraints: Whitelist.new, via: :get <add> # match 'path', to: 'c#a', constraints: PermitList.new, via: :get <ide> # <ide> # See <tt>Scoping#constraints</tt> for more examples with its scope <ide> # equivalent. <ide><path>activejob/lib/active_job/arguments.rb <ide> class SerializationError < ArgumentError; end <ide> module Arguments <ide> extend self <ide> # :nodoc: <del> TYPE_WHITELIST = [ NilClass, String, Integer, Float, BigDecimal, TrueClass, FalseClass ] <add> PERMITTED_TYPES = [ NilClass, String, Integer, Float, BigDecimal, TrueClass, FalseClass ] <ide> <del> # Serializes a set of arguments. Whitelisted types are returned <add> # Serializes a set of arguments. Permitted types are returned <ide> # as-is. Arrays/Hashes are serialized element by element. <ide> # All other types are serialized using GlobalID. <ide> def serialize(arguments) <ide> arguments.map { |argument| serialize_argument(argument) } <ide> end <ide> <del> # Deserializes a set of arguments. Whitelisted types are returned <add> # Deserializes a set of arguments. Permitted types are returned <ide> # as-is. Arrays/Hashes are deserialized element by element. <ide> # All other types are deserialized using GlobalID. <ide> def deserialize(arguments) <ide> def deserialize(arguments) <ide> <ide> def serialize_argument(argument) <ide> case argument <del> when *TYPE_WHITELIST <add> when *PERMITTED_TYPES <ide> argument <ide> when GlobalID::Identification <ide> convert_to_global_id_hash(argument) <ide> def deserialize_argument(argument) <ide> case argument <ide> when String <ide> GlobalID::Locator.locate(argument) || argument <del> when *TYPE_WHITELIST <add> when *PERMITTED_TYPES <ide> argument <ide> when Array <ide> argument.map { |arg| deserialize_argument(arg) } <ide><path>activerecord/lib/active_record/attribute_methods.rb <ide> def self.set_name_cache(name, value) <ide> end <ide> } <ide> <del> BLACKLISTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass) <add> RESTRICTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass) <ide> <ide> class GeneratedAttributeMethods < Module #:nodoc: <ide> include Mutex_m <ide> def method_defined_within?(name, klass, superklass = klass.superclass) # :nodoc: <ide> # A class method is 'dangerous' if it is already (re)defined by Active Record, but <ide> # not by any ancestors. (So 'puts' is not dangerous but 'new' is.) <ide> def dangerous_class_method?(method_name) <del> BLACKLISTED_CLASS_METHODS.include?(method_name.to_s) || class_method_defined_within?(method_name, Base) <add> RESTRICTED_CLASS_METHODS.include?(method_name.to_s) || class_method_defined_within?(method_name, Base) <ide> end <ide> <ide> def class_method_defined_within?(name, klass, superklass = klass.superclass) # :nodoc: <ide><path>activerecord/test/cases/relation/delegation_test.rb <ide> require "models/comment" <ide> <ide> module ActiveRecord <del> module DelegationWhitelistTests <add> module DelegationPermitListTests <ide> ARRAY_DELEGATES = [ <ide> :+, :-, :|, :&, :[], :shuffle, <ide> :all?, :collect, :compact, :detect, :each, :each_cons, :each_with_index, <ide> def test_deprecate_arel_delegation <ide> end <ide> <ide> class DelegationAssociationTest < ActiveRecord::TestCase <del> include DelegationWhitelistTests <add> include DelegationPermitListTests <ide> include DeprecatedArelDelegationTests <ide> <ide> def target <ide> def target <ide> end <ide> <ide> class DelegationRelationTest < ActiveRecord::TestCase <del> include DelegationWhitelistTests <add> include DelegationPermitListTests <ide> include DeprecatedArelDelegationTests <ide> <ide> def target
5
PHP
PHP
remove error_reporting() handling/use deprecated()
a834bc4a641199a57d1bc652e1e8b2848e63ebf9
<ide><path>tests/TestCase/Controller/ControllerTest.php <ide> class ControllerTest extends TestCase <ide> 'core.posts' <ide> ]; <ide> <del> /** <del> * error level property <del> * <del> */ <del> private static $errorLevel; <del> <ide> /** <ide> * reset environment. <ide> * <ide> public function tearDown() <ide> { <ide> parent::tearDown(); <ide> Plugin::unload(); <del> error_reporting(self::$errorLevel); <del> } <del> <del> /** <del> * setUpBeforeClass <del> * <del> * @return void <del> */ <del> public static function setUpBeforeClass() <del> { <del> parent::setUpBeforeClass(); <del> self::$errorLevel = error_reporting(); <del> } <del> <del> /** <del> * tearDownAfterClass <del> * <del> * @return void <del> */ <del> public static function tearDownAfterClass() <del> { <del> parent::tearDownAfterClass(); <del> error_reporting(self::$errorLevel); <ide> } <ide> <ide> /** <ide> public function testBeforeRenderViewVariables() <ide> public function testDeprecatedViewProperty($property, $getter, $setter, $value) <ide> { <ide> $controller = new AnotherTestController(); <del> error_reporting(E_ALL ^ E_USER_DEPRECATED); <del> $controller->$property = $value; <del> $this->assertSame($value, $controller->$property); <add> $this->deprecated(function () use ($controller, $property, $value) { <add> $controller->$property = $value; <add> $this->assertSame($value, $controller->$property); <add> }); <ide> $this->assertSame($value, $controller->viewBuilder()->{$getter}()); <ide> } <ide>
1
Javascript
Javascript
add missing semicolons in sea3ddeflate
af33f2a77d94534a050525ee705837f8b7a091ec
<ide><path>examples/js/loaders/sea3d/SEA3DDeflate.js <ide> var zip_border = new Array( // Order of the bit length code lengths <ide> var zip_HuftList = function() { <ide> this.next = null; <ide> this.list = null; <del>} <add>}; <ide> <ide> var zip_HuftNode = function() { <ide> this.e = 0; // number of extra bits or operation <ide> var zip_HuftNode = function() { <ide> // union <ide> this.n = 0; // literal, length base, or distance base <ide> this.t = null; // (zip_HuftNode) pointer to next level of table <del>} <add>}; <ide> <ide> var zip_HuftBuild = function(b, // code lengths in bits (all assumed <= BMAX) <ide> n, // number of codes (assumed <= N_MAX) <ide> var zip_HuftBuild = function(b, // code lengths in bits (all assumed <= BMAX) <ide> /* Return true (1) if we were given an incomplete table */ <ide> this.status = ((y != 0 && g != 1) ? 1 : 0); <ide> } /* end of constructor */ <del>} <add>}; <ide> <ide> <ide> /* routines (inflate) */ <ide> var zip_GET_BYTE = function() { <ide> if(zip_inflate_data.length == zip_inflate_pos) <ide> return -1; <ide> return zip_inflate_data[zip_inflate_pos++]; <del>} <add>}; <ide> <ide> var zip_NEEDBITS = function(n) { <ide> while(zip_bit_len < n) { <ide> zip_bit_buf |= zip_GET_BYTE() << zip_bit_len; <ide> zip_bit_len += 8; <ide> } <del>} <add>}; <ide> <ide> var zip_GETBITS = function(n) { <ide> return zip_bit_buf & zip_MASK_BITS[n]; <del>} <add>}; <ide> <ide> var zip_DUMPBITS = function(n) { <ide> zip_bit_buf >>= n; <ide> zip_bit_len -= n; <del>} <add>}; <ide> <ide> var zip_inflate_codes = function(buff, off, size) { <ide> /* inflate (decompress) the codes in a deflated (compressed) block. <ide> var zip_inflate_codes = function(buff, off, size) { <ide> <ide> zip_method = -1; // done <ide> return n; <del>} <add>}; <ide> <ide> var zip_inflate_stored = function(buff, off, size) { <ide> /* "decompress" an inflated type 0 (stored) block. */ <ide> var zip_inflate_stored = function(buff, off, size) { <ide> if(zip_copy_leng == 0) <ide> zip_method = -1; // done <ide> return n; <del>} <add>}; <ide> <ide> var zip_inflate_fixed = function(buff, off, size) { <ide> /* decompress an inflated type 1 (fixed Huffman codes) block. We should <ide> var zip_inflate_fixed = function(buff, off, size) { <ide> zip_bl = zip_fixed_bl; <ide> zip_bd = zip_fixed_bd; <ide> return zip_inflate_codes(buff, off, size); <del>} <add>}; <ide> <ide> var zip_inflate_dynamic = function(buff, off, size) { <ide> // decompress an inflated type 2 (dynamic Huffman codes) block. <ide> var zip_inflate_dynamic = function(buff, off, size) { <ide> <ide> // decompress until an end-of-block code <ide> return zip_inflate_codes(buff, off, size); <del>} <add>}; <ide> <ide> var zip_inflate_start = function() { <ide> var i; <ide> var zip_inflate_start = function() { <ide> zip_eof = false; <ide> zip_copy_leng = zip_copy_dist = 0; <ide> zip_tl = null; <del>} <add>}; <ide> <ide> var zip_inflate_internal = function(buff, off, size) { <ide> // decompress an inflated entry <ide> var zip_inflate_internal = function(buff, off, size) { <ide> n += i; <ide> } <ide> return n; <del>} <add>}; <ide> <ide> var zip_inflate = function(data) { <ide> var i, j, pos = 0; <ide> var zip_inflate = function(data) { <ide> <ide> zip_inflate_data = null; // G.C. <ide> return new Uint8Array(out).buffer; <del>} <add>}; <ide> <ide> if (! ctx.RawDeflate) ctx.RawDeflate = {}; <ide> ctx.RawDeflate.inflate = zip_inflate; <ide> SEA3D.File.DeflateUncompress = function( data ) { <ide> <ide> return RawDeflate.inflate( data ); <ide> <del>} <add>}; <ide> <del>SEA3D.File.setDecompressionEngine( 1, "deflate", SEA3D.File.DeflateUncompress ); <ide>\ No newline at end of file <add>SEA3D.File.setDecompressionEngine( 1, "deflate", SEA3D.File.DeflateUncompress );
1
Javascript
Javascript
make watching.close callback optional
b271c105552c50d371018a0938d58ea04d7d8538
<ide><path>lib/Compiler.js <ide> Watching.prototype.invalidate = function() { <ide> }; <ide> <ide> Watching.prototype.close = function(callback) { <add> if(callback === undefined) callback = function(){} <add> <ide> if(this.watcher) { <ide> this.watcher.close(); <ide> this.watcher = null;
1
Javascript
Javascript
remove unused variable from try catch
c301518a456f36382a73ed9e36816061107b2444
<ide><path>lib/internal/repl/await.js <ide> function processTopLevelAwait(src) { <ide> let root; <ide> try { <ide> root = acorn.parse(wrapped, { ecmaVersion: 10 }); <del> } catch (err) { <add> } catch { <ide> return null; <ide> } <ide> const body = root.body[0].expression.callee.body;
1
Text
Text
clarify fs.createreadstream options
384dafe4c9d5fe1e39e74d91d6e7eebeed405415
<ide><path>doc/api/fs.md <ide> default value of 64 kb for the same parameter. <ide> <ide> `options` can include `start` and `end` values to read a range of bytes from <ide> the file instead of the entire file. Both `start` and `end` are inclusive and <del>start at 0. The `encoding` can be any one of those accepted by [`Buffer`][]. <add>start counting at 0. If `fd` is specified and `start` is omitted or `undefined`, <add>`fs.createReadStream()` reads sequentially from the current file position. <add>The `encoding` can be any one of those accepted by [`Buffer`][]. <ide> <ide> If `fd` is specified, `ReadStream` will ignore the `path` argument and will use <ide> the specified file descriptor. This means that no `'open'` event will be
1
Ruby
Ruby
extract railtie load from application
13d66cdf2544af0d465d596383743b16b5005996
<ide><path>railties/lib/rails/application.rb <ide> module Rails <ide> class Application < Engine <ide> autoload :Bootstrap, 'rails/application/bootstrap' <ide> autoload :Finisher, 'rails/application/finisher' <add> autoload :Railties, 'rails/application/railties' <ide> autoload :RoutesReloader, 'rails/application/routes_reloader' <ide> <ide> # TODO Check helpers works as expected <ide> def original_root <ide> end <ide> <ide> def inherited(base) <add> # TODO Add this check <add> # raise "You cannot have more than one Rails::Application" if Rails.application <ide> super <del> Railtie.plugins.delete(base) <del> Rails.application = base.instance <add> <add> # TODO Add a test which ensures me <add> # Railtie.plugins.delete(base) <add> Rails.application ||= base.instance <add> <add> base.rake_tasks do <add> require "rails/tasks" <add> paths.lib.tasks.to_a.sort.each { |r| load(rake) } <add> task :environment do <add> $rails_rake_task = true <add> initialize! <add> end <add> end <ide> end <ide> <ide> protected <ide> def method_missing(*args, &block) <ide> end <ide> <ide> def initialize <del> require_environment <add> environment = config.paths.config.environment.to_a.first <add> require environment if environment <ide> end <ide> <ide> def routes <del> ActionController::Routing::Routes <add> ::ActionController::Routing::Routes <add> end <add> <add> def railties <add> @railties ||= Railties.new(config) <ide> end <ide> <ide> def routes_reloader <ide> def initialize! <ide> self <ide> end <ide> <del> def require_environment <del> environment = config.paths.config.environment.to_a.first <del> require environment if environment <del> end <del> <ide> def load_tasks <del> require "rails/tasks" <del> plugins.each { |p| p.load_tasks } <del> # Load all application tasks <del> # TODO: extract out the path to the rake tasks <del> Dir["#{root}/lib/tasks/**/*.rake"].sort.each { |ext| load ext } <del> task :environment do <del> $rails_rake_task = true <del> initialize! <del> end <add> super <add> railties.all { |r| r.load_tasks } <add> self <ide> end <ide> <ide> def load_generators <del> plugins.each { |p| p.load_generators } <del> end <del> <del> # TODO: Fix this method. It loads all railties independent if :all is given <del> # or not, otherwise frameworks are never loaded. <del> def plugins <del> @plugins ||= begin <del> plugin_names = (config.plugins || [:all]).map { |p| p.to_sym } <del> Railtie.plugins.map(&:new) + Plugin.all(plugin_names, config.paths.vendor.plugins) <del> end <add> super <add> railties.all { |r| r.load_generators } <add> self <ide> end <ide> <ide> def app <ide> def call(env) <ide> def initializers <ide> initializers = Bootstrap.initializers <ide> initializers += super <del> plugins.each { |p| initializers += p.initializers } <add> railties.all { |r| initializers += r.initializers } <ide> initializers += Finisher.initializers <ide> initializers <ide> end <ide><path>railties/lib/rails/application/railties.rb <add>module Rails <add> class Application <add> class Railties <add> # TODO Write tests <add> def initialize(config) <add> @config = config <add> end <add> <add> def all(&block) <add> @all ||= railties + engines + plugins <add> @all.each(&block) if block <add> @all <add> end <add> <add> def railties <add> @railties ||= ::Rails::Railtie.subclasses.map(&:new) <add> end <add> <add> def engines <add> @engines ||= ::Rails::Engine.subclasses.map(&:new) <add> end <add> <add> def plugins <add> @plugins ||= begin <add> plugin_names = (@config.plugins || [:all]).map { |p| p.to_sym } <add> Plugin.all(plugin_names, @config.paths.vendor.plugins) <add> end <add> end <add> end <add> end <add>end <ide>\ No newline at end of file <ide><path>railties/lib/rails/application/routes_reloader.rb <ide> module Rails <ide> class Application <ide> class RoutesReloader <del> attr_reader :config <del> <add> # TODO Change config.action_dispatch.route_files to config.action_dispatch.routes_path <add> # TODO Write tests <ide> def initialize(config) <ide> @config, @last_change_at = config, nil <ide> end <ide> <ide> def changed_at <ide> routes_changed_at = nil <ide> <del> config.action_dispatch.route_files.each do |config| <del> config_changed_at = File.stat(config).mtime <add> files.each do |file| <add> config_changed_at = File.stat(file).mtime <ide> <ide> if routes_changed_at.nil? || config_changed_at > routes_changed_at <ide> routes_changed_at = config_changed_at <ide> def reload! <ide> routes.disable_clear_and_finalize = true <ide> <ide> routes.clear! <del> config.action_dispatch.route_files.each { |config| load(config) } <add> files.each { |file| load(file) } <ide> routes.finalize! <ide> <ide> nil <ide> def reload_if_changed <ide> reload! <ide> end <ide> end <add> <add> def files <add> @config.action_dispatch.route_files <add> end <ide> end <ide> end <ide> end <ide>\ No newline at end of file <ide><path>railties/lib/rails/configuration.rb <ide> def config_key_regexp <ide> /^(#{bits})(?:=)?$/ <ide> end <ide> <add> # TODO Fix me <ide> def config_keys <ide> Railtie.plugin_names.map { |n| n.to_s }.uniq <ide> end <ide> def paths <ide> paths = super <ide> paths.app.controllers << builtin_controller if builtin_controller <ide> paths.config.database "config/database.yml" <add> paths.lib.tasks "lib/tasks", :glob => "**/*.rake" <ide> paths.log "log/#{Rails.env}.log" <ide> paths.tmp "tmp" <ide> paths.tmp.cache "tmp/cache" <ide><path>railties/lib/rails/engine.rb <ide> module Rails <ide> class Engine < Railtie <ide> class << self <ide> attr_accessor :called_from <add> delegate :middleware, :root, :paths, :to => :config <ide> <ide> def original_root <ide> @original_root ||= find_root_with_file_flag("lib") <ide> def inherited(base) <ide> call_stack = caller.map { |p| p.split(':').first } <ide> File.dirname(call_stack.detect { |p| p !~ %r[railties/lib/rails|rack/lib/rack] }) <ide> end <del> <ide> super <ide> end <ide> <ide> def find_root_with_file_flag(flag, default=nil) <ide> end <ide> <ide> root = File.exist?("#{root_path}/#{flag}") ? root_path : default <del> <ide> raise "Could not find root path for #{self}" unless root <ide> <ide> RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? <del> Pathname.new(root).expand_path : <del> Pathname.new(root).realpath <add> Pathname.new(root).expand_path : Pathname.new(root).realpath <ide> end <ide> end <ide> <del> delegate :config, :to => :'self.class' <del> delegate :middleware, :root, :to => :config <add> delegate :middleware, :paths, :root, :config, :to => :'self.class' <ide> <ide> # Add configured load paths to ruby load paths and remove duplicates. <ide> initializer :set_load_path do <ide><path>railties/lib/rails/railtie.rb <ide> class Railtie <ide> ABSTRACT_RAILTIES = %w(Rails::Plugin Rails::Engine Rails::Application) <ide> <ide> class << self <add> attr_reader :subclasses <add> <ide> def abstract_railtie?(base) <ide> ABSTRACT_RAILTIES.include?(base.name) <ide> end <ide> <ide> def inherited(base) <del> @@plugins ||= [] <del> @@plugins << base unless abstract_railtie?(base) <add> @subclasses ||= [] <add> @subclasses << base unless abstract_railtie?(base) <ide> end <ide> <del> # This should be called railtie_name and engine_name <add> # TODO This should be called railtie_name and engine_name <ide> def plugin_name(plugin_name = nil) <ide> @plugin_name ||= name.demodulize.underscore <ide> @plugin_name = plugin_name if plugin_name <ide> @plugin_name <ide> end <ide> <add> # TODO Deprecate me <ide> def plugins <del> @@plugins <add> @subclasses <ide> end <ide> <add> # TODO Deprecate me <ide> def plugin_names <ide> plugins.map { |p| p.plugin_name } <ide> end <ide> def generators <ide> end <ide> <ide> def load_tasks <del> return unless rake_tasks <ide> rake_tasks.each { |blk| blk.call } <ide> end <ide> <ide> def load_generators <del> return unless generators <ide> generators.each { |blk| blk.call } <ide> end <ide> end
6
PHP
PHP
use class constants instead of strings
cafef22a89f3137de7c1b6435824cddb7f8409c7
<ide><path>src/Mailer/Email.php <ide> class Email implements JsonSerializable, Serializable <ide> * <ide> * @var array <ide> */ <del> protected $_emailFormatAvailable = ['text', 'html', 'both']; <add> protected $_emailFormatAvailable = [self::MESSAGE_TEXT, self::MESSAGE_HTML, self::MESSAGE_BOTH]; <ide> <ide> /** <ide> * What format should the email be sent in <ide> * <ide> * @var string <ide> */ <del> protected $_emailFormat = 'text'; <add> protected $_emailFormat = self::MESSAGE_TEXT; <ide> <ide> /** <ide> * The transport instance to use for sending mail. <ide> public function getHeaders(array $include = []): array <ide> $headers['Content-Type'] = 'multipart/mixed; boundary="' . $this->_boundary . '"'; <ide> } elseif ($this->_emailFormat === static::MESSAGE_BOTH) { <ide> $headers['Content-Type'] = 'multipart/alternative; boundary="' . $this->_boundary . '"'; <del> } elseif ($this->_emailFormat === 'text') { <add> } elseif ($this->_emailFormat === static::MESSAGE_TEXT) { <ide> $headers['Content-Type'] = 'text/plain; charset=' . $this->getContentTypeCharset(); <del> } elseif ($this->_emailFormat === 'html') { <add> } elseif ($this->_emailFormat === static::MESSAGE_HTML) { <ide> $headers['Content-Type'] = 'text/html; charset=' . $this->getContentTypeCharset(); <ide> } <ide> $headers['Content-Transfer-Encoding'] = $this->getContentTransferEncoding(); <ide> public function reset(): self <ide> $this->_textMessage = ''; <ide> $this->_htmlMessage = ''; <ide> $this->_message = []; <del> $this->_emailFormat = 'text'; <add> $this->_emailFormat = static::MESSAGE_TEXT; <ide> $this->_transport = null; <ide> $this->_priority = null; <ide> $this->charset = 'utf-8'; <ide><path>src/Mailer/Renderer.php <ide> public function render(Email $email, ?string $content = null) <ide> $textBoundary = 'alt-' . $boundary; <ide> } <ide> <del> if (isset($rendered['text'])) { <add> if (isset($rendered[Email::MESSAGE_TEXT])) { <ide> if ($multiPart) { <ide> $msg[] = '--' . $textBoundary; <ide> $msg[] = 'Content-Type: text/plain; charset=' . $this->email->getContentTypeCharset(); <ide> $msg[] = 'Content-Transfer-Encoding: ' . $this->email->getContentTransferEncoding(); <ide> $msg[] = ''; <ide> } <del> $textMessage = $rendered['text']; <add> $textMessage = $rendered[Email::MESSAGE_TEXT]; <ide> $content = explode("\n", $textMessage); <ide> $msg = array_merge($msg, $content); <ide> $msg[] = ''; <ide> $msg[] = ''; <ide> } <ide> <del> if (isset($rendered['html'])) { <add> if (isset($rendered[Email::MESSAGE_HTML])) { <ide> if ($multiPart) { <ide> $msg[] = '--' . $textBoundary; <ide> $msg[] = 'Content-Type: text/html; charset=' . $this->email->getContentTypeCharset(); <ide> $msg[] = 'Content-Transfer-Encoding: ' . $this->email->getContentTransferEncoding(); <ide> $msg[] = ''; <ide> } <del> $htmlMessage = $rendered['html']; <add> $htmlMessage = $rendered[Email::MESSAGE_HTML]; <ide> $content = explode("\n", $htmlMessage); <ide> $msg = array_merge($msg, $content); <ide> $msg[] = ''; <ide> protected function wrap($message, $wrapLength = self::LINE_LENGTH_MUST) <ide> */ <ide> protected function createBoundary() <ide> { <del> if ($this->email->getAttachments() || $this->email->getEmailFormat() === 'both') { <add> if ($this->email->getAttachments() || $this->email->getEmailFormat() === Email::MESSAGE_BOTH) { <ide> $this->boundary = md5(Security::randomBytes(16)); <ide> } <ide> } <ide> protected function attachInlineFiles($boundary = null) <ide> /** <ide> * Gets the text body types that are in this email message <ide> * <del> * @return array Array of types. Valid types are 'text' and 'html' <add> * @return array Array of types. Valid types are Email::MESSAGE_TEXT and Email::MESSAGE_HTML <ide> */ <ide> protected function getTypes() <ide> { <ide> $format = $this->email->getEmailFormat(); <ide> <ide> $types = [$format]; <del> if ($format === 'both') { <del> $types = ['html', 'text']; <add> if ($format === Email::MESSAGE_BOTH) { <add> $types = [Email::MESSAGE_HTML, Email::MESSAGE_TEXT]; <ide> } <ide> <ide> return $types;
2
Go
Go
remove daemon dependency in containerattach
b0d947615335fe115b5b93c0c09912a4888e5b29
<ide><path>builder/builder.go <ide> type Backend interface { <ide> GetImage(name string) (Image, error) <ide> // Pull tells Docker to pull image referenced by `name`. <ide> Pull(name string) (Image, error) <del> // ContainerWsAttachWithLogs attaches to container. <del> ContainerWsAttachWithLogs(name string, cfg *daemon.ContainerWsAttachWithLogsConfig) error <add> // ContainerAttach attaches to container. <add> ContainerAttach(cID string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error <ide> // ContainerCreate creates a new Docker container and returns potential warnings <ide> ContainerCreate(types.ContainerCreateConfig) (types.ContainerCreateResponse, error) <ide> // ContainerRm removes a container specified by `id`. <ide><path>builder/dockerfile/internals.go <ide> func (b *Builder) run(cID string) (err error) { <ide> errCh := make(chan error) <ide> if b.Verbose { <ide> go func() { <del> errCh <- b.docker.ContainerWsAttachWithLogs(cID, &daemon.ContainerWsAttachWithLogsConfig{ <del> OutStream: b.Stdout, <del> ErrStream: b.Stderr, <del> Stream: true, <del> }) <add> errCh <- b.docker.ContainerAttach(cID, nil, b.Stdout, b.Stderr, true) <ide> }() <ide> } <ide> <ide><path>daemon/daemonbuilder/builder.go <ide> func (d Docker) ContainerUpdateCmd(cID string, cmd []string) error { <ide> return nil <ide> } <ide> <add>// ContainerAttach attaches streams to the container cID. If stream is true, it streams the output. <add>func (d Docker) ContainerAttach(cID string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error { <add> return d.Daemon.ContainerWsAttachWithLogs(cID, &daemon.ContainerWsAttachWithLogsConfig{ <add> InStream: stdin, <add> OutStream: stdout, <add> ErrStream: stderr, <add> Stream: stream, <add> }) <add>} <add> <ide> // BuilderCopy copies/extracts a source FileInfo to a destination path inside a container <ide> // specified by a container object. <ide> // TODO: make sure callers don't unnecessarily convert destPath with filepath.FromSlash (Copy does it already).
3
Ruby
Ruby
reduce retained objects in journey
98d4fc3e82ebfd535b05b7f6e3abb4b03595c2dd
<ide><path>actionpack/lib/action_dispatch/journey/nodes/node.rb <ide> def to_sym <ide> end <ide> <ide> def name <del> left.tr "*:".freeze, "".freeze <add> -(left.tr "*:", "") <ide> end <ide> <ide> def type <ide> class Symbol < Terminal # :nodoc: <ide> def initialize(left) <ide> super <ide> @regexp = DEFAULT_EXP <del> @name = left.tr "*:".freeze, "".freeze <add> @name = -(left.tr "*:", "") <ide> end <ide> <ide> def default_regexp?
1
Text
Text
fix grammatical error
31f5edc49244aea9dd786cfd6ceaba82cd7994e5
<ide><path>docs/contributing/design-principles.md <ide> We do, however, provide some global configuration on the build level. For exampl <ide> <ide> ### Beyond the DOM <ide> <del>We see the value of React in the way it allows us to write components that have less bugs and compose together well. DOM is the original rendering target for React but [React Native](http://facebook.github.io/react-native/) is just as important both to Facebook and the community. <add>We see the value of React in the way it allows us to write components that have fewer bugs and compose together well. DOM is the original rendering target for React but [React Native](http://facebook.github.io/react-native/) is just as important both to Facebook and the community. <ide> <ide> Being renderer-agnostic is an important design constraint of React. It adds some overhead in the internal representations. On the other hand, any improvements to the core translate across platforms. <ide>
1
PHP
PHP
update doc block
e620433680a5133b4f78fe0df0c37f1728da6ade
<ide><path>lib/Cake/View/Helper/FormHelper.php <ide> public function submit($caption = null, $options = array()) { <ide> * - `escape` - If true contents of options will be HTML entity encoded. Defaults to true. <ide> * - `value` The selected value of the input. <ide> * - `class` - When using multiple = checkbox the classname to apply to the divs. Defaults to 'checkbox'. <add> * - `disabled` - Control the disabled attribute. When creating a select box, set to true to disable the <add> * select box. When creating checkboxes, `true` will disable all checkboxes. You can also set disabled <add> * to a list of values you want to disable when creating checkboxes. <ide> * <ide> * ### Using options <ide> * <ide> public function submit($caption = null, $options = array()) { <ide> * While a nested options array will create optgroups with options inside them. <ide> * {{{ <ide> * $options = array( <del> * 1 => 'bill', <del> * 'fred' => array( <del> * 2 => 'fred', <del> * 3 => 'fred jr.' <del> * ) <add> * 1 => 'bill', <add> * 'fred' => array( <add> * 2 => 'fred', <add> * 3 => 'fred jr.' <add> * ) <ide> * ); <ide> * $this->Form->select('Model.field', $options); <ide> * }}} <ide> public function submit($caption = null, $options = array()) { <ide> * <ide> * {{{ <ide> * $options = array( <del> * array('name' => 'United states', 'value' => 'USA'), <del> * array('name' => 'USA', 'value' => 'USA'), <add> * array('name' => 'United states', 'value' => 'USA'), <add> * array('name' => 'USA', 'value' => 'USA'), <ide> * ); <ide> * }}} <ide> *
1
Javascript
Javascript
enable interopclientdefaultexport for next/jest
d76bbde311da00cd750bf48d49887610960cafb9
<ide><path>packages/next/jest.js <del>function interopDefault(mod) { <del> return mod.default || mod <del>} <del>module.exports = interopDefault(require('./dist/build/jest/jest')) <add>module.exports = require('./dist/build/jest/jest') <ide><path>packages/next/taskfile.js <ide> export async function compile(task, opts) { <ide> 'bin', <ide> 'server', <ide> 'nextbuild', <add> 'nextbuildjest', <ide> 'nextbuildstatic', <ide> 'pages', <ide> 'lib', <ide> export async function server(task, opts) { <ide> export async function nextbuild(task, opts) { <ide> await task <ide> .source(opts.src || 'build/**/*.+(js|ts|tsx)', { <del> ignore: ['**/fixture/**', '**/tests/**'], <add> ignore: ['**/fixture/**', '**/tests/**', '**/jest/**'], <ide> }) <ide> .swc('server', { dev: opts.dev }) <ide> .target('dist/build') <ide> notify('Compiled build files') <ide> } <ide> <add>export async function nextbuildjest(task, opts) { <add> await task <add> .source(opts.src || 'build/jest/**/*.+(js|ts|tsx)', { <add> ignore: ['**/fixture/**', '**/tests/**'], <add> }) <add> .swc('server', { dev: opts.dev, interopClientDefaultExport: true }) <add> .target('dist/build/jest') <add> notify('Compiled build/jest files') <add>} <add> <ide> export async function client(task, opts) { <ide> await task <ide> .source(opts.src || 'client/**/*.+(js|ts|tsx)') <ide> export default async function (task) { <ide> await task.watch('pages/**/*.+(js|ts|tsx)', 'pages', opts) <ide> await task.watch('server/**/*.+(js|ts|tsx)', 'server', opts) <ide> await task.watch('build/**/*.+(js|ts|tsx)', 'nextbuild', opts) <add> await task.watch('build/jest/**/*.+(js|ts|tsx)', 'nextbuildjest', opts) <ide> await task.watch('export/**/*.+(js|ts|tsx)', 'nextbuildstatic', opts) <ide> await task.watch('client/**/*.+(js|ts|tsx)', 'client', opts) <ide> await task.watch('lib/**/*.+(js|ts|tsx)', 'lib', opts)
2
Go
Go
add godoc on mountpoint
14cb9d22df7e6674d7f1ebd73651510f213574c4
<ide><path>api/types/types.go <ide> type DefaultNetworkSettings struct { <ide> // MountPoint represents a mount point configuration inside the container. <ide> // This is used for reporting the mountpoints in use by a container. <ide> type MountPoint struct { <del> Type mount.Type `json:",omitempty"` <del> Name string `json:",omitempty"` <del> Source string <add> // Type is the type of mount, see `Type<foo>` definitions in <add> // github.com/docker/docker/api/types/mount.Type <add> Type mount.Type `json:",omitempty"` <add> <add> // Name is the name reference to the underlying data defined by `Source` <add> // e.g., the volume name. <add> Name string `json:",omitempty"` <add> <add> // Source is the source location of the mount. <add> // <add> // For volumes, this contains the storage location of the volume (within <add> // `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains <add> // the source (host) part of the bind-mount. For `tmpfs` mount points, this <add> // field is empty. <add> Source string <add> <add> // Destination is the path relative to the container root (`/`) where the <add> // Source is mounted inside the container. <ide> Destination string <del> Driver string `json:",omitempty"` <del> Mode string <del> RW bool <add> <add> // Driver is the volume driver used to create the volume (if it is a volume). <add> Driver string `json:",omitempty"` <add> <add> // Mode is a comma separated list of options supplied by the user when <add> // creating the bind/volume mount. <add> // <add> // The default is platform-specific (`"z"` on Linux, empty on Windows). <add> Mode string <add> <add> // RW indicates whether the mount is mounted writable (read-write). <add> RW bool <add> <add> // Propagation describes how mounts are propagated from the host into the <add> // mount point, and vice-versa. Refer to the Linux kernel documentation <add> // for details: <add> // https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt <add> // <add> // This field is not used on Windows. <ide> Propagation mount.Propagation <ide> } <ide>
1
PHP
PHP
add missing docblock
21959000a2d64e1aae8d8c12d256c0a0234715f2
<ide><path>src/Illuminate/Support/Facades/Http.php <ide> * @method static \Illuminate\Http\Client\PendingRequest dd() <ide> * @method static \Illuminate\Http\Client\PendingRequest dump() <ide> * @method static \Illuminate\Http\Client\PendingRequest retry(int $times, int $sleepMilliseconds = 0, ?callable $when = null, bool $throw = true) <add> * @method static \Illuminate\Http\Client\ResponseSequence sequence(array $responses = []) <ide> * @method static \Illuminate\Http\Client\PendingRequest sink(string|resource $to) <ide> * @method static \Illuminate\Http\Client\PendingRequest stub(callable $callback) <ide> * @method static \Illuminate\Http\Client\PendingRequest timeout(int $seconds)
1
Javascript
Javascript
remove duplicate test
f9cf4b6490a458e2827b059498c29cbe46a492a5
<ide><path>test/parallel/test-stream-writable-callback-twice.js <del>'use strict'; <del>const common = require('../common'); <del>const { Writable } = require('stream'); <del>const stream = new Writable({ <del> write(chunk, enc, cb) { cb(); cb(); } <del>}); <del> <del>stream.on('error', common.expectsError({ <del> name: 'Error', <del> message: 'Callback called multiple times', <del> code: 'ERR_MULTIPLE_CALLBACK' <del>})); <del> <del>stream.write('foo');
1
Ruby
Ruby
return newest sdk if requested not found
48bdd4811ec5ef54e4e408b0dcc4b7659c648a7d
<ide><path>Library/Homebrew/os/mac.rb <ide> def sdk(v = version) <ide> begin <ide> @locator.sdk_for v <ide> rescue SDKLocator::NoSDKError <add> sdk = @locator.latest_sdk <add> # don't return an SDK that's older than the OS version <add> sdk unless sdk.nil? || sdk.version < version <ide> end <ide> end <ide>
1
Java
Java
use string.isempty() instead of string.equals("")
1f3b595a034c7c554b716ed09e3419a84d3f5fde
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolver.java <ide> protected BeanWiringInfo buildWiringInfo(Object beanInstance, Configurable annot <ide> // Autowiring by name or by type <ide> return new BeanWiringInfo(annotation.autowire().value(), annotation.dependencyCheck()); <ide> } <del> else if (!"".equals(annotation.value())) { <add> else if (!annotation.value().isEmpty()) { <ide> // Explicitly specified bean name for bean definition to take property values from <ide> return new BeanWiringInfo(annotation.value(), false); <ide> } <ide><path>spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java <ide> public Object lookup(String lookupName) throws NameNotFoundException { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Static JNDI lookup: [" + name + "]"); <ide> } <del> if ("".equals(name)) { <add> if (name.isEmpty()) { <ide> return new SimpleNamingContext(this.root, this.boundObjects, this.environment); <ide> } <ide> Object found = this.boundObjects.get(name); <ide> public Name composeName(Name name, Name prefix) throws NamingException { <ide> private Iterator<T> iterator; <ide> <ide> private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException { <del> if (!"".equals(proot) && !proot.endsWith("/")) { <add> if (!proot.isEmpty() && !proot.endsWith("/")) { <ide> proot = proot + "/"; <ide> } <ide> String root = context.root + proot; <ide><path>spring-web/src/main/java/org/springframework/http/codec/ServerSentEventHttpMessageReader.java <ide> public Flux<Object> read( <ide> ResolvableType valueType = (shouldWrap ? elementType.getGeneric() : elementType); <ide> <ide> return stringDecoder.decode(message.getBody(), STRING_TYPE, null, hints) <del> .bufferUntil(line -> line.equals("")) <add> .bufferUntil(String::isEmpty) <ide> .concatMap(lines -> Mono.justOrEmpty(buildEvent(lines, valueType, shouldWrap, hints))); <ide> } <ide> <ide><path>spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java <ide> public String toString() { <ide> <ide> <ide> static PathContainer createFromUrlPath(String path, Options options) { <del> if (path.equals("")) { <add> if (path.isEmpty()) { <ide> return EMPTY_PATH; <ide> } <ide> char separator = options.separator(); <ide> static PathContainer createFromUrlPath(String path, Options options) { <ide> while (begin < path.length()) { <ide> int end = path.indexOf(separator, begin); <ide> String segment = (end != -1 ? path.substring(begin, end) : path.substring(begin)); <del> if (!segment.equals("")) { <add> if (!segment.isEmpty()) { <ide> elements.add(options.shouldDecodeAndParseSegments() ? <ide> decodeAndParsePathSegment(segment) : <ide> new DefaultPathSegment(segment, separatorElement)); <ide><path>spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java <ide> else if (!StringUtils.hasLength(pattern2string.patternString)) { <ide> int dotPos2 = p2string.indexOf('.'); <ide> String file2 = (dotPos2 == -1 ? p2string : p2string.substring(0, dotPos2)); <ide> String secondExtension = (dotPos2 == -1 ? "" : p2string.substring(dotPos2)); <del> boolean firstExtensionWild = (firstExtension.equals(".*") || firstExtension.equals("")); <del> boolean secondExtensionWild = (secondExtension.equals(".*") || secondExtension.equals("")); <add> boolean firstExtensionWild = (firstExtension.equals(".*") || firstExtension.isEmpty()); <add> boolean secondExtensionWild = (secondExtension.equals(".*") || secondExtension.isEmpty()); <ide> if (!firstExtensionWild && !secondExtensionWild) { <ide> throw new IllegalArgumentException( <ide> "Cannot combine patterns: " + this.patternString + " and " + pattern2string);
5
Ruby
Ruby
skip failing test and add a fixme note
d3563bd661a858d41547fa21f3fedb2e6fcd8b8e
<ide><path>activerecord/test/cases/persistence_test.rb <ide> def test_update_attribute_for_readonly_attribute <ide> end <ide> <ide> def test_string_ids <add> # FIXME: Fix this failing test <add> skip "Failing test. We need this fixed before 4.0.0" <ide> mv = Minivan.where(:minivan_id => 1234).first_or_initialize <ide> assert mv.new_record? <ide> assert_equal '1234', mv.minivan_id
1
Python
Python
prepare test/pseudo-tty/testcfg.py python 3
b337b58146d69702aee15e72dbae82761e15c82e
<ide><path>test/pseudo-tty/testcfg.py <del>from __future__ import print_function <ide> # Copyright 2008 the V8 project authors. All rights reserved. <ide> # Redistribution and use in source and binary forms, with or without <ide> # modification, are permitted provided that the following conditions are <ide> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE <ide> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <ide> <add>from __future__ import print_function <add> <ide> import test <ide> import os <ide> from os.path import join, exists, basename, isdir <ide> import re <ide> import utils <ide> <add>try: <add> reduce # Python 2 <add>except NameError: # Python 3 <add> from functools import reduce <add> <ide> try: <ide> xrange # Python 2 <ide> except NameError:
1
Ruby
Ruby
avoid hardcoded magic number in test teardown
42b33590f36f9d31486c1de506f417070fd96d7b
<ide><path>activesupport/test/json/encoding_test.rb <ide> def test_twz_to_json_with_use_standard_json_time_format_config_set_to_true <ide> <ide> def test_twz_to_json_with_custom_time_precision <ide> with_standard_json_time_format(true) do <del> ActiveSupport::JSON::Encoding.time_precision = 0 <del> zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] <del> time = ActiveSupport::TimeWithZone.new(Time.utc(2000), zone) <del> assert_equal "\"1999-12-31T19:00:00-05:00\"", ActiveSupport::JSON.encode(time) <add> with_time_precision(0) do <add> zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] <add> time = ActiveSupport::TimeWithZone.new(Time.utc(2000), zone) <add> assert_equal "\"1999-12-31T19:00:00-05:00\"", ActiveSupport::JSON.encode(time) <add> end <ide> end <del> ensure <del> ActiveSupport::JSON::Encoding.time_precision = 3 <ide> end <ide> <ide> def test_time_to_json_with_custom_time_precision <ide> with_standard_json_time_format(true) do <del> ActiveSupport::JSON::Encoding.time_precision = 0 <del> assert_equal "\"2000-01-01T00:00:00Z\"", ActiveSupport::JSON.encode(Time.utc(2000)) <add> with_time_precision(0) do <add> assert_equal "\"2000-01-01T00:00:00Z\"", ActiveSupport::JSON.encode(Time.utc(2000)) <add> end <ide> end <del> ensure <del> ActiveSupport::JSON::Encoding.time_precision = 3 <ide> end <ide> <ide> def test_datetime_to_json_with_custom_time_precision <ide> with_standard_json_time_format(true) do <del> ActiveSupport::JSON::Encoding.time_precision = 0 <del> assert_equal "\"2000-01-01T00:00:00+00:00\"", ActiveSupport::JSON.encode(DateTime.new(2000)) <add> with_time_precision(0) do <add> assert_equal "\"2000-01-01T00:00:00+00:00\"", ActiveSupport::JSON.encode(DateTime.new(2000)) <add> end <ide> end <del> ensure <del> ActiveSupport::JSON::Encoding.time_precision = 3 <ide> end <ide> <ide> def test_twz_to_json_when_wrapping_a_date_time <ide> def with_standard_json_time_format(boolean = true) <ide> ensure <ide> ActiveSupport.use_standard_json_time_format = old <ide> end <add> <add> def with_time_precision(value) <add> old_value = ActiveSupport::JSON::Encoding.time_precision <add> ActiveSupport::JSON::Encoding.time_precision = value <add> yield <add> ensure <add> ActiveSupport::JSON::Encoding.time_precision = old_value <add> end <ide> end
1
PHP
PHP
remove unnecessary code
75e1c61c5d59ac6801b0e3676036f6cbb18ffc11
<ide><path>src/Illuminate/Foundation/ProviderRepository.php <ide> public function load(array $providers) <ide> $manifest = $this->compileManifest($providers); <ide> } <ide> <del> // If the application is running in the console, we will not lazy load any of <del> // the service providers. This is mainly because it's not as necessary for <del> // performance and also so any provided Artisan commands get registered. <del> if ($this->app->runningInConsole()) <del> { <del> $manifest['eager'] = $manifest['providers']; <del> } <del> <ide> // Next, we will register events to load the providers for each of the events <ide> // that it has requested. This allows the service provider to defer itself <ide> // while still getting automatically loaded when a certain event occurs. <ide><path>tests/Foundation/FoundationProviderRepositoryTest.php <ide> public function testServicesAreRegisteredWhenManifestIsNotRecompiled() <ide> } <ide> <ide> <del> public function testServicesAreNeverLazyLoadedWhenRunningInConsole() <del> { <del> $app = m::mock('Illuminate\Foundation\Application')->makePartial(); <del> <del> $repo = m::mock('Illuminate\Foundation\ProviderRepository[createProvider,loadManifest,shouldRecompile]', array($app, m::mock('Illuminate\Filesystem\Filesystem'), array(__DIR__.'/services.json'))); <del> $repo->shouldReceive('loadManifest')->once()->andReturn(array('eager' => array('foo'), 'deferred' => array('deferred'), 'providers' => array('providers'), 'when' => array())); <del> $repo->shouldReceive('shouldRecompile')->once()->andReturn(false); <del> $provider = m::mock('Illuminate\Support\ServiceProvider'); <del> $repo->shouldReceive('createProvider')->once()->with('providers')->andReturn($provider); <del> <del> $app->shouldReceive('register')->once()->with($provider); <del> $app->shouldReceive('runningInConsole')->andReturn(true); <del> $app->shouldReceive('setDeferredServices')->once()->with(array('deferred')); <del> <del> $repo->load(array()); <del> } <del> <del> <ide> public function testManifestIsProperlyRecompiled() <ide> { <ide> $app = m::mock('Illuminate\Foundation\Application');
2
Javascript
Javascript
remove duplicate test
95d762e406bd37c07693e3a5ddbd0f75289e8c3f
<ide><path>packages/use-sync-external-store/src/__tests__/useSyncExternalStoreShared-test.js <ide> describe('Shared useSyncExternalStore behavior (shim and built-in)', () => { <ide> } <ide> }); <ide> <del> test('Infinite loop if getSnapshot keeps returning new reference', () => { <del> const store = createExternalStore({}); <del> <del> function App() { <del> const text = useSyncExternalStore(store.subscribe, () => ({})); <del> return <Text text={JSON.stringify(text)} />; <del> } <del> <del> spyOnDev(console, 'error'); <del> const root = createRoot(); <del> <del> expect(() => act(() => root.render(<App />))).toThrow( <del> 'Maximum update depth exceeded. This can happen when a component repeatedly ' + <del> 'calls setState inside componentWillUpdate or componentDidUpdate. React limits ' + <del> 'the number of nested updates to prevent infinite loops.', <del> ); <del> if (__DEV__) { <del> expect(console.error.calls.argsFor(0)[0]).toMatch( <del> 'The result of getSnapshot should be cached to avoid an infinite loop', <del> ); <del> } <del> }); <del> <ide> describe('extra features implemented in user-space', () => { <ide> test('memoized selectors are only called once per update', async () => { <ide> const store = createExternalStore({a: 0, b: 0});
1
Python
Python
simplify the code
5fe0e8002fc8eb6ffe56219aeb4c730a9b81675c
<ide><path>libcloud/dns/drivers/godaddy.py <ide> def _to_zones(self, items): <ide> return zones <ide> <ide> def _to_zone(self, item): <del> if "expires" not in item: <del> zone = Zone( <del> id=item["domainId"], <del> domain=item["domain"], <del> type="master", <del> ttl=None, <del> driver=self, <del> ) <del> if "expires" in item: <del> extra = {"expires": item["expires"]} <del> zone = Zone( <del> id=item["domainId"], <del> domain=item["domain"], <del> type="master", <del> ttl=None, <del> driver=self, <del> extra=extra, <del> ) <add> extra = {"expires": item.get("expires", None)} <add> zone = Zone( <add> id=item["domainId"], <add> domain=item["domain"], <add> type="master", <add> ttl=None, <add> driver=self, <add> extra=extra, <add> ) <ide> return zone <ide> <ide> def _to_records(self, items, zone=None):
1
Text
Text
add more info to fs.dir and fix typos
b41989d03a38347a0ae018c5cbfbab898ba454fe
<ide><path>doc/api/fs.md <ide> A class representing a directory stream. <ide> <ide> Created by [`fs.opendir()`][], [`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. <ide> <del>Example using async interation: <del> <ide> ```js <ide> const fs = require('fs'); <ide> <ide> Subsequent reads will result in errors. <ide> added: REPLACEME <ide> --> <ide> <del>* Returns: {Promise} containing {fs.Dirent} <add>* Returns: {Promise} containing {fs.Dirent|null} <ide> <ide> Asynchronously read the next directory entry via readdir(3) as an <ide> [`fs.Dirent`][]. <ide> <del>A `Promise` is returned that will be resolved with a [Dirent][] after the read <del>is completed. <add>After the read is completed, a `Promise` is returned that will be resolved with <add>an [`fs.Dirent`][], or `null` if there are no more directory entries to read. <ide> <ide> _Directory entries returned by this function are in no particular order as <ide> provided by the operating system's underlying directory mechanisms._ <ide> added: REPLACEME <ide> <ide> * `callback` {Function} <ide> * `err` {Error} <del> * `dirent` {fs.Dirent} <add> * `dirent` {fs.Dirent|null} <ide> <ide> Asynchronously read the next directory entry via readdir(3) as an <ide> [`fs.Dirent`][]. <ide> <del>The `callback` will be called with a [Dirent][] after the read is completed. <add>After the read is completed, the `callback` will be called with an <add>[`fs.Dirent`][], or `null` if there are no more directory entries to read. <ide> <ide> _Directory entries returned by this function are in no particular order as <ide> provided by the operating system's underlying directory mechanisms._ <ide> provided by the operating system's underlying directory mechanisms._ <ide> added: REPLACEME <ide> --> <ide> <del>* Returns: {fs.Dirent} <add>* Returns: {fs.Dirent|null} <ide> <ide> Synchronously read the next directory entry via readdir(3) as an <ide> [`fs.Dirent`][]. <ide> <add>If there are no more directory entries to read, `null` will be returned. <add> <ide> _Directory entries returned by this function are in no particular order as <ide> provided by the operating system's underlying directory mechanisms._ <ide> <ide> provided by the operating system's underlying directory mechanisms._ <ide> added: REPLACEME <ide> --> <ide> <del>* Returns: {AsyncIterator} to fully iterate over all entries in the directory. <add>* Returns: {AsyncIterator} of {fs.Dirent} <add> <add>Asynchronously iterates over the directory via readdir(3) until all entries have <add>been read. <add> <add>Entries returned by the async iterator are always an [`fs.Dirent`][]. <add>The `null` case from `dir.read()` is handled internally. <add> <add>See [`fs.Dir`][] for an example. <ide> <ide> _Directory entries returned by this iterator are in no particular order as <ide> provided by the operating system's underlying directory mechanisms._ <ide> and cleaning up the directory. <ide> The `encoding` option sets the encoding for the `path` while opening the <ide> directory and subsequent read operations. <ide> <del>Example using async interation: <add>Example using async iteration: <ide> <ide> ```js <ide> const fs = require('fs');
1
PHP
PHP
add test for rendering custom exception
e905309fcfe9e10f45f35ef44c7591d0f11b5398
<ide><path>src/Error/ExceptionRenderer.php <ide> protected function _customMethod($method, $exception) <ide> protected function _method(\Exception $exception) <ide> { <ide> list(, $baseClass) = namespaceSplit(get_class($exception)); <del> <add> <ide> if (substr($baseClass, -9) === 'Exception') { <ide> $baseClass = substr($baseClass, 0, -9); <ide> } <del> <add> <ide> $method = Inflector::variable($baseClass) ?: 'error500'; <ide> return $this->method = $method; <ide> } <ide><path>tests/TestCase/Error/ExceptionRendererTest.php <ide> public function testCakeExceptionHandling($exception, $patterns, $code) <ide> } <ide> } <ide> <add> /** <add> * Test that class names not ending in Exception are not mangled. <add> * <add> * @return void <add> */ <add> public function testExceptionNameMangling() <add> { <add> $exception = $this->getMock('Exception', [], ['Bad things', 404], 'MissingWidgetThing'); <add> $exceptionRenderer = new MyCustomExceptionRenderer($exception); <add> <add> $result = $exceptionRenderer->render()->body(); <add> $this->assertContains('widget thing is missing', $result); <add> } <add> <ide> /** <ide> * Test exceptions being raised when helpers are missing. <ide> *
2
Text
Text
use short links."
190e665bb1db54d452ed9e0bf93c6985bd8dab5f
<ide><path>docs/Acceptable-Formulae.md <ide> <ide> Some formulae should not go in <ide> [homebrew/core](https://github.com/Homebrew/homebrew-core). But there are <del>additional [Interesting Taps and Forks](Interesting-Taps-and-Forks) and anyone can start their <add>additional [Interesting Taps and Forks](Interesting-Taps-and-Forks.md) and anyone can start their <ide> own! <ide> <ide> ### Dupes in `homebrew/core` <ide> We now accept stuff that comes with macOS as long as it uses `keg_only :provided_by_macos` to be keg-only by default. <ide> <ide> ### Versioned formulae in `homebrew/core` <del>We now accept versioned formulae as long as they [meet the requirements](Versions). <add>We now accept versioned formulae as long as they [meet the requirements](Versions.md). <ide> <ide> ### We don’t like tools that upgrade themselves <ide> Software that can upgrade itself does not integrate well with Homebrew's own <ide> the upstream project. Tarballs are preferred to Git checkouts, and <ide> tarballs should include the version in the filename whenever possible. <ide> <ide> We don’t accept software without a tagged version because they regularly break <del>due to upstream changes and we can’t provide [bottles](Bottles) for them. <add>due to upstream changes and we can’t provide [bottles](Bottles.md) for them. <ide> <ide> ### Bindings <ide> First check that there is not already a binding available via <ide> get maintained and partly because we have to draw the line somewhere. <ide> We frown on authors submitting their own work unless it is very popular. <ide> <ide> Don’t forget Homebrew is all Git underneath! <del>[Maintain your own tap](How-to-Create-and-Maintain-a-Tap) if you have to! <add>[Maintain your own tap](How-to-Create-and-Maintain-a-Tap.md) if you have to! <ide> <ide> There may be exceptions to these rules in the main repository; we may <ide> include things that don't meet these criteria or reject things that do. <ide><path>docs/Bottles.md <ide> If a bottle is available and usable it will be downloaded and poured automatical <ide> Bottles will not be used if the user requests it (see above), if the formula requests it (with `pour_bottle?`), if any options are specified during installation (bottles are all compiled with default options), if the bottle is not up to date (e.g. lacking a checksum) or if the bottle's `cellar` is not `:any` nor equal to the current `HOMEBREW_CELLAR`. <ide> <ide> ## Creation <del>Bottles are created using the [Brew Test Bot](Brew-Test-Bot). This happens mostly when people submit pull requests to Homebrew and the `bottle do` block is updated by maintainers when they `brew pull --bottle` the contents of a pull request. For the Homebrew organisations' taps they are uploaded to and downloaded from [Bintray](https://bintray.com/homebrew). <add>Bottles are created using the [Brew Test Bot](Brew-Test-Bot.md). This happens mostly when people submit pull requests to Homebrew and the `bottle do` block is updated by maintainers when they `brew pull --bottle` the contents of a pull request. For the Homebrew organisations' taps they are uploaded to and downloaded from [Bintray](https://bintray.com/homebrew). <ide> <ide> By default, bottles will be built for the oldest CPU supported by the OS/architecture you're building for. (That's Core 2 for 64-bit OSs, Core for 32-bit.) This ensures that bottles are compatible with all computers you might distribute them to. If you *really* want your bottles to be optimized for something else, you can pass the `--bottle-arch=` option to build for another architecture - for example, `brew install foo --bottle-arch=penryn`. Just remember that if you build for a newer architecture some of your users might get binaries they can't run and that would be sad! <ide> <ide><path>docs/Brew-Test-Bot-For-Core-Contributors.md <ide> If a build has run and passed on `brew test-bot` then it can be used to quickly <ide> There are two types of Jenkins jobs you will interact with: <ide> <ide> ## [Homebrew Core Pull Requests](https://jenkins.brew.sh/job/Homebrew%20Core/) <del>This job automatically builds any pull requests submitted to Homebrew/homebrew-core. On success or failure it updates the pull request status (see more details on the [main Brew Test Bot documentation page](Brew-Test-Bot)). On a successful build it automatically uploads bottles. <add>This job automatically builds any pull requests submitted to Homebrew/homebrew-core. On success or failure it updates the pull request status (see more details on the [main Brew Test Bot documentation page](Brew-Test-Bot.md)). On a successful build it automatically uploads bottles. <ide> <ide> ## [Homebrew Testing](https://jenkins.brew.sh/job/Homebrew%20Testing/) <ide> This job is manually triggered to run [`brew test-bot`](https://github.com/Homebrew/homebrew-test-bot/blob/master/cmd/brew-test-bot.rb) with user-specified parameters. On a successful build it automatically uploads bottles. <ide><path>docs/Building-Against-Non-Homebrew-Dependencies.md <ide> As Homebrew became primarily a binary package manager, most users were fulfillin <ide> <ide> ## Today <ide> <del>If you wish to build against custom non-Homebrew dependencies that are provided by Homebrew (e.g. a non-Homebrew, non-macOS `ruby`) then you must [create and maintain your own tap](How-to-Create-and-Maintain-a-Tap) as these formulae will not be accepted in Homebrew/homebrew-core. Once you have done that you can specify `env :std` in the formula which will allow a e.g. `which ruby` to access your existing `PATH` variable and allow compilation to link against this Ruby. <add>If you wish to build against custom non-Homebrew dependencies that are provided by Homebrew (e.g. a non-Homebrew, non-macOS `ruby`) then you must [create and maintain your own tap](How-to-Create-and-Maintain-a-Tap.md) as these formulae will not be accepted in Homebrew/homebrew-core. Once you have done that you can specify `env :std` in the formula which will allow a e.g. `which ruby` to access your existing `PATH` variable and allow compilation to link against this Ruby. <ide><path>docs/Common-Issues.md <ide> To list all files that would be deleted: <ide> <ide> Don't follow the advice here but fix by using <ide> `Language::Python.setup_install_args` in the formula as described in <del>[Python for Formula Authors](Python-for-Formula-Authors). <add>[Python for Formula Authors](Python-for-Formula-Authors.md). <ide> <ide> ### Upgrading macOS <ide> <ide><path>docs/External-Commands.md <ide> Note they are largely untested, and as always, be careful about running untested <ide> <ide> ### brew-livecheck <ide> Check if there is a new upstream version of a formula. <del>See the [`README`](https://github.com/Homebrew/homebrew-livecheck/blob/master/README) for more info and usage. <add>See the [`README`](https://github.com/Homebrew/homebrew-livecheck/blob/master/README.md) for more info and usage. <ide> <ide> Install using: <ide> <ide><path>docs/FAQ.md <ide> the launchctl PATH for _all users_. For earlier versions of macOS, see <ide> [this page](https://developer.apple.com/legacy/library/qa/qa1067/_index.html). <ide> <ide> ## How do I contribute to Homebrew? <del>Read [CONTRIBUTING.md](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING). <add>Read [CONTRIBUTING.md](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md). <ide> <ide> ## Why do you compile everything? <ide> Homebrew provides pre-compiled versions for many formulae. These <del>pre-compiled versions are referred to as [bottles](Bottles) and are available <add>pre-compiled versions are referred to as [bottles](Bottles.md) and are available <ide> at <https://bintray.com/homebrew/bottles>. <ide> <ide> If available, bottled binaries will be used by default except under the <ide> creating a separate user account especially for use of Homebrew. <ide> <ide> ## Why isn’t a particular command documented? <ide> <del>If it’s not in `man brew`, it’s probably an external command. These are documented [here](External-Commands). <add>If it’s not in `man brew`, it’s probably an external command. These are documented [here](External-Commands.md). <ide> <ide> ## Why haven’t you pulled my pull request? <ide> If it’s been a while, bump it with a “bump” comment. Sometimes we miss requests and there are plenty of them. Maybe we were thinking on something. It will encourage consideration. In the meantime if you could rebase the pull request so that it can be cherry-picked more easily we will love you for a long time. <ide> install <formula>`. If you encounter any issues, run the command with the <ide> into a debugging shell. <ide> <ide> If you want your new formula to be part of `homebrew/core` or want <del>to learn more about writing formulae, then please read the [Formula Cookbook](Formula-Cookbook). <add>to learn more about writing formulae, then please read the [Formula Cookbook](Formula-Cookbook.md). <ide> <ide> ## Can I install my own stuff to `/usr/local`? <ide> Yes, `brew` is designed to not get in your way so you can use it how you <ide><path>docs/Formula-Cookbook.md <ide> Make sure you run `brew update` before you start. This turns your Homebrew insta <ide> <ide> Before submitting a new formula make sure your package: <ide> <del>* meets all our [Acceptable Formulae](Acceptable-Formulae) requirements <add>* meets all our [Acceptable Formulae](Acceptable-Formulae.md) requirements <ide> * isn't already in Homebrew (check `brew search <formula>`) <ide> * isn't in another official [Homebrew tap](https://github.com/Homebrew) <ide> * isn't already waiting to be merged (check the [issue tracker](https://github.com/Homebrew/homebrew-core/pulls)) <ide> * is still supported by upstream (i.e. doesn't require extensive patching) <ide> * has a stable, tagged version (i.e. not just a GitHub repository with no versions) <ide> * passes all `brew audit --new-formula <formula>` tests. <ide> <del>Before submitting a new formula make sure you read over our [contribution guidelines](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING). <add>Before submitting a new formula make sure you read over our [contribution guidelines](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md). <ide> <ide> ### Grab the URL <ide> <ide> Check the top of the e.g. `./configure` output. Some configure scripts do not re <ide> <ide> ### Add a test to the formula <ide> <del>Add a valid test to the [`test do`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula&num;test-class_method) block of the formula. This will be run by `brew test foo` and the [Brew Test Bot](Brew-Test-Bot). <add>Add a valid test to the [`test do`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula&num;test-class_method) block of the formula. This will be run by `brew test foo` and the [Brew Test Bot](Brew-Test-Bot.md). <ide> <ide> The <ide> [`test do`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#test-class_method) <ide> end <ide> <ide> ### Compiler selection <ide> <del>Sometimes a package fails to build when using a certain compiler. Since recent [Xcode versions](Xcode) no longer include a GCC compiler we cannot simply force the use of GCC. Instead, the correct way to declare this is the [`fails_with` DSL method](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method). A properly constructed [`fails_with`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method) block documents the latest compiler build version known to cause compilation to fail, and the cause of the failure. For example: <add>Sometimes a package fails to build when using a certain compiler. Since recent [Xcode versions](Xcode.md) no longer include a GCC compiler we cannot simply force the use of GCC. Instead, the correct way to declare this is the [`fails_with` DSL method](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method). A properly constructed [`fails_with`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#fails_with-class_method) block documents the latest compiler build version known to cause compilation to fail, and the cause of the failure. For example: <ide> <ide> ```ruby <ide> fails_with :clang do <ide><path>docs/Homebrew-and-Python.md <ide> # Python <ide> <del>This page describes how Python is handled in Homebrew for users. See [Python for Formula Authors](Python-for-Formula-Authors) for advice on writing formulae to install packages written in Python. <add>This page describes how Python is handled in Homebrew for users. See [Python for Formula Authors](Python-for-Formula-Authors.md) for advice on writing formulae to install packages written in Python. <ide> <ide> Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python. <ide> <ide> Some formulae provide Python bindings. Sometimes a `--with-python` or `--with-py <ide> <ide> Homebrew builds bindings against the first `python` (and `python-config`) in your `PATH`. (Check with `which python`). <ide> <del>**Warning!** Python may crash (see [Common Issues](Common-Issues)) if you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`). <add>**Warning!** Python may crash (see [Common Issues](Common-Issues.md)) if you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`). <ide> <ide> ## Policy for non-brewed Python bindings <ide> These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.) <ide><path>docs/How-To-Open-a-Homebrew-Pull-Request.md <ide> To make a new branch and submit it for review, create a GitHub pull request with <ide> 1. Check out the `master` branch with `git checkout master`. <ide> 2. Retrieve new changes to the `master` branch with `brew update`. <ide> 3. Create a new branch from the latest `master` branch with `git checkout -b <YOUR_BRANCH_NAME> origin/master`. <del>4. Make your changes. For formulae, use `brew edit` or your favorite text editor, following all the guidelines in the [Formula Cookbook](Formula-Cookbook). <add>4. Make your changes. For formulae, use `brew edit` or your favorite text editor, following all the guidelines in the [Formula Cookbook](Formula-Cookbook.md). <ide> * If there's a `bottle do` block in the formula, don't remove or change it; we'll update it when we pull your PR. <ide> 5. Test your changes by doing the following, and ensure they all pass without issue. For changed formulae, make sure you do the `brew audit` step while your changed formula is installed. <ide> * `brew tests` <ide><path>docs/How-to-Create-and-Maintain-a-Tap.md <ide> If it’s on GitHub, users can install any of your formulae with <ide> file here. <ide> <ide> If they want to get your tap without installing any formula at the same time, <del>users can add it with the [`brew tap` command](Taps). <add>users can add it with the [`brew tap` command](Taps.md). <ide> <ide> If it’s on GitHub, they can use `brew tap user/repo`, where `user` is your <ide> GitHub username and `homebrew-repo` your repository. <ide> Once your tap is installed, Homebrew will update it each time a user runs <ide> <ide> ## External commands <ide> You can provide your tap users with custom `brew` commands by adding them in a <del>`cmd` subdirectory. [Read more on external commands](External-Commands). <add>`cmd` subdirectory. [Read more on external commands](External-Commands.md). <ide> <ide> See [homebrew/aliases](https://github.com/Homebrew/homebrew-aliases) for an <ide> example of a tap with external commands. <ide><path>docs/How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md <ide> <ide> ## What does "keg-only" mean? <ide> <del>The [FAQ](FAQ) briefly explains this. <add>The [FAQ](FAQ.md) briefly explains this. <ide> <ide> As an example: <ide> <ide><path>docs/Installation.md <ide> The suggested and easiest way to install Homebrew is on the <ide> [homepage](https://brew.sh). <ide> <ide> The standard script installs Homebrew to `/usr/local` so that <del>[you don’t need sudo](FAQ) when you <add>[you don’t need sudo](FAQ.md) when you <ide> `brew install`. It is a careful script; it can be run even if you have stuff <ide> installed to `/usr/local` already. It tells you exactly what it will do before <ide> it does it too. And you have to confirm everything it will do before it starts. <ide> mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar <ide> Create a Homebrew installation wherever you extract the tarball. Whichever `brew` command is called is where the packages will be installed. You can use this as you see fit, e.g. a system set of libs in `/usr/local` and tweaked formulae for development in `~/homebrew`. <ide> <ide> ## Uninstallation <del>Uninstallation is documented in the [FAQ](FAQ). <add>Uninstallation is documented in the [FAQ](FAQ.md). <ide> <ide> <a name="1"><sup>1</sup></a> Not all formulae have CPU or OS requirements, but <ide> you can assume you will have trouble if you don’t conform. Also, you can find <ide> PowerPC and Tiger branches from other users in the fork network. See <del>[Interesting Taps and Forks](Interesting-Taps-and-Forks). <add>[Interesting Taps and Forks](Interesting-Taps-and-Forks.md). <ide> <ide> <a name="2"><sup>2</sup></a> 10.10 or higher is recommended. 10.5–10.9 are <ide> supported on a best-effort basis. For 10.4 see <ide><path>docs/Maintainer-Guidelines.md <ide> access** to Homebrew’s repository and help merge the contributions of <ide> others. You may find what is written here interesting, but it’s <ide> definitely not a beginner’s guide. <ide> <del>Maybe you were looking for the [Formula Cookbook](Formula-Cookbook)? <add>Maybe you were looking for the [Formula Cookbook](Formula-Cookbook.md)? <ide> <ide> ## Quick checklist <ide> <ide> Add other names as aliases as symlinks in `Aliases` in the tap root. Ensure the <ide> name referenced on the homepage is one of these, as it may be different and have <ide> underscores and hyphens and so on. <ide> <del>We now accept versioned formulae as long as they [meet the requirements](Versions). <add>We now accept versioned formulae as long as they [meet the requirements](Versions.md). <ide> <ide> ### Merging, rebasing, cherry-picking <ide> Merging should be done in the `Homebrew/brew` repository to preserve history & GPG commit signing, <ide> the commits. Our main branch history should be useful to other people, <ide> not confusing. <ide> <ide> ### Testing <del>We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot) for this. <add>We need to at least check that it builds. Use the [Brew Test Bot](Brew-Test-Bot.md) for this. <ide> <ide> Verify the formula works if possible. If you can’t tell (e.g. if it’s a <ide> library) trust the original contributor, it worked for them, so chances are it <ide><path>docs/New-Maintainer-Checklist.md <ide> If they accept, follow a few steps to get them set up: <ide> - Invite them to the [`homebrew` private maintainers 1Password](https://homebrew.1password.com/signin) <ide> - Invite them to [Google Analytics](https://analytics.google.com/analytics/web/?authuser=1#management/Settings/a76679469w115400090p120682403/%3Fm.page%3DAccountUsers/) <ide> <del>After a month-long trial period with no problems make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to [Homebrew's README](https://github.com/Homebrew/brew/edit/master/README). If there are problems, ask them to step down as a maintainer and revoke their access to the above. <add>After a month-long trial period with no problems make them [owners on the Homebrew GitHub organisation](https://github.com/orgs/Homebrew/people) and add them to [Homebrew's README](https://github.com/Homebrew/brew/edit/master/README.md). If there are problems, ask them to step down as a maintainer and revoke their access to the above. <ide> <ide> Now sit back, relax and let the new maintainers handle more of our contributions. <ide><path>docs/Node-for-Formula-Authors.md <ide> In your formula's `install` method, do any installation steps which need to be d <ide> system "npm", "install", *Language::Node.local_npm_install_args <ide> ``` <ide> <del>This will install all of your Node modules dependencies to your local build path. You can now continue with your build steps and take care of the installation into the Homebrew `prefix` on your own, following the [general Homebrew formula instructions](Formula-Cookbook). <add>This will install all of your Node modules dependencies to your local build path. You can now continue with your build steps and take care of the installation into the Homebrew `prefix` on your own, following the [general Homebrew formula instructions](Formula-Cookbook.md). <ide> <ide> ## Example <ide> <ide><path>docs/README.md <ide> # Documentation <ide> <ide> ## Users <del>- [`brew` man-page (command documentation)](Manpage) <del>- [Troubleshooting](Troubleshooting) <del>- [Installation](Installation) <del>- [Frequently Asked Questions](FAQ) <del>- [Common Issues](Common-Issues) <add>- [`brew` man-page (command documentation)](Manpage.md) <add>- [Troubleshooting](Troubleshooting.md) <add>- [Installation](Installation.md) <add>- [Frequently Asked Questions](FAQ.md) <add>- [Common Issues](Common-Issues.md) <ide> <del>- [Tips and Tricks](Tips-N'-Tricks) <del>- [Bottles (binary packages)](Bottles) <del>- [Taps (third-party repositories)](Taps) <del>- [Interesting Taps and Forks](Interesting-Taps-and-Forks) <del>- [Anonymous Aggregate User Behaviour Analytics](Analytics) <add>- [Tips and Tricks](Tips-N'-Tricks.md) <add>- [Bottles (binary packages)](Bottles.md) <add>- [Taps (third-party repositories)](Taps.md) <add>- [Interesting Taps and Forks](Interesting-Taps-and-Forks.md) <add>- [Anonymous Aggregate User Behaviour Analytics](Analytics.md) <ide> <del>- [Querying `brew`](Querying-Brew) <del>- [C++ Standard Libraries](C++-Standard-Libraries) <del>- [MD5 and SHA-1 Deprecation](Checksum_Deprecation) <del>- [Custom GCC and Cross Compilers](Custom-GCC-and-cross-compilers) <del>- [External Commands](External-Commands) <del>- [Ruby Gems, Python Eggs and Perl Modules](Gems,-Eggs-and-Perl-Modules) <del>- [Python](Homebrew-and-Python) <del>- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies) <del>- [Xcode](Xcode) <del>- [Kickstarter Supporters](Kickstarter-Supporters) <add>- [Querying `brew`](Querying-Brew.md) <add>- [C++ Standard Libraries](C++-Standard-Libraries.md) <add>- [MD5 and SHA-1 Deprecation](Checksum_Deprecation.md) <add>- [Custom GCC and Cross Compilers](Custom-GCC-and-cross-compilers.md) <add>- [External Commands](External-Commands.md) <add>- [Ruby Gems, Python Eggs and Perl Modules](Gems,-Eggs-and-Perl-Modules.md) <add>- [Python](Homebrew-and-Python.md) <add>- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md) <add>- [Xcode](Xcode.md) <add>- [Kickstarter Supporters](Kickstarter-Supporters.md) <ide> <ide> ## Contributors <del>- [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request) <del>- [Formula Cookbook](Formula-Cookbook) <del>- [Acceptable Formulae](Acceptable-Formulae) <del>- [Formulae Versions](Versions) <del>- [Node for Formula Authors](Node-for-Formula-Authors) <del>- [Python for Formula Authors](Python-for-Formula-Authors) <del>- [Migrating A Formula To A Tap](Migrating-A-Formula-To-A-Tap) <del>- [Rename A Formula](Rename-A-Formula) <del>- [Building Against Non-Homebrew Dependencies](Building-Against-Non-Homebrew-Dependencies) <del>- [How To Create (And Maintain) A Tap](How-to-Create-and-Maintain-a-Tap) <del>- [Brew Test Bot](Brew-Test-Bot) <del>- [Prose Style Guidelines](Prose-Style-Guidelines) <add>- [How To Open A Pull Request (and get it merged)](How-To-Open-a-Homebrew-Pull-Request.md) <add>- [Formula Cookbook](Formula-Cookbook.md) <add>- [Acceptable Formulae](Acceptable-Formulae.md) <add>- [Formulae Versions](Versions.md) <add>- [Node for Formula Authors](Node-for-Formula-Authors.md) <add>- [Python for Formula Authors](Python-for-Formula-Authors.md) <add>- [Migrating A Formula To A Tap](Migrating-A-Formula-To-A-Tap.md) <add>- [Rename A Formula](Rename-A-Formula.md) <add>- [Building Against Non-Homebrew Dependencies](Building-Against-Non-Homebrew-Dependencies.md) <add>- [How To Create (And Maintain) A Tap](How-to-Create-and-Maintain-a-Tap.md) <add>- [Brew Test Bot](Brew-Test-Bot.md) <add>- [Prose Style Guidelines](Prose-Style-Guidelines.md) <ide> <ide> ## Maintainers <del>- [New Maintainer Checklist](New-Maintainer-Checklist) <del>- [Maintainers: Avoiding Burnout](Maintainers-Avoiding-Burnout) <del>- [Maintainer Guidelines](Maintainer-Guidelines) <del>- [Brew Test Bot For Maintainers](Brew-Test-Bot-For-Core-Contributors) <del>- [Common Issues for Maintainers](Common-Issues-for-Core-Contributors) <add>- [New Maintainer Checklist](New-Maintainer-Checklist.md) <add>- [Maintainers: Avoiding Burnout](Maintainers-Avoiding-Burnout.md) <add>- [Maintainer Guidelines](Maintainer-Guidelines.md) <add>- [Brew Test Bot For Maintainers](Brew-Test-Bot-For-Core-Contributors.md) <add>- [Common Issues for Maintainers](Common-Issues-for-Core-Contributors.md) <ide><path>docs/Tips-N'-Tricks.md <ide> ## Installing previous versions of formulae <ide> <ide> The supported method of installing specific versions of <del>some formulae is to see if there is a versioned formula (e.g. `gcc@6`) available. If the version you’re looking for isn’t available, consider [opening a pull request](How-To-Open-a-Homebrew-Pull-Request)! <add>some formulae is to see if there is a versioned formula (e.g. `gcc@6`) available. If the version you’re looking for isn’t available, consider [opening a pull request](How-To-Open-a-Homebrew-Pull-Request.md)! <ide> <ide> ### Installing directly from pull requests <ide> You can [browse pull requests](https://github.com/Homebrew/homebrew-core/pulls) <ide><path>docs/Troubleshooting.md <ide> Follow these steps to fix common problems: <ide> * Run `brew doctor` and fix all the warnings (**outdated Xcode/CLT and unbrewed dylibs are very likely to cause problems**). <ide> * Check that **Command Line Tools for Xcode (CLT)** and **Xcode** are up to date. <ide> * If commands fail with permissions errors, check the permissions of `/usr/local`'s subdirectories. If you’re unsure what to do, you can run `cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks`. <del>* Read through the [Common Issues](Common-Issues). <add>* Read through the [Common Issues](Common-Issues.md). <ide> <ide> ## Check to see if the issue has been reported <ide> <ide><path>docs/Versions.md <ide> Versioned formulae we include in [homebrew/core](https://github.com/homebrew/hom <ide> * Versioned formulae should be as similar as possible and sensible to the unversioned formulae. Creating or updating a versioned formula should be a chance to ask questions of the unversioned formula e.g. can some unused or useless options be removed or made default? <ide> * No more than five versions of a formula (including the non-versioned one) will be supported at any given time, regardless of usage. When removing formulae that violate this we will aim to do so based on usage and support status rather than age. <ide> <del>Homebrew's versions are not intended to be used for any old versions you personally require for your project. You should create your own [tap](How-to-Create-and-Maintain-a-Tap) for formulae you or your organisation wish to control the versioning of or those that do not meet the above standards. Software that has regular API or ABI breaking releases still needs to meet all the above requirements; that a `brew upgrade` has broken something for you is not an argument for us to add and maintain a formula for you. <add>Homebrew's versions are not intended to be used for any old versions you personally require for your project. You should create your own [tap](How-to-Create-and-Maintain-a-Tap.md) for formulae you or your organisation wish to control the versioning of or those that do not meet the above standards. Software that has regular API or ABI breaking releases still needs to meet all the above requirements; that a `brew upgrade` has broken something for you is not an argument for us to add and maintain a formula for you. <ide> <ide> We may temporarily add versioned formulae for our own needs that do not meet these standards in [homebrew/core](https://github.com/homebrew/homebrew-core). The presence of a versioned formula there does not imply it will be maintained indefinitely or that we are willing to accept any more versions that do not meet the requirements above.
20
Ruby
Ruby
postgresql 10 new relkind for partitioned tables
36f28fd8184a999f82bd8b0388e31798bd856ae0
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb <ide> def add_options_for_index_columns(quoted_columns, **options) <ide> <ide> def data_source_sql(name = nil, type: nil) <ide> scope = quoted_scope(name, type: type) <del> scope[:type] ||= "'r','v','m','f'" # (r)elation/table, (v)iew, (m)aterialized view, (f)oreign table <add> scope[:type] ||= "'r','v','m','p','f'" # (r)elation/table, (v)iew, (m)aterialized view, (p)artitioned table, (f)oreign table <ide> <ide> sql = "SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace".dup <ide> sql << " WHERE n.nspname = #{scope[:schema]}" <ide> def quoted_scope(name = nil, type: nil) <ide> type = \ <ide> case type <ide> when "BASE TABLE" <del> "'r'" <add> "'r','p'" <ide> when "VIEW" <ide> "'v','m'" <ide> when "FOREIGN TABLE" <ide><path>activerecord/test/cases/adapters/postgresql/partitions_test.rb <add># frozen_string_literal: true <add> <add>require "cases/helper" <add> <add>class PostgreSQLPartitionsTest < ActiveRecord::PostgreSQLTestCase <add> def setup <add> @connection = ActiveRecord::Base.connection <add> end <add> <add> def teardown <add> @connection.drop_table "partitioned_events", if_exists: true <add> end <add> <add> def test_partitions_table_exists <add> skip unless ActiveRecord::Base.connection.postgresql_version >= 100000 <add> @connection.create_table :partitioned_events, force: true, id: false, <add> options: "partition by range (issued_at)" do |t| <add> t.timestamp :issued_at <add> end <add> assert @connection.table_exists?("partitioned_events") <add> end <add>end
2
Ruby
Ruby
fix audit on formulae without homepages
e3f4701f385c286a2cc72c5d07870cc9a6ce0bf4
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_desc <ide> def audit_homepage <ide> homepage = formula.homepage <ide> <add> if homepage.nil? || homepage.empty? <add> problem "Formula should have a homepage." <add> return <add> end <add> <ide> unless homepage =~ %r{^https?://} <ide> problem "The homepage should start with http or https (URL is #{homepage})." <ide> end <ide><path>Library/Homebrew/test/audit_test.rb <ide> class #{Formulary.class_s(name)} < Formula <ide> end <ide> end <ide> <add> def test_audit_without_homepage <add> fa = formula_auditor "foo", <<-EOS.undent, online: true <add> class Foo < Formula <add> url "http://example.com/foo-1.0.tgz" <add> end <add> EOS <add> <add> fa.audit_homepage <add> assert_match "Formula should have a homepage.", fa.problems.first <add> end <add> <ide> def test_audit_xcodebuild_suggests_symroot <ide> fa = formula_auditor "foo", <<-EOS.undent <ide> class Foo < Formula
2
Java
Java
remove temporary timeout in take
e128ffe3c0474e3c4ca1a245b7c6f23ede343f5a
<ide><path>rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorToIterator.java <ide> public T next() { <ide> } <ide> <ide> private Notification<? extends T> take() { <del> return notifications.poll(); <add> try { <add> return notifications.take(); <add> } catch (InterruptedException e) { <add> throw Exceptions.propagate(e); <add> } <ide> } <ide> <ide> @Override
1
Python
Python
remove parentheses around axis
df664eade973041cf4eb554b2048380b3f0b75ae
<ide><path>numpy/fft/fftpack.py <ide> def fft(a, n=None, axis=-1): <ide> Length of the transformed axis of the output. <ide> If `n` is smaller than the length of the input, the input is cropped. <ide> If it is larger, the input is padded with zeros. If `n` is not given, <del> the length of the input (along the axis specified by `axis`) is used. <add> the length of the input along the axis specified by `axis` is used. <ide> axis : int, optional <ide> Axis over which to compute the FFT. If not given, the last axis is <ide> used. <ide> def ifft(a, n=None, axis=-1): <ide> Length of the transformed axis of the output. <ide> If `n` is smaller than the length of the input, the input is cropped. <ide> If it is larger, the input is padded with zeros. If `n` is not given, <del> the length of the input (along the axis specified by `axis`) is used. <add> the length of the input along the axis specified by `axis` is used. <ide> See notes about padding issues. <ide> axis : int, optional <ide> Axis over which to compute the inverse DFT. If not given, the last <ide> def rfft(a, n=None, axis=-1): <ide> Number of points along transformation axis in the input to use. <ide> If `n` is smaller than the length of the input, the input is cropped. <ide> If it is larger, the input is padded with zeros. If `n` is not given, <del> the length of the input (along the axis specified by `axis`) is used. <add> the length of the input along the axis specified by `axis` is used. <ide> axis : int, optional <ide> Axis over which to compute the FFT. If not given, the last axis is <ide> used. <ide> def irfft(a, n=None, axis=-1): <ide> For `n` output points, ``n//2+1`` input points are necessary. If the <ide> input is longer than this, it is cropped. If it is shorter than this, <ide> it is padded with zeros. If `n` is not given, it is determined from <del> the length of the input (along the axis specified by `axis`). <add> the length of the input along the axis specified by `axis`. <ide> axis : int, optional <ide> Axis over which to compute the inverse FFT. If not given, the last <ide> axis is used. <ide> def hfft(a, n=None, axis=-1): <ide> For `n` output points, ``n//2+1`` input points are necessary. If the <ide> input is longer than this, it is cropped. If it is shorter than this, <ide> it is padded with zeros. If `n` is not given, it is determined from <del> the length of the input (along the axis specified by `axis`). <add> the length of the input along the axis specified by `axis`. <ide> axis : int, optional <ide> Axis over which to compute the FFT. If not given, the last <ide> axis is used. <ide> def ihfft(a, n=None, axis=-1): <ide> Number of points along transformation axis in the input to use. <ide> If `n` is smaller than the length of the input, the input is cropped. <ide> If it is larger, the input is padded with zeros. If `n` is not given, <del> the length of the input (along the axis specified by `axis`) is used. <add> the length of the input along the axis specified by `axis` is used. <ide> axis : int, optional <ide> Axis over which to compute the inverse FFT. If not given, the last <ide> axis is used. <ide> def fftn(a, s=None, axes=None): <ide> This corresponds to `n` for `fft(x, n)`. <ide> Along any axis, if the given shape is smaller than that of the input, <ide> the input is cropped. If it is larger, the input is padded with zeros. <del> if `s` is not given, the shape of the input (along the axes specified <del> by `axes`) is used. <add> if `s` is not given, the shape of the input along the axes specified <add> by `axes` is used. <ide> axes : sequence of ints, optional <ide> Axes over which to compute the FFT. If not given, the last ``len(s)`` <ide> axes are used, or all axes if `s` is also not specified. <ide> def ifftn(a, s=None, axes=None): <ide> This corresponds to ``n`` for ``ifft(x, n)``. <ide> Along any axis, if the given shape is smaller than that of the input, <ide> the input is cropped. If it is larger, the input is padded with zeros. <del> if `s` is not given, the shape of the input (along the axes specified <del> by `axes`) is used. See notes for issue on `ifft` zero padding. <add> if `s` is not given, the shape of the input along the axes specified <add> by `axes` is used. See notes for issue on `ifft` zero padding. <ide> axes : sequence of ints, optional <ide> Axes over which to compute the IFFT. If not given, the last ``len(s)`` <ide> axes are used, or all axes if `s` is also not specified. <ide> def fft2(a, s=None, axes=(-2, -1)): <ide> This corresponds to `n` for `fft(x, n)`. <ide> Along each axis, if the given shape is smaller than that of the input, <ide> the input is cropped. If it is larger, the input is padded with zeros. <del> if `s` is not given, the shape of the input (along the axes specified <del> by `axes`) is used. <add> if `s` is not given, the shape of the input along the axes specified <add> by `axes` is used. <ide> axes : sequence of ints, optional <ide> Axes over which to compute the FFT. If not given, the last two <ide> axes are used. A repeated index in `axes` means the transform over <ide> def ifft2(a, s=None, axes=(-2, -1)): <ide> ``s[1]`` to axis 1, etc.). This corresponds to `n` for ``ifft(x, n)``. <ide> Along each axis, if the given shape is smaller than that of the input, <ide> the input is cropped. If it is larger, the input is padded with zeros. <del> if `s` is not given, the shape of the input (along the axes specified <del> by `axes`) is used. See notes for issue on `ifft` zero padding. <add> if `s` is not given, the shape of the input along the axes specified <add> by `axes` is used. See notes for issue on `ifft` zero padding. <ide> axes : sequence of ints, optional <ide> Axes over which to compute the FFT. If not given, the last two <ide> axes are used. A repeated index in `axes` means the transform over <ide> def rfftn(a, s=None, axes=None): <ide> for the remaining axes, it corresponds to `n` for ``fft(x, n)``. <ide> Along any axis, if the given shape is smaller than that of the input, <ide> the input is cropped. If it is larger, the input is padded with zeros. <del> if `s` is not given, the shape of the input (along the axes specified <del> by `axes`) is used. <add> if `s` is not given, the shape of the input along the axes specified <add> by `axes` is used. <ide> axes : sequence of ints, optional <ide> Axes over which to compute the FFT. If not given, the last ``len(s)`` <ide> axes are used, or all axes if `s` is also not specified. <ide> def irfftn(a, s=None, axes=None): <ide> where ``s[-1]//2+1`` points of the input are used. <ide> Along any axis, if the shape indicated by `s` is smaller than that of <ide> the input, the input is cropped. If it is larger, the input is padded <del> with zeros. If `s` is not given, the shape of the input (along the <del> axes specified by `axes`) is used. <add> with zeros. If `s` is not given, the shape of the input along the <add> axes specified by `axes` is used. <ide> axes : sequence of ints, optional <ide> Axes over which to compute the inverse FFT. If not given, the last <ide> `len(s)` axes are used, or all axes if `s` is also not specified.
1
Text
Text
fix a typo in integrationwithexistingapps.md
7eb876e2691d4c660f84a5e44e86fff85bd5154a
<ide><path>docs/IntegrationWithExistingApps.md <ide> After you have created your `Podfile`, you are ready to install the React Native <ide> $ pod install <ide> ``` <ide> <del>Your should see output such as: <add>You should see output such as: <ide> <ide> ```bash <ide> Analyzing dependencies
1
Java
Java
implement tostring() in mockcookie
e17ca9a4e907e045daf0a7ec8e4fa99a0948d248
<ide><path>spring-test/src/main/java/org/springframework/mock/web/MockCookie.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2021 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> import javax.servlet.http.Cookie; <ide> <add>import org.springframework.core.style.ToStringCreator; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.StringUtils; <ide> private static String extractAttributeValue(String attribute, String header) { <ide> return nameAndValue[1]; <ide> } <ide> <add> @Override <add> public String toString() { <add> return new ToStringCreator(this) <add> .append("name", getName()) <add> .append("value", getValue()) <add> .append("Path", getPath()) <add> .append("Domain", getDomain()) <add> .append("Version", getVersion()) <add> .append("Comment", getComment()) <add> .append("Secure", getSecure()) <add> .append("HttpOnly", isHttpOnly()) <add> .append("SameSite", this.sameSite) <add> .append("Max-Age", getMaxAge()) <add> .append("Expires", (this.expires != null ? <add> DateTimeFormatter.RFC_1123_DATE_TIME.format(this.expires) : null)) <add> .toString(); <add> } <add> <ide> }
1
Python
Python
add some docstrings and edit others
55273d236945aa5f4b6e01682dfef82384a7fd65
<ide><path>numpy/lib/_datasource.py <ide> _open = open <ide> <ide> def _check_mode(mode, encoding, newline): <add> """Check mode and that encoding and newline are compatible. <add> <add> Parameters <add> ---------- <add> mode : str <add> File open mode. <add> encoding : str <add> File encoding. <add> newline : str <add> Newline for text files. <add> <add> """ <ide> if "t" in mode: <ide> if "b" in mode: <ide> raise ValueError("Invalid mode: %r" % (mode,)) <ide> def _check_mode(mode, encoding, newline): <ide> if newline is not None: <ide> raise ValueError("Argument 'newline' not supported in binary mode") <ide> <add> <ide> def _python2_bz2open(fn, mode, encoding, newline): <del> """ wrapper to open bz2 in text mode """ <add> """Wrapper to open bz2 in text mode. <add> <add> Parameters <add> ---------- <add> fn : str <add> File name <add> mode : {'r', 'w'} <add> File mode. Note that bz2 Text files are not supported. <add> encoding : str <add> Ignored, text bz2 files not supported in Python2. <add> newline : str <add> Ignored, text bz2 files not supported in Python2. <add> """ <ide> import bz2 <ide> <ide> _check_mode(mode, encoding, newline) <ide> def _python2_bz2open(fn, mode, encoding, newline): <ide> return bz2.BZ2File(fn, mode) <ide> <ide> def _python2_gzipopen(fn, mode, encoding, newline): <del> """ wrapper to open gzip in text mode """ <add> """ Wrapper to open gzip in text mode. <add> <add> Parameters <add> ---------- <add> fn : str, bytes, file <add> File path or opened file. <add> mode : str <add> File mode. The actual files are opened as binary, but will decoded <add> using the specified `encoding` and `newline`. <add> encoding : str <add> Encoding to be used when reading/writing as text. <add> newline : str <add> Newline to be used when reading/writing as text. <add> <add> """ <ide> import gzip <ide> # gzip is lacking read1 needed for TextIOWrapper <ide> class GzipWrap(gzip.GzipFile): <ide> def read1(self, n): <ide> _check_mode(mode, encoding, newline) <ide> <ide> gz_mode = mode.replace("t", "") <add> <ide> if isinstance(fn, (str, bytes)): <ide> binary_file = GzipWrap(fn, gz_mode) <ide> elif hasattr(fn, "read") or hasattr(fn, "write"): <ide><path>numpy/lib/npyio.py <ide> def load(file, mmap_mode=None, allow_pickle=True, fix_imports=True, <ide> used in Python 3. <ide> encoding : str, optional <ide> What encoding to use when reading Python 2 strings. Only useful when <del> loading Python 2 generated pickled files on Python 3, which includes <add> loading Python 2 generated pickled files in Python 3, which includes <ide> npy/npz files containing object arrays. Values other than 'latin1', <ide> 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical <ide> data. Default: 'ASCII' <ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None, <ide> Legal values: 0 (default), 1 or 2. <ide> <ide> .. versionadded:: 1.6.0 <del> encoding: string, optional <add> encoding : str, optional <ide> Encoding used to decode the inputfile. Does not apply to input streams. <ide> The special value 'bytes' enables backward compatibility workarounds <ide> that ensures you receive byte arrays as results if possible and passes <ide> latin1 encoded strings to converters. Override this value to receive <del> unicode arrays and pass strings as input to converters. <del> If set to None the system default is used. <add> unicode arrays and pass strings as input to converters. If set to None <add> the system default is used. The default value is 'bytes'. <ide> <ide> .. versionadded:: 1.14.0 <ide> <ide> def split_line(line): <ide> return [] <ide> <ide> def read_data(chunk_size): <del> # Parse each line, including the first <add> """Parse each line, including the first. <add> <add> The file read, `fh`, is a global defined above. <add> <add> Parameters <add> ---------- <add> chunk_size : int <add> At most `chunk_size` lines are read at a time, with iteration <add> until all lines are read. <add> <add> """ <ide> X = [] <ide> for i, line in enumerate(itertools.chain([first_line], fh)): <ide> vals = split_line(line) <ide> def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', <ide> ``numpy.loadtxt``. <ide> <ide> .. versionadded:: 1.7.0 <del> encoding: string, optional <add> encoding : str, optional <ide> Encoding used to encode the outputfile. Does not apply to output <ide> streams. <ide> <ide> def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', <ide> delimiter = asstr(delimiter) <ide> <ide> class WriteWrap(object): <del> """ convert to unicode in py2 or to bytes on bytestream inputs """ <add> """Convert to unicode in py2 or to bytes on bytestream inputs. <add> <add> """ <ide> def __init__(self, fh, encoding): <ide> self.fh = fh <ide> self.encoding = encoding <ide> def fromregex(file, regexp, dtype, encoding=None): <ide> Groups in the regular expression correspond to fields in the dtype. <ide> dtype : dtype or list of dtypes <ide> Dtype for the structured array. <del> encoding: string, optional <add> encoding : str, optional <ide> Encoding used to decode the inputfile. Does not apply to input streams. <ide> <ide> .. versionadded:: 1.14.0 <ide> def genfromtxt(fname, dtype=float, comments='#', delimiter=None, <ide> to read the entire file. <ide> <ide> .. versionadded:: 1.10.0 <del> encoding: string, optional <del> Encoding used to decode the inputfile. Does not apply to input streams. <del> The special value 'bytes' enables backward compatibility workarounds <del> that ensures you receive byte arrays as results if possible and passes <del> latin1 encoded strings to converters. Override this value to receive <del> unicode arrays and pass strings as input to converters. <del> If set to None the system default is used. <add> encoding : str, optional <add> Encoding used to decode the inputfile. Does not apply when `fname` is <add> a file object. The special value 'bytes' enables backward compatibility <add> workarounds that ensure that you receive byte arrays when possible <add> and passes latin1 encoded strings to converters. Override this value to <add> receive unicode arrays and pass strings as input to converters. If set <add> to None the system default is used. The default value is 'bytes'. <ide> <ide> .. versionadded:: 1.14.0 <ide>
2
Ruby
Ruby
replace the build object rather than mutate it
b7b8b88cea98ed4b24b813f13d7b06b538090fa6
<ide><path>Library/Homebrew/build_options.rb <ide> require 'options' <ide> <ide> class BuildOptions <del> attr_accessor :args <ide> attr_accessor :universal <ide> <ide> def initialize(args, options) <ide> def initialize_copy(other) <ide> end <ide> <ide> def include? name <del> args.include? '--' + name <add> @args.include?("--#{name}") <ide> end <ide> <ide> def with? val <ide><path>Library/Homebrew/dependency.rb <ide> def hash <ide> end <ide> <ide> def to_formula <del> f = Formulary.factory(name) <del> # Add this dependency's options to the formula's build args <del> f.build.args = f.build.args.concat(options) <del> f <add> formula = Formulary.factory(name) <add> formula.build = BuildOptions.new(options, formula.options) <add> formula <ide> end <ide> <ide> def installed? <ide><path>Library/Homebrew/formula_installer.rb <ide> def expand_dependencies(deps) <ide> end <ide> <ide> def effective_build_options_for(dependent, inherited_options=[]) <del> if dependent == f <del> build = dependent.build.dup <del> build.args |= options <del> build <del> else <del> build = dependent.build.dup <del> build.args |= inherited_options <del> build <del> end <add> args = dependent.build.used_options <add> args |= dependent == f ? options : inherited_options <add> BuildOptions.new(args, dependent.options) <ide> end <ide> <ide> def inherited_options_for(dep)
3
Go
Go
use hostname in the output of `docker node ls`
4bc91ceeb750db6a6270b2f1821cb0b2f30117fc
<ide><path>api/client/node/list.go <ide> func printTable(out io.Writer, nodes []swarm.Node, info types.Info) { <ide> // Ignore flushing errors <ide> defer writer.Flush() <ide> <del> fmt.Fprintf(writer, listItemFmt, "ID", "NAME", "MEMBERSHIP", "STATUS", "AVAILABILITY", "MANAGER STATUS") <add> fmt.Fprintf(writer, listItemFmt, "ID", "HOSTNAME", "MEMBERSHIP", "STATUS", "AVAILABILITY", "MANAGER STATUS") <ide> for _, node := range nodes { <del> name := node.Spec.Name <add> name := node.Description.Hostname <ide> availability := string(node.Spec.Availability) <ide> membership := string(node.Spec.Membership) <ide> <del> if name == "" { <del> name = node.Description.Hostname <del> } <del> <ide> reachability := "" <ide> if node.ManagerStatus != nil { <ide> if node.ManagerStatus.Leader { <ide><path>integration-cli/docker_cli_swarm_test.go <ide> package main <ide> import ( <ide> "encoding/json" <ide> "io/ioutil" <add> "strings" <ide> "time" <ide> <ide> "github.com/docker/docker/pkg/integration/checker" <ide> func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *check.C) { <ide> // restart for teardown <ide> c.Assert(d.Start(), checker.IsNil) <ide> } <add> <add>// Test case for #24090 <add>func (s *DockerSwarmSuite) TestSwarmNodeListHostname(c *check.C) { <add> d := s.AddDaemon(c, true, true) <add> <add> // The first line should contain "HOSTNAME" <add> out, err := d.Cmd("node", "ls") <add> c.Assert(err, checker.IsNil) <add> c.Assert(strings.Split(out, "\n")[0], checker.Contains, "HOSTNAME") <add>}
2
Text
Text
fix typo in ar changelog
739eee67fc34895703a4b9c8dd0fcd29c72afd38
<ide><path>activerecord/CHANGELOG.md <ide> * Honor overridden `rack.test` in Rack environment for the connection <del> management middlware. <add> management middleware. <ide> <ide> *Simon Eskildsen* <ide>
1
Text
Text
add example of comparing openssl changes
72785dd9d274cd1b8d91e019cd9d74072a7ba755
<ide><path>deps/openssl/doc/UPGRADING.md <ide> and the other is the older one. sections 6.1 and 6.2 describe the two <ide> types of files. Section 6.3 explains the steps to update the files. <ide> In the case of upgrading 1.0.2f there were no changes to the asm files. <ide> <add>Files changed between two tags can be manually inspected using: <add>``` <add>https://github.com/openssl/openssl/compare/OpenSSL_1_0_2e...OpenSSL_1_0_2f#files_bucket <add>``` <add>If any source files in `asm` directory were changed then please follow the rest of the <add>steps in this section otherwise these steps can be skipped. <add> <ide> ### 6.1. asm files for the latest compiler <ide> This was made in `deps/openssl/asm/Makefile` <ide> - Updated asm files for each platforms which are required in
1
Javascript
Javascript
add getatom to dispatcher api
ff56611fdb3b599519fd8998dcd8d650d1e0b683
<ide><path>src/Dispatcher.js <ide> export default class Dispatcher { <ide> : this.dispatch(action); <ide> } <ide> <add> getAtom() { <add> return this.atom; <add> } <add> <ide> setAtom(atom) { <ide> this.atom = atom; <ide> this.emitChange(); <ide><path>src/components/Provider.js <ide> import { PropTypes } from 'react'; <ide> <ide> const dispatcherShape = PropTypes.shape({ <ide> subscribe: PropTypes.func.isRequired, <del> perform: PropTypes.func.isRequired <add> perform: PropTypes.func.isRequired, <add> getAtom: PropTypes.func.isRequired <ide> }); <ide> <ide> export default class Provider { <ide> export default class Provider { <ide> return this.props.dispatcher.perform(actionCreator, ...args); <ide> } <ide> <add> getAtom() { <add> return this.props.dispatcher.getAtom(); <add> } <add> <ide> render() { <ide> const { children } = this.props; <ide> return children(); <ide><path>src/createDispatcher.js <ide> export default function createDispatcher(...args) { <ide> perform: ::dispatcher.perform, <ide> hydrate: ::dispatcher.hydrate, <ide> dehydrate: ::dispatcher.dehydrate, <add> getAtom: ::dispatcher.getAtom <ide> }; <ide> }
3
Text
Text
fix typo related to
03c8c6b4eeaa335d69e99d73610e47451bc6f544
<ide><path>docs/api/Store.md <ide> You may call [`dispatch()`](#dispatch) from a change listener, with the followin <ide> <ide> 1. The subscriptions are snapshotted just before every [`dispatch()`](#dispatch) call. If you subscribe or unsubscribe while the listeners are being invoked, this will not have any effect on the [`dispatch()`](#dispatch) that is currently in progress. However, the next [`dispatch()`](#dispatch) call, whether nested or not, will use a more recent snapshot of the subscription list. <ide> <del>2. The listener should not expect to see all states changes, as the state might have been updated multiple times during a nested [`dispatch()`](#dispatch) before the listener is called. It is, however, guaranteed that all subscribers registered before the [`dispatch()`](#dispatch) started will be called with the latest state by the time it exits. <add>2. The listener should not expect to see all state changes, as the state might have been updated multiple times during a nested [`dispatch()`](#dispatch) before the listener is called. It is, however, guaranteed that all subscribers registered before the [`dispatch()`](#dispatch) started will be called with the latest state by the time it exits. <ide> <ide> It is a low-level API. Most likely, instead of using it directly, you’ll use React (or other) bindings. If you feel that the callback needs to be invoked with the current state, you might want to [convert the store to an Observable or write a custom `observeStore` utility instead](https://github.com/reactjs/redux/issues/303#issuecomment-125184409). <ide>
1
Javascript
Javascript
add missing copyright headers
fd29448be028125ec1521ddc268314ac20ebc440
<ide><path>test/disabled/GH-670.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var assert = require('assert'); <ide> var https = require('https'); <ide> var tls = require('tls'); <ide><path>test/pummel/test-regress-GH-814.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> // Flags: --expose_gc <ide> <ide> function newBuffer(size, value) { <ide><path>test/pummel/test-regress-GH-814_2.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> // Flags: --expose_gc <ide> <ide> var common = require('../common'); <ide><path>test/pummel/test-timer-wrap.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/pummel/test-timer-wrap2.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/simple/test-child-process-customfd-bounded.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> <ide> var bigish = Array(200); <ide><path>test/simple/test-child-process-fork.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var assert = require('assert'); <ide> var common = require('../common'); <ide> var fork = require('child_process').fork; <ide><path>test/simple/test-child-process-fork2.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var assert = require('assert'); <ide> var common = require('../common'); <ide> var fork = require('child_process').fork; <ide><path>test/simple/test-event-emitter-check-listener-leaks.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var assert = require('assert'); <ide> var events = require('events'); <ide> <ide><path>test/simple/test-fs-utimes.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var util = require('util'); <ide><path>test/simple/test-http-response-readable.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var http = require('http'); <ide><path>test/simple/test-net-remote-address-port.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/simple/test-net-server-listen-remove-callback.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var net = require('net'); <ide><path>test/simple/test-process-next-tick.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var assert = require('assert'); <ide> var N = 2; <ide> var tickCount = 0; <ide><path>test/simple/test-punycode.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> // Copyright (C) 2011 by Ben Noordhuis <info@bnoordhuis.nl> <ide> // <ide> // Permission is hereby granted, free of charge, to any person obtaining a copy <ide><path>test/simple/test-readdouble.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * Tests to verify we're reading in doubles correctly <ide> */ <ide><path>test/simple/test-readfloat.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * Tests to verify we're reading in floats correctly <ide> */ <ide><path>test/simple/test-readint.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * Tests to verify we're reading in signed integers correctly <ide> */ <ide><path>test/simple/test-readuint.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * A battery of tests to help us read a series of uints <ide> */ <ide><path>test/simple/test-regress-GH-1697.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var net = require('net'), <ide> cp = require('child_process'), <ide> util = require('util'); <ide><path>test/simple/test-regress-GH-784.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> // Regression test for GH-784 <ide> // https://github.com/joyent/node/issues/784 <ide> // <ide><path>test/simple/test-regress-GH-819.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var net = require('net'); <ide> var assert = require('assert'); <ide><path>test/simple/test-regress-GH-877.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var http = require('http'); <ide> var assert = require('assert'); <ide><path>test/simple/test-regress-GH-897.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/simple/test-stream-pipe-multi.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> // Test that having a bunch of streams piping in parallel <ide> // doesn't break anything. <ide> <ide><path>test/simple/test-tcp-wrap-connect.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var TCP = process.binding('tcp_wrap').TCP; <ide><path>test/simple/test-tcp-wrap-listen.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/simple/test-tcp-wrap.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/simple/test-tty-wrap.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide><path>test/simple/test-vm-create-context-accessors.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var vm = require('vm'); <ide><path>test/simple/test-vm-create-context-circular-reference.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var vm = require('vm'); <ide><path>test/simple/test-writedouble.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * Tests to verify we're writing doubles correctly <ide> */ <ide><path>test/simple/test-writefloat.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * Tests to verify we're writing floats correctly <ide> */ <ide><path>test/simple/test-writeint.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * Tests to verify we're writing signed integers correctly <ide> */ <ide><path>test/simple/test-writeuint.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <ide> /* <ide> * A battery of tests to help us read a series of uints <ide> */ <ide><path>test/simple/test-zlib-random-byte-pipes.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> var crypto = require('crypto'); <ide> var stream = require('stream');
36
Ruby
Ruby
remove more warnings on variables
da8f9ca4329499fc9cc9c3f999a9d6eecdc801d3
<ide><path>actionpack/lib/action_dispatch/routing/url_for.rb <ide> def url_for(options = nil) <ide> <ide> protected <ide> def _with_routes(routes) <add> @_routes ||= nil <ide> old_routes, @_routes = @_routes, routes <ide> yield <ide> ensure
1
Python
Python
update variable names
97d2f7d31f88811d0714cb7089a2a30368f8786d
<ide><path>libcloud/common/dimensiondata.py <ide> class DimensionDataConnection(ConnectionUserAndKey): <ide> <ide> api_path_version_1 = '/oec' <ide> api_path_version_2 = '/caas' <del> api_version_1 = '0.9' <del> api_version_2 = '2.3' <add> api_version_1 = 0.9 <add> <add> # Earliest version supported <add> oldest_api_version = 2.2 <add> <add> # Latest version supported <add> latest_api_version = 2.3 <add> <add> # Default api version <add> active_api_version = 2.3 <ide> <ide> _orgId = None <ide> responseCls = DimensionDataResponse <ide> def __init__(self, user_id, key, secure=True, host=None, port=None, <ide> self.host = conn_kwargs['region']['host'] <ide> <ide> if api_version: <del> if api_version.startswith('2'): <del> self.api_version_2 = api_version <add> if float(api_version) < self.oldest_api_version: <add> msg = 'API Version specified is too old. No longer ' \ <add> 'supported. Please upgrade to the latest version {}' \ <add> .format(self.active_api_version) <add> <add> raise DimensionDataAPIException(code=None, <add> msg=msg, <add> driver=self.driver) <add> elif float(api_version) > self.latest_api_version: <add> msg = 'Unsupported API Version. The version specified is ' \ <add> 'not release yet. Please use the latest supported ' \ <add> 'version {}' \ <add> .format(self.active_api_version) <add> <add> raise DimensionDataAPIException(code=None, <add> msg=msg, <add> driver=self.driver) <add> <add> else: <add> # Overwrite default version using the version user specified <add> self.active_api_version = api_version <ide> <ide> def add_default_headers(self, headers): <ide> headers['Authorization'] = \ <ide> def request_api_1(self, action, params=None, data='', <ide> def request_api_2(self, path, action, params=None, data='', <ide> headers=None, method='GET'): <ide> action = "%s/%s/%s/%s" % (self.api_path_version_2, <del> self.api_version_2, path, action) <add> self.active_api_version, path, action) <ide> <ide> return super(DimensionDataConnection, self).request( <ide> action=action, <ide> def get_resource_path_api_2(self): <ide> resources that require a full path instead of just an ID, such as <ide> networks, and customer snapshots. <ide> """ <del> return ("%s/%s/%s" % (self.api_path_version_2, self.api_version_2, <add> return ("%s/%s/%s" % (self.api_path_version_2, self.active_api_version, <ide> self._get_orgId())) <ide> <ide> def wait_for_state(self, state, func, poll_interval=2, timeout=60, *args,
1
Text
Text
standardize action cable readme.md
eff98450ff17855439419db25976d2ecfe54dc04
<ide><path>actioncable/README.md <ide> cable.subscriptions.create 'AppearanceChannel', <ide> # normal channel code goes here... <ide> ``` <ide> <add>## Download and Installation <add> <add>The latest version of Action Cable can be installed with [RubyGems](#gem-usage), <add>or with [npm](#npm-usage). <add> <add>Source code can be downloaded as part of the Rails project on GitHub <add> <add>* https://github.com/rails/rails/tree/master/actioncable <add> <ide> ## License <ide> <ide> Action Cable is released under the MIT license:
1
Python
Python
defer translated string evaluation on validators.
607e4edca77441f057ce40cd90175b1b5700f316
<ide><path>rest_framework/compat.py <ide> import django <ide> from django.apps import apps <ide> from django.conf import settings <del>from django.core.exceptions import ImproperlyConfigured <add>from django.core.exceptions import ImproperlyConfigured, ValidationError <add>from django.core.validators import \ <add> MaxLengthValidator as DjangoMaxLengthValidator <add>from django.core.validators import MaxValueValidator as DjangoMaxValueValidator <add>from django.core.validators import \ <add> MinLengthValidator as DjangoMinLengthValidator <add>from django.core.validators import MinValueValidator as DjangoMinValueValidator <ide> from django.db import connection, models, transaction <ide> from django.template import Context, RequestContext, Template <ide> from django.utils import six <ide> from django.views.generic import View <ide> <del> <ide> try: <ide> from django.urls import ( <ide> NoReverseMatch, RegexURLPattern, RegexURLResolver, ResolverMatch, Resolver404, get_script_prefix, reverse, reverse_lazy, resolve <ide> def pygments_css(style): <ide> except ImportError: <ide> DecimalValidator = None <ide> <add>class CustomValidatorMessage(object): <add> """ <add> We need to avoid evaluation of `lazy` translated `message` in `django.core.validators.BaseValidator.__init__`. <add> https://github.com/django/django/blob/75ed5900321d170debef4ac452b8b3cf8a1c2384/django/core/validators.py#L297 <add> <add> Ref: https://github.com/encode/django-rest-framework/pull/5452 <add> """ <add> def __init__(self, *args, **kwargs): <add> self.message = kwargs.pop('message', self.message) <add> super(CustomValidatorMessage, self).__init__(*args, **kwargs) <add> <add>class MinValueValidator(CustomValidatorMessage, DjangoMinValueValidator): <add> pass <add> <add>class MaxValueValidator(CustomValidatorMessage, DjangoMaxValueValidator): <add> pass <add> <add>class MinLengthValidator(CustomValidatorMessage, DjangoMinLengthValidator): <add> pass <add> <add>class MaxLengthValidator(CustomValidatorMessage, DjangoMaxLengthValidator): <add> pass <ide> <ide> def set_rollback(): <ide> if hasattr(transaction, 'set_rollback'): <ide><path>rest_framework/fields.py <ide> from django.core.exceptions import ValidationError as DjangoValidationError <ide> from django.core.exceptions import ObjectDoesNotExist <ide> from django.core.validators import ( <del> EmailValidator, MaxLengthValidator, MaxValueValidator, MinLengthValidator, <del> MinValueValidator, RegexValidator, URLValidator, ip_address_validators <add> EmailValidator, RegexValidator, URLValidator, ip_address_validators <ide> ) <ide> from django.forms import FilePathField as DjangoFilePathField <ide> from django.forms import ImageField as DjangoImageField <ide> from django.utils.duration import duration_string <ide> from django.utils.encoding import is_protected_type, smart_text <ide> from django.utils.formats import localize_input, sanitize_separators <add>from django.utils.functional import lazy <ide> from django.utils.ipv6 import clean_ipv6_address <ide> from django.utils.timezone import utc <ide> from django.utils.translation import ugettext_lazy as _ <ide> <ide> from rest_framework import ISO_8601 <ide> from rest_framework.compat import ( <del> InvalidTimeError, get_remote_field, unicode_repr, unicode_to_repr, <del> value_from_object <add> InvalidTimeError, MaxLengthValidator, MaxValueValidator, <add> MinLengthValidator, MinValueValidator, get_remote_field, unicode_repr, <add> unicode_to_repr, value_from_object <ide> ) <ide> from rest_framework.exceptions import ErrorDetail, ValidationError <ide> from rest_framework.settings import api_settings <ide> def __init__(self, **kwargs): <ide> self.min_length = kwargs.pop('min_length', None) <ide> super(CharField, self).__init__(**kwargs) <ide> if self.max_length is not None: <del> message = self.error_messages['max_length'].format(max_length=self.max_length) <del> self.validators.append(MaxLengthValidator(self.max_length, message=message)) <add> message = lazy( <add> self.error_messages['max_length'].format, <add> six.text_type)(max_length=self.max_length) <add> self.validators.append( <add> MaxLengthValidator(self.max_length, message=message)) <ide> if self.min_length is not None: <del> message = self.error_messages['min_length'].format(min_length=self.min_length) <del> self.validators.append(MinLengthValidator(self.min_length, message=message)) <add> message = lazy( <add> self.error_messages['min_length'].format, <add> six.text_type)(min_length=self.min_length) <add> self.validators.append( <add> MinLengthValidator(self.min_length, message=message)) <ide> <ide> def run_validation(self, data=empty): <ide> # Test for the empty string here so that it does not get validated, <ide> def __init__(self, **kwargs): <ide> self.min_value = kwargs.pop('min_value', None) <ide> super(IntegerField, self).__init__(**kwargs) <ide> if self.max_value is not None: <del> message = self.error_messages['max_value'].format(max_value=self.max_value) <del> self.validators.append(MaxValueValidator(self.max_value, message=message)) <add> message = lazy( <add> self.error_messages['max_value'].format, <add> six.text_type)(max_value=self.max_value) <add> self.validators.append( <add> MaxValueValidator(self.max_value, message=message)) <ide> if self.min_value is not None: <del> message = self.error_messages['min_value'].format(min_value=self.min_value) <del> self.validators.append(MinValueValidator(self.min_value, message=message)) <add> message = lazy( <add> self.error_messages['min_value'].format, <add> six.text_type)(min_value=self.min_value) <add> self.validators.append( <add> MinValueValidator(self.min_value, message=message)) <ide> <ide> def to_internal_value(self, data): <ide> if isinstance(data, six.text_type) and len(data) > self.MAX_STRING_LENGTH: <ide> def __init__(self, **kwargs): <ide> self.min_value = kwargs.pop('min_value', None) <ide> super(FloatField, self).__init__(**kwargs) <ide> if self.max_value is not None: <del> message = self.error_messages['max_value'].format(max_value=self.max_value) <del> self.validators.append(MaxValueValidator(self.max_value, message=message)) <add> message = lazy( <add> self.error_messages['max_value'].format, <add> six.text_type)(max_value=self.max_value) <add> self.validators.append( <add> MaxValueValidator(self.max_value, message=message)) <ide> if self.min_value is not None: <del> message = self.error_messages['min_value'].format(min_value=self.min_value) <del> self.validators.append(MinValueValidator(self.min_value, message=message)) <add> message = lazy( <add> self.error_messages['min_value'].format, <add> six.text_type)(min_value=self.min_value) <add> self.validators.append( <add> MinValueValidator(self.min_value, message=message)) <ide> <ide> def to_internal_value(self, data): <ide> <ide> def __init__(self, max_digits, decimal_places, coerce_to_string=None, max_value= <ide> super(DecimalField, self).__init__(**kwargs) <ide> <ide> if self.max_value is not None: <del> message = self.error_messages['max_value'].format(max_value=self.max_value) <del> self.validators.append(MaxValueValidator(self.max_value, message=message)) <add> message = lazy( <add> self.error_messages['max_value'].format, <add> six.text_type)(max_value=self.max_value) <add> self.validators.append( <add> MaxValueValidator(self.max_value, message=message)) <ide> if self.min_value is not None: <del> message = self.error_messages['min_value'].format(min_value=self.min_value) <del> self.validators.append(MinValueValidator(self.min_value, message=message)) <add> message = lazy( <add> self.error_messages['min_value'].format, <add> six.text_type)(min_value=self.min_value) <add> self.validators.append( <add> MinValueValidator(self.min_value, message=message)) <ide> <ide> def to_internal_value(self, data): <ide> """ <ide> def __init__(self, model_field, **kwargs): <ide> max_length = kwargs.pop('max_length', None) <ide> super(ModelField, self).__init__(**kwargs) <ide> if max_length is not None: <del> message = self.error_messages['max_length'].format(max_length=max_length) <del> self.validators.append(MaxLengthValidator(max_length, message=message)) <add> message = lazy( <add> self.error_messages['max_length'].format, <add> six.text_type)(max_length=self.max_length) <add> self.validators.append( <add> MaxLengthValidator(self.max_length, message=message)) <ide> <ide> def to_internal_value(self, data): <ide> rel = get_remote_field(self.model_field, default=None)
2
Text
Text
move gdams to emeritus
72ccf9f53243874fac091726b02bc777a6b76b76
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Gerhard Stöbich** &lt;deb2001-github@yahoo.de&gt; (he/they) <ide> * [gabrielschulhof](https://github.com/gabrielschulhof) - <ide> **Gabriel Schulhof** &lt;gabrielschulhof@gmail.com&gt; <del>* [gdams](https://github.com/gdams) - <del>**George Adams** &lt;george.adams@microsoft.com&gt; (he/him) <ide> * [geek](https://github.com/geek) - <ide> **Wyatt Preul** &lt;wpreul@gmail.com&gt; <ide> * [gengjiawen](https://github.com/gengjiawen) - <ide> For information about the governance of the Node.js project, see <ide> **Alexander Makarenko** &lt;estliberitas@gmail.com&gt; <ide> * [firedfox](https://github.com/firedfox) - <ide> **Daniel Wang** &lt;wangyang0123@gmail.com&gt; <add>* [gdams](https://github.com/gdams) - <add>**George Adams** &lt;george.adams@microsoft.com&gt; (he/him) <ide> * [gibfahn](https://github.com/gibfahn) - <ide> **Gibson Fahnestock** &lt;gibfahn@gmail.com&gt; (he/him) <ide> * [glentiki](https://github.com/glentiki) -
1
Python
Python
correct an issue introduced in latest commit
d751c0521d1f486fa6d2c926184f2a2f34ccef54
<ide><path>glances/outputs/glances_curses.py <ide> def __display_left(self, stat_display): <ide> <ide> for p in self._left_sidebar: <ide> if ((hasattr(self.args, 'enable_' + p) or <del> hasattr(self.args, 'disable_' + p)) and s in stat_display): <add> hasattr(self.args, 'disable_' + p)) and p in stat_display): <ide> self.new_line() <ide> self.display_plugin(stat_display[p]) <ide>
1
Ruby
Ruby
use the index on hidden field
38426458d682ceca7b00c9794f5680767e1a2d7c
<ide><path>actionview/test/template/form_helper_test.rb <ide> def post.tag_ids; [1]; end <ide> expected = whole_form("/posts", "new_post", "new_post") do <ide> "<input checked='checked' id='post_1_tag_ids_1' name='post[1][tag_ids][]' type='checkbox' value='1' />" + <ide> "<label for='post_1_tag_ids_1'>Tag 1</label>" + <del> "<input name='post[tag_ids][]' type='hidden' value='' />" <add> "<input name='post[1][tag_ids][]' type='hidden' value='' />" <ide> end <ide> <ide> assert_dom_equal expected, output_buffer
1
Text
Text
use a single space between sentences
db52ae8b7f9bc458b3ab47369fc828e273efd0df
<ide><path>doc/api/buffer.md <ide> it allows injection of numbers where a naively written application that does not <ide> validate its input sufficiently might expect to always receive a string. <ide> Before Node.js 8.0.0, the 100 byte buffer might contain <ide> arbitrary pre-existing in-memory data, so may be used to expose in-memory <del>secrets to a remote attacker. Since Node.js 8.0.0, exposure of memory cannot <add>secrets to a remote attacker. Since Node.js 8.0.0, exposure of memory cannot <ide> occur because the data is zero-filled. However, other attacks are still <ide> possible, such as causing very large buffers to be allocated by the server, <ide> leading to performance degradation or crashing on memory exhaustion. <ide><path>doc/api/child_process.md <ide> changes: <ide> * `detached` {boolean} Prepare child to run independently of its parent <ide> process. Specific behavior depends on the platform, see <ide> [`options.detached`][]). <del> * `env` {Object} Environment key-value pairs. **Default:** `process.env`. <add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`. <ide> * `execPath` {string} Executable used to create the child process. <ide> * `execArgv` {string[]} List of string arguments passed to the executable. <ide> **Default:** `process.execArgv`. <ide> changes: <ide> * `stdio` {string|Array} Child's stdio configuration. `stderr` by default will <ide> be output to the parent process' stderr unless `stdio` is specified. <ide> **Default:** `'pipe'`. <del> * `env` {Object} Environment key-value pairs. **Default:** `process.env`. <add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`. <ide> * `uid` {number} Sets the user identity of the process (see setuid(2)). <ide> * `gid` {number} Sets the group identity of the process (see setgid(2)). <ide> * `timeout` {number} In milliseconds the maximum amount of time the process <ide> changes: <ide> * `argv0` {string} Explicitly set the value of `argv[0]` sent to the child <ide> process. This will be set to `command` if not specified. <ide> * `stdio` {string|Array} Child's stdio configuration. <del> * `env` {Object} Environment key-value pairs. **Default:** `process.env`. <add> * `env` {Object} Environment key-value pairs. **Default:** `process.env`. <ide> * `uid` {number} Sets the user identity of the process (see setuid(2)). <ide> * `gid` {number} Sets the group identity of the process (see setgid(2)). <ide> * `timeout` {number} In milliseconds the maximum amount of time the process <ide><path>doc/api/crypto.md <ide> added: v0.1.92 <ide> * `options` {Object} [`stream.Writable` options][] <ide> * Returns: {Sign} <ide> <del>Creates and returns a `Sign` object that uses the given `algorithm`. Use <add>Creates and returns a `Sign` object that uses the given `algorithm`. Use <ide> [`crypto.getHashes()`][] to obtain the names of the available digest algorithms. <ide> Optional `options` argument controls the `stream.Writable` behavior. <ide> <ide><path>doc/api/fs.md <ide> changes: <ide> * `err` {Error} <ide> <ide> Asynchronous symlink(2) which creates the link called `path` pointing to <del>`target`. No arguments other than a possible exception are given to the <add>`target`. No arguments other than a possible exception are given to the <ide> completion callback. <ide> <ide> The `type` argument is only available on Windows and ignored on other platforms. <ide> It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is <ide> not set, Node.js will autodetect `target` type and use `'file'` or `'dir'`. If <ide> the `target` does not exist, `'file'` will be used. Windows junction points <del>require the destination path to be absolute. When using `'junction'`, the <add>require the destination path to be absolute. When using `'junction'`, the <ide> `target` argument will automatically be normalized to absolute path. <ide> <ide> Relative targets are relative to the link’s parent directory. <ide> before and/or after the newly written data. <ide> For example, if `fs.writeFile()` is called twice in a row, first to write the <ide> string `'Hello'`, then to write the string `', World'`, the file would contain <ide> `'Hello, World'`, and might contain some of the file's original data (depending <del>on the size of the original file, and the position of the file descriptor). If <add>on the size of the original file, and the position of the file descriptor). If <ide> a file name had been used instead of a descriptor, the file would be guaranteed <ide> to contain only `', World'`. <ide> <ide><path>doc/api/modules.md <ide> require(X) from module at path Y <ide> 6. THROW "not found" <ide> <ide> LOAD_AS_FILE(X) <del>1. If X is a file, load X as its file extension format. STOP <del>2. If X.js is a file, load X.js as JavaScript text. STOP <del>3. If X.json is a file, parse X.json to a JavaScript Object. STOP <del>4. If X.node is a file, load X.node as binary addon. STOP <add>1. If X is a file, load X as its file extension format. STOP <add>2. If X.js is a file, load X.js as JavaScript text. STOP <add>3. If X.json is a file, parse X.json to a JavaScript Object. STOP <add>4. If X.node is a file, load X.node as binary addon. STOP <ide> <ide> LOAD_INDEX(X) <del>1. If X/index.js is a file, load X/index.js as JavaScript text. STOP <add>1. If X/index.js is a file, load X/index.js as JavaScript text. STOP <ide> 2. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP <del>3. If X/index.node is a file, load X/index.node as binary addon. STOP <add>3. If X/index.node is a file, load X/index.node as binary addon. STOP <ide> <ide> LOAD_AS_DIRECTORY(X) <ide> 1. If X/package.json is a file, <ide> LOAD_PACKAGE_EXPORTS(DIR, X) <ide> a. LOAD_AS_FILE(RESOLVED) <ide> b. LOAD_AS_DIRECTORY(RESOLVED) <ide> 12. Otherwise <del> a. If RESOLVED is a file, load it as its file extension format. STOP <add> a. If RESOLVED is a file, load it as its file extension format. STOP <ide> 13. Throw "not found" <ide> ``` <ide> <ide><path>doc/api/n-api.md <ide> typedef void (*napi_async_execute_callback)(napi_env env, void* data); <ide> <ide> Implementations of this function must avoid making N-API calls <ide> that execute JavaScript or interact with <del>JavaScript objects. N-API <add>JavaScript objects. N-API <ide> calls should be in the `napi_async_complete_callback` instead. <ide> Do not use the `napi_env` parameter as it will likely <ide> result in execution of JavaScript. <ide><path>doc/api/net.md <ide> added: v6.1.0 <ide> If `true`, <ide> [`socket.connect(options[, connectListener])`][`socket.connect(options)`] was <ide> called and has not yet finished. It will stay `true` until the socket becomes <del>connected, then it is set to `false` and the `'connect'` event is emitted. Note <add>connected, then it is set to `false` and the `'connect'` event is emitted. Note <ide> that the <ide> [`socket.connect(options[, connectListener])`][`socket.connect(options)`] <ide> callback is a listener for the `'connect'` event. <ide><path>doc/api/process.md <ide> environment variable. <ide> <ide> `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides <ide> `Set.prototype.has` to recognize several different possible flag <del>representations. `process.allowedNodeEnvironmentFlags.has()` will <add>representations. `process.allowedNodeEnvironmentFlags.has()` will <ide> return `true` in the following cases: <ide> <ide> * Flags may omit leading single (`-`) or double (`--`) dashes; e.g., <ide><path>doc/api/quic.md <ide> used to exhange application data until the `'secure'` event has been emitted. <ide> <ide> QUIC uses the TLS 1.3 [ALPN][] ("Application-Layer Protocol Negotiation") <ide> extension to identify the application level protocol that is using the QUIC <del>connection. Every `QuicSession` instance has an ALPN identifier that *must* be <add>connection. Every `QuicSession` instance has an ALPN identifier that *must* be <ide> specified in either the `connect()` or `listen()` options. ALPN identifiers that <ide> are known to Node.js (such as the ALPN identifier for HTTP/3) will alter how the <ide> `QuicSession` and `QuicStream` objects operate internally, but the QUIC <ide><path>doc/api/readline.md <ide> The current input data being processed by node. <ide> <ide> This can be used when collecting input from a TTY stream to retrieve the <ide> current value that has been processed thus far, prior to the `line` event <del>being emitted. Once the `line` event has been emitted, this property will <add>being emitted. Once the `line` event has been emitted, this property will <ide> be an empty string. <ide> <ide> Be aware that modifying the value during the instance runtime may have <ide> added: v0.1.98 <ide> The cursor position relative to `rl.line`. <ide> <ide> This will track where the current cursor lands in the input string, when <del>reading input from a TTY stream. The position of cursor determines the <add>reading input from a TTY stream. The position of cursor determines the <ide> portion of the input string that will be modified as input is processed, <ide> as well as the column where the terminal caret will be rendered. <ide> <ide> added: <ide> * `cols` {number} the screen column the cursor currently lands on <ide> <ide> Returns the real position of the cursor in relation to the input <del>prompt + string. Long input (wrapping) strings, as well as multiple <add>prompt + string. Long input (wrapping) strings, as well as multiple <ide> line prompts are included in the calculations. <ide> <ide> ## `readline.clearLine(stream, dir[, callback])` <ide><path>doc/api/stream.md <ide> changes: <ide> specified in the [`stream.write()`][stream-write] call) before passing <ide> them to [`stream._write()`][stream-_write]. Other types of data are not <ide> converted (i.e. `Buffer`s are not decoded into `string`s). Setting to <del> false will prevent `string`s from being converted. **Default:** `true`. <add> false will prevent `string`s from being converted. **Default:** `true`. <ide> * `defaultEncoding` {string} The default encoding that is used when no <ide> encoding is specified as an argument to [`stream.write()`][stream-write]. <ide> **Default:** `'utf8'`. <ide><path>doc/api/tls.md <ide> in [`tls.createServer()`][], [`tls.connect()`][], and when creating new <ide> <ide> The ciphers list can contain a mixture of TLSv1.3 cipher suite names, the ones <ide> that start with `'TLS_'`, and specifications for TLSv1.2 and below cipher <del>suites. The TLSv1.2 ciphers support a legacy specification format, consult <add>suites. The TLSv1.2 ciphers support a legacy specification format, consult <ide> the OpenSSL [cipher list format][] documentation for details, but those <del>specifications do *not* apply to TLSv1.3 ciphers. The TLSv1.3 suites can only <add>specifications do *not* apply to TLSv1.3 ciphers. The TLSv1.3 suites can only <ide> be enabled by including their full name in the cipher list. They cannot, for <ide> example, be enabled or disabled by using the legacy TLSv1.2 `'EECDH'` or <ide> `'!EECDH'` specification. <ide> On the client, the `session` can be provided to the `session` option of <ide> See [Session Resumption][] for more information. <ide> <ide> For TLSv1.2 and below, [`tls.TLSSocket.getSession()`][] can be called once <del>the handshake is complete. For TLSv1.3, only ticket-based resumption is allowed <add>the handshake is complete. For TLSv1.3, only ticket-based resumption is allowed <ide> by the protocol, multiple tickets are sent, and the tickets aren't sent until <ide> after the handshake completes. So it is necessary to wait for the <del>`'session'` event to get a resumable session. Applications <add>`'session'` event to get a resumable session. Applications <ide> should use the `'session'` event instead of `getSession()` to ensure <del>they will work for all TLS versions. Applications that only expect to <add>they will work for all TLS versions. Applications that only expect to <ide> get or use one session should listen for this event only once: <ide> <ide> ```js <ide> changes: <ide> [OpenSSL Options][]. <ide> * `secureProtocol` {string} Legacy mechanism to select the TLS protocol <ide> version to use, it does not support independent control of the minimum and <del> maximum version, and does not support limiting the protocol to TLSv1.3. Use <del> `minVersion` and `maxVersion` instead. The possible values are listed as <del> [SSL_METHODS][], use the function names as strings. For example, use <add> maximum version, and does not support limiting the protocol to TLSv1.3. Use <add> `minVersion` and `maxVersion` instead. The possible values are listed as <add> [SSL_METHODS][], use the function names as strings. For example, use <ide> `'TLSv1_1_method'` to force TLS version 1.1, or `'TLS_method'` to allow any <del> TLS protocol version up to TLSv1.3. It is not recommended to use TLS <add> TLS protocol version up to TLSv1.3. It is not recommended to use TLS <ide> versions less than 1.2, but it may be required for interoperability. <ide> **Default:** none, see `minVersion`. <ide> * `sessionIdContext` {string} Opaque identifier used by servers to ensure <ide> added: v11.4.0 <ide> [`tls.createSecureContext()`][]. It can be assigned any of the supported TLS <ide> protocol versions, `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. <ide> **Default:** `'TLSv1.3'`, unless changed using CLI options. Using <del> `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets <add> `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets <ide> the default to `'TLSv1.3'`. If multiple of the options are provided, the <ide> highest maximum is used. <ide> <ide><path>doc/api/util.md <ide> added: v10.0.0 <ide> * Returns: {boolean} <ide> <ide> Returns `true` if the value is an instance of one of the [`ArrayBuffer`][] <del>views, such as typed array objects or [`DataView`][]. Equivalent to <add>views, such as typed array objects or [`DataView`][]. Equivalent to <ide> [`ArrayBuffer.isView()`][]. <ide> <ide> ```js
13
Ruby
Ruby
expect xcode 7.0.1
00242964801a5030d8661ef42fae9a05101c9230
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def latest_version <ide> when "10.7" then "4.6.3" <ide> when "10.8" then "5.1.1" <ide> when "10.9" then "6.2" <del> when "10.10" then "6.4" <del> when "10.11" then "7.0" <add> when "10.10" then "7.0.1" <add> when "10.11" then "7.0.1" <ide> else <ide> # Default to newest known version of Xcode for unreleased OSX versions. <ide> if MacOS.version > "10.11" <del> "7.0" <add> "7.0.1" <ide> else <ide> raise "OS X '#{MacOS.version}' is invalid" <ide> end <ide> def installed? <ide> def latest_version <ide> case MacOS.version <ide> when "10.11" then "700.0.72" <del> when "10.10" then "602.0.53" <add> when "10.10" then "700.0.72" <ide> when "10.9" then "600.0.57" <ide> when "10.8" then "503.0.40" <ide> else
1
Ruby
Ruby
add benchmark inject code
7a59a3ee37966ad2378a3d96fbedde42506c5e00
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit <ide> ENV.activate_extensions! <ide> ENV.setup_build_environment <ide> <add> if ARGV.switch? "D" <add> FormulaAuditor.module_eval do <add> instance_methods.grep(/audit_/).map do |name| <add> method = instance_method(name) <add> define_method(name) do |*args, &block| <add> begin <add> time = Time.now <add> method.bind(self).(*args, &block) <add> ensure <add> $times[name] ||= 0 <add> $times[name] += Time.now - time <add> end <add> end <add> end <add> end <add> <add> $times = {} <add> at_exit { puts $times.sort_by{ |k, v| v }.map{ |k, v| "#{k}: #{v}" } } <add> end <add> <ide> ff = if ARGV.named.empty? <ide> Formula <ide> else
1
Javascript
Javascript
improve win compat of test-repl
03a119eb70eecde859dab544401bd0e769478e01
<ide><path>test/simple/test-repl.js <ide> common.globalCheck = false; <ide> var net = require('net'), <ide> repl = require('repl'), <ide> message = 'Read, Eval, Print Loop', <del> unix_socket_path = '/tmp/node-repl-sock', <ide> prompt_unix = 'node via Unix socket> ', <ide> prompt_tcp = 'node via TCP socket> ', <ide> prompt_multiline = '... ', <ide> server_tcp, server_unix, client_tcp, client_unix, timer; <ide> <add> <ide> // absolute path to test/fixtures/a.js <ide> var moduleFilename = require('path').join(common.fixturesDir, 'a'); <ide> <ide> function error_test() { <ide> function tcp_test() { <ide> server_tcp = net.createServer(function(socket) { <ide> assert.strictEqual(server_tcp, socket.server); <del> assert.strictEqual(server_tcp.type, 'tcp4'); <ide> <ide> socket.addListener('end', function() { <ide> socket.end(); <ide> function tcp_test() { <ide> function unix_test() { <ide> server_unix = net.createServer(function(socket) { <ide> assert.strictEqual(server_unix, socket.server); <del> assert.strictEqual(server_unix.type, 'unix'); <ide> <ide> socket.addListener('end', function() { <ide> socket.end(); <ide> function unix_test() { <ide> server_unix.addListener('listening', function() { <ide> var read_buffer = ''; <ide> <del> client_unix = net.createConnection(unix_socket_path); <add> client_unix = net.createConnection(common.PIPE); <ide> <ide> client_unix.addListener('connect', function() { <ide> assert.equal(true, client_unix.readable); <ide> function unix_test() { <ide> }); <ide> }); <ide> <del> server_unix.listen(unix_socket_path); <add> server_unix.listen(common.PIPE); <ide> } <ide> <ide> unix_test();
1
PHP
PHP
convert i18nshell to commands
be6bc9523423d28d1175ac6fa24cfbb2907c155d
<ide><path>src/Command/I18nCommand.php <add><?php <add>declare(strict_types=1); <add> <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 1.2.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Command; <add> <add>use Cake\Console\Arguments; <add>use Cake\Console\Command; <add>use Cake\Console\ConsoleIo; <add>use Cake\Console\ConsoleOptionParser; <add> <add>/** <add> * Command for interactive I18N management. <add> */ <add>class I18nCommand extends Command <add>{ <add> /** <add> * Execute interactive mode <add> * <add> * @param \Cake\Console\Arguments $args The command arguments. <add> * @param \Cake\Console\ConsoleIo $io The console io <add> * @return null|int The exit code or null for success <add> */ <add> public function execute(Arguments $args, ConsoleIo $io): ?int <add> { <add> $io->out('<info>I18n Shell</info>'); <add> $io->hr(); <add> $io->out('[E]xtract POT file from sources'); <add> $io->out('[I]nitialize a language from POT file'); <add> $io->out('[H]elp'); <add> $io->out('[Q]uit'); <add> <add> $choice = null; <add> while ($choice !== 'q') { <add> $choice = strtolower($io->askChoice('What would you like to do?', ['E', 'I', 'H', 'Q'])); <add> $code = null; <add> switch ($choice) { <add> case 'e': <add> $code = $this->executeCommand(I18nExtractCommand::class, [], $io); <add> break; <add> case 'i': <add> $code = $this->executeCommand(I18nInitCommand::class, [], $io); <add> break; <add> case 'h': <add> $io->out($this->getOptionParser()->help()); <add> break; <add> default: <add> $io->err( <add> 'You have made an invalid selection. ' . <add> 'Please choose a command to execute by entering E, I, H, or Q.' <add> ); <add> } <add> if ($code === static::CODE_ERROR) { <add> $this->abort(); <add> } <add> } <add> <add> return static::CODE_SUCCESS; <add> } <add> <add> /** <add> * Gets the option parser instance and configures it. <add> * <add> * @param \Cake\Console\ConsoleOptionParser $parser The parser to update <add> * @return \Cake\Console\ConsoleOptionParser <add> */ <add> public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser <add> { <add> $parser->setDescription( <add> 'I18n commands let you generate .pot files to power translations in your application.' <add> ); <add> <add> return $parser; <add> } <add>} <add><path>src/Command/I18nExtractCommand.php <del><path>src/Shell/Task/ExtractTask.php <ide> * @since 1.2.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Shell\Task; <add>namespace Cake\Command; <ide> <add>use Cake\Console\Arguments; <add>use Cake\Console\Command; <add>use Cake\Console\ConsoleIo; <ide> use Cake\Console\ConsoleOptionParser; <del>use Cake\Console\Shell; <ide> use Cake\Core\App; <ide> use Cake\Core\Exception\MissingPluginException; <ide> use Cake\Core\Plugin; <ide> /** <ide> * Language string extractor <ide> */ <del>class ExtractTask extends Shell <add>class I18nExtractCommand extends Command <ide> { <ide> /** <ide> * Paths to use when looking for strings <ide> class ExtractTask extends Shell <ide> */ <ide> protected $_exclude = []; <ide> <del> /** <del> * Holds the validation string domain to use for validation messages when extracting <del> * <del> * @var string <del> */ <del> protected $_validationDomain = 'default'; <del> <ide> /** <ide> * Holds whether this call should extract the CakePHP Lib messages <ide> * <ide> class ExtractTask extends Shell <ide> */ <ide> protected $_countMarkerError = 0; <ide> <del> /** <del> * No welcome message. <del> * <del> * @return void <del> */ <del> protected function _welcome(): void <del> { <del> } <del> <ide> /** <ide> * Method to interact with the User and get path selections. <ide> * <add> * @param \Cake\Console\ConsoleIo $io The io instance. <ide> * @return void <ide> */ <del> protected function _getPaths(): void <add> protected function _getPaths(ConsoleIo $io): void <ide> { <ide> $defaultPath = APP; <ide> while (true) { <ide> protected function _getPaths(): void <ide> "Current paths: %s\nWhat is the path you would like to extract?\n[Q]uit [D]one", <ide> implode(', ', $currentPaths) <ide> ); <del> $response = $this->in($message, null, $defaultPath); <add> $response = $io->ask($message, null, $defaultPath); <ide> if (strtoupper($response) === 'Q') { <ide> $this->err('Extract Aborted'); <del> $this->_stop(); <add> $this->abort(); <ide> <ide> return; <ide> } <ide> if (strtoupper($response) === 'D' && count($this->_paths)) { <del> $this->out(); <add> $io->out(); <ide> <ide> return; <ide> } <ide> if (strtoupper($response) === 'D') { <del> $this->warn('No directories selected. Please choose a directory.'); <add> $io->warning('No directories selected. Please choose a directory.'); <ide> } elseif (is_dir($response)) { <ide> $this->_paths[] = $response; <ide> $defaultPath = 'D'; <ide> } else { <del> $this->err('The directory path you supplied was not found. Please try again.'); <add> $io->err('The directory path you supplied was not found. Please try again.'); <ide> } <del> $this->out(); <add> $io->out(); <ide> } <ide> } <ide> <ide> /** <del> * Execution method always used for tasks <add> * Execute the command <ide> * <del> * @return void <del> * @psalm-suppress InvalidReturnType <add> * @param \Cake\Console\Arguments $args The command arguments. <add> * @param \Cake\Console\ConsoleIo $io The console io <add> * @return null|int The exit code or null for success <ide> */ <del> public function main(): void <add> public function execute(Arguments $args, ConsoleIo $io): ?int <ide> { <del> if (!empty($this->params['exclude'])) { <del> $this->_exclude = explode(',', $this->params['exclude']); <add> if ($args->getOption('exclude')) { <add> $this->_exclude = explode(',', $args->getOption('exclude')); <ide> } <del> if (!empty($this->params['files']) && !is_array($this->params['files'])) { <del> $this->_files = explode(',', $this->params['files']); <add> if ($args->getOption('files')) { <add> $this->_files = explode(',', $args->getOption('files')); <ide> } <del> if (!empty($this->params['paths'])) { <del> $this->_paths = explode(',', $this->params['paths']); <del> } elseif (!empty($this->params['plugin'])) { <del> $plugin = Inflector::camelize($this->params['plugin']); <add> if ($args->getOption('paths')) { <add> $this->_paths = explode(',', $args->getOption('paths')); <add> } elseif ($args->getOption('plugin')) { <add> $plugin = Inflector::camelize($args->getOption('plugin')); <ide> if (!Plugin::isLoaded($plugin)) { <ide> throw new MissingPluginException(['plugin' => $plugin]); <ide> } <ide> $this->_paths = [Plugin::classPath($plugin), Plugin::templatePath($plugin)]; <del> $this->params['plugin'] = $plugin; <ide> } else { <del> $this->_getPaths(); <add> $this->_getPaths($io); <ide> } <ide> <del> if (isset($this->params['extract-core'])) { <del> $this->_extractCore = !(strtolower((string)$this->params['extract-core']) === 'no'); <add> if ($args->hasOption('extract-core')) { <add> $this->_extractCore = !(strtolower((string)$args->getOption('extract-core')) === 'no'); <ide> } else { <del> $response = $this->in('Would you like to extract the messages from the CakePHP core?', ['y', 'n'], 'n'); <add> $response = $io->askChoice( <add> 'Would you like to extract the messages from the CakePHP core?', <add> ['y', 'n'], <add> 'n' <add> ); <ide> $this->_extractCore = strtolower((string)$response) === 'y'; <ide> } <ide> <del> if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) { <add> if ($args->hasOption('exclude-plugins') && $this->_isExtractingApp()) { <ide> $this->_exclude = array_merge($this->_exclude, App::path('Plugin')); <ide> } <ide> <del> if (!empty($this->params['validation-domain'])) { <del> $this->_validationDomain = $this->params['validation-domain']; <del> } <del> <ide> if ($this->_extractCore) { <ide> $this->_paths[] = CAKE; <ide> } <ide> <del> if (isset($this->params['output'])) { <del> $this->_output = $this->params['output']; <del> } elseif (isset($this->params['plugin'])) { <add> if ($args->hasOption('output')) { <add> $this->_output = $args->getOption('output'); <add> } elseif ($args->hasOption('plugin')) { <ide> $this->_output = $this->_paths[0] . 'Locale'; <ide> } else { <ide> $message = "What is the path you would like to output?\n[Q]uit"; <ide> while (true) { <del> $response = $this->in( <add> $response = $io->ask( <ide> $message, <ide> null, <ide> rtrim($this->_paths[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'Locale' <ide> ); <ide> if (strtoupper($response) === 'Q') { <del> $this->err('Extract Aborted'); <del> $this->_stop(); <add> $io->err('Extract Aborted'); <ide> <del> return; <add> return static::CODE_ERR0R; <ide> } <ide> if ($this->_isPathUsable($response)) { <ide> $this->_output = $response . DIRECTORY_SEPARATOR; <ide> break; <ide> } <ide> <del> $this->err(''); <del> $this->err( <add> $io->err(''); <add> $io->err( <ide> '<error>The directory path you supplied was ' . <ide> 'not found. Please try again.</error>' <ide> ); <del> $this->out(); <add> $io->err(''); <ide> } <ide> } <ide> <del> if (!empty($this->params['merge'])) { <del> $this->_merge = !(strtolower((string)$this->params['merge']) === 'no'); <add> if ($args->hasOption('merge')) { <add> $this->_merge = !(strtolower((string)$args->getOption('merge')) === 'no'); <ide> } else { <del> $this->out(); <del> $response = $this->in( <add> $io->out(); <add> $response = $io->askChoice( <ide> 'Would you like to merge all domain strings into the default.pot file?', <ide> ['y', 'n'], <ide> 'n' <ide> ); <ide> $this->_merge = strtolower((string)$response) === 'y'; <ide> } <ide> <del> $this->_markerError = (bool)$this->param('marker-error'); <del> $this->_relativePaths = (bool)$this->param('relative-paths'); <add> $this->_markerError = (bool)$args->getOption('marker-error'); <add> $this->_relativePaths = (bool)$args->getOption('relative-paths'); <ide> <ide> if (empty($this->_files)) { <ide> $this->_searchFiles(); <ide> } <ide> <ide> $this->_output = rtrim($this->_output, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; <ide> if (!$this->_isPathUsable($this->_output)) { <del> $this->err(sprintf('The output directory %s was not found or writable.', $this->_output)); <del> $this->_stop(); <add> $io->err(sprintf('The output directory %s was not found or writable.', $this->_output)); <ide> <del> return; <add> return static::CODE_ERROR; <ide> } <ide> <del> $this->_extract(); <add> $this->_extract($args, $io); <add> <add> return static::CODE_SUCCESS; <ide> } <ide> <ide> /** <ide> protected function _addTranslation(string $domain, string $msgid, array $details <ide> /** <ide> * Extract text <ide> * <add> * @param \Cake\Console\Arguments $args The Arguments instance <add> * @param \Cake\Console\ConsoleIo $io The io instance <ide> * @return void <ide> */ <del> protected function _extract(): void <add> protected function _extract(Arguments $args, ConsoleIo $io): void <ide> { <del> $this->out(); <del> $this->out(); <del> $this->out('Extracting...'); <del> $this->hr(); <del> $this->out('Paths:'); <add> $io->out(); <add> $io->out(); <add> $io->out('Extracting...'); <add> $io->hr(); <add> $io->out('Paths:'); <ide> foreach ($this->_paths as $path) { <del> $this->out(' ' . $path); <add> $io->out(' ' . $path); <ide> } <del> $this->out('Output Directory: ' . $this->_output); <del> $this->hr(); <del> $this->_extractTokens(); <del> $this->_buildFiles(); <del> $this->_writeFiles(); <add> $io->out('Output Directory: ' . $this->_output); <add> $io->hr(); <add> $this->_extractTokens($args, $io); <add> $this->_buildFiles($args); <add> $this->_writeFiles($args, $io); <ide> $this->_paths = $this->_files = $this->_storage = []; <ide> $this->_translations = $this->_tokens = []; <del> $this->out(); <add> $io->out(); <ide> if ($this->_countMarkerError) { <del> $this->err("{$this->_countMarkerError} marker error(s) detected."); <del> $this->err(" => Use the --marker-error option to display errors."); <add> $io->err("{$this->_countMarkerError} marker error(s) detected."); <add> $io->err(" => Use the --marker-error option to display errors."); <ide> } <ide> <del> $this->out('Done.'); <add> $io->out('Done.'); <ide> } <ide> <ide> /** <ide> * Gets the option parser instance and configures it. <ide> * <add> * @param \Cake\Console\ConsoleOptionParser $parser The parser to configure <ide> * @return \Cake\Console\ConsoleOptionParser <ide> */ <del> public function getOptionParser(): ConsoleOptionParser <add> public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser <ide> { <del> $parser = parent::getOptionParser(); <ide> $parser->setDescription( <del> 'CakePHP Language String Extraction:' <add> 'Extract i18n POT files from application source files. ' . <add> 'Source files are parsed and string literal format strings ' . <add> 'provided to the <info>__</info> family of functions are extracted.' <ide> )->addOption('app', [ <ide> 'help' => 'Directory where your application is located.', <ide> ])->addOption('paths', [ <del> 'help' => 'Comma separated list of paths.', <add> 'help' => 'Comma separated list of paths that are searched for source files.', <ide> ])->addOption('merge', [ <del> 'help' => 'Merge all domain strings into the default.po file.', <add> 'help' => 'Merge all domain strings into a single default.po file.', <add> 'default' => 'no', <ide> 'choices' => ['yes', 'no'], <ide> ])->addOption('relative-paths', [ <del> 'help' => 'Use relative paths in the .pot file', <add> 'help' => 'Use application relative paths in the .pot file.', <ide> 'boolean' => true, <ide> 'default' => false, <ide> ])->addOption('output', [ <ide> 'help' => 'Full path to output directory.', <ide> ])->addOption('files', [ <del> 'help' => 'Comma separated list of files.', <add> 'help' => 'Comma separated list of files to parse.', <ide> ])->addOption('exclude-plugins', [ <ide> 'boolean' => true, <ide> 'default' => true, <ide> 'help' => 'Ignores all files in plugins if this command is run inside from the same app directory.', <ide> ])->addOption('plugin', [ <ide> 'help' => 'Extracts tokens only from the plugin specified and ' <ide> . 'puts the result in the plugin\'s Locale directory.', <del> ])->addOption('ignore-model-validation', [ <del> 'boolean' => true, <del> 'default' => false, <del> 'help' => 'Ignores validation messages in the $validate property.' . <del> ' If this flag is not set and the command is run from the same app directory,' . <del> ' all messages in model validation rules will be extracted as tokens.', <del> ])->addOption('validation-domain', [ <del> 'help' => 'If set to a value, the localization domain to be used for model validation messages.', <ide> ])->addOption('exclude', [ <ide> 'help' => 'Comma separated list of directories to exclude.' . <ide> ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors', <ide> public function getOptionParser(): ConsoleOptionParser <ide> 'default' => false, <ide> 'help' => 'Always overwrite existing .pot files.', <ide> ])->addOption('extract-core', [ <del> 'help' => 'Extract messages from the CakePHP core libs.', <add> 'help' => 'Extract messages from the CakePHP core libraries.', <ide> 'choices' => ['yes', 'no'], <ide> ])->addOption('no-location', [ <ide> 'boolean' => true, <ide> public function getOptionParser(): ConsoleOptionParser <ide> /** <ide> * Extract tokens out of all files to be processed <ide> * <add> * @param \Cake\Console\Arguments $args The io instance <add> * @param \Cake\Console\ConsoleIo $io The io instance <ide> * @return void <ide> */ <del> protected function _extractTokens(): void <add> protected function _extractTokens(Arguments $args, ConsoleIo $io): void <ide> { <ide> /** @var \Cake\Shell\Helper\ProgressHelper $progress */ <del> $progress = $this->helper('progress'); <add> $progress = $io->helper('progress'); <ide> $progress->init(['total' => count($this->_files)]); <del> $isVerbose = $this->param('verbose'); <add> $isVerbose = $args->getOption('verbose'); <ide> <ide> $functions = [ <ide> '__' => ['singular'], <ide> protected function _extractTokens(): void <ide> foreach ($this->_files as $file) { <ide> $this->_file = $file; <ide> if ($isVerbose) { <del> $this->out(sprintf('Processing %s...', $file), 1, Shell::VERBOSE); <add> $io->verbose(sprintf('Processing %s...', $file)); <ide> } <ide> <ide> $code = file_get_contents($file); <ide> protected function _extractTokens(): void <ide> unset($allTokens); <ide> <ide> foreach ($functions as $functionName => $map) { <del> $this->_parse($functionName, $map); <add> $this->_parse($io, $functionName, $map); <ide> } <ide> } <ide> <ide> protected function _extractTokens(): void <ide> /** <ide> * Parse tokens <ide> * <add> * @param \Cake\Console\ConsoleIo $io The io instance <ide> * @param string $functionName Function name that indicates translatable string (e.g: '__') <ide> * @param array $map Array containing what variables it will find (e.g: domain, singular, plural) <ide> * @return void <ide> */ <del> protected function _parse(string $functionName, array $map): void <add> protected function _parse(ConsoleIo $io, string $functionName, array $map): void <ide> { <ide> $count = 0; <ide> $tokenCount = count($this->_tokens); <ide> protected function _parse(string $functionName, array $map): void <ide> } <ide> $this->_addTranslation($domain, $singular, $details); <ide> } else { <del> $this->_markerError($this->_file, $line, $functionName, $count); <add> $this->_markerError($io, $this->_file, $line, $functionName, $count); <ide> } <ide> } <ide> $count++; <ide> protected function _parse(string $functionName, array $map): void <ide> /** <ide> * Build the translate template file contents out of obtained strings <ide> * <add> * @param \Cake\Console\Arguments $args Console arguments <ide> * @return void <ide> */ <del> protected function _buildFiles(): void <add> protected function _buildFiles(Arguments $args): void <ide> { <ide> $paths = $this->_paths; <ide> $paths[] = realpath(APP) . DIRECTORY_SEPARATOR; <ide> protected function _buildFiles(): void <ide> $files = $details['references']; <ide> $header = ''; <ide> <del> if (!$this->param('no-location')) { <add> if (!$args->getOption('no-location')) { <ide> $occurrences = []; <ide> foreach ($files as $file => $lines) { <ide> $lines = array_unique($lines); <ide> protected function _store(string $domain, string $header, string $sentence): voi <ide> /** <ide> * Write the files that need to be stored <ide> * <add> * @param \Cake\Console\Arguments $args The command arguments. <add> * @param \Cake\Console\ConsoleIo $io The console io <ide> * @return void <ide> */ <del> protected function _writeFiles(): void <add> protected function _writeFiles(Arguments $args, ConsoleIo $io): void <ide> { <ide> $overwriteAll = false; <del> if (!empty($this->params['overwrite'])) { <add> if ($args->getOption('overwrite')) { <ide> $overwriteAll = true; <ide> } <ide> foreach ($this->_storage as $domain => $sentences) { <ide> protected function _writeFiles(): void <ide> && file_exists($this->_output . $filename) <ide> && strtoupper($response) !== 'Y' <ide> ) { <del> $this->out(); <del> $response = $this->in( <add> $io->out(); <add> $response = $this->askChoice( <ide> sprintf('Error: %s already exists in this location. Overwrite? [Y]es, [N]o, [A]ll', $filename), <ide> ['y', 'n', 'a'], <ide> 'y' <ide> ); <ide> if (strtoupper($response) === 'N') { <ide> $response = ''; <ide> while (!$response) { <del> $response = $this->in('What would you like to name this file?', null, 'new_' . $filename); <add> $response = $io->ask('What would you like to name this file?', null, 'new_' . $filename); <ide> $filename = $response; <ide> } <ide> } elseif (strtoupper($response) === 'A') { <ide> protected function _formatString(string $string): string <ide> /** <ide> * Indicate an invalid marker on a processed file <ide> * <add> * @param \Cake\Console\ConsoleIo $io The io instance. <ide> * @param string $file File where invalid marker resides <ide> * @param int $line Line number <ide> * @param string $marker Marker found <ide> * @param int $count Count <ide> * @return void <ide> */ <del> protected function _markerError(string $file, int $line, string $marker, int $count): void <add> protected function _markerError($io, string $file, int $line, string $marker, int $count): void <ide> { <ide> if (strpos($this->_file, CAKE_CORE_INCLUDE_PATH) === false) { <ide> $this->_countMarkerError++; <ide> protected function _markerError(string $file, int $line, string $marker, int $co <ide> return; <ide> } <ide> <del> $this->err(sprintf("Invalid marker content in %s:%s\n* %s(", $file, $line, $marker)); <add> $io->err(sprintf("Invalid marker content in %s:%s\n* %s(", $file, $line, $marker)); <ide> $count += 2; <ide> $tokenCount = count($this->_tokens); <ide> $parenthesis = 1; <ide> <ide> while ((($tokenCount - $count) > 0) && $parenthesis) { <ide> if (is_array($this->_tokens[$count])) { <del> $this->err($this->_tokens[$count][1], 0); <add> $io->err($this->_tokens[$count][1], 0); <ide> } else { <del> $this->err($this->_tokens[$count], 0); <add> $io->err($this->_tokens[$count], 0); <ide> if ($this->_tokens[$count] === '(') { <ide> $parenthesis++; <ide> } <ide> protected function _markerError(string $file, int $line, string $marker, int $co <ide> } <ide> $count++; <ide> } <del> $this->err("\n"); <add> $io->err("\n"); <ide> } <ide> <ide> /** <ide> protected function _searchFiles(): void <ide> } <ide> $pattern = '/' . implode('|', $exclude) . '/'; <ide> } <add> <ide> foreach ($this->_paths as $path) { <ide> $path = realpath($path) . DIRECTORY_SEPARATOR; <ide> $fs = new Filesystem(); <ide><path>src/Command/I18nInitCommand.php <add><?php <add>declare(strict_types=1); <add> <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 1.2.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Command; <add> <add>use Cake\Console\Arguments; <add>use Cake\Console\Command; <add>use Cake\Console\ConsoleIo; <add>use Cake\Console\ConsoleOptionParser; <add>use Cake\Core\App; <add>use Cake\Utility\Inflector; <add>use DirectoryIterator; <add> <add>/** <add> * Command for interactive I18N management. <add> */ <add>class I18nInitCommand extends Command <add>{ <add> /** <add> * Execute the command <add> * <add> * @param \Cake\Console\Arguments $args The command arguments. <add> * @param \Cake\Console\ConsoleIo $io The console io <add> * @return null|int The exit code or null for success <add> */ <add> public function execute(Arguments $args, ConsoleIo $io): ?int <add> { <add> $language = $args->getArgument('language'); <add> if (!$language) { <add> $language = $io->ask('Please specify language code, e.g. `en`, `eng`, `en_US` etc.'); <add> } <add> if (strlen($language) < 2) { <add> $io->err('Invalid language code. Valid is `en`, `eng`, `en_US` etc.'); <add> <add> return static::CODE_ERROR; <add> } <add> <add> $paths = App::path('Locale'); <add> if ($args->hasOption('plugin')) { <add> $plugin = Inflector::camelize($args->getOption('plugin')); <add> $paths = App::path('Locale', $plugin); <add> } <add> <add> $response = $io->ask('What folder?', null, rtrim($paths[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); <add> $sourceFolder = rtrim($response, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; <add> $targetFolder = $sourceFolder . $language . DIRECTORY_SEPARATOR; <add> if (!is_dir($targetFolder)) { <add> mkdir($targetFolder, 0775, true); <add> } <add> <add> $count = 0; <add> $iterator = new DirectoryIterator($sourceFolder); <add> foreach ($iterator as $fileinfo) { <add> if (!$fileinfo->isFile()) { <add> continue; <add> } <add> $filename = $fileinfo->getFilename(); <add> $newFilename = $fileinfo->getBasename('.pot'); <add> $newFilename .= '.po'; <add> <add> $io->createFile($targetFolder . $newFilename, file_get_contents($sourceFolder . $filename)); <add> $count++; <add> } <add> <add> $io->out('Generated ' . $count . ' PO files in ' . $targetFolder); <add> <add> return static::CODE_SUCCESS; <add> } <add> <add> /** <add> * Gets the option parser instance and configures it. <add> * <add> * @param \Cake\Console\ConsoleOptionParser $parser The parser to update <add> * @return \Cake\Console\ConsoleOptionParser <add> */ <add> public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser <add> { <add> $parser->setDescription('Initialize a language PO file from the POT file') <add> ->addOption('plugin', [ <add> 'help' => 'The plugin to create a PO file in.', <add> 'short' => 'p', <add> ]) <add> ->addArgument('language', [ <add> 'help' => 'Two-letter language code to create PO files for.', <add> ]); <add> <add> return $parser; <add> } <add>} <ide><path>src/Shell/I18nShell.php <del><?php <del>declare(strict_types=1); <del> <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 1.2.0 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Shell; <del> <del>use Cake\Console\ConsoleOptionParser; <del>use Cake\Console\Shell; <del>use Cake\Core\App; <del>use Cake\Utility\Inflector; <del>use DirectoryIterator; <del> <del>/** <del> * Shell for I18N management. <del> * <del> * @property \Cake\Shell\Task\ExtractTask $Extract <del> */ <del>class I18nShell extends Shell <del>{ <del> /** <del> * Contains tasks to load and instantiate <del> * <del> * @var array <del> */ <del> public $tasks = ['Extract']; <del> <del> /** <del> * @var string[] <del> */ <del> protected $_paths; <del> <del> /** <del> * Override main() for help message hook <del> * <del> * @return void <del> * @throws \InvalidArgumentException <del> * @throws \Cake\Core\Exception\MissingPluginException <del> * @throws \Cake\Console\Exception\StopException <del> * @psalm-suppress InvalidReturnType <del> */ <del> public function main(): void <del> { <del> $this->out('<info>I18n Shell</info>'); <del> $this->hr(); <del> $this->out('[E]xtract POT file from sources'); <del> $this->out('[I]nitialize a language from POT file'); <del> $this->out('[H]elp'); <del> $this->out('[Q]uit'); <del> <del> $choice = strtolower($this->in('What would you like to do?', ['E', 'I', 'H', 'Q'])); <del> switch ($choice) { <del> case 'e': <del> $this->Extract->main(); <del> break; <del> case 'i': <del> $this->init(); <del> break; <del> case 'h': <del> $this->out($this->OptionParser->help()); <del> break; <del> case 'q': <del> $this->_stop(); <del> <del> return; <del> default: <del> $this->out( <del> 'You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.' <del> ); <del> } <del> $this->hr(); <del> $this->main(); <del> } <del> <del> /** <del> * Inits PO file from POT file. <del> * <del> * @param string|null $language Language code to use. <del> * @return void <del> * @throws \Cake\Console\Exception\StopException <del> */ <del> public function init(?string $language = null): void <del> { <del> if (!$language) { <del> $language = $this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.'); <del> } <del> if (strlen($language) < 2) { <del> $this->abort('Invalid language code. Valid is `en`, `eng`, `en_US` etc.'); <del> } <del> <del> $this->_paths = App::path('Locale'); <del> if ($this->param('plugin')) { <del> $plugin = Inflector::camelize($this->param('plugin')); <del> $this->_paths = App::path('Locale', $plugin); <del> } <del> <del> $response = $this->in('What folder?', null, rtrim($this->_paths[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); <del> $sourceFolder = rtrim($response, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; <del> $targetFolder = $sourceFolder . $language . DIRECTORY_SEPARATOR; <del> if (!is_dir($targetFolder)) { <del> mkdir($targetFolder, 0775, true); <del> } <del> <del> $count = 0; <del> $iterator = new DirectoryIterator($sourceFolder); <del> foreach ($iterator as $fileinfo) { <del> if (!$fileinfo->isFile()) { <del> continue; <del> } <del> $filename = $fileinfo->getFilename(); <del> $newFilename = $fileinfo->getBasename('.pot'); <del> $newFilename .= '.po'; <del> <del> $this->createFile($targetFolder . $newFilename, file_get_contents($sourceFolder . $filename)); <del> $count++; <del> } <del> <del> $this->out('Generated ' . $count . ' PO files in ' . $targetFolder); <del> } <del> <del> /** <del> * Gets the option parser instance and configures it. <del> * <del> * @return \Cake\Console\ConsoleOptionParser <del> * @throws \Cake\Console\Exception\ConsoleException <del> */ <del> public function getOptionParser(): ConsoleOptionParser <del> { <del> $parser = parent::getOptionParser(); <del> $initParser = [ <del> 'options' => [ <del> 'plugin' => [ <del> 'help' => 'Plugin name.', <del> 'short' => 'p', <del> ], <del> 'force' => [ <del> 'help' => 'Force overwriting.', <del> 'short' => 'f', <del> 'boolean' => true, <del> ], <del> ], <del> 'arguments' => [ <del> 'language' => [ <del> 'help' => 'Two-letter language code.', <del> ], <del> ], <del> ]; <del> <del> $parser->setDescription( <del> 'I18n Shell generates .pot files(s) with translations.' <del> )->addSubcommand('extract', [ <del> 'help' => 'Extract the po translations from your application', <del> 'parser' => $this->Extract->getOptionParser(), <del> ]) <del> ->addSubcommand('init', [ <del> 'help' => 'Init PO language file from POT file', <del> 'parser' => $initParser, <del> ]); <del> <del> return $parser; <del> } <del>} <add><path>tests/TestCase/Command/I18nCommandTest.php <del><path>tests/TestCase/Shell/I18nShellTest.php <ide> * @since 3.0.8 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Test\TestCase\Shell; <add>namespace Cake\Test\TestCase\Command; <ide> <del>use Cake\Shell\I18nShell; <ide> use Cake\TestSuite\ConsoleIntegrationTestCase; <ide> <ide> /** <del> * I18nShell test. <add> * I18nCommand test. <ide> */ <del>class I18nShellTest extends ConsoleIntegrationTestCase <add>class I18nCommandTest extends ConsoleIntegrationTestCase <ide> { <ide> /** <ide> * setup method <ide> class I18nShellTest extends ConsoleIntegrationTestCase <ide> public function setUp(): void <ide> { <ide> parent::setUp(); <del> $this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock(); <del> $this->shell = new I18nShell($this->io); <ide> <ide> $this->localeDir = TMP . 'Locale' . DS; <add> $this->useCommandRunner(); <add> $this->setAppNamespace(); <ide> } <ide> <ide> /** <ide> public function testGetOptionParser() <ide> $this->exec('i18n -h'); <ide> <ide> $this->assertExitSuccess(); <del> $this->assertOutputContains('init'); <del> $this->assertOutputContains('extract'); <add> $this->assertOutputContains('cake i18n'); <ide> } <ide> <ide> /** <ide> public function testInteractiveHelp() <ide> $this->exec('i18n', ['h', 'q']); <ide> $this->assertExitSuccess(); <ide> $this->assertOutputContains('cake i18n'); <del> $this->assertOutputContains('init'); <ide> } <ide> <ide> /** <ide> public function testInteractiveInit() <ide> { <ide> $this->exec('i18n', [ <ide> 'i', <del> 'q', <add> 'x', <ide> ]); <ide> $this->assertExitError(); <ide> $this->assertErrorContains('Invalid language code'); <add><path>tests/TestCase/Command/I18nExtractCommandTest.php <del><path>tests/TestCase/Shell/Task/ExtractTaskTest.php <ide> * @since 1.2.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <del>namespace Cake\Test\TestCase\Shell\Task; <add>namespace Cake\Test\TestCase\Command; <ide> <add>use Cake\Core\Configure; <ide> use Cake\Filesystem\Folder; <ide> use Cake\TestSuite\ConsoleIntegrationTestCase; <ide> <ide> /** <del> * ExtractTaskTest class <add> * I18nExtractCommandTest <ide> * <del> * @property \Cake\Shell\Task\ExtractTask|MockObject $Task <del> * @property \Cake\Console\ConsoleIo|MockObject $io <del> * @property string $path <ide> */ <del>class ExtractTaskTest extends ConsoleIntegrationTestCase <add>class I18nExtractCommandTest extends ConsoleIntegrationTestCase <ide> { <ide> /** <ide> * setUp method <ide> class ExtractTaskTest extends ConsoleIntegrationTestCase <ide> public function setUp(): void <ide> { <ide> parent::setUp(); <add> $this->useCommandRunner(); <add> $this->setAppNamespace(); <add> <ide> $this->path = TMP . 'tests/extract_task_test'; <ide> new Folder($this->path . DS . 'locale', true); <ide> } <ide> public function setUp(): void <ide> public function tearDown(): void <ide> { <ide> parent::tearDown(); <del> unset($this->Task); <ide> <ide> $Folder = new Folder($this->path); <ide> $Folder->delete(); <ide> public function testExtractExcludePlugins() <ide> */ <ide> public function testExtractPlugin() <ide> { <del> static::setAppNamespace(); <del> $this->loadPlugins(['TestPlugin']); <add> Configure::write('Plugins.autoload', ['TestPlugin']); <ide> <ide> $this->exec( <ide> 'i18n extract ' . <ide> public function testExtractPlugin() <ide> */ <ide> public function testExtractVendoredPlugin() <ide> { <del> static::setAppNamespace(); <ide> $this->loadPlugins(['Company/TestPluginThree']); <ide> <ide> $this->exec( <ide> public function testExtractVendoredPlugin() <ide> */ <ide> public function testExtractOverwrite() <ide> { <del> static::setAppNamespace(); <del> <ide> file_put_contents($this->path . DS . 'default.pot', 'will be overwritten'); <ide> $this->assertFileExists($this->path . DS . 'default.pot'); <ide> $original = file_get_contents($this->path . DS . 'default.pot'); <ide> public function testExtractOverwrite() <ide> */ <ide> public function testExtractCore() <ide> { <del> static::setAppNamespace(); <ide> $this->exec( <ide> 'i18n extract ' . <ide> '--extract-core=yes ' .
6
Javascript
Javascript
add url type check in module options
edffad075e1dac0ebea7e70b05e4e49528fc59d2
<ide><path>test/parallel/test-vm-module-errors.js <ide> async function checkArgType() { <ide> }); <ide> <ide> for (const invalidOptions of [ <del> 0, 1, null, true, 'str', () => {}, Symbol.iterator <add> 0, 1, null, true, 'str', () => {}, { url: 0 }, Symbol.iterator <ide> ]) { <ide> common.expectsError(() => { <ide> new Module('', invalidOptions);
1
Python
Python
clean some trailing whitespace
781bcb674b80169773edd06ab7a2cde8683c93fd
<ide><path>test/test.py <ide> def do_GET(self): <ide> <ide> self.sendFile(path, ext) <ide> <del> def do_POST(self): <add> def do_POST(self): <ide> numBytes = int(self.headers['Content-Length']) <ide> <ide> self.send_response(200)
1
PHP
PHP
add page argument on paginate
53c6e48ed030f9c8a4d79579b9f411e937967581
<ide><path>src/Illuminate/Database/Query/Builder.php <ide> class Builder <ide> <ide> /** <ide> * The binding backups currently in use. <del> * <add> * <ide> * @var array <ide> */ <ide> protected $bindingBackups = []; <ide> protected function runSelect() <ide> * @param int $perPage <ide> * @param array $columns <ide> * @param string $pageName <add> * @param int|null $page <ide> * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator <ide> */ <del> public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page') <add> public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) <ide> { <del> $page = Paginator::resolveCurrentPage($pageName); <del> <ide> $total = $this->getCountForPagination($columns); <ide> <del> $results = $this->forPage($page, $perPage)->get($columns); <add> $this->forPage( <add> $page = $page ?: Paginator::resolveCurrentPage($pageName), <add> $perPage <add> ); <ide> <del> return new LengthAwarePaginator($results, $total, $perPage, $page, [ <add> return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, [ <ide> 'path' => Paginator::resolveCurrentPath(), <ide> 'pageName' => $pageName, <ide> ]);
1
PHP
PHP
apply suggestions from code review
f1c4877b4d717dfee30d3df301083cc516c4214e
<ide><path>src/View/Widget/BasicWidget.php <ide> public function render(array $data, ContextInterface $context): string <ide> $data['value'] = $data['val']; <ide> unset($data['val']); <ide> if ($data['value'] === false) { <add> // explicitly convert to 0 to avoid empty string which is marshaled as null <ide> $data['value'] = '0'; <ide> } <ide>
1
Text
Text
add references to usingimmutablejs, fix typos
172b8b56ab1421b7912e7e4a9846f512336e6645
<ide><path>docs/faq/ImmutableData.md <ide> - [Why does a selector mutating and returning a persistent object to `mapStateToProps` prevent React-Redux from re-rendering a wrapped component?](#shallow-checking-stops-component-re-rendering) <ide> - [How does immutability enable a shallow check to detect object mutations?](#immutability-enables-shallow-checking) <ide> - [How can immutability in your reducers cause components to render unnecessarily?](#immutability-issues-with-redux) <del>- [What issues can immutability cause with React-Redux?](#immutability-issues-with-react-redux) <add>- [How can immutability in mapStateToProps cause components to render unnecessarily?](#immutability-issues-with-react-redux) <ide> - [Do I have to use Immutable.JS?](#do-i-have-to-use-immutable-js) <ide> - [What are the issues with using JavaScript for immutable operations?](#issues-with-es6-for-immutable-ops) <ide> <ide> a.visibleToDos === b.visibleToDos; <ide> <ide> Note that, conversely, if the values in your props object refer to mutable objects, [your component may not render when it should](#shallow-checking-stops-component-re-rendering). <ide> <del>### Further Information <add>#### Further Information <ide> <ide> **Articles** <ide> - [React.js pure render performance anti-pattern](https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f#.b8bpx1ncj) <ide> You do not need to use Immutable.JS with Redux. Plain JavaScript, if written cor <ide> <ide> However, guaranteeing immutability with JavaScript is difficult, and it can be easy to mutate an object accidentally, causing bugs in your app that are extremely difficult to locate. For this reason, using an immutable update utility library such as Immutable.JS can significantly improve the reliability of your app, and make your app’s development much easier. <ide> <del>### Further Information <add>#### Further Information <ide> <ide> **Discussions** <ide> - [#1185: Question: Should I use immutable data structures?](https://github.com/reactjs/redux/issues/1422) <ide><path>docs/recipes/UsingImmutableJS.md <ide> - [Why should I choose Immutable.JS as an immutable library?](#why-choose-immutable-js) <ide> - [What are the issues with using Immutable.JS?](#issues-with-immutable-js) <ide> - [Is Immutable.JS worth the effort?](#is-immutable-js-worth-effort) <del>- [What are the Recommended Best Practices for using Immutable.JS with Redux?](#immutable-js-best-practices) <add>- [What are some opinionated Best Practices for using Immutable.JS with Redux?](#immutable-js-best-practices) <ide> <ide> <a id="why-use-immutable-library"></a> <ide> ## Why should I use an immutable-focused library such as Immutable.JS? <ide> Whether you choose to use such a library, or stick with plain JavaScript, depend <ide> <ide> Whichever option you choose, make sure you’re familiar with the concepts of [immutability, side effects and mutation](http://redux.js.org/docs/recipes/reducers/PrerequisiteConcepts.html#note-on-immutability-side-effects-and-mutation). In particular, ensure you have a deep understanding of what JavaScript does when updating and copying values in order to guard against accidental mutations that will degrade you app’s performance, or break it altogether. <ide> <add>#### Further Information <add> <ide> **Documentation** <del>- [immutability, side effects and mutation](http://redux.js.org/docs/recipes/reducers/PrerequisiteConcepts.html#note-on-immutability-side-effects-and-mutation) <add>- [Recipes: immutability, side effects and mutation](http://redux.js.org/docs/recipes/reducers/PrerequisiteConcepts.html#note-on-immutability-side-effects-and-mutation) <add> <add>**Articles** <add>- [Introduction to Immutable.js and Functional Programming Concepts](https://auth0.com/blog/intro-to-immutable-js/) <add>- [Pros and Cons of using immutability with React.js](http://reactkungfu.com/2015/08/pros-and-cons-of-using-immutability-with-react-js/) <ide> <ide> <ide> <a id="why-choose-immutable-js"></a> <ide> Immutable.JS avoids this by [cleverly sharing data structures](https://medium.co <ide> <ide> You never see this, of course - the data you give to an Immutable.JS object is never mutated. Rather, it’s the *intermediate* data generated within Immutable.JS from a chained sequence of method calls that is free to be mutated. You therefore get all the benefits of immutable data structures with none (or very little) of the potential performance hits. <ide> <add>#### Further Information <add> <add>**Articles** <add>- [Immutable.js, persistent data structures and structural sharing](https://medium.com/@dtinth/immutable-js-persistent-data-structures-and-structural-sharing-6d163fbd73d2#.6nwctunlc) <add>- [PDF: JavaScript Immutability - Don’t go changing](https://www.jfokus.se/jfokus16/preso/JavaScript-Immutability--Dont-Go-Changing.pdf) <add> <add>**Libraries** <add>- [Immutable.js, persistent data structures and structural sharing](https://facebook.github.io/immutable-js/) <add> <ide> <ide> <a id="issues-with-immutable-js"></a> <ide> ## What are the issues with using Immutable.JS? <ide> When the shallow check fails, React-Redux will cause the component to re-render. <ide> <ide> This can be prevented by using `toJS()` in a Higher Order Component, as discussed in the [Best Practices section](#immutable-js-best-practices) below. <ide> <add>#### Further Information <add> <add>**Articles** <add>- [Immutable.js, persistent data structures and structural sharing](https://medium.com/@dtinth/immutable-js-persistent-data-structures-and-structural-sharing-6d163fbd73d2#.hzgz7ghbe) <add>- [Immutable Data Structures and JavaScript](http://jlongster.com/Using-Immutable-Data-Structures-in-JavaScript) <add>- [React.js pure render performance anti-pattern](https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f#.9ucv6hwk4) <add>- [Building Efficient UI with React and Redux](https://www.toptal.com/react/react-redux-and-immutablejs) <add> <add>**Chrome Extension** <add>- [Immutable Object Formatter](https://chrome.google.com/webstore/detail/immutablejs-object-format/hgldghadipiblonfkkicmgcbbijnpeog) <add> <ide> <ide> <a id="is-immutable-js-worth-effort"></a> <ide> ## Is Using Immutable.JS worth the effort? <ide> This problem is caused predominantly by returning a mutated state object from a <ide> <ide> This, together with its performance and rich API for data manipulation, is why Immutable.JS is worth the effort. <ide> <add>#### Further Information <add> <add>**Documentation** <add>- [Troubleshooting: Nothing happens when I dispatch an action](http://redux.js.org/docs/Troubleshooting.html#nothing-happens-when-i-dispatch-an-action) <add> <ide> <ide> <a id="immutable-js-best-practices"></a> <del>## What are the Recommended Best Practices for using Immutable.JS with Redux? <add>## What are some opinionated Best Practices for using Immutable.JS with Redux? <ide> <ide> Immutable.JS can provide significant reliability and performance improvements to your app, but it must be used correctly. If you choose to use Immutable.js (and remember, you are not required to, and there are other immutable libraries you can use), follow these opinionated best practices, and you’ll be able to get the most out of it, without tripping up on any of the issues it can potentially cause. <ide> <del>#### Never mix plain JavaScript objects with Immutable.JS <add>### Never mix plain JavaScript objects with Immutable.JS <ide> <ide> Never let a plain JavaScript object contain Immutable.JS properties. Equally, never let an Immutable.JS object contain a plain JavaScript object. <ide> <del>#### Make your entire Redux state tree an Immutable.js object <add>#### Further Information <add> <add>**Articles** <add>- [Immutable Data Structures and JavaScript](http://jlongster.com/Using-Immutable-Data-Structures-in-JavaScript) <add> <add> <add>### Make your entire Redux state tree an Immutable.js object <ide> <ide> For a Redux app, your entire state tree should be an Immutable.JS object, with no plain JavaScript objects used at all. <ide> <ide> const newState = state.setIn(['prop1’], fromJS(newObj)); // <-- newObj is now <ide> // Immutable.JS Map <ide> ``` <ide> <del>#### Use Immutable.JS everywhere except your dumb components <add>#### Further Information <add> <add>**Articles** <add>- [Immutable Data Structures and JavaScript](http://jlongster.com/Using-Immutable-Data-Structures-in-JavaScript) <add> <add>**Libraries** <add>- [redux-immutable](https://www.npmjs.com/package/redux-immutable) <add> <add> <add>### Use Immutable.JS everywhere except your dumb components <ide> <ide> Using Immutable.JS everywhere keeps your code performant. Use it in your smart components, your selectors, your sagas or thunks, action creators, and especially your reducers. <ide> <del>Do NOT, however, use Immutable.JS in your dumb components. <add>Do not, however, use Immutable.JS in your dumb components. <add> <add>#### Further Information <ide> <del>#### Limit your use of `toJS()` <add>**Articles** <add>- [Immutable Data Structures and JavaScript](http://jlongster.com/Using-Immutable-Data-Structures-in-JavaScript) <add>- [Smart and Dumb Components in React](http://jaketrent.com/post/smart-dumb-components-react/) <add> <add>### Limit your use of `toJS()` <ide> <ide> `toJS()` is an expensive function and negates the purpose of using Immutable.JS. Avoid its use. <ide> <del>#### Your selectors should return Immutable.JS objects <add>#### Further Information <add> <add>** Discussions** <add>- [Lee Byron on Twitter: “Perf tip for #immutablejs…”](https://twitter.com/leeb/status/746733697093668864) <add> <add>### Your selectors should return Immutable.JS objects <ide> <ide> Always. <ide> <del>#### Use Immutable.JS objects in your Smart Components <add>### Use Immutable.JS objects in your Smart Components <add> <add>Smart components that access the store via React Redux’s `connect` function must use the Immutable.JS values returned by your selectors. Make sure you avoid the potential issues this can cause with unnecessary component re-rendering. Memoize your selectors using a library such as reselect if necessary. <add> <add>#### Further Information <add> <add>**Documentation** <add>- [Recipes: Computing Derived Data](http://redux.js.org/docs/recipes/ComputingDerivedData.html) <add>- [FAQ: Immutable Data](/docs/faq/ImmutableData.html#immutability-issues-with-react-redux) <add>- [Reselect Documentation: How do I use Reselect with Immutable.js?](https://github.com/reactjs/reselect/#q-how-do-i-use-reselect-with-immutablejs) <add> <add>**Articles** <add>- [Redux Patterns and Anti-Patterns](https://tech.affirm.com/redux-patterns-and-anti-patterns-7d80ef3d53bc#.451p9ycfy) <ide> <del>Smart components that access the store via React Redux’s `connect` function must use the Immutable.JS values returned by your selectors. <add>**Libraries** <add>- [Reselect: Selector library for Redux](https://github.com/reactjs/reselect) <add> <add>### Never use `toJS()` in `mapStateToProps` <add> <add>Converting an Immutable.JS object to a JavaScript object using `toJS()` will return a new object every time. If you do this in `mapSateToProps`, you will cause the component to believe that the object has changed every time the state tree changes, and so trigger an unnecessary re-render. <add> <add>#### Further Information <add> <add>**Documentation** <add>- [FAQ: Immutable Data](http://localhost:4000/docs/faq/ImmutableData.html#how-can-immutability-in-mapstatetoprops-cause-components-to-render-unnecessarily) <ide> <del>#### Never use `toJS()` in `mapStateToProps` <add>### Never use Immutable.JS in your Dumb Components <ide> <del>Converting an Immutable.JS object to a JavaScript object using `toJS()` will return a new object every time. If you use do this in `mapSateToProps`, you will cause the component to believe that the object has changed every time the state tree changes, and so trigger an unnecessary re-render. <add>Your dumb components should be pure; that is, they should produce the same output given the same input, and have no external dependencies. If you pass such a component an Immutable.js object as a prop, you make it dependent upon Immutable.js to extract the prop’s value and otherwise manipulate it. <ide> <del>#### Never use Immutable.JS in your Dumb Components <add>Such a dependency renders the component impure, makes testing the component more difficult, and makes reusing and refactoring the component unnecessarily difficult. <ide> <del>Your dumb components should rely solely on JavaScript. Using Immutable.JS in your components adds an extra dependency and stops them from being portable. <add>#### Further Information <ide> <del>#### Use a Higher Order Component to convert your Smart Component’s Immutable.JS props to your Dumb Component’s JavaScript props <add>**Articles** <add>- [Immutable Data Structures and JavaScript](http://jlongster.com/Using-Immutable-Data-Structures-in-JavaScript) <add>- [Smart and Dumb Components in React](http://jaketrent.com/post/smart-dumb-components-react/) <add>- [Tips For a Better Redux Architecture: Lessons for Enterprise Scale](https://hashnode.com/post/tips-for-a-better-redux-architecture-lessons-for-enterprise-scale-civrlqhuy0keqc6539boivk2f) <ide> <del>Something needs to map the Immutable.JS props in your Smart Component to the pure JavaScript props used in your Dumb Component. That something is a Higher Order Component (HOC) that simply takes the Immutable.JS props from your Smart Component, and converts them using `toJS()` to plain JavaScript props, which are then passed to your Dumb Compnent. <add>### Use a Higher Order Component to convert your Smart Component’s Immutable.JS props to your Dumb Component’s JavaScript props <add> <add>Something needs to map the Immutable.JS props in your Smart Component to the pure JavaScript props used in your Dumb Component. That something is a Higher Order Component (HOC) that simply takes the Immutable.JS props from your Smart Component, and converts them using `toJS()` to plain JavaScript props, which are then passed to your Dumb Component. <ide> <ide> Here is an example of such a HOC: <ide> <ide> export default connect(mapStateToProps)(toJS(DumbComponent)); <ide> ``` <ide> By converting Immutable.JS objects to plain JavaScript values within a HOC, we achieve Dumb Component portability, but without the performance hits of using `toJS()` in the Smart Component. <ide> <del>#### Use the Immutable Object Formatter Chrome Extension to Aid Debugging <add>_Note: if your app requires high performance, you may need to avoid `toJS()` altogether, and so will have to use Immutable.js in your dumb components. However, for most apps this will not be the case, and the benefits of keeping Immutable.js out of your dumb components (maintainability, portability and easier testing) will far outweigh any perceived performance improvements of keeping it in._ <add> <add>_In addition, using `toJS` in a Higher Order Component should not cause much, if any, performance degradation, as the component will only be called when the connected component’s props change. As with any performance issue, conduct performance checks first before deciding what to optimise._ <add> <add>#### Further Information <add> <add>**Documentation** <add>- [React: Higher-Order Components](https://facebook.github.io/react/docs/higher-order-components.html) <add> <add>**Articles** <add>- [React Higher Order Components in depth](https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e#.dw2qd1o1g) <add> <add>**Discussions** <add>- [Reddit: acemarke and cpsubrian comments on Dan Abramov: Redux is not an architecture or design pattern, it is just a library.](https://www.reddit.com/r/javascript/comments/4rcqpx/dan_abramov_redux_is_not_an_architecture_or/d5rw0p9/?context=3) <add> <add>**Gists** <add>- [cpsubrian: React decorators for redux/react-router/immutable ‘smart’ components](https://gist.github.com/cpsubrian/79e97b6116ab68bd189eb4917203242c#file-tojs-js) <add> <add>### Use the Immutable Object Formatter Chrome Extension to Aid Debugging <ide> <ide> Install the [Immutable Object Formatter](https://chrome.google.com/webstore/detail/immutablejs-object-format/hgldghadipiblonfkkicmgcbbijnpeog) , and inspect your Immutable.JS data without seeing the noise of Immutable.JS's own object properties. <ide> <add>#### Further Information <add> <add>**Chrome Extension** <add>- [Immutable Object Formatter](https://chrome.google.com/webstore/detail/immutablejs-object-format/hgldghadipiblonfkkicmgcbbijnpeog)
2
Ruby
Ruby
cache the query regexp
4648aa54c03845c0a3f4e00cba4879ee26ba91c7
<ide><path>Library/Homebrew/cmd/search.rb <ide> def search <ide> exec_browser "http://packages.ubuntu.com/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all" <ide> elsif ARGV.include? '--desc' <ide> query = ARGV.next <add> rx = query_regexp(query) <ide> Formula.each do |formula| <del> if formula.desc =~ query_regexp(query) <add> if formula.desc =~ rx <ide> puts "#{formula.full_name}: #{formula.desc}" <ide> end <ide> end
1
Python
Python
fix import of optimizer
19a2b9bf27f768a2c3f8c8033b1679e950b493a6
<ide><path>spacy/compat.py <ide> cupy = None <ide> <ide> try: <del> from thinc.optimizers import Optimizer <add> from thinc.neural.optimizers import Optimizer <ide> except ImportError: <del> from thinc.optimizers import Adam as Optimizer <add> from thinc.neural.optimizers import Adam as Optimizer <ide> <ide> pickle = pickle <ide> copy_reg = copy_reg
1
Python
Python
change version to -beta1
5ddd0e2074f9fac455e73d4ce430c90432251cbe
<ide><path>libcloud/__init__.py <ide> """ <ide> <ide> __all__ = ["__version__", "enable_debug"] <del>__version__ = '0.6.0-beta' <add>__version__ = '0.6.0-beta1' <ide> <ide> DEFAULT_LOG_PATH = '/tmp/libcloud_debug.log' <ide>
1
Text
Text
fix broken link in pull-requests.md
2caa1f54582902a4feae9a4c7a2e30c6718f7005
<ide><path>doc/guides/contributing/pull-requests.md <ide> you can take a look at the <ide> [guide for writing tests in Node.js]: ../writing-tests.md <ide> [https://ci.nodejs.org/]: https://ci.nodejs.org/ <ide> [IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 <del>[Onboarding guide]: ../onboarding.md <add>[Onboarding guide]: ../../onboarding.md
1
Ruby
Ruby
add test coverage for rake notes
b5472cf7f22cb6d06bfdb329b13b919998e4ad7b
<ide><path>railties/test/application/rake/notes_test.rb <ide> def teardown <ide> teardown_app <ide> end <ide> <del> test 'notes' do <add> test 'notes finds notes for certain file_types' do <add> <ide> app_file "app/views/home/index.html.erb", "<% # TODO: note in erb %>" <ide> app_file "app/views/home/index.html.haml", "-# TODO: note in haml" <ide> app_file "app/views/home/index.html.slim", "/ TODO: note in slim" <ide> def teardown <ide> end <ide> end <ide> <add> end <add> test 'notes finds notes in default directories' do <add> <add> app_file "app/controllers/some_controller.rb", "# TODO: note in app directory" <add> app_file "config/initializers/some_initializer.rb", "# TODO: note in config directory" <add> app_file "lib/some_file.rb", "# TODO: note in lib directory" <add> app_file "script/run_something.rb", "# TODO: note in script directory" <add> app_file "test/some_test.rb", 1000.times.map { "" }.join("\n") << "# TODO: note in test directory" <add> <add> boot_rails <add> <add> require 'rake' <add> require 'rdoc/task' <add> require 'rake/testtask' <add> <add> Rails.application.load_tasks <add> <add> Dir.chdir(app_path) do <add> output = `bundle exec rake notes` <add> lines = output.scan(/\[([0-9\s]+)\]/).flatten <add> <add> assert_match /note in app directory/, output <add> assert_match /note in config directory/, output <add> assert_match /note in lib directory/, output <add> assert_match /note in script directory/, output <add> assert_match /note in test directory/, output <add> <add> assert_equal 5, lines.size <add> <add> lines.each do |line_number| <add> assert_equal 4, line_number.size <add> end <add> end <add> <ide> end <ide> <ide> private
1
Go
Go
add minor vet fixes
26ce3f4c90058a2b2f23a2cb36492cfa7963494c
<ide><path>integration-cli/docker_cli_exec_test.go <ide> func (s *DockerSuite) TestInspectExecID(c *check.C) { <ide> // But we should still be able to query the execID <ide> sc, body, err := sockRequest("GET", "/exec/"+execID+"/json", nil) <ide> if sc != http.StatusOK { <del> c.Fatalf("received status != 200 OK: %s\n%s", sc, body) <add> c.Fatalf("received status != 200 OK: %d\n%s", sc, body) <ide> } <ide> } <ide> <ide><path>runconfig/exec_test.go <ide> package runconfig <ide> <ide> import ( <ide> "fmt" <del> flag "github.com/docker/docker/pkg/mflag" <ide> "io/ioutil" <ide> "testing" <add> <add> flag "github.com/docker/docker/pkg/mflag" <ide> ) <ide> <ide> type arguments struct { <ide> func compareExecConfig(config1 *ExecConfig, config2 *ExecConfig) bool { <ide> } <ide> if len(config1.Cmd) != len(config2.Cmd) { <ide> return false <del> } else { <del> for index, value := range config1.Cmd { <del> if value != config2.Cmd[index] { <del> return false <del> } <add> } <add> for index, value := range config1.Cmd { <add> if value != config2.Cmd[index] { <add> return false <ide> } <ide> } <ide> return true <ide><path>runconfig/hostconfig_test.go <ide> func TestDecodeHostConfig(t *testing.T) { <ide> } <ide> <ide> if c.Privileged != false { <del> t.Fatalf("Expected privileged false, found %s\n", c.Privileged) <add> t.Fatalf("Expected privileged false, found %v\n", c.Privileged) <ide> } <ide> <del> if len(c.Binds) != 1 { <del> t.Fatalf("Expected 1 bind, found %v\n", c.Binds) <add> if l := len(c.Binds); l != 1 { <add> t.Fatalf("Expected 1 bind, found %d\n", l) <ide> } <ide> <ide> if c.CapAdd.Len() != 1 && c.CapAdd.Slice()[0] != "NET_ADMIN" {
3
Javascript
Javascript
fix typo 'default' spelling
7085b2bcac4a15149e2a94cf058d13f323921fd6
<ide><path>src/ng/compile.js <ide> * <ide> * #### `template` <ide> * HTML markup that may: <del> * * Replace the contents of the directive's element (defualt). <add> * * Replace the contents of the directive's element (default). <ide> * * Replace the directive's element itself (if `replace` is true - DEPRECATED). <ide> * * Wrap the contents of the directive's element (if `transclude` is true). <ide> *
1
Python
Python
add type hints for gptneo pytorch
8f3ea7a1e1a85e80210b3d4423b674d9a61016ed
<ide><path>src/transformers/models/gpt_neo/modeling_gpt_neo.py <ide> <ide> <ide> import os <del>from typing import Tuple <add>from typing import Optional, Tuple, Union <ide> <ide> import torch <ide> import torch.utils.checkpoint <ide> def set_input_embeddings(self, new_embeddings): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> past_key_values=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> head_mask=None, <del> inputs_embeds=None, <del> use_cache=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> past_key_values: Optional[Tuple[torch.FloatTensor]] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> use_cache: Optional[bool] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseModelOutputWithPastAndCrossAttentions]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def prepare_inputs_for_generation(self, input_ids, past=None, **kwargs): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> past_key_values=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> use_cache=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> past_key_values: Optional[Tuple[torch.FloatTensor]] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> labels: Optional[torch.Tensor] = None, <add> use_cache: Optional[bool] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, CausalLMOutputWithCrossAttentions]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set <ide> def __init__(self, config): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> past_key_values=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> use_cache=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.Tensor] = None, <add> past_key_values: Optional[Tuple[torch.FloatTensor]] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.Tensor] = None, <add> position_ids: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> inputs_embeds: Optional[torch.Tensor] = None, <add> labels: Optional[torch.Tensor] = None, <add> use_cache: Optional[bool] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, SequenceClassifierOutputWithPast]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1
Javascript
Javascript
increase font test timeout for windows
34f737c47bd1764b81be4ebda5d93a7ee5ee1070
<ide><path>test/integration/font-optimization/test/index.test.js <ide> import { <ide> } from 'next-test-utils' <ide> import fs from 'fs-extra' <ide> <del>jest.setTimeout(1000 * 30) <add>jest.setTimeout(1000 * 60 * 2) <ide> <ide> const appDir = join(__dirname, '../') <ide> const nextConfig = join(appDir, 'next.config.js')
1
Ruby
Ruby
fix flash remaining after last flash deleted
3a102d052803f7f066e648454297301310d69906
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def process(action, http_method = 'GET', *args) <ide> <ide> if flash_value = @request.flash.to_session_value <ide> @request.session['flash'] = flash_value <add> else <add> @request.session.delete('flash') <ide> end <ide> <ide> @response <ide><path>actionpack/test/controller/test_case_test.rb <ide> def set_flash <ide> render :text => 'ignore me' <ide> end <ide> <add> def delete_flash <add> flash.delete("test") <add> render :text => 'ignore me' <add> end <add> <ide> def set_flash_now <ide> flash.now["test_now"] = ">#{flash["test_now"]}<" <ide> render :text => 'ignore me' <ide> def test_process_with_flash_now <ide> assert_equal '>value_now<', flash['test_now'] <ide> end <ide> <add> def test_process_delete_flash <add> process :set_flash <add> process :delete_flash <add> assert_empty flash <add> assert_empty session <add> end <add> <ide> def test_process_with_session <ide> process :set_session <ide> assert_equal 'A wonder', session['string'], "A value stored in the session should be available by string key"
2
PHP
PHP
reduce number of mocks used in hasmany tests
3d463bc6f0dd590ddcecf1477fa2cd5d33f0b1b2
<ide><path>tests/TestCase/ORM/Association/HasManyTest.php <ide> namespace Cake\Test\TestCase\ORM\Association; <ide> <ide> use Cake\Database\Expression\IdentifierExpression; <add>use Cake\Database\Expression\OrderByExpression; <ide> use Cake\Database\Expression\QueryExpression; <ide> use Cake\Database\Expression\TupleComparison; <ide> use Cake\Database\TypeMap; <add>use Cake\Datasource\ConnectionManager; <ide> use Cake\ORM\Association\HasMany; <ide> use Cake\ORM\Entity; <ide> use Cake\ORM\Query; <ide> */ <ide> class HasManyTest extends TestCase <ide> { <add> /** <add> * Fixtures <add> * <add> * @var array <add> */ <add> public $fixtures = ['core.comments', 'core.articles', 'core.authors']; <ide> <ide> /** <ide> * Set up <ide> public function setUp() <ide> ] <ide> ] <ide> ]); <add> $connection = ConnectionManager::get('test'); <ide> $this->article = $this->getMock( <ide> 'Cake\ORM\Table', <ide> ['find', 'deleteAll', 'delete'], <del> [['alias' => 'Articles', 'table' => 'articles']] <add> [['alias' => 'Articles', 'table' => 'articles', 'connection' => $connection]] <ide> ); <ide> $this->article->schema([ <ide> 'id' => ['type' => 'integer'], <ide> public function setUp() <ide> 'primary' => ['type' => 'primary', 'columns' => ['id']] <ide> ] <ide> ]); <add> <ide> $this->articlesTypeMap = new TypeMap([ <ide> 'Articles.id' => 'integer', <ide> 'id' => 'integer', <ide> public function testRequiresKeys() <ide> { <ide> $assoc = new HasMany('Test'); <ide> $this->assertTrue($assoc->requiresKeys()); <add> <ide> $assoc->strategy(HasMany::STRATEGY_SUBQUERY); <ide> $this->assertFalse($assoc->requiresKeys()); <add> <ide> $assoc->strategy(HasMany::STRATEGY_SELECT); <ide> $this->assertTrue($assoc->requiresKeys()); <ide> } <ide> public function testEagerLoader() <ide> 'strategy' => 'select' <ide> ]; <ide> $association = new HasMany('Articles', $config); <del> $keys = [1, 2, 3, 4]; <del> $query = $this->getMock('Cake\ORM\Query', ['all'], [null, null]); <del> $this->article->expects($this->once())->method('find')->with('all') <add> $query = $this->article->query(); <add> $this->article->method('find') <add> ->with('all') <ide> ->will($this->returnValue($query)); <del> $results = [ <del> ['id' => 1, 'title' => 'article 1', 'author_id' => 2], <del> ['id' => 2, 'title' => 'article 2', 'author_id' => 1] <del> ]; <del> $query->expects($this->once())->method('all') <del> ->will($this->returnValue($results)); <add> $keys = [1, 2, 3, 4]; <ide> <ide> $callable = $association->eagerLoader(compact('keys', 'query')); <del> $row = ['Authors__id' => 1, 'username' => 'author 1']; <add> $row = ['Authors__id' => 1]; <add> <ide> $result = $callable($row); <del> $row['Articles'] = [ <del> ['id' => 2, 'title' => 'article 2', 'author_id' => 1] <del> ]; <del> $this->assertEquals($row, $result); <add> $this->assertArrayHasKey('Articles', $result); <add> $this->assertEquals($row['Authors__id'], $result['Articles'][0]->author_id); <add> $this->assertEquals($row['Authors__id'], $result['Articles'][1]->author_id); <ide> <del> $row = ['Authors__id' => 2, 'username' => 'author 2']; <add> $row = ['Authors__id' => 2]; <ide> $result = $callable($row); <del> $row['Articles'] = [ <del> ['id' => 1, 'title' => 'article 1', 'author_id' => 2] <del> ]; <del> $this->assertEquals($row, $result); <add> $this->assertArrayNotHasKey('Articles', $result); <add> <add> $row = ['Authors__id' => 3]; <add> $result = $callable($row); <add> $this->assertArrayHasKey('Articles', $result); <add> $this->assertEquals($row['Authors__id'], $result['Articles'][0]->author_id); <add> <add> $row = ['Authors__id' => 4]; <add> $result = $callable($row); <add> $this->assertArrayNotHasKey('Articles', $result); <ide> } <ide> <ide> /** <ide> public function testEagerLoaderWithDefaults() <ide> $config = [ <ide> 'sourceTable' => $this->author, <ide> 'targetTable' => $this->article, <del> 'conditions' => ['Articles.is_active' => true], <add> 'conditions' => ['Articles.published' => 'Y'], <ide> 'sort' => ['id' => 'ASC'], <ide> 'strategy' => 'select' <ide> ]; <ide> $association = new HasMany('Articles', $config); <ide> $keys = [1, 2, 3, 4]; <del> $query = $this->getMock( <del> 'Cake\ORM\Query', <del> ['all', 'where', 'andWhere', 'order'], <del> [null, null] <del> ); <del> $this->article->expects($this->once())->method('find')->with('all') <del> ->will($this->returnValue($query)); <del> $results = [ <del> ['id' => 1, 'title' => 'article 1', 'author_id' => 2], <del> ['id' => 2, 'title' => 'article 2', 'author_id' => 1] <del> ]; <del> <del> $query->expects($this->once())->method('all') <del> ->will($this->returnValue($results)); <ide> <del> $query->expects($this->at(0))->method('where') <del> ->with(['Articles.is_active' => true]) <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->at(1))->method('where') <del> ->with([]) <del> ->will($this->returnSelf()); <add> $query = $this->article->query(); <add> $this->article->method('find') <add> ->with('all') <add> ->will($this->returnValue($query)); <ide> <del> $query->expects($this->once())->method('andWhere') <del> ->with(['Articles.author_id IN' => $keys]) <del> ->will($this->returnSelf()); <add> $association->eagerLoader(compact('keys', 'query')); <ide> <del> $query->expects($this->once())->method('order') <del> ->with(['id' => 'ASC']) <del> ->will($this->returnSelf()); <add> $expected = new QueryExpression( <add> ['Articles.published' => 'Y', 'Articles.author_id IN' => $keys], <add> $this->articlesTypeMap <add> ); <add> $this->assertEquals($expected, $query->clause('where')); <ide> <del> $association->eagerLoader(compact('keys', 'query')); <add> $expected = new OrderByExpression(['id' => 'ASC']); <add> $this->assertEquals($expected, $query->clause('order')); <ide> } <ide> <ide> /** <ide> public function testEagerLoaderWithOverrides() <ide> $config = [ <ide> 'sourceTable' => $this->author, <ide> 'targetTable' => $this->article, <del> 'conditions' => ['Articles.is_active' => true], <add> 'conditions' => ['Articles.published' => 'Y'], <ide> 'sort' => ['id' => 'ASC'], <ide> 'strategy' => 'select' <ide> ]; <add> $this->article->hasMany('Comments'); <add> <ide> $association = new HasMany('Articles', $config); <ide> $keys = [1, 2, 3, 4]; <del> $query = $this->getMock( <del> 'Cake\ORM\Query', <del> ['all', 'where', 'andWhere', 'order', 'select', 'contain'], <del> [null, null] <del> ); <del> $this->article->expects($this->once())->method('find')->with('all') <del> ->will($this->returnValue($query)); <del> $results = [ <del> ['id' => 1, 'title' => 'article 1', 'author_id' => 2], <del> ['id' => 2, 'title' => 'article 2', 'author_id' => 1] <del> ]; <del> <del> $query->expects($this->once())->method('all') <del> ->will($this->returnValue($results)); <del> <del> $query->expects($this->at(0))->method('where') <del> ->with(['Articles.is_active' => true]) <del> ->will($this->returnSelf()); <add> $query = $this->article->query(); <add> $query->addDefaultTypes($this->article->Comments->source()); <ide> <del> $query->expects($this->at(1))->method('where') <del> ->with(['Articles.id !=' => 3]) <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->once())->method('andWhere') <del> ->with(['Articles.author_id IN' => $keys]) <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->once())->method('order') <del> ->with(['title' => 'DESC']) <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->once())->method('select') <del> ->with([ <del> 'Articles__title' => 'Articles.title', <del> 'Articles__author_id' => 'Articles.author_id' <del> ]) <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->once())->method('contain') <del> ->with([ <del> 'Categories' => ['fields' => ['a', 'b']], <del> ]) <del> ->will($this->returnSelf()); <add> $this->article->method('find') <add> ->with('all') <add> ->will($this->returnValue($query)); <ide> <ide> $association->eagerLoader([ <ide> 'conditions' => ['Articles.id !=' => 3], <ide> 'sort' => ['title' => 'DESC'], <ide> 'fields' => ['title', 'author_id'], <del> 'contain' => ['Categories' => ['fields' => ['a', 'b']]], <add> 'contain' => ['Comments' => ['fields' => ['comment']]], <ide> 'keys' => $keys, <ide> 'query' => $query <ide> ]); <add> $expected = [ <add> 'Articles__title' => 'Articles.title', <add> 'Articles__author_id' => 'Articles.author_id' <add> ]; <add> $this->assertEquals($expected, $query->clause('select')); <add> <add> $expected = new QueryExpression([ <add> 'Articles.published' => 'Y', <add> 'Articles.id !=' => 3, <add> 'Articles.author_id IN' => $keys <add> ], <add> $query->typeMap() <add> ); <add> $this->assertEquals($expected, $query->clause('where')); <add> <add> $expected = new OrderByExpression(['title' => 'DESC']); <add> $this->assertEquals($expected, $query->clause('order')); <add> $this->assertArrayHasKey('Comments', $query->contain()); <ide> } <ide> <ide> /** <ide> public function testEagerLoaderFieldsException() <ide> ]; <ide> $association = new HasMany('Articles', $config); <ide> $keys = [1, 2, 3, 4]; <del> $query = $this->getMock( <del> 'Cake\ORM\Query', <del> ['all'], <del> [null, null] <del> ); <del> $this->article->expects($this->once())->method('find')->with('all') <add> $query = $this->article->query(); <add> $this->article->method('find') <add> ->with('all') <ide> ->will($this->returnValue($query)); <ide> <ide> $association->eagerLoader([ <ide> public function testEagerLoaderWithQueryBuilder() <ide> ]; <ide> $association = new HasMany('Articles', $config); <ide> $keys = [1, 2, 3, 4]; <del> $query = $this->getMock( <del> 'Cake\ORM\Query', <del> ['all', 'select', 'join', 'where'], <del> [null, null] <del> ); <del> $this->article->expects($this->once())->method('find')->with('all') <add> $query = $this->article->query(); <add> $this->article->method('find') <add> ->with('all') <ide> ->will($this->returnValue($query)); <del> $results = [ <del> ['id' => 1, 'title' => 'article 1', 'author_id' => 2], <del> ['id' => 2, 'title' => 'article 2', 'author_id' => 1] <del> ]; <del> <del> $query->expects($this->once())->method('all') <del> ->will($this->returnValue($results)); <del> <del> $query->expects($this->any())->method('select') <del> ->will($this->returnSelf()); <del> $query->expects($this->at(2))->method('select') <del> ->with(['a', 'b']) <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->at(3))->method('join') <del> ->with('foo') <del> ->will($this->returnSelf()); <del> <del> $query->expects($this->any())->method('where') <del> ->will($this->returnSelf()); <del> $query->expects($this->at(4))->method('where') <del> ->with(['a' => 1]) <del> ->will($this->returnSelf()); <ide> <ide> $queryBuilder = function ($query) { <del> return $query->select(['a', 'b'])->join('foo')->where(['a' => 1]); <add> return $query->select(['author_id'])->join('comments')->where(['Comments.id' => 1]); <ide> }; <del> <ide> $association->eagerLoader(compact('keys', 'query', 'queryBuilder')); <add> <add> $expected = [ <add> 'Articles__author_id' => 'Articles.author_id' <add> ]; <add> $this->assertEquals($expected, $query->clause('select')); <add> <add> $expected = [ <add> [ <add> 'type' => 'INNER', <add> 'alias' => null, <add> 'table' => 'comments', <add> 'conditions' => new QueryExpression([], $query->typeMap()), <add> ] <add> ]; <add> $this->assertEquals($expected, $query->clause('join')); <add> <add> $expected = new QueryExpression([ <add> 'Articles.author_id IN' => $keys, <add> 'Comments.id' => 1, <add> ], <add> $query->typeMap() <add> ); <add> $this->assertEquals($expected, $query->clause('where')); <ide> } <ide> <ide> /** <ide> public function testEagerLoaderMultipleKeys() <ide> $association = new HasMany('Articles', $config); <ide> $keys = [[1, 10], [2, 20], [3, 30], [4, 40]]; <ide> $query = $this->getMock('Cake\ORM\Query', ['all', 'andWhere'], [null, null]); <del> $this->article->expects($this->once())->method('find')->with('all') <add> $this->article->method('find') <add> ->with('all') <ide> ->will($this->returnValue($query)); <add> <ide> $results = [ <ide> ['id' => 1, 'title' => 'article 1', 'author_id' => 2, 'site_id' => 10], <ide> ['id' => 2, 'title' => 'article 2', 'author_id' => 1, 'site_id' => 20] <ide> ]; <del> $query->expects($this->once())->method('all') <add> $query->method('all') <ide> ->will($this->returnValue($results)); <ide> <ide> $tuple = new TupleComparison( <ide> public function testCascadeDelete() <ide> */ <ide> public function testCascadeDeleteCallbacks() <ide> { <add> $articles = TableRegistry::get('Articles'); <ide> $config = [ <ide> 'dependent' => true, <ide> 'sourceTable' => $this->author, <del> 'targetTable' => $this->article, <del> 'conditions' => ['Articles.is_active' => true], <add> 'targetTable' => $articles, <add> 'conditions' => ['Articles.published' => 'Y'], <ide> 'cascadeCallbacks' => true, <ide> ]; <ide> $association = new HasMany('Articles', $config); <ide> <del> $articleOne = new Entity(['id' => 2, 'title' => 'test']); <del> $articleTwo = new Entity(['id' => 3, 'title' => 'testing']); <del> $iterator = new \ArrayIterator([ <del> $articleOne, <del> $articleTwo <del> ]); <del> <del> $query = $this->getMock('\Cake\ORM\Query', [], [], '', false); <del> $query->expects($this->at(0)) <del> ->method('where') <del> ->with(['Articles.is_active' => true]) <del> ->will($this->returnSelf()); <del> $query->expects($this->at(1)) <del> ->method('where') <del> ->with(['author_id' => 1]) <del> ->will($this->returnSelf()); <del> $query->expects($this->any()) <del> ->method('getIterator') <del> ->will($this->returnValue($iterator)); <del> $query->expects($this->never()) <del> ->method('bufferResults'); <del> <del> $this->article->expects($this->once()) <del> ->method('find') <del> ->will($this->returnValue($query)); <add> $author = new Entity(['id' => 1, 'name' => 'mark']); <add> $this->assertTrue($association->cascadeDelete($author)); <ide> <del> $this->article->expects($this->at(1)) <del> ->method('delete') <del> ->with($articleOne, []); <del> $this->article->expects($this->at(2)) <del> ->method('delete') <del> ->with($articleTwo, []); <add> $query = $articles->query()->where(['author_id' => 1]); <add> $this->assertEquals(0, $query->count(), 'Cleared related rows'); <ide> <del> $entity = new Entity(['id' => 1, 'name' => 'mark']); <del> $this->assertTrue($association->cascadeDelete($entity)); <add> $query = $articles->query()->where(['author_id' => 3]); <add> $this->assertEquals(1, $query->count(), 'other records left behind'); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/ORM/Association/HasOneTest.php <ide> */ <ide> class HasOneTest extends TestCase <ide> { <del> <ide> /** <ide> * Set up <ide> *
2
PHP
PHP
fix incomplete assertion text
651d33216a125ea2bcfe462f4d52ad5f58baddf3
<ide><path>tests/TestCase/Database/Schema/MysqlSchemaTest.php <ide> public function testDescribeJson() <ide> $this->assertEquals( <ide> $expected, <ide> $result->column('data'), <del> 'Field definition does not match for' <add> 'Field definition does not match for data' <ide> ); <ide> } <ide>
1
PHP
PHP
fix import ordering
2d6ee1ec96737c4b6ab68e2c204c6930c0fbb066
<ide><path>tests/TestCase/Database/QueryTest.php <ide> */ <ide> namespace Cake\Test\TestCase\Database; <ide> <del>use Cake\Database\Expression\IdentifierExpression; <ide> use Cake\Database\ExpressionInterface; <add>use Cake\Database\Expression\IdentifierExpression; <ide> use Cake\Database\Query; <ide> use Cake\Database\StatementInterface; <ide> use Cake\Database\TypeMap;
1
Python
Python
fix typo in _iotools.py docstring
34698b64f90b985396f123f3659edc7a95d232ee
<ide><path>numpy/lib/_iotools.py <ide> def __call__(self, value): <ide> <ide> def upgrade(self, value): <ide> """ <del> Rind the best converter for a given string, and return the result. <add> Find the best converter for a given string, and return the result. <ide> <ide> The supplied string `value` is converted by testing different <ide> converters in order. First the `func` method of the
1
Python
Python
support bilstm_depth argument in ud-train
445b81ce3fd4658296fffaf6c8069a60d6d39c9d
<ide><path>spacy/cli/ud_train.py <ide> def initialize_pipeline(nlp, docs, golds, config, device): <ide> class Config(object): <ide> def __init__(self, vectors=None, max_doc_length=10, multitask_tag=False, <ide> multitask_sent=False, multitask_dep=False, multitask_vectors=None, <del> nr_epoch=30, min_batch_size=100, max_batch_size=1000, <add> bilstm_depth=0, nr_epoch=30, min_batch_size=100, max_batch_size=1000, <ide> batch_by_words=True, dropout=0.2, conv_depth=4, subword_features=True, <ide> vectors_dir=None): <ide> if vectors_dir is not None:
1
Go
Go
handle ip route showing mask-less ip addresses
2e72882216ce13169a578614202830a5b084bfb4
<ide><path>network.go <ide> func checkRouteOverlaps(dockerNetwork *net.IPNet) error { <ide> continue <ide> } <ide> if _, network, err := net.ParseCIDR(strings.Split(line, " ")[0]); err != nil { <del> return fmt.Errorf("Unexpected ip route output: %s (%s)", err, line) <add> // is this a mask-less IP address? <add> if ip := net.ParseIP(strings.Split(line, " ")[0]); ip == nil { <add> // fail only if it's neither a network nor a mask-less IP address <add> return fmt.Errorf("Unexpected ip route output: %s (%s)", err, line) <add> } <ide> } else if networkOverlaps(dockerNetwork, network) { <ide> return fmt.Errorf("Network %s is already routed: '%s'", dockerNetwork.String(), line) <ide> }
1
Ruby
Ruby
fix empty request inside helpers test
867e60f6c2f46c1cd23a5dd5b1c89caa559be113
<ide><path>actionview/lib/action_view/test_case.rb <ide> module Behavior <ide> include ActiveSupport::Testing::ConstantLookup <ide> <ide> delegate :lookup_context, to: :controller <del> attr_accessor :controller, :output_buffer, :rendered <add> attr_accessor :controller, :request, :output_buffer, :rendered <ide> <ide> module ClassMethods <ide> def tests(helper_class) <ide><path>actionview/test/template/test_case_test.rb <ide> class GeneralViewTest < ActionView::TestCase <ide> assert params.is_a? ActionController::Parameters <ide> end <ide> <add> test "exposes request" do <add> assert request.is_a? ActionDispatch::Request <add> end <add> <ide> test "exposes view as _view for backwards compatibility" do <ide> assert_same _view, view <ide> end
2
Ruby
Ruby
fix issues with writable? detection in brew doctor
bcde6432f3b7e42870ee4b3ee7a6eb06021c62e7
<ide><path>Library/Contributions/cmds/brew-unpack.rb <ide> def unpack <ide> unpack_dir.mkpath unless unpack_dir.exist? <ide> end <ide> <del> raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable? <add> raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real? <ide> <ide> formulae.each do |f| <ide> # Create a nice name for the stage folder. <ide><path>Library/Contributions/install_homebrew.rb <ide> def macos_version <ide> share/man/man5 share/man/man6 share/man/man7 share/man/man8 <ide> share/info share/doc share/aclocal ). <ide> map{ |d| "/usr/local/#{d}" }. <del> select{ |d| File.directory? d and not File.writable? d } <add> select{ |d| File.directory? d and not File.writable_real? d } <ide> chgrps = chmods.reject{ |d| File.stat(d).grpowned? } <ide> <ide> unless chmods.empty? <ide><path>Library/Homebrew/cmd/doctor.rb <ide> def __check_subdir_access base <ide> <ide> target.find do |d| <ide> next unless d.directory? <del> cant_read << d unless d.writable? <add> cant_read << d unless d.writable_real? <ide> end <ide> <ide> cant_read.sort! <ide> def __check_subdir_access base <ide> def check_access_usr_local <ide> return unless HOMEBREW_PREFIX.to_s == '/usr/local' <ide> <del> unless Pathname('/usr/local').writable? then <<-EOS.undent <add> unless Pathname('/usr/local').writable_real? then <<-EOS.undent <ide> The /usr/local directory is not writable. <ide> Even if this directory was writable when you installed Homebrew, other <ide> software may change permissions on this directory. Some versions of the <ide> def check_access_share_man <ide> <ide> def __check_folder_access base, msg <ide> folder = HOMEBREW_PREFIX+base <del> if folder.exist? and not folder.writable? <add> if folder.exist? and not folder.writable_real? <ide> <<-EOS.undent <ide> #{folder} isn't writable. <ide> This can happen if you "sudo make install" software that isn't managed <ide><path>Library/Homebrew/cmd/install.rb <ide> def check_ppc <ide> end <ide> <ide> def check_writable_install_location <del> raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable? <del> raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable? or HOMEBREW_PREFIX.to_s == '/usr/local' <add> raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable_real? <add> raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable_real? or HOMEBREW_PREFIX.to_s == '/usr/local' <ide> end <ide> <ide> def check_xcode <ide><path>Library/Homebrew/extend/pathname.rb <ide> def make_relative_symlink src <ide> To list all files that would be deleted: <ide> brew link -n formula_name <ide> EOS <del> elsif !dirname.writable? <add> elsif !dirname.writable_real? <ide> raise <<-EOS.undent <ide> Could not symlink file: #{src.expand_path} <ide> #{dirname} is not writable. You should change its permissions. <ide> def / that <ide> <ide> def ensure_writable <ide> saved_perms = nil <del> unless writable? <add> unless writable_real? <ide> saved_perms = stat.mode <ide> chmod 0644 <ide> end <ide><path>Library/Homebrew/global.rb <ide> def cache <ide> # we do this for historic reasons, however the cache *should* be the same <ide> # directory whichever user is used and whatever instance of brew is executed <ide> home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path <del> if home_cache.directory? and home_cache.writable? <add> if home_cache.directory? and home_cache.writable_real? <ide> home_cache <ide> else <ide> root_cache = Pathname.new("/Library/Caches/Homebrew")
6
PHP
PHP
add assertions for flash/session/cookies
99884e0f121074f883a4235fc82fc5e02fff4f54
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> class IntegrationTestCase extends TestCase { <ide> */ <ide> protected $_layoutName; <ide> <add>/** <add> * The session instance from the last request <add> * <add> * @var \Cake\Network\Session <add> */ <add> protected $_requestSession; <add> <ide> /** <ide> * Clear the state used for requests. <ide> * <ide> public function tearDown() { <ide> $this->_controller = null; <ide> $this->_viewName = null; <ide> $this->_layoutName = null; <add> $this->_requestSession = null; <ide> } <ide> <ide> /** <ide> protected function _sendRequest($url, $method, $data = null) { <ide> ); <ide> try { <ide> $dispatcher->dispatch($request, $response); <add> $this->_requestSession = $request->session(); <ide> $this->_response = $response; <ide> } catch (\PHPUnit_Exception $e) { <ide> throw $e; <ide> public function assertLayout($content, $message = '') { <ide> $this->assertContains($content, $this->_layoutName, $message); <ide> } <ide> <add>/** <add> * Fetch a view variable by name. <add> * <add> * If the view variable does not exist null will be returned. <add> * <add> * @param string $name The view variable to get. <add> * @return mixed The view variable if set. <add> */ <add> public function viewVariable($name) { <add> if (empty($this->_controller->viewVars)) { <add> $this->fail('There are no view variables, perhaps you need to run a request?'); <add> } <add> if (isset($this->_controller->viewVars[$name])) { <add> return $this->_controller->viewVars[$name]; <add> } <add> return null; <add> } <add> <add>/** <add> * Assert that a flash message was set. <add> * <add> * @param string $type The flash type to check. <add> * @param string $content The flash message content to check. <add> * @param string $key The flash namespace the message is in. <add> * @param string $message The failure message that will be appended to the generated message. <add> */ <add> public function assertFlash($type, $content, $key = 'flash', $message = '') { <add> if (empty($this->_requestSession)) { <add> $this->fail('There is no stored session data. Perhaps you need to run a request?'); <add> } <add> $key = "Flash.{$key}"; <add> if (!$this->_requestSession->check($key)) { <add> $this->fail("The {$key} key is not set in the session. " . $message); <add> } <add> $val = $this->_requestSession->read($key); <add> if (strpos($val['element'], $type) === false) { <add> $this->fail("The {$key} does not have a matching element/type of {$type}. " . $message); <add> } <add> $this->assertEquals($content, $val['message'], 'Flash message differs. ' . $message); <add> } <add> <add>/** <add> * Assert session contents <add> * <add> * @param string $expected The expected contents. <add> * @param string $path The session data path. Uses Hash::get() compatible notation <add> * @param string $message The failure message that will be appended to the generated message. <add> */ <add> public function assertSession($expected, $path, $message = '') { <add> if (empty($this->_requestSession)) { <add> $this->fail('There is no stored session data. Perhaps you need to run a request?'); <add> } <add> $result = $this->_requestSession->read($path); <add> $this->assertEquals($expected, $result, 'Session content differs. ' . $message); <add> } <add> <add>/** <add> * Assert cookie values <add> * <add> * @param string $expected The expected contents. <add> * @param string $name The cookie name. <add> * @param string $message The failure message that will be appended to the generated message. <add> */ <add> public function assertCookie($expected, $name, $message = '') { <add> if (empty($this->_response)) { <add> $this->fail('Not response set, cannot assert cookies.'); <add> } <add> $result = $this->_response->cookie($name); <add> $this->assertEquals($expected, $result['value'], 'Cookie data differs. ' . $message); <add> } <add> <ide> } <ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php <ide> public function testRequestSetsProperties() { <ide> <ide> $this->assertTemplate('index'); <ide> $this->assertLayout('default'); <add> $this->assertEquals('value', $this->viewVariable('test')); <add> } <add> <add>/** <add> * Test flash and cookie assertions <add> * <add> * @return void <add> */ <add> public function testFlashSessionAndCookieAsserts() { <add> $this->post('/posts/index'); <add> <add> $this->assertFlash('error', 'An error message'); <add> $this->assertSession('An error message', 'Flash.flash.message'); <add> $this->assertCookie(1, 'remember_me'); <ide> } <ide> <ide> /** <ide><path>tests/test_app/TestApp/Controller/PostsController.php <ide> class PostsController extends AppController { <ide> * @var array <ide> */ <ide> public $components = array( <add> 'Flash', <ide> 'RequestHandler', <ide> ); <ide> <ide> class PostsController extends AppController { <ide> * @return void <ide> */ <ide> public function index() { <add> $this->Flash->error('An error message'); <add> $this->response->cookie([ <add> 'name' => 'remember_me', <add> 'value' => 1 <add> ]); <ide> $this->set('test', 'value'); <ide> } <ide> }
3
PHP
PHP
add typehint to notinornull()
73172d81239c834a284fa75f7d5bcd829b117983
<ide><path>src/Database/Expression/QueryExpression.php <ide> public function notIn($field, $values, $type = null) <ide> * @param string|null $type the type name for $value as configured using the Type map. <ide> * @return $this <ide> */ <del> public function notInOrNull($field, $values, $type = null) <add> public function notInOrNull($field, $values, ?string $type = null) <ide> { <ide> $or = new static([], [], 'OR'); <ide> $or
1
Text
Text
fix probs in sections 5.6 and 5.9; [ci skip]
4d1bc027e138df64841f8af3003cae39fb3b133a
<ide><path>guides/source/getting_started.md <ide> Rails has several security features that help you write secure applications, <ide> and you're running into one of them now. This one is called <ide> `strong_parameters`, which requires us to tell Rails exactly which parameters <ide> we want to accept in our controllers. In this case, we want to allow the <del>`title` and `text` parameters, so change your `create` controller action to <del>look like this: <add>`title` and `text` parameters, so add the new `article_params` method, and <add>change your `create` controller action to use it, like this: <ide> <ide> ```ruby <ide> def create <ide> Also add a link in `app/views/articles/new.html.erb`, underneath the form, to <ide> go back to the `index` action: <ide> <ide> ```erb <del><%= form_for :article do |f| %> <add><%= form_for :article, url: articles_path do |f| %> <ide> ... <ide> <% end %> <ide>
1