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
|
|---|---|---|---|---|---|
Javascript
|
Javascript
|
use a string instead of an array in renderbuffer
|
da77c583999a93abb3f53eef07d0a90fd51d6113
|
<ide><path>packages/ember-views/lib/system/render_buffer.js
<ide> Ember.RenderBuffer = function(tagName) {
<ide>
<ide> Ember._RenderBuffer = function(tagName) {
<ide> this.tagNames = [tagName || null];
<del> this.buffer = [];
<add> this.buffer = "";
<ide> };
<ide>
<ide> Ember._RenderBuffer.prototype =
<ide> Ember._RenderBuffer.prototype =
<ide> @chainable
<ide> */
<ide> push: function(string) {
<del> this.buffer.push(string);
<add> this.buffer += string;
<ide> return this;
<ide> },
<ide>
<ide> Ember._RenderBuffer.prototype =
<ide> style = this.elementStyle,
<ide> attr, prop;
<ide>
<del> buffer.push('<' + tagName);
<add> buffer += '<' + tagName;
<ide>
<ide> if (id) {
<del> buffer.push(' id="' + this._escapeAttribute(id) + '"');
<add> buffer += ' id="' + this._escapeAttribute(id) + '"';
<ide> this.elementId = null;
<ide> }
<ide> if (classes) {
<del> buffer.push(' class="' + this._escapeAttribute(classes.join(' ')) + '"');
<add> buffer += ' class="' + this._escapeAttribute(classes.join(' ')) + '"';
<ide> this.classes = null;
<ide> }
<ide>
<ide> if (style) {
<del> buffer.push(' style="');
<add> buffer += ' style="';
<ide>
<ide> for (prop in style) {
<ide> if (style.hasOwnProperty(prop)) {
<del> buffer.push(prop + ':' + this._escapeAttribute(style[prop]) + ';');
<add> buffer += prop + ':' + this._escapeAttribute(style[prop]) + ';';
<ide> }
<ide> }
<ide>
<del> buffer.push('"');
<add> buffer += '"';
<ide>
<ide> this.elementStyle = null;
<ide> }
<ide>
<ide> if (attrs) {
<ide> for (attr in attrs) {
<ide> if (attrs.hasOwnProperty(attr)) {
<del> buffer.push(' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"');
<add> buffer += ' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"';
<ide> }
<ide> }
<ide>
<ide> Ember._RenderBuffer.prototype =
<ide> var value = props[prop];
<ide> if (value || typeof(value) === 'number') {
<ide> if (value === true) {
<del> buffer.push(' ' + prop + '="' + prop + '"');
<add> buffer += ' ' + prop + '="' + prop + '"';
<ide> } else {
<del> buffer.push(' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"');
<add> buffer += ' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"';
<ide> }
<ide> }
<ide> }
<ide> Ember._RenderBuffer.prototype =
<ide> this.elementProperties = null;
<ide> }
<ide>
<del> buffer.push('>');
<add> buffer += '>';
<add> this.buffer = buffer;
<ide> },
<ide>
<ide> pushClosingTag: function() {
<ide> var tagName = this.tagNames.pop();
<del> if (tagName) { this.buffer.push('</' + tagName + '>'); }
<add> if (tagName) { this.buffer += '</' + tagName + '>'; }
<ide> },
<ide>
<ide> currentTagName: function() {
<ide> Ember._RenderBuffer.prototype =
<ide> },
<ide>
<ide> innerString: function() {
<del> return this.buffer.join('');
<add> return this.buffer;
<ide> },
<ide>
<ide> _escapeAttribute: function(value) {
| 1
|
Python
|
Python
|
add a unit test for spacing/nextafter equivalence
|
0ccabc7abbd446ea5ce0b301db2e33392f734fe6
|
<ide><path>numpy/core/tests/test_umath.py
<ide> def test_nextafter():
<ide> assert np.isnan(np.nextafter(one, np.nan))
<ide> assert np.nextafter(one, one) == one
<ide>
<add>def test_nextafter_vs_spacing():
<add> # XXX: spacing does not handle long double yet
<add> for t in [np.float32, np.float64]:
<add> for _f in [1, 1e-5, 1000]:
<add> f = t(_f)
<add> f1 = t(_f + 1)
<add> assert np.nextafter(f, f1) - f == spacing(f, dtype=t)
<add>
<ide> def test_pos_nan():
<ide> """Check np.nan is a positive nan."""
<ide> assert np.signbit(np.nan) == 0
| 1
|
PHP
|
PHP
|
ignore last few silencers for code sniffer
|
74836a1c301b26e49e07c381c9ae5e494e70154e
|
<ide><path>lib/Cake/Network/CakeResponse.php
<ide> protected function _isActive() {
<ide> * @return boolean
<ide> */
<ide> protected function _clearBuffer() {
<add> //@codingStandardsIgnoreStart
<ide> return @ob_end_clean();
<add> //@codingStandardsIgnoreEnd
<ide> }
<ide>
<ide> /**
<ide> protected function _clearBuffer() {
<ide> * @return void
<ide> */
<ide> protected function _flushBuffer() {
<add> //@codingStandardsIgnoreStart
<ide> @flush();
<ide> @ob_flush();
<add> //@codingStandardsIgnoreEnd
<ide> }
<ide>
<ide> }
| 1
|
Ruby
|
Ruby
|
allow searching casks by name
|
b265d870ed30a97a1c37e9267efe648d661761c0
|
<ide><path>Library/Homebrew/cmd/search.rb
<ide> def search(argv = ARGV)
<ide> return
<ide> end
<ide>
<del> if args.remaining.empty?
<add> if args.remaining.empty? && !args.desc?
<ide> puts Formatter.columns(Formula.full_names.sort)
<del> elsif args.desc?
<del> query = args.remaining.join(" ")
<del> string_or_regex = query_regexp(query)
<del> Descriptions.search(string_or_regex, :desc).print
<del> else
<del> query = args.remaining.join(" ")
<del> string_or_regex = query_regexp(query)
<add> return
<add> end
<ide>
<add> query = args.remaining.join(" ")
<add> string_or_regex = query_regexp(query)
<add>
<add> if args.desc?
<add> search_descriptions(string_or_regex)
<add> else
<ide> remote_results = search_taps(query, silent: true)
<ide>
<ide> local_formulae = search_formulae(string_or_regex)
<ide><path>Library/Homebrew/extend/os/mac/search.rb
<ide>
<ide> module Homebrew
<ide> module Search
<del> def search_casks(string_or_regex)
<del> if string_or_regex.is_a?(String) && string_or_regex.match?(HOMEBREW_TAP_CASK_REGEX)
<del> return begin
<del> [Hbc::CaskLoader.load(string_or_regex).token]
<del> rescue Hbc::CaskUnavailableError
<del> []
<add> module Extension
<add> def search_descriptions(string_or_regex)
<add> super
<add>
<add> puts
<add>
<add> ohai "Casks"
<add> Hbc::Cask.to_a.extend(Searchable)
<add> .search(string_or_regex, &:name)
<add> .each do |cask|
<add> puts "#{Tty.bold}#{cask.token}:#{Tty.reset} #{cask.name.join(", ")}"
<ide> end
<ide> end
<ide>
<del> results = Hbc::Cask.search(string_or_regex, &:token).sort_by(&:token)
<add> def search_casks(string_or_regex)
<add> if string_or_regex.is_a?(String) && string_or_regex.match?(HOMEBREW_TAP_CASK_REGEX)
<add> return begin
<add> [Hbc::CaskLoader.load(string_or_regex).token]
<add> rescue Hbc::CaskUnavailableError
<add> []
<add> end
<add> end
<ide>
<del> results.map do |cask|
<del> if cask.installed?
<del> pretty_installed(cask.token)
<del> else
<del> cask.token
<add> results = Hbc::Cask.search(string_or_regex, &:token).sort_by(&:token)
<add>
<add> results.map do |cask|
<add> if cask.installed?
<add> pretty_installed(cask.token)
<add> else
<add> cask.token
<add> end
<ide> end
<ide> end
<ide> end
<add>
<add> prepend Extension
<ide> end
<ide> end
<ide><path>Library/Homebrew/search.rb
<ide> def query_regexp(query)
<ide> raise "#{query} is not a valid regex."
<ide> end
<ide>
<add> def search_descriptions(string_or_regex)
<add> ohai "Formulae"
<add> Descriptions.search(string_or_regex, :desc).print
<add> end
<add>
<ide> def search_taps(query, silent: false)
<ide> if query.match?(Regexp.union(HOMEBREW_TAP_FORMULA_REGEX, HOMEBREW_TAP_CASK_REGEX))
<ide> _, _, query = query.split("/", 3)
| 3
|
PHP
|
PHP
|
remove prefix from tagged cache get. unnecessary
|
5281856203bdafc48025b2c4bf6dfef0a5496678
|
<ide><path>src/Illuminate/Cache/TaggedCache.php
<ide> public function forever($key, $value)
<ide> * Remove an item from the cache.
<ide> *
<ide> * @param string $key
<del> * @return void
<add> * @return bool
<ide> */
<ide> public function forget($key)
<ide> {
<del> $this->store->forget($this->taggedItemKey($key));
<add> return $this->store->forget($this->taggedItemKey($key));
<ide> }
<ide>
<ide> /**
<ide> public function rememberForever($key, Closure $callback)
<ide> */
<ide> public function taggedItemKey($key)
<ide> {
<del> return $this->getPrefix().sha1($this->tags->getNamespace()).':'.$key;
<add> return sha1($this->tags->getNamespace()).':'.$key;
<ide> }
<ide>
<ide> /**
| 1
|
Ruby
|
Ruby
|
improve readability of some specs
|
3b0c1ef9c4b4a255d5069316f05338e404d5bd96
|
<ide><path>railties/test/generators/app_generator_test.rb
<ide> def test_web_console_with_edge_option
<ide> end
<ide>
<ide> def test_generation_runs_bundle_install
<del> assert_generates_with_bundler
<add> generator([destination_root], {})
<add>
<add> assert_bundler_command_called("install")
<ide> end
<ide>
<ide> def test_dev_option
<del> assert_generates_with_bundler dev: true
<add> generator([destination_root], dev: true)
<add>
<add> assert_bundler_command_called("install")
<ide> rails_path = File.expand_path("../../..", Rails.root)
<ide> assert_file "Gemfile", /^gem\s+["']rails["'],\s+path:\s+["']#{Regexp.escape(rails_path)}["']$/
<ide> end
<ide>
<ide> def test_edge_option
<del> assert_generates_with_bundler edge: true
<add> generator([destination_root], edge: true)
<add>
<add> assert_bundler_command_called("install")
<ide> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["']$}
<ide> end
<ide>
<ide> def assert_no_listen_related_configuration
<ide> end
<ide> end
<ide>
<del> def assert_generates_with_bundler(options = {})
<del> generator([destination_root], options)
<del>
<del> assert_bundler_command_called("install")
<del> end
<del>
<ide> def assert_bundler_command_called(target_command)
<ide> command_check = -> command do
<ide> @command_called ||= 0
| 1
|
Java
|
Java
|
add a datevalue headerresultmatcher
|
cf2aed9d005686a7955c2ccfd42c07526b24fbd3
|
<ide><path>spring-test/src/main/java/org/springframework/test/web/servlet/result/HeaderResultMatchers.java
<ide> import static org.hamcrest.MatcherAssert.*;
<ide> import static org.springframework.test.util.AssertionErrors.*;
<ide>
<add>import java.text.SimpleDateFormat;
<add>import java.util.Date;
<add>import java.util.Locale;
<add>import java.util.TimeZone;
<add>
<ide> /**
<ide> * Factory for response header assertions.
<ide> * <p>An instance of this class is usually accessed via
<ide> * {@link MockMvcResultMatchers#header}.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @author Sam Brannen
<add> * @author Brian Clozel
<ide> * @since 3.2
<ide> */
<ide> public class HeaderResultMatchers {
<ide> public void match(MvcResult result) {
<ide> };
<ide> }
<ide>
<add> /**
<add> * Assert the primary value of the named response header as a date String,
<add> * using the preferred date format described in RFC 7231.
<add> * <p>The {@link ResultMatcher} returned by this method throws an {@link AssertionError}
<add> * if the response does not contain the specified header, or if the supplied
<add> * {@code value} does not match the primary value.
<add> *
<add> * @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.1">Section 7.1.1.1 of RFC 7231</a>
<add> * @since 4.2
<add> */
<add> public ResultMatcher dateValue(final String name, final long value) {
<add> return new ResultMatcher() {
<add> @Override
<add> public void match(MvcResult result) {
<add> SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
<add> format.setTimeZone(TimeZone.getTimeZone("GMT"));
<add> assertTrue("Response does not contain header " + name, result.getResponse().containsHeader(name));
<add> assertEquals("Response header " + name, format.format(new Date(value)), result.getResponse().getHeader(name));
<add> }
<add> };
<add> }
<add>
<ide> }
<ide><path>spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/HeaderAssertionTests.java
<ide> import org.junit.Before;
<ide> import org.junit.Test;
<ide>
<add>import org.springframework.http.ResponseEntity;
<ide> import org.springframework.stereotype.Controller;
<ide> import org.springframework.test.web.Person;
<ide> import org.springframework.test.web.servlet.MockMvc;
<ide> import org.springframework.test.web.servlet.ResultMatcher;
<ide> import org.springframework.web.bind.annotation.PathVariable;
<ide> import org.springframework.web.bind.annotation.RequestMapping;
<del>import org.springframework.web.bind.annotation.ResponseBody;
<ide> import org.springframework.web.context.request.WebRequest;
<ide>
<ide> import static org.hamcrest.CoreMatchers.*;
<ide> import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
<ide> import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
<ide>
<add>import java.text.SimpleDateFormat;
<add>import java.util.Date;
<add>import java.util.Locale;
<add>import java.util.TimeZone;
<add>
<ide> /**
<ide> * Examples of expectations on response header values.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @author Sam Brannen
<add> * @author Brian Clozel
<ide> */
<ide> public class HeaderAssertionTests {
<ide>
<ide> public class HeaderAssertionTests {
<ide>
<ide> private final long currentTime = System.currentTimeMillis();
<ide>
<add> private String now;
<add>
<add> private String oneMinuteAgo;
<add>
<add> private String oneSecondLater;
<add>
<ide> private MockMvc mockMvc;
<ide>
<ide> private PersonController personController;
<ide>
<ide>
<ide> @Before
<ide> public void setup() {
<add> SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
<add> dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
<add> this.now = dateFormat.format(new Date(currentTime));
<add> this.oneMinuteAgo = dateFormat.format(new Date(currentTime - (1000 * 60)));
<add> this.oneSecondLater = dateFormat.format(new Date(currentTime + 1000));
<ide> this.personController = new PersonController();
<ide> this.personController.setStubTimestamp(currentTime);
<ide> this.mockMvc = standaloneSetup(this.personController).build();
<ide> }
<ide>
<ide> @Test
<ide> public void stringWithCorrectResponseHeaderValue() throws Exception {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))//
<del> .andExpect(header().string(LAST_MODIFIED, String.valueOf(currentTime)));
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, oneMinuteAgo))//
<add> .andExpect(header().string(LAST_MODIFIED, now));
<ide> }
<ide>
<ide> @Test
<ide> public void stringWithMatcherAndCorrectResponseHeaderValue() throws Exception {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))//
<del> .andExpect(header().string(LAST_MODIFIED, equalTo(String.valueOf(currentTime))));
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, oneMinuteAgo))//
<add> .andExpect(header().string(LAST_MODIFIED, equalTo(now)));
<add> }
<add>
<add> @Test
<add> public void dateValueWithCorrectResponseHeaderValue() throws Exception {
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, oneMinuteAgo))//
<add> .andExpect(header().dateValue(LAST_MODIFIED, currentTime));
<ide> }
<ide>
<ide> @Test
<ide> public void longValueWithCorrectResponseHeaderValue() throws Exception {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))//
<del> .andExpect(header().longValue(LAST_MODIFIED, currentTime));
<add> this.mockMvc.perform(get("/persons/1"))//
<add> .andExpect(header().longValue("X-Rate-Limiting", 42));
<ide> }
<ide>
<ide> @Test
<ide> public void stringWithMissingResponseHeader() throws Exception {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime))//
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, now))//
<ide> .andExpect(status().isNotModified())//
<ide> .andExpect(header().string("X-Custom-Header", (String) null));
<ide> }
<ide>
<ide> @Test
<ide> public void stringWithMatcherAndMissingResponseHeader() throws Exception {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime))//
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, now))//
<ide> .andExpect(status().isNotModified())//
<ide> .andExpect(header().string("X-Custom-Header", nullValue()));
<ide> }
<ide>
<ide> @Test
<ide> public void longValueWithMissingResponseHeader() throws Exception {
<ide> try {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime))//
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, now))//
<ide> .andExpect(status().isNotModified())//
<ide> .andExpect(header().longValue("X-Custom-Header", 99L));
<ide>
<ide> public void doesNotExistFail() throws Exception {
<ide>
<ide> @Test
<ide> public void stringWithIncorrectResponseHeaderValue() throws Exception {
<del> long unexpected = currentTime + 1000;
<del> assertIncorrectResponseHeaderValue(header().string(LAST_MODIFIED, String.valueOf(unexpected)), unexpected);
<add> assertIncorrectResponseHeaderValue(header().string(LAST_MODIFIED, oneSecondLater), oneSecondLater);
<ide> }
<ide>
<ide> @Test
<ide> public void stringWithMatcherAndIncorrectResponseHeaderValue() throws Exception {
<del> long unexpected = currentTime + 1000;
<del> assertIncorrectResponseHeaderValue(header().string(LAST_MODIFIED, equalTo(String.valueOf(unexpected))),
<del> unexpected);
<add> assertIncorrectResponseHeaderValue(header().string(LAST_MODIFIED, equalTo(oneSecondLater)), oneSecondLater);
<ide> }
<ide>
<ide> @Test
<del> public void longValueWithIncorrectResponseHeaderValue() throws Exception {
<add> public void dateValueWithIncorrectResponseHeaderValue() throws Exception {
<ide> long unexpected = currentTime + 1000;
<del> assertIncorrectResponseHeaderValue(header().longValue(LAST_MODIFIED, unexpected), unexpected);
<add> assertIncorrectResponseHeaderValue(header().dateValue(LAST_MODIFIED, unexpected), oneSecondLater);
<ide> }
<ide>
<del> private void assertIncorrectResponseHeaderValue(ResultMatcher resultMatcher, long unexpected) throws Exception {
<add> @Test(expected = AssertionError.class)
<add> public void longValueWithIncorrectResponseHeaderValue() throws Exception {
<add> this.mockMvc.perform(get("/persons/1")).andExpect(header().longValue("X-Rate-Limiting", 1));
<add> }
<add>
<add> private void assertIncorrectResponseHeaderValue(ResultMatcher resultMatcher, String unexpected) throws Exception {
<ide> try {
<del> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, currentTime - (1000 * 60)))//
<add> this.mockMvc.perform(get("/persons/1").header(IF_MODIFIED_SINCE, oneMinuteAgo))//
<ide> .andExpect(resultMatcher);
<ide>
<ide> fail(EXPECTED_ASSERTION_ERROR_MSG);
<ide> private void assertIncorrectResponseHeaderValue(ResultMatcher resultMatcher, lon
<ide> // We don't use assertEquals() since we cannot control the formatting
<ide> // produced by JUnit or Hamcrest.
<ide> assertMessageContains(e, "Response header " + LAST_MODIFIED);
<del> assertMessageContains(e, String.valueOf(unexpected));
<del> assertMessageContains(e, String.valueOf(currentTime));
<add> assertMessageContains(e, unexpected);
<add> assertMessageContains(e, now);
<ide> }
<ide> }
<ide>
<ide> public void setStubTimestamp(long timestamp) {
<ide> }
<ide>
<ide> @RequestMapping("/persons/{id}")
<del> @ResponseBody
<del> public Person showEntity(@PathVariable long id, WebRequest request) {
<del> if (request.checkNotModified(calculateLastModified(id))) {
<del> return null;
<del> }
<del> return new Person("Jason");
<add> public ResponseEntity<Person> showEntity(@PathVariable long id, WebRequest request) {
<add> return ResponseEntity
<add> .ok()
<add> .lastModified(calculateLastModified(id))
<add> .header("X-Rate-Limiting", "42")
<add> .body(new Person("Jason"));
<ide> }
<ide>
<ide> private long calculateLastModified(long id) {
| 2
|
Javascript
|
Javascript
|
avoid repeated creation of a simple regexp object
|
be29fc44e0bbd18563775bf75182a740f2b8332c
|
<ide><path>web/text_layer_builder.js
<ide> var FIND_SCROLL_OFFSET_LEFT = -400;
<ide> var MAX_TEXT_DIVS_TO_RENDER = 100000;
<ide> var RENDER_DELAY = 200; // ms
<ide>
<add>var NonWhitespaceRegexp = /\S/;
<add>
<add>function isAllWhitespace(str) {
<add> return !NonWhitespaceRegexp.test(str);
<add>}
<add>
<ide> /**
<ide> * TextLayerBuilder provides text-selection functionality for the PDF.
<ide> * It does this by creating overlay divs over the PDF text. These divs
<ide> var TextLayerBuilder = (function TextLayerBuilderClosure() {
<ide> var style = styles[geom.fontName];
<ide> var textDiv = document.createElement('div');
<ide> this.textDivs.push(textDiv);
<del> if (!/\S/.test(geom.str)) {
<add> if (isAllWhitespace(geom.str)) {
<ide> textDiv.dataset.isWhitespace = true;
<ide> return;
<ide> }
| 1
|
Text
|
Text
|
add yosuke-furukawa as collaborator
|
2b63bcd247362ec5eb46e235a0eec68d7724a6d7
|
<ide><path>README.md
<ide> information about the governance of the io.js project, see
<ide> * **Johan Bergström** ([@jbergstroem](https://github.com/jbergstroem)) <bugs@bergstroem.nu>
<ide> * **Roman Reiss** ([@silverwind](https://github.com/silverwind)) <me@silverwind.io>
<ide> * **Petka Antonov** ([@petkaantonov](https://github.com/petkaanotnov)) <petka_antonov@hotmail.com>
<add>* **Yosuke Furukawa** ([@yosuke-furukawa](https://github.com/yosuke-furukawa)) <yosuke.furukawa@gmail.com>
<ide>
<ide> Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in
<ide> maintaining the io.js project.
| 1
|
Ruby
|
Ruby
|
include wheel in resources
|
7a19eed48d715a9d4456b435b20283123f8f37c0
|
<ide><path>Library/Homebrew/utils/pypi.rb
<ide> def update_python_resources!(formula, version: nil, package_name: nil, extra_pac
<ide>
<ide> extra_packages = (extra_packages || []).map { |p| Package.new p }
<ide> exclude_packages = (exclude_packages || []).map { |p| Package.new p }
<del> exclude_packages += %W[#{main_package.name} argparse pip setuptools wheel wsgiref].map { |p| Package.new p }
<add> exclude_packages += %W[#{main_package.name} argparse pip setuptools wsgiref].map { |p| Package.new p }
<ide> # remove packages from the exclude list if we've explicitly requested them as an extra package
<ide> exclude_packages.delete_if { |package| extra_packages.include?(package) }
<ide>
| 1
|
Javascript
|
Javascript
|
use correct name for custom inspect symbol
|
66d54467c526eb201c029650f778daac7a64b1fa
|
<ide><path>lib/buffer.js
<ide> Buffer.prototype.equals = function equals(b) {
<ide>
<ide>
<ide> // Override how buffers are presented by util.inspect().
<del>Buffer.prototype[internalUtil.inspectSymbol] = function inspect() {
<add>Buffer.prototype[internalUtil.customInspectSymbol] = function inspect() {
<ide> var str = '';
<ide> var max = exports.INSPECT_MAX_BYTES;
<ide> if (this.length > 0) {
<ide> Buffer.prototype[internalUtil.inspectSymbol] = function inspect() {
<ide> }
<ide> return '<' + this.constructor.name + ' ' + str + '>';
<ide> };
<del>Buffer.prototype.inspect = Buffer.prototype[internalUtil.inspectSymbol];
<add>Buffer.prototype.inspect = Buffer.prototype[internalUtil.customInspectSymbol];
<ide>
<ide> Buffer.prototype.compare = function compare(target,
<ide> start,
<ide><path>test/parallel/test-buffer-inspect.js
<ide> assert.doesNotThrow(function() {
<ide> assert.strictEqual(util.inspect(b), expected);
<ide> assert.strictEqual(util.inspect(s), expected);
<ide> });
<add>
<add>b.inspect = undefined;
<add>assert.strictEqual(util.inspect(b), expected);
| 2
|
Python
|
Python
|
update train_parser example
|
3fba897e0f09eeb1a08c836e76d3c99085fd6f76
|
<ide><path>examples/training/train_parser.py
<ide> def train_parser(nlp, train_data, left_labels, right_labels):
<ide> random.shuffle(train_data)
<ide> loss = 0
<ide> for words, heads, deps in train_data:
<del> doc = nlp.make_doc(words)
<add> doc = Doc(nlp.vocab, words=words)
<ide> gold = GoldParse(doc, heads=heads, deps=deps)
<ide> loss += parser.update(doc, gold)
<ide> parser.model.end_training()
<ide> def main(model_dir=None):
<ide> assert model_dir.isdir()
<ide>
<ide> nlp = spacy.load('en', tagger=False, parser=False, entity=False, vectors=False)
<del> nlp.make_doc = lambda words: Doc(nlp.vocab, zip(words, [True]*len(words)))
<ide>
<ide> train_data = [
<ide> (
<ide> def main(model_dir=None):
<ide> right_labels.add(dep)
<ide> parser = train_parser(nlp, train_data, sorted(left_labels), sorted(right_labels))
<ide>
<del> doc = nlp.make_doc(['I', 'like', 'securities', '.'])
<add> doc = Doc(nlp.vocab, words=['I', 'like', 'securities', '.'])
<ide> parser(doc)
<ide> for word in doc:
<ide> print(word.text, word.dep_, word.head.text)
| 1
|
Python
|
Python
|
remove redundant function and fix formatting
|
02d0ac5cab5fecab55d706be36034dce55dbe36d
|
<ide><path>spacy/lang/lex_attrs.py
<ide> def is_punct(text):
<ide> return True
<ide>
<ide>
<del>def is_space(text):
<del> return text.isspace()
<del>
<del>
<ide> def is_ascii(text):
<ide> for char in text:
<ide> if ord(char) >= 128:
<ide> def like_num(text):
<ide> return False
<ide>
<ide>
<del>
<del>
<ide> def is_bracket(text):
<ide> brackets = ('(',')','[',']','{','}','<','>')
<ide> return text in brackets
| 1
|
Ruby
|
Ruby
|
bring tests up-to-date
|
c8d4af5611ee1c8a0927bdf9fe39e6c4af2c22d7
|
<ide><path>Library/Homebrew/test/test_updater.rb
<ide> def test_init_homebrew
<ide> updater = RefreshBrewMock.new
<ide> updater.git_repo = false
<ide> updater.in_prefix_expect("git init")
<del> updater.in_prefix_expect("git pull #{RefreshBrewMock::REPOSITORY_URL} master")
<add> updater.in_prefix_expect("git remote add origin #{RefreshBrewMock::REPOSITORY_URL}")
<add> updater.in_prefix_expect("git fetch origin")
<add> updater.in_prefix_expect("git reset --hard origin/master")
<add> updater.in_prefix_expect("git pull origin refs/heads/master:refs/remotes/origin/master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "1234abcd")
<ide>
<ide> assert_equal false, updater.update_from_masterbrew!
<ide> def test_update_homebrew_without_any_changes
<ide> updater.git_repo = true
<ide> updater.in_prefix_expect("git checkout -q master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "1234abcd")
<del> updater.in_prefix_expect("git pull #{RefreshBrewMock::REPOSITORY_URL} master")
<add> updater.in_prefix_expect("git remote", "origin")
<add> updater.in_prefix_expect("git pull origin refs/heads/master:refs/remotes/origin/master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "3456cdef")
<ide> updater.in_prefix_expect("git diff-tree -r --name-status -z 1234abcd 3456cdef", "")
<ide>
<ide> def test_update_homebrew_without_formulae_changes
<ide>
<ide> updater.in_prefix_expect("git checkout -q master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "1234abcd")
<del> updater.in_prefix_expect("git pull #{RefreshBrewMock::REPOSITORY_URL} master")
<add> updater.in_prefix_expect("git remote", "origin")
<add> updater.in_prefix_expect("git pull origin refs/heads/master:refs/remotes/origin/master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "3456cdef")
<ide> updater.in_prefix_expect("git diff-tree -r --name-status -z 1234abcd 3456cdef", diff_output.gsub(/\s+/, "\0"))
<ide>
<ide> assert_equal true, updater.update_from_masterbrew!
<add> assert updater.expectations_met?
<ide> assert !updater.pending_formulae_changes?
<ide> assert updater.updated_formulae.empty?
<ide> assert updater.added_formulae.empty?
<ide> def test_update_homebrew_with_formulae_changes
<ide>
<ide> updater.in_prefix_expect("git checkout -q master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "1234abcd")
<del> updater.in_prefix_expect("git pull #{RefreshBrewMock::REPOSITORY_URL} master")
<add> updater.in_prefix_expect("git remote", "origin")
<add> updater.in_prefix_expect("git pull origin refs/heads/master:refs/remotes/origin/master")
<ide> updater.in_prefix_expect("git rev-parse HEAD", "3456cdef")
<ide> updater.in_prefix_expect("git diff-tree -r --name-status -z 1234abcd 3456cdef", diff_output.gsub(/\s+/, "\0"))
<ide>
<ide> assert_equal true, updater.update_from_masterbrew!
<add> assert updater.expectations_met?
<ide> assert updater.pending_formulae_changes?
<ide> assert_equal %w{ xar yajl }, updater.updated_formulae
<ide> assert_equal %w{ antiword bash-completion ddrescue dict lua }, updater.added_formulae
| 1
|
Text
|
Text
|
fix translation of counting cards into russian
|
6a30c175d33826d4cb3da41afa6ec748e192e3b6
|
<ide><path>curriculum/challenges/russian/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.russian.md
<ide> id: 565bbe00e9cc8ac0725390f4
<ide> title: Counting Cards
<ide> challengeType: 1
<ide> videoUrl: ''
<del>localeTitle: Счетные карточки
<add>localeTitle: Считаем карты
<ide> ---
<ide>
<ide> ## Description
<del><section id="description"> В игре Blackjack в казино игрок может получить преимущество над домом, отслеживая относительное количество высоких и низких карт, оставшихся в колоде. Это называется <a href="https://en.wikipedia.org/wiki/Card_counting" target="_blank">подсчет карт</a> . Наличие более высоких карт, оставшихся в колоде, способствует игроку. Каждой карте присваивается значение в соответствии с приведенной ниже таблицей. Когда счет положителен, игрок должен делать ставки на высокий уровень. Когда счетчик равен нулю или отрицателен, игрок должен делать ставки на низком уровне. <table class="table table-striped"><thead><tr><th> Изменить счет </th><th> Карты </th></tr></thead><tbody><tr><td> +1 </td><td> 2, 3, 4, 5, 6 </td></tr><tr><td> 0 </td><td> 7, 8, 9 </td></tr><tr><td> -1 </td><td> 10, 'J', 'Q', 'K', 'A' </td></tr></tbody></table> Вы будете писать функцию подсчета карт. Он получит параметр <code>card</code> , который может быть числом или строкой, и увеличивать или уменьшать глобальную переменную <code>count</code> соответствии с значением карты (см. Таблицу). Затем функция вернет строку с текущим счетчиком и строкой <code>Bet</code> если счетчик положителен, или <code>Hold</code> если счетчик равен нулю или отрицателен. Текущий счетчик и решение игрока ( <code>Bet</code> или <code>Hold</code> ) должны быть разделены одним пробелом. <strong>Пример вывода</strong> <br> <code>-3 Hold</code> <br> <code>5 Bet</code> <strong>подсказок</strong> <code>5 Bet</code> <br> НЕ сбрасывайте <code>count</code> до 0, когда значение равно 7, 8 или 9. <br> НЕ возвращать массив. <br> НЕ включайте в выход кавычки (одиночные или двойные). </section>
<add><section id="description"> В игре Blackjack в казино игрок может получить преимущество над домом, отслеживая относительное количество высоких и низких карт, оставшихся в колоде. Это называется <a href="https://en.wikipedia.org/wiki/Card_counting" target="_blank">подсчет карт</a> . Наличие более высоких карт, оставшихся в колоде, способствует игроку. Каждой карте присваивается значение в соответствии с приведенной ниже таблицей. Когда счет положителен, игрок должен делать ставки на высокий уровень. Когда счетчик равен нулю или отрицателен, игрок должен делать ставки на низком уровне. <table class="table table-striped"><thead><tr><th> Изменить счет </th><th> Карты </th></tr></thead><tbody><tr><td> +1 </td><td> 2, 3, 4, 5, 6 </td></tr><tr><td> 0 </td><td> 7, 8, 9 </td></tr><tr><td> -1 </td><td> 10, 'J', 'Q', 'K', 'A' </td></tr></tbody></table> Вы будете писать функцию подсчета карт. Он получит параметр <code>card</code> , который может быть числом или строкой, и увеличивать или уменьшать глобальную переменную <code>count</code> в соответствии с значением карты (см. Таблицу). Затем функция вернет строку с текущим счетчиком и строкой <code>Bet</code> если счетчик положителен, или <code>Hold</code> если счетчик равен нулю или отрицателен. Текущий счетчик и решение игрока ( <code>Bet</code> или <code>Hold</code> ) должны быть разделены одним пробелом. <strong>Пример вывода</strong> <br> <code>-3 Hold</code> <br> <code>5 Bet</code> <strong>подсказок</strong> <code>5 Bet</code> <br> НЕ сбрасывайте <code>count</code> до 0, когда значение равно 7, 8 или 9. <br> НЕ возвращать массив. <br> НЕ включайте в выход кавычки (одиночные или двойные). </section>
<ide>
<ide> ## Instructions
<ide> <section id="instructions">
| 1
|
Java
|
Java
|
remove dup trace_tag_react_apps
|
07153dd8f21a8cfa326d6309dfd7c71a37bbce09
|
<ide><path>ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java
<ide> public class Systrace {
<ide> public static final long TRACE_TAG_REACT_JAVA_BRIDGE = 0L;
<ide> public static final long TRACE_TAG_REACT_APPS = 0L;
<ide> public static final long TRACE_TAG_REACT_FRESCO = 0L;
<del> public static final long TRACE_TAG_REACT_APPS = 0L;
<ide> public static final long TRACE_TAG_REACT_VIEW = 0L;
<ide> public static final long TRACE_TAG_REACT_JSC_CALLS = 0L;
<ide>
| 1
|
Text
|
Text
|
add missed new features in changelog
|
d7cbceb3c83d1cabd500d5cd7656915cb9d65ed2
|
<ide><path>CHANGELOG.md
<ide> https://iojs.org/api/buffer.html
<ide> - Added `Buffer.compare()` which does a `memcmp()` on two Buffer instances. Instances themselves also have a `compare()`.
<ide> - Added `buffer.equals()` that checks equality of Buffers by their contents.
<ide> - `SlowBuffer`'s semantics were tweaked.
<add>- Added `buf.writeUIntLE`, `buf.writeUIntBE`, `buf.writeIntLE`, `buf.writeIntBE`, `buf.readUIntLE`, `buf.readUIntBE`, `buf.readIntLE` and `buf.readIntBE` that read and write value up to 6 bytes.
<ide>
<ide> ### child_process
<ide>
<ide> https://iojs.org/api/path.html
<ide> - Added `path.win32` and `path.posix` objects that contain platform-specific versions of the various `path` functions.
<ide> - `path.join` is now faster.
<ide>
<add>### process
<add>
<add>https://iojs.org/api/process.html
<add>
<add>- Added `process.mainModule` and `process.exitCode`.
<add>- Added `beforeExit` event.
<add>
<ide> ### querystring
<ide>
<ide> https://iojs.org/api/querystring.html
| 1
|
Text
|
Text
|
add directions for subscribing to mailing list
|
ead10917d63fb2385d1a9325e5220ad3e8b81ad4
|
<ide><path>share/doc/homebrew/README.md
<ide> Read [CONTRIBUTING.md](/CONTRIBUTING.md).
<ide>
<ide> ### Community Forums
<ide> - [@MacHomebrew](https://twitter.com/MacHomebrew)
<del>- [homebrew-discuss@googlegroups.com](mailto:homebrew-discuss@googlegroups.com) ([archive](https://groups.google.com/forum/#!forum/homebrew-discuss))
<add>- [homebrew-discuss@googlegroups.com](mailto:homebrew-discuss@googlegroups.com) ([archive](https://groups.google.com/forum/#!forum/homebrew-discuss)) - subscribe by sending a mail to [homebrew-discuss+subscribe@googlegroups.com](mailto:homebrew-discuss+subscribe@googlegroups.com)
<ide> - [freenode.net\#machomebrew](irc://irc.freenode.net/#machomebrew)
<ide>
<ide> ## Supporters
| 1
|
Ruby
|
Ruby
|
remove useless conditional
|
7779e63371d1248bce5f30ebbae43e13ee7abb6a
|
<ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def hash_filter(params, filter)
<ide> # Declaration { user: :name } or { user: [:name, :age, { address: ... }] }.
<ide> params[key] = each_element(value) do |element|
<ide> if element.is_a?(Parameters)
<del> element = self.class.new(element) unless element.respond_to?(:permit)
<ide> element.permit(*Array.wrap(filter[key]))
<ide> end
<ide> end
| 1
|
Go
|
Go
|
add audit_write cap
|
29ecc95c31ecfe15e3b3d8db94cea1c555e526a3
|
<ide><path>daemon/execdriver/native/template/default_template.go
<ide> func New() *libcontainer.Config {
<ide> "NET_BIND_SERVICE",
<ide> "SYS_CHROOT",
<ide> "KILL",
<add> "AUDIT_WRITE",
<ide> },
<ide> Namespaces: map[string]bool{
<ide> "NEWNS": true,
| 1
|
Text
|
Text
|
improve changelog entry
|
05edaa660eb32ce387658d13cc7ea2f4a449ed68
|
<ide><path>actionview/CHANGELOG.md
<del>* Deprecate `AbstractController::Base::parent_prefixes`. Override `AbstractController::Base::local_prefixes` when you want to change where to find views.
<add>* Deprecate `AbstractController::Base.parent_prefixes`.
<add> Override `AbstractController::Base.local_prefixes` when you want to change
<add> where to find views.
<ide>
<ide> *Nick Sutterer*
<ide>
<del>* Take label values into account when doing I18n lookups for model attributes.
<add>* Take label values into account when doing I18n lookups for model attributes.
<ide>
<ide> The following:
<ide>
| 1
|
Go
|
Go
|
remove some redundant fmt.sprintf()'s
|
abaf4b25d749f3ce225719651e4eee160d659f55
|
<ide><path>integration-cli/daemon/daemon.go
<ide> func (d *Daemon) inspectFilter(name, filter string) (string, error) {
<ide> }
<ide>
<ide> func (d *Daemon) inspectFieldWithError(name, field string) (string, error) {
<del> return d.inspectFilter(name, fmt.Sprintf(".%s", field))
<add> return d.inspectFilter(name, "."+field)
<ide> }
<ide>
<ide> // CheckActiveContainerCount returns the number of active containers
<ide><path>integration-cli/docker_utils_test.go
<ide> func inspectFilter(name, filter string) (string, error) {
<ide>
<ide> // Deprecated: use cli.Inspect
<ide> func inspectFieldWithError(name, field string) (string, error) {
<del> return inspectFilter(name, fmt.Sprintf(".%s", field))
<add> return inspectFilter(name, "."+field)
<ide> }
<ide>
<ide> // Deprecated: use cli.Inspect
<ide> func inspectField(c *testing.T, name, field string) string {
<ide> c.Helper()
<del> out, err := inspectFilter(name, fmt.Sprintf(".%s", field))
<add> out, err := inspectFilter(name, "."+field)
<ide> assert.NilError(c, err)
<ide> return out
<ide> }
<ide>
<ide> // Deprecated: use cli.Inspect
<ide> func inspectFieldJSON(c *testing.T, name, field string) string {
<ide> c.Helper()
<del> out, err := inspectFilter(name, fmt.Sprintf("json .%s", field))
<add> out, err := inspectFilter(name, "json ."+field)
<ide> assert.NilError(c, err)
<ide> return out
<ide> }
| 2
|
Text
|
Text
|
move mylesborins to tsc emeritus
|
f00258720bd2f62b11ee164b0cd1853a375f8862
|
<ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Matteo Collina** <<matteo.collina@gmail.com>> (he/him)
<ide> * [mhdawson](https://github.com/mhdawson) -
<ide> **Michael Dawson** <<midawson@redhat.com>> (he/him)
<del>* [MylesBorins](https://github.com/MylesBorins) -
<del> **Myles Borins** <<myles.borins@gmail.com>> (he/him)
<ide> * [RaisinTen](https://github.com/RaisinTen) -
<ide> **Darshan Sen** <<raisinten@gmail.com>> (he/him)
<ide> * [richardlau](https://github.com/richardlau) -
<ide> For information about the governance of the Node.js project, see
<ide> **Mary Marchini** <<oss@mmarchini.me>> (she/her)
<ide> * [mscdex](https://github.com/mscdex) -
<ide> **Brian White** <<mscdex@mscdex.net>>
<add>* [MylesBorins](https://github.com/MylesBorins) -
<add> **Myles Borins** <<myles.borins@gmail.com>> (he/him)
<ide> * [nebrius](https://github.com/nebrius) -
<ide> **Bryan Hughes** <<bryan@nebri.us>>
<ide> * [ofrobots](https://github.com/ofrobots) -
| 1
|
Ruby
|
Ruby
|
inline anemic methods
|
5f50f4d63b3a11a31ae2999053cdaf12134f84ee
|
<ide><path>activestorage/app/models/active_storage/variant.rb
<ide> def processed?
<ide> end
<ide>
<ide> def process
<del> blob.open do |image|
<del> transform(image) { |output| upload(output) }
<add> blob.open do |input|
<add> variation.transform(input, format: format) do |output|
<add> service.upload(key, output)
<add> end
<ide> end
<ide> end
<ide>
<del> def transform(image, &block)
<del> variation.transform(image, format: format, &block)
<del> end
<del>
<del> def upload(file)
<del> service.upload(key, file)
<del> end
<del>
<ide>
<ide> def specification
<ide> @specification ||=
| 1
|
Javascript
|
Javascript
|
remove unused parameter
|
fa64d4a0f3b36fc738128c98862f83cf4ec91ea3
|
<ide><path>src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js
<ide> export default /* glsl */`
<ide>
<ide> #endif
<ide>
<del> vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
<add> vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry ) {
<ide>
<ide> #if defined( ENVMAP_TYPE_CUBE_UV )
<ide>
<ide> export default /* glsl */`
<ide>
<ide> }
<ide>
<del> vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
<add> vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
<ide>
<ide> #if defined( ENVMAP_TYPE_CUBE_UV )
<ide>
<ide><path>src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js
<ide> export default /* glsl */`
<ide>
<ide> #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
<ide>
<del> iblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );
<add> iblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry );
<ide>
<ide> #endif
<ide>
<ide> #endif
<ide>
<ide> #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
<ide>
<del> radiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
<add> radiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness );
<ide>
<ide> #ifdef CLEARCOAT
<ide>
<del> clearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
<add> clearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
<ide>
<ide> #endif
<ide>
| 2
|
Javascript
|
Javascript
|
add examples when calling $http outside $apply
|
2bb0e1a6041a079b4c456eb6bae4ec5a206582eb
|
<ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
<ide> * called for such responses.
<ide> *
<del> * If your $http is scheduled from something that doesn't cause a $digest to fire then your
<del> * request won't be sent immediately. To make sure a $http request if fired immediately, wrap your
<del> * call around with an $scope.$apply(function(){ //make $http request here }
<add> * # Calling $http from outside AngularJS
<add> * The `$http` service will not actually send the request until the next `$digest()` is executed.
<add> * Normally this is not an issue, since almost all the time your call to `$http` will be from within
<add> * a `$apply()` block.
<add> * If you are calling `$http` from outside Angular, then you should wrap it in a call to `$apply`
<add> * to cause a $digest to occur and also to handle errors in the block correctly.
<add> *
<add> * ```
<add> * $scope.$apply(function() {
<add> * $http(...);
<add> * });
<add> * ```
<add> *
<add> * # Writing Unit Tests that use $http
<add> * When unit testing you are mostly responsible for scheduling the `$digest` cycle. If you do not
<add> * trigger a `$digest` before calling `$httpBackend.flush()` then the request will not have been
<add> * made and `$httpBackend.expect(...)` expectations will fail. The solution is to run the code
<add> * that calls the `$http()` method inside a $apply block as explained in the previous section.
<add> *
<add> * ```
<add> * $httpBackend.expectGET(...);
<add> * $scope.$apply(function() {
<add> * $http.get(...);
<add> * });
<add> * $httpBackend.flush();
<add> * ```
<ide> *
<ide> * # Shortcut methods
<ide> *
| 1
|
Ruby
|
Ruby
|
make build_bottle an explicit installer mode
|
42e60f7c59d3c479670d357f7a10356e0b195410
|
<ide><path>Library/Homebrew/cmd/install.rb
<ide> def install_formula f
<ide> fi = FormulaInstaller.new(f)
<ide> fi.ignore_deps = ARGV.ignore_deps? || ARGV.interactive?
<ide> fi.only_deps = ARGV.only_deps?
<add> fi.build_bottle = ARGV.build_bottle?
<ide> fi.prelude
<ide> fi.install
<ide> fi.caveats
<ide><path>Library/Homebrew/extend/ARGV.rb
<ide> def bottle_arch
<ide>
<ide> def build_from_source?
<ide> include? '--build-from-source' or !ENV['HOMEBREW_BUILD_FROM_SOURCE'].nil? \
<del> or build_head? or build_devel? or build_universal? or build_bottle?
<add> or build_head? or build_devel? or build_universal?
<ide> end
<ide>
<ide> def flag? flag
<ide> def filter_for_dependencies
<ide> old_args = clone
<ide>
<ide> flags_to_clear = %w[
<del> --build-bottle
<ide> --debug -d
<ide> --devel
<ide> --interactive -i
<ide><path>Library/Homebrew/formula.rb
<ide> def set_spec(name)
<ide> end
<ide> end
<ide>
<add> def select_bottle?
<add> !ARGV.build_bottle? && install_bottle?(self)
<add> end
<add>
<ide> def determine_active_spec
<ide> case
<ide> when head && ARGV.build_head? then head # --HEAD
<ide> when devel && ARGV.build_devel? then devel # --devel
<del> when bottle && install_bottle?(self) then bottle # bottle available
<add> when bottle && select_bottle? then bottle # bottle available
<ide> when stable then stable
<ide> when devel && stable.nil? then devel # devel-only
<ide> when head && stable.nil? then head # head-only
<ide><path>Library/Homebrew/formula_installer.rb
<ide> def install
<ide>
<ide> return if only_deps
<ide>
<del> if ARGV.build_bottle? && (arch = ARGV.bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch)
<add> if build_bottle && (arch = ARGV.bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch)
<ide> raise "Unrecognized architecture for --bottle-arch: #{arch}"
<ide> end
<ide>
<ide> def install
<ide> opoo "Bottle installation failed: building from source."
<ide> end
<ide>
<del> build_bottle_preinstall if ARGV.build_bottle?
<add> build_bottle_preinstall if build_bottle
<ide>
<ide> unless @poured_bottle
<ide> compute_and_install_dependencies if @pour_failed and not ignore_deps
<ide> build
<ide> clean
<ide> end
<ide>
<del> build_bottle_postinstall if ARGV.build_bottle?
<add> build_bottle_postinstall if build_bottle
<ide>
<ide> opoo "Nothing was installed to #{f.prefix}" unless f.installed?
<ide> end
<ide> def build_time
<ide> def sanitized_ARGV_options
<ide> args = ARGV.options_only
<ide> args.delete "--ignore-dependencies" unless ignore_deps
<add> args.delete "--build-bottle" unless build_bottle
<ide> args
<ide> end
<ide>
| 4
|
Text
|
Text
|
use es6 and webpacker in actioncable guide
|
195da08ef7c187ac2ae743519973701dde4dc5a8
|
<ide><path>guides/source/action_cable_overview.md
<ide> established using the following JavaScript, which is generated by default by Rai
<ide> #### Connect Consumer
<ide>
<ide> ```js
<del>// app/assets/javascripts/cable.js
<del>//= require action_cable
<del>//= require_self
<del>//= require_tree ./channels
<add>// app/javascript/channels/consumer.js
<add>// Action Cable provides the framework to deal with WebSockets in Rails.
<add>// You can generate new channels where WebSocket features live using the `rails generate channel` command.
<ide>
<del>(function() {
<del> this.App || (this.App = {});
<add>import ActionCable from "actioncable"
<ide>
<del> App.cable = ActionCable.createConsumer();
<del>}).call(this);
<add>export default ActionCable.createConsumer()
<ide> ```
<ide>
<ide> This will ready a consumer that'll connect against `/cable` on your server by default.
<ide> you're interested in having.
<ide>
<ide> A consumer becomes a subscriber by creating a subscription to a given channel:
<ide>
<del>```coffeescript
<del># app/assets/javascripts/cable/subscriptions/chat.coffee
<del>App.cable.subscriptions.create { channel: "ChatChannel", room: "Best Room" }
<add>```js
<add>// app/javascript/cable/subscriptions/chat_channel.js
<add>import consumer from "./consumer"
<add>
<add>consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" })
<add>
<add>// app/javascript/cable/subscriptions/appearance_channel.js
<add>import consumer from "./consumer"
<ide>
<del># app/assets/javascripts/cable/subscriptions/appearance.coffee
<del>App.cable.subscriptions.create { channel: "AppearanceChannel" }
<add>consumer.subscriptions.create({ channel: "AppearanceChannel" })
<ide> ```
<ide>
<ide> While this creates the subscription, the functionality needed to respond to
<ide> received data will be described later on.
<ide> A consumer can act as a subscriber to a given channel any number of times. For
<ide> example, a consumer could subscribe to multiple chat rooms at the same time:
<ide>
<del>```coffeescript
<del>App.cable.subscriptions.create { channel: "ChatChannel", room: "1st Room" }
<del>App.cable.subscriptions.create { channel: "ChatChannel", room: "2nd Room" }
<add>```js
<add>// app/javascript/cable/subscriptions/chat_channel.js
<add>import consumer from "./consumer"
<add>
<add>consumer.subscriptions.create({ channel: "ChatChannel", room: "1st Room" })
<add>consumer.subscriptions.create({ channel: "ChatChannel", room: "2nd Room" })
<ide> ```
<ide>
<ide> ## Client-Server Interactions
<ide> When a consumer is subscribed to a channel, they act as a subscriber. This
<ide> connection is called a subscription. Incoming messages are then routed to
<ide> these channel subscriptions based on an identifier sent by the cable consumer.
<ide>
<del>```coffeescript
<del># app/assets/javascripts/cable/subscriptions/chat.coffee
<del># Assumes you've already requested the right to send web notifications
<del>App.cable.subscriptions.create { channel: "ChatChannel", room: "Best Room" },
<del> received: (data) ->
<del> @appendLine(data)
<del>
<del> appendLine: (data) ->
<del> html = @createLine(data)
<del> $("[data-chat-room='Best Room']").append(html)
<del>
<del> createLine: (data) ->
<del> """
<del> <article class="chat-line">
<del> <span class="speaker">#{data["sent_by"]}</span>
<del> <span class="body">#{data["body"]}</span>
<del> </article>
<del> """
<add>```js
<add>// app/javascript/cable/subscriptions/chat_channel.js
<add>// Assumes you've already requested the right to send web notifications
<add>import consumer from "./consumer"
<add>
<add>consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
<add> received(data) {
<add> this.appendLine(data)
<add> },
<add>
<add> appendLine(data) {
<add> const html = this.createLine(data)
<add> const element = document.querySelector("[data-chat-room='Best Room']")
<add> element.insertAdjacentHTML("beforeend", html)
<add> },
<add>
<add> createLine(data) {
<add> return `
<add> <article class="chat-line">
<add> <span class="speaker">${data["sent_by"]}</span>
<add> <span class="body">${data["body"]}</span>
<add> </article>
<add> `
<add> }
<add>})
<ide> ```
<ide>
<ide> ### Passing Parameters to Channels
<ide> end
<ide> An object passed as the first argument to `subscriptions.create` becomes the
<ide> params hash in the cable channel. The keyword `channel` is required:
<ide>
<del>```coffeescript
<del># app/assets/javascripts/cable/subscriptions/chat.coffee
<del>App.cable.subscriptions.create { channel: "ChatChannel", room: "Best Room" },
<del> received: (data) ->
<del> @appendLine(data)
<del>
<del> appendLine: (data) ->
<del> html = @createLine(data)
<del> $("[data-chat-room='Best Room']").append(html)
<del>
<del> createLine: (data) ->
<del> """
<del> <article class="chat-line">
<del> <span class="speaker">#{data["sent_by"]}</span>
<del> <span class="body">#{data["body"]}</span>
<del> </article>
<del> """
<add>```js
<add>// app/javascript/cable/subscriptions/chat_channel.js
<add>import consumer from "./consumer"
<add>
<add>consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
<add> received(data) {
<add> this.appendLine(data)
<add> },
<add>
<add> appendLine(data) {
<add> const html = this.createLine(data)
<add> const element = document.querySelector("[data-chat-room='Best Room']")
<add> element.insertAdjacentHTML("beforeend", html)
<add> },
<add>
<add> createLine(data) {
<add> return `
<add> <article class="chat-line">
<add> <span class="speaker">${data["sent_by"]}</span>
<add> <span class="body">${data["body"]}</span>
<add> </article>
<add> `
<add> }
<add>})
<ide> ```
<ide>
<ide> ```ruby
<ide> class ChatChannel < ApplicationCable::Channel
<ide> end
<ide> ```
<ide>
<del>```coffeescript
<del># app/assets/javascripts/cable/subscriptions/chat.coffee
<del>App.chatChannel = App.cable.subscriptions.create { channel: "ChatChannel", room: "Best Room" },
<del> received: (data) ->
<del> # data => { sent_by: "Paul", body: "This is a cool chat app." }
<add>```js
<add>// app/javascript/cable/subscriptions/chat_channel.js
<add>import consumer from "./consumer"
<add>
<add>const chatChannel = consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, {
<add> received(data) {
<add> // data => { sent_by: "Paul", body: "This is a cool chat app." }
<add> }
<add>}
<ide>
<del>App.chatChannel.send({ sent_by: "Paul", body: "This is a cool chat app." })
<add>chatChannel.send({ sent_by: "Paul", body: "This is a cool chat app." })
<ide> ```
<ide>
<ide> The rebroadcast will be received by all connected clients, _including_ the
<ide> appear/disappear API could be backed by Redis, a database, or whatever else.
<ide>
<ide> Create the client-side appearance channel subscription:
<ide>
<del>```coffeescript
<del># app/assets/javascripts/cable/subscriptions/appearance.coffee
<del>App.cable.subscriptions.create "AppearanceChannel",
<del> # Called when the subscription is ready for use on the server.
<del> connected: ->
<del> @install()
<del> @appear()
<del>
<del> # Called when the WebSocket connection is closed.
<del> disconnected: ->
<del> @uninstall()
<del>
<del> # Called when the subscription is rejected by the server.
<del> rejected: ->
<del> @uninstall()
<del>
<del> appear: ->
<del> # Calls `AppearanceChannel#appear(data)` on the server.
<del> @perform("appear", appearing_on: $("main").data("appearing-on"))
<del>
<del> away: ->
<del> # Calls `AppearanceChannel#away` on the server.
<del> @perform("away")
<del>
<del>
<del> buttonSelector = "[data-behavior~=appear_away]"
<del>
<del> install: ->
<del> $(document).on "turbolinks:load.appearance", =>
<del> @appear()
<del>
<del> $(document).on "click.appearance", buttonSelector, =>
<del> @away()
<del> false
<del>
<del> $(buttonSelector).show()
<del>
<del> uninstall: ->
<del> $(document).off(".appearance")
<del> $(buttonSelector).hide()
<add>```js
<add>// app/javascript/cable/subscriptions/appearance_channel.js
<add>import consumer from "./consumer"
<add>
<add>consumer.subscriptions.create("AppearanceChannel", {
<add> // Called once when the subscription is created.
<add> initialized() {
<add> this.update = this.update.bind(this)
<add> },
<add>
<add> // Called when the subscription is ready for use on the server.
<add> connected() {
<add> this.install()
<add> this.update()
<add> },
<add>
<add> // Called when the WebSocket connection is closed.
<add> disconnected() {
<add> this.uninstall()
<add> },
<add>
<add> // Called when the subscription is rejected by the server.
<add> rejected() {
<add> this.uninstall()
<add> },
<add>
<add> update() {
<add> this.documentIsActive ? this.appear() : this.away()
<add> },
<add>
<add> appear() {
<add> // Calls `AppearanceChannel#appear(data)` on the server.
<add> this.perform("appear", { appearing_on: this.appearingOn })
<add> },
<add>
<add> away() {
<add> // Calls `AppearanceChannel#away` on the server.
<add> this.perform("away")
<add> },
<add>
<add> install() {
<add> window.addEventListener("focus", this.update)
<add> window.addEventListener("blur", this.update)
<add> document.addEventListener("turbolinks:load", this.update)
<add> document.addEventListener("visibilitychange", this.update)
<add> },
<add>
<add> uninstall() {
<add> window.removeEventListener("focus", this.update)
<add> window.removeEventListener("blur", this.update)
<add> document.removeEventListener("turbolinks:load", this.update)
<add> document.removeEventListener("visibilitychange", this.update)
<add> },
<add>
<add> get documentIsActive() {
<add> return document.visibilityState == "visible" && document.hasFocus()
<add> },
<add>
<add> get appearingOn() {
<add> const element = document.querySelector("[data-appearing-on]")
<add> return element ? element.getAttribute("data-appearing-on") : null
<add> }
<add>})
<ide> ```
<ide>
<ide> ##### Client-Server Interaction
<ide> ActionCable.createConsumer("ws://cable.example.com")`. (`cable.js`). The
<ide> **Server** identifies this connection by `current_user`.
<ide>
<ide> 2. **Client** subscribes to the appearance channel via
<del>`App.cable.subscriptions.create(channel: "AppearanceChannel")`. (`appearance.coffee`)
<add>`consumer.subscriptions.create({ channel: "AppearanceChannel" })`. (`appearance_channel.js`)
<ide>
<ide> 3. **Server** recognizes a new subscription has been initiated for the
<ide> appearance channel and runs its `subscribed` callback, calling the `appear`
<ide> method on `current_user`. (`appearance_channel.rb`)
<ide>
<ide> 4. **Client** recognizes that a subscription has been established and calls
<del>`connected` (`appearance.coffee`) which in turn calls `@install` and `@appear`.
<del>`@appear` calls `AppearanceChannel#appear(data)` on the server, and supplies a
<del>data hash of `{ appearing_on: $("main").data("appearing-on") }`. This is
<add>`connected` (`appearance_channel.js`) which in turn calls `install` and `appear`.
<add>`appear` calls `AppearanceChannel#appear(data)` on the server, and supplies a
<add>data hash of `{ appearing_on: this.appearingOn }`. This is
<ide> possible because the server-side channel instance automatically exposes all
<ide> public methods declared on the class (minus the callbacks), so that these can be
<ide> reached as remote procedure calls via a subscription's `perform` method.
<ide> end
<ide>
<ide> Create the client-side web notifications channel subscription:
<ide>
<del>```coffeescript
<del># app/assets/javascripts/cable/subscriptions/web_notifications.coffee
<del># Client-side which assumes you've already requested
<del># the right to send web notifications.
<del>App.cable.subscriptions.create "WebNotificationsChannel",
<del> received: (data) ->
<del> new Notification data["title"], body: data["body"]
<add>```js
<add>// app/javascript/cable/subscriptions/web_notifications_channel.js
<add>// Client-side which assumes you've already requested
<add>// the right to send web notifications.
<add>import consumer from "./consumer"
<add>
<add>consumer.subscriptions.create("WebNotificationsChannel", {
<add> received(data) {
<add> new Notification(data["title"], body: data["body"])
<add> }
<add>})
<ide> ```
<ide>
<ide> Broadcast content to a web notification channel instance from elsewhere in your
<ide> class Application < Rails::Application
<ide> end
<ide> ```
<ide>
<del>You can use `App.cable = ActionCable.createConsumer()` to connect to the cable
<del>server if `action_cable_meta_tag` is invoked in the layout. A custom path is
<del>specified as first argument to `createConsumer` (e.g. `App.cable =
<del>ActionCable.createConsumer("/websocket")`).
<add>You can use `ActionCable.createConsumer()` to connect to the cable
<add>server if `action_cable_meta_tag` is invoked in the layout. Otherwise, A path is
<add>specified as first argument to `createConsumer` (e.g. `ActionCable.createConsumer("/websocket")`).
<ide>
<ide> For every instance of your server you create and for every worker your server
<ide> spawns, you will also have a new instance of Action Cable, but the use of Redis
| 1
|
Text
|
Text
|
use markdown quotes instead <tt> tag
|
d4794fd9d2bd29473c0968eec7054667abdf0c7a
|
<ide><path>guides/source/association_basics.md
<ide> The `create_association` method returns a new object of the associated type. Thi
<ide>
<ide> ##### `create_association!(attributes = {})`
<ide>
<del>Does the same as <tt>create_association</tt> above, but raises <tt>ActiveRecord::RecordInvalid</tt> if the record is invalid.
<add>Does the same as `create_association` above, but raises `ActiveRecord::RecordInvalid` if the record is invalid.
<ide>
<ide>
<ide> #### Options for `belongs_to`
<ide> The `create_association` method returns a new object of the associated type. Thi
<ide>
<ide> ##### `create_association!(attributes = {})`
<ide>
<del>Does the same as <tt>create_association</tt> above, but raises <tt>ActiveRecord::RecordInvalid</tt> if the record is invalid.
<add>Does the same as `create_association` above, but raises `ActiveRecord::RecordInvalid` if the record is invalid.
<ide>
<ide> #### Options for `has_one`
<ide>
<ide> The `collection.create` method returns a new object of the associated type. This
<ide>
<ide> ##### `collection.create!(attributes = {})`
<ide>
<del>Does the same as <tt>collection.create</tt> above, but raises <tt>ActiveRecord::RecordInvalid</tt> if the record is invalid.
<add>Does the same as `collection.create` above, but raises `ActiveRecord::RecordInvalid` if the record is invalid.
<ide>
<ide> #### Options for `has_many`
<ide>
<ide> The `collection.create` method returns a new object of the associated type. This
<ide>
<ide> ##### `collection.create!(attributes = {})`
<ide>
<del>Does the same as <tt>collection.create</tt>, but raises <tt>ActiveRecord::RecordInvalid</tt> if the record is invalid.
<add>Does the same as `collection.create`, but raises `ActiveRecord::RecordInvalid` if the record is invalid.
<ide>
<ide> #### Options for `has_and_belongs_to_many`
<ide>
<ide> Extensions can refer to the internals of the association proxy using these three
<ide>
<ide> * `proxy_association.owner` returns the object that the association is a part of.
<ide> * `proxy_association.reflection` returns the reflection object that describes the association.
<del>* `proxy_association.target` returns the associated object for `belongs_to` or `has_one`, or the collection of associated objects for `has_many` or `has_and_belongs_to_many`.
<ide>\ No newline at end of file
<add>* `proxy_association.target` returns the associated object for `belongs_to` or `has_one`, or the collection of associated objects for `has_many` or `has_and_belongs_to_many`.
| 1
|
Javascript
|
Javascript
|
use `kemptyobject` in various places
|
917fcb20442c449f386efb10134c852f3aa5b7b1
|
<ide><path>lib/internal/blob.js
<ide> const {
<ide> const {
<ide> createDeferredPromise,
<ide> customInspectSymbol: kInspect,
<add> kEmptyObject,
<ide> } = require('internal/util');
<ide> const { inspect } = require('internal/util/inspect');
<ide>
<ide> class Blob {
<ide> * }} [options]
<ide> * @constructs {Blob}
<ide> */
<del> constructor(sources = [], options = {}) {
<add> constructor(sources = [], options = kEmptyObject) {
<ide> if (sources === null ||
<ide> typeof sources[SymbolIterator] !== 'function' ||
<ide> typeof sources === 'string') {
<ide><path>lib/internal/encoding.js
<ide> const kEncoder = Symbol('encoder');
<ide> const {
<ide> getConstructorOf,
<ide> customInspectSymbol: inspect,
<add> kEmptyObject,
<ide> kEnumerableProperty,
<ide> } = require('internal/util');
<ide>
<ide> function makeTextDecoderICU() {
<ide> } = internalBinding('icu');
<ide>
<ide> class TextDecoder {
<del> constructor(encoding = 'utf-8', options = {}) {
<add> constructor(encoding = 'utf-8', options = kEmptyObject) {
<ide> encoding = `${encoding}`;
<ide> validateObject(options, 'options', {
<ide> nullable: true,
<ide> function makeTextDecoderICU() {
<ide> }
<ide>
<ide>
<del> decode(input = empty, options = {}) {
<add> decode(input = empty, options = kEmptyObject) {
<ide> validateDecoder(this);
<ide> if (isAnyArrayBuffer(input)) {
<ide> input = lazyBuffer().from(input);
<ide> function makeTextDecoderJS() {
<ide> }
<ide>
<ide> class TextDecoder {
<del> constructor(encoding = 'utf-8', options = {}) {
<add> constructor(encoding = 'utf-8', options = kEmptyObject) {
<ide> encoding = `${encoding}`;
<ide> validateObject(options, 'options', {
<ide> nullable: true,
<ide> function makeTextDecoderJS() {
<ide> this[kBOMSeen] = false;
<ide> }
<ide>
<del> decode(input = empty, options = {}) {
<add> decode(input = empty, options = kEmptyObject) {
<ide> validateDecoder(this);
<ide> if (isAnyArrayBuffer(input)) {
<ide> input = lazyBuffer().from(input);
<ide><path>lib/internal/histogram.js
<ide> const {
<ide>
<ide> const {
<ide> customInspectSymbol: kInspect,
<add> kEmptyObject,
<ide> } = require('internal/util');
<ide>
<ide> const { inspect } = require('util');
<ide> internalRecordableHistogram.prototype[kDeserialize] = () => {};
<ide> * }} [options]
<ide> * @returns {RecordableHistogram}
<ide> */
<del>function createHistogram(options = {}) {
<add>function createHistogram(options = kEmptyObject) {
<ide> validateObject(options, 'options');
<ide> const {
<ide> lowest = 1,
<ide><path>lib/internal/promise_hooks.js
<ide> const {
<ide> const { setPromiseHooks } = internalBinding('async_wrap');
<ide> const { triggerUncaughtException } = internalBinding('errors');
<ide>
<add>const { kEmptyObject } = require('internal/util');
<ide> const { validatePlainFunction } = require('internal/validators');
<ide>
<ide> const hooks = {
<ide> const onBefore = makeUseHook('before');
<ide> const onAfter = makeUseHook('after');
<ide> const onSettled = makeUseHook('settled');
<ide>
<del>function createHook({ init, before, after, settled } = {}) {
<add>function createHook({ init, before, after, settled } = kEmptyObject) {
<ide> const hooks = [];
<ide>
<ide> if (init) ArrayPrototypePush(hooks, onInit(init));
| 4
|
Javascript
|
Javascript
|
fix typo in test-http2-invalidheaderfield.js
|
7e99dbcf975f309930ba56d5c19248b918fa55ba
|
<ide><path>test/parallel/test-http2-invalidheaderfield.js
<ide> if (!common.hasCrypto) { common.skip('missing crypto'); }
<ide>
<ide> // Check for:
<ide> // Spaced headers
<del>// Psuedo headers
<add>// Pseudo headers
<ide> // Capitalized headers
<ide>
<ide> const http2 = require('http2');
| 1
|
Python
|
Python
|
add option to print loss
|
52372782bebb67001f5a39d35f7bc936d737fcf5
|
<ide><path>official/utils/misc/keras_utils.py
<ide> def on_batch_end(self, batch, logs=None):
<ide> "BenchmarkMetric: {'global step':%d, 'time_taken': %f,"
<ide> "'examples_per_second': %f}" %
<ide> (self.global_steps, elapsed_time, examples_per_second))
<add> tf.compat.v1.logging.info(
<add> "Loss: %f" %
<add> (logs.get('loss')))
<ide> self.start_time = timestamp
<ide>
<ide> def on_epoch_end(self, epoch, logs=None):
| 1
|
Text
|
Text
|
add vision example to readme
|
e630dad555e2021b6217bfb74886e09e3a2e16d0
|
<ide><path>README.md
<ide> To immediately use a model on a given input (text, image, audio, ...), we provid
<ide>
<ide> The second line of code downloads and caches the pretrained model used by the pipeline, while the third evaluates it on the given text. Here the answer is "positive" with a confidence of 99.97%.
<ide>
<del>Many NLP tasks have a pre-trained `pipeline` ready to go. For example, we can easily extract question answers given context:
<add>Many tasks have a pre-trained `pipeline` ready to go, in NLP but also in computer vision and speech. For example, we can easily extract detect objects in an image:
<ide>
<ide> ``` python
<add>>>> import requests
<add>>>> from PIL import Image
<ide> >>> from transformers import pipeline
<ide>
<del># Allocate a pipeline for question-answering
<del>>>> question_answerer = pipeline('question-answering')
<del>>>> question_answerer({
<del>... 'question': 'What is the name of the repository ?',
<del>... 'context': 'Pipeline has been included in the huggingface/transformers repository'
<del>... })
<del>{'score': 0.30970096588134766, 'start': 34, 'end': 58, 'answer': 'huggingface/transformers'}
<del>
<add># Download an image with cute cats
<add>>>> url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/coco_sample.png"
<add>>>> image_data = requests.get(url, stream=True).raw
<add>>>> image = Image.open(image_data)
<add>
<add># Allocate a pipeline for object detection
<add>>>> object_detector = pipeline('object_detection')
<add>>>> object_detector(image)
<add>[{'score': 0.9982201457023621,
<add> 'label': 'remote',
<add> 'box': {'xmin': 40, 'ymin': 70, 'xmax': 175, 'ymax': 117}},
<add> {'score': 0.9960021376609802,
<add> 'label': 'remote',
<add> 'box': {'xmin': 333, 'ymin': 72, 'xmax': 368, 'ymax': 187}},
<add> {'score': 0.9954745173454285,
<add> 'label': 'couch',
<add> 'box': {'xmin': 0, 'ymin': 1, 'xmax': 639, 'ymax': 473}},
<add> {'score': 0.9988006353378296,
<add> 'label': 'cat',
<add> 'box': {'xmin': 13, 'ymin': 52, 'xmax': 314, 'ymax': 470}},
<add> {'score': 0.9986783862113953,
<add> 'label': 'cat',
<add> 'box': {'xmin': 345, 'ymin': 23, 'xmax': 640, 'ymax': 368}}]
<ide> ```
<ide>
<del>In addition to the answer, the pretrained model used here returned its confidence score, along with the start position and end position of the answer in the tokenized sentence. You can learn more about the tasks supported by the `pipeline` API in [this tutorial](https://huggingface.co/docs/transformers/task_summary).
<add>Here we get a list of objects detected in the image, with a box surrounding the object and a confidence score. Here is the original image on the right, with the predictions displayed on the left:
<add>
<add><h3 align="center">
<add> <a><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/coco_sample.png" width="400"></a>
<add> <a><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/coco_sample_post_processed.png" width="400"></a>
<add></h3>
<add>
<add>You can learn more about the tasks supported by the `pipeline` API in [this tutorial](https://huggingface.co/docs/transformers/task_summary).
<ide>
<ide> To download and use any of the pretrained models on your given task, all it takes is three lines of code. Here is the PyTorch version:
<ide> ```python
<ide> To download and use any of the pretrained models on your given task, all it take
<ide> >>> inputs = tokenizer("Hello world!", return_tensors="pt")
<ide> >>> outputs = model(**inputs)
<ide> ```
<add>
<ide> And here is the equivalent code for TensorFlow:
<ide> ```python
<ide> >>> from transformers import AutoTokenizer, TFAutoModel
| 1
|
PHP
|
PHP
|
apply fixes from styleci
|
c2a1fcf81a6a1791575c86e3c68ecf01e5efe077
|
<ide><path>tests/Notifications/NotificationSendQueuedNotificationTest.php
<ide> public function testSerializationOfNormalNotifiable()
<ide> public function testNotificationCanSetMaxExceptions()
<ide> {
<ide> $notifiable = new NotifiableUser;
<del> $notification = new class {
<add> $notification = new class
<add> {
<ide> public $maxExceptions = 23;
<ide> };
<ide>
| 1
|
Text
|
Text
|
reorganize the "following along" instructions
|
1ce562ead352dc139aa622bdce0f40df7070df5e
|
<ide><path>docs/tutorial/tutorial.md
<ide> You can also follow along locally if you don't mind a few extra steps:
<ide>
<ide> 1. Make sure you have a recent version of [Node.js](https://nodejs.org/en/) installed.
<ide> 2. Follow the [installation instructions](/react/docs/installation.html#creating-a-new-application) to create a new project.
<del>3. Replace the contents of `src/index.js` in the generated project with <a href="https://codepen.io/gaearon/pen/JNYBEZ?editors=0010" target="_blank">this JS code</a>.
<del>4. Replace the contents of `src/index.css` in the generated project with <a href="https://codepen.io/gaearon/pen/JNYBEZ?editors=0100" target="_blank">this CSS code</a>.
<del>5. Delete other files in the `src/` folder, and add three lines to the top of `src/index.js`:
<add>3. Delete all files in the `src/` folder of the new project.
<add>4. Add a file named `index.css` in the `src/` folder with <a href="https://codepen.io/gaearon/pen/JNYBEZ?editors=0100" target="_blank">this CSS code</a>.
<add>5. Add a file named `index.js` in the `src/` folder with <a href="https://codepen.io/gaearon/pen/JNYBEZ?editors=0010" target="_blank">this JS code</a>, and then add three lines to the top of it:
<ide>
<ide> ```js
<ide> import React from 'react';
| 1
|
Go
|
Go
|
fix minor typo
|
96d8c3584cedddfc69c01bda3f512d495b21ac47
|
<ide><path>pkg/version/version.go
<ide> func (v Version) compareTo(other Version) int {
<ide> return 0
<ide> }
<ide>
<del>// LessThan checks if a version is less than another version
<add>// LessThan checks if a version is less than another
<ide> func (v Version) LessThan(other Version) bool {
<ide> return v.compareTo(other) == -1
<ide> }
<ide> func (v Version) LessThanOrEqualTo(other Version) bool {
<ide> return v.compareTo(other) <= 0
<ide> }
<ide>
<del>// GreaterThan checks if a version is greater than another one
<add>// GreaterThan checks if a version is greater than another
<ide> func (v Version) GreaterThan(other Version) bool {
<ide> return v.compareTo(other) == 1
<ide> }
<ide>
<del>// GreaterThanOrEqualTo checks ia version is greater than or equal to another
<add>// GreaterThanOrEqualTo checks if a version is greater than or equal to another
<ide> func (v Version) GreaterThanOrEqualTo(other Version) bool {
<ide> return v.compareTo(other) >= 0
<ide> }
| 1
|
Text
|
Text
|
update active job basics [ci skip]
|
3e055671a1059a8bf496d03da1e1800f7143c16f
|
<ide><path>guides/source/active_job_basics.md
<ide> Here is a noncomprehensive list of documentation:
<ide>
<ide> - [Sidekiq](https://github.com/mperham/sidekiq/wiki/Active-Job)
<ide> - [Resque](https://github.com/resque/resque/wiki/ActiveJob)
<add>- [Sneakers](https://github.com/jondot/sneakers/wiki/How-To:-Rails-Background-Jobs-with-ActiveJob)
<ide> - [Sucker Punch](https://github.com/brandonhilkert/sucker_punch#active-job)
<ide> - [Queue Classic](https://github.com/QueueClassic/queue_classic#active-job)
<ide>
| 1
|
Ruby
|
Ruby
|
use formula tap methods
|
6a0720071e32b7e4031db0470bc9fb3056f46a75
|
<ide><path>Library/Homebrew/formula_versions.rb
<ide> def initialize(f)
<ide> end
<ide>
<ide> def repository
<del> @repository ||= if f.path.to_s =~ HOMEBREW_TAP_DIR_REGEX
<del> HOMEBREW_REPOSITORY/"Library/Taps/#$1/#$2"
<add> @repository ||= if f.tap?
<add> HOMEBREW_LIBRARY.join("Taps", f.tap)
<ide> else
<ide> HOMEBREW_REPOSITORY
<ide> end
| 1
|
Javascript
|
Javascript
|
add prop type for view
|
05ec85043b86fa94408e7a72b55123a60c90426c
|
<ide><path>Libraries/Components/AppleTV/TVViewPropTypes.js
<ide> var TVViewPropTypes = {
<ide>
<ide> };
<ide>
<add>export type TVViewProps = {
<add> isTVSelectable?: bool,
<add> hasTVPreferredFocus?: bool,
<add> tvParallaxProperties?: Object,
<add> tvParallaxShiftDistanceX?: number,
<add> tvParallaxShiftDistanceY?: number,
<add> tvParallaxTiltAngle?: number,
<add> tvParallaxMagnification?: number,
<add>};
<add>
<ide> module.exports = TVViewPropTypes;
<ide><path>Libraries/Components/View/View.js
<ide> const NativeMethodsMixin = require('NativeMethodsMixin');
<ide> const NativeModules = require('NativeModules');
<ide> const Platform = require('Platform');
<del>const React = require('React');
<ide> const PropTypes = require('prop-types');
<add>const React = require('React');
<ide> const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags');
<ide> const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
<ide> const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
<ide> const ViewPropTypes = require('ViewPropTypes');
<ide>
<ide> const invariant = require('fbjs/lib/invariant');
<add>const requireNativeComponent = require('requireNativeComponent');
<ide> const warning = require('fbjs/lib/warning');
<ide>
<ide> const {
<ide> AccessibilityComponentTypes,
<ide> AccessibilityTraits,
<ide> } = require('ViewAccessibility');
<ide>
<del>const requireNativeComponent = require('requireNativeComponent');
<del>
<ide> const forceTouchAvailable = (NativeModules.PlatformConstants &&
<ide> NativeModules.PlatformConstants.forceTouchAvailable) || false;
<ide>
<add>import type {ViewProps} from 'ViewPropTypes';
<add>
<add>export type Props = ViewProps;
<add>
<ide> /**
<ide> * The most fundamental component for building a UI, `View` is a container that supports layout with
<ide> * [flexbox](docs/flexbox.html), [style](docs/style.html),
<ide><path>Libraries/Components/View/ViewPropTypes.js
<ide> if (Platform.isTVOS) {
<ide> TVViewPropTypes = require('TVViewPropTypes');
<ide> }
<ide>
<add>import type {
<add> AccessibilityComponentType,
<add> AccessibilityTrait,
<add>} from 'ViewAccessibility';
<add>import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
<add>import type {TVViewProps} from 'TVViewPropTypes';
<add>
<ide> const stylePropType = StyleSheetPropType(ViewStylePropTypes);
<ide>
<add>// There's no easy way to create a different type if(Platform.isTVOS):
<add>// so we must include TVViewProps
<add>export type ViewProps = {
<add> accessible?: bool,
<add> accessibilityLabel?: React$PropType$Primitive<any>,
<add> accessibilityComponentType?: AccessibilityComponentType,
<add> accessibilityLiveRegion?: 'none' | 'polite' | 'assertive',
<add> importantForAccessibility?: 'auto'| 'yes'| 'no'| 'no-hide-descendants',
<add> accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
<add> accessibilityViewIsModal?: bool,
<add> onAccessibilityTap?: Function,
<add> onMagicTap?: Function,
<add> testID?: string,
<add> nativeID?: string,
<add> onResponderGrant?: Function,
<add> onResponderMove?: Function,
<add> onResponderReject?: Function,
<add> onResponderRelease?: Function,
<add> onResponderTerminate?: Function,
<add> onResponderTerminationRequest?: Function,
<add> onStartShouldSetResponder?: Function,
<add> onStartShouldSetResponderCapture?: Function,
<add> onMoveShouldSetResponder?: Function,
<add> onMoveShouldSetResponderCapture?: Function,
<add> hitSlop?: EdgeInsetsProp,
<add> pointerEvents?: 'box-none'| 'none'| 'box-only'| 'auto',
<add> style?: stylePropType,
<add> removeClippedSubviews?: bool,
<add> renderToHardwareTextureAndroid?: bool,
<add> shouldRasterizeIOS?: bool,
<add> collapsable?: bool,
<add> needsOffscreenAlphaCompositing?: bool,
<add>} & TVViewProps;
<add>
<ide> module.exports = {
<ide> ...TVViewPropTypes,
<ide>
<ide><path>Libraries/StyleSheet/EdgeInsetsPropType.js
<ide> */
<ide> 'use strict';
<ide>
<del>var {PropTypes} = require('React');
<del>
<ide> var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
<ide>
<add>var {PropTypes} = require('React');
<add>
<ide> var EdgeInsetsPropType = createStrictShapeTypeChecker({
<ide> top: PropTypes.number,
<ide> left: PropTypes.number,
<ide> bottom: PropTypes.number,
<ide> right: PropTypes.number,
<ide> });
<ide>
<add>export type EdgeInsetsProp = {
<add> top: number,
<add> left: number,
<add> bottom: number,
<add> right: number,
<add>};
<add>
<ide> module.exports = EdgeInsetsPropType;
| 4
|
Text
|
Text
|
add react day berlin
|
79074a805994ed1ff9d2a80e502490f0d67f2702
|
<ide><path>docs/community/conferences.md
<ide> October 25–27, Bratislava, Slovakia
<ide>
<ide> [Website](https://reactiveconf.com)
<ide>
<add>### React Day Berlin
<add>December 2, Berlin, Germany
<add>
<add>[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/)
<add>
<ide> ### AgentConf 2018
<ide> January 25-28 in Dornbirn, Austria
<ide>
| 1
|
Javascript
|
Javascript
|
change devtools hook warning message
|
969f4b5bb8302afb3eb1656784130651047c3718
|
<ide><path>packages/react-devtools-shared/src/__tests__/setupTests.js
<ide> env.beforeEach(() => {
<ide> // $FlowFixMe
<ide> console.error = (...args) => {
<ide> const firstArg = args[0];
<del> if (firstArg === 'Warning: React DevTools encountered an error: %s') {
<add> if (
<add> firstArg === 'Warning: React instrumentation encountered an error: %s'
<add> ) {
<ide> // Rethrow errors from React.
<ide> throw args[1];
<ide> } else if (
<ide><path>packages/react-reconciler/src/ReactFiberDevToolsHook.js
<ide> export function injectInternals(internals: Object): boolean {
<ide> hasLoggedError = true;
<ide> warningWithoutStack(
<ide> false,
<del> 'React DevTools encountered an error: %s',
<add> 'React instrumentation encountered an error: %s',
<ide> err,
<ide> );
<ide> }
<ide> export function injectInternals(internals: Object): boolean {
<ide> hasLoggedError = true;
<ide> warningWithoutStack(
<ide> false,
<del> 'React DevTools encountered an error: %s',
<add> 'React instrumentation encountered an error: %s',
<ide> err,
<ide> );
<ide> }
<ide> export function injectInternals(internals: Object): boolean {
<ide> hasLoggedError = true;
<ide> warningWithoutStack(
<ide> false,
<del> 'React DevTools encountered an error: %s',
<add> 'React instrumentation encountered an error: %s',
<ide> err,
<ide> );
<ide> }
<ide> export function injectInternals(internals: Object): boolean {
<ide> if (__DEV__) {
<ide> warningWithoutStack(
<ide> false,
<del> 'React DevTools encountered an error: %s.',
<add> 'React instrumentation encountered an error: %s.',
<ide> err,
<ide> );
<ide> }
| 2
|
Javascript
|
Javascript
|
fix variable referencing in template string
|
10596b601e503512457131b3a09edadbb680d3ec
|
<ide><path>lib/internal/worker.js
<ide> class Worker extends EventEmitter {
<ide> this[kDispose]();
<ide> if (customErr) {
<ide> debug(`[${threadId}] failing with custom error ${customErr} \
<del> and with reason {customErrReason}`);
<add> and with reason ${customErrReason}`);
<ide> this.emit('error', new errorCodes[customErr](customErrReason));
<ide> }
<ide> this.emit('exit', code);
| 1
|
Javascript
|
Javascript
|
remove side effects from validatesettings
|
ce265908eb84aa0518dcadc57d59e7fbb353a256
|
<ide><path>lib/internal/http2/core.js
<ide> function pingCallback(cb) {
<ide> // 6. enablePush must be a boolean
<ide> // All settings are optional and may be left undefined
<ide> const validateSettings = hideStackFrames((settings) => {
<del> settings = { ...settings };
<add> if (settings === undefined) return;
<ide> assertWithinRange('headerTableSize',
<ide> settings.headerTableSize,
<ide> 0, kMaxInt);
<ide> const validateSettings = hideStackFrames((settings) => {
<ide> throw new ERR_HTTP2_INVALID_SETTING_VALUE('enablePush',
<ide> settings.enablePush);
<ide> }
<del> return settings;
<ide> });
<ide>
<ide> // Creates the internal binding.Http2Session handle for an Http2Session
<ide> class Http2Session extends EventEmitter {
<ide> if (this.destroyed)
<ide> throw new ERR_HTTP2_INVALID_SESSION();
<ide> assertIsObject(settings, 'settings');
<del> settings = validateSettings(settings);
<add> validateSettings(settings);
<ide>
<ide> if (callback && typeof callback !== 'function')
<ide> throw new ERR_INVALID_CALLBACK();
<ide> debug(`Http2Session ${sessionName(this[kType])}: sending settings`);
<ide>
<ide> this[kState].pendingAck++;
<ide>
<del> const settingsFn = submitSettings.bind(this, settings, callback);
<add> const settingsFn = submitSettings.bind(this, { ...settings }, callback);
<ide> if (this.connecting) {
<ide> this.once('connect', settingsFn);
<ide> return;
<ide> function createServer(options, handler) {
<ide> // HTTP2-Settings header frame.
<ide> function getPackedSettings(settings) {
<ide> assertIsObject(settings, 'settings');
<del> updateSettingsBuffer(validateSettings(settings));
<add> validateSettings(settings);
<add> updateSettingsBuffer({ ...settings });
<ide> return binding.packSettings();
<ide> }
<ide>
| 1
|
Text
|
Text
|
fix a typo in util.isdeepstrictequal
|
ff471da1a81b325508b265290f7b49649030f4a6
|
<ide><path>doc/api/util.md
<ide> added: v9.0.0
<ide> * `val2` {any}
<ide> * Returns: {boolean}
<ide>
<del>Returns `true` if there is deep strict equality between `val` and `val2`.
<add>Returns `true` if there is deep strict equality between `val1` and `val2`.
<ide> Otherwise, returns `false`.
<ide>
<ide> See [`assert.deepStrictEqual()`][] for more information about deep strict
| 1
|
PHP
|
PHP
|
fix errors in 24 hour time generation
|
5114160f672d4138187851312bf5a90fb55f0870
|
<ide><path>src/View/Widget/DateTime.php
<ide> protected function _hourSelect($options = []) {
<ide> ];
<ide> $is24 = $options['format'] == 24;
<ide>
<del> $defaultEnd = $is24 ? 24 : 12;
<del> $options['start'] = max(1, $options['start']);
<add> $defaultStart = $is24 ? 0 : 1;
<add> $defaultEnd = $is24 ? 23 : 12;
<add> $options['start'] = max($defaultStart, $options['start']);
<ide>
<ide> $options['end'] = min($defaultEnd, $options['end']);
<ide> if ($options['end'] === null) {
<ide> protected function _hourSelect($options = []) {
<ide> if (!$is24 && $options['val'] > 12) {
<ide> $options['val'] = sprintf('%02d', $options['val'] - 12);
<ide> }
<del> if (!$is24 && $options['val'] == 0) {
<add> if (!$is24 && in_array($options['val'], ['00', '0', 0], true)) {
<ide> $options['val'] = 12;
<ide> }
<ide>
<ide><path>tests/TestCase/View/Widget/DateTimeTest.php
<ide> public function testRenderHourWidget24() {
<ide> 'val' => $now,
<ide> ]);
<ide> $this->assertContains('<select name="date[hour]" data-foo="test">', $result);
<add> $this->assertContains('<option value="00">0</option>', $result);
<ide> $this->assertContains(
<ide> '<option value="01">1</option>',
<ide> $result,
<ide> public function testRenderHourWidget24() {
<ide> $result,
<ide> 'selected value present'
<ide> );
<del> $this->assertContains(
<del> '<option value="24">24</option>',
<del> $result,
<del> 'contains 24 hours'
<del> );
<add> $this->assertContains('<option value="23">23</option>', $result);
<ide> $this->assertNotContains('date[day]', $result, 'No day select.');
<ide> $this->assertNotContains('value="0"', $result, 'No zero hour');
<del> $this->assertNotContains('value="25"', $result, 'No 25th hour');
<add> $this->assertNotContains('value="24"', $result, 'No 25th hour');
<ide> $this->assertNotContains('<select name="date[meridian]">', $result);
<ide> $this->assertNotContains('<option value="pm" selected="selected">pm</option>', $result);
<ide> }
<ide>
<add>/**
<add> * test selecting various options in 24 hr mode.
<add> *
<add> * @return void
<add> */
<add> public function testRenderHour24SelectedValues() {
<add> $now = new \DateTime('2010-09-09 23:00:00');
<add> $data = [
<add> 'name' => 'date',
<add> 'year' => false,
<add> 'month' => false,
<add> 'day' => false,
<add> 'hour' => [],
<add> 'minute' => false,
<add> 'second' => false,
<add> 'val' => $now,
<add> ];
<add> $result = $this->DateTime->render($data);
<add> $this->assertContains('<option value="23" selected="selected">23</option>', $result);
<add>
<add> $data['val'] = '2010-09-09 23:00:00';
<add> $result = $this->DateTime->render($data);
<add> $this->assertContains('<option value="23" selected="selected">23</option>', $result);
<add> }
<add>
<ide> /**
<ide> * Test rendering the hour widget in 12 hour mode.
<ide> *
| 2
|
Python
|
Python
|
add french stopwords
|
1b3b0436606968b7796bf18db37b520332ce2414
|
<ide><path>spacy/fr/language_data.py
<ide> def strings_to_exc(orths):
<ide> }
<ide>
<ide> STOP_WORDS = set("""
<add>a à â abord absolument afin ah ai aie ailleurs ainsi ait allaient allo allons
<add>allô alors anterieur anterieure anterieures apres après as assez attendu au
<add>aucun aucune aujourd aujourd'hui aupres auquel aura auraient aurait auront
<add>aussi autre autrefois autrement autres autrui aux auxquelles auxquels avaient
<add>avais avait avant avec avoir avons ayant
<ide>
<add>bah bas basee bat beau beaucoup bien bigre boum bravo brrr
<add>
<add>ça car ce ceci cela celle celle-ci celle-là celles celles-ci celles-là celui
<add>celui-ci celui-là cent cependant certain certaine certaines certains certes ces
<add>cet cette ceux ceux-ci ceux-là chacun chacune chaque cher chers chez chiche
<add>chut chère chères ci cinq cinquantaine cinquante cinquantième cinquième clac
<add>clic combien comme comment comparable comparables compris concernant contre
<add>couic crac
<add>
<add>da dans de debout dedans dehors deja delà depuis dernier derniere derriere
<add>derrière des desormais desquelles desquels dessous dessus deux deuxième
<add>deuxièmement devant devers devra different differentes differents différent
<add>différente différentes différents dire directe directement dit dite dits divers
<add>diverse diverses dix dix-huit dix-neuf dix-sept dixième doit doivent donc dont
<add>douze douzième dring du duquel durant dès désormais
<add>
<add>effet egale egalement egales eh elle elle-même elles elles-mêmes en encore
<add>enfin entre envers environ es ès est et etaient étaient etais étais etait était
<add>etant étant etc été etre être eu euh eux eux-mêmes exactement excepté extenso
<add>exterieur
<add>
<add>fais faisaient faisant fait façon feront fi flac floc font
<add>
<add>gens
<add>
<add>ha hein hem hep hi ho holà hop hormis hors hou houp hue hui huit huitième hum
<add>hurrah hé hélas i il ils importe
<add>
<add>je jusqu jusque juste
<add>
<add>la laisser laquelle las le lequel les lesquelles lesquels leur leurs longtemps
<add>lors lorsque lui lui-meme lui-même là lès
<add>
<add>ma maint maintenant mais malgre malgré maximale me meme memes merci mes mien
<add>mienne miennes miens mille mince minimale moi moi-meme moi-même moindres moins
<add>mon moyennant multiple multiples même mêmes
<add>
<add>na naturel naturelle naturelles ne neanmoins necessaire necessairement neuf
<add>neuvième ni nombreuses nombreux non nos notamment notre nous nous-mêmes nouveau
<add>nul néanmoins nôtre nôtres
<add>
<add>o ô oh ohé ollé olé on ont onze onzième ore ou ouf ouias oust ouste outre
<add>ouvert ouverte ouverts où
<add>
<add>paf pan par parce parfois parle parlent parler parmi parseme partant
<add>particulier particulière particulièrement pas passé pendant pense permet
<add>personne peu peut peuvent peux pff pfft pfut pif pire plein plouf plus
<add>plusieurs plutôt possessif possessifs possible possibles pouah pour pourquoi
<add>pourrais pourrait pouvait prealable precisement premier première premièrement
<add>pres probable probante procedant proche près psitt pu puis puisque pur pure
<add>
<add>qu quand quant quant-à-soi quanta quarante quatorze quatre quatre-vingt
<add>quatrième quatrièmement que quel quelconque quelle quelles quelqu'un quelque
<add>quelques quels qui quiconque quinze quoi quoique
<add>
<add>rare rarement rares relative relativement remarquable rend rendre restant reste
<add>restent restrictif retour revoici revoilà rien
<add>
<add>sa sacrebleu sait sans sapristi sauf se sein seize selon semblable semblaient
<add>semble semblent sent sept septième sera seraient serait seront ses seul seule
<add>seulement si sien sienne siennes siens sinon six sixième soi soi-même soit
<add>soixante son sont sous souvent specifique specifiques speculatif stop
<add>strictement subtiles suffisant suffisante suffit suis suit suivant suivante
<add>suivantes suivants suivre superpose sur surtout
<add>
<add>ta tac tant tardive te tel telle tellement telles tels tenant tend tenir tente
<add>tes tic tien tienne tiennes tiens toc toi toi-même ton touchant toujours tous
<add>tout toute toutefois toutes treize trente tres trois troisième troisièmement
<add>trop très tsoin tsouin tu té
<add>
<add>un une unes uniformement unique uniques uns
<add>
<add>va vais vas vers via vif vifs vingt vivat vive vives vlan voici voilà vont vos
<add>votre vous vous-mêmes vu vé vôtre vôtres
<add>
<add>zut
<ide> """.split())
<ide>
<ide>
| 1
|
Ruby
|
Ruby
|
reduce direct accesses of the args collection
|
fad2e26395f09d78e51a9da5965e28d72b3c9cc2
|
<ide><path>Library/Homebrew/build_options.rb
<ide> def without? name
<ide> end
<ide>
<ide> def bottle?
<del> args.include? '--build-bottle'
<add> include? "build-bottle"
<ide> end
<ide>
<ide> def head?
<del> args.include? '--HEAD'
<add> include? "HEAD"
<ide> end
<ide>
<ide> def devel?
<del> args.include? '--devel'
<add> include? "devel"
<ide> end
<ide>
<ide> def stable?
<ide> def stable?
<ide>
<ide> # True if the user requested a universal build.
<ide> def universal?
<del> universal || args.include?('--universal') && has_option?('universal')
<add> universal || include?("universal") && has_option?("universal")
<ide> end
<ide>
<ide> # True if the user requested to enable C++11 mode.
<ide> def cxx11?
<del> args.include?('--c++11') && has_option?('c++11')
<add> include?("c++11") && has_option?("c++11")
<ide> end
<ide>
<ide> # Request a 32-bit only build.
<ide> # This is needed for some use-cases though we prefer to build Universal
<ide> # when a 32-bit version is needed.
<ide> def build_32_bit?
<del> args.include?('--32-bit') && has_option?('32-bit')
<add> include?("32-bit") && has_option?("32-bit")
<ide> end
<ide>
<ide> def used_options
| 1
|
PHP
|
PHP
|
fix failing tests
|
d24fa9685976c73421df985ae1e7670e54b16b37
|
<ide><path>src/Database/Schema/SqlserverSchema.php
<ide> public function truncateTableSql(Table $table)
<ide> if (in_array($column['type'], ['integer', 'biginteger'])) {
<ide> $queries[] = sprintf(
<ide> "DBCC CHECKIDENT('%s', RESEED, 0)",
<del> $name
<add> $table->name()
<ide> );
<ide> }
<ide> }
<ide><path>tests/TestCase/Database/Schema/SqlserverSchemaTest.php
<ide> public function testTruncateSql()
<ide> $result = $table->truncateSql($connection);
<ide> $this->assertCount(2, $result);
<ide> $this->assertEquals('DELETE FROM [schema_articles]', $result[0]);
<del> $this->assertEquals('DBCC CHECKIDENT([schema_articles], RESEED, 0)', $result[1]);
<add> $this->assertEquals("DBCC CHECKIDENT('schema_articles', RESEED, 0)", $result[1]);
<ide> }
<ide>
<ide> /**
| 2
|
Javascript
|
Javascript
|
define mixin properties in prototype
|
1912279ca03767ac7def4ce2dc1428fcc888ff94
|
<ide><path>packages/ember-metal/lib/mixin.js
<ide> Ember.Mixin = function() { return initMixin(this, arguments); };
<ide>
<ide> Mixin = Ember.Mixin;
<ide>
<add>Mixin.prototype = {
<add> properties: null,
<add> mixins: null,
<add> ownerConstructor: null
<add>};
<add>
<ide> Mixin._apply = applyMixin;
<ide>
<ide> Mixin.applyPartial = function(obj) {
| 1
|
Text
|
Text
|
add license info to german bert models
|
5920a37a4c95b667f0a2962c4b4e727c323b07fa
|
<ide><path>model_cards/bert-base-german-cased-README.md
<ide> ---
<ide> language: de
<add>license: mit
<ide> thumbnail: https://static.tildacdn.com/tild6438-3730-4164-b266-613634323466/german_bert.png
<ide> tags:
<ide> - exbert
<ide><path>model_cards/deepset/bert-base-german-cased-oldvocab/README.md
<ide> ---
<ide> language: de
<add>license: mit
<ide> thumbnail: https://static.tildacdn.com/tild6438-3730-4164-b266-613634323466/german_bert.png
<ide> tags:
<ide> - exbert
| 2
|
Mixed
|
Python
|
add masking layer
|
cb1d25fddbd575158af655daeae810b54a153ec7
|
<ide><path>docs/sources/layers/core.md
<ide> model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
<ide> model.fit([X_train, X_train], Y_train, batch_size=128, nb_epoch=20, validation_data=([X_test, X_test], Y_test))
<ide> ```
<ide>
<add>## Masking
<add>```python
<add>keras.layers.core.Masking(mask_value=0)
<add>```
<add>
<add>Create a mask for the input data by using `mask_value` as the padding value which should be masked out.
<add>Works with sequences only, given an input of dimensions `(nb_samples, timesteps, input_dim)`, return the input untouched as output, and supply a mask of shape `(nb_samples, timesteps)` where all timesteps which had all values set to `mask_value` are masked out (0).
<ide><path>keras/layers/core.py
<ide> def get_output_mask(self, train=False):
<ide> return self.get_input_mask(train)
<ide>
<ide>
<add>class Masking(MaskedLayer):
<add> """Mask an input sequence by using a mask value to identify padding.
<add>
<add> This layer copies the input to the output layer, while creating an output mask in the process.
<add> This layer is only available with sequences, so its input should be the in
<add> the shape (nb_samples, timesteps, input_dim) and its output is of the shape
<add> (nb_samples, timesteps).
<add>
<add> At each timestep, if the values all equal `mask_value`, then the timestep
<add> mask is zero (skipped), otherwise it is 1.
<add>
<add> """
<add>
<add> def __init__(self, mask_value=0):
<add> super(Masking, self).__init__()
<add> self.mask_value = mask_value
<add> self.input = T.tensor3()
<add>
<add> def get_output_mask(self, train=False):
<add> X = self.get_input(train)
<add> return T.any(T.ones_like(X) * (1 - T.eq(X, self.mask_value)), axis=-1)
<add>
<add> def get_config(self):
<add> return dict(super(Masking, self).get_config(),
<add> mask_value=self.mask_value)
<add>
<add>
<ide> class Merge(object):
<ide> def __init__(self, layers, mode='sum'):
<ide> ''' Merge the output of a list of layers or containers into a single tensor.
<ide><path>tests/auto/keras/layers/test_core.py
<ide> def test_maxout_dense(self):
<ide> self._runner(layer)
<ide>
<ide>
<add>class TestMasking(unittest.TestCase):
<add> """Test the Masking class"""
<add>
<add> def test_sequences(self):
<add> """Test masking sequences with zeroes as padding"""
<add> # integer inputs, one per timestep, like embeddings
<add> layer = core.Masking()
<add> func = theano.function([layer.input], layer.get_output_mask())
<add> self.assertTrue(np.all(
<add> # get mask for this input
<add> func(np.array(
<add> [[[1], [2], [3], [0]],
<add> [[0], [4], [5], [0]]], dtype=np.int32)) ==
<add> # This is the expected output mask, one dimension less
<add> np.array([[1, 1, 1, 0], [0, 1, 1, 0]])))
<add>
<add> def test_non_zero(self):
<add> """Test masking with non-zero mask value"""
<add> layer = core.Masking(5)
<add> func = theano.function([layer.input], layer.get_output_mask())
<add> self.assertTrue(np.all(
<add> # get mask for this input, if not all the values are 5, shouldn't masked
<add> func(np.array(
<add> [[[1, 1], [2, 1], [3, 1], [5, 5]],
<add> [[1, 5], [5, 0], [0, 0], [0, 0]]], dtype=np.int32)) ==
<add> # This is the expected output mask, one dimension less
<add> np.array([[1, 1, 1, 0], [1, 1, 1, 1]])))
<add>
<add>
<ide> if __name__ == '__main__':
<ide> unittest.main()
| 3
|
Ruby
|
Ruby
|
avoid error on head-only formulae
|
97c12b4bbfa5a4e2d4ff0a1e59788b12503a698c
|
<ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_specs
<ide> ]
<ide>
<ide> throttled.each_slice(2).to_a.map do |a, b|
<add> next if formula.stable.nil?
<ide> version = formula.stable.version.to_s.split(".").last.to_i
<ide> if @strict && a.include?(formula.name) && version.modulo(b.to_i).nonzero?
<ide> problem "should only be updated every #{b} releases on multiples of #{b}"
| 1
|
Go
|
Go
|
use docker media type for plugin layers
|
a876ede24f4c6e13717f56897fb34f6c73914602
|
<ide><path>integration/plugin/common/plugin_test.go
<ide> import (
<ide> "strings"
<ide> "testing"
<ide>
<add> "github.com/containerd/containerd/images"
<add> "github.com/containerd/containerd/remotes/docker"
<ide> "github.com/docker/docker/api/types"
<add> "github.com/docker/docker/pkg/jsonmessage"
<ide> "github.com/docker/docker/testutil/daemon"
<ide> "github.com/docker/docker/testutil/fixtures/plugin"
<ide> "github.com/docker/docker/testutil/registry"
<ide> "github.com/docker/docker/testutil/request"
<add> v1 "github.com/opencontainers/image-spec/specs-go/v1"
<ide> "gotest.tools/v3/assert"
<add> "gotest.tools/v3/assert/cmp"
<ide> is "gotest.tools/v3/assert/cmp"
<ide> "gotest.tools/v3/skip"
<ide> )
<ide> func TestPluginsWithRuntimes(t *testing.T) {
<ide> assert.NilError(t, err)
<ide> })
<ide> }
<add>
<add>func TestPluginBackCompatMediaTypes(t *testing.T) {
<add> skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
<add> skip.If(t, testEnv.OSType == "windows")
<add> skip.If(t, testEnv.IsRootless, "Rootless has a different view of localhost (needed for test registry access)")
<add>
<add> defer setupTest(t)()
<add>
<add> reg := registry.NewV2(t)
<add> defer reg.Close()
<add> reg.WaitReady(t)
<add>
<add> repo := path.Join(registry.DefaultURL, strings.ToLower(t.Name())+":latest")
<add>
<add> client := testEnv.APIClient()
<add>
<add> ctx := context.Background()
<add> assert.NilError(t, plugin.Create(ctx, client, repo))
<add>
<add> rdr, err := client.PluginPush(ctx, repo, "")
<add> assert.NilError(t, err)
<add> defer rdr.Close()
<add>
<add> buf := &strings.Builder{}
<add> assert.NilError(t, jsonmessage.DisplayJSONMessagesStream(rdr, buf, 0, false, nil), buf)
<add>
<add> // Use custom header here because older versions of the registry do not
<add> // parse the accept header correctly and does not like the accept header
<add> // that the default resolver code uses. "Older registries" here would be
<add> // like the one currently included in the test suite.
<add> headers := http.Header{}
<add> headers.Add("Accept", images.MediaTypeDockerSchema2Manifest)
<add>
<add> resolver := docker.NewResolver(docker.ResolverOptions{
<add> Headers: headers,
<add> })
<add> assert.NilError(t, err)
<add>
<add> n, desc, err := resolver.Resolve(ctx, repo)
<add> assert.NilError(t, err, repo)
<add>
<add> fetcher, err := resolver.Fetcher(ctx, n)
<add> assert.NilError(t, err)
<add>
<add> rdr, err = fetcher.Fetch(ctx, desc)
<add> assert.NilError(t, err)
<add> defer rdr.Close()
<add>
<add> type manifest struct {
<add> MediaType string
<add> v1.Manifest
<add> }
<add> var m manifest
<add> assert.NilError(t, json.NewDecoder(rdr).Decode(&m))
<add> assert.Check(t, cmp.Equal(m.MediaType, images.MediaTypeDockerSchema2Manifest))
<add> assert.Check(t, cmp.Len(m.Layers, 1))
<add> assert.Check(t, cmp.Equal(m.Layers[0].MediaType, images.MediaTypeDockerSchema2LayerGzip))
<add>}
<ide><path>plugin/backend_linux.go
<ide> func buildManifest(ctx context.Context, s content.Manager, config digest.Digest,
<ide> return m, errors.Wrapf(err, "error fetching info for content digest %s", l)
<ide> }
<ide> m.Layers = append(m.Layers, specs.Descriptor{
<del> MediaType: specs.MediaTypeImageLayerGzip, // TODO: This is assuming everything is a gzip compressed layer, but that may not be true.
<add> MediaType: images.MediaTypeDockerSchema2LayerGzip, // TODO: This is assuming everything is a gzip compressed layer, but that may not be true.
<ide> Digest: l,
<ide> Size: info.Size,
<ide> })
| 2
|
Python
|
Python
|
catch deprecation warnings in tests
|
e0c2e4f302128aaf51e81d927e525edb87da48b7
|
<ide><path>celery/tests/test_app/test_loaders.py
<ide>
<ide> import os
<ide> import sys
<add>import warnings
<ide>
<ide> from celery import task
<ide> from celery import loaders
<ide> from celery.app import app_or_default
<del>from celery.exceptions import ImproperlyConfigured
<add>from celery.exceptions import CPendingDeprecationWarning, ImproperlyConfigured
<ide> from celery.loaders import base
<ide> from celery.loaders import default
<ide> from celery.loaders.app import AppLoader
<ide> def test_get_loader_cls(self):
<ide> default.Loader)
<ide>
<ide> def test_current_loader(self):
<del> self.assertIs(loaders.current_loader(), self.app.loader)
<add> warnings.resetwarnings()
<add> with catch_warnings(record=True) as log:
<add> self.assertIs(loaders.current_loader(), self.app.loader)
<add> warning = log[0].message
<add>
<add> self.assertIsInstance(warning, CPendingDeprecationWarning)
<add> self.assertIn("deprecation", warning.args[0])
<ide>
<ide> def test_load_settings(self):
<del> self.assertIs(loaders.load_settings(), self.app.conf)
<add> warnings.resetwarnings()
<add> with catch_warnings(record=True) as log:
<add> self.assertIs(loaders.load_settings(), self.app.conf)
<add> warning = log[0].message
<add>
<add> self.assertIsInstance(warning, CPendingDeprecationWarning)
<add> self.assertIn("deprecation", warning.args[0])
<ide>
<ide>
<ide> class TestLoaderBase(unittest.TestCase):
| 1
|
Text
|
Text
|
add the missing author name [ci skip]
|
5f038aa488e6eda5b3b7d5794befd7c433480da5
|
<ide><path>activerecord/CHANGELOG.md
<ide>
<ide> Closes #13775.
<ide>
<add> *Takashi Kokubun*
<add>
<ide> * Add ActiveRecord `#second_to_last` and `#third_to_last` methods.
<ide>
<ide> *Brian Christian*
| 1
|
PHP
|
PHP
|
escape path directly in build command
|
4f9192ffc410c5bf976f0ea6093f37fd0745283a
|
<ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> protected function callAfterCallbacks(Container $container)
<ide> */
<ide> public function buildCommand()
<ide> {
<add> $output = ProcessUtils::escapeArgument($this->output);
<ide> $redirect = $this->shouldAppendOutput ? ' >> ' : ' > ';
<ide>
<ide> if ($this->withoutOverlapping) {
<del> $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$this->output.' 2>&1 &';
<add> $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$output.' 2>&1 &';
<ide> } else {
<del> $command = $this->command.$redirect.$this->output.' 2>&1 &';
<add> $command = $this->command.$redirect.$output.' 2>&1 &';
<ide> }
<ide>
<ide> return $this->user ? 'sudo -u '.$this->user.' '.$command : $command;
<ide> public function skip(Closure $callback)
<ide> */
<ide> public function sendOutputTo($location, $append = false)
<ide> {
<del> $this->output = ProcessUtils::escapeArgument($location);
<add> $this->output = $location;
<ide>
<ide> $this->shouldAppendOutput = $append;
<ide>
<ide><path>tests/Console/Scheduling/EventTest.php
<ide> public function testBuildCommand()
<ide> $event = new Event('php -i');
<ide>
<ide> $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null';
<del> $this->assertSame("php -i > {$defaultOutput} 2>&1 &", $event->buildCommand());
<add> $this->assertSame("php -i > '{$defaultOutput}' 2>&1 &", $event->buildCommand());
<ide> }
<ide>
<ide> public function testBuildCommandSendOutputTo()
<ide> public function testBuildCommandAppendOutput()
<ide> $event->appendOutputTo('/dev/null');
<ide> $this->assertSame("php -i >> '/dev/null' 2>&1 &", $event->buildCommand());
<ide> }
<add>
<add> /**
<add> * @expectedException LogicException
<add> */
<add> public function testEmailOutputToThrowsExceptionIfOutputFileWasNotSpecified()
<add> {
<add> $event = new Event('php -i');
<add> $event->emailOutputTo('foo@example.com');
<add>
<add> $event->buildCommand();
<add> }
<ide> }
| 2
|
Javascript
|
Javascript
|
update removeclippedsubviews prop default value
|
3622e44426431988cd03ffeb6d1e4671207c9a2a
|
<ide><path>Libraries/Components/ScrollView/ScrollView.js
<ide> var ScrollView = React.createClass({
<ide> * Experimental: When true, offscreen child views (whose `overflow` value is
<ide> * `hidden`) are removed from their native backing superview when offscreen.
<ide> * This can improve scrolling performance on long lists. The default value is
<del> * false.
<add> * true.
<ide> */
<ide> removeClippedSubviews: PropTypes.bool,
<ide> /**
| 1
|
Python
|
Python
|
remove duplicated line
|
5dfec704da2c1495247c7abe81a620c6e9913ea5
|
<ide><path>src/transformers/models/gpt_neo/modeling_gpt_neo.py
<ide> def forward(
<ide> else:
<ide> past_length = past_key_values[0][0].size(-2)
<ide>
<del> device = input_ids.device if input_ids is not None else inputs_embeds.device
<ide> if position_ids is None:
<ide> position_ids = torch.arange(past_length, input_shape[-1] + past_length, dtype=torch.long, device=device)
<ide> position_ids = position_ids.unsqueeze(0).view(-1, input_shape[-1])
| 1
|
Javascript
|
Javascript
|
fix broken assertions caused by qunit update
|
8b6aeae52d4c53a53468678ccd45e9dda9665004
|
<ide><path>test/unit/manipulation.js
<ide> function testAppend( valueObj ) {
<ide> equal( result.text(), defaultText + "buga", "Check if text appending works" );
<ide> equal( jQuery("#select3").append( valueObj("<option value='appendTest'>Append Test</option>") ).find("option:last-child").attr("value"), "appendTest", "Appending html options to select element" );
<ide>
<del> jQuery("form").append( valueObj("<input name='radiotest' type='radio' checked='checked' />") );
<del> jQuery("form input[name=radiotest]").each(function() {
<add> jQuery("#qunit-fixture form").append( valueObj("<input name='radiotest' type='radio' checked='checked' />") );
<add> jQuery("#qunit-fixture form input[name=radiotest]").each(function() {
<ide> ok( jQuery(this).is(":checked"), "Append checked radio" );
<ide> }).remove();
<ide>
<del> jQuery("form").append( valueObj("<input name='radiotest2' type='radio' checked = 'checked' />") );
<del> jQuery("form input[name=radiotest2]").each(function() {
<add> jQuery("#qunit-fixture form").append( valueObj("<input name='radiotest2' type='radio' checked = 'checked' />") );
<add> jQuery("#qunit-fixture form input[name=radiotest2]").each(function() {
<ide> ok( jQuery(this).is(":checked"), "Append alternately formated checked radio" );
<ide> }).remove();
<ide>
<del> jQuery("form").append( valueObj("<input name='radiotest3' type='radio' checked />") );
<del> jQuery("form input[name=radiotest3]").each(function() {
<add> jQuery("#qunit-fixture form").append( valueObj("<input name='radiotest3' type='radio' checked />") );
<add> jQuery("#qunit-fixture form input[name=radiotest3]").each(function() {
<ide> ok( jQuery(this).is(":checked"), "Append HTML5-formated checked radio" );
<ide> }).remove();
<ide>
<del> jQuery("form").append( valueObj("<input type='radio' checked='checked' name='radiotest4' />") );
<del> jQuery("form input[name=radiotest4]").each(function() {
<add> jQuery("#qunit-fixture form").append( valueObj("<input type='radio' checked='checked' name='radiotest4' />") );
<add> jQuery("#qunit-fixture form input[name=radiotest4]").each(function() {
<ide> ok( jQuery(this).is(":checked"), "Append with name attribute after checked attribute" );
<ide> }).remove();
<ide>
<ide><path>test/unit/traversing.js
<ide> test("is(jQuery)", function() {
<ide> ok( !jQuery("#radio1").is( jQuery("input:checked") ), "Check for pseudoclass: Expected not checked" );
<ide>
<ide> // Some raw elements
<del> ok( jQuery("#form").is( jQuery("form")[0] ), "Check for element: A form is a form" );
<add> ok( jQuery("#form").is( jQuery("#qunit-fixture form")[0] ), "Check for element: A form is a form" );
<ide> ok( !jQuery("#form").is( jQuery("div")[0] ), "Check for element: A form is not a div" );
<ide> ok( jQuery("#mark").is( jQuery(".blog")[0] ), "Check for class: Expected class 'blog'" );
<ide> ok( !jQuery("#mark").is( jQuery(".link")[0] ), "Check for class: Did not expect class 'link'" );
| 2
|
Python
|
Python
|
use create_index_name for fk names
|
b6784bee66d2c310318b6553fbb13f5707475efb
|
<ide><path>django/db/backends/schema.py
<ide> def create_model(self, model):
<ide> to_column = field.rel.to._meta.get_field(field.rel.field_name).column
<ide> self.deferred_sql.append(
<ide> self.sql_create_fk % {
<del> "name": '%s_refs_%s_%x' % (
<del> field.column,
<del> to_column,
<del> abs(hash((model._meta.db_table, to_table)))
<del> ),
<add> "name": self._create_index_name(model, [field.column], suffix="_fk_%s_%s" % (to_table, to_column)),
<ide> "table": self.quote_name(model._meta.db_table),
<ide> "column": self.quote_name(field.column),
<ide> "to_table": self.quote_name(to_table),
| 1
|
PHP
|
PHP
|
throw exception on `manytophp()` for non-numeric
|
c642ca7bd99f17ac6dc0a9974dace00ff4bd1470
|
<ide><path>src/Database/Type/IntegerType.php
<ide> public function toPHP($value, Driver $driver)
<ide> public function manyToPHP(array $values, array $fields, Driver $driver)
<ide> {
<ide> foreach ($fields as $field) {
<del> if (!isset($values[$field]) || !is_numeric($values[$field])) {
<add> if (!isset($values[$field])) {
<ide> continue;
<ide> }
<add>
<add> if ($values[$field] !== null && $values[$field] !== '' && !is_numeric($values[$field])) {
<add> throw new InvalidArgumentException(sprintf(
<add> 'Cannot convert value of type `%s` to integer',
<add> getTypeName($values[$field])
<add> ));
<add> }
<add>
<ide> $values[$field] = (int)$values[$field];
<ide> }
<ide>
<ide><path>tests/TestCase/Database/Type/IntegerTypeTest.php
<ide> public function testToPHP()
<ide> */
<ide> public function testManyToPHP()
<ide> {
<add> $values = [
<add> 'a' => null,
<add> 'b' => '2.3',
<add> 'c' => '15',
<add> 'd' => '0.0',
<add> 'e' => 10
<add> ];
<add> $expected = [
<add> 'a' => null,
<add> 'b' => 2,
<add> 'c' => 15,
<add> 'd' => 0,
<add> 'e' => 10
<add> ];
<add> $this->assertEquals(
<add> $expected,
<add> $this->type->manyToPHP($values, array_keys($values), $this->driver)
<add> );
<add> }
<add>
<add> /**
<add> * Test to make sure the method throws an exception for invalid integer values.
<add> *
<add> * @return void
<add> */
<add> public function testInvalidManyToPHP()
<add> {
<add> $this->expectException(\InvalidArgumentException::class);
<ide> $values = [
<ide> 'a' => null,
<ide> 'b' => '2.3',
| 2
|
Javascript
|
Javascript
|
remove more trailing commas
|
ea26cf46fdfb1f5308530d8c9570e7ff2b78a4c2
|
<ide><path>packages/ember-metal/tests/mixin/observer_test.js
<ide> testBoth('observing chain with property in mixin applied later', function(get, s
<ide> count: 0,
<ide> foo: Ember.observer(function() {
<ide> set(this, 'count', get(this, 'count')+1);
<del> }, 'bar.baz'),
<add> }, 'bar.baz')
<ide> });
<ide>
<ide> var MyMixin2 = Ember.Mixin.create({bar: obj2});
<ide> testBoth('observing chain with existing property', function(get, set) {
<ide> count: 0,
<ide> foo: Ember.observer(function() {
<ide> set(this, 'count', get(this, 'count')+1);
<del> }, 'bar.baz'),
<add> }, 'bar.baz')
<ide> });
<ide>
<ide> var obj = Ember.mixin({bar: obj2}, MyMixin);
<ide> testBoth('observing chain with property in mixin before', function(get, set) {
<ide> count: 0,
<ide> foo: Ember.observer(function() {
<ide> set(this, 'count', get(this, 'count')+1);
<del> }, 'bar.baz'),
<add> }, 'bar.baz')
<ide> });
<ide>
<ide> var obj = Ember.mixin({}, MyMixin2, MyMixin);
<ide> testBoth('observing chain with property in mixin after', function(get, set) {
<ide> count: 0,
<ide> foo: Ember.observer(function() {
<ide> set(this, 'count', get(this, 'count')+1);
<del> }, 'bar.baz'),
<add> }, 'bar.baz')
<ide> });
<ide>
<ide> var obj = Ember.mixin({}, MyMixin, MyMixin2);
<ide> testBoth('observing chain with overriden property', function(get, set) {
<ide> count: 0,
<ide> foo: Ember.observer(function() {
<ide> set(this, 'count', get(this, 'count')+1);
<del> }, 'bar.baz'),
<add> }, 'bar.baz')
<ide> });
<ide>
<ide> var obj = Ember.mixin({bar: obj2}, MyMixin, MyMixin2);
| 1
|
Javascript
|
Javascript
|
add socket.fd compatibility hack to dgram_uv.js
|
bba432f00e0513faa124cdb0606fa050663e63ca
|
<ide><path>lib/dgram_uv.js
<ide> function Socket(type, listener) {
<ide> this._receiving = false;
<ide> this._bound = false;
<ide> this.type = type;
<add> this.fd = null; // compatibility hack
<ide>
<ide> if (typeof listener === 'function')
<ide> this.on('message', listener);
<ide> Socket.prototype._stopReceiving = function() {
<ide> this._handle.onmessage = null;
<ide> this._handle.recvStop();
<ide> this._receiving = false;
<add> this.fd = null; // compatibility hack
<ide> };
<ide>
<ide>
| 1
|
Ruby
|
Ruby
|
add missing require
|
8ae20e65827fb2670ca0aaf253247c5e0afc6021
|
<ide><path>activejob/test/cases/logging_test.rb
<ide> require "jobs/logging_job"
<ide> require "jobs/overridden_logging_job"
<ide> require "jobs/nested_job"
<add>require "jobs/rescue_job"
<ide> require "models/person"
<ide>
<ide> class LoggingTest < ActiveSupport::TestCase
| 1
|
Javascript
|
Javascript
|
add tests for using jquery.speed directly
|
cb80b42b91bc7d0e75fb842f733878b848a8b9c1
|
<ide><path>test/unit/effects.js
<ide> QUnit.test( "Show/hide/toggle and display: inline", function( assert ) {
<ide> } );
<ide> } );
<ide>
<add>function testEasing( assert, speed, easing, complete ) {
<add> assert.expect( 4 );
<add> var options = jQuery.speed( speed, easing, complete );
<add>
<add> assert.equal( options.duration, 10, "Duration set properly" );
<add> assert.equal(
<add> jQuery.isFunction( options.easing ) ? options.easing() : options.easing,
<add> "linear",
<add> "Easing set properly"
<add> );
<add> assert.equal( options.queue, "fx", "Queue defaults to fx" );
<add> options.complete();
<add>}
<add>
<add>QUnit.test( "jQuery.speed( speed, easing, complete )", function( assert ) {
<add> testEasing( assert, 10, "linear", function() {
<add> assert.ok( true, "Complete called" );
<add> } );
<add>} );
<add>
<add>QUnit.test( "jQuery.speed( speed, easing, complete ) - with easing function", function( assert ) {
<add> testEasing(
<add> assert,
<add> 10,
<add> function() {
<add> return "linear";
<add> },
<add> function() {
<add> assert.ok( true, "Complete called" );
<add> }
<add> );
<add>} );
<add>
<add>QUnit.test( "jQuery.speed( options )", function( assert ) {
<add> testEasing( assert, {
<add> duration: 10,
<add> easing: "linear",
<add> complete: function() {
<add> assert.ok( true, "Complete called" );
<add> }
<add> } );
<add>} );
<add>
<add>QUnit.test( "jQuery.speed( options ) - with easing function", function( assert ) {
<add> testEasing( assert, {
<add> duration: 10,
<add> easing: function() {
<add> return "linear";
<add> },
<add> complete: function() {
<add> assert.ok( true, "Complete called" );
<add> }
<add> } );
<add>} );
<add>
<add>QUnit.test( "jQuery.speed( options ) - queue values", function( assert ) {
<add> assert.expect( 5 );
<add>
<add> var get = function( queue ) {
<add> return jQuery.speed( { queue: queue } ).queue;
<add> };
<add>
<add> assert.equal( get( null ), "fx", "null defaults to 'fx'" );
<add> assert.equal( get( undefined ), "fx", "undefined defaults to 'fx'" );
<add> assert.equal( get( true ), "fx", "true defaults to 'fx'" );
<add> assert.equal( get( "fx" ), "fx", "'fx' passed through" );
<add> assert.equal( get( "custom" ), "custom", "'custom' passed through" );
<add>} );
<add>
<add>QUnit.test( "jQuery.speed() - durations", function( assert ) {
<add> assert.expect( 5 );
<add>
<add> var get = function( duration ) {
<add> return jQuery.speed( duration ).duration;
<add> };
<add>
<add> assert.equal( get( 100 ), 100, "jQuery.speed sets number duration" );
<add> assert.equal( get(), jQuery.fx.speeds._default, "jQuery.speed falls back default duration" );
<add> assert.equal( get( "slow" ), jQuery.fx.speeds.slow, "jQuery.speed uses preset speeds" );
<add> assert.equal( get( "fast" ), jQuery.fx.speeds.fast, "jQuery.speed uses preset speeds" );
<add> jQuery.fx.off = true;
<add> assert.equal( get( 100 ), 0, "jQuery.speed defaults duration to zero if fx is off" );
<add> jQuery.fx.off = false;
<add>} );
<add>
<ide> } )();
| 1
|
Text
|
Text
|
update documenation over page_size
|
c2cbda43b90159d4a98ad6afdb1e6594247bfcd5
|
<ide><path>docs/api-guide/pagination.md
<ide> This pagination style accepts a single number page number in the request query p
<ide>
<ide> #### Setup
<ide>
<del>To enable the `PageNumberPagination` style globally, use the following configuration, modifying the `DEFAULT_PAGE_SIZE` as desired:
<add>To enable the `PageNumberPagination` style globally, use the following configuration, modifying the `PAGE_SIZE` as desired:
<ide>
<ide> REST_FRAMEWORK = {
<ide> 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
<del> 'DEFAULT_PAGE_SIZE': 100
<add> 'PAGE_SIZE': 100
<ide> }
<ide>
<ide> On `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `PageNumberPagination` on a per-view basis.
<ide> The `PageNumberPagination` class includes a number of attributes that may be ove
<ide>
<ide> To set these attributes you should override the `PageNumberPagination` class, and then enable your custom pagination class as above.
<ide>
<del>* `page_size` - A numeric value indicating the page size. If set, this overrides the `DEFAULT_PAGE_SIZE` setting. Defaults to the same value as the `DEFAULT_PAGE_SIZE` settings key.
<add>* `page_size` - A numeric value indicating the page size. If set, this overrides the `PAGE_SIZE` setting. Defaults to the same value as the `PAGE_SIZE` settings key.
<ide> * `page_query_param` - A string value indicating the name of the query parameter to use for the pagination control.
<ide> * `page_size_query_param` - If set, this is a string value indicating the name of a query parameter that allows the client to set the page size on a per-request basis. Defaults to `None`, indicating that the client may not control the requested page size.
<ide> * `max_page_size` - If set, this is a numeric value indicating the maximum allowable requested page size. This attribute is only valid if `page_size_query_param` is also set.
<ide> To enable the `PageNumberPagination` style globally, use the following configura
<ide> 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination'
<ide> }
<ide>
<del>Optionally, you may also set a `DEFAULT_PAGE_SIZE` key. If the `DEFAULT_PAGE_SIZE` parameter is also used then the `limit` query parameter will be optional, and may be omitted by the client.
<add>Optionally, you may also set a `PAGE_SIZE` key. If the `PAGE_SIZE` parameter is also used then the `limit` query parameter will be optional, and may be omitted by the client.
<ide>
<ide> On `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `LimitOffsetPagination` on a per-view basis.
<ide>
<ide> The `LimitOffsetPagination` class includes a number of attributes that may be ov
<ide>
<ide> To set these attributes you should override the `LimitOffsetPagination` class, and then enable your custom pagination class as above.
<ide>
<del>* `default_limit` - A numeric value indicating the limit to use if one is not provided by the client in a query parameter. Defaults to the same value as the `DEFAULT_PAGE_SIZE` settings key.
<add>* `default_limit` - A numeric value indicating the limit to use if one is not provided by the client in a query parameter. Defaults to the same value as the `PAGE_SIZE` settings key.
<ide> * `limit_query_param` - A string value indicating the name of the "limit" query parameter. Defaults to `'limit'`.
<ide> * `offset_query_param` - A string value indicating the name of the "offset" query parameter. Defaults to `'offset'`.
<ide> * `max_limit` - If set this is a numeric value indicating the maximum allowable limit that may be requested by the client. Defaults to `None`.
<ide> For more technical details on the implementation we use for cursor pagination, t
<ide>
<ide> #### Setup
<ide>
<del>To enable the `CursorPagination` style globally, use the following configuration, modifying the `DEFAULT_PAGE_SIZE` as desired:
<add>To enable the `CursorPagination` style globally, use the following configuration, modifying the `PAGE_SIZE` as desired:
<ide>
<ide> REST_FRAMEWORK = {
<ide> 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.CursorPagination',
<del> 'DEFAULT_PAGE_SIZE': 100
<add> 'PAGE_SIZE': 100
<ide> }
<ide>
<ide> On `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `CursorPagination` on a per-view basis.
<ide> The [`DRF-extensions` package][drf-extensions] includes a [`PaginateByMaxMixin`
<ide> [link-header]: ../img/link-header-pagination.png
<ide> [drf-extensions]: http://chibisov.github.io/drf-extensions/docs/
<ide> [paginate-by-max-mixin]: http://chibisov.github.io/drf-extensions/docs/#paginatebymaxmixin
<del>[disqus-cursor-api]: http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api/
<ide>\ No newline at end of file
<add>[disqus-cursor-api]: http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api/
| 1
|
Python
|
Python
|
add horizontal_flip_box in box_ops
|
473f34aa986af7aba63509f4e25be1269f084619
|
<ide><path>official/vision/ops/box_ops.py
<ide> def denormalize_boxes(boxes, image_shape):
<ide> return denormalized_boxes
<ide>
<ide>
<add>def horizontal_flip_boxes(normalized_boxes):
<add> """Flips normalized boxes horizontally.
<add>
<add> Args:
<add> normalized_boxes: the boxes in normalzied coordinates.
<add>
<add> Returns:
<add> horizontally flipped boxes.
<add> """
<add> if normalized_boxes.shape[-1] != 4:
<add> raise ValueError('boxes.shape[-1] is {:d}, but must be 4.'.format(
<add> normalized_boxes.shape[-1]))
<add>
<add> with tf.name_scope('horizontal_flip_boxes'):
<add> ymin, xmin, ymax, xmax = tf.split(
<add> value=normalized_boxes, num_or_size_splits=4, axis=-1)
<add> flipped_xmin = tf.subtract(1.0, xmax)
<add> flipped_xmax = tf.subtract(1.0, xmin)
<add> flipped_boxes = tf.concat([ymin, flipped_xmin, ymax, flipped_xmax], axis=-1)
<add> return flipped_boxes
<add>
<add>
<ide> def clip_boxes(boxes, image_shape):
<ide> """Clips boxes to image boundaries.
<ide>
| 1
|
Go
|
Go
|
go vet fix for testfilllicense
|
1082d1edf2819620961978ad7efe19bc28620a16
|
<ide><path>daemon/licensing_test.go
<ide> import (
<ide> "gotest.tools/assert"
<ide> )
<ide>
<del>func TestfillLicense(t *testing.T) {
<add>func TestFillLicense(t *testing.T) {
<ide> v := &types.Info{}
<ide> d := &Daemon{
<ide> root: "/var/lib/docker/",
| 1
|
Go
|
Go
|
fix vet warning in archive.go
|
fc20658a01e362a5bb484b439a0a1004c51f9ff5
|
<ide><path>pkg/chrootarchive/archive.go
<ide> func Untar(tarArchive io.Reader, dest string, options *archive.TarOptions) error
<ide> cmd := reexec.Command("docker-untar", dest)
<ide> cmd.Stdin = decompressedArchive
<ide> cmd.ExtraFiles = append(cmd.ExtraFiles, r)
<del> var output bytes.Buffer
<del> cmd.Stdout = &output
<del> cmd.Stderr = &output
<add> output := bytes.NewBuffer(nil)
<add> cmd.Stdout = output
<add> cmd.Stderr = output
<ide>
<ide> if err := cmd.Start(); err != nil {
<ide> return fmt.Errorf("Untar error on re-exec cmd: %v", err)
| 1
|
Javascript
|
Javascript
|
remove extra spaces
|
a56da51a384ca301fc9c608eadc608e6449fafe4
|
<ide><path>benchmark/buffers/buffer-write.js
<ide> var bench = common.createBenchmark(main, {
<ide> millions: [1]
<ide> });
<ide>
<del>const INT8 = 0x7f;
<del>const INT16 = 0x7fff;
<del>const INT32 = 0x7fffffff;
<del>const UINT8 = (INT8 * 2) + 1;
<add>const INT8 = 0x7f;
<add>const INT16 = 0x7fff;
<add>const INT32 = 0x7fffffff;
<add>const UINT8 = (INT8 * 2) + 1;
<ide> const UINT16 = (INT16 * 2) + 1;
<ide> const UINT32 = INT32;
<ide>
<ide><path>benchmark/buffers/dataview-set.js
<ide> var bench = common.createBenchmark(main, {
<ide> millions: [1]
<ide> });
<ide>
<del>const INT8 = 0x7f;
<del>const INT16 = 0x7fff;
<del>const INT32 = 0x7fffffff;
<del>const UINT8 = INT8 * 2;
<add>const INT8 = 0x7f;
<add>const INT16 = 0x7fff;
<add>const INT32 = 0x7fffffff;
<add>const UINT8 = INT8 * 2;
<ide> const UINT16 = INT16 * 2;
<ide> const UINT32 = INT32 * 2;
<ide>
<ide><path>lib/internal/repl.js
<ide> function setupHistory(repl, historyPath, oldHistoryPath, ready) {
<ide> `the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`);
<ide> repl._refreshLine();
<ide>
<del> } else if (oldHistoryPath) {
<add> } else if (oldHistoryPath) {
<ide> // Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format.
<ide> repl._writeToOutput(
<ide> '\nConverting old JSON repl history to line-separated history.\n' +
<ide><path>lib/path.js
<ide> const win32 = {
<ide> end = i;
<ide> break;
<ide> }
<del> } else {
<add> } else {
<ide> // We saw the first non-path separator
<ide> matchedSlash = false;
<ide> }
<ide> const posix = {
<ide> end = i;
<ide> break;
<ide> }
<del> } else {
<add> } else {
<ide> // We saw the first non-path separator
<ide> matchedSlash = false;
<ide> }
<ide><path>lib/querystring.js
<ide> QueryString.unescapeBuffer = function(s, decodeSpaces) {
<ide> case 2: // Second hex digit
<ide> state = 0;
<ide> if (c >= 48/*0*/ && c <= 57/*9*/) {
<del> m = c - 48/*0*/;
<add> m = c - 48/*0*/;
<ide> } else if (c >= 65/*A*/ && c <= 70/*F*/) {
<ide> m = c - 65/*A*/ + 10;
<ide> } else if (c >= 97/*a*/ && c <= 102/*f*/) {
<ide><path>lib/repl.js
<ide> class LineParser {
<ide>
<ide> this.shouldFail = this.shouldFail ||
<ide> ((!this._literal && lastChar === '\\') ||
<del> (this._literal && lastChar !== '\\'));
<add> (this._literal && lastChar !== '\\'));
<ide>
<ide> return line;
<ide> }
<ide><path>lib/tls.js
<ide> function convertProtocols(protocols) {
<ide> return buff;
<ide> }
<ide>
<del>exports.convertNPNProtocols = function(protocols, out) {
<add>exports.convertNPNProtocols = function(protocols, out) {
<ide> // If protocols is Array - translate it into buffer
<ide> if (Array.isArray(protocols)) {
<ide> protocols = convertProtocols(protocols);
<ide><path>test/addons/buffer-free-callback/test.js
<ide> check(64, 1, 0);
<ide> check(97, 1, 0);
<ide>
<ide> // Buffers can be unaligned
<del>check(64, 8, 0);
<add>check(64, 8, 0);
<ide> check(64, 16, 0);
<del>check(64, 8, 1);
<add>check(64, 8, 1);
<ide> check(64, 16, 1);
<del>check(97, 8, 1);
<add>check(97, 8, 1);
<ide> check(97, 16, 1);
<del>check(97, 8, 3);
<add>check(97, 8, 3);
<ide> check(97, 16, 3);
<ide>
<ide> // Empty ArrayBuffer does not allocate data, worth checking
<ide><path>test/gc/test-http-client-connaborted.js
<ide> function serverHandler(req, res) {
<ide> res.connection.destroy();
<ide> }
<ide>
<del>const http = require('http');
<add>const http = require('http');
<ide> const weak = require('weak');
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide><path>test/parallel/test-buffer-alloc.js
<ide> Buffer.from(Buffer.allocUnsafe(0), 0, 0);
<ide> [ 'utf9',
<ide> 'utf-7',
<ide> 'Unicode-FTW',
<del> 'new gnu gun' ].forEach(function(enc) {
<add> 'new gnu gun' ].forEach(function(enc) {
<ide> assert.equal(Buffer.isEncoding(enc), false);
<ide> });
<ide>
<ide><path>test/parallel/test-buffer-concat.js
<ide> require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var zero = [];
<del>var one = [ Buffer.from('asdf') ];
<add>var one = [ Buffer.from('asdf') ];
<ide> var long = [];
<ide> for (var i = 0; i < 10; i++) long.push(Buffer.from('asdf'));
<ide>
<ide><path>test/parallel/test-buffer-includes.js
<ide> assert(!mixedByteStringUtf8.includes('\u0396'));
<ide> // Long string that isn't a simple repeat of a shorter string.
<ide> var longString = 'A';
<ide> for (let i = 66; i < 76; i++) { // from 'B' to 'K'
<del> longString = longString + String.fromCharCode(i) + longString;
<add> longString = longString + String.fromCharCode(i) + longString;
<ide> }
<ide>
<ide> const longBufferString = Buffer.from(longString);
<ide><path>test/parallel/test-buffer-indexof.js
<ide> assert.equal(-1, mixedByteStringUtf8.indexOf('\u0396'));
<ide> // Long string that isn't a simple repeat of a shorter string.
<ide> var longString = 'A';
<ide> for (let i = 66; i < 76; i++) { // from 'B' to 'K'
<del> longString = longString + String.fromCharCode(i) + longString;
<add> longString = longString + String.fromCharCode(i) + longString;
<ide> }
<ide>
<ide> var longBufferString = Buffer.from(longString);
<ide><path>test/parallel/test-buffer.js
<ide> Buffer(Buffer(0), 0, 0);
<ide> [ 'utf9',
<ide> 'utf-7',
<ide> 'Unicode-FTW',
<del> 'new gnu gun' ].forEach(function(enc) {
<add> 'new gnu gun' ].forEach(function(enc) {
<ide> assert.equal(Buffer.isEncoding(enc), false);
<ide> });
<ide>
<ide><path>test/parallel/test-crypto-fips.js
<ide> function testHelper(stream, args, expectedOutput, cmd, env) {
<ide> cmd + ' and args \'' + args + '\'');
<ide>
<ide> function childOk(child) {
<del> console.error('Child #' + ++num_children_ok +
<add> console.error('Child #' + ++num_children_ok +
<ide> ' [pid:' + child.pid + '] OK.');
<ide> }
<ide>
<ide><path>test/parallel/test-crypto-padding-aes256.js
<ide> var crypto = require('crypto');
<ide> crypto.DEFAULT_ENCODING = 'buffer';
<ide>
<ide> function aes256(decipherFinal) {
<del> var iv = Buffer.from('00000000000000000000000000000000', 'hex');
<add> var iv = Buffer.from('00000000000000000000000000000000', 'hex');
<ide> var key = Buffer.from('0123456789abcdef0123456789abcdef' +
<ide> '0123456789abcdef0123456789abcdef', 'hex');
<ide>
<ide><path>test/parallel/test-dgram-send-bad-arguments.js
<ide> assert.throws(function() {
<ide> }, TypeError); // First argument should be a buffer.
<ide>
<ide> // send(buf, offset, length, port, host)
<del>assert.throws(function() { sock.send(buf, 1, 1, -1, host); }, RangeError);
<del>assert.throws(function() { sock.send(buf, 1, 1, 0, host); }, RangeError);
<add>assert.throws(function() { sock.send(buf, 1, 1, -1, host); }, RangeError);
<add>assert.throws(function() { sock.send(buf, 1, 1, 0, host); }, RangeError);
<ide> assert.throws(function() { sock.send(buf, 1, 1, 65536, host); }, RangeError);
<ide>
<ide> // send(buf, port, host)
<del>assert.throws(function() { sock.send(23, 12345, host); }, TypeError);
<add>assert.throws(function() { sock.send(23, 12345, host); }, TypeError);
<ide>
<ide> // send([buf1, ..], port, host)
<ide> assert.throws(function() { sock.send([buf, 23], 12345, host); }, TypeError);
<ide><path>test/parallel/test-domain-abort-on-uncaught.js
<ide> if (process.argv[2] === 'child') {
<ide> testCmd += 'ulimit -c 0 && ';
<ide> }
<ide>
<del> testCmd += process.argv[0];
<add> testCmd += process.argv[0];
<ide> testCmd += ' ' + '--abort-on-uncaught-exception';
<ide> testCmd += ' ' + process.argv[1];
<ide> testCmd += ' ' + 'child';
<ide><path>test/parallel/test-domain-no-error-handler-abort-on-uncaught.js
<ide> if (process.argv[2] === 'child') {
<ide> testCmd += 'ulimit -c 0 && ';
<ide> }
<ide>
<del> testCmd += process.argv[0];
<add> testCmd += process.argv[0];
<ide> testCmd += ' ' + '--abort-on-uncaught-exception';
<ide> testCmd += ' ' + process.argv[1];
<ide> testCmd += ' ' + 'child';
<ide><path>test/parallel/test-domain-with-abort-on-uncaught-exception.js
<ide> if (process.argv[2] === 'child') {
<ide> if (options.useTryCatch)
<ide> useTryCatchOpt = 'useTryCatch';
<ide>
<del> cmdToExec += process.argv[0] + ' ';
<add> cmdToExec += process.argv[0] + ' ';
<ide> cmdToExec += (cmdLineOption ? cmdLineOption : '') + ' ';
<ide> cmdToExec += process.argv[1] + ' ';
<ide> cmdToExec += [
<ide><path>test/parallel/test-fs-null-bytes.js
<ide> function check(async, sync) {
<ide> async.apply(null, argsAsync);
<ide> }
<ide>
<del>check(fs.access, fs.accessSync, 'foo\u0000bar');
<del>check(fs.access, fs.accessSync, 'foo\u0000bar', fs.F_OK);
<del>check(fs.appendFile, fs.appendFileSync, 'foo\u0000bar');
<del>check(fs.chmod, fs.chmodSync, 'foo\u0000bar', '0644');
<del>check(fs.chown, fs.chownSync, 'foo\u0000bar', 12, 34);
<del>check(fs.link, fs.linkSync, 'foo\u0000bar', 'foobar');
<del>check(fs.link, fs.linkSync, 'foobar', 'foo\u0000bar');
<del>check(fs.lstat, fs.lstatSync, 'foo\u0000bar');
<del>check(fs.mkdir, fs.mkdirSync, 'foo\u0000bar', '0755');
<del>check(fs.open, fs.openSync, 'foo\u0000bar', 'r');
<del>check(fs.readFile, fs.readFileSync, 'foo\u0000bar');
<del>check(fs.readdir, fs.readdirSync, 'foo\u0000bar');
<del>check(fs.readlink, fs.readlinkSync, 'foo\u0000bar');
<del>check(fs.realpath, fs.realpathSync, 'foo\u0000bar');
<del>check(fs.rename, fs.renameSync, 'foo\u0000bar', 'foobar');
<del>check(fs.rename, fs.renameSync, 'foobar', 'foo\u0000bar');
<del>check(fs.rmdir, fs.rmdirSync, 'foo\u0000bar');
<del>check(fs.stat, fs.statSync, 'foo\u0000bar');
<del>check(fs.symlink, fs.symlinkSync, 'foo\u0000bar', 'foobar');
<del>check(fs.symlink, fs.symlinkSync, 'foobar', 'foo\u0000bar');
<del>check(fs.truncate, fs.truncateSync, 'foo\u0000bar');
<del>check(fs.unlink, fs.unlinkSync, 'foo\u0000bar');
<del>check(null, fs.unwatchFile, 'foo\u0000bar', common.fail);
<del>check(fs.utimes, fs.utimesSync, 'foo\u0000bar', 0, 0);
<del>check(null, fs.watch, 'foo\u0000bar', common.fail);
<del>check(null, fs.watchFile, 'foo\u0000bar', common.fail);
<del>check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar');
<add>check(fs.access, fs.accessSync, 'foo\u0000bar');
<add>check(fs.access, fs.accessSync, 'foo\u0000bar', fs.F_OK);
<add>check(fs.appendFile, fs.appendFileSync, 'foo\u0000bar');
<add>check(fs.chmod, fs.chmodSync, 'foo\u0000bar', '0644');
<add>check(fs.chown, fs.chownSync, 'foo\u0000bar', 12, 34);
<add>check(fs.link, fs.linkSync, 'foo\u0000bar', 'foobar');
<add>check(fs.link, fs.linkSync, 'foobar', 'foo\u0000bar');
<add>check(fs.lstat, fs.lstatSync, 'foo\u0000bar');
<add>check(fs.mkdir, fs.mkdirSync, 'foo\u0000bar', '0755');
<add>check(fs.open, fs.openSync, 'foo\u0000bar', 'r');
<add>check(fs.readFile, fs.readFileSync, 'foo\u0000bar');
<add>check(fs.readdir, fs.readdirSync, 'foo\u0000bar');
<add>check(fs.readlink, fs.readlinkSync, 'foo\u0000bar');
<add>check(fs.realpath, fs.realpathSync, 'foo\u0000bar');
<add>check(fs.rename, fs.renameSync, 'foo\u0000bar', 'foobar');
<add>check(fs.rename, fs.renameSync, 'foobar', 'foo\u0000bar');
<add>check(fs.rmdir, fs.rmdirSync, 'foo\u0000bar');
<add>check(fs.stat, fs.statSync, 'foo\u0000bar');
<add>check(fs.symlink, fs.symlinkSync, 'foo\u0000bar', 'foobar');
<add>check(fs.symlink, fs.symlinkSync, 'foobar', 'foo\u0000bar');
<add>check(fs.truncate, fs.truncateSync, 'foo\u0000bar');
<add>check(fs.unlink, fs.unlinkSync, 'foo\u0000bar');
<add>check(null, fs.unwatchFile, 'foo\u0000bar', common.fail);
<add>check(fs.utimes, fs.utimesSync, 'foo\u0000bar', 0, 0);
<add>check(null, fs.watch, 'foo\u0000bar', common.fail);
<add>check(null, fs.watchFile, 'foo\u0000bar', common.fail);
<add>check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar');
<ide>
<ide> // an 'error' for exists means that it doesn't exist.
<ide> // one of many reasons why this file is the absolute worst.
<ide><path>test/parallel/test-https-agent-session-eviction.js
<ide> https.createServer(options, function(req, res) {
<ide> });
<ide>
<ide> // Do request and let agent cache the session
<del>function first(server) {
<add>function first(server) {
<ide> const req = https.request({
<ide> port: common.PORT,
<ide> rejectUnauthorized: false
<ide><path>test/parallel/test-regress-GH-7511.js
<ide> const vm = require('vm');
<ide>
<ide> assert.doesNotThrow(function() {
<ide> var context = vm.createContext({ process: process });
<del> var result = vm.runInContext('process.env["PATH"]', context);
<add> var result = vm.runInContext('process.env["PATH"]', context);
<ide> assert.notEqual(undefined, result);
<ide> });
<ide><path>test/parallel/test-repl-domain.js
<ide> 'use strict';
<ide> var common = require('../common');
<ide>
<del>var repl = require('repl');
<add>var repl = require('repl');
<ide>
<ide> const putIn = new common.ArrayStream();
<ide> repl.start('', putIn);
<ide><path>test/parallel/test-stream2-writable.js
<ide> test('end callback after .write() call', function(t) {
<ide> test('end callback called after write callback', function(t) {
<ide> var tw = new TestWriter();
<ide> var writeCalledback = false;
<del> tw.write(Buffer.from('hello world'), function() {
<add> tw.write(Buffer.from('hello world'), function() {
<ide> writeCalledback = true;
<ide> });
<ide> tw.end(function() {
<ide><path>test/parallel/test-string-decoder.js
<ide> test(
<ide> test('ucs2', Buffer.from('ababc', 'ucs2'), 'ababc');
<ide>
<ide> // UTF-16LE
<del>test('ucs2', Buffer.from('3DD84DDC', 'hex'), '\ud83d\udc4d'); // thumbs up
<add>test('ucs2', Buffer.from('3DD84DDC', 'hex'), '\ud83d\udc4d'); // thumbs up
<ide>
<ide> console.log(' crayon!');
<ide>
<ide><path>test/parallel/test-tls-client-getephemeralkeyinfo.js
<ide> if (!common.hasCrypto) {
<ide> var tls = require('tls');
<ide>
<ide> var fs = require('fs');
<del>var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
<add>var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
<ide> var cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
<ide>
<ide> var ntests = 0;
<ide><path>test/parallel/test-tls-client-mindhsize.js
<ide> if (!common.hasCrypto) {
<ide> var tls = require('tls');
<ide>
<ide> var fs = require('fs');
<del>var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
<add>var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
<ide> var cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
<ide>
<ide> var nsuccess = 0;
<ide><path>test/parallel/test-tls-dhe.js
<ide> var tls = require('tls');
<ide>
<ide> var spawn = require('child_process').spawn;
<ide> var fs = require('fs');
<del>var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
<add>var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
<ide> var cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
<ide> var nsuccess = 0;
<ide> var ntests = 0;
<ide><path>test/timers/test-timers-reliability.js
<ide>
<ide> require('../common');
<ide>
<del>var Timer = process.binding('timer_wrap').Timer;
<add>var Timer = process.binding('timer_wrap').Timer;
<ide> var assert = require('assert');
<ide>
<del>var timerFired = false;
<add>var timerFired = false;
<ide> var intervalFired = false;
<ide>
<ide> /*
| 30
|
Javascript
|
Javascript
|
reapply changes from
|
9c8161ba81220143e7f87bd901697e46b14d8968
|
<ide><path>packages/react-devtools-extensions/src/backend.js
<ide> function welcome(event) {
<ide> ) {
<ide> return;
<ide> }
<del> const extensionId = event.data.extensionId;
<ide>
<ide> window.removeEventListener('message', welcome);
<ide>
<del> setup(window.__REACT_DEVTOOLS_GLOBAL_HOOK__, extensionId);
<add> setup(window.__REACT_DEVTOOLS_GLOBAL_HOOK__);
<ide> }
<ide>
<ide> window.addEventListener('message', welcome);
<ide>
<del>function setup(hook, extensionId) {
<add>function setup(hook) {
<ide> if (hook == null) {
<ide> // DevTools didn't get injected into this page (maybe b'c of the contentType).
<ide> return;
<ide> function setup(hook, extensionId) {
<ide> {
<ide> source: 'react-devtools-bridge',
<ide> payload: {event, payload},
<del> extensionId,
<ide> },
<ide> '*',
<ide> transferable,
<ide><path>packages/react-devtools-extensions/src/main.js
<ide> const LOCAL_STORAGE_SUPPORTS_PROFILING_KEY =
<ide> 'React::DevTools::supportsProfiling';
<ide>
<ide> const isChrome = getBrowserName() === 'Chrome';
<add>const isEdge = getBrowserName() === 'Edge';
<ide>
<ide> let panelCreated = false;
<ide>
<ide> function createPanelIfReactLoaded() {
<ide>
<ide> store = new Store(bridge, {
<ide> isProfiling,
<del> supportsReloadAndProfile: isChrome,
<add> supportsReloadAndProfile: isChrome || isEdge,
<ide> supportsProfiling,
<ide> // At this time, the scheduling profiler can only parse Chrome performance profiles.
<ide> supportsSchedulingProfiler: isChrome,
| 2
|
PHP
|
PHP
|
update method description
|
772887a8b3eef2966dc9580993c5fcd28a164721
|
<ide><path>src/Collection/Iterator/NoChildrenIterator.php
<ide> public function hasChildren(): bool
<ide> }
<ide>
<ide> /**
<del> * Returns null as there are no children for this iteration level
<add> * Returns a self instance without any elements.
<ide> *
<ide> * @return \RecursiveIterator
<ide> */
| 1
|
Java
|
Java
|
remove useless mounting diagnostic error
|
0aa8ed6361e981c509cb8370e2b404c08a3bc83d
|
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java
<ide> public void deleteView(int reactTag) {
<ide> View view = viewState.mView;
<ide>
<ide> if (view != null) {
<del> ViewParent parentView = view.getParent();
<del>
<del> if (parentView != null) {
<del> ReactSoftException.logSoftException(
<del> TAG,
<del> new IllegalStateException(
<del> "Warning: Deleting view that is still attached to parent: [" + reactTag + "]"));
<del> }
<del>
<ide> dropView(view);
<ide> } else {
<ide> mTagToViewState.remove(reactTag);
| 1
|
Ruby
|
Ruby
|
fix ruby 1.8 breakage
|
02cd2c899a02b1271cf6e4dd8ce816e5513d9f9c
|
<ide><path>Library/Homebrew/cmd/bottle.rb
<ide> def bottle_formula(f)
<ide>
<ide> tab = Tab.for_keg(keg)
<ide> original_tab = tab.dup
<del> tab["poured_from_bottle"] = false
<del> tab["HEAD"] = nil
<del> tab["time"] = nil
<add> tab.poured_from_bottle = false
<add> tab.HEAD = nil
<add> tab.time = nil
<ide> tab.write
<ide>
<ide> keg.find {|k| File.utime(File.atime(k), formula_source_time, k) }
| 1
|
Ruby
|
Ruby
|
fix wrong ordering on when clauses in audit.rb
|
d9242c540d82ec25019896a043410dd07b831609
|
<ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_deps
<ide> depends_on :ruby => "1.8"
<ide> where "1.8" is the minimum version of Ruby required.
<ide> EOS
<del> when "open-mpi", "mpich"
<del> problem <<-EOS.undent
<ide> when *BUILD_TIME_DEPS
<ide> next if dep.build? || dep.run?
<add> when "open-mpi", "mpich"
<ide> problem <<-EOS.undent
<ide> There are multiple conflicting ways to install MPI. Use an MPIRequirement:
<ide> depends_on :mpi => [<lang list>]
| 1
|
PHP
|
PHP
|
remove usage of deprecated function
|
cf19b0c5018bfd6d72759e9f2843d93cc4c849c1
|
<ide><path>tests/TestCase/Validation/ValidationTest.php
<ide> public function testNotBlankIso88591AppEncoding(): void
<ide> $this->assertTrue(Validation::notBlank('fooo' . chr(243) . 'blabla'));
<ide> $this->assertTrue(Validation::notBlank('abçďĕʑʘπй'));
<ide> $this->assertTrue(Validation::notBlank('José'));
<del> $this->assertTrue(Validation::notBlank(utf8_decode('José')));
<ide> $this->assertFalse(Validation::notBlank("\t "));
<ide> $this->assertFalse(Validation::notBlank(''));
<ide> }
| 1
|
PHP
|
PHP
|
add support for 'year' datatype for schema
|
2d1328b5eae791ea5771fabe077666321b3cdb70
|
<ide><path>src/Illuminate/Database/Schema/Blueprint.php
<ide> public function dateTime($column, $precision = 0)
<ide> return $this->addColumn('dateTime', $column, compact('precision'));
<ide> }
<ide>
<add> /**
<add> * Create a new year column on the table.
<add> *
<add> * @param string $column
<add> * @return \Illuminate\Support\Fluent
<add> */
<add> public function year($column)
<add> {
<add> return $this->addColumn('year', $column);
<add> }
<add>
<ide> /**
<ide> * Create a new date-time column (with time zone) on the table.
<ide> *
<ide><path>src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
<ide> protected function typeDate(Fluent $column)
<ide> return 'date';
<ide> }
<ide>
<add> /**
<add> * Create the column definition for a year type.
<add> *
<add> * @param \Illuminate\Support\Fluent $column
<add> * @return string
<add> */
<add> protected function typeYear(Fluent $column)
<add> {
<add> return 'year';
<add> }
<add>
<ide> /**
<ide> * Create the column definition for a date-time type.
<ide> *
<ide><path>src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
<ide> protected function typeDate(Fluent $column)
<ide> return 'date';
<ide> }
<ide>
<add> /**
<add> * Create the column definition for a year type (Polyfill).
<add> *
<add> * @param \Illuminate\Support\Fluent $column
<add> * @return string
<add> */
<add> protected function typeYear(Fluent $column)
<add> {
<add> return $this->typeInteger($column);
<add> }
<add>
<ide> /**
<ide> * Create the column definition for a date-time type.
<ide> *
<ide><path>src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
<ide> protected function typeDate(Fluent $column)
<ide> return 'date';
<ide> }
<ide>
<add> /**
<add> * Create the column definition for a year type (Polyfill).
<add> *
<add> * @param \Illuminate\Support\Fluent $column
<add> * @return string
<add> */
<add> protected function typeYear(Fluent $column)
<add> {
<add> return $this->typeInteger($column);
<add> }
<add>
<ide> /**
<ide> * Create the column definition for a date-time type.
<ide> *
<ide><path>src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
<ide> protected function typeDate(Fluent $column)
<ide> return 'date';
<ide> }
<ide>
<add> /**
<add> * Create the column definition for a year type (Polyfill).
<add> *
<add> * @param \Illuminate\Support\Fluent $column
<add> * @return string
<add> */
<add> protected function typeYear(Fluent $column)
<add> {
<add> return $this->typeInteger($column);
<add> }
<add>
<add>
<ide> /**
<ide> * Create the column definition for a date-time type.
<ide> *
<ide><path>tests/Database/DatabaseMySqlSchemaGrammarTest.php
<ide> public function testAddingDate()
<ide> $this->assertEquals('alter table `users` add `foo` date not null', $statements[0]);
<ide> }
<ide>
<add> public function testAddingYear()
<add> {
<add> $blueprint = new Blueprint('users');
<add> $blueprint->year('birth_year');
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add> $this->assertCount(1, $statements);
<add> $this->assertEquals('alter table `users` add `birth_year` year not null', $statements[0]);
<add> }
<add>
<ide> public function testAddingDateTime()
<ide> {
<ide> $blueprint = new Blueprint('users');
<ide><path>tests/Database/DatabasePostgresSchemaGrammarTest.php
<ide> public function testAddingDate()
<ide> $this->assertEquals('alter table "users" add column "foo" date not null', $statements[0]);
<ide> }
<ide>
<add> public function testAddingYear()
<add> {
<add> $blueprint = new Blueprint('users');
<add> $blueprint->year('birth_year');
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add> $this->assertCount(1, $statements);
<add> $this->assertEquals('alter table "users" add column "birth_year" integer not null', $statements[0]);
<add> }
<add>
<ide> public function testAddingJson()
<ide> {
<ide> $blueprint = new Blueprint('users');
<ide><path>tests/Database/DatabaseSQLiteSchemaGrammarTest.php
<ide> public function testAddingDate()
<ide> $this->assertEquals('alter table "users" add column "foo" date not null', $statements[0]);
<ide> }
<ide>
<add> public function testAddingYear()
<add> {
<add> $blueprint = new Blueprint('users');
<add> $blueprint->year('birth_year');
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add> $this->assertCount(1, $statements);
<add> $this->assertEquals('alter table "users" add column "birth_year" integer not null', $statements[0]);
<add> }
<add>
<ide> public function testAddingDateTime()
<ide> {
<ide> $blueprint = new Blueprint('users');
<ide><path>tests/Database/DatabaseSqlServerSchemaGrammarTest.php
<ide> public function testAddingDate()
<ide> $this->assertEquals('alter table "users" add "foo" date not null', $statements[0]);
<ide> }
<ide>
<add> public function testAddingYear()
<add> {
<add> $blueprint = new Blueprint('users');
<add> $blueprint->year('birth_year');
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add> $this->assertCount(1, $statements);
<add> $this->assertEquals('alter table "users" add "birth_year" int not null', $statements[0]);
<add> }
<add>
<ide> public function testAddingDateTime()
<ide> {
<ide> $blueprint = new Blueprint('users');
| 9
|
Go
|
Go
|
fix validation of non-existing bind-mount source
|
84d5ab96ef33355e65f5c31210eb1777db372c52
|
<ide><path>daemon/cluster/executor/container/validate.go
<ide> package container
<ide>
<ide> import (
<ide> "fmt"
<add> "os"
<ide> "path/filepath"
<ide>
<ide> "github.com/docker/swarmkit/api"
<ide> func validateMounts(mounts []api.Mount) error {
<ide> if !filepath.IsAbs(mount.Source) {
<ide> return fmt.Errorf("invalid bind mount source, must be an absolute path: %s", mount.Source)
<ide> }
<add> if _, err := os.Stat(mount.Source); os.IsNotExist(err) {
<add> return fmt.Errorf("invalid bind mount source, source path not found: %s", mount.Source)
<add> }
<ide> case api.MountTypeVolume:
<ide> if filepath.IsAbs(mount.Source) {
<ide> return fmt.Errorf("invalid volume mount source, must not be an absolute path: %s", mount.Source)
<ide><path>daemon/cluster/executor/container/validate_test.go
<ide> package container
<ide>
<ide> import (
<add> "io/ioutil"
<add> "os"
<ide> "strings"
<ide> "testing"
<ide>
<ide> func TestControllerValidateMountBind(t *testing.T) {
<ide> t.Fatalf("expected error, got: %v", err)
<ide> }
<ide>
<add> // with non-existing source
<add> if _, err := newTestControllerWithMount(api.Mount{
<add> Type: api.MountTypeBind,
<add> Source: "/some-non-existing-host-path/",
<add> Target: testAbsPath,
<add> }); err == nil || !strings.Contains(err.Error(), "invalid bind mount source") {
<add> t.Fatalf("expected error, got: %v", err)
<add> }
<add>
<ide> // with proper source
<add> tmpdir, err := ioutil.TempDir("", "TestControllerValidateMountBind")
<add> if err != nil {
<add> t.Fatalf("failed to create temp dir: %v", err)
<add> }
<add> defer os.Remove(tmpdir)
<add>
<ide> if _, err := newTestControllerWithMount(api.Mount{
<ide> Type: api.MountTypeBind,
<del> Source: testAbsPath,
<add> Source: tmpdir,
<ide> Target: testAbsPath,
<ide> }); err != nil {
<ide> t.Fatalf("expected error, got: %v", err)
<ide> func TestControllerValidateMountVolume(t *testing.T) {
<ide> }
<ide>
<ide> func TestControllerValidateMountTarget(t *testing.T) {
<add> tmpdir, err := ioutil.TempDir("", "TestControllerValidateMountTarget")
<add> if err != nil {
<add> t.Fatalf("failed to create temp dir: %v", err)
<add> }
<add> defer os.Remove(tmpdir)
<add>
<ide> // with improper target
<ide> if _, err := newTestControllerWithMount(api.Mount{
<ide> Type: api.MountTypeBind,
<ide> func TestControllerValidateMountTarget(t *testing.T) {
<ide> // with proper target
<ide> if _, err := newTestControllerWithMount(api.Mount{
<ide> Type: api.MountTypeBind,
<del> Source: testAbsPath,
<add> Source: tmpdir,
<ide> Target: testAbsPath,
<ide> }); err != nil {
<ide> t.Fatalf("expected no error, got: %v", err)
| 2
|
Javascript
|
Javascript
|
make checks for bugfixes better
|
c5f1ca3d917cb89c2da19a946734685d2ea2b07b
|
<ide><path>compare-master-to-stable.js
<ide> then(allInSeries(function (branch) {
<ide> line = line.split(' ');
<ide> var sha = line.shift();
<ide> var msg = line.join(' ');
<del> return sha + (msg.toLowerCase().indexOf('fix') === -1 ? ' ' : ' * ') + msg;
<add> return sha + ((/fix\([^\)]+\):/i.test(msg)) ? ' * ' : ' ') + msg;
<ide> });
<ide> branch.log = log.map(function (line) {
<ide> return line.substr(41);
| 1
|
Javascript
|
Javascript
|
add minheight to buttons in in scrollviewexamples
|
61f538ae95a9d11ed946213adea5f10bcbbdbec6
|
<ide><path>packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js
<ide> const InvertStickyHeaders = () => {
<ide> {<Text>STICKY HEADER</Text>}
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> onPress={() => setInvertStickyHeaders(!invertStickyHeaders)}
<del> label={'invertStickyHeaders: ' + invertStickyHeaders.toString()}
<del> />
<del> <Button
<del> label="Scroll to top"
<del> onPress={() => {
<del> nullthrows(_scrollView.current).scrollTo({y: 0});
<del> }}
<del> testID="scroll_to_top_button"
<del> />
<del> <Button
<del> label="Scroll to bottom"
<del> onPress={() => {
<del> nullthrows(_scrollView.current).scrollToEnd({animated: true});
<del> }}
<del> testID="scroll_to_bottom_button"
<del> />
<add> <View>
<add> <Button
<add> onPress={() => setInvertStickyHeaders(!invertStickyHeaders)}
<add> label={'invertStickyHeaders: ' + invertStickyHeaders.toString()}
<add> />
<add> <Button
<add> label="Scroll to top"
<add> onPress={() => {
<add> nullthrows(_scrollView.current).scrollTo({y: 0});
<add> }}
<add> testID="scroll_to_top_button"
<add> />
<add> <Button
<add> label="Scroll to bottom"
<add> onPress={() => {
<add> nullthrows(_scrollView.current).scrollToEnd({animated: true});
<add> }}
<add> testID="scroll_to_bottom_button"
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const MultipleStickyHeaders = () => {
<ide> {<Item msg={'Sticky Header 3'} style={stickyHeaderStyle} />}
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> label="Scroll to top"
<del> onPress={() => {
<del> nullthrows(_scrollView.current).scrollTo({y: 0});
<del> }}
<del> testID="scroll_to_top_button"
<del> />
<del> <Button
<del> label="Scroll to bottom"
<del> onPress={() => {
<del> nullthrows(_scrollView.current).scrollToEnd({animated: true});
<del> }}
<del> testID="scroll_to_bottom_button"
<del> />
<add> <View>
<add> <Button
<add> label="Scroll to top"
<add> onPress={() => {
<add> nullthrows(_scrollView.current).scrollTo({y: 0});
<add> }}
<add> testID="scroll_to_top_button"
<add> />
<add> <Button
<add> label="Scroll to bottom"
<add> onPress={() => {
<add> nullthrows(_scrollView.current).scrollToEnd({animated: true});
<add> }}
<add> testID="scroll_to_bottom_button"
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const IndicatorStyle = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> onPress={() =>
<del> indicatorStyle === 'default'
<del> ? setIndicatorStyle('white')
<del> : setIndicatorStyle('default')
<del> }
<del> label={'Indicator Style: ' + indicatorStyle}
<del> />
<add> <View>
<add> <Button
<add> onPress={() =>
<add> indicatorStyle === 'default'
<add> ? setIndicatorStyle('white')
<add> : setIndicatorStyle('default')
<add> }
<add> label={'Indicator Style: ' + indicatorStyle}
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const DisableEnable = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> {Platform.OS === 'ios' ? (
<add> <View>
<add> {Platform.OS === 'ios' ? (
<add> <Button
<add> onPress={() => setDirectionalLockEnabled(!directionalLockEnabled)}
<add> label={
<add> 'directionalLockEnabled: ' + directionalLockEnabled.toString()
<add> }
<add> />
<add> ) : null}
<ide> <Button
<del> onPress={() => setDirectionalLockEnabled(!directionalLockEnabled)}
<del> label={'directionalLockEnabled: ' + directionalLockEnabled.toString()}
<add> onPress={() => setDisableIntervalMomentum(!disableIntervalMomentum)}
<add> label={
<add> 'setDisableIntervalMomentum: ' + disableIntervalMomentum.toString()
<add> }
<ide> />
<del> ) : null}
<del> <Button
<del> onPress={() => setDisableIntervalMomentum(!disableIntervalMomentum)}
<del> label={
<del> 'setDisableIntervalMomentum: ' + disableIntervalMomentum.toString()
<del> }
<del> />
<del> <Button
<del> onPress={() =>
<del> setDisableScrollViewPanResponder(!disableScrollViewPanResponder)
<del> }
<del> label={
<del> 'setDisableScrollViewPanResponder: ' +
<del> disableScrollViewPanResponder.toString()
<del> }
<del> />
<add> <Button
<add> onPress={() =>
<add> setDisableScrollViewPanResponder(!disableScrollViewPanResponder)
<add> }
<add> label={
<add> 'setDisableScrollViewPanResponder: ' +
<add> disableScrollViewPanResponder.toString()
<add> }
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const DecelerationRateExample = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> onPress={() =>
<del> decelRate === 'normal' ? setDecelRate('fast') : setDecelRate('normal')
<del> }
<del> label={'Deceleration Rate: ' + decelRate}
<del> />
<add> <View>
<add> <Button
<add> onPress={() =>
<add> decelRate === 'normal'
<add> ? setDecelRate('fast')
<add> : setDecelRate('normal')
<add> }
<add> label={'Deceleration Rate: ' + decelRate}
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const ContentExample = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> {Platform.OS === 'ios' ? (
<del> <>
<del> <Button
<del> onPress={() => setCanCancelContentTouches(!canCancelContentTouches)}
<del> label={
<del> 'canCancelContentTouches: ' + canCancelContentTouches.toString()
<del> }
<del> />
<del> <Button
<del> onPress={() =>
<del> contentInsetAdjustmentBehavior === 'never'
<del> ? setContentInsetAdjustmentBehavior('always')
<del> : setContentInsetAdjustmentBehavior('never')
<del> }
<del> label={
<del> contentInsetAdjustmentBehavior === 'never'
<del> ? "setContentInsetAdjustmentBehavior to 'always'"
<del> : 'reset content inset adjustment behavior'
<del> }
<del> />
<del> </>
<del> ) : null}
<del> <Button
<del> onPress={() =>
<del> contentContainerStyle === null
<del> ? setContentContainerStyle(styles.containerStyle)
<del> : setContentContainerStyle(null)
<del> }
<del> label={
<del> contentContainerStyle === null
<del> ? 'setContentContainerStyle'
<del> : 'reset content container style'
<del> }
<del> />
<del> <Button
<del> onPress={() =>
<del> contentInset === null
<del> ? setContentInset({top: 10, bottom: 10, left: 10, right: 10})
<del> : setContentInset(null)
<del> }
<del> label={
<del> contentInset === null ? 'setContentInset' : 'reset content inset'
<del> }
<del> />
<add> <View>
<add> {Platform.OS === 'ios' ? (
<add> <>
<add> <Button
<add> onPress={() =>
<add> setCanCancelContentTouches(!canCancelContentTouches)
<add> }
<add> label={
<add> 'canCancelContentTouches: ' + canCancelContentTouches.toString()
<add> }
<add> />
<add> <Button
<add> onPress={() =>
<add> contentInsetAdjustmentBehavior === 'never'
<add> ? setContentInsetAdjustmentBehavior('always')
<add> : setContentInsetAdjustmentBehavior('never')
<add> }
<add> label={
<add> contentInsetAdjustmentBehavior === 'never'
<add> ? "setContentInsetAdjustmentBehavior to 'always'"
<add> : 'reset content inset adjustment behavior'
<add> }
<add> />
<add> </>
<add> ) : null}
<add> <Button
<add> onPress={() =>
<add> contentContainerStyle === null
<add> ? setContentContainerStyle(styles.containerStyle)
<add> : setContentContainerStyle(null)
<add> }
<add> label={
<add> contentContainerStyle === null
<add> ? 'setContentContainerStyle'
<add> : 'reset content container style'
<add> }
<add> />
<add> <Button
<add> onPress={() =>
<add> contentInset === null
<add> ? setContentInset({top: 10, bottom: 10, left: 10, right: 10})
<add> : setContentInset(null)
<add> }
<add> label={
<add> contentInset === null ? 'setContentInset' : 'reset content inset'
<add> }
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const BouncesExample = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> onPress={() => setBounces(!bounces)}
<del> label={'Bounces: ' + bounces.toString()}
<del> />
<del> <Button
<del> onPress={() => setBouncesZoom(!bouncesZoom)}
<del> label={'Bounces Zoom: ' + bouncesZoom.toString()}
<del> />
<add> <View>
<add> <Button
<add> onPress={() => setBounces(!bounces)}
<add> label={'Bounces: ' + bounces.toString()}
<add> />
<add> <Button
<add> onPress={() => setBouncesZoom(!bouncesZoom)}
<add> label={'Bounces Zoom: ' + bouncesZoom.toString()}
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const BouncesExampleHorizontal = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> onPress={() => setBounce(!bounce)}
<del> label={'Always Bounce Horizontal: ' + bounce.toString()}
<del> />
<add> <View>
<add> <Button
<add> onPress={() => setBounce(!bounce)}
<add> label={'Always Bounce Horizontal: ' + bounce.toString()}
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const BouncesExampleVertical = () => {
<ide> nestedScrollEnabled>
<ide> {ITEMS.map(createItemRow)}
<ide> </ScrollView>
<del> <Button
<del> onPress={() => setBounce(!bounce)}
<del> label={'Always Bounce Vertical: ' + bounce.toString()}
<del> />
<add> <View>
<add> <Button
<add> onPress={() => setBounce(!bounce)}
<add> label={'Always Bounce Vertical: ' + bounce.toString()}
<add> />
<add> </View>
<ide> </View>
<ide> );
<ide> };
<ide> const styles = StyleSheet.create({
<ide> alignItems: 'center',
<ide> backgroundColor: '#cccccc',
<ide> borderRadius: 3,
<add> minHeight: 30,
<ide> },
<ide> row: {
<ide> flexDirection: 'row',
| 1
|
Python
|
Python
|
fix activity_regularizer in convlstm
|
d72514d6cca9b09842ab31536c16a01e5cd51f6f
|
<ide><path>keras/layers/convolutional.py
<ide> def build(self, input_shape):
<ide> if len(input_shape) != 4:
<ide> raise ValueError('Inputs should have rank ' +
<ide> str(4) +
<del> 'Received input shape:', str(input_shape))
<add> '; Received input shape:', str(input_shape))
<ide> if self.data_format == 'channels_first':
<ide> channel_axis = 1
<ide> else:
<ide><path>keras/layers/convolutional_recurrent.py
<ide> def __init__(self, filters,
<ide> self.kernel_regularizer = regularizers.get(kernel_regularizer)
<ide> self.recurrent_regularizer = regularizers.get(recurrent_regularizer)
<ide> self.bias_regularizer = regularizers.get(bias_regularizer)
<add> self.activity_regularizer = regularizers.get(activity_regularizer)
<ide>
<ide> self.kernel_constraint = constraints.get(kernel_constraint)
<ide> self.recurrent_constraint = constraints.get(recurrent_constraint)
<ide> def get_config(self):
<ide> 'kernel_regularizer': regularizers.serialize(self.kernel_regularizer),
<ide> 'recurrent_regularizer': regularizers.serialize(self.recurrent_regularizer),
<ide> 'bias_regularizer': regularizers.serialize(self.bias_regularizer),
<add> 'activity_regularizer': regularizers.serialize(self.activity_regularizer),
<ide> 'kernel_constraint': constraints.serialize(self.kernel_constraint),
<ide> 'recurrent_constraint': constraints.serialize(self.recurrent_constraint),
<ide> 'bias_constraint': constraints.serialize(self.bias_constraint),
<ide><path>tests/keras/layers/convolutional_recurrent_test.py
<ide> def test_convolutional_recurrent():
<ide> 'kernel_regularizer': regularizers.L1L2(l1=0.01),
<ide> 'recurrent_regularizer': regularizers.L1L2(l1=0.01),
<ide> 'bias_regularizer': 'l2',
<add> 'activity_regularizer': 'l2',
<ide> 'kernel_constraint': 'max_norm',
<ide> 'recurrent_constraint': 'max_norm',
<ide> 'bias_constraint': 'max_norm',
<ide> def test_convolutional_recurrent():
<ide> layer = convolutional_recurrent.ConvLSTM2D(**kwargs)
<ide> layer.build(inputs.shape)
<ide> assert len(layer.losses) == 3
<add> assert layer.activity_regularizer
<ide> output = layer(K.variable(np.ones(inputs.shape)))
<del> assert len(layer.losses) == 3
<add> assert len(layer.losses) == 4
<ide> K.eval(output)
<ide>
<ide> # check dropout
| 3
|
Text
|
Text
|
add richardlau to collaborators
|
cb6c0c14eb58fb0660bc429cce37ef7e519ad06d
|
<ide><path>README.md
<ide> more information about the governance of the Node.js project, see
<ide> **Prince John Wesley** <princejohnwesley@gmail.com>
<ide> * [qard](https://github.com/qard) -
<ide> **Stephen Belanger** <admin@stephenbelanger.com> (he/him)
<add>* [richardlau](https://github.com/richardlau) -
<add>**Richard Lau** <riclau@uk.ibm.com>
<ide> * [rlidwka](https://github.com/rlidwka) -
<ide> **Alex Kocharin** <alex@kocharin.ru>
<ide> * [rmg](https://github.com/rmg) -
| 1
|
Python
|
Python
|
fix typo in setup build for npymath
|
a0ac87205774790e0c5203dc0a95a1d6e2ebd0b8
|
<ide><path>numpy/core/setup.py
<ide> def get_mathlib_info(*args):
<ide> config.add_installed_library('npymath',
<ide> sources=[join('src', 'npymath', 'npy_math.c.src'),
<ide> join('src', 'npymath', 'ieee754.c'),
<del> join('src', 'npymath', 'npy_math_complex.c.src',
<del> get_mathlib_info)],
<add> join('src', 'npymath', 'npy_math_complex.c.src'),
<add> get_mathlib_info],
<ide> install_dir='lib')
<ide> config.add_npy_pkg_config("npymath.ini.in", "lib/npy-pkg-config",
<ide> subst_dict)
| 1
|
Python
|
Python
|
set version to v2.2.2.dev3
|
c2f5f9f5727fd854a6147e71ed6625b7c57c4150
|
<ide><path>spacy/about.py
<ide> # fmt: off
<ide> __title__ = "spacy"
<del>__version__ = "2.2.2.dev2"
<add>__version__ = "2.2.2.dev3"
<ide> __release__ = True
<ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download"
<ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
| 1
|
Ruby
|
Ruby
|
remove global cache
|
644a1796c67ed4d55e2d2ae7182a6a020350f13c
|
<ide><path>activesupport/lib/active_support/notifications.rb
<ide> module ActiveSupport
<ide> # to log subscribers in a thread. You can use any queue implementation you want.
<ide> #
<ide> module Notifications
<del> @instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) }
<del>
<ide> class Registry # :nodoc:
<ide> def self.instance
<ide> Thread.current[name] ||= new
<ide> def publish(name, *args)
<ide> end
<ide>
<ide> def instrument(name, payload = {})
<del> if @instrumenters[name]
<add> if notifier.listening?(name)
<ide> instrumenter.instrument(name, payload) { yield payload if block_given? }
<ide> else
<ide> yield payload if block_given?
<ide> end
<ide> end
<ide>
<ide> def subscribe(*args, &block)
<del> notifier.subscribe(*args, &block).tap do
<del> @instrumenters.clear
<del> end
<add> notifier.subscribe(*args, &block)
<ide> end
<ide>
<ide> def subscribed(callback, *args, &block)
<ide> def subscribed(callback, *args, &block)
<ide>
<ide> def unsubscribe(args)
<ide> notifier.unsubscribe(args)
<del> @instrumenters.clear
<ide> end
<ide>
<ide> def instrumenter
| 1
|
Ruby
|
Ruby
|
fix typo and remove 'examples' noise [ci skip]
|
a3d18d2ec0d73ed8eb92c913e324884aab7aa85b
|
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb
<ide> module FinderMethods
<ide> # If no record can be found for all of the listed ids, then RecordNotFound will be raised. If the primary key
<ide> # is an integer, find by id coerces its arguments using +to_i+.
<ide> #
<del> # ==== Examples
<del> #
<ide> # Person.find(1) # returns the object for ID = 1
<ide> # Person.find("1") # returns the object for ID = 1
<ide> # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6)
<ide> def find(*args)
<ide> #
<ide> # Post.find_by name: 'Spartacus', rating: 4
<ide> # Post.find_by "published_at < ?", 2.weeks.ago
<del> #
<ide> def find_by(*args)
<ide> where(*args).take
<ide> end
<ide> def find_by!(*args)
<ide> # order. The order will depend on the database implementation.
<ide> # If an order is supplied it will be respected.
<ide> #
<del> # Examples:
<del> #
<ide> # Person.take # returns an object fetched by SELECT * FROM people
<ide> # Person.take(5) # returns 5 objects fetched by SELECT * FROM people LIMIT 5
<ide> # Person.where(["name LIKE '%?'", name]).take
<ide> def take!
<ide> # Find the first record (or first N records if a parameter is supplied).
<ide> # If no order is defined it will order by primary key.
<ide> #
<del> # Examples:
<del> #
<ide> # Person.first # returns the first object fetched by SELECT * FROM people
<ide> # Person.where(["user_name = ?", user_name]).first
<ide> # Person.where(["user_name = :u", { :u => user_name }]).first
<ide> # Person.order("created_on DESC").offset(5).first
<del> # Person.first(3) # returns the first 3 objects fetched by SELECT * FROM people LIMIT 3
<add> # Person.first(3) # returns the first three objects fetched by SELECT * FROM people LIMIT 3
<ide> def first(limit = nil)
<ide> if limit
<ide> if order_values.empty? && primary_key
<ide> def first!
<ide> # Find the last record (or last N records if a parameter is supplied).
<ide> # If no order is defined it will order by primary key.
<ide> #
<del> # Examples:
<del> #
<ide> # Person.last # returns the last object fetched by SELECT * FROM people
<ide> # Person.where(["user_name = ?", user_name]).last
<ide> # Person.order("created_on DESC").offset(5).last
<del> # Person.last(3) # returns the last 3 objects fetched by SELECT * FROM people.
<add> # Person.last(3) # returns the last three objects fetched by SELECT * FROM people.
<ide> #
<del> # Take note that in that last case, the results are sorted in ascending order:
<add> # Take note that in that last case, the results are sorted in ascending order:
<ide> #
<del> # [#<Person id:2>, #<Person id:3>, #<Person id:4>]
<add> # [#<Person id:2>, #<Person id:3>, #<Person id:4>]
<ide> #
<del> # and not
<add> # and not:
<ide> #
<del> # [#<Person id:4>, #<Person id:3>, #<Person id:2>]
<add> # [#<Person id:4>, #<Person id:3>, #<Person id:2>]
<ide> def last(limit = nil)
<ide> if limit
<ide> if order_values.empty? && primary_key
<ide> def last!
<ide> # Runs the query on the database and returns records with the used query
<ide> # methods.
<ide> #
<del> # Examples:
<del> #
<ide> # Person.all # returns an array of objects for all the rows fetched by SELECT * FROM people
<ide> # Person.where(["category IN (?)", categories]).limit(50).all
<ide> # Person.where({ :friends => ["Bob", "Steve", "Fred"] }).all
<ide> def all
<ide> # 'Jamie'</tt>), since it would be sanitized and then queried against
<ide> # the primary key column, like <tt>id = 'name = \'Jamie\''</tt>.
<ide> #
<del> # ==== Examples
<ide> # Person.exists?(5)
<ide> # Person.exists?('5')
<ide> # Person.exists?(['name LIKE ?', "%#{query}%"])
| 1
|
Ruby
|
Ruby
|
use a specific exception for unsupported visits
|
145f32ad8516f9654bdc469096c65549354829ab
|
<ide><path>lib/arel/visitors/to_sql.rb
<ide>
<ide> module Arel
<ide> module Visitors
<add> class UnsupportedVisitError < StandardError
<add> def initialize(object)
<add> super "Unsupported argument type: #{object.class.name}. Construct an Arel node instead."
<add> end
<add> end
<add>
<ide> class ToSql < Arel::Visitors::Reduce
<ide> ##
<ide> # This is some roflscale crazy stuff. I'm roflscaling this because
<ide> def quoted o, a
<ide> end
<ide>
<ide> def unsupported o, collector
<del> raise "unsupported argument type: #{o.class.name}. Construct an Arel node instead."
<add> raise UnsupportedVisitError.new(o)
<ide> end
<ide>
<ide> alias :visit_ActiveSupport_Multibyte_Chars :unsupported
<ide><path>test/visitors/test_to_sql.rb
<ide> def dispatch
<ide> compile(Nodes.build_quoted(nil)).must_be_like "NULL"
<ide> end
<ide>
<del> it "unsupported input should not raise ArgumentError" do
<del> error = assert_raises(RuntimeError) { compile(nil) }
<del> assert_match(/\Aunsupported/, error.message)
<add> it "unsupported input should raise UnsupportedVisitError" do
<add> error = assert_raises(UnsupportedVisitError) { compile(nil) }
<add> assert_match(/\AUnsupported/, error.message)
<ide> end
<ide>
<ide> it "should visit_Arel_SelectManager, which is a subquery" do
| 2
|
Ruby
|
Ruby
|
remove overridden methods from pathresolver
|
5789e827d0a521832378f987e00a7bd6181a7e67
|
<ide><path>actionview/lib/action_view/template/resolver.rb
<ide> def reject_files_external_to_app(files)
<ide> files.reject { |filename| !inside_path?(@path, filename) }
<ide> end
<ide>
<del> def find_template_paths_from_details(path, details)
<del> if path.name.include?(".")
<del> return []
<del> end
<del>
<del> query = build_query(path, details)
<del> find_template_paths(query)
<del> end
<del>
<del> def find_template_paths(query)
<del> Dir[query].uniq.reject do |filename|
<del> File.directory?(filename) ||
<del> # deals with case-insensitive file systems.
<del> !File.fnmatch(query, filename, File::FNM_EXTGLOB)
<del> end
<del> end
<del>
<ide> def inside_path?(path, filename)
<ide> filename = File.expand_path(filename)
<ide> path = File.join(path, "")
<ide> filename.start_with?(path)
<ide> end
<ide>
<del> # Helper for building query glob string based on resolver's pattern.
<del> def build_query(path, details)
<del> query = @pattern.dup
<del>
<del> prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
<del> query.gsub!(/:prefix(\/)?/, prefix)
<del>
<del> partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
<del> query.gsub!(":action", partial)
<del>
<del> details.each do |ext, candidates|
<del> if ext == :variants && candidates == :any
<del> query.gsub!(/:#{ext}/, "*")
<del> else
<del> query.gsub!(/:#{ext}/, "{#{candidates.compact.uniq.join(',')}}")
<del> end
<del> end
<del>
<del> File.expand_path(query, @path)
<del> end
<del>
<ide> def escape_entry(entry)
<ide> entry.gsub(/[*?{}\[\]]/, '\\\\\\&')
<ide> end
| 1
|
Java
|
Java
|
add missing package-info.java file
|
afff8499924f367b8e76ca88a22d49ca0f039e6b
|
<ide><path>spring-test/src/main/java/org/springframework/test/context/aot/hint/package-info.java
<add>/**
<add> * Support for registering hints for reflection and resources in the
<add> * <em>Spring TestContext Framework</em>.
<add> */
<add>@NonNullApi
<add>@NonNullFields
<add>package org.springframework.test.context.aot.hint;
<add>
<add>import org.springframework.lang.NonNullApi;
<add>import org.springframework.lang.NonNullFields;
| 1
|
Java
|
Java
|
implement rcttextinlineimage with nodes
|
31d2443dd4ad50b83823743ddb37ed7432f243a5
|
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatTextShadowNode.java
<ide> public boolean isVirtual() {
<ide>
<ide> protected abstract void performCollectText(SpannableStringBuilder builder);
<ide> protected abstract void performApplySpans(SpannableStringBuilder builder, int begin, int end);
<add> protected abstract void performCollectAttachDetachListeners(StateBuilder stateBuilder);
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatUIImplementation.java
<ide> public static FlatUIImplementation createInstance(
<ide> viewManagers.add(new RCTTextManager());
<ide> viewManagers.add(new RCTRawTextManager());
<ide> viewManagers.add(new RCTVirtualTextManager());
<add> viewManagers.add(new RCTTextInlineImageManager());
<ide> viewManagers.add(new RCTImageViewManager());
<ide>
<ide> ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagers);
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/InlineImageSpanWithPipeline.java
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> */
<add>
<add>package com.facebook.react.flat;
<add>
<add>import javax.annotation.Nullable;
<add>
<add>import android.graphics.Bitmap;
<add>import android.graphics.Canvas;
<add>import android.graphics.Paint;
<add>import android.graphics.RectF;
<add>import android.text.style.ReplacementSpan;
<add>
<add>import com.facebook.imagepipeline.request.ImageRequest;
<add>import com.facebook.infer.annotation.Assertions;
<add>
<add>/* package */ final class InlineImageSpanWithPipeline extends ReplacementSpan
<add> implements AttachDetachListener, BitmapUpdateListener {
<add>
<add> private static final RectF TMP_RECT = new RectF();
<add>
<add> private @Nullable PipelineRequestHelper mRequestHelper;
<add> private @Nullable FlatViewGroup.InvalidateCallback mCallback;
<add> private float mWidth;
<add> private float mHeight;
<add> private boolean mFrozen;
<add>
<add> /* package */ InlineImageSpanWithPipeline() {
<add> this(null, Float.NaN, Float.NaN);
<add> }
<add>
<add> private InlineImageSpanWithPipeline(
<add> @Nullable PipelineRequestHelper requestHelper,
<add> float width,
<add> float height) {
<add> mRequestHelper = requestHelper;
<add> mWidth = width;
<add> mHeight = height;
<add> }
<add>
<add> /* package */ InlineImageSpanWithPipeline mutableCopy() {
<add> return new InlineImageSpanWithPipeline(mRequestHelper, mWidth, mHeight);
<add> }
<add>
<add> /* package */ boolean hasImageRequest() {
<add> return mRequestHelper != null;
<add> }
<add>
<add> /**
<add> * Assigns a new image request to the DrawImage, or null to clear the image request.
<add> */
<add> /* package */ void setImageRequest(@Nullable ImageRequest imageRequest) {
<add> if (imageRequest == null) {
<add> mRequestHelper = null;
<add> } else {
<add> mRequestHelper = new PipelineRequestHelper(imageRequest);
<add> }
<add> }
<add>
<add> /* package */ float getWidth() {
<add> return mWidth;
<add> }
<add>
<add> /* package */ void setWidth(float width) {
<add> mWidth = width;
<add> }
<add>
<add> /* package */ float getHeight() {
<add> return mHeight;
<add> }
<add>
<add> /* package */ void setHeight(float height) {
<add> mHeight = height;
<add> }
<add>
<add> /* package */ void freeze() {
<add> mFrozen = true;
<add> }
<add>
<add> /* package */ boolean isFrozen() {
<add> return mFrozen;
<add> }
<add>
<add> @Override
<add> public void onSecondaryAttach(Bitmap bitmap) {
<add> // We don't know if width or height changed, so invalidate just in case.
<add> Assertions.assumeNotNull(mCallback).invalidate();
<add> }
<add>
<add> @Override
<add> public void onBitmapReady(Bitmap bitmap) {
<add> // Bitmap is now ready, draw it.
<add> Assertions.assumeNotNull(mCallback).invalidate();
<add> }
<add>
<add> @Override
<add> public void onAttached(FlatViewGroup.InvalidateCallback callback) {
<add> mCallback = callback;
<add>
<add> if (mRequestHelper != null) {
<add> mRequestHelper.attach(this);
<add> }
<add> }
<add>
<add> @Override
<add> public void onDetached() {
<add> if (mRequestHelper != null) {
<add> mRequestHelper.detach();
<add>
<add> if (mRequestHelper.isDetached()) {
<add> // optional
<add> mCallback = null;
<add> }
<add> }
<add> }
<add>
<add> @Override
<add> public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
<add> if (fm != null) {
<add> fm.ascent = -Math.round(mHeight);
<add> fm.descent = 0;
<add>
<add> fm.top = fm.ascent;
<add> fm.bottom = 0;
<add> }
<add>
<add> return Math.round(mWidth);
<add> }
<add>
<add> @Override
<add> public void draw(
<add> Canvas canvas,
<add> CharSequence text,
<add> int start,
<add> int end,
<add> float x,
<add> int top,
<add> int y,
<add> int bottom,
<add> Paint paint) {
<add> if (mRequestHelper == null) {
<add> return;
<add> }
<add>
<add> Bitmap bitmap = mRequestHelper.getBitmap();
<add> if (bitmap == null) {
<add> return;
<add> }
<add>
<add> float bottomFloat = (float) bottom;
<add> TMP_RECT.set(x, bottomFloat - mHeight, x + mWidth, bottomFloat);
<add>
<add> canvas.drawBitmap(bitmap, null, TMP_RECT, paint);
<add> }
<add>}
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTRawText.java
<ide> /**
<ide> * RCTRawText is a FlatTextShadowNode that can only contain raw text (but not styling).
<ide> */
<del>/* package */ class RCTRawText extends FlatTextShadowNode {
<add>/* package */ final class RCTRawText extends FlatTextShadowNode {
<ide>
<ide> private @Nullable String mText;
<ide>
<ide> protected void performApplySpans(SpannableStringBuilder builder, int begin, int
<ide> Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
<ide> }
<ide>
<add> @Override
<add> protected void performCollectAttachDetachListeners(StateBuilder stateBuilder) {
<add> // nothing to do
<add> }
<add>
<ide> @ReactProp(name = "text")
<ide> public void setText(@Nullable String text) {
<ide> mText = text;
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java
<ide> protected void collectState(
<ide> clipRight,
<ide> clipBottom);
<ide> stateBuilder.addDrawCommand(mDrawCommand);
<add>
<add> performCollectAttachDetachListeners(stateBuilder);
<ide> }
<ide>
<ide> @ReactProp(name = ViewProps.LINE_HEIGHT, defaultDouble = Double.NaN)
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInlineImage.java
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> */
<add>
<add>package com.facebook.react.flat;
<add>
<add>import javax.annotation.Nullable;
<add>
<add>import android.text.SpannableStringBuilder;
<add>import android.text.Spanned;
<add>
<add>import com.facebook.react.uimanager.ReactProp;
<add>
<add>/**
<add> * RCTTextInlineImage
<add> */
<add>/* package */ class RCTTextInlineImage extends FlatTextShadowNode {
<add>
<add> private InlineImageSpanWithPipeline mInlineImageSpan = new InlineImageSpanWithPipeline();
<add>
<add> @Override
<add> public void setStyleWidth(float width) {
<add> super.setStyleWidth(width);
<add>
<add> if (mInlineImageSpan.getWidth() != width) {
<add> getMutableSpan().setWidth(width);
<add> notifyChanged(true);
<add> }
<add> }
<add>
<add> @Override
<add> public void setStyleHeight(float height) {
<add> super.setStyleHeight(height);
<add>
<add> if (mInlineImageSpan.getHeight() != height) {
<add> getMutableSpan().setHeight(height);
<add> notifyChanged(true);
<add> }
<add> }
<add>
<add> @Override
<add> protected void performCollectText(SpannableStringBuilder builder) {
<add> builder.append("I");
<add> }
<add>
<add> @Override
<add> protected void performApplySpans(SpannableStringBuilder builder, int begin, int end) {
<add> mInlineImageSpan.freeze();
<add> builder.setSpan(
<add> mInlineImageSpan,
<add> begin,
<add> end,
<add> Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
<add> }
<add>
<add> @Override
<add> protected void performCollectAttachDetachListeners(StateBuilder stateBuilder) {
<add> // mInlineImageSpan should already be frozen so no need to freeze it again
<add> stateBuilder.addAttachDetachListener(mInlineImageSpan);
<add> }
<add>
<add> @ReactProp(name = "src")
<add> public void setSource(@Nullable String source) {
<add> getMutableSpan().setImageRequest(
<add> ImageRequestHelper.createImageRequest(getThemedContext(), source));
<add> }
<add>
<add> private InlineImageSpanWithPipeline getMutableSpan() {
<add> if (mInlineImageSpan.isFrozen()) {
<add> mInlineImageSpan = mInlineImageSpan.mutableCopy();
<add> }
<add> return mInlineImageSpan;
<add> }
<add>}
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInlineImageManager.java
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> */
<add>
<add>package com.facebook.react.flat;
<add>
<add>/**
<add> * ViewManager that creates instances of RCTTextInlineImage.
<add> */
<add>/* package */ final class RCTTextInlineImageManager extends VirtualViewManager<RCTTextInlineImage> {
<add>
<add> @Override
<add> public String getName() {
<add> return "RCTTextInlineImage";
<add> }
<add>
<add> @Override
<add> public RCTTextInlineImage createShadowNodeInstance() {
<add> return new RCTTextInlineImage();
<add> }
<add>
<add> @Override
<add> public Class<RCTTextInlineImage> getShadowNodeClass() {
<add> return RCTTextInlineImage.class;
<add> }
<add>}
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTVirtualText.java
<ide> protected void performApplySpans(SpannableStringBuilder builder, int begin, int
<ide> }
<ide> }
<ide>
<add> @Override
<add> protected void performCollectAttachDetachListeners(StateBuilder stateBuilder) {
<add> for (int i = 0, childCount = getChildCount(); i < childCount; ++i) {
<add> FlatTextShadowNode child = (FlatTextShadowNode) getChildAt(i);
<add> child.performCollectAttachDetachListeners(stateBuilder);
<add> }
<add> }
<add>
<ide> @ReactProp(name = ViewProps.FONT_SIZE, defaultFloat = Float.NaN)
<ide> public void setFontSize(float fontSizeSp) {
<ide> final int fontSize;
| 8
|
Text
|
Text
|
instruct contributors to branch from master
|
3c73a8fc4f2f4a5e6f1751d01c3ec6493f65eff1
|
<ide><path>CONTRIBUTING.md
<ide> future pull requests as well, simply so that the Spring Framework team knows
<ide> immediately that this process is complete.
<ide>
<ide>
<del>## Create your branch from `3.2.x`
<add>## Create your branch from `master`
<ide>
<del>If your pull request addresses a bug or improvement, please create your branch
<del>from Spring Framework's `3.2.x` branch. `master` is reserved for work on new features
<del>for the next major version of the framework. Rest assured that if your pull
<del>request is accepted and merged into `3.2.x`, these changes will also eventually
<del>be merged into `master`.
<add>Master currently represents work toward Spring Framework 4.0. Please submit
<add>all pull requests there, even bug fixes and minor improvements. Backports to
<add>`3.2.x` will be considered on a case-by-case basis.
<ide>
<ide>
<ide> ## Use short branch names
<ide> e.g.
<ide> * ...
<ide> *
<ide> * @author First Last
<del> * @since 3.2
<add> * @since 4.0
<ide> * @see ...
<ide> */
<ide> ```
| 1
|
Javascript
|
Javascript
|
add specs, clean up whitespace
|
32c4624d95c2b9fa7997356a2f9b59e83ec99116
|
<ide><path>src/tree-sitter-language-mode.js
<ide> class TreeSitterLanguageMode {
<ide> const searchEndIndex = Math.max(0, endIndex - 1)
<ide>
<ide> const matches = matcherForSelector(selector)
<del>
<add>
<ide> let smallestNode
<ide> this._forEachTreeWithRange(range, tree => {
<ide> let node = tree.rootNode.descendantForIndex(startIndex, searchEndIndex)
| 1
|
Python
|
Python
|
add missing arguments to np.ufunc.outer
|
f1aaff1948dfb3e008bb20ef5442bf0118104f4d
|
<ide><path>numpy/add_newdocs.py
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide>
<ide> add_newdoc('numpy.core', 'ufunc', ('outer',
<ide> """
<del> outer(A, B)
<add> outer(A, B, **kwargs)
<ide>
<ide> Apply the ufunc `op` to all pairs (a, b) with a in `A` and b in `B`.
<ide>
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> First array
<ide> B : array_like
<ide> Second array
<add> kwargs : any
<add> Arguments to pass on to the ufunc. Typically `dtype` or `out`.
<ide>
<ide> Returns
<ide> -------
| 1
|
Text
|
Text
|
clarify use of arrow functions
|
d15938cd9292242d87f751a34ca50c78fbf8c629
|
<ide><path>docs/docs/08.1-more-about-refs.md
<ide> It's as simple as:
<ide>
<ide> The `ref` attribute can be a callback function instead of a name. This callback will be executed immediately after the component is mounted. The referenced component will be passed in as a parameter, and the callback function may use the component immediately, or save the reference for future use (or both).
<ide>
<del>It's as simple as assigning a `ref` attribute to anything returned from `render` such as:
<add>It's as simple as adding a `ref` attribute to anything returned from `render` by using an ES6 arrow function:
<ide>
<ide> ```html
<ide> render: function() {
| 1
|
Ruby
|
Ruby
|
fix all homepages now that they are audited
|
70fc2af6470acd116d24882bb1cbb922b40e2d73
|
<ide><path>Library/Homebrew/test/cask/cmd/home_spec.rb
<ide> it_behaves_like "a command that handles invalid options"
<ide>
<ide> it "opens the homepage for the specified Cask" do
<del> expect(described_class).to receive(:open_url).with("https://example.com/local-caffeine")
<add> expect(described_class).to receive(:open_url).with("https://example.com")
<ide> described_class.run("local-caffeine")
<ide> end
<ide>
<ide> it "works for multiple Casks" do
<del> expect(described_class).to receive(:open_url).with("https://example.com/local-caffeine")
<del> expect(described_class).to receive(:open_url).with("https://example.com/local-transmission")
<add> expect(described_class).to receive(:open_url).with("https://example.com")
<add> expect(described_class).to receive(:open_url).with("https://example.com")
<ide> described_class.run("local-caffeine", "local-transmission")
<ide> end
<ide>
<ide><path>Library/Homebrew/test/cask/cmd/info_spec.rb
<ide> described_class.run("local-caffeine")
<ide> }.to output(<<~EOS).to_stdout
<ide> local-caffeine: 1.2.3
<del> https://example.com/local-caffeine
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-caffeine.rb
<ide> ==> Name
<ide> let(:expected_output) {
<ide> <<~EOS
<ide> local-caffeine: 1.2.3
<del> https://example.com/local-caffeine
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-caffeine.rb
<ide> ==> Name
<ide> None
<ide> ==> Artifacts
<ide> Caffeine.app (App)
<ide> local-transmission: 2.61
<del> https://example.com/local-transmission
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-transmission.rb
<ide> ==> Name
<ide> described_class.run("with-caveats")
<ide> }.to output(<<~EOS).to_stdout
<ide> with-caveats: 1.2.3
<del> https://example.com/local-caffeine
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-caveats.rb
<ide> ==> Name
<ide> described_class.run("with-conditional-caveats")
<ide> }.to output(<<~EOS).to_stdout
<ide> with-conditional-caveats: 1.2.3
<del> https://example.com/local-caffeine
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-conditional-caveats.rb
<ide> ==> Name
<ide> described_class.run("with-languages")
<ide> }.to output(<<~EOS).to_stdout
<ide> with-languages: 1.2.3
<del> https://example.com/local-caffeine
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-languages.rb
<ide> ==> Name
<ide> described_class.run("without-languages")
<ide> }.to output(<<~EOS).to_stdout
<ide> without-languages: 1.2.3
<del> https://example.com/local-caffeine
<add> https://example.com
<ide> Not installed
<ide> From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/without-languages.rb
<ide> ==> Name
<ide><path>Library/Homebrew/test/cask/cmd/internal_stanza_spec.rb
<ide> command = described_class.new("homepage", "local-caffeine")
<ide> expect {
<ide> command.run
<del> }.to output("https://example.com/local-caffeine\n").to_stdout
<add> }.to output("https://example.com\n").to_stdout
<ide> end
<ide>
<ide> it "raises an exception when stanza is unknown/unsupported" do
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb
<ide> sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/installer-with-uninstall.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> installer manual: 'Caffeine.app'
<ide>
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide> homepage 'https://www.example.com/local-caffeine'
<ide>
<ide> app 'Caffeine.app'
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<ide> url 'https://example.com/caffeine.zip'
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb
<ide> sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
<del> homepage 'https://example.com/local-transmission'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Transmission.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb
<ide> version '1.2.3'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb
<ide> sha256 :no_check
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-caffeine.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-transmission.rb
<ide> sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
<del> homepage 'https://example.com/local-transmission'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Transmission.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/outdated/version-latest.rb
<ide> sha256 :no_check
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine Mini.app'
<ide> app 'Caffeine Pro.app'
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb
<ide> sha256 :no_check
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine Mini.app'
<ide> app 'Caffeine Pro.app'
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb
<ide> sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
<del> homepage 'https://example.com/local-transmission'
<add> homepage 'https://example.com'
<ide>
<ide> app 'container'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app', target: 'AnotherName.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide>
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide>
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> installer manual: 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-languages.rb
<ide> end
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb
<ide> sha256 '3178fbfd1ea5d87a2a0662a4eb599ebc9a03888e73f37538d9f3f6ee69d2368e'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine Mini.app'
<ide> app 'Caffeine Pro.app'
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb
<ide> sha256 'd687c22a21c02bd8f07da9302c8292b93a04df9a929e3f04d09aea6c76f75c65'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeines-subdir.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeines/Caffeine Mini.app'
<ide> app 'Caffeines/Caffeine Pro.app'
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb
<ide> sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
<ide>
<ide> url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
<del> homepage 'https://example.com/local-caffeine'
<add> homepage 'https://example.com'
<ide>
<ide> app 'Caffeine.app'
<ide> end
| 29
|
Python
|
Python
|
add get_initial_state method to recurrent
|
b691579fff3f508cff8faae0e20aed0d65c91636
|
<ide><path>keras/layers/recurrent.py
<ide> def output_shape(self):
<ide> def step(self, x, states):
<ide> raise NotImplementedError
<ide>
<add> def get_initial_states(self, X):
<add> # build an all-zero tensor of shape (samples, output_dim)
<add> initial_state = K.zeros_like(X) # (samples, timesteps, input_dim)
<add> initial_state = K.sum(initial_state, axis=1) # (samples, input_dim)
<add> reducer = K.zeros((self.input_dim, self.output_dim))
<add> initial_state = K.dot(initial_state, reducer) # (samples, output_dim)
<add> initial_states = [initial_state for _ in range(len(self.states))]
<add> return initial_states
<add>
<ide> def get_output(self, train=False):
<ide> # input shape: (nb_samples, time (padded with zeros), input_dim)
<ide> X = self.get_input(train)
<ide> def get_output(self, train=False):
<ide> if self.stateful:
<ide> initial_states = self.states
<ide> else:
<del> # build an all-zero tensor of shape (samples, output_dim)
<del> initial_state = K.zeros_like(X) # (samples, timesteps, input_dim)
<del> initial_state = K.sum(initial_state, axis=1) # (samples, input_dim)
<del> reducer = K.zeros((self.input_dim, self.output_dim))
<del> initial_state = K.dot(initial_state, reducer) # (samples, output_dim)
<del> initial_states = [initial_state for _ in range(len(self.states))]
<add> initial_states = self.get_initial_states(X)
<ide>
<ide> last_output, outputs, states = K.rnn(self.step, X, initial_states,
<ide> go_backwards=self.go_backwards,
| 1
|
Javascript
|
Javascript
|
add tests for librarytemplateplugin
|
81a7f7f4bff31b168045fd84f02378fe1cce75df
|
<ide><path>test/LibraryTemplatePlugin.test.js
<add>var should = require("should");
<add>var sinon = require("sinon");
<add>var LibraryTemplatePlugin = require("../lib/LibraryTemplatePlugin");
<add>var applyPluginWithOptions = require("./helpers/applyPluginWithOptions");
<add>
<add>describe("LibraryTemplatePlugin", function() {
<add> var env;
<add>
<add> beforeEach(function() {
<add> env = {
<add> compilation: sinon.spy()
<add> };
<add> });
<add>
<add> it("has apply function", function() {
<add> (new LibraryTemplatePlugin()).apply.should.be.a.Function();
<add> });
<add>
<add> describe("when applied", function() {
<add> beforeEach(function() {
<add> env.eventBindings = applyPluginWithOptions(LibraryTemplatePlugin);
<add> });
<add>
<add> it("binds two event handlers", function() {
<add> env.eventBindings.length.should.be.exactly(1);
<add> });
<add>
<add> describe("this-compilation handler", function() {
<add> beforeEach(function() {
<add> env.eventBinding = env.eventBindings[0];
<add> });
<add>
<add> describe("event handler", function() {
<add> it("binds to this-compilation event", function() {
<add> env.eventBinding.name.should.be.exactly("this-compilation");
<add> });
<add> });
<add>
<add> describe("when target is unknown", function() {
<add> beforeEach(function() {
<add> var unknownTarget = "unknownTarget";
<add> env.eventBindings = applyPluginWithOptions(LibraryTemplatePlugin, "foo", unknownTarget, "bar", "baz");
<add> env.eventBinding = env.eventBindings[0];
<add> });
<add>
<add> it("throws an error", function() {
<add> should(function() {
<add> env.eventBinding.handler(env.compilation);
<add> }).throw("unknownTarget is not a valid Library target");
<add> });
<add> });
<add>
<add> describe("name is a string", function() {
<add> [{
<add> type: "var",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("var foo");
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "assign",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("foo");
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "this",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('this["foo"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "window",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('window["foo"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "global",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('global["foo"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "commonjs",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('exports["foo"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "commonjs2",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("module.exports");
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "commonjs-module",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("module.exports");
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "amd",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.be.exactly("foo");
<add> }
<add> },
<add> {
<add> type: "umd",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.be.exactly("foo");
<add> compilationContext.optionalAmdExternalAsGlobal.should.be.false();
<add> compilationContext.namedDefine.should.be.exactly("bar");
<add> compilationContext.auxiliaryComment.should.be.exactly("baz");
<add> }
<add> },
<add> {
<add> type: "umd2",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.be.exactly("foo");
<add> compilationContext.optionalAmdExternalAsGlobal.should.be.true();
<add> compilationContext.namedDefine.should.be.exactly("bar");
<add> compilationContext.auxiliaryComment.should.be.exactly("baz");
<add> }
<add> },
<add> {
<add> type: "jsonp",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.be.exactly("foo");
<add> }
<add> }
<add> ].forEach(function(targetTypeAndAssertion) {
<add> var type = targetTypeAndAssertion.type;
<add>
<add> describe("when target is " + type, function() {
<add> beforeEach(function() {
<add> env.eventBindings = applyPluginWithOptions(LibraryTemplatePlugin, "foo", type, "bar", "baz");
<add> env.eventBinding = env.eventBindings[0];
<add> env.eventBinding.handler(env.compilation);
<add> });
<add>
<add> it("compilation callback is called", function() {
<add> env.compilation.callCount.should.be.exactly(1);
<add> });
<add>
<add> it("compilation callback context is set up", function() {
<add> var compilationContext = env.compilation.firstCall.thisValue;
<add> targetTypeAndAssertion.assertion(compilationContext);
<add> });
<add> });
<add> });
<add> });
<add>
<add> describe("name is an array of strings", function() {
<add> [{
<add> type: "var",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('var foo = foo || {}; foo["bar"] = foo["bar"] || {}; foo["bar"]["baz"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "assign",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('foo = typeof foo === "object" ? foo : {}; foo["bar"] = foo["bar"] || {}; foo["bar"]["baz"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "this",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('this["foo"] = this["foo"] || {}; this["foo"]["bar"] = this["foo"]["bar"] || {}; this["foo"]["bar"]["baz"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "window",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('window["foo"] = window["foo"] || {}; window["foo"]["bar"] = window["foo"]["bar"] || {}; window["foo"]["bar"]["baz"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "global",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('global["foo"] = global["foo"] || {}; global["foo"]["bar"] = global["foo"]["bar"] || {}; global["foo"]["bar"]["baz"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "commonjs",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly('exports["foo"] = exports["foo"] || {}; exports["foo"]["bar"] = exports["foo"]["bar"] || {}; exports["foo"]["bar"]["baz"]');
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "commonjs2",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("module.exports");
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "commonjs-module",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("module.exports");
<add> should(compilationContext.copyObject).be.undefined();
<add> }
<add> },
<add> {
<add> type: "amd",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.deepEqual(["foo", "bar", "baz"]);
<add> }
<add> },
<add> {
<add> type: "umd",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.deepEqual(["foo", "bar", "baz"]);
<add> compilationContext.optionalAmdExternalAsGlobal.should.be.false();
<add> compilationContext.namedDefine.should.be.exactly("bar");
<add> compilationContext.auxiliaryComment.should.be.exactly("baz");
<add> }
<add> },
<add> {
<add> type: "umd2",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.deepEqual(["foo", "bar", "baz"]);
<add> compilationContext.optionalAmdExternalAsGlobal.should.be.true();
<add> compilationContext.namedDefine.should.be.exactly("bar");
<add> compilationContext.auxiliaryComment.should.be.exactly("baz");
<add> }
<add> },
<add> {
<add> type: "jsonp",
<add> assertion: function(compilationContext) {
<add> compilationContext.name.should.deepEqual(["foo", "bar", "baz"]);
<add> }
<add> }
<add> ].forEach(function(targetTypeAndAssertion) {
<add> var type = targetTypeAndAssertion.type;
<add>
<add> describe("when target is " + type, function() {
<add> beforeEach(function() {
<add> env.eventBindings = applyPluginWithOptions(LibraryTemplatePlugin, ["foo", "bar", "baz"], type, "bar", "baz");
<add> env.eventBinding = env.eventBindings[0];
<add> env.eventBinding.handler(env.compilation);
<add> });
<add>
<add> it("compilation callback is called", function() {
<add> env.compilation.callCount.should.be.exactly(1);
<add> });
<add>
<add> it("compilation callback context is set up", function() {
<add> var compilationContext = env.compilation.firstCall.thisValue;
<add> targetTypeAndAssertion.assertion(compilationContext);
<add> });
<add> });
<add> });
<add> });
<add>
<add> describe("name not provided", function() {
<add> [{
<add> type: "this",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("this");
<add> should(compilationContext.copyObject).be.true();
<add> }
<add> },
<add> {
<add> type: "window",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("window");
<add> should(compilationContext.copyObject).be.true();
<add> }
<add> },
<add> {
<add> type: "global",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("global");
<add> should(compilationContext.copyObject).be.true();
<add> }
<add> },
<add> {
<add> type: "commonjs",
<add> assertion: function(compilationContext) {
<add> compilationContext.varExpression.should.be.exactly("exports");
<add> should(compilationContext.copyObject).be.true();
<add> }
<add> }
<add> ].forEach(function(targetTypeAndAssertion) {
<add> var type = targetTypeAndAssertion.type;
<add>
<add> describe("when target is " + type, function() {
<add> beforeEach(function() {
<add> env.eventBindings = applyPluginWithOptions(LibraryTemplatePlugin, undefined, type, "bar", "baz");
<add> env.eventBinding = env.eventBindings[0];
<add> env.eventBinding.handler(env.compilation);
<add> });
<add>
<add> it("compilation callback is called", function() {
<add> env.compilation.callCount.should.be.exactly(1);
<add> });
<add>
<add> it("compilation callback context is set up", function() {
<add> var compilationContext = env.compilation.firstCall.thisValue;
<add> targetTypeAndAssertion.assertion(compilationContext);
<add> });
<add> });
<add> });
<add> });
<add> });
<add> });
<add>});
<ide><path>test/helpers/applyPluginWithOptions.js
<ide> var PluginEnvironment = require('./PluginEnvironment');
<ide>
<del>module.exports = function applyPluginWithOptions(Plugin, options) {
<del> var plugin = new Plugin(options);
<add>module.exports = function applyPluginWithOptions(Plugin) {
<add> var plugin = new (Function.prototype.bind.apply(Plugin, arguments));
<ide> var pluginEnvironment = new PluginEnvironment();
<ide> plugin.apply(pluginEnvironment.getEnvironmentStub());
<ide> return pluginEnvironment.getEventBindings();
| 2
|
Javascript
|
Javascript
|
add info about preselecting complex models
|
a8e03b3a907aa6faf31ac28e7b45e263ceef3de5
|
<ide><path>src/ng/directive/ngOptions.js
<ide> var ngOptionsMinErr = minErr('ngOptions');
<ide> *
<ide> * ## Complex Models (objects or collections)
<ide> *
<del> * **Note:** By default, `ngModel` watches the model by reference, not value. This is important when
<del> * binding any input directive to a model that is an object or a collection.
<add> * By default, `ngModel` watches the model by reference, not value. This is important to know when
<add> * binding the select to a model that is an object or a collection.
<ide> *
<del> * Since this is a common situation for `ngOptions` the directive additionally watches the model using
<del> * `$watchCollection` when the select has the `multiple` attribute or when there is a `track by` clause in
<del> * the options expression. This allows ngOptions to trigger a re-rendering of the options even if the actual
<del> * object/collection has not changed identity but only a property on the object or an item in the collection
<del> * changes.
<add> * One issue occurs if you want to preselect an option. For example, if you set
<add> * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,
<add> * because the objects are not identical. So by default, you should always reference the item in your collection
<add> * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
<add> *
<add> * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity
<add> * of the item not by reference, but by the result of the `track by` expression. For example, if your
<add> * collection items have an id property, you would `track by item.id`.
<add> *
<add> * A different issue with objects or collections is that ngModel won't detect if an object property or
<add> * a collection item changes. For that reason, `ngOptions` additionally watches the model using
<add> * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.
<add> * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection
<add> * has not changed identity, but only a property on the object or an item in the collection changes.
<ide> *
<ide> * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
<ide> * if the model is an array). This means that changing a property deeper than the first level inside the
<ide> * object/collection will not trigger a re-rendering.
<ide> *
<del> *
<ide> * ## `select` **`as`**
<ide> *
<ide> * Using `select` **`as`** will bind the result of the `select` expression to the model, but
| 1
|
Javascript
|
Javascript
|
unify xform observer edition
|
ac64f2320445f75710a81c3616a0d6bdf1b034d5
|
<ide><path>packages/ember-metal/lib/observer.js
<ide> var DeferredEventQueue = function() {
<ide> this.queue = [];
<ide> };
<ide>
<del>DeferredEventQueue.prototype.push = function(target, eventName) {
<add>DeferredEventQueue.prototype.push = function(target, eventName, keyName) {
<ide> var targetSet = this.targetSet,
<ide> queue = this.queue,
<ide> targetGuid = Ember.guidFor(target),
<ide> DeferredEventQueue.prototype.push = function(target, eventName) {
<ide> }
<ide> index = eventNameSet[eventName];
<ide> if (index === undefined) {
<del> eventNameSet[eventName] = queue.push(Ember.deferEvent(target, eventName)) - 1;
<add> eventNameSet[eventName] = queue.push(Ember.deferEvent(target, eventName, target, keyName)) - 1;
<ide> } else {
<del> queue[index] = Ember.deferEvent(target, eventName);
<add> queue[index] = Ember.deferEvent(target, eventName, target, keyName);
<ide> }
<ide> };
<ide>
<ide> DeferredEventQueue.prototype.flush = function() {
<ide> var queue = new DeferredEventQueue(), beforeObserverSet = new ObserverSet();
<ide>
<ide> /** @private */
<del>function notifyObservers(obj, eventName, forceNotification) {
<add>function notifyObservers(obj, eventName, keyName, forceNotification) {
<ide> if (deferred && !forceNotification) {
<del> queue.push(obj, eventName);
<add> queue.push(obj, eventName, keyName);
<ide> } else {
<del> Ember.sendEvent(obj, eventName);
<add> Ember.sendEvent(obj, eventName, obj, keyName);
<ide> }
<ide> }
<ide>
<ide> function beforeEvent(keyName) {
<ide> }
<ide>
<ide> /** @private */
<del>function changeKey(eventName) {
<del> return eventName.slice(0, -7);
<del>}
<del>
<del>/** @private */
<del>function beforeKey(eventName) {
<del> return eventName.slice(0, -7);
<del>}
<del>
<del>/** @private */
<del>function xformChange(target, method, params) {
<del> var obj = params[0], keyName = changeKey(params[1]);
<del> method.call(target, obj, keyName);
<del>}
<del>
<del>/** @private */
<del>function xformBefore(target, method, params) {
<del> var obj = params[0], keyName = beforeKey(params[1]);
<del> method.call(target, obj, keyName);
<add>function xform(target, method, params) {
<add> var args = [].slice.call(params, 2);
<add> method.apply(target, args);
<ide> }
<ide>
<ide> Ember.addObserver = function(obj, path, target, method) {
<del> Ember.addListener(obj, changeEvent(path), target, method, xformChange);
<add> Ember.addListener(obj, changeEvent(path), target, method, xform);
<ide> Ember.watch(obj, path);
<ide> return this;
<ide> };
<ide> Ember.removeObserver = function(obj, path, target, method) {
<ide> };
<ide>
<ide> Ember.addBeforeObserver = function(obj, path, target, method) {
<del> Ember.addListener(obj, beforeEvent(path), target, method, xformBefore);
<add> Ember.addListener(obj, beforeEvent(path), target, method, xform);
<ide> Ember.watch(obj, path);
<ide> return this;
<ide> };
<ide> Ember.removeBeforeObserver = function(obj, path, target, method) {
<ide> Ember.notifyObservers = function(obj, keyName) {
<ide> if (obj.isDestroying) { return; }
<ide>
<del> notifyObservers(obj, changeEvent(keyName));
<add> notifyObservers(obj, changeEvent(keyName), keyName);
<ide> };
<ide>
<ide> /** @private */
<ide> Ember.notifyBeforeObservers = function(obj, keyName) {
<ide> }
<ide> }
<ide>
<del> notifyObservers(obj, beforeEvent(keyName), forceNotification);
<add> notifyObservers(obj, beforeEvent(keyName), keyName, forceNotification);
<ide> };
<ide>
| 1
|
Javascript
|
Javascript
|
replace string concatenation with path.join
|
97008a7b0d7beee598bf53f2a1db0be14380d98b
|
<ide><path>test/async-hooks/test-graph.tls-write.js
<ide> const initHooks = require('./init-hooks');
<ide> const verifyGraph = require('./verify-graph');
<ide> const fs = require('fs');
<ide> const tls = require('tls');
<add>const path = require('path');
<ide>
<ide> const hooks = initHooks();
<ide> hooks.enable();
<ide> hooks.enable();
<ide> //
<ide> const server = tls
<ide> .createServer({
<del> cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
<del> key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
<add> cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')),
<add> key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'))
<ide> })
<ide> .on('listening', common.mustCall(onlistening))
<ide> .on('secureConnection', common.mustCall(onsecureConnection))
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.