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
|
---|---|---|---|---|---|
Java | Java | ensure the last flush will be performed | ec2218c9670ab2e2b88a86dba21bef7f1bf59f9c | <ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java
<ide> protected void flushingFailed(Throwable t) {
<ide> */
<ide> protected abstract void flush() throws IOException;
<ide>
<add> /**
<add> * Whether writing is possible.
<add> */
<add> protected abstract boolean isWritePossible();
<add>
<add> /**
<add> * Whether flushing is pending.
<add> */
<add> protected abstract boolean isFlushPending();
<add>
<add> /**
<add> * Listeners can call this to notify when flushing is possible.
<add> */
<add> protected final void onFlushPossible() {
<add> this.state.get().onFlushPossible(this);
<add> }
<add>
<add> private void flushIfPossible() {
<add> if (isWritePossible()) {
<add> onFlushPossible();
<add> }
<add> }
<add>
<ide>
<ide> private boolean changeState(State oldState, State newState) {
<ide> return this.state.compareAndSet(oldState, newState);
<ide> public <T> void writeComplete(AbstractListenerWriteFlushProcessor<T> processor)
<ide> return;
<ide> }
<ide> if (processor.subscriberCompleted) {
<del> if (processor.changeState(this, COMPLETED)) {
<add> if (processor.isFlushPending()) {
<add> // Ensure the final flush
<add> processor.changeState(this, FLUSHING);
<add> processor.flushIfPossible();
<add> }
<add> else if (processor.changeState(this, COMPLETED)) {
<ide> processor.resultPublisher.publishComplete();
<ide> }
<ide> }
<ide> public <T> void onComplete(AbstractListenerWriteFlushProcessor<T> processor) {
<ide> }
<ide> },
<ide>
<add> FLUSHING {
<add> public <T> void onFlushPossible(AbstractListenerWriteFlushProcessor<T> processor) {
<add> try {
<add> processor.flush();
<add> }
<add> catch (IOException ex) {
<add> processor.flushingFailed(ex);
<add> return;
<add> }
<add> if (processor.changeState(this, COMPLETED)) {
<add> processor.resultPublisher.publishComplete();
<add> }
<add> }
<add> public <T> void onNext(AbstractListenerWriteFlushProcessor<T> processor, Publisher<? extends T> publisher) {
<add> // ignore
<add> }
<add> @Override
<add> public <T> void onComplete(AbstractListenerWriteFlushProcessor<T> processor) {
<add> // ignore
<add> }
<add> },
<add>
<ide> COMPLETED {
<ide> @Override
<ide> public <T> void onNext(AbstractListenerWriteFlushProcessor<T> processor, Publisher<? extends T> publisher) {
<ide> public <T> void writeComplete(AbstractListenerWriteFlushProcessor<T> processor)
<ide> // ignore
<ide> }
<ide>
<add> public <T> void onFlushPossible(AbstractListenerWriteFlushProcessor<T> processor) {
<add> // ignore
<add> }
<add>
<ide>
<ide> private static class WriteSubscriber implements Subscriber<Void> {
<ide>
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpResponse.java
<ide>
<ide> import java.io.IOException;
<ide> import java.io.InputStream;
<del>import java.io.UncheckedIOException;
<ide> import java.nio.charset.Charset;
<ide> import java.util.List;
<ide> import java.util.Map;
<ide> public class ServletServerHttpResponse extends AbstractListenerServerHttpRespons
<ide>
<ide> private final HttpServletResponse response;
<ide>
<add> private final ServletOutputStream outputStream;
<add>
<ide> private final int bufferSize;
<ide>
<ide> @Nullable
<ide> public ServletServerHttpResponse(HttpServletResponse response, AsyncContext asyn
<ide> Assert.isTrue(bufferSize > 0, "Buffer size must be greater than 0");
<ide>
<ide> this.response = response;
<add> this.outputStream = response.getOutputStream();
<ide> this.bufferSize = bufferSize;
<ide>
<ide> asyncContext.addListener(new ResponseAsyncListener());
<ide> protected Processor<? super Publisher<? extends DataBuffer>, Void> createBodyFlu
<ide> * @return the number of bytes written
<ide> */
<ide> protected int writeToOutputStream(DataBuffer dataBuffer) throws IOException {
<del> ServletOutputStream outputStream = response.getOutputStream();
<add> ServletOutputStream outputStream = this.outputStream;
<ide> InputStream input = dataBuffer.asInputStream();
<ide> int bytesWritten = 0;
<ide> byte[] buffer = new byte[this.bufferSize];
<ide> protected int writeToOutputStream(DataBuffer dataBuffer) throws IOException {
<ide> }
<ide>
<ide> private void flush() throws IOException {
<del> ServletOutputStream outputStream = this.response.getOutputStream();
<add> ServletOutputStream outputStream = this.outputStream;
<ide> if (outputStream.isReady()) {
<ide> try {
<ide> outputStream.flush();
<ide> private void flush() throws IOException {
<ide> }
<ide> }
<ide>
<add> private boolean isWritePossible() {
<add> return this.outputStream.isReady();
<add> }
<add>
<ide>
<ide> private final class ResponseAsyncListener implements AsyncListener {
<ide>
<ide> public void onWritePossible() throws IOException {
<ide> if (processor != null) {
<ide> processor.onWritePossible();
<ide> }
<add> else {
<add> ResponseBodyFlushProcessor flushProcessor = bodyFlushProcessor;
<add> if (flushProcessor != null) {
<add> flushProcessor.onFlushPossible();
<add> }
<add> }
<ide> }
<ide>
<ide> @Override
<ide> public void onError(Throwable ex) {
<ide> processor.cancel();
<ide> processor.onError(ex);
<ide> }
<add> else {
<add> ResponseBodyFlushProcessor flushProcessor = bodyFlushProcessor;
<add> if (flushProcessor != null) {
<add> flushProcessor.cancel();
<add> flushProcessor.onError(ex);
<add> }
<add> }
<ide> }
<ide> }
<ide>
<ide> private class ResponseBodyFlushProcessor extends AbstractListenerWriteFlushProce
<ide>
<ide> @Override
<ide> protected Processor<? super DataBuffer, Void> createWriteProcessor() {
<del> try {
<del> ServletOutputStream outputStream = response.getOutputStream();
<del> ResponseBodyProcessor processor = new ResponseBodyProcessor(outputStream);
<del> bodyProcessor = processor;
<del> return processor;
<del> }
<del> catch (IOException ex) {
<del> throw new UncheckedIOException(ex);
<del> }
<add> ResponseBodyProcessor processor = new ResponseBodyProcessor();
<add> bodyProcessor = processor;
<add> return processor;
<ide> }
<ide>
<ide> @Override
<ide> protected void flush() throws IOException {
<ide> }
<ide> ServletServerHttpResponse.this.flush();
<ide> }
<del> }
<ide>
<add> @Override
<add> protected boolean isWritePossible() {
<add> return ServletServerHttpResponse.this.isWritePossible();
<add> }
<ide>
<del> private class ResponseBodyProcessor extends AbstractListenerWriteProcessor<DataBuffer> {
<add> @Override
<add> protected boolean isFlushPending() {
<add> return flushOnNext;
<add> }
<add> }
<ide>
<del> private final ServletOutputStream outputStream;
<ide>
<del> public ResponseBodyProcessor(ServletOutputStream outputStream) {
<del> this.outputStream = outputStream;
<del> }
<add> private class ResponseBodyProcessor extends AbstractListenerWriteProcessor<DataBuffer> {
<ide>
<ide> @Override
<ide> protected boolean isWritePossible() {
<del> return this.outputStream.isReady();
<add> return ServletServerHttpResponse.this.isWritePossible();
<ide> }
<ide>
<ide> @Override
<ide> protected boolean write(DataBuffer dataBuffer) throws IOException {
<ide> }
<ide> flush();
<ide> }
<del> boolean ready = this.outputStream.isReady();
<add> boolean ready = ServletServerHttpResponse.this.isWritePossible();
<ide> if (this.logger.isTraceEnabled()) {
<ide> this.logger.trace("write: " + dataBuffer + " ready: " + ready);
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java
<ide> private ResponseBodyProcessor createBodyProcessor() {
<ide> return new ResponseBodyProcessor(this.responseChannel);
<ide> }
<ide>
<add> private boolean isWritePossible() {
<add> if (this.responseChannel == null) {
<add> this.responseChannel = this.exchange.getResponseChannel();
<add> }
<add> if (this.responseChannel.isWriteResumed()) {
<add> return true;
<add> } else {
<add> this.responseChannel.resumeWrites();
<add> return false;
<add> }
<add> }
<add>
<ide>
<del> private static class ResponseBodyProcessor extends AbstractListenerWriteProcessor<DataBuffer> {
<add> private class ResponseBodyProcessor extends AbstractListenerWriteProcessor<DataBuffer> {
<ide>
<ide> private final StreamSinkChannel channel;
<ide>
<ide> public ResponseBodyProcessor(StreamSinkChannel channel) {
<ide>
<ide> @Override
<ide> protected boolean isWritePossible() {
<del> if (this.channel.isWriteResumed()) {
<del> return true;
<del> } else {
<del> this.channel.resumeWrites();
<del> return false;
<del> }
<add> return UndertowServerHttpResponse.this.isWritePossible();
<ide> }
<ide>
<ide> @Override
<ide> protected void flushingFailed(Throwable t) {
<ide> cancel();
<ide> onError(t);
<ide> }
<add>
<add> @Override
<add> protected boolean isWritePossible() {
<add> return UndertowServerHttpResponse.this.isWritePossible();
<add> }
<add>
<add> @Override
<add> protected boolean isFlushPending() {
<add> return false;
<add> }
<ide> }
<ide>
<ide> } | 3 |
Javascript | Javascript | limit pixel values to 32bit integer range | 17e27e16cc52a7df3e87df8251f040d7cd394dab | <ide><path>src/core/core.scale.js
<ide> import defaults from './core.defaults';
<ide> import Element from './core.element';
<ide> import {_alignPixel, _measureText} from '../helpers/helpers.canvas';
<ide> import {callback as call, each, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpers/helpers.core';
<del>import {_factorize, toDegrees, toRadians} from '../helpers/helpers.math';
<add>import {_factorize, toDegrees, toRadians, _int32Range} from '../helpers/helpers.math';
<ide> import {toFont, resolve, toPadding} from '../helpers/helpers.options';
<ide> import Ticks from './core.ticks';
<ide>
<ide> export default class Scale extends Element {
<ide> decimal = 1 - decimal;
<ide> }
<ide>
<del> return me._startPixel + decimal * me._length;
<add> return _int32Range(me._startPixel + decimal * me._length);
<ide> }
<ide>
<ide> /**
<ide><path>src/helpers/helpers.math.js
<ide> export function _angleBetween(angle, start, end) {
<ide> export function _limitValue(value, min, max) {
<ide> return Math.max(min, Math.min(max, value));
<ide> }
<add>
<add>export function _int32Range(value) {
<add> return _limitValue(value, -2147483648, 2147483647);
<add>} | 2 |
Ruby | Ruby | remove vim from the blacklist | 0a7d2b82b4156d3e429216013ba26465612099ac | <ide><path>Library/Homebrew/blacklist.rb
<ide> def blacklisted? name
<ide> case name.downcase
<del> when /^vim?$/, 'screen', /^rubygems?$/ then <<-EOS.undent
<add> when 'screen', /^rubygems?$/ then <<-EOS.undent
<ide> Apple distributes #{name} with OS X, you can find it in /usr/bin.
<ide> EOS
<ide> when 'libarchive', 'libpcap' then <<-EOS.undent | 1 |
Javascript | Javascript | remove loader inheritance from ctmloader | c2e6781bb900fd85f0533db843f80db76fa9325d | <ide><path>examples/js/loaders/ctm/CTMLoader.js
<ide>
<ide> THREE.CTMLoader = function () {
<ide>
<del> THREE.Loader.call( this );
<del>
<ide> };
<ide>
<del>THREE.CTMLoader.prototype = Object.create( THREE.Loader.prototype );
<ide> THREE.CTMLoader.prototype.constructor = THREE.CTMLoader;
<ide>
<ide> // Load multiple CTM parts defined in JSON
<ide> THREE.CTMLoader.prototype.loadParts = function ( url, callback, parameters ) {
<ide>
<ide> for ( var i = 0; i < jsonObject.materials.length; i ++ ) {
<ide>
<del> materials[ i ] = scope.createMaterial( jsonObject.materials[ i ], basePath );
<add> materials[ i ] = THREE.Loader.prototype.createMaterial( jsonObject.materials[ i ], basePath );
<ide>
<ide> }
<ide> | 1 |
Ruby | Ruby | add githublatest strategy | f96b8e713875fee683299cda6000834fae594255 | <ide><path>Library/Homebrew/livecheck/strategy.rb
<ide> def from_url(url, regex_provided = nil)
<ide> require_relative "strategy/apache"
<ide> require_relative "strategy/bitbucket"
<ide> require_relative "strategy/git"
<add>require_relative "strategy/github_latest"
<ide> require_relative "strategy/gnome"
<ide> require_relative "strategy/gnu"
<ide> require_relative "strategy/hackage"
<ide><path>Library/Homebrew/livecheck/strategy/github_latest.rb
<add># typed: false
<add># frozen_string_literal: true
<add>
<add>module Homebrew
<add> module Livecheck
<add> module Strategy
<add> # The {GithubLatest} strategy identifies versions of software at
<add> # github.com by checking a repository's latest release page.
<add> #
<add> # GitHub URLs take a few differemt formats:
<add> #
<add> # * `https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip`
<add> # * `https://github.com/example/example/archive/v1.2.3.tar.gz`
<add> #
<add> # This strategy is used when latest releases are marked for software hosted
<add> # on GitHub. It is necessary to use `strategy :github_latest` in a `livecheck`
<add> # block for Livecheck to use this strategy.
<add> #
<add> # The default regex identifies versions from `href` attributes containing the
<add> # tag name.
<add> #
<add> # @api public
<add> class GithubLatest
<add> NICE_NAME = "GitHub Latest"
<add>
<add> # The `Regexp` used to determine if the strategy applies to the URL.
<add> URL_MATCH_REGEX = /github.com/i.freeze
<add>
<add> # Whether the strategy can be applied to the provided URL.
<add> #
<add> # @param url [String] the URL to match against
<add> # @return [Boolean]
<add> def self.match?(url)
<add> URL_MATCH_REGEX.match?(url)
<add> end
<add>
<add> # Generates a URL and regex (if one isn't provided) and passes them
<add> # to {PageMatch.find_versions} to identify versions in the content.
<add> #
<add> # @param url [String] the URL of the content to check
<add> # @param regex [Regexp] a regex used for matching versions in content
<add> # @return [Hash]
<add> def self.find_versions(url, regex = nil)
<add> %r{github\.com/(?<username>[\da-z\-]+)/(?<repository>[\da-z_\-]+)}i =~ url
<add>
<add> # The page containing the latest release
<add> page_url = "https://github.com/#{username}/#{repository}/releases/latest"
<add>
<add> # The default regex applies to most repositories, but may have to be
<add> # replaced with a specific regex when the tag names contain the package
<add> # name or other characters apart from the version.
<add> regex ||= %r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i
<add>
<add> Homebrew::Livecheck::Strategy::PageMatch.find_versions(page_url, regex)
<add> end
<add> end
<add> end
<add> end
<add>end
<ide><path>Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb
<add># typed: false
<add># frozen_string_literal: true
<add>
<add>require "livecheck/strategy/github_latest"
<add>
<add>describe Homebrew::Livecheck::Strategy::GithubLatest do
<add> subject(:github_latest) { described_class }
<add>
<add> let(:github_download_url) { "https://github.com/example/example/releases/download/1.2.3/example-1.2.3.zip" }
<add> let(:github_archive_url) { "https://github.com/example/example/archive/v1.2.3.tar.gz" }
<add> let(:non_github_url) { "https://brew.sh/test" }
<add>
<add> describe "::match?" do
<add> it "returns true if the argument provided is a GitHub Download URL" do
<add> expect(github_latest.match?(github_download_url)).to be true
<add> end
<add>
<add> it "returns true if the argument provided is a GitHub Archive URL" do
<add> expect(github_latest.match?(github_archive_url)).to be true
<add> end
<add>
<add> it "returns false if the argument provided is not a GitHub URL" do
<add> expect(github_latest.match?(non_github_url)).to be false
<add> end
<add> end
<add>end | 3 |
Ruby | Ruby | remove some `#popen_read`s | 32ad22395bddf3eda906b70c2b3d814e5af2a498 | <ide><path>Library/Homebrew/extend/os/mac/system_config.rb
<ide> def describe_java
<ide> # java_home doesn't exist on all macOSs; it might be missing on older versions.
<ide> return "N/A" unless File.executable? "/usr/libexec/java_home"
<ide>
<del> java_xml = Utils.popen_read("/usr/libexec/java_home", "--xml", "--failfast", err: :close)
<del> return "N/A" unless $CHILD_STATUS.success?
<add> out, _, status = system_command("/usr/libexec/java_home", args: ["--xml", "--failfast"], print_stderr: false)
<add> return "N/A" unless status.success?
<ide> javas = []
<del> REXML::XPath.each(
<del> REXML::Document.new(java_xml), "//key[text()='JVMVersion']/following-sibling::string"
<del> ) do |item|
<add> xml = REXML::Document.new(out)
<add> REXML::XPath.each(xml, "//key[text()='JVMVersion']/following-sibling::string") do |item|
<ide> javas << item.text
<ide> end
<ide> javas.uniq.join(", ")
<ide><path>Library/Homebrew/readall.rb
<ide> def valid_tap?(tap, options = {})
<ide> private
<ide>
<ide> def syntax_errors_or_warnings?(rb)
<del> # Retrieve messages about syntax errors/warnings printed to `$stderr`, but
<del> # discard a `Syntax OK` printed to `$stdout` (in absence of syntax errors).
<del> messages = Utils.popen_read("#{RUBY_PATH} -c -w #{rb} 2>&1 >/dev/null")
<add> # Retrieve messages about syntax errors/warnings printed to `$stderr`.
<add> _, err, status = system_command(RUBY_PATH, args: ["-c", "-w", rb], print_stderr: false)
<ide>
<ide> # Ignore unnecessary warning about named capture conflicts.
<ide> # See https://bugs.ruby-lang.org/issues/12359.
<del> messages = messages.lines
<del> .grep_v(/named capture conflicts a local variable/)
<del> .join
<add> messages = err.lines
<add> .grep_v(/named capture conflicts a local variable/)
<add> .join
<ide>
<ide> $stderr.print messages
<ide>
<ide> # Only syntax errors result in a non-zero status code. To detect syntax
<ide> # warnings we also need to inspect the output to `$stderr`.
<del> !$CHILD_STATUS.success? || !messages.chomp.empty?
<add> !status.success? || !messages.chomp.empty?
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/requirements/java_requirement.rb
<ide> def oracle_java_os
<ide> end
<ide>
<ide> def satisfies_version(java)
<del> java_version_s = Utils.popen_read(java, "-version", err: :out)[/\d+.\d/]
<add> java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+.\d/]
<ide> return false unless java_version_s
<ide> java_version = Version.create(java_version_s)
<ide> needed_version = Version.create(version_without_plus)
<ide><path>Library/Homebrew/system_command.rb
<ide> def self.run!(command, **options)
<ide> def run!
<ide> puts command.shelljoin.gsub(/\\=/, "=") if verbose? || ARGV.debug?
<ide>
<del> @merged_output = []
<add> @output = []
<ide>
<ide> each_output_line do |type, line|
<ide> case type
<ide> when :stdout
<ide> $stdout << line if print_stdout?
<del> @merged_output << [:stdout, line]
<add> @output << [:stdout, line]
<ide> when :stderr
<ide> $stderr << line if print_stderr?
<del> @merged_output << [:stderr, line]
<add> @output << [:stderr, line]
<ide> end
<ide> end
<ide>
<ide> def assert_success
<ide> return if @status.success?
<ide> raise ErrorDuringExecution.new(command,
<ide> status: @status,
<del> output: @merged_output)
<add> output: @output)
<ide> end
<ide>
<ide> def expanded_args
<ide> def each_output_line(&b)
<ide> @status = raw_wait_thr.value
<ide> rescue SystemCallError => e
<ide> @status = $CHILD_STATUS
<del> @merged_output << [:stderr, e.message]
<add> @output << [:stderr, e.message]
<ide> end
<ide>
<ide> def write_input_to(raw_stdin)
<ide> def each_line_from(sources)
<ide> end
<ide>
<ide> def result
<del> output = @merged_output.each_with_object(stdout: "", stderr: "") do |(type, line), hash|
<del> hash[type] << line
<del> end
<del>
<del> Result.new(command, output[:stdout], output[:stderr], @status)
<add> Result.new(command, @output, @status)
<ide> end
<ide>
<ide> class Result
<del> attr_accessor :command, :stdout, :stderr, :status, :exit_status
<del>
<del> def initialize(command, stdout, stderr, status)
<del> @command = command
<del> @stdout = stdout
<del> @stderr = stderr
<del> @status = status
<del> @exit_status = status.exitstatus
<add> attr_accessor :command, :status, :exit_status
<add>
<add> def initialize(command, output, status)
<add> @command = command
<add> @output = output
<add> @status = status
<add> @exit_status = status.exitstatus
<add> end
<add>
<add> def stdout
<add> @stdout ||= @output.select { |type,| type == :stdout }
<add> .map { |_, line| line }
<add> .join
<add> end
<add>
<add> def stderr
<add> @stderr ||= @output.select { |type,| type == :stderr }
<add> .map { |_, line| line }
<add> .join
<ide> end
<ide>
<ide> def success?
<ide><path>Library/Homebrew/system_config.rb
<ide> def kernel
<ide>
<ide> def describe_java
<ide> return "N/A" unless which "java"
<del> java_version = Utils.popen_read("java", "-version")
<del> return "N/A" unless $CHILD_STATUS.success?
<del> java_version[/java version "([\d\._]+)"/, 1] || "N/A"
<add> _, err, status = system_command("java", args: ["-version"], print_stderr: false)
<add> return "N/A" unless status.success?
<add> err[/java version "([\d\._]+)"/, 1] || "N/A"
<ide> end
<ide>
<ide> def describe_git
<ide> def describe_git
<ide> end
<ide>
<ide> def describe_curl
<del> curl_version_output = Utils.popen_read("#{curl_executable} --version", err: :close)
<del> curl_version_output =~ /^curl ([\d\.]+)/
<del> curl_version = Regexp.last_match(1)
<del> "#{curl_version} => #{curl_executable}"
<del> rescue
<del> "N/A"
<add> out, = system_command(curl_executable, args: ["--version"])
<add>
<add> if /^curl (?<curl_version>[\d\.]+)/ =~ out
<add> "#{curl_version} => #{curl_executable}"
<add> else
<add> "N/A"
<add> end
<ide> end
<ide>
<ide> def dump_verbose_config(f = $stdout)
<ide><path>Library/Homebrew/test/cask/pkg_spec.rb
<ide> "/usr/sbin/pkgutil",
<ide> args: ["--pkg-info-plist", pkg_id],
<ide> ).and_return(
<del> SystemCommand::Result.new(nil, pkg_info_plist, nil, instance_double(Process::Status, exitstatus: 0)),
<add> SystemCommand::Result.new(nil, [[:stdout, pkg_info_plist]], instance_double(Process::Status, exitstatus: 0)),
<ide> )
<ide>
<ide> info = pkg.info
<ide><path>Library/Homebrew/test/java_requirement_spec.rb
<ide> def setup_java_with_version(version)
<ide> IO.write java, <<~SH
<ide> #!/bin/sh
<del> echo 'java version "#{version}"'
<add> echo 'java version "#{version}"' 1>&2
<ide> SH
<ide> FileUtils.chmod "+x", java
<ide> end
<ide><path>Library/Homebrew/test/support/helper/cask/fake_system_command.rb
<ide> def self.run(command_string, options = {})
<ide> if response.respond_to?(:call)
<ide> response.call(command_string, options)
<ide> else
<del> SystemCommand::Result.new(command, response, "", OpenStruct.new(exitstatus: 0))
<add> SystemCommand::Result.new(command, [[:stdout, response]], OpenStruct.new(exitstatus: 0))
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/test/system_command_result_spec.rb
<ide>
<ide> describe SystemCommand::Result do
<ide> describe "#to_ary" do
<add> let(:output) {
<add> [
<add> [:stdout, "output"],
<add> [:stderr, "error"],
<add> ]
<add> }
<ide> subject(:result) {
<del> described_class.new([], "output", "error", instance_double(Process::Status, exitstatus: 0, success?: true))
<add> described_class.new([], output, instance_double(Process::Status, exitstatus: 0, success?: true))
<ide> }
<ide>
<ide> it "can be destructed like `Open3.capture3`" do
<ide> end
<ide>
<ide> describe "#plist" do
<del> subject { described_class.new(command, stdout, "", instance_double(Process::Status, exitstatus: 0)).plist }
<add> subject {
<add> described_class.new(command, [[:stdout, stdout]], instance_double(Process::Status, exitstatus: 0)).plist
<add> }
<ide>
<ide> let(:command) { ["true"] }
<ide> let(:garbage) { | 9 |
Javascript | Javascript | clamp radius when drawing rounded rectangle | 6f317135a3b87b6ff62660adccd1ee063240d46f | <ide><path>src/helpers/helpers.canvas.js
<ide> module.exports = function(Chart) {
<ide> * @param {Number} width - The rectangle's width.
<ide> * @param {Number} height - The rectangle's height.
<ide> * @param {Number} radius - The rounded amount (in pixels) for the four corners.
<del> * @todo handler `radius` as top-left, top-right, bottom-right, bottom-left array/object?
<del> * @todo clamp `radius` to the maximum "correct" value.
<add> * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?
<ide> */
<ide> roundedRect: function(ctx, x, y, width, height, radius) {
<ide> if (radius) {
<del> ctx.moveTo(x + radius, y);
<del> ctx.lineTo(x + width - radius, y);
<del> ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
<del> ctx.lineTo(x + width, y + height - radius);
<del> ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
<del> ctx.lineTo(x + radius, y + height);
<del> ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
<del> ctx.lineTo(x, y + radius);
<del> ctx.quadraticCurveTo(x, y, x + radius, y);
<add> var rx = Math.min(radius, width/2);
<add> var ry = Math.min(radius, height/2);
<add>
<add> ctx.moveTo(x + rx, y);
<add> ctx.lineTo(x + width - rx, y);
<add> ctx.quadraticCurveTo(x + width, y, x + width, y + ry);
<add> ctx.lineTo(x + width, y + height - ry);
<add> ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height);
<add> ctx.lineTo(x + rx, y + height);
<add> ctx.quadraticCurveTo(x, y + height, x, y + height - ry);
<add> ctx.lineTo(x, y + ry);
<add> ctx.quadraticCurveTo(x, y, x + rx, y);
<ide> } else {
<ide> ctx.rect(x, y, width, height);
<ide> } | 1 |
Python | Python | remove unneded open(.., 'u') when on python 3 | ac8d0a48157c4a53f971cf2450cb6c8ee6c05f36 | <ide><path>django/core/management/commands/makemessages.py
<ide> popen_wrapper)
<ide> from django.utils.encoding import force_str
<ide> from django.utils.functional import total_ordering
<add>from django.utils import six
<ide> from django.utils.text import get_text_list
<ide> from django.utils.jslex import prepare_js_for_gettext
<ide>
<ide> def process(self, command, domain):
<ide> orig_file = os.path.join(self.dirpath, self.file)
<ide> is_templatized = file_ext in command.extensions
<ide> if is_templatized:
<del> with open(orig_file, "rU") as fp:
<add> with open(orig_file, 'r' if six.PY3 else 'rU') as fp:
<ide> src_data = fp.read()
<ide> thefile = '%s.py' % self.file
<ide> content = templatize(src_data, orig_file[2:])
<ide> def copy_plural_forms(self, msgs, locale):
<ide> for domain in domains:
<ide> django_po = os.path.join(django_dir, 'conf', 'locale', locale, 'LC_MESSAGES', '%s.po' % domain)
<ide> if os.path.exists(django_po):
<del> with io.open(django_po, 'rU', encoding='utf-8') as fp:
<add> with io.open(django_po, 'r' if six.PY3 else 'rU', encoding='utf-8') as fp:
<ide> m = plural_forms_re.search(fp.read())
<ide> if m:
<ide> plural_form_line = force_str(m.group('value'))
<ide><path>django/core/management/sql.py
<ide> from django.conf import settings
<ide> from django.core.management.base import CommandError
<ide> from django.db import models, router
<add>from django.utils import six
<ide>
<ide>
<ide> def sql_create(app_config, style, connection):
<ide> def custom_sql_for_model(model, style, connection):
<ide> sql_files.append(os.path.join(app_dir, "%s.sql" % opts.model_name))
<ide> for sql_file in sql_files:
<ide> if os.path.exists(sql_file):
<del> with codecs.open(sql_file, 'U', encoding=settings.FILE_CHARSET) as fp:
<add> with codecs.open(sql_file, 'r' if six.PY3 else 'U', encoding=settings.FILE_CHARSET) as fp:
<ide> # Some backends can't execute more than one SQL statement at a time,
<ide> # so split into separate statements.
<ide> output.extend(_split_statements(fp.read())) | 2 |
Python | Python | increase test timeouts | 76fa6b21a1cd94e94048047bd5a434ca6e533254 | <ide><path>tools/test.py
<ide> def BuildOptions():
<ide> result.add_option("-s", "--suite", help="A test suite",
<ide> default=[], action="append")
<ide> result.add_option("-t", "--timeout", help="Timeout in seconds",
<del> default=60, type="int")
<add> default=120, type="int")
<ide> result.add_option("--arch", help='The architecture to run tests for',
<ide> default='none')
<ide> result.add_option("--snapshot", help="Run the tests with snapshot turned on", | 1 |
Text | Text | clarify pr template instructions | 0cb17627a8f1e7ec534025044d2fbeb3405920a8 | <ide><path>.github/pull_request_template.md
<ide> Choose the right checklist for the change that you're making:
<ide>
<ide> ## Documentation / Examples
<ide>
<del>- [ ] Make sure the linting passes by running `pnpm lint`
<add>- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
<ide> - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) | 1 |
Javascript | Javascript | remove `callbackid` field from fiberroot | 96ac799eace5d989de3b4f80e6414e94a08ff77a | <ide><path>packages/react-reconciler/src/ReactFiberRoot.new.js
<ide> function FiberRootNode(containerInfo, tag, hydrate) {
<ide> this.pendingContext = null;
<ide> this.hydrate = hydrate;
<ide> this.callbackNode = null;
<del> this.callbackId = NoLanes;
<ide> this.callbackPriority = NoLanePriority;
<ide> this.eventTimes = createLaneMap(NoLanes);
<ide> this.expirationTimes = createLaneMap(NoTimestamp);
<ide><path>packages/react-reconciler/src/ReactFiberRoot.old.js
<ide> function FiberRootNode(containerInfo, tag, hydrate) {
<ide> this.pendingContext = null;
<ide> this.hydrate = hydrate;
<ide> this.callbackNode = null;
<del> this.callbackId = NoLanes;
<ide> this.callbackPriority = NoLanePriority;
<ide> this.eventTimes = createLaneMap(NoLanes);
<ide> this.expirationTimes = createLaneMap(NoTimestamp);
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js
<ide> function markUpdateLaneFromFiberToRoot(
<ide> }
<ide>
<ide> // Use this function to schedule a task for a root. There's only one task per
<del>// root; if a task was already scheduled, we'll check to make sure the
<del>// expiration time of the existing task is the same as the expiration time of
<del>// the next level that the root has work on. This function is called on every
<del>// update, and right before exiting a task.
<add>// root; if a task was already scheduled, we'll check to make sure the priority
<add>// of the existing task is the same as the priority of the next level that the
<add>// root has work on. This function is called on every update, and right before
<add>// exiting a task.
<ide> function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
<ide> const existingCallbackNode = root.callbackNode;
<ide>
<ide> function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
<ide> markStarvedLanesAsExpired(root, currentTime);
<ide>
<ide> // Determine the next lanes to work on, and their priority.
<del> const newCallbackId = getNextLanes(
<add> const nextLanes = getNextLanes(
<ide> root,
<ide> root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes,
<ide> );
<ide> // This returns the priority level computed during the `getNextLanes` call.
<ide> const newCallbackPriority = returnNextLanesPriority();
<ide>
<del> if (newCallbackId === NoLanes) {
<add> if (nextLanes === NoLanes) {
<ide> // Special case: There's nothing to work on.
<ide> if (existingCallbackNode !== null) {
<ide> cancelCallback(existingCallbackNode);
<ide> root.callbackNode = null;
<ide> root.callbackPriority = NoLanePriority;
<del> root.callbackId = NoLanes;
<ide> }
<ide> return;
<ide> }
<ide>
<ide> // Check if there's an existing task. We may be able to reuse it.
<del> const existingCallbackId = root.callbackId;
<del> const existingCallbackPriority = root.callbackPriority;
<del> if (existingCallbackId !== NoLanes) {
<del> if (newCallbackId === existingCallbackId) {
<del> // This task is already scheduled. Let's check its priority.
<del> if (existingCallbackPriority === newCallbackPriority) {
<del> // The priority hasn't changed. Exit.
<del> return;
<del> }
<del> // The task ID is the same but the priority changed. Cancel the existing
<del> // callback. We'll schedule a new one below.
<add> if (existingCallbackNode !== null) {
<add> const existingCallbackPriority = root.callbackPriority;
<add> if (existingCallbackPriority === newCallbackPriority) {
<add> // The priority hasn't changed. We can reuse the existing task. Exit.
<add> return;
<ide> }
<add> // The priority changed. Cancel the existing callback. We'll schedule a new
<add> // one below.
<ide> cancelCallback(existingCallbackNode);
<ide> }
<ide>
<ide> function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
<ide> );
<ide> }
<ide>
<del> root.callbackId = newCallbackId;
<ide> root.callbackPriority = newCallbackPriority;
<ide> root.callbackNode = newCallbackNode;
<ide> }
<ide> function commitRootImpl(root, renderPriorityLevel) {
<ide> // commitRoot never returns a continuation; it always finishes synchronously.
<ide> // So we can clear these now to allow a new callback to be scheduled.
<ide> root.callbackNode = null;
<del> root.callbackId = NoLanes;
<ide>
<ide> // Update the first and last pending times on this root. The new first
<ide> // pending time is whatever is left on the root fiber.
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js
<ide> function markUpdateLaneFromFiberToRoot(
<ide> }
<ide>
<ide> // Use this function to schedule a task for a root. There's only one task per
<del>// root; if a task was already scheduled, we'll check to make sure the
<del>// expiration time of the existing task is the same as the expiration time of
<del>// the next level that the root has work on. This function is called on every
<del>// update, and right before exiting a task.
<add>// root; if a task was already scheduled, we'll check to make sure the priority
<add>// of the existing task is the same as the priority of the next level that the
<add>// root has work on. This function is called on every update, and right before
<add>// exiting a task.
<ide> function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
<ide> const existingCallbackNode = root.callbackNode;
<ide>
<ide> function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
<ide> markStarvedLanesAsExpired(root, currentTime);
<ide>
<ide> // Determine the next lanes to work on, and their priority.
<del> const newCallbackId = getNextLanes(
<add> const nextLanes = getNextLanes(
<ide> root,
<ide> root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes,
<ide> );
<ide> // This returns the priority level computed during the `getNextLanes` call.
<ide> const newCallbackPriority = returnNextLanesPriority();
<ide>
<del> if (newCallbackId === NoLanes) {
<add> if (nextLanes === NoLanes) {
<ide> // Special case: There's nothing to work on.
<ide> if (existingCallbackNode !== null) {
<ide> cancelCallback(existingCallbackNode);
<ide> root.callbackNode = null;
<ide> root.callbackPriority = NoLanePriority;
<del> root.callbackId = NoLanes;
<ide> }
<ide> return;
<ide> }
<ide>
<ide> // Check if there's an existing task. We may be able to reuse it.
<del> const existingCallbackId = root.callbackId;
<del> const existingCallbackPriority = root.callbackPriority;
<del> if (existingCallbackId !== NoLanes) {
<del> if (newCallbackId === existingCallbackId) {
<del> // This task is already scheduled. Let's check its priority.
<del> if (existingCallbackPriority === newCallbackPriority) {
<del> // The priority hasn't changed. Exit.
<del> return;
<del> }
<del> // The task ID is the same but the priority changed. Cancel the existing
<del> // callback. We'll schedule a new one below.
<add> if (existingCallbackNode !== null) {
<add> const existingCallbackPriority = root.callbackPriority;
<add> if (existingCallbackPriority === newCallbackPriority) {
<add> // The priority hasn't changed. We can reuse the existing task. Exit.
<add> return;
<ide> }
<add> // The priority changed. Cancel the existing callback. We'll schedule a new
<add> // one below.
<ide> cancelCallback(existingCallbackNode);
<ide> }
<ide>
<ide> function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
<ide> );
<ide> }
<ide>
<del> root.callbackId = newCallbackId;
<ide> root.callbackPriority = newCallbackPriority;
<ide> root.callbackNode = newCallbackNode;
<ide> }
<ide> function commitRootImpl(root, renderPriorityLevel) {
<ide> // commitRoot never returns a continuation; it always finishes synchronously.
<ide> // So we can clear these now to allow a new callback to be scheduled.
<ide> root.callbackNode = null;
<del> root.callbackId = NoLanes;
<ide>
<ide> // Update the first and last pending times on this root. The new first
<ide> // pending time is whatever is left on the root fiber.
<ide><path>packages/react-reconciler/src/ReactInternalTypes.js
<ide> type BaseFiberRootProperties = {|
<ide> pendingContext: Object | null,
<ide> // Determines if we should attempt to hydrate on the initial mount
<ide> +hydrate: boolean,
<del> // Node returned by Scheduler.scheduleCallback
<del> callbackNode: *,
<ide>
<ide> // Used by useMutableSource hook to avoid tearing during hydration.
<ide> mutableSourceEagerHydrationData?: Array<
<ide> MutableSource<any> | MutableSourceVersion,
<ide> > | null,
<ide>
<del> // Represents the next task that the root should work on, or the current one
<del> // if it's already working.
<del> callbackId: Lanes,
<add> // Node returned by Scheduler.scheduleCallback. Represents the next rendering
<add> // task that the root will work on.
<add> callbackNode: *,
<ide> callbackPriority: LanePriority,
<ide> eventTimes: LaneMap<number>,
<ide> expirationTimes: LaneMap<number>, | 5 |
PHP | PHP | update more non-orm, non-database package tests | 1a0c223db57a614b850791bc9420907cf73f34b4 | <ide><path>tests/TestCase/Command/SchemaCacheCommandsTest.php
<ide> use Cake\Cache\Engine\NullEngine;
<ide> use Cake\Datasource\ConnectionManager;
<ide> use Cake\TestSuite\ConsoleIntegrationTestTrait;
<add>use Cake\TestSuite\Fixture\TransactionStrategy;
<ide> use Cake\TestSuite\TestCase;
<ide>
<ide> /**
<ide> class SchemaCacheCommandsTest extends TestCase
<ide> {
<ide> use ConsoleIntegrationTestTrait;
<ide>
<add> /**
<add> * @inheritDoc
<add> */
<add> protected $stateResetStrategy = TransactionStrategy::class;
<add>
<ide> /**
<ide> * Fixtures.
<ide> *
<ide><path>tests/TestCase/Console/ShellTest.php
<ide> use Cake\Console\Exception\StopException;
<ide> use Cake\Console\Shell;
<ide> use Cake\Filesystem\Filesystem;
<add>use Cake\TestSuite\Fixture\TransactionStrategy;
<ide> use Cake\TestSuite\TestCase;
<ide> use RuntimeException;
<ide> use TestApp\Shell\MergeShell;
<ide> class_alias(TestBananaTask::class, 'Cake\Shell\Task\TestBananaTask');
<ide> */
<ide> class ShellTest extends TestCase
<ide> {
<add> /**
<add> * @inheritDoc
<add> */
<add> protected $stateResetStrategy = TransactionStrategy::class;
<add>
<ide> /**
<ide> * Fixtures used in this test case
<ide> *
<ide><path>tests/TestCase/Controller/ControllerTest.php
<ide> use Cake\Http\Response;
<ide> use Cake\Http\ServerRequest;
<ide> use Cake\Routing\Router;
<add>use Cake\TestSuite\Fixture\TransactionStrategy;
<ide> use Cake\TestSuite\TestCase;
<ide> use Laminas\Diactoros\Uri;
<ide> use ReflectionFunction;
<ide> */
<ide> class ControllerTest extends TestCase
<ide> {
<add> /**
<add> * @inheritDoc
<add> */
<add> protected $stateResetStrategy = TransactionStrategy::class;
<add>
<ide> /**
<ide> * fixtures property
<ide> *
<ide><path>tests/TestCase/Datasource/PaginatorTest.php
<ide> namespace Cake\Test\TestCase\Datasource;
<ide>
<ide> use Cake\ORM\Entity;
<add>use Cake\TestSuite\Fixture\TransactionStrategy;
<ide> use Cake\TestSuite\TestCase;
<ide>
<ide> class PaginatorTest extends TestCase
<ide> {
<ide> use PaginatorTestTrait;
<ide>
<add> /**
<add> * @inheritDoc
<add> */
<add> protected $stateResetStrategy = TransactionStrategy::class;
<add>
<ide> /**
<ide> * fixtures property
<ide> *
<ide><path>tests/TestCase/Http/SessionTest.php
<ide> namespace Cake\Test\TestCase\Http;
<ide>
<ide> use Cake\Http\Session;
<add>use Cake\TestSuite\Fixture\TransactionStrategy;
<ide> use Cake\TestSuite\TestCase;
<ide> use InvalidArgumentException;
<ide> use RuntimeException;
<ide> */
<ide> class SessionTest extends TestCase
<ide> {
<add> /**
<add> * @inheritDoc
<add> */
<add> protected $stateResetStrategy = TransactionStrategy::class;
<add>
<ide> /**
<ide> * Fixtures used in the SessionTest
<ide> *
<ide><path>tests/TestCase/Mailer/EmailTest.php
<ide> */
<ide> class EmailTest extends TestCase
<ide> {
<add> /**
<add> * @inheritDoc
<add> */
<add> protected $stateResetStrategy = TransactionStrategy::class;
<add>
<ide> protected $fixtures = ['core.Users'];
<ide>
<ide> /**
<ide><path>tests/TestCase/Utility/XmlTest.php
<ide> */
<ide> class XmlTest extends TestCase
<ide> {
<del> /**
<del> * autoFixtures property
<del> *
<del> * @var bool
<del> */
<del> public $autoFixtures = false;
<del>
<del> /**
<del> * fixtures property
<del> *
<del> * @var array
<del> */
<del> protected $fixtures = [
<del> 'core.Articles', 'core.Users',
<del> ];
<del>
<ide> /**
<ide> * setUp method
<ide> */
<ide><path>tests/TestCase/View/XmlViewTest.php
<ide> use Cake\Core\Configure;
<ide> use Cake\Http\Response;
<ide> use Cake\Http\ServerRequest;
<del>use Cake\TestSuite\Fixture\TransactionStrategy;
<ide> use Cake\TestSuite\TestCase;
<ide> use Cake\Utility\Xml;
<ide> | 8 |
Go | Go | add "cmd" prefix to builder instructions | c2a14bb196d0d3046e185783ebacd4b83fa36dd4 | <ide><path>api.go
<ide> func postImagesGetCache(srv *Server, w http.ResponseWriter, r *http.Request, var
<ide> if err != nil {
<ide> return err
<ide> }
<add> if image == nil {
<add> w.WriteHeader(http.StatusNotFound)
<add> return nil
<add> }
<ide> apiId := &ApiId{Id: image.Id}
<ide> b, err := json.Marshal(apiId)
<ide> if err != nil {
<ide><path>builder_client.go
<ide> import (
<ide> )
<ide>
<ide> type BuilderClient struct {
<del> builder *Builder
<del> cli *DockerCli
<add> cli *DockerCli
<ide>
<ide> image string
<ide> maintainer string
<ide> type BuilderClient struct {
<ide>
<ide> func (b *BuilderClient) clearTmp(containers, images map[string]struct{}) {
<ide> for c := range containers {
<del> tmp := b.builder.runtime.Get(c)
<del> b.builder.runtime.Destroy(tmp)
<add> if _, _, err := b.cli.call("DELETE", "/containers/"+c, nil); err != nil {
<add> utils.Debugf("%s", err)
<add> }
<ide> utils.Debugf("Removing container %s", c)
<ide> }
<ide> for i := range images {
<del> b.builder.runtime.graph.Delete(i)
<add> if _, _, err := b.cli.call("DELETE", "/images/"+i, nil); err != nil {
<add> utils.Debugf("%s", err)
<add> }
<ide> utils.Debugf("Removing image %s", i)
<ide> }
<ide> }
<ide>
<del>func (b *BuilderClient) From(name string) error {
<add>func (b *BuilderClient) CmdFrom(name string) error {
<ide> obj, statusCode, err := b.cli.call("GET", "/images/"+name+"/json", nil)
<ide> if statusCode == 404 {
<ide> if err := b.cli.hijack("POST", "/images/create?fromImage="+name, false); err != nil {
<ide> func (b *BuilderClient) From(name string) error {
<ide> return err
<ide> }
<ide>
<del> img := &ApiImages{}
<add> img := &ApiId{}
<ide> if err := json.Unmarshal(obj, img); err != nil {
<ide> return err
<ide> }
<ide> b.image = img.Id
<ide> return nil
<ide> }
<ide>
<del>func (b *BuilderClient) Maintainer(name string) error {
<add>func (b *BuilderClient) CmdMaintainer(name string) error {
<ide> b.needCommit = true
<ide> b.maintainer = name
<ide> return nil
<ide> }
<ide>
<del>func (b *BuilderClient) Run(args string) error {
<add>func (b *BuilderClient) CmdRun(args string) error {
<ide> if b.image == "" {
<ide> return fmt.Errorf("Please provide a source image with `from` prior to run")
<ide> }
<del> config, _, err := ParseRun([]string{b.image, "/bin/sh", "-c", args}, b.builder.runtime.capabilities)
<add> config, _, err := ParseRun([]string{b.image, "/bin/sh", "-c", args}, nil)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func (b *BuilderClient) Run(args string) error {
<ide> b.image = apiId.Id
<ide> return nil
<ide> }
<add> b.commit()
<add> return nil
<add>}
<add>
<add>func (b *BuilderClient) CmdEnv(args string) error {
<add> b.needCommit = true
<add> tmp := strings.SplitN(args, " ", 2)
<add> if len(tmp) != 2 {
<add> return fmt.Errorf("Invalid ENV format")
<add> }
<add> key := strings.Trim(tmp[0], " ")
<add> value := strings.Trim(tmp[1], " ")
<add>
<add> for i, elem := range b.config.Env {
<add> if strings.HasPrefix(elem, key+"=") {
<add> b.config.Env[i] = key + "=" + value
<add> return nil
<add> }
<add> }
<add> b.config.Env = append(b.config.Env, key+"="+value)
<add> return nil
<add>}
<ide>
<del> body, _, err = b.cli.call("POST", "/containers/create", b.config)
<add>func (b *BuilderClient) CmdCmd(args string) error {
<add> b.needCommit = true
<add> b.config.Cmd = []string{"/bin/sh", "-c", args}
<add> return nil
<add>}
<add>
<add>func (b *BuilderClient) CmdExpose(args string) error {
<add> ports := strings.Split(args, " ")
<add> b.config.PortSpecs = append(ports, b.config.PortSpecs...)
<add> return nil
<add>}
<add>
<add>func (b *BuilderClient) CmdInsert(args string) error {
<add> // FIXME: Reimplement this once the remove_hijack branch gets merged.
<add> // We need to retrieve the resulting Id
<add> return fmt.Errorf("INSERT not implemented")
<add>}
<add>
<add>func (b *BuilderClient) commit() error {
<add> body, _, err := b.cli.call("POST", "/containers/create", b.config)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func (b *BuilderClient) Run(args string) error {
<ide> }
<ide> b.tmpImages[apiId.Id] = struct{}{}
<ide> b.image = apiId.Id
<del> b.needCommit = false
<ide> return nil
<ide> }
<ide>
<del>func (b *BuilderClient) Env(args string) error {
<del> b.needCommit = true
<del> tmp := strings.SplitN(args, " ", 2)
<del> if len(tmp) != 2 {
<del> return fmt.Errorf("Invalid ENV format")
<del> }
<del> key := strings.Trim(tmp[0], " ")
<del> value := strings.Trim(tmp[1], " ")
<del>
<del> for i, elem := range b.config.Env {
<del> if strings.HasPrefix(elem, key+"=") {
<del> b.config.Env[i] = key + "=" + value
<del> return nil
<del> }
<del> }
<del> b.config.Env = append(b.config.Env, key+"="+value)
<del> return nil
<del>}
<del>
<del>func (b *BuilderClient) Cmd(args string) error {
<del> b.needCommit = true
<del> b.config.Cmd = []string{"/bin/sh", "-c", args}
<del> return nil
<del>}
<del>
<del>func (b *BuilderClient) Expose(args string) error {
<del> ports := strings.Split(args, " ")
<del> b.config.PortSpecs = append(ports, b.config.PortSpecs...)
<del> return nil
<del>}
<del>
<del>func (b *BuilderClient) Insert(args string) error {
<del> // FIXME: Reimplement this once the remove_hijack branch gets merged.
<del> // We need to retrieve the resulting Id
<del> return fmt.Errorf("INSERT not implemented")
<del>}
<del>
<del>func NewBuilderClient(dockerfile io.Reader) (string, error) {
<add>func (b *BuilderClient) Build(dockerfile io.Reader) (string, error) {
<ide> // defer b.clearTmp(tmpContainers, tmpImages)
<del>
<del> b := &BuilderClient{
<del> cli: NewDockerCli("0.0.0.0", 4243),
<del> }
<ide> file := bufio.NewReader(dockerfile)
<ide> for {
<ide> line, err := file.ReadString('\n')
<ide> func NewBuilderClient(dockerfile io.Reader) (string, error) {
<ide>
<ide> fmt.Printf("%s %s\n", strings.ToUpper(instruction), arguments)
<ide>
<del> method, exists := reflect.TypeOf(b).MethodByName(strings.ToUpper(instruction[:1]) + strings.ToLower(instruction[1:]))
<add> method, exists := reflect.TypeOf(b).MethodByName("Cmd" + strings.ToUpper(instruction[:1]) + strings.ToLower(instruction[1:]))
<ide> if !exists {
<ide> fmt.Printf("Skipping unknown instruction %s\n", strings.ToUpper(instruction))
<ide> }
<ide> func NewBuilderClient(dockerfile io.Reader) (string, error) {
<ide> fmt.Printf("===> %v\n", b.image)
<ide> }
<ide> if b.needCommit {
<del> body, _, err = b.cli.call("POST", "/containers/create", b.config)
<del> if err != nil {
<del> return err
<del> }
<del>
<del> out := &ApiRun{}
<del> err = json.Unmarshal(body, out)
<del> if err != nil {
<del> return err
<del> }
<del>
<del> for _, warning := range out.Warnings {
<del> fmt.Fprintln(os.Stderr, "WARNING: ", warning)
<del> }
<del>
<del> //start the container
<del> _, _, err = b.cli.call("POST", "/containers/"+out.Id+"/start", nil)
<del> if err != nil {
<del> return err
<del> }
<del> b.tmpContainers[out.Id] = struct{}{}
<del>
<del> // Wait for it to finish
<del> _, _, err = b.cli.call("POST", "/containers/"+out.Id+"/wait", nil)
<del> if err != nil {
<del> return err
<del> }
<del>
<del> // Commit the container
<del> v := url.Values{}
<del> v.Set("container", out.Id)
<del> v.Set("author", b.maintainer)
<del> body, _, err = b.cli.call("POST", "/commit?"+v.Encode(), b.config)
<del> if err != nil {
<del> return err
<del> }
<del> apiId := &ApiId{}
<del> err = json.Unmarshal(body, apiId)
<del> if err != nil {
<del> return err
<del> }
<del> b.tmpImages[apiId.Id] = struct{}{}
<del> b.image = apiId.Id
<add> b.commit()
<ide> }
<ide> if b.image != "" {
<ide> // The build is successful, keep the temporary containers and images
<ide> func NewBuilderClient(dockerfile io.Reader) (string, error) {
<ide> }
<ide> return "", fmt.Errorf("An error occured during the build\n")
<ide> }
<add>
<add>func NewBuilderClient(addr string, port int) *BuilderClient {
<add> return &BuilderClient{
<add> cli: NewDockerCli(addr, port),
<add> config: &Config{},
<add> tmpContainers: make(map[string]struct{}),
<add> tmpImages: make(map[string]struct{}),
<add> }
<add>}
<ide><path>commands.go
<ide> func (cli *DockerCli) CmdBuild(args ...string) error {
<ide> return err
<ide> }
<ide> }
<del> NewBuilderClient(file)
<add> if _, err := NewBuilderClient("0.0.0.0", 4243).Build(file); err != nil {
<add> return err
<add> }
<ide> return nil
<ide> }
<ide> | 3 |
PHP | PHP | fix json docblocks in request | 8f259fcc6027760c0554ca444fbf07455da9d299 | <ide><path>src/Illuminate/Http/Request.php
<ide> class Request extends SymfonyRequest implements Arrayable, ArrayAccess
<ide> /**
<ide> * The decoded JSON content for the request.
<ide> *
<del> * @var string
<add> * @var \Symfony\Component\HttpFoundation\ParameterBag|null
<ide> */
<ide> protected $json;
<ide>
<ide> public function replace(array $input)
<ide> *
<ide> * @param string $key
<ide> * @param mixed $default
<del> * @return mixed
<add> * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed
<ide> */
<ide> public function json($key = null, $default = null)
<ide> {
<ide> public function fingerprint()
<ide> /**
<ide> * Set the JSON payload for the request.
<ide> *
<del> * @param array $json
<add> * @param \Symfony\Component\HttpFoundation\ParameterBag $json
<ide> * @return $this
<ide> */
<ide> public function setJson($json) | 1 |
Javascript | Javascript | favor assertions over console logging | 12de99d982c85f3e0b5076b85d9af58cf46c0097 | <ide><path>test/common.js
<ide> process.on('exit', function() {
<ide> if (!exports.globalCheck) return;
<ide> const leaked = leakedGlobals();
<ide> if (leaked.length > 0) {
<del> console.error('Unknown globals: %s', leaked);
<del> fail('Unknown global found');
<add> fail(`Unexpected global(s) found: ${leaked.join(', ')}`);
<ide> }
<ide> });
<ide> | 1 |
PHP | PHP | fix multi-checkboxes not being selected properly | ece39d147e1b1e6df1e1a9cf8bed2758cdbdbf1d | <ide><path>src/View/Widget/MultiCheckboxWidget.php
<ide> public function render(array $data, ContextInterface $context)
<ide> $checkbox['name'] = $data['name'];
<ide> $checkbox['escape'] = $data['escape'];
<ide>
<del> if ($this->_isSelected($key, $data['val'])) {
<add> if ($this->_isSelected($checkbox['value'], $data['val'])) {
<ide> $checkbox['checked'] = true;
<ide> }
<ide> if ($this->_isDisabled($key, $data['disabled'])) {
<ide><path>tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php
<ide> public function testRenderComplex()
<ide> $input = new MultiCheckboxWidget($this->templates, $label);
<ide> $data = [
<ide> 'name' => 'Tags[id]',
<add> 'val' => 2,
<ide> 'options' => [
<ide> ['value' => '1', 'text' => 'CakePHP', 'data-test' => 'val'],
<ide> ['value' => '2', 'text' => 'Development', 'class' => 'custom'],
<ide> public function testRenderComplex()
<ide> ['div' => ['class' => 'checkbox']],
<ide> ['input' => [
<ide> 'type' => 'checkbox',
<add> 'checked' => 'checked',
<ide> 'name' => 'Tags[id][]',
<ide> 'value' => 2,
<ide> 'id' => 'tags-id-2',
<ide> 'class' => 'custom',
<ide> ]],
<del> ['label' => ['for' => 'tags-id-2']],
<add> ['label' => ['class' => 'selected', 'for' => 'tags-id-2']],
<ide> 'Development',
<ide> '/label',
<ide> '/div', | 2 |
Ruby | Ruby | fix data loading from the performance script | 130bf3c9edf89de78203c02c5f76f9ea2b7b46a5 | <ide><path>activerecord/examples/performance.rb
<ide> def self.feel(exhibits) exhibits.each { |e| e.feel } end
<ide> sqlfile = File.expand_path("../performance.sql", __FILE__)
<ide>
<ide> if File.exists?(sqlfile)
<del> mysql_bin = %w[mysql mysql5].select { |bin| `which #{bin}`.length > 0 }
<add> mysql_bin = %w[mysql mysql5].detect { |bin| `which #{bin}`.length > 0 }
<ide> `#{mysql_bin} -u #{conn[:username]} #{"-p#{conn[:password]}" unless conn[:password].blank?} #{conn[:database]} < #{sqlfile}`
<ide> else
<ide> puts 'Generating data...' | 1 |
Text | Text | fix io typo | d24b6648731fac952a5e8b75e84434bbfe7263b0 | <ide><path>README.md
<ide>
<ide> Atom is a hackable text editor for the 21st century, built on [atom-shell](http://github.com/atom/atom-shell), and based on everything we love about our favorite editors. We designed to be deeply customizable, but completely usable without editing a single config file.
<ide>
<del>Visit [atom.i](https://atom.io/) to learn more.
<add>Visit [atom.io](https://atom.io/) to learn more.
<ide>
<ide> ## Installing
<ide> | 1 |
Javascript | Javascript | add a failing test for context when reusing work | c22b7a001cc7e1a0f75e4f4826782bce1949ffee | <ide><path>src/renderers/shared/fiber/__tests__/ReactIncremental-test.js
<ide> describe('ReactIncremental', () => {
<ide> 'Recurse {"n":0}',
<ide> ]);
<ide> });
<add>
<add> it('provides context when reusing work', () => {
<add> var ops = [];
<add>
<add> class Intl extends React.Component {
<add> static childContextTypes = {
<add> locale: React.PropTypes.string,
<add> };
<add> getChildContext() {
<add> return {
<add> locale: this.props.locale,
<add> };
<add> }
<add> render() {
<add> ops.push('Intl ' + JSON.stringify(this.context));
<add> return this.props.children;
<add> }
<add> }
<add>
<add> class ShowLocale extends React.Component {
<add> static contextTypes = {
<add> locale: React.PropTypes.string,
<add> };
<add>
<add> render() {
<add> ops.push('ShowLocale ' + JSON.stringify(this.context));
<add> return this.context.locale;
<add> }
<add> }
<add>
<add> ops.length = 0;
<add> ReactNoop.render(
<add> <Intl locale="fr">
<add> <ShowLocale />
<add> <div hidden="true">
<add> <ShowLocale />
<add> <Intl locale="ru">
<add> <ShowLocale />
<add> </Intl>
<add> </div>
<add> <ShowLocale />
<add> </Intl>
<add> );
<add> ReactNoop.flushDeferredPri(40);
<add> expect(ops).toEqual([
<add> 'Intl null',
<add> 'ShowLocale {"locale":"fr"}',
<add> 'ShowLocale {"locale":"fr"}',
<add> ]);
<add>
<add> ops.length = 0;
<add> ReactNoop.flush();
<add> expect(ops).toEqual([
<add> 'ShowLocale {"locale":"fr"}',
<add> 'Intl null',
<add> 'ShowLocale {"locale":"ru"}',
<add> ]);
<add> });
<ide> }); | 1 |
Ruby | Ruby | manage requirements using comparableset | bbfb6400c77aeaaf88216263d86491d85a40f8a9 | <ide><path>Library/Homebrew/dependencies.rb
<ide> class DependencyCollector
<ide>
<ide> def initialize
<ide> @deps = Dependencies.new
<del> @requirements = Set.new
<add> @requirements = ComparableSet.new
<ide> end
<ide>
<ide> def add spec
<ide> def command_line
<ide> # This requirement is used to require an X11 implementation,
<ide> # optionally with a minimum version number.
<ide> class X11Dependency < Requirement
<add> include Comparable
<add> attr_reader :min_version
<add>
<ide> def initialize min_version=nil
<ide> @min_version = min_version
<ide> end
<ide> def modify_build_environment
<ide> ENV.x11
<ide> end
<ide>
<del> def hash
<del> "X11".hash
<add> def <=> other
<add> unless other.is_a? X11Dependency
<add> raise TypeError, "expected X11Dependency"
<add> end
<add>
<add> if other.min_version.nil?
<add> 1
<add> elsif @min_version.nil?
<add> -1
<add> else
<add> @min_version <=> other.min_version
<add> end
<ide> end
<add>
<ide> end
<ide>
<ide>
<ide><path>Library/Homebrew/extend/set.rb
<add>require 'set'
<add>
<add>class ComparableSet < Set
<add> def add new
<add> # smileys only
<add> return super new unless new.respond_to? :>
<add>
<add> objs = find_all { |o| o.class == new.class }
<add> objs.each do |o|
<add> return self if o > new
<add> delete o
<add> end
<add> super new
<add> end
<add>
<add> alias_method :<<, :add
<add>
<add> # Set#merge bypasses enumerating the set's contents,
<add> # so the subclassed #add would never be called
<add> def merge enum
<add> enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
<add> enum.each { |o| add(o) }
<add> end
<add>end
<ide><path>Library/Homebrew/formula.rb
<ide> require 'patches'
<ide> require 'compilers'
<ide> require 'build_environment'
<add>require 'extend/set'
<ide>
<ide>
<ide> class Formula
<ide> def self.expand_deps f
<ide> end
<ide>
<ide> def recursive_requirements
<del> reqs = recursive_deps.map { |dep| dep.requirements }.to_set
<del> reqs << requirements
<del> reqs.flatten
<add> reqs = ComparableSet.new
<add> recursive_deps.each { |dep| reqs.merge dep.requirements }
<add> reqs.merge requirements
<ide> end
<ide>
<ide> def to_hash
<ide><path>Library/Homebrew/test/test_comparableset.rb
<add>require 'testing_env'
<add>require 'extend/set'
<add>
<add>class ComparableSetTests < Test::Unit::TestCase
<add> def setup
<add> @set = ComparableSet.new
<add> end
<add>
<add> def test_merging_multiple_dependencies
<add> @set << X11Dependency.new
<add> @set << X11Dependency.new
<add> assert_equal @set.count, 1
<add> @set << Requirement.new
<add> assert_equal @set.count, 2
<add> end
<add>
<add> def test_comparison_prefers_larger
<add> @set << X11Dependency.new
<add> @set << X11Dependency.new('2.6')
<add> assert_equal @set.count, 1
<add> assert_equal @set.to_a, [X11Dependency.new('2.6')]
<add> end
<add>
<add> def test_comparison_does_not_merge_smaller
<add> @set << X11Dependency.new('2.6')
<add> @set << X11Dependency.new
<add> assert_equal @set.count, 1
<add> assert_equal @set.to_a, [X11Dependency.new('2.6')]
<add> end
<add>
<add> def test_merging_sets
<add> @set << X11Dependency.new
<add> @set << Requirement.new
<add> reqs = Set.new [X11Dependency.new('2.6'), Requirement.new]
<add> @set.merge reqs
<add>
<add> assert_equal @set.count, 2
<add> assert_equal @set.find {|r| r.is_a? X11Dependency}, X11Dependency.new('2.6')
<add> end
<add>end | 4 |
Ruby | Ruby | parse dates to yaml in json arrays | a1edbf720620c672566a1681572c3845452ca51a | <ide><path>activesupport/lib/active_support/json/backends/yaml.rb
<ide> def decode(json)
<ide> def convert_json_to_yaml(json) #:nodoc:
<ide> require 'strscan' unless defined? ::StringScanner
<ide> scanner, quoting, marks, pos, times = ::StringScanner.new(json), false, [], nil, []
<del> while scanner.scan_until(/(\\['"]|['":,\\]|\\.)/)
<add> while scanner.scan_until(/(\\['"]|['":,\\]|\\.|[\]])/)
<ide> case char = scanner[1]
<ide> when '"', "'"
<ide> if !quoting
<ide> def convert_json_to_yaml(json) #:nodoc:
<ide> end
<ide> quoting = false
<ide> end
<del> when ":",","
<add> when ":",",", "]"
<ide> marks << scanner.pos - 1 unless quoting
<ide> when "\\"
<ide> scanner.skip(/\\/)
<ide><path>activesupport/test/json/decoding_test.rb
<ide> class TestJSONDecoding < ActiveSupport::TestCase
<ide> %({"matzue": "松江", "asakusa": "浅草"}) => {"matzue" => "松江", "asakusa" => "浅草"},
<ide> %({"a": "2007-01-01"}) => {'a' => Date.new(2007, 1, 1)},
<ide> %({"a": "2007-01-01 01:12:34 Z"}) => {'a' => Time.utc(2007, 1, 1, 1, 12, 34)},
<add> %(["2007-01-01 01:12:34 Z"]) => [Time.utc(2007, 1, 1, 1, 12, 34)],
<add> %(["2007-01-01 01:12:34 Z", "2007-01-01 01:12:35 Z"]) => [Time.utc(2007, 1, 1, 1, 12, 34), Time.utc(2007, 1, 1, 1, 12, 35)],
<ide> # no time zone
<ide> %({"a": "2007-01-01 01:12:34"}) => {'a' => "2007-01-01 01:12:34"},
<ide> # invalid date | 2 |
PHP | PHP | remove unnecessary emptying of the buffer property | c75c94cc827e309ca5e5167c51f79cb5be2ead73 | <ide><path>src/Database/Expression/CaseStatementExpression.php
<ide> public function else($result, ?string $type = null)
<ide> $type = $this->inferType($result);
<ide> }
<ide>
<del> $this->whenBuffer = null;
<del>
<ide> $this->else = $result;
<ide> $this->elseType = $type;
<ide> | 1 |
PHP | PHP | cover more cases with tests | ea5d3e2b8c59e5d821adc18f60cfb127435decd6 | <ide><path>tests/TestCase/Database/Schema/TableTest.php
<ide> public static function addConstaintErrorProvider() {
<ide> // No properties
<ide> [[]],
<ide> // Empty columns
<del> [['columns' => '']],
<del> [['columns' => []]],
<add> [['columns' => '', 'type' => Table::CONSTRAINT_UNIQUE]],
<add> [['columns' => [], 'type' => Table::CONSTRAINT_UNIQUE]],
<ide> // Missing column
<del> [['columns' => ['derp']]],
<add> [['columns' => ['derp'], 'type' => Table::CONSTRAINT_UNIQUE]],
<ide> // Invalid type
<ide> [['columns' => 'author_id', 'type' => 'derp']],
<ide> ];
<ide> public static function addIndexErrorProvider() {
<ide> return [
<ide> // Empty
<ide> [[]],
<del> // No columns
<del> [['columns' => '']],
<del> [['columns' => []]],
<del> // Missing column
<del> [['columns' => ['not_there']]],
<ide> // Invalid type
<ide> [['columns' => 'author_id', 'type' => 'derp']],
<add> // No columns
<add> [['columns' => ''], 'type' => Table::INDEX_INDEX],
<add> [['columns' => [], 'type' => Table::INDEX_INDEX]],
<add> // Missing column
<add> [['columns' => ['not_there'], 'type' => Table::INDEX_INDEX]],
<ide> ];
<ide> }
<ide> | 1 |
PHP | PHP | add referer in error.log | f6037cd6fae6d9586f87631ec5ac3f2da6d13c94 | <ide><path>src/Error/BaseErrorHandler.php
<ide> protected function _getMessage(Exception $exception)
<ide> $request = Router::getRequest();
<ide> if ($request) {
<ide> $message .= "\nRequest URL: " . $request->here();
<add>
<add> $referer = $request->env('HTTP_REFERER');
<add> if ($referer) {
<add> $message .= "\nReferer URL: " . $referer;
<add> }
<ide> }
<ide> }
<ide> if (!empty($config['trace'])) { | 1 |
Text | Text | fix typo error of dockernetworks.md | f03050cc4c4512f28b74ec2e8fc4bee81b72b4e0 | <ide><path>docs/userguide/networking/dockernetworks.md
<ide> lo Link encap:Local Loopback
<ide> The `host` network adds a container on the hosts network stack. You'll find the
<ide> network configuration inside the container is identical to the host.
<ide>
<del>With the exception of the the `bridge` network, you really don't need to
<add>With the exception of the `bridge` network, you really don't need to
<ide> interact with these default networks. While you can list and inspect them, you
<ide> cannot remove them. They are required by your Docker installation. However, you
<ide> can add your own user-defined networks and these you can remove when you no
<ide> longer need them. Before you learn more about creating your own networks, it is
<del>worth looking at the `default` network a bit.
<add>worth looking at the default `bridge` network a bit.
<ide>
<ide>
<ide> ### The default bridge network in detail
<ide> ff02::1 ip6-allnodes
<ide> ff02::2 ip6-allrouters
<ide> ```
<ide>
<del>The default `docker0` bridge network supports the use of port mapping and `docker run --link` to allow communications between containers in the `docker0` network. These techniques are cumbersome to set up and prone to error. While they are still available to you as techniques, it is better to avoid them and define your own bridge networks instead.
<add>The default `docker0` bridge network supports the use of port mapping and `docker run --link` to allow communications between containers in the `docker0` network. These techniques are cumbersome to set up and prone to error. While they are still available to you as techniques, it is better to avoid them and define your own bridge networks instead.
<ide>
<ide> ## User-defined networks
<ide>
<ide> built-in network drivers. For example:
<ide>
<ide> $ docker network create --driver weave mynet
<ide>
<del>You can inspect it, add containers too and from it, and so forth. Of course,
<add>You can inspect it, add containers to and from it, and so forth. Of course,
<ide> different plugins may make use of different technologies or frameworks. Custom
<ide> networks can include features not present in Docker's default networks. For more
<ide> information on writing plugins, see [Extending Docker](../../extend/index.md) and | 1 |
Javascript | Javascript | add localedata tests | 53101f3ca8bc6279b8f29b2be22f1979bb693ab8 | <ide><path>src/test/locale/af.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ar-dz.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2016, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2016 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ar-ly.js
<ide> test('no leading zeros in long date formats', function (assert) {
<ide> }
<ide> }
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ar-ma.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ar-sa.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '٢ ٠٢ ٢', '2012 0 14');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ar-tn.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ar.js
<ide> test('no leading zeros in long date formats', function (assert) {
<ide> }
<ide> }
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/az.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-üncü', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/be.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-і', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/bg.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-ти', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/bn.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '২ ০২ ২', 'Jan 14 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '৩ ০৩ ৩', 'Jan 15 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/bo.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '༣ ༠༣ ༣', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/br.js
<ide> test('special mutations for years', function (assert) {
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({y: 261}), true), '261 bloaz', 'mutation 261 years');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/bs.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ca.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/cs.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/cv.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-мӗш', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/cy.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2il', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/da.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/de-at.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/de.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/dv.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/el.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2η', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/en-au.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/en-ca.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/en-gb.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/en-ie.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/en-nz.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/en.js
<ide> test('weekdays strict parsing', function (assert) {
<ide> }
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/eo.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3a', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/es-do.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/es.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<add>
<ide><path>src/test/locale/et.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/eu.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fa.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '۳ ۰۳ ۳م', 'Jan 14 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fi.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fo.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fr-ca.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3e', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fr-ch.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2e', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fr.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/fy.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/gd.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2na', 'Faoi 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/gl.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/he.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/hi.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '३ ०३ ३', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/hr.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/hu.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/hy-am.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-րդ', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/id.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/is.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/it.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ja.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/jv.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ka.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 მე-3', 'იან 9 2012 უნდა იყოს კვირა 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/kk.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3-ші', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/km.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/kn.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '೩ ೦೩ ೩ನೇ', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ko.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3일', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ky.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-чү', 'Jan 9 2012 should be week 3');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3-чү', 'Jan 15 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/lb.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2.', 'Jan 14 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/lo.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 ທີ່3', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/lt.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> test('month cases', function (assert) {
<ide> assert.equal(moment([2015, 4, 1]).format('LL'), '2015 m. gegužės 1 d.', 'uses format instead of standalone form');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/lv.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/me.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/mi.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/mk.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-ти', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ml.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/mr.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '३ ०३ ३', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ms-my.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ms.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/my.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '၂ ၀၂ ၂', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/nb.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ne.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '२ ०२ २', 'Jan 9 2012 should be week 2');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/nl-be.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/nl.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/nn.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/pa-in.js
<ide> test('strict ordinal parsing', function (assert) {
<ide> assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i);
<ide> }
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/pl.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/pt-br.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3º', 'Jan 15 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/pt.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ro.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ru.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-я', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sd.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/se.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/si.js
<ide> test('calendar all else', function (assert) {
<ide> assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sk.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sl.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sq.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sr-cyrl.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sr.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ss.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sv.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/sw.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ta.js
<ide> test('meridiem', function (assert) {
<ide> assert.equal(moment([2011, 2, 23, 23, 30]).format('a'), ' யாமம்', '(before) midnight');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/te.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2వ', 'Jan 14 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3వ', 'Jan 15 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/tet.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/th.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/tl-ph.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/tlh.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/tr.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3\'üncü', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/tzl.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/tzm-latn.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/tzm.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/uk.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-й', 'Jan 9 2012 should be week 3');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/ur.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/uz-latn.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/uz.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/vi.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2');
<ide> });
<ide>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/x-pseudo.js
<ide> test('weeks year starting sunday formatted', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide>\ No newline at end of file
<ide><path>src/test/locale/yo.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 9 2012 should be week 2');
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 ọjọ́ 2', 'Jan 15 2012 should be week 2');
<ide> });
<add>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/zh-cn.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2周', 'Jan 14 2012 应该是第 2周');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/zh-hk.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>});
<ide><path>src/test/locale/zh-tw.js
<ide> test('weeks year starting sunday format', function (assert) {
<ide> assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週');
<ide> });
<ide>
<del>
<add>test('valid localeData', function (assert) {
<add> assert.equal(moment().localeData().months().length, 12, 'months should return 12 months');
<add> assert.equal(moment().localeData().monthsShort().length, 12, 'monthsShort should return 12 months');
<add> assert.equal(moment().localeData().weekdays().length, 7, 'weekdays should return 7 days');
<add> assert.equal(moment().localeData().weekdaysShort().length, 7, 'weekdaysShort should return 7 days');
<add> assert.equal(moment().localeData().weekdaysMin().length, 7, 'monthsShort should return 7 days');
<add>}); | 113 |
Javascript | Javascript | fix use after null when calling .close | c7fef3d3b8763d55a238786b56f91939f10f2c36 | <ide><path>lib/zlib.js
<ide> function _close(engine, callback) {
<ide>
<ide> engine._closed = true;
<ide>
<del> engine._handle.close();
<add> // Caller may invoke .close after a zlib error (which will null _handle).
<add> if (engine._handle) {
<add> engine._handle.close();
<add> }
<ide> }
<ide>
<ide> function emitCloseNT(self) { | 1 |
Text | Text | fix a typo in active record encryption guide | a80a22508558513afccf0b0087873db2b690f3c0 | <ide><path>guides/source/active_record_encryption.md
<ide> class Person
<ide> end
<ide> ```
<ide>
<del>They will also work when combining encrypted and unencrypted data,git and when configuring previous encryption schemes.
<add>They will also work when combining encrypted and unencrypted data, and when configuring previous encryption schemes.
<ide>
<ide> NOTE: If you want to ignore case, make sure to use `downcase:` or `ignore_case:` in the `encrypts` declaration. Using the `case_sensitive:` option in the validation won't work.
<ide> | 1 |
Python | Python | fix critical celerykubernetesexecutor bug | b59e416f61edce86a811ec251d5887bfa728376f | <ide><path>airflow/executors/celery_kubernetes_executor.py
<ide> class CeleryKubernetesExecutor(LoggingMixin):
<ide>
<ide> def __init__(self, celery_executor, kubernetes_executor):
<ide> super().__init__()
<add> self._job_id: Optional[str] = None
<ide> self.celery_executor = celery_executor
<ide> self.kubernetes_executor = kubernetes_executor
<ide>
<ide> def running(self) -> Set[TaskInstanceKey]:
<ide> """Return running tasks from celery and kubernetes executor"""
<ide> return self.celery_executor.running.union(self.kubernetes_executor.running)
<ide>
<add> @property
<add> def job_id(self):
<add> """
<add> This is a class attribute in BaseExecutor but since this is not really an executor, but a wrapper
<add> of executors we implement as property so we can have custom setter.
<add> """
<add> return self._job_id
<add>
<add> @job_id.setter
<add> def job_id(self, value):
<add> """job_id is manipulated by SchedulerJob. We must propagate the job_id to wrapped executors."""
<add> self._job_id = value
<add> self.kubernetes_executor.job_id = value
<add> self.celery_executor.job_id = value
<add>
<ide> def start(self) -> None:
<ide> """Start celery and kubernetes executor"""
<ide> self.celery_executor.start()
<ide> self.kubernetes_executor.start()
<ide>
<add> @property
<add> def slots_available(self):
<add> """Number of new tasks this executor instance can accept"""
<add> return self.celery_executor.slots_available
<add>
<ide> def queue_command(
<ide> self,
<ide> task_instance: TaskInstance,
<ide><path>tests/executors/test_celery_kubernetes_executor.py
<ide> def test_terminate(self):
<ide>
<ide> celery_executor_mock.terminate.assert_called_once()
<ide> k8s_executor_mock.terminate.assert_called_once()
<add>
<add> def test_job_id_setter(self):
<add> cel_exec = CeleryExecutor()
<add> k8s_exec = KubernetesExecutor()
<add> cel_k8s_exec = CeleryKubernetesExecutor(cel_exec, k8s_exec)
<add> job_id = 'this-job-id'
<add> cel_k8s_exec.job_id = job_id
<add> assert cel_exec.job_id == k8s_exec.job_id == cel_k8s_exec.job_id == job_id | 2 |
Text | Text | add link to bootstrap documentation page for cards | cbcc18d7f76020d0caa17d3f3411477b4f0088ce | <ide><path>guide/english/bootstrap/cards/index.md
<ide> This is some text within a card body.
<ide> </div>
<ide> <!--You must set the image height on all cards -->
<ide> ```
<add>
<add>
<add>#### More Information
<add>
<add>- [Bootstrap cards](https://getbootstrap.com/docs/4.1/components/card/)
<add>
<add> | 1 |
Ruby | Ruby | push scope access up for modules | c25d1707b9577db82ccbd47447247ba644d81432 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def self.build(scope, set, path, as, controller, default_action, options)
<ide>
<ide> defaults = (scope[:defaults] || {}).dup
<ide>
<del> new scope, set, path, defaults, as, controller, default_action, options
<add> new scope, set, path, defaults, as, controller, default_action, scope[:module], options
<ide> end
<ide>
<del> def initialize(scope, set, path, defaults, as, controller, default_action, options)
<add> def initialize(scope, set, path, defaults, as, controller, default_action, modyoule, options)
<ide> @requirements, @conditions = {}, {}
<ide> @defaults = defaults
<ide> @set = set
<ide> def initialize(scope, set, path, defaults, as, controller, default_action, optio
<ide> ast = path_ast path
<ide> path_params = path_params ast
<ide>
<del> options = normalize_options!(options, formatted, path_params, ast, scope[:module])
<add> options = normalize_options!(options, formatted, path_params, ast, modyoule)
<ide>
<ide>
<ide> split_constraints(path_params, scope[:constraints]) if scope[:constraints] | 1 |
Ruby | Ruby | fix relation tests for postgres | 630dc5073075ba73251400400caae802f8d97d41 | <ide><path>activerecord/test/cases/relations_test.rb
<ide> def test_loaded_all
<ide> end
<ide>
<ide> def test_scoped_first
<del> topics = Topic.scoped
<add> topics = Topic.scoped.order('id ASC')
<ide>
<ide> assert_queries(1) do
<ide> 2.times { assert_equal "The First Topic", topics.first.title }
<ide> def test_scoped_first
<ide> end
<ide>
<ide> def test_loaded_first
<del> topics = Topic.scoped
<add> topics = Topic.scoped.order('id ASC')
<ide>
<ide> assert_queries(1) do
<ide> topics.all # force load
<ide> def test_dynamic_find_by_attributes_bang
<ide> author = Author.scoped.find_by_id!(authors(:david).id)
<ide> assert_equal "David", author.name
<ide>
<del> assert_raises(ActiveRecord::RecordNotFound) { Author.scoped.find_by_id_and_name!('invalid', 'wt') }
<add> assert_raises(ActiveRecord::RecordNotFound) { Author.scoped.find_by_id_and_name!(20, 'invalid') }
<ide> end
<ide>
<ide> def test_dynamic_find_all_by_attributes
<ide> def test_find_id
<ide> david = authors.find(authors(:david).id)
<ide> assert_equal 'David', david.name
<ide>
<del> assert_raises(ActiveRecord::RecordNotFound) { authors.where(:name => 'lifo').find('invalid') }
<add> assert_raises(ActiveRecord::RecordNotFound) { authors.where(:name => 'lifo').find('42') }
<ide> end
<ide>
<ide> def test_find_ids
<ide> def test_find_ids
<ide> assert_equal 'Mary', results[1].name
<ide> assert_equal results, authors.find([authors(:david).id, authors(:mary).id])
<ide>
<del> assert_raises(ActiveRecord::RecordNotFound) { authors.where(:name => 'lifo').find(authors(:david).id, 'invalid') }
<del> assert_raises(ActiveRecord::RecordNotFound) { authors.find(['invalid', 'oops']) }
<add> assert_raises(ActiveRecord::RecordNotFound) { authors.where(:name => 'lifo').find(authors(:david).id, '42') }
<add> assert_raises(ActiveRecord::RecordNotFound) { authors.find(['42', 43]) }
<ide> end
<ide>
<ide> def test_exists
<ide> davids = Author.where(:name => 'David')
<ide> assert davids.exists?
<ide> assert davids.exists?(authors(:david).id)
<ide> assert ! davids.exists?(authors(:mary).id)
<del> assert ! davids.exists?("hax'id")
<add> assert ! davids.exists?("42")
<add> assert ! davids.exists?(42)
<ide>
<ide> fake = Author.where(:name => 'fake author')
<ide> assert ! fake.exists?
<ide> def test_relation_merging
<ide> devs = Developer.where("salary >= 80000") & Developer.limit(2) & Developer.order('id ASC').where("id < 3")
<ide> assert_equal [developers(:david), developers(:jamis)], devs.to_a
<ide>
<del> dev_with_count = Developer.limit(1) & Developer.order('id DESC') & Developer.select('developers.*').group('id')
<add> dev_with_count = Developer.limit(1) & Developer.order('id DESC') & Developer.select('developers.*')
<ide> assert_equal [developers(:poor_jamis)], dev_with_count.to_a
<ide> end
<ide> | 1 |
Mixed | Python | improve docs and make train flag match eval flag | 2662da2cfeb5448627690d689a6c96647d720ff2 | <ide><path>research/slim/nets/mobilenet_v1.md
<ide> $ bazel build -c opt --config=cuda mobilenet_v1_{eval,train}
<ide> Train:
<ide>
<ide> ```
<del>$ ./bazel-bin/mobilenet_v1_train
<add>$ ./bazel-bin/mobilenet_v1_train --dataset_dir "path/to/dataset" --checkpoint_dir "path/to/checkpoints"
<ide> ```
<ide>
<ide> Eval:
<ide>
<ide> ```
<del>$ ./bazel-bin/mobilenet_v1_eval
<add>$ ./bazel-bin/mobilenet_v1_eval --dataset_dir "path/to/dataset" --checkpoint_dir "path/to/checkpoints"
<ide> ```
<ide>
<ide> #### Quantized Training and Eval
<ide>
<ide> Train from preexisting float checkpoint:
<ide>
<ide> ```
<del>$ ./bazel-bin/mobilenet_v1_train --quantize=True --fine_tune_checkpoint=checkpoint-name
<add>$ ./bazel-bin/mobilenet_v1_train --dataset_dir "path/to/dataset" --checkpoint_dir "path/to/checkpoints" \
<add> --quantize=True --fine_tune_checkpoint=float/checkpoint/path
<ide> ```
<ide>
<ide> Train from scratch:
<ide>
<ide> ```
<del>$ ./bazel-bin/mobilenet_v1_train --quantize=True
<add>$ ./bazel-bin/mobilenet_v1_train --dataset_dir "path/to/dataset" --checkpoint_dir "path/to/checkpoints" --quantize=True
<ide> ```
<ide>
<ide> Eval:
<ide>
<ide> ```
<del>$ ./bazel-bin/mobilenet_v1_eval --quantize=True
<add>$ ./bazel-bin/mobilenet_v1_eval --dataset_dir "path/to/dataset" --checkpoint_dir "path/to/checkpoints" --quantize=True
<ide> ```
<ide>
<ide> The resulting float and quantized models can be run on-device via [TensorFlow Lite](https://www.tensorflow.org/mobile/tflite/).
<ide><path>research/slim/nets/mobilenet_v1_train.py
<ide> flags.DEFINE_bool('quantize', False, 'Quantize training')
<ide> flags.DEFINE_string('fine_tune_checkpoint', '',
<ide> 'Checkpoint from which to start finetuning.')
<del>flags.DEFINE_string('logdir', '', 'Directory for writing training event logs')
<add>flags.DEFINE_string('checkpoint_dir', '',
<add> 'Directory for writing training checkpoints and logs')
<ide> flags.DEFINE_string('dataset_dir', '', 'Location of dataset')
<ide> flags.DEFINE_integer('log_every_n_steps', 100, 'Number of steps per log')
<ide> flags.DEFINE_integer('save_summaries_secs', 100,
<ide> def train_model():
<ide> with g.as_default():
<ide> slim.learning.train(
<ide> train_tensor,
<del> FLAGS.logdir,
<add> FLAGS.checkpoint_dir,
<ide> is_chief=(FLAGS.task == 0),
<ide> master=FLAGS.master,
<ide> log_every_n_steps=FLAGS.log_every_n_steps, | 2 |
Text | Text | add solution to jquery challenges | 1015f1ec6e8424d37d29fd717178846c0175ffc5 | <ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("button").addClass("animated bounce");
<add> $(".well").addClass("animated shake");
<add> $("#target3").addClass("animated fadeOut");
<add> $("button").removeClass("btn-default");
<add> $("#target1").css("color", "red");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/clone-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> $("#target5").clone().appendTo("#left-well");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/delete-your-jquery-functions.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add>
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/disable-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add>
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/learn-how-script-tags-and-document-ready-work.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> });
<add></script>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/remove-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/remove-classes-from-an-element-with-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("button").addClass("animated bounce");
<add> $(".well").addClass("animated shake");
<add> $("#target3").addClass("animated fadeOut");
<add> $("button").removeClass("btn-default");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-a-specific-child-of-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> $("#target5").clone().appendTo("#left-well");
<add> $("#target1").parent().css("background-color", "red");
<add> $("#right-well").children().css("color", "orange");
<add> $(".target:nth-child(2)").addClass("animated bounce");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-elements-by-class-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("button").addClass("animated bounce");
<add> $(".well").addClass("animated shake");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-elements-by-id-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("button").addClass("animated bounce");
<add> $(".well").addClass("animated shake");
<add> $("#target3").addClass("animated fadeOut");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-even-elements-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> $("#target5").clone().appendTo("#left-well");
<add> $("#target1").parent().css("background-color", "red");
<add> $("#right-well").children().css("color", "orange");
<add> $("#left-well").children().css("color", "green");
<add> $(".target:nth-child(2)").addClass("animated bounce");
<add> $(".target:even").addClass("animated shake");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-html-elements-with-selectors-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("button").addClass("animated bounce");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-the-children-of-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> $("#target5").clone().appendTo("#left-well");
<add> $("#target1").parent().css("background-color", "red");
<add> $("#right-well").children().css("color", "orange");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-the-parent-of-an-element-using-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> $("#target5").clone().appendTo("#left-well");
<add> $("#target1").parent().css("background-color", "red");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><body>
<add> <div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add> </div>
<add></body>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/target-the-same-element-with-multiple-jquery-selectors.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("button").addClass("animated");
<add> $(".btn").addClass("shake");
<add> $("#target1").addClass("btn-primary");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/use-appendto-to-move-elements-with-jquery.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/03-front-end-libraries/jquery/use-jquery-to-modify-the-entire-page.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><script>
<add> $(document).ready(function() {
<add> $("#target1").css("color", "red");
<add> $("#target1").prop("disabled", true);
<add> $("#target4").remove();
<add> $("#target2").appendTo("#right-well");
<add> $("#target5").clone().appendTo("#left-well");
<add> $("#target1").parent().css("background-color", "red");
<add> $("#right-well").children().css("color", "orange");
<add> $("#left-well").children().css("color", "green");
<add> $(".target:nth-child(2)").addClass("animated bounce");
<add> $(".target:even").addClass("animated shake");
<add> $("body").addClass("animated hinge");
<add> });
<add></script>
<add>
<add><!-- Only change code above this line. -->
<add>
<add><div class="container-fluid">
<add> <h3 class="text-primary text-center">jQuery Playground</h3>
<add> <div class="row">
<add> <div class="col-xs-6">
<add> <h4>#left-well</h4>
<add> <div class="well" id="left-well">
<add> <button class="btn btn-default target" id="target1">#target1</button>
<add> <button class="btn btn-default target" id="target2">#target2</button>
<add> <button class="btn btn-default target" id="target3">#target3</button>
<add> </div>
<add> </div>
<add> <div class="col-xs-6">
<add> <h4>#right-well</h4>
<add> <div class="well" id="right-well">
<add> <button class="btn btn-default target" id="target4">#target4</button>
<add> <button class="btn btn-default target" id="target5">#target5</button>
<add> <button class="btn btn-default target" id="target6">#target6</button>
<add> </div>
<add> </div>
<add> </div>
<add></div>
<ide> ```
<ide> </section> | 17 |
PHP | PHP | remove schema and prefix from 3.x's censor list | 1d9e37d238b5c12b92445f620ffb8d1b79404ced | <ide><path>src/Database/Connection.php
<ide> public function __debugInfo()
<ide> 'username' => '*****',
<ide> 'host' => '*****',
<ide> 'database' => '*****',
<del> 'port' => '*****',
<del> 'prefix' => '*****',
<del> 'schema' => '*****'
<add> 'port' => '*****'
<ide> ];
<ide> $replace = array_intersect_key($secrets, $this->_config);
<ide> $config = $replace + $this->_config; | 1 |
Ruby | Ruby | fix error handling | 3701081b65cbfd09024b95b0de2e154a3ba7478d | <ide><path>Library/Contributions/cmd/brew-mirror-check.rb
<ide> def test_mirror mirror
<ide> tarball_path = downloader.tarball_path
<ide> tarball_path.unlink if tarball_path.exist?
<ide>
<del> begin
<del> fetched = downloader.fetch
<del> rescue DownloadError => e
<del> opoo "Failed to fetch from URL: #{url}"
<del> return
<del> end
<del>
<add> fetched = downloader.fetch
<add> rescue StandardError
<add> opoo "Failed to fetch from URL: #{url}"
<add> else
<ide> verify_download_integrity fetched if fetched.kind_of? Pathname
<ide> end
<ide> end | 1 |
Ruby | Ruby | skip url processing for githublatest | 7ef88f1966235c59216ec31836abedd6487f7cfc | <ide><path>Library/Homebrew/livecheck/livecheck.rb
<ide> module Livecheck
<ide> lolg.it
<ide> ].freeze
<ide>
<add> STRATEGY_SYMBOLS_TO_SKIP_PREPROCESS_URL = [
<add> :github_latest,
<add> :page_match,
<add> ].freeze
<add>
<ide> UNSTABLE_VERSION_KEYWORDS = %w[
<ide> alpha
<ide> beta
<ide> def latest_version(formula, args:)
<ide> next
<ide> end
<ide>
<del> # Do not preprocess the URL when livecheck.strategy is set to :page_match
<del> url = if livecheck_strategy == :page_match
<add> # Only preprocess the URL when it's appropriate
<add> url = if STRATEGY_SYMBOLS_TO_SKIP_PREPROCESS_URL.include?(livecheck_strategy)
<ide> original_url
<ide> else
<ide> preprocess_url(original_url) | 1 |
Text | Text | release notes for notification | 077ac949cb8bb47d45d3da9460c2f8032b436125 | <ide><path>language-adaptors/rxjava-scala/ReleaseNotes.md
<ide> Subscriptions
<ide> -------------
<ide>
<ide> The `Subscription` trait in Scala now has `isUnsubscribed` as a member, effectively collapsing the old `Subscription`
<del>and `BooleanSubscription`, and the latter has been removed from the public surface. Pending a bugfix in RxJava,
<add>and `BooleanSubscription`, and the latter has been removed from the public surface. Pending a bug fix in RxJava,
<ide> `SerialSubscription` implements its own `isUnsubscribed`.
<ide>
<ide>
<ide> object Subscription {...}
<ide>
<ide> * `Subscription{...}`, `Subscription()`
<ide> * `CompositeSubscription(subscriptions)`
<del> * `MultipleAssignmentSubscription`
<del> * `SerialSubscription`
<add> * `MultipleAssignmentSubscription()`
<add> * `SerialSubscription()`
<ide>
<ide> In case you do feel tempted to call `new Subscription{...}` directly make sure you wire up `isUnsubscribed`
<del> and with the `unsubscribed` field properly, but for all practical purposes you should just use one of the factory methods.
<add> and `unsubscribe()` properly, but for all practical purposes you should just use one of the factory methods.
<ide>
<ide> Notifications
<ide> -------------
<ide> object Notification {...}
<ide> trait Notification[+T] {
<ide> override def equals(that: Any): Boolean = {...}
<ide> override def hashCode(): Int = {...}
<del> def accept[R](onNext: T=>R, onError: Throwable=>R, onCompleted: ()=>R): R = {...}
<add> def apply[R](onNext: T=>R, onError: Throwable=>R, onCompleted: ()=>R): R = {...}
<ide> }
<ide> ```
<ide> The nested companion objects of `Notification` now have both constructor (`apply`) and extractor (`unapply`) functions:
<ide> object Notification {
<ide> To construct a `Notification`, you import `rx.lang.scala.Notification._` and use `OnNext("hello")`,
<ide> or `OnError(new Exception("Oops!"))`, or `OnCompleted()`.
<ide>
<del>To pattern match on a notification you can create a partial function like so: `case OnNext(v) => { ... v ... }`.
<add>To pattern match on a notification you create a partial function like so: `case Notification.OnNext(v) => { ... v ... }`,
<add>or you use the `apply` function to pass in functions for each possibility.
<ide>
<ide> There are no breaking changes for notifications.
<ide> | 1 |
Javascript | Javascript | replace magic numbers with descriptive var names | cd140d94cd9961cc1557645adb686bf4942f6950 | <ide><path>examples/js/loaders/GLTFLoader.js
<ide> THREE.GLTFLoader = ( function () {
<ide>
<ide> var sampler = json.samplers[ texture.sampler ];
<ide>
<del> _texture.magFilter = WEBGL_FILTERS[ sampler.magFilter || 9729 ];
<del> _texture.minFilter = WEBGL_FILTERS[ sampler.minFilter || 9986 ];
<del> _texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS || 10497 ];
<del> _texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT || 10497 ];
<add> _texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || THREE.LinearFilter;
<add> _texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || THREE.NearestMipMapLinearFilter;
<add> _texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || THREE.RepeatWrapping;
<add> _texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || THREE.RepeatWrapping;
<ide>
<ide> }
<ide> | 1 |
Python | Python | remove tests that are not yet ready to be tested | 05bb700f5c20b1a99984e5632ae78e6ada0c1657 | <ide><path>test/test_base.py
<ide>
<ide> class BaseTests(unittest.TestCase):
<ide>
<del> def test_drivers_interface(self):
<del> failures = []
<del> for driver in DRIVERS:
<del> creds = ProviderCreds(driver, 'foo', 'bar')
<del> try:
<del> verifyObject(INodeDriver, get_driver(driver)(creds))
<del> except BrokenImplementation:
<del> failures.append(DRIVERS[driver][1])
<del>
<del> if failures:
<del> self.fail('the following drivers do not support the \
<del> INodeDriver interface: %s' % (', '.join(failures)))
<add># XXX re-enable once everything supports the interfaces
<add># def test_drivers_interface(self):
<add># failures = []
<add># for driver in DRIVERS:
<add># creds = ProviderCreds(driver, 'foo', 'bar')
<add># try:
<add># verifyObject(INodeDriver, get_driver(driver)(creds))
<add># except BrokenImplementation:
<add># failures.append(DRIVERS[driver][1])
<add>#
<add># if failures:
<add># self.fail('the following drivers do not support the \
<add># INodeDriver interface: %s' % (', '.join(failures)))
<ide>
<ide> def test_invalid_creds(self):
<ide> failures = []
<ide><path>test/test_ec2.py
<ide> def setUp(self):
<ide> def test_list_nodes(self):
<ide> ret = self.conn.list_nodes()
<ide>
<del> def test_reboot_nodes(self):
<del> node = Node(None, None, None, None, None,
<del> attrs={'instanceId':'i-e1615d88'})
<del> ret = self.conn.reboot_node(node)
<add># XXX: need to make this test based on a node that was created
<add># def test_reboot_nodes(self):
<add># node = Node(None, None, None, None, None,
<add># attrs={'instanceId':'i-e1615d88'})
<add># ret = self.conn.reboot_node(node) | 2 |
PHP | PHP | fix typo in belongstomany | 71c7fe77b432966162a0ca2ec957c033ae591954 | <ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
<ide> protected function shouldSelect(array $columns = ['*'])
<ide> /**
<ide> * Get the pivot columns for the relation.
<ide> *
<del> * "pivot_" is prefixed ot each column for easy removal later.
<add> * "pivot_" is prefixed at each column for easy removal later.
<ide> *
<ide> * @return array
<ide> */ | 1 |
Ruby | Ruby | remove flaky test | 75c74e4674d3f6a85c4afce79a6096bcc5cca9fc | <ide><path>Library/Homebrew/test/cask/cmd/upgrade_spec.rb
<ide> expect(local_transmission.versions).to include("2.60")
<ide> expect(local_transmission.versions).not_to include("2.61")
<ide> end
<del>
<del> it 'would update "auto_updates" and "latest" Casks when their tokens are provided in the command line' do
<del> local_caffeine = Cask::CaskLoader.load("local-caffeine")
<del> local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
<del> auto_updates = Cask::CaskLoader.load("auto-updates")
<del> auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app")
<del>
<del> expect(local_caffeine).to be_installed
<del> expect(local_caffeine_path).to be_a_directory
<del> expect(local_caffeine.versions).to include("1.2.2")
<del>
<del> expect(auto_updates).to be_installed
<del> expect(auto_updates_path).to be_a_directory
<del> expect(auto_updates.versions).to include("2.57")
<del>
<del> described_class.run("--dry-run", "local-caffeine", "auto-updates")
<del>
<del> expect(local_caffeine).to be_installed
<del> expect(local_caffeine_path).to be_a_directory
<del> expect(local_caffeine.versions).to include("1.2.2")
<del> expect(local_caffeine.versions).not_to include("1.2.3")
<del>
<del> expect(auto_updates).to be_installed
<del> expect(auto_updates_path).to be_a_directory
<del> expect(auto_updates.versions).to include("2.57")
<del> expect(auto_updates.versions).not_to include("2.61")
<del> end
<ide> end
<ide>
<ide> describe "with --greedy it checks additional Casks" do | 1 |
Python | Python | add pyopenssl to google cloud gcp_api | afb826aec2739edaac2ae09265113dae0a04a91e | <ide><path>setup.py
<ide> def run(self):
<ide> 'httplib2',
<ide> 'google-api-python-client<=1.4.2',
<ide> 'oauth2client>=1.5.2, <2.0.0',
<add> 'PyOpenSSL',
<ide> ]
<ide> hdfs = ['snakebite>=2.7.8']
<ide> webhdfs = ['hdfs[dataframe,avro,kerberos]>=2.0.4'] | 1 |
PHP | PHP | update reponse tests related to cookies | 2609bd976ba1ee17100d4a219872ce817b2180a8 | <ide><path>tests/TestCase/Http/ResponseTest.php
<ide> public function testWithCookieEmpty()
<ide> $expected = [
<ide> 'name' => 'testing',
<ide> 'value' => '',
<del> 'expire' => 0,
<del> 'path' => '/',
<del> 'domain' => '',
<del> 'secure' => false,
<del> 'httpOnly' => false];
<add> 'options' => [
<add> 'expires' => 0,
<add> 'path' => '/',
<add> 'domain' => '',
<add> 'secure' => false,
<add> 'httponly' => false,
<add> ],
<add> ];
<ide> $result = $new->getCookie('testing');
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide> public function testWithDuplicateCookie()
<ide> $expected = [
<ide> 'name' => 'testing',
<ide> 'value' => '[a,b,c]',
<del> 'expire' => $expiry,
<del> 'path' => '/test',
<del> 'domain' => '',
<del> 'secure' => true,
<del> 'httpOnly' => false,
<add> 'options' => [
<add> 'expires' => $expiry,
<add> 'path' => '/test',
<add> 'domain' => '',
<add> 'secure' => true,
<add> 'httponly' => false,
<add> ],
<ide> ];
<ide>
<ide> // Match the date time formatting to Response::convertCookieToArray
<del> $expected['expire'] = $expiry->format('U');
<add> $expected['options']['expires'] = $expiry->format('U');
<ide>
<ide> $this->assertEquals($expected, $new->getCookie('testing'));
<ide> }
<ide> public function testWithExpiredCookieScalar()
<ide>
<ide> $new = $response->withExpiredCookie(new Cookie('testing'));
<ide>
<del> $this->assertNull($response->getCookie('testing')['expire']);
<del> $this->assertLessThan(FrozenTime::createFromTimestamp(1), (string)$new->getCookie('testing')['expire']);
<add> $this->assertNull($response->getCookie('testing')['options']['expires']);
<add> $this->assertLessThan(FrozenTime::createFromTimestamp(1), (string)$new->getCookie('testing')['options']['expires']);
<ide> }
<ide>
<ide> /**
<ide> public function testWithExpiredCookieOptions()
<ide> $options = [
<ide> 'name' => 'testing',
<ide> 'value' => 'abc123',
<del> 'domain' => 'cakephp.org',
<del> 'path' => '/custompath/',
<del> 'secure' => true,
<del> 'httpOnly' => true,
<del> 'expire' => new \DateTimeImmutable('+14 days'),
<add> 'options' => [
<add> 'domain' => 'cakephp.org',
<add> 'path' => '/custompath/',
<add> 'secure' => true,
<add> 'httponly' => true,
<add> 'expires' => new \DateTimeImmutable('+14 days'),
<add> ],
<ide> ];
<ide>
<del> $cookie = new Cookie(
<add> $cookie = Cookie::create(
<ide> $options['name'],
<ide> $options['value'],
<del> $options['expire'],
<del> $options['path'],
<del> $options['domain'],
<del> $options['secure'],
<del> $options['httpOnly']
<add> $options['options']
<ide> );
<ide>
<ide> $response = new Response();
<ide> $response = $response->withCookie($cookie);
<ide>
<del> // Change the timestamp format to match the Response::convertCookieToArray
<del> $options['expire'] = $options['expire']->format('U');
<add> $options['options']['expires'] = $options['options']['expires']->format('U');
<ide> $this->assertEquals($options, $response->getCookie('testing'));
<ide>
<ide> $expiredCookie = $response->withExpiredCookie($cookie);
<ide>
<del> $this->assertEquals($options['expire'], $response->getCookie('testing')['expire']);
<del> $this->assertLessThan(FrozenTime::createFromTimestamp(1), (string)$expiredCookie->getCookie('testing')['expire']);
<add> $this->assertEquals($options['options']['expires'], $response->getCookie('testing')['options']['expires']);
<add> $this->assertLessThan(FrozenTime::createFromTimestamp(1), (string)$expiredCookie->getCookie('testing')['options']['expires']);
<ide> }
<ide>
<ide> /**
<ide> public function testWithExpiredCookieObject()
<ide>
<ide> $new = $response->withExpiredCookie($cookie);
<ide>
<del> $this->assertNull($response->getCookie('yay')['expire']);
<del> $this->assertSame(1, $new->getCookie('yay')['expire']);
<add> $this->assertNull($response->getCookie('yay')['options']['expires']);
<add> $this->assertSame(1, $new->getCookie('yay')['options']['expires']);
<ide> }
<ide>
<ide> /**
<ide> public function testGetCookies()
<ide> 'testing' => [
<ide> 'name' => 'testing',
<ide> 'value' => 'a',
<del> 'expire' => null,
<del> 'path' => '/',
<del> 'domain' => '',
<del> 'secure' => false,
<del> 'httpOnly' => false,
<add> 'options' => [
<add> 'expires' => null,
<add> 'path' => '/',
<add> 'domain' => '',
<add> 'secure' => false,
<add> 'httponly' => false,
<add> ],
<ide> ],
<ide> 'test2' => [
<ide> 'name' => 'test2',
<ide> 'value' => 'b',
<del> 'expire' => null,
<del> 'path' => '/test',
<del> 'domain' => '',
<del> 'secure' => true,
<del> 'httpOnly' => false,
<add> 'options' => [
<add> 'expires' => null,
<add> 'path' => '/test',
<add> 'domain' => '',
<add> 'secure' => true,
<add> 'httponly' => false,
<add> ],
<ide> ],
<ide> ];
<ide> $this->assertEquals($expected, $new->getCookies());
<ide> public function testGetCookiesArrayValue()
<ide> 'urmc' => [
<ide> 'name' => 'urmc',
<ide> 'value' => '{"user_id":1,"token":"abc123"}',
<del> 'expire' => null,
<del> 'path' => '/',
<del> 'domain' => '',
<del> 'secure' => false,
<del> 'httpOnly' => true,
<add> 'options' => [
<add> 'expires' => null,
<add> 'path' => '/',
<add> 'domain' => '',
<add> 'secure' => false,
<add> 'httponly' => true,
<add> ],
<ide> ],
<ide> ];
<ide> $this->assertEquals($expected, $new->getCookies()); | 1 |
Ruby | Ruby | use the right assertions | 918aa6e87813c5c7687e5d460c5cd62ba3919536 | <ide><path>actionview/test/template/url_helper_test.rb
<ide> def test_link_unless_current
<ide> end
<ide>
<ide> def test_link_to_unless_with_block
<del> assert_equal %{<a href="/">Showing</a>}, link_to_unless(false, "Showing", url_hash) { "Fallback" }
<del> assert_dom_equal "Fallback", link_to_unless(true, "Listing", url_hash) { "Fallback" }
<add> assert_dom_equal %{<a href="/">Showing</a>}, link_to_unless(false, "Showing", url_hash) { "Fallback" }
<add> assert_equal "Fallback", link_to_unless(true, "Listing", url_hash) { "Fallback" }
<ide> end
<ide>
<ide> def test_mail_to | 1 |
Javascript | Javascript | remove redeclared var in test-domain | f48793eb1536d1b55814d17a819f620242d7aa9f | <ide><path>test/parallel/test-domain.js
<ide> function fn2(data) {
<ide> assert.equal(data, 'data', 'should not be null err argument');
<ide> }
<ide>
<del>var bound = d.intercept(fn2);
<add>bound = d.intercept(fn2);
<ide> bound(null, 'data');
<ide>
<ide> // intercepted should never pass first argument to callback | 1 |
Go | Go | remove unused builder.cancel() | 068f344e032ad4489a88665adec683e06ad6f3c7 | <ide><path>builder/dockerfile/builder.go
<ide> type Builder struct {
<ide> docker builder.Backend
<ide> context builder.Context
<ide> clientCtx context.Context
<del> cancel context.CancelFunc
<ide>
<ide> runConfig *container.Config // runconfig for cmd, run, entrypoint etc.
<ide> flags *BFlags
<ide> func NewBuilder(clientCtx context.Context, config *types.ImageBuildOptions, back
<ide> if config == nil {
<ide> config = new(types.ImageBuildOptions)
<ide> }
<del> ctx, cancel := context.WithCancel(clientCtx)
<ide> b = &Builder{
<del> clientCtx: ctx,
<del> cancel: cancel,
<add> clientCtx: clientCtx,
<ide> options: config,
<ide> Stdout: os.Stdout,
<ide> Stderr: os.Stderr,
<ide> func (b *Builder) hasFromImage() bool {
<ide> return b.image != "" || b.noBaseImage
<ide> }
<ide>
<del>// Cancel cancels an ongoing Dockerfile build.
<del>func (b *Builder) Cancel() {
<del> b.cancel()
<del>}
<del>
<ide> // BuildFromConfig builds directly from `changes`, treating it as if it were the contents of a Dockerfile
<ide> // It will:
<ide> // - Call parse.Parse() to get an AST root for the concatenated Dockerfile entries. | 1 |
Python | Python | add model input small script | e8ad00cad5d9c8f6ed988d94b1e5db17c8d5db20 | <ide><path>research/object_detection/dataset_tools/context_rcnn/view_model_inputs.py
<add># Copyright 2020 The TensorFlow Authors. All Rights Reserved.
<add>#
<add># Licensed under the Apache License, Version 2.0 (the "License");
<add># you may not use this file except in compliance with the License.
<add># You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing, software
<add># distributed under the License is distributed on an "AS IS" BASIS,
<add># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add># See the License for the specific language governing permissions and
<add># limitations under the License.
<add># ==============================================================================
<add>r"""A Beam job to generate embedding data for camera trap images.
<add>
<add>This tool runs inference with an exported Object Detection model in
<add>`saved_model` format and produce raw embeddings for camera trap data. These
<add>embeddings contain an object-centric feature embedding from Faster R-CNN, the
<add>datetime that the image was taken (normalized in a specific way), and the
<add>position of the object of interest. By default, only the highest-scoring object
<add>embedding is included.
<add>
<add>Steps to generate a embedding dataset:
<add>1. Use object_detection/export_inference_graph.py to get a Faster R-CNN
<add> `saved_model` for inference. The input node must accept a tf.Example proto.
<add>2. Run this tool with `saved_model` from step 1 and an TFRecord of tf.Example
<add> protos containing images for inference.
<add>
<add>Example Usage:
<add>--------------
<add>python tensorflow_models/object_detection/export_inference_graph.py \
<add> --alsologtostderr \
<add> --input_type tf_example \
<add> --pipeline_config_path path/to/faster_rcnn_model.config \
<add> --trained_checkpoint_prefix path/to/model.ckpt \
<add> --output_directory path/to/exported_model_directory \
<add> --additional_output_tensor_names detection_features
<add>
<add>python generate_embedding_data.py \
<add> --alsologtostderr \
<add> --embedding_input_tfrecord path/to/input_tfrecords* \
<add> --embedding_output_tfrecord path/to/output_tfrecords \
<add> --embedding_model_dir path/to/exported_model_directory/saved_model
<add>"""
<add>
<add>from __future__ import absolute_import
<add>from __future__ import division
<add>from __future__ import print_function
<add>
<add>import argparse
<add>import datetime
<add>import os
<add>import threading
<add>
<add>import numpy as np
<add>import six
<add>import tensorflow.compat.v1 as tf
<add>
<add>try:
<add> import apache_beam as beam # pylint:disable=g-import-not-at-top
<add>except ModuleNotFoundError:
<add> pass
<add>
<add>def _load_inference_model(args):
<add># Because initialization of the tf.Session is expensive we share
<add># one instance across all threads in the worker. This is possible since
<add># tf.Session.run() is thread safe.
<add> print(args)
<add> args = vars(args)
<add> session_lock = threading.Lock()
<add> session = None
<add> with session_lock:
<add> if session is None:
<add> graph = tf.Graph()
<add> session = tf.Session(graph=graph)
<add> with graph.as_default():
<add> meta_graph = tf.saved_model.loader.load(
<add> session, [tf.saved_model.tag_constants.SERVING],
<add> args['embedding_model_dir'])
<add> signature = meta_graph.signature_def['serving_default']
<add> print(signature.inputs)
<add> print(type(signature.inputs))
<add> input_tensor_name = signature.inputs['input_tensor'].name
<add> print(input_tensor_name)
<add> _input = graph.get_tensor_by_name(input_tensor_name)
<add> print(_input.shape)
<add>
<add> detection_features_name = signature.outputs['detection_features'].name
<add> detection_boxes_name = signature.outputs['detection_boxes'].name
<add> num_detections_name = signature.outputs['num_detections'].name
<add>
<add> self._embedding_node = graph.get_tensor_by_name(detection_features_name)
<add> self._box_node = graph.get_tensor_by_name(detection_boxes_name)
<add> self._scores_node = graph.get_tensor_by_name(
<add> signature.outputs['detection_scores'].name)
<add> self._num_detections = graph.get_tensor_by_name(num_detections_name)
<add> tf.logging.info(signature.outputs['detection_features'].name)
<add> tf.logging.info(signature.outputs['detection_boxes'].name)
<add> tf.logging.info(signature.outputs['num_detections'].name)
<add> print("Hello")
<add>
<add>def parse_args(argv):
<add> """Command-line argument parser.
<add>
<add> Args:
<add> argv: command line arguments
<add> Returns:
<add> beam_args: Arguments for the beam pipeline.
<add> pipeline_args: Arguments for the pipeline options, such as runner type.
<add> """
<add> parser = argparse.ArgumentParser()
<add> parser.add_argument(
<add> '--embedding_input_tfrecord',
<add> dest='embedding_input_tfrecord',
<add> required=True,
<add> help='TFRecord containing images in tf.Example format for object '
<add> 'detection.')
<add> parser.add_argument(
<add> '--embedding_output_tfrecord',
<add> dest='embedding_output_tfrecord',
<add> required=True,
<add> help='TFRecord containing embeddings in tf.Example format.')
<add> parser.add_argument(
<add> '--embedding_model_dir',
<add> dest='embedding_model_dir',
<add> required=True,
<add> help='Path to directory containing an object detection SavedModel with'
<add> 'detection_box_classifier_features in the output.')
<add> parser.add_argument(
<add> '--top_k_embedding_count',
<add> dest='top_k_embedding_count',
<add> default=1,
<add> help='The number of top k embeddings to add to the memory bank.')
<add> parser.add_argument(
<add> '--bottom_k_embedding_count',
<add> dest='bottom_k_embedding_count',
<add> default=0,
<add> help='The number of bottom k embeddings to add to the memory bank.')
<add> parser.add_argument(
<add> '--num_shards',
<add> dest='num_shards',
<add> default=0,
<add> help='Number of output shards.')
<add> beam_args, pipeline_args = parser.parse_known_args(argv)
<add> return beam_args, pipeline_args
<add>
<add>
<add>def main(argv=None, save_main_session=True):
<add> """Runs the Beam pipeline that performs inference.
<add>
<add> Args:
<add> argv: Command line arguments.
<add> save_main_session: Whether to save the main session.
<add> """
<add> args, pipeline_args = parse_args(argv)
<add> _load_inference_model(args)
<add>
<add>if __name__ == '__main__':
<add> main()
<add> | 1 |
Javascript | Javascript | fix error when swapping dataset locations | 9326309afd4676f16a123fa5bafe7f1f1f26b5e2 | <ide><path>src/core/core.controller.js
<ide> class Chart {
<ide> });
<ide> }
<ide>
<del> /**
<del> * Updates the given metaset with the given dataset index. Ensures it's stored at that index
<del> * in the _metasets array by swapping with the metaset at that index if necessary.
<del> * @param {Object} meta - the dataset metadata
<del> * @param {number} index - the dataset index
<del> * @private
<del> */
<del> _updateMetasetIndex(meta, index) {
<del> const metasets = this._metasets;
<del> const oldIndex = meta.index;
<del> if (oldIndex !== index) {
<del> metasets[oldIndex] = metasets[index];
<del> metasets[index] = meta;
<del> meta.index = index;
<del> }
<del> }
<del>
<ide> /**
<ide> * @private
<ide> */
<ide> class Chart {
<ide> const numData = me.data.datasets.length;
<ide> const numMeta = metasets.length;
<ide>
<add> metasets.sort((a, b) => a.index - b.index);
<ide> if (numMeta > numData) {
<ide> for (let i = numData; i < numMeta; ++i) {
<ide> me._destroyDatasetMeta(i);
<ide> class Chart {
<ide> meta.type = type;
<ide> meta.indexAxis = dataset.indexAxis || getIndexAxis(type, me.options);
<ide> meta.order = dataset.order || 0;
<del> me._updateMetasetIndex(meta, i);
<add> meta.index = i;
<ide> meta.label = '' + dataset.label;
<ide> meta.visible = me.isDatasetVisible(i);
<ide>
<ide> class Chart {
<ide> let meta = metasets.filter(x => x && x._dataset === dataset).pop();
<ide>
<ide> if (!meta) {
<del> meta = metasets[datasetIndex] = {
<add> meta = {
<ide> type: null,
<ide> data: [],
<ide> dataset: null,
<ide> class Chart {
<ide> _parsed: [],
<ide> _sorted: false
<ide> };
<add> metasets.push(meta);
<ide> }
<ide>
<ide> return meta;
<ide><path>test/specs/core.controller.tests.js
<ide> describe('Chart', function() {
<ide> expect(metasets[2].order).toEqual(4);
<ide> expect(metasets[3].order).toEqual(3);
<ide> });
<add> it('should update properly when dataset locations are swapped', function() {
<add> const orig = this.chart.data.datasets;
<add> this.chart.data.datasets = [orig[0], orig[2], orig[1], orig[3]];
<add> this.chart.update();
<add> let metasets = this.chart._metasets;
<add> expect(metasets[0].label).toEqual('1');
<add> expect(metasets[1].label).toEqual('3');
<add> expect(metasets[2].label).toEqual('2');
<add> expect(metasets[3].label).toEqual('4');
<add>
<add> this.chart.data.datasets = [{label: 'new', order: 10}, orig[3], orig[2], orig[1], orig[0]];
<add> this.chart.update();
<add> metasets = this.chart._metasets;
<add> expect(metasets[0].label).toEqual('new');
<add> expect(metasets[1].label).toEqual('4');
<add> expect(metasets[2].label).toEqual('3');
<add> expect(metasets[3].label).toEqual('2');
<add> expect(metasets[4].label).toEqual('1');
<add>
<add> this.chart.data.datasets = [orig[3], orig[2], orig[1], {label: 'new', order: 10}];
<add> this.chart.update();
<add> metasets = this.chart._metasets;
<add> expect(metasets[0].label).toEqual('4');
<add> expect(metasets[1].label).toEqual('3');
<add> expect(metasets[2].label).toEqual('2');
<add> expect(metasets[3].label).toEqual('new');
<add> });
<ide> });
<ide>
<ide> describe('data visibility', function() { | 2 |
Text | Text | correct wrong bracket | f6b7958094c389bab26f5fe9b13fea154c18187f | <ide><path>guide/english/cplusplus/vector/index.md
<ide> int main()
<ide> sort(v.begin(), v.end(), [] (int i, int j) -> bool {
<ide> return i < j;
<ide> } );
<add>
<ide> cout << "Vector Contents Sorted In Ascending Order:\n";
<del> for (int e : v)
<del> cout << e << " ";
<del> return 0;
<add> for (int e : v){
<add> cout << e << " ";
<add> }
<add>
<add> return 0;
<ide> }
<ide> ```
<ide> ### Sorting Vector In Descending Order
<ide> int main(){
<ide> vector<int> v{ 10, 5, 82, 69, 64, 70, 3, 42, 28, 0 };
<ide> sort(v.begin(), v.end(), greater<int>());
<ide>
<del> cout << "Vector Contents Sorted In Ascending Order:\n";
<add> cout << "Vector Contents Sorted In Descending Order:\n";
<ide> for(int e : v){
<del> cout << e << " ";
<add> cout << e << " ";
<ide> }
<ide>
<ide> return 0; | 1 |
Javascript | Javascript | fix vrcontrols onerror | 1e99bc45784a60784b396f0e86681505594d18f1 | <ide><path>examples/js/controls/VRControls.js
<ide> THREE.VRControls = function ( object, onError ) {
<ide>
<ide> }
<ide>
<del> if ( onError ) onError( 'HMD not available' );
<add> if ( vrInputs.length === 0 ) {
<add>
<add> if ( onError ) onError( 'PositionSensorVRDevice not available' );
<add>
<add> }
<ide>
<ide> }
<ide> | 1 |
Javascript | Javascript | replace .then chains with await | 24f045dae2401033f16ff882a103123c63ab575b | <ide><path>test/common/debugger.js
<ide> function startCLI(args, flags = [], spawnOpts = {}) {
<ide> },
<ide>
<ide> async waitForInitialBreak() {
<del> return this.waitFor(/break (?:on start )?in/i)
<del> .then(async () => {
<del> if (isPreBreak(this.output)) {
<del> return this.command('next', false)
<del> .then(() => this.waitFor(/break in/));
<del> }
<del> });
<add> await this.waitFor(/break (?:on start )?in/i);
<add>
<add> if (isPreBreak(this.output)) {
<add> await this.command('next', false);
<add> return this.waitFor(/break in/);
<add> }
<ide> },
<ide>
<ide> get breakInfo() { | 1 |
PHP | PHP | update dirty method for get/set | 3d9e8734e728d5accc84c6e93a4227092ea374ac | <ide><path>src/ORM/Association/BelongsToMany.php
<ide> protected function _saveLinks(EntityInterface $sourceEntity, $targetEntities, $o
<ide> }
<ide>
<ide> $e->set($jointProperty, $joint);
<del> $e->dirty($jointProperty, false);
<add> $e->setDirty($jointProperty, false);
<ide> }
<ide>
<ide> return true;
<ide> function () use ($sourceEntity, $targetEntities, $options) {
<ide> }
<ide>
<ide> $sourceEntity->set($property, array_values($existing));
<del> $sourceEntity->dirty($property, false);
<add> $sourceEntity->setDirty($property, false);
<ide>
<ide> return true;
<ide> }
<ide> function () use ($sourceEntity, $targetEntities, $primaryValue, $options) {
<ide>
<ide> ksort($targetEntities);
<ide> $sourceEntity->set($property, array_values($targetEntities));
<del> $sourceEntity->dirty($property, false);
<add> $sourceEntity->setDirty($property, false);
<ide>
<ide> return true;
<ide> }
<ide><path>src/ORM/Association/HasMany.php
<ide> public function link(EntityInterface $sourceEntity, array $targetEntities, array
<ide>
<ide> if ($ok) {
<ide> $sourceEntity->set($property, $savedEntity->get($property));
<del> $sourceEntity->dirty($property, false);
<add> $sourceEntity->setDirty($property, false);
<ide> }
<ide>
<ide> return $ok;
<ide> function ($assoc) use ($targetEntities) {
<ide> );
<ide> }
<ide>
<del> $sourceEntity->dirty($property, false);
<add> $sourceEntity->setDirty($property, false);
<ide> }
<ide>
<ide> /**
<ide><path>src/ORM/AssociationCollection.php
<ide> protected function _saveAssociations($table, $entity, $associations, $options, $
<ide> */
<ide> protected function _save($association, $entity, $nested, $options)
<ide> {
<del> if (!$entity->dirty($association->getProperty())) {
<add> if (!$entity->isDirty($association->getProperty())) {
<ide> return true;
<ide> }
<ide> if (!empty($nested)) {
<ide><path>src/ORM/Behavior/CounterCacheBehavior.php
<ide> public function beforeSave(Event $event, EntityInterface $entity, $options)
<ide> if (!is_callable($config) &&
<ide> isset($config['ignoreDirty']) &&
<ide> $config['ignoreDirty'] === true &&
<del> $entity->$entityAlias->dirty($field)
<add> $entity->$entityAlias->isDirty($field)
<ide> ) {
<ide> $this->_ignoreDirty[$registryAlias][$field] = true;
<ide> }
<ide><path>src/ORM/Behavior/TimestampBehavior.php
<ide> public function touch(EntityInterface $entity, $eventName = 'Model.beforeSave')
<ide> foreach ($events[$eventName] as $field => $when) {
<ide> if (in_array($when, ['always', 'existing'])) {
<ide> $return = true;
<del> $entity->dirty($field, false);
<add> $entity->setDirty($field, false);
<ide> $this->_updateField($entity, $field, $refresh);
<ide> }
<ide> }
<ide> public function touch(EntityInterface $entity, $eventName = 'Model.beforeSave')
<ide> */
<ide> protected function _updateField($entity, $field, $refreshTimestamp)
<ide> {
<del> if ($entity->dirty($field)) {
<add> if ($entity->isDirty($field)) {
<ide> return;
<ide> }
<ide> $entity->set($field, $this->timestamp(null, $refreshTimestamp));
<ide><path>src/ORM/Behavior/TranslateBehavior.php
<ide> public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
<ide> // entity persists.
<ide> if ($noFields && $bundled && !$key) {
<ide> foreach ($this->_config['fields'] as $field) {
<del> $entity->dirty($field, true);
<add> $entity->setDirty($field, true);
<ide> }
<ide>
<ide> return;
<ide> public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
<ide>
<ide> $entity->set('_i18n', array_merge($bundled, array_values($modified + $new)));
<ide> $entity->set('_locale', $locale, ['setter' => false]);
<del> $entity->dirty('_locale', false);
<add> $entity->setDirty('_locale', false);
<ide>
<ide> foreach ($fields as $field) {
<del> $entity->dirty($field, false);
<add> $entity->setDirty($field, false);
<ide> }
<ide> }
<ide>
<ide> protected function _bundleTranslatedFields($entity)
<ide> {
<ide> $translations = (array)$entity->get('_translations');
<ide>
<del> if (empty($translations) && !$entity->dirty('_translations')) {
<add> if (empty($translations) && !$entity->isDirty('_translations')) {
<ide> return;
<ide> }
<ide>
<ide> protected function _bundleTranslatedFields($entity)
<ide>
<ide> foreach ($translations as $lang => $translation) {
<ide> foreach ($fields as $field) {
<del> if (!$translation->dirty($field)) {
<add> if (!$translation->isDirty($field)) {
<ide> continue;
<ide> }
<ide> $find[] = ['locale' => $lang, 'field' => $field, 'foreign_key' => $key];
<ide><path>src/ORM/Behavior/TreeBehavior.php
<ide> public function beforeSave(Event $event, EntityInterface $entity)
<ide> $config = $this->getConfig();
<ide> $parent = $entity->get($config['parent']);
<ide> $primaryKey = $this->_getPrimaryKey();
<del> $dirty = $entity->dirty($config['parent']);
<add> $dirty = $entity->isDirty($config['parent']);
<ide> $level = $config['level'];
<ide>
<ide> if ($parent && $entity->get($primaryKey) == $parent) {
<ide> protected function _removeFromTree($node)
<ide> $this->_table->updateAll($node->extract($fields), [$primary => $node->get($primary)]);
<ide>
<ide> foreach ($fields as $field) {
<del> $node->dirty($field, false);
<add> $node->setDirty($field, false);
<ide> }
<ide>
<ide> return $node;
<ide> protected function _moveUp($node, $number)
<ide> $node->set($left, $targetLeft);
<ide> $node->set($right, $targetLeft + ($nodeRight - $nodeLeft));
<ide>
<del> $node->dirty($left, false);
<del> $node->dirty($right, false);
<add> $node->setDirty($left, false);
<add> $node->setDirty($right, false);
<ide>
<ide> return $node;
<ide> }
<ide> protected function _moveDown($node, $number)
<ide> $node->set($left, $targetRight - ($nodeRight - $nodeLeft));
<ide> $node->set($right, $targetRight);
<ide>
<del> $node->dirty($left, false);
<del> $node->dirty($right, false);
<add> $node->setDirty($left, false);
<add> $node->setDirty($right, false);
<ide>
<ide> return $node;
<ide> }
<ide> protected function _ensureFields($entity)
<ide> $entity->set($fresh->extract($fields), ['guard' => false]);
<ide>
<ide> foreach ($fields as $field) {
<del> $entity->dirty($field, false);
<add> $entity->setDirty($field, false);
<ide> }
<ide> }
<ide>
<ide><path>src/ORM/LazyEagerLoader.php
<ide> protected function _injectResults($objects, $results, $associations, $source)
<ide> foreach ($associations as $assoc) {
<ide> $property = $properties[$assoc];
<ide> $object->set($property, $loaded->get($property), ['useSetters' => false]);
<del> $object->dirty($property, false);
<add> $object->setDirty($property, false);
<ide> }
<ide> $injected[$k] = $object;
<ide> }
<ide><path>src/ORM/Marshaller.php
<ide> public function merge(EntityInterface $entity, array $data, array $options = [])
<ide>
<ide> foreach ($properties as $field => $value) {
<ide> if ($value instanceof EntityInterface) {
<del> $entity->dirty($field, $value->dirty());
<add> $entity->setDirty($field, $value->isDirty());
<ide> }
<ide> }
<ide>
<ide> public function merge(EntityInterface $entity, array $data, array $options = [])
<ide> if (array_key_exists($field, $properties)) {
<ide> $entity->set($field, $properties[$field]);
<ide> if ($properties[$field] instanceof EntityInterface) {
<del> $entity->dirty($field, $properties[$field]->dirty());
<add> $entity->isDirty($field, $properties[$field]->isDirty());
<ide> }
<ide> }
<ide> }
<ide><path>src/ORM/Table.php
<ide> public function save(EntityInterface $entity, $options = [])
<ide> return false;
<ide> }
<ide>
<del> if ($entity->isNew() === false && !$entity->dirty()) {
<add> if ($entity->isNew() === false && !$entity->isDirty()) {
<ide> return $entity;
<ide> }
<ide>
<ide><path>tests/TestCase/ORM/Association/BelongsToManyTest.php
<ide> public function testReplaceLinksUpdateToEmptySet()
<ide>
<ide> $assoc->replaceLinks($entity, []);
<ide> $this->assertSame([], $entity->tags, 'Property should be empty');
<del> $this->assertFalse($entity->dirty('tags'), 'Property should be cleaned');
<add> $this->assertFalse($entity->isDirty('tags'), 'Property should be cleaned');
<ide>
<ide> $new = $articles->get(1, ['contain' => 'Tags']);
<ide> $this->assertSame([], $entity->tags, 'Should not be data in db');
<ide> public function testReplaceLinkSuccess()
<ide> $result = $assoc->replaceLinks($entity, $tagData, ['associated' => false]);
<ide> $this->assertTrue($result);
<ide> $this->assertSame($tagData, $entity->tags, 'Tags should match replaced objects');
<del> $this->assertFalse($entity->dirty('tags'), 'Should be clean');
<add> $this->assertFalse($entity->isDirty('tags'), 'Should be clean');
<ide>
<ide> $fresh = $articles->get(1, ['contain' => 'Tags']);
<ide> $this->assertCount(3, $fresh->tags, 'Records should be in db');
<ide> public function testReplaceLinkWithConditions()
<ide> $result = $assoc->replaceLinks($entity, [], ['associated' => false]);
<ide> $this->assertTrue($result);
<ide> $this->assertSame([], $entity->tags, 'Tags should match replaced objects');
<del> $this->assertFalse($entity->dirty('tags'), 'Should be clean');
<add> $this->assertFalse($entity->isDirty('tags'), 'Should be clean');
<ide>
<ide> $fresh = $articles->get(1, ['contain' => 'Tags']);
<ide> $this->assertCount(0, $fresh->tags, 'Association should be empty');
<ide><path>tests/TestCase/ORM/Behavior/Translate/TranslateTraitTest.php
<ide> public function testTranslationCreate()
<ide> $entity->translation('eng')->set('title', 'My Title');
<ide> $this->assertEquals('My Title', $entity->translation('eng')->get('title'));
<ide>
<del> $this->assertTrue($entity->dirty('_translations'));
<add> $this->assertTrue($entity->isDirty('_translations'));
<ide>
<ide> $entity->translation('spa')->set('body', 'Contenido');
<ide> $this->assertEquals('My Title', $entity->translation('eng')->get('title'));
<ide> public function testTranslationDirty()
<ide> ]);
<ide> $entity->clean();
<ide> $this->assertEquals('My Title', $entity->translation('eng')->get('title'));
<del> $this->assertTrue($entity->dirty('_translations'));
<add> $this->assertTrue($entity->isDirty('_translations'));
<ide> }
<ide> }
<ide><path>tests/TestCase/ORM/EntityTest.php
<ide> public function testUnset()
<ide> public function testUnsetMakesClean()
<ide> {
<ide> $entity = new Entity(['id' => 1, 'name' => 'bar']);
<del> $this->assertTrue($entity->dirty('name'));
<add> $this->assertTrue($entity->isDirty('name'));
<ide> $entity->unsetProperty('name');
<del> $this->assertFalse($entity->dirty('name'), 'Removed properties are not dirty.');
<add> $this->assertFalse($entity->isDirty('name'), 'Removed properties are not dirty.');
<ide> }
<ide>
<ide> /**
<ide> public function testClean()
<ide> 'title' => 'Foo',
<ide> 'author_id' => 3
<ide> ]);
<del> $this->assertTrue($entity->dirty('id'));
<del> $this->assertTrue($entity->dirty('title'));
<del> $this->assertTrue($entity->dirty('author_id'));
<add> $this->assertTrue($entity->isDirty('id'));
<add> $this->assertTrue($entity->isDirty('title'));
<add> $this->assertTrue($entity->isDirty('author_id'));
<ide>
<ide> $entity->clean();
<del> $this->assertFalse($entity->dirty('id'));
<del> $this->assertFalse($entity->dirty('title'));
<del> $this->assertFalse($entity->dirty('author_id'));
<add> $this->assertFalse($entity->isDirty('id'));
<add> $this->assertFalse($entity->isDirty('title'));
<add> $this->assertFalse($entity->isDirty('author_id'));
<ide> }
<ide>
<ide> /**
<ide> public function testDebugInfo()
<ide> $entity->accessible('id', false);
<ide> $entity->accessible('name', true);
<ide> $entity->virtualProperties(['baz']);
<del> $entity->dirty('foo', true);
<add> $entity->setDirty('foo', true);
<ide> $entity->errors('foo', ['An error']);
<ide> $entity->invalid('foo', 'a value');
<ide> $entity->source('foos');
<ide><path>tests/TestCase/ORM/MarshallerTest.php
<ide> public function testOneSimple()
<ide>
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result);
<ide> $this->assertEquals($data, $result->toArray());
<del> $this->assertTrue($result->dirty(), 'Should be a dirty entity.');
<add> $this->assertTrue($result->isDirty(), 'Should be a dirty entity.');
<ide> $this->assertTrue($result->isNew(), 'Should be new');
<ide> $this->assertEquals('Articles', $result->source());
<ide> }
<ide> public function testOneEmptyStringPrimaryKey()
<ide> $marshall = new Marshaller($this->articles);
<ide> $result = $marshall->one($data, []);
<ide>
<del> $this->assertFalse($result->dirty('id'));
<add> $this->assertFalse($result->isDirty('id'));
<ide> $this->assertNull($result->id);
<ide> }
<ide>
<ide> public function testOneWithAdditionalName()
<ide> $result = $marshall->one($data, ['associated' => ['Users']]);
<ide>
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result);
<del> $this->assertTrue($result->dirty(), 'Should be a dirty entity.');
<add> $this->assertTrue($result->isDirty(), 'Should be a dirty entity.');
<ide> $this->assertTrue($result->isNew(), 'Should be new');
<ide> $this->assertFalse($result->has('Articles'), 'No prefixed field.');
<ide> $this->assertEquals($data['title'], $result->title, 'Data from prefix should be merged.');
<ide> public function testOneAssociationsSingle()
<ide>
<ide> $this->assertInternalType('array', $result->comments);
<ide> $this->assertEquals($data['comments'], $result->comments);
<del> $this->assertTrue($result->dirty('comments'));
<add> $this->assertTrue($result->isDirty('comments'));
<ide>
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->user);
<del> $this->assertTrue($result->dirty('user'));
<add> $this->assertTrue($result->isDirty('user'));
<ide> $this->assertEquals($data['user']['username'], $result->user->username);
<ide> $this->assertEquals($data['user']['password'], $result->user->password);
<ide> }
<ide> public function testOneBelongsToManyWithNestedAssociations()
<ide>
<ide> $this->assertNotEmpty($tag->articles);
<ide> $this->assertCount(1, $tag->articles);
<del> $this->assertTrue($tag->dirty('articles'), 'Updated prop should be dirty');
<add> $this->assertTrue($tag->isDirty('articles'), 'Updated prop should be dirty');
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $tag->articles[0]);
<ide> $this->assertSame('New tagged article', $tag->articles[0]->title);
<ide> $this->assertFalse($tag->articles[0]->isNew());
<ide>
<ide> $this->assertNotEmpty($tag->articles[0]->user);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $tag->articles[0]->user);
<del> $this->assertTrue($tag->articles[0]->dirty('user'), 'Updated prop should be dirty');
<add> $this->assertTrue($tag->articles[0]->isDirty('user'), 'Updated prop should be dirty');
<ide> $this->assertSame('newuser', $tag->articles[0]->user->username);
<ide> $this->assertTrue($tag->articles[0]->user->isNew());
<ide>
<ide> $this->assertNotEmpty($tag->articles[0]->comments);
<ide> $this->assertCount(2, $tag->articles[0]->comments);
<del> $this->assertTrue($tag->articles[0]->dirty('comments'), 'Updated prop should be dirty');
<add> $this->assertTrue($tag->articles[0]->isDirty('comments'), 'Updated prop should be dirty');
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $tag->articles[0]->comments[0]);
<ide> $this->assertTrue($tag->articles[0]->comments[0]->isNew());
<ide> $this->assertTrue($tag->articles[0]->comments[1]->isNew());
<ide> public function testBelongsToManyAddingNewExisting()
<ide> $this->assertEquals($data['tags'][1]['id'], $result->tags[1]->id);
<ide> $this->assertNotEmpty($result->tags[0]->_joinData);
<ide> $this->assertNotEmpty($result->tags[1]->_joinData);
<del> $this->assertTrue($result->dirty('tags'), 'Modified prop should be dirty');
<add> $this->assertTrue($result->isDirty('tags'), 'Modified prop should be dirty');
<ide> $this->assertEquals(0, $result->tags[0]->_joinData->active);
<ide> $this->assertEquals(1, $result->tags[1]->_joinData->active);
<ide> }
<ide> public function testMergeSimple()
<ide>
<ide> $this->assertSame($entity, $result);
<ide> $this->assertEquals($data + ['body' => 'My Content'], $result->toArray());
<del> $this->assertTrue($result->dirty(), 'Should be a dirty entity.');
<add> $this->assertTrue($result->isDirty(), 'Should be a dirty entity.');
<ide> $this->assertFalse($result->isNew(), 'Should not change the entity state');
<ide> }
<ide>
<ide> public function testMergeFalseyValues($value)
<ide> $entity->clean();
<ide>
<ide> $entity = $marshall->merge($entity, ['author_id' => $value]);
<del> $this->assertTrue($entity->dirty('author_id'), 'Field should be dirty');
<add> $this->assertTrue($entity->isDirty('author_id'), 'Field should be dirty');
<ide> $this->assertSame(0, $entity->get('author_id'), 'Value should be zero');
<ide> }
<ide>
<ide> public function testMergeUnchangedNullValue()
<ide> $entity->clean();
<ide> $result = $marshall->merge($entity, $data, []);
<ide>
<del> $this->assertFalse($entity->dirty('body'), 'unchanged null should not be dirty');
<add> $this->assertFalse($entity->isDirty('body'), 'unchanged null should not be dirty');
<ide> }
<ide>
<ide> /**
<ide> public function testMergeWithSingleAssociationAndFields($fields)
<ide> 'associated' => ['Users' => []]
<ide> ]);
<ide> $this->assertSame($user, $article->user);
<del> $this->assertTrue($article->dirty('user'));
<add> $this->assertTrue($article->isDirty('user'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeDirty()
<ide> 'crazy' => true
<ide> ];
<ide> $this->assertEquals($expected, $result->toArray());
<del> $this->assertFalse($entity->dirty('title'));
<del> $this->assertFalse($entity->dirty('author_id'));
<del> $this->assertTrue($entity->dirty('crazy'));
<add> $this->assertFalse($entity->isDirty('title'));
<add> $this->assertFalse($entity->isDirty('author_id'));
<add> $this->assertTrue($entity->isDirty('crazy'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeWithSingleAssociation()
<ide> $marshall = new Marshaller($this->articles);
<ide> $marshall->merge($entity, $data, ['associated' => ['Users']]);
<ide>
<del> $this->assertTrue($entity->dirty('user'), 'association should be dirty');
<del> $this->assertTrue($entity->dirty('body'), 'body should be dirty');
<add> $this->assertTrue($entity->isDirty('user'), 'association should be dirty');
<add> $this->assertTrue($entity->isDirty('body'), 'body should be dirty');
<ide> $this->assertEquals('My Content', $entity->body);
<ide> $this->assertSame($user, $entity->user);
<ide> $this->assertEquals('mark', $entity->user->username);
<ide> public function testMergeCreateAssociation()
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $entity->user);
<ide> $this->assertEquals('mark', $entity->user->username);
<ide> $this->assertEquals('not a secret', $entity->user->password);
<del> $this->assertTrue($entity->dirty('user'));
<del> $this->assertTrue($entity->dirty('body'));
<add> $this->assertTrue($entity->isDirty('user'));
<add> $this->assertTrue($entity->isDirty('body'));
<ide> $this->assertTrue($entity->user->isNew());
<ide> }
<ide>
<ide> public function testMergeAssociationNullOut()
<ide> ]);
<ide> $this->assertNull($article->user);
<ide> $this->assertSame('', $article->user_id);
<del> $this->assertTrue($article->dirty('user'));
<add> $this->assertTrue($article->isDirty('user'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeMultipleAssociations()
<ide> $result = $marshall->merge($entity, $data, ['associated' => ['Users', 'Comments']]);
<ide> $this->assertSame($entity, $result);
<ide> $this->assertSame($user, $result->user);
<del> $this->assertTrue($result->dirty('user'), 'association should be dirty');
<add> $this->assertTrue($result->isDirty('user'), 'association should be dirty');
<ide> $this->assertEquals('not so secret', $entity->user->password);
<ide>
<del> $this->assertTrue($result->dirty('comments'));
<add> $this->assertTrue($result->isDirty('comments'));
<ide> $this->assertSame($comment1, $entity->comments[0]);
<ide> $this->assertSame($comment2, $entity->comments[1]);
<ide> $this->assertEquals('Altered comment 1', $entity->comments[0]->comment);
<ide> public function testMergeBelongsToManyEntitiesFromIds()
<ide> $result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
<ide>
<ide> $this->assertCount(3, $result->tags);
<del> $this->assertTrue($result->dirty('tags'), 'Updated prop should be dirty');
<add> $this->assertTrue($result->isDirty('tags'), 'Updated prop should be dirty');
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[1]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[2]);
<ide> public function testMergeFromIdsWithAutoAssociation()
<ide> $result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
<ide>
<ide> $this->assertCount(3, $result->tags);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeBelongsToManyFromIdsWithConditions()
<ide> $result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
<ide>
<ide> $this->assertCount(3, $result->tags);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[1]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[2]);
<ide> public function testMergeBelongsToManyEntitiesFromIdsEmptyValue()
<ide> ];
<ide> $result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
<ide> $this->assertCount(0, $result->tags);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeBelongsToManyOnlyIdsRejectArray()
<ide> 'associated' => ['Tags' => ['onlyIds' => true]]
<ide> ]);
<ide> $this->assertCount(0, $result->tags);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeBelongsToManyOnlyIdsWithIds()
<ide> ]);
<ide> $this->assertCount(1, $result->tags);
<ide> $this->assertEquals('tag3', $result->tags[0]->name);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeBelongsToManyJoinDataScalar()
<ide> $result = $marshall->merge($entity, $data, ['associated' => 'Tags._joinData']);
<ide>
<ide> $articles->save($entity, ['associated' => ['Tags._joinData']]);
<del> $this->assertFalse($entity->tags[0]->dirty('_joinData'));
<add> $this->assertFalse($entity->tags[0]->isDirty('_joinData'));
<ide> $this->assertEmpty($entity->tags[0]->_joinData);
<ide> }
<ide>
<ide> public function testMergeBelongsToManyJoinDataNotAccessible()
<ide> $marshall = new Marshaller($articles);
<ide> $result = $marshall->merge($entity, $data, ['associated' => 'Tags._joinData']);
<ide>
<del> $this->assertTrue($entity->dirty('tags'), 'Association data changed');
<del> $this->assertTrue($entity->tags[0]->dirty('_joinData'));
<del> $this->assertTrue($result->tags[0]->_joinData->dirty('author_id'), 'Field not modified');
<del> $this->assertTrue($result->tags[0]->_joinData->dirty('highlighted'), 'Field not modified');
<add> $this->assertTrue($entity->isDirty('tags'), 'Association data changed');
<add> $this->assertTrue($entity->tags[0]->isDirty('_joinData'));
<add> $this->assertTrue($result->tags[0]->_joinData->isDirty('author_id'), 'Field not modified');
<add> $this->assertTrue($result->tags[0]->_joinData->isDirty('highlighted'), 'Field not modified');
<ide> $this->assertSame(99, $result->tags[0]->_joinData->author_id);
<ide> $this->assertTrue($result->tags[0]->_joinData->highlighted);
<ide> }
<ide> public function testMergeBelongsToManyHandleJoinDataConsistently()
<ide> $marshall = new Marshaller($articles);
<ide> $result = $marshall->merge($entity, $data, ['associated' => 'Tags']);
<ide>
<del> $this->assertTrue($entity->dirty('tags'));
<add> $this->assertTrue($entity->isDirty('tags'));
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]->_joinData);
<ide> $this->assertTrue($result->tags[0]->_joinData->highlighted);
<ide>
<ide> public function testMergeBelongsToManyHandleJoinDataConsistently()
<ide> $marshall = new Marshaller($articles);
<ide> $result = $marshall->merge($entity, $data, ['associated' => 'Tags']);
<ide>
<del> $this->assertTrue($entity->dirty('tags'), 'association data changed');
<add> $this->assertTrue($entity->isDirty('tags'), 'association data changed');
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]->_joinData);
<ide> $this->assertTrue($result->tags[0]->_joinData->highlighted);
<ide> }
<ide> public function testMergeBelongsToManyJoinDataAssociatedWithIds()
<ide> $article = $this->articles->get(1, ['associated' => 'Tags']);
<ide> $result = $marshall->merge($article, $data, ['associated' => ['Tags._joinData.Users']]);
<ide>
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[1]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]->_joinData->user);
<ide> public function testMergeBelongsToManyJoinData()
<ide>
<ide> $this->assertEquals($data['title'], $result->title);
<ide> $this->assertEquals('My content', $result->body);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> $this->assertSame($tag1, $entity->tags[0]);
<ide> $this->assertSame($tag1->_joinData, $entity->tags[0]->_joinData);
<ide> $this->assertSame(
<ide> public function testMergeBelongsToManyJoinData()
<ide> $entity->tags[1]->_joinData->toArray()
<ide> );
<ide> $this->assertEquals('new tag', $entity->tags[1]->tag);
<del> $this->assertTrue($entity->tags[0]->dirty('_joinData'));
<del> $this->assertTrue($entity->tags[1]->dirty('_joinData'));
<add> $this->assertTrue($entity->tags[0]->isDirty('_joinData'));
<add> $this->assertTrue($entity->tags[1]->isDirty('_joinData'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeJoinDataAssociations()
<ide>
<ide> $this->assertEquals($data['title'], $result->title);
<ide> $this->assertEquals('My content', $result->body);
<del> $this->assertTrue($entity->dirty('tags'));
<add> $this->assertTrue($entity->isDirty('tags'));
<ide> $this->assertSame($tag1, $entity->tags[0]);
<ide>
<del> $this->assertTrue($tag1->dirty('_joinData'));
<add> $this->assertTrue($tag1->isDirty('_joinData'));
<ide> $this->assertSame($tag1->_joinData, $entity->tags[0]->_joinData);
<ide> $this->assertEquals('Bill', $entity->tags[0]->_joinData->user->username);
<ide> $this->assertEquals('secret', $entity->tags[0]->_joinData->user->password);
<ide> public function testMergeBelongsToManyIdsRetainJoinData()
<ide> $result = $marshall->merge($entity, $data, ['associated' => ['Tags']]);
<ide>
<ide> $this->assertCount(1, $result->tags);
<del> $this->assertTrue($result->dirty('tags'));
<add> $this->assertTrue($result->isDirty('tags'));
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]);
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $result->tags[0]->_joinData);
<ide> $this->assertSame($original, $result->tags[0]->_joinData, 'Should be same object');
<ide> public function testMergeManySimple()
<ide> $this->assertEquals('Changed 1', $result[0]->comment);
<ide> $this->assertEquals(1, $result[0]->user_id);
<ide> $this->assertEquals('Changed 2', $result[1]->comment);
<del> $this->assertTrue($result[0]->dirty('user_id'));
<del> $this->assertFalse($result[1]->dirty('user_id'));
<add> $this->assertTrue($result[0]->isDirty('user_id'));
<add> $this->assertFalse($result[1]->isDirty('user_id'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeAssociationWithfields($fields)
<ide> $this->assertEquals('mark', $entity->user->username);
<ide> $this->assertEquals('secret', $entity->user->password);
<ide> $this->assertEquals('data', $entity->user->extra);
<del> $this->assertTrue($entity->dirty('user'));
<add> $this->assertTrue($entity->isDirty('user'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeJoinDataWithFields($fields)
<ide> $entity->tags[1]->_joinData->toArray()
<ide> );
<ide> $this->assertEquals('new tag', $entity->tags[1]->tag);
<del> $this->assertTrue($entity->tags[0]->dirty('_joinData'));
<del> $this->assertTrue($entity->tags[1]->dirty('_joinData'));
<add> $this->assertTrue($entity->tags[0]->isDirty('_joinData'));
<add> $this->assertTrue($entity->tags[1]->isDirty('_joinData'));
<ide> }
<ide>
<ide> /**
<ide> public function testMergeWithTranslations()
<ide>
<ide> $this->assertSame($entity, $result);
<ide> $this->assertEmpty($result->errors());
<del> $this->assertTrue($result->dirty('_translations'));
<add> $this->assertTrue($result->isDirty('_translations'));
<ide>
<ide> $translations = $result->get('_translations');
<ide> $this->assertCount(2, $translations);
<ide> public function testAssociationNoChanges()
<ide> $this->assertInstanceOf('Cake\ORM\Entity', $entity->user);
<ide> $this->assertEquals('mark', $entity->user->username);
<ide> $this->assertEquals('not a secret', $entity->user->password);
<del> $this->assertFalse($entity->dirty('user'));
<add> $this->assertFalse($entity->isDirty('user'));
<ide> $this->assertTrue($entity->user->isNew());
<ide> }
<ide>
<ide> public function testEnsurePrimaryKeyBeingReadFromTableForHandlingEmptyStringPrim
<ide> $marshall = new Marshaller($articles);
<ide> $result = $marshall->one($data);
<ide>
<del> $this->assertFalse($result->dirty('id'));
<add> $this->assertFalse($result->isDirty('id'));
<ide> $this->assertNull($result->id);
<ide> }
<ide>
<ide><path>tests/TestCase/ORM/RulesCheckerIntegrationTest.php
<ide> function (Entity $entity) {
<ide> $this->assertTrue($entity->article->isNew());
<ide> $this->assertNull($entity->article->id);
<ide> $this->assertNull($entity->article->get('author_id'));
<del> $this->assertFalse($entity->article->dirty('author_id'));
<add> $this->assertFalse($entity->article->isDirty('author_id'));
<ide> $this->assertNotEmpty($entity->article->errors('title'));
<ide> $this->assertSame('A Title', $entity->article->invalid('title'));
<ide> }
<ide> public function testIsUniqueDomainRule()
<ide> $this->assertSame($entity, $table->save($entity));
<ide>
<ide> $entity = $table->get(1);
<del> $entity->dirty('name', true);
<add> $entity->setDirty('name', true);
<ide> $this->assertSame($entity, $table->save($entity));
<ide> }
<ide>
<ide> public function testIsUniqueAllowMultipleNulls()
<ide> $this->assertSame($entity, $table->save($entity));
<ide>
<ide> $entity = $table->get(1);
<del> $entity->dirty('author_id', true);
<add> $entity->setDirty('author_id', true);
<ide> $this->assertSame($entity, $table->save($entity));
<ide> }
<ide>
<ide> public function testExistsInWithCleanFields()
<ide> $entity = $table->get(1);
<ide> $entity->title = 'Foo';
<ide> $entity->author_id = 1000;
<del> $entity->dirty('author_id', false);
<add> $entity->setDirty('author_id', false);
<ide> $this->assertSame($entity, $table->save($entity));
<ide> }
<ide>
<ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testFindCleanEntities()
<ide> $results = $table->find('all')->contain(['tags', 'authors'])->toArray();
<ide> $this->assertCount(3, $results);
<ide> foreach ($results as $article) {
<del> $this->assertFalse($article->dirty('id'));
<del> $this->assertFalse($article->dirty('title'));
<del> $this->assertFalse($article->dirty('author_id'));
<del> $this->assertFalse($article->dirty('body'));
<del> $this->assertFalse($article->dirty('published'));
<del> $this->assertFalse($article->dirty('author'));
<del> $this->assertFalse($article->author->dirty('id'));
<del> $this->assertFalse($article->author->dirty('name'));
<del> $this->assertFalse($article->dirty('tag'));
<add> $this->assertFalse($article->isDirty('id'));
<add> $this->assertFalse($article->isDirty('title'));
<add> $this->assertFalse($article->isDirty('author_id'));
<add> $this->assertFalse($article->isDirty('body'));
<add> $this->assertFalse($article->isDirty('published'));
<add> $this->assertFalse($article->isDirty('author'));
<add> $this->assertFalse($article->author->isDirty('id'));
<add> $this->assertFalse($article->author->isDirty('name'));
<add> $this->assertFalse($article->isDirty('tag'));
<ide> if ($article->tag) {
<del> $this->assertFalse($article->tag[0]->_joinData->dirty('tag_id'));
<add> $this->assertFalse($article->tag[0]->_joinData->isDirty('tag_id'));
<ide> }
<ide> }
<ide> }
<ide> public function testSaveReplaceSaveStrategy()
<ide>
<ide> $articleId = $entity->articles[0]->id;
<ide> unset($entity->articles[0]);
<del> $entity->dirty('articles', true);
<add> $entity->setDirty('articles', true);
<ide>
<ide> $authors->save($entity, ['associated' => ['Articles']]);
<ide>
<ide> public function testSaveAppendSaveStrategy()
<ide>
<ide> $articleId = $entity->articles[0]->id;
<ide> unset($entity->articles[0]);
<del> $entity->dirty('articles', true);
<add> $entity->setDirty('articles', true);
<ide>
<ide> $authors->save($entity, ['associated' => ['Articles']]);
<ide>
<ide> public function testSaveReplaceSaveStrategyDependent()
<ide>
<ide> $articleId = $entity->articles[0]->id;
<ide> unset($entity->articles[0]);
<del> $entity->dirty('articles', true);
<add> $entity->setDirty('articles', true);
<ide>
<ide> $authors->save($entity, ['associated' => ['Articles']]);
<ide>
<ide> public function testSaveReplaceSaveStrategyNotNullable()
<ide> $this->assertTrue($articles->Comments->exists(['id' => $commentId]));
<ide>
<ide> unset($article->comments[0]);
<del> $article->dirty('comments', true);
<add> $article->setDirty('comments', true);
<ide> $article = $articles->save($article, ['associated' => ['Comments']]);
<ide>
<ide> $this->assertEquals($sizeComments - 1, $articles->Comments->find('all')->where(['article_id' => $article->id])->count());
<ide> public function testSaveReplaceSaveStrategyAdding()
<ide> 'comment' => 'new comment'
<ide> ]);
<ide>
<del> $article->dirty('comments', true);
<add> $article->setDirty('comments', true);
<ide> $article = $articles->save($article, ['associated' => ['Comments']]);
<ide>
<ide> $this->assertEquals($sizeComments, $articles->Comments->find('all')->where(['article_id' => $article->id])->count());
<ide> public function testHasManyNonCascadingUnlinkDeleteUsesAssociationConditions()
<ide> $this->assertEquals(3, $Comments->target()->find()->where(['Comments.article_id' => $article->get('id')])->count());
<ide>
<ide> unset($article->comments[1]);
<del> $article->dirty('comments', true);
<add> $article->setDirty('comments', true);
<ide>
<ide> $article = $Articles->save($article);
<ide> $this->assertNotEmpty($article);
<ide> public function testHasManyNonDependentNonCascadingUnlinkUpdateUsesAssociationCo
<ide>
<ide> $article2 = $author->articles[1];
<ide> unset($author->articles[1]);
<del> $author->dirty('articles', true);
<add> $author->setDirty('articles', true);
<ide>
<ide> $author = $Authors->save($author);
<ide> $this->assertNotEmpty($author);
<ide> public function testAfterSave()
<ide> $called = false;
<ide> $listener = function ($e, $entity, $options) use ($data, &$called) {
<ide> $this->assertSame($data, $entity);
<del> $this->assertTrue($entity->dirty());
<add> $this->assertTrue($entity->isDirty());
<ide> $called = true;
<ide> };
<ide> $table->eventManager()->on('Model.afterSave', $listener);
<ide>
<ide> $calledAfterCommit = false;
<ide> $listenerAfterCommit = function ($e, $entity, $options) use ($data, &$calledAfterCommit) {
<ide> $this->assertSame($data, $entity);
<del> $this->assertTrue($entity->dirty());
<add> $this->assertTrue($entity->isDirty());
<ide> $this->assertNotSame($data->get('username'), $data->getOriginal('username'));
<ide> $calledAfterCommit = true;
<ide> };
<ide> public function testSaveOnlyDirtyProperties()
<ide> 'updated' => new Time('2013-10-10 00:00')
<ide> ]);
<ide> $entity->clean();
<del> $entity->dirty('username', true);
<del> $entity->dirty('created', true);
<del> $entity->dirty('updated', true);
<add> $entity->setDirty('username', true);
<add> $entity->setDirty('created', true);
<add> $entity->setDirty('updated', true);
<ide>
<ide> $table = TableRegistry::get('users');
<ide> $this->assertSame($entity, $table->save($entity));
<ide> public function testASavedEntityIsClean()
<ide> ]);
<ide> $table = TableRegistry::get('users');
<ide> $this->assertSame($entity, $table->save($entity));
<del> $this->assertFalse($entity->dirty('usermane'));
<del> $this->assertFalse($entity->dirty('password'));
<del> $this->assertFalse($entity->dirty('created'));
<del> $this->assertFalse($entity->dirty('updated'));
<add> $this->assertFalse($entity->isDirty('usermane'));
<add> $this->assertFalse($entity->isDirty('password'));
<add> $this->assertFalse($entity->isDirty('created'));
<add> $this->assertFalse($entity->isDirty('updated'));
<ide> }
<ide>
<ide> /**
<ide> public function testSaveUpdateAuto()
<ide> $this->assertEquals($original->created, $row->created);
<ide> $this->assertEquals($original->updated, $row->updated);
<ide> $this->assertFalse($entity->isNew());
<del> $this->assertFalse($entity->dirty('id'));
<del> $this->assertFalse($entity->dirty('username'));
<add> $this->assertFalse($entity->isDirty('id'));
<add> $this->assertFalse($entity->isDirty('username'));
<ide> }
<ide>
<ide> /**
<ide> public function testSaveHasOne()
<ide> $this->assertFalse($entity->article->isNew());
<ide> $this->assertEquals(4, $entity->article->id);
<ide> $this->assertEquals(5, $entity->article->get('author_id'));
<del> $this->assertFalse($entity->article->dirty('author_id'));
<add> $this->assertFalse($entity->article->isDirty('author_id'));
<ide> }
<ide>
<ide> /**
<ide> public function testSaveBelongsToManyJoinDataOnExistingRecord()
<ide> $entity = $table->find()->contain('Tags')->first();
<ide> // not associated to the article already.
<ide> $entity->tags[] = $tags->get(3);
<del> $entity->dirty('tags', true);
<add> $entity->setDirty('tags', true);
<ide>
<ide> $this->assertSame($entity, $table->save($entity));
<ide>
<ide> public function testLinkHasMany()
<ide>
<ide> $this->assertCount($sizeArticles, $authors->Articles->findAllByAuthorId($author->id));
<ide> $this->assertCount($sizeArticles, $author->articles);
<del> $this->assertFalse($author->dirty('articles'));
<add> $this->assertFalse($author->isDirty('articles'));
<ide> }
<ide>
<ide> /**
<ide> public function testLinkHasManyReplaceSaveStrategy()
<ide>
<ide> $this->assertCount($sizeArticles, $authors->Articles->findAllByAuthorId($author->id));
<ide> $this->assertCount($sizeArticles, $author->articles);
<del> $this->assertFalse($author->dirty('articles'));
<add> $this->assertFalse($author->isDirty('articles'));
<ide> }
<ide>
<ide> /**
<ide> public function testLinkHasManyExisting()
<ide>
<ide> $this->assertCount($sizeArticles, $authors->Articles->findAllByAuthorId($author->id));
<ide> $this->assertCount($sizeArticles, $author->articles);
<del> $this->assertFalse($author->dirty('articles'));
<add> $this->assertFalse($author->isDirty('articles'));
<ide> }
<ide>
<ide> /**
<ide> public function testUnlinkHasManyCleanProperty()
<ide>
<ide> $this->assertCount($sizeArticles - count($articlesToUnlink), $authors->Articles->findAllByAuthorId($author->id));
<ide> $this->assertCount($sizeArticles - count($articlesToUnlink), $author->articles);
<del> $this->assertFalse($author->dirty('articles'));
<add> $this->assertFalse($author->isDirty('articles'));
<ide> }
<ide>
<ide> /**
<ide> public function testUnlinkHasManyNotCleanProperty()
<ide>
<ide> $this->assertCount($sizeArticles - count($articlesToUnlink), $authors->Articles->findAllByAuthorId($author->id));
<ide> $this->assertCount($sizeArticles, $author->articles);
<del> $this->assertFalse($author->dirty('articles'));
<add> $this->assertFalse($author->isDirty('articles'));
<ide> }
<ide>
<ide> /**
<ide> public function testUnlinkBelongsToMany()
<ide> $table->association('tags')->unlink($article, [$article->tags[0]]);
<ide> $this->assertCount(1, $article->tags);
<ide> $this->assertEquals(2, $article->tags[0]->get('id'));
<del> $this->assertFalse($article->dirty('tags'));
<add> $this->assertFalse($article->isDirty('tags'));
<ide> }
<ide>
<ide> /**
<ide> function (Event $event, Entity $entity, ArrayObject $options) use (&$actualOptio
<ide>
<ide> $article = $articles->get(1);
<ide> $article->tags = [];
<del> $article->dirty('tags', true);
<add> $article->setDirty('tags', true);
<ide>
<ide> $result = $articles->save($article, ['foo' => 'bar']);
<ide> $this->assertNotEmpty($result);
<ide> function (Event $event, Entity $entity, ArrayObject $options) use (&$actualOptio
<ide>
<ide> $author = $authors->get(1);
<ide> $author->articles = [];
<del> $author->dirty('articles', true);
<add> $author->setDirty('articles', true);
<ide>
<ide> $result = $authors->save($author, ['foo' => 'bar']);
<ide> $this->assertNotEmpty($result);
<ide> function (Event $event, Entity $entity, ArrayObject $options) use (&$actualOptio
<ide>
<ide> $author = $authors->get(1);
<ide> $author->articles = [];
<del> $author->dirty('articles', true);
<add> $author->setDirty('articles', true);
<ide>
<ide> $result = $articles->link($author, [$articles->target()->get(2)], ['foo' => 'bar']);
<ide> $this->assertTrue($result);
<ide> function (Event $event, Entity $entity, ArrayObject $options) use (&$actualOptio
<ide>
<ide> $author = $authors->get(1);
<ide> $author->articles = [];
<del> $author->dirty('articles', true);
<add> $author->setDirty('articles', true);
<ide>
<ide> $articles->unlink($author, [$articles->target()->get(1)], ['foo' => 'bar']);
<ide>
<ide> function (Event $event, Entity $entity, ArrayObject $options) use (&$actualOptio
<ide>
<ide> $author = $authors->get(1);
<ide> $author->articles = [];
<del> $author->dirty('articles', true);
<add> $author->setDirty('articles', true);
<ide>
<ide> $articles->unlink($author, [$articles->target()->get(1)], false);
<ide> $this->assertArrayHasKey('cleanProperty', $actualOptions);
<ide> public function testSaveHasManyNoWasteSave()
<ide> $userTable->Comments
<ide> ->eventManager()
<ide> ->on('Model.afterSave', function (Event $event, $entity) use (&$counter) {
<del> if ($entity->dirty()) {
<add> if ($entity->isDirty()) {
<ide> $counter++;
<ide> }
<ide> });
<ide>
<ide> $savedUser->comments[] = $userTable->Comments->get(5);
<ide> $this->assertCount(3, $savedUser->comments);
<del> $savedUser->dirty('comments', true);
<add> $savedUser->setDirty('comments', true);
<ide> $userTable->save($savedUser);
<ide> $this->assertEquals(1, $counter);
<ide> }
<ide> public function testSaveBelongsToManyNoWasteSave()
<ide> $table->Tags->junction()
<ide> ->eventManager()
<ide> ->on('Model.afterSave', function (Event $event, $entity) use (&$counter) {
<del> if ($entity->dirty()) {
<add> if ($entity->isDirty()) {
<ide> $counter++;
<ide> }
<ide> });
<ide>
<ide> $article->tags[] = $table->Tags->get(3);
<ide> $this->assertCount(3, $article->tags);
<del> $article->dirty('tags', true);
<add> $article->setDirty('tags', true);
<ide> $table->save($article);
<ide> $this->assertEquals(1, $counter);
<ide> }
<ide> public function testEntityClean()
<ide> $validator = $table->validator()->requirePresence('body');
<ide> $entity = $table->newEntity(['title' => 'mark']);
<ide>
<del> $entity->dirty('title', true);
<add> $entity->setDirty('title', true);
<ide> $entity->invalid('title', 'albert');
<ide>
<ide> $this->assertNotEmpty($entity->errors());
<del> $this->assertTrue($entity->dirty());
<add> $this->assertTrue($entity->isDirty());
<ide> $this->assertEquals(['title' => 'albert'], $entity->invalid());
<ide>
<ide> $entity->title = 'alex';
<ide> public function testEntityClean()
<ide> $entity->clean();
<ide>
<ide> $this->assertEmpty($entity->errors());
<del> $this->assertFalse($entity->dirty());
<add> $this->assertFalse($entity->isDirty());
<ide> $this->assertEquals([], $entity->invalid());
<ide> $this->assertSame($entity->getOriginal('title'), 'alex');
<ide> } | 16 |
Ruby | Ruby | add wxpython as separate formula | edd03fbe69047b84137c8e97d7494e25ecb7a4e2 | <ide><path>Library/Homebrew/blacklist.rb
<ide> def blacklisted? name
<ide> Some build scripts fail to detect it correctly, please check existing
<ide> formulae for solutions.
<ide> EOS
<del> when 'wxpython' then <<-EOS.undent
<del> The Python bindings (import wx) for wxWidgets are installed by:
<del> brew install wxwidgets
<del> EOS
<ide> when 'tex', 'tex-live', 'texlive', 'latex' then <<-EOS.undent
<ide> Installing TeX from source is weird and gross, requires a lot of patches,
<ide> and only builds 32-bit (and thus can't use Homebrew deps on Snow Leopard.) | 1 |
Python | Python | add test for performance exporter | f9491103358b1b7039b0e5836537cb7aa564d093 | <ide><path>research/object_detection/model_lib_tf2_test.py
<ide> from __future__ import division
<ide> from __future__ import print_function
<ide>
<add>import json
<ide> import os
<ide> import tempfile
<ide> import unittest
<ide> import tensorflow.compat.v1 as tf
<ide> import tensorflow.compat.v2 as tf2
<ide>
<add>from object_detection import exporter_lib_v2
<ide> from object_detection import inputs
<ide> from object_detection import model_lib_v2
<del>from object_detection.builders import model_builder
<ide> from object_detection.core import model
<ide> from object_detection.protos import train_pb2
<ide> from object_detection.utils import config_util
<ide> def regularization_losses(self):
<ide> return []
<ide>
<ide>
<add>def fake_model_builder(*_, **__):
<add> return SimpleModel()
<add>
<add>FAKE_BUILDER_MAP = {'build': fake_model_builder}
<add>
<add>
<ide> @unittest.skipIf(tf_version.is_tf1(), 'Skipping TF2.X only test.')
<ide> class ModelCheckpointTest(tf.test.TestCase):
<ide> """Test for model checkpoint related functionality."""
<ide> def test_checkpoint_max_to_keep(self):
<ide> """Test that only the most recent checkpoints are kept."""
<ide>
<ide> strategy = tf2.distribute.OneDeviceStrategy(device='/cpu:0')
<del> with mock.patch.object(
<del> model_builder, 'build', autospec=True) as mock_builder:
<del> with strategy.scope():
<del> mock_builder.return_value = SimpleModel()
<add> with mock.patch.dict(
<add> exporter_lib_v2.INPUT_BUILDER_UTIL_MAP, FAKE_BUILDER_MAP):
<add>
<ide> model_dir = tempfile.mkdtemp(dir=self.get_temp_dir())
<ide> pipeline_config_path = get_pipeline_config_path(MODEL_NAME_FOR_TEST)
<ide> new_pipeline_config_path = os.path.join(model_dir, 'new_pipeline.config')
<ide> def test_restore_map_incompatible_error(self):
<ide> unpad_groundtruth_tensors=True)
<ide>
<ide>
<add>@unittest.skipIf(tf_version.is_tf1(), 'Skipping TF2.X only test.')
<add>class MetricsExportTest(tf.test.TestCase):
<add>
<add> @classmethod
<add> def setUpClass(cls): # pylint:disable=g-missing-super-call
<add> tf.keras.backend.clear_session()
<add>
<add> def test_export_metrics_json_serializable(self):
<add> """Tests that Estimator and input function are constructed correctly."""
<add>
<add> strategy = tf2.distribute.OneDeviceStrategy(device='/cpu:0')
<add>
<add> def export(data, _):
<add> json.dumps(data)
<add>
<add> with mock.patch.dict(
<add> exporter_lib_v2.INPUT_BUILDER_UTIL_MAP, FAKE_BUILDER_MAP):
<add> with strategy.scope():
<add> model_dir = tf.test.get_temp_dir()
<add> new_pipeline_config_path = os.path.join(model_dir,
<add> 'new_pipeline.config')
<add> pipeline_config_path = get_pipeline_config_path(MODEL_NAME_FOR_TEST)
<add> config_util.clear_fine_tune_checkpoint(pipeline_config_path,
<add> new_pipeline_config_path)
<add> train_steps = 2
<add> with strategy.scope():
<add> model_lib_v2.train_loop(
<add> new_pipeline_config_path,
<add> model_dir=model_dir,
<add> train_steps=train_steps,
<add> checkpoint_every_n=100,
<add> performance_summary_exporter=export,
<add> **_get_config_kwarg_overrides())
<add>
<add>
<ide> if __name__ == '__main__':
<ide> tf.test.main()
<ide><path>research/object_detection/model_lib_v2.py
<ide> def _dist_train_step(data_iterator):
<ide> 'steps_per_sec': np.mean(steps_per_sec_list),
<ide> 'steps_per_sec_p50': np.median(steps_per_sec_list),
<ide> 'steps_per_sec_max': max(steps_per_sec_list),
<del> 'last_batch_loss': loss
<add> 'last_batch_loss': float(loss)
<ide> }
<ide> mixed_precision = 'bf16' if kwargs['use_bfloat16'] else 'fp32'
<ide> performance_summary_exporter(metrics, mixed_precision) | 2 |
PHP | PHP | add wildcard support to seejsonstructure | eb8ab1a0e461488fa33cc1747324f053b327957c | <ide><path>src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
<ide> public function seeJsonStructure(array $structure = null, $responseData = null)
<ide> }
<ide>
<ide> foreach ($structure as $key => $value) {
<del> if (is_array($value)) {
<add> if (is_array($value) && $key === '*') {
<add> $this->assertInternalType('array', $responseData);
<add>
<add> foreach ($responseData as $responseDataItem) {
<add> $this->seeJsonStructure($structure['*'], $responseDataItem);
<add> }
<add> } elseif (is_array($value)) {
<ide> $this->assertArrayHasKey($key, $responseData);
<ide> $this->seeJsonStructure($structure[$key], $responseData[$key]);
<ide> } else {
<ide><path>tests/Foundation/FoundationCrawlerTraitJsonTest.php
<add><?php
<add>
<add>use Illuminate\Foundation\Testing\Concerns\MakesHttpRequests;
<add>
<add>class FoundationCrawlerTraitJsonTest extends PHPUnit_Framework_TestCase
<add>{
<add> use MakesHttpRequests;
<add>
<add> public function testSeeJsonStructure()
<add> {
<add> $this->response = new \Illuminate\Http\Response(new JsonSerializableMixedResourcesStub);
<add>
<add> // At root
<add> $this->seeJsonStructure(['foo']);
<add>
<add> // Nested
<add> $this->seeJsonStructure(['foobar' => ['foobar_foo', 'foobar_bar']]);
<add>
<add> // Wildcard (repeating structure)
<add> $this->seeJsonStructure(['bars' => ['*' => ['bar', 'foo']]]);
<add>
<add> // Nested after wildcard
<add> $this->seeJsonStructure(['baz' => ['*' => ['foo', 'bar' => ['foo', 'bar']]]]);
<add>
<add> // Wildcard (repeating structure) at root
<add> $this->response = new \Illuminate\Http\Response(new JsonSerializableSingleResourceStub);
<add> $this->seeJsonStructure(['*' => ['foo', 'bar', 'foobar']]);
<add> }
<add>}
<add>
<add>class JsonSerializableMixedResourcesStub implements JsonSerializable
<add>{
<add> public function jsonSerialize()
<add> {
<add> return [
<add> 'foo' => 'bar',
<add> 'foobar' => [
<add> 'foobar_foo' => 'foo',
<add> 'foobar_bar' => 'bar',
<add> ],
<add> 'bars' => [
<add> ['bar' => 'foo 0', 'foo' => 'bar 0'],
<add> ['bar' => 'foo 1', 'foo' => 'bar 1'],
<add> ['bar' => 'foo 2', 'foo' => 'bar 2'],
<add> ],
<add> 'baz' => [
<add> ['foo' => 'bar 0', 'bar' => ['foo' => 'bar 0', 'bar' => 'foo 0']],
<add> ['foo' => 'bar 1', 'bar' => ['foo' => 'bar 1', 'bar' => 'foo 1']],
<add> ],
<add> ];
<add> }
<add>}
<add>
<add>class JsonSerializableSingleResourceStub implements JsonSerializable
<add>{
<add> public function jsonSerialize()
<add> {
<add> return [
<add> ['foo' => 'foo 0', 'bar' => 'bar 0', 'foobar' => 'foobar 0'],
<add> ['foo' => 'foo 1', 'bar' => 'bar 1', 'foobar' => 'foobar 1'],
<add> ['foo' => 'foo 2', 'bar' => 'bar 2', 'foobar' => 'foobar 2'],
<add> ['foo' => 'foo 3', 'bar' => 'bar 3', 'foobar' => 'foobar 3'],
<add> ];
<add> }
<add>} | 2 |
Python | Python | add basic tests for copysign | 12a7c572cc29dbf1584333594bf549cca8787b55 | <ide><path>numpy/core/tests/test_umath.py
<ide> def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False,
<ide> assert np.all(np.absolute(y0.real - ym.real*re_sign) < atol), (y0, ym)
<ide> assert np.all(np.absolute(y0.imag - ym.imag*im_sign) < atol), (y0, ym)
<ide>
<add>def test_copysign():
<add> assert np.copysign(1, -1) == -1
<add> assert 1 / np.copysign(0, -1) < 0
<add> assert 1 / np.copysign(0, 1) > 0
<add> assert np.signbit(np.copysign(np.nan, -1))
<add> assert not np.signbit(np.copysign(np.nan, 1))
<add>
<ide> def test_pos_nan():
<ide> """Check np.nan is a positive nan."""
<ide> assert np.signbit(np.nan) == 0 | 1 |
Python | Python | display dag filepaths in airflow dags list command | 4e9a7d09ca10a937bdd6bcf177f3d3386d5e20db | <ide><path>airflow/cli/cli_parser.py
<ide> def __init__(self, flags=None, help=None, action=None, default=None, nargs=None,
<ide> help="Tree view",
<ide> action="store_true")
<ide>
<del># list_dags
<del>ARG_REPORT = Arg(
<del> ("-r", "--report"),
<del> help="Show DagBag loading report",
<del> action="store_true")
<del>
<ide> # clear
<ide> ARG_UPSTREAM = Arg(
<ide> ("-u", "--upstream"),
<ide> class GroupCommand(NamedTuple):
<ide> name='list',
<ide> help="List all the DAGs",
<ide> func=lazy_load_command('airflow.cli.commands.dag_command.dag_list_dags'),
<del> args=(ARG_SUBDIR, ARG_REPORT),
<add> args=(ARG_SUBDIR, ARG_OUTPUT),
<add> ),
<add> ActionCommand(
<add> name='report',
<add> help='Show DagBag loading report',
<add> func=lazy_load_command('airflow.cli.commands.dag_command.dag_report'),
<add> args=(ARG_SUBDIR, ARG_OUTPUT),
<ide> ),
<ide> ActionCommand(
<ide> name='list_runs',
<ide><path>airflow/cli/commands/dag_command.py
<ide> import logging
<ide> import signal
<ide> import subprocess
<del>import textwrap
<ide> from typing import List
<ide>
<ide> from tabulate import tabulate
<ide> from airflow.utils.session import create_session
<ide>
<ide>
<del>def _tabulate_dag_runs(dag_runs: List[DagRun], tablefmt="fancy_grid"):
<add>def _tabulate_dag_runs(dag_runs: List[DagRun], tablefmt: str = "fancy_grid") -> str:
<ide> tabulat_data = (
<ide> {
<ide> 'ID': dag_run.id,
<ide> def _tabulate_dag_runs(dag_runs: List[DagRun], tablefmt="fancy_grid"):
<ide> 'End date': dag_run.end_date.isoformat() if dag_run.end_date else '',
<ide> } for dag_run in dag_runs
<ide> )
<del> return "\n%s" % tabulate(
<add> return tabulate(
<ide> tabular_data=tabulat_data,
<ide> tablefmt=tablefmt
<ide> )
<ide>
<ide>
<add>def _tabulate_dags(dags: List[DAG], tablefmt: str = "fancy_grid") -> str:
<add> tabulat_data = (
<add> {
<add> 'DAG ID': dag.dag_id,
<add> 'Filepath': dag.filepath,
<add> 'Owner': dag.owner,
<add> } for dag in sorted(dags, key=lambda d: d.dag_id)
<add> )
<add> return tabulate(
<add> tabular_data=tabulat_data,
<add> tablefmt=tablefmt,
<add> headers='keys'
<add> )
<add>
<add>
<ide> @cli_utils.action_logging
<ide> def dag_backfill(args, dag=None):
<ide> """Creates backfill job or dry run for a DAG"""
<ide> def dag_next_execution(args):
<ide> def dag_list_dags(args):
<ide> """Displays dags with or without stats at the command line"""
<ide> dagbag = DagBag(process_subdir(args.subdir))
<del> list_template = textwrap.dedent("""\n
<del> -------------------------------------------------------------------
<del> DAGS
<del> -------------------------------------------------------------------
<del> {dag_list}
<del> """)
<del> dag_list = "\n".join(sorted(dagbag.dags))
<del> print(list_template.format(dag_list=dag_list))
<del> if args.report:
<del> print(dagbag.dagbag_report())
<add> dags = dagbag.dags.values()
<add> print(_tabulate_dags(dags, tablefmt=args.output))
<add>
<add>
<add>@cli_utils.action_logging
<add>def dag_report(args):
<add> """Displays dagbag stats at the command line"""
<add> dagbag = DagBag(process_subdir(args.subdir))
<add> print(tabulate(dagbag.dagbag_stats, headers="keys", tablefmt=args.output))
<ide>
<ide>
<ide> @cli_utils.action_logging
<ide><path>tests/cli/commands/test_dag_command.py
<ide> from airflow.settings import Session
<ide> from airflow.utils import timezone
<ide> from airflow.utils.state import State
<add>from tests.test_utils.config import conf_vars
<ide>
<ide> dag_folder_path = '/'.join(os.path.realpath(__file__).split('/')[:-1])
<ide>
<ide> def reset_dr_db(dag_id):
<ide>
<ide> reset_dr_db(dag_id)
<ide>
<add> @conf_vars({
<add> ('core', 'load_examples'): 'true'
<add> })
<add> def test_cli_report(self):
<add> args = self.parser.parse_args(['dags', 'report'])
<add> with contextlib.redirect_stdout(io.StringIO()) as temp_stdout:
<add> dag_command.dag_report(args)
<add> out = temp_stdout.getvalue()
<add>
<add> self.assertIn("airflow/example_dags/example_complex.py ", out)
<add> self.assertIn("['example_complex']", out)
<add>
<add> @conf_vars({
<add> ('core', 'load_examples'): 'true'
<add> })
<ide> def test_cli_list_dags(self):
<del> args = self.parser.parse_args(['dags', 'list', '--report'])
<del> dag_command.dag_list_dags(args)
<add> args = self.parser.parse_args(['dags', 'list'])
<add> with contextlib.redirect_stdout(io.StringIO()) as temp_stdout:
<add> dag_command.dag_list_dags(args)
<add> out = temp_stdout.getvalue()
<add> self.assertIn("Owner", out)
<add> self.assertIn("│ airflow │", out)
<add> self.assertIn("airflow/example_dags/example_complex.py", out)
<ide>
<ide> def test_cli_list_dag_runs(self):
<ide> dag_command.dag_trigger(self.parser.parse_args([ | 3 |
PHP | PHP | fix cs error | e236933544d52e7a16d5c77ecf9834ae38e4c6fa | <ide><path>src/Database/Driver/Sqlserver.php
<ide> namespace Cake\Database\Driver;
<ide>
<ide> use Cake\Database\Dialect\SqlserverDialectTrait;
<del>use Cake\Database\Statement\SqlserverStatement;
<ide> use Cake\Database\Query;
<add>use Cake\Database\Statement\SqlserverStatement;
<ide> use PDO;
<ide>
<ide> /** | 1 |
Python | Python | fix logs downloading for tasks | 923bde2b917099135adfe470a5453f663131fd5f | <ide><path>airflow/providers/elasticsearch/log/es_task_handler.py
<ide> def _read(
<ide> if (
<ide> cur_ts.diff(last_log_ts).in_minutes() >= 5
<ide> or 'max_offset' in metadata
<del> and offset >= metadata['max_offset']
<add> and int(offset) >= int(metadata['max_offset'])
<ide> ):
<ide> metadata['end_of_log'] = True
<ide>
<del> if offset != next_offset or 'last_log_timestamp' not in metadata:
<add> if int(offset) != int(next_offset) or 'last_log_timestamp' not in metadata:
<ide> metadata['last_log_timestamp'] = str(cur_ts)
<ide>
<ide> # If we hit the end of the log, remove the actual end_of_log message
<ide><path>tests/providers/elasticsearch/log/test_es_task_handler.py
<ide> def test_read_with_match_phrase_query(self):
<ide>
<ide> ts = pendulum.now()
<ide> logs, metadatas = self.es_task_handler.read(
<del> self.ti, 1, {'offset': 0, 'last_log_timestamp': str(ts), 'end_of_log': False}
<add> self.ti, 1, {'offset': '0', 'last_log_timestamp': str(ts), 'end_of_log': False, 'max_offset': 2}
<ide> )
<ide> assert 1 == len(logs)
<ide> assert len(logs) == len(metadatas) | 2 |
Javascript | Javascript | add test for listen callback runtime binding | 9ce5a031480a51abdb3d65fe67fba52df6a3851a | <ide><path>test/parallel/test-http-pause.js
<ide> const server = http.createServer((req, res) => {
<ide> });
<ide>
<ide> server.listen(0, function() {
<add> // Anonymous function rather than arrow function to test `this` value.
<add> assert.strictEqual(this, server);
<ide> const req = http.request({
<ide> port: this.address().port,
<ide> path: '/', | 1 |
Javascript | Javascript | fix linting issues | 04081ba0e57f06127a066fc2dea67e08737667fd | <ide><path>src/config.js
<ide> class Config {
<ide> this.projectSettings = {}
<ide> this.projectFile = null
<ide>
<del>
<ide> this.scopedSettingsStore = new ScopedPropertyStore()
<ide>
<ide> this.settingsLoaded = false | 1 |
Python | Python | remove ref to is_pipeline_test | d92e22d1f28324f513f3080e5c47c071a3916721 | <ide><path>tests/pipelines/test_pipelines_zero_shot_object_detection.py
<ide> import unittest
<ide>
<ide> from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline
<del>from transformers.testing_utils import (
<del> is_pipeline_test,
<del> nested_simplify,
<del> require_tf,
<del> require_torch,
<del> require_vision,
<del> slow,
<del>)
<add>from transformers.testing_utils import nested_simplify, require_tf, require_torch, require_vision, slow
<ide>
<ide> from .test_pipelines_common import ANY, PipelineTestCaseMeta
<ide>
<ide> def open(*args, **kwargs):
<ide>
<ide> @require_vision
<ide> @require_torch
<del>@is_pipeline_test
<ide> class ZeroShotObjectDetectionPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseMeta):
<ide>
<ide> model_mapping = MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING | 1 |
PHP | PHP | add routes.php generation to plugin bake | c5eab6946f48a240c5c9fa2e8845e9b30c7bcce0 | <ide><path>src/Console/Command/Task/PluginTask.php
<ide> public function bake($plugin) {
<ide> $this->createFile($this->path . $plugin . DS . $classBase . DS . 'Controller' . DS . $controllerFileName, $out);
<ide>
<ide> $hasAutoloader = $this->_modifyAutoloader($plugin, $this->path);
<add> $this->_generateRoutes($plugin, $this->path);
<ide> $this->_modifyBootstrap($plugin, $hasAutoloader);
<ide> $this->_generatePhpunitXml($plugin, $this->path);
<ide> $this->_generateTestBootstrap($plugin, $this->path);
<ide> protected function _modifyBootstrap($plugin, $hasAutoloader) {
<ide> if (!preg_match("@\n\s*Plugin::loadAll@", $contents)) {
<ide> $autoload = $hasAutoloader ? null : "'autoload' => true, ";
<ide> $bootstrap->append(sprintf(
<del> "\nPlugin::load('%s', [%s'bootstrap' => false, 'routes' => false]);\n",
<add> "\nPlugin::load('%s', [%s'bootstrap' => false, 'routes' => true]);\n",
<ide> $plugin,
<ide> $autoload
<ide> ));
<ide> protected function _modifyBootstrap($plugin, $hasAutoloader) {
<ide> }
<ide> }
<ide>
<add>/**
<add> * Generate a routes file for the plugin being baked.
<add> *
<add> * @param string $plugin The plugin to generate routes for.
<add> * @param string $path The path to save the routes.php file in.
<add> * @return void
<add> */
<add> protected function _generateRoutes($plugin, $path) {
<add> $this->Template->set([
<add> 'plugin' => $plugin,
<add> ]);
<add> $this->out( __d('cake_console', 'Generating routes.php file...'));
<add> $out = $this->Template->generate('config', 'routes');
<add> $file = $path . $plugin . DS . 'Config' . DS . 'routes.php';
<add> $this->createFile($file, $out);
<add> }
<add>
<ide> /**
<ide> * Generate a phpunit.xml stub for the plugin.
<ide> *
<ide><path>tests/TestCase/Console/Command/Task/PluginTaskTest.php
<ide> public function testExecuteWithOneArg() {
<ide> $this->Task->expects($this->at(1))->method('createFile')
<ide> ->with($file, $this->stringContains('class AppController extends BaseController {'));
<ide>
<del> $file = $path . DS . 'phpunit.xml';
<add> $file = $path . DS . 'Config' . DS . 'routes.php';
<ide> $this->Task->expects($this->at(2))->method('createFile')
<del> ->with($file, new \PHPUnit_Framework_Constraint_IsAnything());
<add> ->with($file, $this->stringContains("Router::plugin('BakeTestPlugin', function(\$routes)"));
<ide>
<del> $file = $path . DS . 'tests' . DS . 'bootstrap.php';
<add> $file = $path . DS . 'phpunit.xml';
<ide> $this->Task->expects($this->at(3))->method('createFile')
<del> ->with($file, new \PHPUnit_Framework_Constraint_IsAnything());
<add> ->with($file, $this->anything());
<add>
<add> $file = $path . DS . 'tests' . DS . 'bootstrap.php';
<add> $this->Task->expects($this->at(4))->method('createFile')
<add> ->with($file, $this->anything());
<ide>
<ide> $this->Task->main('BakeTestPlugin');
<ide> | 2 |
Text | Text | clarify test cases | 4ec48bb2fb8eca276f97c6753ac798285aa2cf0f | <ide><path>curriculum/challenges/english/05-back-end-development-and-apis/basic-node-and-express/get-query-parameter-input-from-the-client.md
<ide> Build an API endpoint, mounted at `GET /name`. Respond with a JSON document, tak
<ide>
<ide> # --hints--
<ide>
<del>Test 1 : Your API endpoint should respond with the correct name
<add>Test 1 : Your API endpoint should respond with `{ "name": "Mick Jagger" }` when the `/name` endpoint is called with `?first=Mick&last=Jagger`
<ide>
<ide> ```js
<ide> (getUserInput) =>
<ide> Test 1 : Your API endpoint should respond with the correct name
<ide> );
<ide> ```
<ide>
<del>Test 2 : Your API endpoint should respond with the correct name
<add>Test 2 : Your API endpoint should respond with `{ "name": "Keith Richards" }` when the `/name` endpoint is called with `?first=Keith&last=Richards`
<ide>
<ide> ```js
<ide> (getUserInput) => | 1 |
Javascript | Javascript | fix invalid end handling for slowbuffer#hexslice | 3c9fb3ec1af991b1b1eb7105b2a790549ca2b844 | <ide><path>lib/buffer.js
<ide> SlowBuffer.prototype.hexSlice = function(start, end) {
<ide> var len = this.length;
<ide>
<ide> if (!start || start < 0) start = 0;
<del> if (end < 0) end = len - start;
<add> if (!end || end < 0 || end > len) end = len - 1;
<ide>
<ide> var out = '';
<ide> for (var i = start; i < end; i ++) {
<ide><path>test/simple/test-buffer.js
<ide> var hexb2 = new Buffer(hexStr, 'hex');
<ide> for (var i = 0; i < 256; i ++) {
<ide> assert.equal(hexb2[i], hexb[i]);
<ide> }
<add>
<add>// test an invalid slice end.
<add>console.log('Try to slice off the end of the buffer');
<add>var b = new Buffer([1,2,3,4,5]);
<add>var b2 = b.toString('hex', 1, 10000);
<add>var b3 = b.toString('hex', 1, 5);
<add>var b4 = b.toString('hex', 1);
<add>assert.equal(b2, b3);
<add>assert.equal(b2, b4); | 2 |
Ruby | Ruby | add test coverage for `bin/setup` | 2d1a7b9c76a2cde7531d7d3c544c630e916ed481 | <ide><path>railties/test/application/bin_setup_test.rb
<add>require 'isolation/abstract_unit'
<add>
<add>module ApplicationTests
<add> class BinSetupTest < ActiveSupport::TestCase
<add> include ActiveSupport::Testing::Isolation
<add>
<add> def setup
<add> build_app
<add> end
<add>
<add> def teardown
<add> teardown_app
<add> end
<add>
<add> def test_bin_setup
<add> Dir.chdir(app_path) do
<add> app_file 'db/schema.rb', <<-RUBY
<add> ActiveRecord::Schema.define(version: 20140423102712) do
<add> create_table(:articles) {}
<add> end
<add> RUBY
<add>
<add> list_tables = lambda { `bin/rails runner 'p ActiveRecord::Base.connection.tables'`.strip }
<add> File.write("log/my.log", "zomg!")
<add>
<add> assert_equal '[]', list_tables.call
<add> assert_equal 5, File.size("log/my.log")
<add> assert_not File.exist?("tmp/restart.txt")
<add> `bin/setup 2>&1`
<add> assert_equal 0, File.size("log/my.log")
<add> assert_equal '["articles", "schema_migrations"]', list_tables.call
<add> assert File.exist?("tmp/restart.txt")
<add> end
<add> end
<add>
<add> def test_bin_setup_output
<add> Dir.chdir(app_path) do
<add> app_file 'db/schema.rb', ""
<add>
<add> output = `bin/setup 2>&1`
<add> assert_equal(<<-OUTPUT, output)
<add>== Installing dependencies ==
<add>The Gemfile's dependencies are satisfied
<add>
<add>== Preparing database ==
<add>
<add>== Removing old logs and tempfiles ==
<add>
<add>== Restarting application server ==
<add> OUTPUT
<add> end
<add> end
<add> end
<add>end | 1 |
Ruby | Ruby | use the superclass implementation | fa1e101d5469729c0b21c234bde85f731d4ce6e4 | <ide><path>activerecord/lib/active_record/associations/association_scope.rb
<ide> def table_name_for(reflection)
<ide> # the owner
<ide> klass.table_name
<ide> else
<del> reflection.table_name
<add> super
<ide> end
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/reflection.rb
<ide> def through_reflection
<ide> #
<ide> def chain
<ide> @chain ||= begin
<del> chain = source_reflection.chain + through_reflection.chain
<add> a = source_reflection.chain
<add> b = through_reflection.chain
<add> chain = a + b
<ide> chain[0] = self # Use self so we don't lose the information from :source_type
<ide> chain
<ide> end | 2 |
Ruby | Ruby | tolerate missing logger | 85eb3af873e3393416ff2c764c5590abc0538a64 | <ide><path>activeresource/lib/active_resource/base.rb
<ide> def prefix(options={}) "#{prefix_call}" end
<ide> end_code
<ide> silence_warnings { instance_eval code, __FILE__, __LINE__ }
<ide> rescue
<del> logger.error "Couldn't set prefix: #{$!}\n #{code}"
<add> logger.error "Couldn't set prefix: #{$!}\n #{code}" if logger
<ide> raise
<ide> end
<ide> | 1 |
Ruby | Ruby | fix query cache to load before first request | 349db176d8283a5c16816b50a92b0b319b1b8b74 | <ide><path>activerecord/lib/active_record/railtie.rb
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> end
<ide>
<ide> initializer "active_record.set_executor_hooks" do
<del> ActiveSupport.on_load(:active_record) do
<del> ActiveRecord::QueryCache.install_executor_hooks
<del> end
<add> ActiveRecord::QueryCache.install_executor_hooks
<ide> end
<ide>
<ide> initializer "active_record.add_watchable_files" do |app|
<ide><path>railties/test/application/loading_test.rb
<ide> def test_initialize_can_be_called_at_any_time
<ide> end
<ide> end
<ide>
<add> test "active record query cache hooks are installed before first request" do
<add> app_file "app/controllers/omg_controller.rb", <<-RUBY
<add> begin
<add> class OmgController < ActionController::Metal
<add> ActiveSupport.run_load_hooks(:action_controller, self)
<add> def show
<add> if ActiveRecord::Base.connection.query_cache_enabled
<add> self.response_body = ["Query cache is enabled."]
<add> else
<add> self.response_body = ["Expected ActiveRecord::Base.connection.query_cache_enabled to be true"]
<add> end
<add> end
<add> end
<add> rescue => e
<add> puts "Error loading metal: \#{e.class} \#{e.message}"
<add> end
<add> RUBY
<add>
<add> app_file "config/routes.rb", <<-RUBY
<add> Rails.application.routes.draw do
<add> get "/:controller(/:action)"
<add> end
<add> RUBY
<add>
<add> require "#{rails_root}/config/environment"
<add>
<add> require "rack/test"
<add> extend Rack::Test::Methods
<add>
<add> get "/omg/show"
<add> assert_equal "Query cache is enabled.", last_response.body
<add> end
<add>
<ide> private
<ide>
<ide> def setup_ar! | 2 |
Text | Text | fix typo "director" instead of "directory" | 1ca4a9cdbf0aafe07d6cd47d673e12fba276f259 | <ide><path>doc/api/fs.md
<ide> changes:
<ide> * `withFileTypes` {boolean} **Default:** `false`
<ide> * Returns: {string[]|Buffer[]|fs.Dirent[]}
<ide>
<del>Reads the contents of the director.
<add>Reads the contents of the directory.
<ide>
<ide> See the POSIX readdir(3) documentation for more details.
<ide> | 1 |
Ruby | Ruby | allow configuration of std_cargo_args | 2fe77f52717e9b688a2e2f4c57c0404022a3afee | <ide><path>Library/Homebrew/formula.rb
<ide> def std_configure_args
<ide> end
<ide>
<ide> # Standard parameters for cargo builds.
<del> sig { returns(T::Array[T.any(String, Pathname)]) }
<del> def std_cargo_args
<del> ["--locked", "--root", prefix, "--path", "."]
<add> sig { params(root: String, path: String).returns(T::Array[T.any(String, Pathname)]) }
<add> def std_cargo_args(root: prefix, path: ".")
<add> ["--locked", "--root", root, "--path", path]
<ide> end
<ide>
<ide> # Standard parameters for CMake builds. | 1 |
Ruby | Ruby | add missing space before closing hash brace | ddfc54492a3d53160a473f14223db2a28c56a1ce | <ide><path>actionpack/lib/action_dispatch/middleware/actionable_exceptions.rb
<ide> def redirect_to(location)
<ide> if uri.relative? || uri.scheme == "http" || uri.scheme == "https"
<ide> body = "<html><body>You are being <a href=\"#{ERB::Util.unwrapped_html_escape(location)}\">redirected</a>.</body></html>"
<ide> else
<del> return [400, { "Content-Type" => "text/plain"}, ["Invalid redirection URI"]]
<add> return [400, { "Content-Type" => "text/plain" }, ["Invalid redirection URI"]]
<ide> end
<ide>
<ide> [302, { | 1 |
Javascript | Javascript | add tests for checking which input is focused | 878f0500e76b65d737c6e3932cd75a8c2f0fc613 | <ide><path>Libraries/Components/TextInput/__tests__/TextInput-test.js
<ide> const React = require('react');
<ide> const ReactTestRenderer = require('react-test-renderer');
<ide> const TextInput = require('../TextInput');
<add>const ReactNative = require('../../../Renderer/shims/ReactNative');
<ide>
<add>import type {FocusEvent} from '../TextInput';
<ide> import Component from '@reactions/component';
<ide>
<ide> const {enter} = require('../../../Utilities/ReactNativeTestTools');
<ide> describe('TextInput tests', () => {
<ide> nativeEvent: {text: message},
<ide> });
<ide> });
<add>
<add> it('should have support being focused and unfocused', () => {
<add> const textInputRef = React.createRef(null);
<add> ReactTestRenderer.create(<TextInput ref={textInputRef} value="value1" />);
<add>
<add> expect(textInputRef.current.isFocused()).toBe(false);
<add> const inputTag = ReactNative.findNodeHandle(textInputRef.current);
<add> TextInput.State.focusTextInput(inputTag);
<add> expect(textInputRef.current.isFocused()).toBe(true);
<add> expect(TextInput.State.currentlyFocusedField()).toBe(inputTag);
<add> TextInput.State.blurTextInput(inputTag);
<add> expect(textInputRef.current.isFocused()).toBe(false);
<add> expect(TextInput.State.currentlyFocusedField()).toBe(null);
<add> });
<add>
<add> it('should unfocus when other TextInput is focused', () => {
<add> const textInputRe1 = React.createRef(null);
<add> const textInputRe2 = React.createRef(null);
<add>
<add> ReactTestRenderer.create(
<add> <>
<add> <TextInput ref={textInputRe1} value="value1" />
<add> <TextInput ref={textInputRe2} value="value2" />
<add> </>,
<add> );
<add> ReactNative.findNodeHandle = jest.fn().mockImplementation(ref => {
<add> if (
<add> ref === textInputRe1.current ||
<add> ref === textInputRe1.current.getNativeRef()
<add> ) {
<add> return 1;
<add> }
<add>
<add> if (
<add> ref === textInputRe2.current ||
<add> ref === textInputRe2.current.getNativeRef()
<add> ) {
<add> return 2;
<add> }
<add>
<add> return 3;
<add> });
<add>
<add> expect(textInputRe1.current.isFocused()).toBe(false);
<add> expect(textInputRe2.current.isFocused()).toBe(false);
<add>
<add> const inputTag1 = ReactNative.findNodeHandle(textInputRe1.current);
<add> const inputTag2 = ReactNative.findNodeHandle(textInputRe2.current);
<add>
<add> TextInput.State.focusTextInput(inputTag1);
<add>
<add> expect(textInputRe1.current.isFocused()).toBe(true);
<add> expect(textInputRe2.current.isFocused()).toBe(false);
<add> expect(TextInput.State.currentlyFocusedField()).toBe(inputTag1);
<add>
<add> TextInput.State.focusTextInput(inputTag2);
<add>
<add> expect(textInputRe1.current.isFocused()).toBe(false);
<add> expect(textInputRe2.current.isFocused()).toBe(true);
<add> expect(TextInput.State.currentlyFocusedField()).toBe(inputTag2);
<add> });
<ide> }); | 1 |
PHP | PHP | remove needless _defaultconfig merging | 12b281ac7bc678454c0e9d2e1f3a0c2055d02792 | <ide><path>src/View/Helper.php
<ide> public function __construct(View $View, $config = array()) {
<ide> $this->_View = $View;
<ide> $this->request = $View->request;
<ide>
<del> if ($config) {
<del> $config = Hash::merge($this->_defaultConfig, $config);
<del> }
<ide> $this->config($config);
<ide>
<ide> if (!empty($this->helpers)) {
<ide> public function __call($method, $params) {
<ide> */
<ide> public function __get($name) {
<ide> if (isset($this->_helperMap[$name]) && !isset($this->{$name})) {
<del> $settings = array_merge((array)$this->_helperMap[$name]['settings'], array('enabled' => false));
<del> $this->{$name} = $this->_View->addHelper($this->_helperMap[$name]['class'], $settings);
<add> $settings = array_merge((array)$this->_helperMap[$name]['config'], array('enabled' => false));
<add> $this->{$name} = $this->_View->addHelper($this->_helperMap[$name]['class'], $this->_config);
<ide> }
<ide> if (isset($this->{$name})) {
<ide> return $this->{$name};
<ide><path>src/View/Helper/FormHelper.php
<ide> class FormHelper extends Helper {
<ide> */
<ide> public function __construct(View $View, $config = []) {
<ide> parent::__construct($View, $config);
<del> $config = $this->config();
<add> $config = $this->_config;
<ide>
<ide> $this->widgetRegistry($config['registry'], $config['widgets']);
<ide> $this->config(['widgets' => null, 'registry' => null]);
<ide> protected function _inputType($fieldName, $options) {
<ide> }
<ide>
<ide> $internalType = $context->type($fieldName);
<del> $map = $this->config('typeMap');
<add> $map = $this->_config['typeMap'];
<ide> $type = isset($map[$internalType]) ? $map[$internalType] : 'text';
<ide> $fieldName = array_slice(explode('.', $fieldName), -1)[0];
<ide>
<ide> protected function _initInputField($field, $options = []) {
<ide> unset($options['value'], $options['default']);
<ide>
<ide> if ($context->hasError($field)) {
<del> $options = $this->addClass($options, $this->config('errorClass'));
<add> $options = $this->addClass($options, $this->_config['errorClass']);
<ide> }
<ide> if (!empty($options['disabled']) || $secure === static::SECURE_SKIP) {
<ide> return $options;
<ide><path>src/View/Helper/NumberHelper.php
<ide> class NumberHelper extends Helper {
<ide> public function __construct(View $View, $config = array()) {
<ide> parent::__construct($View, $config);
<ide>
<del> $config = $this->config();
<add> $config = $this->_config;
<ide>
<ide> $engineClass = App::classname($config['engine'], 'Utility');
<ide> if ($engineClass) {
<ide><path>src/View/Helper/PaginatorHelper.php
<ide> public function options($options = array()) {
<ide> );
<ide> unset($options[$model]);
<ide> }
<del> $this->_config['options'] = array_filter(array_merge($this->config('options'), $options));
<add> $this->_config['options'] = array_filter(array_merge($this->_config['options'], $options));
<ide> }
<ide>
<ide> /**
<ide> public function url($options = array(), $model = null) {
<ide> 'direction' => $paging['direction'],
<ide> ];
<ide>
<del> $defaultUrl = $this->config('options.url');
<del> if ($defaultUrl) {
<del> $url = array_merge($defaultUrl, $url);
<add> if (!empty($this->_config['options']['url'])) {
<add> $url = array_merge($this->_config['options']['url'], $url);
<ide> }
<ide> $url = array_merge(array_filter($url), $options);
<ide>
<ide><path>src/View/Helper/TextHelper.php
<ide> class TextHelper extends Helper {
<ide> public function __construct(View $View, $config = array()) {
<ide> parent::__construct($View, $config);
<ide>
<del> $config = $this->config();
<add> $config = $this->_config;
<ide> $engineClass = App::classname($config['engine'], 'Utility');
<ide> if ($engineClass) {
<ide> $this->_engine = new $engineClass($config);
<ide><path>src/View/Helper/TimeHelper.php
<ide> class TimeHelper extends Helper {
<ide> public function __construct(View $View, $config = array()) {
<ide> parent::__construct($View, $config);
<ide>
<del> $config = $this->config();
<add> $config = $this->_config;
<ide>
<ide> $engineClass = App::classname($config['engine'], 'Utility');
<ide> if ($engineClass) {
<ide><path>src/View/View.php
<ide> public function loadHelpers() {
<ide> $helpers = $registry->normalizeArray($this->helpers);
<ide> foreach ($helpers as $properties) {
<ide> list(, $class) = pluginSplit($properties['class']);
<del> $this->{$class} = $registry->load($properties['class'], $properties['settings']);
<add> $this->{$class} = $registry->load($properties['class'], $properties['config']);
<ide> }
<ide> }
<ide>
<ide> public function helpers() {
<ide> * Loads a helper. Delegates to the `HelperRegistry::load()` to load the helper
<ide> *
<ide> * @param string $helperName Name of the helper to load.
<del> * @param array $settings Settings for the helper
<add> * @param array $config Settings for the helper
<ide> * @return Helper a constructed helper object.
<ide> * @see HelperRegistry::load()
<ide> */
<del> public function addHelper($helperName, $settings = []) {
<del> return $this->helpers()->load($helperName, $settings);
<add> public function addHelper($helperName, $config = []) {
<add> return $this->helpers()->load($helperName, $config);
<ide> }
<ide>
<ide> /** | 7 |
Javascript | Javascript | add ref to offscreen component | c1d414d75851aee7f25f69c1b6fda6a14198ba24 | <ide><path>packages/react-reconciler/src/ReactFiber.new.js
<ide> export function createFiberFromOffscreen(
<ide> fiber.elementType = REACT_OFFSCREEN_TYPE;
<ide> fiber.lanes = lanes;
<ide> const primaryChildInstance: OffscreenInstance = {
<del> visibility: OffscreenVisible,
<del> pendingMarkers: null,
<del> retryCache: null,
<del> transitions: null,
<add> _visibility: OffscreenVisible,
<add> _pendingMarkers: null,
<add> _retryCache: null,
<add> _transitions: null,
<ide> };
<ide> fiber.stateNode = primaryChildInstance;
<ide> return fiber;
<ide> export function createFiberFromLegacyHidden(
<ide> // Adding a stateNode for legacy hidden because it's currently using
<ide> // the offscreen implementation, which depends on a state node
<ide> const instance: OffscreenInstance = {
<del> visibility: OffscreenVisible,
<del> pendingMarkers: null,
<del> transitions: null,
<del> retryCache: null,
<add> _visibility: OffscreenVisible,
<add> _pendingMarkers: null,
<add> _transitions: null,
<add> _retryCache: null,
<ide> };
<ide> fiber.stateNode = instance;
<ide> return fiber;
<ide><path>packages/react-reconciler/src/ReactFiber.old.js
<ide> export function createFiberFromOffscreen(
<ide> fiber.elementType = REACT_OFFSCREEN_TYPE;
<ide> fiber.lanes = lanes;
<ide> const primaryChildInstance: OffscreenInstance = {
<del> visibility: OffscreenVisible,
<del> pendingMarkers: null,
<del> retryCache: null,
<del> transitions: null,
<add> _visibility: OffscreenVisible,
<add> _pendingMarkers: null,
<add> _retryCache: null,
<add> _transitions: null,
<ide> };
<ide> fiber.stateNode = primaryChildInstance;
<ide> return fiber;
<ide> export function createFiberFromLegacyHidden(
<ide> // Adding a stateNode for legacy hidden because it's currently using
<ide> // the offscreen implementation, which depends on a state node
<ide> const instance: OffscreenInstance = {
<del> visibility: OffscreenVisible,
<del> pendingMarkers: null,
<del> transitions: null,
<del> retryCache: null,
<add> _visibility: OffscreenVisible,
<add> _pendingMarkers: null,
<add> _transitions: null,
<add> _retryCache: null,
<ide> };
<ide> fiber.stateNode = instance;
<ide> return fiber;
<ide><path>packages/react-reconciler/src/ReactFiberBeginWork.new.js
<ide> function updateOffscreenComponent(
<ide> const prevState: OffscreenState | null =
<ide> current !== null ? current.memoizedState : null;
<ide>
<add> markRef(current, workInProgress);
<add>
<ide> if (
<ide> nextProps.mode === 'hidden' ||
<ide> (enableLegacyHidden && nextProps.mode === 'unstable-defer-without-hiding')
<ide> function updateOffscreenComponent(
<ide> // We have now gone from hidden to visible, so any transitions should
<ide> // be added to the stack to get added to any Offscreen/suspense children
<ide> const instance: OffscreenInstance | null = workInProgress.stateNode;
<del> if (instance !== null && instance.transitions != null) {
<del> transitions = Array.from(instance.transitions);
<add> if (instance !== null && instance._transitions != null) {
<add> transitions = Array.from(instance._transitions);
<ide> }
<ide> }
<ide>
<ide><path>packages/react-reconciler/src/ReactFiberBeginWork.old.js
<ide> function updateOffscreenComponent(
<ide> const prevState: OffscreenState | null =
<ide> current !== null ? current.memoizedState : null;
<ide>
<add> markRef(current, workInProgress);
<add>
<ide> if (
<ide> nextProps.mode === 'hidden' ||
<ide> (enableLegacyHidden && nextProps.mode === 'unstable-defer-without-hiding')
<ide> function updateOffscreenComponent(
<ide> // We have now gone from hidden to visible, so any transitions should
<ide> // be added to the stack to get added to any Offscreen/suspense children
<ide> const instance: OffscreenInstance | null = workInProgress.stateNode;
<del> if (instance !== null && instance.transitions != null) {
<del> transitions = Array.from(instance.transitions);
<add> if (instance !== null && instance._transitions != null) {
<add> transitions = Array.from(instance._transitions);
<ide> }
<ide> }
<ide>
<ide><path>packages/react-reconciler/src/ReactFiberCommitWork.new.js
<ide> import type {
<ide> OffscreenState,
<ide> OffscreenInstance,
<ide> OffscreenQueue,
<add> OffscreenProps,
<ide> } from './ReactFiberOffscreenComponent';
<ide> import type {HookFlags} from './ReactHookEffectTags';
<ide> import type {Cache} from './ReactFiberCacheComponent.new';
<ide> function commitLayoutEffectOnFiber(
<ide> committedLanes,
<ide> );
<ide> }
<add> if (flags & Ref) {
<add> const props: OffscreenProps = finishedWork.memoizedProps;
<add> if (props.mode === 'manual') {
<add> safelyAttachRef(finishedWork, finishedWork.return);
<add> } else {
<add> safelyDetachRef(finishedWork, finishedWork.return);
<add> }
<add> }
<ide> break;
<ide> }
<ide> default: {
<ide> function commitTransitionProgress(offscreenFiber: Fiber) {
<ide> const wasHidden = prevState !== null;
<ide> const isHidden = nextState !== null;
<ide>
<del> const pendingMarkers = offscreenInstance.pendingMarkers;
<add> const pendingMarkers = offscreenInstance._pendingMarkers;
<ide> // If there is a name on the suspense boundary, store that in
<ide> // the pending boundaries.
<ide> let name = null;
<ide> function commitDeletionEffectsOnFiber(
<ide> return;
<ide> }
<ide> case OffscreenComponent: {
<add> safelyDetachRef(deletedFiber, nearestMountedAncestor);
<ide> if (deletedFiber.mode & ConcurrentMode) {
<ide> // If this offscreen component is hidden, we already unmounted it. Before
<ide> // deleting the children, track that it's already unmounted so that we
<ide> function getRetryCache(finishedWork) {
<ide> }
<ide> case OffscreenComponent: {
<ide> const instance: OffscreenInstance = finishedWork.stateNode;
<del> let retryCache = instance.retryCache;
<add> let retryCache = instance._retryCache;
<ide> if (retryCache === null) {
<del> retryCache = instance.retryCache = new PossiblyWeakSet();
<add> retryCache = instance._retryCache = new PossiblyWeakSet();
<ide> }
<ide> return retryCache;
<ide> }
<ide> function commitMutationEffectsOnFiber(
<ide> return;
<ide> }
<ide> case OffscreenComponent: {
<add> if (flags & Ref) {
<add> if (current !== null) {
<add> safelyDetachRef(current, current.return);
<add> }
<add> }
<add>
<ide> const newState: OffscreenState | null = finishedWork.memoizedState;
<ide> const isHidden = newState !== null;
<ide> const wasHidden = current !== null && current.memoizedState !== null;
<ide> function commitMutationEffectsOnFiber(
<ide> // Track the current state on the Offscreen instance so we can
<ide> // read it during an event
<ide> if (isHidden) {
<del> offscreenInstance.visibility &= ~OffscreenVisible;
<add> offscreenInstance._visibility &= ~OffscreenVisible;
<ide> } else {
<del> offscreenInstance.visibility |= OffscreenVisible;
<add> offscreenInstance._visibility |= OffscreenVisible;
<ide> }
<ide>
<ide> if (isHidden) {
<ide> export function disappearLayoutEffects(finishedWork: Fiber) {
<ide> break;
<ide> }
<ide> case OffscreenComponent: {
<add> // TODO (Offscreen) Check: flags & RefStatic
<add> safelyDetachRef(finishedWork, finishedWork.return);
<add>
<ide> const isHidden = finishedWork.memoizedState !== null;
<ide> if (isHidden) {
<ide> // Nested Offscreen tree is already hidden. Don't disappear
<ide> export function reappearLayoutEffects(
<ide> includeWorkInProgressEffects,
<ide> );
<ide> }
<add> // TODO: Check flags & Ref
<add> safelyAttachRef(finishedWork, finishedWork.return);
<ide> break;
<ide> }
<ide> default: {
<ide> function commitOffscreenPassiveMountEffects(
<ide> // Add all the transitions saved in the update queue during
<ide> // the render phase (ie the transitions associated with this boundary)
<ide> // into the transitions set.
<del> if (instance.transitions === null) {
<del> instance.transitions = new Set();
<add> if (instance._transitions === null) {
<add> instance._transitions = new Set();
<ide> }
<del> instance.transitions.add(transition);
<add> instance._transitions.add(transition);
<ide> });
<ide> }
<ide>
<ide> function commitOffscreenPassiveMountEffects(
<ide> // caused them
<ide> if (markerTransitions !== null) {
<ide> markerTransitions.forEach(transition => {
<del> if (instance.transitions === null) {
<del> instance.transitions = new Set();
<del> } else if (instance.transitions.has(transition)) {
<add> if (instance._transitions === null) {
<add> instance._transitions = new Set();
<add> } else if (instance._transitions.has(transition)) {
<ide> if (markerInstance.pendingBoundaries === null) {
<ide> markerInstance.pendingBoundaries = new Map();
<ide> }
<del> if (instance.pendingMarkers === null) {
<del> instance.pendingMarkers = new Set();
<add> if (instance._pendingMarkers === null) {
<add> instance._pendingMarkers = new Set();
<ide> }
<ide>
<del> instance.pendingMarkers.add(markerInstance);
<add> instance._pendingMarkers.add(markerInstance);
<ide> }
<ide> });
<ide> }
<ide> function commitOffscreenPassiveMountEffects(
<ide>
<ide> // TODO: Refactor this into an if/else branch
<ide> if (!isHidden) {
<del> instance.transitions = null;
<del> instance.pendingMarkers = null;
<add> instance._transitions = null;
<add> instance._pendingMarkers = null;
<ide> }
<ide> }
<ide> }
<ide> function commitPassiveMountOnFiber(
<ide> const isHidden = nextState !== null;
<ide>
<ide> if (isHidden) {
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<ide> // The effects are currently connected. Update them.
<ide> recursivelyTraversePassiveMountEffects(
<ide> finishedRoot,
<ide> function commitPassiveMountOnFiber(
<ide> }
<ide> } else {
<ide> // Legacy Mode: Fire the effects even if the tree is hidden.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide> recursivelyTraversePassiveMountEffects(
<ide> finishedRoot,
<ide> finishedWork,
<ide> function commitPassiveMountOnFiber(
<ide> }
<ide> } else {
<ide> // Tree is visible
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<ide> // The effects are currently connected. Update them.
<ide> recursivelyTraversePassiveMountEffects(
<ide> finishedRoot,
<ide> function commitPassiveMountOnFiber(
<ide> // The effects are currently disconnected. Reconnect them, while also
<ide> // firing effects inside newly mounted trees. This also applies to
<ide> // the initial render.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide>
<ide> const includeWorkInProgressEffects =
<ide> (finishedWork.subtreeFlags & PassiveMask) !== NoFlags;
<ide> export function reconnectPassiveEffects(
<ide> const isHidden = nextState !== null;
<ide>
<ide> if (isHidden) {
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<ide> // The effects are currently connected. Update them.
<ide> recursivelyTraverseReconnectPassiveEffects(
<ide> finishedRoot,
<ide> export function reconnectPassiveEffects(
<ide> }
<ide> } else {
<ide> // Legacy Mode: Fire the effects even if the tree is hidden.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide> recursivelyTraverseReconnectPassiveEffects(
<ide> finishedRoot,
<ide> finishedWork,
<ide> export function reconnectPassiveEffects(
<ide> // continue traversing the tree and firing all the effects.
<ide> //
<ide> // We do need to set the "connected" flag on the instance, though.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide>
<ide> recursivelyTraverseReconnectPassiveEffects(
<ide> finishedRoot,
<ide> function commitPassiveUnmountOnFiber(finishedWork: Fiber): void {
<ide>
<ide> if (
<ide> isHidden &&
<del> instance.visibility & OffscreenPassiveEffectsConnected &&
<add> instance._visibility & OffscreenPassiveEffectsConnected &&
<ide> // For backwards compatibility, don't unmount when a tree suspends. In
<ide> // the future we may change this to unmount after a delay.
<ide> (finishedWork.return === null ||
<ide> function commitPassiveUnmountOnFiber(finishedWork: Fiber): void {
<ide> // TODO: Add option or heuristic to delay before disconnecting the
<ide> // effects. Then if the tree reappears before the delay has elapsed, we
<ide> // can skip toggling the effects entirely.
<del> instance.visibility &= ~OffscreenPassiveEffectsConnected;
<add> instance._visibility &= ~OffscreenPassiveEffectsConnected;
<ide> recursivelyTraverseDisconnectPassiveEffects(finishedWork);
<ide> } else {
<ide> recursivelyTraversePassiveUnmountEffects(finishedWork);
<ide> export function disconnectPassiveEffect(finishedWork: Fiber): void {
<ide> }
<ide> case OffscreenComponent: {
<ide> const instance: OffscreenInstance = finishedWork.stateNode;
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<del> instance.visibility &= ~OffscreenPassiveEffectsConnected;
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<add> instance._visibility &= ~OffscreenPassiveEffectsConnected;
<ide> recursivelyTraverseDisconnectPassiveEffects(finishedWork);
<ide> } else {
<ide> // The effects are already disconnected.
<ide> function commitPassiveUnmountInsideDeletedTreeOnFiber(
<ide> // We need to mark this fiber's parents as deleted
<ide> const offscreenFiber: Fiber = (current.child: any);
<ide> const instance: OffscreenInstance = offscreenFiber.stateNode;
<del> const transitions = instance.transitions;
<add> const transitions = instance._transitions;
<ide> if (transitions !== null) {
<ide> const abortReason = {
<ide> reason: 'suspense',
<ide><path>packages/react-reconciler/src/ReactFiberCommitWork.old.js
<ide> import type {
<ide> OffscreenState,
<ide> OffscreenInstance,
<ide> OffscreenQueue,
<add> OffscreenProps,
<ide> } from './ReactFiberOffscreenComponent';
<ide> import type {HookFlags} from './ReactHookEffectTags';
<ide> import type {Cache} from './ReactFiberCacheComponent.old';
<ide> function commitLayoutEffectOnFiber(
<ide> committedLanes,
<ide> );
<ide> }
<add> if (flags & Ref) {
<add> const props: OffscreenProps = finishedWork.memoizedProps;
<add> if (props.mode === 'manual') {
<add> safelyAttachRef(finishedWork, finishedWork.return);
<add> } else {
<add> safelyDetachRef(finishedWork, finishedWork.return);
<add> }
<add> }
<ide> break;
<ide> }
<ide> default: {
<ide> function commitTransitionProgress(offscreenFiber: Fiber) {
<ide> const wasHidden = prevState !== null;
<ide> const isHidden = nextState !== null;
<ide>
<del> const pendingMarkers = offscreenInstance.pendingMarkers;
<add> const pendingMarkers = offscreenInstance._pendingMarkers;
<ide> // If there is a name on the suspense boundary, store that in
<ide> // the pending boundaries.
<ide> let name = null;
<ide> function commitDeletionEffectsOnFiber(
<ide> return;
<ide> }
<ide> case OffscreenComponent: {
<add> safelyDetachRef(deletedFiber, nearestMountedAncestor);
<ide> if (deletedFiber.mode & ConcurrentMode) {
<ide> // If this offscreen component is hidden, we already unmounted it. Before
<ide> // deleting the children, track that it's already unmounted so that we
<ide> function getRetryCache(finishedWork) {
<ide> }
<ide> case OffscreenComponent: {
<ide> const instance: OffscreenInstance = finishedWork.stateNode;
<del> let retryCache = instance.retryCache;
<add> let retryCache = instance._retryCache;
<ide> if (retryCache === null) {
<del> retryCache = instance.retryCache = new PossiblyWeakSet();
<add> retryCache = instance._retryCache = new PossiblyWeakSet();
<ide> }
<ide> return retryCache;
<ide> }
<ide> function commitMutationEffectsOnFiber(
<ide> return;
<ide> }
<ide> case OffscreenComponent: {
<add> if (flags & Ref) {
<add> if (current !== null) {
<add> safelyDetachRef(current, current.return);
<add> }
<add> }
<add>
<ide> const newState: OffscreenState | null = finishedWork.memoizedState;
<ide> const isHidden = newState !== null;
<ide> const wasHidden = current !== null && current.memoizedState !== null;
<ide> function commitMutationEffectsOnFiber(
<ide> // Track the current state on the Offscreen instance so we can
<ide> // read it during an event
<ide> if (isHidden) {
<del> offscreenInstance.visibility &= ~OffscreenVisible;
<add> offscreenInstance._visibility &= ~OffscreenVisible;
<ide> } else {
<del> offscreenInstance.visibility |= OffscreenVisible;
<add> offscreenInstance._visibility |= OffscreenVisible;
<ide> }
<ide>
<ide> if (isHidden) {
<ide> export function disappearLayoutEffects(finishedWork: Fiber) {
<ide> break;
<ide> }
<ide> case OffscreenComponent: {
<add> // TODO (Offscreen) Check: flags & RefStatic
<add> safelyDetachRef(finishedWork, finishedWork.return);
<add>
<ide> const isHidden = finishedWork.memoizedState !== null;
<ide> if (isHidden) {
<ide> // Nested Offscreen tree is already hidden. Don't disappear
<ide> export function reappearLayoutEffects(
<ide> includeWorkInProgressEffects,
<ide> );
<ide> }
<add> // TODO: Check flags & Ref
<add> safelyAttachRef(finishedWork, finishedWork.return);
<ide> break;
<ide> }
<ide> default: {
<ide> function commitOffscreenPassiveMountEffects(
<ide> // Add all the transitions saved in the update queue during
<ide> // the render phase (ie the transitions associated with this boundary)
<ide> // into the transitions set.
<del> if (instance.transitions === null) {
<del> instance.transitions = new Set();
<add> if (instance._transitions === null) {
<add> instance._transitions = new Set();
<ide> }
<del> instance.transitions.add(transition);
<add> instance._transitions.add(transition);
<ide> });
<ide> }
<ide>
<ide> function commitOffscreenPassiveMountEffects(
<ide> // caused them
<ide> if (markerTransitions !== null) {
<ide> markerTransitions.forEach(transition => {
<del> if (instance.transitions === null) {
<del> instance.transitions = new Set();
<del> } else if (instance.transitions.has(transition)) {
<add> if (instance._transitions === null) {
<add> instance._transitions = new Set();
<add> } else if (instance._transitions.has(transition)) {
<ide> if (markerInstance.pendingBoundaries === null) {
<ide> markerInstance.pendingBoundaries = new Map();
<ide> }
<del> if (instance.pendingMarkers === null) {
<del> instance.pendingMarkers = new Set();
<add> if (instance._pendingMarkers === null) {
<add> instance._pendingMarkers = new Set();
<ide> }
<ide>
<del> instance.pendingMarkers.add(markerInstance);
<add> instance._pendingMarkers.add(markerInstance);
<ide> }
<ide> });
<ide> }
<ide> function commitOffscreenPassiveMountEffects(
<ide>
<ide> // TODO: Refactor this into an if/else branch
<ide> if (!isHidden) {
<del> instance.transitions = null;
<del> instance.pendingMarkers = null;
<add> instance._transitions = null;
<add> instance._pendingMarkers = null;
<ide> }
<ide> }
<ide> }
<ide> function commitPassiveMountOnFiber(
<ide> const isHidden = nextState !== null;
<ide>
<ide> if (isHidden) {
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<ide> // The effects are currently connected. Update them.
<ide> recursivelyTraversePassiveMountEffects(
<ide> finishedRoot,
<ide> function commitPassiveMountOnFiber(
<ide> }
<ide> } else {
<ide> // Legacy Mode: Fire the effects even if the tree is hidden.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide> recursivelyTraversePassiveMountEffects(
<ide> finishedRoot,
<ide> finishedWork,
<ide> function commitPassiveMountOnFiber(
<ide> }
<ide> } else {
<ide> // Tree is visible
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<ide> // The effects are currently connected. Update them.
<ide> recursivelyTraversePassiveMountEffects(
<ide> finishedRoot,
<ide> function commitPassiveMountOnFiber(
<ide> // The effects are currently disconnected. Reconnect them, while also
<ide> // firing effects inside newly mounted trees. This also applies to
<ide> // the initial render.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide>
<ide> const includeWorkInProgressEffects =
<ide> (finishedWork.subtreeFlags & PassiveMask) !== NoFlags;
<ide> export function reconnectPassiveEffects(
<ide> const isHidden = nextState !== null;
<ide>
<ide> if (isHidden) {
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<ide> // The effects are currently connected. Update them.
<ide> recursivelyTraverseReconnectPassiveEffects(
<ide> finishedRoot,
<ide> export function reconnectPassiveEffects(
<ide> }
<ide> } else {
<ide> // Legacy Mode: Fire the effects even if the tree is hidden.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide> recursivelyTraverseReconnectPassiveEffects(
<ide> finishedRoot,
<ide> finishedWork,
<ide> export function reconnectPassiveEffects(
<ide> // continue traversing the tree and firing all the effects.
<ide> //
<ide> // We do need to set the "connected" flag on the instance, though.
<del> instance.visibility |= OffscreenPassiveEffectsConnected;
<add> instance._visibility |= OffscreenPassiveEffectsConnected;
<ide>
<ide> recursivelyTraverseReconnectPassiveEffects(
<ide> finishedRoot,
<ide> function commitPassiveUnmountOnFiber(finishedWork: Fiber): void {
<ide>
<ide> if (
<ide> isHidden &&
<del> instance.visibility & OffscreenPassiveEffectsConnected &&
<add> instance._visibility & OffscreenPassiveEffectsConnected &&
<ide> // For backwards compatibility, don't unmount when a tree suspends. In
<ide> // the future we may change this to unmount after a delay.
<ide> (finishedWork.return === null ||
<ide> function commitPassiveUnmountOnFiber(finishedWork: Fiber): void {
<ide> // TODO: Add option or heuristic to delay before disconnecting the
<ide> // effects. Then if the tree reappears before the delay has elapsed, we
<ide> // can skip toggling the effects entirely.
<del> instance.visibility &= ~OffscreenPassiveEffectsConnected;
<add> instance._visibility &= ~OffscreenPassiveEffectsConnected;
<ide> recursivelyTraverseDisconnectPassiveEffects(finishedWork);
<ide> } else {
<ide> recursivelyTraversePassiveUnmountEffects(finishedWork);
<ide> export function disconnectPassiveEffect(finishedWork: Fiber): void {
<ide> }
<ide> case OffscreenComponent: {
<ide> const instance: OffscreenInstance = finishedWork.stateNode;
<del> if (instance.visibility & OffscreenPassiveEffectsConnected) {
<del> instance.visibility &= ~OffscreenPassiveEffectsConnected;
<add> if (instance._visibility & OffscreenPassiveEffectsConnected) {
<add> instance._visibility &= ~OffscreenPassiveEffectsConnected;
<ide> recursivelyTraverseDisconnectPassiveEffects(finishedWork);
<ide> } else {
<ide> // The effects are already disconnected.
<ide> function commitPassiveUnmountInsideDeletedTreeOnFiber(
<ide> // We need to mark this fiber's parents as deleted
<ide> const offscreenFiber: Fiber = (current.child: any);
<ide> const instance: OffscreenInstance = offscreenFiber.stateNode;
<del> const transitions = instance.transitions;
<add> const transitions = instance._transitions;
<ide> if (transitions !== null) {
<ide> const abortReason = {
<ide> reason: 'suspense',
<ide><path>packages/react-reconciler/src/ReactFiberConcurrentUpdates.new.js
<ide> function markUpdateLaneFromFiberToRoot(
<ide> const offscreenInstance: OffscreenInstance | null = parent.stateNode;
<ide> if (
<ide> offscreenInstance !== null &&
<del> !(offscreenInstance.visibility & OffscreenVisible)
<add> !(offscreenInstance._visibility & OffscreenVisible)
<ide> ) {
<ide> isHidden = true;
<ide> }
<ide><path>packages/react-reconciler/src/ReactFiberConcurrentUpdates.old.js
<ide> function markUpdateLaneFromFiberToRoot(
<ide> const offscreenInstance: OffscreenInstance | null = parent.stateNode;
<ide> if (
<ide> offscreenInstance !== null &&
<del> !(offscreenInstance.visibility & OffscreenVisible)
<add> !(offscreenInstance._visibility & OffscreenVisible)
<ide> ) {
<ide> isHidden = true;
<ide> }
<ide><path>packages/react-reconciler/src/ReactFiberOffscreenComponent.js
<ide> export const OffscreenVisible = /* */ 0b01;
<ide> export const OffscreenPassiveEffectsConnected = /* */ 0b10;
<ide>
<ide> export type OffscreenInstance = {
<del> visibility: OffscreenVisibility,
<del> pendingMarkers: Set<TracingMarkerInstance> | null,
<del> transitions: Set<Transition> | null,
<del> retryCache: WeakSet<Wakeable> | Set<Wakeable> | null,
<add> _visibility: OffscreenVisibility,
<add> _pendingMarkers: Set<TracingMarkerInstance> | null,
<add> _transitions: Set<Transition> | null,
<add> _retryCache: WeakSet<Wakeable> | Set<Wakeable> | null,
<ide> };
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js
<ide> export function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable) {
<ide> break;
<ide> case OffscreenComponent: {
<ide> const instance: OffscreenInstance = boundaryFiber.stateNode;
<del> retryCache = instance.retryCache;
<add> retryCache = instance._retryCache;
<ide> break;
<ide> }
<ide> default:
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js
<ide> export function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable) {
<ide> break;
<ide> case OffscreenComponent: {
<ide> const instance: OffscreenInstance = boundaryFiber.stateNode;
<del> retryCache = instance.retryCache;
<add> retryCache = instance._retryCache;
<ide> break;
<ide> }
<ide> default:
<ide><path>packages/react-reconciler/src/__tests__/ReactOffscreen-test.js
<ide> let useState;
<ide> let useLayoutEffect;
<ide> let useEffect;
<ide> let useMemo;
<add>let useRef;
<ide> let startTransition;
<ide>
<ide> describe('ReactOffscreen', () => {
<ide> describe('ReactOffscreen', () => {
<ide> useLayoutEffect = React.useLayoutEffect;
<ide> useEffect = React.useEffect;
<ide> useMemo = React.useMemo;
<add> useRef = React.useRef;
<ide> startTransition = React.startTransition;
<ide> });
<ide>
<ide> describe('ReactOffscreen', () => {
<ide> </div>,
<ide> );
<ide> });
<add>
<add> describe('manual interactivity', () => {
<add> // @gate enableOffscreen
<add> it('should attach ref only for mode null', async () => {
<add> let offscreenRef;
<add>
<add> function App({mode}) {
<add> offscreenRef = useRef(null);
<add> return (
<add> <Offscreen
<add> mode={mode}
<add> ref={ref => {
<add> offscreenRef.current = ref;
<add> }}>
<add> <div />
<add> </Offscreen>
<add> );
<add> }
<add>
<add> const root = ReactNoop.createRoot();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'manual'} />);
<add> });
<add>
<add> expect(offscreenRef.current).not.toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'visible'} />);
<add> });
<add>
<add> expect(offscreenRef.current).toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'hidden'} />);
<add> });
<add>
<add> expect(offscreenRef.current).toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'manual'} />);
<add> });
<add>
<add> expect(offscreenRef.current).not.toBeNull();
<add> });
<add> });
<add>
<add> // @gate enableOffscreen
<add> it('should detach ref if Offscreen is unmounted', async () => {
<add> let offscreenRef;
<add>
<add> function App({showOffscreen}) {
<add> offscreenRef = useRef(null);
<add> return showOffscreen ? (
<add> <Offscreen
<add> mode={'manual'}
<add> ref={ref => {
<add> offscreenRef.current = ref;
<add> }}>
<add> <div />
<add> </Offscreen>
<add> ) : null;
<add> }
<add>
<add> const root = ReactNoop.createRoot();
<add>
<add> await act(async () => {
<add> root.render(<App showOffscreen={true} />);
<add> });
<add>
<add> expect(offscreenRef.current).not.toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App showOffscreen={false} />);
<add> });
<add>
<add> expect(offscreenRef.current).toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App showOffscreen={true} />);
<add> });
<add>
<add> expect(offscreenRef.current).not.toBeNull();
<add> });
<add>
<add> // @gate enableOffscreen
<add> it('should detach ref when parent Offscreen is hidden', async () => {
<add> let offscreenRef;
<add>
<add> function App({mode}) {
<add> offscreenRef = useRef(null);
<add> return (
<add> <Offscreen mode={mode}>
<add> <Offscreen mode={'manual'} ref={offscreenRef}>
<add> <div />
<add> </Offscreen>
<add> </Offscreen>
<add> );
<add> }
<add>
<add> const root = ReactNoop.createRoot();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'hidden'} />);
<add> });
<add>
<add> expect(offscreenRef.current).toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'visible'} />);
<add> });
<add>
<add> expect(offscreenRef.current).not.toBeNull();
<add>
<add> await act(async () => {
<add> root.render(<App mode={'hidden'} />);
<add> });
<add>
<add> expect(offscreenRef.current).toBeNull();
<add> });
<add>
<add> // TODO: When attach/detach methods are implemented. Add tests for nested Offscreen case.
<ide> });
<ide><path>packages/shared/ReactTypes.js
<ide> export type Thenable<T> =
<ide> export type OffscreenMode =
<ide> | 'hidden'
<ide> | 'unstable-defer-without-hiding'
<del> | 'visible';
<add> | 'visible'
<add> | 'manual';
<ide>
<ide> export type StartTransitionOptions = {
<ide> name?: string, | 13 |
Python | Python | make "unnamed vectors" warning a real warning | 3ba5238282d5ea84d5d2a71b5940de30fbaf3331 | <ide><path>spacy/_ml.py
<ide> def link_vectors_to_models(vocab):
<ide> if vectors.name is None:
<ide> vectors.name = VECTORS_KEY
<ide> if vectors.data.size != 0:
<del> print(
<del> "Warning: Unnamed vectors -- this won't allow multiple vectors "
<del> "models to be loaded. (Shape: (%d, %d))" % vectors.data.shape
<del> )
<add> user_warning(Warnings.W020.format(shape=vectors.data.shape))
<ide> ops = Model.ops
<ide> for word in vocab:
<ide> if word.orth in vectors.key2row:
<ide><path>spacy/errors.py
<ide> class Warnings(object):
<ide> W018 = ("Entity '{entity}' already exists in the Knowledge base.")
<ide> W019 = ("Changing vectors name from {old} to {new}, to avoid clash with "
<ide> "previously loaded vectors. See Issue #3853.")
<add> W020 = ("Unnamed vectors. This won't allow multiple vectors models to be "
<add> "loaded. (Shape: {shape})")
<ide>
<ide>
<ide> @add_codes | 2 |
Mixed | Ruby | add querylogtags to rails | 2408615154d039264810edbe628f4fc06d8cdc45 | <ide><path>actionpack/lib/action_controller/railtie.rb
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> ActionController::Metal.descendants.each(&:action_methods) if config.eager_load
<ide> end
<ide> end
<add>
<add> initializer "action_controller.query_log_tags" do |app|
<add> ActiveSupport.on_load(:action_controller_base) do
<add> singleton_class.attr_accessor :log_query_tags_around_actions
<add> self.log_query_tags_around_actions = true
<add> end
<add>
<add> ActiveSupport.on_load(:active_record) do
<add> if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
<add> ActiveRecord::QueryLogs.taggings.merge! \
<add> controller: -> { context[:controller]&.controller_name },
<add> action: -> { context[:controller]&.action_name },
<add> namespaced_controller: -> { context[:controller]&.class&.name }
<add>
<add> ActiveRecord::QueryLogs.tags << :controller << :action
<add>
<add> context_extension = ->(controller) do
<add> around_action :expose_controller_to_query_logs
<add>
<add> private
<add> def expose_controller_to_query_logs(&block)
<add> ActiveRecord::QueryLogs.set_context(controller: self, &block)
<add> end
<add> end
<add>
<add> ActionController::Base.class_eval(&context_extension)
<add> ActionController::API.class_eval(&context_extension)
<add> end
<add> end
<add> end
<ide> end
<ide> end
<ide><path>activejob/lib/active_job/railtie.rb
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> end
<ide> end
<ide> end
<add>
<add> initializer "active_job.query_log_tags" do |app|
<add> ActiveSupport.on_load(:active_job) do
<add> singleton_class.attr_accessor :log_query_tags_around_perform
<add> self.log_query_tags_around_perform = true
<add> end
<add>
<add> ActiveSupport.on_load(:active_record) do
<add> if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
<add> ActiveRecord::QueryLogs.taggings[:job] = -> { context[:job]&.class&.name }
<add> ActiveRecord::QueryLogs.tags << :job
<add>
<add> ActiveJob::Base.class_eval do
<add> around_perform :expose_job_to_query_logs
<add>
<add> private
<add> def expose_job_to_query_logs(&block)
<add> ActiveRecord::QueryLogs.set_context(job: self, &block)
<add> end
<add> end
<add> end
<add> end
<add> end
<ide> end
<ide> end
<ide><path>activerecord/CHANGELOG.md
<add>* Add `ActiveRecord::QueryLogs`.
<add>
<add> Configurable tags can be automatically added to all SQL queries generated by Active Record.
<add>
<add> ```ruby
<add> # config/application.rb
<add> module MyApp
<add> class Application < Rails::Application
<add> config.active_record.query_log_tags_enabled = true
<add> end
<add> end
<add> ```
<add>
<add> By default the application, controller and action details are added to the query tags:
<add>
<add> ```ruby
<add> class BooksController < ApplicationController
<add> def index
<add> @books = Book.all
<add> end
<add> end
<add> ```
<add>
<add> ```ruby
<add> GET /books
<add> # SELECT * FROM books /*application:MyApp;controller:books;action:index*/
<add> ```
<add>
<add> Custom tags containing static values and Procs can be defined in the application configuration:
<add>
<add> ```ruby
<add> config.active_record.query_log_tags = [
<add> :application,
<add> :controller,
<add> :action,
<add> {
<add> custom_static: "foo",
<add> custom_dynamic: -> { Time.now }
<add> }
<add> ]
<add> ```
<add>
<add> *Keeran Raj Hawoldar*, *Eileen M. Uchitelle*, *Kasper Timm Hansen*
<add>
<ide> * Added support for multiple databases to `rails db:setup` and `rails db:reset`.
<ide>
<ide> *Ryan Hall*
<ide><path>activerecord/lib/active_record.rb
<ide> module ActiveRecord
<ide> autoload :Persistence
<ide> autoload :QueryCache
<ide> autoload :Querying
<add> autoload :QueryLogs
<ide> autoload :ReadonlyAttributes
<ide> autoload :RecordInvalid, "active_record/validations"
<ide> autoload :Reflection
<ide> def self.global_executor_concurrency # :nodoc:
<ide> singleton_class.attr_accessor :verify_foreign_keys_for_fixtures
<ide> self.verify_foreign_keys_for_fixtures = false
<ide>
<add> ##
<add> # :singleton-method:
<add> # Specify whether or not to enable adapter-level query comments.
<add> # To enable:
<add> #
<add> # config.active_record.query_log_tags_enabled = true
<add> #
<add> # When included in +ActionController+, controller context is automatically updated via an
<add> # +around_action+ filter. This behaviour can be disabled as follows:
<add> #
<add> # config.action_controller.log_query_tags_around_actions = false
<add> #
<add> # This behaviour can be disabled for +ActiveJob+ in a similar way:
<add> #
<add> # config.active_job.log_query_tags_around_perform = false
<add> singleton_class.attr_accessor :query_log_tags_enabled
<add> self.query_log_tags_enabled = false
<add>
<add> ##
<add> # :singleton-method:
<add> # An +Array+ specifying the key/value tags to be inserted in an SQL comment. Defaults to `[ :application ]`, a
<add> # predefined tag returning the application name.
<add> #
<add> # Custom values can be passed in as a +Hash+:
<add> #
<add> # config.active_record.query_log_tags = [ :application, { custom: 'value' } ]
<add> #
<add> # See +ActiveRecord::QueryLogs+ for more details
<add> # on predefined tags and defining new tag content.
<add> singleton_class.attr_accessor :query_log_tags
<add> self.query_log_tags = [ :application ]
<add>
<add> ##
<add> # :singleton-method:
<add> # Specify whether or not to enable caching of query log tags.
<add> # For applications that have a large number of queries, caching query log tags can
<add> # provide a performance benefit when the context does not change during the lifetime
<add> # of the request or job execution.
<add> #
<add> # To enable:
<add> #
<add> # config.active_record.cache_query_log_tags = true
<add> singleton_class.attr_accessor :cache_query_log_tags
<add> self.cache_query_log_tags = false
<add>
<ide> def self.eager_load!
<ide> super
<ide> ActiveRecord::Locking.eager_load!
<ide><path>activerecord/lib/active_record/database_configurations/hash_config.rb
<ide> def host
<ide> configuration_hash[:host]
<ide> end
<ide>
<add> def socket # :nodoc:
<add> configuration_hash[:socket]
<add> end
<add>
<ide> def database
<ide> configuration_hash[:database]
<ide> end
<ide><path>activerecord/lib/active_record/query_logs.rb
<add># frozen_string_literal: true
<add>
<add>require "active_support/core_ext/module/attribute_accessors_per_thread"
<add>
<add>module ActiveRecord
<add> # = Active Record Query Logs
<add> #
<add> # Automatically tag SQL queries with runtime information.
<add> #
<add> # Default tags available for use:
<add> #
<add> # * +application+
<add> # * +pid+
<add> # * +socket+
<add> # * +db_host+
<add> # * +database+
<add> #
<add> # _Action Controller and Active Job tags are also defined when used in Rails:_
<add> #
<add> # * +controller+
<add> # * +action+
<add> # * +job+
<add> #
<add> # The tags used in a query can be configured directly:
<add> #
<add> # ActiveRecord::QueryLogs.tags = [ :application, :controller, :action, :job ]
<add> #
<add> # or via Rails configuration:
<add> #
<add> # config.active_record.query_log_tags = [ :application, :controller, :action, :job ]
<add> #
<add> # To add new comment tags, add a hash to the tags array containing the keys and values you
<add> # want to add to the comment. Dynamic content can be created by setting a proc or lambda value in a hash,
<add> # and can reference any value stored in the +context+ object.
<add> #
<add> # Example:
<add> #
<add> # tags = [
<add> # :application,
<add> # { custom_tag: -> { context[:controller].controller_name } }
<add> # ]
<add> # ActiveRecord::QueryLogs.tags = tags
<add> #
<add> # The QueryLogs +context+ can be manipulated via +update_context+ & +set_context+ methods.
<add> #
<add> # Direct updates to a context value:
<add> #
<add> # ActiveRecord::QueryLogs.update_context(foo: Bar.new)
<add> #
<add> # Temporary updates limited to the execution of a block:
<add> #
<add> # ActiveRecord::QueryLogs.set_context(foo: Bar.new) do
<add> # posts = Post.all
<add> # end
<add> #
<add> # Tag comments can be prepended to the query:
<add> #
<add> # ActiveRecord::QueryLogs.prepend_comment = true
<add> #
<add> # For applications where the content will not change during the lifetime of
<add> # the request or job execution, the tags can be cached for reuse in every query:
<add> #
<add> # ActiveRecord::QueryLogs.cache_query_log_tags = true
<add> #
<add> # This option can be set during application configuration or in a Rails initializer:
<add> #
<add> # config.active_record.cache_query_log_tags = true
<add> module QueryLogs
<add> mattr_accessor :taggings, instance_accessor: false, default: {}
<add> mattr_accessor :tags, instance_accessor: false, default: [ :application ]
<add> mattr_accessor :prepend_comment, instance_accessor: false, default: false
<add> mattr_accessor :cache_query_log_tags, instance_accessor: false, default: false
<add> thread_mattr_accessor :cached_comment, instance_accessor: false
<add>
<add> class << self
<add> # Updates the context used to construct tags in the SQL comment.
<add> # Resets the cached comment if <tt>cache_query_log_tags</tt> is +true+.
<add> def update_context(**options)
<add> context.merge!(**options.symbolize_keys)
<add> self.cached_comment = nil
<add> end
<add>
<add> # Updates the context used to construct tags in the SQL comment during
<add> # execution of the provided block. Resets provided values to nil after
<add> # the block is executed.
<add> def set_context(**options)
<add> update_context(**options)
<add> yield if block_given?
<add> ensure
<add> update_context(**options.transform_values! { nil })
<add> end
<add>
<add> # Temporarily tag any query executed within `&block`. Can be nested.
<add> def with_tag(tag, &block)
<add> inline_tags.push(tag)
<add> yield if block_given?
<add> ensure
<add> inline_tags.pop
<add> end
<add>
<add> def add_query_log_tags_to_sql(sql) # :nodoc:
<add> comments.each do |comment|
<add> unless sql.include?(comment)
<add> sql = prepend_comment ? "#{comment} #{sql}" : "#{sql} #{comment}"
<add> end
<add> end
<add> sql
<add> end
<add>
<add> private
<add> # Returns an array of comments which need to be added to the query, comprised
<add> # of configured and inline tags.
<add> def comments
<add> [ comment, inline_comment ].compact
<add> end
<add>
<add> # Returns an SQL comment +String+ containing the query log tags.
<add> # Sets and returns a cached comment if <tt>cache_query_log_tags</tt> is +true+.
<add> def comment
<add> if cache_query_log_tags
<add> self.cached_comment ||= uncached_comment
<add> else
<add> uncached_comment
<add> end
<add> end
<add>
<add> def uncached_comment
<add> content = tag_content
<add> if content.present?
<add> "/*#{escape_sql_comment(content)}*/"
<add> end
<add> end
<add>
<add> # Returns a +String+ containing any inline comments from +with_tag+.
<add> def inline_comment
<add> return nil unless inline_tags.present?
<add> "/*#{escape_sql_comment(inline_tag_content)}*/"
<add> end
<add>
<add> # Return the set of active inline tags from +with_tag+.
<add> def inline_tags
<add> context[:inline_tags] ||= []
<add> end
<add>
<add> def context
<add> Thread.current[:active_record_query_log_tags_context] ||= {}
<add> end
<add>
<add> def escape_sql_comment(content)
<add> content.to_s.gsub(%r{ (/ (?: | \g<1>) \*) \+? \s* | \s* (\* (?: | \g<2>) /) }x, "")
<add> end
<add>
<add> def tag_content
<add> tags.flat_map { |i| [*i] }.filter_map do |tag|
<add> key, value_input = tag
<add> val = case value_input
<add> when nil then instance_exec(&taggings[key]) if taggings.has_key? key
<add> when Proc then instance_exec(&value_input)
<add> else value_input
<add> end
<add> "#{key}:#{val}" unless val.nil?
<add> end.join(",")
<add> end
<add>
<add> def inline_tag_content
<add> inline_tags.join
<add> end
<add> end
<add>
<add> module ExecutionMethods
<add> def execute(sql, *args, **kwargs)
<add> super(ActiveRecord::QueryLogs.add_query_log_tags_to_sql(sql), *args, **kwargs)
<add> end
<add>
<add> def exec_query(sql, *args, **kwargs)
<add> super(ActiveRecord::QueryLogs.add_query_log_tags_to_sql(sql), *args, **kwargs)
<add> end
<add> end
<add> end
<add>end
<add>
<add>ActiveSupport.on_load(:active_record) do
<add> ActiveRecord::QueryLogs.taggings.merge! \
<add> socket: -> { ActiveRecord::Base.connection_db_config.socket },
<add> db_host: -> { ActiveRecord::Base.connection_db_config.host },
<add> database: -> { ActiveRecord::Base.connection_db_config.database }
<add>end
<ide><path>activerecord/lib/active_record/railtie.rb
<ide> class Railtie < Rails::Railtie # :nodoc:
<ide> end
<ide> end
<ide> end
<add>
<add> initializer "active_record.query_log_tags_config" do |app|
<add> config.after_initialize do
<add> if app.config.active_record.query_log_tags_enabled
<add> ActiveRecord::QueryLogs.taggings.merge! \
<add> application: -> { @application_name ||= Rails.application.class.name.split("::").first },
<add> pid: -> { Process.pid }
<add>
<add> if app.config.active_record.query_log_tags.present?
<add> ActiveRecord::QueryLogs.tags = app.config.active_record.query_log_tags
<add> end
<add>
<add> if app.config.active_record.cache_query_log_tags
<add> ActiveRecord::QueryLogs.cache_query_log_tags = true
<add> end
<add>
<add> ActiveSupport.on_load(:active_record) do
<add> ConnectionAdapters::AbstractAdapter.descendants.each do |klass|
<add> klass.prepend(QueryLogs::ExecutionMethods) if klass.descendants.empty?
<add> end
<add> end
<add> end
<add> end
<add> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/query_logs_test.rb
<add># frozen_string_literal: true
<add>
<add>require "cases/helper"
<add>require "models/dashboard"
<add>
<add>class QueryLogsTest < ActiveRecord::TestCase
<add> fixtures :dashboards
<add>
<add> ActiveRecord::QueryLogs.taggings[:application] = -> {
<add> "active_record"
<add> }
<add>
<add> def setup
<add> @original_enabled = ActiveRecord.query_log_tags_enabled
<add> ActiveRecord.query_log_tags_enabled = true
<add> if @original_enabled == false
<add> # if we haven't enabled the feature, the execution methods need to be prepended at run time
<add> ActiveRecord::Base.connection.class_eval do
<add> prepend(ActiveRecord::QueryLogs::ExecutionMethods)
<add> end
<add> end
<add> @original_prepend = ActiveRecord::QueryLogs.prepend_comment
<add> ActiveRecord::QueryLogs.prepend_comment = false
<add> ActiveRecord::QueryLogs.cache_query_log_tags = false
<add> ActiveRecord::QueryLogs.cached_comment = nil
<add> end
<add>
<add> def teardown
<add> ActiveRecord.query_log_tags_enabled = @original_enabled
<add> ActiveRecord::QueryLogs.prepend_comment = @original_prepend
<add> ActiveRecord::QueryLogs.tags = []
<add> end
<add>
<add> def test_escaping_good_comment
<add> assert_equal "app:foo", ActiveRecord::QueryLogs.send(:escape_sql_comment, "app:foo")
<add> end
<add>
<add> def test_escaping_bad_comments
<add> assert_equal "; DROP TABLE USERS;", ActiveRecord::QueryLogs.send(:escape_sql_comment, "*/; DROP TABLE USERS;/*")
<add> assert_equal "; DROP TABLE USERS;", ActiveRecord::QueryLogs.send(:escape_sql_comment, "**//; DROP TABLE USERS;/*")
<add> end
<add>
<add> def test_basic_commenting
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add>
<add> assert_sql(%r{select id from posts /\*application:active_record\*/$}) do
<add> ActiveRecord::Base.connection.execute "select id from posts"
<add> end
<add> end
<add>
<add> def test_add_comments_to_beginning_of_query
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add> ActiveRecord::QueryLogs.prepend_comment = true
<add>
<add> assert_sql(%r{/\*application:active_record\*/ select id from posts$}) do
<add> ActiveRecord::Base.connection.execute "select id from posts"
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.prepend_comment = nil
<add> end
<add>
<add> def test_exists_is_commented
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add> assert_sql(%r{/\*application:active_record\*/}) do
<add> Dashboard.exists?
<add> end
<add> end
<add>
<add> def test_delete_is_commented
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add> record = Dashboard.first
<add>
<add> assert_sql(%r{/\*application:active_record\*/}) do
<add> record.destroy
<add> end
<add> end
<add>
<add> def test_update_is_commented
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add>
<add> assert_sql(%r{/\*application:active_record\*/}) do
<add> dash = Dashboard.first
<add> dash.name = "New name"
<add> dash.save
<add> end
<add> end
<add>
<add> def test_create_is_commented
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add>
<add> assert_sql(%r{/\*application:active_record\*/}) do
<add> Dashboard.create(name: "Another dashboard")
<add> end
<add> end
<add>
<add> def test_select_is_commented
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add>
<add> assert_sql(%r{/\*application:active_record\*/}) do
<add> Dashboard.all.to_a
<add> end
<add> end
<add>
<add> def test_retrieves_comment_from_cache_when_enabled_and_set
<add> ActiveRecord::QueryLogs.cache_query_log_tags = true
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add>
<add> assert_equal " /*application:active_record*/", ActiveRecord::QueryLogs.add_query_log_tags_to_sql("")
<add>
<add> ActiveRecord::QueryLogs.stub(:cached_comment, "/*cached_comment*/") do
<add> assert_equal " /*cached_comment*/", ActiveRecord::QueryLogs.add_query_log_tags_to_sql("")
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.cached_comment = nil
<add> ActiveRecord::QueryLogs.cache_query_log_tags = false
<add> end
<add>
<add> def test_resets_cache_on_context_update
<add> ActiveRecord::QueryLogs.cache_query_log_tags = true
<add> ActiveRecord::QueryLogs.update_context(temporary: "value")
<add> ActiveRecord::QueryLogs.tags = [ temporary_tag: -> { context[:temporary] } ]
<add>
<add> assert_equal " /*temporary_tag:value*/", ActiveRecord::QueryLogs.add_query_log_tags_to_sql("")
<add>
<add> ActiveRecord::QueryLogs.update_context(temporary: "new_value")
<add>
<add> assert_nil ActiveRecord::QueryLogs.cached_comment
<add> assert_equal " /*temporary_tag:new_value*/", ActiveRecord::QueryLogs.add_query_log_tags_to_sql("")
<add> ensure
<add> ActiveRecord::QueryLogs.cached_comment = nil
<add> ActiveRecord::QueryLogs.cache_query_log_tags = false
<add> end
<add>
<add> def test_ensure_context_has_symbol_keys
<add> ActiveRecord::QueryLogs.tags = [ new_key: -> { context[:symbol_key] } ]
<add> ActiveRecord::QueryLogs.update_context("symbol_key" => "symbolized")
<add>
<add> assert_sql(%r{/\*new_key:symbolized}) do
<add> Dashboard.first
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.update_context(application_name: nil)
<add> end
<add>
<add> def test_inline_tags_only_affect_block
<add> # disable regular comment tags
<add> ActiveRecord::QueryLogs.tags = []
<add>
<add> # confirm single inline tag
<add> assert_sql(%r{/\*foo\*/$}) do
<add> ActiveRecord::QueryLogs.with_tag("foo") do
<add> Dashboard.first
<add> end
<add> end
<add>
<add> # confirm different inline tag
<add> assert_sql(%r{/\*bar\*/$}) do
<add> ActiveRecord::QueryLogs.with_tag("bar") do
<add> Dashboard.first
<add> end
<add> end
<add>
<add> # confirm no tags are persisted
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add>
<add> assert_sql(%r{/\*application:active_record\*/$}) do
<add> Dashboard.first
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add> end
<add>
<add> def test_nested_inline_tags
<add> assert_sql(%r{/\*foobar\*/$}) do
<add> ActiveRecord::QueryLogs.with_tag("foo") do
<add> ActiveRecord::QueryLogs.with_tag("bar") do
<add> Dashboard.first
<add> end
<add> end
<add> end
<add> end
<add>
<add> def test_bad_inline_tags
<add> assert_sql(%r{/\*; DROP TABLE USERS;\*/$}) do
<add> ActiveRecord::QueryLogs.with_tag("*/; DROP TABLE USERS;/*") do
<add> Dashboard.first
<add> end
<add> end
<add>
<add> assert_sql(%r{/\*; DROP TABLE USERS;\*/$}) do
<add> ActiveRecord::QueryLogs.with_tag("**//; DROP TABLE USERS;//**") do
<add> Dashboard.first
<add> end
<add> end
<add> end
<add>
<add> def test_inline_tags_are_deduped
<add> ActiveRecord::QueryLogs.tags = [ :application ]
<add> assert_sql(%r{select id from posts /\*foo\*/ /\*application:active_record\*/$}) do
<add> ActiveRecord::QueryLogs.with_tag("foo") do
<add> ActiveRecord::Base.connection.execute "select id from posts /*foo*/"
<add> end
<add> end
<add> end
<add>
<add> def test_empty_comments_are_not_added
<add> original_tags = ActiveRecord::QueryLogs.tags
<add> ActiveRecord::QueryLogs.tags = [ empty: -> { nil } ]
<add> assert_sql(%r{select id from posts$}) do
<add> ActiveRecord::Base.connection.execute "select id from posts"
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.tags = original_tags
<add> end
<add>
<add> def test_custom_basic_tags
<add> original_tags = ActiveRecord::QueryLogs.tags
<add> ActiveRecord::QueryLogs.tags = [ :application, { custom_string: "test content" } ]
<add>
<add> assert_sql(%r{/\*application:active_record,custom_string:test content\*/$}) do
<add> Dashboard.first
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.tags = original_tags
<add> end
<add>
<add> def test_custom_proc_tags
<add> original_tags = ActiveRecord::QueryLogs.tags
<add> ActiveRecord::QueryLogs.tags = [ :application, { custom_proc: -> { "test content" } } ]
<add>
<add> assert_sql(%r{/\*application:active_record,custom_proc:test content\*/$}) do
<add> Dashboard.first
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.tags = original_tags
<add> end
<add>
<add> def test_multiple_custom_tags
<add> original_tags = ActiveRecord::QueryLogs.tags
<add> ActiveRecord::QueryLogs.tags = [ :application, { custom_proc: -> { "test content" }, another_proc: -> { "more test content" } } ]
<add>
<add> assert_sql(%r{/\*application:active_record,custom_proc:test content,another_proc:more test content\*/$}) do
<add> Dashboard.first
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.tags = original_tags
<add> end
<add>
<add> def test_custom_proc_context_tags
<add> original_tags = ActiveRecord::QueryLogs.tags
<add> ActiveRecord::QueryLogs.update_context(foo: "bar")
<add> ActiveRecord::QueryLogs.tags = [ :application, { custom_context_proc: -> { context[:foo] } } ]
<add>
<add> assert_sql(%r{/\*application:active_record,custom_context_proc:bar\*/$}) do
<add> Dashboard.first
<add> end
<add> ensure
<add> ActiveRecord::QueryLogs.update_context(foo: nil)
<add> ActiveRecord::QueryLogs.tags = original_tags
<add> end
<add>end
<ide><path>railties/test/application/query_logs_test.rb
<add># frozen_string_literal: true
<add>
<add>require "isolation/abstract_unit"
<add>require "rack/test"
<add>
<add>module ApplicationTests
<add> class QueryLogsTest < ActiveSupport::TestCase
<add> include ActiveSupport::Testing::Isolation
<add> include Rack::Test::Methods
<add>
<add> def setup
<add> build_app
<add> app_file "app/models/user.rb", <<-RUBY
<add> class User < ActiveRecord::Base
<add> end
<add> RUBY
<add>
<add> app_file "app/controllers/users_controller.rb", <<-RUBY
<add> class UsersController < ApplicationController
<add> def index
<add> render inline: ActiveRecord::QueryLogs.add_query_log_tags_to_sql("")
<add> end
<add>
<add> def dynamic_content
<add> Time.now.to_f
<add> end
<add> end
<add> RUBY
<add>
<add> app_file "app/jobs/user_job.rb", <<-RUBY
<add> class UserJob < ActiveJob::Base
<add> def perform
<add> ActiveRecord::QueryLogs.add_query_log_tags_to_sql("")
<add> end
<add>
<add> def dynamic_content
<add> Time.now.to_f
<add> end
<add> end
<add> RUBY
<add>
<add> app_file "config/routes.rb", <<-RUBY
<add> Rails.application.routes.draw do
<add> get "/", to: "users#index"
<add> end
<add> RUBY
<add> end
<add>
<add> def teardown
<add> teardown_app
<add> end
<add>
<add> def app
<add> @app ||= Rails.application
<add> end
<add>
<add> test "does not modify the query execution path by default" do
<add> boot_app
<add>
<add> assert_equal ActiveRecord::Base.connection.method(:execute).owner, ActiveRecord::ConnectionAdapters::SQLite3::DatabaseStatements
<add> end
<add>
<add> test "prepends the query execution path when enabled" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add>
<add> boot_app
<add>
<add> assert_equal ActiveRecord::Base.connection.method(:execute).owner, ActiveRecord::QueryLogs::ExecutionMethods
<add> end
<add>
<add> test "controller and job tags are defined by default" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add>
<add> boot_app
<add>
<add> assert_equal ActiveRecord::QueryLogs.tags, [ :application, :controller, :action, :job ]
<add> end
<add>
<add> test "controller actions have tagging filters enabled by default" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add>
<add> boot_app
<add>
<add> get "/"
<add> comment = last_response.body.strip
<add>
<add> assert_includes comment, "controller:users"
<add> end
<add>
<add> test "controller actions tagging filters can be disabled" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add> add_to_config "config.action_controller.log_query_tags_around_actions = false"
<add>
<add> boot_app
<add>
<add> get "/"
<add> comment = last_response.body.strip
<add>
<add> assert_not_includes comment, "controller:users"
<add> end
<add>
<add> test "job perform method has tagging filters enabled by default" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add>
<add> boot_app
<add>
<add> comment = UserJob.new.perform_now
<add>
<add> assert_includes comment, "UserJob"
<add> end
<add>
<add> test "job perform method tagging filters can be disabled" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add> add_to_config "config.active_job.log_query_tags_around_perform = false"
<add>
<add> boot_app
<add>
<add> comment = UserJob.new.perform_now
<add>
<add> assert_not_includes comment, "UserJob"
<add> end
<add>
<add> test "query cache is cleared between requests" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add> add_to_config "config.active_record.cache_query_log_tags = true"
<add> add_to_config "config.active_record.query_log_tags = [ { dynamic: -> { context[:controller].dynamic_content } } ]"
<add>
<add> boot_app
<add>
<add> get "/"
<add>
<add> first_tags = last_response.body
<add>
<add> get "/"
<add>
<add> second_tags = last_response.body
<add>
<add> assert_not_equal first_tags, second_tags
<add> end
<add>
<add> test "query cache is cleared between job executions" do
<add> add_to_config "config.active_record.query_log_tags_enabled = true"
<add> add_to_config "config.active_record.cache_query_log_tags = true"
<add> add_to_config "config.active_record.query_log_tags = [ { dynamic: -> { context[:job].dynamic_content } } ]"
<add>
<add> boot_app
<add>
<add> first_tags = UserJob.new.perform_now
<add> second_tags = UserJob.new.perform_now
<add>
<add> assert_not_equal first_tags, second_tags
<add> end
<add>
<add> private
<add> def boot_app(env = "production")
<add> ENV["RAILS_ENV"] = env
<add>
<add> require "#{app_path}/config/environment"
<add> ensure
<add> ENV.delete "RAILS_ENV"
<add> end
<add> end
<add>end | 9 |
Ruby | Ruby | remove redundant require 'set' lines | bd6c03332ea4dea9be8444ae46cbe84df03f7bdc | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
<ide> require 'thread'
<ide> require 'thread_safe'
<ide> require 'monitor'
<del>require 'set'
<ide>
<ide> module ActiveRecord
<ide> # Raised when a connection could not be obtained within the connection
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
<ide> require 'date'
<del>require 'set'
<ide> require 'bigdecimal'
<ide> require 'bigdecimal/util'
<ide>
<ide><path>activerecord/lib/active_record/relation/merger.rb
<ide> require 'active_support/core_ext/hash/keys'
<del>require "set"
<ide>
<ide> module ActiveRecord
<ide> class Relation | 3 |
Python | Python | fix another flake8 warning | a9cced7aecfb7c49fe0f84c33b86744bba8f58b5 | <ide><path>django/views/generic/dates.py
<ide> def get_object(self, queryset=None):
<ide> raise Http404(_(
<ide> "Future %(verbose_name_plural)s not available because "
<ide> "%(class_name)s.allow_future is False.") % {
<del> 'verbose_name_plural': qs.model._meta.verbose_name_plural,
<del> 'class_name': self.__class__.__name__,
<add> 'verbose_name_plural': qs.model._meta.verbose_name_plural,
<add> 'class_name': self.__class__.__name__,
<ide> },
<ide> )
<ide> | 1 |
Text | Text | update modules.md wording | 3dd3a3cc203da477a91b75d682b00157b70b804b | <ide><path>doc/api/modules.md
<ide> folders as modules, and work for both `require` and `import`.
<ide>
<ide> If the module identifier passed to `require()` is not a
<ide> [core](#core-modules) module, and does not begin with `'/'`, `'../'`, or
<del>`'./'`, then Node.js starts at the parent directory of the current module, and
<add>`'./'`, then Node.js starts at the directory of the current module, and
<ide> adds `/node_modules`, and attempts to load the module from that location.
<ide> Node.js will not append `node_modules` to a path already ending in
<ide> `node_modules`. | 1 |
Javascript | Javascript | add runnable example | 636b3799b323d223bff900b2d0e8d255b58f7c8e | <ide><path>src/ng/filter.js
<ide> *
<ide> * @param {String} name Name of the filter function to retrieve
<ide> * @return {Function} the filter function
<del> */
<add> * @example
<add> <example name="$filter" module="filterExample">
<add> <file name="index.html">
<add> <div ng-controller="MainCtrl">
<add> <h3>{{ originalText }}</h3>
<add> <h3>{{ filteredText }}</h3>
<add> </div>
<add> </file>
<add>
<add> <file name="script.js">
<add> angular.module('filterExample', [])
<add> .controller('MainCtrl', function($scope, $filter) {
<add> $scope.originalText = 'hello';
<add> $scope.filteredText = $filter('uppercase')($scope.originalText);
<add> });
<add> </file>
<add> </example>
<add> */
<ide> $FilterProvider.$inject = ['$provide'];
<ide> function $FilterProvider($provide) {
<ide> var suffix = 'Filter'; | 1 |
PHP | PHP | fix a typo | 20b013220fc8346b73d403af5034b6ce1ee29c79 | <ide><path>src/Illuminate/Foundation/Auth/ThrottlesLogins.php
<ide> protected function sendLockoutResponse(Request $request)
<ide> throw ValidationException::withMessages([
<ide> $this->username() => [Lang::get('auth.throttle', [
<ide> 'seconds' => $seconds,
<del> 'minutes' => ceil($seconds * 60),
<add> 'minutes' => ceil($seconds / 60),
<ide> ])],
<ide> ])->status(Response::HTTP_TOO_MANY_REQUESTS);
<ide> } | 1 |
PHP | PHP | fix session.cookietimeout default behavior | 83a29f054e6b8482b9bdc4612931aad438c6c580 | <ide><path>lib/Cake/Model/Datasource/CakeSession.php
<ide> protected static function _defaultConfig($name) {
<ide> 'php' => array(
<ide> 'cookie' => 'CAKEPHP',
<ide> 'timeout' => 240,
<del> 'cookieTimeout' => 240,
<ide> 'ini' => array(
<ide> 'session.use_trans_sid' => 0,
<ide> 'session.cookie_path' => self::$path
<ide> protected static function _defaultConfig($name) {
<ide> 'cake' => array(
<ide> 'cookie' => 'CAKEPHP',
<ide> 'timeout' => 240,
<del> 'cookieTimeout' => 240,
<ide> 'ini' => array(
<ide> 'session.use_trans_sid' => 0,
<ide> 'url_rewriter.tags' => '',
<ide> protected static function _defaultConfig($name) {
<ide> 'cache' => array(
<ide> 'cookie' => 'CAKEPHP',
<ide> 'timeout' => 240,
<del> 'cookieTimeout' => 240,
<ide> 'ini' => array(
<ide> 'session.use_trans_sid' => 0,
<ide> 'url_rewriter.tags' => '',
<ide> protected static function _defaultConfig($name) {
<ide> 'database' => array(
<ide> 'cookie' => 'CAKEPHP',
<ide> 'timeout' => 240,
<del> 'cookieTimeout' => 240,
<ide> 'ini' => array(
<ide> 'session.use_trans_sid' => 0,
<ide> 'url_rewriter.tags' => '',
<ide><path>lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
<ide> App::uses('CakeSession', 'Model/Datasource');
<ide>
<ide> class TestCakeSession extends CakeSession {
<add>
<ide> public static function setUserAgent($value) {
<ide> self::$_userAgent = $value;
<ide> }
<ide>
<ide> public static function setHost($host) {
<ide> self::_setHost($host);
<ide> }
<add>
<ide> }
<ide>
<ide> /**
<ide> public function testSessionTimeout() {
<ide> $this->assertEquals(CakeSession::$time + $timeoutSeconds, $_SESSION['Config']['time']);
<ide> }
<ide>
<add>/**
<add> * Test that cookieTimeout matches timeout when unspecified.
<add> *
<add> * @return void
<add> */
<add> public function testCookieTimeoutFallback() {
<add> $_SESSION = null;
<add> Configure::write('Session', array(
<add> 'defaults' => 'php',
<add> 'timeout' => 400,
<add> ));
<add> TestCakeSession::start();
<add> $this->assertEquals(400, Configure::read('Session.cookieTimeout'));
<add> $this->assertEquals(400, Configure::read('Session.timeout'));
<add>
<add> $_SESSION = null;
<add> Configure::write('Session', array(
<add> 'defaults' => 'php',
<add> 'timeout' => 400,
<add> 'cookieTimeout' => 600
<add> ));
<add> TestCakeSession::start();
<add> $this->assertEquals(600, Configure::read('Session.cookieTimeout'));
<add> $this->assertEquals(400, Configure::read('Session.timeout'));
<add> }
<add>
<ide> } | 2 |
Ruby | Ruby | use array.wrap, remove unneeded returning block | 5f56d90085ea484b99e080c231c17ddc6cda71d1 | <ide><path>activesupport/lib/active_support/json/encoders/hash.rb
<ide> class Hash
<ide> def to_json(options = {}) #:nodoc:
<ide> hash_keys = self.keys
<ide>
<del> if options[:except]
<del> hash_keys = hash_keys - Array(options[:except])
<del> elsif options[:only]
<del> hash_keys = hash_keys & Array(options[:only])
<add> if except = options[:except]
<add> hash_keys = hash_keys - Array.wrap(except)
<add> elsif only = options[:only]
<add> hash_keys = hash_keys & Array.wrap(only)
<ide> end
<ide>
<del> returning result = '{' do
<del> result << hash_keys.map do |key|
<del> "#{ActiveSupport::JSON.encode(key.to_s)}: #{ActiveSupport::JSON.encode(self[key], options)}"
<del> end * ', '
<del> result << '}'
<del> end
<add> result = '{'
<add> result << hash_keys.map do |key|
<add> "#{ActiveSupport::JSON.encode(key.to_s)}: #{ActiveSupport::JSON.encode(self[key], options)}"
<add> end * ', '
<add> result << '}'
<ide> end
<ide> end | 1 |
Go | Go | add secret create and delete integration tests | e63dc5cde4c0dd52c3a54bb007259a4b8878b7df | <ide><path>integration-cli/daemon_swarm.go
<ide> func (d *SwarmDaemon) listServices(c *check.C) []swarm.Service {
<ide> return services
<ide> }
<ide>
<add>func (d *SwarmDaemon) createSecret(c *check.C, secretSpec swarm.SecretSpec) string {
<add> status, out, err := d.SockRequest("POST", "/secrets", secretSpec)
<add>
<add> c.Assert(err, checker.IsNil, check.Commentf(string(out)))
<add> c.Assert(status, checker.Equals, http.StatusCreated, check.Commentf("output: %q", string(out)))
<add>
<add> var scr types.SecretCreateResponse
<add> c.Assert(json.Unmarshal(out, &scr), checker.IsNil)
<add> return scr.ID
<add>}
<add>
<ide> func (d *SwarmDaemon) listSecrets(c *check.C) []swarm.Secret {
<ide> status, out, err := d.SockRequest("GET", "/secrets", nil)
<ide> c.Assert(err, checker.IsNil, check.Commentf(string(out)))
<ide> func (d *SwarmDaemon) listSecrets(c *check.C) []swarm.Secret {
<ide> return secrets
<ide> }
<ide>
<add>func (d *SwarmDaemon) getSecret(c *check.C, id string) *swarm.Secret {
<add> var secret swarm.Secret
<add> status, out, err := d.SockRequest("GET", "/secrets/"+id, nil)
<add> c.Assert(err, checker.IsNil, check.Commentf(string(out)))
<add> c.Assert(status, checker.Equals, http.StatusOK, check.Commentf("output: %q", string(out)))
<add> c.Assert(json.Unmarshal(out, &secret), checker.IsNil)
<add> return &secret
<add>}
<add>
<add>func (d *SwarmDaemon) deleteSecret(c *check.C, id string) {
<add> status, out, err := d.SockRequest("DELETE", "/secrets/"+id, nil)
<add> c.Assert(err, checker.IsNil, check.Commentf(string(out)))
<add> c.Assert(status, checker.Equals, http.StatusOK, check.Commentf("output: %q", string(out)))
<add>}
<add>
<ide> func (d *SwarmDaemon) getSwarm(c *check.C) swarm.Swarm {
<ide> var sw swarm.Swarm
<ide> status, out, err := d.SockRequest("GET", "/swarm", nil)
<ide><path>integration-cli/docker_api_swarm_test.go
<ide> func (s *DockerSwarmSuite) TestAPISwarmSecretsEmptyList(c *check.C) {
<ide> c.Assert(secrets, checker.NotNil)
<ide> c.Assert(len(secrets), checker.Equals, 0, check.Commentf("secrets: %#v", secrets))
<ide> }
<add>
<add>func (s *DockerSwarmSuite) TestAPISwarmSecretsCreate(c *check.C) {
<add> d := s.AddDaemon(c, true, true)
<add>
<add> testName := "test_secret"
<add> id := d.createSecret(c, swarm.SecretSpec{
<add> swarm.Annotations{
<add> Name: testName,
<add> },
<add> []byte("TESTINGDATA"),
<add> })
<add> c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
<add>
<add> secrets := d.listSecrets(c)
<add> c.Assert(len(secrets), checker.Equals, 1, check.Commentf("secrets: %#v", secrets))
<add> name := secrets[0].Spec.Annotations.Name
<add> c.Assert(name, checker.Equals, testName, check.Commentf("secret: %s", name))
<add>}
<add>
<add>func (s *DockerSwarmSuite) TestAPISwarmSecretsDelete(c *check.C) {
<add> d := s.AddDaemon(c, true, true)
<add>
<add> testName := "test_secret"
<add> id := d.createSecret(c, swarm.SecretSpec{
<add> swarm.Annotations{
<add> Name: testName,
<add> },
<add> []byte("TESTINGDATA"),
<add> })
<add> c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
<add>
<add> secret := d.getSecret(c, id)
<add> c.Assert(secret.ID, checker.Equals, id, check.Commentf("secret: %v", secret))
<add>
<add> d.deleteSecret(c, secret.ID)
<add> status, out, err := d.SockRequest("GET", "/secrets/"+id, nil)
<add> c.Assert(err, checker.IsNil)
<add> c.Assert(status, checker.Equals, http.StatusNotFound, check.Commentf("secret delete: %s", string(out)))
<add>} | 2 |
Ruby | Ruby | simplify handling of slow checks | bcedfe64e8ca64e092ca72c3f61fe164c28c8af5 | <ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def doctor
<ide> checks.inject_dump_stats! if ARGV.switch? "D"
<ide>
<ide> if ARGV.named.empty?
<del> methods = checks.all.sort
<del> methods << "check_for_linked_keg_only_brews" << "check_for_outdated_homebrew"
<del> methods = methods.reverse.uniq.reverse
<add> slow_checks = %w[
<add> check_for_broken_symlinks
<add> check_missing_deps
<add> check_for_outdated_homebrew
<add> check_for_linked_keg_only_brews
<add> ]
<add> methods = (checks.all.sort - slow_checks) + slow_checks
<ide> else
<ide> methods = ARGV.named
<ide> end | 1 |
Text | Text | add v3.1.0-beta.2 to changelog | 455c4c44410f55c2d77258934d903dcd3328782e | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.1.0-beta.2 (February 19, 2018)
<add>
<add>- [#13355](https://github.com/emberjs/ember.js/pull/13355) [BUGFIX] Fix issue with `Ember.trySet` on destroyed objects.
<add>- [#16245](https://github.com/emberjs/ember.js/pull/16245) [BUGFIX] Ensure errors in deferred component hooks can be recovered.
<add>- [#16246](https://github.com/emberjs/ember.js/pull/16246) [BUGFIX] computed.sort should not sort if sortProperties is empty
<add>
<ide> ### v3.1.0-beta.1 (February 14, 2018)
<ide>
<ide> - [emberjs/rfcs#276](https://github.com/emberjs/rfcs/blob/master/text/0276-named-args.md) [FEATURE named-args] enabled by default. | 1 |
Python | Python | remove unnecessary compiler flags (see #237) | ed3ebf9e43ba701b3140009324fbceca5c9bccaa | <ide><path>setup.py
<ide> link_options = {'msvc' : [],
<ide> 'other' : []}
<ide>
<del>if sys.platform.startswith('darwin'):
<del> compile_options['other'].append('-mmacosx-version-min=10.8')
<del> compile_options['other'].append('-stdlib=libc++')
<del> link_options['other'].append('-lc++')
<del>
<del>
<ide> class build_ext_options:
<ide> def build_options(self):
<ide> for e in self.extensions: | 1 |
Javascript | Javascript | make mkdir() default to 0777 permissions | 11d68eb3fc3c2f8d377cf8c50f1babb8d1f82d5f | <ide><path>lib/fs.js
<ide> fs.fsyncSync = function(fd) {
<ide> };
<ide>
<ide> fs.mkdir = function(path, mode, callback) {
<del> binding.mkdir(path, modeNum(mode), callback || noop);
<add> binding.mkdir(path, modeNum(mode, 511 /*=0777*/), callback || noop);
<ide> };
<ide>
<ide> fs.mkdirSync = function(path, mode) {
<del> return binding.mkdir(path, modeNum(mode));
<add> return binding.mkdir(path, modeNum(mode, 511 /*=0777*/));
<ide> };
<ide>
<ide> fs.sendfile = function(outFd, inFd, inOffset, length, callback) { | 1 |
Python | Python | update axis parameter for np.ma.{min,max} | c86ebe0d343c5af9d210658a1be6115ce04feb6f | <ide><path>numpy/ma/core.py
<ide> def min(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue):
<ide>
<ide> Parameters
<ide> ----------
<del> axis : {None, int}, optional
<add> axis : None or int or tuple of ints, optional
<ide> Axis along which to operate. By default, ``axis`` is None and the
<ide> flattened input is used.
<add> .. versionadded:: 1.7.0
<add> If this is a tuple of ints, the minimum is selected over multiple
<add> axes, instead of a single axis or all the axes as before.
<ide> out : array_like, optional
<ide> Alternative output array in which to place the result. Must be of
<ide> the same shape and buffer length as the expected output.
<ide> def max(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue):
<ide>
<ide> Parameters
<ide> ----------
<del> axis : {None, int}, optional
<add> axis : None or int or tuple of ints, optional
<ide> Axis along which to operate. By default, ``axis`` is None and the
<ide> flattened input is used.
<add> .. versionadded:: 1.7.0
<add> If this is a tuple of ints, the maximum is selected over multiple
<add> axes, instead of a single axis or all the axes as before.
<ide> out : array_like, optional
<ide> Alternative output array in which to place the result. Must
<ide> be of the same shape and buffer length as the expected output. | 1 |
Javascript | Javascript | add usage info to ember-utils entry point | 9cbda8f9ad059a98f08faf72f0df1468963eeb49 | <ide><path>packages/ember-utils/lib/index.js
<add>/*
<add> This package will be eagerly parsed and should have no dependencies on external
<add> packages.
<add>
<add> It is intended to be used to share utility methods that will be needed
<add> by every Ember application (and is **not** a dumping ground of useful utilities).
<add>
<add> Utility methods that are needed in < 80% of cases should be placed
<add> elsewhere (so they can be lazily evaluated / parsed).
<add>*/
<ide> export { default as symbol } from './symbol';
<ide> export { getOwner, setOwner, OWNER } from './owner';
<ide> export { default as assign } from './assign'; | 1 |
Text | Text | update http urls to https in contributing.md | de3bb8f84386e9090602e4a276ad8a8686223380 | <ide><path>CONTRIBUTING.md
<ide> In case of doubt, open an issue in the
<ide> [issue tracker](https://github.com/nodejs/node/issues/) or contact one of the
<ide> [project Collaborators](https://github.com/nodejs/node/#current-project-team-members).
<ide> Node.js has two IRC channels:
<del>[#Node.js](http://webchat.freenode.net/?channels=node.js) for general help and
<add>[#Node.js](https://webchat.freenode.net/?channels=node.js) for general help and
<ide> questions, and
<del>[#Node-dev](http://webchat.freenode.net/?channels=node-dev) for development of
<add>[#Node-dev](https://webchat.freenode.net/?channels=node-dev) for development of
<ide> Node.js core specifically.
<ide>
<ide> ### Setting up your local environment | 1 |
Text | Text | move [email protected] to emeritus | ee7ee6e14e5f9b1153a0113f525a52cba79b109f | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Juan José Arboleda** <[email protected]> (he/him)
<ide> * [JungMinu](https://github.com/JungMinu) -
<ide> **Minwoo Jung** <[email protected]> (he/him)
<del>* [lance](https://github.com/lance) -
<del>**Lance Ball** <[email protected]> (he/him)
<ide> * [legendecas](https://github.com/legendecas) -
<ide> **Chengzhong Wu** <[email protected]> (he/him)
<ide> * [Leko](https://github.com/Leko) -
<ide> For information about the governance of the Node.js project, see
<ide> **Kyle Farnung** <[email protected]> (he/him)
<ide> * [kunalspathak](https://github.com/kunalspathak) -
<ide> **Kunal Pathak** <[email protected]>
<add>* [lance](https://github.com/lance) -
<add>**Lance Ball** <[email protected]> (he/him)
<ide> * [lucamaraschi](https://github.com/lucamaraschi) -
<ide> **Luca Maraschi** <[email protected]> (he/him)
<ide> * [lxe](https://github.com/lxe) - | 1 |
Python | Python | restore previous behavior on subclasses | 4bed228adba88f9c5b85eaad308582db79a95b7b | <ide><path>numpy/core/numeric.py
<ide> def normalize_axis_tuple(axis, ndim, argname=None, allow_duplicate=False):
<ide> --------
<ide> normalize_axis_index : normalizing a single scalar axis
<ide> """
<del> # Speed-up most common cases.
<del> if not isinstance(axis, (list, tuple)):
<add> # Optimization to speed-up the most common cases.
<add> if type(axis) not in (tuple, list):
<ide> try:
<ide> axis = [operator.index(axis)]
<ide> except TypeError: | 1 |
Text | Text | fix nits in writing-tests.md | 4e9dc31817498ae03fcf7c2136d5d69b863a135c | <ide><path>doc/guides/writing-tests.md
<ide> assert.throws(
<ide>
<ide> Output written by tests to stdout or stderr, such as with `console.log()` or
<ide> `console.error()`, can be useful when writing tests, as well as for debugging
<del>them during later maintenance. The output will be supressed by the test runner
<add>them during later maintenance. The output will be suppressed by the test runner
<ide> (`./tools/test.py`) unless the test fails, but will always be displayed when
<ide> running tests directly with `node`. For failing tests, the test runner will
<ide> include the output along with the failed test assertion in the test report.
<ide>
<ide> Some output can help debugging by giving context to test failures. For example,
<ide> when troubleshooting tests that timeout in CI. With no log statements, we have
<del>no idea where the test got hung up. There have been cases where tests fail
<del>without `console.log()`, and then pass when its added, so be cautious about its
<del>use, particularly in tests of the I/O and streaming APIs.
<add>no idea where the test got hung up.
<add>
<add>There have been cases where tests fail without `console.log()`, and then pass
<add>when its added, so be cautious about its use, particularly in tests of the I/O
<add>and streaming APIs.
<ide>
<ide> Excessive use of console output is discouraged as it can overwhelm the display,
<del>including the Jenkins console and test report displays. Be particularly
<add>including the Jenkins console and test report displays. Be particularly
<ide> cautious of output in loops, or other contexts where output may be repeated many
<ide> times in the case of failure.
<ide> | 1 |
Javascript | Javascript | remove special test entries" | 7cfbc9f90f3109feaeb9db5df9d4d692a62178ef | <ide><path>benchmark/assert/deepequal-buffer.js
<ide> const bench = common.createBenchmark(main, {
<ide> n: [2e4],
<ide> len: [1e2, 1e3],
<ide> strict: [0, 1],
<del> method: ['deepEqual', 'notDeepEqual'],
<add> method: [ 'deepEqual', 'notDeepEqual' ],
<ide> });
<ide>
<ide> function main({ len, n, method, strict }) {
<add> if (!method)
<add> method = 'deepEqual';
<ide> const data = Buffer.allocUnsafe(len + 1);
<ide> const actual = Buffer.alloc(len);
<ide> const expected = Buffer.alloc(len);
<ide><path>benchmark/assert/deepequal-map.js
<ide> function main({ n, len, method, strict }) {
<ide> const array = Array(len).fill(1);
<ide>
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'deepEqual_primitiveOnly': {
<ide> const values = array.map((_, i) => [`str_${i}`, 123]);
<ide> benchmark(strict ? deepStrictEqual : deepEqual, n, values);
<ide><path>benchmark/assert/deepequal-object.js
<ide> const bench = common.createBenchmark(main, {
<ide> n: [5e3],
<ide> size: [1e2, 1e3, 5e4],
<ide> strict: [0, 1],
<del> method: ['deepEqual', 'notDeepEqual'],
<add> method: [ 'deepEqual', 'notDeepEqual' ],
<ide> });
<ide>
<ide> function createObj(source, add = '') {
<ide> function main({ size, n, method, strict }) {
<ide> // TODO: Fix this "hack". `n` should not be manipulated.
<ide> n = Math.min(Math.ceil(n / size), 20);
<ide>
<add> if (!method)
<add> method = 'deepEqual';
<add>
<ide> const source = Array.apply(null, Array(size));
<ide> const actual = createObj(source);
<ide> const expected = createObj(source);
<ide><path>benchmark/assert/deepequal-prims-and-objs-big-array-set.js
<ide> function main({ n, len, primitive, method, strict }) {
<ide> const expectedWrongSet = new Set(expectedWrong);
<ide>
<ide> switch (method) {
<add> // Empty string falls through to next line as default, mostly for tests.
<add> case '':
<ide> case 'deepEqual_Array':
<ide> run(strict ? deepStrictEqual : deepEqual, n, actual, expected);
<ide> break;
<ide><path>benchmark/assert/deepequal-prims-and-objs-big-loop.js
<ide> const bench = common.createBenchmark(main, {
<ide> primitive: Object.keys(primValues),
<ide> n: [2e4],
<ide> strict: [0, 1],
<del> method: ['deepEqual', 'notDeepEqual'],
<add> method: [ 'deepEqual', 'notDeepEqual' ],
<ide> });
<ide>
<ide> function main({ n, primitive, method, strict }) {
<add> if (!method)
<add> method = 'deepEqual';
<ide> const prim = primValues[primitive];
<ide> const actual = prim;
<ide> const expected = prim;
<ide><path>benchmark/assert/deepequal-set.js
<ide> function main({ n, len, method, strict }) {
<ide> const array = Array(len).fill(1);
<ide>
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'deepEqual_primitiveOnly': {
<ide> const values = array.map((_, i) => `str_${i}`);
<ide> benchmark(strict ? deepStrictEqual : deepEqual, n, values);
<ide><path>benchmark/assert/deepequal-typedarrays.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ type, n, len, method, strict }) {
<add> if (!method)
<add> method = 'deepEqual';
<ide> const clazz = global[type];
<ide> const actual = new clazz(len);
<ide> const expected = new clazz(len);
<ide><path>benchmark/assert/throws.js
<ide> function main({ n, method }) {
<ide> const message = 'failure';
<ide>
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'doesNotThrow':
<ide> bench.start();
<ide> for (let i = 0; i < n; ++i) {
<ide><path>benchmark/buffers/buffer-bytelength.js
<ide> const chars = [
<ide>
<ide> function main({ n, len, encoding }) {
<ide> let strings = [];
<del> let results = [len * 16];
<add> let results = [ len * 16 ];
<ide> if (encoding === 'buffer') {
<del> strings = [Buffer.alloc(len * 16, 'a')];
<add> strings = [ Buffer.alloc(len * 16, 'a') ];
<ide> } else {
<ide> for (const string of chars) {
<ide> // Strings must be built differently, depending on encoding
<ide><path>benchmark/buffers/buffer-creation.js
<ide> const bench = common.createBenchmark(main, {
<ide> function main({ len, n, type }) {
<ide> let fn, i;
<ide> switch (type) {
<add> case '':
<ide> case 'fast-alloc':
<ide> fn = Buffer.alloc;
<ide> break;
<ide><path>benchmark/buffers/buffer-fill.js
<ide> function main({ n, type, size }) {
<ide> const buffer = Buffer.allocUnsafe(size);
<ide> const testFunction = new Function('b', `
<ide> for (var i = 0; i < ${n}; i++) {
<del> b.${type};
<add> b.${type || 'fill(0)'};
<ide> }
<ide> `);
<ide> bench.start();
<ide><path>benchmark/buffers/buffer-iterate.js
<ide> function main({ size, type, method, n }) {
<ide> Buffer.alloc(size) :
<ide> SlowBuffer(size).fill(0);
<ide>
<del> const fn = methods[method];
<add> const fn = methods[method || 'for'];
<ide>
<ide> bench.start();
<ide> fn(buffer, n);
<ide><path>benchmark/buffers/buffer-read-float.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ n, type, endian, value }) {
<add> type = type || 'Double';
<ide> const buff = Buffer.alloc(8);
<ide> const fn = `read${type}${endian}`;
<ide> const values = {
<ide><path>benchmark/buffers/buffer-read-with-byteLength.js
<ide> function main({ n, buf, type, byteLength }) {
<ide> const buff = buf === 'fast' ?
<ide> Buffer.alloc(8) :
<ide> require('buffer').SlowBuffer(8);
<del> const fn = `read${type}`;
<add> const fn = `read${type || 'IntBE'}`;
<ide>
<ide> buff.writeDoubleLE(0, 0);
<ide> bench.start();
<ide><path>benchmark/buffers/buffer-read.js
<ide> function main({ n, buf, type }) {
<ide> const buff = buf === 'fast' ?
<ide> Buffer.alloc(8) :
<ide> require('buffer').SlowBuffer(8);
<del> const fn = `read${type}`;
<add> const fn = `read${type || 'UInt8'}`;
<ide>
<ide> buff.writeDoubleLE(0, 0);
<ide> bench.start();
<ide><path>benchmark/buffers/buffer-swap.js
<ide> function genMethod(method) {
<ide>
<ide> function main({ method, len, n, aligned = 'true' }) {
<ide> const buf = createBuffer(len, aligned === 'true');
<del> const bufferSwap = genMethod(method);
<add> const bufferSwap = genMethod(method || 'swap16');
<ide>
<ide> bufferSwap(n, buf);
<ide> bench.start();
<ide><path>benchmark/buffers/buffer-write.js
<ide> function main({ n, buf, type }) {
<ide> const buff = buf === 'fast' ?
<ide> Buffer.alloc(8) :
<ide> require('buffer').SlowBuffer(8);
<del> const fn = `write${type}`;
<add> const fn = `write${type || 'UInt8'}`;
<ide>
<ide> if (!/\d/.test(fn))
<ide> benchSpecialInt(buff, fn, n);
<ide><path>benchmark/buffers/dataview-set.js
<ide> const mod = {
<ide> };
<ide>
<ide> function main({ n, type }) {
<add> type = type || 'Uint8';
<ide> const ab = new ArrayBuffer(8);
<ide> const dv = new DataView(ab, 0, 8);
<ide> const le = /LE$/.test(type);
<ide><path>benchmark/crypto/aes-gcm-throughput.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ n, len, cipher }) {
<add> // Default cipher for tests.
<add> if (cipher === '')
<add> cipher = 'aes-128-gcm';
<ide> const message = Buffer.alloc(len, 'b');
<ide> const key = crypto.randomBytes(keylen[cipher]);
<ide> const iv = crypto.randomBytes(12);
<ide><path>benchmark/crypto/cipher-stream.js
<ide> const common = require('../common.js');
<ide>
<ide> const bench = common.createBenchmark(main, {
<ide> writes: [500],
<del> cipher: ['AES192', 'AES256'],
<add> cipher: [ 'AES192', 'AES256' ],
<ide> type: ['asc', 'utf', 'buf'],
<ide> len: [2, 1024, 102400, 1024 * 1024],
<ide> api: ['legacy', 'stream']
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ api, cipher, type, len, writes }) {
<add> // Default cipher for tests.
<add> if (cipher === '')
<add> cipher = 'AES192';
<ide> if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
<ide> console.error('Crypto streams not available until v0.10');
<ide> // Use the legacy, just so that we can compare them.
<ide> function main({ api, cipher, type, len, writes }) {
<ide> alice.generateKeys();
<ide> bob.generateKeys();
<ide>
<add>
<ide> const pubEnc = /^v0\.[0-8]/.test(process.version) ? 'binary' : null;
<ide> const alice_secret = alice.computeSecret(bob.getPublicKey(), pubEnc, 'hex');
<ide> const bob_secret = bob.computeSecret(alice.getPublicKey(), pubEnc, 'hex');
<ide><path>benchmark/es/defaultparams-bench.js
<ide> function runDefaultParams(n) {
<ide>
<ide> function main({ n, method }) {
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'withoutdefaults':
<ide> runOldStyleDefaults(n);
<ide> break;
<ide><path>benchmark/es/destructuring-bench.js
<ide> function runSwapDestructured(n) {
<ide>
<ide> function main({ n, method }) {
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'swap':
<ide> runSwapManual(n);
<ide> break;
<ide><path>benchmark/es/destructuring-object-bench.js
<ide> function runDestructured(n) {
<ide>
<ide> function main({ n, method }) {
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'normal':
<ide> runNormal(n);
<ide> break;
<ide><path>benchmark/es/foreach-bench.js
<ide> function main({ n, count, method }) {
<ide> items[i] = i;
<ide>
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'for':
<ide> fn = useFor;
<ide> break;
<ide><path>benchmark/es/map-bench.js
<ide> function runMap(n) {
<ide>
<ide> function main({ n, method }) {
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'object':
<ide> runObject(n);
<ide> break;
<ide><path>benchmark/es/restparams-bench.js
<ide> function runUseArguments(n) {
<ide> function main({ n, method }) {
<ide> let fn;
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'copy':
<ide> fn = runCopyArguments;
<ide> break;
<ide><path>benchmark/es/spread-assign.js
<ide> function main({ n, context, count, rest, method }) {
<ide> let obj; // eslint-disable-line no-unused-vars
<ide>
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case '_extend':
<ide> bench.start();
<ide> for (let i = 0; i < n; i++)
<ide><path>benchmark/es/spread-bench.js
<ide> function main({ n, context, count, rest, method }) {
<ide> args[i] = i;
<ide>
<ide> switch (method) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'apply':
<ide> bench.start();
<ide> for (let i = 0; i < n; i++)
<ide><path>benchmark/es/string-concatenations.js
<ide> function main({ n, mode }) {
<ide> let string;
<ide>
<ide> switch (mode) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'multi-concat':
<ide> bench.start();
<ide> for (let i = 0; i < n; i++)
<ide><path>benchmark/es/string-repeat.js
<ide> function main({ n, size, encoding, mode }) {
<ide> let str;
<ide>
<ide> switch (mode) {
<add> case '':
<add> // Empty string falls through to next line as default, mostly for tests.
<ide> case 'Array':
<ide> bench.start();
<ide> for (let i = 0; i < n; i++)
<ide><path>benchmark/misc/arguments.js
<ide> function usingPredefined() {
<ide> function main({ n, method, args }) {
<ide> let fn;
<ide> switch (method) {
<add> // '' is a default case for tests
<add> case '':
<ide> case 'restAndSpread':
<ide> fn = usingRestAndSpread;
<ide> break;
<ide><path>benchmark/misc/getstringwidth.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ n, type }) {
<add> // Default value for testing purposes.
<add> type = type || 'ascii';
<ide> const { getStringWidth } = require('internal/util/inspect');
<ide>
<ide> const str = ({
<ide><path>benchmark/misc/object-property-bench.js
<ide> function runSymbol(n) {
<ide> function main({ n, method }) {
<ide>
<ide> switch (method) {
<add> // '' is a default case for tests
<add> case '':
<ide> case 'property':
<ide> runProperty(n);
<ide> break;
<ide><path>benchmark/misc/punycode.js
<ide> function runICU(n, val) {
<ide>
<ide> function main({ n, val, method }) {
<ide> switch (method) {
<add> // '' is a default case for tests
<add> case '':
<ide> case 'punycode':
<ide> runPunycode(n, val);
<ide> break;
<ide><path>benchmark/misc/trace.js
<ide> function main({ n, method }) {
<ide> } = common.binding('trace_events');
<ide>
<ide> switch (method) {
<add> case '':
<ide> case 'trace':
<ide> doTrace(n, trace);
<ide> break;
<ide><path>benchmark/misc/util-extend-vs-object-assign.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ n, type }) {
<add> // Default value for tests.
<add> if (type === '')
<add> type = 'extend';
<add>
<ide> let fn;
<ide> if (type === 'extend') {
<ide> fn = util._extend;
<ide><path>benchmark/url/url-format.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ type, n }) {
<del> const input = inputs[type];
<add> const input = inputs[type] || '';
<ide>
<ide> // Force-optimize url.format() so that the benchmark doesn't get
<ide> // disrupted by the optimizer kicking in halfway through.
<ide><path>benchmark/url/url-parse.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ type, n }) {
<del> const input = inputs[type];
<add> const input = inputs[type] || '';
<ide>
<ide> bench.start();
<ide> for (let i = 0; i < n; i += 1)
<ide><path>benchmark/util/format.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ n, type }) {
<del> const [first, second] = inputs[type];
<add> // For testing, if supplied with an empty type, default to string.
<add> const [first, second] = inputs[type || 'string'];
<ide>
<ide> bench.start();
<ide> for (let i = 0; i < n; i++) {
<ide><path>benchmark/util/inspect-array.js
<ide> function main({ n, len, type }) {
<ide> opts = { showHidden: true };
<ide> arr = arr.fill('denseArray');
<ide> break;
<add> // For testing, if supplied with an empty type, default to denseArray.
<add> case '':
<ide> case 'denseArray':
<ide> arr = arr.fill('denseArray');
<ide> break;
<ide><path>benchmark/util/type-check.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> function main({ type, argument, version, n }) {
<add> // For testing, if supplied with an empty type, default to ArrayBufferView.
<add> type = type || 'ArrayBufferView';
<add>
<ide> const util = common.binding('util');
<ide> const types = require('internal/util/types');
<ide> | 41 |
Javascript | Javascript | fix buck error | 4b6b71664ecdb9a7888bf45f46f673bcce613579 | <ide><path>Libraries/Components/MapView/MapView.js
<ide> var EdgeInsetsPropType = require('EdgeInsetsPropType');
<ide> var Image = require('Image');
<ide> var NativeMethodsMixin = require('NativeMethodsMixin');
<del>var PinColors = require('NativeModules').UIManager.RCTMap.Constants.PinColors;
<ide> var Platform = require('Platform');
<add>var RCTMapConstants = require('NativeModules').UIManager.RCTMap.Constants;
<ide> var React = require('React');
<ide> var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
<ide> var View = require('View');
<ide> var MapView = React.createClass({
<ide> * `annotation.tintColor` property. You are not obliged to use these,
<ide> * but they are useful for matching the standard iOS look and feel.
<ide> */
<add>let PinColors = RCTMapConstants && RCTMapConstants.PinColors;
<ide> MapView.PinColors = PinColors && {
<ide> RED: PinColors.RED,
<ide> GREEN: PinColors.GREEN, | 1 |
Javascript | Javascript | fix performanceobserver gc crash | afabd145d176ec49adafeecd6d820cf71783d3e0 | <ide><path>lib/internal/perf/observe.js
<ide> function maybeDecrementObserverCounts(entryTypes) {
<ide> if (observerType === NODE_PERFORMANCE_ENTRY_TYPE_GC &&
<ide> observerCounts[observerType] === 0) {
<ide> removeGarbageCollectionTracking();
<add> gcTrackingInstalled = false;
<ide> }
<ide> }
<ide> }
<ide><path>test/parallel/test-perf-gc-crash.js
<add>'use strict';
<add>
<add>require('../common');
<add>
<add>// Refers to https://github.com/nodejs/node/issues/39548
<add>
<add>// The test fails if this crashes. If it closes normally,
<add>// then all is good.
<add>
<add>const {
<add> PerformanceObserver,
<add>} = require('perf_hooks');
<add>
<add>// We don't actually care if the observer callback is called here.
<add>const gcObserver = new PerformanceObserver(() => {});
<add>
<add>gcObserver.observe({ entryTypes: ['gc'] });
<add>
<add>gcObserver.disconnect();
<add>
<add>const gcObserver2 = new PerformanceObserver(() => {});
<add>
<add>gcObserver2.observe({ entryTypes: ['gc'] });
<add>
<add>gcObserver2.disconnect(); | 2 |
Ruby | Ruby | add additional method signatures to strategies | f2bd39ccefd89a76c20c32b00fc6f3455885b6e0 | <ide><path>Library/Homebrew/livecheck/strategy.rb
<ide> module Strategy
<ide> # At present, this should only be called after tap strategies have been
<ide> # loaded, otherwise livecheck won't be able to use them.
<ide> # @return [Hash]
<add> sig { returns(T::Hash[Symbol, T.untyped]) }
<ide> def strategies
<ide> return @strategies if defined? @strategies
<ide>
<ide> def strategies
<ide> # @param symbol [Symbol] the strategy name in snake case as a `Symbol`
<ide> # (e.g. `:page_match`)
<ide> # @return [Strategy, nil]
<add> sig { params(symbol: T.nilable(Symbol)).returns(T.nilable(T.untyped)) }
<ide> def from_symbol(symbol)
<del> strategies[symbol]
<add> strategies[symbol] if symbol.present?
<ide> end
<ide>
<ide> # Returns an array of strategies that apply to the provided URL.
<ide> def from_symbol(symbol)
<ide> # @param regex_provided [Boolean] whether a regex is provided in the
<ide> # `livecheck` block
<ide> # @return [Array]
<del> def from_url(url, livecheck_strategy: nil, url_provided: nil, regex_provided: nil, block_provided: nil)
<add> sig {
<add> params(
<add> url: String,
<add> livecheck_strategy: T.nilable(Symbol),
<add> url_provided: T::Boolean,
<add> regex_provided: T::Boolean,
<add> block_provided: T::Boolean,
<add> ).returns(T::Array[T.untyped])
<add> }
<add> def from_url(url, livecheck_strategy: nil, url_provided: false, regex_provided: false, block_provided: false)
<ide> usable_strategies = strategies.values.select do |strategy|
<ide> if strategy == PageMatch
<ide> # Only treat the `PageMatch` strategy as usable if a regex is
<ide> def from_url(url, livecheck_strategy: nil, url_provided: nil, regex_provided: ni
<ide> end
<ide> end
<ide>
<add> sig { params(url: String).returns(T::Array[T::Hash[String, String]]) }
<ide> def self.page_headers(url)
<ide> headers = []
<ide>
<ide><path>Library/Homebrew/livecheck/strategy/apache.rb
<ide> class Apache
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/bitbucket.rb
<ide> class Bitbucket
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/cpan.rb
<ide> class Cpan
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/git.rb
<ide> def self.match?(url)
<ide> # @param url [String] the URL of the Git repository to check
<ide> # @param regex [Regexp] the regex to use for filtering tags
<ide> # @return [Hash]
<add> sig { params(url: String, regex: T.nilable(Regexp)).returns(T::Hash[Symbol, T.untyped]) }
<ide> def self.tag_info(url, regex = nil)
<ide> # Open3#capture3 is used here because we need to capture stderr
<ide> # output and handle it in an appropriate manner. Alternatives like
<ide><path>Library/Homebrew/livecheck/strategy/github_latest.rb
<ide> class GithubLatest
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/gnome.rb
<ide> class Gnome
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/gnu.rb
<ide> class Gnu
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url) && url.exclude?("savannah.")
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/hackage.rb
<ide> class Hackage
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/launchpad.rb
<ide> class Launchpad
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/npm.rb
<ide> class Npm
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/pypi.rb
<ide> class Pypi
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/sourceforge.rb
<ide> class Sourceforge
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end
<ide><path>Library/Homebrew/livecheck/strategy/xorg.rb
<ide> class Xorg
<ide> #
<ide> # @param url [String] the URL to match against
<ide> # @return [Boolean]
<add> sig { params(url: String).returns(T::Boolean) }
<ide> def self.match?(url)
<ide> URL_MATCH_REGEX.match?(url)
<ide> end | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.