content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Text
Text
fix typos in web streams api documentation
3bae79087c6c64c65d7dc6c1076d8dc392d1d468
<ide><path>doc/api/webstreams.md <ide> method to acquire the async iterator and set the `preventCancel` option to <ide> The {ReadableStream} must not be locked (that is, it must not have an existing <ide> active reader). During the async iteration, the {ReadableStream} will be locked. <ide> <del>#### Transfering with `postMessage()` <add>#### Transferring with `postMessage()` <ide> <ide> A {ReadableStream} instance can be transferred using a {MessagePort}. <ide> <ide> the pooled `Buffer` instances. When a `Buffer`, {TypedArray}, <ide> or {DataView} is passed in to `readableStreamBYOBReader.read()`, <ide> the view's underlying `ArrayBuffer` is *detached*, invalidating <ide> all existing views that may exist on that `ArrayBuffer`. This <del>can have disasterous consequences for your application. <add>can have disastrous consequences for your application. <ide> <ide> #### `readableStreamBYOBReader.releaseLock()` <ide> <!-- YAML <ide> The `writableStream.locked` property is `false` by default, and is <ide> switched to `true` while there is an active writer attached to this <ide> `WritableStream`. <ide> <del>#### Transfering with postMessage() <add>#### Transferring with postMessage() <ide> <ide> A {WritableStream} instance can be transferred using a {MessagePort}. <ide> <ide> added: REPLACEME <ide> <ide> * Type: {WritableStream} <ide> <del>#### Transfering with postMessage() <add>#### Transferring with postMessage() <ide> <ide> A {TransformStream} instance can be transferred using a {MessagePort}. <ide> <ide> added: REPLACEME <ide> <ide> * `reason` {any} <ide> <del>Signals to both the readable and writable side that an error has occured <add>Signals to both the readable and writable side that an error has occurred <ide> while processing the transform data, causing both sides to be abruptly <ide> closed. <ide>
1
Mixed
Go
clarify meaning of docker attach
1922eac4cc7190e1f3fa98796e7613c3e5b8b2bd
<ide><path>cli/command/container/attach.go <ide> func NewAttachCommand(dockerCli *command.DockerCli) *cobra.Command { <ide> <ide> cmd := &cobra.Command{ <ide> Use: "attach [OPTIONS] CONTAINER", <del> Short: "Attach to a running container", <add> Short: "Attach local standard input, output, and error streams to a running container", <ide> Args: cli.ExactArgs(1), <ide> RunE: func(cmd *cobra.Command, args []string) error { <ide> opts.container = args[0] <ide><path>docs/reference/commandline/attach.md <ide> keywords: "attach, running, container" <ide> ```markdown <ide> Usage: docker attach [OPTIONS] CONTAINER <ide> <del>Attach to a running container <add>Attach local standard input, output, and error streams to a running container <ide> <ide> Options: <ide> --detach-keys string Override the key sequence for detaching a container <ide> Options: <ide> <ide> ## Description <ide> <del>Use `docker attach` to attach to a running container using the container's ID <del>or name, either to view its ongoing output or to control it interactively. <add>Use `docker attach` to attach your terminal's standard input, output, and error <add>(or any combination of the three) to a running container using the container's <add>ID or name. This allows you to view its ongoing output or to control it <add>interactively, as though the commands were running directly in your terminal. <add> <ide> You can attach to the same contained process multiple times simultaneously, <del>screen sharing style, or quickly view the progress of your detached process. <add>even as a different user with the appropriate permissions. <ide> <ide> To stop a container, use `CTRL-c`. This key sequence sends `SIGKILL` to the <ide> container. If `--sig-proxy` is true (the default),`CTRL-c` sends a `SIGINT` to
2
Ruby
Ruby
remove unused block arguments
7b1c78363032bd83b81c54f49ee258d82c3d4998
<ide><path>actionpack/lib/action_dispatch/http/request.rb <ide> def GET <ide> <ide> # Override Rack's POST method to support indifferent access <ide> def POST <del> get_header("action_dispatch.request.request_parameters") do |k| <add> get_header("action_dispatch.request.request_parameters") do <ide> self.request_parameters = normalize_encode_params(super || {}) <ide> end <ide> rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e <ide><path>actionpack/test/dispatch/callbacks_test.rb <ide> def test_before_and_after_callbacks <ide> assert_equal 4, Foo.a <ide> assert_equal 4, Foo.b <ide> <del> dispatch do |env| <add> dispatch do <ide> raise "error" <ide> end rescue nil <ide> assert_equal 6, Foo.a
2
Javascript
Javascript
add prefix to the architecture overlay
d0c618a1f16d7ea7155bd66524d1faf30f30f5a4
<ide><path>Libraries/ReactNative/ReactNativeArchitectureIndicator.js <ide> const View = require('../Components/View/View'); <ide> const hasTurboModule = global.__turboModuleProxy != null; <ide> const isBridgeless = global.RN$Bridgeless === true; <ide> <add>// This is a temporary component to help with migration for the new architecture. <ide> function ReactNativeArchitectureIndicator(props: {| <ide> fabric: boolean, <ide> |}): React.Node { <ide> function ReactNativeArchitectureIndicator(props: {| <ide> <ide> return ( <ide> <View style={styles.container}> <del> <Text style={styles.text}>{parts.join('+')}</Text> <add> <Text style={styles.text}>{'(FB-ONLY) ' + parts.join('+')}</Text> <ide> </View> <ide> ); <ide> }
1
Javascript
Javascript
use relative path in source map for context module
14478b90c8d2735626b6f40fd0a9274e0a9e5225
<ide><path>lib/Compilation.js <ide> Or do you want to use the entrypoints '${name}' and '${runtime}' independently o <ide> dependencyTemplates, <ide> runtimeTemplate, <ide> runtime, <del> codeGenerationResults: results <add> codeGenerationResults: results, <add> compilation: this <ide> }); <ide> } catch (err) { <ide> errors.push(new CodeGenerationError(module, err)); <ide><path>lib/ContextModule.js <ide> const { <ide> keepOriginalOrder, <ide> compareModulesById <ide> } = require("./util/comparators"); <del>const { contextify, parseResource } = require("./util/identifier"); <add>const { <add> contextify, <add> parseResource, <add> makePathsRelative <add>} = require("./util/identifier"); <ide> const makeSerializable = require("./util/makeSerializable"); <ide> <ide> /** @typedef {import("webpack-sources").Source} Source */ <ide> module.exports = webpackEmptyAsyncContext;`; <ide> return this.getSourceForEmptyContext(id, runtimeTemplate); <ide> } <ide> <del> getSource(sourceString) { <add> /** <add> * @param {string} sourceString source content <add> * @param {Compilation=} compilation the compilation <add> * @returns {Source} generated source <add> */ <add> getSource(sourceString, compilation) { <ide> if (this.useSourceMap || this.useSimpleSourceMap) { <del> return new OriginalSource(sourceString, this.identifier()); <add> return new OriginalSource( <add> sourceString, <add> `webpack://${makePathsRelative( <add> (compilation && compilation.options.context) || this.context, <add> this.identifier(), <add> compilation && compilation.compiler.root <add> )}` <add> ); <ide> } <ide> return new RawSource(sourceString); <ide> } <ide> module.exports = webpackEmptyAsyncContext;`; <ide> * @returns {CodeGenerationResult} result <ide> */ <ide> codeGeneration(context) { <del> const { chunkGraph } = context; <add> const { chunkGraph, compilation } = context; <ide> const sources = new Map(); <ide> sources.set( <ide> "javascript", <del> this.getSource(this.getSourceString(this.options.mode, context)) <add> this.getSource( <add> this.getSourceString(this.options.mode, context), <add> compilation <add> ) <ide> ); <ide> const set = new Set(); <ide> const allDeps = /** @type {ContextElementDependency[]} */ ( <ide><path>lib/Module.js <ide> const makeSerializable = require("./util/makeSerializable"); <ide> * @property {string=} type the type of source that should be generated <ide> */ <ide> <add>// TODO webpack 6: compilation will be required in CodeGenerationContext <ide> /** <ide> * @typedef {Object} CodeGenerationContext <ide> * @property {DependencyTemplates} dependencyTemplates the dependency templates <ide> const makeSerializable = require("./util/makeSerializable"); <ide> * @property {RuntimeSpec} runtime the runtimes code should be generated for <ide> * @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules <ide> * @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that) <add> * @property {Compilation=} compilation the compilation <ide> */ <ide> <ide> /** <ide><path>test/configCases/source-map/context-module-source-path/foo/a.js <add>module.exports = "a"; <ide><path>test/configCases/source-map/context-module-source-path/foo/b.js <add>module.exports = "b"; <ide><path>test/configCases/source-map/context-module-source-path/index.js <add>const foo = Math.random() > 0.5 ? "a" : "b"; <add>require(`./foo/${foo}.js`); <add> <add>it("context module should use relative path in source map file", () => { <add> var fs = require("fs"); <add> var source = fs.readFileSync(__filename + ".map", "utf-8"); <add> var map = JSON.parse(source); <add> expect(map.sources).toContain("webpack:///./foo/ sync ^\\.\\/.*\\.js$"); <add>}); <ide><path>test/configCases/source-map/context-module-source-path/webpack.config.js <add>module.exports = { <add> node: { <add> __dirname: false, <add> __filename: false <add> }, <add> devtool: "source-map" <add>};
7
Text
Text
fix readme for 0.10
22e14b1e81155e958bff24f14c59a28233b4202a
<ide><path>README.md <ide> export default class Counter { <ide> // and bind actions to the dispatcher with `bindActionCreators`. <ide> <ide> import React from 'react'; <del>import { Connector, bindActionCreators } from 'redux'; <add>import { bindActionCreators } from 'redux'; <add>import { Connector } from 'redux/react'; // Or redux/react-native <ide> import Counter from '../components/Counter'; <ide> import * as CounterActions from '../actions/CounterActions'; <ide> <ide> The `@connect` decorator lets you create smart components less verbosely: <ide> <ide> ```js <ide> import React from 'react'; <del>import { connect, bindActionCreators } from 'redux'; <add>import { bindActionCreators } from 'redux'; <add>import { connect } from 'redux/react'; // Or redux/react-native <ide> import Counter from '../components/Counter'; <ide> import * as CounterActions from '../actions/CounterActions'; <ide> <ide> export default class CounterApp { <ide> The simplest way to initialize a Redux instance is to give it an object whose values are your Store functions, and whose keys are their names. You may `import *` from the file with all your Store definitions to obtain such an object: <ide> <ide> ```js <del>import { createRedux, Provider } from 'redux'; <add>import { createRedux } from 'redux'; <add>import { Provider } from 'redux/react'; <ide> import * as stores from '../stores/index'; <ide> <ide> const redux = createRedux(stores);
1
Javascript
Javascript
set fahrenheit values to 1 decimal
c599797696da2d797915ea63b16e036e7b74a41c
<ide><path>glances/outputs/static/js/components/plugin-sensors/controller.js <ide> function GlancesPluginSensorsController($scope, GlancesStats, GlancesPluginHelpe <ide> <ide> _.forEach(stats, function (sensor) { <ide> if (convertToFahrenheit && sensor.type != 'battery' && sensor.type != 'fan_speed') { <del> sensor.value = sensor.value * 1.8 + 32; <add> sensor.value = parseFloat(sensor.value * 1.8 + 32).toFixed(1); <ide> sensor.unit = 'F'; <ide> } <ide> });
1
Ruby
Ruby
fix typo in documentation comment
47bf072330f4b62a125d7e93b8a11c8d92c84387
<ide><path>actionpack/lib/action_view/helpers/asset_tag_helper.rb <ide> def auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {}) <ide> # ==== Examples <ide> # <ide> # favicon_link_tag '/myicon.ico' <del> # # => <link href="/assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" /> <add> # # => <link href="/assets/myicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" /> <ide> # <ide> # Mobile Safari looks for a different <link> tag, pointing to an image that <ide> # will be used if you add the page to the home screen of an iPod Touch, iPhone, or iPad.
1
Javascript
Javascript
fix handling of val on ie with jquery
81e99799a8c999d8038dd27bf86bb8ca6a3add11
<ide><path>src/widgets.js <ide> function valueAccessor(scope, element) { <ide> } <ide> }, <ide> set: function(value) { <del> var oldValue = element.val(), <add> var oldValue = element[0].value, <ide> newValue = format(value); <ide> if (oldValue != newValue) { <del> element.val(newValue); <add> element[0].value = newValue; <ide> } <ide> validate(); <ide> } <ide> }; <ide> <ide> function validate() { <del> var value = trim(element.val()); <add> var value = trim(element[0].value); <ide> if (element[0].disabled || element[0].readOnly) { <ide> elementError(element, NG_VALIDATION_ERROR, null); <ide> invalidWidgets.markValid(element);
1
Python
Python
add a note about byte arrays
352b02f98f61127c4908bb0fe12e7e2fbc232def
<ide><path>libcloud/utils/files.py <ide> def read_in_chunks(iterator, chunk_size=None, fill_size=False): <ide> @type fill_size: C{bool} <ide> @param fill_size: If True, make sure chunks are chunk_size in length <ide> (except for last chunk). <add> <add> TODO: At some point in the future we could use byte arrays here if version <add> >= Python 3. This should speed things up a bit and reduce memory usage. <ide> """ <ide> chunk_size = chunk_size or CHUNK_SIZE <ide>
1
Javascript
Javascript
add mustcall to test-fs-readfile-pipe
fa3714d721e32acd16776d262ab970da405dbda4
<ide><path>test/parallel/test-fs-readfile-pipe.js <ide> const assert = require('assert'); <ide> const fs = require('fs'); <ide> <ide> if (process.argv[2] === 'child') { <del> fs.readFile('/dev/stdin', function(er, data) { <add> fs.readFile('/dev/stdin', common.mustCall(function(er, data) { <ide> assert.ifError(er); <ide> process.stdout.write(data); <del> }); <add> })); <ide> return; <ide> } <ide> <ide> const exec = require('child_process').exec; <ide> const f = JSON.stringify(__filename); <ide> const node = JSON.stringify(process.execPath); <ide> const cmd = `cat ${filename} | ${node} ${f} child`; <del>exec(cmd, function(err, stdout, stderr) { <add>exec(cmd, common.mustCall(function(err, stdout, stderr) { <ide> assert.ifError(err); <ide> assert.strictEqual( <ide> stdout, <ide> exec(cmd, function(err, stdout, stderr) { <ide> '', <ide> `expected not to read anything from stderr but got: '${stderr}'`); <ide> console.log('ok'); <del>}); <add>}));
1
Javascript
Javascript
fix bracket nit
3154ec4e38796c38fd27848dbd13447b463f508c
<ide><path>src/core.js <ide> var PDFDoc = (function PDFDocClosure() { <ide> <ide> messageHandler.on('page_error', function pdfDocError(data) { <ide> var page = this.pageCache[data.pageNum]; <del> if (page.displayReadyPromise) { <del> page.displayReadyPromise.reject(data.error);} <add> if (page.displayReadyPromise) <add> page.displayReadyPromise.reject(data.error); <ide> else <ide> throw data.error; <ide> }, this);
1
Mixed
Text
add -h|--human flag to `docker history`
ae5cf30c7c6630d201ef14e2e460f4164f58a261
<ide><path>api/client/history.go <ide> import ( <ide> // Usage: docker history [OPTIONS] IMAGE <ide> func (cli *DockerCli) CmdHistory(args ...string) error { <ide> cmd := cli.Subcmd("history", "IMAGE", "Show the history of an image", true) <add> human := cmd.Bool([]string{"H", "-human"}, true, "Print sizes and dates in human readable format") <ide> quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only show numeric IDs") <ide> noTrunc := cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Don't truncate output") <ide> cmd.Require(flag.Exact, 1) <ide> func (cli *DockerCli) CmdHistory(args ...string) error { <ide> fmt.Fprintf(w, stringid.TruncateID(entry.ID)) <ide> } <ide> if !*quiet { <del> if *noTrunc { <add> if *human { <add> fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(entry.Created, 0)))) <add> } else { <ide> fmt.Fprintf(w, "\t%s\t", time.Unix(entry.Created, 0).Format(time.RFC3339)) <add> } <add> <add> if *noTrunc { <ide> fmt.Fprintf(w, "%s\t", entry.CreatedBy) <ide> } else { <del> fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(entry.Created, 0)))) <ide> fmt.Fprintf(w, "%s\t", stringutils.Truncate(entry.CreatedBy, 45)) <ide> } <del> fmt.Fprintf(w, "%s\t", units.HumanSize(float64(entry.Size))) <add> <add> if *human { <add> fmt.Fprintf(w, "%s\t", units.HumanSize(float64(entry.Size))) <add> } else { <add> fmt.Fprintf(w, "%d\t", entry.Size) <add> } <add> <ide> fmt.Fprintf(w, "%s", entry.Comment) <ide> } <ide> fmt.Fprintf(w, "\n") <ide><path>docs/man/docker-history.1.md <ide> Show the history of when and how an image was created. <ide> **--help** <ide> Print usage statement <ide> <add>**-H**. **--human**=*true*|*false* <add> Print sizes and dates in human readable format. The default is *true*. <add> <ide> **--no-trunc**=*true*|*false* <ide> Don't truncate output. The default is *false*. <ide> <ide><path>docs/sources/reference/commandline/cli.md <ide> This will create a new Bash session in the container `ubuntu_bash`. <ide> <ide> Show the history of an image <ide> <add> -H, --human=true Print sizes and dates in human readable format <ide> --no-trunc=false Don't truncate output <ide> -q, --quiet=false Only show numeric IDs <ide>
3
PHP
PHP
fix cs error
d1daf290267bac76e3ce80c6df2fb52c8f5ba757
<ide><path>src/ORM/Behavior/TreeBehavior.php <ide> public function afterSave(Event $event, Entity $entity) <ide> /** <ide> * Set level for descendents. <ide> * <del> * @param \Cake\ORM\Entity $entity <add> * @param \Cake\ORM\Entity $entity The entity whose descendents need to be updated. <ide> * @return void <ide> */ <ide> protected function _setChildrenLevel(Entity $entity)
1
Javascript
Javascript
change var to let in test-trace-events
fdac8f62581389ee3019d473a9c5c3f68ca4027e
<ide><path>test/parallel/test-trace-events-all.js <ide> const fs = require('fs'); <ide> const path = require('path'); <ide> <ide> const CODE = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> <ide> const tmpdir = require('../common/tmpdir'); <ide> tmpdir.refresh(); <ide><path>test/parallel/test-trace-events-async-hooks-dynamic.js <ide> const path = require('path'); <ide> const enable = `require("trace_events").createTracing( <ide> { categories: ["node.async_hooks"] }).enable();`; <ide> const code = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> <ide> const tmpdir = require('../common/tmpdir'); <ide> const filename = path.join(tmpdir.path, 'node_trace.1.log'); <ide><path>test/parallel/test-trace-events-async-hooks-worker.js <ide> const fs = require('fs'); <ide> const path = require('path'); <ide> <ide> const code = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> const worker = <ide> `const { Worker } = require('worker_threads'); <ide> const worker = new Worker('${code}', <ide><path>test/parallel/test-trace-events-async-hooks.js <ide> const path = require('path'); <ide> const util = require('util'); <ide> <ide> const CODE = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> <ide> const tmpdir = require('../common/tmpdir'); <ide> tmpdir.refresh(); <ide><path>test/parallel/test-trace-events-file-pattern.js <ide> const path = require('path'); <ide> tmpdir.refresh(); <ide> <ide> const CODE = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> <ide> const proc = cp.spawn(process.execPath, [ <ide> '--trace-events-enabled', <ide><path>test/parallel/test-trace-events-metadata.js <ide> const fs = require('fs'); <ide> const path = require('path'); <ide> <ide> const CODE = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1);' + <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1);' + <ide> 'process.title = "foo"'; <ide> <ide> const tmpdir = require('../common/tmpdir'); <ide><path>test/parallel/test-trace-events-none.js <ide> const fs = require('fs'); <ide> const path = require('path'); <ide> <ide> const CODE = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> <ide> const tmpdir = require('../common/tmpdir'); <ide> tmpdir.refresh(); <ide><path>test/parallel/test-trace-events-v8.js <ide> const fs = require('fs'); <ide> const path = require('path'); <ide> <ide> const CODE = <del> 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; <add> 'setTimeout(() => { for (let i = 0; i < 100000; i++) { "test" + i } }, 1)'; <ide> <ide> const tmpdir = require('../common/tmpdir'); <ide> tmpdir.refresh();
8
Go
Go
fix streaming json content-type for postbuild
30d6ff99fc6a22937b21bd9f35610d5f74a9b6e7
<ide><path>api/server/server.go <ide> func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite <ide> } <ide> } <ide> <add> // This needs to be set before calls to streamJSON <add> job.SetenvBool("lineDelim", version.GreaterThanOrEqualTo("1.15")) <add> <ide> if version.GreaterThanOrEqualTo("1.8") { <ide> job.SetenvBool("json", true) <ide> streamJSON(job, w, true) <ide> func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite <ide> job.Setenv("q", r.FormValue("q")) <ide> job.Setenv("nocache", r.FormValue("nocache")) <ide> job.Setenv("forcerm", r.FormValue("forcerm")) <del> job.SetenvBool("lineDelim", version.GreaterThanOrEqualTo("1.15")) <ide> job.SetenvJson("authConfig", authConfig) <ide> job.SetenvJson("configFile", configFile) <ide>
1
Python
Python
update new test so that it fails without the fix
06521777bdf4419e5e6197e5815ba6a40d4a197f
<ide><path>keras/applications/applications_test.py <ide> def test_application_notop(self, app, last_dim): <ide> def test_application_notop_custom_input_shape(self, app, last_dim): <ide> output_shape = _get_output_shape( <ide> lambda: app( <del> weights=None, include_top=False, input_shape=(224, 224, 3) <add> weights='imagenet', include_top=False, input_shape=(224, 224, 3) <ide> ) <ide> ) <ide>
1
Ruby
Ruby
remove unused accessor
8e20737c5e88c4389f06a63161ebbf13b0958568
<ide><path>activerecord/test/cases/migration/column_positioning_test.rb <ide> module ActiveRecord <ide> class Migration <ide> class ColumnPositioningTest < ActiveRecord::TestCase <del> attr_reader :connection, :table_name <add> attr_reader :connection <ide> alias :conn :connection <ide> <ide> def setup
1
Javascript
Javascript
use only websockets and xhr-polling
ddff347b91df7f13b6d1118410cfa15bf99b456d
<ide><path>karma-shared.conf.js <ide> module.exports = function(config, specificOptions) { <ide> <ide> <ide> if (process.env.TRAVIS) { <add> config.transports = ['websocket', 'xhr-polling']; <add> config.browserStack.build = 'TRAVIS ' + process.env.TRAVIS_BUILD; <add> <ide> // Debug logging into a file, that we print out at the end of the build. <ide> config.loggers.push({ <ide> type: 'file',
1
Go
Go
fix openfile parameters
141b9a74716c016029badf16aca21dc96975aaac
<ide><path>daemon/graphdriver/lcow/remotefs_file.go <ide> func (l *lcowfs) OpenFile(path string, flag int, perm os.FileMode) (_ driver.Fil <ide> flagStr := strconv.FormatInt(int64(flag), 10) <ide> permStr := strconv.FormatUint(uint64(perm), 8) <ide> <del> commandLine := fmt.Sprintf("%s %s %s %s", remotefs.RemotefsCmd, remotefs.OpenFileCmd, flagStr, permStr) <add> commandLine := fmt.Sprintf("%s %s %s %s %s", remotefs.RemotefsCmd, remotefs.OpenFileCmd, path, flagStr, permStr) <ide> env := make(map[string]string) <ide> env["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:" <ide> processConfig := &hcsshim.ProcessConfig{
1
Javascript
Javascript
fix handling of multiple async focus events
ddfa83766478268391bc9da96683fc0d4973fcfe
<ide><path>src/event.js <ide> function leverageNative( el, type, expectSync ) { <ide> if ( ( event.isTrigger & 1 ) && this[ type ] ) { <ide> <ide> // Interrupt processing of the outer synthetic .trigger()ed event <del> if ( !saved ) { <add> // Saved data should be false in such cases, but might be a leftover capture object <add> // from an async native handler (gh-4350) <add> if ( !saved.length ) { <ide> <ide> // Store arguments for use when handling the inner native event <add> // There will always be at least one argument (an event object), so this array <add> // will not be confused with a leftover capture object. <ide> saved = slice.call( arguments ); <ide> dataPriv.set( this, type, saved ); <ide> <ide> function leverageNative( el, type, expectSync ) { <ide> if ( saved !== result || notAsync ) { <ide> dataPriv.set( this, type, false ); <ide> } else { <del> result = undefined; <add> result = {}; <ide> } <ide> if ( saved !== result ) { <ide> <ide> // Cancel the outer synthetic event <ide> event.stopImmediatePropagation(); <ide> event.preventDefault(); <del> return result; <add> return result.value; <ide> } <ide> <ide> // If this is an inner synthetic event for an event with a bubbling surrogate <ide> function leverageNative( el, type, expectSync ) { <ide> <ide> // If this is a native event triggered above, everything is now in order <ide> // Fire an inner synthetic event with the original arguments <del> } else if ( saved ) { <add> } else if ( saved.length ) { <ide> <ide> // ...and capture the result <del> dataPriv.set( this, type, jQuery.event.trigger( <del> <del> // Support: IE <=9 - 11+ <del> // Extend with the prototype to reset the above stopImmediatePropagation() <del> jQuery.extend( saved.shift(), jQuery.Event.prototype ), <del> saved, <del> this <del> ) ); <add> dataPriv.set( this, type, { <add> value: jQuery.event.trigger( <add> <add> // Support: IE <=9 - 11+ <add> // Extend with the prototype to reset the above stopImmediatePropagation() <add> jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), <add> saved.slice( 1 ), <add> this <add> ) <add> } ); <ide> <ide> // Abort handling of the native event <ide> event.stopImmediatePropagation(); <ide><path>test/unit/event.js <ide> QUnit.test( "focus-blur order (#12868)", function( assert ) { <ide> }, 50 ); <ide> } ); <ide> <add>QUnit.test( "Event handling works with multiple async focus events (gh-4350)", function( assert ) { <add> assert.expect( 3 ); <add> <add> var remaining = 3, <add> input = jQuery( "#name" ), <add> <add> // Support: IE <=9 - 11+ <add> // focus and blur events are asynchronous; this is the resulting mess. <add> // The browser window must be topmost for this to work properly!! <add> done = assert.async(); <add> <add> input <add> .on( "focus", function() { <add> remaining--; <add> assert.ok( true, "received focus event, expecting " + remaining + " more" ); <add> if ( remaining > 0 ) { <add> input.trigger( "blur" ); <add> } else { <add> done(); <add> } <add> } ) <add> .on( "blur", function() { <add> setTimeout( function() { <add> input.trigger( "focus" ); <add> } ); <add> } ); <add> <add> // gain focus <add> input.trigger( "focus" ); <add> <add> // DOM focus is unreliable in TestSwarm <add> setTimeout( function() { <add> if ( QUnit.isSwarm && remaining === 3 ) { <add> assert.ok( true, "GAP: Could not observe focus change" ); <add> assert.ok( true, "GAP: Could not observe focus change" ); <add> assert.ok( true, "GAP: Could not observe focus change" ); <add> setTimeout( function() { <add> done(); <add> } ); <add> } <add> } ); <add>} ); <add> <ide> QUnit.test( "native-backed events preserve trigger data (gh-1741, gh-4139)", function( assert ) { <ide> assert.expect( 17 ); <ide>
2
Javascript
Javascript
pass geometry and material into super constructor
32c143f7d678af9f32678222b3538f94f86a2b3d
<ide><path>examples/js/lines/Line2.js <ide> console.warn( "THREE.Line2: As part of the transition to ES6 Modules, the files <ide> <ide> THREE.Line2 = function ( geometry, material ) { <ide> <del> THREE.LineSegments2.call( this ); <add> THREE.LineSegments2.call( this, geometry, material ); <ide> <ide> this.type = 'Line2'; <ide> <ide><path>examples/js/lines/LineSegments2.js <ide> console.warn( "THREE.LineSegments2: As part of the transition to ES6 Modules, th <ide> <ide> THREE.LineSegments2 = function ( geometry, material ) { <ide> <del> THREE.Mesh.call( this ); <add> THREE.Mesh.call( this, geometry, material ); <ide> <ide> this.type = 'LineSegments2'; <ide> <ide><path>examples/jsm/lines/Line2.js <ide> import { LineMaterial } from "../lines/LineMaterial.js"; <ide> <ide> var Line2 = function ( geometry, material ) { <ide> <del> LineSegments2.call( this ); <add> LineSegments2.call( this, geometry, material ); <ide> <ide> this.type = 'Line2'; <ide> <ide><path>examples/jsm/lines/LineSegments2.js <ide> import { LineMaterial } from "../lines/LineMaterial.js"; <ide> <ide> var LineSegments2 = function ( geometry, material ) { <ide> <del> Mesh.call( this ); <add> Mesh.call( this, geometry, material ); <ide> <ide> this.type = 'LineSegments2'; <ide>
4
Ruby
Ruby
add comment detailing options handling
03a72760ef8a7b3c04193ed51fa5398d38abbd96
<ide><path>Library/Homebrew/utils/curl.rb <ide> def curl_http_content_headers_and_checksum( <ide> ) <ide> file = Tempfile.new.tap(&:close) <ide> <add> # Convert specs to options. This is mostly key-value options, <add> # unless the value is a boolean in which case treat as as flag. <ide> specs = specs.flat_map do |option, argument| <ide> next [] if argument == false # No flag. <ide> <ide> args = ["--#{option.to_s.tr("_", "-")}"] <ide> args << argument unless argument == true # It's a flag. <ide> args <ide> end <add> <ide> max_time = hash_needed ? 600 : 25 <ide> output, _, status = curl_output( <ide> *specs, "--dump-header", "-", "--output", file.path, "--location", url,
1
Text
Text
fix eager load associations without pks [ci skip]
d8fbfee81e8923e2fec79da880eef263dcf16e91
<ide><path>activerecord/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <add>* Fix eagerly loading associations without primary keys. Fixes #4976. *Kelley Reynolds* <add> <ide> * Rails now raise an exception when you're trying to run a migration that has an invalid <ide> file name. Only lower case letters, numbers, and '_' are allowed in migration's file name. <ide> Please see #7419 for more details.
1
Javascript
Javascript
fix thumbnails to follow the require syntax
596109fa0a5d078f59852dea2e174ac55cc96f93
<ide><path>Examples/UIExplorer/ListViewGridLayoutExample.js <ide> var { <ide> } = React; <ide> <ide> var THUMB_URLS = [ <del> 'Thumbnails/like.png', <del> 'Thumbnails/dislike.png', <del> 'Thumbnails/call.png', <del> 'Thumbnails/fist.png', <del> 'Thumbnails/bandaged.png', <del> 'Thumbnails/flowers.png', <del> 'Thumbnails/heart.png', <del> 'Thumbnails/liking.png', <del> 'Thumbnails/party.png', <del> 'Thumbnails/poke.png', <del> 'Thumbnails/superlike.png', <del> 'Thumbnails/victory.png', <add> require('./Thumbnails/like.png'), <add> require('./Thumbnails/dislike.png'), <add> require('./Thumbnails/call.png'), <add> require('./Thumbnails/fist.png'), <add> require('./Thumbnails/bandaged.png'), <add> require('./Thumbnails/flowers.png'), <add> require('./Thumbnails/heart.png'), <add> require('./Thumbnails/liking.png'), <add> require('./Thumbnails/party.png'), <add> require('./Thumbnails/poke.png'), <add> require('./Thumbnails/superlike.png'), <add> require('./Thumbnails/victory.png'), <ide> ]; <ide> <ide> var ListViewGridLayoutExample = React.createClass({ <ide> var ListViewGridLayoutExample = React.createClass({ <ide> <ide> _renderRow: function(rowData: string, sectionID: number, rowID: number) { <ide> var rowHash = Math.abs(hashCode(rowData)); <del> var imgSource = { <del> uri: THUMB_URLS[rowHash % THUMB_URLS.length], <del> }; <add> var imgSource = THUMB_URLS[rowHash % THUMB_URLS.length]; <ide> return ( <ide> <TouchableHighlight onPress={() => this._pressRow(rowID)} underlayColor="transparent"> <ide> <View> <ide><path>Examples/UIExplorer/ListViewPagingExample.js <ide> var { <ide> <ide> var PAGE_SIZE = 4; <ide> var THUMB_URLS = [ <del> 'Thumbnails/like.png', <del> 'Thumbnails/dislike.png', <del> 'Thumbnails/call.png', <del> 'Thumbnails/fist.png', <del> 'Thumbnails/bandaged.png', <del> 'Thumbnails/flowers.png', <del> 'Thumbnails/heart.png', <del> 'Thumbnails/liking.png', <del> 'Thumbnails/party.png', <del> 'Thumbnails/poke.png', <del> 'Thumbnails/superlike.png', <del> 'Thumbnails/victory.png', <del> ]; <add> require('./Thumbnails/like.png'), <add> require('./Thumbnails/dislike.png'), <add> require('./Thumbnails/call.png'), <add> require('./Thumbnails/fist.png'), <add> require('./Thumbnails/bandaged.png'), <add> require('./Thumbnails/flowers.png'), <add> require('./Thumbnails/heart.png'), <add> require('./Thumbnails/liking.png'), <add> require('./Thumbnails/party.png'), <add> require('./Thumbnails/poke.png'), <add> require('./Thumbnails/superlike.png'), <add> require('./Thumbnails/victory.png'), <add>]; <ide> var NUM_SECTIONS = 100; <ide> var NUM_ROWS_PER_SECTION = 10; <ide> <ide> var Thumb = React.createClass({ <ide> <TouchableOpacity <ide> onPress={this._onPressThumb} <ide> style={[styles.buttonContents, {flexDirection: this.state.dir}]}> <del> <Image style={styles.img} source={{uri: THUMB_URLS[this.state.thumbIndex]}} /> <del> <Image style={styles.img} source={{uri: THUMB_URLS[this.state.thumbIndex]}} /> <del> <Image style={styles.img} source={{uri: THUMB_URLS[this.state.thumbIndex]}} /> <add> <Image style={styles.img} source={THUMB_URLS[this.state.thumbIndex]} /> <add> <Image style={styles.img} source={THUMB_URLS[this.state.thumbIndex]} /> <add> <Image style={styles.img} source={THUMB_URLS[this.state.thumbIndex]} /> <ide> {this.state.dir === 'column' ? <ide> <Text> <ide> Oooo, look at this new text! So awesome it may just be crazy.
2
Text
Text
fix nits in deprecated
78a5480dfd8dc1b304e38bc9c18854c4ef86de33
<ide><path>docs/deprecated.md <ide> The `docker import` command format 'file|URL|- [REPOSITORY [TAG]]' is deprecated <ide> The shorthand (`-h`) is less common than `--help` on Linux and cannot be used <ide> on all subcommands (due to it conflicting with, e.g. `-h` / `--hostname` on <ide> `docker create`). For this reason, the `-h` shorthand was not printed in the <del>"usage" output of subcommands, nor docummented, and is now marked "deprecated". <add>"usage" output of subcommands, nor documented, and is now marked "deprecated". <ide> <ide> ### `-e` and `--email` flags on `docker login` <ide> **Deprecated In Release: [v1.11.0](https://github.com/docker/docker/releases/tag/v1.11.0)** <ide> The docker login command is removing the ability to automatically register for a <ide> <ide> **Target For Removal In Release: v1.13** <ide> <del>The flag `--security-opt` doesn't use the colon separator(`:`) anymore to divide keys and values, it uses the equal symbol(`=`) for consinstency with other similar flags, like `--storage-opt`. <add>The flag `--security-opt` doesn't use the colon separator(`:`) anymore to divide keys and values, it uses the equal symbol(`=`) for consistency with other similar flags, like `--storage-opt`. <ide> <ide> ### `/containers/(id or name)/copy` endpoint <ide>
1
Go
Go
add gotestyourself to vendor
381a1c0a5ac99b6d7ab33a29150878b9a8008e95
<ide><path>vendor/github.com/gotestyourself/gotestyourself/poll/poll.go <add>/*Package poll provides tools for testing asynchronous code. <add> */ <add>package poll <add> <add>import ( <add> "fmt" <add> "time" <add>) <add> <add>// TestingT is the subset of testing.T used by WaitOn <add>type TestingT interface { <add> LogT <add> Fatalf(format string, args ...interface{}) <add>} <add> <add>// LogT is a logging interface that is passed to the WaitOn check function <add>type LogT interface { <add> Log(args ...interface{}) <add> Logf(format string, args ...interface{}) <add>} <add> <add>// Settings are used to configure the behaviour of WaitOn <add>type Settings struct { <add> // Timeout is the maximum time to wait for the condition. Defaults to 10s <add> Timeout time.Duration <add> // Delay is the time to sleep between checking the condition. Detaults to <add> // 1ms <add> Delay time.Duration <add>} <add> <add>func defaultConfig() *Settings { <add> return &Settings{Timeout: 10 * time.Second, Delay: time.Millisecond} <add>} <add> <add>// SettingOp is a function which accepts and modifies Settings <add>type SettingOp func(config *Settings) <add> <add>// WithDelay sets the delay to wait between polls <add>func WithDelay(delay time.Duration) SettingOp { <add> return func(config *Settings) { <add> config.Delay = delay <add> } <add>} <add> <add>// WithTimeout sets the timeout <add>func WithTimeout(timeout time.Duration) SettingOp { <add> return func(config *Settings) { <add> config.Timeout = timeout <add> } <add>} <add> <add>// Result of a check performed by WaitOn <add>type Result interface { <add> // Error indicates that the check failed and polling should stop, and the <add> // the has failed <add> Error() error <add> // Done indicates that polling should stop, and the test should proceed <add> Done() bool <add> // Message provides the most recent state when polling has not completed <add> Message() string <add>} <add> <add>type result struct { <add> done bool <add> message string <add> err error <add>} <add> <add>func (r result) Done() bool { <add> return r.done <add>} <add> <add>func (r result) Message() string { <add> return r.message <add>} <add> <add>func (r result) Error() error { <add> return r.err <add>} <add> <add>// Continue returns a Result that indicates to WaitOn that it should continue <add>// polling. The message text will be used as the failure message if the timeout <add>// is reached. <add>func Continue(message string, args ...interface{}) Result { <add> return result{message: fmt.Sprintf(message, args...)} <add>} <add> <add>// Success returns a Result where Done() returns true, which indicates to WaitOn <add>// that it should stop polling and exit without an error. <add>func Success() Result { <add> return result{done: true} <add>} <add> <add>// Error returns a Result that indicates to WaitOn that it should fail the test <add>// and stop polling. <add>func Error(err error) Result { <add> return result{err: err} <add>} <add> <add>// WaitOn a condition or until a timeout. Poll by calling check and exit when <add>// check returns a done Result. To fail a test and exit polling with an error <add>// return a error result. <add>func WaitOn(t TestingT, check func(t LogT) Result, pollOps ...SettingOp) { <add> config := defaultConfig() <add> for _, pollOp := range pollOps { <add> pollOp(config) <add> } <add> <add> var lastMessage string <add> after := time.After(config.Timeout) <add> chResult := make(chan Result) <add> for { <add> go func() { <add> chResult <- check(t) <add> }() <add> select { <add> case <-after: <add> if lastMessage == "" { <add> lastMessage = "first check never completed" <add> } <add> t.Fatalf("timeout hit after %s: %s", config.Timeout, lastMessage) <add> case result := <-chResult: <add> switch { <add> case result.Error() != nil: <add> t.Fatalf("polling check failed: %s", result.Error()) <add> case result.Done(): <add> return <add> } <add> time.Sleep(config.Delay) <add> lastMessage = result.Message() <add> } <add> } <add>}
1
Javascript
Javascript
add verifynopendingtasks method
f0c6ebc07653f6267acec898ccef5677884e3081
<ide><path>src/ngMock/angular-mocks.js <ide> function MockXhr() { <ide> * @description <ide> * <ide> * This service is just a simple decorator for {@link ng.$timeout $timeout} service <del> * that adds a "flush" method. <del> */ <add> * that adds a "flush" and "verifyNoPendingTasks" methods. <add> */ <ide> <del>/** <del> * @ngdoc method <del> * @name ngMock.$timeout#flush <del> * @methodOf ngMock.$timeout <del> * @description <del> * <del> * Flushes the queue of pending tasks. <del> */ <add>angular.mock.$TimeoutDecorator = function($delegate, $browser) { <add> <add> /** <add> * @ngdoc method <add> * @name ngMock.$timeout#flush <add> * @methodOf ngMock.$timeout <add> * @description <add> * <add> * Flushes the queue of pending tasks. <add> */ <add> $delegate.flush = function() { <add> $browser.defer.flush(); <add> }; <add> <add> /** <add> * @ngdoc method <add> * @name ngMock.$timeout#verifyNoPendingTasks <add> * @methodOf ngMock.$timeout <add> * @description <add> * <add> * Verifies that there are no pending tasks that need to be flushed. <add> */ <add> $delegate.verifyNoPendingTasks = function() { <add> if ($browser.deferredFns.length) { <add> throw Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): ' + <add> formatPendingTasksAsString($browser.deferredFns)); <add> } <add> }; <add> <add> function formatPendingTasksAsString(tasks) { <add> var result = []; <add> angular.forEach(tasks, function(task) { <add> result.push('{id: ' + task.id + ', ' + 'time: ' + task.time + '}'); <add> }); <add> <add> return result.join(', '); <add> } <add> <add> return $delegate; <add>}; <ide> <ide> /** <ide> * <ide> angular.module('ngMock', ['ng']).provider({ <ide> $httpBackend: angular.mock.$HttpBackendProvider, <ide> $rootElement: angular.mock.$RootElementProvider <ide> }).config(function($provide) { <del> $provide.decorator('$timeout', function($delegate, $browser) { <del> $delegate.flush = function() { <del> $browser.defer.flush(); <del> }; <del> return $delegate; <del> }); <add> $provide.decorator('$timeout', angular.mock.$TimeoutDecorator); <ide> }); <ide> <del> <ide> /** <ide> * @ngdoc overview <ide> * @name ngMockE2E <ide><path>test/ngMock/angular-mocksSpec.js <ide> describe('ngMock', function() { <ide> $timeout.flush(); <ide> expect(logger).toEqual(['t1', 't3', 't2']); <ide> })); <add> <add> <add> it('should throw an exception when not flushed', inject(function($timeout){ <add> $timeout(noop); <add> <add> var expectedError = 'Deferred tasks to flush (1): {id: 0, time: 0}'; <add> expect(function() {$timeout.verifyNoPendingTasks();}).toThrow(expectedError); <add> })); <add> <add> <add> it('should do nothing when all tasks have been flushed', inject(function($timeout) { <add> $timeout(noop); <add> <add> $timeout.flush(); <add> expect(function() {$timeout.verifyNoPendingTasks();}).not.toThrow(); <add> })); <ide> }); <ide> <ide>
2
Python
Python
add tests for border_mode == same
8e67b040e88abad2e9befca3748521ca1a0d5254
<ide><path>tests/auto/keras/layers/test_convolutional.py <ide> def test_convolution_1d(self): <ide> <ide> input = np.ones((nb_samples, nb_steps, input_dim)) <ide> for weight in [None, weights_in]: <del> for border_mode in ['valid', 'full']: <add> for border_mode in ['valid', 'full', 'same']: <ide> for subsample_length in [1, 3]: <ide> for W_regularizer in [None, 'l2']: <ide> for b_regularizer in [None, 'l2']: <ide> def test_convolution_1d(self): <ide> <ide> layer.input = theano.shared(value=input) <ide> for train in [True, False]: <del> layer.get_output(train).eval() <add> out = layer.get_output(train).eval() <add> assert input.shape[0] == out.shape[0] <add> if border_mode == 'same' and subsample_length == 1: <add> assert input.shape[1] == out.shape[1] <ide> <ide> config = layer.get_config() <ide>
1
Javascript
Javascript
add note on checkbox inheriting from component
6153cd8b2f93a90f2862de7ce7aabad978c146a7
<ide><path>packages/ember-views/lib/views/checkbox.js <ide> import View from "ember-views/views/view"; <ide> @namespace Ember <ide> @extends Ember.View <ide> */ <add>// 2.0TODO: Subclass Component rather than View <ide> export default View.extend({ <ide> instrumentDisplay: '{{input type="checkbox"}}', <ide>
1
Javascript
Javascript
update jshint plugin
67afe3bf78d4a704b02603d800a6e2a0f904b8fc
<ide><path>Gruntfile.js <ide> module.exports = function(grunt) { <ide> nodeunit : { <ide> all : ["test/**/*.js"] <ide> }, <del> lint : { <del> files: [ <del> 'moment.js', <del> 'lang/**/*.js' <del> ] <del> }, <ide> jshint: { <add> all: ["Gruntfile.js", "moment.js", "lang/**/*.js"], <ide> options: { <ide> "node" : true, <ide> "es5" : true,
1
Python
Python
add ftpshook class
addfe48086fbb4aa057dfc53818294decdd940d1
<ide><path>airflow/contrib/hooks/ftp_hook.py <ide> def get_mod_time(self, path): <ide> conn = self.get_conn() <ide> ftp_mdtm = conn.sendcmd('MDTM ' + path) <ide> return datetime.datetime.strptime(ftp_mdtm[4:], '%Y%m%d%H%M%S') <add> <add> <add>class FTPSHook(FTPHook): <add> <add> def get_conn(self): <add> """ <add> Returns a FTPS connection object <add> """ <add> if self.conn is None: <add> params = self.get_connection(self.ftp_conn_id) <add> self.conn = ftplib.FTP_TLS( <add> params.host, params.login, params.password <add> ) <add> return self.conn
1
Ruby
Ruby
fix tests for sqlite3adapter
d42b60a411c09dd9b69942dabbcdba6a05f259e8
<ide><path>activerecord/lib/active_record/validations/uniqueness.rb <ide> module ClassMethods <ide> # The following bundled adapters throw the ActiveRecord::RecordNotUnique exception: <ide> # * ActiveRecord::ConnectionAdapters::MysqlAdapter <ide> # * ActiveRecord::ConnectionAdapters::Mysql2Adapter <del> # * ActiveRecord::ConnectionAdapters::SQLiteAdapter <ide> # * ActiveRecord::ConnectionAdapters::SQLite3Adapter <ide> # * ActiveRecord::ConnectionAdapters::PostgreSQLAdapter <ide> # <ide><path>activerecord/test/cases/adapters/sqlite3/quoting_test.rb <ide> <ide> module ActiveRecord <ide> module ConnectionAdapters <del> class SQLiteAdapter <add> class SQLite3Adapter <ide> class QuotingTest < ActiveRecord::TestCase <ide> def setup <ide> @conn = Base.sqlite3_connection :database => ':memory:', <ide><path>activerecord/test/cases/base_test.rb <ide> def test_preserving_time_objects <ide> ) <ide> <ide> # For adapters which support microsecond resolution. <del> if current_adapter?(:PostgreSQLAdapter) || current_adapter?(:SQLiteAdapter) <add> if current_adapter?(:PostgreSQLAdapter) || current_adapter?(:SQLite3Adapter) <ide> assert_equal 11, Topic.find(1).written_on.sec <ide> assert_equal 223300, Topic.find(1).written_on.usec <ide> assert_equal 9900, Topic.find(2).written_on.usec <ide><path>activerecord/test/cases/helper.rb <ide> def current_adapter?(*types) <ide> end <ide> <ide> def in_memory_db? <del> current_adapter?(:SQLiteAdapter) && <add> current_adapter?(:SQLite3Adapter) && <ide> ActiveRecord::Base.connection_pool.spec.config[:database] == ":memory:" <ide> end <ide>
4
PHP
PHP
fix error in comment
11b9f522398efd0b95de805082736471a0992f3c
<ide><path>laravel/lang.php <ide> public static function has($key, $language = null) <ide> * $line = Lang::line('validation.required')->get('sp'); <ide> * <ide> * // Return a default value if the line doesn't exist <del> * $line = Lang::line('validation.required', null, 'Default'); <add> * $line = Lang::line('validation.required')->get(null, 'Default'); <ide> * </code> <ide> * <ide> * @param string $language <ide> public function __toString() <ide> return (string) $this->get(); <ide> } <ide> <del>} <ide>\ No newline at end of file <add>}
1
PHP
PHP
apply fixes from styleci
73f7cd4772584bcb5dc297c9350a722d26f1248a
<ide><path>src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php <ide> public function handle() <ide> $executions[] = $execution = new Process([ <ide> PHP_BINARY, <ide> defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', <del> 'schedule:run' <add> 'schedule:run', <ide> ]); <ide> <ide> $execution->start();
1
Text
Text
add v3.11.0-beta.1 to changelog
3ef8521abb10cab42587d8bf058bd3035acb7228
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.11.0-beta.1 (May 13, 2019) <add> <add>- [#17842](https://github.com/emberjs/ember.js/pull/17842) / [#17901](https://github.com/emberjs/ember.js/pull/17901) [FEATURE] Implement the [Forwarding Element Modifiers with "Splattributes" RFC](https://github.com/emberjs/rfcs/blob/master/text/0435-modifier-splattributes.md). <add>- [#17941](https://github.com/emberjs/ember.js/pull/17941) / [#17961](https://github.com/emberjs/ember.js/pull/17961) [FEATURE] Implement the [{{fn}} rfc](https://github.com/emberjs/rfcs/blob/master/text/0470-fn-helper.md). <add>- [#17960](https://github.com/emberjs/ember.js/pull/17960) [FEATURE] Implement the [{{on}} modifier RFC](https://github.com/emberjs/rfcs/blob/master/text/0471-on-modifier.md) <add>- [#17858](https://github.com/emberjs/ember.js/pull/17858) [FEATURE] Implement the [Inject Parameter Normalization RFC](https://github.com/emberjs/rfcs/blob/master/text/0451-injection-parameter-normalization.md). <add>- [#17910](https://github.com/emberjs/ember.js/pull/17910) [DEPRECATION] Add deprecation for Function.prototype extensions. <add>- [#17845](https://github.com/emberjs/ember.js/pull/17845) [CLEANUP] Removes various deprecated APIs <add>- [#17843](https://github.com/emberjs/ember.js/pull/17843) [CLEANUP] Remove deprecated intimate apis in the router <add>- [#17940](https://github.com/emberjs/ember.js/pull/17940) [CLEANUP] Remove `sync` queue from @ember/runloop. <add>- [#18026](https://github.com/emberjs/ember.js/pull/18026) Enabling featured discussed in 2019-05-03 core team meeting. <add> <add> <ide> ### v3.10.0 (May 13, 2019) <ide> <ide> - [#17836](https://github.com/emberjs/ember.js/pull/17836) [BREAKING] Explicitly drop support for Node 6
1
Javascript
Javascript
support more properties for image maps
5b17e757070cc8ee4ffb7cb064195588db75e4e6
<ide><path>src/browser/ui/dom/HTMLDOMPropertyConfig.js <ide> var HTMLDOMPropertyConfig = { <ide> contentEditable: null, <ide> contextMenu: MUST_USE_ATTRIBUTE, <ide> controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <add> coords: null, <ide> crossOrigin: null, <ide> data: null, // For `<object />` acts as `src`. <ide> dateTime: MUST_USE_ATTRIBUTE, <ide> var HTMLDOMPropertyConfig = { <ide> scrollTop: MUST_USE_PROPERTY, <ide> seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, <ide> selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, <add> shape: null, <ide> size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, <ide> span: HAS_POSITIVE_NUMERIC_VALUE, <ide> spellCheck: null, <ide> var HTMLDOMPropertyConfig = { <ide> target: null, <ide> title: null, <ide> type: null, <add> useMap: null, <ide> value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, <ide> width: MUST_USE_ATTRIBUTE, <ide> wmode: MUST_USE_ATTRIBUTE, <ide><path>vendor/fbtransform/transforms/__tests__/react-displayName-test.js <add>/** <add> * Copyright 2004-present Facebook. All Rights Reserved. <add> * <add> * @emails jeffmo@fb.com <add> */ <add>"use strict"; <add> <add>require('mock-modules').autoMockOff(); <add> <add>var transformAll = require('../../syntax.js').transformAll; <add> <add>function transform(source) { <add> return transformAll(source, {}, ['allocate']); <add>} <add> <add>describe('react displayName jsx', function() { <add> <add> it('should only inject displayName if missing', function() { <add> var code = [ <add> '/** @jsx React.DOM */', <add> '"use strict";', <add> 'var Whateva = React.createClass({', <add> ' displayName: \'Whateva\',', <add> ' render: function() {', <add> ' return <div className=\'whateva\'>...whateva.</div>;', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> var result = [ <add> '/** @jsx React.DOM */', <add> '"use strict";', <add> 'var Whateva = React.createClass({', <add> ' displayName: \'Whateva\',', <add> ' render: function() {', <add> ' return React.DOM.div({className: "whateva"}, "...whateva.");', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> expect(transform(code).code).toEqual(result); <add> }); <add> <add> it('should inject displayName in simple assignment', () => { <add> var code = [ <add> '/** @jsx React.DOM */', <add> 'var Component = React.createClass({', <add> ' render: function() {', <add> ' return <div/>;', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> var result = [ <add> '/** @jsx React.DOM */', <add> 'var Component = React.createClass({displayName: \'Component\',', <add> ' render: function() {', <add> ' return React.DOM.div(null);', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> expect(transform(code).code).toEqual(result); <add> }); <add> <add> it('should inject displayName in simple assignment without var', () => { <add> var code = [ <add> '/** @jsx React.DOM */', <add> 'var Component;', <add> 'Component = React.createClass({', <add> ' render: function() {', <add> ' return <div/>;', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> var result = [ <add> '/** @jsx React.DOM */', <add> 'var Component;', <add> 'Component = React.createClass({displayName: \'Component\',', <add> ' render: function() {', <add> ' return React.DOM.div(null);', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> expect(transform(code).code).toEqual(result); <add> }); <add> <add> it('should inject displayName in property assignment', () => { <add> var code = [ <add> '/** @jsx React.DOM */', <add> 'exports.Component = React.createClass({', <add> ' render: function() {', <add> ' return <div/>;', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> var result = [ <add> '/** @jsx React.DOM */', <add> 'exports.Component = React.createClass({displayName: \'Component\',', <add> ' render: function() {', <add> ' return React.DOM.div(null);', <add> ' }', <add> '});' <add> ].join('\n'); <add> <add> expect(transform(code).code).toEqual(result); <add> }); <add> <add> it('should inject displayName in object declaration', () => { <add> var code = [ <add> '/** @jsx React.DOM */', <add> 'exports = {', <add> ' Component: React.createClass({', <add> ' render: function() {', <add> ' return <div/>;', <add> ' }', <add> ' })', <add> '};' <add> ].join('\n'); <add> <add> var result = [ <add> '/** @jsx React.DOM */', <add> 'exports = {', <add> ' Component: React.createClass({displayName: \'Component\',', <add> ' render: function() {', <add> ' return React.DOM.div(null);', <add> ' }', <add> ' })', <add> '};' <add> ].join('\n'); <add> <add> expect(transform(code).code).toEqual(result); <add> }); <add> <add>});
2
PHP
PHP
update use of getmock() in testcase
d29af6dd55ff62f9afde0454a5dc8377329c3666
<ide><path>src/TestSuite/TestCase.php <ide> public function getMockForModel($alias, array $methods = [], array $options = [] <ide> $options += ['alias' => $baseClass, 'connection' => $connection]; <ide> $options += TableRegistry::config($alias); <ide> <del> $mock = $this->getMock($options['className'], $methods, [$options]); <add> $mock = $this->getMockBuilder($options['className']) <add> ->setMethods($methods) <add> ->setConstructorArgs([$options]) <add> ->getMock(); <ide> <ide> if (empty($options['entityClass']) && $mock->entityClass() === '\Cake\ORM\Entity') { <ide> $parts = explode('\\', $options['className']);
1
Text
Text
add caveat on pch errors
a9d8d1cab6d0196604e7ffcb4670ee675b093d69
<ide><path>docs/KnownIssues.md <ide> React Native Android depends on [Fresco](https://github.com/facebook/fresco) for <ide> <ide> Try running `react-native init` with `--verbose` and see [#2797](https://github.com/facebook/react-native/issues/2797) for common causes. <ide> <add>### Moving folder after iOS build <add> <add>Moving a React Native project after it has been compiled in iOS can sometimes cause errors with pre-compiled headers e.g. `mv MyAwesomeProject/ newDir/MyAwesomeProject`. This results in a message resembling: `error: PCH was compiled with module cache path ...`. If you were compiling using Xcode you can [hold option when you clean the build](http://stackoverflow.com/a/15463219/3110982). If you're using `react-native run-ios` you can manually clean the header cache by deleting the contents of your ModuleCache folder. e.g. `rm -rf ios/build/ModuleCache/*` <add> <ide> ### Text Input Border <ide> <ide> The text input has by default a border at the bottom of its view. This border has its padding set by the background image provided by the system, and it cannot be changed. Solutions to avoid this is to either not set height explicitly, case in which the system will take care of displaying the border in the correct position, or to not display the border by setting underlineColorAndroid to transparent.
1
Text
Text
fix documentation typos
7da5784b10a9f085af98984e6e69e733e55ddbf5
<ide><path>docs/installation/linux/centos.md <ide> display your kernel version: <ide> $ uname -r <ide> 3.10.0-229.el7.x86_64 <ide> <del>Finally, is it recommended that you fully update your system. Please keep in <add>Finally, it is recommended that you fully update your system. Please keep in <ide> mind that your system should be fully patched to fix any potential kernel bugs. <ide> Any reported kernel bugs may have already been fixed on the latest kernel <ide> packages. <ide><path>docs/userguide/networking/default_network/configure-dns.md <ide> Four different options affect container domain name services. <ide> Using this option as you <code>run</code> a container gives the new <ide> container's <code>/etc/hosts</code> an extra entry named <ide> <code>ALIAS</code> that points to the IP address of the container <del> identified by <code>CONTAINER_NAME_or_ID<c/ode>. This lets processes <add> identified by <code>CONTAINER_NAME_or_ID</code>. This lets processes <ide> inside the new container connect to the hostname <code>ALIAS</code> <ide> without having to know its IP. The <code>--link=</code> option is <ide> discussed in more detail below. Because Docker may assign a different IP
2
Python
Python
remove debugging log
b0ba85025c6c719f31a4dc6065120dc3693cd08e
<ide><path>official/modeling/hyperparams/base_config.py <ide> def _get_subconfig_type(cls, k) -> Type[params_dict.ParamsDict]: <ide> return subconfig_type <ide> <ide> def __post_init__(self, default_params, restrictions, *args, **kwargs): <del> logging.error('DEBUG before init %r', type(self)) <ide> super().__init__(default_params=default_params, <ide> restrictions=restrictions, <ide> *args, <ide> **kwargs) <del> logging.error('DEBUG after init %r', type(self)) <ide> <ide> def _set(self, k, v): <ide> """Overrides same method in ParamsDict.
1
Python
Python
fix a bug in case of date equality
8eabc502af69e8c63e16e389bd51ea31a12fedc1
<ide><path>airflow/macros/hive.py <ide> def _closest_date(target_dt, date_list, before_target=None): <ide> :returns: The closest date <ide> :rtype: datetime.date or None <ide> ''' <del> fb = lambda d: d - target_dt if d > target_dt else datetime.timedelta.max <del> fa = lambda d: d - target_dt if d < target_dt else datetime.timedelta.min <add> fb = lambda d: d - target_dt if d >= target_dt else datetime.timedelta.max <add> fa = lambda d: d - target_dt if d <= target_dt else datetime.timedelta.min <ide> fnone = lambda d: target_dt - d if d < target_dt else d - target_dt <ide> if before_target is None: <ide> return min(date_list, key=fnone).date() <ide> def closest_ds_partition( <ide> from airflow.hooks import HiveMetastoreHook <ide> if '.' in table: <ide> schema, table = table.split('.') <del> target_dt = datetime.datetime.strptime(ds, '%Y-%m-%d') <ide> hh = HiveMetastoreHook(metastore_conn_id=metastore_conn_id) <ide> partitions = hh.get_partitions(schema=schema, table_name=table) <del> parts = [ <del> datetime.datetime.strptime(p.values()[0], '%Y-%m-%d') <del> for p in partitions] <del> if partitions is None or partitions == []: <add> if not partitions: <ide> return None <del> if ds in partitions: <add> part_vals = [p.values()[0] for p in partitions] <add> if ds in part_vals: <ide> return ds <ide> else: <add> parts = [datetime.datetime.strptime(pv, '%Y-%m-%d') <add> for pv in part_vals] <add> target_dt = datetime.datetime.strptime(ds, '%Y-%m-%d') <ide> closest_ds = _closest_date(target_dt, parts, before_target=before) <ide> return closest_ds.isoformat()
1
Python
Python
fix train.py for 1.0
080d29e092d6032d65541d78da53fb6122d1f71d
<ide><path>spacy/train.py <ide> def __init__(self, nlp, gold_tuples): <ide> self.gold_tuples = gold_tuples <ide> <ide> def epochs(self, nr_epoch, augment_data=None, gold_preproc=False): <del> def _epoch(): <del> for raw_text, paragraph_tuples in self.gold_tuples: <add> cached_golds = {} <add> def _epoch(indices): <add> for i in indices: <add> raw_text, paragraph_tuples = self.gold_tuples[i] <ide> if gold_preproc: <ide> raw_text = None <ide> else: <ide> paragraph_tuples = merge_sents(paragraph_tuples) <del> if augment_data is not None: <add> if augment_data is None: <add> docs = self.make_docs(raw_text, paragraph_tuples) <add> if i in cached_golds: <add> golds = cached_golds[i] <add> else: <add> golds = self.make_golds(docs, paragraph_tuples) <add> else: <ide> raw_text, paragraph_tuples = augment_data(raw_text, paragraph_tuples) <del> docs = self.make_docs(raw_text, paragraph_tuples) <del> golds = self.make_golds(docs, paragraph_tuples) <add> docs = self.make_docs(raw_text, paragraph_tuples) <add> golds = self.make_golds(docs, paragraph_tuples) <ide> for doc, gold in zip(docs, golds): <ide> yield doc, gold <ide> <add> indices = list(range(len(self.gold_tuples))) <ide> for itn in range(nr_epoch): <del> random.shuffle(self.gold_tuples) <del> yield _epoch() <add> random.shuffle(indices) <add> yield _epoch(indices) <ide> <ide> def update(self, doc, gold): <ide> for process in self.nlp.pipeline: <ide> def evaluate(self, dev_sents, gold_preproc=False): <ide> docs = self.make_docs(raw_text, paragraph_tuples) <ide> golds = self.make_golds(docs, paragraph_tuples) <ide> for doc, gold in zip(docs, golds): <del> for process in self.nlp.pipeline[1:]: <add> for process in self.nlp.pipeline: <ide> process(doc) <ide> scorer.score(doc, gold) <ide> return scorer <ide> def make_docs(self, raw_text, paragraph_tuples): <ide> <ide> def make_golds(self, docs, paragraph_tuples): <ide> if len(docs) == 1: <del> return [GoldParse(docs[0], sent_tuples[0]) <add> return [GoldParse.from_annot_tuples(docs[0], sent_tuples[0]) <ide> for sent_tuples in paragraph_tuples] <ide> else: <del> return [GoldParse(doc, sent_tuples[0]) <add> return [GoldParse.from_annot_tuples(doc, sent_tuples[0]) <ide> for doc, sent_tuples in zip(docs, paragraph_tuples)]
1
Text
Text
add more info to the scrum guide and fix typos
1fefb703ebb164067ebe56c93b169fda46ec2e94
<ide><path>guide/english/agile/scrum/index.md <ide> The Scrum process is made up of the following items: <ide> - Product Backlog: It is the list of tasks a Team is supposed to finish within the current Sprint. It is decided by the Product Owner, in agreement with the Management as well as Delivery Team. <ide> <ide> ## Roles <del>- **Product Owner(PO)**: The ONLY Accountable person to the Management. PO decides what goes in or out of the Product Backlog. <del>- **Delivery Team**: They are required to work in accordance with the tasks set by their PO in the product backlog and deliver the required deliverable at the end of the sprint. <del>- **Scrum Masters**: - Scrum Master's has to strictly adhere to Scrum Guide and make the team understand the need to adhere to Scrum guide when following Scrum. It is a Scrum Master's job to ensure all Scrum ceremonies being conducted on time and participated by all the required people as per the scrum guide. The SM has to ensure that the Daily Scrum is conducted regularly and actively participated by the team. <add>- **Product Owner(PO)**: The ONLY accountable person to the Management (or any stakeholders). The PO decides what goes in or out of the Product Backlog, for making decisions in a timely manner, and for providing information in a timely manner. <add>- **Delivery Team**: The Delivery Team is required to work in accordance with the tasks set by their PO in the product backlog and deliver the required deliverable at the end of the sprint. <add>- **Scrum Masters(SM)**: - Scrum Masters are the Team Lead and have to strictly adhere to the Scrum Guide and make the team understand the need to adhere to it as well. It is the Scrum Master's job to ensure that all Scrum ceremonies are being conducted on time and participated by all the required people as per the Scrum Guide. The SM has to ensure that the Daily Scrum is conducted regularly and actively participated by the team. <add> <ide> <ide> #### More Information: <ide> <del>There are several online tools that can be used to do scrum for your team: <add>There are several online tools that can be used to implement Scrum on your team: <ide> <ide> - [Scrum Do](https://www.scrumdo.com/) <ide> - [Asana](http://www.asana.com) <ide> Here are some more resources: <ide> - [Why Scrum](https://www.scrumalliance.org/why-scrum) from The Scrum Alliance <ide> - [Scrum Guide](http://www.scrumguides.org/scrum-guide.html) from Scrum.org <ide> - [Doing vs Being Agile](http://agilitrix.com/2016/04/doing-agile-vs-being-agile/) <add>- [Roles on Agile Teams: From Small to Large Teams](http://www.ambysoft.com/essays/agileRoles.html) <ide> - [YouTube - Introduction to Scrum](https://www.youtube.com/watch?v=9TycLR0TqFA) <add>
1
Text
Text
add links to pr template
a2df178554814082d95d9b3b6d94af0b1fa7a30f
<ide><path>.github/pull_request_template.md <ide> Choose the right checklist for the change that you're making: <ide> <ide> - [ ] Related issues linked using `fixes #number` <ide> - [ ] Integration tests added <del>- [ ] Errors have a helpful link attached, see `contributing.md` <add>- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) <ide> <ide> ## Feature <ide> <ide> - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. <ide> - [ ] Related issues linked using `fixes #number` <del>- [ ] Integration tests added <add>- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added <ide> - [ ] Documentation added <ide> - [ ] Telemetry added. In case of a feature if it's used or not. <del>- [ ] Errors have a helpful link attached, see `contributing.md` <add>- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) <ide> <ide> ## Documentation / Examples <ide>
1
Java
Java
prevent npe on themedreactcontext
f1b5fe1d3ea49294d8c89accfa27d76a1a97ccea
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> public boolean getThemeData(int surfaceId, float[] defaultTextInputPadding) { <ide> SurfaceMountingManager surfaceMountingManager = <ide> mMountingManager.getSurfaceManagerEnforced(surfaceId, "getThemeData"); <ide> ThemedReactContext themedReactContext = surfaceMountingManager.getContext(); <add> <add> if (themedReactContext == null) { <add> FLog.w(TAG, "\"themedReactContext\" is null when call \"getThemeData\""); <add> return false; <add> } <ide> float[] defaultTextInputPaddingForTheme = <ide> UIManagerHelper.getDefaultTextInputPadding(themedReactContext); <ide> defaultTextInputPadding[0] = defaultTextInputPaddingForTheme[PADDING_START_INDEX];
1
Go
Go
migrate some update restart tests to api tests
5b65cee9150b343c97606adc525cf680fb330642
<ide><path>integration-cli/docker_cli_update_test.go <del>package main <del> <del>import ( <del> "strings" <del> "time" <del> <del> "github.com/docker/docker/integration-cli/checker" <del> "github.com/docker/docker/integration-cli/cli" <del> "github.com/go-check/check" <del> "github.com/gotestyourself/gotestyourself/icmd" <del>) <del> <del>func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) { <del> out := cli.DockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "sh", "-c", "sleep 1 && false").Combined() <del> timeout := 60 * time.Second <del> if testEnv.OSType == "windows" { <del> timeout = 180 * time.Second <del> } <del> <del> id := strings.TrimSpace(string(out)) <del> <del> // update restart policy to on-failure:5 <del> cli.DockerCmd(c, "update", "--restart=on-failure:5", id) <del> <del> cli.WaitExited(c, id, timeout) <del> <del> count := inspectField(c, id, "RestartCount") <del> c.Assert(count, checker.Equals, "5") <del> <del> maximumRetryCount := inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount") <del> c.Assert(maximumRetryCount, checker.Equals, "5") <del>} <del> <del>func (s *DockerSuite) TestUpdateRestartWithAutoRemoveFlag(c *check.C) { <del> out := runSleepingContainer(c, "--rm") <del> id := strings.TrimSpace(out) <del> <del> // update restart policy for an AutoRemove container <del> cli.Docker(cli.Args("update", "--restart=always", id)).Assert(c, icmd.Expected{ <del> ExitCode: 1, <del> Err: "Restart policy cannot be updated because AutoRemove is enabled for the container", <del> }) <del>} <ide><path>integration/container/update_test.go <add>package container // import "github.com/docker/docker/integration/container" <add> <add>import ( <add> "context" <add> "testing" <add> "time" <add> <add> containertypes "github.com/docker/docker/api/types/container" <add> "github.com/docker/docker/integration/internal/container" <add> "github.com/docker/docker/integration/internal/request" <add> "github.com/docker/docker/internal/testutil" <add> "github.com/gotestyourself/gotestyourself/poll" <add> "github.com/stretchr/testify/assert" <add> "github.com/stretchr/testify/require" <add>) <add> <add>func TestUpdateRestartPolicy(t *testing.T) { <add> defer setupTest(t)() <add> client := request.NewAPIClient(t) <add> ctx := context.Background() <add> <add> cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) { <add> c.HostConfig.RestartPolicy = containertypes.RestartPolicy{ <add> Name: "on-failure", <add> MaximumRetryCount: 3, <add> } <add> }) <add> <add> _, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{ <add> RestartPolicy: containertypes.RestartPolicy{ <add> Name: "on-failure", <add> MaximumRetryCount: 5, <add> }, <add> }) <add> require.NoError(t, err) <add> <add> timeout := 60 * time.Second <add> if testEnv.OSType == "windows" { <add> timeout = 180 * time.Second <add> } <add> <add> poll.WaitOn(t, containerIsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(timeout)) <add> <add> inspect, err := client.ContainerInspect(ctx, cID) <add> require.NoError(t, err) <add> assert.Equal(t, inspect.RestartCount, 5) <add> assert.Equal(t, inspect.HostConfig.RestartPolicy.MaximumRetryCount, 5) <add>} <add> <add>func TestUpdateRestartWithAutoRemove(t *testing.T) { <add> defer setupTest(t)() <add> client := request.NewAPIClient(t) <add> ctx := context.Background() <add> <add> cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) { <add> c.HostConfig.AutoRemove = true <add> }) <add> <add> _, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{ <add> RestartPolicy: containertypes.RestartPolicy{ <add> Name: "always", <add> }, <add> }) <add> testutil.ErrorContains(t, err, "Restart policy cannot be updated because AutoRemove is enabled for the container") <add>}
2
Ruby
Ruby
remove unused gsub_app_file method from bukkit
644730981765ca1081b764a3a6dde93845430697
<ide><path>railties/test/isolation/abstract_unit.rb <ide> def app_file(path, contents) <ide> end <ide> end <ide> <del> def gsub_app_file(path, regexp, *args, &block) <del> path = "#{app_path}/#{path}" <del> content = File.read(path).gsub(regexp, *args, &block) <del> File.open(path, 'wb') { |f| f.write(content) } <del> end <del> <ide> def remove_file(path) <ide> FileUtils.rm_rf "#{app_path}/#{path}" <ide> end
1
Javascript
Javascript
do this different
6227203de7b9ddd84b9c12c67e6d94b2fc473d1d
<ide><path>src/main-process/parse-command-line.js <ide> module.exports = function parseCommandLine (processArgs) { <ide> args = { <ide> urlHandler: true, <ide> 'url-handler': true, <del> _: args._ <add> _: args._.slice(0, 1) <ide> } <ide> } <ide> <ide> module.exports = function parseCommandLine (processArgs) { <ide> } <ide> } <ide> <del> // When performing as a URL handler, only accept one URL and no paths <del> if (args.urlHandler) { <del> pathsToOpen = [] <del> if (urlsToOpen.length > 1) { <del> urlsToOpen.length = 1 <del> } <del> } <del> <ide> if (args['resource-path']) { <ide> devMode = true <ide> devResourcePath = args['resource-path']
1
Text
Text
clearify callback text in the tutorial
5ffd1db5706a223b49bebcbdcc0ff51abfd06981
<ide><path>docs/docs/tutorial.md <ide> var CommentBox = React.createClass({ <ide> }); <ide> ``` <ide> <del>Let's call the callback from the `CommentForm` when the user submits the form: <add>Now that `CommentBox` has made the callback available to `CommentForm` via the `onCommentSubmit` prop, the `CommentForm` can call the callback when the user submits the form: <ide> <ide> ```javascript{19} <ide> // tutorial19.js
1
PHP
PHP
use qualified column names in pivot query
006ba38124df6a8a651546a0301d604665b394b7
<ide><path>src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php <ide> public function detach($ids = null, $touch = true) <ide> return 0; <ide> } <ide> <del> $query->whereIn($this->relatedPivotKey, (array) $ids); <add> $query->whereIn($this->getQualifiedRelatedPivotKeyName(), (array) $ids); <ide> } <ide> <ide> // Once we have all of the conditions set on the statement, we are ready <ide> public function newPivotQuery() <ide> $query->whereIn(...$arguments); <ide> } <ide> <del> return $query->where($this->foreignPivotKey, $this->parent->{$this->parentKey}); <add> return $query->where($this->getQualifiedForeignPivotKeyName(), $this->parent->{$this->parentKey}); <ide> } <ide> <ide> /** <ide><path>tests/Database/DatabaseEloquentMorphToManyTest.php <ide> public function testDetachRemovesPivotTableRecord() <ide> $relation = $this->getMockBuilder(MorphToMany::class)->setMethods(['touchIfTouching'])->setConstructorArgs($this->getRelationArguments())->getMock(); <ide> $query = m::mock(stdClass::class); <ide> $query->shouldReceive('from')->once()->with('taggables')->andReturn($query); <del> $query->shouldReceive('where')->once()->with('taggable_id', 1)->andReturn($query); <add> $query->shouldReceive('where')->once()->with('taggables.taggable_id', 1)->andReturn($query); <ide> $query->shouldReceive('where')->once()->with('taggable_type', get_class($relation->getParent()))->andReturn($query); <del> $query->shouldReceive('whereIn')->once()->with('tag_id', [1, 2, 3]); <add> $query->shouldReceive('whereIn')->once()->with('taggables.tag_id', [1, 2, 3]); <ide> $query->shouldReceive('delete')->once()->andReturn(true); <ide> $relation->getQuery()->shouldReceive('getQuery')->andReturn($mockQueryBuilder = m::mock(stdClass::class)); <ide> $mockQueryBuilder->shouldReceive('newQuery')->once()->andReturn($query); <ide> public function testDetachMethodClearsAllPivotRecordsWhenNoIDsAreGiven() <ide> $relation = $this->getMockBuilder(MorphToMany::class)->setMethods(['touchIfTouching'])->setConstructorArgs($this->getRelationArguments())->getMock(); <ide> $query = m::mock(stdClass::class); <ide> $query->shouldReceive('from')->once()->with('taggables')->andReturn($query); <del> $query->shouldReceive('where')->once()->with('taggable_id', 1)->andReturn($query); <add> $query->shouldReceive('where')->once()->with('taggables.taggable_id', 1)->andReturn($query); <ide> $query->shouldReceive('where')->once()->with('taggable_type', get_class($relation->getParent()))->andReturn($query); <ide> $query->shouldReceive('whereIn')->never(); <ide> $query->shouldReceive('delete')->once()->andReturn(true);
2
Java
Java
improve configuration changes in guavacachemanager
d47c5433cb2480df285b7a0901372615852d526e
<ide><path>spring-context-support/src/main/java/org/springframework/cache/guava/GuavaCacheManager.java <ide> /* <del> * Copyright 2002-2013 the original author or authors. <add> * Copyright 2002-2014 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.util.Arrays; <ide> import java.util.Collection; <ide> import java.util.Collections; <add>import java.util.Map; <ide> import java.util.concurrent.ConcurrentHashMap; <ide> import java.util.concurrent.ConcurrentMap; <ide> <ide> import org.springframework.cache.Cache; <ide> import org.springframework.cache.CacheManager; <ide> import org.springframework.util.Assert; <add>import org.springframework.util.ObjectUtils; <ide> <ide> /** <ide> * {@link CacheManager} implementation that lazily builds {@link GuavaCache} <ide> * <p>Requires Google Guava 12.0 or higher. <ide> * <ide> * @author Juergen Hoeller <add> * @author Stephane Nicoll <ide> * @since 4.0 <ide> * @see GuavaCache <ide> */ <ide> public GuavaCacheManager(String... cacheNames) { <ide> * Specify the set of cache names for this CacheManager's 'static' mode. <ide> * <p>The number of caches and their names will be fixed after a call to this method, <ide> * with no creation of further cache regions at runtime. <add> * <p>Calling this with a {@code null} collection argument resets the <add> * mode to 'dynamic', allowing for further creation of caches again. <ide> */ <ide> public void setCacheNames(Collection<String> cacheNames) { <ide> if (cacheNames != null) { <ide> public void setCacheNames(Collection<String> cacheNames) { <ide> } <ide> this.dynamic = false; <ide> } <add> else { <add> this.dynamic = true; <add> } <ide> } <ide> <ide> /** <ide> public void setCacheNames(Collection<String> cacheNames) { <ide> */ <ide> public void setCacheBuilder(CacheBuilder<Object, Object> cacheBuilder) { <ide> Assert.notNull(cacheBuilder, "CacheBuilder must not be null"); <del> this.cacheBuilder = cacheBuilder; <add> doSetCacheBuilder(cacheBuilder); <ide> } <ide> <ide> /** <ide> public void setCacheBuilder(CacheBuilder<Object, Object> cacheBuilder) { <ide> * @see com.google.common.cache.CacheBuilder#from(CacheBuilderSpec) <ide> */ <ide> public void setCacheBuilderSpec(CacheBuilderSpec cacheBuilderSpec) { <del> this.cacheBuilder = CacheBuilder.from(cacheBuilderSpec); <add> doSetCacheBuilder(CacheBuilder.from(cacheBuilderSpec)); <ide> } <ide> <ide> /** <ide> public void setCacheBuilderSpec(CacheBuilderSpec cacheBuilderSpec) { <ide> * @see com.google.common.cache.CacheBuilder#from(String) <ide> */ <ide> public void setCacheSpecification(String cacheSpecification) { <del> this.cacheBuilder = CacheBuilder.from(cacheSpecification); <add> doSetCacheBuilder(CacheBuilder.from(cacheSpecification)); <ide> } <ide> <ide> /** <ide> public void setCacheSpecification(String cacheSpecification) { <ide> * @see com.google.common.cache.LoadingCache <ide> */ <ide> public void setCacheLoader(CacheLoader<Object, Object> cacheLoader) { <del> this.cacheLoader = cacheLoader; <add> if (!ObjectUtils.nullSafeEquals(this.cacheLoader, cacheLoader)) { <add> this.cacheLoader = cacheLoader; <add> refreshKnownCaches(); <add> } <ide> } <ide> <ide> /** <ide> public void setCacheLoader(CacheLoader<Object, Object> cacheLoader) { <ide> * An internal holder object will be used to store user-level {@code null}s. <ide> */ <ide> public void setAllowNullValues(boolean allowNullValues) { <del> this.allowNullValues = allowNullValues; <add> if (this.allowNullValues != allowNullValues) { <add> this.allowNullValues = allowNullValues; <add> refreshKnownCaches(); <add> } <ide> } <ide> <ide> /** <ide> protected com.google.common.cache.Cache<Object, Object> createNativeGuavaCache(S <ide> } <ide> } <ide> <add> private void doSetCacheBuilder(CacheBuilder<Object, Object> cacheBuilder) { <add> if (!ObjectUtils.nullSafeEquals(this.cacheBuilder, cacheBuilder)) { <add> this.cacheBuilder = cacheBuilder; <add> refreshKnownCaches(); <add> } <add> } <add> <add> /** <add> * Create the known caches again with the current state of this manager. <add> */ <add> private void refreshKnownCaches() { <add> for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) { <add> entry.setValue(createGuavaCache(entry.getKey())); <add> } <add> } <add> <ide> } <ide><path>spring-context-support/src/test/java/org/springframework/cache/guava/GuavaCacheManagerTests.java <ide> /* <del> * Copyright 2002-2013 the original author or authors. <add> * Copyright 2002-2014 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.cache.guava; <ide> <add>import com.google.common.cache.CacheBuilder; <add>import com.google.common.cache.CacheLoader; <ide> import org.junit.Test; <ide> <ide> import org.springframework.cache.Cache; <ide> import org.springframework.cache.CacheManager; <ide> <ide> import static org.junit.Assert.*; <add>import static org.mockito.Mockito.mock; <ide> <ide> /** <ide> * @author Juergen Hoeller <add> * @author Stephane Nicoll <ide> */ <ide> public class GuavaCacheManagerTests { <ide> <ide> public void testDynamicMode() { <ide> <ide> @Test <ide> public void testStaticMode() { <del> CacheManager cm = new GuavaCacheManager("c1", "c2"); <add> GuavaCacheManager cm = new GuavaCacheManager("c1", "c2"); <ide> Cache cache1 = cm.getCache("c1"); <ide> assertTrue(cache1 instanceof GuavaCache); <ide> Cache cache1again = cm.getCache("c1"); <ide> public void testStaticMode() { <ide> assertNull(cache1.get("key3").get()); <ide> cache1.evict("key3"); <ide> assertNull(cache1.get("key3")); <add> <add> cm.setAllowNullValues(false); <add> Cache cache1x = cm.getCache("c1"); <add> assertTrue(cache1x instanceof GuavaCache); <add> assertTrue(cache1x != cache1); <add> Cache cache2x = cm.getCache("c2"); <add> assertTrue(cache2x instanceof GuavaCache); <add> assertTrue(cache2x != cache2); <add> Cache cache3x = cm.getCache("c3"); <add> assertNull(cache3x); <add> <add> cache1x.put("key1", "value1"); <add> assertEquals("value1", cache1x.get("key1").get()); <add> cache1x.put("key2", 2); <add> assertEquals(2, cache1x.get("key2").get()); <add> try { <add> cache1x.put("key3", null); <add> fail("Should have thrown NullPointerException"); <add> } <add> catch (NullPointerException ex) { <add> // expected <add> } <add> <add> cm.setAllowNullValues(true); <add> Cache cache1y = cm.getCache("c1"); <add> <add> cache1y.put("key3", null); <add> assertNull(cache1y.get("key3").get()); <add> cache1y.evict("key3"); <add> assertNull(cache1y.get("key3")); <add> } <add> <add> @Test <add> public void changeCacheSpecificationRecreateCache() { <add> GuavaCacheManager cm = new GuavaCacheManager("c1"); <add> Cache cache1 = cm.getCache("c1"); <add> <add> CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder().maximumSize(10); <add> cm.setCacheBuilder(cacheBuilder); <add> Cache cache1x = cm.getCache("c1"); <add> assertTrue(cache1x != cache1); <add> <add> cm.setCacheBuilder(cacheBuilder); // Set same instance <add> Cache cache1xx = cm.getCache("c1"); <add> assertSame(cache1x, cache1xx); <add> } <add> <add> @Test <add> public void changeCacheLoaderRecreateCache() { <add> GuavaCacheManager cm = new GuavaCacheManager("c1"); <add> Cache cache1 = cm.getCache("c1"); <add> <add> CacheLoader<Object,Object> loader = mockCacheLoader(); <add> cm.setCacheLoader(loader); <add> Cache cache1x = cm.getCache("c1"); <add> assertTrue(cache1x != cache1); <add> <add> cm.setCacheLoader(loader); // Set same instance <add> Cache cache1xx = cm.getCache("c1"); <add> assertSame(cache1x, cache1xx); <add> } <add> <add> @Test <add> public void setCacheNameNullRestoreDynamicMode() { <add> GuavaCacheManager cm = new GuavaCacheManager("c1"); <add> assertNull(cm.getCache("someCache")); <add> cm.setCacheNames(null); <add> assertNotNull(cm.getCache("someCache")); <add> } <add> <add> @SuppressWarnings("unchecked") <add> private CacheLoader<Object, Object> mockCacheLoader() { <add> return mock(CacheLoader.class); <ide> } <ide> <ide> }
2
Go
Go
fix race in test registry setup
de8ea06d7dab7c5278f84728f7e0aa69e3301ad0
<ide><path>integration-cli/docker_utils.go <ide> func setupRegistry(t *testing.T) func() { <ide> if err != nil { <ide> t.Fatal(err) <ide> } <add> <add> // Wait for registry to be ready to serve requests. <add> for i := 0; i != 5; i++ { <add> if err = reg.Ping(); err == nil { <add> break <add> } <add> time.Sleep(100 * time.Millisecond) <add> } <add> <add> if err != nil { <add> t.Fatal("Timeout waiting for test registry to become available") <add> } <add> <ide> return func() { reg.Close() } <ide> } <ide><path>integration-cli/registry.go <ide> package main <ide> import ( <ide> "fmt" <ide> "io/ioutil" <add> "net/http" <ide> "os" <ide> "os/exec" <ide> "path/filepath" <ide> http: <ide> }, nil <ide> } <ide> <add>func (t *testRegistryV2) Ping() error { <add> // We always ping through HTTP for our test registry. <add> resp, err := http.Get(fmt.Sprintf("http://%s/v2/", privateRegistryURL)) <add> if err != nil { <add> return err <add> } <add> if resp.StatusCode != 200 { <add> return fmt.Errorf("registry ping replied with an unexpected status code %s", resp.StatusCode) <add> } <add> return nil <add>} <add> <ide> func (r *testRegistryV2) Close() { <ide> r.cmd.Process.Kill() <ide> os.RemoveAll(r.dir)
2
Python
Python
fix issues with custom pagination serializers
a51bca32fd26ae954228b9026b18ebeea81ad8e2
<ide><path>rest_framework/pagination.py <ide> def to_native(self, value): <ide> return replace_query_param(url, self.page_field, page) <ide> <ide> <add>class DefaultObjectSerializer(serializers.Field): <add> """ <add> If no object serializer is specified, then this serializer will be applied <add> as the default. <add> """ <add> <add> def __init__(self, source=None, context=None): <add> # Note: Swallow context kwarg - only required for eg. ModelSerializer. <add> super(DefaultObjectSerializer, self).__init__(source=source) <add> <add> <ide> class PaginationSerializerOptions(serializers.SerializerOptions): <ide> """ <ide> An object that stores the options that may be provided to a <ide> class PaginationSerializerOptions(serializers.SerializerOptions): <ide> def __init__(self, meta): <ide> super(PaginationSerializerOptions, self).__init__(meta) <ide> self.object_serializer_class = getattr(meta, 'object_serializer_class', <del> serializers.Field) <add> DefaultObjectSerializer) <ide> <ide> <ide> class BasePaginationSerializer(serializers.Serializer): <ide> def __init__(self, *args, **kwargs): <ide> <ide> self.fields[results_field] = object_serializer(source='object_list', **context_kwarg) <ide> <del> def to_native(self, obj): <del> """ <del> Prevent default behaviour of iterating over elements, and serializing <del> each in turn. <del> """ <del> return self.convert_object(obj) <del> <ide> <ide> class PaginationSerializer(BasePaginationSerializer): <ide> """ <ide><path>rest_framework/serializers.py <ide> import datetime <ide> import types <ide> from decimal import Decimal <add>from django.core.paginator import Page <ide> from django.db import models <ide> from django.forms import widgets <ide> from django.utils.datastructures import SortedDict <ide> def to_native(self, obj): <ide> """ <ide> Serialize objects -> primitives. <ide> """ <del> if hasattr(obj, '__iter__'): <add> # Note: At the moment we have an ugly hack to determine if we should <add> # walk over iterables. At some point, serializers will require an <add> # explicit `many=True` in order to iterate over a set, and this hack <add> # will disappear. <add> if hasattr(obj, '__iter__') and not isinstance(obj, Page): <ide> return [self.convert_object(item) for item in obj] <ide> return self.convert_object(obj) <ide>
2
PHP
PHP
make addcomponent() also set the property
cd7cbe869a5fa988b7a3fc7bbe5c5e65ec6a3df8
<ide><path>src/Controller/Controller.php <ide> public function components() { <ide> } <ide> <ide> /** <del> * Add a component to the controller's registry <add> * Add a component to the controller's registry. <add> * <add> * This method will also set the component to a property. <add> * For example: <add> * <add> * `$this->addComponent('DebugKit.Toolbar');` <add> * <add> * Will result in a `Toolbar` property being set. <ide> * <ide> * @param string $name The name of the component to load. <ide> * @param array $config The config for the component. <ide> * @return \Cake\Controller\Component <ide> */ <ide> public function addComponent($name, $config = []) { <del> return $this->components()->load($name, $config); <add> list(, $prop) = pluginSplit($name); <add> $this->{$prop} = $this->components()->load($name, $config); <add> return $this->{$prop}; <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Controller/ControllerTest.php <ide> public function testAddComponent() { <ide> $controller = new TestController($request, $response); <ide> $result = $controller->addComponent('Paginator'); <ide> $this->assertInstanceOf('Cake\Controller\Component\PaginatorComponent', $result); <add> $this->assertSame($result, $controller->Paginator); <ide> <ide> $registry = $controller->components(); <ide> $this->assertTrue(isset($registry->Paginator));
2
Text
Text
add v4.9.0 to changelog
70b98dac9e0b54b498c85d68162b560580654bc9
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <del>### v4.9.0-beta.4 (November 15, 2022) <add>### v4.9.0 (November 28, 2022) <ide> <add>- [#20274](https://github.com/emberjs/ember.js/pull/20274) [BUGFIX] Add some missing types to preview types <ide> - [#20256](https://github.com/emberjs/ember.js/pull/20256) [BUGFIX] Correct types for Ember Arrays <ide> - [#20257](https://github.com/emberjs/ember.js/pull/20257) [BUGFIX] Fix types for `getOwner` and GlimmerComponent <add>- [#20233](https://github.com/emberjs/ember.js/pull/20233) [BUGFIX] Include package name in deprecation error message <add>- [#20235](https://github.com/emberjs/ember.js/pull/20235) [BUGFIX] Update `@types/node` for TS 4.9 issue <add>- [#20238](https://github.com/emberjs/ember.js/pull/20238) [BUGFIX] Update Node.js versions to match support policy <add>- [#20227](https://github.com/emberjs/ember.js/pull/20227) [BUGFIX] Fix unsafe internal cast for NativeArray <add>- [#20228](https://github.com/emberjs/ember.js/pull/20228) [BUGFIX] Remove type export for ControllerMixin <add>- [#20203](https://github.com/emberjs/ember.js/pull/20203) / [#20204](https://github.com/emberjs/ember.js/pull/20204) [FEATURE] Preview types: Update to Typescript 4.8 <ide> <ide> ### v4.8.2 (November 3, 2022) <ide> <ide> - [#20244](https://github.com/emberjs/ember.js/pull/20244) Add missing type for `getComponentTemplate` to preview types <ide> <del>### v4.9.0-beta.3 (November 2, 2022) <del> <del>- [CVE pending](https://emberjs.com/blog/ember-4-8-1-released) Fix a prototype pollution vulnerability in `set` and `setProperties` <del>- [#20233](https://github.com/emberjs/ember.js/pull/20233) [BUGFIX] Include package name in deprecation error message <del>- [#20235](https://github.com/emberjs/ember.js/pull/20235) [BUGFIX] Update `@types/node` for TS 4.9 issue <del>- [#20238](https://github.com/emberjs/ember.js/pull/20238) [BUGFIX] Update Node.js versions to match support policy <del>- [#20244](https://github.com/emberjs/ember.js/pull/20244) [BUGFIX] Expose getComponentTemplate type <del> <ide> ### v4.8.1 (November 2, 2022) <ide> <ide> - [CVE pending](https://emberjs.com/blog/ember-4-8-1-released) Fix a prototype pollution vulnerability in `set` and `setProperties` <ide> <ide> - [CVE pending](https://emberjs.com/blog/ember-4-8-1-released) Fix a prototype pollution vulnerability in `set` and `setProperties` <ide> <del>### v4.9.0-beta.2 (October 25, 2022) <del> <del>- [#20227](https://github.com/emberjs/ember.js/pull/20227) [BUGFIX] Fix unsafe internal cast for NativeArray <del>- [#20228](https://github.com/emberjs/ember.js/pull/20228) [BUGFIX] Remove type export for ControllerMixin <del> <del>### v4.9.0-beta.1 (October 17, 2022) <del> <del>- [#20203](https://github.com/emberjs/ember.js/pull/20203) / [#20204](https://github.com/emberjs/ember.js/pull/20204) [FEATURE] Preview types: Update to Typescript 4.8 <del> <ide> ### v4.8.0 (October 17, 2022) <ide> <ide> - [#20180](https://github.com/emberjs/ember.js/pull/20180) [FEATURE] Publish an opt-in preview of public types for Ember
1
Ruby
Ruby
remove useless parens
4b5a3d7367ecdfcff1c2ffe1b299a9865d66ab7e
<ide><path>activesupport/lib/active_support/multibyte/unicode.rb <ide> def g_unpack(string) <ide> # Example: <ide> # Unicode.g_pack(Unicode.g_unpack('क्षि')) # => 'क्षि' <ide> def g_pack(unpacked) <del> (unpacked.flatten).pack('U*') <add> unpacked.flatten.pack('U*') <ide> end <ide> <ide> # Re-order codepoints so the string becomes canonical.
1
Ruby
Ruby
remove confusing validations comments [ci-skip]
8e91abbea1bccb34deea8ab7e48f46ec42b5db8e
<ide><path>activemodel/lib/active_model/validations/absence.rb <ide> def validate_each(record, attr_name, value) <ide> <ide> module HelperMethods <ide> # Validates that the specified attributes are blank (as defined by <del> # Object#present?). Happens by default on save. <add> # Object#present?). <ide> # <ide> # class Person < ActiveRecord::Base <ide> # validates_absence_of :first_name <ide><path>activemodel/lib/active_model/validations/acceptance.rb <ide> module HelperMethods <ide> # <ide> # If the database column does not exist, the +terms_of_service+ attribute <ide> # is entirely virtual. This check is performed only if +terms_of_service+ <del> # is not +nil+ and by default on save. <add> # is not +nil+. <ide> # <ide> # Configuration options: <ide> # * <tt>:message</tt> - A custom error message (default is: "must be <ide><path>activemodel/lib/active_model/validations/presence.rb <ide> def validate_each(record, attr_name, value) <ide> <ide> module HelperMethods <ide> # Validates that the specified attributes are not blank (as defined by <del> # Object#blank?). Happens by default on save. <add> # Object#blank?). <ide> # <ide> # class Person < ActiveRecord::Base <ide> # validates_presence_of :first_name <ide><path>activerecord/lib/active_record/validations.rb <ide> def initialize(record = nil) <ide> <ide> # = Active Record \Validations <ide> # <del> # Active Record includes the majority of its validations from ActiveModel::Validations <del> # all of which accept the <tt>:on</tt> argument to define the context where the <del> # validations are active. Active Record will always supply either the context of <del> # <tt>:create</tt> or <tt>:update</tt> dependent on whether the model is a <add> # Active Record includes the majority of its validations from ActiveModel::Validations. <add> # <add> # In Active Record, all validations are performed on save by default. <add> # Validations accept the <tt>:on</tt> argument to define the context where <add> # the validations are active. Active Record will pass either the context of <add> # <tt>:create</tt> or <tt>:update</tt> depending on whether the model is a <ide> # {new_record?}[rdoc-ref:Persistence#new_record?]. <ide> module Validations <ide> extend ActiveSupport::Concern
4
Text
Text
fix typo in api routes documentation.
b3dbcbb5bbe6154dc1c16cf97d774be9089912b5
<ide><path>packages/next/README.md <ide> export default withRouter(MyLink) <ide> </ul> <ide> </details> <ide> <del>API routes provides a straightforward solution to build your **API** with Next.js. <add>API routes provide a straightforward solution to build your **API** with Next.js. <ide> Start by creating the `api/` folder inside the `./pages/` folder. <ide> <ide> Every file inside `./pages/api` is mapped to `/api/*`.
1
PHP
PHP
add type-hints to artisan facade methods props
7f8db2a3e1dad10f4b933a86ba9d3e0706551d98
<ide><path>src/Illuminate/Support/Facades/Blade.php <ide> namespace Illuminate\Support\Facades; <ide> <ide> /** <del> * @method static void compile($path = null) <add> * @method static void compile(string|null $path = null) <ide> * @method static string getPath() <del> * @method static void setPath($path) <del> * @method static string compileString($value) <del> * @method static string stripParentheses($expression) <add> * @method static void setPath(string $path) <add> * @method static string compileString(string $value) <add> * @method static string stripParentheses(string $expression) <ide> * @method static void extend(callable $compiler) <ide> * @method static array getExtensions() <del> * @method static void if($name, callable $callback) <del> * @method static bool check($name, ...$parameters) <del> * @method static void component($path, $alias = null) <del> * @method static void include($path, $alias = null) <del> * @method static void directive($name, callable $handler) <add> * @method static void if(string $name, callable $callback) <add> * @method static bool check(string $name, array ...$parameters) <add> * @method static void component(string $path, string|null $alias = null) <add> * @method static void include(string $path, string|null $alias = null) <add> * @method static void directive(string $name, callable $handler) <ide> * @method static array getCustomDirectives() <del> * @method static void setEchoFormat($format) <add> * @method static void setEchoFormat(string $format) <ide> * @method static void withDoubleEncoding() <ide> * @method static void withoutDoubleEncoding() <ide> *
1
Mixed
Go
add volume api/cli
b3b7eb2723461b1eb4be692f4bced0ae8ea9cb58
<ide><path>api/client/volume.go <add>package client <add> <add>import ( <add> "bytes" <add> "encoding/json" <add> "fmt" <add> "io" <add> "net/url" <add> "text/tabwriter" <add> "text/template" <add> <add> "github.com/docker/docker/api/types" <add> Cli "github.com/docker/docker/cli" <add> "github.com/docker/docker/opts" <add> flag "github.com/docker/docker/pkg/mflag" <add> "github.com/docker/docker/pkg/parsers/filters" <add>) <add> <add>// CmdVolume is the parent subcommand for all volume commands <add>// <add>// Usage: docker volume <COMMAND> <OPTS> <add>func (cli *DockerCli) CmdVolume(args ...string) error { <add> description := "Manage Docker volumes\n\nCommands:\n" <add> commands := [][]string{ <add> {"create", "Create a volume"}, <add> {"inspect", "Return low-level information on a volume"}, <add> {"ls", "List volumes"}, <add> {"rm", "Remove a volume"}, <add> } <add> <add> for _, cmd := range commands { <add> description += fmt.Sprintf(" %-25.25s%s\n", cmd[0], cmd[1]) <add> } <add> <add> description += "\nRun 'docker volume COMMAND --help' for more information on a command." <add> cmd := Cli.Subcmd("volume", []string{"[COMMAND]"}, description, true) <add> cmd.ParseFlags(args, true) <add> <add> return cli.CmdVolumeLs(args...) <add>} <add> <add>// CmdVolumeLs outputs a list of Docker volumes. <add>// <add>// Usage: docker volume ls [OPTIONS] <add>func (cli *DockerCli) CmdVolumeLs(args ...string) error { <add> cmd := Cli.Subcmd("volume ls", nil, "List volumes", true) <add> <add> quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only display volume names") <add> flFilter := opts.NewListOpts(nil) <add> cmd.Var(&flFilter, []string{"f", "-filter"}, "Provide filter values (i.e. 'dangling=true')") <add> <add> cmd.Require(flag.Exact, 0) <add> cmd.ParseFlags(args, true) <add> <add> volFilterArgs := filters.Args{} <add> for _, f := range flFilter.GetAll() { <add> var err error <add> volFilterArgs, err = filters.ParseFlag(f, volFilterArgs) <add> if err != nil { <add> return err <add> } <add> } <add> <add> v := url.Values{} <add> if len(volFilterArgs) > 0 { <add> filterJSON, err := filters.ToParam(volFilterArgs) <add> if err != nil { <add> return err <add> } <add> v.Set("filters", filterJSON) <add> } <add> <add> resp, err := cli.call("GET", "/volumes?"+v.Encode(), nil, nil) <add> if err != nil { <add> return err <add> } <add> <add> var volumes types.VolumesListResponse <add> if err := json.NewDecoder(resp.body).Decode(&volumes); err != nil { <add> return err <add> } <add> <add> w := tabwriter.NewWriter(cli.out, 20, 1, 3, ' ', 0) <add> if !*quiet { <add> fmt.Fprintf(w, "DRIVER \tVOLUME NAME") <add> fmt.Fprintf(w, "\n") <add> } <add> <add> for _, vol := range volumes.Volumes { <add> if *quiet { <add> fmt.Fprintln(w, vol.Name) <add> continue <add> } <add> fmt.Fprintf(w, "%s\t%s\n", vol.Driver, vol.Name) <add> } <add> w.Flush() <add> return nil <add>} <add> <add>// CmdVolumeInspect displays low-level information on one or more volumes. <add>// <add>// Usage: docker volume inspect [OPTIONS] VOLUME [VOLUME...] <add>func (cli *DockerCli) CmdVolumeInspect(args ...string) error { <add> cmd := Cli.Subcmd("volume inspect", []string{"[VOLUME NAME]"}, "Return low-level information on a volume", true) <add> tmplStr := cmd.String([]string{"f", "-format"}, "", "Format the output using the given go template.") <add> if err := cmd.Parse(args); err != nil { <add> return nil <add> } <add> <add> cmd.Require(flag.Min, 1) <add> cmd.ParseFlags(args, true) <add> <add> var tmpl *template.Template <add> if *tmplStr != "" { <add> var err error <add> tmpl, err = template.New("").Funcs(funcMap).Parse(*tmplStr) <add> if err != nil { <add> return err <add> } <add> } <add> <add> var status = 0 <add> var volumes []*types.Volume <add> for _, name := range cmd.Args() { <add> resp, err := cli.call("GET", "/volumes/"+name, nil, nil) <add> if err != nil { <add> return err <add> } <add> <add> var volume types.Volume <add> if err := json.NewDecoder(resp.body).Decode(&volume); err != nil { <add> fmt.Fprintf(cli.err, "%s\n", err) <add> status = 1 <add> continue <add> } <add> <add> if tmpl == nil { <add> volumes = append(volumes, &volume) <add> continue <add> } <add> <add> if err := tmpl.Execute(cli.out, &volume); err != nil { <add> if err := tmpl.Execute(cli.out, &volume); err != nil { <add> fmt.Fprintf(cli.err, "%s\n", err) <add> status = 1 <add> continue <add> } <add> } <add> io.WriteString(cli.out, "\n") <add> } <add> <add> if tmpl != nil { <add> return nil <add> } <add> <add> b, err := json.MarshalIndent(volumes, "", " ") <add> if err != nil { <add> return err <add> } <add> _, err = io.Copy(cli.out, bytes.NewReader(b)) <add> if err != nil { <add> return err <add> } <add> io.WriteString(cli.out, "\n") <add> <add> if status != 0 { <add> return Cli.StatusError{StatusCode: status} <add> } <add> return nil <add>} <add> <add>// CmdVolumeCreate creates a new container from a given image. <add>// <add>// Usage: docker volume create [OPTIONS] <add>func (cli *DockerCli) CmdVolumeCreate(args ...string) error { <add> cmd := Cli.Subcmd("volume create", nil, "Create a volume", true) <add> flDriver := cmd.String([]string{"d", "-driver"}, "local", "Specify volume driver name") <add> flName := cmd.String([]string{"-name"}, "", "Specify volume name") <add> <add> flDriverOpts := opts.NewMapOpts(nil, nil) <add> cmd.Var(flDriverOpts, []string{"o", "-opt"}, "Set driver specific options") <add> <add> cmd.Require(flag.Exact, 0) <add> cmd.ParseFlags(args, true) <add> <add> volReq := &types.VolumeCreateRequest{ <add> Driver: *flDriver, <add> DriverOpts: flDriverOpts.GetAll(), <add> } <add> <add> if *flName != "" { <add> volReq.Name = *flName <add> } <add> <add> resp, err := cli.call("POST", "/volumes", volReq, nil) <add> if err != nil { <add> return err <add> } <add> <add> var vol types.Volume <add> if err := json.NewDecoder(resp.body).Decode(&vol); err != nil { <add> return err <add> } <add> fmt.Fprintf(cli.out, "%s\n", vol.Name) <add> return nil <add>} <add> <add>// CmdVolumeRm removes one or more containers. <add>// <add>// Usage: docker volume rm VOLUME [VOLUME...] <add>func (cli *DockerCli) CmdVolumeRm(args ...string) error { <add> cmd := Cli.Subcmd("volume rm", []string{"[NAME]"}, "Remove a volume", true) <add> cmd.Require(flag.Min, 1) <add> cmd.ParseFlags(args, true) <add> <add> var status = 0 <add> for _, name := range cmd.Args() { <add> _, err := cli.call("DELETE", "/volumes/"+name, nil, nil) <add> if err != nil { <add> fmt.Fprintf(cli.err, "%s\n", err) <add> status = 1 <add> continue <add> } <add> fmt.Fprintf(cli.out, "%s\n", name) <add> } <add> <add> if status != 0 { <add> return Cli.StatusError{StatusCode: status} <add> } <add> return nil <add>} <ide><path>api/server/server.go <ide> func createRouter(s *Server) *mux.Router { <ide> "/containers/{name:.*}/attach/ws": s.wsContainersAttach, <ide> "/exec/{id:.*}/json": s.getExecByID, <ide> "/containers/{name:.*}/archive": s.getContainersArchive, <add> "/volumes": s.getVolumesList, <add> "/volumes/{name:.*}": s.getVolumeByName, <ide> }, <ide> "POST": { <ide> "/auth": s.postAuth, <ide> func createRouter(s *Server) *mux.Router { <ide> "/exec/{name:.*}/start": s.postContainerExecStart, <ide> "/exec/{name:.*}/resize": s.postContainerExecResize, <ide> "/containers/{name:.*}/rename": s.postContainerRename, <add> "/volumes": s.postVolumesCreate, <ide> }, <ide> "PUT": { <ide> "/containers/{name:.*}/archive": s.putContainersArchive, <ide> }, <ide> "DELETE": { <ide> "/containers/{name:.*}": s.deleteContainers, <ide> "/images/{name:.*}": s.deleteImages, <add> "/volumes/{name:.*}": s.deleteVolumes, <ide> }, <ide> "OPTIONS": { <ide> "": s.optionsHandler, <ide><path>api/server/volume.go <add>package server <add> <add>import ( <add> "encoding/json" <add> "net/http" <add> <add> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/pkg/version" <add>) <add> <add>func (s *Server) getVolumesList(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <add> if err := parseForm(r); err != nil { <add> return err <add> } <add> <add> volumes, err := s.daemon.Volumes(r.Form.Get("filters")) <add> if err != nil { <add> return err <add> } <add> return writeJSON(w, http.StatusOK, &types.VolumesListResponse{Volumes: volumes}) <add>} <add> <add>func (s *Server) getVolumeByName(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <add> if err := parseForm(r); err != nil { <add> return err <add> } <add> <add> v, err := s.daemon.VolumeInspect(vars["name"]) <add> if err != nil { <add> return err <add> } <add> return writeJSON(w, http.StatusOK, v) <add>} <add> <add>func (s *Server) postVolumesCreate(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <add> if err := parseForm(r); err != nil { <add> return err <add> } <add> <add> if err := checkForJSON(r); err != nil { <add> return err <add> } <add> <add> var req types.VolumeCreateRequest <add> if err := json.NewDecoder(r.Body).Decode(&req); err != nil { <add> return err <add> } <add> <add> volume, err := s.daemon.VolumeCreate(req.Name, req.Driver, req.DriverOpts) <add> if err != nil { <add> return err <add> } <add> return writeJSON(w, http.StatusCreated, volume) <add>} <add> <add>func (s *Server) deleteVolumes(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error { <add> if err := parseForm(r); err != nil { <add> return err <add> } <add> if err := s.daemon.VolumeRm(vars["name"]); err != nil { <add> return err <add> } <add> w.WriteHeader(http.StatusNoContent) <add> return nil <add>} <ide><path>api/types/types.go <ide> type MountPoint struct { <ide> Mode string <ide> RW bool <ide> } <add> <add>// Volume represents the configuration of a volume for the remote API <add>type Volume struct { <add> Name string // Name is the name of the volume <add> Driver string // Driver is the Driver name used to create the volume <add> Mountpoint string // Mountpoint is the location on disk of the volume <add>} <add> <add>// VolumesListResponse contains the response for the remote API: <add>// GET "/volumes" <add>type VolumesListResponse struct { <add> Volumes []*Volume // Volumes is the list of volumes being returned <add>} <add> <add>// VolumeCreateRequest contains the response for the remote API: <add>// POST "/volumes" <add>type VolumeCreateRequest struct { <add> Name string // Name is the requested name of the volume <add> Driver string // Driver is the name of the driver that should be used to create the volume <add> DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume. <add>} <ide><path>daemon/container_unix.go <ide> func (container *Container) isDestinationMounted(destination string) bool { <ide> func (container *Container) prepareMountPoints() error { <ide> for _, config := range container.MountPoints { <ide> if len(config.Driver) > 0 { <del> v, err := createVolume(config.Name, config.Driver) <add> v, err := container.daemon.createVolume(config.Name, config.Driver, nil) <ide> if err != nil { <ide> return err <ide> } <ide> func (container *Container) prepareMountPoints() error { <ide> return nil <ide> } <ide> <del>func (container *Container) removeMountPoints() error { <add>func (container *Container) removeMountPoints(rm bool) error { <add> var rmErrors []string <ide> for _, m := range container.MountPoints { <del> if m.Volume != nil { <del> if err := removeVolume(m.Volume); err != nil { <del> return err <add> if m.Volume == nil { <add> continue <add> } <add> container.daemon.volumes.Decrement(m.Volume) <add> if rm { <add> if err := container.daemon.volumes.Remove(m.Volume); err != nil { <add> rmErrors = append(rmErrors, fmt.Sprintf("%v\n", err)) <add> continue <ide> } <ide> } <ide> } <add> if len(rmErrors) > 0 { <add> return fmt.Errorf("Error removing volumes:\n%v", rmErrors) <add> } <ide> return nil <ide> } <ide> <ide><path>daemon/container_windows.go <ide> func (container *Container) prepareMountPoints() error { <ide> } <ide> <ide> // removeMountPoints is a no-op on Windows. <del>func (container *Container) removeMountPoints() error { <add>func (container *Container) removeMountPoints(_ bool) error { <ide> return nil <ide> } <ide> <ide><path>daemon/create.go <ide> import ( <ide> "fmt" <ide> <ide> "github.com/Sirupsen/logrus" <add> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/graph/tags" <ide> "github.com/docker/docker/image" <ide> "github.com/docker/docker/pkg/parsers" <add> "github.com/docker/docker/pkg/stringid" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/opencontainers/runc/libcontainer/label" <ide> ) <ide> func (daemon *Daemon) GenerateSecurityOpt(ipcMode runconfig.IpcMode, pidMode run <ide> } <ide> return nil, nil <ide> } <add> <add>// VolumeCreate creates a volume with the specified name, driver, and opts <add>// This is called directly from the remote API <add>func (daemon *Daemon) VolumeCreate(name, driverName string, opts map[string]string) (*types.Volume, error) { <add> if name == "" { <add> name = stringid.GenerateNonCryptoID() <add> } <add> <add> v, err := daemon.volumes.Create(name, driverName, opts) <add> if err != nil { <add> return nil, err <add> } <add> return volumeToAPIType(v), nil <add>} <ide><path>daemon/create_unix.go <ide> func createContainerPlatformSpecificSettings(container *Container, config *runco <ide> } <ide> } <ide> <del> v, err := createVolume(name, volumeDriver) <add> v, err := container.daemon.createVolume(name, volumeDriver, nil) <ide> if err != nil { <ide> return err <ide> } <add> <ide> if err := label.Relabel(v.Path(), container.MountLabel, "z"); err != nil { <ide> return err <ide> } <ide><path>daemon/daemon.go <ide> type Daemon struct { <ide> RegistryService *registry.Service <ide> EventsService *events.Events <ide> netController libnetwork.NetworkController <add> volumes *volumeStore <ide> root string <ide> shutdown bool <ide> } <ide> func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo <ide> } <ide> <ide> // Configure the volumes driver <del> if err := configureVolumes(config); err != nil { <add> volStore, err := configureVolumes(config) <add> if err != nil { <ide> return nil, err <ide> } <ide> <ide> func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo <ide> d.defaultLogConfig = config.LogConfig <ide> d.RegistryService = registryService <ide> d.EventsService = eventsService <add> d.volumes = volStore <ide> d.root = config.Root <ide> go d.execCommandGC() <ide> <ide><path>daemon/daemon_test.go <ide> import ( <ide> "github.com/docker/docker/pkg/truncindex" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/volume" <del> "github.com/docker/docker/volume/drivers" <add> volumedrivers "github.com/docker/docker/volume/drivers" <ide> "github.com/docker/docker/volume/local" <ide> ) <ide> <ide> func TestRemoveLocalVolumesFollowingSymlinks(t *testing.T) { <ide> } <ide> <ide> m := c.MountPoints["/vol1"] <del> v, err := createVolume(m.Name, m.Driver) <add> _, err = daemon.VolumeCreate(m.Name, m.Driver, nil) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> if err := removeVolume(v); err != nil { <add> if err := daemon.VolumeRm(m.Name); err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> func initDaemonForVolumesTest(tmp string) (*Daemon, error) { <ide> daemon := &Daemon{ <ide> repository: tmp, <ide> root: tmp, <add> volumes: newVolumeStore([]volume.Volume{}), <ide> } <ide> <ide> volumesDriver, err := local.New(tmp) <ide><path>daemon/daemon_unix.go <ide> func migrateIfDownlevel(driver graphdriver.Driver, root string) error { <ide> return migrateIfAufs(driver, root) <ide> } <ide> <del>func configureVolumes(config *Config) error { <add>func configureVolumes(config *Config) (*volumeStore, error) { <ide> volumesDriver, err := local.New(config.Root) <ide> if err != nil { <del> return err <add> return nil, err <ide> } <ide> volumedrivers.Register(volumesDriver, volumesDriver.Name()) <del> return nil <add> return newVolumeStore(volumesDriver.List()), nil <ide> } <ide> <ide> func configureSysInit(config *Config) (string, error) { <ide><path>daemon/daemon_windows.go <ide> func migrateIfDownlevel(driver graphdriver.Driver, root string) error { <ide> return nil <ide> } <ide> <del>func configureVolumes(config *Config) error { <add>func configureVolumes(config *Config) (*volumeStore, error) { <ide> // Windows does not support volumes at this time <del> return nil <add> return &volumeStore{}, nil <ide> } <ide> <ide> func configureSysInit(config *Config) (string, error) { <ide><path>daemon/delete.go <ide> func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error <ide> return fmt.Errorf("Cannot destroy container %s: %v", name, err) <ide> } <ide> <del> if config.RemoveVolume { <del> container.removeMountPoints() <del> } <add> container.removeMountPoints(config.RemoveVolume) <ide> return nil <ide> } <ide> <ide> func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) { <ide> return nil <ide> } <ide> <del>func (daemon *Daemon) DeleteVolumes(c *Container) error { <del> return c.removeMountPoints() <add>// VolumeRm removes the volume with the given name. <add>// If the volume is referenced by a container it is not removed <add>// This is called directly from the remote API <add>func (daemon *Daemon) VolumeRm(name string) error { <add> v, err := daemon.volumes.Get(name) <add> if err != nil { <add> return err <add> } <add> if err := daemon.volumes.Remove(v); err != nil { <add> if err == ErrVolumeInUse { <add> return fmt.Errorf("Conflict: %v", err) <add> } <add> return err <add> } <add> return nil <ide> } <ide><path>daemon/inspect.go <ide> func (daemon *Daemon) ContainerExecInspect(id string) (*execConfig, error) { <ide> } <ide> return eConfig, nil <ide> } <add> <add>func (daemon *Daemon) VolumeInspect(name string) (*types.Volume, error) { <add> v, err := daemon.volumes.Get(name) <add> if err != nil { <add> return nil, err <add> } <add> return volumeToAPIType(v), nil <add>} <ide><path>daemon/list.go <ide> func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container, <ide> } <ide> return containers, nil <ide> } <add> <add>func (daemon *Daemon) Volumes(filter string) ([]*types.Volume, error) { <add> var volumesOut []*types.Volume <add> volFilters, err := filters.FromParam(filter) <add> if err != nil { <add> return nil, err <add> } <add> <add> filterUsed := false <add> if i, ok := volFilters["dangling"]; ok { <add> if len(i) > 1 { <add> return nil, fmt.Errorf("Conflict: cannot use more than 1 value for `dangling` filter") <add> } <add> <add> filterValue := i[0] <add> if strings.ToLower(filterValue) == "true" || filterValue == "1" { <add> filterUsed = true <add> } <add> } <add> <add> volumes := daemon.volumes.List() <add> for _, v := range volumes { <add> if filterUsed && daemon.volumes.Count(v) == 0 { <add> continue <add> } <add> volumesOut = append(volumesOut, volumeToAPIType(v)) <add> } <add> return volumesOut, nil <add>} <ide><path>daemon/volumes.go <ide> import ( <ide> "os" <ide> "path/filepath" <ide> "strings" <add> "sync" <ide> <add> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/pkg/chrootarchive" <ide> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/volume" <add> "github.com/docker/docker/volume/drivers" <ide> ) <ide> <del>// ErrVolumeReadonly is used to signal an error when trying to copy data into <del>// a volume mount that is not writable. <del>var ErrVolumeReadonly = errors.New("mounted volume is marked read-only") <add>var ( <add> // ErrVolumeReadonly is used to signal an error when trying to copy data into <add> // a volume mount that is not writable. <add> ErrVolumeReadonly = errors.New("mounted volume is marked read-only") <add> // ErrVolumeInUse is a typed error returned when trying to remove a volume that is currently in use by a container <add> ErrVolumeInUse = errors.New("volume is in use") <add> // ErrNoSuchVolume is a typed error returned if the requested volume doesn't exist in the volume store <add> ErrNoSuchVolume = errors.New("no such volume") <add>) <ide> <ide> // mountPoint is the intersection point between a volume and a container. It <ide> // specifies which volume is to be used and where inside a container it should <ide> func copyExistingContents(source, destination string) error { <ide> } <ide> return copyOwnership(source, destination) <ide> } <add> <add>func newVolumeStore(vols []volume.Volume) *volumeStore { <add> store := &volumeStore{ <add> vols: make(map[string]*volumeCounter), <add> } <add> for _, v := range vols { <add> store.vols[v.Name()] = &volumeCounter{v, 0} <add> } <add> return store <add>} <add> <add>// volumeStore is a struct that stores the list of volumes available and keeps track of their usage counts <add>type volumeStore struct { <add> vols map[string]*volumeCounter <add> mu sync.Mutex <add>} <add> <add>type volumeCounter struct { <add> volume.Volume <add> count int <add>} <add> <add>func getVolumeDriver(name string) (volume.Driver, error) { <add> if name == "" { <add> name = volume.DefaultDriverName <add> } <add> return volumedrivers.Lookup(name) <add>} <add> <add>// Create tries to find an existing volume with the given name or create a new one from the passed in driver <add>func (s *volumeStore) Create(name, driverName string, opts map[string]string) (volume.Volume, error) { <add> s.mu.Lock() <add> defer s.mu.Unlock() <add> <add> if vc, exists := s.vols[name]; exists { <add> return vc.Volume, nil <add> } <add> <add> vd, err := getVolumeDriver(driverName) <add> if err != nil { <add> return nil, err <add> } <add> <add> v, err := vd.Create(name, opts) <add> if err != nil { <add> return nil, err <add> } <add> <add> s.vols[v.Name()] = &volumeCounter{v, 0} <add> return v, nil <add>} <add> <add>// Get looks if a volume with the given name exists and returns it if so <add>func (s *volumeStore) Get(name string) (volume.Volume, error) { <add> s.mu.Lock() <add> defer s.mu.Unlock() <add> vc, exists := s.vols[name] <add> if !exists { <add> return nil, ErrNoSuchVolume <add> } <add> return vc.Volume, nil <add>} <add> <add>// Remove removes the requested volume. A volume is not removed if the usage count is > 0 <add>func (s *volumeStore) Remove(v volume.Volume) error { <add> s.mu.Lock() <add> defer s.mu.Unlock() <add> name := v.Name() <add> vc, exists := s.vols[name] <add> if !exists { <add> return ErrNoSuchVolume <add> } <add> <add> if vc.count != 0 { <add> return ErrVolumeInUse <add> } <add> <add> vd, err := getVolumeDriver(vc.DriverName()) <add> if err != nil { <add> return err <add> } <add> if err := vd.Remove(vc.Volume); err != nil { <add> return err <add> } <add> delete(s.vols, name) <add> return nil <add>} <add> <add>// Increment increments the usage count of the passed in volume by 1 <add>func (s *volumeStore) Increment(v volume.Volume) { <add> s.mu.Lock() <add> defer s.mu.Unlock() <add> <add> vc, exists := s.vols[v.Name()] <add> if !exists { <add> s.vols[v.Name()] = &volumeCounter{v, 1} <add> return <add> } <add> vc.count++ <add> return <add>} <add> <add>// Decrement decrements the usage count of the passed in volume by 1 <add>func (s *volumeStore) Decrement(v volume.Volume) { <add> s.mu.Lock() <add> defer s.mu.Unlock() <add> <add> vc, exists := s.vols[v.Name()] <add> if !exists { <add> return <add> } <add> vc.count-- <add> return <add>} <add> <add>// Count returns the usage count of the passed in volume <add>func (s *volumeStore) Count(v volume.Volume) int { <add> vc, exists := s.vols[v.Name()] <add> if !exists { <add> return 0 <add> } <add> return vc.count <add>} <add> <add>// List returns all the available volumes <add>func (s *volumeStore) List() []volume.Volume { <add> var ls []volume.Volume <add> for _, vc := range s.vols { <add> ls = append(ls, vc.Volume) <add> } <add> return ls <add>} <add> <add>// volumeToAPIType converts a volume.Volume to the type used by the remote API <add>func volumeToAPIType(v volume.Volume) *types.Volume { <add> return &types.Volume{ <add> Name: v.Name(), <add> Driver: v.DriverName(), <add> Mountpoint: v.Path(), <add> } <add>} <ide><path>daemon/volumes_linux_unit_test.go <ide> import ( <ide> <ide> type fakeDriver struct{} <ide> <del>func (fakeDriver) Name() string { return "fake" } <del>func (fakeDriver) Create(name string) (volume.Volume, error) { return nil, nil } <del>func (fakeDriver) Remove(v volume.Volume) error { return nil } <add>func (fakeDriver) Name() string { return "fake" } <add>func (fakeDriver) Create(name string, opts map[string]string) (volume.Volume, error) { return nil, nil } <add>func (fakeDriver) Remove(v volume.Volume) error { return nil } <ide> <ide> func TestGetVolumeDriver(t *testing.T) { <ide> _, err := getVolumeDriver("missing") <ide><path>daemon/volumes_unix.go <ide> import ( <ide> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/docker/volume" <del> "github.com/docker/docker/volume/drivers" <add> volumedrivers "github.com/docker/docker/volume/drivers" <ide> "github.com/docker/docker/volume/local" <ide> "github.com/opencontainers/runc/libcontainer/label" <ide> ) <ide> func (m mounts) parts(i int) int { <ide> // It preserves the volume json configuration generated pre Docker 1.7 to be able to <ide> // downgrade from Docker 1.7 to Docker 1.6 without losing volume compatibility. <ide> func migrateVolume(id, vfs string) error { <del> l, err := getVolumeDriver(volume.DefaultDriverName) <add> l, err := volumedrivers.Lookup(volume.DefaultDriverName) <ide> if err != nil { <ide> return err <ide> } <ide> func (daemon *Daemon) verifyVolumesInfo(container *Container) error { <ide> // Volumes created with a Docker version >= 1.7. We verify integrity in case of data created <ide> // with Docker 1.7 RC versions that put the information in <ide> // DOCKER_ROOT/volumes/VOLUME_ID rather than DOCKER_ROOT/volumes/VOLUME_ID/_container_data. <del> l, err := getVolumeDriver(volume.DefaultDriverName) <add> l, err := volumedrivers.Lookup(volume.DefaultDriverName) <ide> if err != nil { <ide> return err <ide> } <ide> func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc <ide> } <ide> <ide> if len(cp.Source) == 0 { <del> v, err := createVolume(cp.Name, cp.Driver) <add> v, err := daemon.createVolume(cp.Name, cp.Driver, nil) <ide> if err != nil { <ide> return err <ide> } <ide> func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc <ide> <ide> if len(bind.Name) > 0 && len(bind.Driver) > 0 { <ide> // create the volume <del> v, err := createVolume(bind.Name, bind.Driver) <add> v, err := daemon.createVolume(bind.Name, bind.Driver, nil) <ide> if err != nil { <ide> return err <ide> } <ide> func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc <ide> if m.BackwardsCompatible() { <ide> bcVolumes[m.Destination] = m.Path() <ide> bcVolumesRW[m.Destination] = m.RW <add> <add> // This mountpoint is replacing an existing one, so the count needs to be decremented <add> if mp, exists := container.MountPoints[m.Destination]; exists && mp.Volume != nil { <add> daemon.volumes.Decrement(mp.Volume) <add> } <ide> } <ide> } <ide> <ide> func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc <ide> } <ide> <ide> // createVolume creates a volume. <del>func createVolume(name, driverName string) (volume.Volume, error) { <del> vd, err := getVolumeDriver(driverName) <add>func (daemon *Daemon) createVolume(name, driverName string, opts map[string]string) (volume.Volume, error) { <add> v, err := daemon.volumes.Create(name, driverName, opts) <ide> if err != nil { <ide> return nil, err <ide> } <del> return vd.Create(name) <del>} <del> <del>// removeVolume removes a volume. <del>func removeVolume(v volume.Volume) error { <del> vd, err := getVolumeDriver(v.DriverName()) <del> if err != nil { <del> return nil <del> } <del> return vd.Remove(v) <del>} <del> <del>// getVolumeDriver returns the volume driver for the supplied name. <del>func getVolumeDriver(name string) (volume.Driver, error) { <del> if name == "" { <del> name = volume.DefaultDriverName <del> } <del> return volumedrivers.Lookup(name) <add> daemon.volumes.Increment(v) <add> return v, nil <ide> } <ide> <ide> // parseVolumeSource parses the origin sources that's mounted into the container. <ide><path>docker/flags.go <ide> var dockerCommands = []command{ <ide> {"top", "Display the running processes of a container"}, <ide> {"unpause", "Unpause all processes within a container"}, <ide> {"version", "Show the Docker version information"}, <add> {"volume", "Manage Docker volumes"}, <ide> {"wait", "Block until a container stops, then print its exit code"}, <ide> } <ide><path>docs/extend/plugins_volume.md <ide> containers. <ide> **Request**: <ide> ``` <ide> { <del> "Name": "volume_name" <add> "Name": "volume_name", <add> "Opts": {} <ide> } <ide> ``` <ide> <ide> Instruct the plugin that the user wants to create a volume, given a user <ide> specified volume name. The plugin does not need to actually manifest the <ide> volume on the filesystem yet (until Mount is called). <add>Opts is a map of driver specific options passed through from the user request. <ide> <ide> **Response**: <ide> ``` <ide><path>docs/reference/api/docker_remote_api.md <ide> parent = "smn_remoteapi" <ide> <ide> # Docker Remote API <ide> <del> - By default the Docker daemon listens on `unix:///var/run/docker.sock` <del> and the client must have `root` access to interact with the daemon. <del> - If you are using `docker-machine`, the Docker daemon is on a virtual host that uses an encrypted TCP socket. In this situation, you need to add extra <del> parameters to `curl` or `wget` when making test API requests: <del> `curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://YOUR_VM_IP:2376/images/json` <del> or <del> `wget --no-check-certificate --certificate=$DOCKER_CERT_PATH/cert.pem --private-key=$DOCKER_CERT_PATH/key.pem https://your_vm_ip:2376/images/json -O - -q` <del> - If a group named `docker` exists on your system, docker will apply <del> ownership of the socket to the group. <del> - The API tends to be REST, but for some complex commands, like attach <del> or pull, the HTTP connection is hijacked to transport STDOUT, STDIN, <del> and STDERR. <del> - Since API version 1.2, the auth configuration is now handled client <del> side, so the client has to send the `authConfig` as a `POST` in `/images/(name)/push`. <del> - authConfig, set as the `X-Registry-Auth` header, is currently a Base64 <del> encoded (JSON) string with the following structure: <del> `{"username": "string", "password": "string", "email": "string", <del> "serveraddress" : "string", "auth": ""}`. Notice that `auth` is to be left <del> empty, `serveraddress` is a domain/ip without protocol, and that double <del> quotes (instead of single ones) are required. <del> - The Remote API uses an open schema model. In this model, unknown <del> properties in incoming messages will be ignored. <del> Client applications need to take this into account to ensure <del> they will not break when talking to newer Docker daemons. <del> <del>The current version of the API is v1.21 <del> <del>Calling `/info` is the same as calling <del>`/v1.21/info`. <del> <del>You can still call an old version of the API using <add>Docker's Remote API uses an open schema model. In this model, unknown <add>properties in incoming messages are ignored. Client applications need to take <add>this behavior into account to ensure they do not break when talking to newer <add>Docker daemons. <add> <add>The API tends to be REST, but for some complex commands, like attach or pull, <add>the HTTP connection is hijacked to transport STDOUT, STDIN, and STDERR. <add> <add>By default the Docker daemon listens on `unix:///var/run/docker.sock` and the <add>client must have `root` access to interact with the daemon. If a group named <add>`docker` exists on your system, `docker` applies ownership of the socket to the <add>group. <add> <add>The current version of the API is v1.21 which means calling `/info` is the same <add>as calling `/v1.21/info`. To call an older version of the API use <ide> `/v1.20/info`. <ide> <add>## Authentication <add> <add>Since API version 1.2, the auth configuration is now handled client side, so the <add>client has to send the `authConfig` as a `POST` in `/images/(name)/push`. The <add>`authConfig`, set as the `X-Registry-Auth` header, is currently a Base64 encoded <add>(JSON) string with the following structure: <add> <add>``` <add>{"username": "string", "password": "string", "email": "string", <add> "serveraddress" : "string", "auth": ""} <add>``` <add> <add>Callers should leave the `auth` empty. The `serveraddress` is a domain/ip <add>without protocol. Throughout this structure, double quotes are required. <add> <add>## Using Docker Machine with the API <add> <add>If you are using `docker-machine`, the Docker daemon is on a virtual host that uses an encrypted TCP socket. This means, for Docker Machine users, you need to add extra parameters to `curl` or `wget` when making test API requests, for example: <add> <add>``` <add>curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://YOUR_VM_IP:2376/images/json <add> <add>wget --no-check-certificate --certificate=$DOCKER_CERT_PATH/cert.pem --private-key=$DOCKER_CERT_PATH/key.pem https://your_vm_ip:2376/images/json -O - -q <add>``` <add> <ide> ## Docker Events <ide> <ide> The following diagram depicts the container states accessible through the API. <ide> Running `docker rmi` emits an **untag** event when removing an image name. The <ide> <ide> > **Acknowledgement**: This diagram and the accompanying text were used with the permission of Matt Good and Gilder Labs. See Matt's original blog post [Docker Events Explained](http://gliderlabs.com/blog/2015/04/14/docker-events-explained/). <ide> <del>## v1.21 <del> <del>### Full documentation <del> <del>[*Docker Remote API v1.21*](/reference/api/docker_remote_api_v1.21/) <del> <del>## v1.20 <del> <del>### Full documentation <add>## Version history <ide> <del>[*Docker Remote API v1.20*](/reference/api/docker_remote_api_v1.20/) <add>This section lists each version from latest to oldest. Each listing includes a link to the full documentation set and the changes relevant in that release. <ide> <del>### What's new <add>### v1.21 API changes <ide> <del>`GET /containers/(id)/archive` <add>[Docker Remote API v1.21](/reference/api/docker_remote_api_v1.21/) documentation <ide> <del>**New!** <del>Get an archive of filesystem content from a container. <add>* `GET /volumes` lists volumes from all volume drivers. <add>* `POST /volumes` to create a volume. <add>* `GET /volumes/(name)` get low-level information about a volume. <add>* `DELETE /volumes/(name)`remove a volume with the specified name. <ide> <del>`PUT /containers/(id)/archive` <ide> <del>**New!** <del>Upload an archive of content to be extracted to an <del>existing directory inside a container's filesystem. <add>### v1.20 API changes <ide> <del>`POST /containers/(id)/copy` <add>[Docker Remote API v1.20](/reference/api/docker_remote_api_v1.20/) documentation <ide> <del>**Deprecated!** <del>This copy endpoint has been deprecated in favor of the above `archive` endpoint <del>which can be used to download files and directories from a container. <add>* `GET /containers/(id)/archive` get an archive of filesystem content from a container. <add>* `PUT /containers/(id)/archive` upload an archive of content to be extracted to <add>an existing directory inside a container's filesystem. <add>* `POST /containers/(id)/copy` is deprecated in favor of the above `archive` <add>endpoint which can be used to download files and directories from a container. <add>* The `hostConfig` option now accepts the field `GroupAdd`, which specifies a <add>list of additional groups that the container process will run as. <ide> <del>**New!** <del>The `hostConfig` option now accepts the field `GroupAdd`, which specifies a list of additional <del>groups that the container process will run as. <add>### v1.19 API changes <ide> <del>## v1.19 <add>[Docker Remote API v1.19](/reference/api/docker_remote_api_v1.19/) documentation <ide> <del>### Full documentation <del> <del>[*Docker Remote API v1.19*](/reference/api/docker_remote_api_v1.19/) <del> <del>### What's new <del> <del>**New!** <del>When the daemon detects a version mismatch with the client, usually when <add>* When the daemon detects a version mismatch with the client, usually when <ide> the client is newer than the daemon, an HTTP 400 is now returned instead <ide> of a 404. <del> <del>`GET /containers/(id)/stats` <del> <del>**New!** <del>You can now supply a `stream` bool to get only one set of stats and <del>disconnect <del> <del>`GET /containers/(id)/logs` <del> <del>**New!** <del> <del>This endpoint now accepts a `since` timestamp parameter. <del> <del>`GET /info` <del> <del>**New!** <del> <del>The fields `Debug`, `IPv4Forwarding`, `MemoryLimit`, and `SwapLimit` <del>are now returned as boolean instead of as an int. <del> <del>In addition, the end point now returns the new boolean fields <del>`CpuCfsPeriod`, `CpuCfsQuota`, and `OomKillDisable`. <del> <del>## v1.18 <del> <del>### Full documentation <del> <del>[*Docker Remote API v1.18*](/reference/api/docker_remote_api_v1.18/) <del> <del>### What's new <del> <del>`GET /version` <del> <del>**New!** <del>This endpoint now returns `Os`, `Arch` and `KernelVersion`. <del> <del>`POST /containers/create` <del> <del>`POST /containers/(id)/start` <del> <del>**New!** <del>You can set ulimit settings to be used within the container. <del> <del>`GET /info` <del> <del>**New!** <del>This endpoint now returns `SystemTime`, `HttpProxy`,`HttpsProxy` and `NoProxy`. <del> <del>`GET /images/json` <del> <del>**New!** <del>Added a `RepoDigests` field to include image digest information. <del> <del>`POST /build` <del> <del>**New!** <del>Builds can now set resource constraints for all containers created for the build. <del> <del>**New!** <del>(`CgroupParent`) can be passed in the host config to setup container cgroups under a specific cgroup. <del> <del>`POST /build` <del> <del>**New!** <del>Closing the HTTP request will now cause the build to be canceled. <del> <del>`POST /containers/(id)/exec` <del> <del>**New!** <del>Add `Warnings` field to response. <del> <del>## v1.17 <del> <del>### Full documentation <del> <del>[*Docker Remote API v1.17*](/reference/api/docker_remote_api_v1.17/) <del> <del>### What's new <del> <del>The build supports `LABEL` command. Use this to add metadata <del>to an image. For example you could add data describing the content of an image. <del> <del>`LABEL "com.example.vendor"="ACME Incorporated"` <del> <del>**New!** <del>`POST /containers/(id)/attach` and `POST /exec/(id)/start` <del> <del>**New!** <del>Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers. <del> <del>`POST /containers/create` <del> <del>**New!** <del>You can set labels on container create describing the container. <del> <del>`GET /containers/json` <del> <del>**New!** <del>The endpoint returns the labels associated with the containers (`Labels`). <del> <del>`GET /containers/(id)/json` <del> <del>**New!** <del>This endpoint now returns the list current execs associated with the container (`ExecIDs`). <del>This endpoint now returns the container labels (`Config.Labels`). <del> <del>`POST /containers/(id)/rename` <del> <del>**New!** <del>New endpoint to rename a container `id` to a new name. <del> <del>`POST /containers/create` <del>`POST /containers/(id)/start` <del> <del>**New!** <del>(`ReadonlyRootfs`) can be passed in the host config to mount the container's <del>root filesystem as read only. <del> <del>`GET /containers/(id)/stats` <del> <del>**New!** <del>This endpoint returns a live stream of a container's resource usage statistics. <del> <del>`GET /images/json` <del> <del>**New!** <del>This endpoint now returns the labels associated with each image (`Labels`). <del> <del> <del>## v1.16 <del> <del>### Full documentation <del> <del>[*Docker Remote API v1.16*](/reference/api/docker_remote_api_v1.16/) <del> <del>### What's new <del> <del>`GET /info` <del> <del>**New!** <del>`info` now returns the number of CPUs available on the machine (`NCPU`), <add>* `GET /containers/(id)/stats` now accepts `stream` bool to get only one set of stats and disconnect. <add>* `GET /containers/(id)/logs` now accepts a `since` timestamp parameter. <add>* `GET /info` The fields `Debug`, `IPv4Forwarding`, `MemoryLimit`, and <add>`SwapLimit` are now returned as boolean instead of as an int. In addition, the <add>end point now returns the new boolean fields `CpuCfsPeriod`, `CpuCfsQuota`, and <add>`OomKillDisable`. <add> <add>### v1.18 API changes <add> <add>[Docker Remote API v1.18](/reference/api/docker_remote_api_v1.18/) documentation <add> <add>* `GET /version` now returns `Os`, `Arch` and `KernelVersion`. <add>* `POST /containers/create` and `POST /containers/(id)/start`allow you to set ulimit settings for use in the container. <add>* `GET /info` now returns `SystemTime`, `HttpProxy`,`HttpsProxy` and `NoProxy`. <add>* `GET /images/json` added a `RepoDigests` field to include image digest information. <add>* `POST /build` can now set resource constraints for all containers created for the build. <add>* `CgroupParent` can be passed in the host config to setup container cgroups under a specific cgroup. <add>* `POST /build` closing the HTTP request cancels the build <add>* `POST /containers/(id)/exec` includes `Warnings` field to response. <add> <add>### v1.17 API changes <add> <add>[Docker Remote API v1.17](/reference/api/docker_remote_api_v1.17/) documentation <add> <add>* The build supports `LABEL` command. Use this to add metadata to an image. For <add>example you could add data describing the content of an image. `LABEL <add>"com.example.vendor"="ACME Incorporated"` <add>* `POST /containers/(id)/attach` and `POST /exec/(id)/start` <add>* The Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers. <add>* `POST /containers/create` sets labels on container create describing the container. <add>* `GET /containers/json` returns the labels associated with the containers (`Labels`). <add>* `GET /containers/(id)/json` returns the list current execs associated with the <add>container (`ExecIDs`). This endpoint now returns the container labels <add>(`Config.Labels`). <add>* `POST /containers/(id)/rename` renames a container `id` to a new name.* <add>* `POST /containers/create` and `POST /containers/(id)/start` callers can pass <add>`ReadonlyRootfs` in the host config to mount the container's root filesystem as <add>read only. <add>* `GET /containers/(id)/stats` returns a live stream of a container's resource usage statistics. <add>* `GET /images/json` returns the labels associated with each image (`Labels`). <add> <add> <add>### v1.16 API changes <add> <add>[Docker Remote API v1.16](/reference/api/docker_remote_api_v1.16/) <add> <add>* `GET /info` returns the number of CPUs available on the machine (`NCPU`), <ide> total memory available (`MemTotal`), a user-friendly name describing the running Docker daemon (`Name`), a unique ID identifying the daemon (`ID`), and <ide> a list of daemon labels (`Labels`). <add>* `POST /containers/create` callers can set the new container's MAC address explicitly. <add>* Volumes are now initialized when the container is created. <add>* `POST /containers/(id)/copy` copies data which is contained in a volume. <ide> <del>`POST /containers/create` <del> <del>**New!** <del>You can set the new container's MAC address explicitly. <del> <del>**New!** <del>Volumes are now initialized when the container is created. <del> <del>`POST /containers/(id)/copy` <del> <del>**New!** <del>You can now copy data which is contained in a volume. <add>### v1.15 API changes <ide> <del>## v1.15 <add>[Docker Remote API v1.15](/reference/api/docker_remote_api_v1.15/) documentation <ide> <del>### Full documentation <add>`POST /containers/create` you can set a container's `HostConfig` when creating a <add>container. Previously this was only available when starting a container. <ide> <del>[*Docker Remote API v1.15*](/reference/api/docker_remote_api_v1.15/) <add>### v1.14 API changes <ide> <del>### What's new <add>[Docker Remote API v1.14](/reference/api/docker_remote_api_v1.14/) documentation <ide> <del>`POST /containers/create` <del> <del>**New!** <del>It is now possible to set a container's HostConfig when creating a container. <del>Previously this was only available when starting a container. <del> <del>## v1.14 <del> <del>### Full documentation <del> <del>[*Docker Remote API v1.14*](/reference/api/docker_remote_api_v1.14/) <del> <del>### What's new <del> <del>`DELETE /containers/(id)` <del> <del>**New!** <del>When using `force`, the container will be immediately killed with SIGKILL. <del> <del>`POST /containers/(id)/start` <del> <del>**New!** <del>The `hostConfig` option now accepts the field `CapAdd`, which specifies a list of capabilities <add>* `DELETE /containers/(id)` when using `force`, the container will be immediately killed with SIGKILL. <add>* `POST /containers/(id)/start` the `hostConfig` option accepts the field `CapAdd`, which specifies a list of capabilities <ide> to add, and the field `CapDrop`, which specifies a list of capabilities to drop. <add>* `POST /images/create` th `fromImage` and `repo` parameters supportthe <add>`repo:tag` format. Consequently, the `tag` parameter is now obsolete. Using the <add>new format and the `tag` parameter at the same time will return an error. <ide> <del>`POST /images/create` <del> <del>**New!** <del>The `fromImage` and `repo` parameters now supports the `repo:tag` format. <del>Consequently, the `tag` parameter is now obsolete. Using the new format and <del>the `tag` parameter at the same time will return an error. <ide> <ide> <ide><path>docs/reference/api/docker_remote_api_v1.21.md <ide> Status Codes: <ide> - **404** – no such exec instance <ide> - **500** - server error <ide> <add>## 2.4 Volumes <add> <add>### List volumes <add> <add>`GET /volumes` <add> <add>**Example request**: <add> <add> GET /volumes HTTP/1.1 <add> <add>**Example response**: <add> <add> HTTP/1.1 200 OK <add> Content-Type: application/json <add> <add> { <add> "Volumes": [ <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <add> ] <add> } <add> <add>Query Parameters: <add> <add>- **filter** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true` <add> <add>Status Codes: <add> <add>- **200** - no error <add>- **500** - server error <add> <add>### Create a volume <add> <add>`POST /volumes` <add> <add>Create a volume <add> <add>**Example request**: <add> <add> POST /volumes HTTP/1.1 <add> Content-Type: application/json <add> <add> { <add> "Name": "tardis" <add> } <add> <add>**Example response**: <add> <add> HTTP/1.1 201 Created <add> Content-Type: application/json <add> <add> { <add> "Name": "tardis" <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <add> <add>Status Codes: <add> <add>- **201** - no error <add>- **500** - server error <add> <add>JSON Parameters: <add> <add>- **Name** - The new volume's name. If not specified, Docker generates a name. <add>- **Driver** - Name of the volume driver to use. Defaults to `local` for the name. <add>- **DriverOpts** - A mapping of driver options and values. These options are <add> passed directly to the driver and are driver specific. <add> <add>### Inspect a volume <add> <add>`GET /volumes/(name)` <add> <add>Return low-level information on the volume `name` <add> <add>**Example request**: <add> <add> GET /volumes/tardis <add> <add>**Example response**: <add> <add> HTTP/1.1 200 OK <add> Content-Type: application/json <add> <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <add> <add>Status Codes: <add> <add>- **200** - no error <add>- **404** - no such volume <add>- **500** - server error <add> <add>### Remove a volume <add> <add>`DELETE /volumes/(name)` <add> <add>Instruct the driver to remove the volume (`name`). <add> <add>**Example request**: <add> <add> DELETE /volumes/local/tardis HTTP/1.1 <add> <add>**Example response**: <add> <add> HTTP/1.1 204 No Content <add> <add>Status Codes <add> <add>- **204** - no error <add>- **404** - no such volume or volume driver <add>- **409** - volume is in use and cannot be removed <add>- **500** - server error <add> <ide> # 3. Going further <ide> <ide> ## 3.1 Inside `docker run` <ide><path>docs/reference/commandline/ps.md <ide> Running `docker ps --no-trunc` showing 2 linked containers. <ide> <ide> ## Filtering <ide> <del>The filtering flag (`-f` or `--filter)` format is a `key=value` pair. If there is more <add>The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more <ide> than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`) <ide> <ide> The currently supported filters are: <ide><path>docs/reference/commandline/volume_create.md <add><!--[metadata]> <add>+++ <add>title = "volume create" <add>description = "The volume create command description and usage" <add>keywords = ["volume, create"] <add>[menu.main] <add>parent = "smn_cli" <add>+++ <add><![end-metadata]--> <add> <add># volume create <add> <add> Usage: docker volume create [OPTIONS] <add> <add> Create a volume <add> <add> -d, --driver=local Specify volume driver name <add> --help=false Print usage <add> --name= Specify volume name <add> -o, --opt=map[] Set driver specific options <add> <add>Creates a new volume that containers can can consume and store data in. If a name is not specified, Docker generates a random name. You create a volume and then configure the container to use it, for example: <add> <add> $ docker volume create --name hello <add> hello <add> $ docker run -d -v hello:/world busybox ls /world <add> <add>The mount is created inside the container's `/src` directory. Docker does not support relative paths for mount points inside the container. <add> <add>Multiple containers can use the same volume in the same time period. This is useful if two containers need access to shared data. For example, if one container writes and the other reads the data. <add> <add>## Driver specific options <add> <add>Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options: <add> <add> $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey <add> <add>These options are passed directly to the volume driver. Options for <add>different volume drivers may do different things (or nothing at all). <add> <add>*Note*: The built-in `local` volume driver does not currently accept any options. <add> <ide><path>docs/reference/commandline/volume_inspect.md <add><!--[metadata]> <add>+++ <add>title = "volume inspect" <add>description = "The volume inspect command description and usage" <add>keywords = ["volume, inspect"] <add>[menu.main] <add>parent = "smn_cli" <add>+++ <add><![end-metadata]--> <add> <add># volume inspect <add> <add> Usage: docker volume inspect [OPTIONS] [VOLUME NAME] <add> <add> Inspect a volume <add> <add> -f, --format= Format the output using the given go template. <add> <add>Returns information about a volume. By default, this command renders all results <add>in a JSON array. You can specify an alternate format to execute a given template <add>is executed for each result. Go's <add>[text/template](http://golang.org/pkg/text/template/) package describes all the <add>details of the format. <add> <add>Example output: <add> <add> $ docker volume create <add> 85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d <add> $ docker volume inspect 85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d <add> [ <add> { <add> "Name": "85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d/_data" <add> } <add> ] <add> <add> $ docker volume inspect --format '{{ .Mountpoint }}' 85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d <add> "/var/lib/docker/volumes/85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d/_data" <ide><path>docs/reference/commandline/volume_ls.md <add><!--[metadata]> <add>+++ <add>title = "volume ls" <add>description = "The volume ls command description and usage" <add>keywords = ["volume, list"] <add>[menu.main] <add>parent = "smn_cli" <add>+++ <add><![end-metadata]--> <add> <add># volume ls <add> <add> Usage: docker volume ls [OPTIONS] <add> <add> List volumes <add> <add> -f, --filter=[] Provide filter values (i.e. 'dangling=true') <add> --help=false Print usage <add> -q, --quiet=false Only display volume names <add> <add>Lists all the volumes Docker knows about. You can filter using the `-f` or `--filter` flag. The filtering format is a `key=value` pair. To specify more than one filter, pass multiple flags (for example, `--filter "foo=bar" --filter "bif=baz"`) <add> <add>There is a single supported filter `dangling=value` which takes a boolean of `true` or `false`. <add> <add>Example output: <add> <add> $ docker volume create --name rose <add> rose <add> $docker volume create --name tyler <add> tyler <add> $ docker volume ls <add> DRIVER VOLUME NAME <add> local rose <add> local tyler <ide><path>docs/reference/commandline/volume_rm.md <add><!--[metadata]> <add>+++ <add>title = "ps" <add>description = "the volume rm command description and usage" <add>keywords = ["volume, rm"] <add>[menu.main] <add>parent = "smn_cli" <add>+++ <add><![end-metadata]--> <add> <add># volume rm <add> <add> Usage: docker volume rm [OPTIONS] [VOLUME NAME] <add> <add> Remove a volume <add> <add> --help=false Print usage <add> <add>Removes a volume. You cannot remove a volume that is in use by a container. <add> <add> $ docker volume rm hello <add> hello <ide><path>integration-cli/check_test.go <ide> type DockerSuite struct { <ide> func (s *DockerSuite) TearDownTest(c *check.C) { <ide> deleteAllContainers() <ide> deleteAllImages() <add> deleteAllVolumes() <ide> } <ide> <ide> func init() { <ide><path>integration-cli/docker_api_volumes_test.go <add>package main <add> <add>import ( <add> "encoding/json" <add> "net/http" <add> "path" <add> <add> "github.com/docker/docker/api/types" <add> "github.com/go-check/check" <add>) <add> <add>func (s *DockerSuite) TestVolumesApiList(c *check.C) { <add> dockerCmd(c, "run", "-d", "-v", "/foo", "busybox") <add> <add> status, b, err := sockRequest("GET", "/volumes", nil) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusOK) <add> <add> var volumes types.VolumesListResponse <add> c.Assert(json.Unmarshal(b, &volumes), check.IsNil) <add> <add> c.Assert(len(volumes.Volumes), check.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <add>} <add> <add>func (s *DockerSuite) TestVolumesApiCreate(c *check.C) { <add> config := types.VolumeCreateRequest{ <add> Name: "test", <add> } <add> status, b, err := sockRequest("POST", "/volumes", config) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusCreated, check.Commentf(string(b))) <add> <add> var vol types.Volume <add> err = json.Unmarshal(b, &vol) <add> c.Assert(err, check.IsNil) <add> <add> c.Assert(path.Base(path.Dir(vol.Mountpoint)), check.Equals, config.Name) <add>} <add> <add>func (s *DockerSuite) TestVolumesApiRemove(c *check.C) { <add> dockerCmd(c, "run", "-d", "-v", "/foo", "--name=test", "busybox") <add> <add> status, b, err := sockRequest("GET", "/volumes", nil) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusOK) <add> <add> var volumes types.VolumesListResponse <add> c.Assert(json.Unmarshal(b, &volumes), check.IsNil) <add> c.Assert(len(volumes.Volumes), check.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <add> <add> v := volumes.Volumes[0] <add> status, _, err = sockRequest("DELETE", "/volumes/"+v.Name, nil) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusConflict, check.Commentf("Should not be able to remove a volume that is in use")) <add> <add> dockerCmd(c, "rm", "-f", "test") <add> status, data, err := sockRequest("DELETE", "/volumes/"+v.Name, nil) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusNoContent, check.Commentf(string(data))) <add> <add>} <add> <add>func (s *DockerSuite) TestVolumesApiInspect(c *check.C) { <add> config := types.VolumeCreateRequest{ <add> Name: "test", <add> } <add> status, b, err := sockRequest("POST", "/volumes", config) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusCreated, check.Commentf(string(b))) <add> <add> status, b, err = sockRequest("GET", "/volumes", nil) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusOK, check.Commentf(string(b))) <add> <add> var volumes types.VolumesListResponse <add> c.Assert(json.Unmarshal(b, &volumes), check.IsNil) <add> c.Assert(len(volumes.Volumes), check.Equals, 1, check.Commentf("\n%v", volumes.Volumes)) <add> <add> var vol types.Volume <add> status, b, err = sockRequest("GET", "/volumes/"+config.Name, nil) <add> c.Assert(err, check.IsNil) <add> c.Assert(status, check.Equals, http.StatusOK, check.Commentf(string(b))) <add> c.Assert(json.Unmarshal(b, &vol), check.IsNil) <add> c.Assert(vol.Name, check.Equals, config.Name) <add>} <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithVolumesRefs(c *check.C) { <ide> if err := s.d.Restart(); err != nil { <ide> c.Fatal(err) <ide> } <add> <ide> if _, err := s.d.Cmd("run", "-d", "--volumes-from", "volrestarttest1", "--name", "volrestarttest2", "busybox", "top"); err != nil { <ide> c.Fatal(err) <ide> } <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithPausedContainer(c *check.C) { <ide> c.Fatal(err) <ide> } <ide> } <add>} <add> <add>func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) { <add> c.Assert(s.d.StartWithBusybox(), check.IsNil) <add> <add> out, err := s.d.Cmd("create", "-v", "test:/foo", "busybox") <add> c.Assert(err, check.IsNil, check.Commentf(out)) <add> <add> c.Assert(s.d.Restart(), check.IsNil) <ide> <add> out, err = s.d.Cmd("volume", "rm", "test") <add> c.Assert(err, check.Not(check.IsNil), check.Commentf("should not be able to remove in use volume after daemon restart")) <add> c.Assert(strings.Contains(out, "in use"), check.Equals, true) <add>} <add> <add>func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) { <add> c.Assert(s.d.Start(), check.IsNil) <add> <add> _, err := s.d.Cmd("volume", "create", "--name", "test") <add> c.Assert(err, check.IsNil) <add> c.Assert(s.d.Restart(), check.IsNil) <add> <add> _, err = s.d.Cmd("volume", "inspect", "test") <add> c.Assert(err, check.IsNil) <ide> } <ide><path>integration-cli/docker_cli_help_test.go <ide> func (s *DockerSuite) TestHelpTextVerify(c *check.C) { <ide> <ide> } <ide> <del> expected := 39 <add> expected := 40 <ide> if isLocalDaemon { <ide> expected++ // for the daemon command <ide> } <ide><path>integration-cli/docker_cli_run_test.go <ide> func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *check.C) { <ide> containerID, err := inspectField(name, "Id") <ide> c.Assert(containerID, check.Equals, "", check.Commentf("Expected not to have this container: %s!", containerID)) <ide> } <add> <add>func (s *DockerSuite) TestRunNamedVolume(c *check.C) { <add> dockerCmd(c, "run", "--name=test", "-v", "testing:/foo", "busybox", "sh", "-c", "echo hello > /foo/bar") <add> <add> out, _ := dockerCmd(c, "run", "--volumes-from", "test", "busybox", "sh", "-c", "cat /foo/bar") <add> c.Assert(strings.TrimSpace(out), check.Equals, "hello") <add> <add> out, _ = dockerCmd(c, "run", "-v", "testing:/foo", "busybox", "sh", "-c", "cat /foo/bar") <add> c.Assert(strings.TrimSpace(out), check.Equals, "hello") <add>} <ide><path>integration-cli/docker_cli_start_volume_driver_unix_test.go <ide> func (s *DockerExternalVolumeSuite) SetUpSuite(c *check.C) { <ide> http.Error(w, err.Error(), 500) <ide> } <ide> <del> p := hostVolumePath(pr.name) <del> if err := os.RemoveAll(p); err != nil { <del> http.Error(w, err.Error(), 500) <del> } <del> <ide> w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") <ide> fmt.Fprintln(w, `{}`) <ide> }) <ide> func (s *DockerExternalVolumeSuite) TestStartExternalNamedVolumeDriver(c *check. <ide> <ide> out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", "test-external-volume-driver", "busybox:latest", "cat", "/tmp/external-volume-test/test") <ide> if err != nil { <del> c.Fatal(err) <add> c.Fatal(out, err) <ide> } <ide> <ide> if !strings.Contains(out, s.server.URL) { <ide> func (s DockerExternalVolumeSuite) TestStartExternalVolumeDriverVolumesFrom(c *c <ide> c.Fatal(err) <ide> } <ide> <del> if _, err := s.d.Cmd("run", "-d", "--name", "vol-test1", "-v", "/foo", "--volume-driver", "test-external-volume-driver", "busybox:latest"); err != nil { <del> c.Fatal(err) <del> } <add> out, err := s.d.Cmd("run", "-d", "--name", "vol-test1", "-v", "/foo", "--volume-driver", "test-external-volume-driver", "busybox:latest") <add> c.Assert(err, check.IsNil, check.Commentf(out)) <ide> <del> if _, err := s.d.Cmd("run", "--rm", "--volumes-from", "vol-test1", "--name", "vol-test2", "busybox", "ls", "/tmp"); err != nil { <del> c.Fatal(err) <del> } <add> out, err = s.d.Cmd("run", "--rm", "--volumes-from", "vol-test1", "--name", "vol-test2", "busybox", "ls", "/tmp") <add> c.Assert(err, check.IsNil, check.Commentf(out)) <ide> <del> if _, err := s.d.Cmd("rm", "-f", "vol-test1"); err != nil { <del> c.Fatal(err) <del> } <add> out, err = s.d.Cmd("rm", "-fv", "vol-test1") <add> c.Assert(err, check.IsNil, check.Commentf(out)) <ide> <ide> c.Assert(s.ec.activations, check.Equals, 1) <del> c.Assert(s.ec.creations, check.Equals, 2) <add> c.Assert(s.ec.creations, check.Equals, 1) <ide> c.Assert(s.ec.removals, check.Equals, 1) <ide> c.Assert(s.ec.mounts, check.Equals, 2) <ide> c.Assert(s.ec.unmounts, check.Equals, 2) <ide> func (s DockerExternalVolumeSuite) TestStartExternalVolumeDriverDeleteContainer( <ide> c.Fatal(err) <ide> } <ide> <del> if _, err := s.d.Cmd("run", "-d", "--name", "vol-test1", "-v", "/foo", "--volume-driver", "test-external-volume-driver", "busybox:latest"); err != nil { <del> c.Fatal(err) <add> if out, err := s.d.Cmd("run", "-d", "--name", "vol-test1", "-v", "/foo", "--volume-driver", "test-external-volume-driver", "busybox:latest"); err != nil { <add> c.Fatal(out, err) <ide> } <ide> <del> if _, err := s.d.Cmd("rm", "-fv", "vol-test1"); err != nil { <del> c.Fatal(err) <add> if out, err := s.d.Cmd("rm", "-fv", "vol-test1"); err != nil { <add> c.Fatal(out, err) <ide> } <ide> <ide> c.Assert(s.ec.activations, check.Equals, 1) <ide><path>integration-cli/docker_cli_volume_test.go <add>package main <add> <add>import ( <add> "os/exec" <add> "strings" <add> <add> "github.com/go-check/check" <add>) <add> <add>func (s *DockerSuite) TestVolumeCliCreate(c *check.C) { <add> dockerCmd(c, "volume", "create") <add> <add> _, err := runCommand(exec.Command(dockerBinary, "volume", "create", "-d", "nosuchdriver")) <add> c.Assert(err, check.Not(check.IsNil)) <add> <add> out, _ := dockerCmd(c, "volume", "create", "--name=test") <add> name := strings.TrimSpace(out) <add> c.Assert(name, check.Equals, "test") <add>} <add> <add>func (s *DockerSuite) TestVolumeCliInspect(c *check.C) { <add> c.Assert( <add> exec.Command(dockerBinary, "volume", "inspect", "doesntexist").Run(), <add> check.Not(check.IsNil), <add> check.Commentf("volume inspect should error on non-existant volume"), <add> ) <add> <add> out, _ := dockerCmd(c, "volume", "create") <add> name := strings.TrimSpace(out) <add> out, _ = dockerCmd(c, "volume", "inspect", "--format='{{ .Name }}'", name) <add> c.Assert(strings.TrimSpace(out), check.Equals, name) <add> <add> dockerCmd(c, "volume", "create", "--name", "test") <add> out, _ = dockerCmd(c, "volume", "inspect", "--format='{{ .Name }}'", "test") <add> c.Assert(strings.TrimSpace(out), check.Equals, "test") <add>} <add> <add>func (s *DockerSuite) TestVolumeCliLs(c *check.C) { <add> out, _ := dockerCmd(c, "volume", "create") <add> id := strings.TrimSpace(out) <add> <add> dockerCmd(c, "volume", "create", "--name", "test") <add> dockerCmd(c, "run", "-v", "/foo", "busybox", "ls", "/") <add> <add> out, _ = dockerCmd(c, "volume", "ls") <add> outArr := strings.Split(strings.TrimSpace(out), "\n") <add> c.Assert(len(outArr), check.Equals, 4, check.Commentf("\n%s", out)) <add> <add> // Since there is no guarentee of ordering of volumes, we just make sure the names are in the output <add> c.Assert(strings.Contains(out, id+"\n"), check.Equals, true) <add> c.Assert(strings.Contains(out, "test\n"), check.Equals, true) <add>} <add> <add>func (s *DockerSuite) TestVolumeCliRm(c *check.C) { <add> out, _ := dockerCmd(c, "volume", "create") <add> id := strings.TrimSpace(out) <add> <add> dockerCmd(c, "volume", "create", "--name", "test") <add> dockerCmd(c, "volume", "rm", id) <add> dockerCmd(c, "volume", "rm", "test") <add> <add> out, _ = dockerCmd(c, "volume", "ls") <add> outArr := strings.Split(strings.TrimSpace(out), "\n") <add> c.Assert(len(outArr), check.Equals, 1, check.Commentf("%s\n", out)) <add> <add> volumeID := "testing" <add> dockerCmd(c, "run", "-v", volumeID+":/foo", "--name=test", "busybox", "sh", "-c", "echo hello > /foo/bar") <add> out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "volume", "rm", "testing")) <add> c.Assert( <add> err, <add> check.Not(check.IsNil), <add> check.Commentf("Should not be able to remove volume that is in use by a container\n%s", out)) <add> <add> out, _ = dockerCmd(c, "run", "--volumes-from=test", "--name=test2", "busybox", "sh", "-c", "cat /foo/bar") <add> c.Assert(strings.TrimSpace(out), check.Equals, "hello") <add> dockerCmd(c, "rm", "-fv", "test2") <add> dockerCmd(c, "volume", "inspect", volumeID) <add> dockerCmd(c, "rm", "-f", "test") <add> <add> out, _ = dockerCmd(c, "run", "--name=test2", "-v", volumeID+":/foo", "busybox", "sh", "-c", "cat /foo/bar") <add> c.Assert(strings.TrimSpace(out), check.Equals, "hello", check.Commentf("volume data was removed")) <add> dockerCmd(c, "rm", "test2") <add> <add> dockerCmd(c, "volume", "rm", volumeID) <add> c.Assert( <add> exec.Command("volume", "rm", "doesntexist").Run(), <add> check.Not(check.IsNil), <add> check.Commentf("volume rm should fail with non-existant volume"), <add> ) <add>} <ide><path>integration-cli/docker_utils.go <ide> func deleteAllContainers() error { <ide> return nil <ide> } <ide> <add>func deleteAllVolumes() error { <add> volumes, err := getAllVolumes() <add> if err != nil { <add> return err <add> } <add> var errors []string <add> for _, v := range volumes { <add> status, b, err := sockRequest("DELETE", "/volumes/"+v.Name, nil) <add> if err != nil { <add> errors = append(errors, err.Error()) <add> continue <add> } <add> if status != http.StatusNoContent { <add> errors = append(errors, fmt.Sprintf("error deleting volume %s: %s", v.Name, string(b))) <add> } <add> } <add> if len(errors) > 0 { <add> return fmt.Errorf(strings.Join(errors, "\n")) <add> } <add> return nil <add>} <add> <add>func getAllVolumes() ([]*types.Volume, error) { <add> var volumes types.VolumesListResponse <add> _, b, err := sockRequest("GET", "/volumes", nil) <add> if err != nil { <add> return nil, err <add> } <add> if err := json.Unmarshal(b, &volumes); err != nil { <add> return nil, err <add> } <add> return volumes.Volumes, nil <add>} <add> <ide> var protectedImages = map[string]struct{}{} <ide> <ide> func init() { <ide><path>man/docker-volume-create.1.md <add>% DOCKER(1) Docker User Manuals <add>% Docker Community <add>% JULY 2015 <add># NAME <add>docker-volume-create - Create a new volume <add> <add># SYNOPSIS <add>**docker volume create** <add>[**-d**|**--driver**[=*local*]] <add>[**--name**[=**]] <add>[**-o**|**--opt**[=**]] <add> <add>[OPTIONS] <add> <add># DESCRIPTION <add> <add>Creates a new volume that containers can consume and store data in. If a name is not specified, Docker generates a random name. You create a volume and then configure the container to use it, for example: <add> <add> ``` <add> $ docker volume create --name hello <add> hello <add> $ docker run -d -v hello:/world busybox ls /world <add> ``` <add> <add>The mount is created inside the container's `/src` directory. Docker doesn't not support relative paths for mount points inside the container. <add> <add>Multiple containers can use the same volume in the same time period. This is useful if two containers need access to shared data. For example, if one container writes and the other reads the data. <add> <add>## Driver specific options <add> <add>Some volume drivers may take options to customize the volume creation. Use the `-o` or `--opt` flags to pass driver options: <add> <add> ``` <add> $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey <add> ``` <add> <add>These options are passed directly to the volume driver. Options for <add>different volume drivers may do different things (or nothing at all). <add> <add>*Note*: The built-in `local` volume driver does not currently accept any options. <add> <add># OPTIONS <add>**-d**, **--driver**=[] <add> Specify volume driver name <add>**--name**="" <add> Specify volume name <add>**-o**, **--opt**=map[] <add> Set driver specific options <add> <add># HISTORY <add>July 2015, created by Brian Goff <cpuguy83@gmail.com> <ide><path>man/docker-volume-inspect.1.md <add>% DOCKER(1) Docker User Manuals <add>% Docker Community <add>% JULY 2015 <add># NAME <add>docker-volume-inspect - Get low-level information about a volume <add> <add># SYNOPSIS <add>**docker volume inspect** <add>[**-f**|**--format**[=**]] <add> <add>[OPTIONS] [VOLUME NAME] <add> <add># DESCRIPTION <add> <add>Returns information about a volume. By default, this command renders all results <add>in a JSON array. You can specify an alternate format to execute a given template <add>is executed for each result. Go's <add>http://golang.org/pkg/text/template/ package describes all the details of the <add>format. <add> <add># OPTIONS <add>**-f**, **--format**="" <add> Format the output using the given go template. <add> <add># HISTORY <add>July 2015, created by Brian Goff <cpuguy83@gmail.com> <ide><path>man/docker-volume-ls.1.md <add>% DOCKER(1) Docker User Manuals <add>% Docker Community <add>% JULY 2015 <add># NAME <add>docker-volume-ls - List all volumes <add> <add># SYNOPSIS <add>**docker volume ls** <add>[**-f**|**--filter**[=**]] <add>[**-q**|**--quiet**[=**]] <add> <add>[OPTIONS] <add> <add># DESCRIPTION <add> <add>Lists all the volumes Docker knows about. You can filter using the `-f` or `--filter` flag. The filtering format is a `key=value` pair. To specify more than one filter, pass multiple flags (for example, `--filter "foo=bar" --filter "bif=baz"`) <add> <add>There is a single supported filter `dangling=value` which takes a boolean of `true` or `false`. <add> <add># OPTIONS <add>**-f**, **--filter**="" <add> Provide filter values (i.e. 'dangling=true') <add>**-q**, **--quiet**=false <add> Only display volume names <add> <add># HISTORY <add>July 2015, created by Brian Goff <cpuguy83@gmail.com> <ide><path>man/docker-volume-rm.1.md <add>% DOCKER(1) Docker User Manuals <add>% Docker Community <add>% JULY 2015 <add># NAME <add>docker-volume-rm - Remove a volume <add> <add># SYNOPSIS <add>**docker volume rm** <add> <add>[OPTIONS] [VOLUME NAME] <add> <add># DESCRIPTION <add> <add>Removes a volume. You cannot remove a volume that is in use by a container. <add> <add> ``` <add> $ docker volume rm hello <add> hello <add> ``` <add> <add># OPTIONS <add> <add># HISTORY <add>July 2015, created by Brian Goff <cpuguy83@gmail.com> <ide><path>opts/opts.go <ide> func (opts *MapOpts) Set(value string) error { <ide> return nil <ide> } <ide> <add>func (opts *MapOpts) GetAll() map[string]string { <add> return opts.values <add>} <add> <ide> func (opts *MapOpts) String() string { <ide> return fmt.Sprintf("%v", map[string]string((opts.values))) <ide> } <ide><path>pkg/plugins/client.go <ide> import ( <ide> ) <ide> <ide> const ( <del> versionMimetype = "application/vnd.docker.plugins.v1+json" <add> versionMimetype = "application/vnd.docker.plugins.v1.1+json" <ide> defaultTimeOut = 30 <ide> ) <ide> <add>type remoteError struct { <add> method string <add> err string <add>} <add> <add>func (e *remoteError) Error() string { <add> return fmt.Sprintf("Plugin Error: %s, %s", e.err, e.method) <add>} <add> <ide> // NewClient creates a new plugin client (http). <ide> func NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error) { <ide> tr := &http.Transport{} <ide> func (c *Client) callWithRetry(serviceMethod string, args interface{}, ret inter <ide> if resp.StatusCode != http.StatusOK { <ide> remoteErr, err := ioutil.ReadAll(resp.Body) <ide> if err != nil { <del> return fmt.Errorf("Plugin Error: %s", err) <add> return &remoteError{err.Error(), serviceMethod} <ide> } <del> return fmt.Errorf("Plugin Error: %s", remoteErr) <add> return &remoteError{string(remoteErr), serviceMethod} <ide> } <ide> <ide> return json.NewDecoder(resp.Body).Decode(&ret) <ide><path>pkg/plugins/pluginrpc-gen/parser.go <ide> import ( <ide> "go/parser" <ide> "go/token" <ide> "reflect" <del> "strings" <ide> ) <ide> <ide> var ErrBadReturn = errors.New("found return arg with no name: all args must be named") <ide> type arg struct { <ide> } <ide> <ide> func (a *arg) String() string { <del> return strings.ToLower(a.Name) + " " + strings.ToLower(a.ArgType) <add> return a.Name + " " + a.ArgType <ide> } <ide> <ide> // Parses the given file for an interface definition with the given name <ide><path>volume/drivers/adapter.go <ide> func (a *volumeDriverAdapter) Name() string { <ide> return a.name <ide> } <ide> <del>func (a *volumeDriverAdapter) Create(name string) (volume.Volume, error) { <del> err := a.proxy.Create(name) <add>func (a *volumeDriverAdapter) Create(name string, opts map[string]string) (volume.Volume, error) { <add> err := a.proxy.Create(name, opts) <ide> if err != nil { <ide> return nil, err <ide> } <ide> type volumeAdapter struct { <ide> eMount string // ephemeral host volume path <ide> } <ide> <add>type proxyVolume struct { <add> Name string <add> Mountpoint string <add>} <add> <ide> func (a *volumeAdapter) Name() string { <ide> return a.name <ide> } <ide><path>volume/drivers/api.go <del>//go:generate pluginrpc-gen -i $GOFILE -o proxy.go -type VolumeDriver -name VolumeDriver <del> <del>package volumedrivers <del> <del>import "github.com/docker/docker/volume" <del> <del>// NewVolumeDriver returns a driver has the given name mapped on the given client. <del>func NewVolumeDriver(name string, c client) volume.Driver { <del> proxy := &volumeDriverProxy{c} <del> return &volumeDriverAdapter{name, proxy} <del>} <del> <del>// VolumeDriver defines the available functions that volume plugins must implement. <del>type VolumeDriver interface { <del> // Create a volume with the given name <del> Create(name string) (err error) <del> // Remove the volume with the given name <del> Remove(name string) (err error) <del> // Get the mountpoint of the given volume <del> Path(name string) (mountpoint string, err error) <del> // Mount the given volume and return the mountpoint <del> Mount(name string) (mountpoint string, err error) <del> // Unmount the given volume <del> Unmount(name string) (err error) <del>} <ide><path>volume/drivers/extpoint.go <add>//go:generate pluginrpc-gen -i $GOFILE -o proxy.go -type VolumeDriver -name VolumeDriver <add> <ide> package volumedrivers <ide> <ide> import ( <ide> import ( <ide> <ide> var drivers = &driverExtpoint{extensions: make(map[string]volume.Driver)} <ide> <add>// NewVolumeDriver returns a driver has the given name mapped on the given client. <add>func NewVolumeDriver(name string, c client) volume.Driver { <add> proxy := &volumeDriverProxy{c} <add> return &volumeDriverAdapter{name, proxy} <add>} <add> <add>type opts map[string]string <add> <add>// VolumeDriver defines the available functions that volume plugins must implement. <add>type VolumeDriver interface { <add> // Create a volume with the given name <add> Create(name string, opts opts) (err error) <add> // Remove the volume with the given name <add> Remove(name string) (err error) <add> // Get the mountpoint of the given volume <add> Path(name string) (mountpoint string, err error) <add> // Mount the given volume and return the mountpoint <add> Mount(name string) (mountpoint string, err error) <add> // Unmount the given volume <add> Unmount(name string) (err error) <add>} <add> <ide> type driverExtpoint struct { <ide> extensions map[string]volume.Driver <ide> sync.Mutex <ide><path>volume/drivers/proxy.go <ide> type volumeDriverProxy struct { <ide> <ide> type volumeDriverProxyCreateRequest struct { <ide> Name string <add> Opts opts <ide> } <ide> <ide> type volumeDriverProxyCreateResponse struct { <ide> Err string <ide> } <ide> <del>func (pp *volumeDriverProxy) Create(name string) (err error) { <add>func (pp *volumeDriverProxy) Create(name string, opts opts) (err error) { <ide> var ( <ide> req volumeDriverProxyCreateRequest <ide> ret volumeDriverProxyCreateResponse <ide> ) <ide> <ide> req.Name = name <add> req.Opts = opts <ide> if err = pp.Call("VolumeDriver.Create", req, &ret); err != nil { <ide> return <ide> } <ide><path>volume/drivers/proxy_test.go <ide> func TestVolumeRequestError(t *testing.T) { <ide> <ide> driver := volumeDriverProxy{client} <ide> <del> if err = driver.Create("volume"); err == nil { <add> if err = driver.Create("volume", nil); err == nil { <ide> t.Fatal("Expected error, was nil") <ide> } <ide> <ide><path>volume/local/local.go <ide> const ( <ide> volumesPathName = "volumes" <ide> ) <ide> <del>var oldVfsDir = filepath.Join("vfs", "dir") <add>var ( <add> // ErrNotFound is the typed error returned when the requested volume name can't be found <add> ErrNotFound = errors.New("volume not found") <add> oldVfsDir = filepath.Join("vfs", "dir") <add>) <ide> <ide> // New instantiates a new Root instance with the provided scope. Scope <ide> // is the base path that the Root instance uses to store its <ide> func New(scope string) (*Root, error) { <ide> path: r.DataPath(name), <ide> } <ide> } <add> <ide> return r, nil <ide> } <ide> <ide> type Root struct { <ide> volumes map[string]*localVolume <ide> } <ide> <add>// List lists all the volumes <add>func (r *Root) List() []volume.Volume { <add> var ls []volume.Volume <add> for _, v := range r.volumes { <add> ls = append(ls, v) <add> } <add> return ls <add>} <add> <ide> // DataPath returns the constructed path of this volume. <ide> func (r *Root) DataPath(volumeName string) string { <ide> return filepath.Join(r.path, volumeName, VolumeDataPathName) <ide> func (r *Root) Name() string { <ide> // Create creates a new volume.Volume with the provided name, creating <ide> // the underlying directory tree required for this volume in the <ide> // process. <del>func (r *Root) Create(name string) (volume.Volume, error) { <add>func (r *Root) Create(name string, _ map[string]string) (volume.Volume, error) { <ide> r.m.Lock() <ide> defer r.m.Unlock() <ide> <ide> v, exists := r.volumes[name] <del> if !exists { <del> path := r.DataPath(name) <del> if err := os.MkdirAll(path, 0755); err != nil { <del> if os.IsExist(err) { <del> return nil, fmt.Errorf("volume already exists under %s", filepath.Dir(path)) <del> } <del> return nil, err <del> } <del> v = &localVolume{ <del> driverName: r.Name(), <del> name: name, <del> path: path, <add> if exists { <add> return v, nil <add> } <add> <add> path := r.DataPath(name) <add> if err := os.MkdirAll(path, 0755); err != nil { <add> if os.IsExist(err) { <add> return nil, fmt.Errorf("volume already exists under %s", filepath.Dir(path)) <ide> } <del> r.volumes[name] = v <add> return nil, err <ide> } <del> v.use() <add> v = &localVolume{ <add> driverName: r.Name(), <add> name: name, <add> path: path, <add> } <add> r.volumes[name] = v <ide> return v, nil <ide> } <ide> <ide> func (r *Root) Remove(v volume.Volume) error { <ide> if !ok { <ide> return errors.New("unknown volume type") <ide> } <del> lv.release() <del> if lv.usedCount == 0 { <del> realPath, err := filepath.EvalSymlinks(lv.path) <del> if err != nil { <del> return err <del> } <del> if !r.scopedPath(realPath) { <del> return fmt.Errorf("Unable to remove a directory of out the Docker root: %s", realPath) <del> } <ide> <del> if err := os.RemoveAll(realPath); err != nil { <del> return err <del> } <add> realPath, err := filepath.EvalSymlinks(lv.path) <add> if err != nil { <add> return err <add> } <add> if !r.scopedPath(realPath) { <add> return fmt.Errorf("Unable to remove a directory of out the Docker root: %s", realPath) <add> } <ide> <del> delete(r.volumes, lv.name) <del> return os.RemoveAll(filepath.Dir(lv.path)) <add> if err := os.RemoveAll(realPath); err != nil { <add> return err <ide> } <del> return nil <add> <add> delete(r.volumes, lv.name) <add> return os.RemoveAll(filepath.Dir(lv.path)) <add>} <add> <add>// Get looks up the volume for the given name and returns it if found <add>func (r *Root) Get(name string) (volume.Volume, error) { <add> r.m.Lock() <add> v, exists := r.volumes[name] <add> r.m.Unlock() <add> if !exists { <add> return nil, ErrNotFound <add> } <add> return v, nil <ide> } <ide> <ide> // scopedPath verifies that the path where the volume is located <ide> func (v *localVolume) Mount() (string, error) { <ide> func (v *localVolume) Unmount() error { <ide> return nil <ide> } <del> <del>func (v *localVolume) use() { <del> v.m.Lock() <del> v.usedCount++ <del> v.m.Unlock() <del>} <del> <del>func (v *localVolume) release() { <del> v.m.Lock() <del> v.usedCount-- <del> v.m.Unlock() <del>} <ide><path>volume/volume.go <ide> type Driver interface { <ide> // Name returns the name of the volume driver. <ide> Name() string <ide> // Create makes a new volume with the given id. <del> Create(string) (Volume, error) <add> Create(name string, opts map[string]string) (Volume, error) <ide> // Remove deletes the volume. <ide> Remove(Volume) error <ide> }
49
Javascript
Javascript
provide support for element.one()
937caab6475e53a7ea0206e992f8a52449232e78
<ide><path>src/jqLite.js <ide> * - [`next()`](http://api.jquery.com/next/) - Does not support selectors <ide> * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData <ide> * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors <add> * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors <ide> * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors <ide> * - [`prepend()`](http://api.jquery.com/prepend/) <ide> * - [`prop()`](http://api.jquery.com/prop/) <ide> forEach({ <ide> <ide> off: jqLiteOff, <ide> <add> one: function(element, type, fn) { <add> element = jqLite(element); <add> <add> //add the listener twice so that when it is called <add> //you can remove the original function and still be <add> //able to call element.off(ev, fn) normally <add> element.on(type, function onFn() { <add> element.off(type, fn); <add> element.off(type, onFn); <add> }); <add> element.on(type, fn); <add> }, <add> <ide> replaceWith: function(element, replaceNode) { <ide> var index, parent = element.parentNode; <ide> jqLiteDealoc(element); <ide><path>test/jqLiteSpec.js <ide> describe('jqLite', function() { <ide> } <ide> }); <ide> <add> describe('one', function() { <add> <add> it('should only fire the callback once', function() { <add> var element = jqLite(a); <add> var spy = jasmine.createSpy('click'); <add> <add> element.one('click', spy); <add> <add> browserTrigger(element, 'click'); <add> expect(spy).toHaveBeenCalledOnce(); <add> <add> browserTrigger(element, 'click'); <add> expect(spy).toHaveBeenCalledOnce(); <add> }); <add> <add> it('should deregister when off is called', function() { <add> var element = jqLite(a); <add> var spy = jasmine.createSpy('click'); <add> <add> element.one('click', spy); <add> element.off('click', spy); <add> <add> browserTrigger(element, 'click'); <add> expect(spy).not.toHaveBeenCalled(); <add> }); <add> <add> it('should return the same event object just as on() does', function() { <add> var element = jqLite(a); <add> var eventA, eventB; <add> element.on('click', function(event) { <add> eventA = event; <add> }); <add> element.one('click', function(event) { <add> eventB = event; <add> }); <add> <add> browserTrigger(element, 'click'); <add> expect(eventA).toEqual(eventB); <add> }); <add> <add> it('should not remove other event handlers of the same type after execution', function() { <add> var element = jqLite(a); <add> var calls = []; <add> element.one('click', function(event) { <add> calls.push('one'); <add> }); <add> element.on('click', function(event) { <add> calls.push('on'); <add> }); <add> <add> browserTrigger(element, 'click'); <add> browserTrigger(element, 'click'); <add> <add> expect(calls).toEqual(['one','on','on']); <add> }); <add> }); <add> <ide> <ide> describe('replaceWith', function() { <ide> it('should replaceWith', function() {
2
Text
Text
clarify parameter for napi_get_cb_info
a2dead41710d374d0e30fcf23cc92c3a1daced84
<ide><path>doc/api/n-api.md <ide> napi_status napi_get_cb_info(napi_env env, <ide> * `[in-out] argc`: Specifies the length of the provided `argv` array and <ide> receives the actual count of arguments. `argc` can <ide> optionally be ignored by passing `NULL`. <del>* `[out] argv`: Buffer to which the `napi_value` representing the arguments are <add>* `[out] argv`: C array of `napi_value`s to which the arguments will be <ide> copied. If there are more arguments than the provided count, only the <ide> requested number of arguments are copied. If there are fewer arguments <ide> provided than claimed, the rest of `argv` is filled with `napi_value` values
1
Ruby
Ruby
fix pretty names
ca10e5005abcf36fba5760b60c0aeeefa5ca6505
<ide><path>Library/Homebrew/os/mac/version.rb <ide> def <=>(other) <ide> end <ide> <ide> def pretty_name <del> @version.split('_').map(&:capitalize).join(' ') <add> case @version <add> when "10.9" then "Mavericks" <add> when "10.8" then "Mountain Lion" <add> when "10.7" then "Lion" <add> when "10.6" then "Snow Leopard" <add> when "10.5" then "Leopard" <add> when "10.4" then "Tiger" <add> else @version <add> end <ide> end <ide> end <ide> end
1
Javascript
Javascript
check error msg test-writeint.js
6782577eef5d6bfe8ea5fad6c1b3b999d7a2ded1
<ide><path>test/parallel/test-writeint.js <ide> */ <ide> require('../common'); <ide> const assert = require('assert'); <add>const errorOutOfBounds = /^TypeError: "value" argument is out of bounds$/; <ide> <ide> function test8(clazz) { <ide> const buffer = new clazz(2); <ide> function test8(clazz) { <ide> /* Make sure we handle truncation correctly */ <ide> assert.throws(function() { <ide> buffer.writeInt8(0xabc, 0); <del> }); <add> }, errorOutOfBounds); <ide> assert.throws(function() { <ide> buffer.writeInt8(0xabc, 0); <del> }); <add> }, errorOutOfBounds); <ide> <ide> /* Make sure we handle min/max correctly */ <ide> buffer.writeInt8(0x7f, 0); <ide> function test8(clazz) { <ide> assert.strictEqual(0x80, buffer[1]); <ide> assert.throws(function() { <ide> buffer.writeInt8(0x7f + 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> assert.throws(function() { <ide> buffer.writeInt8(-0x80 - 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> } <ide> <ide> <ide> function test16(clazz) { <ide> assert.strictEqual(0x00, buffer[3]); <ide> assert.throws(function() { <ide> buffer.writeInt16BE(0x7fff + 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> assert.throws(function() { <ide> buffer.writeInt16BE(-0x8000 - 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> <ide> buffer.writeInt16LE(0x7fff, 0); <ide> buffer.writeInt16LE(-0x8000, 2); <ide> function test16(clazz) { <ide> assert.strictEqual(0x80, buffer[3]); <ide> assert.throws(function() { <ide> buffer.writeInt16LE(0x7fff + 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> assert.throws(function() { <ide> buffer.writeInt16LE(-0x8000 - 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> } <ide> <ide> <ide> function test32(clazz) { <ide> assert.strictEqual(0x00, buffer[7]); <ide> assert.throws(function() { <ide> buffer.writeInt32BE(0x7fffffff + 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> assert.throws(function() { <ide> buffer.writeInt32BE(-0x80000000 - 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> <ide> buffer.writeInt32LE(0x7fffffff, 0); <ide> buffer.writeInt32LE(-0x80000000, 4); <ide> function test32(clazz) { <ide> assert.strictEqual(0x80, buffer[7]); <ide> assert.throws(function() { <ide> buffer.writeInt32LE(0x7fffffff + 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> assert.throws(function() { <ide> buffer.writeInt32LE(-0x80000000 - 1, 0); <del> }); <add> }, errorOutOfBounds); <ide> } <ide> <ide>
1
Javascript
Javascript
push correct timestamp format on account creation
cfc9e31f6273aedeadf406a8cae1a2930842de7f
<ide><path>common/models/user.js <ide> module.exports = function(User) { <ide> } <ide> <ide> if (user.progressTimestamps.length === 0) { <del> user.progressTimestamps.push({ timestamp: Date.now() }); <add> user.progressTimestamps.push(Date.now()); <ide> } <ide> return Observable.fromPromise(User.doesExist(null, user.email)) <ide> .do(exists => {
1
PHP
PHP
fix delete processing
fd7a29db134c1ae6c1e734065ea4654e39b3c04f
<ide><path>src/Cache/Engine/RedisEngine.php <ide> public function clear($check) <ide> } <ide> $keys = $this->_Redis->getKeys($this->_config['prefix'] . '*'); <ide> <del> return !in_array(false, $this->deleteMany($keys)); <add> $result = []; <add> foreach ($keys as $key) { <add> $result[] = $this->_Redis->delete($key) > 0; <add> } <add> <add> return !in_array(false, $result); <ide> } <ide> <ide> /**
1
Ruby
Ruby
improve a path in _render_partial
4ac9d391d337d5a05a7aa93849405e21dd4bbf01
<ide><path>actionpack/lib/action_view/helpers/form_helper.rb <ide> class FormBuilder #:nodoc: <ide> <ide> attr_accessor :object_name, :object, :options <ide> <add> def self.model_name <add> @model_name ||= Struct.new(:partial_path).new(name.demodulize.underscore.sub!(/_builder$/, '')) <add> end <add> <ide> def initialize(object_name, object, template, options, proc) <ide> @nested_child_index = {} <ide> @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc <ide><path>actionpack/lib/action_view/render/partials.rb <ide> module ActionView <ide> module Partials <ide> extend ActiveSupport::Memoizable <ide> extend ActiveSupport::Concern <del> <add> <ide> included do <del> attr_accessor :_partial <add> attr_accessor :_partial <ide> end <ide> <ide> def render_partial(*args) <ide> def render_partial(*args) <ide> def _render_partial(options = {}) #:nodoc: <ide> options[:locals] ||= {} <ide> <del> case path = partial = options[:partial] <del> when *_array_like_objects <add> path = partial = options[:partial] <add> <add> if partial.respond_to?(:to_ary) <ide> return _render_partial_collection(partial, options) <del> else <del> if partial.is_a?(ActionView::Helpers::FormBuilder) <del> path = partial.class.to_s.demodulize.underscore.sub(/_builder$/, '') <del> options[:locals].merge!(path.to_sym => partial) <del> elsif !partial.is_a?(String) <del> options[:object] = object = partial <del> path = ActionController::RecordIdentifier.partial_path(object, controller_path) <del> end <del> _, _, prefix, object = parts = partial_parts(path, options) <del> parts[1] = {:formats => parts[1]} <del> template = find_by_parts(*parts) <del> _render_partial_object(template, options, (object unless object == true)) <add> elsif partial.is_a?(ActionView::Helpers::FormBuilder) <add> path = partial.class.model_name.partial_path <add> options[:locals].merge!(path.to_sym => partial) <add> elsif !partial.is_a?(String) <add> options[:object] = object = partial <add> path = ActionController::RecordIdentifier.partial_path(object, controller_path) <ide> end <add> <add> parts = partial_parts(path, options) <add> template = find_by_parts(*parts) <add> _render_partial_object(template, options, (parts[3] unless parts[3] == true)) <ide> end <ide> <ide> private <ide> def partial_parts(name, options) <ide> path = parts.join(".") <ide> prefix = segments[0..-1].join("/") <ide> prefix = prefix.blank? ? controller_path : prefix <del> parts = [path, formats, prefix] <add> parts = [path, {:formats => formats}, prefix] <ide> parts.push options[:object] || true <ide> end <ide> <ide> def _render_partial_object(template, options, object = nil) <ide> else <ide> locals = (options[:locals] ||= {}) <ide> object ||= locals[:object] || locals[template.variable_name] <del> <add> <ide> _set_locals(object, locals, template, options) <del> <add> <ide> options[:_template] = template <del> <add> <ide> _render_template(template, locals) <ide> end <ide> end <ide> def _set_locals(object, locals, template, options) <ide> <ide> def _render_partial_collection(collection, options = {}, passed_template = nil) #:nodoc: <ide> return nil if collection.blank? <del> <add> <ide> spacer = options[:spacer_template] ? _render_partial(:partial => options[:spacer_template]) : '' <ide> <ide> locals = (options[:locals] ||= {}) <ide> index, @_partial_path = 0, nil <ide> collection.map do |object| <ide> options[:_template] = template = passed_template || begin <del> _partial_path = <add> _partial_path = <ide> ActionController::RecordIdentifier.partial_path(object, controller_path) <ide> template = _pick_partial_template(_partial_path) <ide> end <ide> <ide> _set_locals(object, locals, template, options) <ide> locals[template.counter_name] = index <del> <add> <ide> index += 1 <del> <add> <ide> _render_template(template, locals) <ide> end.join(spacer) <ide> end
2
Mixed
Ruby
show full route constraints in error message
892c539591c001285792b7865fe5d70846b0041b
<ide><path>actionpack/CHANGELOG.md <add>* Show full route constraints in error message <add> <add> When an optimized helper fails to generate, show the full route constraints <add> in the error message. Previously it would only show the contraints that were <add> required as part of the path. <add> <add> Fixes #13592 <add> <add> *Andrew White* <add> <ide> * Use a custom route visitor for optimized url generation. Fixes #13349. <ide> <ide> *Andrew White* <ide><path>actionpack/lib/action_dispatch/journey/formatter.rb <ide> def generate(type, name, options, recall = {}, parameterize = nil) <ide> return [route.format(parameterized_parts), params] <ide> end <ide> <del> message = "No route matches #{constraints.inspect}" <del> message << " missing required keys: #{missing_keys.inspect}" if name <add> message = "No route matches #{Hash[constraints.sort].inspect}" <add> message << " missing required keys: #{missing_keys.sort.inspect}" if name <ide> <ide> raise ActionController::UrlGenerationError, message <ide> end <ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> def missing_keys(args) <ide> end <ide> <ide> def raise_generation_error(args, missing_keys) <del> message = "No route matches #{args.inspect}" <del> message << " missing required keys: #{missing_keys.inspect}" <add> constraints = Hash[@route.requirements.merge(args).sort] <add> message = "No route matches #{constraints.inspect}" <add> message << " missing required keys: #{missing_keys.sort.inspect}" <ide> <ide> raise ActionController::UrlGenerationError, message <ide> end <ide><path>actionpack/test/dispatch/routing_test.rb <ide> def test_redirect_doesnt_match_unnamed_route <ide> end <ide> end <ide> end <add> <add>class TestUrlGenerationErrors < ActionDispatch::IntegrationTest <add> Routes = ActionDispatch::Routing::RouteSet.new.tap do |app| <add> app.draw do <add> get "/products/:id" => 'products#show', :as => :product <add> end <add> end <add> <add> def app; Routes end <add> <add> include Routes.url_helpers <add> <add> test "url helpers raise a helpful error message whem generation fails" do <add> url, missing = { action: 'show', controller: 'products', id: nil }, [:id] <add> message = "No route matches #{url.inspect} missing required keys: #{missing.inspect}" <add> <add> # Optimized url helper <add> error = assert_raises(ActionController::UrlGenerationError){ product_path(nil) } <add> assert_equal message, error.message <add> <add> # Non-optimized url helper <add> error = assert_raises(ActionController::UrlGenerationError, message){ product_path(id: nil) } <add> assert_equal message, error.message <add> end <add>end
4
Javascript
Javascript
fix new-library to copy to current project
c98fc33ce5a2ddabeb9f0ffc939e76a68479f23b
<ide><path>local-cli/library/library.js <ide> function library(argv, config, args) { <ide> return; <ide> } <ide> <del> const dest = f.replace(/Sample/g, args.name).replace(/^_/, '.'); <add> const dest = path.relative(source, f.replace(/Sample/g, args.name).replace(/^_/, '.')); <ide> copyAndReplace( <ide> path.resolve(source, f), <ide> path.resolve(libraryDest, dest),
1
Ruby
Ruby
remove broken require
bf8a4b000602a12ba04d105b9c97f900c410e341
<ide><path>activerecord/lib/active_record.rb <ide> require 'active_record/aggregations' <ide> require 'active_record/transactions' <ide> require 'active_record/timestamp' <del>require 'active_record/acts/list' <ide> require 'active_record/acts/tree' <ide> require 'active_record/acts/nested_set' <ide> require 'active_record/locking/optimistic'
1
Javascript
Javascript
add day marker character for japanese
0000b80448fcf74b1e1e75a3ade0175e6b7cb8f1
<ide><path>locale/ja.js <ide> lastWeek : '[前週]dddd LT', <ide> sameElse : 'L' <ide> }, <del> ordinalParse : /\d{1,2}日/, <del> ordinal : function (number, period) { <del> switch (period) { <del> case 'd': <del> case 'D': <del> case 'DDD': <del> return number + '日'; <del> default: <del> return number; <del> } <del> }, <ide> relativeTime : { <ide> future : '%s後', <ide> past : '%s前', <ide><path>src/locale/ja.js <ide> export default moment.defineLocale('ja', { <ide> lastWeek : '[前週]dddd LT', <ide> sameElse : 'L' <ide> }, <add> ordinalParse : /\d{1,2}日/, <add> ordinal : function (number, period) { <add> switch (period) { <add> case 'd': <add> case 'D': <add> case 'DDD': <add> return number + '日'; <add> default: <add> return number; <add> } <add> }, <ide> relativeTime : { <ide> future : '%s後', <ide> past : '%s前',
2
Ruby
Ruby
use each instead of while loop
c9a4e1e1c932bbc69d35a2f544955c956552165d
<ide><path>Library/Homebrew/python_helper.rb <ide> def python_helper(options={:allowed_major_versions => [2, 3]}, &block) <ide> # check that no two python binaries are the same (which could be the case <ide> # because more than one `depends_on :python => 'module_name' may be present). <ide> filtered_python_reqs = [] <del> while !python_reqs.empty? <del> py = python_reqs.shift <add> python_reqs.each do |py| <ide> next if filtered_python_reqs.any? { |req| req.binary == py.binary } <ide> next unless py.satisfied? <ide> next unless options[:allowed_major_versions].include?(py.version.major)
1
Mixed
Javascript
make negative sign on remaining time optional
67e6ed6fd64f2a62d311721b8f786b63fb07f53b
<ide><path>docs/guides/options.md <ide> * [Standard &lt;video> Element Options](#standard-video-element-options) <ide> * [autoplay](#autoplay) <ide> * [More info on autoplay support and changes:](#more-info-on-autoplay-support-and-changes) <add> * [controlBar.remainingTimeDisplay.displayNegative](#controlbarremainingtimedisplaydisplaynegative) <ide> * [controls](#controls) <ide> * [height](#height) <ide> * [loop](#loop) <ide> player.autoplay('muted'); <ide> <ide> * See our blog post: [Autoplay Best Practices with Video.js](https://videojs.com/blog/autoplay-best-practices-with-video-js/) <ide> <add>### `controlBar.remainingTimeDisplay.displayNegative` <add> <add>> Type: `boolean` <add> <add>Bu default the remaining time display shows as negative time. To not show the negative sign set `controlBar.remainingTimeDisplay.displayNegative` to `false`. <add> <ide> ### `controls` <ide> <ide> > Type: `boolean` <ide><path>src/js/control-bar/time-controls/remaining-time-display.js <ide> class RemainingTimeDisplay extends TimeDisplay { <ide> createEl() { <ide> const el = super.createEl(); <ide> <del> el.insertBefore(Dom.createEl('span', {}, {'aria-hidden': true}, '-'), this.contentEl_); <add> if (this.options_.displayNegative !== false) { <add> el.insertBefore(Dom.createEl('span', {}, {'aria-hidden': true}, '-'), this.contentEl_); <add> } <ide> return el; <ide> } <ide> <ide><path>test/unit/controls.test.js <ide> import PictureInPictureToggle from '../../src/js/control-bar/picture-in-picture- <ide> import FullscreenToggle from '../../src/js/control-bar/fullscreen-toggle.js'; <ide> import ControlBar from '../../src/js/control-bar/control-bar.js'; <ide> import SeekBar from '../../src/js/control-bar/progress-control/seek-bar.js'; <add>import RemainingTimeDisplay from '../../src/js/control-bar/time-controls/remaining-time-display.js'; <ide> import TestHelpers from './test-helpers.js'; <ide> import document from 'global/document'; <ide> import sinon from 'sinon'; <ide> QUnit.test('all controlbar children to false, does not cause an assertion', func <ide> player.dispose(); <ide> assert.ok(true, 'did not cause an assertion'); <ide> }); <add> <add>QUnit.test('Remaing time negative sign can be optional', function(assert) { <add> const player = TestHelpers.makePlayer({ techOrder: ['html5'] }); <add> <add> const rtd1 = new RemainingTimeDisplay(player); <add> const rtd2 = new RemainingTimeDisplay(player, {displayNegative: false}); <add> <add> this.clock.tick(1); <add> <add> assert.ok(rtd1.el().textContent.indexOf('-') > 0, 'Value is negative by default'); <add> assert.equal(rtd2.el().textContent.indexOf('-'), -1, 'Value is positive with option'); <add> <add> rtd1.dispose(); <add> rtd2.dispose(); <add> player.dispose(); <add>});
3
Ruby
Ruby
send an accept header with the request
24a133f1199117f202639642577643cc9543d718
<ide><path>Library/Contributions/cmd/brew-gist-logs.rb <ide> def http <ide> end <ide> <ide> def make_request(path, data) <del> request = Net::HTTP::Post.new(path) <del> request['User-Agent'] = HOMEBREW_USER_AGENT <del> request['Content-Type'] = 'application/json' <add> headers = { <add> "User-Agent" => HOMEBREW_USER_AGENT, <add> "Accept" => "application/vnd.github.v3+json", <add> "Content-Type" => "application/json", <add> } <add> <ide> if HOMEBREW_GITHUB_API_TOKEN <del> request['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" <add> headers["Authorization"] = "token #{HOMEBREW_GITHUB_API_TOKEN}" <ide> end <add> <add> request = Net::HTTP::Post.new(path, headers) <ide> request.body = Utils::JSON.dump(data) <ide> request <ide> end
1
Python
Python
set version to v3.0.0a1
e1b3e8ee114ed74cccd802ed1e7a738fe8e316e5
<ide><path>spacy/about.py <ide> # fmt: off <ide> __title__ = "spacy-nightly" <del>__version__ = "3.0.0a0" <add>__version__ = "3.0.0a1" <ide> __release__ = True <ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download" <ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
1
Go
Go
add fixes for integration-cli tests w/ --net none
c2fe26243906ad2641876e877d23a419bb4bdb75
<ide><path>integration-cli/docker_cli_events_test.go <ide> func TestEventsImageUntagDelete(t *testing.T) { <ide> <ide> func TestEventsImagePull(t *testing.T) { <ide> since := daemonTime(t).Unix() <add> testRequires(t, Network) <ide> <ide> defer deleteImages("hello-world") <ide> <ide><path>integration-cli/docker_cli_run_test.go <ide> func TestRunLeakyFileDescriptors(t *testing.T) { <ide> // it should be possible to lookup Google DNS <ide> // this will fail when Internet access is unavailable <ide> func TestRunLookupGoogleDns(t *testing.T) { <add> testRequires(t, Network) <ide> defer deleteAllContainers() <ide> <ide> out, _, _, err := runCommandWithStdoutStderr(exec.Command(dockerBinary, "run", "busybox", "nslookup", "google.com")) <ide><path>integration-cli/docker_cli_search_test.go <ide> import ( <ide> <ide> // search for repos named "registry" on the central registry <ide> func TestSearchOnCentralRegistry(t *testing.T) { <add> testRequires(t, Network) <ide> searchCmd := exec.Command(dockerBinary, "search", "busybox") <ide> out, exitCode, err := runCommandWithOutput(searchCmd) <ide> if err != nil || exitCode != 0 {
3
Javascript
Javascript
fix typo in safearea documentation
58edf024a1ed3a71ef04f124546ee97496b6502f
<ide><path>Libraries/Components/SafeAreaView/SafeAreaView.ios.js <ide> type Props = ViewProps & { <ide> /** <ide> * Renders nested content and automatically applies paddings reflect the portion of the view <ide> * that is not covered by navigation bars, tab bars, toolbars, and other ancestor views. <del> * Moreover, and most importantly, Safe Area's paddings feflect physical limitation of the screen, <add> * Moreover, and most importantly, Safe Area's paddings reflect physical limitation of the screen, <ide> * such as rounded corners or camera notches (aka sensor housing area on iPhone X). <ide> */ <ide> class SafeAreaView extends React.Component<Props> {
1
Text
Text
add docs [ci skip]
db9f8896f5f8e4c6bde1839a4f04a06babbf64fc
<ide><path>website/docs/api/matcher.md <ide> Find all token sequences matching the supplied patterns on the `Doc` or `Span`. <ide> > matches = matcher(doc) <ide> > ``` <ide> <del>| Name | Description | <del>| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `doclike` | The `Doc` or `Span` to match over. ~~Union[Doc, Span]~~ | <del>| **RETURNS** | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end`]. The `match_id` is the ID of the added match pattern. ~~List[Tuple[int, int, int]]~~ | <add>| Name | Description | <add>| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `doclike` | The `Doc` or `Span` to match over. ~~Union[Doc, Span]~~ | <add>| _keyword-only_ | | <add>| `as_spans` <Tag variant="new">3</Tag> | Instead of tuples, return a list of [`Span`](/api/span) objects of the matches, with the `match_id` assigned as the span label. Defaults to `False`. ~~bool~~ | <add>| **RETURNS** | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end`]. The `match_id` is the ID of the added match pattern. If `as_spans` is set to `True`, a list of `Span` objects is returned instead. ~~Union[List[Tuple[int, int, int]], List[Span]]~~ | <ide> <ide> ## Matcher.pipe {#pipe tag="method"} <ide> <ide><path>website/docs/api/phrasematcher.md <ide> Find all token sequences matching the supplied patterns on the `Doc`. <ide> > matches = matcher(doc) <ide> > ``` <ide> <del>| Name | Description | <del>| ----------- | ----------------------------------- | <del>| `doc` | The document to match over. ~~Doc~~ | <del>| **RETURNS** | list | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end]`. The `match_id` is the ID of the added match pattern. ~~List[Tuple[int, int, int]]~~ | <add>| Name | Description | <add>| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `doc` | The document to match over. ~~Doc~~ | <add>| _keyword-only_ | | <add>| `as_spans` <Tag variant="new">3</Tag> | Instead of tuples, return a list of [`Span`](/api/span) objects of the matches, with the `match_id` assigned as the span label. Defaults to `False`. ~~bool~~ | <add>| **RETURNS** | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end`]. The `match_id` is the ID of the added match pattern. If `as_spans` is set to `True`, a list of `Span` objects is returned instead. ~~Union[List[Tuple[int, int, int]], List[Span]]~~ | <ide> <ide> <Infobox title="Note on retrieving the string representation of the match_id" variant="warning"> <ide> <ide><path>website/docs/usage/rule-based-matching.md <ide> you prefer. <ide> | `i` | Index of the current match (`matches[i`]). ~~int~~ | <ide> | `matches` | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end`]. ~~ List[Tuple[int, int int]]~~ | <ide> <add>### Creating spans from matches {#matcher-spans} <add> <add>Creating [`Span`](/api/span) objects from the returned matches is a very common <add>use case. spaCy makes this easy by giving you access to the `start` and `end` <add>token of each match, which you can use to construct a new span with an optional <add>label. As of spaCy v3.0, you can also set `as_spans=True` when calling the <add>matcher on a `Doc`, which will return a list of [`Span`](/api/span) objects <add>using the `match_id` as the span label. <add> <add>```python <add>### {executable="true"} <add>import spacy <add>from spacy.matcher import Matcher <add>from spacy.tokens import Span <add> <add>nlp = spacy.blank("en") <add>matcher = Matcher(nlp.vocab) <add>matcher.add("PERSON", [[{"lower": "barack"}, {"lower": "obama"}]]) <add>doc = nlp("Barack Obama was the 44th president of the United States") <add> <add># 1. Return (match_id, start, end) tuples <add>matches = matcher(doc) <add>for match_id, start, end in matches: <add> # Create the matched span and assign the match_id as a label <add> span = Span(doc, start, end, label=match_id) <add> print(span.text, span.label_) <add> <add># 2. Return Span objects directly <add>matches = matcher(doc, as_spans=True) <add>for span in matches: <add> print(span.text, span.label_) <add>``` <add> <ide> ### Using custom pipeline components {#matcher-pipeline} <ide> <ide> Let's say your data also contains some annoying pre-processing artifacts, like
3
PHP
PHP
remove unused method
35cdb45de69303918949ff0360c0ddb9640be876
<ide><path>src/Console/Shell.php <ide> use Cake\Error; <ide> use Cake\Log\Engine\ConsoleLog; <ide> use Cake\Log\Log; <del>use Cake\Utility\ClassRegistry; <add>use Cake\Utility\ConventionsTrait; <ide> use Cake\Utility\File; <ide> use Cake\Utility\Inflector; <ide> use Cake\Utility\MergeVariablesTrait; <ide> public function createFile($path, $contents) { <ide> return false; <ide> } <ide> <del>/** <del> * Action to create a Unit Test <del> * <del> * @return boolean Success <del> */ <del> protected function _checkUnitTest() { <del> if (class_exists('PHPUnit_Framework_TestCase')) { <del> return true; <del> //@codingStandardsIgnoreStart <del> } elseif (@include 'PHPUnit/Autoload.php') { <del> //@codingStandardsIgnoreEnd <del> return true; <del> } <del> <del> $prompt = __d('cake_console', 'PHPUnit is not installed. Do you want to bake unit test files anyway?'); <del> $unitTest = $this->in($prompt, ['y', 'n'], 'y'); <del> $result = strtolower($unitTest) === 'y' || strtolower($unitTest) === 'yes'; <del> <del> if ($result) { <del> $this->out(); <del> $this->out(__d('cake_console', 'You can download PHPUnit from %s', 'http://phpunit.de')); <del> } <del> return $result; <del> } <del> <ide> /** <ide> * Makes absolute file path easier to read <ide> *
1
Python
Python
use popen with celeryexecutor
197a72210c212a5a69c56cf55938ab799e627b06
<ide><path>airflow/executors/celery_executor.py <ide> class CeleryConfig(object): <ide> @app.task <ide> def execute_command(command): <ide> logging.info("Executing command in Celery " + command) <del> rc = subprocess.Popen(command, shell=True).wait() <del> if rc: <del> logging.error(rc) <add> try: <add> subprocess.check_call(command, shell=True) <add> except subprocess.CalledProcessError as e: <add> logging.error(e) <ide> raise AirflowException('Celery command failed') <ide> <ide> <ide> def execute_async(self, key, command, queue=DEFAULT_QUEUE): <ide> self.last_state[key] = celery_states.PENDING <ide> <ide> def sync(self): <add> <ide> self.logger.debug( <ide> "Inquiring about {} celery task(s)".format(len(self.tasks))) <ide> for key, async in list(self.tasks.items()):
1
PHP
PHP
fix typo in code comment
ae885e664bc0c8921566a334dcd75b1512f12134
<ide><path>src/Illuminate/Container/Container.php <ide> protected function resolve($abstract, $parameters = [], $raiseEvents = true) <ide> { <ide> $abstract = $this->getAlias($abstract); <ide> <del> // First we wil fire any event handlers that handle the "before" resolving of <add> // First we'll fire any event handlers which handle the "before" resolving of <ide> // specific types. This gives some hooks the chance to add various extends <ide> // calls to change the resolution of objects that they're interested in. <ide> if ($raiseEvents) {
1
Text
Text
improve readability in csrf section of guide
705847578ef41f60e85ad6bd5a606bbadea99ce0
<ide><path>guides/source/security.md <ide> This attack method works by including malicious code or a link in a page that ac <ide> <ide> ![](images/csrf.png) <ide> <del>In the [session chapter](#sessions) you have learned that most Rails applications use cookie-based sessions. Either they store the session id in the cookie and have a server-side session hash, or the entire session hash is on the client-side. In either case the browser will automatically send along the cookie on every request to a domain, if it can find a cookie for that domain. The controversial point is, that it will also send the cookie, if the request comes from a site of a different domain. Let's start with an example: <add>In the [session chapter](#sessions) you have learned that most Rails applications use cookie-based sessions. Either they store the session id in the cookie and have a server-side session hash, or the entire session hash is on the client-side. In either case the browser will automatically send along the cookie on every request to a domain, if it can find a cookie for that domain. The controversial point is that if the request comes from a site of a different domain, it will also send the cookie. Let's start with an example: <ide> <ide> * Bob browses a message board and views a post from a hacker where there is a crafted HTML image element. The element references a command in Bob's project management application, rather than an image file: `<img src="http://www.webapp.com/project/1/destroy">` <ide> * Bob's session at `www.webapp.com` is still alive, because he didn't log out a few minutes ago. <ide> The HTTP protocol basically provides two main types of requests - GET and POST ( <ide> * The interaction _changes the state_ of the resource in a way that the user would perceive (e.g., a subscription to a service), or <ide> * The user is _held accountable for the results_ of the interaction. <ide> <del>If your web application is RESTful, you might be used to additional HTTP verbs, such as PATCH, PUT or DELETE. Most of today's web browsers, however do not support them - only GET and POST. Rails uses a hidden `_method` field to handle this barrier. <add>If your web application is RESTful, you might be used to additional HTTP verbs, such as PATCH, PUT or DELETE. Most of today's web browsers, however, do not support them - only GET and POST. Rails uses a hidden `_method` field to handle this barrier. <ide> <del>_POST requests can be sent automatically, too_. Here is an example for a link which displays `www.harmless.com` as destination in the browser's status bar. In fact it dynamically creates a new form that sends a POST request. <add>_POST requests can be sent automatically, too_. In this example, the link www.harmless.com is shown as the destination in the browser's status bar. But it has actually dynamically created a new form that sends a POST request. <ide> <ide> ```html <ide> <a href="http://www.harmless.com/" onclick=" <ide> The security landscape shifts and it is important to keep up to date, because mi <ide> * Subscribe to the Rails security [mailing list](http://groups.google.com/group/rubyonrails-security) <ide> * [Keep up to date on the other application layers](http://secunia.com/) (they have a weekly newsletter, too) <ide> * A [good security blog](https://www.owasp.org) including the [Cross-Site scripting Cheat Sheet](https://www.owasp.org/index.php/DOM_based_XSS_Prevention_Cheat_Sheet) <del>
1
Javascript
Javascript
fix a lint error
14de6bc258762803301a74cf80e137ad25e97f5a
<ide><path>examples/jsm/loaders/GLTFLoader.js <ide> var GLTFLoader = ( function () { <ide> <ide> // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the <ide> // expensive work of uploading a texture to the GPU off the main thread. <del> if (typeof createImageBitmap !== 'undefined') { <add> if ( typeof createImageBitmap !== 'undefined' ) { <ide> this.textureLoader.setImageLoader( new ImageBitmapLoader( this.options.manager ) ); <ide> } <ide> <ide><path>src/loaders/TextureLoader.js <ide> import { ImageLoader } from './ImageLoader.js'; <ide> import { Texture } from '../textures/Texture.js'; <ide> import { Loader } from './Loader.js'; <ide> <del>function TextureLoader( manager, imageLoader ) { <add>function TextureLoader( manager ) { <ide> <ide> Loader.call( this, manager ); <ide> <ide> TextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), { <ide> <ide> const texture = new Texture(); <ide> <del> if ( !this.imageLoader ) { <add> if ( ! this.imageLoader ) { <ide> <ide> this.imageLoader = new ImageLoader( this.manager ); <ide>
2
Python
Python
fix bug regarding layer cache
080a8199f408eef9698330e67a2000d388e58cac
<ide><path>keras/layers/containers.py <ide> def __init__(self, layers=[]): <ide> self.add(layer) <ide> <ide> def __call__(self, X, mask=None, train=False): <add> #turn off layer cache temporarily <add> tmp_cache_enabled = self.cache_enabled <add> self.cache_enabled = False <ide> #recursively search for a layer which is not a Sequential model <ide> layer = self <ide> while issubclass(layer.__class__, Sequential): <ide> def __call__(self, X, mask=None, train=False): <ide> layer.get_input = tmp_input <ide> if hasattr(layer, 'get_input_mask'): <ide> layer.get_input_mask = tmp_mask <add> self.cache_enabled = tmp_cache_enabled <ide> return Y <ide> <add> @cache_enabled.setter <add> def cache_enabled(self, value): <add> self._cache_enabled = value <add> for l in self.layers: <add> l.cache_enabled = value <add> <ide> def set_previous(self, layer): <ide> self.layers[0].previous = layer <ide>
1
Python
Python
improve verbose output of breeze
6f146e721c81e9304bf7c0af66fc3d203d902dab
<ide><path>dev/breeze/src/airflow_breeze/utils/run_utils.py <ide> from distutils.version import StrictVersion <ide> from functools import lru_cache <ide> from pathlib import Path <del>from typing import List, Mapping, Optional, Union <add>from typing import Dict, List, Mapping, Optional, Union <ide> <ide> from airflow_breeze.utils.console import get_console <ide> from airflow_breeze.utils.path_utils import AIRFLOW_SOURCES_ROOT <ide> def run_command( <ide> workdir: str = str(cwd) if cwd else os.getcwd() <ide> if verbose or dry_run: <ide> command_to_print = ' '.join(shlex.quote(c) for c in cmd) <del> # if we pass environment variables to execute, then <del> env_to_print = ' '.join(f'{key}="{val}"' for (key, val) in env.items()) if env else '' <del> if env_to_print: <del> env_to_print += ' ' <add> env_to_print = get_environments_to_print(env) <ide> get_console().print(f"\n[info]Working directory {workdir} [/]\n") <ide> # Soft wrap allows to copy&paste and run resulting output as it has no hard EOL <ide> get_console().print(f"\n[info]{env_to_print}{command_to_print}[/]\n", soft_wrap=True) <ide> def run_command( <ide> return ex <ide> <ide> <add>def get_environments_to_print(env: Optional[Mapping[str, str]]): <add> if not env: <add> return "# No environment variables \\\n" <add> system_env: Dict[str, str] = {} <add> my_env: Dict[str, str] = {} <add> for key, val in env.items(): <add> if os.environ.get(key) == val: <add> system_env[key] = val <add> else: <add> my_env[key] = val <add> env_to_print = ''.join(f'{key}="{val}" \\\n' for (key, val) in sorted(system_env.items())) <add> env_to_print += r"""\ <add>""" <add> env_to_print += ''.join(f'{key}="{val}" \\\n' for (key, val) in sorted(my_env.items())) <add> return env_to_print <add> <add> <ide> def assert_pre_commit_installed(verbose: bool): <ide> """ <ide> Check if pre-commit is installed in the right version.
1
Javascript
Javascript
update identicon colors
1348a5a037f0eb3cece2c3445c157706a6b20e09
<ide><path>client/src/components/profile/components/Camper.js <ide> function Camper({ <ide> // A lot of the user-profiles are still using the defunct service. <ide> const avatar = /example.com|identicon.org/.test(picture) ? ( <ide> <Identicon <del> bg={'#006400'} <add> bg={'#858591'} <ide> count={5} <del> fg={'#FCB900'} <add> fg={'#0A0A23'} <ide> padding={5} <ide> size={256} <ide> string={username}
1
Python
Python
use io.open instead of open for compatibility
871d07987b28f4e7657aef7364f776e30b0c7daa
<ide><path>doc/postprocess.py <ide> """ <ide> from __future__ import division, absolute_import, print_function <ide> <del>import re, optparse <add>import re <add>import optparse <add>import io <ide> <ide> def main(): <ide> p = optparse.OptionParser(__doc__) <ide> def main(): <ide> p.error('unknown mode %s' % mode) <ide> <ide> for fn in args: <del> f = open(fn, 'r', encoding="utf-8") <add> f = io.open(fn, 'r', encoding="utf-8") <ide> try: <ide> if mode == 'html': <ide> lines = process_html(fn, f.readlines()) <ide> def main(): <ide> finally: <ide> f.close() <ide> <del> f = open(fn, 'w', encoding="utf-8") <add> f = io.open(fn, 'w', encoding="utf-8") <ide> f.write("".join(lines)) <ide> f.close() <ide>
1
Go
Go
handle non-tty mode
1a4fb0921919720ab379bc82b7508580057770ee
<ide><path>pkg/libcontainer/nsinit/exec.go <ide> import ( <ide> "syscall" <ide> ) <ide> <del>func execCommand(container *libcontainer.Container, args []string) (int, error) { <del> master, console, err := createMasterAndConsole() <del> if err != nil { <del> return -1, err <add>func execCommand(container *libcontainer.Container, tty bool, args []string) (int, error) { <add> var ( <add> master *os.File <add> console string <add> err error <add> <add> inPipe io.WriteCloser <add> outPipe, errPipe io.ReadCloser <add> ) <add> <add> if tty { <add> master, console, err = createMasterAndConsole() <add> if err != nil { <add> return -1, err <add> } <ide> } <ide> <ide> // create a pipe so that we can syncronize with the namespaced process and <ide> func execCommand(container *libcontainer.Container, args []string) (int, error) <ide> <ide> command := createCommand(container, console, r.Fd(), args) <ide> <add> if !tty { <add> inPipe, err = command.StdinPipe() <add> if err != nil { <add> return -1, err <add> } <add> outPipe, err = command.StdoutPipe() <add> if err != nil { <add> return -1, err <add> } <add> errPipe, err = command.StderrPipe() <add> if err != nil { <add> return -1, err <add> } <add> } <add> <ide> if err := command.Start(); err != nil { <ide> return -1, err <ide> } <ide> func execCommand(container *libcontainer.Container, args []string) (int, error) <ide> w.Close() <ide> r.Close() <ide> <del> go io.Copy(os.Stdout, master) <del> go io.Copy(master, os.Stdin) <del> <del> state, err := setupWindow(master) <del> if err != nil { <del> command.Process.Kill() <del> return -1, err <add> if tty { <add> go io.Copy(os.Stdout, master) <add> go io.Copy(master, os.Stdin) <add> state, err := setupWindow(master) <add> if err != nil { <add> command.Process.Kill() <add> return -1, err <add> } <add> defer term.RestoreTerminal(os.Stdin.Fd(), state) <add> } else { <add> go io.Copy(inPipe, os.Stdin) <add> go io.Copy(os.Stdout, outPipe) <add> go io.Copy(os.Stderr, errPipe) <ide> } <del> defer term.RestoreTerminal(os.Stdin.Fd(), state) <ide> <ide> if err := command.Wait(); err != nil { <ide> if _, ok := err.(*exec.ExitError); !ok { <ide><path>pkg/libcontainer/nsinit/init.go <ide> func initCommand(container *libcontainer.Container, console string, pipe io.Read <ide> return err <ide> } <ide> <del> // close pipes so that we can replace it with the pty <del> os.Stdin.Close() <del> os.Stdout.Close() <del> os.Stderr.Close() <del> <del> slave, err := openTerminal(console, syscall.O_RDWR) <del> if err != nil { <del> return fmt.Errorf("open terminal %s", err) <del> } <del> if err := dupSlave(slave); err != nil { <del> return fmt.Errorf("dup2 slave %s", err) <add> if console != "" { <add> // close pipes so that we can replace it with the pty <add> os.Stdin.Close() <add> os.Stdout.Close() <add> os.Stderr.Close() <add> slave, err := openTerminal(console, syscall.O_RDWR) <add> if err != nil { <add> return fmt.Errorf("open terminal %s", err) <add> } <add> if err := dupSlave(slave); err != nil { <add> return fmt.Errorf("dup2 slave %s", err) <add> } <ide> } <add> <ide> if _, err := system.Setsid(); err != nil { <ide> return fmt.Errorf("setsid %s", err) <ide> } <del> if err := system.Setctty(); err != nil { <del> return fmt.Errorf("setctty %s", err) <add> if console != "" { <add> if err := system.Setctty(); err != nil { <add> return fmt.Errorf("setctty %s", err) <add> } <ide> } <ide> if err := system.ParentDeathSignal(); err != nil { <ide> return fmt.Errorf("parent deth signal %s", err) <ide><path>pkg/libcontainer/nsinit/main.go <ide> var ( <ide> ) <ide> <ide> func main() { <del> console := flag.String("console", "", "Console (pty slave) name") <del> pipeFd := flag.Int("pipe", 0, "sync pipe fd") <add> var ( <add> console = flag.String("console", "", "Console (pty slave) name") <add> tty = flag.Bool("tty", false, "Create a tty") <add> pipeFd = flag.Int("pipe", 0, "sync pipe fd") <add> ) <ide> flag.Parse() <ide> <ide> container, err := loadContainer() <ide> func main() { <ide> if nspid > 0 { <ide> exitCode, err = execinCommand(container, nspid, flag.Args()[1:]) <ide> } else { <del> exitCode, err = execCommand(container, flag.Args()[1:]) <add> exitCode, err = execCommand(container, *tty, flag.Args()[1:]) <ide> } <ide> if err != nil { <ide> log.Fatal(err) <ide><path>pkg/libcontainer/nsinit/mount.go <ide> func setupNewMountNamespace(rootfs, console string, readonly bool) error { <ide> if err := setupDev(rootfs); err != nil { <ide> return err <ide> } <del> if err := setupPtmx(rootfs, console); err != nil { <del> return err <add> if console != "" { <add> if err := setupPtmx(rootfs, console); err != nil { <add> return err <add> } <ide> } <ide> if err := system.Chdir(rootfs); err != nil { <ide> return fmt.Errorf("chdir into %s %s", rootfs, err)
4
Ruby
Ruby
remove default_validation_options from validations
379e468034a2d22fb3330694a080ff7375d2379a
<ide><path>activemodel/lib/active_model/validations.rb <ide> def self.included(base) # :nodoc: <ide> end <ide> <ide> module ClassMethods <del> DEFAULT_VALIDATION_OPTIONS = { :on => :save, :allow_nil => false, :allow_blank => false, :message => nil }.freeze <del> <ide> # Adds a validation method or block to the class. This is useful when <ide> # overriding the +validate+ instance method becomes too unwieldly and <ide> # you're looking for more descriptive declaration of your validations. <ide><path>activemodel/lib/active_model/validations/length.rb <ide> module ClassMethods <ide> # Defaults to <tt>lambda{ |value| value.split(//) }</tt> which counts individual characters. <ide> def validates_length_of(*attrs) <ide> # Merge given options with defaults. <del> options = { <del> :tokenizer => lambda {|value| value.split(//)} <del> }.merge(DEFAULT_VALIDATION_OPTIONS) <add> options = { :tokenizer => lambda {|value| value.split(//)} } <ide> options.update(attrs.extract_options!.symbolize_keys) <ide> <ide> # Ensure that one and only one range option is specified.
2
Python
Python
update pr -- merge with master
11679478ef17b56e559d5a12509d281c646f79a2
<ide><path>airflow/jobs.py <ide> def manage_slas(self, dag, session=None): <ide> session.commit() <ide> session.close() <ide> <add> def import_errors(self, dagbag): <add> session = settings.Session() <add> session.query(models.ImportError).delete() <add> for filename, stacktrace in list(dagbag.import_errors.items()): <add> session.add(models.ImportError( <add> filename=filename, stacktrace=stacktrace)) <add> session.commit() <add> <ide> def process_dag(self, dag, executor): <ide> """ <ide> This method schedules a single DAG by looking at the latest <ide> def signal_handler(signum, frame): <ide> duration_sec = (datetime.now() - loop_start_dttm).total_seconds() <ide> logging.info("Loop took: {} seconds".format(duration_sec)) <ide> try: <del> dag_sizes = sorted( <del> [(sys.getsizeof(dag), dag.dag_id) for dag in dags], <del> key=lambda x: x[0], <del> reverse=True, <del> ) <del> logging.debug("DAG sizes: " + str(dag_sizes)) <del> except: <del> logging.error("Failed at getting DAG sizes") <add> self.import_errors(dagbag) <add> except Exception as e: <add> logging.exception(e) <ide> try: <ide> # We really just want the scheduler to never ever stop. <ide> executor.heartbeat() <ide><path>airflow/models.py <ide> def __init__( <ide> self.sync_to_db = sync_to_db <ide> self.file_last_changed = {} <ide> self.executor = executor <del> self.collect_dags(dag_folder) <add> self.import_errors = {} <ide> if include_examples: <ide> example_dag_folder = os.path.join( <ide> os.path.dirname(__file__), <ide> 'example_dags') <ide> self.collect_dags(example_dag_folder) <add> self.collect_dags(dag_folder) <ide> if sync_to_db: <ide> self.deactivate_inactive_dags() <ide> <ide> def process_file(self, filepath, only_if_updated=True, safe_mode=True): <ide> del sys.modules[mod_name] <ide> with utils.timeout(30): <ide> m = imp.load_source(mod_name, filepath) <del> except: <add> except Exception as e: <ide> logging.error("Failed to import: " + filepath) <del> logging.exception("") <add> self.import_errors[filepath] = e <add> logging.exception(e) <ide> self.file_last_changed[filepath] = dttm <ide> return <ide> <ide> def collect_dags( <ide> os.path.split(filepath)[-1]) <ide> if file_ext != '.py': <ide> continue <del> if not any([re.findall(p, filepath) for p in patterns]): <add> if not any( <add> [re.findall(p, filepath) for p in patterns]): <ide> self.process_file( <ide> filepath, only_if_updated=only_if_updated) <ide> except: <ide> class SlaMiss(Base): <ide> def __repr__(self): <ide> return str(( <ide> self.dag_id, self.task_id, self.execution_date.isoformat())) <add> <add> <add>class ImportError(Base): <add> __tablename__ = "import_error" <add> id = Column(Integer, primary_key=True) <add> timestamp = Column(DateTime) <add> filename = Column(String(1024)) <add> stacktrace = Column(Text) <ide><path>airflow/operators/mysql_to_hive.py <ide> from builtins import chr <ide> from collections import OrderedDict <del>import csv <add>import unicodecsv as csv <ide> import logging <ide> from tempfile import NamedTemporaryFile <ide> import MySQLdb <ide> def __init__( <ide> self.partition = partition <ide> self.create = create <ide> self.recreate = recreate <del> self.delimiter = delimiter <add> self.delimiter = str(delimiter) <ide> self.mysql_conn_id = mysql_conn_id <ide> self.hive_cli_conn_id = hive_cli_conn_id <ide> self.partition = partition or {} <ide><path>airflow/www/app.py <ide> def index(self): <ide> DM = models.DagModel <ide> qry = session.query(DM).filter(~DM.is_subdag, DM.is_active).all() <ide> orm_dags = {dag.dag_id: dag for dag in qry} <add> import_errors = session.query(models.ImportError).all() <add> for ie in import_errors: <add> flash( <add> "Broken DAG: [{ie.filename}] {ie.stacktrace}".format(ie=ie), <add> "error") <ide> session.expunge_all() <ide> session.commit() <ide> session.close() <ide> def tree(self): <ide> else: <ide> base_date = dateutil.parser.parse(base_date) <ide> <add> start_date = dag.start_date <add> if not start_date: <add> start_date = dag.default_args['start_date'] <add> <add> if start_date: <add> difference = base_date - start_date <add> offset = timedelta(seconds=int(difference.total_seconds() % dag.schedule_interval.total_seconds())) <add> base_date -= offset <add> base_date -= timedelta(microseconds=base_date.microsecond) <add> <ide> num_runs = request.args.get('num_runs') <ide> num_runs = int(num_runs) if num_runs else 25 <del> from_time = datetime.min.time() <del> if dag.start_date: <del> from_time = dag.start_date.time() <del> from_date = (base_date-(num_runs * dag.schedule_interval)).date() <del> from_date = datetime.combine(from_date, from_time) <add> from_date = (base_date-(num_runs * dag.schedule_interval)) <ide> <ide> dates = utils.date_range( <ide> from_date, base_date, dag.schedule_interval) <ide><path>tests/core.py <ide> NUM_EXAMPLE_DAGS = 5 <ide> DEV_NULL = '/dev/null' <ide> LOCAL_EXECUTOR = executors.LocalExecutor() <del>DEFAULT_DATE = datetime(2015, 1, 1) <add>DEFAULT_DATE = datetime(2015, 8, 1) <add>TEST_DAG_ID = 'unit_tests' <ide> configuration.test_mode() <ide> <ide> <ide> def setUp(self): <ide> configuration.test_mode() <ide> utils.initdb() <ide> args = {'owner': 'airflow', 'start_date': datetime(2015, 1, 1)} <del> dag = DAG('hive_test', default_args=args) <add> dag = DAG(TEST_DAG_ID, default_args=args) <ide> self.dag = dag <ide> <ide> def test_mysql_to_hive(self): <ide> def setUp(self): <ide> configuration.test_mode() <ide> utils.initdb() <ide> args = {'owner': 'airflow', 'start_date': datetime(2015, 1, 1)} <del> dag = DAG('hive_test', default_args=args) <add> dag = DAG(TEST_DAG_ID, default_args=args) <ide> self.dag = dag <ide> self.hql = """ <ide> USE airflow; <ide> def test_hive2samba(self): <ide> <ide> def test_hive_to_mysql(self): <ide> t = operators.HiveToMySqlTransfer( <add> mysql_conn_id='airflow_db', <ide> task_id='hive_to_mysql_check', <ide> sql=""" <ide> SELECT name, count(*) as ccount <ide> def test_hive_to_mysql(self): <ide> mysql_table='test_static_babynames', <ide> mysql_preoperator='TRUNCATE TABLE test_static_babynames;', <ide> dag=self.dag) <add> t.clear(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) <ide> t.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, force=True) <ide> <ide> <ide> def setUp(self): <ide> dag_folder=DEV_NULL, include_examples=True) <ide> utils.initdb() <ide> args = {'owner': 'airflow', 'start_date': datetime(2015, 1, 1)} <del> dag = DAG('core_test', default_args=args) <add> dag = DAG(TEST_DAG_ID, default_args=args) <ide> self.dag = dag <ide> self.dag_bash = self.dagbag.dags['example_bash_operator'] <ide> self.runme_0 = self.dag_bash.get_task('runme_0') <ide> def setUp(self): <ide> configuration.test_mode() <ide> utils.initdb() <ide> args = {'owner': 'airflow', 'start_date': datetime(2015, 1, 1)} <del> dag = DAG('hive_test', default_args=args) <add> dag = DAG(TEST_DAG_ID, default_args=args) <ide> self.dag = dag <ide> <ide> def mysql_operator_test(self): <ide> def setUp(self): <ide> configuration.test_mode() <ide> utils.initdb() <ide> args = {'owner': 'airflow', 'start_date': datetime(2015, 1, 1)} <del> dag = DAG('hive_test', default_args=args) <add> dag = DAG(TEST_DAG_ID, default_args=args) <ide> self.dag = dag <ide> <ide> def postgres_operator_test(self): <ide> def setUp(self): <ide> configuration.test_mode() <ide> utils.initdb() <ide> args = {'owner': 'airflow', 'start_date': datetime(2015, 1, 1)} <del> dag = DAG('http_test', default_args=args) <add> dag = DAG(TEST_DAG_ID, default_args=args) <ide> self.dag = dag <ide> <ide> def test_get(self):
5
Javascript
Javascript
fix ambiguity in doc comment for isvalidelement
15a8f031838a553e41c0b66eb1bcf1da8448104d
<ide><path>packages/react/src/ReactElement.js <ide> export function cloneElement(element, config, children) { <ide> * Verifies the object is a ReactElement. <ide> * See https://reactjs.org/docs/react-api.html#isvalidelement <ide> * @param {?object} object <del> * @return {boolean} True if `object` is a valid component. <add> * @return {boolean} True if `object` is a ReactElement. <ide> * @final <ide> */ <ide> export function isValidElement(object) {
1
PHP
PHP
use arraycache instead of mocks and file cache
e9d0d5838203d95a0df78f0679fbc2c8c527ba42
<ide><path>tests/TestCase/View/CellTest.php <ide> public function testCellInheritsController() <ide> */ <ide> public function testCachedRenderSimple() <ide> { <del> $mock = $this->getMockBuilder('Cake\Cache\CacheEngine')->getMock(); <del> $mock->method('init') <del> ->will($this->returnValue(true)); <del> $mock->method('get') <del> ->will($this->returnValue(null)); <del> $mock->expects($this->once()) <del> ->method('set') <del> ->with('cell_test_app_view_cell_articles_cell_display_default', "dummy\n") <del> ->will($this->returnValue(true)); <del> Cache::setConfig('default', $mock); <add> Cache::setConfig('default', ['className' => 'Array']); <ide> <ide> $cell = $this->View->cell('Articles', [], ['cache' => true]); <ide> $result = $cell->render(); <del> $this->assertEquals("dummy\n", $result); <add> $expected = "dummy\n"; <add> $this->assertEquals($expected, $result); <add> <add> $result = Cache::read('cell_test_app_view_cell_articles_cell_display_default', 'default'); <add> $this->assertEquals($expected, $result); <ide> Cache::drop('default'); <ide> } <ide> <ide> public function testCachedRenderSimple() <ide> */ <ide> public function testReadCachedCell() <ide> { <del> $mock = $this->getMockBuilder('Cake\Cache\CacheEngine')->getMock(); <del> $mock->method('init') <del> ->will($this->returnValue(true)); <del> $mock->method('get') <del> ->will($this->returnValue("dummy\n")); <del> $mock->expects($this->never()) <del> ->method('set'); <del> Cache::setConfig('default', $mock); <add> Cache::setConfig('default', ['className' => 'Array']); <add> Cache::write('cell_test_app_view_cell_articles_cell_display_default', 'from cache'); <ide> <ide> $cell = $this->View->cell('Articles', [], ['cache' => true]); <ide> $result = $cell->render(); <del> $this->assertEquals("dummy\n", $result); <add> $this->assertEquals('from cache', $result); <ide> Cache::drop('default'); <ide> } <ide> <ide> public function testReadCachedCell() <ide> */ <ide> public function testCachedRenderArrayConfig() <ide> { <del> $mock = $this->getMockBuilder('Cake\Cache\CacheEngine')->getMock(); <del> $mock->method('init') <del> ->will($this->returnValue(true)); <del> $mock->method('get') <del> ->will($this->returnValue(null)); <del> $mock->expects($this->once()) <del> ->method('set') <del> ->with('my_key', "dummy\n") <del> ->will($this->returnValue(true)); <del> Cache::setConfig('cell', $mock); <add> Cache::setConfig('cell', ['className' => 'Array']); <add> Cache::write('my_key', 'from cache', 'cell'); <ide> <ide> $cell = $this->View->cell('Articles', [], [ <ide> 'cache' => ['key' => 'my_key', 'config' => 'cell'], <ide> ]); <ide> $result = $cell->render(); <del> $this->assertEquals("dummy\n", $result); <add> $this->assertEquals('from cache', $result); <ide> Cache::drop('cell'); <ide> } <ide> <ide> public function testCachedRenderArrayConfig() <ide> */ <ide> public function testCachedRenderSimpleCustomTemplate() <ide> { <del> $mock = $this->getMockBuilder('Cake\Cache\CacheEngine')->getMock(); <del> $mock->method('init') <del> ->will($this->returnValue(true)); <del> $mock->method('get') <del> ->will($this->returnValue(null)); <del> $mock->expects($this->once()) <del> ->method('set') <del> ->with('cell_test_app_view_cell_articles_cell_customTemplateViewBuilder_default', "<h1>This is the alternate template</h1>\n") <del> ->will($this->returnValue(true)); <del> Cache::setConfig('default', $mock); <add> Cache::setConfig('default', ['className' => 'Array']); <ide> <ide> $cell = $this->View->cell('Articles::customTemplateViewBuilder', [], ['cache' => true]); <ide> $result = $cell->render(); <del> $this->assertStringContainsString('This is the alternate template', $result); <add> $expected = 'This is the alternate template'; <add> $this->assertStringContainsString($expected, $result); <ide> <add> $result = Cache::read('cell_test_app_view_cell_articles_cell_customTemplateViewBuilder_default'); <add> $this->assertStringContainsString($expected, $result); <ide> Cache::drop('default'); <ide> } <ide> <ide> public function testCachedRenderSimpleCustomTemplate() <ide> */ <ide> public function testCachedRenderSimpleCustomTemplateViewBuilder() <ide> { <del> Cache::setConfig('default', [ <del> 'className' => 'File', <del> 'path' => CACHE, <del> ]); <add> Cache::setConfig('default', ['className' => 'Array']); <ide> $cell = $this->View->cell('Articles::customTemplateViewBuilder', [], ['cache' => ['key' => 'celltest']]); <ide> $result = $cell->render(); <ide> $this->assertEquals(1, $cell->counter); <ide> $cell->render(); <add> <ide> $this->assertEquals(1, $cell->counter); <ide> $this->assertStringContainsString('This is the alternate template', $result); <del> Cache::delete('celltest'); <ide> Cache::drop('default'); <ide> } <ide> <ide> public function testCachedRenderSimpleCustomTemplateViewBuilder() <ide> */ <ide> public function testACachedViewCellReRendersWhenGivenADifferentTemplate() <ide> { <del> Cache::setConfig('default', [ <del> 'className' => 'File', <del> 'path' => CACHE, <del> ]); <add> Cache::setConfig('default', ['className' => 'Array']); <ide> $cell = $this->View->cell('Articles::customTemplateViewBuilder', [], ['cache' => true]); <ide> $result = $cell->render('alternate_teaser_list'); <ide> $result2 = $cell->render('not_the_alternate_teaser_list');
1
Javascript
Javascript
repeat last command
60a1dbddd2a4f6341c0fbc26e3fcdf3f16bcbbe8
<ide><path>lib/_debugger.js <ide> Interface.prototype.controlEval = function(code, context, filename, callback) { <ide> try { <ide> // Repeat last command if empty line are going to be evaluated <ide> if (this.repl.rli.history && this.repl.rli.history.length > 0) { <del> if (code === '(\n)') { <del> code = '(' + this.repl.rli.history[0] + '\n)'; <add> if (code === '\n') { <add> code = this.repl.rli.history[0] + '\n'; <ide> } <ide> } <ide> <ide><path>test/simple/helper-debugger-repl.js <ide> var port = common.PORT + 1337; <ide> var child; <ide> var buffer = ''; <ide> var expected = []; <add>var quit; <ide> <ide> function startDebugger(scriptToDebug) { <ide> scriptToDebug = process.env.NODE_DEBUGGER_TEST_SCRIPT || <ide> function startDebugger(scriptToDebug) { <ide> }); <ide> <ide> var quitCalled = false; <del> function quit() { <add> quit = function() { <ide> if (quitCalled || childClosed) return; <ide> quitCalled = true; <ide> child.stdin.write('quit'); <ide><path>test/simple/test-debugger-repl-term.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> <add>process.env.NODE_FORCE_READLINE = 1; <add> <add>var repl = require('./helper-debugger-repl.js'); <add> <add>repl.startDebugger('breakpoints.js'); <add> <add>var addTest = repl.addTest; <add> <add>// next <add>addTest('n', [ <add> /debug>.*n/, <add> /break in .*:11/, <add> /9/, /10/, /11/, /12/, /13/ <add>]); <add> <add>// should repeat next <add>addTest('', [ <add> /debug>/, <add> /break in .*:5/, <add> /3/, /4/, /5/, /6/, /7/, <add>]); <add> <add>// continue <add>addTest('c', [ <add> /debug>.*c/, <add> /break in .*:12/, <add> /10/, /11/, /12/, /13/, /14/ <add>]); <add> <add>// should repeat continue <add>addTest('', [ <add> /debug>/, <add> /break in .*:5/, <add> /3/, /4/, /5/, /6/, /7/, <add>]); <add> <add>// should repeat continue <add>addTest('', [ <add> /debug>/, <add> /break in .*:23/, <add> /21/, /22/, /23/, /24/, /25/, <add>]);
3
Javascript
Javascript
remove trailing commas
40ca7f2df7c3360f569d0208609729c1a587e484
<ide><path>test/core/transition-test.js <ide> var suite = vows.describe("transition"); <ide> suite.addBatch({ <ide> "select": require("./transition-test-select"), <ide> "selectAll": require("./transition-test-selectAll"), <del> "transition": require("./transition-test-transition"), <add> "transition": require("./transition-test-transition") <ide> }); <ide> <ide> // Content <ide> suite.addBatch({ <ide> "style": require("./transition-test-style"), <ide> "styleTween": require("./transition-test-styleTween"), <ide> "text": require("./transition-test-text"), <del> "remove": require("./transition-test-remove"), <add> "remove": require("./transition-test-remove") <ide> }); <ide> <ide> // Animation <ide> suite.addBatch({ <ide> "delay": require("./transition-test-delay"), <del> "duration": require("./transition-test-duration"), <add> "duration": require("./transition-test-duration") <ide> }); <ide> <ide> // Control
1
Javascript
Javascript
set title using logic similar as download name
c67edabcb3a566a97c9610a93aa04284b10aadc7
<ide><path>web/app.js <ide> var PDFViewerApplication = { <ide> setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) { <ide> this.url = url; <ide> this.baseUrl = url.split('#')[0]; <del> try { <del> this.setTitle(decodeURIComponent( <del> pdfjsLib.getFilenameFromUrl(url)) || url); <del> } catch (e) { <del> // decodeURIComponent may throw URIError, <del> // fall back to using the unprocessed url in that case <del> this.setTitle(url); <add> var title = getPDFFileNameFromURL(url, ''); <add> if (!title) { <add> try { <add> title = decodeURIComponent(pdfjsLib.getFilenameFromUrl(url)) || url; <add> } catch (e) { <add> // decodeURIComponent may throw URIError, <add> // fall back to using the unprocessed url in that case <add> title = url; <add> } <ide> } <add> this.setTitle(title); <ide> }, <ide> <ide> setTitle: function pdfViewSetTitle(title) { <ide><path>web/ui_utils.js <ide> function noContextMenuHandler(e) { <ide> /** <ide> * Returns the filename or guessed filename from the url (see issue 3455). <ide> * url {String} The original PDF location. <add> * defaultFilename {string} The value to return if the file name is unknown. <ide> * @return {String} Guessed PDF file name. <ide> */ <del>function getPDFFileNameFromURL(url) { <add>function getPDFFileNameFromURL(url, defaultFilename) { <add> if (typeof defaultFilename === 'undefined') { <add> defaultFilename = 'document.pdf'; <add> } <ide> var reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; <ide> // SCHEME HOST 1.PATH 2.QUERY 3.REF <ide> // Pattern to get last matching NAME.pdf <ide> function getPDFFileNameFromURL(url) { <ide> } <ide> } <ide> } <del> return suggestedFilename || 'document.pdf'; <add> return suggestedFilename || defaultFilename; <ide> } <ide> <ide> function normalizeWheelEventDelta(evt) {
2
Go
Go
add synchronization in server.containers
da853e98c94c9ce8001d3d1516ba0fd2614db3b0
<ide><path>server/server.go <ide> package server <ide> <ide> import ( <ide> "encoding/json" <add> "errors" <ide> "fmt" <ide> "io" <ide> "io/ioutil" <ide> func (srv *Server) Containers(job *engine.Job) engine.Status { <ide> } <ide> } <ide> <del> for _, container := range srv.daemon.List() { <add> errLast := errors.New("last container") <add> writeCont := func(container *daemon.Container) error { <add> container.Lock() <add> defer container.Unlock() <ide> if !container.State.IsRunning() && !all && n <= 0 && since == "" && before == "" { <del> continue <add> return nil <ide> } <ide> if before != "" && !foundBefore { <ide> if container.ID == beforeCont.ID { <ide> foundBefore = true <ide> } <del> continue <add> return nil <ide> } <ide> if n > 0 && displayed == n { <del> break <add> return errLast <ide> } <ide> if since != "" { <ide> if container.ID == sinceCont.ID { <del> break <add> return errLast <ide> } <ide> } <ide> displayed++ <ide> func (srv *Server) Containers(job *engine.Job) engine.Status { <ide> out.Set("Status", container.State.String()) <ide> str, err := container.NetworkSettings.PortMappingAPI().ToListString() <ide> if err != nil { <del> return job.Error(err) <add> return err <ide> } <ide> out.Set("Ports", str) <ide> if size { <ide> func (srv *Server) Containers(job *engine.Job) engine.Status { <ide> out.SetInt64("SizeRootFs", sizeRootFs) <ide> } <ide> outs.Add(out) <add> return nil <add> } <add> <add> for _, container := range srv.daemon.List() { <add> if err := writeCont(container); err != nil { <add> if err != errLast { <add> return job.Error(err) <add> } <add> break <add> } <ide> } <ide> outs.ReverseSort() <ide> if _, err := outs.WriteListTo(job.Stdout); err != nil {
1
Javascript
Javascript
use tomatch in widgetspec
b28dee7fd540a6c46087e66fb2f6ca2307cf17c6
<ide><path>test/widgetsSpec.js <ide> describe("widget", function(){ <ide> var log = ""; <ide> log += element.attr('ng-exception') + ';'; <ide> log += element.hasClass('ng-exception') + ';'; <del> expect(log.match(/Expected ng:repeat in form of 'item in collection' but got 'i dont parse'./)).toBeTruthy(); <add> expect(log).toMatch(/Expected ng:repeat in form of 'item in collection' but got 'i dont parse'./); <ide> }); <ide> <ide> it('should expose iterator offset as $index when iterating over arrays', function() {
1
Python
Python
fix double wrapping + test
f882966004742ab6af9f03539a749d23792eeaae
<ide><path>src/transformers/trainer.py <ide> def _wrap_model(self, model, training=True): <ide> if self.deepspeed: <ide> return self.deepspeed <ide> <add> # train/eval could be run multiple-times - if already wrapped, don't re-wrap it again <add> if unwrap_model(model) is not model: <add> return model <add> <ide> # Mixed precision training with apex (torch < 1.6) <ide> if self.use_apex and training: <ide> model, self.optimizer = amp.initialize(model, self.optimizer, opt_level=self.args.fp16_opt_level) <ide><path>tests/test_trainer.py <ide> def test_gradient_accumulation(self): <ide> trainer.train() <ide> self.check_trained_model(trainer.model) <ide> <add> @require_torch_multi_gpu <add> def test_run_seq2seq_double_train_wrap_once(self): <add> # test that we don't wrap the model more than once <add> # since wrapping primarily happens on multi-gpu setup we want multiple gpus to test for <add> # example DataParallel(DataParallel(model)) <add> <add> trainer = get_regression_trainer() <add> trainer.train() <add> model_wrapped_before = trainer.model_wrapped <add> trainer.train() <add> model_wrapped_after = trainer.model_wrapped <add> self.assertIs(model_wrapped_before, model_wrapped_after, "should be not wrapped twice") <add> <ide> def test_can_resume_training(self): <ide> if torch.cuda.device_count() > 2: <ide> # This test will fail for more than 2 GPUs since the batch size will get bigger and with the number of
2
PHP
PHP
remove indefinite block
045e6f25a860763942c928c4e6d8857d59741486
<ide><path>src/Illuminate/Cache/Lock.php <ide> public function get($callback = null) <ide> return $result; <ide> } <ide> <del> /** <del> * Attempt to acquire the lock while blocking indefinitely. <del> * <del> * @param callable|null $calback <del> * @return bool <del> */ <del> public function block($callback = null) <del> { <del> while (! $this->acquire()) { <del> usleep(250 * 1000); <del> } <del> <del> if (is_callable($callback)) { <del> return tap($callback(), function () { <del> $this->release(); <del> }); <del> } <del> <del> return true; <del> } <del> <ide> /** <ide> * Attempt to acquire the lock for the given number of seconds. <ide> * <ide> * @param int $seconds <ide> * @param callable|null $callback <ide> * @return bool <ide> */ <del> public function blockFor($seconds, $callback = null) <add> public function block($seconds, $callback = null) <ide> { <ide> $starting = Carbon::now(); <ide> <ide><path>src/Illuminate/Contracts/Cache/Lock.php <ide> interface Lock <ide> */ <ide> public function get($callback = null); <ide> <del> /** <del> * Attempt to acquire the lock while blocking indefinitely. <del> * <del> * @param callable|null $calback <del> * @return bool <del> */ <del> public function block($callback = null); <del> <ide> /** <ide> * Attempt to acquire the lock for the given number of seconds. <ide> * <ide> * @param int $seconds <ide> * @param callable|null $callback <ide> * @return bool <ide> */ <del> public function blockFor($seconds, $callback = null); <add> public function block($seconds, $callback = null); <ide> <ide> /** <ide> * Release the lock. <ide><path>tests/Integration/Cache/CacheLockTest.php <ide> public function test_locks_can_run_callbacks() <ide> } <ide> <ide> <del> public function test_locks_can_block() <del> { <del> Cache::store('memcached')->lock('foo')->release(); <del> Cache::store('memcached')->lock('foo', 1)->get(); <del> $this->assertEquals('taylor', Cache::store('memcached')->lock('foo', 10)->block(function () { <del> return 'taylor'; <del> })); <del> <del> Cache::store('memcached')->lock('foo')->release(); <del> Cache::store('memcached')->lock('foo', 1)->get(); <del> $this->assertTrue(Cache::store('memcached')->lock('foo', 10)->block()); <del> <del> <del> Cache::store('redis')->lock('foo')->release(); <del> Cache::store('redis')->lock('foo', 1)->get(); <del> $this->assertEquals('taylor', Cache::store('redis')->lock('foo', 10)->block(function () { <del> return 'taylor'; <del> })); <del> <del> Cache::store('redis')->lock('foo')->release(); <del> Cache::store('redis')->lock('foo', 1)->get(); <del> $this->assertTrue(Cache::store('redis')->lock('foo', 10)->block()); <del> } <del> <del> <ide> public function test_locks_can_block_for_seconds() <ide> { <ide> Carbon::setTestNow(); <ide> <ide> Cache::store('memcached')->lock('foo')->release(); <del> $this->assertEquals('taylor', Cache::store('memcached')->lock('foo', 10)->blockFor(1, function () { <add> $this->assertEquals('taylor', Cache::store('memcached')->lock('foo', 10)->block(1, function () { <ide> return 'taylor'; <ide> })); <ide> <ide> Cache::store('memcached')->lock('foo')->release(); <del> $this->assertTrue(Cache::store('memcached')->lock('foo', 10)->blockFor(1)); <add> $this->assertTrue(Cache::store('memcached')->lock('foo', 10)->block(1)); <ide> <ide> <ide> Cache::store('redis')->lock('foo')->release(); <del> $this->assertEquals('taylor', Cache::store('redis')->lock('foo', 10)->blockFor(1, function () { <add> $this->assertEquals('taylor', Cache::store('redis')->lock('foo', 10)->block(1, function () { <ide> return 'taylor'; <ide> })); <ide> <ide> Cache::store('redis')->lock('foo')->release(); <del> $this->assertTrue(Cache::store('redis')->lock('foo', 10)->blockFor(1)); <add> $this->assertTrue(Cache::store('redis')->lock('foo', 10)->block(1)); <ide> } <ide> <ide> <ide> public function test_locks_throw_timeout_if_block_expires() <ide> <ide> Cache::store('memcached')->lock('foo')->release(); <ide> Cache::store('memcached')->lock('foo', 5)->get(); <del> $this->assertEquals('taylor', Cache::store('memcached')->lock('foo', 10)->blockFor(1, function () { <add> $this->assertEquals('taylor', Cache::store('memcached')->lock('foo', 10)->block(1, function () { <ide> return 'taylor'; <ide> })); <ide> }
3