content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Ruby | Ruby | add unit tests | 2c4ad58d16d6c137e3d26ff494450f3064364d02 | <ide><path>Library/Homebrew/test/software_spec/bottle_spec.rb
<ide> end
<ide> end
<ide>
<add> describe "#compatible_locations?" do
<add> it "checks if the bottle cellar is relocatable" do
<add> expect(bottle_spec.compatible_locations?).to be false
<add> end
<add> end
<add>
<add> describe "#tag_to_cellar" do
<add> it "returns the cellar for a tag" do
<add> expect(bottle_spec.tag_to_cellar).to eq Utils::Bottles.tag.default_cellar
<add> end
<add> end
<add>
<ide> %w[root_url rebuild].each do |method|
<ide> specify "##{method}" do
<ide> object = Object.new | 1 |
Ruby | Ruby | remove support of symbols on classify and camelize | 3718ccd2a61c2c189913bcfd487912f592fa0660 | <ide><path>activesupport/lib/active_support/inflector/methods.rb
<ide> module Inflector
<ide> # "words".pluralize # => "words"
<ide> # "CamelOctopus".pluralize # => "CamelOctopi"
<ide> def pluralize(word)
<add> word = deprecate_symbol(word)
<ide> result = word.to_str.dup
<ide>
<ide> if word.empty? || inflections.uncountables.include?(result.downcase)
<ide> def pluralize(word)
<ide> # "word".singularize # => "word"
<ide> # "CamelOctopi".singularize # => "CamelOctopus"
<ide> def singularize(word)
<add> word = deprecate_symbol(word)
<ide> result = word.to_str.dup
<ide>
<ide> if inflections.uncountables.any? { |inflection| result =~ /\b(#{inflection})\Z/i }
<ide> def singularize(word)
<ide> #
<ide> # "SSLError".underscore.camelize # => "SslError"
<ide> def camelize(term, uppercase_first_letter = true)
<add> term = deprecate_symbol(term)
<ide> string = term.to_str
<ide> if uppercase_first_letter
<ide> string = string.sub(/^[a-z\d]*/) { inflections.acronyms[$&] || $&.capitalize }
<ide> def camelize(term, uppercase_first_letter = true)
<ide> #
<ide> # "SSLError".underscore.camelize # => "SslError"
<ide> def underscore(camel_cased_word)
<add> camel_cased_word = deprecate_symbol(camel_cased_word)
<ide> word = camel_cased_word.to_str.dup
<ide> word.gsub!(/::/, '/')
<ide> word.gsub!(/(?:([A-Za-z\d])|^)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1}#{$1 && '_'}#{$2.downcase}" }
<ide> def underscore(camel_cased_word)
<ide> # "employee_salary" # => "Employee salary"
<ide> # "author_id" # => "Author"
<ide> def humanize(lower_case_and_underscored_word)
<add> lower_case_and_underscored_word = deprecate_symbol(lower_case_and_underscored_word)
<ide> result = lower_case_and_underscored_word.to_str.dup
<ide> inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
<ide> result.gsub!(/_id$/, "")
<ide> def tableize(class_name)
<ide> # Singular names are not handled correctly:
<ide> # "business".classify # => "Busines"
<ide> def classify(table_name)
<add> table_name = deprecate_symbol(table_name)
<ide> # strip out any leading schema name
<ide> camelize(singularize(table_name.to_str.sub(/.*\./, '')))
<ide> end
<ide> def classify(table_name)
<ide> # Example:
<ide> # "puni_puni" # => "puni-puni"
<ide> def dasherize(underscored_word)
<add> underscored_word = deprecate_symbol(underscored_word)
<ide> underscored_word.to_str.gsub(/_/, '-')
<ide> end
<ide>
<ide> def dasherize(underscored_word)
<ide> # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
<ide> # "Inflections".demodulize # => "Inflections"
<ide> def demodulize(class_name_in_module)
<add> class_name_in_module = deprecate_symbol(class_name_in_module)
<ide> class_name_in_module.to_str.gsub(/^.*::/, '')
<ide> end
<ide>
<ide> def ordinalize(number)
<ide> end
<ide> end
<ide> end
<add>
<add> def deprecate_symbol(symbol)
<add> if symbol.is_a?(Symbol)
<add> symbol = symbol.to_s
<add> ActiveSupport::Deprecation.warn("Using symbols in inflections is deprecated. Please use to_s to have a string.")
<add> end
<add> symbol
<add> end
<ide> end
<ide> end
<ide><path>activesupport/test/inflector_test.rb
<ide> class Case
<ide> end
<ide> end
<ide>
<del>class InflectorTest < Test::Unit::TestCase
<add>class InflectorTest < ActiveSupport::TestCase
<ide> include InflectorTestCases
<ide>
<ide> def test_pluralize_plurals
<ide> def test_classify
<ide> end
<ide> end
<ide>
<del> def test_classify_with_symbol
<del> assert_nothing_raised do
<del> assert_equal 'FooBar', ActiveSupport::Inflector.classify(:foo_bars)
<del> end
<del> end
<del>
<ide> def test_classify_with_leading_schema_name
<ide> assert_equal 'FooBar', ActiveSupport::Inflector.classify('schema.foo_bar')
<ide> end
<ide> def test_underscore_to_lower_camel
<ide> end
<ide> end
<ide>
<del> def test_symbol_to_lower_camel
<del> SymbolToLowerCamel.each do |symbol, lower_camel|
<del> assert_equal(lower_camel, ActiveSupport::Inflector.camelize(symbol, false))
<del> end
<del> end
<del>
<ide> %w{plurals singulars uncountables humans}.each do |inflection_type|
<ide> class_eval <<-RUBY, __FILE__, __LINE__ + 1
<ide> def test_clear_#{inflection_type}
<ide> def test_clear_with_default
<ide> ActiveSupport::Inflector.inflections.instance_variable_set :@humans, cached_values[3]
<ide> end
<ide>
<add> [:pluralize, :singularize, :camelize, :underscore, :humanize, :titleize, :tableize, :classify, :dasherize, :demodulize].each do |method|
<add> test "should deprecate symbols on #{method}" do
<add> assert_deprecated(/Using symbols in inflections is deprecated/) do
<add> ActiveSupport::Inflector.send(method, :foo)
<add> end
<add> end
<add> end
<add>
<ide> Irregularities.each do |irregularity|
<ide> singular, plural = *irregularity
<ide> ActiveSupport::Inflector.inflections do |inflect|
<ide><path>activesupport/test/inflector_test_cases.rb
<ide> module InflectorTestCases
<ide> "area51_controller" => "area51Controller"
<ide> }
<ide>
<del> SymbolToLowerCamel = {
<del> :product => 'product',
<del> :special_guest => 'specialGuest',
<del> :application_controller => 'applicationController',
<del> :area51_controller => 'area51Controller'
<del> }
<del>
<ide> CamelToUnderscoreWithoutReverse = {
<ide> "HTMLTidy" => "html_tidy",
<ide> "HTMLTidyGenerator" => "html_tidy_generator",
<ide><path>activesupport/test/safe_buffer_test.rb
<ide> def setup
<ide> assert_equal "my_test", str
<ide> end
<ide>
<del> test "Should not return safe buffer from gsub" do
<del> altered_buffer = @buffer.gsub('', 'asdf')
<del> assert_equal 'asdf', altered_buffer
<add> test "Should not return safe buffer from capitalize" do
<add> altered_buffer = "asdf".html_safe.capitalize
<add> assert_equal 'Asdf', altered_buffer
<ide> assert !altered_buffer.html_safe?
<ide> end
<ide>
<ide> test "Should not return safe buffer from gsub!" do
<del> @buffer.gsub!('', 'asdf')
<del> assert_equal 'asdf', @buffer
<del> assert !@buffer.html_safe?
<add> string = "asdf"
<add> string.capitalize!
<add> assert_equal 'Asdf', string
<add> assert !string.html_safe?
<ide> end
<ide>
<ide> test "Should escape dirty buffers on add" do
<ide> clean = "hello".html_safe
<del> @buffer.gsub!('', '<>')
<del> assert_equal "hello<>", clean + @buffer
<add> assert_equal "hello<>", clean + '<>'
<ide> end
<ide>
<ide> test "Should concat as a normal string when dirty" do
<ide> clean = "hello".html_safe
<del> @buffer.gsub!('', '<>')
<del> assert_equal "<>hello", @buffer + clean
<add> assert_equal "<>hello", '<>' + clean
<ide> end
<ide>
<ide> test "Should preserve dirty? status on copy" do
<del> @buffer.gsub!('', '<>')
<del> assert !@buffer.dup.html_safe?
<add> dirty = "<>"
<add> assert !dirty.dup.html_safe?
<ide> end
<ide>
<ide> test "Should raise an error when safe_concat is called on dirty buffers" do
<del> @buffer.gsub!('', '<>')
<add> @buffer.capitalize!
<ide> assert_raise ActiveSupport::SafeBuffer::SafeConcatError do
<ide> @buffer.safe_concat "BUSTED"
<ide> end
<ide> end
<del>
<add>
<ide> test "should not fail if the returned object is not a string" do
<ide> assert_kind_of NilClass, @buffer.slice("chipchop")
<ide> end
<ide> def setup
<ide> assert_not_nil dirty
<ide> assert !dirty
<ide> end
<add>
<add> ["gsub", "sub"].each do |unavailable_method|
<add> test "should raise on #{unavailable_method}" do
<add> assert_raise NoMethodError, "#{unavailable_method} cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}" do
<add> @buffer.send(unavailable_method, '', '<>')
<add> end
<add> end
<add>
<add> test "should raise on #{unavailable_method}!" do
<add> assert_raise NoMethodError, "#{unavailable_method}! cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}!" do
<add> @buffer.send("#{unavailable_method}!", '', '<>')
<add> end
<add> end
<add> end
<ide> end | 4 |
Text | Text | broaden json standardisation by patching | 975f5b0c281fe579336fc0ffeb49ac0907465a5a | <ide><path>docs/sources/reference/api/docker_remote_api_v1.0.md
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.1.md
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.10.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id` 's filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pull it from the registry or by importing
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Status Codes:
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide>
<ide> Json Parameters:
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.11.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pull it from the registry or by importing i
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Display system-wide information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Containers":11,
<del> "Images":16,
<del> "Driver":"btrfs",
<del> "ExecutionDriver":"native-0.1",
<del> "KernelVersion":"3.12.0-1-amd64"
<del> "Debug":false,
<add> "Containers": 11,
<add> "Images": 16,
<add> "Driver": "btrfs",
<add> "ExecutionDriver": "native-0.1",
<add> "KernelVersion": "3.12.0-1-amd64"
<add> "Debug": false,
<ide> "NFd": 11,
<del> "NGoroutines":21,
<del> "NEventsListener":0,
<del> "InitPath":"/usr/bin/docker",
<del> "IndexServerAddress":["https://index.docker.io/v1/"],
<del> "MemoryLimit":true,
<del> "SwapLimit":false,
<del> "IPv4Forwarding":true
<add> "NGoroutines": 21,
<add> "NEventsListener": 0,
<add> "InitPath": "/usr/bin/docker",
<add> "IndexServerAddress": ["https://index.docker.io/v1/"],
<add> "MemoryLimit": true,
<add> "SwapLimit": false,
<add> "IPv4Forwarding": true
<ide> }
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.12.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pull it from the registry or by importing i
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return low-level information on the image `name`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Created":"2013-03-23T22:24:18.818426-07:00",
<del> "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<add> "Created": "2013-03-23T22:24:18.818426-07:00",
<add> "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<ide> "ContainerConfig":
<ide> {
<del> "Hostname":"",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<del> "AttachStdin":false,
<del> "AttachStdout":false,
<del> "AttachStderr":false,
<del> "PortSpecs":null,
<del> "Tty":true,
<del> "OpenStdin":true,
<del> "StdinOnce":false,
<del> "Env":null,
<add> "Hostname": "",
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<add> "AttachStdin": false,
<add> "AttachStdout": false,
<add> "AttachStderr": false,
<add> "PortSpecs": null,
<add> "Tty": true,
<add> "OpenStdin": true,
<add> "StdinOnce": false,
<add> "Env": null,
<ide> "Cmd": ["/bin/bash"],
<del> "Dns":null,
<del> "Image":"base",
<del> "Volumes":null,
<del> "VolumesFrom":"",
<del> "WorkingDir":""
<add> "Dns": null,
<add> "Image": "base",
<add> "Volumes": null,
<add> "VolumesFrom": "",
<add> "WorkingDir": ""
<ide> },
<del> "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<del> "Parent":"27cf784147099545",
<add> "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<add> "Parent": "27cf784147099545",
<ide> "Size": 6824592
<ide> }
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Display system-wide information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Containers":11,
<del> "Images":16,
<del> "Driver":"btrfs",
<del> "ExecutionDriver":"native-0.1",
<del> "KernelVersion":"3.12.0-1-amd64"
<del> "Debug":false,
<add> "Containers": 11,
<add> "Images": 16,
<add> "Driver": "btrfs",
<add> "ExecutionDriver": "native-0.1",
<add> "KernelVersion": "3.12.0-1-amd64"
<add> "Debug": false,
<ide> "NFd": 11,
<del> "NGoroutines":21,
<del> "NEventsListener":0,
<del> "InitPath":"/usr/bin/docker",
<del> "IndexServerAddress":["https://index.docker.io/v1/"],
<del> "MemoryLimit":true,
<del> "SwapLimit":false,
<del> "IPv4Forwarding":true
<add> "NGoroutines": 21,
<add> "NEventsListener": 0,
<add> "InitPath": "/usr/bin/docker",
<add> "IndexServerAddress": ["https://index.docker.io/v1/"],
<add> "MemoryLimit": true,
<add> "SwapLimit": false,
<add> "IPv4Forwarding": true
<ide> }
<ide>
<ide> Status Codes:
<ide> Show the docker version information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "ApiVersion":"1.12",
<del> "Version":"0.2.2",
<del> "GitCommit":"5a2a5cc+CHANGES",
<del> "GoVersion":"go1.0.3"
<add> "ApiVersion": "1.12",
<add> "Version": "0.2.2",
<add> "GitCommit": "5a2a5cc+CHANGES",
<add> "GoVersion": "go1.0.3"
<ide> }
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "PortSpecs":null,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "PortSpecs": null,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<del> "Volumes":{
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "ExposedPorts":{
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> }
<ide> }
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.13.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pulling it from the registry or by importing it
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return low-level information on the image `name`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Created":"2013-03-23T22:24:18.818426-07:00",
<del> "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<add> "Created": "2013-03-23T22:24:18.818426-07:00",
<add> "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<ide> "ContainerConfig":
<ide> {
<del> "Hostname":"",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<del> "AttachStdin":false,
<del> "AttachStdout":false,
<del> "AttachStderr":false,
<del> "PortSpecs":null,
<del> "Tty":true,
<del> "OpenStdin":true,
<del> "StdinOnce":false,
<del> "Env":null,
<add> "Hostname": "",
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<add> "AttachStdin": false,
<add> "AttachStdout": false,
<add> "AttachStderr": false,
<add> "PortSpecs": null,
<add> "Tty": true,
<add> "OpenStdin": true,
<add> "StdinOnce": false,
<add> "Env": null,
<ide> "Cmd": ["/bin/bash"],
<del> "Dns":null,
<del> "Image":"base",
<del> "Volumes":null,
<del> "VolumesFrom":"",
<del> "WorkingDir":""
<add> "Dns": null,
<add> "Image": "base",
<add> "Volumes": null,
<add> "VolumesFrom": "",
<add> "WorkingDir": ""
<ide> },
<del> "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<del> "Parent":"27cf784147099545",
<add> "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<add> "Parent": "27cf784147099545",
<ide> "Size": 6824592
<ide> }
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Display system-wide information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Containers":11,
<del> "Images":16,
<del> "Driver":"btrfs",
<del> "ExecutionDriver":"native-0.1",
<del> "KernelVersion":"3.12.0-1-amd64"
<del> "Debug":false,
<add> "Containers": 11,
<add> "Images": 16,
<add> "Driver": "btrfs",
<add> "ExecutionDriver": "native-0.1",
<add> "KernelVersion": "3.12.0-1-amd64"
<add> "Debug": false,
<ide> "NFd": 11,
<del> "NGoroutines":21,
<del> "NEventsListener":0,
<del> "InitPath":"/usr/bin/docker",
<del> "IndexServerAddress":["https://index.docker.io/v1/"],
<del> "MemoryLimit":true,
<del> "SwapLimit":false,
<del> "IPv4Forwarding":true
<add> "NGoroutines": 21,
<add> "NEventsListener": 0,
<add> "InitPath": "/usr/bin/docker",
<add> "IndexServerAddress": ["https://index.docker.io/v1/"],
<add> "MemoryLimit": true,
<add> "SwapLimit": false,
<add> "IPv4Forwarding": true
<ide> }
<ide>
<ide> Status Codes:
<ide> Show the docker version information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "ApiVersion":"1.12",
<del> "Version":"0.2.2",
<del> "GitCommit":"5a2a5cc+CHANGES",
<del> "GoVersion":"go1.0.3"
<add> "ApiVersion": "1.12",
<add> "Version": "0.2.2",
<add> "GitCommit": "5a2a5cc+CHANGES",
<add> "GoVersion": "go1.0.3"
<ide> }
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "PortSpecs":null,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "PortSpecs": null,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<del> "Volumes":{
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "ExposedPorts":{
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> }
<ide> }
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.14.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> Return low-level information on the container `id`
<ide> },
<ide> "Links": ["/name:alias"],
<ide> "PublishAllPorts": false,
<del> "CapAdd: ["NET_ADMIN"],
<del> "CapDrop: ["MKNOD"]
<add> "CapAdd": ["NET_ADMIN"],
<add> "CapDrop": ["MKNOD"]
<ide> }
<ide> }
<ide>
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pulling it from the registry or by importing it
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return low-level information on the image `name`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Created":"2013-03-23T22:24:18.818426-07:00",
<del> "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<add> "Created": "2013-03-23T22:24:18.818426-07:00",
<add> "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<ide> "ContainerConfig":
<ide> {
<del> "Hostname":"",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<del> "AttachStdin":false,
<del> "AttachStdout":false,
<del> "AttachStderr":false,
<del> "PortSpecs":null,
<del> "Tty":true,
<del> "OpenStdin":true,
<del> "StdinOnce":false,
<del> "Env":null,
<add> "Hostname": "",
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<add> "AttachStdin": false,
<add> "AttachStdout": false,
<add> "AttachStderr": false,
<add> "PortSpecs": null,
<add> "Tty": true,
<add> "OpenStdin": true,
<add> "StdinOnce": false,
<add> "Env": null,
<ide> "Cmd": ["/bin/bash"],
<del> "Dns":null,
<del> "Image":"base",
<del> "Volumes":null,
<del> "VolumesFrom":"",
<del> "WorkingDir":""
<add> "Dns": null,
<add> "Image": "base",
<add> "Volumes": null,
<add> "VolumesFrom": "",
<add> "WorkingDir": ""
<ide> },
<del> "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<del> "Parent":"27cf784147099545",
<add> "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<add> "Parent": "27cf784147099545",
<ide> "Size": 6824592
<ide> }
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Display system-wide information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Containers":11,
<del> "Images":16,
<del> "Driver":"btrfs",
<del> "ExecutionDriver":"native-0.1",
<del> "KernelVersion":"3.12.0-1-amd64"
<del> "Debug":false,
<add> "Containers": 11,
<add> "Images": 16,
<add> "Driver": "btrfs",
<add> "ExecutionDriver": "native-0.1",
<add> "KernelVersion": "3.12.0-1-amd64"
<add> "Debug": false,
<ide> "NFd": 11,
<del> "NGoroutines":21,
<del> "NEventsListener":0,
<del> "InitPath":"/usr/bin/docker",
<del> "IndexServerAddress":["https://index.docker.io/v1/"],
<del> "MemoryLimit":true,
<del> "SwapLimit":false,
<del> "IPv4Forwarding":true
<add> "NGoroutines": 21,
<add> "NEventsListener": 0,
<add> "InitPath": "/usr/bin/docker",
<add> "IndexServerAddress": ["https://index.docker.io/v1/"],
<add> "MemoryLimit": true,
<add> "SwapLimit": false,
<add> "IPv4Forwarding": true
<ide> }
<ide>
<ide> Status Codes:
<ide> Show the docker version information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "ApiVersion":"1.12",
<del> "Version":"0.2.2",
<del> "GitCommit":"5a2a5cc+CHANGES",
<del> "GoVersion":"go1.0.3"
<add> "ApiVersion": "1.12",
<add> "Version": "0.2.2",
<add> "GitCommit": "5a2a5cc+CHANGES",
<add> "GoVersion": "go1.0.3"
<ide> }
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "PortSpecs":null,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "PortSpecs": null,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<del> "Volumes":{
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "ExposedPorts":{
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> }
<ide> }
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.16.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Create a container
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<ide> "Entrypoint": "",
<del> "Image":"base",
<del> "Volumes":{
<add> "Image": "base",
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "MacAddress":"12:34:56:78:9a:bc",
<del> "ExposedPorts":{
<add> "MacAddress": "12:34:56:78:9a:bc",
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> },
<ide> "SecurityOpts": [""],
<ide> "HostConfig": {
<del> "Binds":["/tmp:/tmp"],
<del> "Links":["redis3:redis"],
<del> "LxcConf":{"lxc.utsname":"docker"},
<del> "PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
<del> "PublishAllPorts":false,
<del> "Privileged":false,
<add> "Binds": ["/tmp:/tmp"],
<add> "Links": ["redis3:redis"],
<add> "LxcConf": {"lxc.utsname":"docker"},
<add> "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
<add> "PublishAllPorts": false,
<add> "Privileged": false,
<ide> "Dns": ["8.8.8.8"],
<ide> "DnsSearch": [""],
<ide> "VolumesFrom": ["parent", "other:ro"],
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> Return low-level information on the container `id`
<ide> },
<ide> "Links": ["/name:alias"],
<ide> "PublishAllPorts": false,
<del> "CapAdd: ["NET_ADMIN"],
<del> "CapDrop: ["MKNOD"]
<add> "CapAdd": ["NET_ADMIN"],
<add> "CapDrop": ["MKNOD"]
<ide> }
<ide> }
<ide>
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pulling it from the registry or by importing it
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return low-level information on the image `name`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Created":"2013-03-23T22:24:18.818426-07:00",
<del> "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<add> "Created": "2013-03-23T22:24:18.818426-07:00",
<add> "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<ide> "ContainerConfig":
<ide> {
<del> "Hostname":"",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<del> "AttachStdin":false,
<del> "AttachStdout":false,
<del> "AttachStderr":false,
<del> "PortSpecs":null,
<del> "Tty":true,
<del> "OpenStdin":true,
<del> "StdinOnce":false,
<del> "Env":null,
<add> "Hostname": "",
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<add> "AttachStdin": false,
<add> "AttachStdout": false,
<add> "AttachStderr": false,
<add> "PortSpecs": null,
<add> "Tty": true,
<add> "OpenStdin": true,
<add> "StdinOnce": false,
<add> "Env": null,
<ide> "Cmd": ["/bin/bash"],
<del> "Dns":null,
<del> "Image":"base",
<del> "Volumes":null,
<del> "VolumesFrom":"",
<del> "WorkingDir":""
<add> "Dns": null,
<add> "Image": "base",
<add> "Volumes": null,
<add> "VolumesFrom": "",
<add> "WorkingDir": ""
<ide> },
<del> "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<del> "Parent":"27cf784147099545",
<add> "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<add> "Parent": "27cf784147099545",
<ide> "Size": 6824592
<ide> }
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Show the docker version information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "ApiVersion":"1.12",
<del> "Version":"0.2.2",
<del> "GitCommit":"5a2a5cc+CHANGES",
<del> "GoVersion":"go1.0.3"
<add> "ApiVersion": "1.12",
<add> "Version": "0.2.2",
<add> "GitCommit": "5a2a5cc+CHANGES",
<add> "GoVersion": "go1.0.3"
<ide> }
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "PortSpecs":null,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "PortSpecs": null,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<del> "Volumes":{
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "ExposedPorts":{
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> }
<ide> }
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "Tty":false,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "Tty": false,
<add> "Cmd": [
<ide> "date"
<ide> ],
<ide> }
<ide> Sets up an exec instance in a running container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Id":"f90e34656806"
<add> "Id": "f90e34656806"
<ide> }
<ide>
<ide> Json Parameters:
<ide> interactive session with the `exec` command.
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Detach":false,
<del> "Tty":false,
<add> "Detach": false,
<add> "Tty": false,
<ide> }
<ide>
<ide> **Example response**:
<ide><path>docs/sources/reference/api/docker_remote_api_v1.17.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Create a container
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<ide> "Entrypoint": "",
<del> "Image":"base",
<del> "Volumes":{
<add> "Image": "base",
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "MacAddress":"12:34:56:78:9a:bc",
<del> "ExposedPorts":{
<add> "MacAddress": "12:34:56:78:9a:bc",
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> },
<ide> "SecurityOpts": [""],
<ide> "HostConfig": {
<del> "Binds":["/tmp:/tmp"],
<del> "Links":["redis3:redis"],
<del> "LxcConf":{"lxc.utsname":"docker"},
<del> "PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
<del> "PublishAllPorts":false,
<del> "Privileged":false,
<add> "Binds": ["/tmp:/tmp"],
<add> "Links": ["redis3:redis"],
<add> "LxcConf": {"lxc.utsname":"docker"},
<add> "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
<add> "PublishAllPorts": false,
<add> "Privileged": false,
<ide> "Dns": ["8.8.8.8"],
<ide> "DnsSearch": [""],
<ide> "VolumesFrom": ["parent", "other:ro"],
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> Return low-level information on the container `id`
<ide> },
<ide> "Links": ["/name:alias"],
<ide> "PublishAllPorts": false,
<del> "CapAdd: ["NET_ADMIN"],
<del> "CapDrop: ["MKNOD"]
<add> "CapAdd": ["NET_ADMIN"],
<add> "CapDrop": ["MKNOD"]
<ide> }
<ide> }
<ide>
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pulling it from the registry or by importing it
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return low-level information on the image `name`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Created":"2013-03-23T22:24:18.818426-07:00",
<del> "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<add> "Created": "2013-03-23T22:24:18.818426-07:00",
<add> "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
<ide> "ContainerConfig":
<ide> {
<del> "Hostname":"",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<del> "AttachStdin":false,
<del> "AttachStdout":false,
<del> "AttachStderr":false,
<del> "PortSpecs":null,
<del> "Tty":true,
<del> "OpenStdin":true,
<del> "StdinOnce":false,
<del> "Env":null,
<add> "Hostname": "",
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<add> "AttachStdin": false,
<add> "AttachStdout": false,
<add> "AttachStderr": false,
<add> "PortSpecs": null,
<add> "Tty": true,
<add> "OpenStdin": true,
<add> "StdinOnce": false,
<add> "Env": null,
<ide> "Cmd": ["/bin/bash"],
<del> "Dns":null,
<del> "Image":"base",
<del> "Volumes":null,
<del> "VolumesFrom":"",
<del> "WorkingDir":""
<add> "Dns": null,
<add> "Image": "base",
<add> "Volumes": null,
<add> "VolumesFrom": "",
<add> "WorkingDir": ""
<ide> },
<del> "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<del> "Parent":"27cf784147099545",
<add> "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
<add> "Parent": "27cf784147099545",
<ide> "Size": 6824592
<ide> }
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> If you wish to push an image on to a private registry, that image must already have been tagged
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Query Parameters:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Show the docker version information
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "ApiVersion":"1.12",
<del> "Version":"0.2.2",
<del> "GitCommit":"5a2a5cc+CHANGES",
<del> "GoVersion":"go1.0.3"
<add> "ApiVersion": "1.12",
<add> "Version": "0.2.2",
<add> "GitCommit": "5a2a5cc+CHANGES",
<add> "GoVersion": "go1.0.3"
<ide> }
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Hostname":"",
<add> "Hostname": "",
<ide> "Domainname": "",
<del> "User":"",
<del> "Memory":0,
<del> "MemorySwap":0,
<add> "User": "",
<add> "Memory": 0,
<add> "MemorySwap": 0,
<ide> "CpuShares": 512,
<ide> "Cpuset": "0,1",
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "PortSpecs":null,
<del> "Tty":false,
<del> "OpenStdin":false,
<del> "StdinOnce":false,
<del> "Env":null,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "PortSpecs": null,
<add> "Tty": false,
<add> "OpenStdin": false,
<add> "StdinOnce": false,
<add> "Env": null,
<add> "Cmd": [
<ide> "date"
<ide> ],
<del> "Volumes":{
<add> "Volumes": {
<ide> "/tmp": {}
<ide> },
<del> "WorkingDir":"",
<add> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<del> "ExposedPorts":{
<add> "ExposedPorts": {
<ide> "22/tcp": {}
<ide> }
<ide> }
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "AttachStdin":false,
<del> "AttachStdout":true,
<del> "AttachStderr":true,
<del> "Tty":false,
<del> "Cmd":[
<add> "AttachStdin": false,
<add> "AttachStdout": true,
<add> "AttachStderr": true,
<add> "Tty": false,
<add> "Cmd": [
<ide> "date"
<ide> ],
<ide> }
<ide> Sets up an exec instance in a running container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Id":"f90e34656806"
<add> "Id": "f90e34656806"
<ide> }
<ide>
<ide> Json Parameters:
<ide> interactive session with the `exec` command.
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Detach":false,
<del> "Tty":false,
<add> "Detach": false,
<add> "Tty": false,
<ide> }
<ide>
<ide> **Example response**:
<ide><path>docs/sources/reference/api/docker_remote_api_v1.2.md
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.3.md
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.4.md
<ide> Return low-level information on the container `id`
<ide> "Image": "ubuntu",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.5.md
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.6.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.7.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.8.md
<ide> List containers
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pull it from the registry or by importing i
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> Request Headers:
<ide> Remove the image `name` from the filesystem
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Build an image from Dockerfile via stdin
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 OK
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Query Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide>
<ide><path>docs/sources/reference/api/docker_remote_api_v1.9.md
<ide> List containers.
<ide> "Command": "echo 1",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "9cd87474be90",
<ide> "Image": "base:latest",
<ide> "Command": "echo 222222",
<ide> "Created": 1367854155,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> },
<ide> {
<ide> "Id": "3176a2479c92",
<ide> List containers.
<ide> "Command": "echo 444444444444444444444444444444444",
<ide> "Created": 1367854152,
<ide> "Status": "Exit 0",
<del> "Ports":[],
<del> "SizeRw":12288,
<del> "SizeRootFs":0
<add> "Ports": [],
<add> "SizeRw": 12288,
<add> "SizeRootFs": 0
<ide> }
<ide> ]
<ide>
<ide> Return low-level information on the container `id`
<ide> "Image": "base",
<ide> "Volumes": {},
<ide> "VolumesFrom": "",
<del> "WorkingDir":""
<del>
<add> "WorkingDir": ""
<ide> },
<ide> "State": {
<ide> "Running": false,
<ide> List processes running inside the container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Titles":[
<add> "Titles": [
<ide> "USER",
<ide> "PID",
<ide> "%CPU",
<ide> List processes running inside the container `id`
<ide> "TIME",
<ide> "COMMAND"
<ide> ],
<del> "Processes":[
<add> "Processes": [
<ide> ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
<ide> ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
<ide> ]
<ide> Inspect changes on container `id`'s filesystem
<ide>
<ide> [
<ide> {
<del> "Path":"/dev",
<del> "Kind":0
<add> "Path": "/dev",
<add> "Kind": 0
<ide> },
<ide> {
<del> "Path":"/dev/kmsg",
<del> "Kind":1
<add> "Path": "/dev/kmsg",
<add> "Kind": 1
<ide> },
<ide> {
<del> "Path":"/test",
<del> "Kind":1
<add> "Path": "/test",
<add> "Kind": 1
<ide> }
<ide> ]
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"StatusCode":0}
<add> {"StatusCode": 0}
<ide>
<ide> Status Codes:
<ide>
<ide> Copy files or folders of container `id`
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "Resource":"test.txt"
<add> "Resource": "test.txt"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create an image, either by pull it from the registry or by importing i
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pulling..."}
<del> {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
<del> {"error":"Invalid..."}
<add> {"status": "Pulling..."}
<add> {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> When using this endpoint to pull an image from the registry, the
<ide> Return the history of the image `name`
<ide>
<ide> [
<ide> {
<del> "Id":"b750fe79269d",
<del> "Created":1364102658,
<del> "CreatedBy":"/bin/bash"
<add> "Id": "b750fe79269d",
<add> "Created": 1364102658,
<add> "CreatedBy": "/bin/bash"
<ide> },
<ide> {
<del> "Id":"27cf78414709",
<del> "Created":1364068391,
<del> "CreatedBy":""
<add> "Id": "27cf78414709",
<add> "Created": 1364068391,
<add> "CreatedBy": ""
<ide> }
<ide> ]
<ide>
<ide> Push the image `name` on the registry
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"Pushing..."}
<del> {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
<del> {"error":"Invalid..."}
<add> {"status": "Pushing..."}
<add> {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
<add> {"error": "Invalid..."}
<ide> ...
<ide>
<ide> Request Headers:
<ide> Status Codes:
<ide> Content-type: application/json
<ide>
<ide> [
<del> {"Untagged":"3e2f21a89f"},
<del> {"Deleted":"3e2f21a89f"},
<del> {"Deleted":"53b4f83ac9"}
<add> {"Untagged": "3e2f21a89f"},
<add> {"Deleted": "3e2f21a89f"},
<add> {"Deleted": "53b4f83ac9"}
<ide> ]
<ide>
<ide> Status Codes:
<ide> Build an image from Dockerfile using a POST body.
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"stream":"Step 1..."}
<del> {"stream":"..."}
<del> {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
<add> {"stream": "Step 1..."}
<add> {"stream": "..."}
<add> {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
<ide>
<ide> The stream must be a tar archive compressed with one of the
<ide> following algorithms: identity (no compression), gzip, bzip2, xz.
<ide> Get the default username and email
<ide> Content-Type: application/json
<ide>
<ide> {
<del> "username":"hannibal",
<del> "password:"xxxx",
<del> "email":"hannibal@a-team.com",
<del> "serveraddress":"https://index.docker.io/v1/"
<add> "username":" hannibal",
<add> "password: "xxxx",
<add> "email": "hannibal@a-team.com",
<add> "serveraddress": "https://index.docker.io/v1/"
<ide> }
<ide>
<ide> **Example response**:
<ide> Create a new image from a container's changes
<ide> HTTP/1.1 201 Created
<ide> Content-Type: application/vnd.docker.raw-stream
<ide>
<del> {"Id":"596069db4bf5"}
<add> {"Id": "596069db4bf5"}
<ide>
<ide> Json Parameters:
<ide>
<ide> and Docker images will report:
<ide> HTTP/1.1 200 OK
<ide> Content-Type: application/json
<ide>
<del> {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
<del> {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
<del> {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
<add> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
<add> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
<add> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
<ide>
<ide> Query Parameters:
<ide>
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide>
<ide> ```
<ide> {"hello-world":
<del> {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<add> {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
<ide> }
<ide> ```
<ide> | 17 |
Javascript | Javascript | expand test coverage of events.js | bee83e0bbc4f61c3bef3bb18043e3f39ea40a336 | <ide><path>test/parallel/test-event-emitter-num-args.js
<ide> const assert = require('assert');
<ide> const events = require('events');
<ide>
<ide> const e = new events.EventEmitter();
<del>const num_args_emited = [];
<add>const num_args_emitted = [];
<ide>
<ide> e.on('numArgs', function() {
<ide> const numArgs = arguments.length;
<del> console.log('numArgs: ' + numArgs);
<del> num_args_emited.push(numArgs);
<add> num_args_emitted.push(numArgs);
<ide> });
<ide>
<del>console.log('start');
<add>e.on('foo', function() {
<add> num_args_emitted.push(arguments.length);
<add>});
<add>
<add>e.on('foo', function() {
<add> num_args_emitted.push(arguments.length);
<add>});
<ide>
<ide> e.emit('numArgs');
<ide> e.emit('numArgs', null);
<ide> e.emit('numArgs', null, null, null);
<ide> e.emit('numArgs', null, null, null, null);
<ide> e.emit('numArgs', null, null, null, null, null);
<ide>
<add>e.emit('foo', null, null, null, null);
<add>
<ide> process.on('exit', function() {
<del> assert.deepStrictEqual([0, 1, 2, 3, 4, 5], num_args_emited);
<add> assert.deepStrictEqual([0, 1, 2, 3, 4, 5, 4, 4], num_args_emitted);
<ide> });
<ide><path>test/parallel/test-event-emitter-remove-all-listeners.js
<ide> function listener() {}
<ide> ee.removeAllListeners('baz');
<ide> assert.strictEqual(ee.listeners('baz').length, 0);
<ide> }
<add>
<add>{
<add> const ee = new events.EventEmitter();
<add> assert.deepStrictEqual(ee, ee.removeAllListeners());
<add>}
<ide><path>test/parallel/test-event-emitter-remove-listeners.js
<ide> function listener2() {}
<ide> ee.emit('hello');
<ide> }
<ide>
<add>{
<add> const ee = new EventEmitter();
<add>
<add> assert.deepStrictEqual(ee, ee.removeListener('foo', () => {}));
<add>}
<add>
<ide> // Verify that the removed listener must be a function
<ide> assert.throws(() => {
<ide> const ee = new EventEmitter();
<ide><path>test/parallel/test-event-emitter-special-event-names.js
<ide> const assert = require('assert');
<ide> const ee = new EventEmitter();
<ide> const handler = () => {};
<ide>
<add>assert.deepStrictEqual(ee.eventNames(), []);
<add>
<ide> assert.strictEqual(ee._events.hasOwnProperty, undefined);
<ide> assert.strictEqual(ee._events.toString, undefined);
<ide> | 4 |
Ruby | Ruby | add support for "presentation" gallery attribute | 2bd0f608f268d6e98ad014ae6a2151e291ebce7c | <ide><path>lib/action_text/attachment.rb
<ide> class Attachment
<ide>
<ide> TAG_NAME = "action-text-attachment"
<ide> SELECTOR = TAG_NAME
<del> ATTRIBUTES = %w( sgid content-type url href filename filesize width height previewable caption )
<add> ATTRIBUTES = %w( sgid content-type url href filename filesize width height previewable presentation caption )
<ide>
<ide> class << self
<ide> def fragment_by_canonicalizing_attachments(content)
<ide><path>lib/action_text/trix_attachment.rb
<ide> class TrixAttachment
<ide> TAG_NAME = "figure"
<ide> SELECTOR = "[data-trix-attachment]"
<ide>
<del> ATTRIBUTES = %w( sgid contentType url href filename filesize width height previewable content caption )
<add> COMPOSED_ATTRIBUTES = %w( caption presentation )
<add> ATTRIBUTES = %w( sgid contentType url href filename filesize width height previewable content ) + COMPOSED_ATTRIBUTES
<ide> ATTRIBUTE_TYPES = {
<ide> "previewable" => ->(value) { value.to_s == "true" },
<ide> "filesize" => ->(value) { Integer(value.to_s) rescue value },
<ide> class << self
<ide> def from_attributes(attributes)
<ide> attributes = process_attributes(attributes)
<ide>
<del> trix_attachment_attributes = attributes.except("caption")
<del> trix_attributes = attributes.slice("caption")
<add> trix_attachment_attributes = attributes.except(*COMPOSED_ATTRIBUTES)
<add> trix_attributes = attributes.slice(*COMPOSED_ATTRIBUTES)
<ide>
<ide> node = ActionText::HtmlConversion.create_element(TAG_NAME)
<ide> node["data-trix-attachment"] = JSON.generate(trix_attachment_attributes) | 2 |
PHP | PHP | remove unused test | 4e0f246c6eebd1a610a4ec44f15af1709f8a9b88 | <ide><path>tests/TestCase/Utility/SecurityTest.php
<ide> class SecurityTest extends TestCase
<ide> {
<ide>
<del> /**
<del> * testGenerateAuthkey method
<del> *
<del> * @return void
<del> */
<del> public function testGenerateAuthkey()
<del> {
<del> $this->assertEquals(strlen(Security::generateAuthKey()), 40);
<del> }
<del>
<ide> /**
<ide> * testHash method
<ide> * | 1 |
Javascript | Javascript | fix crash during server render in react 16.4.1. | c35a1e74835d2b4c07f1e14779a22ae8ca5a0d10 | <ide><path>packages/react-scheduler/src/ReactScheduler.js
<ide> if (__DEV__) {
<ide> // this module is initially evaluated.
<ide> // We want to be using a consistent implementation.
<ide> const localDate = Date;
<del>const localSetTimeout = setTimeout;
<del>const localClearTimeout = clearTimeout;
<add>
<add>// This initialization code may run even on server environments
<add>// if a component just imports ReactDOM (e.g. for findDOMNode).
<add>// Some environments might not have setTimeout or clearTimeout.
<add>// https://github.com/facebook/react/pull/13088
<add>const localSetTimeout =
<add> typeof setTimeout === 'function' ? setTimeout : (undefined: any);
<add>const localClearTimeout =
<add> typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
<ide>
<ide> const hasNativePerformanceNow =
<ide> typeof performance === 'object' && typeof performance.now === 'function'; | 1 |
Python | Python | fix failing tests | 62ccc1a306ba59cb843dbb8fb2b1c2e21c84166a | <ide><path>rest_framework/templatetags/rest_framework.py
<ide> def optional_login(request):
<ide> """
<ide> try:
<ide> login_url = reverse('rest_framework:login')
<del> except NoReverseMatch:
<add> except:
<ide> return ''
<ide>
<ide> snippet = "<a href='%s?next=%s'>Log in</a>" % (login_url, request.path)
<ide> def optional_logout(request):
<ide> """
<ide> try:
<ide> logout_url = reverse('rest_framework:logout')
<del> except NoReverseMatch:
<add> except:
<ide> return ''
<ide>
<ide> snippet = "<a href='%s?next=%s'>Log out</a>" % (logout_url, request.path) | 1 |
Python | Python | simplify deprecation test decorator | 29a45efa15cf3992ab01b1535d51189319a7592d | <ide><path>numpy/testing/decorators.py
<ide> """
<ide> from __future__ import division, absolute_import, print_function
<ide>
<del>import warnings
<ide> import collections
<ide>
<del>from .utils import SkipTest
<add>from .utils import SkipTest, assert_warns
<add>
<ide>
<ide> def slow(t):
<ide> """
<ide> def deprecate_decorator(f):
<ide>
<ide> def _deprecated_imp(*args, **kwargs):
<ide> # Poor man's replacement for the with statement
<del> with warnings.catch_warnings(record=True) as l:
<del> warnings.simplefilter('always')
<add> with assert_warns(DeprecationWarning):
<ide> f(*args, **kwargs)
<del> if not len(l) > 0:
<del> raise AssertionError("No warning raised when calling %s"
<del> % f.__name__)
<del> if not l[0].category is DeprecationWarning:
<del> raise AssertionError("First warning for %s is not a "
<del> "DeprecationWarning( is %s)" % (f.__name__, l[0]))
<ide>
<ide> if isinstance(conditional, collections.Callable):
<ide> cond = conditional()
<ide><path>numpy/testing/tests/test_decorators.py
<ide> from __future__ import division, absolute_import, print_function
<ide>
<add>import warnings
<add>
<ide> from numpy.testing import (dec, assert_, assert_raises, run_module_suite,
<ide> SkipTest, KnownFailureException)
<del>import nose
<add>
<ide>
<ide> def test_slow():
<ide> @dec.slow
<ide> def deprecated_func3():
<ide> assert_raises(AssertionError, non_deprecated_func)
<ide> # should be silent
<ide> deprecated_func()
<del> # fails if deprecated decorator just disables test. See #1453.
<del> assert_raises(ValueError, deprecated_func2)
<del> # first warnings is not a DeprecationWarning
<del> assert_raises(AssertionError, deprecated_func3)
<add> with warnings.catch_warnings(record=True):
<add> warnings.simplefilter("always") # do not propagate unrelated warnings
<add> # fails if deprecated decorator just disables test. See #1453.
<add> assert_raises(ValueError, deprecated_func2)
<add> # warning is not a DeprecationWarning
<add> assert_raises(AssertionError, deprecated_func3)
<ide>
<ide>
<ide> if __name__ == '__main__': | 2 |
Javascript | Javascript | add missing types | 1e969d24c154eb196e11be5b8321587b4ebde2ab | <ide><path>lib/Cache.js
<ide> class Cache {
<ide> const gotHandlers = [];
<ide> this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => {
<ide> if (err) {
<del> callback(err);
<add> callback(/** @type {WebpackError} */ (err));
<ide> return;
<ide> }
<ide> if (gotHandlers.length > 1) {
<ide><path>lib/Compilation.js
<ide> class Compilation {
<ide> "compilerIndex"
<ide> ]),
<ide>
<del> /** @type {HookMap<Object, Object>} */
<add> /** @type {HookMap<SyncHook<[Object, Object]>>} */
<ide> statsPreset: new HookMap(() => new SyncHook(["options", "context"])),
<del> /** @type {SyncHook<Object, Object>} */
<add> /** @type {SyncHook<[Object, Object]>} */
<ide> statsNormalize: new SyncHook(["options", "context"]),
<del> /** @type {SyncHook<StatsFactory, Object>} */
<add> /** @type {SyncHook<[StatsFactory, Object]>} */
<ide> statsFactory: new SyncHook(["statsFactory", "options"]),
<del> /** @type {SyncHook<StatsPrinter, Object>} */
<add> /** @type {SyncHook<[StatsPrinter, Object]>} */
<ide> statsPrinter: new SyncHook(["statsPrinter", "options"]),
<ide>
<ide> get normalModuleLoader() {
<ide> class Compilation {
<ide> if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) {
<ide> const options = Object.assign({}, optionsOrPreset);
<ide> if (options.preset !== undefined) {
<del> this.hooks.statsPreset.for(options.preset).call(options, context);
<add> this.hooks.statsPreset
<add> .for(String(options.preset))
<add> .call(options, context);
<ide> }
<ide> this.hooks.statsNormalize.call(options, context);
<ide> return options;
<ide><path>lib/cache/FileCachePlugin.js
<add>/*
<add> MIT License http://www.opensource.org/licenses/mit-license.php
<add> Author Tobias Koppers @sokra
<add>*/
<add>
<add>"use strict";
<add>
<add>const path = require("path");
<add>const createHash = require("../util/createHash");
<add>const makeSerializable = require("../util/makeSerializable");
<add>const { serializer } = require("../util/serialization");
<add>
<add>/** @typedef {import("webpack-sources").Source} Source */
<add>/** @typedef {import("../../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */
<add>/** @typedef {import("../Compiler")} Compiler */
<add>/** @typedef {import("../Module")} Module */
<add>
<add>class Pack {
<add> constructor(version) {
<add> this.version = version;
<add> this.content = new Map();
<add> this.lastAccess = new Map();
<add> this.unserializable = new Set();
<add> this.used = new Set();
<add> this.invalid = false;
<add> }
<add>
<add> get(identifier) {
<add> this.used.add(identifier);
<add> return this.content.get(identifier);
<add> }
<add>
<add> set(identifier, data) {
<add> if (this.unserializable.has(identifier)) return;
<add> this.used.add(identifier);
<add> this.invalid = true;
<add> return this.content.set(identifier, data);
<add> }
<add>
<add> collectGarbage(maxAge) {
<add> this._updateLastAccess();
<add> const now = Date.now();
<add> for (const [identifier, lastAccess] of this.lastAccess) {
<add> if (now - lastAccess > maxAge) {
<add> this.lastAccess.delete(identifier);
<add> this.content.delete(identifier);
<add> }
<add> }
<add> }
<add>
<add> _updateLastAccess() {
<add> const now = Date.now();
<add> for (const identifier of this.used) {
<add> this.lastAccess.set(identifier, now);
<add> }
<add> this.used.clear();
<add> }
<add>
<add> serialize({ write, snapshot, rollback }) {
<add> this._updateLastAccess();
<add> write(this.version);
<add> for (const [identifier, data] of this.content) {
<add> const s = snapshot();
<add> try {
<add> write(identifier);
<add> write(data);
<add> } catch (err) {
<add> rollback(s);
<add> this.unserializable.add(identifier);
<add> continue;
<add> }
<add> }
<add> write(null);
<add> write(this.lastAccess);
<add> write(this.unserializable);
<add> }
<add>
<add> deserialize({ read }) {
<add> this.version = read();
<add> this.content = new Map();
<add> let identifier = read();
<add> while (identifier !== null) {
<add> this.content.set(identifier, read());
<add> identifier = read();
<add> }
<add> this.lastAccess = read();
<add> this.unserializable = read();
<add> }
<add>}
<add>
<add>makeSerializable(Pack, "webpack/lib/cache/FileCachePlugin", "Pack");
<add>
<add>class FileCachePlugin {
<add> /**
<add> * @param {FileCacheOptions} options options
<add> */
<add> constructor(options) {
<add> this.options = options;
<add> this.missingEntries = new Set();
<add> }
<add>
<add> /**
<add> * @param {Compiler} compiler Webpack compiler
<add> * @returns {void}
<add> */
<add> apply(compiler) {
<add> const cacheDirectory = path.resolve(
<add> this.options.cacheDirectory || "node_modules/.cache/webpack/",
<add> this.options.name || "default"
<add> );
<add> const hashAlgorithm = this.options.hashAlgorithm || "md4";
<add> const version = this.options.version || "";
<add> const log = this.options.loglevel
<add> ? { debug: 4, verbose: 3, info: 2, warning: 1 }[this.options.loglevel]
<add> : 0;
<add> const store = this.options.store || "pack";
<add>
<add> const resolvedPromise = Promise.resolve();
<add>
<add> let pendingPromiseFactories = new Map();
<add> const toHash = str => {
<add> const hash = createHash(hashAlgorithm);
<add> hash.update(str);
<add> const digest = hash.digest("hex");
<add> return `${digest.slice(0, 2)}/${digest.slice(2)}`;
<add> };
<add> let packPromise;
<add> if (store === "pack") {
<add> packPromise = serializer
<add> .deserializeFromFile(`${cacheDirectory}.pack`)
<add> .then(cacheEntry => {
<add> if (cacheEntry) {
<add> if (!(cacheEntry instanceof Pack)) {
<add> if (log >= 3) {
<add> console.warn(
<add> `Restored pack from ${cacheDirectory}.pack, but is not a Pack.`
<add> );
<add> }
<add> return new Pack(version);
<add> }
<add> if (cacheEntry.version !== version) {
<add> if (log >= 3) {
<add> console.warn(
<add> `Restored pack from ${cacheDirectory}.pack, but version doesn't match.`
<add> );
<add> }
<add> return new Pack(version);
<add> }
<add> return cacheEntry;
<add> }
<add> return new Pack(version);
<add> })
<add> .catch(err => {
<add> if (log >= 1 && err && err.code !== "ENOENT") {
<add> console.warn(
<add> `Restoring pack failed from ${cacheDirectory}.pack: ${
<add> log >= 4 ? err.stack : err
<add> }`
<add> );
<add> }
<add> return new Pack(version);
<add> });
<add> }
<add> const storeEntry = (identifier, etag, data) => {
<add> this.missingEntries.delete(identifier);
<add> const entry = {
<add> identifier,
<add> data: etag ? () => data : data,
<add> etag,
<add> version
<add> };
<add> const promiseFactory =
<add> store === "pack"
<add> ? () =>
<add> packPromise.then(pack => {
<add> if (log >= 2) {
<add> console.warn(`Cached ${identifier} to pack.`);
<add> }
<add> pack.set(identifier, entry);
<add> })
<add> : () => {
<add> const relativeFilename = toHash(identifier) + ".data";
<add> const filename = path.join(cacheDirectory, relativeFilename);
<add> return serializer
<add> .serializeToFile(entry, filename)
<add> .then(() => {
<add> if (log >= 2) {
<add> console.warn(`Cached ${identifier} to ${filename}.`);
<add> }
<add> })
<add> .catch(err => {
<add> if (log >= 1) {
<add> console.warn(
<add> `Caching failed for ${identifier}: ${
<add> log >= 3 ? err.stack : err
<add> }`
<add> );
<add> }
<add> });
<add> };
<add> if (store === "instant") {
<add> return promiseFactory();
<add> } else if (store === "idle" || store === "pack") {
<add> pendingPromiseFactories.set(identifier, promiseFactory);
<add> return resolvedPromise;
<add> } else if (store === "background") {
<add> const promise = promiseFactory();
<add> pendingPromiseFactories.set(identifier, () => promise);
<add> return resolvedPromise;
<add> }
<add> };
<add> compiler.cache.hooks.store.tapPromise("FileCachePlugin", storeEntry);
<add> compiler.cache.hooks.got.tapPromise(
<add> "FileCachePlugin",
<add> (identifier, etag, result) => {
<add> if (result !== undefined && this.missingEntries.has(identifier)) {
<add> return storeEntry(identifier, etag, result);
<add> } else {
<add> return resolvedPromise;
<add> }
<add> }
<add> );
<add>
<add> compiler.cache.hooks.get.tapPromise(
<add> "FileCachePlugin",
<add> (identifier, etag) => {
<add> let logMessage;
<add> let cacheEntryPromise;
<add> if (store === "pack") {
<add> logMessage = "pack";
<add> cacheEntryPromise = packPromise.then(pack => pack.get(identifier));
<add> } else {
<add> const relativeFilename = toHash(identifier) + ".data";
<add> const filename = path.join(cacheDirectory, relativeFilename);
<add> logMessage = filename;
<add> cacheEntryPromise = serializer.deserializeFromFile(filename);
<add> }
<add> return cacheEntryPromise.then(
<add> cacheEntry => {
<add> if (cacheEntry === undefined) {
<add> this.missingEntries.add(identifier);
<add> return;
<add> }
<add> if (cacheEntry.identifier !== identifier) {
<add> if (log >= 3) {
<add> console.warn(
<add> `Restored ${identifier} from ${logMessage}, but identifier doesn't match.`
<add> );
<add> }
<add> this.missingEntries.add(identifier);
<add> return;
<add> }
<add> if (cacheEntry.etag !== etag) {
<add> if (log >= 3) {
<add> console.warn(
<add> `Restored ${identifier} from ${logMessage}, but etag doesn't match.`
<add> );
<add> }
<add> this.missingEntries.add(identifier);
<add> return;
<add> }
<add> if (cacheEntry.version !== version) {
<add> if (log >= 3) {
<add> console.warn(
<add> `Restored ${identifier} from ${logMessage}, but version doesn't match.`
<add> );
<add> }
<add> this.missingEntries.add(identifier);
<add> return;
<add> }
<add> if (log >= 3) {
<add> console.warn(`Restored ${identifier} from ${logMessage}.`);
<add> }
<add> if (typeof cacheEntry.data === "function") return cacheEntry.data();
<add> return cacheEntry.data;
<add> },
<add> err => {
<add> this.missingEntries.add(identifier);
<add> if (log >= 1 && err && err.code !== "ENOENT") {
<add> console.warn(
<add> `Restoring failed for ${identifier} from ${logMessage}: ${
<add> log >= 4 ? err.stack : err
<add> }`
<add> );
<add> }
<add> }
<add> );
<add> }
<add> );
<add> const serializePack = () => {
<add> return packPromise.then(pack => {
<add> if (!pack.invalid) return;
<add> if (log >= 3) {
<add> console.warn(`Storing pack...`);
<add> }
<add> pack.collectGarbage(1000 * 60 * 60 * 24 * 2);
<add> // You might think this breaks all access to the existing pack
<add> // which are still referenced, but serializing the pack memorizes
<add> // all data in the pack and makes it no longer need the backing file
<add> // So it's safe to replace the pack file
<add> return serializer
<add> .serializeToFile(pack, `${cacheDirectory}.pack`)
<add> .then(() => {
<add> if (log >= 3) {
<add> console.warn(`Stored pack`);
<add> }
<add> })
<add> .catch(err => {
<add> if (log >= 1) {
<add> console.warn(
<add> `Caching failed for pack: ${log >= 4 ? err.stack : err}`
<add> );
<add> }
<add> return new Pack(version);
<add> });
<add> });
<add> };
<add> compiler.cache.hooks.shutdown.tapPromise("FileCachePlugin", () => {
<add> isIdle = false;
<add> const promises = Array.from(pendingPromiseFactories.values()).map(fn =>
<add> fn()
<add> );
<add> pendingPromiseFactories.clear();
<add> if (currentIdlePromise !== undefined) promises.push(currentIdlePromise);
<add> let promise = Promise.all(promises);
<add> if (store === "pack") {
<add> promise = promise.then(serializePack);
<add> }
<add> return /** @type {any} */ (promise);
<add> });
<add>
<add> let currentIdlePromise;
<add> let isIdle = false;
<add> const processIdleTasks = () => {
<add> if (isIdle) {
<add> if (pendingPromiseFactories.size > 0) {
<add> const promises = [];
<add> const maxTime = Date.now() + 100;
<add> let maxCount = 100;
<add> for (const [filename, factory] of pendingPromiseFactories) {
<add> pendingPromiseFactories.delete(filename);
<add> promises.push(factory());
<add> if (maxCount-- <= 0 || Date.now() > maxTime) break;
<add> }
<add> currentIdlePromise = Promise.all(promises).then(() => {
<add> currentIdlePromise = undefined;
<add> });
<add> currentIdlePromise.then(processIdleTasks);
<add> } else if (store === "pack") {
<add> currentIdlePromise = serializePack();
<add> }
<add> }
<add> };
<add> compiler.cache.hooks.beginIdle.tap("FileCachePlugin", () => {
<add> isIdle = true;
<add> resolvedPromise.then(processIdleTasks);
<add> });
<add> compiler.cache.hooks.endIdle.tap("FileCachePlugin", () => {
<add> isIdle = false;
<add> });
<add> }
<add>}
<add>
<add>module.exports = FileCachePlugin;
<ide><path>lib/stats/DefaultStatsPresetPlugin.js
<ide> class DefaultStatsPresetPlugin {
<ide> apply(compiler) {
<ide> compiler.hooks.compilation.tap("DefaultStatsPresetPlugin", compilation => {
<ide> compilation.hooks.statsPreset
<del> .for(false)
<add> .for("false")
<ide> .tap("DefaultStatsPresetPlugin", (options, context) => {
<ide> applyDefaults(options, NAMED_PRESETS.none);
<ide> });
<ide><path>lib/stats/StatsFactory.js
<ide> const forEachLevelFilter = (hookMap, type, items, fn, forceClone) => {
<ide> class StatsFactory {
<ide> constructor() {
<ide> this.hooks = Object.freeze({
<del> /** @type {HookMap<Object, any, Object>} */
<add> /** @type {HookMap<SyncBailHook<[Object, any, Object]>>} */
<ide> extract: new HookMap(
<ide> () => new SyncBailHook(["object", "data", "context"])
<ide> ),
<del> /** @type {HookMap<any, Object, number, number>} */
<add> /** @type {HookMap<SyncBailHook<[any, Object, number, number]>>} */
<ide> filter: new HookMap(
<ide> () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"])
<ide> ),
<del> /** @type {HookMap<(function(any, any): number)[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[(function(any, any): number)[], Object]>>} */
<ide> sort: new HookMap(() => new SyncBailHook(["comparators", "context"])),
<del> /** @type {HookMap<any, Object, number, number>} */
<add> /** @type {HookMap<SyncBailHook<[any, Object, number, number]>>} */
<ide> filterSorted: new HookMap(
<ide> () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"])
<ide> ),
<del> /** @type {HookMap<(function(any, any): number)[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[(function(any, any): number)[], Object]>>} */
<ide> sortResults: new HookMap(
<ide> () => new SyncBailHook(["comparators", "context"])
<ide> ),
<ide> filterResults: new HookMap(
<ide> () => new SyncBailHook(["item", "context", "index", "unfilteredIndex"])
<ide> ),
<del> /** @type {HookMap<any[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[any[], Object]>>} */
<ide> merge: new HookMap(() => new SyncBailHook(["items", "context"])),
<del> /** @type {HookMap<any[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[any[], Object]>>} */
<ide> result: new HookMap(() => new SyncWaterfallHook(["result", "context"])),
<del> /** @type {HookMap<any, Object>} */
<add> /** @type {HookMap<SyncBailHook<[any, Object]>>} */
<ide> getItemName: new HookMap(() => new SyncBailHook(["item", "context"])),
<del> /** @type {HookMap<any, Object>} */
<add> /** @type {HookMap<SyncBailHook<[any, Object]>>} */
<ide> getItemFactory: new HookMap(() => new SyncBailHook(["item", "context"]))
<ide> });
<ide> }
<ide><path>lib/stats/StatsPrinter.js
<ide> const forEachLevelWaterfall = (hookMap, type, data, fn) => {
<ide> class StatsPrinter {
<ide> constructor() {
<ide> this.hooks = Object.freeze({
<del> /** @type {HookMap<string[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[string[], Object]>>} */
<ide> sortElements: new HookMap(
<ide> () => new SyncBailHook(["elements", "context"])
<ide> ),
<del> /** @type {HookMap<PrintedElement[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[PrintedElement[], Object]>>} */
<ide> printElements: new HookMap(
<ide> () => new SyncBailHook(["printedElements", "context"])
<ide> ),
<del> /** @type {HookMap<any[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[any[], Object]>>} */
<ide> sortItems: new HookMap(() => new SyncBailHook(["items", "context"])),
<del> /** @type {HookMap<any, Object>} */
<add> /** @type {HookMap<SyncBailHook<[any, Object]>>} */
<ide> getItemName: new HookMap(() => new SyncBailHook(["item", "context"])),
<del> /** @type {HookMap<string[], Object>} */
<add> /** @type {HookMap<SyncBailHook<[string[], Object]>>} */
<ide> printItems: new HookMap(
<ide> () => new SyncBailHook(["printedItems", "context"])
<ide> ),
<del> /** @type {HookMap<Object, Object>} */
<add> /** @type {HookMap<SyncBailHook<[Object, Object]>>} */
<ide> print: new HookMap(() => new SyncBailHook(["object", "context"])),
<del> /** @type {HookMap<string, Object>} */
<add> /** @type {HookMap<SyncWaterfallHook<[string, Object]>>} */
<ide> result: new HookMap(() => new SyncWaterfallHook(["result", "context"]))
<ide> });
<ide> } | 6 |
PHP | PHP | update deprecation warnings | 44a2c08b79cad1c3ef9a8324fdeb6200d38697e5 | <ide><path>src/ORM/Locator/LocatorAwareTrait.php
<ide> trait LocatorAwareTrait
<ide> *
<ide> * @param \Cake\ORM\Locator\LocatorInterface|null $tableLocator LocatorInterface instance.
<ide> * @return \Cake\ORM\Locator\LocatorInterface
<del> * @deprecated 3.5.0 Use getter/setter instead.
<add> * @deprecated 3.5.0 Use getTableLocator()/setTableLocator() instead.
<ide> */
<ide> public function tableLocator(LocatorInterface $tableLocator = null)
<ide> {
<ide><path>src/ORM/TableRegistry.php
<ide> class TableRegistry
<ide> *
<ide> * @param \Cake\ORM\Locator\LocatorInterface|null $locator Instance of a locator to use.
<ide> * @return \Cake\ORM\Locator\LocatorInterface
<del> * @deprecated 3.5.0 Use getter/setter instead.
<add> * @deprecated 3.5.0 Use getTableLocator()/setTableLocator() instead.
<ide> */
<ide> public static function locator(LocatorInterface $locator = null)
<ide> { | 2 |
Ruby | Ruby | add mime-info to gnome folders | 6a83404fd537205f0894acce6f9224df765fb25d | <ide><path>Library/Homebrew/keg.rb
<ide> def link mode=OpenStruct.new
<ide> share_mkpaths.concat((1..8).map { |i| "man/man#{i}" })
<ide> share_mkpaths.concat((1..8).map { |i| "man/cat#{i}" })
<ide> # Paths used by Gnome Desktop support
<del> share_mkpaths.concat %w[applications icons pixmaps sounds]
<add> share_mkpaths.concat %w[applications icons mime-info pixmaps sounds]
<ide>
<ide> # yeah indeed, you have to force anything you need in the main tree into
<ide> # these dirs REMEMBER that *NOT* everything needs to be in the main tree | 1 |
Text | Text | add number and range field to form helpers article | b0a3d113a306d6bdec1ed13261ef051d367c7160 | <ide><path>guides/source/form_helpers.md
<ide> make it easier for users to click the inputs.
<ide>
<ide> ### Other Helpers of Interest
<ide>
<del>Other form controls worth mentioning are textareas, password fields, hidden fields, search fields, telephone fields, date fields, time fields, color fields, datetime fields, datetime-local fields, month fields, week fields, URL fields and email fields:
<add>Other form controls worth mentioning are textareas, password fields,
<add>hidden fields, search fields, telephone fields, date fields, time fields,
<add>color fields, datetime fields, datetime-local fields, month fields, week fields,
<add>URL fields, email fields, number fields and range fields:
<ide>
<ide> ```erb
<ide> <%= text_area_tag(:message, "Hi, nice site", size: "24x6") %>
<ide> Other form controls worth mentioning are textareas, password fields, hidden fiel
<ide> <%= email_field(:user, :address) %>
<ide> <%= color_field(:user, :favorite_color) %>
<ide> <%= time_field(:task, :started_at) %>
<add><%= number_field(:product, :price, in: 1.0..20.0, step: 0.5) %>
<add><%= range_field(:product, :discount, in: 1..100) %>
<ide> ```
<ide>
<ide> Output:
<ide> Output:
<ide> <input id="user_address" name="user[address]" type="email" />
<ide> <input id="user_favorite_color" name="user[favorite_color]" type="color" value="#000000" />
<ide> <input id="task_started_at" name="task[started_at]" type="time" />
<add><input id="product_price" max="20.0" min="1.0" name="product[price]" step="0.5" type="number" />
<add><input id="product_discount" max="100" min="1" name="product[discount]" type="range" />
<ide> ```
<ide>
<ide> Hidden inputs are not shown to the user but instead hold data like any textual input. Values inside them can be changed with JavaScript.
<ide>
<del>IMPORTANT: The search, telephone, date, time, color, datetime, datetime-local, month, week, URL, and email inputs are HTML5 controls. If you require your app to have a consistent experience in older browsers, you will need an HTML5 polyfill (provided by CSS and/or JavaScript). There is definitely [no shortage of solutions for this](https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills), although a couple of popular tools at the moment are [Modernizr](http://www.modernizr.com/) and [yepnope](http://yepnopejs.com/), which provide a simple way to add functionality based on the presence of detected HTML5 features.
<add>IMPORTANT: The search, telephone, date, time, color, datetime, datetime-local,
<add>month, week, URL, email, number and range inputs are HTML5 controls.
<add>If you require your app to have a consistent experience in older browsers,
<add>you will need an HTML5 polyfill (provided by CSS and/or JavaScript).
<add>There is definitely [no shortage of solutions for this](https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills), although a couple of popular tools at the moment are
<add>[Modernizr](http://www.modernizr.com/) and [yepnope](http://yepnopejs.com/),
<add>which provide a simple way to add functionality based on the presence of
<add>detected HTML5 features.
<ide>
<ide> TIP: If you're using password input fields (for any purpose), you might want to configure your application to prevent those parameters from being logged. You can learn about this in the [Security Guide](security.html#logging).
<ide> | 1 |
Javascript | Javascript | add typecheck, cleanup | 2dc24fc2343b6120d8b80df9e9e070917cc197d9 | <ide><path>src/core/ReactMount.js
<ide> var ReactMount = {
<ide> * Unmounts and destroys the React component rendered in the `container`.
<ide> *
<ide> * @param {DOMElement} container DOM element containing a React component.
<add> * @return {boolean} True if a component was found in and unmounted from
<add> * `container`
<ide> */
<ide> unmountAndReleaseReactRootNode: function(container) {
<ide> var reactRootID = getReactRootID(container);
<ide> var component = instanceByReactRootID[reactRootID];
<del> if (component) {
<del> component.unmountComponentFromNode(container);
<del> delete instanceByReactRootID[reactRootID];
<del> delete containersByReactRootID[reactRootID];
<del> return true;
<del> } else {
<add> if (!component) {
<ide> return false;
<ide> }
<add> component.unmountComponentFromNode(container);
<add> delete instanceByReactRootID[reactRootID];
<add> delete containersByReactRootID[reactRootID];
<add> return true;
<ide> },
<ide>
<ide> /** | 1 |
Python | Python | use weak-references in promises when possible | b52d44f1a2c916ccfebb0d144589ff74ac0079b7 | <ide><path>celery/result.py
<ide> def __init__(self, id, backend=None,
<ide> self.id = id
<ide> self.backend = backend or self.app.backend
<ide> self.parent = parent
<del> self.on_ready = promise(self._on_fulfilled)
<add> self.on_ready = promise(self._on_fulfilled, weak=True)
<ide> self._cache = None
<ide>
<ide> def then(self, callback, on_error=None, weak=False):
<ide> def get(self, timeout=None, propagate=True, interval=0.5,
<ide> assert_will_not_block()
<ide> _on_interval = promise()
<ide> if follow_parents and propagate and self.parent:
<del> on_interval = promise(self._maybe_reraise_parent_error)
<add> on_interval = promise(self._maybe_reraise_parent_error, weak=True)
<ide> self._maybe_reraise_parent_error()
<ide> if on_interval:
<ide> _on_interval.then(on_interval)
<ide> def __init__(self, results, app=None, ready_barrier=None, **kwargs):
<ide> self.on_ready = promise(args=(self,))
<ide> self._on_full = ready_barrier or barrier(results)
<ide> if self._on_full:
<del> self._on_full.then(promise(self.on_ready))
<add> self._on_full.then(promise(self.on_ready, weak=True))
<ide>
<ide> def add(self, result):
<ide> """Add :class:`AsyncResult` as a new member of the set.
<ide> def __init__(self, id, ret_value, state, traceback=None):
<ide> self._result = ret_value
<ide> self._state = state
<ide> self._traceback = traceback
<del> self.on_ready = promise(args=(self,))
<del> self.on_ready()
<add> self.on_ready = promise()
<add> self.on_ready(self)
<ide>
<ide> def then(self, callback, on_error=None, weak=False):
<ide> return self.on_ready.then(callback, on_error) | 1 |
Javascript | Javascript | improve error handling in beforeloaders hook | 9c648cf90f6ef08e3875b61a29a67a5e6a0980aa | <ide><path>lib/NormalModule.js
<ide> class NormalModule extends Module {
<ide>
<ide> const hooks = NormalModule.getCompilationHooks(compilation);
<ide>
<del> hooks.beforeLoaders.call(this.loaders, this, loaderContext);
<add> try {
<add> hooks.beforeLoaders.call(this.loaders, this, loaderContext);
<add> } catch (err) {
<add> processResult(err);
<add> return;
<add> }
<ide> runLoaders(
<ide> {
<ide> resource: this.resource, | 1 |
PHP | PHP | add exception on parse failure | edcb3dc629a506d3566fa14a174dfe34bf75f1a9 | <ide><path>src/Core/StaticConfigTrait.php
<ide> public static function configured()
<ide> *
<ide> * @param string $dsn The DSN string to convert to a configuration array
<ide> * @return array The configuration array to be stored after parsing the DSN
<del> * @throws \InvalidArgumentException If not passed a string
<add> * @throws \InvalidArgumentException If not passed a string, or passed an invalid string
<ide> */
<ide> public static function parseDsn($dsn)
<ide> {
<ide> public static function parseDsn($dsn)
<ide> preg_match($pattern, $dsn, $parsed);
<ide>
<ide> if (empty($parsed)) {
<del> return false;
<add> throw new InvalidArgumentException("The DSN string '{$dsn}' could not be parsed.");
<ide> }
<ide> foreach ($parsed as $k => $v) {
<ide> if (is_int($k)) {
<ide><path>tests/TestCase/Datasource/ConnectionManagerTest.php
<ide> public function testParseDsn($dsn, $expected)
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide>
<add> /**
<add> * Test parseDsn invalid.
<add> *
<add> * @expectedException InvalidArgumentException
<add> * @expectedExceptionMessage The DSN string 'bagof:nope' could not be parsed.
<add> * @return void
<add> */
<add> public function testParseDsnInvalid()
<add> {
<add> $result = ConnectionManager::parseDsn('bagof:nope');
<add> }
<add>
<ide> /**
<ide> * Tests that directly setting an instance in a config, will not return a different
<ide> * instance later on | 2 |
Ruby | Ruby | include default route for formats | 54bc5ca8d97b7ef8640686e50168ba25d7f23d27 | <ide><path>railties/configs/routes.rb
<ide> # -- just remember to delete public/index.html.
<ide> # map.root :controller => "welcome"
<ide>
<del> # Install the default route as the lowest priority.
<add> # Install the default routes as the lowest priority.
<ide> map.connect ':controller/:action/:id'
<del>end
<add> map.connect ':controller/:action/:id.:format'
<add>end
<ide>\ No newline at end of file | 1 |
Javascript | Javascript | fix module ids of initial require calls | f83c86941149704bdb061a707a77482f14bc7200 | <ide><path>packager/react-packager/src/Bundler/Bundle.js
<ide> class Bundle extends BundleBase {
<ide> const name = 'require-' + moduleId;
<ide> super.addModule(new ModuleTransport({
<ide> name,
<del> id: this._numRequireCalls - 1,
<add> id: -this._numRequireCalls - 1,
<ide> code,
<ide> virtual: true,
<ide> sourceCode: code, | 1 |
PHP | PHP | use assertcount | 60478992946c71cb7067b84b0118cf9c86d49ab1 | <ide><path>tests/Database/DatabaseEloquentIntegrationTest.php
<ide> public function testBelongsToManyRelationshipModelsAreProperlyHydratedOverChunke
<ide> $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
<ide>
<ide> EloquentTestUser::first()->friends()->chunk(2, function ($friends) use ($user, $friend) {
<del> $this->assertEquals(1, count($friends));
<add> $this->assertCount(1, $friends);
<ide> $this->assertEquals('abigailotwell@gmail.com', $friends->first()->email);
<ide> $this->assertEquals($user->id, $friends->first()->pivot->user_id);
<ide> $this->assertEquals($friend->id, $friends->first()->pivot->friend_id);
<ide><path>tests/Database/DatabaseEloquentModelTest.php
<ide> public function testPushEmptyManyRelation()
<ide> $this->assertTrue($model->push());
<ide> $this->assertEquals(1, $model->id);
<ide> $this->assertTrue($model->exists);
<del> $this->assertEquals(0, count($model->relationMany));
<add> $this->assertCount(0, $model->relationMany);
<ide> }
<ide>
<ide> public function testPushManyRelation() | 2 |
Ruby | Ruby | refactor the type casting of booleans in mysql | fbdd58081e3d8a14bef68c824848571c873af21b | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
<ide> def type_cast(value, column)
<ide> case value
<ide> when String, ActiveSupport::Multibyte::Chars
<ide> value.to_s
<del> when true then 't'
<del> when false then 'f'
<add> when true then unquoted_true
<add> when false then unquoted_false
<ide> when nil then nil
<ide> # BigDecimals need to be put in a non-normalized form and quoted.
<ide> when BigDecimal then value.to_s('F')
<ide> def quoted_true
<ide> "'t'"
<ide> end
<ide>
<add> def unquoted_true
<add> 't'
<add> end
<add>
<ide> def quoted_false
<ide> "'f'"
<ide> end
<ide>
<add> def unquoted_false
<add> 'f'
<add> end
<add>
<ide> def quoted_date(value)
<ide> if value.acts_like?(:time)
<ide> zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
<ide> def supports_index_sort_order?
<ide> true
<ide> end
<ide>
<del> def type_cast(value, column)
<del> case value
<del> when TrueClass
<del> 1
<del> when FalseClass
<del> 0
<del> else
<del> super
<del> end
<del> end
<del>
<ide> # MySQL 4 technically support transaction isolation, but it is affected by a bug
<ide> # where the transaction level gets persisted for the whole session:
<ide> #
<ide> def quoted_true
<ide> QUOTED_TRUE
<ide> end
<ide>
<add> def unquoted_true
<add> 1
<add> end
<add>
<ide> def quoted_false
<ide> QUOTED_FALSE
<ide> end
<ide>
<add> def unquoted_false
<add> 0
<add> end
<add>
<ide> # REFERENTIAL INTEGRITY ====================================
<ide>
<ide> def disable_referential_integrity #:nodoc: | 2 |
Text | Text | add quotes to static paths in fallback section | 99eedc4b86b5ab1108bff9734d0fbce93bcd9158 | <ide><path>docs/basic-features/data-fetching.md
<ide> function Post({ post }) {
<ide> export async function getStaticPaths() {
<ide> return {
<ide> // Only `/posts/1` and `/posts/2` are generated at build time
<del> paths: [{ params: { id: 1 } }, { params: { id: 2 } }],
<add> paths: [{ params: { id: '1' } }, { params: { id: '2' } }],
<ide> // Enable statically generating additional pages
<ide> // For example: `/posts/3`
<ide> fallback: true, | 1 |
Go | Go | add info to fatal log | eb0f9f664116ca28d844144929f4b578fe2d1dc8 | <ide><path>integration-cli/docker_cli_run_test.go
<ide> func (s *DockerSuite) TestRunEnvironment(c *check.C) {
<ide> }
<ide> sort.Strings(goodEnv)
<ide> if len(goodEnv) != len(actualEnv) {
<del> c.Fatalf("Wrong environment: should be %d variables, not: %q\n", len(goodEnv), strings.Join(actualEnv, ", "))
<add> c.Fatalf("Wrong environment: should be %d variables, not %d: %q", len(goodEnv), len(actualEnv), strings.Join(actualEnv, ", "))
<ide> }
<ide> for i := range goodEnv {
<ide> if actualEnv[i] != goodEnv[i] {
<ide> func (s *DockerSuite) TestRunEnvironmentErase(c *check.C) {
<ide> }
<ide> sort.Strings(goodEnv)
<ide> if len(goodEnv) != len(actualEnv) {
<del> c.Fatalf("Wrong environment: should be %d variables, not: %q\n", len(goodEnv), strings.Join(actualEnv, ", "))
<add> c.Fatalf("Wrong environment: should be %d variables, not %d: %q", len(goodEnv), len(actualEnv), strings.Join(actualEnv, ", "))
<ide> }
<ide> for i := range goodEnv {
<ide> if actualEnv[i] != goodEnv[i] {
<ide> func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) {
<ide> }
<ide> sort.Strings(goodEnv)
<ide> if len(goodEnv) != len(actualEnv) {
<del> c.Fatalf("Wrong environment: should be %d variables, not: %q\n", len(goodEnv), strings.Join(actualEnv, ", "))
<add> c.Fatalf("Wrong environment: should be %d variables, not %d: %q", len(goodEnv), len(actualEnv), strings.Join(actualEnv, ", "))
<ide> }
<ide> for i := range goodEnv {
<ide> if actualEnv[i] != goodEnv[i] { | 1 |
Go | Go | fix race between container cleanup and inspect/ps | 93d6adf8a19855edf118d27d0239222f572d8292 | <ide><path>daemon/monitor.go
<ide> func (m *containerMonitor) Start() error {
<ide> exitStatus int
<ide> )
<ide>
<add> // this variable indicates that we under container.Lock
<add> underLock := true
<add>
<ide> // ensure that when the monitor finally exits we release the networking and unmount the rootfs
<del> defer m.Close()
<add> defer func() {
<add> if !underLock {
<add> m.container.Lock()
<add> defer m.container.Unlock()
<add> }
<add> m.Close()
<add> }()
<ide>
<ide> // reset the restart count
<ide> m.container.RestartCount = -1
<ide> func (m *containerMonitor) Start() error {
<ide> log.Errorf("Error running container: %s", err)
<ide> }
<ide>
<add> // here container.Lock is already lost
<add> underLock = false
<add>
<ide> m.resetMonitor(err == nil && exitStatus == 0)
<ide>
<ide> if m.shouldRestart(exitStatus) { | 1 |
PHP | PHP | add debuginfo to response for better debugging | 6eb1196ae6fdbd34018876c209b8166d4ca920f0 | <ide><path>src/Network/Response.php
<ide> public function stop($status = 0)
<ide> {
<ide> exit($status);
<ide> }
<add>
<add> /**
<add> * Returns an array that can be used to describe the internal state of this
<add> * object.
<add> *
<add> * @return array
<add> */
<add> public function __debugInfo()
<add> {
<add> return [
<add> 'status' => $this->_status,
<add> 'contentType' => $this->_contentType,
<add> 'headers' => $this->_headers,
<add> 'file' => $this->_file,
<add> 'fileRange' => $this->_fileRange,
<add> 'cookies' => $this->_cookies,
<add> 'cacheDirectives' => $this->_cacheDirectives,
<add> 'body' => $this->_body,
<add> ];
<add> }
<ide> }
<ide><path>tests/TestCase/Network/ResponseTest.php
<ide> public function testLocation()
<ide> $this->assertNull($response->location('http://example.org'), 'Setting a location should return null');
<ide> $this->assertEquals('http://example.org', $response->location(), 'Reading a location should return the value.');
<ide> }
<add>
<add> /**
<add> * Tests __debugInfo
<add> *
<add> * @return void
<add> */
<add> public function testDebugInfo()
<add> {
<add> $response = new Response();
<add> $result = $response->__debugInfo();
<add>
<add> $expected = [
<add> 'status' => (int) 200,
<add> 'contentType' => 'text/html',
<add> 'headers' => [],
<add> 'file' => null,
<add> 'fileRange' => [],
<add> 'cookies' => [],
<add> 'cacheDirectives' => [],
<add> 'body' => null
<add> ];
<add> $this->assertEquals($expected, $result);
<add> }
<ide> } | 2 |
Java | Java | remove unneeded conditional logic | ad6d183a0614adaa0bb1493a9500a4a9b412c1e2 | <ide><path>spring-core/src/main/java/org/springframework/core/convert/support/ConversionUtils.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public static boolean canConvertElements(@Nullable TypeDescriptor sourceElementT
<ide> // yes
<ide> return true;
<ide> }
<del> else if (sourceElementType.getType().isAssignableFrom(targetElementType.getType())) {
<add> if (sourceElementType.getType().isAssignableFrom(targetElementType.getType())) {
<ide> // maybe
<ide> return true;
<ide> }
<del> else {
<del> // no
<del> return false;
<del> }
<add> // no
<add> return false;
<ide> }
<ide>
<ide> public static Class<?> getEnumType(Class<?> targetType) { | 1 |
Go | Go | remove job from resize&execresize | e290a22dc935c2472e08be7362b7d3b0f6303615 | <ide><path>api/server/server.go
<ide> func postContainersResize(eng *engine.Engine, version version.Version, w http.Re
<ide> if vars == nil {
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<del> if err := eng.Job("resize", vars["name"], r.Form.Get("h"), r.Form.Get("w")).Run(); err != nil {
<add>
<add> height, err := strconv.Atoi(r.Form.Get("h"))
<add> if err != nil {
<add> return nil
<add> }
<add> width, err := strconv.Atoi(r.Form.Get("w"))
<add> if err != nil {
<add> return nil
<add> }
<add>
<add> d := getDaemon(eng)
<add> cont, err := d.Get(vars["name"])
<add> if err != nil {
<ide> return err
<ide> }
<add>
<add> if err := cont.Resize(height, width); err != nil {
<add> return err
<add> }
<add>
<ide> return nil
<ide> }
<ide>
<ide> func postContainerExecResize(eng *engine.Engine, version version.Version, w http
<ide> if vars == nil {
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<del> if err := eng.Job("execResize", vars["name"], r.Form.Get("h"), r.Form.Get("w")).Run(); err != nil {
<add>
<add> height, err := strconv.Atoi(r.Form.Get("h"))
<add> if err != nil {
<add> return nil
<add> }
<add> width, err := strconv.Atoi(r.Form.Get("w"))
<add> if err != nil {
<add> return nil
<add> }
<add>
<add> d := getDaemon(eng)
<add> if err := d.ContainerExecResize(vars["name"], height, width); err != nil {
<ide> return err
<ide> }
<add>
<ide> return nil
<ide> }
<ide>
<ide><path>daemon/daemon.go
<ide> func (daemon *Daemon) Install(eng *engine.Engine) error {
<ide> "info": daemon.CmdInfo,
<ide> "kill": daemon.ContainerKill,
<ide> "logs": daemon.ContainerLogs,
<del> "resize": daemon.ContainerResize,
<ide> "restart": daemon.ContainerRestart,
<ide> "start": daemon.ContainerStart,
<ide> "stop": daemon.ContainerStop,
<ide> "top": daemon.ContainerTop,
<ide> "wait": daemon.ContainerWait,
<ide> "execCreate": daemon.ContainerExecCreate,
<ide> "execStart": daemon.ContainerExecStart,
<del> "execResize": daemon.ContainerExecResize,
<ide> "execInspect": daemon.ContainerExecInspect,
<ide> } {
<ide> if err := eng.Register(name, method); err != nil {
<ide><path>daemon/resize.go
<ide> package daemon
<ide>
<del>import (
<del> "fmt"
<del> "strconv"
<del>
<del> "github.com/docker/docker/engine"
<del>)
<del>
<del>func (daemon *Daemon) ContainerResize(job *engine.Job) error {
<del> if len(job.Args) != 3 {
<del> return fmt.Errorf("Not enough arguments. Usage: %s CONTAINER HEIGHT WIDTH\n", job.Name)
<del> }
<del> name := job.Args[0]
<del> height, err := strconv.Atoi(job.Args[1])
<del> if err != nil {
<del> return err
<del> }
<del> width, err := strconv.Atoi(job.Args[2])
<del> if err != nil {
<del> return err
<del> }
<del> container, err := daemon.Get(name)
<del> if err != nil {
<del> return err
<del> }
<del> if err := container.Resize(height, width); err != nil {
<del> return err
<del> }
<del> return nil
<del>}
<del>
<del>func (daemon *Daemon) ContainerExecResize(job *engine.Job) error {
<del> if len(job.Args) != 3 {
<del> return fmt.Errorf("Not enough arguments. Usage: %s EXEC HEIGHT WIDTH\n", job.Name)
<del> }
<del> name := job.Args[0]
<del> height, err := strconv.Atoi(job.Args[1])
<del> if err != nil {
<del> return err
<del> }
<del> width, err := strconv.Atoi(job.Args[2])
<del> if err != nil {
<del> return err
<del> }
<add>func (daemon *Daemon) ContainerExecResize(name string, height, width int) error {
<ide> execConfig, err := daemon.getExecConfig(name)
<ide> if err != nil {
<ide> return err | 3 |
Javascript | Javascript | allow multiple json vulnerability prefixes | fe633dd0cf3d52f84ce73f486bcbd4e1d3058857 | <ide><path>src/service/http.js
<ide> function $HttpProvider() {
<ide> // transform in-coming reponse data
<ide> transformResponse: function(data) {
<ide> if (isString(data)) {
<del> if (/^\)\]\}',\n/.test(data)) data = data.substr(6);
<add> // strip json vulnerability protection prefix
<add> data = data.replace(/^\)\]\}',?\n/, '');
<ide> if (/^\s*[\[\{]/.test(data) && /[\}\]]\s*$/.test(data))
<ide> data = fromJson(data, true);
<ide> }
<ide><path>test/service/httpSpec.js
<ide> describe('$http', function() {
<ide> expect(callback).toHaveBeenCalledOnce();
<ide> expect(callback.mostRecentCall.args[0]).toEqual([1, 'abc', {foo:'bar'}]);
<ide> });
<add>
<add>
<add> it('should deserialize json with security prefix ")]}\'"', function() {
<add> $httpBackend.expect('GET', '/url').respond(')]}\'\n\n[1, "abc", {"foo":"bar"}]');
<add> $http({method: 'GET', url: '/url'}).on('200', callback);
<add> $httpBackend.flush();
<add>
<add> expect(callback).toHaveBeenCalledOnce();
<add> expect(callback.mostRecentCall.args[0]).toEqual([1, 'abc', {foo:'bar'}]);
<add> });
<ide> });
<ide>
<ide> | 2 |
Text | Text | update restart description | c32ec8b93b199168425f29cab040d9d8cc23566f | <ide><path>docs/reference/run.md
<ide> Or, to get the last time the container was (re)started;
<ide> $ docker inspect -f "{{ .State.StartedAt }}" my-container
<ide> # 2015-03-04T23:47:07.691840179Z
<ide>
<del>You cannot set any restart policy in combination with
<del>["clean up (--rm)"](#clean-up-rm). Setting both `--restart` and `--rm`
<del>results in an error.
<add>
<add>Combining `--restart` (restart policy) with the `--rm` (clean up) flag results
<add>in an error. On container restart, attached clients are disconnected. See the
<add>examples on using the [`--rm` (clean up)](#clean-up-rm) flag later in this page.
<ide>
<ide> ### Examples
<ide> | 1 |
Java | Java | add tests to demonstrate bugs | fb22a73a7df3ccada20d3f2e7b0da2db806bcb2e | <ide><path>rxjava-core/src/main/java/rx/operators/OperationTake.java
<ide> public void testTake2() {
<ide> verify(aObserver, times(1)).onCompleted();
<ide> }
<ide>
<add> @Test
<add> public void testTakeDoesntLeakErrors() {
<add> Observable<String> source = Observable.concat(Observable.from("one"), Observable.<String>error(new Exception("test failed")));
<add> Observable.create(take(source, 1)).last();
<add> }
<add>
<add> @Test
<add> public void testTakeZeroDoesntLeakError() {
<add> Observable<String> source = Observable.<String>error(new Exception("test failed"));
<add> Observable.create(take(source, 0)).lastOrDefault("ok");
<add> }
<add>
<ide> @Test
<ide> public void testUnsubscribeAfterTake() {
<ide> Subscription s = mock(Subscription.class); | 1 |
PHP | PHP | add tests for configuring cookie creation | b9113aa5cde8de9cb08eb376990c06d75bd0a75f | <ide><path>Cake/Controller/Component/CsrfComponent.php
<ide> class CsrfComponent extends Component {
<ide> * the request is a GET request, and the cookie value
<ide> * is absent a cookie will be set.
<ide> *
<add> * RequestAction requests do not get checked, nor will
<add> * they set a cookie should it be missing.
<add> *
<ide> * @param Cake\Event\Event $event
<ide> * @return void
<ide> */
<ide> public function startup(Event $event) {
<ide> $response = $controller->response;
<ide> $cookieName = $this->settings['cookieName'];
<ide>
<add> if ($request->is('requested')) {
<add> return;
<add> }
<add>
<ide> if ($request->is('get') && $request->cookie($cookieName) === null) {
<ide> $this->_setCookie($request, $response);
<ide> }
<ide><path>Cake/Test/TestCase/Controller/Component/CsrfComponentTest.php
<ide> public function testInvalidTokenRequestData($method) {
<ide> $this->component->startUp($event);
<ide> }
<ide>
<add>/**
<add> * Test that CSRF checks are not applied to request action requests.
<add> *
<add> * @return void
<add> */
<add> public function testCsrfValidationSkipsRequestAction() {
<add> $_SERVER['REQUEST_METHOD'] = 'POST';
<add>
<add> $controller = $this->getMock('Cake\Controller\Controller');
<add> $controller->request = new Request([
<add> 'params' => ['requested' => 1],
<add> 'post' => ['_csrfToken' => 'nope'],
<add> 'cookies' => ['csrfToken' => 'testing123']
<add> ]);
<add> $controller->response = new Response();
<add>
<add> $event = new Event('Controller.startup', $controller);
<add> $result = $this->component->startUp($event);
<add> $this->assertNull($result, 'No error.');
<add> }
<add>
<add>/**
<add> * Test that the configuration options work.
<add> *
<add> * @return void
<add> */
<add> public function testConfigurationCookieCreate() {
<add> $_SERVER['REQUEST_METHOD'] = 'GET';
<add>
<add> $controller = $this->getMock('Cake\Controller\Controller');
<add> $controller->request = new Request(['base' => '/dir']);
<add> $controller->response = new Response();
<add>
<add> $component = new CsrfComponent($this->registry, [
<add> 'cookieName' => 'token',
<add> 'expiry' => 90,
<add> ]);
<add>
<add> $event = new Event('Controller.startup', $controller);
<add> $component->startUp($event);
<add>
<add> $this->assertEmpty($controller->response->cookie('csrfToken'));
<add> $cookie = $controller->response->cookie('token');
<add> $this->assertNotEmpty($cookie, 'Should set a token.');
<add> $this->assertRegExp('/^[a-f0-9]+$/', $cookie['value'], 'Should look like a hash.');
<add> $this->assertEquals(90, $cookie['expiry'], 'session duration.');
<add> $this->assertEquals('/dir', $cookie['path'], 'session path.');
<add> }
<add>
<add>/**
<add> * Test that the configuration options work.
<add> *
<add> * @return void
<add> */
<add> public function testConfigurationValidate() {
<add> $_SERVER['REQUEST_METHOD'] = 'POST';
<add>
<add> $controller = $this->getMock('Cake\Controller\Controller');
<add> $controller->request = new Request([
<add> 'cookies' => ['csrfToken' => 'nope', 'token' => 'yes'],
<add> 'post' => ['_csrfToken' => 'no match', 'token' => 'yes'],
<add> ]);
<add> $controller->response = new Response();
<add>
<add> $component = new CsrfComponent($this->registry, [
<add> 'cookieName' => 'token',
<add> 'field' => 'token',
<add> 'expiry' => 90,
<add> ]);
<add>
<add> $event = new Event('Controller.startup', $controller);
<add> $result = $component->startUp($event);
<add> $this->assertNull($result, 'Config settings should work.');
<add> }
<add>
<ide> } | 2 |
Mixed | Javascript | add trace-events for time and count | 9c82a1e7ba8d5ce7e743f99348cf992965594f0a | <ide><path>doc/api/tracing.md
<ide> The available categories are:
<ide> The [`async_hooks`] events have a unique `asyncId` and a special `triggerId`
<ide> `triggerAsyncId` property.
<ide> * `node.bootstrap` - Enables capture of Node.js bootstrap milestones.
<add>* `node.console` - Enables capture of `console.time()` and `console.count()`
<add> output.
<ide> * `node.environment` - Enables capture of Node.js Environment milestones.
<ide> * `node.fs.sync` - Enables capture of trace data for file system sync methods.
<ide> * `node.perf` - Enables capture of [Performance API] measurements.
<ide><path>lib/console.js
<ide>
<ide> 'use strict';
<ide>
<add>const { trace } = internalBinding('trace_events');
<ide> const {
<ide> isStackOverflowError,
<ide> codes: {
<ide> const {
<ide> } = util.types;
<ide> const kCounts = Symbol('counts');
<ide>
<add>const kTraceConsoleCategory = 'node,node.console';
<add>const kTraceCount = 'C'.charCodeAt(0);
<add>const kTraceBegin = 'b'.charCodeAt(0);
<add>const kTraceEnd = 'e'.charCodeAt(0);
<add>const kTraceInstant = 'n'.charCodeAt(0);
<add>
<ide> const {
<ide> keys: ObjectKeys,
<ide> values: ObjectValues,
<ide> Console.prototype.time = function time(label = 'default') {
<ide> process.emitWarning(`Label '${label}' already exists for console.time()`);
<ide> return;
<ide> }
<add> trace(kTraceBegin, kTraceConsoleCategory, `time::${label}`, 0);
<ide> this._times.set(label, process.hrtime());
<ide> };
<ide>
<ide> Console.prototype.timeEnd = function timeEnd(label = 'default') {
<ide> // Coerces everything other than Symbol to a string
<ide> label = `${label}`;
<ide> const hasWarned = timeLogImpl(this, 'timeEnd', label);
<add> trace(kTraceEnd, kTraceConsoleCategory, `time::${label}`, 0);
<ide> if (!hasWarned) {
<ide> this._times.delete(label);
<ide> }
<ide> Console.prototype.timeLog = function timeLog(label, ...data) {
<ide> // Coerces everything other than Symbol to a string
<ide> label = `${label}`;
<ide> timeLogImpl(this, 'timeLog', label, data);
<add> trace(kTraceInstant, kTraceConsoleCategory, `time::${label}`, 0);
<ide> };
<ide>
<ide> // Returns true if label was not found
<ide> Console.prototype.count = function count(label = 'default') {
<ide> else
<ide> count++;
<ide> counts.set(label, count);
<add> trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, count);
<ide> this.log(`${label}: ${count}`);
<ide> };
<ide>
<ide> Console.prototype.countReset = function countReset(label = 'default') {
<ide> process.emitWarning(`Count for '${label}' does not exist`);
<ide> return;
<ide> }
<del>
<add> trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, 0);
<ide> counts.delete(`${label}`);
<ide> };
<ide>
<ide><path>test/parallel/test-trace-events-console.js
<add>'use strict';
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const cp = require('child_process');
<add>const path = require('path');
<add>const fs = require('fs');
<add>const tmpdir = require('../common/tmpdir');
<add>
<add>// Tests that node.console trace events for counters and time methods are
<add>// emitted as expected.
<add>
<add>const names = [
<add> 'time::foo',
<add> 'count::bar'
<add>];
<add>const expectedCounts = [ 1, 2, 0 ];
<add>const expectedTimeTypes = [ 'b', 'n', 'e' ];
<add>
<add>if (process.argv[2] === 'child') {
<add> // The following console outputs exercise the test, causing node.console
<add> // trace events to be emitted for the counter and time calls.
<add> console.count('bar');
<add> console.count('bar');
<add> console.countReset('bar');
<add> console.time('foo');
<add> setImmediate(() => {
<add> console.timeLog('foo');
<add> setImmediate(() => {
<add> console.timeEnd('foo');
<add> });
<add> });
<add>} else {
<add> tmpdir.refresh();
<add>
<add> const proc = cp.fork(__filename,
<add> [ 'child' ], {
<add> cwd: tmpdir.path,
<add> execArgv: [
<add> '--trace-event-categories',
<add> 'node.console'
<add> ]
<add> });
<add>
<add> proc.once('exit', common.mustCall(async () => {
<add> const file = path.join(tmpdir.path, 'node_trace.1.log');
<add>
<add> assert(fs.existsSync(file));
<add> const data = await fs.promises.readFile(file, { encoding: 'utf8' });
<add> JSON.parse(data).traceEvents
<add> .filter((trace) => trace.cat !== '__metadata')
<add> .forEach((trace) => {
<add> assert.strictEqual(trace.pid, proc.pid);
<add> assert(names.includes(trace.name));
<add> if (trace.name === 'count::bar')
<add> assert.strictEqual(trace.args.data, expectedCounts.shift());
<add> else if (trace.name === 'time::foo')
<add> assert.strictEqual(trace.ph, expectedTimeTypes.shift());
<add> });
<add> assert.strictEqual(expectedCounts.length, 0);
<add> assert.strictEqual(expectedTimeTypes.length, 0);
<add> }));
<add>} | 3 |
PHP | PHP | add dashedroute class | 3bfa4ca2177af7e3fda3a7e104dbfe0f33a48d4e | <ide><path>src/Routing/Route/DashedRoute.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.0.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Routing\Route;
<add>
<add>use Cake\Routing\Route\Route;
<add>use Cake\Utility\Inflector;
<add>
<add>/**
<add> * This route class will transparently inflect the controller, action and plugin
<add> * routing parameters, so that requesting `/my-plugin/my-controller/my-action`
<add> * is parsed as `['plugin' => 'MyPlugin', 'controller' => 'MyController', 'action' => 'myAction']`
<add> */
<add>class DashedRoute extends Route {
<add>
<add>/**
<add> * Flag for tracking whether or not the defaults have been inflected.
<add> *
<add> * Default values need to be inflected so that they match the inflections that
<add> * match() will create.
<add> *
<add> * @var bool
<add> */
<add> protected $_inflectedDefaults = false;
<add>
<add>/**
<add> * Parses a string URL into an array. If it mathes, it will convert the
<add> * controller, action and plugin keys to their camelized form.
<add> *
<add> * @param string $url The URL to parse
<add> * @return mixed false on failure, or an array of request parameters
<add> */
<add> public function parse($url) {
<add> $params = parent::parse($url);
<add> if (!$params) {
<add> return false;
<add> }
<add> if (!empty($params['controller'])) {
<add> $params['controller'] = Inflector::camelize(str_replace(
<add> '-',
<add> '_',
<add> $params['controller']
<add> ));
<add> }
<add> if (!empty($params['plugin'])) {
<add> $params['plugin'] = Inflector::camelize(str_replace(
<add> '-',
<add> '_',
<add> $params['plugin']
<add> ));
<add> }
<add> if (!empty($params['action'])) {
<add> $params['action'] = Inflector::variable(str_replace(
<add> '-',
<add> '_',
<add> $params['action']
<add> ));
<add> }
<add> return $params;
<add> }
<add>
<add>/**
<add> * Dasherizes the controller, action and plugin params before passing them on
<add> * to the parent class.
<add> *
<add> * @param array $url Array of parameters to convert to a string.
<add> * @param array $context An array of the current request context.
<add> * Contains information such as the current host, scheme, port, and base
<add> * directory.
<add> * @return mixed either false or a string URL.
<add> */
<add> public function match(array $url, array $context = array()) {
<add> $url = $this->_dasherize($url);
<add> if (!$this->_inflectedDefaults) {
<add> $this->_inflectedDefaults = true;
<add> $this->defaults = $this->_dasherize($this->defaults);
<add> }
<add> return parent::match($url, $context);
<add> }
<add>
<add>/**
<add> * Helper method for dasherizing keys in a URL array.
<add> *
<add> * @param array $url An array of URL keys.
<add> * @return array
<add> */
<add> protected function _dasherize($url) {
<add> foreach (['controller', 'plugin', 'action'] as $element) {
<add> if (!empty($url[$element])) {
<add> $url[$element] = Inflector::dasherize($url[$element]);
<add> }
<add> }
<add> return $url;
<add> }
<add>
<add>}
<ide><path>tests/TestCase/Routing/Route/DashedRouteTest.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 3.0.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\Routing\Route;
<add>
<add>use Cake\Core\App;
<add>use Cake\Routing\Router;
<add>use Cake\Routing\Route\DashedRoute;
<add>use Cake\TestSuite\TestCase;
<add>
<add>/**
<add> * Test case for DashedRoute
<add> */
<add>class DashedRouteTest extends TestCase {
<add>
<add>/**
<add> * test that routes match their pattern.
<add> *
<add> * @return void
<add> */
<add> public function testMatchBasic() {
<add> $route = new DashedRoute('/:controller/:action/:id', ['plugin' => null]);
<add> $result = $route->match(['controller' => 'Posts', 'action' => 'myView', 'plugin' => null]);
<add> $this->assertFalse($result);
<add>
<add> $result = $route->match([
<add> 'plugin' => null,
<add> 'controller' => 'Posts',
<add> 'action' => 'myView',
<add> 0
<add> ]);
<add> $this->assertFalse($result);
<add>
<add> $result = $route->match([
<add> 'plugin' => null,
<add> 'controller' => 'MyPosts',
<add> 'action' => 'myView',
<add> 'id' => 1
<add> ]);
<add> $this->assertEquals('/my-posts/my-view/1', $result);
<add>
<add> $route = new DashedRoute('/', ['controller' => 'Pages', 'action' => 'myDisplay', 'home']);
<add> $result = $route->match(['controller' => 'Pages', 'action' => 'myDisplay', 'home']);
<add> $this->assertEquals('/', $result);
<add>
<add> $result = $route->match(['controller' => 'Pages', 'action' => 'display', 'about']);
<add> $this->assertFalse($result);
<add>
<add> $route = new DashedRoute('/blog/:action', ['controller' => 'Posts']);
<add> $result = $route->match(['controller' => 'Posts', 'action' => 'myView']);
<add> $this->assertEquals('/blog/my-view', $result);
<add>
<add> $result = $route->match(['controller' => 'Posts', 'action' => 'myView', 'id' => 2]);
<add> $this->assertEquals('/blog/my-view?id=2', $result);
<add>
<add> $result = $route->match(['controller' => 'Posts', 'action' => 'myView', 1]);
<add> $this->assertFalse($result);
<add>
<add> $route = new DashedRoute('/foo/:controller/:action', ['action' => 'index']);
<add> $result = $route->match(['controller' => 'Posts', 'action' => 'myView']);
<add> $this->assertEquals('/foo/posts/my-view', $result);
<add>
<add> $route = new DashedRoute('/:plugin/:id/*', ['controller' => 'Posts', 'action' => 'myView']);
<add> $result = $route->match([
<add> 'plugin' => 'TestPlugin',
<add> 'controller' => 'Posts',
<add> 'action' => 'myView',
<add> 'id' => '1'
<add> ]);
<add> $this->assertEquals('/test-plugin/1/', $result);
<add>
<add> $result = $route->match([
<add> 'plugin' => 'TestPlugin',
<add> 'controller' => 'Posts',
<add> 'action' => 'myView',
<add> 'id' => '1',
<add> '0'
<add> ]);
<add> $this->assertEquals('/test-plugin/1/0', $result);
<add>
<add> $result = $route->match([
<add> 'plugin' => 'TestPlugin',
<add> 'controller' => 'Nodes',
<add> 'action' => 'myView',
<add> 'id' => 1
<add> ]);
<add> $this->assertFalse($result);
<add>
<add> $result = $route->match([
<add> 'plugin' => 'TestPlugin',
<add> 'controller' => 'Posts',
<add> 'action' => 'edit',
<add> 'id' => 1
<add> ]);
<add> $this->assertFalse($result);
<add>
<add> $route = new DashedRoute('/admin/subscriptions/:action/*', [
<add> 'controller' => 'Subscribe', 'prefix' => 'admin'
<add> ]);
<add> $result = $route->match([
<add> 'controller' => 'Subscribe',
<add> 'prefix' => 'admin',
<add> 'action' => 'editAdminE',
<add> 1
<add> ]);
<add> $expected = '/admin/subscriptions/edit-admin-e/1';
<add> $this->assertEquals($expected, $result);
<add> }
<add>
<add>/**
<add> * test the parse method of DashedRoute.
<add> *
<add> * @return void
<add> */
<add> public function testParse() {
<add> $route = new DashedRoute(
<add> '/:controller/:action/:id',
<add> ['controller' => 'Testing4', 'id' => null],
<add> ['id' => Router::ID]
<add> );
<add> $route->compile();
<add> $result = $route->parse('/my-posts/my-view/1');
<add> $this->assertEquals('MyPosts', $result['controller']);
<add> $this->assertEquals('myView', $result['action']);
<add> $this->assertEquals('1', $result['id']);
<add>
<add> $route = new DashedRoute(
<add> '/admin/:controller',
<add> ['prefix' => 'admin', 'admin' => 1, 'action' => 'index']
<add> );
<add> $route->compile();
<add> $result = $route->parse('/admin/');
<add> $this->assertFalse($result);
<add>
<add> $result = $route->parse('/admin/my-posts');
<add> $this->assertEquals('MyPosts', $result['controller']);
<add> $this->assertEquals('index', $result['action']);
<add>
<add> $route = new DashedRoute(
<add> '/media/search/*',
<add> ['controller' => 'Media', 'action' => 'searchIt']
<add> );
<add> $result = $route->parse('/media/search');
<add> $this->assertEquals('Media', $result['controller']);
<add> $this->assertEquals('searchIt', $result['action']);
<add> $this->assertEquals([], $result['pass']);
<add>
<add> $result = $route->parse('/media/search/tv_shows');
<add> $this->assertEquals('Media', $result['controller']);
<add> $this->assertEquals('searchIt', $result['action']);
<add> $this->assertEquals(['tv_shows'], $result['pass']);
<add> }
<add>
<add>} | 2 |
Python | Python | fix typo in variable name | 6aa659951a63d7c491f1a06aea0605ea30ec699f | <ide><path>numpy/core/numeric.py
<ide> def binary_repr(num, width=None):
<ide> '11101'
<ide>
<ide> """
<del> def warn_if_insufficient(width, binwdith):
<add> def warn_if_insufficient(width, binwidth):
<ide> if width is not None and width < binwidth:
<ide> warnings.warn(
<ide> "Insufficient bit width provided. This behavior " | 1 |
Ruby | Ruby | fix another race condition | 30b0e5848c5a91c0bfd1ef33ec4b9bc36bcead0b | <ide><path>activerecord/lib/active_record/attribute_methods.rb
<ide> require 'active_support/core_ext/enumerable'
<ide> require 'active_support/deprecation'
<del>require 'thread'
<ide>
<ide> module ActiveRecord
<ide> # = Active Record Attribute Methods
<ide> module ClassMethods
<ide> def define_attribute_methods
<ide> # Use a mutex; we don't want two thread simaltaneously trying to define
<ide> # attribute methods.
<del> @attribute_methods_mutex ||= Mutex.new
<del>
<ide> @attribute_methods_mutex.synchronize do
<ide> return if attribute_methods_generated?
<ide> superclass.define_attribute_methods unless self == base_class
<ide><path>activerecord/lib/active_record/core.rb
<ide> require 'active_support/concern'
<add>require 'thread'
<ide>
<ide> module ActiveRecord
<ide> module Core
<ide> def inherited(child_class) #:nodoc:
<ide> end
<ide>
<ide> def initialize_generated_modules
<add> @attribute_methods_mutex = Mutex.new
<add>
<ide> # force attribute methods to be higher in inheritance hierarchy than other generated methods
<ide> generated_attribute_methods
<ide> generated_feature_methods
<ide><path>activerecord/test/cases/attribute_methods/read_test.rb
<ide> require "cases/helper"
<ide> require 'active_support/core_ext/object/inclusion'
<add>require 'thread'
<ide>
<ide> module ActiveRecord
<ide> module AttributeMethods
<ide> def self.base_class; self; end
<ide>
<ide> include ActiveRecord::AttributeMethods
<ide>
<add> def self.define_attribute_methods
<add> # Created in the inherited/included hook for "proper" ARs
<add> @attribute_methods_mutex ||= Mutex.new
<add>
<add> super
<add> end
<add>
<ide> def self.column_names
<ide> %w{ one two three }
<ide> end | 3 |
Go | Go | introduce failing test case for | 4cbb6ce13bf93df2a9e251dfa87fbce9952ab8a6 | <ide><path>container_test.go
<ide> func TestMultipleVolumesFrom(t *testing.T) {
<ide> t.Fail()
<ide> }
<ide> }
<add>
<add>func TestRestartGhost(t *testing.T) {
<add> runtime := mkRuntime(t)
<add> defer nuke(runtime)
<add>
<add> container, err := runtime.Create(&Config{
<add> Image: GetTestImage(runtime).ID,
<add> Cmd: []string{"sh", "-c", "echo -n bar > /test/foo"},
<add> Volumes: map[string]struct{}{"/test": {}},
<add> },
<add> )
<add>
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> if err := container.Kill(); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> container.State.Ghost = true
<add> _, err = container.Output()
<add>
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>}
<ide>\ No newline at end of file | 1 |
Ruby | Ruby | remove requirement that query ends with comments | 990af3d203fd573e55140a84fc48ee1a06db5587 | <ide><path>activerecord/test/cases/query_logs_test.rb
<ide> def test_empty_comments_are_not_added
<ide> def test_custom_basic_tags
<ide> ActiveRecord::QueryLogs.tags = [ :application, { custom_string: "test content" } ]
<ide>
<del> assert_sql(%r{/\*application:active_record,custom_string:test content\*/$}) do
<add> assert_sql(%r{/\*application:active_record,custom_string:test content\*/}) do
<ide> Dashboard.first
<ide> end
<ide> end
<ide>
<ide> def test_custom_proc_tags
<ide> ActiveRecord::QueryLogs.tags = [ :application, { custom_proc: -> { "test content" } } ]
<ide>
<del> assert_sql(%r{/\*application:active_record,custom_proc:test content\*/$}) do
<add> assert_sql(%r{/\*application:active_record,custom_proc:test content\*/}) do
<ide> Dashboard.first
<ide> end
<ide> end
<ide> def test_multiple_custom_tags
<ide> { custom_proc: -> { "test content" }, another_proc: -> { "more test content" } },
<ide> ]
<ide>
<del> assert_sql(%r{/\*application:active_record,custom_proc:test content,another_proc:more test content\*/$}) do
<add> assert_sql(%r{/\*application:active_record,custom_proc:test content,another_proc:more test content\*/}) do
<ide> Dashboard.first
<ide> end
<ide> end
<ide> def test_custom_proc_context_tags
<ide> ActiveSupport::ExecutionContext[:foo] = "bar"
<ide> ActiveRecord::QueryLogs.tags = [ :application, { custom_context_proc: ->(context) { context[:foo] } } ]
<ide>
<del> assert_sql(%r{/\*application:active_record,custom_context_proc:bar\*/$}) do
<add> assert_sql(%r{/\*application:active_record,custom_context_proc:bar\*/}) do
<ide> Dashboard.first
<ide> end
<ide> end | 1 |
Python | Python | fix warningc context tests, uncover bug? | e8dda96dd2a50d2e23134d924cbcabd545af54a1 | <ide><path>numpy/testing/tests/test_utils.py
<ide> def test_clear_and_catch_warnings():
<ide> warnings.simplefilter('ignore')
<ide> warnings.warn('Some warning')
<ide> assert_equal(my_mod.__warningregistry__, {})
<del> # Without specified modules, don't clear warnings during context
<add> # Without specified modules, don't clear warnings during context.
<add> # catch_warnings doesn't make an entry for 'ignore'.
<ide> with clear_and_catch_warnings():
<ide> warnings.simplefilter('ignore')
<ide> warnings.warn('Some warning')
<del> assert_warn_len_equal(my_mod, 1)
<add> assert_warn_len_equal(my_mod, 0)
<add>
<add> # Manually adding two warnings to the registry:
<add> my_mod.__warningregistry__ = {'warning1': 1,
<add> 'warning2': 2}
<add>
<ide> # Confirm that specifying module keeps old warning, does not add new
<ide> with clear_and_catch_warnings(modules=[my_mod]):
<ide> warnings.simplefilter('ignore')
<ide> warnings.warn('Another warning')
<del> assert_warn_len_equal(my_mod, 1)
<del> # Another warning, no module spec does add to warnings dict, except on
<add> assert_warn_len_equal(my_mod, 2)
<add> # Another warning, no module spec does add to warnings dict
<ide> with clear_and_catch_warnings():
<ide> warnings.simplefilter('ignore')
<ide> warnings.warn('Another warning')
<ide> def warn(arr):
<ide> warnings.warn('Some warning')
<ide> assert_warn_len_equal(my_mod, 0)
<ide>
<add> # Manually adding two warnings to the registry:
<add> my_mod.__warningregistry__ = {'warning1': 1,
<add> 'warning2': 2}
<add>
<ide> # Without specified modules, don't clear warnings during context
<ide> with suppress_warnings():
<ide> warnings.simplefilter('ignore')
<ide> warnings.warn('Some warning')
<del> assert_warn_len_equal(my_mod, 1)
<add> assert_warn_len_equal(my_mod, 2)
<ide>
<ide>
<ide> def test_suppress_warnings_type():
<ide> def test_suppress_warnings_type():
<ide> warnings.warn('Some warning')
<ide> assert_warn_len_equal(my_mod, 0)
<ide>
<add> # Manually adding two warnings to the registry:
<add> my_mod.__warningregistry__ = {'warning1': 1,
<add> 'warning2': 2}
<add>
<ide> # Without specified modules, don't clear warnings during context
<ide> with suppress_warnings():
<ide> warnings.simplefilter('ignore')
<ide> warnings.warn('Some warning')
<del> assert_warn_len_equal(my_mod, 1)
<add> assert_warn_len_equal(my_mod, 2)
<ide>
<ide>
<ide> def test_suppress_warnings_decorate_no_record(): | 1 |
Text | Text | address maintainer feedback | 9d8b101ede241df5973b1d4ec5290a7fbc0d56dc | <ide><path>docs/Maintainer-Guidelines.md
<ide> is a good opportunity to do it) provided the line itself has some kind
<ide> of modification that is not whitespace in it. But be careful about
<ide> making changes to inline patches—make sure they still apply.
<ide>
<del>### Adding formulae
<del>Only one maintainer is necessary to approve and merge the addition of a new formula which passes CI. However, if the formula addition
<del>is controversial the maintainer who adds it will be expected to fix issues that arise with it in future.
<add>### Adding or update formulae
<add>Only one maintainer is necessary to approve and merge the addition of a new or updated formula which passes CI. However, if the formula addition or update is controversial the maintainer who adds it will be expected to fix issues that arise with it in future.
<ide>
<ide> ### Removing formulae
<ide> Formulae that:
<ide> Formulae that:
<ide> should not be removed from Homebrew. The exception to this rule are [versioned formulae](Versions.md) for which there are higher standards of usage and a maximum number of versions for a given formula.
<ide>
<ide> ### Closing issues/PRs
<del>Maintainers (including the lead maintainer) should not close issues or pull requests opened by other maintainers unless they are stale (i.e. have seen no updates for 28 days) in which case they can be closed by any maintainer. If the close is undesirable: no big deal, they can be reopened when additional work will be done.
<add>Maintainers (including the lead maintainer) should not close issues or pull requests opened by other maintainers unless they are stale (i.e. have seen no updates for 28 days) in which case they can be closed by any maintainer. Any maintainer is encouraged to reopen a closed issue when they wish to do additional work on the issue.
<ide>
<del>Any maintainer can merge any PR passing CI that has been opened by any other maintainer. If you do not wish to have other maintainers merge your PRs: please use the `do not merge` label to indicate that until you're ready to merge it yourself.
<add>Any maintainer can merge any PR they have carefully reviewed and is passing CI that has been opened by any other maintainer. If you do not wish to have other maintainers merge your PRs: please use the `do not merge` label to indicate that until you're ready to merge it yourself.
<ide>
<ide> ## Reverting PRs
<del>Any maintainer can revert a PR created by another maintainer after a user submitted issue or CI failure that results. The maintainer who created the original PR should be given an hour to fix the issue themselves or decide to revert the PR themselves if they would rather.
<add>Any maintainer can revert a PR created by another maintainer after a user submitted issue or CI failure that results. The maintainer who created the original PR should be given no less than an hour to fix the issue themselves or decide to revert the PR themselves if they would rather.
<ide>
<ide> ## Communication
<ide> Maintainers have a variety of ways to communicate with each other:
<ide> This makes it easier for other maintainers, contributors and users to follow alo
<ide>
<ide> All maintainers (and lead maintainer) communication through any medium is bound by [Homebrew's Code of Conduct](CODE_OF_CONDUCT.md#code-of-conduct). Abusive behaviour towards other maintainers, contributors or users will not be tolerated; the maintainer will be given a warning and if their behaviour continues they will be removed as a maintainer.
<ide>
<del>Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden.
<add>Maintainers should feel free to pleasantly disagree with the work and decisions of other maintainers. Healthy, friendly, technical disagreement between maintainers is actively encouraged and should occur in public on the issue tracker to make the project better. Interpersonal issues should be handled privately in Slack, ideally with moderation. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. No maintainer may ever justify a decision with e.g. "because I say so" or "it was I who did X" alone. Off-topic discussions on the issue tracker, [bike-shedding](https://en.wikipedia.org/wiki/Law_of_triviality) and personal attacks are forbidden.
<ide>
<ide> ## Lead maintainer guidelines
<ide> There should be one lead maintainer for Homebrew. Decisions are determined by a consensus of the maintainers. When a consensus is not reached, the lead maintainer has the final say in determining the outcome of any decision (though this power should be used sparingly). They should also be seen as the product manager for Homebrew itself and ensuring that changes made to the entire Homebrew ecosystem are consistent and providing an increasingly positive experience for Homebrew's users.
<ide> In the same way that Homebrew maintainers are expected to be spending more of th
<ide>
<ide> Individual Homebrew repositories should not have formal lead maintainers (although those who do the most work will have the loudest voices).
<ide>
<del>Maintainers should feel free to pleasantly disagree with the work and decisions of the lead maintainer. Constructive criticism is actively solicited and will be iterated upon to make the project better. Technical criticism should occur on the issue tracker and interpersonal criticism should be handled privately in Slack. If work or decisions are insufficiently documented or explained any maintainer or contributor should feel free to ask for clarification. The lead maintainer may never justify a decision with e.g. "because I say so" or "it was I who did X" alone.
<add>Maintainers should feel even more free to pleasantly disagree with the work and decisions of the lead maintainer. With greater authority comes greater responsibility to handle and moderate technical disagreements. | 1 |
PHP | PHP | write docblock to testaddmany() test method | cd4c892dfb9c21e71c4b22ef8c05ee6363da73f6 | <ide><path>tests/TestCase/Http/Client/FormDataTest.php
<ide> public function testAddSimple()
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide>
<add> /**
<add> * Test addMany method.
<add> *
<add> * @return void
<add> */
<ide> public function testAddMany()
<ide> {
<ide> $data = new FormData(); | 1 |
Python | Python | use the correct add_start_docstrings | 42049b8e12dbeea4377b491cdd519b25c83ddaff | <ide><path>src/transformers/tokenization_marian.py
<ide>
<ide> import sentencepiece
<ide>
<del>from .file_utils import add_start_docstrings_to_callable
<add>from .file_utils import add_start_docstrings
<ide> from .tokenization_utils import BatchEncoding, PreTrainedTokenizer
<ide> from .tokenization_utils_base import PREPARE_SEQ2SEQ_BATCH_DOCSTRING
<ide>
<ide> def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None) -> Lis
<ide> # We don't expect to process pairs, but leave the pair logic for API consistency
<ide> return token_ids_0 + token_ids_1 + [self.eos_token_id]
<ide>
<del> @add_start_docstrings_to_callable(PREPARE_SEQ2SEQ_BATCH_DOCSTRING)
<add> @add_start_docstrings(PREPARE_SEQ2SEQ_BATCH_DOCSTRING)
<ide> def prepare_seq2seq_batch(
<ide> self,
<ide> src_texts: List[str],
<ide><path>src/transformers/tokenization_mbart.py
<ide>
<ide> from typing import List, Optional
<ide>
<del>from .file_utils import add_start_docstrings_to_callable
<add>from .file_utils import add_start_docstrings
<ide> from .tokenization_utils import BatchEncoding
<ide> from .tokenization_utils_base import PREPARE_SEQ2SEQ_BATCH_DOCSTRING
<ide> from .tokenization_xlm_roberta import XLMRobertaTokenizer
<ide> def build_inputs_with_special_tokens(
<ide> # We don't expect to process pairs, but leave the pair logic for API consistency
<ide> return self.prefix_tokens + token_ids_0 + token_ids_1 + self.suffix_tokens
<ide>
<del> @add_start_docstrings_to_callable(PREPARE_SEQ2SEQ_BATCH_DOCSTRING)
<add> @add_start_docstrings(PREPARE_SEQ2SEQ_BATCH_DOCSTRING)
<ide> def prepare_seq2seq_batch(
<ide> self,
<ide> src_texts: List[str],
<ide><path>src/transformers/tokenization_pegasus.py
<ide>
<ide> from transformers.tokenization_reformer import ReformerTokenizer
<ide>
<del>from .file_utils import add_start_docstrings_to_callable
<add>from .file_utils import add_start_docstrings
<ide> from .tokenization_utils_base import PREPARE_SEQ2SEQ_BATCH_DOCSTRING, BatchEncoding
<ide>
<ide>
<ide> def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None) -> Lis
<ide> # We don't expect to process pairs, but leave the pair logic for API consistency
<ide> return token_ids_0 + token_ids_1 + [self.eos_token_id]
<ide>
<del> @add_start_docstrings_to_callable(PREPARE_SEQ2SEQ_BATCH_DOCSTRING)
<add> @add_start_docstrings(PREPARE_SEQ2SEQ_BATCH_DOCSTRING)
<ide> def prepare_seq2seq_batch(
<ide> self,
<ide> src_texts: List[str], | 3 |
PHP | PHP | rendersections() | 7bebac8dd5282918f16a3b553dbd6f4e1089a8b9 | <ide><path>src/Illuminate/View/View.php
<ide> protected function renderContents()
<ide> */
<ide> public function renderSections()
<ide> {
<del> $env = $this->factory;
<del>
<del> return $this->render(function ($view) use ($env) {
<del> return $env->getSections();
<add> return $this->render(function () {
<add> return $this->factory->getSections();
<ide> });
<ide> }
<ide> | 1 |
Ruby | Ruby | fix overzealous regex | 152490b7b00ddeac71eb5cb27d145797c981d55c | <ide><path>Library/Homebrew/bottle_version.rb
<ide> def self._parse spec
<ide> return m.captures.first unless m.nil?
<ide>
<ide> # e.g. 20120731 from fontforge-20120731.mavericks.bottle.tar.gz
<del> m = /-(\d+)/.match(stem)
<add> m = /-(\d{8})/.match(stem)
<ide> return m.captures.first unless m.nil?
<ide>
<ide> super | 1 |
Ruby | Ruby | pass regex into strategy blocks | fef4512b35fb30eaf5a3efbf2de675077bab5089 | <ide><path>Library/Homebrew/livecheck/strategy/git.rb
<ide> def self.find_versions(url, regex = nil, &block)
<ide> tags_only_debian = tags_data[:tags].all? { |tag| tag.start_with?("debian/") }
<ide>
<ide> if block
<del> case (value = block.call(tags_data[:tags]))
<add> case (value = block.call(tags_data[:tags], regex))
<ide> when String
<ide> match_data[:matches][value] = Version.new(value)
<ide> when Array
<ide><path>Library/Homebrew/livecheck/strategy/header_match.rb
<ide> def self.find_versions(url, regex, &block)
<ide> merged_headers = headers.reduce(&:merge)
<ide>
<ide> if block
<del> match = block.call(merged_headers)
<add> match = block.call(merged_headers, regex)
<ide> else
<ide> match = nil
<ide>
<ide><path>Library/Homebrew/livecheck/strategy/page_match.rb
<ide> def self.match?(url)
<ide> # @return [Array]
<ide> def self.page_matches(content, regex, &block)
<ide> if block
<del> case (value = block.call(content))
<add> case (value = block.call(content, regex))
<ide> when String
<ide> return [value]
<ide> when Array | 3 |
PHP | PHP | add missing use statement | 150be2d7b55dc694a6acfcc664a374deeab9727c | <ide><path>src/Collection/CollectionTrait.php
<ide> use Cake\Collection\Iterator\TreeIterator;
<ide> use Cake\Collection\Iterator\UnfoldIterator;
<ide> use Cake\Collection\Iterator\ZipIterator;
<add>use Countable;
<ide> use Iterator;
<ide> use LimitIterator;
<ide> use RecursiveIteratorIterator; | 1 |
Text | Text | update debugging docs with yellowbox/redbox | 157b5274b75ffb4a338d35272ba2ae49e7054558 | <ide><path>docs/Debugging.md
<ide> To access the in-app developer menu:
<ide> > 1. For iOS open your project in Xcode and select `Product` → `Scheme` → `Edit Scheme...` (or press `⌘ + <`). Next, select `Run` from the menu on the left and change the Build Configuration to `Release`.
<ide> > 2. For Android, by default, developer menu will be disabled in release builds done by gradle (e.g with gradle `assembleRelease` task). Although this behavior can be customized by passing proper value to `ReactInstanceManager#setUseDeveloperSupport`.
<ide>
<add>### Android logging
<add>Run `adb logcat *:S ReactNative:V ReactNativeJS:V` in a terminal to see your Android app's logs.
<add>
<ide> ### Reload
<ide> Selecting `Reload` (or pressing `⌘ + r` in the iOS simulator) will reload the JavaScript that powers your application. If you have added new resources (such as an image to `Images.xcassets` on iOS or to `res/drawable` folder on Android) or modified any native code (Objective-C/Swift code on iOS or Java/C++ code on Android), you will need to re-build the app for the changes to take effect.
<ide>
<add>### YellowBox/RedBox
<add>Using `console.warn` will display an on-screen log on a yellow background. Click on this warning to show more information about it full screen and/or dismiss the warning.
<add>
<add>You can use `console.error` to display a full screen error on a red background.
<add>
<add>These boxes only appear when you're running your app in dev mode.
<add>
<ide> ### Chrome Developer Tools
<ide> To debug the JavaScript code in Chrome, select `Debug in Chrome` from the developer menu. This will open a new tab at [http://localhost:8081/debugger-ui](http://localhost:8081/debugger-ui).
<ide> | 1 |
PHP | PHP | fix identifier typos | a1ae31e554545c1982201ea68457c50e17f2429f | <ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php
<ide> public function testSecuredFormUrlWorksWithNamedParameter() {
<ide> }
<ide>
<ide> /**
<del> * Test that URL, HTML and identifer show up in their hashs.
<add> * Test that URL, HTML and identifier show up in their hashs.
<ide> *
<ide> * @return void
<ide> */
<del> public function testSecuredFormUrlHasHtmlAndIdentifer() {
<add> public function testSecuredFormUrlHasHtmlAndIdentifier() {
<ide> $this->Form->request['_Token'] = array('key' => 'testKey');
<ide>
<ide> $expected = 'ece0693fb1b19ca116133db1832ac29baaf41ce5%3A'; | 1 |
Javascript | Javascript | improve assert test hygiene | 5624a6f8a77b8215b25e7ca27d4ac4ed66f72aee | <ide><path>test/parallel/test-assert-builtins-not-read-from-filesystem.js
<del>// Flags: --expose-internals
<del>
<ide> 'use strict';
<ide>
<del>require('../common');
<add>// Do not read filesystem when creating AssertionError messages for code in
<add>// builtin modules.
<ide>
<add>require('../common');
<ide> const assert = require('assert');
<del>const EventEmitter = require('events');
<del>const { errorCache } = require('internal/assert');
<del>const { writeFileSync, unlinkSync } = require('fs');
<ide>
<del>// Do not read filesystem for error messages in builtin modules.
<del>{
<add>if (process.argv[2] !== 'child') {
<add> const tmpdir = require('../common/tmpdir');
<add> tmpdir.refresh();
<add> const { spawnSync } = require('child_process');
<add> const { output, status, error } =
<add> spawnSync(process.execPath,
<add> ['--expose-internals', process.argv[1], 'child'],
<add> { cwd: tmpdir.path, env: process.env });
<add> assert.ifError(error);
<add> assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`);
<add>} else {
<add> const EventEmitter = require('events');
<add> const { errorCache } = require('internal/assert');
<add> const { writeFileSync } = require('fs');
<ide> const e = new EventEmitter();
<ide>
<ide> e.on('hello', assert);
<ide> const { writeFileSync, unlinkSync } = require('fs');
<ide> assert.strictEqual(errorCache.size, size - 1);
<ide> const data = `${'\n'.repeat(line - 1)}${' '.repeat(column - 1)}` +
<ide> 'ok(failed(badly));';
<del> try {
<del> writeFileSync(filename, data);
<del> assert.throws(
<del> () => e.emit('hello', false),
<del> {
<del> message: 'false == true'
<del> }
<del> );
<del> threw = true;
<del> } finally {
<del> unlinkSync(filename);
<del> }
<add>
<add> writeFileSync(filename, data);
<add> assert.throws(
<add> () => e.emit('hello', false),
<add> {
<add> message: 'false == true'
<add> }
<add> );
<add> threw = true;
<add>
<ide> }
<ide> assert(threw);
<ide> } | 1 |
Javascript | Javascript | fix decode artefacts | d2bb59bdae63702be9d88418c649ce0312dec916 | <ide><path>src/renderers/shaders/ShaderChunk/packing.glsl.js
<ide> vec4 encodeHalfRGBA ( vec2 v ) {
<ide> }
<ide>
<ide> vec2 decodeHalfRGBA( vec4 v ) {
<add> v = floor( v * 255.0 + 0.5 ) / 255.0;
<ide> return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
<ide> }
<ide> | 1 |
Mixed | Ruby | fix `content_tag_for` with array html option | 540ebe37cd1a9551b739c552a0d4efd2adc7ff22 | <ide><path>actionpack/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* Fix `content_tag_for` with array html option.
<add> It would embed array as string instead of joining it like `content_tag` does:
<add>
<add> content_tag(:td, class: ["foo", "bar"]){}
<add> #=> '<td class="foo bar"></td>'
<add>
<add> Before:
<add>
<add> content_tag_for(:td, item, class: ["foo", "bar"])
<add> #=> '<td class="item ["foo", "bar"]" id="item_1"></td>'
<add>
<add> After:
<add>
<add> content_tag_for(:td, item, class: ["foo", "bar"])
<add> #=> '<td class="item foo bar" id="item_1"></td>'
<add>
<add> *Semyon Perepelitsa*
<add>
<ide> * Remove `BestStandardsSupport` middleware, !DOCTYPE html already triggers
<ide> standards mode per http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx
<ide> and ChromeFrame header has been moved to `config.action_dispatch.default_headers`
<ide><path>actionpack/lib/action_view/helpers/record_tag_helper.rb
<ide> def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options
<ide> # for each record.
<ide> def content_tag_for_single_record(tag_name, record, prefix, options, &block)
<ide> options = options ? options.dup : {}
<del> options[:class] = "#{dom_class(record, prefix)} #{options[:class]}".rstrip
<add> options[:class] = [ dom_class(record, prefix), options[:class] ].compact
<ide> options[:id] = dom_id(record, prefix)
<ide>
<ide> if block_given?
<ide><path>actionpack/test/template/record_tag_helper_test.rb
<ide> def test_content_tag_for_with_extra_html_options
<ide> assert_dom_equal expected, actual
<ide> end
<ide>
<add> def test_content_tag_for_with_array_css_class
<add> expected = %(<tr class="record_tag_post special odd" id="record_tag_post_45"></tr>)
<add> actual = content_tag_for(:tr, @post, class: ["special", "odd"])
<add> assert_dom_equal expected, actual
<add> end
<add>
<ide> def test_content_tag_for_with_prefix_and_extra_html_options
<ide> expected = %(<tr class="archived_record_tag_post special" id="archived_record_tag_post_45" style='background-color: #f0f0f0'></tr>)
<ide> actual = content_tag_for(:tr, @post, :archived, class: "special", style: "background-color: #f0f0f0") | 3 |
Text | Text | add name check and post publish instructions | e279c75653d2cef9fa067e7fff641cbc0d89fcd4 | <ide><path>docs/publishing-a-package.md
<ide> This guide will show you how to publish a package or theme to the
<ide> [atom.io][atomio] package registry.
<ide>
<del>Publishing a package allows other people to install it and use it. It is a
<del>great way to share what you've made and get feedback and contributions from
<add>Publishing a package allows other people to install it and use it in Atom. It
<add>is a great way to share what you've made and get feedback and contributions from
<ide> others.
<ide>
<add>This guide assumes your package's name is `my-package` but you should pick a
<add>better name.
<add>
<ide> ### Install apm
<ide>
<ide> The `apm` command line utility that ships with Atom supports publishing packages
<ide> If not, there are a few things you should check before publishing:
<ide> and `repository` information.
<ide> * Your *package.json* file has a version field of `0.0.0`.
<ide> * Your *package.json* file has an `engines` field that contains an entry
<del> for Atom such as: `"engines": {"atom": ">=0.50.0"}`
<del> * Your package is stored in a git repository that is hosted on [GitHub][github]
<add> for Atom such as: `"engines": {"atom": ">=0.50.0"}`.
<add> * Your package is stored in a git repository that is hosted on
<add> [GitHub][github].
<ide> * Your package has a `README.md` file at the root.
<ide>
<ide> ### Publish Your Package
<ide>
<add>One last thing to check before publishing is that a package with the same
<add>name hasn't already been published to atom.io. You can do so by visiting
<add>`http://atom.io/packages/my-package` to see if the package already exists.
<add>If it does, update your package's name to something that is available.
<add>
<ide> Run the following commands to publish your package (this assumes your package
<ide> is located at `~/github/my-package`).
<ide>
<ide> The publish command also creates and pushes a [Git tag][git-tag] for this
<ide> release. You should now see a `v0.1.0` tag in your Git repository after
<ide> publishing.
<ide>
<add>:tada: Your package is now published and available on atom.io. Head on over to
<add>`http://atom.io/packages/my-package` to see your package's page. People can
<add>install it by running `apm install my-package` or from the Atom settings view
<add>via the *Atom > Preferences...* menu.
<add>
<ide>
<ide> [atomio]: https://atom.io
<ide> [github]: https://github.com | 1 |
Go | Go | remove valentina tereshkova | 0f052eb4f56c05dcb8c444823ebde6ce0fac7197 | <ide><path>pkg/namesgenerator/names-generator.go
<ide> var (
<ide> // Helen Brooke Taussig - American cardiologist and founder of the field of paediatric cardiology. https://en.wikipedia.org/wiki/Helen_B._Taussig
<ide> "taussig",
<ide>
<del> // Valentina Tereshkova is a Russian engineer, cosmonaut and politician. She was the first woman to fly to space in 1963. In 2013, at the age of 76, she offered to go on a one-way mission to Mars. https://en.wikipedia.org/wiki/Valentina_Tereshkova
<del> "tereshkova",
<del>
<ide> // Nikola Tesla invented the AC electric system and every gadget ever used by a James Bond villain. https://en.wikipedia.org/wiki/Nikola_Tesla
<ide> "tesla",
<ide> | 1 |
Javascript | Javascript | use different regexp for extended and basic iso | 329e9a4fd35f30032f1461475e5404a1ae3e71cd | <ide><path>src/lib/create/from-string.js
<ide> import getParsingFlags from './parsing-flags';
<ide>
<ide> // iso 8601 regex
<ide> // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
<del>var isoRegex = /^\s*((?:[+-]\d{6}|\d{4})-?(?:\d\d-?\d\d|W\d\d-?\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::?\d\d(?::?\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
<add>var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
<add>var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
<ide>
<ide> var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
<ide>
<ide> var isoDates = [
<del> ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/, true],
<del> ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/, true],
<del> ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/, true],
<del> ['GGGG-[W]WW', /\d{4}-W\d\d/, true, false],
<del> ['YYYY-DDD', /\d{4}-\d{3}/, true],
<del> ['YYYY-MM', /\d{4}-\d\d/, true, false],
<del> ['YYYYYYMMDD', /[+-]\d{10}/, false],
<del> ['YYYYMMDD', /\d{8}/, false],
<add> ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
<add> ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
<add> ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
<add> ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
<add> ['YYYY-DDD', /\d{4}-\d{3}/],
<add> ['YYYY-MM', /\d{4}-\d\d/, false],
<add> ['YYYYYYMMDD', /[+-]\d{10}/],
<add> ['YYYYMMDD', /\d{8}/],
<ide> // YYYYMM is NOT allowed by the standard
<del> ['GGGG[W]WWE', /\d{4}W\d{3}/, false],
<del> ['GGGG[W]WW', /\d{4}W\d{2}/, false, false],
<del> ['YYYYDDD', /\d{7}/, false]
<add> ['GGGG[W]WWE', /\d{4}W\d{3}/],
<add> ['GGGG[W]WW', /\d{4}W\d{2}/, false],
<add> ['YYYYDDD', /\d{7}/]
<ide> ];
<ide>
<ide> // iso time formats and regexes
<ide> var isoTimes = [
<del> ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/, true],
<del> ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/, true],
<del> ['HH:mm:ss', /\d\d:\d\d:\d\d/, true],
<del> ['HH:mm', /\d\d:\d\d/, true],
<del> ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/, false],
<del> ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/, false],
<del> ['HHmmss', /\d\d\d\d\d\d/, false],
<del> ['HHmm', /\d\d\d\d/, false],
<del> ['HH', /\d\d/, null]
<add> ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
<add> ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
<add> ['HH:mm:ss', /\d\d:\d\d:\d\d/],
<add> ['HH:mm', /\d\d:\d\d/],
<add> ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
<add> ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
<add> ['HHmmss', /\d\d\d\d\d\d/],
<add> ['HHmm', /\d\d\d\d/],
<add> ['HH', /\d\d/]
<ide> ];
<ide>
<ide> var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
<ide> var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
<ide> export function configFromISO(config) {
<ide> var i, l,
<ide> string = config._i,
<del> match = isoRegex.exec(string),
<del> extendedDate, extendedTime, allowTime, dateFormat, timeFormat, tzFormat;
<add> match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
<add> allowTime, dateFormat, timeFormat, tzFormat;
<ide>
<ide> if (match) {
<ide> getParsingFlags(config).iso = true;
<ide>
<ide> for (i = 0, l = isoDates.length; i < l; i++) {
<ide> if (isoDates[i][1].exec(match[1])) {
<ide> dateFormat = isoDates[i][0];
<del> extendedDate = isoDates[i][2];
<del> allowTime = isoDates[i][3] !== false;
<add> allowTime = isoDates[i][2] !== false;
<ide> break;
<ide> }
<ide> }
<ide> export function configFromISO(config) {
<ide> if (isoTimes[i][1].exec(match[3])) {
<ide> // match[2] should be 'T' or space
<ide> timeFormat = (match[2] || ' ') + isoTimes[i][0];
<del> extendedTime = isoTimes[i][2];
<ide> break;
<ide> }
<ide> }
<ide> export function configFromISO(config) {
<ide> config._isValid = false;
<ide> return;
<ide> }
<del> if (extendedDate != null &&
<del> extendedTime != null &&
<del> extendedDate !== extendedTime) {
<del> // extended and basic formats for date and time can NOT be mixed
<del> config._isValid = false;
<del> return;
<del> }
<ide> if (match[4] != null) {
<ide> if (tzRegex.exec(match[4])) {
<ide> tzFormat = 'Z';
<ide><path>src/test/moment/create.js
<ide> test('parsing iso', function (assert) {
<ide> });
<ide>
<ide> test('non iso 8601 strings', function (assert) {
<del> assert.ok(!moment('2015-10T10:15', moment.ISO_8601).isValid(), 'incomplete date with time');
<del> assert.ok(!moment('2015-W10T10:15', moment.ISO_8601).isValid(), 'incomplete week date with time');
<del> assert.ok(!moment('201510', moment.ISO_8601).isValid(), 'basic YYYYMM is not allowed');
<del> assert.ok(!moment('2015W10T1015', moment.ISO_8601).isValid(), 'incomplete week date with time (basic)');
<del> assert.ok(!moment('2015-10-08T1015', moment.ISO_8601).isValid(), 'mixing extended and basic format');
<del> assert.ok(!moment('20151008T10:15', moment.ISO_8601).isValid(), 'mixing basic and extended format');
<add> assert.ok(!moment('2015-10T10:15', moment.ISO_8601, true).isValid(), 'incomplete date with time');
<add> assert.ok(!moment('2015-W10T10:15', moment.ISO_8601, true).isValid(), 'incomplete week date with time');
<add> assert.ok(!moment('201510', moment.ISO_8601, true).isValid(), 'basic YYYYMM is not allowed');
<add> assert.ok(!moment('2015W10T1015', moment.ISO_8601, true).isValid(), 'incomplete week date with time (basic)');
<add> assert.ok(!moment('2015-10-08T1015', moment.ISO_8601, true).isValid(), 'mixing extended and basic format');
<add> assert.ok(!moment('20151008T10:15', moment.ISO_8601, true).isValid(), 'mixing basic and extended format');
<ide> });
<ide>
<ide> test('parsing iso week year/week/weekday', function (assert) { | 2 |
Text | Text | remove experimental status for json documentation | 956e08e6f077b9e162f653438352699937429579 | <ide><path>doc/api/documentation.md
<ide> attaching a listener to the [`'warning'`][] event.
<ide> added: v0.6.12
<ide> -->
<ide>
<del>> Stability: 1 - Experimental
<del>
<del>Every `.html` document has a corresponding `.json` document presenting
<del>the same information in a structured manner. This feature is
<del>experimental, and added for the benefit of IDEs and other utilities that
<del>wish to do programmatic things with the documentation.
<add>Every `.html` document has a corresponding `.json` document. This is for IDEs
<add>and other utilities that consume the documentation.
<ide>
<ide> ## Syscalls and man pages
<ide> | 1 |
Go | Go | fix init layer | 446ca4b57b228a2d030f0c816e08948ff7da1d79 | <ide><path>builder.go
<ide> func (builder *Builder) Create(config *Config) (*Container, error) {
<ide> container.HostnamePath = path.Join(container.root, "hostname")
<ide> ioutil.WriteFile(container.HostnamePath, []byte(container.Config.Hostname+"\n"), 0644)
<ide>
<del> hostsContent := []byte("127.0.0.1\tlocalhost\n" +
<del> "::1\t\tlocalhost ip6-localhost ip6-loopback\n" +
<del> "fe00::0\t\tip6-localnet\n" +
<del> "ff00::0\t\tip6-mcastprefix\n" +
<del> "ff02::1\t\tip6-allnodes\n" +
<del> "ff02::2\t\tip6-allrouters\n")
<add> hostsContent := []byte(`
<add>127.0.0.1 localhost
<add>::1 localhost ip6-localhost ip6-loopback
<add>fe00::0 ip6-localnet
<add>ff00::0 ip6-mcastprefix
<add>ff02::1 ip6-allnodes
<add>ff02::2 ip6-allrouters
<add>`)
<ide>
<ide> container.HostsPath = path.Join(container.root, "hosts")
<ide>
<ide> if container.Config.Domainname != "" {
<del> hostsContent = append([]byte("127.0.0.1\t"+container.Config.Hostname+"."+container.Config.Domainname+" "+container.Config.Hostname+"\n"+
<del> "::1\t\t"+container.Config.Hostname+"."+container.Config.Domainname+" "+container.Config.Hostname+"\n"), hostsContent...)
<add> hostsContent = append([]byte(fmt.Sprintf("::1\t\t%s.%s %s\n", container.Config.Hostname, container.Config.Domainname, container.Config.Hostname)), hostsContent...)
<add> hostsContent = append([]byte(fmt.Sprintf("127.0.0.1\t%s.%s %s\n", container.Config.Hostname, container.Config.Domainname, container.Config.Hostname)), hostsContent...)
<ide> } else {
<del> hostsContent = append([]byte("127.0.0.1\t"+container.Config.Hostname+"\n"+
<del> "::1\t\t"+container.Config.Hostname+"\n"), hostsContent...)
<add> hostsContent = append([]byte(fmt.Sprintf("::1\t\t%s\n", container.Config.Hostname)), hostsContent...)
<add> hostsContent = append([]byte(fmt.Sprintf("127.0.0.1\t%s\n", container.Config.Hostname)), hostsContent...)
<ide> }
<ide>
<ide> ioutil.WriteFile(container.HostsPath, hostsContent, 0644)
<ide><path>graph.go
<ide> func (graph *Graph) getDockerInitLayer() (string, error) {
<ide> "/sys": "dir",
<ide> "/.dockerinit": "file",
<ide> "/etc/resolv.conf": "file",
<add> "/etc/hosts": "file",
<add> "/etc/hostname": "file",
<ide> // "var/run": "dir",
<ide> // "var/lock": "dir",
<ide> } { | 2 |
Java | Java | remove obsolete suppression of deprecation warning | 8027e1f1090e01ed0eeafcea4699c86def37edbf | <ide><path>spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> protected Class<? extends Throwable> getExpectedException(FrameworkMethod framew
<ide> * @see #getJUnitTimeout(FrameworkMethod)
<ide> */
<ide> @Override
<del> @SuppressWarnings("deprecation")
<ide> protected Statement withPotentialTimeout(FrameworkMethod frameworkMethod, Object testInstance, Statement next) {
<ide> Statement statement = null;
<ide> long springTimeout = getSpringTimeout(frameworkMethod); | 1 |
PHP | PHP | add missing use statement | bc348de6dd75f2c94a264f2f8abec3ffd6833f8e | <ide><path>src/Controller/Component/AuthComponent.php
<ide> namespace Cake\Controller\Component;
<ide>
<ide> use Cake\Controller\Component;
<add>use Cake\Controller\ComponentRegistry;
<ide> use Cake\Controller\Controller;
<ide> use Cake\Core\App;
<ide> use Cake\Core\Configure; | 1 |
Ruby | Ruby | escape options for the stylesheet_link_tag method | 5ffa69793fd3e1d4af41ebc719a6736163eb7433 | <ide><path>actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
<ide> def extension
<ide>
<ide> def asset_tag(source, options)
<ide> # We force the :request protocol here to avoid a double-download bug in IE7 and IE8
<del> tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => ERB::Util.html_escape(path_to_asset(source, :protocol => :request)) }.merge(options), false, false)
<add> tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => path_to_asset(source, :protocol => :request) }.merge(options))
<ide> end
<ide>
<ide> def custom_dir
<ide><path>actionpack/test/template/asset_tag_helper_test.rb
<ide> def test_stylesheet_link_tag_is_html_safe
<ide> assert stylesheet_link_tag('dir/other/file', 'dir/file2').html_safe?
<ide> end
<ide>
<add> def test_stylesheet_link_tag_escapes_options
<add> assert_dom_equal %(<link href="/file.css" media="<script>" rel="stylesheet" type="text/css" />), stylesheet_link_tag('/file', :media => '<script>')
<add> end
<add>
<ide> def test_custom_stylesheet_expansions
<ide> ENV["RAILS_ASSET_ID"] = ''
<ide> ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :robbery => ["bank", "robber"] | 2 |
Python | Python | add link to swagger ui to navbar | 57d34f22bd1f97f2d44fb391ca589284394dfab9 | <ide><path>airflow/config_templates/airflow_local_settings.py
<ide> 'level': FAB_LOG_LEVEL,
<ide> 'propagate': True,
<ide> },
<add> 'connexion': {
<add> 'handler': ['console'],
<add> 'level': LOG_LEVEL,
<add> 'propagate': True,
<add> }
<ide> },
<ide> 'root': {
<ide> 'handlers': ['console'],
<ide><path>airflow/www/app.py
<ide> def init_views(appbuilder):
<ide> appbuilder.add_link("GitHub",
<ide> href='https://github.com/apache/airflow',
<ide> category="Docs")
<add> appbuilder.add_link("REST API Reference",
<add> href='/api/v1./api/v1_swagger_ui_index',
<add> category="Docs")
<ide> appbuilder.add_view(views.VersionView,
<ide> 'Version',
<ide> category='About',
<ide><path>tests/www/test_views.py
<ide> def test_index(self):
<ide> resp = self.client.get('/', follow_redirects=True)
<ide> self.check_content_in_response('DAGs', resp)
<ide>
<del> def test_doc_site_url(self):
<add> def test_doc_urls(self):
<ide> resp = self.client.get('/', follow_redirects=True)
<ide> if "dev" in version.version:
<ide> airflow_doc_site = "https://airflow.readthedocs.io/en/latest"
<ide> else:
<ide> airflow_doc_site = 'https://airflow.apache.org/docs/{}'.format(version.version)
<ide>
<ide> self.check_content_in_response(airflow_doc_site, resp)
<add> self.check_content_in_response("/api/v1/ui", resp)
<ide>
<ide> def test_health(self):
<ide> | 3 |
PHP | PHP | use events, duh | ace7f04ae579146ca3adf1c5992256c50ddc05a8 | <ide><path>src/Illuminate/Queue/Console/WorkCommand.php
<ide> use Illuminate\Queue\Worker;
<ide> use Illuminate\Console\Command;
<ide> use Illuminate\Contracts\Queue\Job;
<add>use Illuminate\Queue\Events\JobFailed;
<add>use Illuminate\Queue\Events\JobProcessed;
<ide> use Symfony\Component\Console\Input\InputOption;
<ide> use Symfony\Component\Console\Input\InputArgument;
<ide>
<ide> public function fire()
<ide> return $this->worker->sleep($this->option('sleep'));
<ide> }
<ide>
<add> // We'll listen to the processed and failed events so we can write information
<add> // to the console as jobs are processed, which will let the developer watch
<add> // which jobs are coming through a queue and be informed on its progress.
<add> $this->listenForEvents();
<add>
<ide> $queue = $this->option('queue');
<ide>
<ide> $delay = $this->option('delay');
<ide> public function fire()
<ide>
<ide> $connection = $this->argument('connection');
<ide>
<del> $response = $this->runWorker(
<add> $this->runWorker(
<ide> $connection, $queue, $delay, $memory, $this->option('daemon')
<ide> );
<add> }
<ide>
<del> // If a job was fired by the worker, we'll write the output out to the console
<del> // so that the developer can watch live while the queue runs in the console
<del> // window, which will also of get logged if stdout is logged out to disk.
<del> if (! is_null($response['job'])) {
<del> $this->writeOutput($response['job'], $response['failed']);
<del> }
<add> /**
<add> * Listen for the queue events in order to update the console output.
<add> *
<add> * @return void
<add> */
<add> protected function listenForEvents()
<add> {
<add> $this->laravel['events']->listen(JobProcessed::class, function ($event) {
<add> $this->writeOutput($event->job, false);
<add> });
<add>
<add> $this->laravel['events']->listen(JobFailed::class, function ($event) {
<add> $this->writeOutput($event->job, true);
<add> });
<ide> }
<ide>
<ide> /** | 1 |
Ruby | Ruby | support both luas | 3369c55dc69815c4a4992e131645576950d5f559 | <ide><path>Library/Homebrew/requirements/language_module_requirement.rb
<ide> def the_test
<ide> case @language
<ide> when :chicken then %W[/usr/bin/env csi -e (use\ #{@import_name})]
<ide> when :jruby then %W[/usr/bin/env jruby -rubygems -e require\ '#{@import_name}']
<del> when :lua then %W[/usr/bin/env luarocks show #{@import_name}]
<add> when :lua then %W[/usr/bin/env luarocks-5.2 show #{@import_name}]
<add> when :lua51 then %W[/usr/bin/env luarocks-5.1 show #{@import_name}]
<ide> when :node then %W[/usr/bin/env node -e require('#{@import_name}');]
<ide> when :ocaml then %W[/usr/bin/env opam list --installed #{@import_name}]
<ide> when :perl then %W[/usr/bin/env perl -e use\ #{@import_name}]
<ide> def command_line
<ide> case @language
<ide> when :chicken then "chicken-install"
<ide> when :jruby then "jruby -S gem install"
<del> when :lua then "luarocks install"
<add> when :lua then "luarocks-5.2 install"
<add> when :lua51 then "luarocks-5.1 install"
<ide> when :node then "npm install"
<ide> when :ocaml then "opam install"
<ide> when :perl then "cpan -i" | 1 |
Javascript | Javascript | provide all jquery functions as futures | 60eeeb9f20be3220dbb891abef848fe3754437da | <ide><path>src/scenario/DSL.js
<ide> angular.scenario.dsl.repeater = function(selector) {
<ide> };
<ide>
<ide> angular.scenario.dsl.element = function(selector) {
<del> var nameSuffix = "element '" + selector + "'";
<del> return $scenario.addFuture('Find ' + nameSuffix, function(done) {
<del> var self = this, repeaterArray = [], ngBindPattern;
<del> var startIndex = selector.search(angular.scenario.dsl.NG_BIND_PATTERN);
<del> if (startIndex >= 0) {
<del> ngBindPattern = selector.substring(startIndex + 2, selector.length - 2);
<del> var element = this.testDocument.find('*').filter(function() {
<del> return self.jQuery(this).attr('ng:bind') == ngBindPattern;
<del> });
<del> done(element);
<del> } else {
<del> done(this.testDocument.find(selector));
<del> }
<del> });
<add> var namePrefix = "Element '" + selector + "'";
<add> var futureJquery = {};
<add> for (key in _jQuery.fn) {
<add> (function(){
<add> var jqFnName = key;
<add> var jqFn = _jQuery.fn[key];
<add> futureJquery[key] = function() {
<add> var jqArgs = arguments;
<add> return $scenario.addFuture(namePrefix + "." + jqFnName + "()",
<add> function(done) {
<add> var self = this, repeaterArray = [], ngBindPattern;
<add> var startIndex = selector.search(angular.scenario.dsl.NG_BIND_PATTERN);
<add> if (startIndex >= 0) {
<add> ngBindPattern = selector.substring(startIndex + 2, selector.length - 2);
<add> var element = this.testDocument.find('*').filter(function() {
<add> return self.jQuery(this).attr('ng:bind') == ngBindPattern;
<add> });
<add> done(jqFn.apply(element, jqArgs));
<add> } else {
<add> done(jqFn.apply(this.testDocument.find(selector), jqArgs));
<add> }
<add> });
<add> };
<add> })();
<add> }
<add> return futureJquery;
<ide> };
<ide><path>test/scenario/DSLSpec.js
<ide> describe("DSL", function() {
<ide> expect(future.fulfilled).toBeTruthy();
<ide> }
<ide> it('should find elements on the page and provide jquery api', function() {
<del> var future = element('.reports-detail');
<del> expect(future.name).toEqual("Find element '.reports-detail'");
<add> var future = element('.reports-detail').text();
<add> expect(future.name).toEqual("Element '.reports-detail'.text()");
<ide> timeTravel(future);
<del> expect(future.value.text()).
<add> expect(future.value).
<ide> toEqual('Description : Details...Date created: 01/01/01');
<del> expect(future.value.find('.desc').text()).
<del> toEqual('Description : Details...');
<add>// expect(future.value.find('.desc').text()).
<add>// toEqual('Description : Details...');
<ide> });
<ide> it('should find elements with angular syntax', function() {
<del> var future = element('{{report.description}}');
<del> expect(future.name).toEqual("Find element '{{report.description}}'");
<add> var future = element('{{report.description}}').text();
<add> expect(future.name).toEqual("Element '{{report.description}}'.text()");
<ide> timeTravel(future);
<del> expect(future.value.text()).toEqual('Details...');
<del> expect(future.value.attr('ng:bind')).toEqual('report.description');
<add> expect(future.value).toEqual('Details...');
<add>// expect(future.value.attr('ng:bind')).toEqual('report.description');
<add> });
<add> it('should be able to click elements', function(){
<add> var future = element('.link-class').click();
<add> expect(future.name).toEqual("Element '.link-class'.click()");
<add> executeFuture(future, html, function(value) { future.fulfill(value); });
<add> expect(future.fulfilled).toBeTruthy();
<add> // TODO(rajat): look for some side effect from click happening?
<ide> });
<ide> });
<ide> }); | 2 |
Ruby | Ruby | remove debugging statement | 9ee1302f86e2b2f7cf0aec9fad8a89e05eaf9195 | <ide><path>actionpack/lib/action_controller/caching.rb
<ide> def expire_page(options = {})
<ide> # If no options are provided, the current +options+ for this action is used. Example:
<ide> # cache_page "I'm the cached content", :controller => "lists", :action => "show"
<ide> def cache_page(content = nil, options = {})
<del> logger.info "Cached page: #{options.inspect} || #{caching_allowed}"
<ide> return unless perform_caching && caching_allowed
<ide> self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true })))
<ide> end | 1 |
PHP | PHP | remove unused group tag | a96e9027b73f925c29bd9f2438743835df0503e5 | <ide><path>tests/TestCase/ORM/EntityTest.php
<ide> public function testErrors()
<ide> /**
<ide> * Tests error getters and setters
<ide> *
<del> * @group fish
<ide> * @return void
<ide> */
<ide> public function testGetAndSetErrors() | 1 |
Python | Python | attach existing volume in create_node | 92970e12aa707a0ce0401fb830b67fbeb0e9ee74 | <ide><path>libcloud/compute/drivers/digitalocean.py
<ide> def list_volumes(self):
<ide> return list(map(self._to_volume, data))
<ide>
<ide> def create_node(self, name, size, image, location, ex_create_attr=None,
<del> ex_ssh_key_ids=None, ex_user_data=None):
<add> ex_ssh_key_ids=None, ex_user_data=None, volumes=[]):
<ide> """
<ide> Create a node.
<ide>
<ide> def create_node(self, name, size, image, location, ex_create_attr=None,
<ide> attr = {'name': name, 'size': size.name, 'image': image.id,
<ide> 'region': location.id, 'user_data': ex_user_data}
<ide>
<add> if volumes:
<add> attr['volumes'] = volumes
<add>
<ide> if ex_ssh_key_ids:
<ide> warnings.warn("The ex_ssh_key_ids parameter has been deprecated in"
<ide> " favor of the ex_create_attr parameter.") | 1 |
PHP | PHP | fix class references | 871309ac986bd1c020ad6392756836bfd838d155 | <ide><path>src/Error/Debugger.php
<ide> use Cake\Error\Debug\ScalarNode;
<ide> use Cake\Error\Debug\SpecialNode;
<ide> use Cake\Error\Debug\TextFormatter;
<del>use Cake\Error\Renderer\HtmlRenderer;
<del>use Cake\Error\Renderer\TextRenderer;
<add>use Cake\Error\Renderer\HtmlErrorRenderer;
<add>use Cake\Error\Renderer\TextErrorRenderer;
<ide> use Cake\Log\Log;
<ide> use Cake\Utility\Hash;
<ide> use Cake\Utility\Security;
<ide> class Debugger
<ide> */
<ide> protected $renderers = [
<ide> // Backwards compatible alias for text that will be deprecated.
<del> 'txt' => TextRenderer::class,
<del> 'text' => TextRenderer::class,
<add> 'txt' => TextErrorRenderer::class,
<add> 'text' => TextErrorRenderer::class,
<ide> // The html alias currently uses no JS and will be deprecated.
<del> 'js' => HtmlRenderer::class,
<add> 'js' => HtmlErrorRenderer::class,
<ide> ];
<ide>
<ide> /**
<ide><path>tests/TestCase/Error/DebuggerTest.php
<ide> use Cake\Error\Debug\SpecialNode;
<ide> use Cake\Error\Debug\TextFormatter;
<ide> use Cake\Error\Debugger;
<del>use Cake\Error\Renderer\HtmlRenderer;
<add>use Cake\Error\Renderer\HtmlErrorRenderer;
<ide> use Cake\Form\Form;
<ide> use Cake\Log\Log;
<ide> use Cake\TestSuite\TestCase;
<ide> public function testAddRendererInvalid(): void
<ide> */
<ide> public function testAddOutputFormatOverwrite(): void
<ide> {
<del> Debugger::addRenderer('test', HtmlRenderer::class);
<add> Debugger::addRenderer('test', HtmlErrorRenderer::class);
<ide> Debugger::addFormat('test', [
<ide> 'error' => '{:description} : {:path}, line {:line}',
<ide> ]); | 2 |
Ruby | Ruby | add has_named_route? to the mapper api | 378ea96905e5f95be1a413b7bdd6fbb000265129 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def with_default_scope(scope, &block)
<ide> end
<ide> end
<ide>
<add> # Query if the following named route was already defined.
<add> def has_named_route?(name)
<add> @set.named_routes.routes[name.to_sym]
<add> end
<add>
<ide> private
<ide> def app_name(app)
<ide> return unless app.respond_to?(:routes)
<ide><path>actionpack/test/dispatch/routing_test.rb
<ide> def test_redirect_argument_error
<ide> assert_raises(ArgumentError) { routes.redirect Object.new }
<ide> end
<ide>
<add> def test_named_route_check
<add> before, after = nil
<add>
<add> draw do
<add> before = has_named_route?(:hello)
<add> get "/hello", as: :hello, to: "hello#world"
<add> after = has_named_route?(:hello)
<add> end
<add>
<add> assert !before, "expected to not have named route :hello before route definition"
<add> assert after, "expected to have named route :hello after route definition"
<add> end
<add>
<ide> def test_explicitly_avoiding_the_named_route
<ide> draw do
<ide> scope :as => "routes" do | 2 |
PHP | PHP | add mockbuilder with muted reflection errors | 7688bd0aac48f498b78713a9abb03d0a17217d5b | <ide><path>src/TestSuite/MockBuilder.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 3.8.8
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\TestSuite;
<add>
<add>use PHPUnit\Framework\MockObject\MockBuilder as BaseMockBuilder;
<add>
<add>/**
<add> * PHPUnit MockBuilder with muted Reflection errors
<add> *
<add> * @internal
<add> */
<add>class MockBuilder extends BaseMockBuilder
<add>{
<add> /**
<add> * @inheritDoc
<add> */
<add> public function getMock()
<add> {
<add> $errorLevel = error_reporting();
<add> error_reporting(E_ALL ^ E_DEPRECATED);
<add> try {
<add> return parent::getMock();
<add> } finally {
<add> error_reporting($errorLevel);
<add> }
<add> }
<add>}
<ide><path>src/TestSuite/TestCase.php
<ide> protected function skipUnless($condition, $message = '')
<ide>
<ide> // @codingStandardsIgnoreEnd
<ide>
<add> /**
<add> * @inheritDoc
<add> */
<add> public function getMockBuilder($className)
<add> {
<add> return new MockBuilder($this, $className);
<add> }
<add>
<ide> /**
<ide> * Mock a model, maintain fixtures and table association
<ide> *
<ide><path>tests/phpunit_aliases.php
<ide> class_alias('PHPUnit_Framework_Error_Deprecated', 'PHPUnit\Framework\Error\Depre
<ide> class_alias('PHPUnit_Framework_Error_Notice', 'PHPUnit\Framework\Error\Notice');
<ide> class_alias('PHPUnit_Framework_Error_Warning', 'PHPUnit\Framework\Error\Warning');
<ide> class_alias('PHPUnit_Framework_ExpectationFailedException', 'PHPUnit\Framework\ExpectationFailedException');
<add> class_alias('PHPUnit_Framework_MockObject_MockBuilder', 'PHPUnit\Framework\MockObject\MockBuilder');
<ide> }
<ide> } | 3 |
Mixed | Javascript | inspect arraybuffers contents as well | aa07dd6248764006d1b201700a18173250b281de | <ide><path>doc/api/util.md
<ide> stream.write('With ES6');
<ide> <!-- YAML
<ide> added: v0.3.0
<ide> changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/25006
<add> description: ArrayBuffers now also show their binary contents.
<ide> - version: v11.5.0
<ide> pr-url: https://github.com/nodejs/node/pull/24852
<ide> description: The `getters` option is supported now.
<ide><path>lib/internal/util/inspect.js
<ide> const setValues = uncurryThis(Set.prototype.values);
<ide> const mapEntries = uncurryThis(Map.prototype.entries);
<ide> const dateGetTime = uncurryThis(Date.prototype.getTime);
<ide> const hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
<add>let hexSlice;
<ide>
<ide> const inspectDefaultOptions = Object.seal({
<ide> showHidden: false,
<ide> function noPrototypeIterator(ctx, value, recurseTimes) {
<ide> // Note: using `formatValue` directly requires the indentation level to be
<ide> // corrected by setting `ctx.indentationLvL += diff` and then to decrease the
<ide> // value afterwards again.
<del>function formatValue(ctx, value, recurseTimes) {
<add>function formatValue(ctx, value, recurseTimes, typedArray) {
<ide> // Primitive types cannot have properties.
<ide> if (typeof value !== 'object' && typeof value !== 'function') {
<ide> return formatPrimitive(ctx.stylize, value, ctx);
<ide> function formatValue(ctx, value, recurseTimes) {
<ide> if (ctx.seen.indexOf(value) !== -1)
<ide> return ctx.stylize('[Circular]', 'special');
<ide>
<del> return formatRaw(ctx, value, recurseTimes);
<add> return formatRaw(ctx, value, recurseTimes, typedArray);
<ide> }
<ide>
<del>function formatRaw(ctx, value, recurseTimes) {
<add>function formatRaw(ctx, value, recurseTimes, typedArray) {
<ide> let keys;
<ide>
<ide> const constructor = getConstructorName(value, ctx);
<ide> function formatRaw(ctx, value, recurseTimes) {
<ide> const arrayType = isArrayBuffer(value) ? 'ArrayBuffer' :
<ide> 'SharedArrayBuffer';
<ide> const prefix = getPrefix(constructor, tag, arrayType);
<del> if (keys.length === 0)
<add> if (typedArray === undefined) {
<add> formatter = formatArrayBuffer;
<add> } else if (keys.length === 0) {
<ide> return prefix +
<ide> `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength)} }`;
<add> }
<ide> braces[0] = `${prefix}{`;
<ide> keys.unshift('byteLength');
<ide> } else if (isDataView(value)) {
<ide> function formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
<ide> return output;
<ide> }
<ide>
<add>function formatArrayBuffer(ctx, value) {
<add> const buffer = new Uint8Array(value);
<add> if (hexSlice === undefined)
<add> hexSlice = uncurryThis(require('buffer').Buffer.prototype.hexSlice);
<add> let str = hexSlice(buffer, 0, Math.min(ctx.maxArrayLength, buffer.length))
<add> .replace(/(.{2})/g, '$1 ').trim();
<add> const remaining = buffer.length - ctx.maxArrayLength;
<add> if (remaining > 0)
<add> str += ` ... ${remaining} more byte${remaining > 1 ? 's' : ''}`;
<add> return [`${ctx.stylize('[Uint8Contents]', 'special')}: <${str}>`];
<add>}
<add>
<ide> function formatArray(ctx, value, recurseTimes) {
<ide> const valLen = value.length;
<ide> const len = Math.min(Math.max(0, ctx.maxArrayLength), valLen);
<ide> function formatTypedArray(ctx, value, recurseTimes) {
<ide> 'byteOffset',
<ide> 'buffer'
<ide> ]) {
<del> const str = formatValue(ctx, value[key], recurseTimes);
<add> const str = formatValue(ctx, value[key], recurseTimes, true);
<ide> output.push(`[${key}]: ${str}`);
<ide> }
<ide> ctx.indentationLvl -= 2;
<ide><path>test/parallel/test-util-format-shared-arraybuffer.js
<del>'use strict';
<del>require('../common');
<del>const assert = require('assert');
<del>const util = require('util');
<del>const sab = new SharedArrayBuffer(4);
<del>assert.strictEqual(util.format(sab), 'SharedArrayBuffer { byteLength: 4 }');
<ide><path>test/parallel/test-util-format.js
<ide> assert.strictEqual(
<ide> '\u001b[1mnull\u001b[22m ' +
<ide> 'foobar'
<ide> );
<add>
<add>assert.strictEqual(
<add> util.format(new SharedArrayBuffer(4)),
<add> 'SharedArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
<add>);
<ide><path>test/parallel/test-util-inspect.js
<ide> assert(!/Object/.test(
<ide> util.inspect({ a: { a: { a: { a: {} } } } }, undefined, null, true)
<ide> ));
<ide>
<del>for (const showHidden of [true, false]) {
<del> const ab = new ArrayBuffer(4);
<add>{
<add> const showHidden = true;
<add> const ab = new Uint8Array([1, 2, 3, 4]).buffer;
<ide> const dv = new DataView(ab, 1, 2);
<ide> assert.strictEqual(
<ide> util.inspect(ab, showHidden),
<del> 'ArrayBuffer { byteLength: 4 }'
<add> 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
<ide> );
<ide> assert.strictEqual(util.inspect(new DataView(ab, 1, 2), showHidden),
<ide> 'DataView {\n' +
<ide> ' byteLength: 2,\n' +
<ide> ' byteOffset: 1,\n' +
<del> ' buffer: ArrayBuffer { byteLength: 4 } }');
<add> ' buffer:\n' +
<add> ' ArrayBuffer { [Uint8Contents]: ' +
<add> '<01 02 03 04>, byteLength: 4 } }');
<ide> assert.strictEqual(
<ide> util.inspect(ab, showHidden),
<del> 'ArrayBuffer { byteLength: 4 }'
<add> 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
<ide> );
<ide> assert.strictEqual(util.inspect(dv, showHidden),
<ide> 'DataView {\n' +
<ide> ' byteLength: 2,\n' +
<ide> ' byteOffset: 1,\n' +
<del> ' buffer: ArrayBuffer { byteLength: 4 } }');
<add> ' buffer:\n' +
<add> ' ArrayBuffer { [Uint8Contents]: ' +
<add> '<01 02 03 04>, byteLength: 4 } }');
<ide> ab.x = 42;
<ide> dv.y = 1337;
<ide> assert.strictEqual(util.inspect(ab, showHidden),
<del> 'ArrayBuffer { byteLength: 4, x: 42 }');
<add> 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
<add> 'byteLength: 4, x: 42 }');
<ide> assert.strictEqual(util.inspect(dv, showHidden),
<ide> 'DataView {\n' +
<ide> ' byteLength: 2,\n' +
<ide> ' byteOffset: 1,\n' +
<del> ' buffer: ArrayBuffer { byteLength: 4, x: 42 },\n' +
<add> ' buffer:\n' +
<add> ' ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
<add> 'byteLength: 4, x: 42 },\n' +
<ide> ' y: 1337 }');
<ide> }
<ide>
<ide> // Now do the same checks but from a different context.
<del>for (const showHidden of [true, false]) {
<add>{
<add> const showHidden = false;
<ide> const ab = vm.runInNewContext('new ArrayBuffer(4)');
<ide> const dv = vm.runInNewContext('new DataView(ab, 1, 2)', { ab });
<ide> assert.strictEqual(
<ide> util.inspect(ab, showHidden),
<del> 'ArrayBuffer { byteLength: 4 }'
<add> 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
<ide> );
<ide> assert.strictEqual(util.inspect(new DataView(ab, 1, 2), showHidden),
<ide> 'DataView {\n' +
<ide> ' byteLength: 2,\n' +
<ide> ' byteOffset: 1,\n' +
<del> ' buffer: ArrayBuffer { byteLength: 4 } }');
<add> ' buffer:\n' +
<add> ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
<add> 'byteLength: 4 } }');
<ide> assert.strictEqual(
<ide> util.inspect(ab, showHidden),
<del> 'ArrayBuffer { byteLength: 4 }'
<add> 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
<ide> );
<ide> assert.strictEqual(util.inspect(dv, showHidden),
<ide> 'DataView {\n' +
<ide> ' byteLength: 2,\n' +
<ide> ' byteOffset: 1,\n' +
<del> ' buffer: ArrayBuffer { byteLength: 4 } }');
<add> ' buffer:\n' +
<add> ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
<add> 'byteLength: 4 } }');
<ide> ab.x = 42;
<ide> dv.y = 1337;
<ide> assert.strictEqual(util.inspect(ab, showHidden),
<del> 'ArrayBuffer { byteLength: 4, x: 42 }');
<add> 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
<add> 'byteLength: 4, x: 42 }');
<ide> assert.strictEqual(util.inspect(dv, showHidden),
<ide> 'DataView {\n' +
<ide> ' byteLength: 2,\n' +
<ide> ' byteOffset: 1,\n' +
<del> ' buffer: ArrayBuffer { byteLength: 4, x: 42 },\n' +
<add> ' buffer:\n' +
<add> ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
<add> ' byteLength: 4, x: 42 },\n' +
<ide> ' y: 1337 }');
<ide> }
<ide>
<ide> assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
<ide> [new Float64Array(2), '[Float64Array: null prototype] [ 0, 0 ]'],
<ide> [new BigInt64Array(2), '[BigInt64Array: null prototype] [ 0n, 0n ]'],
<ide> [new BigUint64Array(2), '[BigUint64Array: null prototype] [ 0n, 0n ]'],
<del> [new ArrayBuffer(16), '[ArrayBuffer: null prototype] ' +
<del> '{ byteLength: undefined }'],
<add> [new ArrayBuffer(16), '[ArrayBuffer: null prototype] {\n' +
<add> ' [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>,\n' +
<add> ' byteLength: undefined }'],
<ide> [new DataView(new ArrayBuffer(16)),
<ide> '[DataView: null prototype] {\n byteLength: undefined,\n ' +
<del> 'byteOffset: undefined,\n buffer: undefined }'],
<add> 'byteOffset: undefined,\n buffer: undefined }'],
<ide> [new SharedArrayBuffer(2), '[SharedArrayBuffer: null prototype] ' +
<del> '{ byteLength: undefined }'],
<add> '{ [Uint8Contents]: <00 00>, byteLength: undefined }'],
<ide> [/foobar/, '[RegExp: null prototype] /foobar/']
<ide> ].forEach(([value, expected]) => {
<ide> assert.strictEqual( | 5 |
Javascript | Javascript | fix typo in evented mixin | 737c2872ef21f973dd265031764631515d6ed716 | <ide><path>packages/ember-runtime/lib/mixins/evented.js
<ide> Ember.Evented = Ember.Mixin.create({
<ide> event.
<ide>
<ide> ```javascript
<del> person.on('didEat', food) {
<add> person.on('didEat', function(food) {
<ide> console.log('person ate some ' + food);
<ide> });
<ide> | 1 |
Ruby | Ruby | remove unnecessary code since as beta1 is out | 8a3327526fab96745850606a45f7ccf5ad9e868a | <ide><path>lib/arel/algebra/core_extensions/object.rb
<ide> def let
<ide> yield(self)
<ide> end
<ide>
<del> # TODO remove this when ActiveSupport beta1 is out.
<del> # Returns the object's singleton class.
<del> def singleton_class
<del> class << self
<del> self
<del> end
<del> end unless respond_to?(:singleton_class)
<del>
<del> # class_eval on an object acts like singleton_class_eval.
<del> def class_eval(*args, &block)
<del> singleton_class.class_eval(*args, &block)
<del> end
<del>
<ide> Object.send(:include, self)
<ide> end
<ide> end | 1 |
Text | Text | clarify changelog entry added in [ci skip] | ff718abcba6fd8ca5972f019524836bbd1d068d2 | <ide><path>railties/CHANGELOG.md
<del>* Make :null_store the default store in the test environment.
<add>* Make `ActiveSupport::Cache::NullStore` the default cache store in the test environment.
<ide>
<ide> *Michael C. Nelson*
<ide> | 1 |
Text | Text | update bert readme | afd348a8f68e36338dd7acd11f5fad7ab74e9d4f | <ide><path>official/nlp/bert/README.md
<ide> python ../data/create_finetuning_data.py \
<ide> --fine_tuning_task_type=squad --max_seq_length=384
<ide> ```
<ide>
<add>Note: To create fine-tuning data with SQUAD 2.0, you need to add flag `--version_2_with_negative=True`
<add>
<ide> ## Fine-tuning with BERT
<ide>
<ide> ### Cloud GPUs and TPUs | 1 |
Python | Python | add __eq__ and __ne__ to poly1d | 3e5fdde668f661e82789bdd764ee6846f43efe84 | <ide><path>numpy/lib/polynomial.py
<ide> def __rdiv__(self, other):
<ide> other = poly1d(other)
<ide> return polydiv(other, self)
<ide>
<add> def __eq__(self, other):
<add> return (self.coeffs == other.coeffs).all()
<add>
<add> def __ne__(self, other):
<add> return (self.coeffs != other.coeffs).any()
<add>
<ide> def __setattr__(self, key, val):
<ide> raise ValueError, "Attributes cannot be changed this way."
<ide> | 1 |
PHP | PHP | add stringable tests | fe9711b86f02704869c688ede0a79579db067f12 | <ide><path>src/Illuminate/Support/Stringable.php
<ide> class Stringable
<ide> * @param string $value
<ide> * @return void
<ide> */
<del> public function __construct($value)
<add> public function __construct($value = '')
<ide> {
<ide> $this->value = (string) $value;
<ide> }
<ide> public function ascii($language = 'en')
<ide> return new static(Str::ascii($this->value, $language));
<ide> }
<ide>
<add> /**
<add> * Get the trailing name component of the path.
<add> *
<add> * @param string $suffix
<add> * @return static
<add> */
<add> public function basename($suffix = '')
<add> {
<add> return new static(basename($this->value, $suffix));
<add> }
<add>
<ide> /**
<ide> * Get the portion of a string before the first occurrence of a given value.
<ide> *
<ide> public function containsAll(array $needles)
<ide> return Str::containsAll($this->value, $needles);
<ide> }
<ide>
<add> /**
<add> * Get the parent directory's path.
<add> *
<add> * @param int $levels
<add> * @return static
<add> */
<add> public function dirname($levels = 1)
<add> {
<add> return new static(dirname($this->value, $levels));
<add> }
<add>
<ide> /**
<ide> * Determine if a given string ends with a given substring.
<ide> *
<ide> public function exactly($value)
<ide> *
<ide> * @param string $delimiter
<ide> * @param int $limit
<del> * @return array
<add> * @return \Illuminate\Support\Collection
<ide> */
<ide> public function explode($delimiter, $limit = PHP_INT_MAX)
<ide> {
<del> return explode($delimiter, $this->value, $limit);
<add> return collect(explode($delimiter, $this->value, $limit));
<ide> }
<ide>
<ide> /**
<ide> public function lower()
<ide> }
<ide>
<ide> /**
<del> * Limit the number of words in a string.
<add> * Get the string matching the given pattern.
<ide> *
<del> * @param int $words
<del> * @param string $end
<del> * @return static
<add> * @param string $pattern
<add> * @return static|null
<ide> */
<del> public function words($words = 100, $end = '...')
<add> public function match($pattern)
<ide> {
<del> return new static(Str::words($this->value, $words, $end));
<add> preg_match($pattern, $this->value, $matches);
<add>
<add> if (! $matches) {
<add> return new static;
<add> }
<add>
<add> return new static($matches[1] ?? $matches[0]);
<add> }
<add>
<add> /**
<add> * Get the string matching the given pattern.
<add> *
<add> * @param string $pattern
<add> * @return static|null
<add> */
<add> public function matchAll($pattern)
<add> {
<add> preg_match_all($pattern, $this->value, $matches);
<add>
<add> if (empty($matches[0])) {
<add> return collect();
<add> }
<add>
<add> return collect($matches[1] ?? $matches[0]);
<ide> }
<ide>
<ide> /**
<ide> public function ucfirst()
<ide> return new static(Str::ucfirst($this->value));
<ide> }
<ide>
<add> /**
<add> * Execute the given callback if the string is empty.
<add> *
<add> * @param callable $callback
<add> * @return static
<add> */
<add> public function whenEmpty($callback)
<add> {
<add> if ($this->isEmpty()) {
<add> $callback($this);
<add> }
<add>
<add> return $this;
<add> }
<add>
<add> /**
<add> * Limit the number of words in a string.
<add> *
<add> * @param int $words
<add> * @param string $end
<add> * @return static
<add> */
<add> public function words($words = 100, $end = '...')
<add> {
<add> return new static(Str::words($this->value, $words, $end));
<add> }
<add>
<ide> /**
<ide> * Proxy dynamic properties onto methods.
<ide> *
<ide><path>tests/Support/SupportStringableTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Support;
<add>
<add>use Illuminate\Support\Stringable;
<add>use PHPUnit\Framework\TestCase;
<add>
<add>class SupportStrTest extends TestCase
<add>{
<add> public function testMatch()
<add> {
<add> $string = new Stringable('foo bar');
<add>
<add> $this->assertEquals('bar', $string->match('/bar/'));
<add> $this->assertEquals('bar', $string->match('/foo (.*)/'));
<add> $this->assertTrue($string->match('/nothing/')->isEmpty());
<add>
<add> $string = new Stringable('bar foo bar');
<add>
<add> $this->assertEquals(['bar', 'bar'], $string->matchAll('/bar/')->all());
<add>
<add> $string = new Stringable('bar fun bar fly');
<add>
<add> $this->assertEquals(['un', 'ly'], $string->matchAll('/f(\w*)/')->all());
<add> $this->assertTrue($string->matchAll('/nothing/')->isEmpty());
<add> }
<add>} | 2 |
Java | Java | adjust uricomponentsbuilder#touristring behavior | b219c6ce15637a7a190a657f864e631e428b5378 | <ide><path>spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java
<ide> public URI build(Map<String, ?> uriVariables) {
<ide> }
<ide>
<ide> /**
<del> * Build a URI String. This is a shortcut for:
<add> * Build a URI String.
<add> * <p>Effectively, a shortcut for building, encoding, and returning the
<add> * String representation:
<add> * <pre class="code">
<add> * String uri = builder.build().encode().toUriString()
<add> * </pre>
<add> * <p>However if {@link #uriVariables(Map) URI variables} have been provided
<add> * then the URI template is pre-encoded separately from URI variables (see
<add> * {@link #encode()} for details), i.e. equivalent to:
<ide> * <pre>
<ide> * String uri = builder.encode().build().toUriString()
<ide> * </pre>
<ide> * @since 4.1
<ide> * @see UriComponents#toUriString()
<ide> */
<ide> public String toUriString() {
<del> return buildInternal(EncodingHint.ENCODE_TEMPLATE).toUriString();
<add> return this.uriVariables.isEmpty() ?
<add> encode().build().toUriString() :
<add> buildInternal(EncodingHint.ENCODE_TEMPLATE).toUriString();
<ide> }
<ide>
<ide> | 1 |
Java | Java | remove superfluous oncomplete | 27650908d26170ba9dac9c610b9dd20388ac1a2f | <ide><path>rxjava-core/src/main/java/rx/operators/OperatorFromIterable.java
<ide> public OperatorFromIterable(Iterable<? extends T> iterable) {
<ide> public void call(Operator<? super T> o) {
<ide> for (T i : is) {
<ide> if (o.isUnsubscribed()) {
<del> break;
<add> return;
<ide> }
<ide> o.onNext(i);
<ide> } | 1 |
Ruby | Ruby | use hash#fetch instead of testing for #key? | 6960e481cb87964bd450ec3fbaa1087f44c3b860 | <ide><path>actionpack/lib/sprockets/railtie.rb
<ide> class Railtie < ::Rails::Railtie
<ide> env.version = ::Rails.env + "-#{config.assets.version}"
<ide>
<ide> if config.assets.logger != false
<del> env.logger = config.assets.logger || ::Rails.logger
<add> env.logger = config.assets.logger || ::Rails.logger
<ide> end
<ide>
<ide> if config.assets.cache_store != false
<ide><path>actionpack/lib/sprockets/static_compiler.rb
<ide> def initialize(env, target, paths, options = {})
<ide> @env = env
<ide> @target = target
<ide> @paths = paths
<del> @digest = options.key?(:digest) ? options.delete(:digest) : true
<del> @manifest = options.key?(:manifest) ? options.delete(:manifest) : true
<add> @digest = options.fetch(:digest, true)
<add> @manifest = options.fetch(:manifest, true)
<ide> @manifest_path = options.delete(:manifest_path) || target
<ide> @zip_files = options.delete(:zip_files) || /\.(?:css|html|js|svg|txt|xml)$/
<ide> end | 2 |
Go | Go | add experimenta btrfs driver | e51af36a85126aca6bf6da5291eaf960fd82aa56 | <ide><path>graphdriver/btrfs/btrfs.go
<add>// +build linux
<add>
<add>package btrfs
<add>
<add>/*
<add>#include <stdlib.h>
<add>#include <sys/ioctl.h>
<add>#include <linux/fs.h>
<add>#include <errno.h>
<add>#include <sys/types.h>
<add>#include <dirent.h>
<add>#include <linux/btrfs.h>
<add>
<add>*/
<add>import "C"
<add>import (
<add> "fmt"
<add> "github.com/dotcloud/docker/graphdriver"
<add> "os"
<add> "path"
<add> "syscall"
<add> "unsafe"
<add>)
<add>
<add>func init() {
<add> graphdriver.Register("btrfs", Init)
<add>}
<add>
<add>func Init(home string) (graphdriver.Driver, error) {
<add> rootdir := path.Dir(home)
<add>
<add> var buf syscall.Statfs_t
<add> if err := syscall.Statfs(rootdir, &buf); err != nil {
<add> return nil, err
<add> }
<add>
<add> if buf.Type != 0x9123683E {
<add> return nil, fmt.Errorf("%s is not a btrfs filesystem", rootdir)
<add> }
<add>
<add> return &Driver{
<add> home: home,
<add> }, nil
<add>}
<add>
<add>type Driver struct {
<add> home string
<add>}
<add>
<add>func (d *Driver) String() string {
<add> return "btrfs"
<add>}
<add>
<add>func (d *Driver) Status() [][2]string {
<add> return nil
<add>}
<add>
<add>func (d *Driver) Cleanup() error {
<add> return nil
<add>}
<add>
<add>func free(p *C.char) {
<add> C.free(unsafe.Pointer(p))
<add>}
<add>
<add>func openDir(path string) (*C.DIR, error) {
<add> Cpath := C.CString(path)
<add> defer free(Cpath)
<add>
<add> dir := C.opendir(Cpath)
<add> if dir == nil {
<add> return nil, fmt.Errorf("Can't open dir")
<add> }
<add> return dir, nil
<add>}
<add>
<add>func closeDir(dir *C.DIR) {
<add> if dir != nil {
<add> C.closedir(dir)
<add> }
<add>}
<add>
<add>func getDirFd(dir *C.DIR) uintptr {
<add> return uintptr(C.dirfd(dir))
<add>}
<add>
<add>func subvolCreate(path, name string) error {
<add> dir, err := openDir(path)
<add> if err != nil {
<add> return err
<add> }
<add> defer closeDir(dir)
<add>
<add> var args C.struct_btrfs_ioctl_vol_args
<add> for i, c := range []byte(name) {
<add> args.name[i] = C.char(c)
<add> }
<add>
<add> _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_SUBVOL_CREATE,
<add> uintptr(unsafe.Pointer(&args)))
<add> if errno != 0 {
<add> return fmt.Errorf("Can't create subvolume")
<add> }
<add> return nil
<add>}
<add>
<add>func subvolSnapshot(src, dest, name string) error {
<add> srcDir, err := openDir(src)
<add> if err != nil {
<add> return err
<add> }
<add> defer closeDir(srcDir)
<add>
<add> destDir, err := openDir(dest)
<add> if err != nil {
<add> return err
<add> }
<add> defer closeDir(destDir)
<add>
<add> var args C.struct_btrfs_ioctl_vol_args_v2
<add> args.fd = C.__s64(getDirFd(srcDir))
<add> for i, c := range []byte(name) {
<add> args.name[i] = C.char(c)
<add> }
<add>
<add> _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2,
<add> uintptr(unsafe.Pointer(&args)))
<add> if errno != 0 {
<add> return fmt.Errorf("Can't create subvolume")
<add> }
<add> return nil
<add>}
<add>
<add>func subvolDelete(path, name string) error {
<add> dir, err := openDir(path)
<add> if err != nil {
<add> return err
<add> }
<add> defer closeDir(dir)
<add>
<add> var args C.struct_btrfs_ioctl_vol_args
<add> for i, c := range []byte(name) {
<add> args.name[i] = C.char(c)
<add> }
<add>
<add> _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_SNAP_DESTROY,
<add> uintptr(unsafe.Pointer(&args)))
<add> if errno != 0 {
<add> return fmt.Errorf("Can't create subvolume")
<add> }
<add> return nil
<add>}
<add>
<add>func (d *Driver) subvolumesDir() string {
<add> return path.Join(d.home, "subvolumes")
<add>}
<add>
<add>func (d *Driver) subvolumesDirId(id string) string {
<add> return path.Join(d.subvolumesDir(), id)
<add>}
<add>
<add>func (d *Driver) Create(id string, parent string) error {
<add> subvolumes := path.Join(d.home, "subvolumes")
<add> if err := os.MkdirAll(subvolumes, 0700); err != nil {
<add> return err
<add> }
<add> if parent == "" {
<add> if err := subvolCreate(subvolumes, id); err != nil {
<add> return err
<add> }
<add> } else {
<add> parentDir, err := d.Get(parent)
<add> if err != nil {
<add> return err
<add> }
<add> if err := subvolSnapshot(parentDir, subvolumes, id); err != nil {
<add> return err
<add> }
<add> }
<add> return nil
<add>}
<add>
<add>func (d *Driver) Remove(id string) error {
<add> dir := d.subvolumesDirId(id)
<add> if _, err := os.Stat(dir); err != nil {
<add> return err
<add> }
<add> if err := subvolDelete(d.subvolumesDir(), id); err != nil {
<add> return err
<add> }
<add> return os.RemoveAll(dir)
<add>}
<add>
<add>func (d *Driver) Get(id string) (string, error) {
<add> dir := d.subvolumesDirId(id)
<add> st, err := os.Stat(dir)
<add> if err != nil {
<add> return "", err
<add> }
<add>
<add> if !st.IsDir() {
<add> return "", fmt.Errorf("%s: not a directory", dir)
<add> }
<add>
<add> return dir, nil
<add>}
<add>
<add>func (d *Driver) Put(id string) {
<add>}
<add>
<add>func (d *Driver) Exists(id string) bool {
<add> dir := d.subvolumesDirId(id)
<add> _, err := os.Stat(dir)
<add> return err == nil
<add>}
<ide><path>graphdriver/btrfs/dummy_unsupported.go
<add>// +build !linux
<add>
<add>package btrfs
<ide><path>graphdriver/driver.go
<ide> var (
<ide> "aufs",
<ide> "devicemapper",
<ide> "vfs",
<add> // experimental, has to be enabled manually for now
<add> "btrfs",
<ide> }
<ide> )
<ide>
<ide><path>runtime.go
<ide> import (
<ide> "github.com/dotcloud/docker/execdriver/lxc"
<ide> "github.com/dotcloud/docker/graphdriver"
<ide> "github.com/dotcloud/docker/graphdriver/aufs"
<add> _ "github.com/dotcloud/docker/graphdriver/btrfs"
<ide> _ "github.com/dotcloud/docker/graphdriver/devmapper"
<ide> _ "github.com/dotcloud/docker/graphdriver/vfs"
<ide> "github.com/dotcloud/docker/pkg/graphdb" | 4 |
Mixed | Ruby | catch invalidurierror on bad paths on redirect | e23b3149458b22cf07382d6aeb2264585e28a339 | <ide><path>actionpack/CHANGELOG.md
<add>* Handle InvalidURIError on bad paths on redirect route.
<add>
<add> *arthurnn*
<add>
<ide> * Deprecate passing first parameter as `Hash` and default status code for `head` method.
<ide>
<ide> *Mehmet Emin İNAÇ*
<ide><path>actionpack/lib/action_dispatch/routing/redirection.rb
<ide> def call(env)
<ide>
<ide> def serve(req)
<ide> req.check_path_parameters!
<del> uri = URI.parse(path(req.path_parameters, req))
<del>
<add> begin
<add> uri = URI.parse(path(req.path_parameters, req))
<add> rescue URI::InvalidURIError
<add> return [ 400, {}, ['Invalid path.'] ]
<add> end
<add>
<ide> unless uri.host
<ide> if relative_path?(uri.path)
<ide> uri.path = "#{req.script_name}/#{uri.path}"
<ide> elsif uri.path.empty?
<ide> uri.path = req.script_name.empty? ? "/" : req.script_name
<ide> end
<ide> end
<del>
<add>
<ide> uri.scheme ||= req.scheme
<ide> uri.host ||= req.host
<ide> uri.port ||= req.port unless req.standard_port?
<ide> def path(params, request)
<ide> url_options[:script_name] = request.script_name
<ide> end
<ide> end
<del>
<add>
<ide> ActionDispatch::Http::URL.url_for url_options
<ide> end
<ide>
<ide><path>actionpack/test/journey/router_test.rb
<ide> def test_X_Cascade
<ide> assert_equal 404, resp.first
<ide> end
<ide>
<add> def test_invalid_url_path
<add> routes = Class.new { include ActionDispatch::Routing::Redirection }.new
<add> route = routes.redirect("/foo/bar/%{id}")
<add> resp = route.serve(rails_env({ 'REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/foo/(function(){})' }))
<add> assert_equal 400, resp.first
<add> end
<add>
<ide> def test_clear_trailing_slash_from_script_name_on_root_unanchored_routes
<ide> route_set = Routing::RouteSet.new
<ide> mapper = Routing::Mapper.new route_set | 3 |
Javascript | Javascript | use faster variant for rss | 4ad7338398eadf20ddbe20600979e89c1b386ab8 | <ide><path>test/sequential/test-net-bytes-per-incoming-chunk-overhead.js
<ide> const receivedChunks = [];
<ide> const N = 250000;
<ide>
<ide> const server = net.createServer(common.mustCall((socket) => {
<del> baseRSS = process.memoryUsage().rss;
<add> baseRSS = process.memoryUsage.rss();
<ide>
<ide> socket.setNoDelay(true);
<ide> socket.on('data', (chunk) => {
<ide> const server = net.createServer(common.mustCall((socket) => {
<ide> process.on('exit', () => {
<ide> global.gc();
<ide> const bytesPerChunk =
<del> (process.memoryUsage().rss - baseRSS) / receivedChunks.length;
<add> (process.memoryUsage.rss() - baseRSS) / receivedChunks.length;
<ide> // We should always have less than one page (usually ~ 4 kB) per chunk.
<ide> assert(bytesPerChunk < 650, `measured ${bytesPerChunk} bytes per chunk`);
<ide> }); | 1 |
PHP | PHP | fix cs error | 4c545b9facec53043a8ed6b574b1dc1fd172bed3 | <ide><path>tests/TestCase/Utility/XmlTest.php
<ide> public function testFromArray()
<ide> */
<ide> public function testFromArrayZeroValue()
<ide> {
<del> $xml = array(
<del> 'tag' => array(
<add> $xml = [
<add> 'tag' => [
<ide> '@' => 0,
<ide> '@test' => 'A test'
<del> )
<del> );
<add> ]
<add> ];
<ide> $obj = Xml::fromArray($xml);
<ide> $xmlText = <<<XML
<ide> <?xml version="1.0" encoding="UTF-8"?>
<ide> <tag test="A test">0</tag>
<ide> XML;
<ide> $this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
<ide>
<del> $xml = array(
<del> 'tag' => array('0')
<del> );
<add> $xml = [
<add> 'tag' => ['0']
<add> ];
<ide> $obj = Xml::fromArray($xml);
<ide> $xmlText = <<<XML
<ide> <?xml version="1.0" encoding="UTF-8"?> | 1 |
PHP | PHP | fix merge conflict with 62f8dea | 32e7943b00c1481e3ff194556aa02e0acad05932 | <ide><path>lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
<ide> public function tearDown() {
<ide> * @return void
<ide> */
<ide> public function testContainments() {
<del> $r = $this->__containments($this->Article, array('Comment' => array('conditions' => array('Comment.user_id' => 2))));
<add> $r = $this->_containments($this->Article, array('Comment' => array('conditions' => array('Comment.user_id' => 2))));
<ide> $this->assertTrue(Set::matches('/Article/keep/Comment/conditions[Comment.user_id=2]', $r));
<ide>
<del> $r = $this->__containments($this->User, array(
<add> $r = $this->_containments($this->User, array(
<ide> 'ArticleFeatured' => array(
<ide> 'Featured' => array(
<ide> 'id',
<ide> public function testContainments() {
<ide> )));
<ide> $this->assertEquals(Set::extract('/ArticleFeatured/keep/Featured/fields', $r), array('id'));
<ide>
<del> $r = $this->__containments($this->Article, array(
<add> $r = $this->_containments($this->Article, array(
<ide> 'Comment' => array(
<ide> 'User',
<ide> 'conditions' => array('Comment' => array('user_id' => 2)),
<ide> public function testContainments() {
<ide> $this->assertTrue(Set::matches('/Comment', $r));
<ide> $this->assertTrue(Set::matches('/Article/keep/Comment/conditions/Comment[user_id=2]', $r));
<ide>
<del> $r = $this->__containments($this->Article, array('Comment(comment, published)' => 'Attachment(attachment)', 'User(user)'));
<add> $r = $this->_containments($this->Article, array('Comment(comment, published)' => 'Attachment(attachment)', 'User(user)'));
<ide> $this->assertTrue(Set::matches('/Comment', $r));
<ide> $this->assertTrue(Set::matches('/User', $r));
<ide> $this->assertTrue(Set::matches('/Article/keep/Comment', $r));
<ide> public function testContainments() {
<ide> $this->assertTrue(Set::matches('/Comment/keep/Attachment', $r));
<ide> $this->assertEquals(Set::extract('/Comment/keep/Attachment/fields', $r), array('attachment'));
<ide>
<del> $r = $this->__containments($this->Article, array('Comment' => array('limit' => 1)));
<add> $r = $this->_containments($this->Article, array('Comment' => array('limit' => 1)));
<ide> $this->assertEquals(array_keys($r), array('Comment', 'Article'));
<ide> $result = Set::extract('/Comment/keep', $r);
<ide> $this->assertEquals(array_shift($result), array('keep' => array()));
<ide> $this->assertTrue(Set::matches('/Article/keep/Comment', $r));
<ide> $result = Set::extract('/Article/keep/Comment/.', $r);
<ide> $this->assertEquals(array_shift($result), array('limit' => 1));
<ide>
<del> $r = $this->__containments($this->Article, array('Comment.User'));
<add> $r = $this->_containments($this->Article, array('Comment.User'));
<ide> $this->assertEquals(array_keys($r), array('User', 'Comment', 'Article'));
<ide>
<ide> $result = Set::extract('/User/keep', $r);
<ide> public function testContainments() {
<ide> $result = Set::extract('/Article/keep', $r);
<ide> $this->assertEquals(array_shift($result), array('keep' => array('Comment' => array())));
<ide>
<del> $r = $this->__containments($this->Tag, array('Article' => array('User' => array('Comment' => array(
<add> $r = $this->_containments($this->Tag, array('Article' => array('User' => array('Comment' => array(
<ide> 'Attachment' => array('conditions' => array('Attachment.id >' => 1))
<ide> )))));
<ide> $this->assertTrue(Set::matches('/Attachment', $r));
<ide> public function testContainments() {
<ide> * @return void
<ide> */
<ide> public function testInvalidContainments() {
<del> $r = $this->__containments($this->Article, array('Comment', 'InvalidBinding'));
<add> $r = $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
<ide> }
<ide>
<ide> /**
<ide> public function testInvalidContainments() {
<ide> */
<ide> public function testInvalidContainmentsNoNotices() {
<ide> $this->Article->Behaviors->attach('Containable', array('notices' => false));
<del> $r = $this->__containments($this->Article, array('Comment', 'InvalidBinding'));
<add> $r = $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
<ide> }
<ide>
<ide> /**
<ide> public function testFindEmbeddedThirdLevelNonReset() {
<ide> );
<ide> $this->assertEquals($expected, $result);
<ide>
<del> $this->__assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<ide>
<ide> $this->User->resetBindings();
<ide>
<del> $this->__assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<ide>
<ide> $result = $this->User->find('all', array('reset' => false, 'contain' => array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => array('Article', 'Attachment')))));
<ide> $expected = array(
<ide> public function testFindEmbeddedThirdLevelNonReset() {
<ide> );
<ide> $this->assertEquals($expected, $result);
<ide>
<del> $this->__assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article'), 'hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article'), 'hasOne' => array('Attachment')));
<ide>
<ide> $this->User->resetBindings();
<del> $this->__assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<ide>
<ide> $result = $this->User->find('all', array('contain' => array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => array('Article', 'Attachment')), false)));
<ide> $expected = array(
<ide> public function testFindEmbeddedThirdLevelNonReset() {
<ide> );
<ide> $this->assertEquals($expected, $result);
<ide>
<del> $this->__assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article'), 'hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('ArticleFeatured')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article'), 'hasOne' => array('Attachment')));
<ide>
<ide> $this->User->resetBindings();
<del> $this->__assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<ide>
<ide> $result = $this->User->find('all', array('reset' => false, 'contain' => array('ArticleFeatured' => array('Featured' => 'Category', 'Comment' => 'Attachment'), 'Article')));
<ide> $expected = array(
<ide> public function testFindEmbeddedThirdLevelNonReset() {
<ide> );
<ide> $this->assertEquals($expected, $result);
<ide>
<del> $this->__assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured')));
<del> $this->__assertBindings($this->User->Article);
<del> $this->__assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured')));
<add> $this->_assertBindings($this->User->Article);
<add> $this->_assertBindings($this->User->ArticleFeatured, array('hasOne' => array('Featured'), 'hasMany' => array('Comment')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('hasOne' => array('Attachment')));
<ide>
<ide> $this->User->resetBindings();
<del> $this->__assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<del> $this->__assertBindings($this->User->Article, array('belongsTo' => array('User'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<del> $this->__assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<del> $this->__assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<add> $this->_assertBindings($this->User, array('hasMany' => array('Article', 'ArticleFeatured', 'Comment')));
<add> $this->_assertBindings($this->User->Article, array('belongsTo' => array('User'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<add> $this->_assertBindings($this->User->ArticleFeatured, array('belongsTo' => array('User'), 'hasOne' => array('Featured'), 'hasMany' => array('Comment'), 'hasAndBelongsToMany' => array('Tag')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Featured, array('belongsTo' => array('ArticleFeatured', 'Category')));
<add> $this->_assertBindings($this->User->ArticleFeatured->Comment, array('belongsTo' => array('Article', 'User'), 'hasOne' => array('Attachment')));
<ide> }
<ide>
<ide> /**
<ide> public function testLazyLoad() {
<ide> }
<ide>
<ide> /**
<del> * containments method
<add> * _containments method
<ide> *
<del> * @param mixed $Model
<add> * @param Model $Model
<ide> * @param array $contain
<ide> * @return void
<ide> */
<del> protected function __containments(&$Model, $contain = array()) {
<add> protected function _containments($Model, $contain = array()) {
<ide> if (!is_array($Model)) {
<ide> $result = $Model->containments($contain);
<del> return $this->__containments($result['models']);
<add> return $this->_containments($result['models']);
<ide> } else {
<ide> $result = $Model;
<ide> foreach ($result as $i => $containment) {
<ide> $result[$i] = array_diff_key($containment, array('instance' => true));
<ide> }
<ide> }
<del>
<ide> return $result;
<ide> }
<ide>
<ide> /**
<del> * assertBindings method
<add> * _assertBindings method
<ide> *
<del> * @param mixed $Model
<add> * @param Model $Model
<ide> * @param array $expected
<ide> * @return void
<ide> */
<del> protected function __assertBindings(&$Model, $expected = array()) {
<del> $expected = array_merge(array('belongsTo' => array(), 'hasOne' => array(), 'hasMany' => array(), 'hasAndBelongsToMany' => array()), $expected);
<del>
<add> protected function _assertBindings($Model, $expected = array()) {
<add> $expected = array_merge(array(
<add> 'belongsTo' => array(),
<add> 'hasOne' => array(),
<add> 'hasMany' => array(),
<add> 'hasAndBelongsToMany' => array()
<add> ), $expected);
<ide> foreach ($expected as $binding => $expect) {
<ide> $this->assertEquals(array_keys($Model->$binding), $expect);
<ide> }
<ide> }
<del>
<del>/**
<del> * bindings method
<del> *
<del> * @param mixed $Model
<del> * @param array $extra
<del> * @param bool $output
<del> * @return void
<del> */
<del> protected function __bindings(&$Model, $extra = array(), $output = true) {
<del> $relationTypes = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
<del>
<del> $debug = '[';
<del> $lines = array();
<del> foreach ($relationTypes as $binding) {
<del> if (!empty($Model->$binding)) {
<del> $models = array_keys($Model->$binding);
<del> foreach ($models as $linkedModel) {
<del> $line = $linkedModel;
<del> if (!empty($extra) && !empty($Model->{$binding}[$linkedModel])) {
<del> $extraData = array();
<del> foreach (array_intersect_key($Model->{$binding}[$linkedModel], array_flip($extra)) as $key => $value) {
<del> $extraData[] = $key . ': ' . (is_array($value) ? '(' . implode(', ', $value) . ')' : $value);
<del> }
<del> $line .= ' {' . implode(' - ', $extraData) . '}';
<del> }
<del> $lines[] = $line;
<del> }
<del> }
<del> }
<del> $debug .= implode(' | ' , $lines);
<del> $debug .= ']';
<del> $debug = '<strong>' . $Model->alias . '</strong>: ' . $debug . '<br />';
<del>
<del> if ($output) {
<del> echo $debug;
<del> }
<del>
<del> return $debug;
<del> }
<ide> } | 1 |
Javascript | Javascript | remove target.pagesrepo, commit here (not bot) | 790f60830b677d49b913a6f927faac62a53accbf | <ide><path>make.js
<ide> target.generic = function() {
<ide> target.web = function() {
<ide> target.generic();
<ide> target.extension();
<del> target.pagesrepo();
<ide>
<del> cd(ROOT_DIR);
<ide> echo();
<ide> echo('### Creating web site');
<ide>
<add> if (test('-d', GH_PAGES_DIR))
<add> rm('-rf', GH_PAGES_DIR);
<add>
<add> mkdir('-p', GH_PAGES_DIR + '/web');
<add> mkdir('-p', GH_PAGES_DIR + '/web/images');
<add> mkdir('-p', GH_PAGES_DIR + BUILD_DIR);
<add> mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/firefox');
<add> mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/chrome');
<add>
<ide> cp('-R', GENERIC_DIR + '/*', GH_PAGES_DIR);
<ide> cp(FIREFOX_BUILD_DIR + '/*.xpi', FIREFOX_BUILD_DIR + '/*.rdf',
<ide> GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/');
<ide> target.web = function() {
<ide> cp('web/index.html.template', GH_PAGES_DIR + '/index.html');
<ide>
<ide> cd(GH_PAGES_DIR);
<add> exec('git init');
<add> exec('git remote add origin ' + REPO);
<ide> exec('git add -A');
<add> exec('git commit -am "gh-pages site created via make.js script"');
<add> exec('git branch -m gh-pages');
<ide>
<ide> echo();
<ide> echo('Website built in ' + GH_PAGES_DIR);
<del> echo('Don\'t forget to cd into ' + GH_PAGES_DIR +
<del> ' and issue \'git commit\' to push changes.');
<ide> };
<ide>
<ide> //
<ide> target.bundle = function() {
<ide> };
<ide>
<ide>
<del>//
<del>// make pagesrepo
<del>//
<del>// This target clones the gh-pages repo into the build directory. It deletes
<del>// the current contents of the repo, since we overwrite everything with data
<del>// from the master repo. The 'make web' target then uses 'git add -A' to track
<del>// additions, modifications, moves, and deletions.
<del>target.pagesrepo = function() {
<del> cd(ROOT_DIR);
<del> echo();
<del> echo('### Creating a fresh git repo for gh-pages');
<del>
<del> if (test('-d', GH_PAGES_DIR))
<del> rm('-rf', GH_PAGES_DIR);
<del>
<del> mkdir('-p', GH_PAGES_DIR);
<del> var oldDir = pwd();
<del> cd(GH_PAGES_DIR);
<del> exec('git init');
<del> exec('git remote add origin ' + REPO);
<del> exec('git checkout --orphan gh-pages');
<del> cd(oldDir);
<del>
<del> mkdir('-p', GH_PAGES_DIR + '/web');
<del> mkdir('-p', GH_PAGES_DIR + '/web/images');
<del> mkdir('-p', GH_PAGES_DIR + BUILD_DIR);
<del> mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/firefox');
<del> mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/chrome');
<del>};
<del>
<ide>
<ide> ///////////////////////////////////////////////////////////////////////////////////////////
<ide> // | 1 |
Javascript | Javascript | add documentation for render buffer | 40f7d959cce2c431fb4b40076e1d0ef0c6aa8f99 | <ide><path>packages/sproutcore-views/lib/system/render_buffer.js
<ide>
<ide> var get = SC.get, set = SC.set;
<ide>
<del>/*
<del> TODO Document SC.RenderBuffer class itself
<del>*/
<del>
<ide> /**
<ide> @class
<add>
<add> SC.RenderBuffer gathers information regarding the a view and generates the
<add> final representation. SC.RenderBuffer will generate HTML which can be pushed
<add> to the DOM.
<add>
<ide> @extends SC.Object
<ide> */
<ide> SC.RenderBuffer = function(tagName) {
<ide> SC._RenderBuffer = SC.Object.extend(
<ide> /** @scope SC.RenderBuffer.prototype */ {
<ide>
<ide> /**
<add> Array of class-names which will be applied in the class="" attribute
<add>
<add> You should not maintain this array yourself, rather, you should use
<add> the addClass() method of SC.RenderBuffer.
<add>
<ide> @type Array
<ide> @default []
<ide> */
<ide> elementClasses: null,
<ide>
<ide> /**
<add> The id in of the element, to be applied in the id="" attribute
<add>
<add> You should not set this property yourself, rather, you should use
<add> the id() method of SC.RenderBuffer.
<add>
<ide> @type String
<ide> @default null
<ide> */
<ide> elementId: null,
<ide>
<ide> /**
<add> A hash keyed on the name of the attribute and whose value will be
<add> applied to that attribute. For example, if you wanted to apply a
<add> data-view="Foo.bar" property to an element, you would set the
<add> elementAttributes hash to {'data-view':'Foo.bar'}
<add>
<add> You should not maintain this hash yourself, rather, you should use
<add> the attr() method of SC.RenderBuffer.
<add>
<ide> @type Hash
<ide> @default {}
<ide> */
<ide> elementAttributes: null,
<ide>
<ide> /**
<add> An array of strings which defines the body of the element.
<add>
<add> You should not maintain this array yourself, rather, you should use
<add> the push() method of SC.RenderBuffer.
<add>
<ide> @type Array
<ide> @default []
<ide> */
<ide> elementContent: null,
<ide>
<ide> /**
<add> The tagname of the element an instance of SC.RenderBuffer represents.
<add>
<add> Usually, this gets set as the first parameter to SC.RenderBuffer. For
<add> example, if you wanted to create a `p` tag, then you would call
<add>
<add> SC.RenderBuffer('p')
<add>
<ide> @type String
<ide> @default null
<ide> */
<ide> elementTag: null,
<ide>
<ide> /**
<add> A hash keyed on the name of the style attribute and whose value will
<add> be applied to that attribute. For example, if you wanted to apply a
<add> background-color:black;" style to an element, you would set the
<add> elementStyle hash to {'background-color':'black'}
<add>
<add> You should not maintain this hash yourself, rather, you should use
<add> the style() method of SC.RenderBuffer.
<add>
<ide> @type Hash
<ide> @default {}
<ide> */
<ide> SC._RenderBuffer = SC.Object.extend(
<ide> escapeContent: false,
<ide>
<ide> /**
<add> If escapeContent is set to true, escapeFunction will be called
<add> to escape the content. Set this property to a function that
<add> takes a content string as its parameter, and return a sanitized
<add> string.
<add>
<ide> @type Function
<ide> @see SC.RenderBuffer.prototype.escapeContent
<ide> */
<ide> escapeFunction: null,
<ide>
<add> /**
<add> Nested RenderBuffers will set this to their parent RenderBuffer
<add> instance.
<add>
<add> @type SC._RenderBuffer
<add> */
<ide> parentBuffer: null,
<ide>
<ide> /** @private */ | 1 |
PHP | PHP | fix wincache test | 081b1231d1d2c2aa2d3ec5d00cf280e22148dd74 | <ide><path>tests/TestCase/Cache/Engine/WincacheEngineTest.php
<ide> public function testClear()
<ide> wincache_ucache_set('not_cake', 'safe');
<ide> Cache::write('some_value', 'value', 'wincache');
<ide>
<del> $result = Cache::clear(false, 'wincache');
<add> $result = Cache::clear('wincache');
<ide> $this->assertTrue($result);
<ide> $this->assertFalse(Cache::read('some_value', 'wincache'));
<ide> $this->assertEquals('safe', wincache_ucache_get('not_cake')); | 1 |
Java | Java | add onerror callback to deferredresult | e0678ba5835eb6f0a8d8b3ac344c8728102c4a4d | <ide><path>spring-orm/src/main/java/org/springframework/orm/hibernate5/support/AsyncRequestInterceptor.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 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> * Ensures the following:
<ide> * 1) The session is bound/unbound when "callable processing" is started
<del> * 2) The session is closed if an async request times out
<add> * 2) The session is closed if an async request times out or an error occurred
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 4.2
<ide> class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter imple
<ide>
<ide> private volatile boolean timeoutInProgress;
<ide>
<add> private volatile boolean errorInProgress;
<add>
<ide>
<ide> public AsyncRequestInterceptor(SessionFactory sessionFactory, SessionHolder sessionHolder) {
<ide> this.sessionFactory = sessionFactory;
<ide> public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
<ide>
<ide> public void bindSession() {
<ide> this.timeoutInProgress = false;
<add> this.errorInProgress = false;
<ide> TransactionSynchronizationManager.bindResource(this.sessionFactory, this.sessionHolder);
<ide> }
<ide>
<ide> public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) {
<ide> return RESULT_NONE; // give other interceptors a chance to handle the timeout
<ide> }
<ide>
<add> @Override
<add> public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) {
<add> this.errorInProgress = true;
<add> return RESULT_NONE; // give other interceptors a chance to handle the error
<add> }
<add>
<ide> @Override
<ide> public <T> void afterCompletion(NativeWebRequest request, Callable<T> task) throws Exception {
<del> closeAfterTimeout();
<add> closeSession();
<ide> }
<ide>
<del> private void closeAfterTimeout() {
<del> if (this.timeoutInProgress) {
<del> logger.debug("Closing Hibernate Session after async request timeout");
<add> private void closeSession() {
<add> if (this.timeoutInProgress || this.errorInProgress) {
<add> logger.debug("Closing Hibernate Session after async request timeout/error");
<ide> SessionFactoryUtils.closeSession(this.sessionHolder.getSession());
<ide> }
<ide> }
<ide> public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> def
<ide> return true; // give other interceptors a chance to handle the timeout
<ide> }
<ide>
<add> @Override
<add> public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> deferredResult, Throwable t) {
<add> this.errorInProgress = true;
<add> return true; // give other interceptors a chance to handle the error
<add> }
<add>
<ide> @Override
<ide> public <T> void afterCompletion(NativeWebRequest request, DeferredResult<T> deferredResult) {
<del> closeAfterTimeout();
<add> closeSession();
<ide> }
<ide>
<ide> }
<ide><path>spring-orm/src/main/java/org/springframework/orm/jpa/support/AsyncRequestInterceptor.java
<ide> *
<ide> * Ensures the following:
<ide> * 1) The session is bound/unbound when "callable processing" is started
<del> * 2) The session is closed if an async request times out
<add> * 2) The session is closed if an async request times out or an error occurred
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 3.2.5
<ide> class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter imple
<ide>
<ide> private volatile boolean timeoutInProgress;
<ide>
<add> private volatile boolean errorInProgress;
<add>
<ide>
<ide> public AsyncRequestInterceptor(EntityManagerFactory emFactory, EntityManagerHolder emHolder) {
<ide> this.emFactory = emFactory;
<ide> public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
<ide>
<ide> public void bindEntityManager() {
<ide> this.timeoutInProgress = false;
<add> this.errorInProgress = false;
<ide> TransactionSynchronizationManager.bindResource(this.emFactory, this.emHolder);
<ide> }
<ide>
<ide> public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) {
<ide> return RESULT_NONE; // give other interceptors a chance to handle the timeout
<ide> }
<ide>
<add> @Override
<add> public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) {
<add> this.errorInProgress = true;
<add> return RESULT_NONE; // give other interceptors a chance to handle the error
<add> }
<add>
<ide> @Override
<ide> public <T> void afterCompletion(NativeWebRequest request, Callable<T> task) throws Exception {
<del> closeAfterTimeout();
<add> closeEntityManager();
<ide> }
<ide>
<del> private void closeAfterTimeout() {
<del> if (this.timeoutInProgress) {
<del> logger.debug("Closing JPA EntityManager after async request timeout");
<add> private void closeEntityManager() {
<add> if (this.timeoutInProgress || this.errorInProgress) {
<add> logger.debug("Closing JPA EntityManager after async request timeout/error");
<ide> EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
<ide> }
<ide> }
<ide> public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> def
<ide> return true; // give other interceptors a chance to handle the timeout
<ide> }
<ide>
<add> @Override
<add> public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> deferredResult, Throwable t) {
<add> this.errorInProgress = true;
<add> return true; // give other interceptors a chance to handle the error
<add> }
<add>
<ide> @Override
<ide> public <T> void afterCompletion(NativeWebRequest request, DeferredResult<T> deferredResult) {
<del> closeAfterTimeout();
<add> closeEntityManager();
<ide> }
<ide>
<ide> }
<ide><path>spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public String call() throws Exception {
<ide> verify(this.manager).close();
<ide> }
<ide>
<add> @Test
<add> public void testOpenEntityManagerInViewInterceptorAsyncErrorScenario() throws Exception {
<add>
<add> // Initial request thread
<add>
<add> OpenEntityManagerInViewInterceptor interceptor = new OpenEntityManagerInViewInterceptor();
<add> interceptor.setEntityManagerFactory(factory);
<add>
<add> given(this.factory.createEntityManager()).willReturn(this.manager);
<add>
<add> interceptor.preHandle(this.webRequest);
<add> assertTrue(TransactionSynchronizationManager.hasResource(this.factory));
<add>
<add> AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, this.response);
<add> WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request);
<add> asyncManager.setTaskExecutor(new SyncTaskExecutor());
<add> asyncManager.setAsyncWebRequest(asyncWebRequest);
<add> asyncManager.startCallableProcessing(new Callable<String>() {
<add> @Override
<add> public String call() throws Exception {
<add> return "anything";
<add> }
<add> });
<add>
<add> interceptor.afterConcurrentHandlingStarted(this.webRequest);
<add> assertFalse(TransactionSynchronizationManager.hasResource(this.factory));
<add>
<add> // Async request timeout
<add>
<add> given(this.manager.isOpen()).willReturn(true);
<add>
<add> MockAsyncContext asyncContext = (MockAsyncContext) this.request.getAsyncContext();
<add> for (AsyncListener listener : asyncContext.getListeners()) {
<add> listener.onError(new AsyncEvent(asyncContext, new Exception()));
<add> }
<add> for (AsyncListener listener : asyncContext.getListeners()) {
<add> listener.onComplete(new AsyncEvent(asyncContext));
<add> }
<add>
<add> verify(this.manager).close();
<add> }
<add>
<ide> @Test
<ide> public void testOpenEntityManagerInViewFilter() throws Exception {
<ide> given(manager.isOpen()).willReturn(true);
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/AsyncWebRequest.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> package org.springframework.web.context.request.async;
<ide>
<add>import java.util.function.Consumer;
<add>
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.web.context.request.NativeWebRequest;
<ide>
<ide> public interface AsyncWebRequest extends NativeWebRequest {
<ide> void addTimeoutHandler(Runnable runnable);
<ide>
<ide> /**
<del> * Add a handle to invoke when request processing completes.
<add> * Add a handler to invoke when an error occurred while concurrent
<add> * handling of a request.
<add> */
<add> void addErrorHandler(Consumer<Throwable> exceptionHandler);
<add>
<add> /**
<add> * Add a handler to invoke when request processing completes.
<ide> */
<ide> void addCompletionHandler(Runnable runnable);
<ide>
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 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> else if (result != CallableProcessingInterceptor.RESULT_NONE) {
<ide> return CallableProcessingInterceptor.RESULT_NONE;
<ide> }
<ide>
<add> public Object triggerAfterError(NativeWebRequest request, Callable<?> task, Throwable throwable) {
<add> for (CallableProcessingInterceptor interceptor : this.interceptors) {
<add> try {
<add> Object result = interceptor.handleError(request, task, throwable);
<add> if (result == CallableProcessingInterceptor.RESPONSE_HANDLED) {
<add> break;
<add> }
<add> else if (result != CallableProcessingInterceptor.RESULT_NONE) {
<add> return result;
<add> }
<add> }
<add> catch (Throwable t) {
<add> return t;
<add> }
<add> }
<add> return CallableProcessingInterceptor.RESULT_NONE;
<add> }
<add>
<ide> public void triggerAfterCompletion(NativeWebRequest request, Callable<?> task) {
<ide> for (int i = this.interceptors.size()-1; i >= 0; i--) {
<ide> try {
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/CallableProcessingInterceptor.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 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> * <p>A {@code CallableProcessingInterceptor} is invoked before and after the
<ide> * invocation of the {@code Callable} task in the asynchronous thread, as well
<del> * as on timeout from a container thread, or after completing for any reason
<add> * as on timeout/error from a container thread, or after completing for any reason
<ide> * including a timeout or network error.
<ide> *
<ide> * <p>As a general rule exceptions raised by interceptor methods will cause
<ide> * async processing to resume by dispatching back to the container and using
<ide> * the Exception instance as the concurrent result. Such exceptions will then
<ide> * be processed through the {@code HandlerExceptionResolver} mechanism.
<ide> *
<del> * <p>The {@link #handleTimeout(NativeWebRequest, Callable) afterTimeout} method
<add> * <p>The {@link #handleTimeout(NativeWebRequest, Callable) handleTimeout} method
<ide> * can select a value to be used to resume processing.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> public interface CallableProcessingInterceptor {
<ide> */
<ide> <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception;
<ide>
<add> /**
<add> * Invoked from a container thread when an error occurred while processing the async request
<add> * before the {@code Callable} task completes. Implementations may return a value,
<add> * including an {@link Exception}, to use instead of the value the
<add> * {@link Callable} did not return in time.
<add> * @param request the current request
<add> * @param task the task for the current async request
<add> * @paramt t the error that occurred while request processing
<add> * @return a concurrent result value; if the value is anything other than
<add> * {@link #RESULT_NONE} or {@link #RESPONSE_HANDLED}, concurrent processing
<add> * is resumed and subsequent interceptors are not invoked
<add> * @throws Exception in case of errors
<add> */
<add> <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception;
<add>
<ide> /**
<ide> * Invoked from a container thread when async processing completes for any
<ide> * reason including timeout or network error.
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/CallableProcessingInterceptorAdapter.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) thro
<ide> return RESULT_NONE;
<ide> }
<ide>
<add> /**
<add> * This implementation always returns
<add> * {@link CallableProcessingInterceptor#RESULT_NONE RESULT_NONE}.
<add> */
<add> @Override
<add> public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception {
<add> return RESULT_NONE;
<add> }
<add>
<ide> /**
<ide> * This implementation is empty.
<ide> */
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> import java.util.PriorityQueue;
<ide> import java.util.concurrent.Callable;
<add>import java.util.function.Consumer;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<ide>
<ide> private Runnable timeoutCallback;
<ide>
<add> private Consumer<Throwable> errorCallback;
<add>
<ide> private Runnable completionCallback;
<ide>
<ide> private DeferredResultHandler resultHandler;
<ide> public void onTimeout(Runnable callback) {
<ide> this.timeoutCallback = callback;
<ide> }
<ide>
<add> /**
<add> * Register code to invoke when an error occurred while processing the async request.
<add> * <p>This method is called from a container thread when an error occurred while
<add> * processing an async request before the {@code DeferredResult} has been populated.
<add> * It may invoke {@link DeferredResult#setResult setResult} or
<add> * {@link DeferredResult#setErrorResult setErrorResult} to resume processing.
<add> */
<add> public void onError(Consumer<Throwable> callback) {
<add> this.errorCallback = callback;
<add> }
<add>
<ide> /**
<ide> * Register code to invoke when the async request completes.
<ide> * <p>This method is called from a container thread when an async request
<ide> public <S> boolean handleTimeout(NativeWebRequest request, DeferredResult<S> def
<ide> return continueProcessing;
<ide> }
<ide> @Override
<add> public <S> boolean handleError(NativeWebRequest request, DeferredResult<S> deferredResult, Throwable t) {
<add> boolean continueProcessing = true;
<add> try {
<add> if (errorCallback != null) {
<add> errorCallback.accept(t);
<add> }
<add> }
<add> finally {
<add> continueProcessing = false;
<add> try {
<add> setResultInternal(t);
<add> }
<add> catch (Throwable ex) {
<add> logger.debug("Failed to handle error result", ex);
<add> }
<add> }
<add> return continueProcessing;
<add> }
<add> @Override
<ide> public <S> void afterCompletion(NativeWebRequest request, DeferredResult<S> deferredResult) {
<ide> expired = true;
<ide> if (completionCallback != null) {
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultInterceptorChain.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public void triggerAfterTimeout(NativeWebRequest request, DeferredResult<?> defe
<ide> }
<ide> }
<ide>
<add> public void triggerAfterError(NativeWebRequest request, DeferredResult<?> deferredResult, Throwable t) throws Exception {
<add> for (DeferredResultProcessingInterceptor interceptor : this.interceptors) {
<add> if (deferredResult.isSetOrExpired()) {
<add> return;
<add> }
<add> if (!interceptor.handleError(request, deferredResult, t)){
<add> break;
<add> }
<add> }
<add> }
<add>
<ide> public void triggerAfterCompletion(NativeWebRequest request, DeferredResult<?> deferredResult) {
<ide> for (int i = this.preProcessingIndex; i >= 0; i--) {
<ide> try {
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptor.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 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> * <p>A {@code DeferredResultProcessingInterceptor} is invoked before the start
<ide> * of async processing, after the {@code DeferredResult} is set as well as on
<del> * timeout, or after completing for any reason including a timeout or network
<add> * timeout/error, or after completing for any reason including a timeout or network
<ide> * error.
<ide> *
<ide> * <p>As a general rule exceptions raised by interceptor methods will cause
<ide> * async processing to resume by dispatching back to the container and using
<ide> * the Exception instance as the concurrent result. Such exceptions will then
<ide> * be processed through the {@code HandlerExceptionResolver} mechanism.
<ide> *
<del> * <p>The {@link #handleTimeout(NativeWebRequest, DeferredResult) afterTimeout}
<add> * <p>The {@link #handleTimeout(NativeWebRequest, DeferredResult) handleTimeout}
<ide> * method can set the {@code DeferredResult} in order to resume processing.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> public interface DeferredResultProcessingInterceptor {
<ide> */
<ide> <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) throws Exception;
<ide>
<add> /**
<add> * Invoked from a container thread when an error occurred while processing an async request
<add> * before the {@code DeferredResult} has been set. Implementations may invoke
<add> * {@link DeferredResult#setResult(Object) setResult} or
<add> * {@link DeferredResult#setErrorResult(Object) setErrorResult} to resume processing.
<add> * @param request the current request
<add> * @param deferredResult the DeferredResult for the current request; if the
<add> * {@code DeferredResult} is set, then concurrent processing is resumed and
<add> * subsequent interceptors are not invoked
<add> * @param t the error that occurred while request processing
<add> * @return {@code true} if processing should continue, or {@code false} if
<add> * other interceptors should not be invoked
<add> * @throws Exception in case of errors
<add> */
<add> <T> boolean handleError(NativeWebRequest request, DeferredResult<T> deferredResult, Throwable t) throws Exception;
<add>
<ide> /**
<ide> * Invoked from a container thread when an async request completed for any
<ide> * reason including timeout and network error. This method is useful for
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptorAdapter.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> def
<ide> return true;
<ide> }
<ide>
<add> /**
<add> * This implementation returns {@code true} by default allowing other interceptors
<add> * to be given a chance to handle the error.
<add> */
<add> @Override
<add> public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> deferredResult, Throwable t)
<add> throws Exception {
<add> return true;
<add> }
<add>
<ide> /**
<ide> * This implementation is empty.
<ide> */
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/ErrorCallableProcessingInterceptor.java
<add>/*
<add> * Copyright 2002-2017 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.context.request.async;
<add>
<add>import java.util.concurrent.Callable;
<add>
<add>import org.springframework.web.context.request.NativeWebRequest;
<add>
<add>/**
<add> * Registered at the end, after all other interceptors and
<add> * therefore invoked only if no other interceptor handles the error.
<add> *
<add> * @author Violeta Georgieva
<add> * @since 5.0
<add> */
<add>public class ErrorCallableProcessingInterceptor extends CallableProcessingInterceptorAdapter {
<add>
<add> @Override
<add> public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception {
<add> return t;
<add> }
<add>
<add>}
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/ErrorDeferredResultProcessingInterceptor.java
<add>/*
<add> * Copyright 2002-2017 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.context.request.async;
<add>
<add>import org.springframework.web.context.request.NativeWebRequest;
<add>
<add>/**
<add> * Registered at the end, after all other interceptors and
<add> * therefore invoked only if no other interceptor handles the error.
<add> *
<add> * @author Violeta Georgieva
<add> * @since 5.0
<add> */
<add>public class ErrorDeferredResultProcessingInterceptor extends DeferredResultProcessingInterceptorAdapter {
<add>
<add> @Override
<add> public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> result, Throwable t)
<add> throws Exception {
<add> result.setErrorResult(t);
<add> return false;
<add> }
<add>
<add>}
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 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.ArrayList;
<ide> import java.util.List;
<ide> import java.util.concurrent.atomic.AtomicBoolean;
<add>import java.util.function.Consumer;
<add>
<ide> import javax.servlet.AsyncContext;
<ide> import javax.servlet.AsyncEvent;
<ide> import javax.servlet.AsyncListener;
<ide> public class StandardServletAsyncWebRequest extends ServletWebRequest implements
<ide>
<ide> private final List<Runnable> timeoutHandlers = new ArrayList<>();
<ide>
<add> private final List<Consumer<Throwable>> exceptionHandlers = new ArrayList<>();
<add>
<ide> private final List<Runnable> completionHandlers = new ArrayList<>();
<ide>
<ide>
<ide> public void addTimeoutHandler(Runnable timeoutHandler) {
<ide> this.timeoutHandlers.add(timeoutHandler);
<ide> }
<ide>
<add> @Override
<add> public void addErrorHandler(Consumer<Throwable> exceptionHandler) {
<add> this.exceptionHandlers.add(exceptionHandler);
<add> }
<add>
<ide> @Override
<ide> public void addCompletionHandler(Runnable runnable) {
<ide> this.completionHandlers.add(runnable);
<ide> public void onStartAsync(AsyncEvent event) throws IOException {
<ide>
<ide> @Override
<ide> public void onError(AsyncEvent event) throws IOException {
<del> onComplete(event);
<add> for (Consumer<Throwable> handler : this.exceptionHandlers) {
<add> handler.accept(event.getThrowable());
<add> }
<ide> }
<ide>
<ide> @Override
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java
<ide> public final class WebAsyncManager {
<ide> private static final CallableProcessingInterceptor timeoutCallableInterceptor =
<ide> new TimeoutCallableProcessingInterceptor();
<ide>
<add> private static final CallableProcessingInterceptor errorCallableInterceptor =
<add> new ErrorCallableProcessingInterceptor();
<add>
<ide> private static final DeferredResultProcessingInterceptor timeoutDeferredResultInterceptor =
<ide> new TimeoutDeferredResultProcessingInterceptor();
<ide>
<add> private static final DeferredResultProcessingInterceptor errorDeferredResultInterceptor =
<add> new ErrorDeferredResultProcessingInterceptor();
<add>
<ide>
<ide> private AsyncWebRequest asyncWebRequest;
<ide>
<ide> public void startCallableProcessing(final WebAsyncTask<?> webAsyncTask, Object..
<ide> interceptors.add(webAsyncTask.getInterceptor());
<ide> interceptors.addAll(this.callableInterceptors.values());
<ide> interceptors.add(timeoutCallableInterceptor);
<add> interceptors.add(errorCallableInterceptor);
<ide>
<ide> final Callable<?> callable = webAsyncTask.getCallable();
<ide> final CallableInterceptorChain interceptorChain = new CallableInterceptorChain(interceptors);
<ide> public void startCallableProcessing(final WebAsyncTask<?> webAsyncTask, Object..
<ide> }
<ide> });
<ide>
<add> this.asyncWebRequest.addErrorHandler(t -> {
<add> logger.debug("Processing error");
<add> Object result = interceptorChain.triggerAfterError(this.asyncWebRequest, callable, t);
<add> if (result != CallableProcessingInterceptor.RESULT_NONE) {
<add> setConcurrentResultAndDispatch(result);
<add> }
<add> });
<add>
<ide> this.asyncWebRequest.addCompletionHandler(() ->
<ide> interceptorChain.triggerAfterCompletion(this.asyncWebRequest, callable));
<ide>
<ide> public void startDeferredResultProcessing(
<ide> interceptors.add(deferredResult.getInterceptor());
<ide> interceptors.addAll(this.deferredResultInterceptors.values());
<ide> interceptors.add(timeoutDeferredResultInterceptor);
<add> interceptors.add(errorDeferredResultInterceptor);
<ide>
<ide> final DeferredResultInterceptorChain interceptorChain = new DeferredResultInterceptorChain(interceptors);
<ide>
<ide> public void startDeferredResultProcessing(
<ide> }
<ide> });
<ide>
<add> this.asyncWebRequest.addErrorHandler(t -> {
<add> try {
<add> interceptorChain.triggerAfterError(this.asyncWebRequest, deferredResult, t);
<add> }
<add> catch (Throwable ex) {
<add> setConcurrentResultAndDispatch(ex);
<add> }
<add> });
<add>
<ide> this.asyncWebRequest.addCompletionHandler(()
<ide> -> interceptorChain.triggerAfterCompletion(this.asyncWebRequest, deferredResult));
<ide>
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncTask.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2017 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> private Callable<V> timeoutCallback;
<ide>
<add> private Callable<V> errorCallback;
<add>
<ide> private Runnable completionCallback;
<ide>
<ide>
<ide> public void onTimeout(Callable<V> callback) {
<ide> this.timeoutCallback = callback;
<ide> }
<ide>
<add> /**
<add> * Register code to invoke when an error occurred while processing the async request.
<add> * <p>This method is called from a container thread when an error occurred while processing
<add> * an async request before the {@code Callable} has completed. The callback is executed in
<add> * the same thread and therefore should return without blocking. It may return
<add> * an alternative value to use, including an {@link Exception} or return
<add> * {@link CallableProcessingInterceptor#RESULT_NONE RESULT_NONE}.
<add> */
<add> public void onError(Callable<V> callback) {
<add> this.errorCallback = callback;
<add> }
<add>
<ide> /**
<ide> * Register code to invoke when the async request completes.
<ide> * <p>This method is called from a container thread when an async request
<ide> public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) thro
<ide> return (timeoutCallback != null ? timeoutCallback.call() : CallableProcessingInterceptor.RESULT_NONE);
<ide> }
<ide> @Override
<add> public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception {
<add> return (errorCallback != null ? errorCallback.call() : CallableProcessingInterceptor.RESULT_NONE);
<add> }
<add> @Override
<ide> public <T> void afterCompletion(NativeWebRequest request, Callable<T> task) throws Exception {
<ide> if (completionCallback != null) {
<ide> completionCallback.run();
<ide><path>spring-web/src/test/java/org/springframework/web/context/request/async/DeferredResultTests.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> package org.springframework.web.context.request.async;
<ide>
<add>import java.util.function.Consumer;
<add>
<ide> import org.junit.Test;
<ide>
<ide> import org.springframework.web.context.request.async.DeferredResult.DeferredResultHandler;
<ide> public void run() {
<ide> verify(handler).handleResult("timeout result");
<ide> }
<ide>
<add> @Test
<add> public void onError() throws Exception {
<add> final StringBuilder sb = new StringBuilder();
<add>
<add> DeferredResultHandler handler = mock(DeferredResultHandler.class);
<add>
<add> DeferredResult<String> result = new DeferredResult<>(null, "error result");
<add> result.setResultHandler(handler);
<add> Exception e = new Exception();
<add> result.onError(new Consumer<Throwable>() {
<add> @Override
<add> public void accept(Throwable t) {
<add> sb.append("error event");
<add> }
<add> });
<add>
<add> result.getInterceptor().handleError(null, null, e);
<add>
<add> assertEquals("error event", sb.toString());
<add> assertFalse("Should not be able to set result a second time", result.setResult("hello"));
<add> verify(handler).handleResult(e);
<add> }
<add>
<ide> }
<ide><path>spring-web/src/test/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequestTests.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> package org.springframework.web.context.request.async;
<ide>
<ide>
<add>import java.util.function.Consumer;
<add>
<ide> import javax.servlet.AsyncEvent;
<ide>
<ide> import org.junit.Before;
<ide> public void onTimeoutHandler() throws Exception {
<ide> verify(timeoutHandler).run();
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<add> @Test
<add> public void onErrorHandler() throws Exception {
<add> Consumer<Throwable> errorHandler = mock(Consumer.class);
<add> this.asyncRequest.addErrorHandler(errorHandler);
<add> Exception e = new Exception();
<add> this.asyncRequest.onError(new AsyncEvent(new MockAsyncContext(this.request, this.response), e));
<add> verify(errorHandler).accept(e);
<add> }
<add>
<ide> @Test(expected = IllegalStateException.class)
<ide> public void setTimeoutDuringConcurrentHandling() {
<ide> this.asyncRequest.startAsync();
<ide> public void onCompletionHandler() throws Exception {
<ide>
<ide> // SPR-13292
<ide>
<add> @SuppressWarnings("unchecked")
<ide> @Test
<del> public void onCompletionHandlerAfterOnErrorEvent() throws Exception {
<add> public void onErrorHandlerAfterOnErrorEvent() throws Exception {
<add> Consumer<Throwable> handler = mock(Consumer.class);
<add> this.asyncRequest.addErrorHandler(handler);
<add>
<add> this.asyncRequest.startAsync();
<add> Exception e = new Exception();
<add> this.asyncRequest.onError(new AsyncEvent(this.request.getAsyncContext(), e));
<add>
<add> verify(handler).accept(e);
<add> }
<add>
<add> @Test
<add> public void onCompletionHandlerAfterOnCompleteEvent() throws Exception {
<ide> Runnable handler = mock(Runnable.class);
<ide> this.asyncRequest.addCompletionHandler(handler);
<ide>
<ide> this.asyncRequest.startAsync();
<del> this.asyncRequest.onError(new AsyncEvent(this.request.getAsyncContext()));
<add> this.asyncRequest.onComplete(new AsyncEvent(this.request.getAsyncContext()));
<ide>
<ide> verify(handler).run();
<ide> assertTrue(this.asyncRequest.isAsyncComplete());
<ide><path>spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerErrorTests.java
<add>/*
<add> * Copyright 2002-2017 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.context.request.async;
<add>
<add>import java.util.concurrent.Callable;
<add>import java.util.function.Consumer;
<add>
<add>import javax.servlet.AsyncEvent;
<add>
<add>import org.junit.Before;
<add>import org.junit.Test;
<add>import org.springframework.core.task.AsyncTaskExecutor;
<add>import org.springframework.mock.web.test.MockAsyncContext;
<add>import org.springframework.mock.web.test.MockHttpServletRequest;
<add>import org.springframework.mock.web.test.MockHttpServletResponse;
<add>import org.springframework.web.context.request.NativeWebRequest;
<add>
<add>import static org.junit.Assert.*;
<add>import static org.mockito.BDDMockito.*;
<add>import static org.springframework.web.context.request.async.CallableProcessingInterceptor.*;
<add>
<add>/**
<add> * {@link WebAsyncManager} tests where container-triggered error/completion
<add> * events are simulated.
<add> *
<add> * @author Violeta Georgieva
<add> * @since 5.0
<add> */
<add>public class WebAsyncManagerErrorTests {
<add>
<add> private WebAsyncManager asyncManager;
<add>
<add> private StandardServletAsyncWebRequest asyncWebRequest;
<add>
<add> private MockHttpServletRequest servletRequest;
<add>
<add> private MockHttpServletResponse servletResponse;
<add>
<add>
<add> @Before
<add> public void setup() {
<add> this.servletRequest = new MockHttpServletRequest("GET", "/test");
<add> this.servletRequest.setAsyncSupported(true);
<add> this.servletResponse = new MockHttpServletResponse();
<add> this.asyncWebRequest = new StandardServletAsyncWebRequest(servletRequest, servletResponse);
<add>
<add> AsyncTaskExecutor executor = mock(AsyncTaskExecutor.class);
<add>
<add> this.asyncManager = WebAsyncUtils.getAsyncManager(servletRequest);
<add> this.asyncManager.setTaskExecutor(executor);
<add> this.asyncManager.setAsyncWebRequest(this.asyncWebRequest);
<add> }
<add>
<add>
<add> @Test
<add> public void startCallableProcessingErrorAndComplete() throws Exception {
<add> StubCallable callable = new StubCallable();
<add>
<add> CallableProcessingInterceptor interceptor = mock(CallableProcessingInterceptor.class);
<add> Exception e = new Exception();
<add> given(interceptor.handleError(this.asyncWebRequest, callable, e)).willReturn(RESULT_NONE);
<add>
<add> this.asyncManager.registerCallableInterceptor("interceptor", interceptor);
<add> this.asyncManager.startCallableProcessing(callable);
<add>
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add> this.asyncWebRequest.onComplete(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(e, this.asyncManager.getConcurrentResult());
<add>
<add> verify(interceptor).beforeConcurrentHandling(this.asyncWebRequest, callable);
<add> verify(interceptor).afterCompletion(this.asyncWebRequest, callable);
<add> }
<add>
<add> @Test
<add> public void startCallableProcessingErrorAndResumeThroughCallback() throws Exception {
<add>
<add> StubCallable callable = new StubCallable();
<add> WebAsyncTask<Object> webAsyncTask = new WebAsyncTask<>(callable);
<add> webAsyncTask.onError(new Callable<Object>() {
<add> @Override
<add> public Object call() throws Exception {
<add> return 7;
<add> }
<add> });
<add>
<add> this.asyncManager.startCallableProcessing(webAsyncTask);
<add>
<add> Exception e = new Exception();
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(7, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add> }
<add>
<add> @Test
<add> public void startCallableProcessingErrorAndResumeThroughInterceptor() throws Exception {
<add>
<add> StubCallable callable = new StubCallable();
<add>
<add> CallableProcessingInterceptor interceptor = mock(CallableProcessingInterceptor.class);
<add> Exception e = new Exception();
<add> given(interceptor.handleError(this.asyncWebRequest, callable, e)).willReturn(22);
<add>
<add> this.asyncManager.registerCallableInterceptor("errorInterceptor", interceptor);
<add> this.asyncManager.startCallableProcessing(callable);
<add>
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(22, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add>
<add> verify(interceptor).beforeConcurrentHandling(this.asyncWebRequest, callable);
<add> }
<add>
<add> @Test
<add> public void startCallableProcessingAfterException() throws Exception {
<add>
<add> StubCallable callable = new StubCallable();
<add> Exception exception = new Exception();
<add>
<add> CallableProcessingInterceptor interceptor = mock(CallableProcessingInterceptor.class);
<add> Exception e = new Exception();
<add> given(interceptor.handleError(this.asyncWebRequest, callable, e)).willThrow(exception);
<add>
<add> this.asyncManager.registerCallableInterceptor("errorInterceptor", interceptor);
<add> this.asyncManager.startCallableProcessing(callable);
<add>
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(exception, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add>
<add> verify(interceptor).beforeConcurrentHandling(this.asyncWebRequest, callable);
<add> }
<add>
<add> @Test
<add> public void startDeferredResultProcessingErrorAndComplete() throws Exception {
<add>
<add> DeferredResult<Integer> deferredResult = new DeferredResult<>();
<add>
<add> DeferredResultProcessingInterceptor interceptor = mock(DeferredResultProcessingInterceptor.class);
<add> Exception e = new Exception();
<add> given(interceptor.handleError(this.asyncWebRequest, deferredResult, e)).willReturn(true);
<add>
<add> this.asyncManager.registerDeferredResultInterceptor("interceptor", interceptor);
<add> this.asyncManager.startDeferredResultProcessing(deferredResult);
<add>
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add> this.asyncWebRequest.onComplete(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(e, this.asyncManager.getConcurrentResult());
<add>
<add> verify(interceptor).beforeConcurrentHandling(this.asyncWebRequest, deferredResult);
<add> verify(interceptor).preProcess(this.asyncWebRequest, deferredResult);
<add> verify(interceptor).afterCompletion(this.asyncWebRequest, deferredResult);
<add> }
<add>
<add> @Test
<add> public void startDeferredResultProcessingErrorAndResumeWithDefaultResult() throws Exception {
<add>
<add> Exception e = new Exception();
<add> DeferredResult<Throwable> deferredResult = new DeferredResult<>(null, e);
<add> this.asyncManager.startDeferredResultProcessing(deferredResult);
<add>
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(e, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add> }
<add>
<add> @Test
<add> public void startDeferredResultProcessingErrorAndResumeThroughCallback() throws Exception {
<add>
<add> final DeferredResult<Throwable> deferredResult = new DeferredResult<>();
<add> deferredResult.onError(new Consumer<Throwable>() {
<add> @Override
<add> public void accept(Throwable t) {
<add> deferredResult.setResult(t);
<add> }
<add> });
<add>
<add> this.asyncManager.startDeferredResultProcessing(deferredResult);
<add>
<add> Exception e = new Exception();
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(e, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add> }
<add>
<add> @Test
<add> public void startDeferredResultProcessingErrorAndResumeThroughInterceptor() throws Exception {
<add>
<add> DeferredResult<Integer> deferredResult = new DeferredResult<>();
<add>
<add> DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
<add> @Override
<add> public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> result, Throwable t)
<add> throws Exception {
<add> result.setErrorResult(t);
<add> return true;
<add> }
<add> };
<add>
<add> this.asyncManager.registerDeferredResultInterceptor("interceptor", interceptor);
<add> this.asyncManager.startDeferredResultProcessing(deferredResult);
<add>
<add> Exception e = new Exception();
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(e, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add> }
<add>
<add> @Test
<add> public void startDeferredResultProcessingAfterException() throws Exception {
<add>
<add> DeferredResult<Integer> deferredResult = new DeferredResult<>();
<add> final Exception exception = new Exception();
<add>
<add> DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
<add> @Override
<add> public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> result, Throwable t)
<add> throws Exception {
<add> throw exception;
<add> }
<add> };
<add>
<add> this.asyncManager.registerDeferredResultInterceptor("interceptor", interceptor);
<add> this.asyncManager.startDeferredResultProcessing(deferredResult);
<add>
<add> Exception e = new Exception();
<add> AsyncEvent event = new AsyncEvent(new MockAsyncContext(this.servletRequest, this.servletResponse), e);
<add> this.asyncWebRequest.onError(event);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add> assertEquals(e, this.asyncManager.getConcurrentResult());
<add> assertEquals("/test", ((MockAsyncContext) this.servletRequest.getAsyncContext()).getDispatchedPath());
<add> }
<add>
<add>
<add> private final class StubCallable implements Callable<Object> {
<add> @Override
<add> public Object call() throws Exception {
<add> return 21;
<add> }
<add> }
<add>
<add>}
<ide><path>spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTests.java
<ide> package org.springframework.web.context.request.async;
<ide>
<ide> import java.util.concurrent.Callable;
<add>import java.util.function.Consumer;
<add>
<ide> import javax.servlet.http.HttpServletRequest;
<ide>
<ide> import org.junit.Before;
<ide> public void startCallableProcessingCallableException() throws Exception {
<ide> verify(interceptor).postProcess(this.asyncWebRequest, task, concurrentResult);
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<ide> @Test
<ide> public void startCallableProcessingBeforeConcurrentHandlingException() throws Exception {
<ide> Callable<Object> task = new StubCallable(21);
<ide> public void startCallableProcessingBeforeConcurrentHandlingException() throws Ex
<ide> assertFalse(this.asyncManager.hasConcurrentResult());
<ide>
<ide> verify(this.asyncWebRequest).addTimeoutHandler((Runnable) notNull());
<add> verify(this.asyncWebRequest).addErrorHandler((Consumer<Throwable>) notNull());
<ide> verify(this.asyncWebRequest).addCompletionHandler((Runnable) notNull());
<ide> }
<ide>
<ide> public void startCallableProcessingPostProcessContinueAfterException() throws Ex
<ide> verify(interceptor2).preProcess(this.asyncWebRequest, task);
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<ide> @Test
<ide> public void startCallableProcessingWithAsyncTask() throws Exception {
<ide> AsyncTaskExecutor executor = mock(AsyncTaskExecutor.class);
<ide> given(this.asyncWebRequest.getNativeRequest(HttpServletRequest.class)).willReturn(this.servletRequest);
<ide>
<del> @SuppressWarnings("unchecked")
<ide> WebAsyncTask<Object> asyncTask = new WebAsyncTask<>(1000L, executor, mock(Callable.class));
<ide> this.asyncManager.startCallableProcessing(asyncTask);
<ide>
<ide> verify(executor).submit((Runnable) notNull());
<ide> verify(this.asyncWebRequest).setTimeout(1000L);
<ide> verify(this.asyncWebRequest).addTimeoutHandler(any(Runnable.class));
<add> verify(this.asyncWebRequest).addErrorHandler(any(Consumer.class));
<ide> verify(this.asyncWebRequest).addCompletionHandler(any(Runnable.class));
<ide> verify(this.asyncWebRequest).startAsync();
<ide> }
<ide> public void startDeferredResultProcessing() throws Exception {
<ide> verify(this.asyncWebRequest).setTimeout(1000L);
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<ide> @Test
<ide> public void startDeferredResultProcessingBeforeConcurrentHandlingException() throws Exception {
<ide> DeferredResult<Integer> deferredResult = new DeferredResult<>();
<ide> public void startDeferredResultProcessingBeforeConcurrentHandlingException() thr
<ide> assertFalse(this.asyncManager.hasConcurrentResult());
<ide>
<ide> verify(this.asyncWebRequest).addTimeoutHandler((Runnable) notNull());
<add> verify(this.asyncWebRequest).addErrorHandler((Consumer<Throwable>) notNull());
<ide> verify(this.asyncWebRequest).addCompletionHandler((Runnable) notNull());
<ide> }
<ide>
<ide> private void setupDefaultAsyncScenario() {
<ide> given(this.asyncWebRequest.isAsyncComplete()).willReturn(false);
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<ide> private void verifyDefaultAsyncScenario() {
<ide> verify(this.asyncWebRequest).addTimeoutHandler((Runnable) notNull());
<add> verify(this.asyncWebRequest).addErrorHandler((Consumer<Throwable>) notNull());
<ide> verify(this.asyncWebRequest).addCompletionHandler((Runnable) notNull());
<ide> verify(this.asyncWebRequest).startAsync();
<ide> verify(this.asyncWebRequest).dispatch();
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandler.java
<ide> public final void onSubscribe(Subscription subscription) {
<ide> terminate();
<ide> this.emitter.complete();
<ide> });
<add> this.emitter.onError(t -> this.emitter.completeWithError(t));
<ide> subscription.request(1);
<ide> }
<ide>
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitter.java
<ide> import java.io.IOException;
<ide> import java.util.LinkedHashSet;
<ide> import java.util.Set;
<add>import java.util.function.Consumer;
<ide>
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.server.ServerHttpResponse;
<ide> public class ResponseBodyEmitter {
<ide>
<ide> private final DefaultCallback timeoutCallback = new DefaultCallback();
<ide>
<add> private final ErrorCallback errorCallback = new ErrorCallback();
<add>
<ide> private final DefaultCallback completionCallback = new DefaultCallback();
<ide>
<ide>
<ide> synchronized void initialize(Handler handler) throws IOException {
<ide> }
<ide> else {
<ide> this.handler.onTimeout(this.timeoutCallback);
<add> this.handler.onError(this.errorCallback);
<ide> this.handler.onCompletion(this.completionCallback);
<ide> }
<ide> }
<ide> private void sendInternal(Object object, @Nullable MediaType mediaType) throws I
<ide> this.handler.send(object, mediaType);
<ide> }
<ide> catch (IOException ex) {
<del> completeWithError(ex);
<ide> throw ex;
<ide> }
<ide> catch (Throwable ex) {
<del> completeWithError(ex);
<ide> throw new IllegalStateException("Failed to send " + object, ex);
<ide> }
<ide> }
<ide> public synchronized void onTimeout(Runnable callback) {
<ide> this.timeoutCallback.setDelegate(callback);
<ide> }
<ide>
<add> /**
<add> * Register code to invoke when an error occurred while processing the async request.
<add> * This method is called from a container thread when an error occurred while processing
<add> * an async request.
<add> */
<add> public synchronized void onError(Consumer<Throwable> callback) {
<add> this.errorCallback.setDelegate(callback);
<add> }
<add>
<ide> /**
<ide> * Register code to invoke when the async request completes. This method is
<ide> * called from a container thread when an async request completed for any
<ide> interface Handler {
<ide>
<ide> void onTimeout(Runnable callback);
<ide>
<add> void onError(Consumer<Throwable> callback);
<add>
<ide> void onCompletion(Runnable callback);
<ide> }
<ide>
<ide> public void run() {
<ide> }
<ide> }
<ide>
<add>
<add> private class ErrorCallback implements Consumer<Throwable> {
<add>
<add> private Consumer<Throwable> delegate;
<add>
<add> public void setDelegate(Consumer<Throwable> callback) {
<add> this.delegate = callback;
<add> }
<add>
<add> @Override
<add> public void accept(Throwable t) {
<add> ResponseBodyEmitter.this.complete = true;
<add> if (this.delegate != null) {
<add> this.delegate.accept(t);
<add> }
<add> }
<add> }
<add>
<ide> }
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandler.java
<ide> import java.io.IOException;
<ide> import java.io.OutputStream;
<ide> import java.util.List;
<add>import java.util.function.Consumer;
<add>
<ide> import javax.servlet.ServletRequest;
<ide> import javax.servlet.http.HttpServletResponse;
<ide>
<ide> public void onTimeout(Runnable callback) {
<ide> this.deferredResult.onTimeout(callback);
<ide> }
<ide>
<add> @Override
<add> public void onError(Consumer<Throwable> callback) {
<add> this.deferredResult.onError(callback);
<add> }
<add>
<ide> @Override
<ide> public void onCompletion(Runnable callback) {
<ide> this.deferredResult.onCompletion(callback);
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java
<ide> import java.util.List;
<ide> import java.util.Set;
<ide> import java.util.concurrent.atomic.AtomicReference;
<add>import java.util.function.Consumer;
<ide> import java.util.stream.Collectors;
<ide>
<ide> import org.junit.Before;
<ide> public void completeWithError(Throwable failure) {
<ide> public void onTimeout(Runnable callback) {
<ide> }
<ide>
<add> @Override
<add> public void onError(Consumer<Throwable> callback) {
<add> }
<add>
<ide> @Override
<ide> public void onCompletion(Runnable callback) {
<ide> }
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterReturnValueHandlerTests.java
<ide> import java.util.Collections;
<ide> import java.util.List;
<ide> import java.util.concurrent.atomic.AtomicReference;
<add>import java.util.function.Consumer;
<ide>
<ide> import org.junit.Before;
<ide> import org.junit.Test;
<ide> public void responseBodyEmitterWithTimeoutValue() throws Exception {
<ide> verify(asyncWebRequest).startAsync();
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<add> @Test
<add> public void responseBodyEmitterWithErrorValue() throws Exception {
<add>
<add> AsyncWebRequest asyncWebRequest = mock(AsyncWebRequest.class);
<add> WebAsyncUtils.getAsyncManager(this.request).setAsyncWebRequest(asyncWebRequest);
<add>
<add> ResponseBodyEmitter emitter = new ResponseBodyEmitter(19000L);
<add> emitter.onError(mock(Consumer.class));
<add> emitter.onCompletion(mock(Runnable.class));
<add>
<add> MethodParameter type = on(TestController.class).resolveReturnType(ResponseBodyEmitter.class);
<add> this.handler.handleReturnValue(emitter, type, this.mavContainer, this.webRequest);
<add>
<add> verify(asyncWebRequest).addErrorHandler(any(Consumer.class));
<add> verify(asyncWebRequest, times(2)).addCompletionHandler(any(Runnable.class));
<add> verify(asyncWebRequest).startAsync();
<add> }
<add>
<ide> @Test
<ide> public void sseEmitter() throws Exception {
<ide> MethodParameter type = on(TestController.class).resolveReturnType(SseEmitter.class);
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyEmitterTests.java
<ide> public void sendFailsAfterComplete() throws Exception {
<ide> public void sendAfterHandlerInitialized() throws Exception {
<ide> this.emitter.initialize(this.handler);
<ide> verify(this.handler).onTimeout(any());
<add> verify(this.handler).onError(any());
<ide> verify(this.handler).onCompletion(any());
<ide> verifyNoMoreInteractions(this.handler);
<ide>
<ide> public void sendAfterHandlerInitialized() throws Exception {
<ide> public void sendAfterHandlerInitializedWithError() throws Exception {
<ide> this.emitter.initialize(this.handler);
<ide> verify(this.handler).onTimeout(any());
<add> verify(this.handler).onError(any());
<ide> verify(this.handler).onCompletion(any());
<ide> verifyNoMoreInteractions(this.handler);
<ide>
<ide> public void sendAfterHandlerInitializedWithError() throws Exception {
<ide> public void sendWithError() throws Exception {
<ide> this.emitter.initialize(this.handler);
<ide> verify(this.handler).onTimeout(any());
<add> verify(this.handler).onError(any());
<ide> verify(this.handler).onCompletion(any());
<ide> verifyNoMoreInteractions(this.handler);
<ide>
<ide> public void sendWithError() throws Exception {
<ide> // expected
<ide> }
<ide> verify(this.handler).send("foo", MediaType.TEXT_PLAIN);
<del> verify(this.handler).completeWithError(failure);
<ide> verifyNoMoreInteractions(this.handler);
<ide> }
<ide>
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SseEmitterTests.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 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.io.IOException;
<ide> import java.util.ArrayList;
<ide> import java.util.List;
<add>import java.util.function.Consumer;
<ide>
<ide> import org.junit.Before;
<ide> import org.junit.Test;
<ide> public void completeWithError(Throwable failure) {
<ide> public void onTimeout(Runnable callback) {
<ide> }
<ide>
<add> @Override
<add> public void onError(Consumer<Throwable> callback) {
<add> }
<add>
<ide> @Override
<ide> public void onCompletion(Runnable callback) {
<ide> } | 27 |
Ruby | Ruby | fix frozen string usage in odeprecated | 6325db9e37c4ea55ea82a8e6be767b119e403e87 | <ide><path>Library/Homebrew/utils.rb
<ide> def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call
<ide> next unless match = line.match(HOMEBREW_TAP_PATH_REGEX)
<ide>
<ide> tap = Tap.fetch(match[:user], match[:repo])
<del> tap_message = "\nPlease report this to the #{tap} tap"
<add> tap_message = +"\nPlease report this to the #{tap} tap"
<ide> tap_message += ", or even better, submit a PR to fix it" if replacement
<ide> tap_message << ":\n #{line.sub(/^(.*\:\d+)\:.*$/, '\1')}\n\n"
<ide> break | 1 |
Python | Python | fix punctuation in system check | 676aa772234421cbb338cca31b6eaf00a482b47e | <ide><path>rest_framework/checks.py
<ide> def pagination_system_check(app_configs, **kwargs):
<ide> if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS:
<ide> errors.append(
<ide> Warning(
<del> "You have specified a default PAGE_SIZE pagination rest_framework setting,"
<add> "You have specified a default PAGE_SIZE pagination rest_framework setting, "
<ide> "without specifying also a DEFAULT_PAGINATION_CLASS.",
<ide> hint="The default for DEFAULT_PAGINATION_CLASS is None. "
<ide> "In previous versions this was PageNumberPagination. " | 1 |
Ruby | Ruby | escape dep before regexp interpolation | a3863394c0cbf38255d9b71cb589710729bbbcc6 | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_line(line)
<ide> end
<ide>
<ide> def audit_conditional_dep(dep, condition, line)
<add> dep = Regexp.escape(dep)
<ide> case condition
<ide> when /if build\.include\? ['"]with-#{dep}['"]$/, /if build\.with\? ['"]#{dep}['"]$/
<ide> problem %{Replace #{line.inspect} with "depends_on #{quote_dep(dep)} => :optional"} | 1 |
Go | Go | update devicemapper to pass mount flag | ae006493054e524ed35c08863f1713986fe0a22c | <ide><path>daemon/graphdriver/devmapper/driver.go
<ide> package devmapper
<ide>
<ide> import (
<ide> "fmt"
<del> "github.com/dotcloud/docker/daemon/graphdriver"
<del> "github.com/dotcloud/docker/utils"
<ide> "io/ioutil"
<ide> "os"
<ide> "path"
<add>
<add> "github.com/dotcloud/docker/daemon/graphdriver"
<add> "github.com/dotcloud/docker/utils"
<ide> )
<ide>
<ide> func init() {
<ide> func (d *Driver) Get(id, mountLabel string) (string, error) {
<ide> }
<ide>
<ide> // Mount the device
<del> if err := d.DeviceSet.MountDevice(id, mp, ""); err != nil {
<add> if err := d.DeviceSet.MountDevice(id, mp, mountLabel); err != nil {
<ide> return "", err
<ide> }
<ide> | 1 |
Ruby | Ruby | remove trailing whitespace | 3caca406c8cadbd4a42e50bfbb3e2794fd8d985e | <ide><path>activesupport/lib/active_support/whiny_nil.rb
<ide> # classes in NilClass::WHINERS the error message suggests which could be the
<ide> # actual intended class:
<ide> #
<del># $ rails runner nil.destroy
<add># $ rails runner nil.destroy
<ide> # ...
<ide> # You might have expected an instance of ActiveRecord::Base.
<ide> # ... | 1 |
Javascript | Javascript | prefer === to == | 84c448eafbbf968241bc72b5020081fcc0ebc522 | <ide><path>lib/net.js
<ide> function Socket(options) {
<ide> } else if (options.fd !== undefined) {
<ide> this._handle = createHandle(options.fd);
<ide> this._handle.open(options.fd);
<add> // options.fd can be string (since it user-defined),
<add> // so changing this to === would be semver-major
<add> // See: https://github.com/nodejs/node/pull/11513
<ide> if ((options.fd == 1 || options.fd == 2) &&
<ide> (this._handle instanceof Pipe) &&
<ide> process.platform === 'win32') {
<ide> function afterConnect(status, handle, req, readable, writable) {
<ide> self.connecting = false;
<ide> self._sockname = null;
<ide>
<del> if (status == 0) {
<add> if (status === 0) {
<ide> self.readable = readable;
<ide> self.writable = writable;
<ide> self._unrefTimer(); | 1 |
Text | Text | update readme with charter | f31d0fc964239d8275bc71b8112d9f5f675813d3 | <ide><path>README.md
<del>Immutable collections for JavaScript
<del>====================================
<add>Immutable collections for JavaScript: Community Maintained Edition
<add>==================================================================
<ide>
<del>[](https://travis-ci.org/facebook/immutable-js) [](https://gitter.im/immutable-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<add>This is a fork of Immutable-JS intended to serve has home to active development
<add>during the period (February 2019 - ???) when Immutable.js has no active
<add>maintainers. If all goes well this repository will be deprecated and merged
<add>back into the main immutable repository as soon as that repository has active
<add>maintainers.
<add>
<add>The present scope of this fork is limited to the bug fixes and polish necessary to
<add>make the long-awaited `immutable@4.0` release.
<add>
<add>This repo will be released under the npm package name `immutable-oss`.
<add>
<add>[](https://travis-ci.org/immutable-js-oss/immutable-js) [](https://gitter.im/immutable-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<ide>
<ide> [Immutable][] data cannot be changed once created, leading to much simpler
<ide> application development, no defensive copying, and enabling advanced memoization | 1 |
Javascript | Javascript | use relative imports in ember-template-compiler | c56e2152b4d01b38a4c4e227e8e4ca295fb46da0 | <ide><path>packages/ember-template-compiler/lib/plugins/assert-reserved-named-arguments.js
<ide> import { assert } from 'ember-metal/debug';
<del>import calculateLocationDisplay from 'ember-template-compiler/system/calculate-location-display';
<add>import calculateLocationDisplay from '../system/calculate-location-display';
<ide>
<ide> export default function AssertReservedNamedArguments(options) {
<ide> this.syntax = null;
<ide><path>packages/ember-template-compiler/lib/plugins/deprecate-render-model.js
<ide> import { deprecate } from 'ember-metal/debug';
<ide> import calculateLocationDisplay from
<del> 'ember-template-compiler/system/calculate-location-display';
<add> '../system/calculate-location-display';
<ide>
<ide> export default function DeprecateRenderModel(options) {
<ide> this.syntax = null;
<ide><path>packages/ember-template-compiler/lib/plugins/index.js
<del>import TransformOldBindingSyntax from 'ember-template-compiler/plugins/transform-old-binding-syntax';
<del>import TransformItemClass from 'ember-template-compiler/plugins/transform-item-class';
<del>import TransformAngleBracketComponents from 'ember-template-compiler/plugins/transform-angle-bracket-components';
<del>import TransformInputOnToOnEvent from 'ember-template-compiler/plugins/transform-input-on-to-onEvent';
<del>import TransformTopLevelComponents from 'ember-template-compiler/plugins/transform-top-level-components';
<del>import TransformInlineLinkTo from 'ember-template-compiler/plugins/transform-inline-link-to';
<del>import TransformOldClassBindingSyntax from 'ember-template-compiler/plugins/transform-old-class-binding-syntax';
<del>import DeprecateRenderModel from 'ember-template-compiler/plugins/deprecate-render-model';
<del>import AssertReservedNamedArguments from 'ember-template-compiler/plugins/assert-reserved-named-arguments';
<add>import TransformOldBindingSyntax from './transform-old-binding-syntax';
<add>import TransformItemClass from './transform-item-class';
<add>import TransformAngleBracketComponents from './transform-angle-bracket-components';
<add>import TransformInputOnToOnEvent from './transform-input-on-to-onEvent';
<add>import TransformTopLevelComponents from './transform-top-level-components';
<add>import TransformInlineLinkTo from './transform-inline-link-to';
<add>import TransformOldClassBindingSyntax from './transform-old-class-binding-syntax';
<add>import DeprecateRenderModel from './deprecate-render-model';
<add>import AssertReservedNamedArguments from './assert-reserved-named-arguments';
<ide>
<ide> export default Object.freeze([
<ide> TransformOldBindingSyntax,
<ide><path>packages/ember-template-compiler/lib/plugins/transform-input-on-to-onEvent.js
<ide> import { deprecate } from 'ember-metal/debug';
<del>import calculateLocationDisplay from 'ember-template-compiler/system/calculate-location-display';
<add>import calculateLocationDisplay from '../system/calculate-location-display';
<ide>
<ide> /**
<ide> @module ember
<ide><path>packages/ember-template-compiler/lib/plugins/transform-old-binding-syntax.js
<ide> import { assert, deprecate } from 'ember-metal/debug';
<del>import calculateLocationDisplay from 'ember-template-compiler/system/calculate-location-display';
<add>import calculateLocationDisplay from '../system/calculate-location-display';
<ide>
<ide> export default function TransformOldBindingSyntax(options) {
<ide> this.syntax = null;
<ide><path>packages/ember-template-compiler/lib/system/bootstrap.js
<ide> */
<ide>
<ide> import EmberError from 'ember-metal/error';
<del>import { compile } from 'ember-template-compiler';
<add>import { compile } from '../index';
<ide> import {
<ide> has as hasTemplate,
<ide> set as registerTemplate | 6 |
Text | Text | add model card for t5-base-squad | 9ddd3a65481ca19280e0715ebc3aa8b9d1e9d939 | <ide><path>model_cards/valhalla/t5-base-squad/README.md
<add># T5 for question-answering
<add>This is T5-base model fine-tuned on SQuAD1.1 for QA using text-to-text approach
<add>
<add>## Model training
<add>This model was trained on colab TPU with 35GB RAM for 4 epochs
<add>
<add>## Results:
<add>| Metric | #Value |
<add>|-------------|---------|
<add>| Exact Match | 81.5610 |
<add>| F1 | 89.9601 |
<add>
<add>## Model in Action 🚀
<add>```
<add>from transformers import AutoModelWithLMHead, AutoTokenizer
<add>
<add>tokenizer = AutoTokenizer.from_pretrained("valhalla/t5-base-squad")
<add>model = AutoModelWithLMHead.from_pretrained("valhalla/t5-base-squad")
<add>
<add>def get_answer(question, context):
<add> input_text = "question: %s context: %s </s>" % (question, context)
<add> features = tokenizer.batch_encode_plus([input_text], return_tensors='pt')
<add>
<add> out = model.generate(input_ids=features['input_ids'],
<add> attention_mask=features['attention_mask'])
<add>
<add> return tokenizer.decode(out[0])
<add>
<add>context = "In Norse mythology, Valhalla is a majestic, enormous hall located in Asgard, ruled over by the god Odin."
<add>question = "What is Valhalla ?"
<add>
<add>get_answer(question, context)
<add># output: 'a majestic, enormous hall located in Asgard, ruled over by the god Odin'
<add>```
<add>Play with this model [](https://colab.research.google.com/drive/1a5xpJiUjZybfU9Mi-aDkOp116PZ9-wni?usp=sharing)
<add>
<add>> Created by Suraj Patil [](https://github.com/patil-suraj/)
<add>[](https://twitter.com/psuraj28) | 1 |
Text | Text | add changelog for [ci skip] | 7709ea3d59b049d8b566763a823befc212724dc3 | <ide><path>actionview/CHANGELOG.md
<ide>
<ide> *Peter Schilling*, *Matthew Draper*
<ide>
<add>* Add `:skip_pipeline` option to several asset tag helpers
<add>
<add> `javascript_include_tag`, `stylesheet_link_tag`, `favicon_link_tag`,
<add> `image_tag` and `audio_tag` now accept a `:skip_pipeline` option which can
<add> be set to true to bypass the asset pipeline and serve the assets from the
<add> public folder.
<add>
<add> *Richard Schneeman*
<add>
<add>* Add `:poster_skip_pipeline` option to the `video_tag` helper
<add>
<add> `video_tag` now accepts a `:poster_skip_pipeline` option which can be used
<add> in combination with the `:poster` option to bypass the asset pipeline and
<add> serve the poster image for the video from the public folder.
<add>
<add> *Richard Schneeman*
<add>
<ide> * Show cache hits and misses when rendering partials.
<ide>
<ide> Partials using the `cache` helper will show whether a render hit or missed | 1 |
Text | Text | change links to https in benchmark guide | 0b57175813831e7f748475e0ed9bb7adfb54826c | <ide><path>doc/guides/writing-and-running-benchmarks.md
<ide> Supported options keys are:
<ide> [autocannon]: https://github.com/mcollina/autocannon
<ide> [wrk]: https://github.com/wg/wrk
<ide> [t-test]: https://en.wikipedia.org/wiki/Student%27s_t-test#Equal_or_unequal_sample_sizes.2C_unequal_variances
<del>[git-for-windows]: http://git-scm.com/download/win
<del>[nghttp2.org]: http://nghttp2.org
<add>[git-for-windows]: https://git-scm.com/download/win
<add>[nghttp2.org]: https://nghttp2.org
<ide> [benchmark-ci]: https://github.com/nodejs/benchmarking/blob/master/docs/core_benchmarks.md | 1 |
Ruby | Ruby | fix typo in apparently-dead will_unload? method | 582bff71c465075d01b6e062d64b13ac3df4ad56 | <ide><path>activesupport/lib/active_support/dependencies.rb
<ide> def autoloaded?(desc)
<ide>
<ide> # Will the provided constant descriptor be unloaded?
<ide> def will_unload?(const_desc)
<del> autoloaded?(desc) ||
<add> autoloaded?(const_desc) ||
<ide> explicitly_unloadable_constants.include?(to_constant_name(const_desc))
<ide> end
<ide> | 1 |
Python | Python | allow extra args on pretrain and debug_data | 5e683d03fea143c5000a9e4fd1e8f30919ec9bfc | <ide><path>spacy/cli/debug_data.py
<ide> BLANK_MODEL_THRESHOLD = 2000
<ide>
<ide>
<del>@app.command("debug-data")
<add>@app.command(
<add> "debug-data",
<add> context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
<add>)
<ide> def debug_data_cli(
<ide> # fmt: off
<ide> ctx: typer.Context, # This is only used to read additional arguments
<ide><path>spacy/cli/pretrain.py
<ide> from .. import util
<ide>
<ide>
<del>@app.command("pretrain")
<add>@app.command(
<add> "pretrain",
<add> context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
<add>)
<ide> def pretrain_cli(
<ide> # fmt: off
<ide> ctx: typer.Context, # This is only used to read additional arguments | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.