content_type stringclasses 8
values | main_lang stringclasses 7
values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Ruby | Ruby | add mediatype comment | 725f2828b4ec27e43c4cc0086cc8b2894c91f7d2 | <ide><path>Library/Homebrew/github_packages.rb
<ide> def write_image_config(platform_hash, tar_sha256, blobs)
<ide>
<ide> def write_image_index(manifests, blobs, annotations)
<ide> image_index = {
<add> # Currently needed for correct multi-arch display in GitHub Packages UI
<ide> mediaType: "application/vnd.docker.distribution.manifest.list.v2+json",
<ide> schemaVersion: 2,
<ide> manifests: manifests, | 1 |
Java | Java | fix checkstyle violation | ffbecf1427019c3d407342df2fa5dc949da35d15 | <ide><path>spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java
<ide> public ReactiveTransactionManager getTransactionManager() {
<ide> public <T> Flux<T> execute(TransactionCallback<T> action) throws TransactionException {
<ide> return TransactionContextManager.currentContext().flatMapMany(context -> {
<ide> Mono<ReactiveTransaction> status = this.transactionManager.getReactiveTransaction(this.transactionDefinition);
<del> return status.flatMapMany(it -> {
<del> // This is an around advice: Invoke the next interceptor in the chain.
<del> // This will normally result in a target object being invoked.
<del> // Need re-wrapping of ReactiveTransaction until we get hold of the exception
<del> // through usingWhen.
<del> return Flux.usingWhen(Mono.just(it), action::doInTransaction,
<del> this.transactionManager::commit, s -> Mono.empty())
<del> .onErrorResume(ex -> rollbackOnException(it, ex).then(Mono.error(ex)));
<del> });
<add> // This is an around advice: Invoke the next interceptor in the chain.
<add> // This will normally result in a target object being invoked.
<add> // Need re-wrapping of ReactiveTransaction until we get hold of the exception
<add> // through usingWhen.
<add> return status.flatMapMany(it -> Flux.usingWhen(Mono.just(it), action::doInTransaction,
<add> this.transactionManager::commit, s -> Mono.empty())
<add> .onErrorResume(ex -> rollbackOnException(it, ex).then(Mono.error(ex))));
<ide> })
<ide> .subscriberContext(TransactionContextManager.getOrCreateContext())
<ide> .subscriberContext(TransactionContextManager.getOrCreateContextHolder()); | 1 |
Javascript | Javascript | remove requestanimationframe support. fixes | 2053d1c621e8ef65b79d6b339d7336c732ed1b82 | <ide><path>src/effects.js
<ide> var elemdisplay = {},
<ide> // opacity animations
<ide> [ "opacity" ]
<ide> ],
<del> fxNow,
<del> requestAnimationFrame = window.webkitRequestAnimationFrame ||
<del> window.mozRequestAnimationFrame ||
<del> window.oRequestAnimationFrame;
<add> fxNow;
<ide>
<ide> jQuery.fn.extend({
<ide> show: function( speed, easing, callback ) {
<ide> jQuery.fx.prototype = {
<ide> // Start an animation from one number to another
<ide> custom: function( from, to, unit ) {
<ide> var self = this,
<del> fx = jQuery.fx,
<del> raf;
<add> fx = jQuery.fx;
<ide>
<ide> this.startTime = fxNow || createFxNow();
<ide> this.start = from;
<ide> jQuery.fx.prototype = {
<ide> t.elem = this.elem;
<ide>
<ide> if ( t() && jQuery.timers.push(t) && !timerId ) {
<del> // Use requestAnimationFrame instead of setInterval if available
<del> if ( requestAnimationFrame ) {
<del> timerId = true;
<del> raf = function() {
<del> // When timerId gets set to null at any point, this stops
<del> if ( timerId ) {
<del> requestAnimationFrame( raf );
<del> fx.tick();
<del> }
<del> };
<del> requestAnimationFrame( raf );
<del> } else {
<del> timerId = setInterval( fx.tick, fx.interval );
<del> }
<add> timerId = setInterval( fx.tick, fx.interval );
<ide> }
<ide> },
<ide> | 1 |
Javascript | Javascript | rename the new reactperfanalysis to reactperf | 411fc9ca7d9c2660f4755bf54ad5c9ec316b56d2 | <ide><path>grunt/tasks/npm-react-addons.js
<ide> var addons = {
<ide> docs: 'two-way-binding-helpers',
<ide> },
<ide> Perf: {
<del> module: 'ReactPerfAnalysis',
<add> module: 'ReactPerf',
<ide> name: 'perf',
<ide> docs: 'perf',
<ide> },
<ide><path>src/addons/ReactWithAddons.js
<ide> React.addons = {
<ide> };
<ide>
<ide> if (__DEV__) {
<del> React.addons.Perf = require('ReactPerfAnalysis');
<add> React.addons.Perf = require('ReactPerf');
<ide> React.addons.TestUtils = require('ReactTestUtils');
<ide> }
<ide>
<add><path>src/isomorphic/ReactPerf.js
<del><path>src/isomorphic/ReactPerfAnalysis.js
<ide> * LICENSE file in the root directory of this source tree. An additional grant
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<del> * @providesModule ReactPerfAnalysis
<add> * @providesModule ReactPerf
<ide> */
<ide>
<ide> 'use strict'; | 3 |
Ruby | Ruby | decouple detect_stdlibs from env | e40b73521709189c7d95169ff88939179d45d665 | <ide><path>Library/Homebrew/build.rb
<ide> def install
<ide>
<ide> formula.install
<ide>
<del> stdlibs = detect_stdlibs
<add> stdlibs = detect_stdlibs(ENV.compiler)
<ide> Tab.create(formula, ENV.compiler, stdlibs.first, formula.build).write
<ide>
<ide> # Find and link metafiles
<ide> def install
<ide> end
<ide> end
<ide>
<del> def detect_stdlibs
<add> def detect_stdlibs(compiler)
<ide> keg = Keg.new(formula.prefix)
<del> CxxStdlib.check_compatibility(formula, deps, keg, ENV.compiler)
<add> CxxStdlib.check_compatibility(formula, deps, keg, compiler)
<ide>
<ide> # The stdlib recorded in the install receipt is used during dependency
<ide> # compatibility checks, so we only care about the stdlib that libraries | 1 |
Text | Text | fix mergefail in changelog | 27bcec28bfb7272aa2cbe107c10bdafd5ebc32c9 | <ide><path>activerecord/CHANGELOG.md
<ide> * Deprecated use of string argument as a configuration lookup in
<ide> `ActiveRecord::Base.establish_connection`. Instead, a symbol must be given.
<ide>
<del>* Deprecated use of string argument as a configuration lookup in `ActiveRecord::Base.establish_connection`. Instead, a symbol must be given.
<del>
<ide> *José Valim*
<ide>
<ide> * Fixed `update_column`, `update_columns`, and `update_all` to correctly serialize | 1 |
PHP | PHP | reduce complexity in timeagoinwords | 14bfd83dad2d060f67b52eeb9b553cda9add2dca | <ide><path>lib/Cake/Utility/CakeTime.php
<ide> public static function toRSS($dateString, $timezone = null) {
<ide> /**
<ide> * Returns either a relative date or a formatted date depending
<ide> * on the difference between the current time and given datetime.
<del> * $datetime should be in a <i>strtotime</i> - parsable format, like MySQL's datetime datatype.
<add> * $datetime should be in a *strtotime* - parsable format, like MySQL's datetime datatype.
<ide> *
<ide> * ### Options:
<ide> *
<ide> public static function toRSS($dateString, $timezone = null) {
<ide> * - minute => The format if minutes > 0 (default "minute")
<ide> * - second => The format if seconds > 0 (default "second")
<ide> * - `end` => The end of relative time telling
<del> * - `userOffset` => Users offset from GMT (in hours)
<del> * - `element` => A wrapping HTML element (array, default null)
<del> * - tag => The tag to wrap the time in (default "span")
<del> * - class => The CSS class to put on the wrapping element (default "timeAgoInWords")
<del> * - title => The title of the element (default null = the input date)
<add> * - `userOffset` => Users offset from GMT (in hours) *Deprecated* use timezone intead.
<add> * - `timezone` => The user timezone the timestamp should be formatted in.
<ide> *
<ide> * Relative dates look something like this:
<del> * 3 weeks, 4 days ago
<del> * 15 seconds ago
<add> *
<add> * - 3 weeks, 4 days ago
<add> * - 15 seconds ago
<ide> *
<ide> * Default date formatting is d/m/yy e.g: on 18/2/09
<ide> *
<ide> public static function timeAgoInWords($dateTime, $options = array()) {
<ide> list($past['H'], $past['i'], $past['s'], $past['d'], $past['m'], $past['Y']) = explode('/', date('H/i/s/d/m/Y', $pastTime));
<ide> $years = $months = $weeks = $days = $hours = $minutes = $seconds = 0;
<ide>
<del> if ($future['Y'] == $past['Y'] && $future['m'] == $past['m']) {
<del> $months = 0;
<del> $years = 0;
<del> } else {
<del> if ($future['Y'] == $past['Y']) {
<del> $months = $future['m'] - $past['m'];
<del> } else {
<del> $years = $future['Y'] - $past['Y'];
<del> $months = $future['m'] + ((12 * $years) - $past['m']);
<del>
<del> if ($months >= 12) {
<del> $years = floor($months / 12);
<del> $months = $months - ($years * 12);
<del> }
<add> $years = $future['Y'] - $past['Y'];
<add> $months = $future['m'] + ((12 * $years) - $past['m']);
<ide>
<del> if ($future['m'] < $past['m'] && $future['Y'] - $past['Y'] == 1) {
<del> $years--;
<del> }
<del> }
<add> if ($months >= 12) {
<add> $years = floor($months / 12);
<add> $months = $months - ($years * 12);
<add> }
<add> if ($future['m'] < $past['m'] && $future['Y'] - $past['Y'] == 1) {
<add> $years--;
<ide> }
<ide>
<ide> if ($future['d'] >= $past['d']) { | 1 |
Java | Java | use correct log level | e9dc5160b989a2b2df29cfc8bc2a48830c9d8a97 | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java
<ide> public void handleMessage(Message<?> message) throws MessagingException {
<ide> logger.debug("Terminating '" + session + "'", ex);
<ide> }
<ide> else if (logger.isWarnEnabled()) {
<del> logger.debug("Terminating '" + session + "': " + ex.getMessage());
<add> logger.warn("Terminating '" + session + "': " + ex.getMessage());
<ide> }
<ide> this.stats.incrementLimitExceededCount();
<ide> clearSession(session, ex.getStatus()); // clear first, session may be unresponsive | 1 |
Ruby | Ruby | remove incomplete filter runs all tests in plugins | be3d4c6ef65b3cda3242c19fd756ef3869f2deaf | <ide><path>railties/test/generators/plugin_test_runner_test.rb
<ide> def test_multiple_line_filters
<ide> end
<ide> end
<ide>
<del> def test_line_filter_without_line_runs_all_tests
<del> create_test_file 'account'
<del>
<del> run_test_command('test/account_test.rb:').tap do |output|
<del> assert_match 'AccountTest', output
<del> end
<del> end
<del>
<ide> def test_output_inline_by_default
<ide> create_test_file 'post', pass: false
<ide> | 1 |
Go | Go | add imagename to logevent tests | 7f9ba14b18e171589a82e8dd3bd084ece3405f83 | <ide><path>api_test.go
<ide> func TestGetEvents(t *testing.T) {
<ide> listeners: make(map[string]chan utils.JSONMessage),
<ide> }
<ide>
<del> srv.LogEvent("fakeaction", "fakeid")
<del> srv.LogEvent("fakeaction2", "fakeid")
<add> srv.LogEvent("fakeaction", "fakeid", "fakeimage")
<add> srv.LogEvent("fakeaction2", "fakeid", "fakeimage")
<ide>
<ide> req, err := http.NewRequest("GET", "/events?since=1", nil)
<ide> if err != nil {
<ide><path>server_test.go
<ide> func TestLogEvent(t *testing.T) {
<ide> listeners: make(map[string]chan utils.JSONMessage),
<ide> }
<ide>
<del> srv.LogEvent("fakeaction", "fakeid")
<add> srv.LogEvent("fakeaction", "fakeid", "fakeimage")
<ide>
<ide> listener := make(chan utils.JSONMessage)
<ide> srv.Lock()
<ide> srv.listeners["test"] = listener
<ide> srv.Unlock()
<ide>
<del> srv.LogEvent("fakeaction2", "fakeid")
<add> srv.LogEvent("fakeaction2", "fakeid", "fakeimage")
<ide>
<ide> if len(srv.events) != 2 {
<ide> t.Fatalf("Expected 2 events, found %d", len(srv.events))
<ide> }
<ide> go func() {
<ide> time.Sleep(200 * time.Millisecond)
<del> srv.LogEvent("fakeaction3", "fakeid")
<add> srv.LogEvent("fakeaction3", "fakeid", "fakeimage")
<ide> time.Sleep(200 * time.Millisecond)
<del> srv.LogEvent("fakeaction4", "fakeid")
<add> srv.LogEvent("fakeaction4", "fakeid", "fakeimage")
<ide> }()
<ide>
<ide> setTimeout(t, "Listening for events timed out", 2*time.Second, func() { | 2 |
Go | Go | use proper scheme with static registry | 44d54ba0c299540efbfa173bf484d541e857f4ac | <ide><path>registry/registry.go
<ide> import (
<ide> "encoding/json"
<ide> "errors"
<ide> "fmt"
<del> "github.com/dotcloud/docker/utils"
<ide> "io"
<ide> "io/ioutil"
<ide> "net"
<ide> import (
<ide> "strconv"
<ide> "strings"
<ide> "time"
<add>
<add> "github.com/dotcloud/docker/utils"
<ide> )
<ide>
<ide> var (
<ide> func (r *Registry) GetRepositoryData(remote string) (*RepositoryData, error) {
<ide> }
<ide> } else {
<ide> // Assume the endpoint is on the same host
<del> endpoints = append(endpoints, fmt.Sprintf("%s://%s/v1/", urlScheme, req.URL.Host))
<add> u, err := url.Parse(indexEp)
<add> if err != nil {
<add> return nil, err
<add> }
<add> endpoints = append(endpoints, fmt.Sprintf("%s://%s/v1/", u.Scheme, req.URL.Host))
<ide> }
<ide>
<ide> checksumsJSON, err := ioutil.ReadAll(res.Body) | 1 |
Go | Go | remove prefix dots from inspects in tests | 67058e388b596392f7aceb7ecd6b38f6f2ff2de1 | <ide><path>integration-cli/docker_cli_by_digest_test.go
<ide> func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C)
<ide> }
<ide> // just in case...
<ide>
<del> imageID, err := inspectField(imageReference, ".Id")
<add> imageID, err := inspectField(imageReference, "Id")
<ide> if err != nil {
<ide> c.Fatalf("error inspecting image id: %v", err)
<ide> }
<ide><path>integration-cli/docker_cli_restart_test.go
<ide> func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
<ide> c.Errorf("expect 1 volume received %s", out)
<ide> }
<ide>
<del> volumes, err := inspectField(cleanedContainerID, ".Volumes")
<add> volumes, err := inspectField(cleanedContainerID, "Volumes")
<ide> c.Assert(err, check.IsNil)
<ide>
<ide> runCmd = exec.Command(dockerBinary, "restart", cleanedContainerID)
<ide> func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
<ide> c.Errorf("expect 1 volume after restart received %s", out)
<ide> }
<ide>
<del> volumesAfterRestart, err := inspectField(cleanedContainerID, ".Volumes")
<add> volumesAfterRestart, err := inspectField(cleanedContainerID, "Volumes")
<ide> c.Assert(err, check.IsNil)
<ide>
<ide> if volumes != volumesAfterRestart { | 2 |
Go | Go | add hostconfig check for memoryswappiness | 19c7b65ea600ab77679c9506d762201264dd9a2a | <ide><path>daemon/daemon_unix.go
<ide> func (daemon *Daemon) verifyContainerSettings(hostConfig *runconfig.HostConfig,
<ide> if hostConfig.Memory == 0 && hostConfig.MemorySwap > 0 {
<ide> return warnings, fmt.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage.")
<ide> }
<add> if hostConfig.MemorySwappiness != -1 && !daemon.SystemConfig().MemorySwappiness {
<add> warnings = append(warnings, "Your kernel does not support memory swappiness capabilities, memory swappiness discarded.")
<add> logrus.Warnf("Your kernel does not support memory swappiness capabilities, memory swappiness discarded.")
<add> hostConfig.MemorySwappiness = -1
<add> }
<add> if hostConfig.MemorySwappiness != -1 && (hostConfig.MemorySwappiness < 0 || hostConfig.MemorySwappiness > 100) {
<add> return warnings, fmt.Errorf("Invalid value: %d, valid memory swappiness range is 0-100.", hostConfig.MemorySwappiness)
<add> }
<ide> if hostConfig.CpuPeriod > 0 && !daemon.SystemConfig().CpuCfsPeriod {
<ide> warnings = append(warnings, "Your kernel does not support CPU cfs period. Period discarded.")
<ide> logrus.Warnf("Your kernel does not support CPU cfs period. Period discarded.") | 1 |
Ruby | Ruby | add all_top_level_directories constant | 842d6ce8bdc2296869c41c5866bbf5f046ac6eb8 | <ide><path>Library/Homebrew/diagnostic.rb
<ide> def check_access_homebrew_repository
<ide> def check_access_prefix_directories
<ide> not_writable_dirs = []
<ide>
<del> extra_dirs = ["lib/pkgconfig", "share/locale", "share/man", "opt"]
<del> (Keg::TOP_LEVEL_DIRECTORIES + extra_dirs).each do |dir|
<add> Keg::ALL_TOP_LEVEL_DIRECTORIES.each do |dir|
<ide> path = HOMEBREW_PREFIX/dir
<ide> next unless path.exist?
<ide> next if path.writable_real?
<ide><path>Library/Homebrew/keg.rb
<ide> def to_s; <<-EOS.undent
<ide> LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
<ide> INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}
<ide> TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks]
<add> ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze
<ide> PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks LinkedKegs].map do |d|
<ide> case d when "LinkedKegs" then HOMEBREW_LIBRARY/d else HOMEBREW_PREFIX/d end
<ide> end | 2 |
Javascript | Javascript | fix a bug in tick guestimation | 3e8e4e30eb871e4399b0a0e35aad1f3991a95dff | <ide><path>d3.time.js
<ide> var d3_time_scaleSteps = [
<ide> 864e5, // 1-day
<ide> 1728e5, // 2-day
<ide> 6048e5, // 1-week
<del> 1728e6, // 1-month
<add> 2592e6, // 1-month
<ide> 7776e6, // 3-month
<ide> 31536e6 // 1-year
<ide> ];
<ide><path>d3.time.min.js
<del>(function(){function b(a,b,c,d){var e,f,g=0,i=b.length,j=c.length;while(g<i){if(d>=j)return-1;e=b.charCodeAt(g++);if(e==37){f=h[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function i(a,b,c){return b.substring(c,c+=3).toLowerCase()in j?c:-1}function k(a,b,c){l.lastIndex=0;var d=l.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function n(a,b,c){var d=o[b.substring(c,c+=3).toLowerCase()];return d==null?-1:(a.setMonth(d),c)}function p(a,b,c){q.lastIndex=0;var d=q.exec(b.substring(c,c+12));return d?(a.setMonth(r[d[0].toLowerCase()]),c+=d[0].length):-1}function t(a,c,d){return b(a,g.c.toString(),c,d)}function u(a,c,d){return b(a,g.x.toString(),c,d)}function v(a,c,d){return b(a,g.X.toString(),c,d)}function w(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+4));return d?(a.setFullYear(d[0]),c+=d[0].length):-1}function x(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setFullYear(y()+ +d[0]),c+=d[0].length):-1}function y(){return~~((new Date).getFullYear()/1e3)*1e3}function z(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setMonth(d[0]-1),c+=d[0].length):-1}function A(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setDate(+d[0]),c+=d[0].length):-1}function B(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setHours(+d[0]),c+=d[0].length):-1}function C(a,b,c){return a.hour12=!0,B(a,b,c)}function D(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setMinutes(+d[0]),c+=d[0].length):-1}function E(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setSeconds(+d[0]),c+=d[0].length):-1}function F(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+3));return d?(a.setMilliseconds(+d[0]),c+=d[0].length):-1}function H(a,b,c){var d=I[b.substring(c,c+=2).toLowerCase()];return d==null?-1:(a.hour12pm=d,c)}function J(b){return new a(b.getFullYear(),0,1)}function K(a,b){return~~((b-a)/864e5-(b.getTimezoneOffset()-a.getTimezoneOffset())/1440)}function L(a){return d(1+K(J(a),a))}function M(a){var b=J(a);return c(~~((K(b,a)+b.getDay())/7))}function N(a){var b=J(a);return c(~~((K(b,a)+(b.getDay()+6)%7)/7))}function O(a){var b=a.getTimezoneOffset(),d=b>0?"-":"+",e=~~(Math.abs(b)/60),f=Math.abs(b)%60;return d+c(e)+c(f)}function P(){this._=new Date(Date.UTC.apply(this,arguments))}function R(a){return a.toISOString()}function S(a,b,c){return function(d,e,f){var g=a(d),h=[];g<d&&b(g);if(f>1)while(g<e){var i=new Date(+g);c(i)%f||h.push(i),b(g)}else while(g<e)h.push(new Date(+g)),b(g);return h}}function T(a){a.setTime(a.getTime()+6e4)}function U(a){a.setTime(a.getTime()+36e5)}function V(a,b,c){function d(b){return a(b)}return d.invert=function(b){return X(a.invert(b))},d.domain=function(b){return arguments.length?(a.domain(b),d):a.domain().map(X)},d.ticks=function(a,c){var e=W(d.domain());if(typeof a!="function"){var f=e[1]-e[0],g=f/a,h=d3.bisect(Z,g,1,Z.length-1);Math.log(g/Z[h-1])<Math.log(Z[h]/g)&&--h,a=b[h],c=a[1],a=a[0]}return a(e[0],e[1],c)},d.tickFormat=function(){return c},d.copy=function(){return V(a.copy(),b,c)},d3.rebind(d,a,"range","rangeRound","interpolate","clamp")}function W(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function X(a){return new Date(a)}function Y(a){return function(b){var c=a.length-1,d=a[c];while(!d[1](b))d=a[--c];return d[0](b)}}d3.time={};var a=Date;d3.time.format=function(c){function e(a){var b=[],e=-1,f=0,h,i;while(++e<d)c.charCodeAt(e)==37&&(b.push(c.substring(f,e),(i=g[h=c.charAt(++e)])?i(a):h),f=e+1);return b.push(c.substring(f,e)),b.join("")}var d=c.length;return e.parse=function(d){var e=new a(1900,0,1),f=b(e,c,d,0);if(f!=d.length)return null;if(e.hour12){var g=e.getHours()%12;e.setHours(e.hour12pm?g+12:g)}return delete e.hour12,delete e.hour12pm,e},e.toString=function(){return c},e};var c=d3.format("02d"),d=d3.format("03d"),e=d3.format("04d"),f=d3.format("2d"),g={a:function(a){return m[a.getDay()].substring(0,3)},A:function(a){return m[a.getDay()]},b:function(a){return s[a.getMonth()].substring(0,3)},B:function(a){return s[a.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(a){return c(a.getDate())},e:function(a){return f(a.getDate())},H:function(a){return c(a.getHours())},I:function(a){return c(a.getHours()%12||12)},j:L,L:function(a){return d(a.getMilliseconds())},m:function(a){return c(a.getMonth()+1)},M:function(a){return c(a.getMinutes())},p:function(a){return a.getHours()>=12?"PM":"AM"},S:function(a){return c(a.getSeconds())},U:M,w:function(a){return a.getDay()},W:N,x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(a){return c(a.getFullYear()%100)},Y:function(a){return e(a.getFullYear()%1e4)},Z:O,"%":function(a){return"%"}},h={a:i,A:k,b:n,B:p,c:t,d:A,e:A,H:B,I:C,L:F,m:z,M:D,p:H,S:E,x:u,X:v,y:x,Y:w},j={sun:3,mon:3,tue:3,wed:3,thu:3,fri:3,sat:3},l=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig,m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},q=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig,r={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},s=["January","February","March","April","May","June","July","August","September","October","November","December"],G=/\s*\d+/,I={am:0,pm:1};d3.time.format.utc=function(b){function d(b){try{a=P;var d=new a;return d._=b,c(d)}finally{a=Date}}var c=d3.time.format(b);return d.parse=function(b){try{a=P;var d=c.parse(b);return d&&d._}finally{a=Date}},d.toString=c.toString,d},P.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.getTime()},setDate:function(a){this._.setUTCDate(a)},setDay:function(a){this._.setUTCDay(a)},setFullYear:function(a){this._.setUTCFullYear(a)},setHours:function(a){this._.setUTCHours(a)},setMilliseconds:function(a){this._.setUTCMilliseconds(a)},setMinutes:function(a){this._.setUTCMinutes(a)},setMonth:function(a){this._.setUTCMonth(a)},setSeconds:function(a){this._.setUTCSeconds(a)}};var Q=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?R:Q,R.parse=function(a){return new Date(a)},R.toString=Q.toString,d3.time.second=function(a){return new Date(~~(a/1e3)*1e3)},d3.time.second.utc=d3.time.second,d3.time.seconds=S(d3.time.second,function(a){a.setTime(a.getTime()+1e3)},function(a){return a.getSeconds()}),d3.time.seconds.utc=d3.time.seconds,d3.time.minute=function(a){return new Date(~~(a/6e4)*6e4)},d3.time.minute.utc=d3.time.minute,d3.time.minutes=S(d3.time.minute,T,function(a){return a.getMinutes()}),d3.time.minutes.utc=S(d3.time.minute,T,function(a){return a.getUTCMinutes()}),d3.time.hour=function(a){var b=a.getTimezoneOffset()/60;return new Date((~~(a/36e5-b)+b)*36e5)},d3.time.hour.utc=function(a){return new Date(~~(a/36e5)*36e5)},d3.time.hours=S(d3.time.hour,U,function(a){return a.getHours()}),d3.time.hours.utc=S(d3.time.hour.utc,U,function(a){return a.getUTCHours()}),d3.time.day=function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},d3.time.day.utc=function(a){return new Date(~~(a/864e5)*864e5)},d3.time.days=S(d3.time.day,function(a){a.setDate(a.getDate()+1)},function(a){return a.getDate()-1}),d3.time.days.utc=S(d3.time.day.utc,function(a){a.setUTCDate(a.getUTCDate()+1)},function(a){return a.getUTCDate()-1}),d3.time.week=function(a){return(a=d3.time.day(a)).setDate(a.getDate()-a.getDay()),a},d3.time.week.utc=function(a){return(a=d3.time.day.utc(a)).setUTCDate(a.getUTCDate()-a.getUTCDay()),a},d3.time.weeks=S(d3.time.week,function(a){a.setDate(a.getDate()+7)},function(a){return~~((a-new Date(a.getFullYear(),0,1))/6048e5)}),d3.time.weeks.utc=S(d3.time.week.utc,function(a){a.setUTCDate(a.getUTCDate()+7)},function(a){return~~((a-Date.UTC(a.getUTCFullYear(),0,1))/6048e5)}),d3.time.month=function(a){return new Date(a.getFullYear(),a.getMonth(),1)},d3.time.month.utc=function(a){return new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1))},d3.time.months=S(d3.time.month,function(a){a.setMonth(a.getMonth()+1)},function(a){return a.getMonth()}),d3.time.months.utc=S(d3.time.month.utc,function(a){a.setUTCMonth(a.getUTCMonth()+1)},function(a){return a.getUTCMonth()}),d3.time.year=function(a){return new Date(a.getFullYear(),0,1)},d3.time.year.utc=function(a){return new Date(Date.UTC(a.getUTCFullYear(),0,1))},d3.time.years=S(d3.time.year,function(a){a.setFullYear(a.getFullYear()+1)},function(a){return a.getFullYear()}),d3.time.years.utc=S(d3.time.year.utc,function(a){a.setUTCFullYear(a.getUTCFullYear()+1)},function(a){return a.getUTCFullYear()});var Z=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,1728e6,7776e6,31536e6],$=[[d3.time.seconds,1],[d3.time.seconds,5],[d3.time.seconds,15],[d3.time.seconds,30],[d3.time.minutes,1],[d3.time.minutes,5],[d3.time.minutes,15],[d3.time.minutes,30],[d3.time.hours,1],[d3.time.hours,3],[d3.time.hours,6],[d3.time.hours,12],[d3.time.days,1],[d3.time.days,2],[d3.time.weeks,1],[d3.time.months,1],[d3.time.months,3],[d3.time.years,1]],_=[[d3.time.format("%Y"),function(a){return!0}],[d3.time.format("%B"),function(a){return a.getMonth()}],[d3.time.format("%b %d"),function(a){return a.getDate()!=1}],[d3.time.format("%a %d"),function(a){return a.getDay()&&a.getDate()!=1}],[d3.time.format("%I %p"),function(a){return a.getHours()}],[d3.time.format("%I:%M"),function(a){return a.getMinutes()}],[d3.time.format(":%S"),function(a){return a.getSeconds()||a.getMilliseconds()}]],ba=Y(_);d3.time.scale=function(){return V(d3.scale.linear(),$,ba)};var bb=[[d3.time.seconds.utc,1],[d3.time.seconds.utc,5],[d3.time.seconds.utc,15],[d3.time.seconds.utc,30],[d3.time.minutes.utc,1],[d3.time.minutes.utc,5],[d3.time.minutes.utc,15],[d3.time.minutes.utc,30],[d3.time.hours.utc,1],[d3.time.hours.utc,3],[d3.time.hours.utc,6],[d3.time.hours.utc,12],[d3.time.days.utc,1],[d3.time.days.utc,2],[d3.time.weeks.utc,1],[d3.time.months.utc,1],[d3.time.months.utc,3],[d3.time.years.utc,1]],bc=[[d3.time.format.utc("%Y"),function(a){return!0}],[d3.time.format.utc("%B"),function(a){return a.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(a){return a.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(a){return a.getUTCDay()&&a.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(a){return a.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(a){return a.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(a){return a.getUTCSeconds()||a.getUTCMilliseconds()}]],bd=Y(bc);d3.time.scale.utc=function(){return V(d3.scale.linear(),bb,bd)}})();
<ide>\ No newline at end of file
<add>(function(){function b(a,b,c,d){var e,f,g=0,i=b.length,j=c.length;while(g<i){if(d>=j)return-1;e=b.charCodeAt(g++);if(e==37){f=h[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function i(a,b,c){return b.substring(c,c+=3).toLowerCase()in j?c:-1}function k(a,b,c){l.lastIndex=0;var d=l.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function n(a,b,c){var d=o[b.substring(c,c+=3).toLowerCase()];return d==null?-1:(a.setMonth(d),c)}function p(a,b,c){q.lastIndex=0;var d=q.exec(b.substring(c,c+12));return d?(a.setMonth(r[d[0].toLowerCase()]),c+=d[0].length):-1}function t(a,c,d){return b(a,g.c.toString(),c,d)}function u(a,c,d){return b(a,g.x.toString(),c,d)}function v(a,c,d){return b(a,g.X.toString(),c,d)}function w(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+4));return d?(a.setFullYear(d[0]),c+=d[0].length):-1}function x(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setFullYear(y()+ +d[0]),c+=d[0].length):-1}function y(){return~~((new Date).getFullYear()/1e3)*1e3}function z(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setMonth(d[0]-1),c+=d[0].length):-1}function A(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setDate(+d[0]),c+=d[0].length):-1}function B(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setHours(+d[0]),c+=d[0].length):-1}function C(a,b,c){return a.hour12=!0,B(a,b,c)}function D(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setMinutes(+d[0]),c+=d[0].length):-1}function E(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+2));return d?(a.setSeconds(+d[0]),c+=d[0].length):-1}function F(a,b,c){G.lastIndex=0;var d=G.exec(b.substring(c,c+3));return d?(a.setMilliseconds(+d[0]),c+=d[0].length):-1}function H(a,b,c){var d=I[b.substring(c,c+=2).toLowerCase()];return d==null?-1:(a.hour12pm=d,c)}function J(b){return new a(b.getFullYear(),0,1)}function K(a,b){return~~((b-a)/864e5-(b.getTimezoneOffset()-a.getTimezoneOffset())/1440)}function L(a){return d(1+K(J(a),a))}function M(a){var b=J(a);return c(~~((K(b,a)+b.getDay())/7))}function N(a){var b=J(a);return c(~~((K(b,a)+(b.getDay()+6)%7)/7))}function O(a){var b=a.getTimezoneOffset(),d=b>0?"-":"+",e=~~(Math.abs(b)/60),f=Math.abs(b)%60;return d+c(e)+c(f)}function P(){this._=new Date(Date.UTC.apply(this,arguments))}function R(a){return a.toISOString()}function S(a,b,c){return function(d,e,f){var g=a(d),h=[];g<d&&b(g);if(f>1)while(g<e){var i=new Date(+g);c(i)%f||h.push(i),b(g)}else while(g<e)h.push(new Date(+g)),b(g);return h}}function T(a){a.setTime(a.getTime()+6e4)}function U(a){a.setTime(a.getTime()+36e5)}function V(a,b,c){function d(b){return a(b)}return d.invert=function(b){return X(a.invert(b))},d.domain=function(b){return arguments.length?(a.domain(b),d):a.domain().map(X)},d.ticks=function(a,c){var e=W(d.domain());if(typeof a!="function"){var f=e[1]-e[0],g=f/a,h=d3.bisect(Z,g,1,Z.length-1);Math.log(g/Z[h-1])<Math.log(Z[h]/g)&&--h,a=b[h],c=a[1],a=a[0]}return a(e[0],e[1],c)},d.tickFormat=function(){return c},d.copy=function(){return V(a.copy(),b,c)},d3.rebind(d,a,"range","rangeRound","interpolate","clamp")}function W(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function X(a){return new Date(a)}function Y(a){return function(b){var c=a.length-1,d=a[c];while(!d[1](b))d=a[--c];return d[0](b)}}d3.time={};var a=Date;d3.time.format=function(c){function e(a){var b=[],e=-1,f=0,h,i;while(++e<d)c.charCodeAt(e)==37&&(b.push(c.substring(f,e),(i=g[h=c.charAt(++e)])?i(a):h),f=e+1);return b.push(c.substring(f,e)),b.join("")}var d=c.length;return e.parse=function(d){var e=new a(1900,0,1),f=b(e,c,d,0);if(f!=d.length)return null;if(e.hour12){var g=e.getHours()%12;e.setHours(e.hour12pm?g+12:g)}return delete e.hour12,delete e.hour12pm,e},e.toString=function(){return c},e};var c=d3.format("02d"),d=d3.format("03d"),e=d3.format("04d"),f=d3.format("2d"),g={a:function(a){return m[a.getDay()].substring(0,3)},A:function(a){return m[a.getDay()]},b:function(a){return s[a.getMonth()].substring(0,3)},B:function(a){return s[a.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(a){return c(a.getDate())},e:function(a){return f(a.getDate())},H:function(a){return c(a.getHours())},I:function(a){return c(a.getHours()%12||12)},j:L,L:function(a){return d(a.getMilliseconds())},m:function(a){return c(a.getMonth()+1)},M:function(a){return c(a.getMinutes())},p:function(a){return a.getHours()>=12?"PM":"AM"},S:function(a){return c(a.getSeconds())},U:M,w:function(a){return a.getDay()},W:N,x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(a){return c(a.getFullYear()%100)},Y:function(a){return e(a.getFullYear()%1e4)},Z:O,"%":function(a){return"%"}},h={a:i,A:k,b:n,B:p,c:t,d:A,e:A,H:B,I:C,L:F,m:z,M:D,p:H,S:E,x:u,X:v,y:x,Y:w},j={sun:3,mon:3,tue:3,wed:3,thu:3,fri:3,sat:3},l=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/ig,m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},q=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig,r={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},s=["January","February","March","April","May","June","July","August","September","October","November","December"],G=/\s*\d+/,I={am:0,pm:1};d3.time.format.utc=function(b){function d(b){try{a=P;var d=new a;return d._=b,c(d)}finally{a=Date}}var c=d3.time.format(b);return d.parse=function(b){try{a=P;var d=c.parse(b);return d&&d._}finally{a=Date}},d.toString=c.toString,d},P.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.getTime()},setDate:function(a){this._.setUTCDate(a)},setDay:function(a){this._.setUTCDay(a)},setFullYear:function(a){this._.setUTCFullYear(a)},setHours:function(a){this._.setUTCHours(a)},setMilliseconds:function(a){this._.setUTCMilliseconds(a)},setMinutes:function(a){this._.setUTCMinutes(a)},setMonth:function(a){this._.setUTCMonth(a)},setSeconds:function(a){this._.setUTCSeconds(a)}};var Q=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?R:Q,R.parse=function(a){return new Date(a)},R.toString=Q.toString,d3.time.second=function(a){return new Date(~~(a/1e3)*1e3)},d3.time.second.utc=d3.time.second,d3.time.seconds=S(d3.time.second,function(a){a.setTime(a.getTime()+1e3)},function(a){return a.getSeconds()}),d3.time.seconds.utc=d3.time.seconds,d3.time.minute=function(a){return new Date(~~(a/6e4)*6e4)},d3.time.minute.utc=d3.time.minute,d3.time.minutes=S(d3.time.minute,T,function(a){return a.getMinutes()}),d3.time.minutes.utc=S(d3.time.minute,T,function(a){return a.getUTCMinutes()}),d3.time.hour=function(a){var b=a.getTimezoneOffset()/60;return new Date((~~(a/36e5-b)+b)*36e5)},d3.time.hour.utc=function(a){return new Date(~~(a/36e5)*36e5)},d3.time.hours=S(d3.time.hour,U,function(a){return a.getHours()}),d3.time.hours.utc=S(d3.time.hour.utc,U,function(a){return a.getUTCHours()}),d3.time.day=function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},d3.time.day.utc=function(a){return new Date(~~(a/864e5)*864e5)},d3.time.days=S(d3.time.day,function(a){a.setDate(a.getDate()+1)},function(a){return a.getDate()-1}),d3.time.days.utc=S(d3.time.day.utc,function(a){a.setUTCDate(a.getUTCDate()+1)},function(a){return a.getUTCDate()-1}),d3.time.week=function(a){return(a=d3.time.day(a)).setDate(a.getDate()-a.getDay()),a},d3.time.week.utc=function(a){return(a=d3.time.day.utc(a)).setUTCDate(a.getUTCDate()-a.getUTCDay()),a},d3.time.weeks=S(d3.time.week,function(a){a.setDate(a.getDate()+7)},function(a){return~~((a-new Date(a.getFullYear(),0,1))/6048e5)}),d3.time.weeks.utc=S(d3.time.week.utc,function(a){a.setUTCDate(a.getUTCDate()+7)},function(a){return~~((a-Date.UTC(a.getUTCFullYear(),0,1))/6048e5)}),d3.time.month=function(a){return new Date(a.getFullYear(),a.getMonth(),1)},d3.time.month.utc=function(a){return new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1))},d3.time.months=S(d3.time.month,function(a){a.setMonth(a.getMonth()+1)},function(a){return a.getMonth()}),d3.time.months.utc=S(d3.time.month.utc,function(a){a.setUTCMonth(a.getUTCMonth()+1)},function(a){return a.getUTCMonth()}),d3.time.year=function(a){return new Date(a.getFullYear(),0,1)},d3.time.year.utc=function(a){return new Date(Date.UTC(a.getUTCFullYear(),0,1))},d3.time.years=S(d3.time.year,function(a){a.setFullYear(a.getFullYear()+1)},function(a){return a.getFullYear()}),d3.time.years.utc=S(d3.time.year.utc,function(a){a.setUTCFullYear(a.getUTCFullYear()+1)},function(a){return a.getUTCFullYear()});var Z=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],$=[[d3.time.seconds,1],[d3.time.seconds,5],[d3.time.seconds,15],[d3.time.seconds,30],[d3.time.minutes,1],[d3.time.minutes,5],[d3.time.minutes,15],[d3.time.minutes,30],[d3.time.hours,1],[d3.time.hours,3],[d3.time.hours,6],[d3.time.hours,12],[d3.time.days,1],[d3.time.days,2],[d3.time.weeks,1],[d3.time.months,1],[d3.time.months,3],[d3.time.years,1]],_=[[d3.time.format("%Y"),function(a){return!0}],[d3.time.format("%B"),function(a){return a.getMonth()}],[d3.time.format("%b %d"),function(a){return a.getDate()!=1}],[d3.time.format("%a %d"),function(a){return a.getDay()&&a.getDate()!=1}],[d3.time.format("%I %p"),function(a){return a.getHours()}],[d3.time.format("%I:%M"),function(a){return a.getMinutes()}],[d3.time.format(":%S"),function(a){return a.getSeconds()||a.getMilliseconds()}]],ba=Y(_);d3.time.scale=function(){return V(d3.scale.linear(),$,ba)};var bb=[[d3.time.seconds.utc,1],[d3.time.seconds.utc,5],[d3.time.seconds.utc,15],[d3.time.seconds.utc,30],[d3.time.minutes.utc,1],[d3.time.minutes.utc,5],[d3.time.minutes.utc,15],[d3.time.minutes.utc,30],[d3.time.hours.utc,1],[d3.time.hours.utc,3],[d3.time.hours.utc,6],[d3.time.hours.utc,12],[d3.time.days.utc,1],[d3.time.days.utc,2],[d3.time.weeks.utc,1],[d3.time.months.utc,1],[d3.time.months.utc,3],[d3.time.years.utc,1]],bc=[[d3.time.format.utc("%Y"),function(a){return!0}],[d3.time.format.utc("%B"),function(a){return a.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(a){return a.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(a){return a.getUTCDay()&&a.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(a){return a.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(a){return a.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(a){return a.getUTCSeconds()||a.getUTCMilliseconds()}]],bd=Y(bc);d3.time.scale.utc=function(){return V(d3.scale.linear(),bb,bd)}})();
<ide>\ No newline at end of file
<ide><path>src/time/scale.js
<ide> var d3_time_scaleSteps = [
<ide> 864e5, // 1-day
<ide> 1728e5, // 2-day
<ide> 6048e5, // 1-week
<del> 1728e6, // 1-month
<add> 2592e6, // 1-month
<ide> 7776e6, // 3-month
<ide> 31536e6 // 1-year
<ide> ]; | 3 |
Text | Text | add firedfox to collaborators | 54785f59e16179dc66f00f97e13dce40661447bd | <ide><path>README.md
<ide> information about the governance of the Node.js project, see
<ide> * [domenic](https://github.com/domenic) - **Domenic Denicola** <d@domenic.me>
<ide> * [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) - **Robert Jefe Lindstaedt** <robert.lindstaedt@gmail.com>
<ide> * [estliberitas](https://github.com/estliberitas) - **Alexander Makarenko** <estliberitas@gmail.com>
<add>* [firedfox](https://github.com/firedfox) - **Daniel Wang** <wangyang0123@gmail.com>
<ide> * [geek](https://github.com/geek) - **Wyatt Preul** <wpreul@gmail.com>
<ide> * [iarna](https://github.com/iarna) - **Rebecca Turner** <me@re-becca.org>
<ide> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <i@izs.me> | 1 |
Python | Python | fix issue #265 | 089cbca7ae0067effcc34f26655b99fdb2063306 | <ide><path>glances/glances.py
<ide> def displayHelp(self, core):
<ide>
<ide> # display the limits table
<ide> limits_table_x = self.help_x
<del> limits_table_y = self.help_y + 2
<add> limits_table_y = self.help_y + 1
<ide> self.term_window.addnstr(limits_table_y, limits_table_x + 18,
<ide> format(_("OK"), '^8'), 8,
<ide> self.default_color)
<ide> def displayHelp(self, core):
<ide>
<ide> width = 8
<ide> limits_table_x = self.help_x + 2
<del> limits_table_y = self.help_y + 3
<add> limits_table_y = self.help_y + 2
<ide> for label in stat_labels:
<ide> self.term_window.addnstr(limits_table_y, limits_table_x,
<ide> format(label, '<14'), 14)
<ide> def displayHelp(self, core):
<ide> limits.getProcessCritical(stat='MEM')]]
<ide>
<ide> limits_table_x = self.help_x + 15
<del> limits_table_y = self.help_y + 3
<add> limits_table_y = self.help_y + 2
<ide> for value in limit_values:
<ide> self.term_window.addnstr(
<ide> limits_table_y, limits_table_x, | 1 |
Javascript | Javascript | fix a bug of ci (prettier) bug | 80f8d6ea0977f4a8d1774d73d0ebc1426bb631fb | <ide><path>src/menu-helpers.js
<ide> function findMatchingItemIndex(menu, { type, id, submenu }) {
<ide> for (let index = 0; index < menu.length; index++) {
<ide> const item = menu[index];
<ide> if (
<del> item.id === id &&
<del> (item.submenu != null) === (submenu != null)
<add> item.id === id && (item.submenu != null) === (submenu != null)
<ide> ) {
<ide> return index;
<ide> } | 1 |
Python | Python | fix unexpected bug in exiting hook context manager | 9c644194ed6bc6a3a065b72ea7cf89c02d1c5275 | <ide><path>airflow/providers/microsoft/psrp/hooks/psrp.py
<ide> def __enter__(self):
<ide>
<ide> def __exit__(self, exc_type, exc_value, traceback):
<ide> try:
<del> self._client.__exit__()
<add> self._client.__exit__(exc_type, exc_value, traceback)
<ide> finally:
<ide> self._client = None
<ide>
<ide><path>tests/providers/microsoft/psrp/hooks/test_psrp.py
<ide> def end_invoke():
<ide>
<ide> hook.invoke_powershell("foo")
<ide>
<add> assert ws_man().__exit__.mock_calls == [call(None, None, None)]
<add>
<ide> assert call('%s', '<output>') in log_info.mock_calls
<ide> assert call('Information: %s', '<message>') in log_info.mock_calls
<ide> assert call('Invocation state: %s', 'Completed') in log_info.mock_calls | 2 |
Go | Go | add legacy support | a926cd4d880904258e01ea521ecd9e1b908f2b97 | <ide><path>server.go
<ide> func (srv *Server) ContainerAttach(name string, logs, stream, stdin, stdout, std
<ide> //logs
<ide> if logs {
<ide> cLog, err := container.ReadLog("json")
<del> if err != nil {
<del> utils.Debugf("Error reading logs (json): %s", err)
<del> }
<del> dec := json.NewDecoder(cLog)
<del> for {
<del> var l utils.JSONLog
<del> if err := dec.Decode(&l); err == io.EOF {
<del> break
<del> } else if err != nil {
<del> utils.Debugf("Error streaming logs: %s", err)
<del> break
<add> if err != nil && os.IsNotExist(err) {
<add> // Legacy logs
<add> if stdout {
<add> cLog, err := container.ReadLog("stdout")
<add> if err != nil {
<add> utils.Debugf("Error reading logs (stdout): %s", err)
<add> } else if _, err := io.Copy(out, cLog); err != nil {
<add> utils.Debugf("Error streaming logs (stdout): %s", err)
<add> }
<add> }
<add> if stderr {
<add> cLog, err := container.ReadLog("stderr")
<add> if err != nil {
<add> utils.Debugf("Error reading logs (stderr): %s", err)
<add> } else if _, err := io.Copy(out, cLog); err != nil {
<add> utils.Debugf("Error streaming logs (stderr): %s", err)
<add> }
<ide> }
<del> if (l.Stream == "stdout" && stdout) || (l.Stream == "stderr" && stderr) {
<del> fmt.Fprintf(out, "%s", l.Log)
<add> } else if err != nil {
<add> utils.Debugf("Error reading logs (json): %s", err)
<add> } else {
<add> dec := json.NewDecoder(cLog)
<add> for {
<add> var l utils.JSONLog
<add> if err := dec.Decode(&l); err == io.EOF {
<add> break
<add> } else if err != nil {
<add> utils.Debugf("Error streaming logs: %s", err)
<add> break
<add> }
<add> if (l.Stream == "stdout" && stdout) || (l.Stream == "stderr" && stderr) {
<add> fmt.Fprintf(out, "%s", l.Log)
<add> }
<ide> }
<ide> }
<ide> } | 1 |
Python | Python | fix test_void_dtype_equality_failures for python 3 | df148e1b6327ca699b8b56f51f34dc871551da8b | <ide><path>numpy/core/tests/test_deprecations.py
<ide> def assert_deprecated(self, function, num=1, ignore_others=False,
<ide> function(*args, **kwargs)
<ide> except (Exception if function_fails else tuple()):
<ide> pass
<add>
<ide> # just in case, clear the registry
<ide> num_found = 0
<ide> for warning in self.log:
<ide> class NotArray(object):
<ide> def __array__(self):
<ide> raise TypeError
<ide>
<add> # Needed so Python 3 does not raise DeprecationWarning twice.
<add> def __ne__(self, other):
<add> return NotImplemented
<add>
<ide> self.assert_deprecated(lambda: np.arange(2) == NotArray())
<ide> self.assert_deprecated(lambda: np.arange(2) != NotArray())
<ide> | 1 |
PHP | PHP | support all enumerables in proxy | 0c86fd2d155e431b5055046eced247a9037b9099 | <ide><path>src/Illuminate/Support/HigherOrderCollectionProxy.php
<ide> namespace Illuminate\Support;
<ide>
<ide> /**
<del> * @mixin \Illuminate\Support\Collection
<add> * @mixin \Illuminate\Support\Enumerable
<ide> */
<ide> class HigherOrderCollectionProxy
<ide> {
<ide> /**
<ide> * The collection being operated on.
<ide> *
<del> * @var \Illuminate\Support\Collection
<add> * @var \Illuminate\Support\Enumerable
<ide> */
<ide> protected $collection;
<ide>
<ide> class HigherOrderCollectionProxy
<ide> /**
<ide> * Create a new proxy instance.
<ide> *
<del> * @param \Illuminate\Support\Collection $collection
<add> * @param \Illuminate\Support\Enumerable $collection
<ide> * @param string $method
<ide> * @return void
<ide> */
<del> public function __construct(Collection $collection, $method)
<add> public function __construct(Enumerable $collection, $method)
<ide> {
<ide> $this->method = $method;
<ide> $this->collection = $collection; | 1 |
Java | Java | fix method argument naming across types | 0c84f4017f576bd250e4408d8410f6647507027c | <ide><path>src/main/java/io/reactivex/rxjava3/core/Completable.java
<ide> public static Completable create(@NonNull CompletableOnSubscribe source) {
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code unsafeCreate} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param source the callback which will receive the {@link CompletableObserver} instances
<add> * @param onSubscribe the callback which will receive the {@link CompletableObserver} instances
<ide> * when the {@code Completable} is subscribed to.
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code source} is {@code null}
<add> * @throws NullPointerException if {@code onSubscribe} is {@code null}
<ide> * @throws IllegalArgumentException if {@code source} is a {@code Completable}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static Completable unsafeCreate(@NonNull CompletableSource source) {
<del> Objects.requireNonNull(source, "source is null");
<del> if (source instanceof Completable) {
<add> public static Completable unsafeCreate(@NonNull CompletableSource onSubscribe) {
<add> Objects.requireNonNull(onSubscribe, "onSubscribe is null");
<add> if (onSubscribe instanceof Completable) {
<ide> throw new IllegalArgumentException("Use of unsafeCreate(Completable)!");
<ide> }
<del> return RxJavaPlugins.onAssembly(new CompletableFromUnsafeSource(source));
<add> return RxJavaPlugins.onAssembly(new CompletableFromUnsafeSource(onSubscribe));
<ide> }
<ide>
<ide> /**
<ide> public static Completable unsafeCreate(@NonNull CompletableSource source) {
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code defer} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param completableSupplier the supplier that returns the {@code Completable} that will be subscribed to.
<add> * @param supplier the supplier that returns the {@code Completable} that will be subscribed to.
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code completableSupplier} is {@code null}
<add> * @throws NullPointerException if {@code supplier} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static Completable defer(@NonNull Supplier<? extends CompletableSource> completableSupplier) {
<del> Objects.requireNonNull(completableSupplier, "completableSupplier is null");
<del> return RxJavaPlugins.onAssembly(new CompletableDefer(completableSupplier));
<add> public static Completable defer(@NonNull Supplier<? extends CompletableSource> supplier) {
<add> Objects.requireNonNull(supplier, "supplier is null");
<add> return RxJavaPlugins.onAssembly(new CompletableDefer(supplier));
<ide> }
<ide>
<ide> /**
<ide> public static Completable defer(@NonNull Supplier<? extends CompletableSource> c
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param errorSupplier the error supplier, not {@code null}
<add> * @param supplier the error supplier, not {@code null}
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code errorSupplier} is {@code null}
<add> * @throws NullPointerException if {@code supplier} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static Completable error(@NonNull Supplier<? extends Throwable> errorSupplier) {
<del> Objects.requireNonNull(errorSupplier, "errorSupplier is null");
<del> return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(errorSupplier));
<add> public static Completable error(@NonNull Supplier<? extends Throwable> supplier) {
<add> Objects.requireNonNull(supplier, "supplier is null");
<add> return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(supplier));
<ide> }
<ide>
<ide> /**
<ide> public static Completable error(@NonNull Supplier<? extends Throwable> errorSupp
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param error the {@code Throwable} instance to emit, not {@code null}
<add> * @param throwable the {@code Throwable} instance to emit, not {@code null}
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code error} is {@code null}
<add> * @throws NullPointerException if {@code throwable} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static Completable error(@NonNull Throwable error) {
<del> Objects.requireNonNull(error, "error is null");
<del> return RxJavaPlugins.onAssembly(new CompletableError(error));
<add> public static Completable error(@NonNull Throwable throwable) {
<add> Objects.requireNonNull(throwable, "throwable is null");
<add> return RxJavaPlugins.onAssembly(new CompletableError(throwable));
<ide> }
<ide>
<ide> /**
<ide> public static Completable error(@NonNull Throwable error) {
<ide> * {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.rxjava3.exceptions.UndeliverableException UndeliverableException}.
<ide> * </dd>
<ide> * </dl>
<del> * @param run the {@code Action} to run for each subscribing {@link CompletableObserver}
<add> * @param action the {@code Action} to run for each subscribing {@link CompletableObserver}
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code run} is {@code null}
<add> * @throws NullPointerException if {@code action} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static Completable fromAction(@NonNull Action run) {
<del> Objects.requireNonNull(run, "run is null");
<del> return RxJavaPlugins.onAssembly(new CompletableFromAction(run));
<add> public static Completable fromAction(@NonNull Action action) {
<add> Objects.requireNonNull(action, "action is null");
<add> return RxJavaPlugins.onAssembly(new CompletableFromAction(action));
<ide> }
<ide>
<ide> /**
<ide> private static NullPointerException toNpe(Throwable ex) {
<ide> * </dl>
<ide> * @param <R> the resource type
<ide> * @param resourceSupplier the {@link Supplier} that returns a resource to be managed.
<del> * @param completableFunction the {@link Function} that given a resource returns a {@code CompletableSource} instance that will be subscribed to
<del> * @param disposer the {@link Consumer} that disposes the resource created by the resource supplier
<add> * @param sourceSupplier the {@link Function} that given a resource returns a {@code CompletableSource} instance that will be subscribed to
<add> * @param resourceCleanup the {@link Consumer} that disposes the resource created by the resource supplier
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code completableFunction}
<del> * or {@code disposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier}
<add> * or {@code resourceCleanup} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<ide> public static <R> Completable using(@NonNull Supplier<R> resourceSupplier,
<del> @NonNull Function<? super R, ? extends CompletableSource> completableFunction,
<del> @NonNull Consumer<? super R> disposer) {
<del> return using(resourceSupplier, completableFunction, disposer, true);
<add> @NonNull Function<? super R, ? extends CompletableSource> sourceSupplier,
<add> @NonNull Consumer<? super R> resourceCleanup) {
<add> return using(resourceSupplier, sourceSupplier, resourceCleanup, true);
<ide> }
<ide>
<ide> /**
<ide> public static <R> Completable using(@NonNull Supplier<R> resourceSupplier,
<ide> * </dl>
<ide> * @param <R> the resource type
<ide> * @param resourceSupplier the {@link Supplier} that returns a resource to be managed
<del> * @param completableFunction the {@link Function} that given a resource returns a non-{@code null}
<add> * @param sourceSupplier the {@link Function} that given a resource returns a non-{@code null}
<ide> * {@code CompletableSource} instance that will be subscribed to
<del> * @param disposer the {@link Consumer} that disposes the resource created by the resource supplier
<add> * @param resourceCleanup the {@link Consumer} that disposes the resource created by the resource supplier
<ide> * @param eager
<ide> * If {@code true} then resource disposal will happen either on a {@code dispose()} call before the upstream is disposed
<ide> * or just before the emission of a terminal event ({@code onComplete} or {@code onError}).
<ide> * If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed
<ide> * or just after the emission of a terminal event ({@code onComplete} or {@code onError}).
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code completableFunction}
<del> * or {@code disposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier}
<add> * or {@code resourceCleanup} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <R> Completable using(
<ide> @NonNull Supplier<R> resourceSupplier,
<del> @NonNull Function<? super R, ? extends CompletableSource> completableFunction,
<del> @NonNull Consumer<? super R> disposer,
<add> @NonNull Function<? super R, ? extends CompletableSource> sourceSupplier,
<add> @NonNull Consumer<? super R> resourceCleanup,
<ide> boolean eager) {
<ide> Objects.requireNonNull(resourceSupplier, "resourceSupplier is null");
<del> Objects.requireNonNull(completableFunction, "completableFunction is null");
<del> Objects.requireNonNull(disposer, "disposer is null");
<add> Objects.requireNonNull(sourceSupplier, "sourceSupplier is null");
<add> Objects.requireNonNull(resourceCleanup, "resourceCleanup is null");
<ide>
<del> return RxJavaPlugins.onAssembly(new CompletableUsing<>(resourceSupplier, completableFunction, disposer, eager));
<add> return RxJavaPlugins.onAssembly(new CompletableUsing<>(resourceSupplier, sourceSupplier, resourceCleanup, eager));
<ide> }
<ide>
<ide> /**
<ide> public final Completable concatWith(@NonNull CompletableSource other) {
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code delay} does operate by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param delay the delay time
<add> * @param time the delay time
<ide> * @param unit the delay unit
<ide> * @return the new {@code Completable} instance
<ide> * @throws NullPointerException if {@code unit} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Completable delay(long delay, @NonNull TimeUnit unit) {
<del> return delay(delay, unit, Schedulers.computation(), false);
<add> public final Completable delay(long time, @NonNull TimeUnit unit) {
<add> return delay(time, unit, Schedulers.computation(), false);
<ide> }
<ide>
<ide> /**
<ide> public final Completable delay(long delay, @NonNull TimeUnit unit) {
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code delay} operates on the {@code Scheduler} you specify.</dd>
<ide> * </dl>
<del> * @param delay the delay time
<add> * @param time the delay time
<ide> * @param unit the delay unit
<ide> * @param scheduler the {@code Scheduler} to run the delayed completion on
<ide> * @return the new {@code Completable} instance
<ide> public final Completable delay(long delay, @NonNull TimeUnit unit) {
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return delay(delay, unit, scheduler, false);
<add> public final Completable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return delay(time, unit, scheduler, false);
<ide> }
<ide>
<ide> /**
<ide> public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code delay} operates on the {@code Scheduler} you specify.</dd>
<ide> * </dl>
<del> * @param delay the delay time
<add> * @param time the delay time
<ide> * @param unit the delay unit
<ide> * @param scheduler the {@code Scheduler} to run the delayed completion on
<ide> * @param delayError delay the error emission as well?
<ide> public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
<add> public final Completable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<del> return RxJavaPlugins.onAssembly(new CompletableDelay(this, delay, unit, scheduler, delayError));
<add> return RxJavaPlugins.onAssembly(new CompletableDelay(this, time, unit, scheduler, delayError));
<ide> }
<ide>
<ide> /**
<ide> public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
<ide> * </dl>
<ide> * <p>History: 2.2.3 - experimental
<ide> *
<del> * @param delay the time to delay the subscription
<add> * @param time the time to delay the subscription
<ide> * @param unit the time unit of {@code delay}
<ide> * @return the new {@code Completable} instance
<ide> * @throws NullPointerException if {@code unit} is {@code null}
<ide> public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) {
<del> return delaySubscription(delay, unit, Schedulers.computation());
<add> public final Completable delaySubscription(long time, @NonNull TimeUnit unit) {
<add> return delaySubscription(time, unit, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) {
<ide> * <dd>You specify which {@code Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> * <p>History: 2.2.3 - experimental
<del> * @param delay the time to delay the subscription
<add> * @param time the time to delay the subscription
<ide> * @param unit the time unit of {@code delay}
<ide> * @param scheduler the {@code Scheduler} on which the waiting and subscription will happen
<ide> * @return the new {@code Completable} instance
<ide> public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) {
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Completable delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return Completable.timer(delay, unit, scheduler).andThen(this);
<add> public final Completable delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return Completable.timer(time, unit, scheduler).andThen(this);
<ide> }
<ide>
<ide> /**
<ide> public final Completable onErrorComplete(@NonNull Predicate<? super Throwable> p
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param errorMapper the {@code mapper} {@code Function} that takes the error and should return a {@code CompletableSource} as
<add> * @param fallbackSupplier the {@code mapper} {@code Function} that takes the error and should return a {@code CompletableSource} as
<ide> * continuation.
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code errorMapper} is {@code null}
<add> * @throws NullPointerException if {@code fallbackSupplier} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Completable onErrorResumeNext(@NonNull Function<? super Throwable, ? extends CompletableSource> errorMapper) {
<del> Objects.requireNonNull(errorMapper, "errorMapper is null");
<del> return RxJavaPlugins.onAssembly(new CompletableResumeNext(this, errorMapper));
<add> public final Completable onErrorResumeNext(@NonNull Function<? super Throwable, ? extends CompletableSource> fallbackSupplier) {
<add> Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null");
<add> return RxJavaPlugins.onAssembly(new CompletableResumeNext(this, fallbackSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final Completable timeout(long timeout, @NonNull TimeUnit unit) {
<ide> * </dl>
<ide> * @param timeout the timeout value
<ide> * @param unit the unit of {@code timeout}
<del> * @param other the other {@code CompletableSource} instance to switch to in case of a timeout
<add> * @param fallback the other {@code CompletableSource} instance to switch to in case of a timeout
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code unit} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<del> public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull CompletableSource other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(timeout, unit, Schedulers.computation(), other);
<add> public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull CompletableSource fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(timeout, unit, Schedulers.computation(), fallback);
<ide> }
<ide>
<ide> /**
<ide> public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull
<ide> * @param timeout the timeout value
<ide> * @param unit the unit of {@code timeout}
<ide> * @param scheduler the {@code Scheduler} to use to wait for completion
<del> * @param other the other {@code Completable} instance to switch to in case of a timeout
<add> * @param fallback the other {@code Completable} instance to switch to in case of a timeout
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull CompletableSource other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(timeout, unit, scheduler, other);
<add> public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull CompletableSource fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(timeout, unit, scheduler, fallback);
<ide> }
<ide>
<ide> /**
<ide> public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull
<ide> * @param timeout the timeout value
<ide> * @param unit the unit of {@code timeout}
<ide> * @param scheduler the {@code Scheduler} to use to wait for completion
<del> * @param other the other {@code Completable} instance to switch to in case of a timeout,
<add> * @param fallback the other {@code Completable} instance to switch to in case of a timeout,
<ide> * if {@code null} a {@link TimeoutException} is emitted instead
<ide> * @return the new {@code Completable} instance
<del> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableSource other) {
<add> private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableSource fallback) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<del> return RxJavaPlugins.onAssembly(new CompletableTimeout(this, timeout, unit, scheduler, other));
<add> return RxJavaPlugins.onAssembly(new CompletableTimeout(this, timeout, unit, scheduler, fallback));
<ide> }
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/Flowable.java
<ide> public static <T> Flowable<T> error(@NonNull Throwable throwable) {
<ide> * <dd>{@code fromPublisher} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <T> the value type of the flow
<del> * @param source the {@code Publisher} to convert
<add> * @param publisher the {@code Publisher} to convert
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if the {@code source} {@code Publisher} is {@code null}
<add> * @throws NullPointerException if {@code publisher} is {@code null}
<ide> * @see #create(FlowableOnSubscribe, BackpressureStrategy)
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.PASS_THROUGH)
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @SuppressWarnings("unchecked")
<del> public static <T> Flowable<T> fromPublisher(@NonNull Publisher<@NonNull ? extends T> source) {
<del> if (source instanceof Flowable) {
<del> return RxJavaPlugins.onAssembly((Flowable<T>)source);
<add> public static <T> Flowable<T> fromPublisher(@NonNull Publisher<@NonNull ? extends T> publisher) {
<add> if (publisher instanceof Flowable) {
<add> return RxJavaPlugins.onAssembly((Flowable<T>)publisher);
<ide> }
<del> Objects.requireNonNull(source, "source is null");
<add> Objects.requireNonNull(publisher, "publisher is null");
<ide>
<del> return RxJavaPlugins.onAssembly(new FlowableFromPublisher<>(source));
<add> return RxJavaPlugins.onAssembly(new FlowableFromPublisher<>(publisher));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Flowable<T> unsafeCreate(@NonNull Publisher<T> onSubscribe) {
<ide> * the factory function to create a resource object that depends on the {@code Publisher}
<ide> * @param sourceSupplier
<ide> * the factory function to create a {@code Publisher}
<del> * @param resourceDisposer
<add> * @param resourceCleanup
<ide> * the function that will dispose of the resource
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceDisposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/using.html">ReactiveX operators documentation: Using</a>
<ide> */
<ide> @CheckReturnValue
<ide> public static <T> Flowable<T> unsafeCreate(@NonNull Publisher<T> onSubscribe) {
<ide> public static <T, D> Flowable<T> using(
<ide> @NonNull Supplier<? extends D> resourceSupplier,
<ide> @NonNull Function<? super D, ? extends Publisher<@NonNull ? extends T>> sourceSupplier,
<del> @NonNull Consumer<? super D> resourceDisposer) {
<del> return using(resourceSupplier, sourceSupplier, resourceDisposer, true);
<add> @NonNull Consumer<? super D> resourceCleanup) {
<add> return using(resourceSupplier, sourceSupplier, resourceCleanup, true);
<ide> }
<ide>
<ide> /**
<ide> public static <T, D> Flowable<T> using(
<ide> * the factory function to create a resource object that depends on the {@code Publisher}
<ide> * @param sourceSupplier
<ide> * the factory function to create a {@code Publisher}
<del> * @param resourceDisposer
<add> * @param resourceCleanup
<ide> * the function that will dispose of the resource
<ide> * @param eager
<ide> * If {@code true}, the resource disposal will happen either on a {@code cancel()} call before the upstream is disposed
<ide> * or just before the emission of a terminal event ({@code onComplete} or {@code onError}).
<ide> * If {@code false} the resource disposal will happen either on a {@code cancel()} call after the upstream is disposed
<ide> * or just after the emission of a terminal event ({@code onComplete} or {@code onError}).
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceDisposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/using.html">ReactiveX operators documentation: Using</a>
<ide> * @since 2.0
<ide> */
<ide> public static <T, D> Flowable<T> using(
<ide> public static <T, D> Flowable<T> using(
<ide> @NonNull Supplier<? extends D> resourceSupplier,
<ide> @NonNull Function<? super D, ? extends Publisher<@NonNull ? extends T>> sourceSupplier,
<del> @NonNull Consumer<? super D> resourceDisposer,
<add> @NonNull Consumer<? super D> resourceCleanup,
<ide> boolean eager) {
<ide> Objects.requireNonNull(resourceSupplier, "resourceSupplier is null");
<ide> Objects.requireNonNull(sourceSupplier, "sourceSupplier is null");
<del> Objects.requireNonNull(resourceDisposer, "resourceDisposer is null");
<del> return RxJavaPlugins.onAssembly(new FlowableUsing<T, D>(resourceSupplier, sourceSupplier, resourceDisposer, eager));
<add> Objects.requireNonNull(resourceCleanup, "resourceCleanup is null");
<add> return RxJavaPlugins.onAssembly(new FlowableUsing<T, D>(resourceSupplier, sourceSupplier, resourceCleanup, eager));
<ide> }
<ide>
<ide> /**
<ide> public final Iterable<T> blockingLatest() {
<ide> * the initial item that the {@code Iterable} sequence will yield if this
<ide> * {@code Flowable} has not yet emitted an item
<ide> * @return the new {@code Iterable} instance
<add> * @throws NullPointerException if {@code initialItem} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/first.html">ReactiveX documentation: First</a>
<ide> */
<ide> @CheckReturnValue
<ide> @BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<ide> public final Iterable<T> blockingMostRecent(@NonNull T initialItem) {
<add> Objects.requireNonNull(initialItem, "initialItem is null");
<ide> return new BlockingFlowableMostRecent<>(this, initialItem);
<ide> }
<ide>
<ide> public final <U> Flowable<T> delay(@NonNull Function<? super T, ? extends Publis
<ide> * <dd>This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the {@link TimeUnit} in which {@code period} is defined
<ide> public final <U> Flowable<T> delay(@NonNull Function<? super T, ? extends Publis
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit) {
<del> return delay(delay, unit, Schedulers.computation(), false);
<add> public final Flowable<T> delay(long time, @NonNull TimeUnit unit) {
<add> return delay(time, unit, Schedulers.computation(), false);
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit) {
<ide> * <dd>This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the {@link TimeUnit} in which {@code period} is defined
<ide> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit) {
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, boolean delayError) {
<del> return delay(delay, unit, Schedulers.computation(), delayError);
<add> public final Flowable<T> delay(long time, @NonNull TimeUnit unit, boolean delayError) {
<add> return delay(time, unit, Schedulers.computation(), delayError);
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, boolean delay
<ide> * <dd>You specify which {@link Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, boolean delay
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return delay(delay, unit, scheduler, false);
<add> public final Flowable<T> delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return delay(time, unit, scheduler, false);
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
<ide> * <dd>You specify which {@link Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Sche
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> public final Flowable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
<add> public final Flowable<T> delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<ide>
<del> return RxJavaPlugins.onAssembly(new FlowableDelay<>(this, Math.max(0L, delay), unit, scheduler, delayError));
<add> return RxJavaPlugins.onAssembly(new FlowableDelay<>(this, Math.max(0L, time), unit, scheduler, delayError));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Flowable<T> delaySubscription(@NonNull Publisher<U> subscriptio
<ide> * <dd>This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the time to delay the subscription
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final <U> Flowable<T> delaySubscription(@NonNull Publisher<U> subscriptio
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Flowable<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<del> return delaySubscription(delay, unit, Schedulers.computation());
<add> public final Flowable<T> delaySubscription(long time, @NonNull TimeUnit unit) {
<add> return delaySubscription(time, unit, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<ide> * <dd>You specify which {@code Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the time to delay the subscription
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Flowable<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Flowable<T> delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return delaySubscription(timer(delay, unit, scheduler));
<add> public final Flowable<T> delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return delaySubscription(timer(time, unit, scheduler));
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> onBackpressureLatest() {
<ide> * <dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param resumeFunction
<add> * @param fallbackSupplier
<ide> * a function that returns a {@code Publisher} that will take over if the current {@code Flowable} encounters
<ide> * an error
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code resumeFunction} is {@code null}
<add> * @throws NullPointerException if {@code fallbackSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Flowable<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? extends Publisher<@NonNull ? extends T>> resumeFunction) {
<del> Objects.requireNonNull(resumeFunction, "resumeFunction is null");
<del> return RxJavaPlugins.onAssembly(new FlowableOnErrorNext<>(this, resumeFunction));
<add> public final Flowable<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? extends Publisher<@NonNull ? extends T>> fallbackSupplier) {
<add> Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null");
<add> return RxJavaPlugins.onAssembly(new FlowableOnErrorNext<>(this, fallbackSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> onErrorResumeNext(@NonNull Function<? super Throwable,
<ide> * <dd>{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param next
<add> * @param fallback
<ide> * the next {@code Publisher} source that will take over if the current {@code Flowable} encounters
<ide> * an error
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code next} is {@code null}
<add> * @throws NullPointerException if {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Flowable<T> onErrorResumeWith(@NonNull Publisher<@NonNull ? extends T> next) {
<del> Objects.requireNonNull(next, "next is null");
<del> return onErrorResumeNext(Functions.justFunction(next));
<add> public final Flowable<T> onErrorResumeWith(@NonNull Publisher<@NonNull ? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return onErrorResumeNext(Functions.justFunction(fallback));
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> onErrorResumeWith(@NonNull Publisher<@NonNull ? extends
<ide> * <dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param valueSupplier
<add> * @param itemSupplier
<ide> * a function that returns a single value that will be emitted along with a regular {@code onComplete} in case
<ide> * the current {@code Flowable} signals an {@code onError} event
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code valueSupplier} is {@code null}
<add> * @throws NullPointerException if {@code itemSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Flowable<T> onErrorReturn(@NonNull Function<? super Throwable, ? extends T> valueSupplier) {
<del> Objects.requireNonNull(valueSupplier, "valueSupplier is null");
<del> return RxJavaPlugins.onAssembly(new FlowableOnErrorReturn<>(this, valueSupplier));
<add> public final Flowable<T> onErrorReturn(@NonNull Function<? super Throwable, ? extends T> itemSupplier) {
<add> Objects.requireNonNull(itemSupplier, "itemSupplier is null");
<add> return RxJavaPlugins.onAssembly(new FlowableOnErrorReturn<>(this, itemSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final <V> Flowable<T> timeout(@NonNull Function<? super T, ? extends Publ
<ide> * @param itemTimeoutIndicator
<ide> * a function that returns a {@code Publisher}, for each item emitted by the current {@code Flowable}, that
<ide> * determines the timeout window for the subsequent item
<del> * @param other
<add> * @param fallback
<ide> * the fallback {@code Publisher} to switch to if the current {@code Flowable} times out
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code itemTimeoutIndicator} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code itemTimeoutIndicator} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final <V> Flowable<T> timeout(@NonNull Function<? super T, ? extends Publisher<@NonNull V>> itemTimeoutIndicator, @NonNull Publisher<@NonNull ? extends T> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(null, itemTimeoutIndicator, other);
<add> public final <V> Flowable<T> timeout(@NonNull Function<? super T, ? extends Publisher<@NonNull V>> itemTimeoutIndicator, @NonNull Publisher<@NonNull ? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(null, itemTimeoutIndicator, fallback);
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> timeout(long timeout, @NonNull TimeUnit unit) {
<ide> * maximum duration between items before a timeout occurs
<ide> * @param unit
<ide> * the unit of time that applies to the {@code timeout} argument
<del> * @param other
<add> * @param fallback
<ide> * the fallback {@code Publisher} to use in case of a timeout
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code unit} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<del> public final Flowable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Publisher<@NonNull ? extends T> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(timeout, unit, other, Schedulers.computation());
<add> public final Flowable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Publisher<@NonNull ? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(timeout, unit, fallback, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Flowable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull
<ide> * the unit of time that applies to the {@code timeout} argument
<ide> * @param scheduler
<ide> * the {@code Scheduler} to run the timeout timers on
<del> * @param other
<add> * @param fallback
<ide> * the {@code Publisher} to use as the fallback in case of a timeout
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> public final Flowable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Publisher<@NonNull ? extends T> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(timeout, unit, other, scheduler);
<add> public final Flowable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Publisher<@NonNull ? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(timeout, unit, fallback, scheduler);
<ide> }
<ide>
<ide> /**
<ide> public final <U, V> Flowable<T> timeout(@NonNull Publisher<U> firstTimeoutIndica
<ide> * a function that returns a {@code Publisher} for each item emitted by the current {@code Flowable} and that
<ide> * determines the timeout window in which the subsequent source item must arrive in order to
<ide> * continue the sequence
<del> * @param other
<add> * @param fallback
<ide> * the fallback {@code Publisher} to switch to if the current {@code Flowable} times out
<ide> * @return the new {@code Flowable} instance
<del> * @throws NullPointerException if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> public final <U, V> Flowable<T> timeout(@NonNull Publisher<U> firstTimeoutIndica
<ide> public final <U, V> Flowable<T> timeout(
<ide> @NonNull Publisher<U> firstTimeoutIndicator,
<ide> @NonNull Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator,
<del> @NonNull Publisher<@NonNull ? extends T> other) {
<add> @NonNull Publisher<@NonNull ? extends T> fallback) {
<ide> Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null");
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, other);
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, fallback);
<ide> }
<ide>
<del> private Flowable<T> timeout0(long timeout, TimeUnit unit, Publisher<@NonNull ? extends T> other,
<add> private Flowable<T> timeout0(long timeout, TimeUnit unit, Publisher<@NonNull ? extends T> fallback,
<ide> Scheduler scheduler) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<del> return RxJavaPlugins.onAssembly(new FlowableTimeoutTimed<>(this, timeout, unit, scheduler, other));
<add> return RxJavaPlugins.onAssembly(new FlowableTimeoutTimed<>(this, timeout, unit, scheduler, fallback));
<ide> }
<ide>
<ide> private <U, V> Flowable<T> timeout0(
<ide> Publisher<U> firstTimeoutIndicator,
<ide> Function<? super T, ? extends Publisher<@NonNull V>> itemTimeoutIndicator,
<del> Publisher<@NonNull ? extends T> other) {
<add> Publisher<@NonNull ? extends T> fallback) {
<ide> Objects.requireNonNull(itemTimeoutIndicator, "itemTimeoutIndicator is null");
<del> return RxJavaPlugins.onAssembly(new FlowableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, other));
<add> return RxJavaPlugins.onAssembly(new FlowableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, fallback));
<ide> }
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/Maybe.java
<ide> public static <T> Maybe<T> create(@NonNull MaybeOnSubscribe<T> onSubscribe) {
<ide> * <dd>{@code defer} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <T> the value type
<del> * @param maybeSupplier the {@code Supplier} that is called for each individual {@code MaybeObserver} and
<add> * @param supplier the {@code Supplier} that is called for each individual {@code MaybeObserver} and
<ide> * returns a {@code MaybeSource} instance to subscribe to
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code maybeSupplier} is {@code null}
<add> * @throws NullPointerException if {@code supplier} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Maybe<T> defer(@NonNull Supplier<? extends MaybeSource<? extends T>> maybeSupplier) {
<del> Objects.requireNonNull(maybeSupplier, "maybeSupplier is null");
<del> return RxJavaPlugins.onAssembly(new MaybeDefer<>(maybeSupplier));
<add> public static <T> Maybe<T> defer(@NonNull Supplier<? extends MaybeSource<? extends T>> supplier) {
<add> Objects.requireNonNull(supplier, "supplier is null");
<add> return RxJavaPlugins.onAssembly(new MaybeDefer<>(supplier));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Maybe<T> empty() {
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param error
<add> * @param throwable
<ide> * the particular {@link Throwable} to pass to {@link MaybeObserver#onError onError}
<ide> * @param <T>
<ide> * the type of the item (ostensibly) emitted by the {@code Maybe}
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code error} is {@code null}
<add> * @throws NullPointerException if {@code throwable} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/empty-never-throw.html">ReactiveX operators documentation: Throw</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Maybe<T> error(@NonNull Throwable error) {
<del> Objects.requireNonNull(error, "error is null");
<del> return RxJavaPlugins.onAssembly(new MaybeError<>(error));
<add> public static <T> Maybe<T> error(@NonNull Throwable throwable) {
<add> Objects.requireNonNull(throwable, "throwable is null");
<add> return RxJavaPlugins.onAssembly(new MaybeError<>(throwable));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Maybe<T> fromCompletable(@NonNull CompletableSource completabl
<ide> * <dd>{@code fromSingle} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <T> the target type
<del> * @param singleSource the {@code SingleSource} to convert from
<add> * @param single the {@code SingleSource} to convert from
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code singleSource} is {@code null}
<add> * @throws NullPointerException if {@code single} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Maybe<T> fromSingle(@NonNull SingleSource<T> singleSource) {
<del> Objects.requireNonNull(singleSource, "singleSource is null");
<del> return RxJavaPlugins.onAssembly(new MaybeFromSingle<>(singleSource));
<add> public static <T> Maybe<T> fromSingle(@NonNull SingleSource<T> single) {
<add> Objects.requireNonNull(single, "single is null");
<add> return RxJavaPlugins.onAssembly(new MaybeFromSingle<>(single));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Maybe<T> unsafeCreate(@NonNull MaybeSource<T> onSubscribe) {
<ide> * the factory function to create a resource object that depends on the {@code Maybe}
<ide> * @param sourceSupplier
<ide> * the factory function to create a {@code MaybeSource}
<del> * @param resourceDisposer
<add> * @param resourceCleanup
<ide> * the function that will dispose of the resource
<ide> * @return the new {@code Maybe} instance
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/using.html">ReactiveX operators documentation: Using</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<ide> public static <T, D> Maybe<T> using(@NonNull Supplier<? extends D> resourceSupplier,
<ide> @NonNull Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
<del> @NonNull Consumer<? super D> resourceDisposer) {
<del> return using(resourceSupplier, sourceSupplier, resourceDisposer, true);
<add> @NonNull Consumer<? super D> resourceCleanup) {
<add> return using(resourceSupplier, sourceSupplier, resourceCleanup, true);
<ide> }
<ide>
<ide> /**
<ide> public static <T, D> Maybe<T> using(@NonNull Supplier<? extends D> resourceSuppl
<ide> * the factory function to create a resource object that depends on the {@code Maybe}
<ide> * @param sourceSupplier
<ide> * the factory function to create a {@code MaybeSource}
<del> * @param resourceDisposer
<add> * @param resourceCleanup
<ide> * the function that will dispose of the resource
<ide> * @param eager
<ide> * If {@code true} then resource disposal will happen either on a {@code dispose()} call before the upstream is disposed
<ide> * or just before the emission of a terminal event ({@code onSuccess}, {@code onComplete} or {@code onError}).
<ide> * If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed
<ide> * or just after the emission of a terminal event ({@code onSuccess}, {@code onComplete} or {@code onError}).
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceDisposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/using.html">ReactiveX operators documentation: Using</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, D> Maybe<T> using(@NonNull Supplier<? extends D> resourceSupplier,
<ide> @NonNull Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
<del> @NonNull Consumer<? super D> resourceDisposer, boolean eager) {
<add> @NonNull Consumer<? super D> resourceCleanup, boolean eager) {
<ide> Objects.requireNonNull(resourceSupplier, "resourceSupplier is null");
<ide> Objects.requireNonNull(sourceSupplier, "sourceSupplier is null");
<del> Objects.requireNonNull(resourceDisposer, "resourceDisposer is null");
<del> return RxJavaPlugins.onAssembly(new MaybeUsing<T, D>(resourceSupplier, sourceSupplier, resourceDisposer, eager));
<add> Objects.requireNonNull(resourceCleanup, "resourceCleanup is null");
<add> return RxJavaPlugins.onAssembly(new MaybeUsing<T, D>(resourceSupplier, sourceSupplier, resourceCleanup, eager));
<ide> }
<ide>
<ide> /**
<ide> public final Single<T> defaultIfEmpty(@NonNull T defaultItem) {
<ide> * <dd>This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the {@link TimeUnit} in which {@code period} is defined
<ide> public final Single<T> defaultIfEmpty(@NonNull T defaultItem) {
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Maybe<T> delay(long delay, @NonNull TimeUnit unit) {
<del> return delay(delay, unit, Schedulers.computation());
<add> public final Maybe<T> delay(long time, @NonNull TimeUnit unit) {
<add> return delay(time, unit, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Maybe<T> delay(long delay, @NonNull TimeUnit unit) {
<ide> * <dd>you specify which {@code Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Maybe<T> delay(long delay, @NonNull TimeUnit unit) {
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<del> public final Maybe<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> public final Maybe<T> delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<del> return RxJavaPlugins.onAssembly(new MaybeDelay<>(this, Math.max(0L, delay), unit, scheduler));
<add> return RxJavaPlugins.onAssembly(new MaybeDelay<>(this, Math.max(0L, time), unit, scheduler));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Maybe<T> delaySubscription(@NonNull Publisher<U> subscriptionIn
<ide> * <dd>This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the time to delay the subscription
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final <U> Maybe<T> delaySubscription(@NonNull Publisher<U> subscriptionIn
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Maybe<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<del> return delaySubscription(delay, unit, Schedulers.computation());
<add> public final Maybe<T> delaySubscription(long time, @NonNull TimeUnit unit) {
<add> return delaySubscription(time, unit, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Maybe<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<ide> * <dd>You specify which {@code Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the time to delay the subscription
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Maybe<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Maybe<T> delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return delaySubscription(Flowable.timer(delay, unit, scheduler));
<add> public final Maybe<T> delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return delaySubscription(Flowable.timer(time, unit, scheduler));
<ide> }
<ide>
<ide> /**
<ide> public final <R> Maybe<R> flatMap(
<ide> * the type of items emitted by the resulting {@code Maybe}
<ide> * @param mapper
<ide> * a function that returns a {@code MaybeSource} for the item emitted by the current {@code Maybe}
<del> * @param resultSelector
<add> * @param combiner
<ide> * a function that combines one item emitted by each of the source and collection {@code MaybeSource} and
<ide> * returns an item to be emitted by the resulting {@code MaybeSource}
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code mapper} or {@code resultSelector} is {@code null}
<add> * @throws NullPointerException if {@code mapper} or {@code combiner} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public final <U, R> Maybe<R> flatMap(@NonNull Function<? super T, ? extends MaybeSource<? extends U>> mapper,
<del> @NonNull BiFunction<? super T, ? super U, ? extends R> resultSelector) {
<add> @NonNull BiFunction<? super T, ? super U, ? extends R> combiner) {
<ide> Objects.requireNonNull(mapper, "mapper is null");
<del> Objects.requireNonNull(resultSelector, "resultSelector is null");
<del> return RxJavaPlugins.onAssembly(new MaybeFlatMapBiSelector<>(this, mapper, resultSelector));
<add> Objects.requireNonNull(combiner, "combiner is null");
<add> return RxJavaPlugins.onAssembly(new MaybeFlatMapBiSelector<>(this, mapper, combiner));
<ide> }
<ide>
<ide> /**
<ide> public final Maybe<T> onErrorComplete(@NonNull Predicate<? super Throwable> pred
<ide> * <dd>{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param next
<add> * @param fallback
<ide> * the next {@code MaybeSource} that will take over if the current {@code Maybe} encounters
<ide> * an error
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code next} is {@code null}
<add> * @throws NullPointerException if {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Maybe<T> onErrorResumeWith(@NonNull MaybeSource<? extends T> next) {
<del> Objects.requireNonNull(next, "next is null");
<del> return onErrorResumeNext(Functions.justFunction(next));
<add> public final Maybe<T> onErrorResumeWith(@NonNull MaybeSource<? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return onErrorResumeNext(Functions.justFunction(fallback));
<ide> }
<ide>
<ide> /**
<ide> public final Maybe<T> onErrorResumeWith(@NonNull MaybeSource<? extends T> next)
<ide> * <dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param resumeFunction
<add> * @param fallbackSupplier
<ide> * a function that returns a {@code MaybeSource} that will take over if the current {@code Maybe} encounters
<ide> * an error
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code resumeFunction} is {@code null}
<add> * @throws NullPointerException if {@code fallbackSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Maybe<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? extends MaybeSource<? extends T>> resumeFunction) {
<del> Objects.requireNonNull(resumeFunction, "resumeFunction is null");
<del> return RxJavaPlugins.onAssembly(new MaybeOnErrorNext<>(this, resumeFunction));
<add> public final Maybe<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? extends MaybeSource<? extends T>> fallbackSupplier) {
<add> Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null");
<add> return RxJavaPlugins.onAssembly(new MaybeOnErrorNext<>(this, fallbackSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final Maybe<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? e
<ide> * <dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param valueSupplier
<add> * @param itemSupplier
<ide> * a function that returns a single value that will be emitted as success value
<ide> * the current {@code Maybe} signals an {@code onError} event
<ide> * @return the new {@code Maybe} instance
<del> * @throws NullPointerException if {@code valueSupplier} is {@code null}
<add> * @throws NullPointerException if {@code itemSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Maybe<T> onErrorReturn(@NonNull Function<? super Throwable, ? extends T> valueSupplier) {
<del> Objects.requireNonNull(valueSupplier, "valueSupplier is null");
<del> return RxJavaPlugins.onAssembly(new MaybeOnErrorReturn<>(this, valueSupplier));
<add> public final Maybe<T> onErrorReturn(@NonNull Function<? super Throwable, ? extends T> itemSupplier) {
<add> Objects.requireNonNull(itemSupplier, "itemSupplier is null");
<add> return RxJavaPlugins.onAssembly(new MaybeOnErrorReturn<>(this, itemSupplier));
<ide> }
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/Observable.java
<ide> public static <T> Observable<T> empty() {
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param errorSupplier
<add> * @param supplier
<ide> * a {@link Supplier} factory to return a {@link Throwable} for each individual {@code Observer}
<ide> * @param <T>
<ide> * the type of the items (ostensibly) emitted by the {@code Observable}
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code errorSupplier} is {@code null}
<add> * @throws NullPointerException if {@code supplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/empty-never-throw.html">ReactiveX operators documentation: Throw</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Observable<T> error(@NonNull Supplier<? extends Throwable> errorSupplier) {
<del> Objects.requireNonNull(errorSupplier, "errorSupplier is null");
<del> return RxJavaPlugins.onAssembly(new ObservableError<>(errorSupplier));
<add> public static <T> Observable<T> error(@NonNull Supplier<? extends Throwable> supplier) {
<add> Objects.requireNonNull(supplier, "supplier is null");
<add> return RxJavaPlugins.onAssembly(new ObservableError<>(supplier));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Observable<T> error(@NonNull Supplier<? extends Throwable> err
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param exception
<add> * @param throwable
<ide> * the particular {@link Throwable} to pass to {@link Observer#onError onError}
<ide> * @param <T>
<ide> * the type of the items (ostensibly) emitted by the {@code Observable}
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code exception} is {@code null}
<add> * @throws NullPointerException if {@code throwable} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/empty-never-throw.html">ReactiveX operators documentation: Throw</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Observable<T> error(@NonNull Throwable exception) {
<del> Objects.requireNonNull(exception, "exception is null");
<del> return error(Functions.justSupplier(exception));
<add> public static <T> Observable<T> error(@NonNull Throwable throwable) {
<add> Objects.requireNonNull(throwable, "throwable is null");
<add> return error(Functions.justSupplier(throwable));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Observable<T> unsafeCreate(@NonNull ObservableSource<T> onSubs
<ide> * the factory function to create a resource object that depends on the {@code ObservableSource}
<ide> * @param sourceSupplier
<ide> * the factory function to create an {@code ObservableSource}
<del> * @param resourceDisposer
<add> * @param resourceCleanup
<ide> * the function that will dispose of the resource
<ide> * @return the new {@code Observable} instance
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/using.html">ReactiveX operators documentation: Using</a>
<ide> */
<ide> @CheckReturnValue
<ide> public static <T> Observable<T> unsafeCreate(@NonNull ObservableSource<T> onSubs
<ide> public static <T, D> Observable<T> using(
<ide> @NonNull Supplier<? extends D> resourceSupplier,
<ide> @NonNull Function<? super D, ? extends ObservableSource<? extends T>> sourceSupplier,
<del> @NonNull Consumer<? super D> resourceDisposer) {
<del> return using(resourceSupplier, sourceSupplier, resourceDisposer, true);
<add> @NonNull Consumer<? super D> resourceCleanup) {
<add> return using(resourceSupplier, sourceSupplier, resourceCleanup, true);
<ide> }
<ide>
<ide> /**
<ide> public static <T, D> Observable<T> using(
<ide> * the factory function to create a resource object that depends on the {@code ObservableSource}
<ide> * @param sourceSupplier
<ide> * the factory function to create an {@code ObservableSource}
<del> * @param resourceDisposer
<add> * @param resourceCleanup
<ide> * the function that will dispose of the resource
<ide> * @param eager
<ide> * If {@code true}, the resource disposal will happen either on a {@code dispose()} call before the upstream is disposed
<ide> * or just before the emission of a terminal event ({@code onComplete} or {@code onError}).
<ide> * If {@code false}, the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed
<ide> * or just after the emission of a terminal event ({@code onComplete} or {@code onError}).
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} and {@code resourceDisposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} and {@code resourceCleanup} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/using.html">ReactiveX operators documentation: Using</a>
<ide> * @since 2.0
<ide> */
<ide> public static <T, D> Observable<T> using(
<ide> public static <T, D> Observable<T> using(
<ide> @NonNull Supplier<? extends D> resourceSupplier,
<ide> @NonNull Function<? super D, ? extends ObservableSource<? extends T>> sourceSupplier,
<del> @NonNull Consumer<? super D> resourceDisposer, boolean eager) {
<add> @NonNull Consumer<? super D> resourceCleanup, boolean eager) {
<ide> Objects.requireNonNull(resourceSupplier, "resourceSupplier is null");
<ide> Objects.requireNonNull(sourceSupplier, "sourceSupplier is null");
<del> Objects.requireNonNull(resourceDisposer, "resourceDisposer is null");
<del> return RxJavaPlugins.onAssembly(new ObservableUsing<T, D>(resourceSupplier, sourceSupplier, resourceDisposer, eager));
<add> Objects.requireNonNull(resourceCleanup, "resourceCleanup is null");
<add> return RxJavaPlugins.onAssembly(new ObservableUsing<T, D>(resourceSupplier, sourceSupplier, resourceCleanup, eager));
<ide> }
<ide>
<ide> /**
<ide> public final Iterable<T> blockingLatest() {
<ide> * <dd>{@code blockingMostRecent} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param initialValue
<add> * @param initialItem
<ide> * the initial value that the {@code Iterable} sequence will yield if the current
<ide> * {@code Observable} has not yet emitted an item
<ide> * @return the new {@code Iterable} instance
<add> * @throws NullPointerException if {@code initialItem} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/first.html">ReactiveX documentation: First</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Iterable<T> blockingMostRecent(@NonNull T initialValue) {
<del> return new BlockingObservableMostRecent<>(this, initialValue);
<add> public final Iterable<T> blockingMostRecent(@NonNull T initialItem) {
<add> Objects.requireNonNull(initialItem, "initialItem is null");
<add> return new BlockingObservableMostRecent<>(this, initialItem);
<ide> }
<ide>
<ide> /**
<ide> public final <U extends Collection<? super T>> Observable<U> buffer(int count, i
<ide> * @param <U> the collection subclass type to buffer into
<ide> * @param <B>
<ide> * the boundary value type (ignored)
<del> * @param boundary
<add> * @param boundaryIndicator
<ide> * the boundary {@code ObservableSource}
<ide> * @param bufferSupplier
<ide> * a factory function that returns an instance of the collection subclass to be used and returned
<ide> * as the buffer
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code boundary} or {@code bufferSupplier} is {@code null}
<add> * @throws NullPointerException if {@code boundaryIndicator} or {@code bufferSupplier} is {@code null}
<ide> * @see #buffer(ObservableSource, int)
<ide> * @see <a href="http://reactivex.io/documentation/operators/buffer.html">ReactiveX operators documentation: Buffer</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <B, @NonNull U extends Collection<? super T>> Observable<U> buffer(@NonNull ObservableSource<B> boundary, @NonNull Supplier<U> bufferSupplier) {
<del> Objects.requireNonNull(boundary, "boundary is null");
<add> public final <B, @NonNull U extends Collection<? super T>> Observable<U> buffer(@NonNull ObservableSource<B> boundaryIndicator, @NonNull Supplier<U> bufferSupplier) {
<add> Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null");
<ide> Objects.requireNonNull(bufferSupplier, "bufferSupplier is null");
<del> return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<>(this, boundary, bufferSupplier));
<add> return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<>(this, boundaryIndicator, bufferSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Observable<U> cast(@NonNull Class<U> clazz) {
<ide> * </dl>
<ide> *
<ide> * @param <U> the accumulator and output type
<del> * @param initialValueSupplier
<add> * @param initialItemSupplier
<ide> * the mutable data structure that will collect the items
<ide> * @param collector
<ide> * a function that accepts the {@code state} and an emitted item, and modifies the accumulator accordingly
<ide> * accordingly
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code initialValueSupplier} or {@code collector} is {@code null}
<add> * @throws NullPointerException if {@code initialItemSupplier} or {@code collector} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/reduce.html">ReactiveX operators documentation: Reduce</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <U> Single<U> collect(@NonNull Supplier<? extends U> initialValueSupplier, @NonNull BiConsumer<? super U, ? super T> collector) {
<del> Objects.requireNonNull(initialValueSupplier, "initialValueSupplier is null");
<add> public final <U> Single<U> collect(@NonNull Supplier<? extends U> initialItemSupplier, @NonNull BiConsumer<? super U, ? super T> collector) {
<add> Objects.requireNonNull(initialItemSupplier, "initialItemSupplier is null");
<ide> Objects.requireNonNull(collector, "collector is null");
<del> return RxJavaPlugins.onAssembly(new ObservableCollectSingle<>(this, initialValueSupplier, collector));
<add> return RxJavaPlugins.onAssembly(new ObservableCollectSingle<>(this, initialItemSupplier, collector));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Single<U> collect(@NonNull Supplier<? extends U> initialValueSu
<ide> * </dl>
<ide> *
<ide> * @param <U> the accumulator and output type
<del> * @param initialValue
<add> * @param initialItem
<ide> * the mutable data structure that will collect the items
<ide> * @param collector
<ide> * a function that accepts the {@code state} and an emitted item, and modifies the accumulator accordingly
<ide> * accordingly
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code initialValue} or {@code collector} is {@code null}
<add> * @throws NullPointerException if {@code initialItem} or {@code collector} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/reduce.html">ReactiveX operators documentation: Reduce</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <U> Single<U> collectInto(@NonNull U initialValue, @NonNull BiConsumer<? super U, ? super T> collector) {
<del> Objects.requireNonNull(initialValue, "initialValue is null");
<del> return collect(Functions.justSupplier(initialValue), collector);
<add> public final <U> Single<U> collectInto(@NonNull U initialItem, @NonNull BiConsumer<? super U, ? super T> collector) {
<add> Objects.requireNonNull(initialItem, "initialItem is null");
<add> return collect(Functions.justSupplier(initialItem), collector);
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> concatWith(@NonNull CompletableSource other) {
<ide> * <dd>{@code contains} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param element
<add> * @param item
<ide> * the item to search for in the emissions from the current {@code Observable}
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code element} is {@code null}
<add> * @throws NullPointerException if {@code item} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/contains.html">ReactiveX operators documentation: Contains</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Single<Boolean> contains(@NonNull Object element) {
<del> Objects.requireNonNull(element, "element is null");
<del> return any(Functions.equalsWith(element));
<add> public final Single<Boolean> contains(@NonNull Object item) {
<add> Objects.requireNonNull(item, "item is null");
<add> return any(Functions.equalsWith(item));
<ide> }
<ide>
<ide> /**
<ide> public final Single<Long> count() {
<ide> *
<ide> * @param <U>
<ide> * the debounce value type (ignored)
<del> * @param debounceSelector
<add> * @param debounceIndicator
<ide> * function to return a sequence that indicates the throttle duration for each item via its own emission or completion
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code debounceSelector} is {@code null}
<add> * @throws NullPointerException if {@code debounceIndicator} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <U> Observable<T> debounce(@NonNull Function<? super T, ? extends ObservableSource<U>> debounceSelector) {
<del> Objects.requireNonNull(debounceSelector, "debounceSelector is null");
<del> return RxJavaPlugins.onAssembly(new ObservableDebounce<>(this, debounceSelector));
<add> public final <U> Observable<T> debounce(@NonNull Function<? super T, ? extends ObservableSource<U>> debounceIndicator) {
<add> Objects.requireNonNull(debounceIndicator, "debounceIndicator is null");
<add> return RxJavaPlugins.onAssembly(new ObservableDebounce<>(this, debounceIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> defaultIfEmpty(@NonNull T defaultItem) {
<ide> *
<ide> * @param <U>
<ide> * the item delay value type (ignored)
<del> * @param itemDelay
<add> * @param itemDelayIndicator
<ide> * a function that returns an {@code ObservableSource} for each item emitted by the current {@code Observable}, which is
<ide> * then used to delay the emission of that item by the resulting {@code Observable} until the {@code ObservableSource}
<ide> * returned from {@code itemDelay} emits an item
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code itemDelay} is {@code null}
<add> * @throws NullPointerException if {@code itemDelayIndicator} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <U> Observable<T> delay(@NonNull Function<? super T, ? extends ObservableSource<U>> itemDelay) {
<del> Objects.requireNonNull(itemDelay, "itemDelay is null");
<del> return flatMap(ObservableInternalHelper.itemDelay(itemDelay));
<add> public final <U> Observable<T> delay(@NonNull Function<? super T, ? extends ObservableSource<U>> itemDelayIndicator) {
<add> Objects.requireNonNull(itemDelayIndicator, "itemDelayIndicator is null");
<add> return flatMap(ObservableInternalHelper.itemDelay(itemDelayIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Observable<T> delay(@NonNull Function<? super T, ? extends Obse
<ide> * <dd>This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the {@link TimeUnit} in which {@code period} is defined
<ide> public final <U> Observable<T> delay(@NonNull Function<? super T, ? extends Obse
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Observable<T> delay(long delay, @NonNull TimeUnit unit) {
<del> return delay(delay, unit, Schedulers.computation(), false);
<add> public final Observable<T> delay(long time, @NonNull TimeUnit unit) {
<add> return delay(time, unit, Schedulers.computation(), false);
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit) {
<ide> * <dd>This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the {@link TimeUnit} in which {@code period} is defined
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit) {
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, boolean delayError) {
<del> return delay(delay, unit, Schedulers.computation(), delayError);
<add> public final Observable<T> delay(long time, @NonNull TimeUnit unit, boolean delayError) {
<add> return delay(time, unit, Schedulers.computation(), delayError);
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, boolean del
<ide> * <dd>You specify which {@link Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, boolean del
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return delay(delay, unit, scheduler, false);
<add> public final Observable<T> delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return delay(time, unit, scheduler, false);
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Sc
<ide> * <dd>You specify which {@link Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the delay to shift the source by
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Sc
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
<add> public final Observable<T> delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<ide>
<del> return RxJavaPlugins.onAssembly(new ObservableDelay<>(this, delay, unit, scheduler, delayError));
<add> return RxJavaPlugins.onAssembly(new ObservableDelay<>(this, time, unit, scheduler, delayError));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> delay(long delay, @NonNull TimeUnit unit, @NonNull Sc
<ide> * the subscription delay value type (ignored)
<ide> * @param <V>
<ide> * the item delay value type (ignored)
<del> * @param subscriptionDelay
<add> * @param subscriptionIndicator
<ide> * a function that returns an {@code ObservableSource} that triggers the subscription to the current {@code Observable}
<ide> * once it emits any item
<del> * @param itemDelay
<add> * @param itemDelayIndicator
<ide> * a function that returns an {@code ObservableSource} for each item emitted by the current {@code Observable}, which is
<ide> * then used to delay the emission of that item by the resulting {@code Observable} until the {@code ObservableSource}
<ide> * returned from {@code itemDelay} emits an item
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code subscriptionDelay} or {@code itemDelay} is {@code null}
<add> * @throws NullPointerException if {@code subscriptionIndicator} or {@code itemDelayIndicator} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <U, V> Observable<T> delay(@NonNull ObservableSource<U> subscriptionDelay,
<del> @NonNull Function<? super T, ? extends ObservableSource<V>> itemDelay) {
<del> return delaySubscription(subscriptionDelay).delay(itemDelay);
<add> public final <U, V> Observable<T> delay(@NonNull ObservableSource<U> subscriptionIndicator,
<add> @NonNull Function<? super T, ? extends ObservableSource<V>> itemDelayIndicator) {
<add> return delaySubscription(subscriptionIndicator).delay(itemDelayIndicator);
<ide> }
<ide>
<ide> /**
<ide> public final <U, V> Observable<T> delay(@NonNull ObservableSource<U> subscriptio
<ide> * </dl>
<ide> *
<ide> * @param <U> the value type of the other {@code Observable}, irrelevant
<del> * @param other the other {@code ObservableSource} that should trigger the subscription
<add> * @param subscriptionIndicator the other {@code ObservableSource} that should trigger the subscription
<ide> * to the current {@code Observable}.
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code other} is {@code null}
<add> * @throws NullPointerException if {@code subscriptionIndicator} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <U> Observable<T> delaySubscription(@NonNull ObservableSource<U> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return RxJavaPlugins.onAssembly(new ObservableDelaySubscriptionOther<>(this, other));
<add> public final <U> Observable<T> delaySubscription(@NonNull ObservableSource<U> subscriptionIndicator) {
<add> Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null");
<add> return RxJavaPlugins.onAssembly(new ObservableDelaySubscriptionOther<>(this, subscriptionIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Observable<T> delaySubscription(@NonNull ObservableSource<U> ot
<ide> * <dd>This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the time to delay the subscription
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final <U> Observable<T> delaySubscription(@NonNull ObservableSource<U> ot
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Observable<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
<del> return delaySubscription(delay, unit, Schedulers.computation());
<add> public final Observable<T> delaySubscription(long time, @NonNull TimeUnit unit) {
<add> return delaySubscription(time, unit, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> delaySubscription(long delay, @NonNull TimeUnit unit)
<ide> * <dd>You specify which {@code Scheduler} this operator will use.</dd>
<ide> * </dl>
<ide> *
<del> * @param delay
<add> * @param time
<ide> * the time to delay the subscription
<ide> * @param unit
<ide> * the time unit of {@code delay}
<ide> public final Observable<T> delaySubscription(long delay, @NonNull TimeUnit unit)
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Observable<T> delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<del> return delaySubscription(timer(delay, unit, scheduler));
<add> public final Observable<T> delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
<add> return delaySubscription(timer(time, unit, scheduler));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Observable<U> ofType(@NonNull Class<U> clazz) {
<ide> * <dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param resumeFunction
<add> * @param fallbackSupplier
<ide> * a function that returns an {@code ObservableSource} that will take over if the current {@code Observable} encounters
<ide> * an error
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code resumeFunction} is {@code null}
<add> * @throws NullPointerException if {@code fallbackSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Observable<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? extends ObservableSource<? extends T>> resumeFunction) {
<del> Objects.requireNonNull(resumeFunction, "resumeFunction is null");
<del> return RxJavaPlugins.onAssembly(new ObservableOnErrorNext<>(this, resumeFunction));
<add> public final Observable<T> onErrorResumeNext(@NonNull Function<? super Throwable, ? extends ObservableSource<? extends T>> fallbackSupplier) {
<add> Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null");
<add> return RxJavaPlugins.onAssembly(new ObservableOnErrorNext<>(this, fallbackSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> onErrorResumeNext(@NonNull Function<? super Throwable
<ide> * <dd>{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param next
<add> * @param fallback
<ide> * the next {@code ObservableSource} source that will take over if the current {@code Observable} encounters
<ide> * an error
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code next} is {@code null}
<add> * @throws NullPointerException if {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Observable<T> onErrorResumeWith(@NonNull ObservableSource<? extends T> next) {
<del> Objects.requireNonNull(next, "next is null");
<del> return onErrorResumeNext(Functions.justFunction(next));
<add> public final Observable<T> onErrorResumeWith(@NonNull ObservableSource<? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return onErrorResumeNext(Functions.justFunction(fallback));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> onErrorResumeWith(@NonNull ObservableSource<? extends
<ide> * <dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param valueSupplier
<add> * @param itemSupplier
<ide> * a function that returns a single value that will be emitted along with a regular {@code onComplete} in case
<ide> * the current {@code Observable} signals an {@code onError} event
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code valueSupplier} is {@code null}
<add> * @throws NullPointerException if {@code itemSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Observable<T> onErrorReturn(@NonNull Function<? super Throwable, ? extends T> valueSupplier) {
<del> Objects.requireNonNull(valueSupplier, "valueSupplier is null");
<del> return RxJavaPlugins.onAssembly(new ObservableOnErrorReturn<>(this, valueSupplier));
<add> public final Observable<T> onErrorReturn(@NonNull Function<? super Throwable, ? extends T> itemSupplier) {
<add> Objects.requireNonNull(itemSupplier, "itemSupplier is null");
<add> return RxJavaPlugins.onAssembly(new ObservableOnErrorReturn<>(this, itemSupplier));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> sorted() {
<ide> * <dd>{@code sorted} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param sortFunction
<add> * @param comparator
<ide> * a function that compares two items emitted by the current {@code Observable} and returns an {@code int}
<ide> * that indicates their sort order
<del> * @throws NullPointerException if {@code sortFunction} is {@code null}
<add> * @throws NullPointerException if {@code comparator} is {@code null}
<ide> * @return the new {@code Observable} instance
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Observable<T> sorted(@NonNull Comparator<? super T> sortFunction) {
<del> Objects.requireNonNull(sortFunction, "sortFunction is null");
<del> return toList().toObservable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.identity());
<add> public final Observable<T> sorted(@NonNull Comparator<? super T> comparator) {
<add> Objects.requireNonNull(comparator, "comparator is null");
<add> return toList().toObservable().map(Functions.listSorter(comparator)).flatMapIterable(Functions.identity());
<ide> }
<ide>
<ide> /**
<ide> public final <V> Observable<T> timeout(@NonNull Function<? super T, ? extends Ob
<ide> * @param itemTimeoutIndicator
<ide> * a function that returns an {@code ObservableSource}, for each item emitted by the current {@code Observable}, that
<ide> * determines the timeout window for the subsequent item
<del> * @param other
<add> * @param fallback
<ide> * the fallback {@code ObservableSource} to switch to if the current {@code Observable} times out
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code itemTimeoutIndicator} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code itemTimeoutIndicator} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<ide> public final <V> Observable<T> timeout(@NonNull Function<? super T, ? extends ObservableSource<V>> itemTimeoutIndicator,
<del> @NonNull ObservableSource<? extends T> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(null, itemTimeoutIndicator, other);
<add> @NonNull ObservableSource<? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(null, itemTimeoutIndicator, fallback);
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> timeout(long timeout, @NonNull TimeUnit unit) {
<ide> * maximum duration between items before a timeout occurs
<ide> * @param unit
<ide> * the unit of time that applies to the {@code timeout} argument
<del> * @param other
<add> * @param fallback
<ide> * the fallback {@code ObservableSource} to use in case of a timeout
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code unit} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.COMPUTATION)
<ide> @NonNull
<del> public final Observable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull ObservableSource<? extends T> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(timeout, unit, other, Schedulers.computation());
<add> public final Observable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull ObservableSource<? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(timeout, unit, fallback, Schedulers.computation());
<ide> }
<ide>
<ide> /**
<ide> public final Observable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNul
<ide> * the unit of time that applies to the {@code timeout} argument
<ide> * @param scheduler
<ide> * the {@code Scheduler} to run the timeout timers on
<del> * @param other
<add> * @param fallback
<ide> * the {@code ObservableSource} to use as the fallback in case of a timeout
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
<add> * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.CUSTOM)
<ide> @NonNull
<del> public final Observable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull ObservableSource<? extends T> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(timeout, unit, other, scheduler);
<add> public final Observable<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull ObservableSource<? extends T> fallback) {
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(timeout, unit, fallback, scheduler);
<ide> }
<ide>
<ide> /**
<ide> public final <U, V> Observable<T> timeout(@NonNull ObservableSource<U> firstTime
<ide> * a function that returns an {@code ObservableSource} for each item emitted by the current {@code Observable} and that
<ide> * determines the timeout window in which the subsequent source item must arrive in order to
<ide> * continue the sequence
<del> * @param other
<add> * @param fallback
<ide> * the fallback {@code ObservableSource} to switch to if the current {@code Observable} times out
<ide> * @return the new {@code Observable} instance
<ide> * @throws NullPointerException
<del> * if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code other} is {@code null}
<add> * if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code fallback} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
<ide> */
<ide> @CheckReturnValue
<ide> public final <U, V> Observable<T> timeout(@NonNull ObservableSource<U> firstTime
<ide> public final <U, V> Observable<T> timeout(
<ide> @NonNull ObservableSource<U> firstTimeoutIndicator,
<ide> @NonNull Function<? super T, ? extends ObservableSource<V>> itemTimeoutIndicator,
<del> @NonNull ObservableSource<? extends T> other) {
<add> @NonNull ObservableSource<? extends T> fallback) {
<ide> Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null");
<del> Objects.requireNonNull(other, "other is null");
<del> return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, other);
<add> Objects.requireNonNull(fallback, "fallback is null");
<add> return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, fallback);
<ide> }
<ide>
<ide> @NonNull
<ide> private Observable<T> timeout0(long timeout, @NonNull TimeUnit unit,
<del> @Nullable ObservableSource<? extends T> other,
<add> @Nullable ObservableSource<? extends T> fallback,
<ide> @NonNull Scheduler scheduler) {
<ide> Objects.requireNonNull(unit, "unit is null");
<ide> Objects.requireNonNull(scheduler, "scheduler is null");
<del> return RxJavaPlugins.onAssembly(new ObservableTimeoutTimed<>(this, timeout, unit, scheduler, other));
<add> return RxJavaPlugins.onAssembly(new ObservableTimeoutTimed<>(this, timeout, unit, scheduler, fallback));
<ide> }
<ide>
<ide> @NonNull
<ide> private <U, V> Observable<T> timeout0(
<ide> @NonNull ObservableSource<U> firstTimeoutIndicator,
<ide> @NonNull Function<? super T, ? extends ObservableSource<V>> itemTimeoutIndicator,
<del> @Nullable ObservableSource<? extends T> other) {
<add> @Nullable ObservableSource<? extends T> fallback) {
<ide> Objects.requireNonNull(itemTimeoutIndicator, "itemTimeoutIndicator is null");
<del> return RxJavaPlugins.onAssembly(new ObservableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, other));
<add> return RxJavaPlugins.onAssembly(new ObservableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, fallback));
<ide> }
<ide>
<ide> /**
<ide> public final Observable<Observable<T>> window(
<ide> *
<ide> * @param <B>
<ide> * the window element type (ignored)
<del> * @param boundary
<add> * @param boundaryIndicator
<ide> * an {@code ObservableSource} whose emitted items close and open windows
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code boundary} is {@code null}
<add> * @throws NullPointerException if {@code boundaryIndicator} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/window.html">ReactiveX operators documentation: Window</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <B> Observable<Observable<T>> window(@NonNull ObservableSource<B> boundary) {
<del> return window(boundary, bufferSize());
<add> public final <B> Observable<Observable<T>> window(@NonNull ObservableSource<B> boundaryIndicator) {
<add> return window(boundaryIndicator, bufferSize());
<ide> }
<ide>
<ide> /**
<ide> public final <B> Observable<Observable<T>> window(@NonNull ObservableSource<B> b
<ide> *
<ide> * @param <B>
<ide> * the window element type (ignored)
<del> * @param boundary
<add> * @param boundaryIndicator
<ide> * an {@code ObservableSource} whose emitted items close and open windows
<ide> * @param bufferSize
<ide> * the capacity hint for the buffer in the inner windows
<ide> * @return the new {@code Observable} instance
<del> * @throws NullPointerException if {@code boundary} is {@code null}
<add> * @throws NullPointerException if {@code boundaryIndicator} is {@code null}
<ide> * @throws IllegalArgumentException if {@code bufferSize} is non-positive
<ide> * @see <a href="http://reactivex.io/documentation/operators/window.html">ReactiveX operators documentation: Window</a>
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final <B> Observable<Observable<T>> window(@NonNull ObservableSource<B> boundary, int bufferSize) {
<del> Objects.requireNonNull(boundary, "boundary is null");
<add> public final <B> Observable<Observable<T>> window(@NonNull ObservableSource<B> boundaryIndicator, int bufferSize) {
<add> Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null");
<ide> ObjectHelper.verifyPositive(bufferSize, "bufferSize");
<del> return RxJavaPlugins.onAssembly(new ObservableWindowBoundary<>(this, boundary, bufferSize));
<add> return RxJavaPlugins.onAssembly(new ObservableWindowBoundary<>(this, boundaryIndicator, bufferSize));
<ide> }
<ide>
<ide> /**
<ide><path>src/main/java/io/reactivex/rxjava3/core/Single.java
<ide> public static <T> Flowable<T> concatEager(@NonNull Iterable<@NonNull ? extends S
<ide> * <dd>{@code defer} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <T> the value type
<del> * @param singleSupplier the {@code Supplier} that is called for each individual {@code SingleObserver} and
<add> * @param supplier the {@code Supplier} that is called for each individual {@code SingleObserver} and
<ide> * returns a {@code SingleSource} instance to subscribe to
<del> * @throws NullPointerException if {@code singleSupplier} is {@code null}
<add> * @throws NullPointerException if {@code supplier} is {@code null}
<ide> * @return the new {@code Single} instance
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Single<T> defer(@NonNull Supplier<? extends SingleSource<? extends T>> singleSupplier) {
<del> Objects.requireNonNull(singleSupplier, "singleSupplier is null");
<del> return RxJavaPlugins.onAssembly(new SingleDefer<>(singleSupplier));
<add> public static <T> Single<T> defer(@NonNull Supplier<? extends SingleSource<? extends T>> supplier) {
<add> Objects.requireNonNull(supplier, "supplier is null");
<add> return RxJavaPlugins.onAssembly(new SingleDefer<>(supplier));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Single<T> defer(@NonNull Supplier<? extends SingleSource<? ext
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <T> the value type
<del> * @param errorSupplier the {@link Supplier} that is called for each individual {@code SingleObserver} and
<add> * @param supplier the {@link Supplier} that is called for each individual {@code SingleObserver} and
<ide> * returns a {@code Throwable} instance to be emitted.
<del> * @throws NullPointerException if {@code errorSupplier} is {@code null}
<add> * @throws NullPointerException if {@code supplier} is {@code null}
<ide> * @return the new {@code Single} instance
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Single<T> error(@NonNull Supplier<? extends Throwable> errorSupplier) {
<del> Objects.requireNonNull(errorSupplier, "errorSupplier is null");
<del> return RxJavaPlugins.onAssembly(new SingleError<>(errorSupplier));
<add> public static <T> Single<T> error(@NonNull Supplier<? extends Throwable> supplier) {
<add> Objects.requireNonNull(supplier, "supplier is null");
<add> return RxJavaPlugins.onAssembly(new SingleError<>(supplier));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Single<T> error(@NonNull Supplier<? extends Throwable> errorSu
<ide> * <dd>{@code error} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param exception
<add> * @param throwable
<ide> * the particular {@link Throwable} to pass to {@link SingleObserver#onError onError}
<ide> * @param <T>
<ide> * the type of the item (ostensibly) emitted by the {@code Single}
<ide> * @return the new {@code Single} that invokes the subscriber's {@link SingleObserver#onError onError} method when
<ide> * the subscriber subscribes to it
<del> * @throws NullPointerException if {@code exception} is {@code null}
<add> * @throws NullPointerException if {@code throwable} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/empty-never-throw.html">ReactiveX operators documentation: Throw</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Single<T> error(@NonNull Throwable exception) {
<del> Objects.requireNonNull(exception, "exception is null");
<del> return error(Functions.justSupplier(exception));
<add> public static <T> Single<T> error(@NonNull Throwable throwable) {
<add> Objects.requireNonNull(throwable, "throwable is null");
<add> return error(Functions.justSupplier(throwable));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Single<T> fromPublisher(@NonNull Publisher<@NonNull ? extends
<ide> * <dd>{@code fromObservable} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param observableSource the source sequence to wrap, not {@code null}
<add> * @param observable the source sequence to wrap, not {@code null}
<ide> * @param <T>
<ide> * the type of the item emitted by the {@code Single}.
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code observableSource} is {@code null}
<add> * @throws NullPointerException if {@code observable} is {@code null}
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public static <T> Single<T> fromObservable(@NonNull ObservableSource<? extends T> observableSource) {
<del> Objects.requireNonNull(observableSource, "observableSource is null");
<del> return RxJavaPlugins.onAssembly(new ObservableSingleSingle<>(observableSource, null));
<add> public static <T> Single<T> fromObservable(@NonNull ObservableSource<? extends T> observable) {
<add> Objects.requireNonNull(observable, "observable is null");
<add> return RxJavaPlugins.onAssembly(new ObservableSingleSingle<>(observable, null));
<ide> }
<ide>
<ide> /**
<ide> public static <T> Single<T> unsafeCreate(@NonNull SingleSource<T> onSubscribe) {
<ide> * @param <T> the value type of the {@code SingleSource} generated
<ide> * @param <U> the resource type
<ide> * @param resourceSupplier the {@link Supplier} called for each {@link SingleObserver} to generate a resource object
<del> * @param singleFunction the function called with the returned resource
<add> * @param sourceSupplier the function called with the returned resource
<ide> * object from {@code resourceSupplier} and should return a {@code SingleSource} instance
<ide> * to be run by the operator
<del> * @param disposer the consumer of the generated resource that is called exactly once for
<add> * @param resourceCleanup the consumer of the generated resource that is called exactly once for
<ide> * that particular resource when the generated {@code SingleSource} terminates
<ide> * (successfully or with an error) or gets disposed.
<ide> * @return the new {@code Single} instance
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} and {@code resourceCleanup} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<ide> public static <T, U> Single<T> using(@NonNull Supplier<U> resourceSupplier,
<del> @NonNull Function<? super U, ? extends SingleSource<? extends T>> singleFunction,
<del> @NonNull Consumer<? super U> disposer) {
<del> return using(resourceSupplier, singleFunction, disposer, true);
<add> @NonNull Function<? super U, ? extends SingleSource<? extends T>> sourceSupplier,
<add> @NonNull Consumer<? super U> resourceCleanup) {
<add> return using(resourceSupplier, sourceSupplier, resourceCleanup, true);
<ide> }
<ide>
<ide> /**
<ide> public static <T, U> Single<T> using(@NonNull Supplier<U> resourceSupplier,
<ide> * @param <T> the value type of the {@code SingleSource} generated
<ide> * @param <U> the resource type
<ide> * @param resourceSupplier the {@link Supplier} called for each {@link SingleObserver} to generate a resource object
<del> * @param singleFunction the function called with the returned resource
<add> * @param sourceSupplier the function called with the returned resource
<ide> * object from {@code resourceSupplier} and should return a {@code SingleSource} instance
<ide> * to be run by the operator
<del> * @param disposer the consumer of the generated resource that is called exactly once for
<add> * @param resourceCleanup the consumer of the generated resource that is called exactly once for
<ide> * that particular resource when the generated {@code SingleSource} terminates
<ide> * (successfully or with an error) or gets disposed.
<ide> * @param eager
<ide> public static <T, U> Single<T> using(@NonNull Supplier<U> resourceSupplier,
<ide> * If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed
<ide> * or just after the emission of a terminal event ({@code onSuccess} or {@code onError}).
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code resourceSupplier}, {@code singleFunction} or {@code disposer} is {@code null}
<add> * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public static <T, U> Single<T> using(
<ide> @NonNull Supplier<U> resourceSupplier,
<del> @NonNull Function<? super U, ? extends SingleSource<? extends T>> singleFunction,
<del> @NonNull Consumer<? super U> disposer,
<add> @NonNull Function<? super U, ? extends SingleSource<? extends T>> sourceSupplier,
<add> @NonNull Consumer<? super U> resourceCleanup,
<ide> boolean eager) {
<ide> Objects.requireNonNull(resourceSupplier, "resourceSupplier is null");
<del> Objects.requireNonNull(singleFunction, "singleFunction is null");
<del> Objects.requireNonNull(disposer, "disposer is null");
<add> Objects.requireNonNull(sourceSupplier, "sourceSupplier is null");
<add> Objects.requireNonNull(resourceCleanup, "resourceCleanup is null");
<ide>
<del> return RxJavaPlugins.onAssembly(new SingleUsing<>(resourceSupplier, singleFunction, disposer, eager));
<add> return RxJavaPlugins.onAssembly(new SingleUsing<>(resourceSupplier, sourceSupplier, resourceCleanup, eager));
<ide> }
<ide>
<ide> /**
<ide> public final Single<T> delay(long time, @NonNull TimeUnit unit, @NonNull Schedul
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param other the {@code CompletableSource} that has to complete before the subscription to the
<add> * @param subscriptionIndicator the {@code CompletableSource} that has to complete before the subscription to the
<ide> * current {@code Single} happens
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code other} is {@code null}
<add> * @throws NullPointerException if {@code subscriptionIndicator} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Single<T> delaySubscription(@NonNull CompletableSource other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return RxJavaPlugins.onAssembly(new SingleDelayWithCompletable<>(this, other));
<add> public final Single<T> delaySubscription(@NonNull CompletableSource subscriptionIndicator) {
<add> Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null");
<add> return RxJavaPlugins.onAssembly(new SingleDelayWithCompletable<>(this, subscriptionIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final Single<T> delaySubscription(@NonNull CompletableSource other) {
<ide> * <dd>{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <U> the element type of the other source
<del> * @param other the {@code SingleSource} that has to complete before the subscription to the
<add> * @param subscriptionIndicator the {@code SingleSource} that has to complete before the subscription to the
<ide> * current {@code Single} happens
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code other} is {@code null}
<add> * @throws NullPointerException if {@code subscriptionIndicator} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final <U> Single<T> delaySubscription(@NonNull SingleSource<U> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return RxJavaPlugins.onAssembly(new SingleDelayWithSingle<>(this, other));
<add> public final <U> Single<T> delaySubscription(@NonNull SingleSource<U> subscriptionIndicator) {
<add> Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null");
<add> return RxJavaPlugins.onAssembly(new SingleDelayWithSingle<>(this, subscriptionIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Single<T> delaySubscription(@NonNull SingleSource<U> other) {
<ide> * <dd>{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <U> the element type of the other source
<del> * @param other the {@code ObservableSource} that has to signal a value or complete before the
<add> * @param subscriptionIndicator the {@code ObservableSource} that has to signal a value or complete before the
<ide> * subscription to the current {@code Single} happens
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code other} is {@code null}
<add> * @throws NullPointerException if {@code subscriptionIndicator} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final <U> Single<T> delaySubscription(@NonNull ObservableSource<U> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return RxJavaPlugins.onAssembly(new SingleDelayWithObservable<>(this, other));
<add> public final <U> Single<T> delaySubscription(@NonNull ObservableSource<U> subscriptionIndicator) {
<add> Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null");
<add> return RxJavaPlugins.onAssembly(new SingleDelayWithObservable<>(this, subscriptionIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final <U> Single<T> delaySubscription(@NonNull ObservableSource<U> other)
<ide> * <dd>{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> * @param <U> the element type of the other source
<del> * @param other the {@code Publisher} that has to signal a value or complete before the
<add> * @param subscriptionIndicator the {@code Publisher} that has to signal a value or complete before the
<ide> * subscription to the current {@code Single} happens
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code other} is {@code null}
<add> * @throws NullPointerException if {@code subscriptionIndicator} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @BackpressureSupport(BackpressureKind.FULL)
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final <U> Single<T> delaySubscription(@NonNull Publisher<U> other) {
<del> Objects.requireNonNull(other, "other is null");
<del> return RxJavaPlugins.onAssembly(new SingleDelayWithPublisher<>(this, other));
<add> public final <U> Single<T> delaySubscription(@NonNull Publisher<U> subscriptionIndicator) {
<add> Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null");
<add> return RxJavaPlugins.onAssembly(new SingleDelayWithPublisher<>(this, subscriptionIndicator));
<ide> }
<ide>
<ide> /**
<ide> public final Single<Notification<T>> materialize() {
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code contains} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param value the value to compare against the success value of this {@code Single}
<add> * @param item the value to compare against the success value of this {@code Single}
<ide> * @return the new {@code Single} instance
<add> * @throws NullPointerException if {@code item} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> @NonNull
<del> public final Single<Boolean> contains(@NonNull Object value) {
<del> return contains(value, ObjectHelper.equalsPredicate());
<add> public final Single<Boolean> contains(@NonNull Object item) {
<add> return contains(item, ObjectHelper.equalsPredicate());
<ide> }
<ide>
<ide> /**
<ide> public final Single<Boolean> contains(@NonNull Object value) {
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code contains} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param value the value to compare against the success value of this {@code Single}
<add> * @param item the value to compare against the success value of this {@code Single}
<ide> * @param comparer the function that receives the success value of this {@code Single}, the value provided
<ide> * and should return {@code true} if they are considered equal
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code value} or {@code comparer} is {@code null}
<add> * @throws NullPointerException if {@code item} or {@code comparer} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Single<Boolean> contains(@NonNull Object value, @NonNull BiPredicate<Object, Object> comparer) {
<del> Objects.requireNonNull(value, "value is null");
<add> public final Single<Boolean> contains(@NonNull Object item, @NonNull BiPredicate<Object, Object> comparer) {
<add> Objects.requireNonNull(item, "item is null");
<ide> Objects.requireNonNull(comparer, "comparer is null");
<del> return RxJavaPlugins.onAssembly(new SingleContains<>(this, value, comparer));
<add> return RxJavaPlugins.onAssembly(new SingleContains<>(this, item, comparer));
<ide> }
<ide>
<ide> /**
<ide> public final Single<T> observeOn(@NonNull Scheduler scheduler) {
<ide> * <dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param resumeFunction
<add> * @param itemSupplier
<ide> * a function that returns an item that the new {@code Single} will emit if the current {@code Single} encounters
<ide> * an error
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code resumeFunction} is {@code null}
<add> * @throws NullPointerException if {@code itemSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Single<T> onErrorReturn(@NonNull Function<Throwable, ? extends T> resumeFunction) {
<del> Objects.requireNonNull(resumeFunction, "resumeFunction is null");
<del> return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, resumeFunction, null));
<add> public final Single<T> onErrorReturn(@NonNull Function<Throwable, ? extends T> itemSupplier) {
<add> Objects.requireNonNull(itemSupplier, "itemSupplier is null");
<add> return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, itemSupplier, null));
<ide> }
<ide>
<ide> /**
<ide> public final Single<T> onErrorReturn(@NonNull Function<Throwable, ? extends T> r
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code onErrorReturnItem} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<del> * @param value the value to signal if the current {@code Single} fails
<add> * @param item the value to signal if the current {@code Single} fails
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code value} is {@code null}
<add> * @throws NullPointerException if {@code item} is {@code null}
<ide> * @since 2.0
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<del> public final Single<T> onErrorReturnItem(@NonNull T value) {
<del> Objects.requireNonNull(value, "value is null");
<del> return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, null, value));
<add> public final Single<T> onErrorReturnItem(@NonNull T item) {
<add> Objects.requireNonNull(item, "item is null");
<add> return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, null, item));
<ide> }
<ide>
<ide> /**
<ide> public final Single<T> onErrorResumeWith(@NonNull SingleSource<? extends T> fall
<ide> * <dd>{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide> *
<del> * @param fallback a function that returns a {@code Single} that will take control if source {@code Single} encounters an error.
<add> * @param fallbackSupplier a function that returns a {@code SingleSource} that will take control if source {@code Single} encounters an error.
<ide> * @return the new {@code Single} instance
<del> * @throws NullPointerException if {@code fallback} is {@code null}
<add> * @throws NullPointerException if {@code fallbackSupplier} is {@code null}
<ide> * @see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
<ide> * @since .20
<ide> */
<ide> @CheckReturnValue
<ide> @NonNull
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide> public final Single<T> onErrorResumeNext(
<del> @NonNull Function<? super Throwable, ? extends SingleSource<? extends T>> fallback) {
<del> Objects.requireNonNull(fallback, "fallback is null");
<del> return RxJavaPlugins.onAssembly(new SingleResumeNext<>(this, fallback));
<add> @NonNull Function<? super Throwable, ? extends SingleSource<? extends T>> fallbackSupplier) {
<add> Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null");
<add> return RxJavaPlugins.onAssembly(new SingleResumeNext<>(this, fallbackSupplier));
<ide> }
<ide>
<ide> /**
<ide><path>src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java
<ide> import io.reactivex.rxjava3.schedulers.TestScheduler;
<ide>
<ide> public class BlockingFlowableMostRecentTest extends RxJavaTest {
<del> @Test
<del> public void mostRecentNull() {
<del> assertNull(Flowable.<Void>never().blockingMostRecent(null).iterator().next());
<del> }
<ide>
<ide> @Test
<ide> public void mostRecent() {
<ide><path>src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java
<ide> import io.reactivex.rxjava3.subjects.*;
<ide>
<ide> public class BlockingObservableMostRecentTest extends RxJavaTest {
<del> @Test
<del> public void mostRecentNull() {
<del> assertNull(Observable.<Void>never().blockingMostRecent(null).iterator().next());
<del> }
<ide>
<ide> static <T> Iterable<T> mostRecent(Observable<T> source, T initialValue) {
<ide> return source.blockingMostRecent(initialValue);
<ide><path>src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java
<add>/**
<add> * Copyright (c) 2016-present, RxJava Contributors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
<add> * compliance with the License. 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 distributed under the License is
<add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
<add> * the License for the specific language governing permissions and limitations under the License.
<add> */
<add>
<add>package io.reactivex.rxjava3.internal.util;
<add>
<add>import java.lang.reflect.*;
<add>import java.util.*;
<add>
<add>import org.reactivestreams.*;
<add>
<add>import com.google.common.base.Strings;
<add>
<add>import io.reactivex.rxjava3.core.*;
<add>import io.reactivex.rxjava3.core.Observer;
<add>import io.reactivex.rxjava3.core.Observable;
<add>
<add>/**
<add> * Compare method argument naming across base classes.
<add> * This is not a full test because some naming mismatch is legitimate, such as singular in Maybe/Single and
<add> * plural in Flowable/Observable
<add> */
<add>public final class OperatorArgumentNaming {
<add>
<add> private OperatorArgumentNaming() {
<add> throw new IllegalStateException("No instances!");
<add> }
<add>
<add> /** Classes to compare with each other. */
<add> static final Class<?>[] CLASSES = { Flowable.class, Observable.class, Maybe.class, Single.class, Completable.class };
<add>
<add> /** Types that refer to a reactive type and is generally matching the parent class; for comparison, these have to be unified. */
<add> static final Set<Class<?>> BASE_TYPE_SET = new HashSet<>(Arrays.asList(
<add> Flowable.class, Publisher.class, Subscriber.class, FlowableSubscriber.class,
<add> Observable.class, ObservableSource.class, Observer.class,
<add> Maybe.class, MaybeSource.class, MaybeObserver.class,
<add> Single.class, SingleSource.class, SingleObserver.class,
<add> Completable.class, CompletableSource.class, CompletableObserver.class
<add> ));
<add>
<add> public static void main(String[] args) {
<add> // className -> methodName -> overloads -> arguments
<add> Map<String, Map<String, List<List<ArgumentNameAndType>>>> map = new HashMap<>();
<add>
<add> for (Class<?> clazz : CLASSES) {
<add> Map<String, List<List<ArgumentNameAndType>>> classMethods = map.computeIfAbsent(clazz.getSimpleName(), v -> new HashMap<>());
<add> for (Method method : clazz.getDeclaredMethods()) {
<add> if (method.getDeclaringClass() == clazz && method.getParameterCount() != 0) {
<add> List<List<ArgumentNameAndType>> overloads = classMethods.computeIfAbsent(method.getName(), v -> new ArrayList<>());
<add>
<add> List<ArgumentNameAndType> overload = new ArrayList<>();
<add> overloads.add(overload);
<add>
<add> for (Parameter param : method.getParameters()) {
<add> String typeName;
<add> Class<?> type = param.getType();
<add> if (type.isArray()) {
<add> Class<?> componentType = type.getComponentType();
<add> if (BASE_TYPE_SET.contains(componentType)) {
<add> typeName = "BaseType";
<add> } else {
<add> typeName = type.getComponentType().getSimpleName() + "[]";
<add> }
<add> } else
<add> if (BASE_TYPE_SET.contains(type)) {
<add> typeName = "BaseType";
<add> } else {
<add> typeName = type.getSimpleName();
<add> }
<add> String name = param.getName();
<add> if (name.equals("bufferSize") || name.equals("prefetch") || name.equals("capacityHint")) {
<add> name = "bufferSize|prefetch|capacityHint";
<add> }
<add> if (name.equals("subscriber") || name.equals("observer")) {
<add> name = "subscriber|observer";
<add> }
<add> if (name.contains("onNext")) {
<add> name = name.replace("onNext", "onNext|onSuccess");
<add> } else
<add> if (name.contains("onSuccess")) {
<add> name = name.replace("onSuccess", "onNext|onSuccess");
<add> }
<add> overload.add(new ArgumentNameAndType(typeName, name));
<add> }
<add> }
<add> }
<add> }
<add>
<add> int counter = 0;
<add>
<add> for (int i = 0; i < CLASSES.length - 1; i++) {
<add> String firstName = CLASSES[i].getSimpleName();
<add> Map<String, List<List<ArgumentNameAndType>>> firstClassMethods = map.get(firstName);
<add> for (int j = i + 1; j < CLASSES.length; j++) {
<add> String secondName = CLASSES[j].getSimpleName();
<add> Map<String, List<List<ArgumentNameAndType>>> secondClassMethods = map.get(secondName);
<add>
<add> for (Map.Entry<String, List<List<ArgumentNameAndType>>> methodOverloadsFirst : firstClassMethods.entrySet()) {
<add>
<add> List<List<ArgumentNameAndType>> methodOverloadsSecond = secondClassMethods.get(methodOverloadsFirst.getKey());
<add>
<add> if (methodOverloadsSecond != null) {
<add> for (List<ArgumentNameAndType> overloadFirst : methodOverloadsFirst.getValue()) {
<add> for (List<ArgumentNameAndType> overloadSecond : methodOverloadsSecond) {
<add> if (overloadFirst.size() == overloadSecond.size()) {
<add> // Argument types match?
<add> boolean match = true;
<add> for (int k = 0; k < overloadFirst.size(); k++) {
<add> if (!overloadFirst.get(k).type.equals(overloadSecond.get(k).type)) {
<add> match = false;
<add> break;
<add> }
<add> }
<add> // Argument names match?
<add> if (match) {
<add> for (int k = 0; k < overloadFirst.size(); k++) {
<add> if (!overloadFirst.get(k).name.equals(overloadSecond.get(k).name)) {
<add> System.out.print("Argument naming mismatch #");
<add> System.out.println(++counter);
<add>
<add> System.out.print(" ");
<add> System.out.print(Strings.padEnd(firstName, Math.max(firstName.length(), secondName.length()) + 1, ' '));
<add> System.out.print(methodOverloadsFirst.getKey());
<add> System.out.print(" ");
<add> System.out.println(overloadFirst);
<add>
<add> System.out.print(" ");
<add> System.out.print(Strings.padEnd(secondName, Math.max(firstName.length(), secondName.length()) + 1, ' '));
<add> System.out.print(methodOverloadsFirst.getKey());
<add> System.out.print(" ");
<add> System.out.println(overloadSecond);
<add> System.out.println();
<add> break;
<add> }
<add> }
<add> }
<add> }
<add> }
<add> }
<add> }
<add> }
<add> }
<add> }
<add> }
<add>
<add> static final class ArgumentNameAndType {
<add> final String type;
<add> final String name;
<add>
<add> ArgumentNameAndType(String type, String name) {
<add> this.type = type;
<add> this.name = name;
<add> }
<add>
<add> @Override
<add> public String toString() {
<add> return type + " " + name;
<add> }
<add> }
<add>}
<ide><path>src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java
<ide> public void checkParallelFlowable() {
<ide> addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class));
<ide> addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE));
<ide>
<del> // null default is allowed
<del> addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "blockingMostRecent", Object.class));
<del>
<ide> // negative time is considered as zero time
<ide> addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class));
<ide> addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class));
<ide> public void checkParallelFlowable() {
<ide> addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class));
<ide> addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE));
<ide>
<del> // null default is allowed
<del> addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "blockingMostRecent", Object.class));
<del>
<ide> // negative time is considered as zero time
<ide> addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class));
<ide> addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class));
<ide><path>src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java
<ide> static void processFile(Class<?> clazz) throws Exception {
<ide>
<ide> int quote = line.indexOf('"', comma);
<ide>
<del> String message = line.substring(quote + 1, quote + 2 + paramName.length());
<add> String message = line.substring(quote + 1, Math.min(line.length(), quote + 2 + paramName.length()));
<ide>
<ide> if (line.contains("\"A Disposable")) {
<ide> continue; | 10 |
Javascript | Javascript | update documentation for emberarray.findby | 1d6bff0d18670e7655b65d80eb4938430aa467b0 | <ide><path>packages/@ember/-internals/runtime/lib/mixins/array.js
<ide> const ArrayMixin = Mixin.create(Enumerable, {
<ide>
<ide> This method works much like the more generic `find()` method.
<ide>
<add> Usage Example:
<add>
<add> ```javascript
<add> let users = [
<add> { id: 1, name: 'Yehuda', isTom: false },
<add> { id: 2, name: 'Tom', isTom: true },
<add> { id: 3, name: 'Melanie', isTom: false },
<add> { id: 4, name: 'Leah', isTom: false }
<add> ];
<add>
<add> users.findBy('id', 4); // { id: 4, name: 'Leah', isTom: false }
<add> users.findBy('name', 'Melanie'); // { id: 3, name: 'Melanie', isTom: false }
<add> users.findBy('isTom'); // { id: 2, name: 'Tom', isTom: true }
<add> ```
<add>
<ide> @method findBy
<ide> @param {String} key the property to test
<ide> @param {String} [value] optional value to test against. | 1 |
Javascript | Javascript | add os x to module loading error test | 339d3840c88470fdc4a3427542258f6ec4856530 | <ide><path>test/parallel/test-module-loading-error.js
<ide> console.error('load test-module-loading-error.js');
<ide> var error_desc = {
<ide> win32: ['%1 is not a valid Win32 application'],
<ide> linux: ['file too short', 'Exec format error'],
<del> sunos: ['unknown file type', 'not an ELF file']
<add> sunos: ['unknown file type', 'not an ELF file'],
<add> darwin: ['file too short']
<ide> };
<ide> var dlerror_msg = error_desc[process.platform];
<ide> | 1 |
Go | Go | add ability to alias any interface in a sanbox | 78b684a24a97b0bc6d9cc4f8b405ac9613cc385e | <ide><path>libnetwork/osl/namespace_linux.go
<ide> func (n *networkNamespace) loopbackUp() error {
<ide> return n.nlHandle.LinkSetUp(iface)
<ide> }
<ide>
<del>func (n *networkNamespace) AddLoopbackAliasIP(ip *net.IPNet) error {
<del> iface, err := n.nlHandle.LinkByName("lo")
<add>func (n *networkNamespace) GetLoopbackIfaceName() string {
<add> return "lo"
<add>}
<add>
<add>func (n *networkNamespace) AddAliasIP(ifName string, ip *net.IPNet) error {
<add> iface, err := n.nlHandle.LinkByName(ifName)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> return n.nlHandle.AddrAdd(iface, &netlink.Addr{IPNet: ip})
<ide> }
<ide>
<del>func (n *networkNamespace) RemoveLoopbackAliasIP(ip *net.IPNet) error {
<del> iface, err := n.nlHandle.LinkByName("lo")
<add>func (n *networkNamespace) RemoveAliasIP(ifName string, ip *net.IPNet) error {
<add> iface, err := n.nlHandle.LinkByName(ifName)
<ide> if err != nil {
<ide> return err
<ide> }
<ide><path>libnetwork/osl/sandbox.go
<ide> type Sandbox interface {
<ide> // Unset the previously set default IPv6 gateway in the sandbox
<ide> UnsetGatewayIPv6() error
<ide>
<del> // AddLoopbackAliasIP adds the passed IP address to the sandbox loopback interface
<del> AddLoopbackAliasIP(ip *net.IPNet) error
<add> // GetLoopbackIfaceName returns the name of the loopback interface
<add> GetLoopbackIfaceName() string
<ide>
<del> // RemoveLoopbackAliasIP removes the passed IP address from the sandbox loopback interface
<del> RemoveLoopbackAliasIP(ip *net.IPNet) error
<add> // AddAliasIP adds the passed IP address to the named interface
<add> AddAliasIP(ifName string, ip *net.IPNet) error
<add>
<add> // RemoveAliasIP removes the passed IP address from the named interface
<add> RemoveAliasIP(ifName string, ip *net.IPNet) error
<ide>
<ide> // Add a static route to the sandbox.
<ide> AddStaticRoute(*types.StaticRoute) error
<ide><path>libnetwork/sandbox.go
<ide> func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) {
<ide> ep.Unlock()
<ide>
<ide> if len(vip) != 0 {
<del> if err := osSbox.RemoveLoopbackAliasIP(&net.IPNet{IP: vip, Mask: net.CIDRMask(32, 32)}); err != nil {
<add> loopName := osSbox.GetLoopbackIfaceName()
<add> if err := osSbox.RemoveAliasIP(loopName, &net.IPNet{IP: vip, Mask: net.CIDRMask(32, 32)}); err != nil {
<ide> logrus.Warnf("Remove virtual IP %v failed: %v", vip, err)
<ide> }
<ide> }
<ide> func (sb *sandbox) populateNetworkResources(ep *endpoint) error {
<ide> }
<ide>
<ide> if len(ep.virtualIP) != 0 {
<del> err := sb.osSbox.AddLoopbackAliasIP(&net.IPNet{IP: ep.virtualIP, Mask: net.CIDRMask(32, 32)})
<add> loopName := sb.osSbox.GetLoopbackIfaceName()
<add> err := sb.osSbox.AddAliasIP(loopName, &net.IPNet{IP: ep.virtualIP, Mask: net.CIDRMask(32, 32)})
<ide> if err != nil {
<ide> return fmt.Errorf("failed to add virtual IP %v: %v", ep.virtualIP, err)
<ide> } | 3 |
Javascript | Javascript | use multiply rather than divide for speed | da70ca6b9629b821d9b0a7e11dee61a5d972f06b | <ide><path>src/css.js
<ide> if ( !jQuery.support.opacity ) {
<ide> get: function( elem, computed ) {
<ide> // IE uses filters for opacity
<ide> return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
<del> ( parseFloat( RegExp.$1 ) / 100 ) + "" :
<add> ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
<ide> computed ? "1" : "";
<ide> },
<ide> | 1 |
Javascript | Javascript | increase scope of connections variable | 24e47535ac79f77744f737109ab3d0082a74bdd3 | <ide><path>examples/js/loaders/FBXLoader.js
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var FBXTree;
<add> var connections;
<ide>
<ide> function FBXLoader( manager ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> parse: function () {
<ide>
<del> this.connections = this.parseConnections();
<add> connections = this.parseConnections();
<ide>
<ide> var images = this.parseImages();
<ide> var textures = this.parseTextures( images );
<ide> var materials = this.parseMaterials( textures );
<ide> var deformers = this.parseDeformers();
<del> var geometryMap = new GeometryParser( this.connections ).parse( deformers );
<add> var geometryMap = new GeometryParser().parse( deformers );
<ide>
<ide> return this.parseScene( deformers, geometryMap, materials );
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var currentPath = this.textureLoader.path;
<ide>
<del> var children = this.connections.get( textureNode.id ).children;
<add> var children = connections.get( textureNode.id ).children;
<ide>
<ide> if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> }
<ide>
<ide> // Ignore unused materials which don't have any connections.
<del> if ( ! this.connections.has( ID ) ) return null;
<add> if ( ! connections.has( ID ) ) return null;
<ide>
<ide> var parameters = this.parseParameters( materialNode, textureMap, ID );
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> }
<ide>
<ide> var self = this;
<del> this.connections.get( ID ).children.forEach( function ( child ) {
<add> connections.get( ID ).children.forEach( function ( child ) {
<ide>
<ide> var type = child.relationship;
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> if ( 'LayeredTexture' in FBXTree.Objects && id in FBXTree.Objects.LayeredTexture ) {
<ide>
<ide> console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.' );
<del> id = this.connections.get( id ).children[ 0 ].ID;
<add> id = connections.get( id ).children[ 0 ].ID;
<ide>
<ide> }
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var deformerNode = DeformerNodes[ nodeID ];
<ide>
<del> var relationships = this.connections.get( parseInt( nodeID ) );
<add> var relationships = connections.get( parseInt( nodeID ) );
<ide>
<ide> if ( deformerNode.attrType === 'Skin' ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> if ( morphTargetNode.attrType !== 'BlendShapeChannel' ) return;
<ide>
<del> var targetRelationships = this.connections.get( parseInt( child.ID ) );
<add> var targetRelationships = connections.get( parseInt( child.ID ) );
<ide>
<ide> targetRelationships.children.forEach( function ( child ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> var modelNode = modelNodes[ model.ID ];
<ide> self.setLookAtProperties( model, modelNode, sceneGraph );
<ide>
<del> var parentConnections = self.connections.get( model.ID ).parents;
<add> var parentConnections = connections.get( model.ID ).parents;
<ide>
<ide> parentConnections.forEach( function ( connection ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var id = parseInt( nodeID );
<ide> var node = modelNodes[ nodeID ];
<del> var relationships = this.connections.get( id );
<add> var relationships = connections.get( id );
<ide>
<ide> var model = this.buildSkeleton( relationships, skeletons, id, node.attrName );
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> if ( 'LookAtProperty' in modelNode ) {
<ide>
<del> var children = this.connections.get( model.ID ).children;
<add> var children = connections.get( model.ID ).children;
<ide>
<ide> children.forEach( function ( child ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var skeleton = skeletons[ ID ];
<ide>
<del> var parents = this.connections.get( parseInt( skeleton.ID ) ).parents;
<add> var parents = connections.get( parseInt( skeleton.ID ) ).parents;
<ide>
<del> var self = this;
<ide> parents.forEach( function ( parent ) {
<ide>
<ide> if ( geometryMap.has( parent.ID ) ) {
<ide>
<ide> var geoID = parent.ID;
<del> var geoRelationships = self.connections.get( geoID );
<add> var geoRelationships = connections.get( geoID );
<ide>
<ide> geoRelationships.parents.forEach( function ( geoConnParent ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> sceneGraph.animations = [];
<ide>
<del> var rawClips = new AnimationParser( this.connections ).parse();
<add> var rawClips = new AnimationParser( connections ).parse();
<ide>
<ide> if ( rawClips === undefined ) return;
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> };
<ide>
<ide> // parse Geometry data from FBXTree and return map of BufferGeometries and nurbs curves
<del> function GeometryParser( connections ) {
<del>
<del> this.connections = connections;
<del>
<del> }
<add> function GeometryParser() {}
<ide>
<ide> GeometryParser.prototype = {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> for ( var nodeID in geoNodes ) {
<ide>
<del> var relationships = this.connections.get( parseInt( nodeID ) );
<add> var relationships = connections.get( parseInt( nodeID ) );
<ide> var geo = this.parseGeometry( relationships, geoNodes[ nodeID ], deformers );
<ide>
<ide> geometryMap.set( parseInt( nodeID ), geo );
<ide> THREE.FBXLoader = ( function () {
<ide> };
<ide>
<ide> // parse animation data from FBXTree
<del> function AnimationParser( connections ) {
<del>
<del> this.connections = connections;
<del>
<del> }
<add> function AnimationParser() {}
<ide>
<ide> AnimationParser.prototype = {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> };
<ide>
<del> var relationships = this.connections.get( animationCurve.id );
<add> var relationships = connections.get( animationCurve.id );
<ide>
<ide> if ( relationships !== undefined ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var layerCurveNodes = [];
<ide>
<del> var connection = this.connections.get( parseInt( nodeID ) );
<add> var connection = connections.get( parseInt( nodeID ) );
<ide>
<ide> if ( connection !== undefined ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var modelID;
<ide>
<del> self.connections.get( child.ID ).parents.forEach( function ( parent ) {
<add> connections.get( child.ID ).parents.forEach( function ( parent ) {
<ide>
<ide> if ( parent.relationship !== undefined ) modelID = parent.ID;
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var deformerID;
<ide>
<del> self.connections.get( child.ID ).parents.forEach( function ( parent ) {
<add> connections.get( child.ID ).parents.forEach( function ( parent ) {
<ide>
<ide> if ( parent.relationship !== undefined ) deformerID = parent.ID;
<ide>
<ide> } );
<ide>
<del> var morpherID = self.connections.get( deformerID ).parents[ 0 ].ID;
<del> var geoID = self.connections.get( morpherID ).parents[ 0 ].ID;
<add> var morpherID = connections.get( deformerID ).parents[ 0 ].ID;
<add> var geoID = connections.get( morpherID ).parents[ 0 ].ID;
<ide>
<ide> // assuming geometry is not used in more than one model
<del> var modelID = self.connections.get( geoID ).parents[ 0 ].ID;
<add> var modelID = connections.get( geoID ).parents[ 0 ].ID;
<ide>
<ide> var rawModel = FBXTree.Objects.Model[ modelID ];
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> for ( var nodeID in rawStacks ) {
<ide>
<del> var children = this.connections.get( parseInt( nodeID ) ).children;
<add> var children = connections.get( parseInt( nodeID ) ).children;
<ide>
<ide> if ( children.length > 1 ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> return FBXLoader;
<ide>
<del>} )();
<ide>\ No newline at end of file
<add>} )(); | 1 |
Go | Go | remove checks for deprecated flags | 85d6fb888c89ff0124b32d7df5485656e2d48b8e | <ide><path>integration-cli/docker_cli_search_test.go
<ide> func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
<ide> out, _, err = dockerCmdWithError("search", "-f", "is-official=a", "busybox")
<ide> assert.ErrorContains(c, err, "", out)
<ide> assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
<del>
<del> // -s --stars deprecated since Docker 1.13
<del> out, _, err = dockerCmdWithError("search", "--stars=a", "busybox")
<del> assert.ErrorContains(c, err, "", out)
<del> assert.Assert(c, strings.Contains(out, "invalid syntax"), "couldn't find the invalid value warning")
<del>
<del> // -s --stars deprecated since Docker 1.13
<del> out, _, err = dockerCmdWithError("search", "-s=-1", "busybox")
<del> assert.ErrorContains(c, err, "", out)
<del> assert.Assert(c, strings.Contains(out, "invalid syntax"), "couldn't find the invalid value warning")
<ide> }
<ide>
<ide> func (s *DockerSuite) TestSearchCmdOptions(c *check.C) { | 1 |
Ruby | Ruby | remove extra whitespaces | 04d37b077baeb36bd7e19342a37974a8542d84a4 | <ide><path>activerecord/lib/active_record/base.rb
<ide> module ActiveRecord #:nodoc:
<ide> #
<ide> # The <tt>authenticate_unsafely</tt> method inserts the parameters directly into the query
<ide> # and is thus susceptible to SQL-injection attacks if the <tt>user_name</tt> and +password+
<del> # parameters come directly from an HTTP request. The <tt>authenticate_safely</tt> and
<add> # parameters come directly from an HTTP request. The <tt>authenticate_safely</tt> and
<ide> # <tt>authenticate_safely_simply</tt> both will sanitize the <tt>user_name</tt> and +password+
<ide> # before inserting them in the query, which will ensure that an attacker can't escape the
<ide> # query and fake the login (or worse).
<ide> class Base
<ide> ##
<ide> # :singleton-method:
<ide> # Specifies the format to use when dumping the database schema with Rails'
<del> # Rakefile. If :sql, the schema is dumped as (potentially database-
<del> # specific) SQL statements. If :ruby, the schema is dumped as an
<add> # Rakefile. If :sql, the schema is dumped as (potentially database-
<add> # specific) SQL statements. If :ruby, the schema is dumped as an
<ide> # ActiveRecord::Schema file which can be loaded into any database that
<del> # supports migrations. Use :ruby if you want to have different database
<add> # supports migrations. Use :ruby if you want to have different database
<ide> # adapters for, e.g., your development and test environments.
<ide> cattr_accessor :schema_format , :instance_writer => false
<ide> @@schema_format = :ruby
<ide> class << self # Class methods
<ide> delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly, :having, :create_with, :to => :scoped
<ide> delegate :count, :average, :minimum, :maximum, :sum, :calculate, :to => :scoped
<ide>
<del> # Executes a custom SQL query against your database and returns all the results. The results will
<add> # Executes a custom SQL query against your database and returns all the results. The results will
<ide> # be returned as an array with columns requested encapsulated as attributes of the model you call
<del> # this method from. If you call <tt>Product.find_by_sql</tt> then the results will be returned in
<add> # this method from. If you call <tt>Product.find_by_sql</tt> then the results will be returned in
<ide> # a Product object with the attributes you specified in the SQL query.
<ide> #
<ide> # If you call a complicated SQL query which spans multiple tables the columns specified by the
<ide> # SELECT will be attributes of the model, whether or not they are columns of the corresponding
<ide> # table.
<ide> #
<del> # The +sql+ parameter is a full SQL query as a string. It will be called as is, there will be
<del> # no database agnostic conversions performed. This should be a last resort because using, for example,
<add> # The +sql+ parameter is a full SQL query as a string. It will be called as is, there will be
<add> # no database agnostic conversions performed. This should be a last resort because using, for example,
<ide> # MySQL specific terms will lock you to using that particular database engine or require you to
<ide> # change your call if you switch engines.
<ide> #
<ide> def find_by_sql(sql, binds = [])
<ide> # Creates an object (or multiple objects) and saves it to the database, if validations pass.
<ide> # The resulting object is returned whether the object was saved successfully to the database or not.
<ide> #
<del> # The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the
<add> # The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the
<ide> # attributes on the objects that are to be created.
<ide> #
<ide> # ==== Examples
<ide> def create(attributes = nil, &block)
<ide>
<ide> # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part.
<ide> # The use of this method should be restricted to complicated SQL queries that can't be executed
<del> # using the ActiveRecord::Calculations class methods. Look into those before using this.
<add> # using the ActiveRecord::Calculations class methods. Look into those before using this.
<ide> #
<ide> # ==== Parameters
<ide> #
<ide> def serialize(attr_name, class_name = Object)
<ide> # invoice/lineitem.rb Invoice::Lineitem lineitems
<ide> #
<ide> # Additionally, the class-level +table_name_prefix+ is prepended and the
<del> # +table_name_suffix+ is appended. So if you have "myapp_" as a prefix,
<add> # +table_name_suffix+ is appended. So if you have "myapp_" as a prefix,
<ide> # the table name guess for an Invoice class becomes "myapp_invoices".
<ide> # Invoice::Lineitem becomes "myapp_invoice_lineitems".
<ide> #
<ide> def inheritance_column
<ide> @inheritance_column ||= "type"
<ide> end
<ide>
<del> # Lazy-set the sequence name to the connection's default. This method
<add> # Lazy-set the sequence name to the connection's default. This method
<ide> # is only ever called once since set_sequence_name overrides it.
<ide> def sequence_name #:nodoc:
<ide> reset_sequence_name
<ide> def reset_sequence_name #:nodoc:
<ide> default
<ide> end
<ide>
<del> # Sets the table name. If the value is nil or false then the value returned by the given
<add> # Sets the table name. If the value is nil or false then the value returned by the given
<ide> # block is used.
<ide> #
<ide> # class Project < ActiveRecord::Base
<ide> def all_attributes_exists?(attribute_names)
<ide> # <tt>where</tt>, <tt>includes</tt>, and <tt>joins</tt> operations in <tt>Relation</tt>, which are merged.
<ide> #
<ide> # <tt>joins</tt> operations are uniqued so multiple scopes can join in the same table without table aliasing
<del> # problems. If you need to join multiple tables, but still want one of the tables to be uniqued, use the
<add> # problems. If you need to join multiple tables, but still want one of the tables to be uniqued, use the
<ide> # array of strings format for your joins.
<ide> #
<ide> # class Article < ActiveRecord::Base
<ide> def sanitize_sql_hash_for_assignment(attrs)
<ide> end.join(', ')
<ide> end
<ide>
<del> # Accepts an array of conditions. The array has each value
<add> # Accepts an array of conditions. The array has each value
<ide> # sanitized and interpolated into the SQL statement.
<ide> # ["name='%s' and group_id='%s'", "foo'bar", 4] returns "name='foo''bar' and group_id='4'"
<ide> def sanitize_sql_array(ary)
<ide> def initialize(attributes = nil)
<ide> end
<ide>
<ide> # Populate +coder+ with attributes about this record that should be
<del> # serialized. The structure of +coder+ defined in this method is
<add> # serialized. The structure of +coder+ defined in this method is
<ide> # guaranteed to match the structure of +coder+ passed to the +init_with+
<ide> # method.
<ide> #
<ide> def encode_with(coder)
<ide> coder['attributes'] = attributes
<ide> end
<ide>
<del> # Initialize an empty model object from +coder+. +coder+ must contain
<del> # the attributes necessary for initializing an empty model object. For
<add> # Initialize an empty model object from +coder+. +coder+ must contain
<add> # the attributes necessary for initializing an empty model object. For
<ide> # example:
<ide> #
<ide> # class Post < ActiveRecord::Base | 1 |
Text | Text | incorporate changes from code review | b125bd92cf6cc4042716d499c816db89334d8b31 | <ide><path>docs/Deprecating-Disabling-and-Removing-Formulae.md
<ide> This general rule of thumb can be followed:
<ide>
<ide> - `deprecate!` should be used for formulae that _should_ no longer be used.
<ide> - `disable!` should be used for formulae that _cannot_ be used.
<del>- Formulae that have are not longer acceptable in homebrew/core or have been disabled for over a year should be removed.
<add>- Formulae that are no longer acceptable in homebrew/core or have been disabled for over a year should be removed.
<ide>
<ide> ## Deprecation
<ide>
<ide> If a user attempts to install a deprecated formula, they will be shown a warning message but the install will succeed.
<ide>
<del>A formula should be deprecated to indicate to users that the formula should not be used and may be disabled in the future. Deprecated formulae should still be able to build from source and their bottles should continue to work.
<add>A formula should be deprecated to indicate to users that the formula should not be used and may be disabled in the future. Deprecated formulae should still build from source and their bottles should continue to work.
<ide>
<ide> The most common reasons for deprecation are when the upstream project is deprecated, unmaintained, or archived.
<ide>
<ide> deprecate! date: "YYYY-MM-DD", because: :reason
<ide>
<ide> The `date` parameter should be set to the date that the project or version became (or will become) deprecated. If there is no clear date but the formula needs to be deprecated, use today's date. If the `date` parameter is set to a date in the future, the formula will not become deprecated until that date. This can be useful if the upstream developers have indicated a date where the project or version will stop being supported.
<ide>
<del>The `because` parameter can be set to a preset reason (using a symbol) or a custom reason. See the [Deprecate and Disable Reasons](#deprecate-and-disable-reasons) section below for more details about the `because` parameter.
<add>The `because` parameter can be a preset reason (using a symbol) or a custom reason. See the [Deprecate and Disable Reasons](#deprecate-and-disable-reasons) section below for more details about the `because` parameter.
<ide>
<ide> ## Disabling
<ide>
<ide> If a user attempts to install a disabled formula, they will be shown an error message and the install will fail.
<ide>
<del>A formula should be disabled to indicate to users that the formula cannot be used and will be removed in the future. Disabled formulae may no longer be able to build from source or have working bottles.
<add>A formula should be disabled to indicate to users that the formula cannot be used and will be removed in the future. Disabled formulae may no longer build from source or have working bottles.
<ide>
<del>The most common reasons for disabling are when the formula cannot be built from source (meaning no bottles can be built), has been deprecated for a long time, the upstream repository has been removed, or the project has no license.
<add>The most common reasons for disabling are when the formula cannot be built from source (meaning no bottles can be built), the formula has been deprecated for a long time, the upstream repository has been removed, or the project has no license.
<ide>
<ide> **Note: disabled formulae in homebrew/core will be automatically removed one year after their disable date**
<ide>
<ide> disable! date: "YYYY-MM-DD", because: :reason
<ide>
<ide> The `date` parameter should be set to the date that the reason for disabling came into effect. If there is no clear date but the formula needs to be disabled, use today's date. If the `date` parameter is set to a date in the future, the formula will be deprecated until that date (on which the formula will become disabled).
<ide>
<del>The `because` parameter can be set to a preset reason (using a symbol) or a custom reason. See the [Deprecate and Disable Reasons](#deprecate-and-disable-reasons) section below for more details about the `because` parameter.
<add>The `because` parameter can be a preset reason (using a symbol) or a custom reason. See the [Deprecate and Disable Reasons](#deprecate-and-disable-reasons) section below for more details about the `because` parameter.
<ide>
<ide> ## Removal
<ide> | 1 |
Javascript | Javascript | change the channel owner to the resource url | a842534a564b715629d3037b2ec94225a5a3e2bc | <ide><path>extensions/firefox/components/PdfStreamConverter.js
<ide> PdfStreamConverter.prototype = {
<ide> var resourcePrincipal = 'getNoAppCodebasePrincipal' in securityManager ?
<ide> securityManager.getNoAppCodebasePrincipal(uri) :
<ide> securityManager.getCodebasePrincipal(uri);
<del> channel.owner = resourcePrincipal;
<add> aRequest.owner = resourcePrincipal;
<ide> }
<ide> channel.asyncOpen(proxy, aContext);
<ide> }, | 1 |
Python | Python | close the tfrecordwriter after use | e1364ca051f703aa7dad208efb297a6712470d1f | <ide><path>im2txt/im2txt/data/build_mscoco_data.py
<ide> def _process_image_files(thread_index, ranges, name, images, decoder, vocab,
<ide> (datetime.now(), thread_index, counter, num_images_in_thread))
<ide> sys.stdout.flush()
<ide>
<add> writer.close()
<ide> print("%s [thread %d]: Wrote %d image-caption pairs to %s" %
<ide> (datetime.now(), thread_index, shard_counter, output_file))
<ide> sys.stdout.flush()
<ide><path>inception/inception/data/build_image_data.py
<ide> def _process_image_files_batch(coder, thread_index, ranges, name, filenames,
<ide> (datetime.now(), thread_index, counter, num_files_in_thread))
<ide> sys.stdout.flush()
<ide>
<add> writer.close()
<ide> print('%s [thread %d]: Wrote %d images to %s' %
<ide> (datetime.now(), thread_index, shard_counter, output_file))
<ide> sys.stdout.flush()
<ide><path>inception/inception/data/build_imagenet_data.py
<ide> def _process_image_files_batch(coder, thread_index, ranges, name, filenames,
<ide> (datetime.now(), thread_index, counter, num_files_in_thread))
<ide> sys.stdout.flush()
<ide>
<add> writer.close()
<ide> print('%s [thread %d]: Wrote %d images to %s' %
<ide> (datetime.now(), thread_index, shard_counter, output_file))
<ide> sys.stdout.flush() | 3 |
Text | Text | translate 02.1 to korean | aae74da7920875b9cfa35c9f5d1516fd4288d111 | <ide><path>docs/docs/02.1-jsx-in-depth.ko-KR.md
<add>---
<add>id: jsx-in-depth-ko-KR
<add>title: JSX 깊이보기
<add>permalink: jsx-in-depth.ko-KR.html
<add>prev: displaying-data.ko-KR.html
<add>next: jsx-spread.ko-KR.html
<add>---
<add>
<add>[JSX](http://facebook.github.io/jsx/)는 XML과 비슷한 JavaScript문법 확장입니다. React에서 변환되는 간단한 JSX 구문을 사용하실 수 있습니다.
<add>
<add>## 왜 JSX인가?
<add>
<add>React를 위해 꼭 JSX를 사용할 필요는 없고, 그냥 일반 JS를 사용할 수도 있습니만 JSX를 사용하기를 추천합니다. 왜냐하면, 어트리뷰트를 가진 트리 구조로 정의할 수 있는 간결하고 익숙한 문법이기 때문입니다.
<add>
<add>이것은 디자이너 같은 케쥬얼 개발자에게 더 익숙합니다.
<add>
<add>XML에는 여닫는 태그의 장점이 있습니다. 태그는 큰 트리일 때 함수 호출이나 객체 리터럴보다 읽기 쉬워 집니다.
<add>
<add>JSX는 JavaScript의 시맨틱을 변경하지 않습니다.
<add>
<add>## HTML 태그 vs. React 컴포넌트
<add>
<add>React는 렌더 HTML 태그(문자열)이나 React 컴포넌트(클래스)일 수 있습니다.
<add>
<add>HTML 태그를 렌더하려면, 그냥 JSX에 소문자 태그를 사용하세요.
<add>
<add>```javascript
<add>var myDivElement = <div className="foo" />;
<add>React.render(myDivElement, document.body);
<add>```
<add>
<add>React 컴포넌트를 렌더하려면, 대문자로 시작하는 로컬 변수를 만드세요.
<add>
<add>```javascript
<add>var MyComponent = React.createClass({/*...*/});
<add>var myElement = <MyComponent someProperty={true} />;
<add>React.render(myElement, document.body);
<add>```
<add>
<add>React JSX는 대소문자를 로컬 컴포넌트 클래스와 HTML 태그를 구별하는 컨벤션으로 사용합니다.
<add>
<add>> 주의:
<add>>
<add>> JSX가 JavaScript기 때문에, `class`, `for`같은 식별자는 XML 어트리뷰트 이름으로
<add>> 권장하지 않습니다. 대신, React DOM 컴포넌트는 각각 `className`, `htmlFor`같은
<add>> DOM 프로퍼티 이름을 기대합니다.
<add>
<add>## 변환
<add>
<add>React JSX는 XML같은 문법에서 네이티브 JavaScript로 변환됩니다. XML 엘리먼트, 어트리뷰트, 자식은 `React.createElement`에 넘겨지는 인자로 변환됩니다.
<add>
<add>```javascript
<add>var Nav;
<add>// 입력 (JSX):
<add>var app = <Nav color="blue" />;
<add>// 출력 (JS):
<add>var app = React.createElement(Nav, {color:"blue"});
<add>```
<add>
<add>`<Nav />`를 사용하려면, `Nav`변수는 스코프에 있어야 합니다.
<add>
<add>JSX에서는 XML 구문으로 자식을 지정할 수도 있습니다.
<add>
<add>```javascript
<add>var Nav, Profile;
<add>// 입력 (JSX):
<add>var app = <Nav color="blue"><Profile>click</Profile></Nav>;
<add>// 출력 (JS):
<add>var app = React.createElement(
<add> Nav,
<add> {color:"blue"},
<add> React.createElement(Profile, null, "click")
<add>);
<add>```
<add>
<add>[JSX 컴파일러](/react/jsx-compiler.html)를 사용해보면 JSX에서 어떻게 네이티브
<add>JavaScript로 변환하는지(desugars) 볼 수 있고,
<add>[HTML에서 JSX 변환기](/react/html-jsx.html)는 이미 있는 HTML을 JSX로 변환해
<add>줍니다.
<add>
<add>JSX를 사용 하시려면, [시작하기](/react/docs/getting-started.html) 가이드에서 어떻게 컴파일을 설정하는지 보실 수 있습니다.
<add>
<add>> 주의:
<add>>
<add>> JSX 표현식은 언제나 ReactElement로 평가됩니다. 실제 구현의 세부사항은 많이
<add>> 다를 수 있습니다. 최적화 모드는ReactElement를 `React.createElement`에서 검증
<add>> 코드를 우회하는 객체 리터럴로 ReactElement를 인라인으로 만들 수 있습니다.
<add>
<add>## 네임스페이스를 사용한 컴포넌트
<add>
<add>자식을 많이 가지는 컴포넌트를 만들거나, 재사용 가능한 컴포넌트 카테고리(`Form` 카테고리처럼)가 있는 애플리케이션을 만든다면, 간단하고 쉽게 하기 위해, *컴포넌트에서 네임스페이스*를 사용할 수 있습니다. 예를 들어, 이렇게 해야 할 일이 있다면
<add>
<add>```javascript
<add>var Form = MyFormComponent;
<add>var FormRow = Form.Row;
<add>var FormLabel = Form.Label;
<add>var FormInput = Form.Input;
<add>
<add>var App = (
<add> <Form>
<add> <FormRow>
<add> <FormLabel />
<add> <FormInput />
<add> </FormRow>
<add> </Form>
<add>);
<add>```
<add>
<add>위에 변수를 한 묶음 선언하는 대신에, 다른 컴포넌트를 어트리뷰트로 가지는 하나의 컴포넌트만 쓸 수 있습니다.
<add>
<add>```javascript
<add>var Form = MyFormComponent;
<add>
<add>var App = (
<add> <Form>
<add> <Form.Row>
<add> <Form.Label />
<add> <Form.Input />
<add> </Form.Row>
<add> </Form>
<add>);
<add>```
<add>
<add>이렇게 하려면, *"sub-components"*를 메인 컴포넌트의 어트리뷰트로 만들 필요가 있습니다.
<add>
<add>```javascript
<add>var MyFormComponent = React.createClass({ ... });
<add>
<add>MyFormComponent.Row = React.createClass({ ... });
<add>MyFormComponent.Label = React.createClass({ ... });
<add>MyFormComponent.Input = React.createClass({ ... });
<add>```
<add>
<add>코드를 컴파일할 때 JSX는 이것을 제대로 처리해 줍니다.
<add>
<add>```javascript
<add>var App = (
<add> React.createElement(Form, null,
<add> React.createElement(Form.Row, null,
<add> React.createElement(Form.Label, null),
<add> React.createElement(Form.Input, null)
<add> )
<add> )
<add>);
<add>```
<add>
<add>> 주의:
<add>>
<add>> 이 기능은 [v0.11](http://facebook.github.io/react/blog/2014/07/17/react-v0.11.html#jsx) 이상에만 있습니다.
<add>
<add>## JavaScript 표현식
<add>
<add>### 어트리뷰트 표현식
<add>
<add>JavaScript 표현식을 어트리뷰트 값으로 사용하려면, 표현식을 쌍따옴표(`""`)대신
<add>중괄호(`{}`)로 감싸야 합니다.
<add>
<add>```javascript
<add>// 입력 (JSX):
<add>var person = <Person name={window.isLoggedIn ? window.name : ''} />;
<add>// 출력 (JS):
<add>var person = React.createElement(
<add> Person,
<add> {name: window.isLoggedIn ? window.name : ''}
<add>);
<add>```
<add>
<add>### 자식 표현식
<add>
<add>비슷하게, JavaScript 표현식은 자식을 표현하는 데 사용할 수 있습니다.
<add>
<add>```javascript
<add>// 입력 (JSX):
<add>var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>;
<add>// 출력 (JS):
<add>var content = React.createElement(
<add> Container,
<add> null,
<add> window.isLoggedIn ? React.createElement(Nav) : React.createElement(Login)
<add>);
<add>```
<add>
<add>### 주석
<add>
<add>JSX에 주석을 넣기는 쉽습니다. 그냥 JS 표현식과 같습니다. 그냥 태그의 자식 섹션에서만 조심하시면 됩니다. 이럴 땐 주석 주변에 `{}`를 감싸야 합니다.
<add>
<add>```javascript
<add>var content = (
<add> <Nav>
<add> {/* 자식 주석, {}로 감싼다 */}
<add> <Person
<add> /* 여러
<add> 줄
<add> 주석 */
<add> name={window.isLoggedIn ? window.name : ''} // 줄 끝부분 주석
<add> />
<add> </Nav>
<add>);
<add>```
<add>
<add>> 주의:
<add>>
<add>> JSX 는 HTML과 비슷하지만 완전히 같지는 않습니다. 중요한 차이점을 보시려면 [JSX gotchas](/react/docs/jsx-gotchas.html)를 보세요. | 1 |
PHP | PHP | fix another reference to license.txt | 887dc4d7219df894e1fc0b153a40f69d172e1991 | <ide><path>tests/TestCase/Mailer/EmailTest.php
<ide> public function testAttachments()
<ide> $this->Email->addAttachments([CORE_PATH . 'config' . DS . 'bootstrap.php']);
<ide> $this->Email->addAttachments([
<ide> 'other.txt' => CORE_PATH . 'config' . DS . 'bootstrap.php',
<del> 'license' => CORE_PATH . 'LICENSE.txt'
<add> 'license' => CORE_PATH . 'LICENSE'
<ide> ]);
<ide> $expected = [
<ide> 'basics.php' => ['file' => CAKE . 'basics.php', 'mimetype' => 'text/plain'],
<ide> 'bootstrap.php' => ['file' => CORE_PATH . 'config' . DS . 'bootstrap.php', 'mimetype' => 'text/x-php'],
<ide> 'other.txt' => ['file' => CORE_PATH . 'config' . DS . 'bootstrap.php', 'mimetype' => 'text/x-php'],
<del> 'license' => ['file' => CORE_PATH . 'LICENSE.txt', 'mimetype' => 'text/plain']
<add> 'license' => ['file' => CORE_PATH . 'LICENSE', 'mimetype' => 'text/plain']
<ide> ];
<ide> $this->assertSame($expected, $this->Email->getAttachments());
<ide> $this->expectException(\InvalidArgumentException::class); | 1 |
Javascript | Javascript | add unit test for relative paths in collection | 572dad409d67949453874e3361e19558726a84fb | <ide><path>packages/sproutcore-handlebars/tests/views/collection_view_test.js
<ide> var set = SC.set, setPath = SC.setPath;
<ide> var view;
<ide>
<del>module("SC.HandlebarsCollectionView", {
<add>module("sproutcore-handlebars/tests/views/collection_view_test", {
<ide> setup: function() {
<ide> window.TemplateTests = SC.Namespace.create();
<ide> },
<ide> test("passing a block to the collection helper sets it as the template for examp
<ide> });
<ide>
<ide> view = SC.View.create({
<del> template: SC.Handlebars.compile('{{#collection "TemplateTests.CollectionTestView"}} <label></label> {{/collection}}')
<add> template: SC.Handlebars.compile('{{#collection TemplateTests.CollectionTestView}} <label></label> {{/collection}}')
<add> });
<add>
<add> SC.run(function() {
<add> view.appendTo('#qunit-fixture');
<add> });
<add>
<add> equals(view.$('label').length, 3, 'one label element is created for each content item');
<add>});
<add>
<add>test("collection helper should accept relative paths", function() {
<add>
<add> view = SC.View.create({
<add> template: SC.Handlebars.compile('{{#collection collection}} <label></label> {{/collection}}'),
<add> collection: SC.CollectionView.extend({
<add> tagName: 'ul',
<add> content: ['foo', 'bar', 'baz']
<add> })
<ide> });
<ide>
<ide> SC.run(function() { | 1 |
Python | Python | fix import of stop words in language data | 29720150f9960c1a57b2d463d4653e0a8f3211e0 | <ide><path>spacy/nl/language_data.py
<ide> from .. import language_data as base
<ide> from ..language_data import update_exc, strings_to_exc
<ide>
<del>from .stop_words import STOP_WORDS
<add>from .word_sets import STOP_WORDS, NUM_WORDS
<ide>
<ide>
<ide> STOP_WORDS = set(STOP_WORDS) | 1 |
Go | Go | use _, _ string | 454f56e37eefd072e350739a6c5a06743ff913ef | <ide><path>api/client/cli.go
<ide> func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey,
<ide> if proto == "unix" {
<ide> // no need in compressing for local communications
<ide> tr.DisableCompression = true
<del> tr.Dial = func(dial_network, dial_addr string) (net.Conn, error) {
<add> tr.Dial = func(_, _ string) (net.Conn, error) {
<ide> return net.DialTimeout(proto, addr, timeout)
<ide> }
<ide> } else { | 1 |
Javascript | Javascript | fix tab completion bug | e29e470c14ac3c48f144b29383907ddab3a210b1 | <ide><path>lib/readline.js
<ide> Interface.prototype._tabComplete = function() {
<ide> var width = completions.reduce(function(a, b) {
<ide> return a.length > b.length ? a : b;
<ide> }).length + 2; // 2 space padding
<del> var maxColumns = Math.floor(self.columns / width) || 1;
<add> var maxColumns = Math.floor(self.columns / width);
<add> if (!maxColumns || maxColumns === Infinity) {
<add> maxColumns = 1;
<add> }
<ide> var group = [], c;
<ide> for (var i = 0, compLen = completions.length; i < compLen; i++) {
<ide> c = completions[i];
<ide><path>test/parallel/test-readline-undefined-columns.js
<add>'use strict';
<add>
<add>const assert = require('assert');
<add>const PassThrough = require('stream').PassThrough;
<add>const readline = require('readline');
<add>
<add>// Checks that tab completion still works
<add>// when output column size is undefined
<add>
<add>const iStream = new PassThrough();
<add>const oStream = new PassThrough();
<add>
<add>const rli = readline.createInterface({
<add> terminal: true,
<add> input: iStream,
<add> output: oStream,
<add> completer: function(line, cb) {
<add> cb(null, [['process.stdout', 'process.stdin', 'process.stderr'], line]);
<add> }
<add>});
<add>
<add>var output = '';
<add>
<add>oStream.on('data', function(data) {
<add> output += data;
<add>});
<add>
<add>oStream.on('end', function() {
<add> const expect = 'process.stdout\r\n' +
<add> 'process.stdin\r\n' +
<add> 'process.stderr';
<add> assert(new RegExp(expect).test(output));
<add>});
<add>
<add>iStream.write('process.std\t');
<add>oStream.end(); | 2 |
Python | Python | force the return of token type ids | ffcffebe85206425a5e6b6285fc3a3aa376d547f | <ide><path>examples/utils_multiple_choice.py
<ide> def convert_examples_to_features(
<ide> else:
<ide> text_b = example.question + " " + ending
<ide>
<del> inputs = tokenizer.encode_plus(text_a, text_b, add_special_tokens=True, max_length=max_length,)
<add> inputs = tokenizer.encode_plus(
<add> text_a, text_b, add_special_tokens=True, max_length=max_length, return_token_type_ids=True
<add> )
<ide> if "num_truncated_tokens" in inputs and inputs["num_truncated_tokens"] > 0:
<ide> logger.info(
<ide> "Attention! you are cropping tokens (swag task is ok). "
<ide><path>src/transformers/data/processors/squad.py
<ide> def squad_convert_example_to_features(example, max_seq_length, doc_stride, max_q
<ide> pad_to_max_length=True,
<ide> stride=max_seq_length - doc_stride - len(truncated_query) - sequence_pair_added_tokens,
<ide> truncation_strategy="only_second" if tokenizer.padding_side == "right" else "only_first",
<add> return_token_type_ids=True,
<ide> )
<ide>
<ide> paragraph_len = min( | 2 |
Mixed | Javascript | remove deprecated property | 1fcb76e8f2f05fc084337da097a17b06cc7d0c68 | <ide><path>doc/api/cluster.md
<ide> if (cluster.isMaster) {
<ide> }
<ide> ```
<ide>
<del>### worker.suicide
<del><!-- YAML
<del>added: v0.7.0
<del>deprecated: v6.0.0
<del>changes:
<del> - version: v7.0.0
<del> pr-url: https://github.com/nodejs/node/pull/3747
<del> description: Accessing this property will now emit a deprecation warning.
<del>-->
<del>
<del>> Stability: 0 - Deprecated: Use [`worker.exitedAfterDisconnect`][] instead.
<del>
<del>An alias to [`worker.exitedAfterDisconnect`][].
<del>
<del>Set by calling `.kill()` or `.disconnect()`. Until then, it is `undefined`.
<del>
<del>The boolean `worker.suicide` is used to distinguish between voluntary
<del>and accidental exit, the master may choose not to respawn a worker based on
<del>this value.
<del>
<del>```js
<del>cluster.on('exit', (worker, code, signal) => {
<del> if (worker.suicide === true) {
<del> console.log('Oh, it was just voluntary – no need to worry');
<del> }
<del>});
<del>
<del>// kill worker
<del>worker.kill();
<del>```
<del>
<del>This API only exists for backwards compatibility and will be removed in the
<del>future.
<del>
<ide> ## Event: 'disconnect'
<ide> <!-- YAML
<ide> added: v0.7.9
<ide><path>lib/internal/cluster/worker.js
<ide> 'use strict';
<ide> const EventEmitter = require('events');
<del>const internalUtil = require('internal/util');
<ide> const util = require('util');
<del>const defineProperty = Object.defineProperty;
<del>const suicideDeprecationMessage =
<del> 'worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.';
<ide>
<ide> module.exports = Worker;
<ide>
<ide> function Worker(options) {
<ide>
<ide> this.exitedAfterDisconnect = undefined;
<ide>
<del> defineProperty(this, 'suicide', {
<del> get: internalUtil.deprecate(
<del> () => this.exitedAfterDisconnect,
<del> suicideDeprecationMessage, 'DEP0007'),
<del> set: internalUtil.deprecate(
<del> (val) => { this.exitedAfterDisconnect = val; },
<del> suicideDeprecationMessage, 'DEP0007'),
<del> enumerable: true
<del> });
<del>
<ide> this.state = options.state || 'none';
<ide> this.id = options.id | 0;
<ide> | 2 |
Python | Python | fix py3k syntax errors | 44930f30915298cda8c1474ed9ec4415258c3e6f | <ide><path>rest_framework/authentication.py
<ide> def authenticate(self, request):
<ide> try:
<ide> consumer_key = oauth_request.get_parameter('oauth_consumer_key')
<ide> consumer = oauth_provider_store.get_consumer(request, oauth_request, consumer_key)
<del> except oauth_provider_store.InvalidConsumerError, err:
<add> except oauth_provider_store.InvalidConsumerError as err:
<ide> raise exceptions.AuthenticationFailed(err)
<ide>
<ide> if consumer.status != oauth_provider.consts.ACCEPTED:
<ide> def authenticate(self, request):
<ide>
<ide> try:
<ide> self.validate_token(request, consumer, token)
<del> except oauth.Error, e:
<del> raise exceptions.AuthenticationFailed(e.message)
<add> except oauth.Error as err:
<add> raise exceptions.AuthenticationFailed(err.message)
<ide>
<ide> user = token.user
<ide> | 1 |
Ruby | Ruby | implement githubgistformula in a more natural way | c50fdbd139439576318460d12c98ba007f28becd | <ide><path>Library/Homebrew/formula_specialties.rb
<ide> def install
<ide>
<ide> # See browser for an example
<ide> class GithubGistFormula < ScriptFileFormula
<del> def initialize(*)
<del> url = self.class.stable.url
<del> self.class.stable.version(File.basename(File.dirname(url))[0,6])
<add> def self.url(val)
<ide> super
<add> version File.basename(File.dirname(val))[0, 6]
<ide> end
<ide> end
<ide> | 1 |
Javascript | Javascript | add usesyncexternalstore to react-debug-tools | cfd81933286f3a63734ba0ac1650019487c402ff | <ide><path>packages/react-debug-tools/src/ReactDebugHooks.js
<ide> function useSyncExternalStore<T>(
<ide> subscribe: (() => void) => () => void,
<ide> getSnapshot: () => T,
<ide> ): T {
<del> throw new Error('Not yet implemented');
<add> // useSyncExternalStore() composes multiple hooks internally.
<add> // Advance the current hook index the same number of times
<add> // so that subsequent hooks have the right memoized state.
<add> nextHook(); // SyncExternalStore
<add> nextHook(); // LayoutEffect
<add> nextHook(); // Effect
<add> const value = getSnapshot();
<add> hookLog.push({
<add> primitive: 'SyncExternalStore',
<add> stackError: new Error(),
<add> value,
<add> });
<add> return value;
<ide> }
<ide>
<ide> function useTransition(): [boolean, (() => void) => void] {
<ide><path>packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js
<ide> describe('ReactHooksInspectionIntegration', () => {
<ide> },
<ide> ]);
<ide> });
<add>
<add> // @gate experimental || www
<add> it('should support composite useSyncExternalStore hook', () => {
<add> const useSyncExternalStore = React.unstable_useSyncExternalStore;
<add> function Foo() {
<add> const value = useSyncExternalStore(
<add> () => () => {},
<add> () => 'snapshot',
<add> );
<add> React.useMemo(() => 'memo', []);
<add> return value;
<add> }
<add>
<add> const renderer = ReactTestRenderer.create(<Foo />);
<add> const childFiber = renderer.root.findByType(Foo)._currentFiber();
<add> const tree = ReactDebugTools.inspectHooksOfFiber(childFiber);
<add> expect(tree).toEqual([
<add> {
<add> id: 0,
<add> isStateEditable: false,
<add> name: 'SyncExternalStore',
<add> value: 'snapshot',
<add> subHooks: [],
<add> },
<add> {
<add> id: 1,
<add> isStateEditable: false,
<add> name: 'Memo',
<add> value: 'memo',
<add> subHooks: [],
<add> },
<add> ]);
<add> });
<ide> }); | 2 |
Text | Text | update changelog to add previously_new_record? | 2dbe1302a19e43ab4bfe753dfc7a4f5872093d30 | <ide><path>activerecord/CHANGELOG.md
<add>* Add `ActiveRecord::Base#previously_new_record?` to show if a record was new before the last save.
<add>
<add> *Tom Ward*
<add>
<ide> * Allow generated `create_table` migrations to include or skip timestamps.
<ide>
<del> *Michael Duchemin*
<add> *Michael Duchemin*
<ide>
<ide> Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activerecord/CHANGELOG.md) for previous changes. | 1 |
Text | Text | update custom server docs | 1a53f4500aaa5a211540e7aa86858521f34e1ec9 | <ide><path>docs/advanced-features/custom-server.md
<ide> app.prepare().then(() => {
<ide> const { pathname, query } = parsedUrl
<ide>
<ide> if (pathname === '/a') {
<del> app.render(req, res, '/b', query)
<del> } else if (pathname === '/b') {
<ide> app.render(req, res, '/a', query)
<add> } else if (pathname === '/b') {
<add> app.render(req, res, '/b', query)
<ide> } else {
<ide> handle(req, res, parsedUrl)
<ide> } | 1 |
Mixed | Python | update indonesian example phrases | 7489d02deaae09f1d0901122c7c40c71f0e85560 | <ide><path>.github/contributors/rasyidf.md
<add># spaCy contributor agreement
<add>
<add>This spaCy Contributor Agreement (**"SCA"**) is based on the
<add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
<add>The SCA applies to any contribution that you make to any product or project
<add>managed by us (the **"project"**), and sets out the intellectual property rights
<add>you grant to us in the contributed materials. The term **"us"** shall mean
<add>[ExplosionAI UG (haftungsbeschränkt)](https://explosion.ai/legal). The term
<add>**"you"** shall mean the person or entity identified below.
<add>
<add>If you agree to be bound by these terms, fill in the information requested
<add>below and include the filled-in version with your first pull request, under the
<add>folder [`.github/contributors/`](/.github/contributors/). The name of the file
<add>should be your GitHub username, with the extension `.md`. For example, the user
<add>example_user would create the file `.github/contributors/example_user.md`.
<add>
<add>Read this agreement carefully before signing. These terms and conditions
<add>constitute a binding legal agreement.
<add>
<add>## Contributor Agreement
<add>
<add>1. The term "contribution" or "contributed materials" means any source code,
<add>object code, patch, tool, sample, graphic, specification, manual,
<add>documentation, or any other material posted or submitted by you to the project.
<add>
<add>2. With respect to any worldwide copyrights, or copyright applications and
<add>registrations, in your contribution:
<add>
<add> * you hereby assign to us joint ownership, and to the extent that such
<add> assignment is or becomes invalid, ineffective or unenforceable, you hereby
<add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
<add> royalty-free, unrestricted license to exercise all rights under those
<add> copyrights. This includes, at our option, the right to sublicense these same
<add> rights to third parties through multiple levels of sublicensees or other
<add> licensing arrangements;
<add>
<add> * you agree that each of us can do all things in relation to your
<add> contribution as if each of us were the sole owners, and if one of us makes
<add> a derivative work of your contribution, the one who makes the derivative
<add> work (or has it made will be the sole owner of that derivative work;
<add>
<add> * you agree that you will not assert any moral rights in your contribution
<add> against us, our licensees or transferees;
<add>
<add> * you agree that we may register a copyright in your contribution and
<add> exercise all ownership rights associated with it; and
<add>
<add> * you agree that neither of us has any duty to consult with, obtain the
<add> consent of, pay or render an accounting to the other for any use or
<add> distribution of your contribution.
<add>
<add>3. With respect to any patents you own, or that you can license without payment
<add>to any third party, you hereby grant to us a perpetual, irrevocable,
<add>non-exclusive, worldwide, no-charge, royalty-free license to:
<add>
<add> * make, have made, use, sell, offer to sell, import, and otherwise transfer
<add> your contribution in whole or in part, alone or in combination with or
<add> included in any product, work or materials arising out of the project to
<add> which your contribution was submitted, and
<add>
<add> * at our option, to sublicense these same rights to third parties through
<add> multiple levels of sublicensees or other licensing arrangements.
<add>
<add>4. Except as set out above, you keep all right, title, and interest in your
<add>contribution. The rights that you grant to us under these terms are effective
<add>on the date you first submitted a contribution to us, even if your submission
<add>took place before the date you sign these terms.
<add>
<add>5. You covenant, represent, warrant and agree that:
<add>
<add> * Each contribution that you submit is and shall be an original work of
<add> authorship and you can legally grant the rights set out in this SCA;
<add>
<add> * to the best of your knowledge, each contribution will not violate any
<add> third party's copyrights, trademarks, patents, or other intellectual
<add> property rights; and
<add>
<add> * each contribution shall be in compliance with U.S. export control laws and
<add> other applicable export and import laws. You agree to notify us if you
<add> become aware of any circumstance which would make any of the foregoing
<add> representations inaccurate in any respect. We may publicly disclose your
<add> participation in the project, including the fact that you have signed the SCA.
<add>
<add>6. This SCA is governed by the laws of the State of California and applicable
<add>U.S. Federal law. Any choice of law rules will not apply.
<add>
<add>7. Please place an “x” on one of the applicable statement below. Please do NOT
<add>mark both statements:
<add>
<add> * [x] I am signing on behalf of myself as an individual and no other person
<add> or entity, including my employer, has or will have rights with respect to my
<add> contributions.
<add>
<add> * [ ] I am signing on behalf of my employer or a legal entity and I have the
<add> actual authority to contractually bind that entity.
<add>
<add>## Contributor Details
<add>
<add>| Field | Entry |
<add>|------------------------------- | ------------------------ |
<add>| Name | Muhammad Fahmi Rasyid |
<add>| Company name (if applicable) | |
<add>| Title or role (if applicable) | |
<add>| Date | 2020-09-23 |
<add>| GitHub username | rasyidf |
<add>| Website (optional) | http://rasyidf.github.io |
<ide><path>spacy/lang/id/examples.py
<ide>
<ide>
<ide> sentences = [
<del> "Al Qaidah mengklaim bom mobil yang menewaskan 60 Orang di Mali",
<del> "Abu Sayyaf mengeksekusi sandera warga Filipina",
<add> "Indonesia merupakan negara kepulauan yang kaya akan budaya.",
<add> "Berapa banyak warga yang dibutuhkan saat kerja bakti?",
<ide> "Penyaluran pupuk berasal dari lima lokasi yakni Bontang, Kalimantan Timur, Surabaya, Banyuwangi, Semarang, dan Makassar.",
<ide> "PT Pupuk Kaltim telah menyalurkan 274.707 ton pupuk bersubsidi ke wilayah penyaluran di 14 provinsi.",
<ide> "Jakarta adalah kota besar yang nyaris tidak pernah tidur." | 2 |
Ruby | Ruby | add spec for attribute#inspect | 16707d1b96365ab569e7a5e47a3d694c14d4132c | <ide><path>spec/arel/algebra/unit/primitives/attribute_spec.rb
<ide> module Arel
<ide> @attribute = @relation[:id]
<ide> end
<ide>
<add> describe "#inspect" do
<add> it "returns a simple, short inspect string" do
<add> @attribute.inspect.should == "<Attribute id>"
<add> end
<add> end
<add>
<ide> describe Attribute::Transformations do
<ide> describe '#as' do
<ide> it "manufactures an aliased attributed" do | 1 |
PHP | PHP | fix disabled attribute check | 91319bbe7bc665befc67a5d2e6db6490354819fb | <ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php
<ide> public function testInputCheckbox() {
<ide> '/div'
<ide> );
<ide> $this->assertTags($result, $expected);
<add>
<add> $result = $this->Form->input('User.disabled', array(
<add> 'label' => 'Disabled',
<add> 'type' => 'checkbox',
<add> 'data-foo' => 'disabled'
<add> ));
<add> $expected = array(
<add> 'div' => array('class' => 'input checkbox'),
<add> 'input' => array('type' => 'hidden', 'name' => 'data[User][disabled]', 'value' => '0', 'id' => 'UserDisabled_'),
<add> array('input' => array(
<add> 'type' => 'checkbox',
<add> 'name' => 'data[User][disabled]',
<add> 'value' => '1',
<add> 'id' => 'UserDisabled',
<add> 'data-foo' => 'disabled'
<add> )),
<add> 'label' => array('for' => 'UserDisabled'),
<add> 'Disabled',
<add> '/label',
<add> '/div'
<add> );
<add> $this->assertTags($result, $expected);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/View/Helper/FormHelper.php
<ide> protected function _initInputField($field, $options = array()) {
<ide> }
<ide>
<ide> $disabledIndex = array_search('disabled', $options, true);
<del> if ($disabledIndex !== false) {
<add> if (is_int($disabledIndex)) {
<ide> unset($options[$disabledIndex]);
<ide> $options['disabled'] = true;
<ide> } | 2 |
PHP | PHP | fix php-cs (missing spaces) | cd31676cf7177ad5dcef008c1fb1a90034216280 | <ide><path>src/View/ViewBlock.php
<ide> public function end()
<ide> return;
<ide> }
<ide> if (!empty($this->_active)) {
<del> $mode = end($this->_active);
<add> $mode = end($this->_active);
<ide> $active = key($this->_active);
<ide> $content = ob_get_clean();
<del> if($mode === ViewBlock::OVERRIDE) {
<add> if ($mode === ViewBlock::OVERRIDE) {
<ide> $this->_blocks[$active] = $content;
<ide> } else {
<ide> $this->concat($active, $content, $mode);
<ide> public function end()
<ide> */
<ide> public function concat($name, $value = null, $mode = ViewBlock::APPEND)
<ide> {
<del> if($value === null) {
<add> if ($value === null) {
<ide> $this->start($name, $mode);
<ide> return;
<ide> } | 1 |
Ruby | Ruby | use homebrew_git_* vars | 28f4d68b31959483a2245a17e4b28fa5e440c8d5 | <ide><path>Library/Homebrew/dev-cmd/bottle.rb
<ide> def merge
<ide> end
<ide>
<ide> unless ARGV.include? "--no-commit"
<add> if ENV["HOMEBREW_GIT_NAME"]
<add> ENV["GIT_AUTHOR_NAME"] =
<add> ENV["GIT_COMMITTER_NAME"] =
<add> ENV["HOMEBREW_GIT_NAME"]
<add> end
<add> if ENV["HOMEBREW_GIT_EMAIL"]
<add> ENV["GIT_AUTHOR_EMAIL"] =
<add> ENV["GIT_COMMITTER_EMAIL"] =
<add> ENV["HOMEBREW_GIT_EMAIL"]
<add> end
<add>
<ide> short_name = formula_name.split("/", -1).last
<ide> pkg_version = bottle_hash["formula"]["pkg_version"]
<ide> | 1 |
Javascript | Javascript | use debug for prettier logs | 52529a99b17ae267773fa760bcf5bd396ea0b642 | <ide><path>server/boot/explorer.js
<add>const createDebugger = require('debug');
<add>
<add>const log = createDebugger('fcc:boot:explorer');
<add>
<ide> module.exports = function mountLoopBackExplorer(app) {
<ide> if (process.env.NODE_ENV === 'production') {
<ide> return;
<ide> }
<del> var explorer;
<add> let explorer;
<ide> try {
<ide> explorer = require('loopback-component-explorer');
<ide> } catch (err) {
<ide> // Print the message only when the app was started via `app.listen()`.
<ide> // Do not print any message when the project is used as a component.
<ide> app.once('started', function() {
<del> console.log(
<add> log(
<ide> 'Run `npm install loopback-component-explorer` to enable ' +
<ide> 'the LoopBack explorer'
<ide> );
<ide> });
<ide> return;
<ide> }
<ide>
<del> var restApiRoot = app.get('restApiRoot');
<del> var mountPath = '/explorer';
<add> const restApiRoot = app.get('restApiRoot');
<add> const mountPath = '/explorer';
<ide>
<ide> explorer(app, { basePath: restApiRoot, mountPath });
<ide> app.once('started', function() {
<del> var baseUrl = app.get('url').replace(/\/$/, '');
<add> const baseUrl = app.get('url').replace(/\/$/, '');
<ide>
<del> console.log('Browse your REST API at %s%s', baseUrl, mountPath);
<add> log('Browse your REST API at %s%s', baseUrl, mountPath);
<ide> });
<ide> };
<ide><path>server/production-start.js
<ide> // this ensures node understands the future
<ide> require('babel-register');
<ide> const _ = require('lodash');
<add>const createDebugger = require('debug');
<ide>
<add>const log = createDebugger('fcc:server:production-start');
<ide> const startTime = Date.now();
<add>// force logger to always output
<add>// this may be brittle
<add>log.enabled = true;
<ide> // this is where server starts booting up
<ide> const app = require('./server');
<ide>
<add>
<ide> let timeoutHandler;
<ide> let killTime = 15;
<ide>
<ide> const onConnect = _.once(() => {
<del> console.log('db connected in: %s', Date.now() - startTime);
<add> log('db connected in: %s', Date.now() - startTime);
<ide> if (timeoutHandler) {
<ide> clearTimeout(timeoutHandler);
<ide> }
<ide><path>server/server.js
<ide> const boot = require('loopback-boot');
<ide> const expressState = require('express-state');
<ide> const path = require('path');
<ide> const setupPassport = require('./component-passport');
<add>const createDebugger = require('debug');
<add>
<add>const log = createDebugger('fcc:server');
<add>// force logger to always output
<add>// this may be brittle
<add>log.enabled = true;
<ide>
<ide> Rx.config.longStackSupport = process.env.NODE_DEBUG !== 'production';
<ide> const app = loopback();
<ide> boot(app, {
<ide> setupPassport(app);
<ide>
<ide> const { db } = app.datasources;
<del>db.on('connected', _.once(() => console.log('db connected')));
<add>db.on('connected', _.once(() => log('db connected')));
<ide> app.start = _.once(function() {
<ide> const server = app.listen(app.get('port'), function() {
<ide> app.emit('started');
<del> console.log(
<add> log(
<ide> 'freeCodeCamp server listening on port %d in %s',
<ide> app.get('port'),
<ide> app.get('env')
<ide> );
<ide> if (isBeta) {
<del> console.log('freeCodeCamp is in beta mode');
<add> log('freeCodeCamp is in beta mode');
<ide> }
<del> console.log(`connecting to db at ${db.settings.url}`);
<add> log(`connecting to db at ${db.settings.url}`);
<ide> });
<ide>
<ide> process.on('SIGINT', () => {
<del> console.log('Shutting down server');
<add> log('Shutting down server');
<ide> server.close(() => {
<del> console.log('Server is closed');
<add> log('Server is closed');
<ide> });
<del> console.log('closing db connection');
<add> log('closing db connection');
<ide> db.disconnect()
<ide> .then(() => {
<del> console.log('DB connection closed');
<add> log('DB connection closed');
<ide> // exit process
<ide> // this may close kept alive sockets
<ide> // eslint-disable-next-line no-process-exit | 3 |
Javascript | Javascript | remove dead code | b15c80696c9ddcaddcf3b997a8d2617ebe22a447 | <ide><path>grunt/tasks/browserify.js
<ide> module.exports = function() {
<ide> config.globalTransforms = config.globalTransforms || [];
<ide> config.plugins = config.plugins || [];
<ide> config.after = config.after || [];
<del> config.paths = config.paths || [];
<ide>
<ide> // create the bundle we'll work with
<ide> var entries = grunt.file.expand(config.entries);
<del> var paths = grunt.file.expand(config.paths);
<ide>
<ide> // Extract other options
<ide> var options = {
<ide> entries: entries,
<ide> debug: config.debug, // sourcemaps
<ide> standalone: config.standalone, // global
<del> paths: paths,
<ide> };
<ide>
<ide> var bundle = browserify(options); | 1 |
Javascript | Javascript | remove trailing whitespace | 2c1eae5819933f9ef8fe4d8776debb7af6fcb4dd | <ide><path>make.js
<ide> target.all = function() {
<ide> //
<ide>
<ide> // Files that need to be included in every build.
<del>var COMMON_WEB_FILES =
<add>var COMMON_WEB_FILES =
<ide> ['web/viewer.css',
<ide> 'web/images',
<ide> 'web/debugger.js'], | 1 |
Javascript | Javascript | do less work in insert | 0b89761d6dcaa1aa6b49b5b9d85b36065f681351 | <ide><path>lib/internal/timers.js
<ide> function initAsyncResource(resource, type) {
<ide>
<ide> // Timer constructor function.
<ide> // The entire prototype is defined in lib/timers.js
<del>function Timeout(callback, after, args, isRepeat) {
<add>function Timeout(callback, after, args, isRepeat, isRefed) {
<ide> after *= 1; // Coalesce to number or NaN
<ide> if (!(after >= 1 && after <= TIMEOUT_MAX)) {
<ide> if (after > TIMEOUT_MAX) {
<ide> function Timeout(callback, after, args, isRepeat) {
<ide> this._repeat = isRepeat ? after : null;
<ide> this._destroyed = false;
<ide>
<del> this[kRefed] = null;
<add> if (isRefed)
<add> incRefCount();
<add> this[kRefed] = isRefed;
<ide>
<ide> initAsyncResource(this, 'Timeout');
<ide> }
<ide> function decRefCount() {
<ide> // Schedule or re-schedule a timer.
<ide> // The item must have been enroll()'d first.
<ide> function active(item) {
<del> insert(item, true, getLibuvNow());
<add> insertGuarded(item, true);
<ide> }
<ide>
<ide> // Internal APIs that need timeouts should use `unrefActive()` instead of
<ide> // `active()` so that they do not unnecessarily keep the process open.
<ide> function unrefActive(item) {
<del> insert(item, false, getLibuvNow());
<add> insertGuarded(item, false);
<ide> }
<ide>
<ide> // The underlying logic for scheduling or re-scheduling a timer.
<ide> //
<ide> // Appends a timer onto the end of an existing timers list, or creates a new
<ide> // list if one does not already exist for the specified timeout duration.
<del>function insert(item, refed, start) {
<del> let msecs = item._idleTimeout;
<add>function insertGuarded(item, refed, start) {
<add> const msecs = item._idleTimeout;
<ide> if (msecs < 0 || msecs === undefined)
<ide> return;
<ide>
<del> // Truncate so that accuracy of sub-millisecond timers is not assumed.
<del> msecs = MathTrunc(msecs);
<add> insert(item, msecs, start);
<add>
<add> if (!item[async_id_symbol] || item._destroyed) {
<add> item._destroyed = false;
<add> initAsyncResource(item, 'Timeout');
<add> }
<add>
<add> if (refed === !item[kRefed]) {
<add> if (refed)
<add> incRefCount();
<add> else
<add> decRefCount();
<add> }
<add> item[kRefed] = refed;
<add>}
<ide>
<add>function insert(item, msecs, start = getLibuvNow()) {
<add> // Truncate so that accuracy of sub-milisecond timers is not assumed.
<add> msecs = MathTrunc(msecs);
<ide> item._idleStart = start;
<ide>
<ide> // Use an existing list if there is one, otherwise we need to make a new one.
<ide> function insert(item, refed, start) {
<ide> }
<ide> }
<ide>
<del> if (!item[async_id_symbol] || item._destroyed) {
<del> item._destroyed = false;
<del> initAsyncResource(item, 'Timeout');
<del> }
<del>
<del> if (refed === !item[kRefed]) {
<del> if (refed)
<del> incRefCount();
<del> else
<del> decRefCount();
<del> }
<del> item[kRefed] = refed;
<del>
<ide> L.append(list, item);
<ide> }
<ide>
<ide> function setUnrefTimeout(callback, after) {
<ide> throw new ERR_INVALID_CALLBACK(callback);
<ide> }
<ide>
<del> const timer = new Timeout(callback, after, undefined, false);
<del> unrefActive(timer);
<add> const timer = new Timeout(callback, after, undefined, false, false);
<add> insert(timer, timer._idleTimeout);
<ide>
<ide> return timer;
<ide> }
<ide> function getTimerCallbacks(runNextTicks) {
<ide> } finally {
<ide> if (timer._repeat && timer._idleTimeout !== -1) {
<ide> timer._idleTimeout = timer._repeat;
<del> if (start === undefined)
<del> start = getLibuvNow();
<del> insert(timer, timer[kRefed], start);
<add> insert(timer, timer._idleTimeout, start);
<ide> } else if (!timer._idleNext && !timer._idlePrev) {
<ide> if (timer[kRefed])
<ide> refCount--;
<ide> timer[kRefed] = null;
<ide>
<ide> if (destroyHooksExist() && !timer._destroyed) {
<del> emitDestroy(timer[async_id_symbol]);
<add> emitDestroy(asyncId);
<ide> }
<ide> timer._destroyed = true;
<ide> }
<ide> module.exports = {
<ide> },
<ide> active,
<ide> unrefActive,
<add> insert,
<ide> timerListMap,
<ide> timerListQueue,
<ide> decRefCount,
<ide><path>lib/timers.js
<ide> const {
<ide> timerListQueue,
<ide> immediateQueue,
<ide> active,
<del> unrefActive
<add> unrefActive,
<add> insert
<ide> } = require('internal/timers');
<ide> const {
<ide> promisify: { custom: customPromisify },
<ide> function setTimeout(callback, after, arg1, arg2, arg3) {
<ide> break;
<ide> }
<ide>
<del> const timeout = new Timeout(callback, after, args, false);
<del> active(timeout);
<add> const timeout = new Timeout(callback, after, args, false, true);
<add> insert(timeout, timeout._idleTimeout);
<ide>
<ide> return timeout;
<ide> }
<ide>
<ide> setTimeout[customPromisify] = function(after, value) {
<ide> const args = value !== undefined ? [value] : value;
<ide> return new Promise((resolve) => {
<del> active(new Timeout(resolve, after, args, false));
<add> const timeout = new Timeout(resolve, after, args, false, true);
<add> insert(timeout, timeout._idleTimeout);
<ide> });
<ide> };
<ide>
<ide> function setInterval(callback, repeat, arg1, arg2, arg3) {
<ide> break;
<ide> }
<ide>
<del> const timeout = new Timeout(callback, repeat, args, true);
<del> active(timeout);
<add> const timeout = new Timeout(callback, repeat, args, true, true);
<add> insert(timeout, timeout._idleTimeout);
<ide>
<ide> return timeout;
<ide> } | 2 |
Text | Text | fix typo in maintaining-zlib guide | 988f5bf6fb739950fe47ecc3c20853893ba729b0 | <ide><path>doc/guides/maintaining-zlib.md
<ide> Check that Node.js still builds and tests.
<ide> It may be necessary to update deps/zlib/zlib.gyp if any significant changes have
<ide> occurred upstream.
<ide>
<del>## Commiting zlib
<add>## Committing zlib
<ide>
<ide> Add zlib: `git add --all deps/zlib`
<ide> | 1 |
Javascript | Javascript | reduce dereferencing of array.prototype.slice | 56acdc1fdcdcada0d850c64eb77f76c920f93f28 | <ide><path>packages/ember-metal/lib/mixin.js
<ide> var Mixin, MixinDelegate, REQUIRED, Alias;
<ide> var classToString, superClassString;
<ide>
<ide> var a_map = Array.prototype.map;
<add>var a_slice = Array.prototype.slice;
<ide> var EMPTY_META = {}; // dummy for non-writable meta
<ide> var META_SKIP = { __emberproto__: true, __ember_count__: true };
<ide>
<ide> function applyMixin(obj, mixins, partial) {
<ide> }
<ide>
<ide> Ember.mixin = function(obj) {
<del> var args = Array.prototype.slice.call(arguments, 1);
<add> var args = a_slice.call(arguments, 1);
<ide> return applyMixin(obj, args, false);
<ide> };
<ide>
<ide> Mixin = function() { return initMixin(this, arguments); };
<ide> Mixin._apply = applyMixin;
<ide>
<ide> Mixin.applyPartial = function(obj) {
<del> var args = Array.prototype.slice.call(arguments, 1);
<add> var args = a_slice.call(arguments, 1);
<ide> return applyMixin(obj, args, true);
<ide> };
<ide>
<ide> Mixin.prototype.detect = function(obj) {
<ide>
<ide> Mixin.prototype.without = function() {
<ide> var ret = new Mixin(this);
<del> ret._without = Array.prototype.slice.call(arguments);
<add> ret._without = a_slice.call(arguments);
<ide> return ret;
<ide> };
<ide>
<ide> Ember.MixinDelegate = MixinDelegate;
<ide> //
<ide>
<ide> Ember.observer = function(func) {
<del> var paths = Array.prototype.slice.call(arguments, 1);
<add> var paths = a_slice.call(arguments, 1);
<ide> func.__ember_observes__ = paths;
<ide> return func;
<ide> };
<ide>
<ide> Ember.beforeObserver = function(func) {
<del> var paths = Array.prototype.slice.call(arguments, 1);
<add> var paths = a_slice.call(arguments, 1);
<ide> func.__ember_observesBefore__ = paths;
<ide> return func;
<ide> };
<ide><path>packages/ember-runtime/lib/ext/function.js
<ide>
<ide> require('ember-runtime/core');
<ide>
<add>var a_slice = Array.prototype.slice;
<add>
<ide> if (Ember.EXTEND_PROTOTYPES) {
<ide>
<ide> Function.prototype.property = function() {
<ide> if (Ember.EXTEND_PROTOTYPES) {
<ide> };
<ide>
<ide> Function.prototype.observes = function() {
<del> this.__ember_observes__ = Array.prototype.slice.call(arguments);
<add> this.__ember_observes__ = a_slice.call(arguments);
<ide> return this;
<ide> };
<ide>
<ide> Function.prototype.observesBefore = function() {
<del> this.__ember_observesBefore__ = Array.prototype.slice.call(arguments);
<add> this.__ember_observesBefore__ = a_slice.call(arguments);
<ide> return this;
<ide> };
<ide>
<ide><path>packages/ember-runtime/lib/mixins/enumerable.js
<ide> //
<ide>
<ide> var get = Ember.get, set = Ember.set;
<add>var a_slice = Array.prototype.slice;
<ide>
<ide> var contexts = [];
<ide> function popCtx() {
<ide> Ember.Enumerable = Ember.Mixin.create( /** @lends Ember.Enumerable */ {
<ide> */
<ide> invoke: function(methodName) {
<ide> var args, ret = [];
<del> if (arguments.length>1) args = Array.prototype.slice.call(arguments, 1);
<add> if (arguments.length>1) args = a_slice.call(arguments, 1);
<ide>
<ide> this.forEach(function(x, idx) {
<ide> var method = x && x[methodName];
<ide><path>packages/ember-views/lib/views/view.js
<ide> require("ember-views/system/render_buffer");
<ide> var get = Ember.get, set = Ember.set, addObserver = Ember.addObserver;
<ide> var getPath = Ember.getPath, meta = Ember.meta, fmt = Ember.String.fmt;
<add>var a_slice = Array.prototype.slice;
<ide>
<ide> var childViewsProperty = Ember.computed(function() {
<ide> var childViews = get(this, '_childViews');
<ide> Ember.View = Ember.Object.extend(
<ide> var fn = state[name];
<ide>
<ide> if (fn) {
<del> var args = Array.prototype.slice.call(arguments, 1);
<add> var args = a_slice.call(arguments, 1);
<ide> args.unshift(this);
<ide>
<ide> return fn.apply(this, args); | 4 |
Python | Python | normalize layer importing | 3bfe4eace955f8b6b46b389f37375b9cc4ae94a0 | <ide><path>keras/layers/__init__.py
<add>from __future__ import absolute_import
<add>from .core import *
<add>from .convolutional import *
<add>from .recurrent import *
<add>from .normalization import *
<add>from .embeddings import *
<add>from .noise import *
<add>from .advanced_activations import *
<ide>\ No newline at end of file | 1 |
Go | Go | fix net=none w/ testdaemonnospaceleftondeviceerror | 8e0e9e0f24e5802709508b7c7fe61cb5171ec414 | <ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C)
<ide>
<ide> // Test daemon for no space left on device error
<ide> func (s *DockerDaemonSuite) TestDaemonNoSpaceleftOnDeviceError(c *check.C) {
<del> testRequires(c, SameHostDaemon, DaemonIsLinux)
<add> testRequires(c, SameHostDaemon, DaemonIsLinux, Network)
<ide>
<ide> // create a 2MiB image and mount it as graph root
<ide> cmd := exec.Command("dd", "of=/tmp/testfs.img", "bs=1M", "seek=2", "count=0")
<ide> func (s *DockerDaemonSuite) TestDaemonNoSpaceleftOnDeviceError(c *check.C) {
<ide>
<ide> // pull a repository large enough to fill the mount point
<ide> out, err := s.d.Cmd("pull", "registry:2")
<del>
<del> c.Assert(strings.Contains(out, "no space left on device"), check.Equals, true)
<add> c.Assert(out, checker.Contains, "no space left on device")
<ide> }
<ide>
<ide> // Test daemon restart with container links + auto restart | 1 |
Mixed | Javascript | save original argv[0] | a804db1af7bd9a0f00fc2253ec84ee2e40332408 | <ide><path>doc/api/process.md
<ide> added: v0.1.27
<ide>
<ide> The `process.argv` property returns an array containing the command line
<ide> arguments passed when the Node.js process was launched. The first element will
<del>be [`process.execPath`]. The second element will be the path to the
<del>JavaScript file being executed. The remaining elements will be any additional
<del>command line arguments.
<add>be [`process.execPath`]. See `process.argv0` if access to the original value of
<add>`argv[0]` is needed. The second element will be the path to the JavaScript
<add>file being executed. The remaining elements will be any additional command line
<add>arguments.
<ide>
<ide> For example, assuming the following script for `process-args.js`:
<ide>
<ide> Would generate the output:
<ide> 4: four
<ide> ```
<ide>
<add>## process.argv0
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>The `process.argv0` property stores a read-only copy of the original value of
<add>`argv[0]` passed when Node.js starts.
<add>
<add>```js
<add>$ bash -c 'exec -a customArgv0 ./node'
<add>> process.argv[0]
<add>'/Volumes/code/external/node/out/Release/node'
<add>> process.argv0
<add>'customArgv0'
<add>```
<add>
<ide> ## process.chdir(directory)
<ide> <!-- YAML
<ide> added: v0.1.17
<ide><path>lib/internal/bootstrap_node.js
<ide>
<ide> _process.setupRawDebug();
<ide>
<add> Object.defineProperty(process, 'argv0', {
<add> enumerable: true,
<add> configurable: false,
<add> value: process.argv[0]
<add> });
<ide> process.argv[0] = process.execPath;
<ide>
<ide> // There are various modes that Node can run in. The most common two | 2 |
Java | Java | fix javadoc syntax error in httprequesthandler | 408fe42df242dcaa564f4f0eb61d41d8d8909d5b | <ide><path>spring-web/src/main/java/org/springframework/web/HttpRequestHandler.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> * Plain handler interface for components that process HTTP requests,
<ide> * analogous to a Servlet. Only declares {@link javax.servlet.ServletException}
<ide> * and {@link java.io.IOException}, to allow for usage within any
<del> * {@link javax.servlet.http.HttpServlet}}. This interface is essentially the
<add> * {@link javax.servlet.http.HttpServlet}. This interface is essentially the
<ide> * direct equivalent of an HttpServlet, reduced to a central handle method.
<ide> *
<ide> * <p>The easiest way to expose an HttpRequestHandler bean in Spring style
<ide> * is to define it in Spring's root web application context and define
<ide> * an {@link org.springframework.web.context.support.HttpRequestHandlerServlet}
<del> * in {@code web.xml}, pointing at the target HttpRequestHandler bean
<add> * in {@code web.xml}, pointing to the target HttpRequestHandler bean
<ide> * through its {@code servlet-name} which needs to match the target bean name.
<ide> *
<ide> * <p>Supported as a handler type within Spring's | 1 |
Python | Python | add note to ``nonzero`` docstring. | 1f427353554e6403f87c01f81b6e414427faa5f0 | <ide><path>numpy/core/fromnumeric.py
<ide> def nonzero(a):
<ide> Equivalent ndarray method.
<ide> count_nonzero :
<ide> Counts the number of non-zero elements in the input array.
<add>
<add> Notes
<add> -----
<add> To obtain the non-zero values, it is recommended to use ``x[x.astype(bool)]``
<add> which will correctly handle 0-d arrays.
<ide>
<ide> Examples
<ide> -------- | 1 |
Ruby | Ruby | add remote search to `brew cask search` | 238cd5430f47895ef930756f2c3fb8b770a89f46 | <ide><path>Library/Homebrew/cask/lib/hbc/cli/search.rb
<ide> def self.extract_regexp(string)
<ide> end
<ide> end
<ide>
<add> def self.search_remote(query)
<add> matches = GitHub.search_code("user:caskroom", "path:Casks", "filename:#{query}", "extension:rb")
<add> [*matches].map do |match|
<add> tap = Tap.fetch(match["repository"]["full_name"])
<add> next if tap.installed?
<add> "#{tap.name}/#{File.basename(match["path"], ".rb")}"
<add> end.compact
<add> end
<add>
<ide> def self.search(*arguments)
<ide> exact_match = nil
<ide> partial_matches = []
<ide> def self.search(*arguments)
<ide> partial_matches = simplified_tokens.grep(/#{simplified_search_term}/i) { |t| all_tokens[simplified_tokens.index(t)] }
<ide> partial_matches.delete(exact_match)
<ide> end
<del> [exact_match, partial_matches, search_term]
<add>
<add> remote_matches = search_remote(search_term)
<add>
<add> [exact_match, partial_matches, remote_matches, search_term]
<ide> end
<ide>
<del> def self.render_results(exact_match, partial_matches, search_term)
<add> def self.render_results(exact_match, partial_matches, remote_matches, search_term)
<ide> if !exact_match && partial_matches.empty?
<ide> puts "No Cask found for \"#{search_term}\"."
<ide> return
<ide> end
<ide> if exact_match
<del> ohai "Exact match"
<add> ohai "Exact Match"
<ide> puts highlight_installed exact_match
<ide> end
<ide>
<del> return if partial_matches.empty?
<del>
<del> if extract_regexp search_term
<del> ohai "Regexp matches"
<del> else
<del> ohai "Partial matches"
<add> unless partial_matches.empty?
<add> if extract_regexp search_term
<add> ohai "Regexp Matches"
<add> else
<add> ohai "Partial Matches"
<add> end
<add> puts Formatter.columns(partial_matches.map(&method(:highlight_installed)))
<ide> end
<del> puts Formatter.columns(partial_matches.map(&method(:highlight_installed)))
<add>
<add> return if remote_matches.empty?
<add> ohai "Remote Matches"
<add> puts Formatter.columns(remote_matches.map(&method(:highlight_installed)))
<ide> end
<ide>
<ide> def self.highlight_installed(token)
<ide><path>Library/Homebrew/test/cask/cli/search_spec.rb
<ide> expect {
<ide> Hbc::CLI::Search.run("local")
<ide> }.to output(<<-EOS.undent).to_stdout
<del> ==> Partial matches
<add> ==> Partial Matches
<ide> local-caffeine
<ide> local-transmission
<ide> EOS
<ide> it "accepts a regexp argument" do
<ide> expect {
<ide> Hbc::CLI::Search.run("/^local-c[a-z]ffeine$/")
<del> }.to output("==> Regexp matches\nlocal-caffeine\n").to_stdout
<add> }.to output("==> Regexp Matches\nlocal-caffeine\n").to_stdout
<ide> end
<ide>
<ide> it "Returns both exact and partial matches" do
<ide> expect {
<ide> Hbc::CLI::Search.run("test-opera")
<del> }.to output(/^==> Exact match\ntest-opera\n==> Partial matches\ntest-opera-mail/).to_stdout
<add> }.to output(/^==> Exact Match\ntest-opera\n==> Partial Matches\ntest-opera-mail/).to_stdout
<ide> end
<ide>
<ide> it "does not search the Tap name" do | 2 |
Python | Python | make public versions of private tensor utils | 9151e649a53fc8a7e5d8beec1ae8d27db1094aa7 | <ide><path>src/transformers/feature_extraction_sequence_utils.py
<ide> import numpy as np
<ide>
<ide> from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin
<del>from .utils import PaddingStrategy, TensorType, is_tf_available, is_torch_available, logging, to_numpy
<del>from .utils.generic import _is_tensorflow, _is_torch
<add>from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy
<ide>
<ide>
<ide> logger = logging.get_logger(__name__)
<ide> def pad(
<ide> first_element = required_input[index][0]
<ide>
<ide> if return_tensors is None:
<del> if is_tf_available() and _is_tensorflow(first_element):
<add> if is_tf_tensor(first_element):
<ide> return_tensors = "tf"
<del> elif is_torch_available() and _is_torch(first_element):
<add> elif is_torch_tensor(first_element):
<ide> return_tensors = "pt"
<ide> elif isinstance(first_element, (int, float, list, tuple, np.ndarray)):
<ide> return_tensors = "np"
<ide><path>src/transformers/feature_extraction_utils.py
<ide> copy_func,
<ide> download_url,
<ide> is_flax_available,
<add> is_jax_tensor,
<add> is_numpy_array,
<ide> is_offline_mode,
<ide> is_remote_url,
<ide> is_tf_available,
<ide> is_torch_available,
<add> is_torch_device,
<ide> logging,
<ide> torch_required,
<ide> )
<del>from .utils.generic import _is_jax, _is_numpy, _is_torch_device
<ide>
<ide>
<ide> if TYPE_CHECKING:
<ide> def as_tensor(value):
<ide> import jax.numpy as jnp # noqa: F811
<ide>
<ide> as_tensor = jnp.array
<del> is_tensor = _is_jax
<add> is_tensor = is_jax_tensor
<ide> else:
<ide> as_tensor = np.asarray
<del> is_tensor = _is_numpy
<add> is_tensor = is_numpy_array
<ide>
<ide> # Do the tensor conversion in batch
<ide> for key, value in self.items():
<ide> def to(self, device: Union[str, "torch.device"]) -> "BatchFeature":
<ide> # This check catches things like APEX blindly calling "to" on all inputs to a module
<ide> # Otherwise it passes the casts down and casts the LongTensor containing the token idxs
<ide> # into a HalfTensor
<del> if isinstance(device, str) or _is_torch_device(device) or isinstance(device, int):
<add> if isinstance(device, str) or is_torch_device(device) or isinstance(device, int):
<ide> self.data = {k: v.to(device=device) for k, v in self.data.items()}
<ide> else:
<ide> logger.warning(f"Attempting to cast a BatchFeature to type {str(device)}. This is not supported.")
<ide><path>src/transformers/image_utils.py
<ide>
<ide> import requests
<ide>
<del>from .utils import is_flax_available, is_tf_available, is_torch_available, is_vision_available
<add>from .utils import (
<add> ExplicitEnum,
<add> is_jax_tensor,
<add> is_tf_tensor,
<add> is_torch_available,
<add> is_torch_tensor,
<add> is_vision_available,
<add> to_numpy,
<add>)
<ide> from .utils.constants import ( # noqa: F401
<ide> IMAGENET_DEFAULT_MEAN,
<ide> IMAGENET_DEFAULT_STD,
<ide> IMAGENET_STANDARD_MEAN,
<ide> IMAGENET_STANDARD_STD,
<ide> )
<del>from .utils.generic import ExplicitEnum, _is_jax, _is_tensorflow, _is_torch, to_numpy
<ide>
<ide>
<ide> if is_vision_available():
<ide> class ChannelDimension(ExplicitEnum):
<ide> LAST = "channels_last"
<ide>
<ide>
<del>def is_torch_tensor(obj):
<del> return _is_torch(obj) if is_torch_available() else False
<del>
<del>
<del>def is_tf_tensor(obj):
<del> return _is_tensorflow(obj) if is_tf_available() else False
<del>
<del>
<del>def is_jax_tensor(obj):
<del> return _is_jax(obj) if is_flax_available() else False
<del>
<del>
<ide> def is_valid_image(img):
<ide> return (
<ide> isinstance(img, (PIL.Image.Image, np.ndarray))
<ide><path>src/transformers/models/luke/tokenization_luke.py
<ide> TextInput,
<ide> TextInputPair,
<ide> TruncationStrategy,
<del> _is_tensorflow,
<del> _is_torch,
<ide> to_py_obj,
<ide> )
<del>from ...utils import add_end_docstrings, is_tf_available, is_torch_available, logging
<add>from ...utils import add_end_docstrings, is_tf_tensor, is_torch_tensor, logging
<ide>
<ide>
<ide> logger = logging.get_logger(__name__)
<ide> def pad(
<ide> first_element = required_input[index][0]
<ide> # At this state, if `first_element` is still a list/tuple, it's an empty one so there is nothing to do.
<ide> if not isinstance(first_element, (int, list, tuple)):
<del> if is_tf_available() and _is_tensorflow(first_element):
<add> if is_tf_tensor(first_element):
<ide> return_tensors = "tf" if return_tensors is None else return_tensors
<del> elif is_torch_available() and _is_torch(first_element):
<add> elif is_torch_tensor(first_element):
<ide> return_tensors = "pt" if return_tensors is None else return_tensors
<ide> elif isinstance(first_element, np.ndarray):
<ide> return_tensors = "np" if return_tensors is None else return_tensors
<ide><path>src/transformers/models/mluke/tokenization_mluke.py
<ide> TextInput,
<ide> TextInputPair,
<ide> TruncationStrategy,
<del> _is_tensorflow,
<del> _is_torch,
<ide> to_py_obj,
<ide> )
<del>from ...utils import add_end_docstrings, is_tf_available, is_torch_available, logging
<add>from ...utils import add_end_docstrings, is_tf_tensor, is_torch_tensor, logging
<ide>
<ide>
<ide> logger = logging.get_logger(__name__)
<ide> def pad(
<ide> first_element = required_input[index][0]
<ide> # At this state, if `first_element` is still a list/tuple, it's an empty one so there is nothing to do.
<ide> if not isinstance(first_element, (int, list, tuple)):
<del> if is_tf_available() and _is_tensorflow(first_element):
<add> if is_tf_tensor(first_element):
<ide> return_tensors = "tf" if return_tensors is None else return_tensors
<del> elif is_torch_available() and _is_torch(first_element):
<add> elif is_torch_tensor(first_element):
<ide> return_tensors = "pt" if return_tensors is None else return_tensors
<ide> elif isinstance(first_element, np.ndarray):
<ide> return_tensors = "np" if return_tensors is None else return_tensors
<ide><path>src/transformers/tokenization_utils_base.py
<ide> download_url,
<ide> extract_commit_hash,
<ide> is_flax_available,
<add> is_jax_tensor,
<add> is_numpy_array,
<ide> is_offline_mode,
<ide> is_remote_url,
<ide> is_tf_available,
<add> is_tf_tensor,
<ide> is_tokenizers_available,
<ide> is_torch_available,
<add> is_torch_device,
<add> is_torch_tensor,
<ide> logging,
<ide> to_py_obj,
<ide> torch_required,
<ide> )
<del>from .utils.generic import _is_jax, _is_numpy, _is_tensorflow, _is_torch, _is_torch_device
<ide>
<ide>
<ide> if TYPE_CHECKING:
<ide> def convert_to_tensors(
<ide> import jax.numpy as jnp # noqa: F811
<ide>
<ide> as_tensor = jnp.array
<del> is_tensor = _is_jax
<add> is_tensor = is_jax_tensor
<ide> else:
<ide> as_tensor = np.asarray
<del> is_tensor = _is_numpy
<del> # (mfuntowicz: This code is unreachable)
<del> # else:
<del> # raise ImportError(
<del> # f"Unable to convert output to tensors format {tensor_type}"
<del> # )
<add> is_tensor = is_numpy_array
<ide>
<ide> # Do the tensor conversion in batch
<ide> for key, value in self.items():
<ide> def to(self, device: Union[str, "torch.device"]) -> "BatchEncoding":
<ide> # This check catches things like APEX blindly calling "to" on all inputs to a module
<ide> # Otherwise it passes the casts down and casts the LongTensor containing the token idxs
<ide> # into a HalfTensor
<del> if isinstance(device, str) or _is_torch_device(device) or isinstance(device, int):
<add> if isinstance(device, str) or is_torch_device(device) or isinstance(device, int):
<ide> self.data = {k: v.to(device=device) for k, v in self.data.items()}
<ide> else:
<ide> logger.warning(f"Attempting to cast a BatchEncoding to type {str(device)}. This is not supported.")
<ide> def pad(
<ide> break
<ide> # At this state, if `first_element` is still a list/tuple, it's an empty one so there is nothing to do.
<ide> if not isinstance(first_element, (int, list, tuple)):
<del> if is_tf_available() and _is_tensorflow(first_element):
<add> if is_tf_tensor(first_element):
<ide> return_tensors = "tf" if return_tensors is None else return_tensors
<del> elif is_torch_available() and _is_torch(first_element):
<add> elif is_torch_tensor(first_element):
<ide> return_tensors = "pt" if return_tensors is None else return_tensors
<ide> elif isinstance(first_element, np.ndarray):
<ide> return_tensors = "np" if return_tensors is None else return_tensors
<ide><path>src/transformers/utils/__init__.py
<ide> cached_property,
<ide> find_labels,
<ide> flatten_dict,
<add> is_jax_tensor,
<add> is_numpy_array,
<ide> is_tensor,
<add> is_tf_tensor,
<add> is_torch_device,
<add> is_torch_tensor,
<ide> to_numpy,
<ide> to_py_obj,
<ide> working_or_temp_dir,
<ide><path>src/transformers/utils/generic.py
<ide> def _is_numpy(x):
<ide> return isinstance(x, np.ndarray)
<ide>
<ide>
<add>def is_numpy_array(x):
<add> """
<add> Tests if `x` is a numpy array or not.
<add> """
<add> return _is_numpy(x)
<add>
<add>
<ide> def _is_torch(x):
<ide> import torch
<ide>
<ide> return isinstance(x, torch.Tensor)
<ide>
<ide>
<add>def is_torch_tensor(x):
<add> """
<add> Tests if `x` is a torch tensor or not. Safe to call even if torch is not installed.
<add> """
<add> return False if not is_torch_available() else _is_torch(x)
<add>
<add>
<ide> def _is_torch_device(x):
<ide> import torch
<ide>
<ide> return isinstance(x, torch.device)
<ide>
<ide>
<add>def is_torch_device(x):
<add> """
<add> Tests if `x` is a torch device or not. Safe to call even if torch is not installed.
<add> """
<add> return False if not is_torch_available() else _is_torch_device(x)
<add>
<add>
<ide> def _is_tensorflow(x):
<ide> import tensorflow as tf
<ide>
<ide> return isinstance(x, tf.Tensor)
<ide>
<ide>
<add>def is_tf_tensor(x):
<add> """
<add> Tests if `x` is a tensorflow tensor or not. Safe to call even if tensorflow is not installed.
<add> """
<add> return False if not is_tf_available() else _is_tensorflow(x)
<add>
<add>
<ide> def _is_jax(x):
<ide> import jax.numpy as jnp # noqa: F811
<ide>
<ide> return isinstance(x, jnp.ndarray)
<ide>
<ide>
<add>def is_jax_tensor(x):
<add> """
<add> Tests if `x` is a Jax tensor or not. Safe to call even if jax is not installed.
<add> """
<add> return False if not is_flax_available() else _is_jax(x)
<add>
<add>
<ide> def to_py_obj(obj):
<ide> """
<ide> Convert a TensorFlow tensor, PyTorch tensor, Numpy array or python list to a python list.
<ide> def to_py_obj(obj):
<ide> return {k: to_py_obj(v) for k, v in obj.items()}
<ide> elif isinstance(obj, (list, tuple)):
<ide> return [to_py_obj(o) for o in obj]
<del> elif is_tf_available() and _is_tensorflow(obj):
<add> elif is_tf_tensor(obj):
<ide> return obj.numpy().tolist()
<del> elif is_torch_available() and _is_torch(obj):
<add> elif is_torch_tensor(obj):
<ide> return obj.detach().cpu().tolist()
<del> elif is_flax_available() and _is_jax(obj):
<add> elif is_jax_tensor(obj):
<ide> return np.asarray(obj).tolist()
<ide> elif isinstance(obj, (np.ndarray, np.number)): # tolist also works on 0d np arrays
<ide> return obj.tolist()
<ide> def to_numpy(obj):
<ide> return {k: to_numpy(v) for k, v in obj.items()}
<ide> elif isinstance(obj, (list, tuple)):
<ide> return np.array(obj)
<del> elif is_tf_available() and _is_tensorflow(obj):
<add> elif is_tf_tensor(obj):
<ide> return obj.numpy()
<del> elif is_torch_available() and _is_torch(obj):
<add> elif is_torch_tensor(obj):
<ide> return obj.detach().cpu().numpy()
<del> elif is_flax_available() and _is_jax(obj):
<add> elif is_jax_tensor(obj):
<ide> return np.asarray(obj)
<ide> else:
<ide> return obj | 8 |
Python | Python | update double head model | fe2756ff41147ea6de14d8f81ecc5304382af91d | <ide><path>pytorch_pretrained_bert/modeling_openai.py
<ide> def __init__(self, config):
<ide> def forward(self, hidden_states, mc_token_ids):
<ide> # Classification logits
<ide> # hidden_state (bsz, num_choices, seq_length, hidden_size)
<del> # mc_token_ids (bsz, num_choices, 1)
<add> # mc_token_ids (bsz, num_choices)
<ide> mc_token_ids = mc_token_ids.unsqueeze(-1).unsqueeze(-1).expand(-1, -1, -1, hidden_states.size(-1))
<ide> # (bsz, num_choices, 1, hidden_size)
<ide> multiple_choice_h = hidden_states.gather(2, mc_token_ids).squeeze(2) | 1 |
Text | Text | add await before promise.all() | 24d2555633a9c6bd1e37cc4f49cc7a53fa41cf8c | <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/personal-library.md
<ide> When you are done, make sure a working demo of your project is hosted somewhere
<ide>
<ide> # --instructions--
<ide>
<del>1. Add your MongoDB connection string to `.env` without quotes as `DB`
<add>1. Add your MongoDB connection string to `.env` without quotes as `DB`
<ide> Example: `DB=mongodb://admin:pass@1234.mlab.com:1234/fccpersonallib`
<ide> 2. In your `.env` file set `NODE_ENV` to `test`, without quotes
<ide> 3. You need to create all routes within `routes/api.js`
<ide> async (getUserInput) => {
<ide> let a = $.post(url, { title: 'Faux Book A' });
<ide> let b = $.post(url, { title: 'Faux Book B' });
<ide> let c = $.post(url, { title: 'Faux Book C' });
<del> Promise.all([a, b, c]).then(async () => {
<add> await Promise.all([a, b, c]).then(async () => {
<ide> let data = await $.get(url);
<ide> assert.isArray(data);
<ide> assert.isAtLeast(data.length, 3);
<ide> async (getUserInput) => {
<ide>
<ide> ```js
<ide> /**
<del> Backend challenges don't need solutions,
<del> because they would need to be tested against a full working project.
<add> Backend challenges don't need solutions,
<add> because they would need to be tested against a full working project.
<ide> Please check our contributing guidelines to learn more.
<ide> */
<ide> ``` | 1 |
Text | Text | add links to docs in all the samples | 4183b7f04a8f5b1e8336aaa8b93f260ffd66a042 | <ide><path>docs/samples/advanced/data-decimation.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Data Decimation](../../configuration/decimation.html)
<add>* [Line](../../charts/line.html)
<add>* [Time Scale](../../axes/cartesian/time.html)
<add>
<ide><path>docs/samples/advanced/derived-axis-type.md
<ide> module.exports = {
<ide> ## Log2 axis implementation
<ide>
<ide> <<< @/docs/scripts/log2.js
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [New Axes](../../developers/axes.html)
<ide><path>docs/samples/advanced/derived-chart-type.md
<ide> module.exports = {
<ide> ## DerivedBubble Implementation
<ide>
<ide> <<< @/docs/scripts/derived-bubble.js
<add>
<add>## Docs
<add>* [Bubble Chart](../../charts/bubble.html)
<add>* [New Charts](../../developers/charts.html)
<ide><path>docs/samples/advanced/linear-gradient.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Colors](../../general/colors.html)
<add> * [Patterns and Gradients](../../general/colors.html#patterns-and-gradients)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add>* [Line](../../charts/line.html)
<ide><path>docs/samples/advanced/programmatic-events.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## API
<add>* [Chart](../../api/classes/Chart.md)
<add> * [`setActiveElements`](../../api/classes/Chart.md#setactiveelements)
<add>* [TooltipModel](../../api/interfaces/TooltipModel.html)
<add> * [`setActiveElements`](../../api/interfaces/TooltipModel.html#setactiveelements)
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add> * [Interactions (`hoverBorderColor`)](../../charts/bar.html#interactions)
<add>* [Interactions](../../configuration/interactions.html)
<add>* [Tooltip](../../configuration/tooltip.html)
<ide><path>docs/samples/advanced/progress-bar.md
<ide> module.exports = {
<ide> output: 'console.log output is displayed here'
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Animations](../../configuration/animations.html)
<add> * [Animation Callbacks](../../configuration/animations.html#animation-callbacks)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide><path>docs/samples/advanced/radial-gradient.md
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Polar Area Chart](../../charts/polar.md)
<add> * [Styling](../../charts/polar.md#styling)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide>\ No newline at end of file
<ide><path>docs/samples/animations/delay.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Animations](../../configuration/animations.html)
<add> * [animation (`delay`)](../../configuration/animations.html#animation)
<add> * [Animation Callbacks](../../configuration/animations.html#animation-callbacks)
<add>* [Bar](../../charts/bar.html)
<add> * [Stacked Bar Chart](../../charts/bar.html#stacked-bar-chart)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide><path>docs/samples/animations/drop.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Area](../../charts/area.html)
<add>* [Animations](../../configuration/animations.html)
<add> * [animation (`easing`)](../../configuration/animations.html#animation)
<add> * [animations (`from`)](../../configuration/animations.html#animations-2)
<add>* [Line](../../charts/line.html)
<add> * [Line Styling](../../charts/line.html#line-styling)
<add> * `fill`
<add> * `tension`
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide><path>docs/samples/animations/loop.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Animations](../../configuration/animations.html)
<add> * [animation](../../configuration/animations.html#animation)
<add> * `duration`
<add> * `easing`
<add> * **`loop`**
<add> * [Default animations (`radius`)](../../configuration/animations.html#default-animations)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Elements](../../configuration/elements.html)
<add> * [Point Configuration](../../configuration/elements.html#point-configuration)
<add> * `hoverRadius`
<add> * `hoverBackgroundColor`
<add>* [Line](../../charts/line.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add>* [Tooltip (`enabled`)](../../configuration/tooltip.html)
<ide><path>docs/samples/animations/progressive-line-easing.md
<ide> module.exports = {
<ide> };
<ide>
<ide> ```
<add>## Api
<add>* [Chart](../../api/classes/Chart.md)
<add> * [`getDatasetMeta`](../../api/classes/Chart.md#getdatasetmeta)
<add>* [Scale](../../api/classes/Scale.html)
<add> * [`getPixelForValue`](../../api/classes/Scale.html#getpixelforvalue)
<add>## Docs
<add>* [Animations](../../configuration/animations.html)
<add> * [animation](../../configuration/animations.html#animation)
<add> * `delay`
<add> * `duration`
<add> * `easing`
<add> * `loop`
<add> * [Easing](../../configuration/animations.html#easing)
<add>* [Line](../../charts/line.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add> * [Data Context](../../general/options.html#data)
<ide><path>docs/samples/animations/progressive-line.md
<ide> module.exports = {
<ide> };
<ide>
<ide> ```
<add>
<add>## Api
<add>* [Chart](../../api/classes/Chart.md)
<add> * [`getDatasetMeta`](../../api/classes/Chart.md#getdatasetmeta)
<add>* [Scale](../../api/classes/Scale.html)
<add> * [`getPixelForValue`](../../api/classes/Scale.html#getpixelforvalue)
<add>## Docs
<add>* [Animations](../../configuration/animations.html)
<add> * [animation](../../configuration/animations.html#animation)
<add> * `delay`
<add> * `duration`
<add> * `easing`
<add> * `loop`
<add>* [Line](../../charts/line.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add> * [Data Context](../../general/options.html#data)
<ide><path>docs/samples/area/line-boundaries.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Area](../../charts/area.html)
<add> * [Filling modes](../../charts/area.htmll#filling-modes)
<add> * Boundary: `'start'`, `'end'`, `'origin'`
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/area/line-datasets.md
<ide> module.exports = {
<ide> ```
<ide>
<ide> <div id="chart-analyser" class="analyser"></div>
<add>
<add>## Docs
<add>* [Area](../../charts/area.html)
<add> * [Filling modes](../../charts/area.htmll#filling-modes)
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes scales](../../axes/)
<add> * [Common options to all axes (`stacked`)](../../axes/#common-options-to-all-axes)
<ide><path>docs/samples/area/line-drawtime.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Area](../../charts/area.html)
<add> * [Configuration (`drawTime`)](../../charts/area.html#configuration)
<add>* [Line](../../charts/line.html)
<add> * [Line Styling (`tension`)](../../charts/line.html#line-styling)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/area/line-stacked.md
<ide> module.exports = {
<ide> config: config
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Area](../../charts/area.html)
<add> * [Filling modes](../../charts/area.htmll#filling-modes)
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes scales](../../axes/)
<add> * [Common options to all axes (`stacked`)](../../axes/#common-options-to-all-axes)
<ide><path>docs/samples/area/radar.md
<ide> module.exports = {
<ide> ```
<ide>
<ide> <div id="chart-analyser" class="analyser"></div>
<add>
<add>## Docs
<add>* [Area](../../charts/area.html)
<add> * [Filling modes](../../charts/area.htmll#filling-modes)
<add> * [`propagate`](../../charts/area.html#propagate)
<add>* [Radar](../../charts/radar.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/bar/border-radius.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add> * [`borderRadius`](../../charts/bar.html#borderradius)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/bar/floating.md
<ide> # Floating Bars
<ide>
<add>Using `[number, number][]` as the type for `data` to define the beginning and end value for each bar. This is instead of having every bar start at 0.
<add>
<ide> ```js chart-editor
<ide> // <block:actions:2>
<ide> const actions = [
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/bar/horizontal.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add> * [Horizontal Bar Chart](../../charts/bar.html#horizontal-bar-chart)
<add>
<ide><path>docs/samples/bar/stacked-groups.md
<ide> # Stacked Bar Chart with Groups
<ide>
<add>Using the `stack` property to divide datasets into multiple stacks.
<add>
<ide> ```js chart-editor
<ide> // <block:actions:2>
<ide> const actions = [
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add> * [Stacked Bar Chart](../../charts/bar.html#stacked-bar-chart)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add> * [Dataset Configuration (`stack`)](../../general/data-structures.html#dataset-configuration)
<add>
<ide><path>docs/samples/bar/stacked.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add> * [Stacked Bar Chart](../../charts/bar.html#stacked-bar-chart)
<add>
<ide><path>docs/samples/bar/vertical.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/legend/events.md
<ide> module.exports = {
<ide> config
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Doughnut and Pie Charts](../../charts/doughnut.html)
<add>* [Legend](../../configuration/legend.html)
<add> * `onHover`
<add> * `onLeave`
<ide>\ No newline at end of file
<ide><path>docs/samples/legend/html.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Legend](../../configuration/legend.html)
<add> * `display: false`
<add>* [Plugins](../../developers/plugins.html)
<ide><path>docs/samples/legend/point-style.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Legend](../../configuration/legend.html)
<add> * [Legend Label Configuration](../../configuration/legend.html#legend-label-configuration)
<add> * `usePointStyle`
<add>* [Elements](../../configuration/elements.html)
<add> * [Point Configuration](../../configuration/elements.html#point-configuration)
<add> * [Point Styles](../../configuration/elements.html#point-styles)
<ide><path>docs/samples/legend/position.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Legend](../../configuration/legend.html)
<add> * [Position](../../configuration/legend.html#position)
<ide><path>docs/samples/legend/title.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Legend](../../configuration/legend.html)
<ide>\ No newline at end of file
<ide><path>docs/samples/line/interpolation.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add> * [`cubicInterpolationMode`](../../charts/line.html#cubicinterpolationmode)
<add> * [Line Styling (`tension`)](../../charts/line.html#line-styling)
<add>
<ide><path>docs/samples/line/line.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/line/multi-axis.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Axes scales](../../axes/)
<add>* [Cartesian Axes](../../axes/cartesian/)
<add> * [Axis Position](../../axes/cartesian/#axis-position)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>
<ide><path>docs/samples/line/point-styling.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add> * [Point Styling](../../charts/line.html#point-styling)
<ide><path>docs/samples/line/segments.md
<ide> # Line Segment Styling
<add>Using helper functions to style each segment. Gaps in the data ('skipped') are set to dashed lines and segments with values going 'down' are set to a different color.
<ide>
<ide> ```js chart-editor
<ide>
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add> * [Line Styling](../../charts/line.html#line-styling)
<add> * [Segment](../../charts/line.html#segment)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide>\ No newline at end of file
<ide><path>docs/samples/line/stepped.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add> * [Stepped](../../charts/line.html#stepped)
<ide><path>docs/samples/line/styling.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add> * [Line Styling](../../charts/line.html#line-styling)
<ide><path>docs/samples/other-charts/bubble.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bubble](../../charts/bubble.html)
<ide>\ No newline at end of file
<ide><path>docs/samples/other-charts/combo-bar-line.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/other-charts/doughnut.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Doughnut and Pie Charts](../../charts/doughnut.html)
<ide><path>docs/samples/other-charts/multi-series-pie.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Doughnut and Pie Charts](../../charts/doughnut.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide>\ No newline at end of file
<ide><path>docs/samples/other-charts/pie.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>## Docs
<add>* [Doughnut and Pie Charts](../../charts/doughnut.html)
<ide><path>docs/samples/other-charts/polar-area-center-labels.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Polar Area Chart](../../charts/polar.md)
<add>* [Linear Radial Axis](../../axes/radial/linear.html)
<add> * [Point Label Options (`centerPointLabels`)](../../axes/radial/linear.html#point-label-options)
<ide>\ No newline at end of file
<ide><path>docs/samples/other-charts/polar-area.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Polar Area Chart](../../charts/polar.md)
<ide><path>docs/samples/other-charts/radar-skip-points.md
<ide> module.exports = {
<ide> };
<ide> ```
<ide>
<add>## Docs
<add>* [Radar](../../charts/radar.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/other-charts/radar.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Radar](../../charts/radar.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/other-charts/scatter-multi-axis.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Scatter](../../charts/scatter.html)
<add>* [Cartesian Axes](../../axes/cartesian/)
<add> * [Axis Position](../../axes/cartesian/#axis-position)
<ide>\ No newline at end of file
<ide><path>docs/samples/other-charts/scatter.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Scatter](../../charts/scatter.html)
<ide>\ No newline at end of file
<ide><path>docs/samples/other-charts/stacked-bar-line.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Axes scales](../../axes/)
<add> * [Common options to all axes (`stacked`)](../../axes/#common-options-to-all-axes)
<add> * [Stacking](../../axes/#stacking)
<add>* [Bar](../../charts/bar.html)
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add> * [Dataset Configuration (`stack`)](../../general/data-structures.html#dataset-configuration)
<add>
<ide><path>docs/samples/plugins/chart-area-border.md
<ide> const config = {
<ide> module.exports = {
<ide> config: config,
<ide> };
<add>```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Plugins](../../developers/plugins.html)
<ide><path>docs/samples/plugins/doughnut-empty-state.md
<ide> module.exports = {
<ide> actions,
<ide> config,
<ide> };
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Plugins](../../developers/plugins.html)
<add>* [Doughnut and Pie Charts](../../charts/doughnut.html)
<ide><path>docs/samples/plugins/quadrants.md
<ide> module.exports = {
<ide> actions,
<ide> config,
<ide> };
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Plugins](../../developers/plugins.html)
<add>* [Scatter](../../charts/scatter.html)
<ide><path>docs/samples/scale-options/center.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Scatter](../../charts/scatter.html)
<add>* [Cartesian Axes](../../axes/cartesian/)
<add> * [Axis Position](../../axes/cartesian/#axis-position)
<ide>\ No newline at end of file
<ide><path>docs/samples/scale-options/grid.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add> * [Tick Context](../../general/options.html#tick)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes Styling](../../axes/styling.html)
<add> * [Grid Line Configuration](../../axes/styling.html#grid-line-configuration)
<ide>\ No newline at end of file
<ide><path>docs/samples/scale-options/ticks.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add> * [Tick Context](../../general/options.html#tick)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes Styling](../../axes/styling.html)
<add> * [Tick Configuration](../../axes/styling.html#tick-configuration)
<ide>\ No newline at end of file
<ide><path>docs/samples/scale-options/titles.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes Styling](../../axes/styling.html)
<add>* [Cartesian Axes](../../axes/cartesian/)
<add> * [Common options to all cartesian axes](../../axes/cartesian/#common-options-to-all-cartesian-axes)
<add>* [Labeling Axes](../../axes/labelling.html)
<add> * [Scale Title Configuration](../../axes/labelling.html#scale-title-configuration)
<ide>\ No newline at end of file
<ide><path>docs/samples/scales/linear-min-max-suggested.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes scales](../../axes/)
<add> * [Common options to all axes](../../axes/#common-options-to-all-axes)
<add> * [Axis Range Settings](../../axes/#axis-range-settings)
<ide><path>docs/samples/scales/linear-min-max.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes scales](../../axes/)
<add> * [Common options to all axes (`min`,`max`)](../../axes/#common-options-to-all-axes)
<add>
<ide>\ No newline at end of file
<ide><path>docs/samples/scales/linear-step-size.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Axes scales](../../axes/)
<add> * [Common options to all axes (`min`,`max`)](../../axes/#common-options-to-all-axes)
<add>* [Linear Axis](../../axes/cartesian/linear.html)
<add> * [Linear Axis specific tick options (`stepSize`)](../../axes/cartesian/linear.html#linear-axis-specific-tick-options)
<add> * [Step Size](../../axes/cartesian/linear.html#step-size)
<ide><path>docs/samples/scales/log.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Logarithmic Axis](../../axes/cartesian/logarithmic.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>
<ide><path>docs/samples/scales/stacked.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Axes scales](../../axes/)
<add> * [Stacking](../../axes/#stacking)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<ide><path>docs/samples/scales/time-combo.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add>* [Line](../../charts/line.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Time Scale](../../axes/cartesian/time.html)
<ide><path>docs/samples/scales/time-line.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add>* [Time Cartesian Axis](../../axes/cartesian/time.html)
<ide>\ No newline at end of file
<ide><path>docs/samples/scales/time-max-span.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add> * [`spanGaps`](../../charts/line.html#line-styling)
<add>* [Time Scale](../../axes/cartesian/time.html)
<ide><path>docs/samples/scriptable/bar.md
<ide> # Bar Chart
<add>Demo selecting bar color based on the bar's y value.
<ide>
<ide> ```js chart-editor
<ide> // <block:setup:2>
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bar](../../charts/bar.html)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add> * [Dataset Configuration (`stack`)](../../general/data-structures.html#dataset-configuration)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide><path>docs/samples/scriptable/bubble.md
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Bubble](../../charts/bubble.html)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<ide>\ No newline at end of file
<ide><path>docs/samples/scriptable/line.md
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Line](../../charts/line.html)
<add> * [Point Styling](../../charts/line.html#point-styling)
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>
<ide><path>docs/samples/scriptable/pie.md
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add>* [Doughnut and Pie Charts](../../charts/doughnut.html)
<ide>\ No newline at end of file
<ide><path>docs/samples/scriptable/polar.md
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add>* [Polar Area Chart](../../charts/polar.md)
<ide><path>docs/samples/scriptable/radar.md
<ide> module.exports = {
<ide> config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Options](../../general/options.html)
<add> * [Scriptable Options](../../general/options.html#scriptable-options)
<add>* [Radar](../../charts/radar.html)
<ide><path>docs/samples/subtitle/basic.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Title](../../configuration/title.html)
<add>* [Subtitle](../../configuration/subtitle.html)
<ide><path>docs/samples/title/alignment.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Title](../../configuration/title.html)
<ide>\ No newline at end of file
<ide><path>docs/samples/tooltip/content.md
<ide> module.exports = {
<ide> actions: [],
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Tooltip](../../configuration/tooltip.html)
<add> * [Tooltip Callbacks](../../configuration/tooltip.html#tooltip-callbacks)
<ide><path>docs/samples/tooltip/html.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Tooltip](../../configuration/tooltip.html)
<add> * [External (Custom) Tooltips](../../configuration/tooltip.html#external-custom-tooltips)
<add>
<ide>\ No newline at end of file
<ide><path>docs/samples/tooltip/interactions.md
<ide> module.exports = {
<ide> config: config,
<ide> };
<ide> ```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Tooltip](../../configuration/tooltip.html)
<add>* [Interactions](../../configuration/interactions.html)
<ide><path>docs/samples/tooltip/point-style.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Tooltip](../../configuration/tooltip.html)
<add> * `usePointStyle`
<add>* [Elements](../../configuration/elements.html)
<add> * [Point Styles](../../configuration/elements.html#point-styles)
<add>
<ide><path>docs/samples/tooltip/position.md
<ide> module.exports = {
<ide> actions: actions,
<ide> config: config,
<ide> };
<del>```
<ide>\ No newline at end of file
<add>```
<add>
<add>## Docs
<add>* [Data structures (`labels`)](../../general/data-structures.html)
<add>* [Line](../../charts/line.html)
<add>* [Tooltip](../../configuration/tooltip.html)
<add> * [Position Modes](../../configuration/tooltip.html#position-modes)
<add> * [Custom Position Modes](../../configuration/tooltip.html#custom-position-modes)
<ide>\ No newline at end of file | 75 |
Go | Go | define "opt" type | e6c0d19c3a5ebd0d719bb21c29b9d2395c7c3719 | <ide><path>client/client.go
<ide> func CheckRedirect(req *http.Request, via []*http.Request) error {
<ide> // It won't send any version information if the version number is empty. It is
<ide> // highly recommended that you set a version or your client may break if the
<ide> // server is upgraded.
<del>func NewClientWithOpts(ops ...func(*Client) error) (*Client, error) {
<add>func NewClientWithOpts(ops ...Opt) (*Client, error) {
<ide> client, err := defaultHTTPClient(DefaultDockerHost)
<ide> if err != nil {
<ide> return nil, err
<ide><path>client/options.go
<ide> import (
<ide> "github.com/pkg/errors"
<ide> )
<ide>
<add>// Opt is a configuration option to initialize a client
<add>type Opt func(*Client) error
<add>
<ide> // FromEnv configures the client with values from environment variables.
<ide> //
<ide> // Supported environment variables:
<ide> func FromEnv(c *Client) error {
<ide> // WithDialer applies the dialer.DialContext to the client transport. This can be
<ide> // used to set the Timeout and KeepAlive settings of the client.
<ide> // Deprecated: use WithDialContext
<del>func WithDialer(dialer *net.Dialer) func(*Client) error {
<add>func WithDialer(dialer *net.Dialer) Opt {
<ide> return WithDialContext(dialer.DialContext)
<ide> }
<ide>
<ide> // WithDialContext applies the dialer to the client transport. This can be
<ide> // used to set the Timeout and KeepAlive settings of the client.
<del>func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) func(*Client) error {
<add>func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt {
<ide> return func(c *Client) error {
<ide> if transport, ok := c.client.Transport.(*http.Transport); ok {
<ide> transport.DialContext = dialContext
<ide> func WithDialContext(dialContext func(ctx context.Context, network, addr string)
<ide> }
<ide>
<ide> // WithHost overrides the client host with the specified one.
<del>func WithHost(host string) func(*Client) error {
<add>func WithHost(host string) Opt {
<ide> return func(c *Client) error {
<ide> hostURL, err := ParseHostURL(host)
<ide> if err != nil {
<ide> func WithHost(host string) func(*Client) error {
<ide> }
<ide>
<ide> // WithHTTPClient overrides the client http client with the specified one
<del>func WithHTTPClient(client *http.Client) func(*Client) error {
<add>func WithHTTPClient(client *http.Client) Opt {
<ide> return func(c *Client) error {
<ide> if client != nil {
<ide> c.client = client
<ide> func WithHTTPClient(client *http.Client) func(*Client) error {
<ide> }
<ide>
<ide> // WithHTTPHeaders overrides the client default http headers
<del>func WithHTTPHeaders(headers map[string]string) func(*Client) error {
<add>func WithHTTPHeaders(headers map[string]string) Opt {
<ide> return func(c *Client) error {
<ide> c.customHTTPHeaders = headers
<ide> return nil
<ide> }
<ide> }
<ide>
<ide> // WithScheme overrides the client scheme with the specified one
<del>func WithScheme(scheme string) func(*Client) error {
<add>func WithScheme(scheme string) Opt {
<ide> return func(c *Client) error {
<ide> c.scheme = scheme
<ide> return nil
<ide> }
<ide> }
<ide>
<ide> // WithTLSClientConfig applies a tls config to the client transport.
<del>func WithTLSClientConfig(cacertPath, certPath, keyPath string) func(*Client) error {
<add>func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt {
<ide> return func(c *Client) error {
<ide> opts := tlsconfig.Options{
<ide> CAFile: cacertPath,
<ide> func WithTLSClientConfig(cacertPath, certPath, keyPath string) func(*Client) err
<ide> }
<ide>
<ide> // WithVersion overrides the client version with the specified one
<del>func WithVersion(version string) func(*Client) error {
<add>func WithVersion(version string) Opt {
<ide> return func(c *Client) error {
<ide> c.version = version
<ide> c.manualOverride = true
<ide><path>internal/test/request/request.go
<ide> import (
<ide> )
<ide>
<ide> // NewAPIClient returns a docker API client configured from environment variables
<del>func NewAPIClient(t assert.TestingT, ops ...func(*client.Client) error) client.APIClient {
<add>func NewAPIClient(t assert.TestingT, ops ...client.Opt) client.APIClient {
<ide> if ht, ok := t.(test.HelperT); ok {
<ide> ht.Helper()
<ide> }
<del> ops = append([]func(*client.Client) error{client.FromEnv}, ops...)
<add> ops = append([]client.Opt{client.FromEnv}, ops...)
<ide> clt, err := client.NewClientWithOpts(ops...)
<ide> assert.NilError(t, err)
<ide> return clt | 3 |
Javascript | Javascript | update error messages | 99af9e2c33d2228a4fd124372fc8691e2687b0dd | <ide><path>script/utils/verify-requirements.js
<ide> function verifyPython27(cb) {
<ide> }
<ide>
<ide> function checkPythonVersion (python, cb) {
<del> var pythonRequiredMessage = "Python 2.7 is required to build Atom. Python 2.7 must be installed at '" + pythonPath + "', or the PYTHON env var must be set to '/path/to/Python27/python.exe', or the Python install directory must be in the path.";
<add> var pythonHelpMessage = "Set the PYTHON env var to '/path/to/Python27/python.exe' if your python is installed in a non-default location.";
<ide>
<ide> execFile(python, ['-c', 'import platform; print(platform.python_version());'], { env: process.env }, function (err, stdout) {
<ide> if (err) {
<del> console.log(pythonRequiredMessage);
<add> console.log("Python 2.7 is required to build Atom. An error occured when checking for python '" + err + "'");
<add> console.log(pythonHelpMessage);
<ide> process.exit(1);
<ide> }
<ide>
<del> var version = stdout.trim()
<add> var version = stdout.trim();
<ide> if (~version.indexOf('+')) {
<del> version = version.replace(/\+/g, '')
<add> version = version.replace(/\+/g, '');
<ide> }
<ide> if (~version.indexOf('rc')) {
<del> version = version.replace(/rc(.*)$/ig, '')
<add> version = version.replace(/rc(.*)$/ig, '');
<ide> }
<ide>
<del> // Atom requires python 2.7 or better (but not python 3) for node-gyp
<add> // Atom requires python 2.7 or higher (but not python 3) for node-gyp
<ide> var versionArray = version.split('.').map(function(num) { return +num; });
<del> var goodPythonVersion = (versionArray[0] === 2 && versionArray[1] >= 7)
<add> var goodPythonVersion = (versionArray[0] === 2 && versionArray[1] >= 7);
<ide> if (!goodPythonVersion) {
<del> console.log(pythonRequiredMessage);
<add> console.log("Python 2.7 is required to build Atom. '" + python + "' returns version " + version);
<add> console.log(pythonHelpMessage);
<ide> process.exit(1);
<ide> }
<ide> | 1 |
Mixed | Javascript | use readableobjectmode public api for js stream | b4735ecebb390f467bba5b2d467f27f88dbbf09e | <ide><path>doc/api/stream.md
<ide> This property contains the number of bytes (or objects) in the queue
<ide> ready to be written. The value provides introspection data regarding
<ide> the status of the `highWaterMark`.
<ide>
<add>##### writable.writableObjectMode
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>Getter for the property `objectMode` of a given `Writable` stream.
<add>
<ide> ##### writable.write(chunk[, encoding][, callback])
<ide> <!-- YAML
<ide> added: v0.9.4
<ide> This property contains the number of bytes (or objects) in the queue
<ide> ready to be read. The value provides introspection data regarding
<ide> the status of the `highWaterMark`.
<ide>
<add>##### readable.readableObjectMode
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>Getter for the property `objectMode` of a given `Readable` stream.
<add>
<ide> ##### readable.resume()
<ide> <!-- YAML
<ide> added: v0.9.4
<ide><path>lib/_stream_readable.js
<ide> Object.defineProperty(Readable.prototype, 'readableLength', {
<ide> }
<ide> });
<ide>
<add>Object.defineProperty(Readable.prototype, 'readableObjectMode', {
<add> enumerable: false,
<add> get() {
<add> return this._readableState ? this._readableState.objectMode : false;
<add> }
<add>});
<add>
<ide> // Pluck off n bytes from an array of buffers.
<ide> // Length is the combined lengths of all the buffers in the list.
<ide> // This function is designed to be inlinable, so please take care when making
<ide><path>lib/_stream_writable.js
<ide> Object.defineProperty(Writable.prototype, 'destroyed', {
<ide> }
<ide> });
<ide>
<add>Object.defineProperty(Writable.prototype, 'writableObjectMode', {
<add> enumerable: false,
<add> get() {
<add> return this._writableState ? this._writableState.objectMode : false;
<add> }
<add>});
<add>
<ide> Writable.prototype.destroy = destroyImpl.destroy;
<ide> Writable.prototype._undestroy = destroyImpl.undestroy;
<ide> Writable.prototype._destroy = function(err, cb) {
<ide><path>lib/internal/js_stream_socket.js
<ide> class JSStreamSocket extends Socket {
<ide> stream.on('error', (err) => this.emit('error', err));
<ide> const ondata = (chunk) => {
<ide> if (typeof chunk === 'string' ||
<del> stream._readableState.objectMode === true) {
<add> stream.readableObjectMode === true) {
<ide> // Make sure that no further `data` events will happen.
<ide> stream.pause();
<ide> stream.removeListener('data', ondata);
<ide><path>test/parallel/test-stream2-basic.js
<ide>
<ide> const common = require('../common');
<ide> const R = require('_stream_readable');
<add>const W = require('_stream_writable');
<ide> const assert = require('assert');
<ide>
<ide> const EE = require('events').EventEmitter;
<ide> class TestWriter extends EE {
<ide> const r2 = r.setEncoding('utf8').pause().resume().pause();
<ide> assert.strictEqual(r, r2);
<ide> }
<add>
<add>{
<add> // Verify readableObjectMode property
<add> const r = new R({ objectMode: true });
<add> assert.strictEqual(r.readableObjectMode, true);
<add>}
<add>
<add>{
<add> // Verify writableObjectMode property
<add> const w = new W({ objectMode: true });
<add> assert.strictEqual(w.writableObjectMode, true);
<add>} | 5 |
Javascript | Javascript | remove o-auth account creation | 8166bfbcd815d53545ff8bf1e1770148f52990d5 | <ide><path>common/models/User-Identity.js
<ide> const { defaultProfileImage } = require('../utils/constantStrings.json');
<ide> const githubRegex = (/github/i);
<ide> const debug = debugFactory('fcc:models:userIdent');
<ide>
<del>function createAccessToken(user, ttl, cb) {
<del> if (arguments.length === 2 && typeof ttl === 'function') {
<del> cb = ttl;
<del> ttl = 0;
<del> }
<del> user.accessTokens.create({
<del> created: new Date(),
<del> ttl: Math.min(ttl || user.constructor.settings.ttl,
<del> user.constructor.settings.maxTTL)
<del> }, cb);
<del>}
<del>
<ide> export default function(UserIdent) {
<ide> // original source
<ide> // github.com/strongloop/loopback-component-passport
<ide> export default function(UserIdent) {
<ide> cb = options;
<ide> options = {};
<ide> }
<del> const autoLogin = options.autoLogin || !options.autoLogin;
<ide> const userIdentityModel = UserIdent;
<ide> profile.id = profile.id || profile.openid;
<del> return userIdentityModel.findOne({
<add> const filter = {
<ide> where: {
<ide> provider: getSocialProvider(provider),
<ide> externalId: profile.id
<ide> }
<del> })
<del> .then(identity => {
<del> if (identity) {
<del> identity.credentials = credentials;
<del> return identity.updateAttributes({
<del> profile: profile,
<del> credentials: credentials,
<del> modified: new Date()
<del> })
<del> .then(function() {
<del> // Find the user for the given identity
<del> return identity.user(function(err, user) {
<del> // Create access token if the autoLogin flag is set to true
<del> if (!err && user && autoLogin) {
<del> return (options.createAccessToken || createAccessToken)(
<del> user,
<del> function(err, token) {
<del> cb(err, user, identity, token);
<del> }
<del> );
<del> }
<del> return cb(err, user, identity);
<del> });
<del> });
<del> }
<del> // Find the user model
<del> const userModel = userIdentityModel.relations.user &&
<del> userIdentityModel.relations.user.modelTo ||
<del> loopback.getModelByType(loopback.User);
<del>
<del> const userObj = options.profileToUser(provider, profile, options);
<add> };
<add> return userIdentityModel.findOne(filter)
<add> .then(identity => {
<add> // identity already exists
<add> // find user and log them in
<add> if (identity) {
<add> identity.credentials = credentials;
<add> const options = {
<add> profile: profile,
<add> credentials: credentials,
<add> modified: new Date()
<add> };
<add> return identity.updateAttributes(options)
<add> // grab user associated with identity
<add> .then(() => identity.user())
<add> .then(user => {
<add> // Create access token for user
<add> const options = {
<add> created: new Date(),
<add> ttl: user.constructor.settings.ttl
<add> };
<add> return user.accessTokens.create(options)
<add> .then(token => ({ user, token }));
<add> })
<add> .then(({ token, user })=> {
<add> cb(null, user, identity, token);
<add> })
<add> .catch(err => cb(err));
<add> }
<add> // Find the user model
<add> const userModel = userIdentityModel.relations.user &&
<add> userIdentityModel.relations.user.modelTo ||
<add> loopback.getModelByType(loopback.User);
<ide>
<del> if (!userObj.email && !options.emailOptional) {
<del> process.nextTick(function() {
<del> return cb('email is missing from the user profile');
<del> });
<del> }
<add> const userObj = options.profileToUser(provider, profile, options);
<add> if (getSocialProvider(provider) !== 'github') {
<add> return process.nextTick(() => cb(
<add> new Error(
<add> 'accounts can only be created using Github or though email'
<add> )
<add> ));
<add> }
<ide>
<del> const query;
<del> if (userObj.email) {
<del> query = { or: [
<del> { username: userObj.username },
<del> { email: userObj.email }
<del> ]};
<del> } else {
<del> query = { username: userObj.username };
<del> }
<del> return userModel.findOrCreate({ where: query }, userObj, (err, user) => {
<del> if (err) {
<del> return cb(err);
<add> let query;
<add> if (userObj.email) {
<add> query = { or: [
<add> { username: userObj.username },
<add> { email: userObj.email }
<add> ]};
<add> } else {
<add> query = { username: userObj.username };
<ide> }
<del> const date = new Date();
<del> return userIdentityModel.create({
<del> provider: getSocialProvider(provider),
<del> externalId: profile.id,
<del> authScheme: authScheme,
<del> profile: profile,
<del> credentials: credentials,
<del> userId: user.id,
<del> created: date,
<del> modified: date
<del> }, function(err, identity) {
<del> if (!err && user && autoLogin) {
<del> return (options.createAccessToken || createAccessToken)(
<del> user,
<del> function(err, token) {
<del> cb(err, user, identity, token);
<del> }
<del> );
<del> }
<del> return cb(err, user, identity);
<del> });
<add> return userModel.findOrCreate({ where: query }, userObj)
<add> .then(([ user ]) => {
<add> const promises = [
<add> userIdentityModel.create({
<add> provider: getSocialProvider(provider),
<add> externalId: profile.id,
<add> authScheme: authScheme,
<add> profile: profile,
<add> credentials: credentials,
<add> userId: user.id,
<add> created: new Date(),
<add> modified: new Date()
<add> }),
<add> user.accessTokens.create({
<add> created: new Date(),
<add> ttl: user.constructor.settings.ttl
<add> })
<add> ];
<add> return Promise.all(promises)
<add> .then(([ identity, token ]) => ({ user, identity, token }));
<add> })
<add> .then(({ user, token, identity }) => cb(null, user, identity, token))
<add> .catch(err => cb(err));
<ide> });
<del> });
<ide> };
<ide>
<ide> UserIdent.observe('before save', function(ctx, next) {
<ide><path>common/models/user.js
<ide> module.exports = function(User) {
<ide> User.definition.properties.rand.default = function() {
<ide> return Math.random();
<ide> };
<add> // increase user accessToken ttl to 900 days
<add> User.settings.ttl = 900 * 24 * 60 * 60 * 1000;
<ide>
<ide> // username should not be in blacklist
<ide> User.validatesExclusionOf('username', {
<ide><path>server/component-passport.js
<ide> import {
<ide> const passportOptions = {
<ide> emailOptional: true,
<ide> profileToUser(provider, profile) {
<del> var emails = profile.emails;
<add> const emails = profile.emails;
<ide> // NOTE(berks): get email or set to null.
<ide> // MongoDB indexs email but can be sparse(blank)
<del> var email = emails && emails[0] && emails[0].value ?
<add> const email = emails && emails[0] && emails[0].value ?
<ide> emails[0].value :
<ide> null;
<ide>
<ide> // create random username
<ide> // username will be assigned when camper signups for Github
<del> var username = 'fcc' + uuid.v4().slice(0, 8);
<del> var password = generateKey('password');
<del> var userObj = {
<add> const username = 'fcc' + uuid.v4().slice(0, 8);
<add> const password = generateKey('password');
<add> let userObj = {
<ide> username: username,
<ide> password: password
<ide> };
<ide> const passportOptions = {
<ide> }
<ide>
<ide> if (/github/.test(provider)) {
<del> setProfileFromGithub(userObj, profile, profile._json);
<add> userObj = setProfileFromGithub(userObj, profile, profile._json);
<ide> }
<ide> return userObj;
<ide> }
<ide><path>server/utils/auth.js
<del>import assign from 'object.assign';
<del>
<ide> const providerHash = {
<ide> facebook: ({ id }) => id,
<ide> twitter: ({ username }) => username,
<ide> export function setProfileFromGithub(
<ide> name
<ide> }
<ide> ) {
<del> return assign(
<add> return Object.assign(
<ide> user,
<del> { isGithubCool: true, isMigrationGrandfathered: false },
<ide> {
<ide> name,
<add> email: user.email || githubEmail,
<ide> username: username.toLowerCase(),
<ide> location,
<ide> joinedGithubOn,
<ide> website,
<add> isGithubCool: true,
<ide> picture,
<ide> githubId,
<ide> githubURL, | 4 |
Javascript | Javascript | increase execfile abort coverage | 5dd58d069fd31e778d050a2ffc7af8e64af30095 | <ide><path>test/parallel/test-child-process-execfile.js
<ide> const execOpts = { encoding: 'utf8', shell: true };
<ide> execFile(process.execPath, [echoFixture, 0], { signal }, callback);
<ide> ac.abort();
<ide> }
<add>
<add>{
<add> // Verify that if something different than Abortcontroller.signal
<add> // is passed, ERR_INVALID_ARG_TYPE is thrown
<add> assert.throws(() => {
<add> const callback = common.mustNotCall(() => {});
<add>
<add> execFile(process.execPath, [echoFixture, 0], { signal: 'hello' }, callback);
<add> }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
<add>
<add>} | 1 |
Go | Go | optimize networkdb queue | 55e4cc7262576e2b7c3e9f4692d35fe8824d22e3 | <ide><path>libnetwork/networkdb/broadcast.go
<ide> type tableEventMessage struct {
<ide> tname string
<ide> key string
<ide> msg []byte
<del> node string
<ide> }
<ide>
<ide> func (m *tableEventMessage) Invalidates(other memberlist.Broadcast) bool {
<ide> func (nDB *NetworkDB) sendTableEvent(event TableEvent_Type, nid string, tname st
<ide> id: nid,
<ide> tname: tname,
<ide> key: key,
<del> node: nDB.config.NodeID,
<ide> })
<ide> return nil
<ide> }
<ide><path>libnetwork/networkdb/cluster.go
<ide> const (
<ide> retryInterval = 1 * time.Second
<ide> nodeReapInterval = 24 * time.Hour
<ide> nodeReapPeriod = 2 * time.Hour
<add> // considering a cluster with > 20 nodes and a drain speed of 100 msg/s
<add> // the following is roughly 1 minute
<add> maxQueueLenBroadcastOnSync = 500
<ide> )
<ide>
<ide> type logWriter struct{}
<ide> func (nDB *NetworkDB) bulkSync(nodes []string, all bool) ([]string, error) {
<ide>
<ide> var err error
<ide> var networks []string
<add> var success bool
<ide> for _, node := range nodes {
<ide> if node == nDB.config.NodeID {
<ide> continue
<ide> }
<ide> logrus.Debugf("%v(%v): Initiating bulk sync with node %v", nDB.config.Hostname, nDB.config.NodeID, node)
<ide> networks = nDB.findCommonNetworks(node)
<ide> err = nDB.bulkSyncNode(networks, node, true)
<del> // if its periodic bulksync stop after the first successful sync
<del> if !all && err == nil {
<del> break
<del> }
<ide> if err != nil {
<ide> err = fmt.Errorf("bulk sync to node %s failed: %v", node, err)
<ide> logrus.Warn(err.Error())
<add> } else {
<add> // bulk sync succeeded
<add> success = true
<add> // if its periodic bulksync stop after the first successful sync
<add> if !all {
<add> break
<add> }
<ide> }
<ide> }
<ide>
<del> if err != nil {
<del> return nil, err
<add> if success {
<add> // if at least one node sync succeeded
<add> return networks, nil
<ide> }
<ide>
<del> return networks, nil
<add> return nil, err
<ide> }
<ide>
<ide> // Bulk sync all the table entries belonging to a set of networks to a
<ide><path>libnetwork/networkdb/delegate.go
<ide> func (nDB *NetworkDB) handleNetworkEvent(nEvent *NetworkEvent) bool {
<ide> return true
<ide> }
<ide>
<del>func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent) bool {
<add>func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent, isBulkSync bool) bool {
<ide> // Update our local clock if the received messages has newer time.
<ide> nDB.tableClock.Witness(tEvent.LTime)
<ide>
<ide> func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent) bool {
<ide> nDB.Unlock()
<ide> return false
<ide> }
<add> } else if tEvent.Type == TableEventTypeDelete && !isBulkSync {
<add> nDB.Unlock()
<add> // We don't know the entry, the entry is being deleted and the message is an async message
<add> // In this case the safest approach is to ignore it, it is possible that the queue grew so much to
<add> // exceed the garbage collection time (the residual reap time that is in the message is not being
<add> // updated, to avoid inserting too many messages in the queue).
<add> // Instead the messages coming from TCP bulk sync are safe with the latest value for the garbage collection time
<add> return false
<ide> }
<ide>
<ide> e = &entry{
<ide> func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent) bool {
<ide> nDB.Unlock()
<ide>
<ide> if err != nil && tEvent.Type == TableEventTypeDelete {
<del> // If it is a delete event and we did not have a state for it, don't propagate to the application
<add> // Again we don't know the entry but this is coming from a TCP sync so the message body is up to date.
<add> // We had saved the state so to speed up convergence and be able to avoid accepting create events.
<add> // Now we will rebroadcast the message if 2 conditions are met:
<add> // 1) we had already synced this network (during the network join)
<add> // 2) the residual reapTime is higher than 1/6 of the total reapTime.
<ide> // If the residual reapTime is lower or equal to 1/6 of the total reapTime don't bother broadcasting it around
<del> // most likely the cluster is already aware of it, if not who will sync with this node will catch the state too.
<del> // This also avoids that deletion of entries close to their garbage collection ends up circuling around forever
<del> return e.reapTime > nDB.config.reapEntryInterval/6
<add> // most likely the cluster is already aware of it
<add> // This also reduce the possibility that deletion of entries close to their garbage collection ends up circuling around
<add> // forever
<add> //logrus.Infof("exiting on delete not knowing the obj with rebroadcast:%t", network.inSync)
<add> return network.inSync && e.reapTime > nDB.config.reapEntryInterval/6
<ide> }
<ide>
<ide> var op opType
<ide> func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent) bool {
<ide> }
<ide>
<ide> nDB.broadcaster.Write(makeEvent(op, tEvent.TableName, tEvent.NetworkID, tEvent.Key, tEvent.Value))
<del> return true
<add> return network.inSync
<ide> }
<ide>
<ide> func (nDB *NetworkDB) handleCompound(buf []byte, isBulkSync bool) {
<ide> func (nDB *NetworkDB) handleTableMessage(buf []byte, isBulkSync bool) {
<ide> return
<ide> }
<ide>
<del> if rebroadcast := nDB.handleTableEvent(&tEvent); rebroadcast {
<add> if rebroadcast := nDB.handleTableEvent(&tEvent, isBulkSync); rebroadcast {
<ide> var err error
<ide> buf, err = encodeRawMessage(MessageTypeTableEvent, buf)
<ide> if err != nil {
<ide> func (nDB *NetworkDB) handleTableMessage(buf []byte, isBulkSync bool) {
<ide> return
<ide> }
<ide>
<add> // if the queue is over the threshold, avoid distributing information coming from TCP sync
<add> if isBulkSync && n.tableBroadcasts.NumQueued() > maxQueueLenBroadcastOnSync {
<add> return
<add> }
<add>
<ide> n.tableBroadcasts.QueueBroadcast(&tableEventMessage{
<ide> msg: buf,
<ide> id: tEvent.NetworkID,
<ide> tname: tEvent.TableName,
<ide> key: tEvent.Key,
<del> node: tEvent.NodeName,
<ide> })
<ide> }
<ide> }
<ide><path>libnetwork/networkdb/networkdb.go
<ide> type network struct {
<ide> // Lamport time for the latest state of the entry.
<ide> ltime serf.LamportTime
<ide>
<add> // Gets set to true after the first bulk sync happens
<add> inSync bool
<add>
<ide> // Node leave is in progress.
<ide> leaving bool
<ide>
<ide> func (nDB *NetworkDB) JoinNetwork(nid string) error {
<ide> }
<ide> nDB.addNetworkNode(nid, nDB.config.NodeID)
<ide> networkNodes := nDB.networkNodes[nid]
<add> n = nodeNetworks[nid]
<ide> nDB.Unlock()
<ide>
<ide> if err := nDB.sendNetworkEvent(nid, NetworkEventTypeJoin, ltime); err != nil {
<ide> func (nDB *NetworkDB) JoinNetwork(nid string) error {
<ide> logrus.Errorf("Error bulk syncing while joining network %s: %v", nid, err)
<ide> }
<ide>
<add> // Mark the network as being synced
<add> // note this is a best effort, we are not checking the result of the bulk sync
<add> nDB.Lock()
<add> n.inSync = true
<add> nDB.Unlock()
<add>
<ide> return nil
<ide> }
<ide> | 4 |
Javascript | Javascript | preserve sourcemaps in rollup transforms | 1eedf1b3712f9d4f9cffa50073a30ec29678974e | <ide><path>utils/build/rollup.config.js
<ide> function glconstants() {
<ide>
<ide> return {
<ide> code: code,
<del> map: { mappings: '' }
<add> map: null
<ide> };
<ide>
<ide> }
<ide> function glsl() {
<ide>
<ide> return {
<ide> code: code,
<del> map: { mappings: '' }
<add> map: null
<ide> };
<ide>
<ide> }
<ide> function bubleCleanup() {
<ide>
<ide> return {
<ide> code: code,
<del> map: { mappings: '' }
<add> map: null
<ide> };
<ide>
<ide> } | 1 |
Text | Text | note lack of tests | 102f40e9f6c08651c022ee71d6c1725be9fbf5db | <ide><path>README.md
<ide> Action Cable will move from rails/actioncable to rails/rails and become a full-f
<ide> framework alongside Action Pack, Active Record, and the like once we cross the bridge from alpha
<ide> to beta software (which will happen once the API and missing pieces have solidified).
<ide>
<add>Finally, note that testing is a unfinished, hell unstarted, area of this framework. The framework
<add>has been developed in-app up until this point. We need to find a good way to test both the framework
<add>itself and allow the user to test their connection and channel logic.
<add>
<ide>
<ide> ## Download and installation
<ide> | 1 |
PHP | PHP | remove extra spaces | 9039f2457e8df999aa1a0e401d04dafee135d9f5 | <ide><path>src/Illuminate/Foundation/Testing/TestResponse.php
<ide> public function assertForbidden()
<ide>
<ide> return $this;
<ide> }
<del>
<add>
<ide> /**
<ide> * Assert that the response has an unauthorized status code.
<ide> *
<ide> public function assertForbidden()
<ide> public function assertUnauthorized()
<ide> {
<ide> $actual = $this->getStatusCode();
<del>
<add>
<ide> PHPUnit::assertTrue(
<ide> 401 === $actual,
<ide> 'Response status code ['.$actual.'] is not an unauthorized status code.' | 1 |
Ruby | Ruby | change specs to cover lt, lteq, gt and gteq | 3f8ac523cbf2ebc544e5eec0db2b3247f396f9b3 | <ide><path>test/attributes/test_attribute.rb
<ide> module Attributes
<ide> SELECT * FROM "users" WHERE "users"."karma" > (SELECT AVG("users"."karma") AS avg_id FROM "users")
<ide> }
<ide> end
<add>
<add> it 'should accept various data types.' do
<add> relation = Table.new(:users)
<add> mgr = relation.project relation[:id]
<add> mgr.where relation[:name].gt('fake_name')
<add> mgr.to_sql.must_match %{"users"."name" > 'fake_name'}
<add>
<add> current_time = ::Time.now
<add> mgr.where relation[:created_at].gt(current_time)
<add> mgr.to_sql.must_match %{"users"."created_at" > '#{current_time}'}
<add> end
<ide> end
<ide>
<ide> describe '#gt_any' do
<ide> module Attributes
<ide> SELECT "users"."id" FROM "users" WHERE "users"."id" >= 10
<ide> }
<ide> end
<add>
<add> it 'should accept various data types.' do
<add> relation = Table.new(:users)
<add> mgr = relation.project relation[:id]
<add> mgr.where relation[:name].gteq('fake_name')
<add> mgr.to_sql.must_match %{"users"."name" >= 'fake_name'}
<add>
<add> current_time = ::Time.now
<add> mgr.where relation[:created_at].gteq(current_time)
<add> mgr.to_sql.must_match %{"users"."created_at" >= '#{current_time}'}
<add> end
<ide> end
<ide>
<ide> describe '#gteq_any' do
<ide> module Attributes
<ide> mgr.to_sql.must_be_like %{
<ide> SELECT "users"."id" FROM "users" WHERE "users"."id" < 10
<ide> }
<add> end
<add>
<add> it 'should accept various data types.' do
<add> relation = Table.new(:users)
<add> mgr = relation.project relation[:id]
<add> mgr.where relation[:name].lt('fake_name')
<add> mgr.to_sql.must_match %{"users"."name" < 'fake_name'}
<ide>
<del> mgr.where relation[:created_at].lt(::Time.now)
<del> mgr.to_sql.must_match %{"users"."created_at" <}
<add> current_time = ::Time.now
<add> mgr.where relation[:created_at].lt(current_time)
<add> mgr.to_sql.must_match %{"users"."created_at" < '#{current_time}'}
<ide> end
<ide> end
<ide>
<ide> module Attributes
<ide> mgr.to_sql.must_be_like %{
<ide> SELECT "users"."id" FROM "users" WHERE "users"."id" <= 10
<ide> }
<add> end
<add>
<add> it 'should accept various data types.' do
<add> relation = Table.new(:users)
<add> mgr = relation.project relation[:id]
<add> mgr.where relation[:name].lteq('fake_name')
<add> mgr.to_sql.must_match %{"users"."name" <= 'fake_name'}
<ide>
<del> mgr.where relation[:created_at].lteq(::Time.now)
<del> mgr.to_sql.must_match %{"users"."created_at" <=}
<add> current_time = ::Time.now
<add> mgr.where relation[:created_at].lteq(current_time)
<add> mgr.to_sql.must_match %{"users"."created_at" <= '#{current_time}'}
<ide> end
<ide> end
<ide> | 1 |
Javascript | Javascript | fix concatenation of module externals | 3f7d80d823c1f7a920a35ac17d9756bc2f5d5505 | <ide><path>lib/ExternalModule.js
<ide> const StaticExportsDependency = require("./dependencies/StaticExportsDependency"
<ide> const extractUrlAndGlobal = require("./util/extractUrlAndGlobal");
<ide> const makeSerializable = require("./util/makeSerializable");
<ide> const propertyAccess = require("./util/propertyAccess");
<add>const { register } = require("./util/serialization");
<ide>
<ide> /** @typedef {import("webpack-sources").Source} Source */
<ide> /** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
<ide> class ModuleExternalInitFragment extends InitFragment {
<ide> `external module import ${id}`
<ide> );
<ide> this._identifier = identifier;
<add> this._id = id;
<add> this._request = request;
<ide> }
<ide>
<ide> getNamespaceIdentifier() {
<ide> return this._identifier;
<ide> }
<ide> }
<ide>
<add>register(
<add> ModuleExternalInitFragment,
<add> "webpack/lib/ExternalModule",
<add> "ModuleExternalInitFragment",
<add> {
<add> serialize(obj, { write }) {
<add> write(obj._id);
<add> write(obj._request);
<add> },
<add> deserialize({ read }) {
<add> return new ModuleExternalInitFragment(read(), read());
<add> }
<add> }
<add>);
<add>
<ide> const generateModuleRemapping = (input, exportsInfo, runtime) => {
<ide> if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) {
<ide> const properties = [];
<ide><path>lib/optimize/ConcatenatedModule.js
<ide> const {
<ide> /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
<ide> /** @typedef {import("../DependencyTemplates")} DependencyTemplates */
<ide> /** @typedef {import("../ExportsInfo").ExportInfo} ExportInfo */
<add>/** @template T @typedef {import("../InitFragment")<T>} InitFragment */
<ide> /** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */
<ide> /** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
<ide> /** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */
<ide> const {
<ide> /** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */
<ide> /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
<ide> /** @typedef {import("../WebpackError")} WebpackError */
<add>/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
<ide> /** @typedef {import("../util/Hash")} Hash */
<ide> /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
<ide> /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
<ide> if (!ReferencerClass.prototype.PropertyDefinition) {
<ide> * @property {Object} ast
<ide> * @property {Source} internalSource
<ide> * @property {ReplaceSource} source
<add> * @property {InitFragment<ChunkRenderContext>[]=} chunkInitFragments
<ide> * @property {Iterable<string>} runtimeRequirements
<ide> * @property {Scope} globalScope
<ide> * @property {Scope} moduleScope
<ide> ${defineGetters}`
<ide> }
<ide> }
<ide>
<add> const chunkInitFragments = [];
<add>
<ide> // evaluate modules in order
<ide> for (const rawInfo of modulesWithInfo) {
<ide> let name;
<ide> ${defineGetters}`
<ide> )}\n`
<ide> );
<ide> result.add(info.source);
<add> if (info.chunkInitFragments) {
<add> for (const f of info.chunkInitFragments) chunkInitFragments.push(f);
<add> }
<ide> if (info.runtimeRequirements) {
<ide> for (const r of info.runtimeRequirements) {
<ide> runtimeRequirements.add(r);
<ide> ${defineGetters}`
<ide> }
<ide> }
<ide>
<add> const data = new Map();
<add> if (chunkInitFragments.length > 0)
<add> data.set("chunkInitFragments", chunkInitFragments);
<add>
<ide> /** @type {CodeGenerationResult} */
<ide> const resultEntry = {
<ide> sources: new Map([["javascript", new CachedSource(result)]]),
<add> data,
<ide> runtimeRequirements
<ide> };
<ide>
<ide> ${defineGetters}`
<ide> concatenationScope
<ide> });
<ide> const source = codeGenResult.sources.get("javascript");
<add> const data = codeGenResult.data;
<add> const chunkInitFragments = data && data.get("chunkInitFragments");
<ide> const code = source.source().toString();
<ide> let ast;
<ide> try {
<ide> ${defineGetters}`
<ide> info.ast = ast;
<ide> info.internalSource = source;
<ide> info.source = resultSource;
<add> info.chunkInitFragments = chunkInitFragments;
<ide> info.globalScope = globalScope;
<ide> info.moduleScope = moduleScope;
<ide> } catch (err) {
<ide><path>lib/util/makeSerializable.js
<ide> const { register } = require("./serialization");
<ide> class ClassSerializer {
<ide> constructor(Constructor) {
<ide> this.Constructor = Constructor;
<del> this.hash = null;
<ide> }
<ide>
<ide> serialize(obj, context) {
<ide><path>test/ConfigTestCases.template.js
<ide> const path = require("path");
<ide> const fs = require("graceful-fs");
<ide> const vm = require("vm");
<del>const { URL, pathToFileURL } = require("url");
<add>const { URL, pathToFileURL, fileURLToPath } = require("url");
<ide> const rimraf = require("rimraf");
<ide> const webpack = require("..");
<ide> const TerserPlugin = require("terser-webpack-plugin");
<ide> const describeCases = config => {
<ide> currentDirectory,
<ide> options,
<ide> module,
<del> esmMode
<add> esmMode,
<add> parentModule
<ide> ) => {
<ide> if (Array.isArray(module) || /^\.\.?\//.test(module)) {
<ide> let content;
<ide> const describeCases = config => {
<ide> );
<ide> const esm = new vm.SourceTextModule(content, {
<ide> identifier: p,
<del> context: vm.createContext(moduleScope, {
<del> name: `context for ${p}`
<del> }),
<add> url: pathToFileURL(p).href,
<add> context:
<add> (parentModule && parentModule.context) ||
<add> vm.createContext(moduleScope, {
<add> name: `context for ${p}`
<add> }),
<ide> initializeImportMeta: (meta, module) => {
<ide> meta.url = pathToFileURL(p).href;
<ide> },
<ide> const describeCases = config => {
<ide> path.dirname(p),
<ide> options,
<ide> specifier,
<del> "evaluated"
<add> "evaluated",
<add> module
<ide> );
<ide> return await asModule(result, module.context);
<ide> }
<ide> const describeCases = config => {
<ide> async (specifier, referencingModule) => {
<ide> return await asModule(
<ide> await _require(
<del> path.dirname(referencingModule.identfier),
<add> path.dirname(
<add> referencingModule.identifier ||
<add> fileURLToPath(referencingModule.url)
<add> ),
<ide> options,
<ide> specifier,
<del> "unlinked"
<add> "unlinked",
<add> referencingModule
<ide> ),
<ide> module.context,
<ide> true
<ide><path>test/configCases/module/externals/imported.js
<add>import value from "./module";
<add>
<add>export default value + 2;
<ide><path>test/configCases/module/externals/index.js
<add>import imported from "./imported.mjs";
<add>import value from "./module";
<add>
<add>it("should allow to use externals in concatenated modules", () => {
<add> expect(imported).toBe(42);
<add> expect(value).toBe(40);
<add>});
<ide><path>test/configCases/module/externals/module.js
<add>export default 40;
<ide><path>test/configCases/module/externals/test.config.js
<add>module.exports = {
<add> findBundle: function () {
<add> return "./main.mjs";
<add> }
<add>};
<ide><path>test/configCases/module/externals/webpack.config.js
<add>/** @type {import("../../../../").Configuration} */
<add>module.exports = {
<add> entry: {
<add> main: "./index.js",
<add> imported: {
<add> import: "./imported.js",
<add> library: {
<add> type: "module"
<add> }
<add> }
<add> },
<add> target: "node14",
<add> output: {
<add> filename: "[name].mjs"
<add> },
<add> externals: "./imported.mjs",
<add> experiments: {
<add> outputModule: true
<add> },
<add> optimization: {
<add> concatenateModules: true
<add> }
<add>}; | 9 |
Javascript | Javascript | improve coverage of fs internal utils | def57580fce7a0ca6acd215371028efc7fdb3f5f | <ide><path>test/parallel/test-fs-util-validateoffsetlength.js
<add>// Flags: --expose-internals
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>const {
<add> validateOffsetLengthRead,
<add> validateOffsetLengthWrite,
<add>} = require('internal/fs/utils');
<add>
<add>{
<add> const offset = -1;
<add> assert.throws(
<add> () => validateOffsetLengthRead(offset, 0, 0),
<add> common.expectsError({
<add> code: 'ERR_OUT_OF_RANGE',
<add> name: 'RangeError',
<add> message: 'The value of "offset" is out of range. ' +
<add> `It must be >= 0. Received ${offset}`
<add> })
<add> );
<add>}
<add>
<add>{
<add> const length = -1;
<add> assert.throws(
<add> () => validateOffsetLengthRead(0, length, 0),
<add> common.expectsError({
<add> code: 'ERR_OUT_OF_RANGE',
<add> name: 'RangeError',
<add> message: 'The value of "length" is out of range. ' +
<add> `It must be >= 0. Received ${length}`
<add> })
<add> );
<add>}
<add>
<add>{
<add> const offset = 1;
<add> const length = 1;
<add> const byteLength = offset + length - 1;
<add> assert.throws(
<add> () => validateOffsetLengthRead(offset, length, byteLength),
<add> common.expectsError({
<add> code: 'ERR_OUT_OF_RANGE',
<add> name: 'RangeError',
<add> message: 'The value of "length" is out of range. ' +
<add> `It must be <= ${byteLength - offset}. Received ${length}`
<add> })
<add> );
<add>}
<add>
<add>// Most platforms don't allow reads or writes >= 2 GB.
<add>// See https://github.com/libuv/libuv/pull/1501.
<add>const kIoMaxLength = 2 ** 31 - 1;
<add>
<add>// RangeError when offset > byteLength
<add>{
<add> const offset = 100;
<add> const length = 100;
<add> const byteLength = 50;
<add> assert.throws(
<add> () => validateOffsetLengthWrite(offset, length, byteLength),
<add> common.expectsError({
<add> code: 'ERR_OUT_OF_RANGE',
<add> name: 'RangeError',
<add> message: 'The value of "offset" is out of range. ' +
<add> `It must be <= ${byteLength}. Received ${offset}`
<add> })
<add> );
<add>}
<add>
<add>// RangeError when byteLength < kIoMaxLength, and length > byteLength - offset.
<add>{
<add> const offset = kIoMaxLength - 150;
<add> const length = 200;
<add> const byteLength = kIoMaxLength - 100;
<add> assert.throws(
<add> () => validateOffsetLengthWrite(offset, length, byteLength),
<add> common.expectsError({
<add> code: 'ERR_OUT_OF_RANGE',
<add> name: 'RangeError',
<add> message: 'The value of "length" is out of range. ' +
<add> `It must be <= ${byteLength - offset}. Received ${length}`
<add> })
<add> );
<add>}
<ide><path>test/parallel/test-fs-util-validateoffsetlengthwrite.js
<del>// Flags: --expose-internals
<del>'use strict';
<del>
<del>require('../common');
<del>
<del>const assert = require('assert');
<del>const { validateOffsetLengthWrite } = require('internal/fs/utils');
<del>
<del>// Most platforms don't allow reads or writes >= 2 GB.
<del>// See https://github.com/libuv/libuv/pull/1501.
<del>const kIoMaxLength = 2 ** 31 - 1;
<del>
<del>// RangeError when offset > byteLength
<del>{
<del> const offset = 100;
<del> const length = 100;
<del> const byteLength = 50;
<del> assert.throws(
<del> () => validateOffsetLengthWrite(offset, length, byteLength),
<del> {
<del> code: 'ERR_OUT_OF_RANGE',
<del> name: 'RangeError',
<del> message: 'The value of "offset" is out of range. ' +
<del> `It must be <= ${byteLength}. Received ${offset}`
<del> }
<del> );
<del>}
<del>
<del>// RangeError when byteLength < kIoMaxLength, and length > byteLength - offset.
<del>{
<del> const offset = kIoMaxLength - 150;
<del> const length = 200;
<del> const byteLength = kIoMaxLength - 100;
<del> assert.throws(
<del> () => validateOffsetLengthWrite(offset, length, byteLength),
<del> {
<del> code: 'ERR_OUT_OF_RANGE',
<del> name: 'RangeError',
<del> message: 'The value of "length" is out of range. ' +
<del> `It must be <= ${byteLength - offset}. Received ${length}`
<del> }
<del> );
<del>} | 2 |
Ruby | Ruby | fix merging relation that order including `?` | 96cd16bdeec661c9ecf1a83ca41a2cb22f435af9 | <ide><path>activerecord/lib/active_record/relation/merger.rb
<ide> def merge_outer_joins
<ide> def merge_multi_values
<ide> if other.reordering_value
<ide> # override any order specified in the original relation
<del> relation.reorder! other.order_values
<add> relation.reorder!(*other.order_values)
<ide> elsif other.order_values.any?
<ide> # merge in order_values from relation
<del> relation.order! other.order_values
<add> relation.order!(*other.order_values)
<ide> end
<ide>
<ide> extensions = other.extensions - relation.extensions
<ide><path>activerecord/test/cases/relation/merging_test.rb
<ide> def test_merging_with_from_clause
<ide> relation = relation.merge(Post.from("posts"))
<ide> assert_not_empty relation.from_clause
<ide> end
<add>
<add> def test_merging_with_order_with_binds
<add> relation = Post.all.merge(Post.order([Arel.sql("title LIKE ?"), "%suffix"]))
<add> assert_equal ["title LIKE '%suffix'"], relation.order_values
<add> end
<add>
<add> def test_merging_with_order_without_binds
<add> relation = Post.all.merge(Post.order(Arel.sql("title LIKE '%?'")))
<add> assert_equal ["title LIKE '%?'"], relation.order_values
<add> end
<ide> end
<ide>
<ide> class MergingDifferentRelationsTest < ActiveRecord::TestCase | 2 |
Text | Text | warn users about migrating to 9.4 from dotenv | 5da1dcf669cff474eb6521008173158a5d8f6ebe | <ide><path>docs/basic-features/environment-variables.md
<ide> npx cross-env NEXT_PUBLIC_EXAMPLE_KEY=my-value next dev
<ide>
<ide> - Trying to destructure `process.env` variables won't work due to the limitations of webpack's [DefinePlugin](https://webpack.js.org/plugins/define-plugin/).
<ide> - To avoid exposing secrets, do not use the `NEXT_PUBLIC_` prefix for them. Instead, [expose the variables using `.env`](#exposing-environment-variables).
<add>- You cannot have `dotenv` installed in your project, as this will cause Next.js to disable the auto-loading of the environment variables. Look for and uninstall this package if your variables are showing up as `undefined`.
<ide>
<ide> ## Exposing Environment Variables
<ide> | 1 |
Javascript | Javascript | remove usage of events.eventemitter | f32a606e373ad57f684b0e511d6d6e4cbd48a812 | <ide><path>lib/_http_agent.js
<ide>
<ide> const net = require('net');
<ide> const util = require('util');
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const debug = util.debuglog('http');
<ide>
<ide> // New Agent code.
<ide><path>lib/_http_client.js
<ide> const util = require('util');
<ide> const net = require('net');
<ide> const url = require('url');
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const HTTPParser = process.binding('http_parser').HTTPParser;
<ide> const assert = require('assert').ok;
<ide> const common = require('_http_common');
<ide><path>lib/_http_server.js
<ide>
<ide> const util = require('util');
<ide> const net = require('net');
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const HTTPParser = process.binding('http_parser').HTTPParser;
<ide> const assert = require('assert').ok;
<ide> const common = require('_http_common');
<ide> function onServerResponseClose() {
<ide> // array. That is, in the example below, b still gets called even though
<ide> // it's been removed by a:
<ide> //
<del> // var obj = new events.EventEmitter;
<add> // var EventEmitter = require('events');
<add> // var obj = new EventEmitter();
<ide> // obj.on('event', a);
<ide> // obj.on('event', b);
<ide> // function a() { obj.removeListener('event', b) }
<ide><path>lib/_stream_readable.js
<ide> module.exports = Readable;
<ide> Readable.ReadableState = ReadableState;
<ide>
<del>const EE = require('events').EventEmitter;
<add>const EE = require('events');
<ide> const Stream = require('stream');
<ide> const Buffer = require('buffer').Buffer;
<ide> const util = require('util');
<ide><path>lib/_tls_legacy.js
<ide> 'use strict';
<ide>
<ide> const assert = require('assert');
<del>const events = require('events');
<add>const EventEmitter = require('events');
<ide> const stream = require('stream');
<ide> const tls = require('tls');
<ide> const util = require('util');
<ide> function SecurePair(context, isServer, requestCert, rejectUnauthorized,
<ide>
<ide> options || (options = {});
<ide>
<del> events.EventEmitter.call(this);
<add> EventEmitter.call(this);
<ide>
<ide> this.server = options.server;
<ide> this._secureEstablished = false;
<ide> function SecurePair(context, isServer, requestCert, rejectUnauthorized,
<ide> process.nextTick(securePairNT, this, options);
<ide> }
<ide>
<del>util.inherits(SecurePair, events.EventEmitter);
<add>util.inherits(SecurePair, EventEmitter);
<ide>
<ide> function securePairNT(self, options) {
<ide> /* The Connection may be destroyed by an abort call */
<ide><path>lib/cluster.js
<ide> 'use strict';
<ide>
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const assert = require('assert');
<ide> const dgram = require('dgram');
<ide> const fork = require('child_process').fork;
<ide><path>lib/dgram.js
<ide> const assert = require('assert');
<ide> const Buffer = require('buffer').Buffer;
<ide> const util = require('util');
<del>const events = require('events');
<add>const EventEmitter = require('events');
<ide> const constants = require('constants');
<ide>
<ide> const UDP = process.binding('udp_wrap').UDP;
<ide> exports._createSocketHandle = function(address, port, addressType, fd, flags) {
<ide>
<ide>
<ide> function Socket(type, listener) {
<del> events.EventEmitter.call(this);
<add> EventEmitter.call(this);
<ide>
<ide> if (typeof type === 'object') {
<ide> var options = type;
<ide> function Socket(type, listener) {
<ide> if (typeof listener === 'function')
<ide> this.on('message', listener);
<ide> }
<del>util.inherits(Socket, events.EventEmitter);
<add>util.inherits(Socket, EventEmitter);
<ide> exports.Socket = Socket;
<ide>
<ide>
<ide><path>lib/fs.js
<ide> const constants = require('constants');
<ide> const fs = exports;
<ide> const Buffer = require('buffer').Buffer;
<ide> const Stream = require('stream').Stream;
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const FSReqWrap = binding.FSReqWrap;
<ide> const FSEvent = process.binding('fs_event_wrap').FSEvent;
<ide>
<ide><path>lib/http.js
<ide>
<ide> const util = require('util');
<ide> const internalUtil = require('internal/util');
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide>
<ide>
<ide> exports.IncomingMessage = require('_http_incoming').IncomingMessage;
<ide><path>lib/internal/child_process.js
<ide>
<ide> const StringDecoder = require('string_decoder').StringDecoder;
<ide> const Buffer = require('buffer').Buffer;
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const net = require('net');
<ide> const dgram = require('dgram');
<ide> const util = require('util');
<ide><path>lib/internal/socket_list.js
<ide>
<ide> module.exports = {SocketListSend, SocketListReceive};
<ide>
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide> const util = require('util');
<ide>
<ide> // This object keep track of the socket there are sended
<ide><path>lib/net.js
<ide> 'use strict';
<ide>
<del>const events = require('events');
<add>const EventEmitter = require('events');
<ide> const stream = require('stream');
<ide> const timers = require('timers');
<ide> const util = require('util');
<ide> function Server(options, connectionListener) {
<ide> if (!(this instanceof Server))
<ide> return new Server(options, connectionListener);
<ide>
<del> events.EventEmitter.call(this);
<add> EventEmitter.call(this);
<ide>
<ide> var self = this;
<ide> var options;
<ide> function Server(options, connectionListener) {
<ide> this.allowHalfOpen = options.allowHalfOpen || false;
<ide> this.pauseOnConnect = !!options.pauseOnConnect;
<ide> }
<del>util.inherits(Server, events.EventEmitter);
<add>util.inherits(Server, EventEmitter);
<ide> exports.Server = Server;
<ide>
<ide>
<ide><path>lib/readline.js
<ide> const util = require('util');
<ide> const internalUtil = require('internal/util');
<ide> const inherits = util.inherits;
<ide> const Buffer = require('buffer').Buffer;
<del>const EventEmitter = require('events').EventEmitter;
<add>const EventEmitter = require('events');
<ide>
<ide>
<ide> exports.createInterface = function(input, output, completer, terminal) {
<ide><path>lib/stream.js
<ide>
<ide> module.exports = Stream;
<ide>
<del>const EE = require('events').EventEmitter;
<add>const EE = require('events');
<ide> const util = require('util');
<ide>
<ide> util.inherits(Stream, EE);
<ide><path>src/node.js
<ide> this.global = this;
<ide>
<ide> function startup() {
<del> var EventEmitter = NativeModule.require('events').EventEmitter;
<add> var EventEmitter = NativeModule.require('events');
<ide>
<ide> process.__proto__ = Object.create(EventEmitter.prototype, {
<ide> constructor: { | 15 |
Python | Python | fix openstack tests | 17fa4a3c24754df8ebf01176ee37cfab4dbf52b5 | <ide><path>libcloud/test/compute/test_openstack.py
<ide> def _v1_0_slug_images_333111(self, method, url, body, headers):
<ide> raise NotImplementedError()
<ide> # this is currently used for deletion of an image
<ide> # as such it should not accept GET/POST
<del> return(httplib.NO_CONTENT, "", "", httplib.responses[httplib.NO_CONTENT])
<add> return(httplib.NO_CONTENT, "", {}, httplib.responses[httplib.NO_CONTENT])
<ide>
<ide> def _v1_0_slug_images(self, method, url, body, headers):
<ide> if method != "POST": | 1 |
Javascript | Javascript | fix broken tests in test-buffer-includes | 52b666ee3dd4beb76d7862337e54a35959799c1e | <ide><path>test/parallel/test-buffer-includes.js
<ide> assert(mixedByteStringUcs2.includes('bc', 0, 'ucs2'));
<ide> assert(mixedByteStringUcs2.includes('\u03a3', 0, 'ucs2'));
<ide> assert(!mixedByteStringUcs2.includes('\u0396', 0, 'ucs2'));
<ide>
<del>assert(
<del> 6, mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2'));
<del>assert(
<del> 10, mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'),
<del> 0, 'ucs2'));
<del>assert(
<del> -1, mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'),
<del> 0, 'ucs2'));
<add>assert.ok(
<add> mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2'));
<add>assert.ok(
<add> mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2'));
<add>assert.ok(
<add> !mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2'));
<ide>
<ide> twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2');
<ide>
<ide> for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
<ide>
<ide> const patternBufferUcs2 =
<ide> allCharsBufferUcs2.slice(index, index + length);
<del> assert(
<del> index, allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2'));
<add> assert.ok(
<add> allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2'));
<ide>
<ide> const patternStringUcs2 = patternBufferUcs2.toString('ucs2');
<del> assert(
<del> index, allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2'));
<add> assert.ok(
<add> allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2'));
<ide> }
<ide> }
<ide> | 1 |
Javascript | Javascript | handle undefined url in linkannotation | 054f1e7e57ac7e2ea476bd7cfa603dc1fee7a520 | <ide><path>src/shared/annotation.js
<ide> var LinkAnnotation = (function LinkAnnotationClosure() {
<ide> if (isName(url)) {
<ide> // Some bad PDFs do not put parentheses around relative URLs.
<ide> url = '/' + url.name;
<del> } else {
<add> } else if (url) {
<ide> url = addDefaultProtocolToUrl(url);
<ide> }
<ide> // TODO: pdf spec mentions urls can be relative to a Base
<ide> var LinkAnnotation = (function LinkAnnotationClosure() {
<ide>
<ide> // Lets URLs beginning with 'www.' default to using the 'http://' protocol.
<ide> function addDefaultProtocolToUrl(url) {
<del> if (url.indexOf('www.') === 0) {
<add> if (url && url.indexOf('www.') === 0) {
<ide> return ('http://' + url);
<ide> }
<ide> return url; | 1 |
Text | Text | clarify path search in `child_process.spawn` | c649573a2ab4866426d629088c6d5c989eaf8fd8 | <ide><path>doc/api/child_process.md
<ide> identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`
<ide> option if the output will not be consumed.
<ide>
<ide> The command lookup is performed using the `options.env.PATH` environment
<del>variable if it is in the `options` object. Otherwise, `process.env.PATH` is
<del>used.
<add>variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
<add>used. If `options.env` is set without `PATH`, lookup on Unix is performed
<add>on a default search path search of `/usr/bin:/bin` (see your operating system's
<add>manual for execvpe/execvp), on Windows the current processes environment
<add>variable `PATH` is used.
<ide>
<ide> On Windows, environment variables are case-insensitive. Node.js
<ide> lexicographically sorts the `env` keys and uses the first one that | 1 |
Ruby | Ruby | detect outdated head in outdated_versions | 001bef0604534adeb5f85d77e00a20e8a1542b7a | <ide><path>Library/Homebrew/formula.rb
<ide> def migration_needed?
<ide> end
<ide>
<ide> # @private
<del> def outdated_versions
<add> def outdated_versions(options = {})
<ide> @outdated_versions ||= begin
<ide> all_versions = []
<ide>
<ide> def outdated_versions
<ide> installed_kegs.each do |keg|
<ide> version = keg.version
<ide> all_versions << version
<del> return [] if pkg_version <= version
<add>
<add> return [] if pkg_version <= version && !version.head?
<ide> end
<ide>
<del> all_versions.sort!
<add> head_version = latest_head_version
<add> if head_version
<add> head_version_outdated?(head_version, options) ? all_versions.sort! : []
<add> else
<add> all_versions.sort!
<add> end
<ide> end
<ide> end
<ide>
<ide> # @private
<del> def outdated?
<del> !outdated_versions.empty?
<add> def outdated?(options = {})
<add> !outdated_versions(options).empty?
<ide> rescue Migrator::MigrationNeededError
<ide> true
<ide> end | 1 |
Javascript | Javascript | remove redundant imports in xstate example | fedc662f259915bac5c312a4254e2d8b7e8b4223 | <ide><path>examples/with-xstate/components/Toggle.js
<del>import React from 'react'
<del>
<ide> const Toggle = ({ onToggle, active }) => {
<ide> return (
<ide> <div>
<ide><path>examples/with-xstate/pages/index.js
<del>import React from 'react'
<ide> import { useMachine } from '@xstate/react'
<ide> import { Counter, Toggle } from '../components'
<ide> import { toggleMachine } from '../machines/toggleMachine' | 2 |
Ruby | Ruby | use general types for mysql fields | ca703bbc06c353acc41851578e264e4459d481c2 | <ide><path>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
<ide> def last_inserted_id(result)
<ide> end
<ide>
<ide> module Fields
<del> class Type
<del> def type; end
<del>
<del> def type_cast_for_write(value)
<del> value
<del> end
<del> end
<del>
<del> class Identity < Type
<del> def type_cast(value); value; end
<del> end
<del>
<del> class Integer < Type
<del> def type_cast(value)
<del> return if value.nil?
<del>
<del> value.to_i rescue value ? 1 : 0
<del> end
<del> end
<del>
<del> class Date < Type
<del> def type; :date; end
<del>
<del> def type_cast(value)
<del> return if value.nil?
<del>
<del> # FIXME: probably we can improve this since we know it is mysql
<del> # specific
<del> ConnectionAdapters::Column.value_to_date value
<del> end
<del> end
<del>
<del> class DateTime < ConnectionAdapters::Type::DateTime
<add> class DateTime < Type::DateTime
<ide> def cast_value(value)
<ide> if Mysql::Time === value
<ide> new_time(
<ide> def cast_value(value)
<ide> end
<ide> end
<ide>
<del> class Time < ConnectionAdapters::Type::Time
<add> class Time < Type::Time
<ide> def cast_value(value)
<ide> if Mysql::Time === value
<ide> new_time(
<ide> def cast_value(value)
<ide> end
<ide> end
<ide>
<del> class Float < Type
<del> def type; :float; end
<del>
<del> def type_cast(value)
<del> return if value.nil?
<del>
<del> value.to_f
<del> end
<del> end
<del>
<del> class Decimal < Type
<del> def type_cast(value)
<del> return if value.nil?
<del>
<del> ConnectionAdapters::Column.value_to_decimal value
<del> end
<del> end
<del>
<del> class Boolean < Type
<del> def type_cast(value)
<del> return if value.nil?
<del>
<del> ConnectionAdapters::Column.value_to_boolean value
<del> end
<del> end
<del>
<ide> TYPES = {}
<ide>
<ide> # Register an MySQL +type_id+ with a typecasting object in
<ide> def self.find_type(field)
<ide> if field.type == Mysql::Field::TYPE_TINY && field.length > 1
<ide> TYPES[Mysql::Field::TYPE_LONG]
<ide> else
<del> TYPES.fetch(field.type) { Fields::Identity.new }
<add> TYPES.fetch(field.type) { Type::Value.new }
<ide> end
<ide> end
<ide>
<del> register_type Mysql::Field::TYPE_TINY, Fields::Boolean.new
<del> register_type Mysql::Field::TYPE_LONG, Fields::Integer.new
<add> register_type Mysql::Field::TYPE_TINY, Type::Boolean.new
<add> register_type Mysql::Field::TYPE_LONG, Type::Integer.new
<ide> alias_type Mysql::Field::TYPE_LONGLONG, Mysql::Field::TYPE_LONG
<ide> alias_type Mysql::Field::TYPE_NEWDECIMAL, Mysql::Field::TYPE_LONG
<ide>
<del> register_type Mysql::Field::TYPE_VAR_STRING, Fields::Identity.new
<del> register_type Mysql::Field::TYPE_BLOB, Fields::Identity.new
<del> register_type Mysql::Field::TYPE_DATE, Fields::Date.new
<add> register_type Mysql::Field::TYPE_VAR_STRING, Type::Value.new
<add> register_type Mysql::Field::TYPE_BLOB, Type::Value.new
<add> register_type Mysql::Field::TYPE_DATE, Type::Date.new
<ide> register_type Mysql::Field::TYPE_DATETIME, Fields::DateTime.new
<ide> register_type Mysql::Field::TYPE_TIME, Fields::Time.new
<del> register_type Mysql::Field::TYPE_FLOAT, Fields::Float.new
<add> register_type Mysql::Field::TYPE_FLOAT, Type::Float.new
<ide>
<ide> Mysql::Field.constants.grep(/TYPE/).map { |class_name|
<ide> Mysql::Field.const_get class_name
<ide> }.reject { |const| TYPES.key? const }.each do |const|
<del> register_type const, Fields::Identity.new
<add> register_type const, Type::Value.new
<ide> end
<ide> end
<ide>
<ide> def exec_without_stmt(sql, name = 'SQL') # :nodoc:
<ide> fields << field_name
<ide>
<ide> if field.decimals > 0
<del> types[field_name] = Fields::Decimal.new
<add> types[field_name] = Type::Decimal.new
<ide> else
<ide> types[field_name] = Fields.find_type field
<ide> end | 1 |
Ruby | Ruby | fix undefined `dep_f` | 461b61abacbafd523f007e76b39b542f04155994 | <ide><path>Library/Homebrew/cmd/link.rb
<ide> def link
<ide> elsif (MacOS.version >= :mojave ||
<ide> MacOS::Xcode.version >= "10.0" ||
<ide> MacOS::CLT.version >= "10.0") &&
<del> dep_f.keg_only_reason.reason == :provided_by_macos
<add> keg.to_formula.keg_only_reason.reason == :provided_by_macos
<ide> opoo <<~EOS
<ide> Refusing to link macOS-provided software: #{keg.name}
<ide> Instead, pass the full include/library paths to your compiler e.g.: | 1 |
Javascript | Javascript | fix moment.utc with array of formats | 0b549ab759c3191b7442ac1108b87f56880a197c | <ide><path>moment.js
<ide> for (i = 0; i < config._f.length; i++) {
<ide> currentScore = 0;
<ide> tempConfig = copyConfig({}, config);
<add> if (config._useUTC != null) {
<add> tempConfig._useUTC = config._useUTC;
<add> }
<ide> tempConfig._pf = defaultParsingFlags();
<ide> tempConfig._f = config._f[i];
<ide> makeDateFromStringAndFormat(tempConfig);
<ide><path>test/moment/create.js
<ide> exports.create = {
<ide> true,
<ide> 'string array + isValid');
<ide> test.done();
<add> },
<add>
<add> 'utc with array of formats' : function (test) {
<add> test.equal(moment.utc('2014-01-01', ['YYYY-MM-DD', 'YYYY-MM']).format(),
<add> '2014-01-01T00:00:00+00:00',
<add> 'moment.utc works with array of formats');
<add> test.done();
<ide> }
<ide>
<ide> }; | 2 |
Text | Text | fix the gateway type in remote network plugin spec | 1c67f2592bf781856a8e4aa53f91f549903fe787 | <ide><path>libnetwork/docs/remote.md
<ide> When the proxy is asked to create a network, the remote process shall receive a
<ide> {
<ide> "AddressSpace": string,
<ide> "Pool": ipv4-cidr-string,
<del> "Gateway" : ipv4-address"
<add> "Gateway" : ipv4-cidr-string,
<ide> "AuxAddresses": {
<ide> "<identifier1>" : "<ipv4-address1>",
<ide> "<identifier2>" : "<ipv4-address2>",
<ide> When the proxy is asked to create a network, the remote process shall receive a
<ide> {
<ide> "AddressSpace": string,
<ide> "Pool": ipv6-cidr-string,
<del> "Gateway" : ipv6-address"
<add> "Gateway" : ipv6-cidr-string,
<ide> "AuxAddresses": {
<ide> "<identifier1>" : "<ipv6-address1>",
<ide> "<identifier2>" : "<ipv6-address2>",
<ide> When the proxy is asked to create a network, the remote process shall receive a
<ide> * `IPv4Data` and `IPv6Data` are the ip-addressing data configured by the user and managed by IPAM driver. The network driver is expected to honor the ip-addressing data supplied by IPAM driver. The data include,
<ide> * `AddressSpace` : A unique string represents an isolated space for IP Addressing
<ide> * `Pool` : A range of IP Addresses represented in CIDR format address/mask. Since, the IPAM driver is responsible for allocating container ip-addresses, the network driver can make use of this information for the network plumbing purposes.
<del>* `Gateway` : Optionally, the IPAM driver may provide a Gateway for the subnet represented by the Pool. The network driver can make use of this information for the network plumbing purposes.
<add>* `Gateway` : Optionally, the IPAM driver may provide a Gateway IP address in CIDR format for the subnet represented by the Pool. The network driver can make use of this information for the network plumbing purposes.
<ide> * `AuxAddresses` : A list of pre-allocated ip-addresses with an associated identifier as provided by the user to assist network driver if it requires specific ip-addresses for its operation.
<ide>
<ide> The response indicating success is empty: | 1 |
Text | Text | fix example output | a65a24409d40db9c344b117d44671cbf3d281321 | <ide><path>examples/custom-json-modules/README.md
<ide> module.exports = {
<ide>
<ide> ```javascript
<ide> /******/ (() => { // webpackBootstrap
<add>/******/ "use strict";
<ide> /******/ var __webpack_modules__ = ([
<ide> /* 0 */
<ide> /*!********************!*\
<ide> module.exports = {
<ide> /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
<ide> /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
<ide>
<del>"use strict";
<ide> __webpack_require__.r(__webpack_exports__);
<ide> /* harmony import */ var _data_toml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./data.toml */ 1);
<ide> /* harmony import */ var _data_yaml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./data.yaml */ 2);
<ide> module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\"
<ide> ## webpack output
<ide>
<ide> ```
<del>Hash: [1mf9cc6e468bda1ef6f9fb[39m[22m
<del>Version: webpack [1m5.0.0-beta.7[39m[22m
<del>Time: [1m161[39m[22mms
<del> [1mAsset[39m[22m [1mSize[39m[22m
<del>[1m[32moutput.js[39m[22m 8.18 KiB [1m[32m[emitted][39m[22m [name: main]
<del>Entrypoint [1mmain[39m[22m = [1m[32moutput.js[39m[22m
<del>chunk [1m[32moutput.js[39m[22m (main) 919 bytes (javascript) 274 bytes (runtime) [1m[33m[entry][39m[22m [1m[32m[rendered][39m[22m
<del> > ./example.js [1m[39m[22m main
<del> [1m./data.json5[39m[22m 189 bytes [1m[32m[built][39m[22m
<del> [1m[36m[exports: default, owner, title][39m[22m
<del> [1m[36m[used exports unknown][39m[22m
<del> harmony side effect evaluation [1m[36m./data.json5[39m[22m [1m[35m./example.js[39m[22m 3:0-32 [1m[36m[39m[22m
<del> harmony import specifier [1m[36m./data.json5[39m[22m [1m[35m./example.js[39m[22m 5:56-60 [1m[36m[39m[22m
<del> [1m./data.toml[39m[22m 188 bytes [1m[32m[built][39m[22m
<del> [1m[36m[exports: default, owner, title][39m[22m
<del> [1m[36m[used exports unknown][39m[22m
<del> harmony side effect evaluation [1m[36m./data.toml[39m[22m [1m[35m./example.js[39m[22m 1:0-31 [1m[36m[39m[22m
<del> harmony import specifier [1m[36m./data.toml[39m[22m [1m[35m./example.js[39m[22m 5:44-48 [1m[36m[39m[22m
<del> [1m./data.yaml[39m[22m 188 bytes [1m[32m[built][39m[22m
<del> [1m[36m[exports: default, owner, title][39m[22m
<del> [1m[36m[used exports unknown][39m[22m
<del> harmony side effect evaluation [1m[36m./data.yaml[39m[22m [1m[35m./example.js[39m[22m 2:0-31 [1m[36m[39m[22m
<del> harmony import specifier [1m[36m./data.yaml[39m[22m [1m[35m./example.js[39m[22m 5:50-54 [1m[36m[39m[22m
<del> [1m./example.js[39m[22m 354 bytes [1m[32m[built][39m[22m
<del> [1m[36m[no exports][39m[22m
<del> [1m[36m[used exports unknown][39m[22m
<del> entry [1m[36m./example.js[39m[22m [1m[35mnull[39m[22m main [1m[36m[39m[22m
<add>Hash: 0a1b2c3d4e5f6a7b8c9d
<add>Version: webpack 5.0.0-beta.7
<add> Asset Size
<add>output.js 8.19 KiB [emitted] [name: main]
<add>Entrypoint main = output.js
<add>chunk output.js (main) 919 bytes (javascript) 274 bytes (runtime) [entry] [rendered]
<add> > ./example.js main
<add> ./data.json5 189 bytes [built]
<add> [exports: default, owner, title]
<add> [used exports unknown]
<add> harmony side effect evaluation ./data.json5 ./example.js 3:0-32
<add> harmony import specifier ./data.json5 ./example.js 5:56-60
<add> ./data.toml 188 bytes [built]
<add> [exports: default, owner, title]
<add> [used exports unknown]
<add> harmony side effect evaluation ./data.toml ./example.js 1:0-31
<add> harmony import specifier ./data.toml ./example.js 5:44-48
<add> ./data.yaml 188 bytes [built]
<add> [exports: default, owner, title]
<add> [used exports unknown]
<add> harmony side effect evaluation ./data.yaml ./example.js 2:0-31
<add> harmony import specifier ./data.yaml ./example.js 5:50-54
<add> ./example.js 354 bytes [built]
<add> [no exports]
<add> [used exports unknown]
<add> entry ./example.js main
<ide> + 1 hidden chunk module
<ide> ``` | 1 |
Javascript | Javascript | skip non-doc files in test-make-doc checks | 759809f67421bdceff9a6799424f5b7d191c458f | <ide><path>test/doctool/test-make-doc.js
<ide> const apiPath = path.resolve(__dirname, '..', '..', 'out', 'doc', 'api');
<ide> const allDocs = fs.readdirSync(apiPath);
<ide> assert.ok(allDocs.includes('_toc.html'));
<ide>
<del>const filter = ['assets', '_toc.html', '.md'];
<ide> const actualDocs = allDocs.filter(
<del> (name) => !filter.some((str) => name.includes(str))
<add> (name) => {
<add> const extension = path.extname(name);
<add> return (extension === '.html' || extension === '.json') &&
<add> name !== '_toc.html';
<add> }
<ide> );
<ide>
<ide> const toc = fs.readFileSync(path.resolve(apiPath, '_toc.html'), 'utf8'); | 1 |
Text | Text | add a note about react classe name convention | 83a2465af9a95db9ffa3369e4c8e2b1db28a3bcb | <ide><path>docs/docs/tutorial.md
<ide> React.render(
<ide> );
<ide> ```
<ide>
<add>Note that native HTML element names start with a lowercase letter, while custom React classes names begin with an uppercase letter.
<add>
<ide> #### JSX Syntax
<ide>
<ide> The first thing you'll notice is the XML-ish syntax in your JavaScript. We have a simple precompiler that translates the syntactic sugar to this plain JavaScript: | 1 |
Python | Python | add time and level to default logging formatter | a3293efc4826c2528e7a740273d0bf424ba874ea | <ide><path>spacy/util.py
<ide>
<ide> logger = logging.getLogger("spacy")
<ide> logger_stream_handler = logging.StreamHandler()
<del>logger_stream_handler.setFormatter(logging.Formatter("%(message)s"))
<add>logger_stream_handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s"))
<ide> logger.addHandler(logger_stream_handler)
<ide>
<ide> | 1 |
Javascript | Javascript | add weathereh to showcase | 5c6bbf7f1fe23800e4f8b3e1a8911c5b5a280d2c | <ide><path>website/src/react-native/showcase.js
<ide> var apps = [
<ide> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.wearvr.app',
<ide> author: 'WEARVR LLC',
<ide> },
<add> {
<add> name: 'WeatherEh - Canada weather',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple18/v4/39/cf/84/39cf8411-acc3-f7d6-3923-39973c2eb511/icon175x175.jpeg',
<add> link: 'https://itunes.apple.com/app/id1112813447',
<add> author: 'Zhao Han',
<add> },
<ide> {
<ide> name: 'wego concerts',
<ide> icon: 'http://a5.mzstatic.com/us/r30/Purple69/v4/03/91/2d/03912daa-fae7-6a25-5f11-e6b19290b3f4/icon175x175.png', | 1 |
Ruby | Ruby | remove redundant attr_readers | 00f05eafe988267da4797922b350aee68c8dd937 | <ide><path>Library/Homebrew/formula_support.rb
<ide> def verify_download_integrity fn
<ide>
<ide> class Bottle < SoftwareSpec
<ide> attr_writer :url
<del> attr_reader :revision, :root_url, :cellar
<ide> # TODO: Can be removed when all bottles migrated to underscored cat symbols.
<ide> attr_reader :cat_without_underscores
<ide> | 1 |
PHP | PHP | remove unused variable | 5500f942b9c277fe13161852db04074edb9f25f5 | <ide><path>lib/Cake/Routing/Router.php
<ide> public static function redirect($route, $url, $options = array()) {
<ide> * @return array Array of mapped resources
<ide> */
<ide> public static function mapResources($controller, $options = array()) {
<del> $hasPrefix = isset($options['prefix']);
<ide> $options = array_merge(array(
<ide> 'id' => static::ID . '|' . static::UUID
<ide> ), $options); | 1 |
Python | Python | replace scipytestcase with numpytestcase | 10943b683e107694053221df6b36e5117eb38e13 | <ide><path>numpy/core/tests/test_ma.py
<ide> import types, time
<ide> from numpy.core.ma import *
<ide> from numpy.core.numerictypes import float32
<del>from numpy.testing import ScipyTestCase, ScipyTest
<add>from numpy.testing import NumpyTestCase, NumpyTest
<ide> pi = numpy.pi
<ide> def eq(v,w, msg=''):
<ide> result = allclose(v,w)
<ide> def eq(v,w, msg=''):
<ide> %s"""% (msg, str(v), str(w))
<ide> return result
<ide>
<del>class test_ma(ScipyTestCase):
<add>class test_ma(NumpyTestCase):
<ide> def __init__(self, *args, **kwds):
<del> ScipyTestCase.__init__(self, *args, **kwds)
<add> NumpyTestCase.__init__(self, *args, **kwds)
<ide> self.setUp()
<ide>
<ide> def setUp (self):
<ide> def check_testSingleElementSubscript(self):
<ide> self.failUnlessEqual(b[0].shape, ())
<ide> self.failUnlessEqual(b[1].shape, ())
<ide>
<del>class test_ufuncs(ScipyTestCase):
<add>class test_ufuncs(NumpyTestCase):
<ide> def setUp(self):
<ide> self.d = (array([1.0, 0, -1, pi/2]*2, mask=[0,1]+[0]*6),
<ide> array([1.0, 0, -1, pi/2]*2, mask=[1,0]+[0]*6),)
<ide> def test_nonzero(self):
<ide> self.failUnless(eq(nonzero(x), [0]))
<ide>
<ide>
<del>class test_array_methods(ScipyTestCase):
<add>class test_array_methods(NumpyTestCase):
<ide>
<ide> def setUp(self):
<ide> x = numpy.array([ 8.375, 7.545, 8.828, 8.5 , 1.757, 5.928,
<ide> def testinplace(x):
<ide> testinplace.test_name = 'Inplace operations'
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest('numpy.core.ma').run()
<add> NumpyTest('numpy.core.ma').run()
<ide> #timingTest()
<ide><path>numpy/core/tests/test_multiarray.py
<ide> from numpy.core import *
<ide> from numpy import random
<ide>
<del>class test_flags(ScipyTestCase):
<add>class test_flags(NumpyTestCase):
<ide> def setUp(self):
<ide> self.a = arange(10)
<ide>
<ide> def check_otherflags(self):
<ide> assert_equal(self.a.flags.updateifcopy, False)
<ide>
<ide>
<del>class test_attributes(ScipyTestCase):
<add>class test_attributes(NumpyTestCase):
<ide> def setUp(self):
<ide> self.one = arange(10)
<ide> self.two = arange(20).reshape(4,5)
<ide> def check_fill(self):
<ide> x.fill(x[0])
<ide> assert_equal(x['f1'][1], x['f1'][0])
<ide>
<del>class test_dtypedescr(ScipyTestCase):
<add>class test_dtypedescr(NumpyTestCase):
<ide> def check_construction(self):
<ide> d1 = dtype('i4')
<ide> assert_equal(d1, dtype(int32))
<ide> d2 = dtype('f8')
<ide> assert_equal(d2, dtype(float64))
<ide>
<del>class test_fromstring(ScipyTestCase):
<add>class test_fromstring(NumpyTestCase):
<ide> def check_binary(self):
<ide> a = fromstring('\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@',dtype='<f4')
<ide> assert_array_equal(a, array([1,2,3,4]))
<ide> def check_ascii(self):
<ide> b = fromstring('1,2,3,4',dtype=float,sep=',')
<ide> assert_array_equal(a,b)
<ide>
<del>class test_zero_rank(ScipyTestCase):
<add>class test_zero_rank(NumpyTestCase):
<ide> def setUp(self):
<ide> self.d = array(0), array('x', object)
<ide>
<ide> def check_output(self):
<ide> x = array(2)
<ide> self.failUnlessRaises(ValueError, add, x, [1], x)
<ide>
<del>class test_creation(ScipyTestCase):
<add>class test_creation(NumpyTestCase):
<ide> def check_from_attribute(self):
<ide> class x(object):
<ide> def __array__(self, dtype=None):
<ide> pass
<ide> self.failUnlessRaises(ValueError, array, x())
<ide>
<del>class test_bool(ScipyTestCase):
<add>class test_bool(NumpyTestCase):
<ide> def check_test_interning(self):
<ide> a0 = bool_(0)
<ide> b0 = bool_(False)
<ide> def check_test_interning(self):
<ide> self.failUnless(array(True)[()] is a1)
<ide>
<ide>
<del>class test_methods(ScipyTestCase):
<add>class test_methods(NumpyTestCase):
<ide> def check_test_round(self):
<ide> assert_equal(array([1.2,1.5]).round(), [1,2])
<ide> assert_equal(array(1.5).round(), 2)
<ide> def check_transpose(self):
<ide> self.failUnlessRaises(ValueError, lambda: a.transpose(0,0))
<ide> self.failUnlessRaises(ValueError, lambda: a.transpose(0,1,2))
<ide>
<del>class test_subscripting(ScipyTestCase):
<add>class test_subscripting(NumpyTestCase):
<ide> def check_test_zero_rank(self):
<ide> x = array([1,2,3])
<ide> self.failUnless(isinstance(x[0], int))
<ide> self.failUnless(type(x[0, ...]) is ndarray)
<ide>
<del>class test_pickling(ScipyTestCase):
<add>class test_pickling(NumpyTestCase):
<ide> def check_both(self):
<ide> import pickle
<ide> carray = array([[2,9],[7,0],[3,8]])
<ide> def check_version1_object(self):
<ide> p = loads(s)
<ide> assert_equal(a, p)
<ide>
<del>class test_fancy_indexing(ScipyTestCase):
<add>class test_fancy_indexing(NumpyTestCase):
<ide> def check_list(self):
<ide> x = ones((1,1))
<ide> x[:,[0]] = 2.0
<ide> def check_tuple(self):
<ide> x[:,:,(0,)] = 2.0
<ide> assert_array_equal(x, array([[[2.0]]]))
<ide>
<del>class test_string_compare(ScipyTestCase):
<add>class test_string_compare(NumpyTestCase):
<ide> def check_string(self):
<ide> g1 = array(["This","is","example"])
<ide> g2 = array(["This","was","example"])
<ide> def check_unicode(self):
<ide> assert_array_equal(g1 > g2, [g1[i] > g2[i] for i in [0,1,2]])
<ide>
<ide>
<del>class test_argmax(ScipyTestCase):
<add>class test_argmax(NumpyTestCase):
<ide> def check_all(self):
<ide> a = random.normal(0,1,(4,5,6,7,8))
<ide> for i in xrange(a.ndim):
<ide> def check_all(self):
<ide> axes.remove(i)
<ide> assert all(amax == aargmax.choose(*a.transpose(i,*axes)))
<ide>
<del>class test_newaxis(ScipyTestCase):
<add>class test_newaxis(NumpyTestCase):
<ide> def check_basic(self):
<ide> sk = array([0,-0.1,0.1])
<ide> res = 250*sk[:,newaxis]
<ide> def check_basic(self):
<ide> restore_path()
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest('numpy.core.multiarray').run()
<add> NumpyTest('numpy.core.multiarray').run()
<ide><path>numpy/core/tests/test_umath.py
<ide> from numpy import zeros, ndarray, array, choose
<ide> restore_path()
<ide>
<del>class test_power(ScipyTestCase):
<add>class test_power(NumpyTestCase):
<ide> def check_power_float(self):
<ide> x = array([1., 2., 3.])
<ide> assert_equal(x**0, [1., 1., 1.])
<ide> def check_power_complex(self):
<ide> assert_almost_equal(x**14, [-76443+16124j, 23161315+58317492j,
<ide> 5583548873 + 2465133864j])
<ide>
<del>class test_log1p(ScipyTestCase):
<add>class test_log1p(NumpyTestCase):
<ide> def check_log1p(self):
<ide> assert_almost_equal(ncu.log1p(0.2), ncu.log(1.2))
<ide> assert_almost_equal(ncu.log1p(1e-6), ncu.log(1+1e-6))
<ide>
<del>class test_expm1(ScipyTestCase):
<add>class test_expm1(NumpyTestCase):
<ide> def check_expm1(self):
<ide> assert_almost_equal(ncu.expm1(0.2), ncu.exp(0.2)-1)
<ide> assert_almost_equal(ncu.expm1(1e-6), ncu.exp(1e-6)-1)
<ide>
<del>class test_maximum(ScipyTestCase):
<add>class test_maximum(NumpyTestCase):
<ide> def check_reduce_complex(self):
<ide> assert_equal(maximum.reduce([1,2j]),1)
<ide> assert_equal(maximum.reduce([1+3j,2j]),1+3j)
<ide>
<del>class test_minimum(ScipyTestCase):
<add>class test_minimum(NumpyTestCase):
<ide> def check_reduce_complex(self):
<ide> assert_equal(minimum.reduce([1,2j]),2j)
<ide>
<del>class test_floating_point(ScipyTestCase):
<add>class test_floating_point(NumpyTestCase):
<ide> def check_floating_point(self):
<ide> assert_equal(ncu.FLOATING_POINT_SUPPORT, 1)
<ide>
<del>class test_special_methods(ScipyTestCase):
<add>class test_special_methods(NumpyTestCase):
<ide> def test_wrap(self):
<ide> class with_wrap(object):
<ide> def __array__(self):
<ide> def __array__(self):
<ide> assert_equal(maximum(a, B()), 0)
<ide> assert_equal(maximum(a, C()), 0)
<ide>
<del>class test_choose(ScipyTestCase):
<add>class test_choose(NumpyTestCase):
<ide> def test_mixed(self):
<ide> c = array([True,True])
<ide> a = array([True,True])
<ide> assert_equal(choose(c, (a, 1)), array([1,1]))
<ide>
<ide>
<del>class test_choose(ScipyTestCase):
<add>class test_choose(NumpyTestCase):
<ide> def test_attributes(self):
<ide> add = ncu.add
<ide> assert_equal(add.__name__, 'add')
<ide> def test_attributes(self):
<ide> assert_equal(add.identity, 0)
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/core/tests/test_unicode.py
<ide> # Creation tests
<ide> ############################################################
<ide>
<del>class create_zeros:
<add>class create_zeros(NumpyTestCase):
<ide> """Check the creation of zero-valued arrays"""
<ide>
<ide> def content_test(self, ua, ua_scalar, nbytes):
<ide> def check_zerosMD(self):
<ide> self.content_test(ua, ua[-1,-1,-1], 4*self.ulen*2*3*4)
<ide>
<ide>
<del>class test_create_zeros_1(create_zeros, NumpyTestCase):
<add>class test_create_zeros_1(create_zeros):
<ide> """Check the creation of zero-valued arrays (size 1)"""
<ide> ulen = 1
<ide>
<del>class test_create_zeros_2(create_zeros, NumpyTestCase):
<add>class test_create_zeros_2(create_zeros):
<ide> """Check the creation of zero-valued arrays (size 2)"""
<ide> ulen = 2
<ide>
<del>class test_create_zeros_1009(create_zeros, NumpyTestCase):
<add>class test_create_zeros_1009(create_zeros):
<ide> """Check the creation of zero-valued arrays (size 1009)"""
<ide> ulen = 1009
<ide>
<ide>
<del>class create_values:
<add>class create_values(NumpyTestCase):
<ide> """Check the creation of unicode arrays with values"""
<ide>
<ide> def content_test(self, ua, ua_scalar, nbytes):
<ide> def check_valuesMD(self):
<ide> self.content_test(ua, ua[-1,-1,-1], 4*self.ulen*2*3*4)
<ide>
<ide>
<del>class test_create_values_1_ucs2(create_values, NumpyTestCase):
<add>class test_create_values_1_ucs2(create_values):
<ide> """Check the creation of valued arrays (size 1, UCS2 values)"""
<ide> ulen = 1
<ide> ucs_value = ucs2_value
<ide>
<del>class test_create_values_1_ucs4(create_values, NumpyTestCase):
<add>class test_create_values_1_ucs4(create_values):
<ide> """Check the creation of valued arrays (size 1, UCS4 values)"""
<ide> ulen = 1
<ide> ucs_value = ucs4_value
<ide>
<del>class test_create_values_2_ucs2(create_values, NumpyTestCase):
<add>class test_create_values_2_ucs2(create_values):
<ide> """Check the creation of valued arrays (size 2, UCS2 values)"""
<ide> ulen = 2
<ide> ucs_value = ucs2_value
<ide>
<del>class test_create_values_2_ucs4(create_values, NumpyTestCase):
<add>class test_create_values_2_ucs4(create_values):
<ide> """Check the creation of valued arrays (size 2, UCS4 values)"""
<ide> ulen = 2
<ide> ucs_value = ucs4_value
<ide>
<del>class test_create_values_1009_ucs2(create_values, NumpyTestCase):
<add>class test_create_values_1009_ucs2(create_values):
<ide> """Check the creation of valued arrays (size 1009, UCS2 values)"""
<ide> ulen = 1009
<ide> ucs_value = ucs2_value
<ide>
<del>class test_create_values_1009_ucs4(create_values, NumpyTestCase):
<add>class test_create_values_1009_ucs4(create_values):
<ide> """Check the creation of valued arrays (size 1009, UCS4 values)"""
<ide> ulen = 1009
<ide> ucs_value = ucs4_value
<ide> class test_create_values_1009_ucs4(create_values, NumpyTestCase):
<ide> # Assignment tests
<ide> ############################################################
<ide>
<del>class assign_values:
<add>class assign_values(NumpyTestCase):
<ide> """Check the assignment of unicode arrays with values"""
<ide>
<ide> def content_test(self, ua, ua_scalar, nbytes):
<ide> def check_valuesMD(self):
<ide> self.content_test(ua, ua[-1,-1,-1], 4*self.ulen*2*3*4)
<ide>
<ide>
<del>class test_assign_values_1_ucs2(assign_values, NumpyTestCase):
<add>class test_assign_values_1_ucs2(assign_values):
<ide> """Check the assignment of valued arrays (size 1, UCS2 values)"""
<ide> ulen = 1
<ide> ucs_value = ucs2_value
<ide>
<del>class test_assign_values_1_ucs4(assign_values, NumpyTestCase):
<add>class test_assign_values_1_ucs4(assign_values):
<ide> """Check the assignment of valued arrays (size 1, UCS4 values)"""
<ide> ulen = 1
<ide> ucs_value = ucs4_value
<ide>
<del>class test_assign_values_2_ucs2(assign_values, NumpyTestCase):
<add>class test_assign_values_2_ucs2(assign_values):
<ide> """Check the assignment of valued arrays (size 2, UCS2 values)"""
<ide> ulen = 2
<ide> ucs_value = ucs2_value
<ide>
<del>class test_assign_values_2_ucs4(assign_values, NumpyTestCase):
<add>class test_assign_values_2_ucs4(assign_values):
<ide> """Check the assignment of valued arrays (size 2, UCS4 values)"""
<ide> ulen = 2
<ide> ucs_value = ucs4_value
<ide>
<del>class test_assign_values_1009_ucs2(assign_values, NumpyTestCase):
<add>class test_assign_values_1009_ucs2(assign_values):
<ide> """Check the assignment of valued arrays (size 1009, UCS2 values)"""
<ide> ulen = 1009
<ide> ucs_value = ucs2_value
<ide>
<del>class test_assign_values_1009_ucs4(assign_values, NumpyTestCase):
<add>class test_assign_values_1009_ucs4(assign_values):
<ide> """Check the assignment of valued arrays (size 1009, UCS4 values)"""
<ide> ulen = 1009
<ide> ucs_value = ucs4_value
<ide> class test_assign_values_1009_ucs4(assign_values, NumpyTestCase):
<ide> # Byteorder tests
<ide> ############################################################
<ide>
<del>class byteorder_values:
<add>class byteorder_values(NumpyTestCase):
<ide> """Check the byteorder of unicode arrays in round-trip conversions"""
<ide>
<ide> def check_values0D(self):
<ide> def check_valuesMD(self):
<ide> # Arrays must be equal after the round-trip
<ide> assert_equal(ua, ua3)
<ide>
<del>class test_byteorder_1_ucs2(byteorder_values, NumpyTestCase):
<add>class test_byteorder_1_ucs2(byteorder_values):
<ide> """Check the byteorder in unicode (size 1, UCS2 values)"""
<ide> ulen = 1
<ide> ucs_value = ucs2_value
<ide>
<del>class test_byteorder_1_ucs4(byteorder_values, NumpyTestCase):
<add>class test_byteorder_1_ucs4(byteorder_values):
<ide> """Check the byteorder in unicode (size 1, UCS4 values)"""
<ide> ulen = 1
<ide> ucs_value = ucs4_value
<ide>
<del>class test_byteorder_2_ucs2(byteorder_values, NumpyTestCase):
<add>class test_byteorder_2_ucs2(byteorder_values):
<ide> """Check the byteorder in unicode (size 2, UCS2 values)"""
<ide> ulen = 2
<ide> ucs_value = ucs2_value
<ide>
<del>class test_byteorder_2_ucs4(byteorder_values, NumpyTestCase):
<add>class test_byteorder_2_ucs4(byteorder_values):
<ide> """Check the byteorder in unicode (size 2, UCS4 values)"""
<ide> ulen = 2
<ide> ucs_value = ucs4_value
<ide>
<del>class test_byteorder_1009_ucs2(byteorder_values, NumpyTestCase):
<add>class test_byteorder_1009_ucs2(byteorder_values):
<ide> """Check the byteorder in unicode (size 1009, UCS2 values)"""
<ide> ulen = 1009
<ide> ucs_value = ucs2_value
<ide>
<del>class test_byteorder_1009_ucs4(byteorder_values, NumpyTestCase):
<add>class test_byteorder_1009_ucs4(byteorder_values):
<ide> """Check the byteorder in unicode (size 1009, UCS4 values)"""
<ide> ulen = 1009
<ide> ucs_value = ucs4_value
<ide><path>numpy/dft/tests/test_helper.py
<ide> def random(size):
<ide> return rand(*size)
<ide>
<del>class test_fftshift(ScipyTestCase):
<add>class test_fftshift(NumpyTestCase):
<ide>
<ide> def check_definition(self):
<ide> x = [0,1,2,3,4,-4,-3,-2,-1]
<ide> def check_inverse(self):
<ide> x = random((n,))
<ide> assert_array_almost_equal(ifftshift(fftshift(x)),x)
<ide>
<del>class test_fftfreq(ScipyTestCase):
<add>class test_fftfreq(NumpyTestCase):
<ide>
<ide> def check_definition(self):
<ide> x = [0,1,2,3,4,-4,-3,-2,-1]
<ide> def check_definition(self):
<ide> assert_array_almost_equal(10*pi*fftfreq(10,pi),x)
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/distutils/tests/f2py_ext/tests/test_fib2.py
<ide> from f2py_ext import fib2
<ide> del sys.path[0]
<ide>
<del>class test_fib2(ScipyTestCase):
<add>class test_fib2(NumpyTestCase):
<ide>
<ide> def check_fib(self):
<ide> assert_array_equal(fib2.fib(6),[0,1,1,2,3,5])
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest(fib2).run()
<add> NumpyTest(fib2).run()
<ide><path>numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py
<ide> from f2py_f90_ext import foo
<ide> del sys.path[0]
<ide>
<del>class test_foo(ScipyTestCase):
<add>class test_foo(NumpyTestCase):
<ide>
<ide> def check_foo_free(self):
<ide> assert_equal(foo.foo_free.bar13(),13)
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/distutils/tests/gen_ext/tests/test_fib3.py
<ide> from gen_ext import fib3
<ide> del sys.path[0]
<ide>
<del>class test_fib3(ScipyTestCase):
<add>class test_fib3(NumpyTestCase):
<ide>
<ide> def check_fib(self):
<ide> assert_array_equal(fib3.fib(6),[0,1,1,2,3,5])
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/distutils/tests/pyrex_ext/tests/test_primes.py
<ide> from pyrex_ext.primes import primes
<ide> restore_path()
<ide>
<del>class test_primes(ScipyTestCase):
<add>class test_primes(NumpyTestCase):
<ide> def check_simple(self, level=1):
<ide> l = primes(10)
<ide> assert_equal(l, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29])
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/distutils/tests/swig_ext/tests/test_example.py
<ide> from swig_ext import example
<ide> restore_path()
<ide>
<del>class test_example(ScipyTestCase):
<add>class test_example(NumpyTestCase):
<ide>
<ide> def check_fact(self):
<ide> assert_equal(example.fact(10),3628800)
<ide> def check_cvar(self):
<ide> assert_equal(example.cvar.My_variable,5.0)
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/distutils/tests/swig_ext/tests/test_example2.py
<ide> from swig_ext import example2
<ide> restore_path()
<ide>
<del>class test_example2(ScipyTestCase):
<add>class test_example2(NumpyTestCase):
<ide>
<ide> def check_zoo(self):
<ide> z = example2.Zoo()
<ide> def check_zoo(self):
<ide>
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/distutils/tests/test_misc_util.py
<ide>
<ide> ajoin = lambda *paths: join(*((sep,)+paths))
<ide>
<del>class test_appendpath(ScipyTestCase):
<add>class test_appendpath(NumpyTestCase):
<ide>
<ide> def check_1(self):
<ide> assert_equal(appendpath('prefix','name'),join('prefix','name'))
<ide> def check_3(self):
<ide> assert_equal(appendpath('/prefix/sub/sub2','/prefix/sub/sup/name'),
<ide> ajoin('prefix','sub','sub2','sup','name'))
<ide>
<del>class test_minrelpath(ScipyTestCase):
<add>class test_minrelpath(NumpyTestCase):
<ide>
<ide> def check_1(self):
<ide> import os
<ide> def check_gpaths(self):
<ide> assert os.path.join(local_path,'system_info.py')==f[0],`f`
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/f2py/tests/array_from_pyobj/tests/test_array_from_pyobj.py
<ide> class test_%s_gen(unittest.TestCase,
<ide> ''' % (t,t,t)
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/lib/tests/test_arraysetops.py
<ide>
<ide> ##################################################
<ide>
<del>class test_aso( ScipyTestCase ):
<add>class test_aso(NumpyTestCase):
<ide> ##
<ide> # 03.11.2005, c
<ide> def check_unique1d( self ):
<ide> def check_manyways( self ):
<ide> assert_array_equal( c1, c2 )
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/lib/tests/test_function_base.py
<ide> def compare_results(res,desired):
<ide> assert_array_equal(res[i],desired[i])
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest('numpy.lib.function_base').run()
<add> NumpyTest('numpy.lib.function_base').run()
<ide><path>numpy/lib/tests/test_getlimits.py
<ide>
<ide> ##################################################
<ide>
<del>class test_python_float(ScipyTestCase):
<add>class test_python_float(NumpyTestCase):
<ide> def check_singleton(self):
<ide> ftype = finfo(float)
<ide> ftype2 = finfo(float)
<ide> assert_equal(id(ftype),id(ftype2))
<ide>
<del>class test_single(ScipyTestCase):
<add>class test_single(NumpyTestCase):
<ide> def check_singleton(self):
<ide> ftype = finfo(single)
<ide> ftype2 = finfo(single)
<ide> assert_equal(id(ftype),id(ftype2))
<ide>
<del>class test_double(ScipyTestCase):
<add>class test_double(NumpyTestCase):
<ide> def check_singleton(self):
<ide> ftype = finfo(double)
<ide> ftype2 = finfo(double)
<ide> assert_equal(id(ftype),id(ftype2))
<ide>
<del>class test_longdouble(ScipyTestCase):
<add>class test_longdouble(NumpyTestCase):
<ide> def check_singleton(self,level=2):
<ide> ftype = finfo(longdouble)
<ide> ftype2 = finfo(longdouble)
<ide> assert_equal(id(ftype),id(ftype2))
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/lib/tests/test_index_tricks.py
<ide> from numpy import array, ones, r_, mgrid
<ide> restore_path()
<ide>
<del>class test_grid(ScipyTestCase):
<add>class test_grid(NumpyTestCase):
<ide> def check_basic(self):
<ide> a = mgrid[-1:1:10j]
<ide> b = mgrid[-1:1:0.1]
<ide> def check_nd(self):
<ide> assert_array_almost_equal(d[0,1,:]-d[0,0,:], 0.1*ones(20,'d'),11)
<ide> assert_array_almost_equal(d[1,:,1]-d[1,:,0], 0.2*ones(20,'d'),11)
<ide>
<del>class test_concatenator(ScipyTestCase):
<add>class test_concatenator(NumpyTestCase):
<ide> def check_1d(self):
<ide> assert_array_equal(r_[1,2,3,4,5,6],array([1,2,3,4,5,6]))
<ide> b = ones(5)
<ide> def check_2d(self):
<ide> assert_array_equal(d[5:,:],c)
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/lib/tests/test_polynomial.py
<ide> class test_docs(NumpyTestCase):
<ide> def check_doctests(self): return self.rundocs()
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/lib/tests/test_shape_base.py
<ide> from numpy.core import *
<ide> restore_path()
<ide>
<del>class test_apply_along_axis(ScipyTestCase):
<add>class test_apply_along_axis(NumpyTestCase):
<ide> def check_simple(self):
<ide> a = ones((20,10),'d')
<ide> assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1]))
<ide> def check_simple101(self,level=11):
<ide> a = ones((10,101),'d')
<ide> assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1]))
<ide>
<del>class test_array_split(ScipyTestCase):
<add>class test_array_split(NumpyTestCase):
<ide> def check_integer_0_split(self):
<ide> a = arange(10)
<ide> try:
<ide> def check_index_split_high_bound(self):
<ide> array([]),array([])]
<ide> compare_results(res,desired)
<ide>
<del>class test_split(ScipyTestCase):
<add>class test_split(NumpyTestCase):
<ide> """* This function is essentially the same as array_split,
<ide> except that it test if splitting will result in an
<ide> equal split. Only test for this case.
<ide> def check_unequal_split(self):
<ide> except ValueError:
<ide> pass
<ide>
<del>class test_atleast_1d(ScipyTestCase):
<add>class test_atleast_1d(NumpyTestCase):
<ide> def check_0D_array(self):
<ide> a = array(1); b = array(2);
<ide> res=map(atleast_1d,[a,b])
<ide> def check_r1array(self):
<ide> assert(atleast_1d(3.0).shape == (1,))
<ide> assert(atleast_1d([[2,3],[4,5]]).shape == (2,2))
<ide>
<del>class test_atleast_2d(ScipyTestCase):
<add>class test_atleast_2d(NumpyTestCase):
<ide> def check_0D_array(self):
<ide> a = array(1); b = array(2);
<ide> res=map(atleast_2d,[a,b])
<ide> def check_r2array(self):
<ide> assert(atleast_2d([3j,1]).shape == (1,2))
<ide> assert(atleast_2d([[[3,1],[4,5]],[[3,5],[1,2]]]).shape == (2,2,2))
<ide>
<del>class test_atleast_3d(ScipyTestCase):
<add>class test_atleast_3d(NumpyTestCase):
<ide> def check_0D_array(self):
<ide> a = array(1); b = array(2);
<ide> res=map(atleast_3d,[a,b])
<ide> def check_3D_array(self):
<ide> desired = [a,b]
<ide> assert_array_equal(res,desired)
<ide>
<del>class test_hstack(ScipyTestCase):
<add>class test_hstack(NumpyTestCase):
<ide> def check_0D_array(self):
<ide> a = array(1); b = array(2);
<ide> res=hstack([a,b])
<ide> def check_2D_array(self):
<ide> desired = array([[1,1],[2,2]])
<ide> assert_array_equal(res,desired)
<ide>
<del>class test_vstack(ScipyTestCase):
<add>class test_vstack(NumpyTestCase):
<ide> def check_0D_array(self):
<ide> a = array(1); b = array(2);
<ide> res=vstack([a,b])
<ide> def check_2D_array2(self):
<ide> desired = array([[1,2],[1,2]])
<ide> assert_array_equal(res,desired)
<ide>
<del>class test_dstack(ScipyTestCase):
<add>class test_dstack(NumpyTestCase):
<ide> def check_0D_array(self):
<ide> a = array(1); b = array(2);
<ide> res=dstack([a,b])
<ide> def check_2D_array2(self):
<ide> """ array_split has more comprehensive test of splitting.
<ide> only do simple test on hsplit, vsplit, and dsplit
<ide> """
<del>class test_hsplit(ScipyTestCase):
<add>class test_hsplit(NumpyTestCase):
<ide> """ only testing for integer splits.
<ide> """
<ide> def check_0D_array(self):
<ide> def check_2D_array(self):
<ide> desired = [array([[1,2],[1,2]]),array([[3,4],[3,4]])]
<ide> compare_results(res,desired)
<ide>
<del>class test_vsplit(ScipyTestCase):
<add>class test_vsplit(NumpyTestCase):
<ide> """ only testing for integer splits.
<ide> """
<ide> def check_1D_array(self):
<ide> def check_2D_array(self):
<ide> desired = [array([[1,2,3,4]]),array([[1,2,3,4]])]
<ide> compare_results(res,desired)
<ide>
<del>class test_dsplit(ScipyTestCase):
<add>class test_dsplit(NumpyTestCase):
<ide> """ only testing for integer splits.
<ide> """
<ide> def check_2D_array(self):
<ide> def check_3D_array(self):
<ide> array([[[3,4],[3,4]],[[3,4],[3,4]]])]
<ide> compare_results(res,desired)
<ide>
<del>class test_squeeze(ScipyTestCase):
<add>class test_squeeze(NumpyTestCase):
<ide> def check_basic(self):
<ide> a = rand(20,10,10,1,1)
<ide> b = rand(20,1,10,1,20)
<ide> def check_basic(self):
<ide> assert_array_equal(squeeze(b),reshape(b,(20,10,20)))
<ide> assert_array_equal(squeeze(c),reshape(c,(20,10)))
<ide>
<del>class test_kron(ScipyTestCase):
<add>class test_kron(NumpyTestCase):
<ide> def check_return_type(self):
<ide> a = ones([2,2])
<ide> m = asmatrix(a)
<ide> def compare_results(res,desired):
<ide>
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run()
<ide><path>numpy/lib/tests/test_type_check.py
<ide> def assert_all(x):
<ide> assert(all(x)), x
<ide>
<del>class test_mintypecode(ScipyTestCase):
<add>class test_mintypecode(NumpyTestCase):
<ide>
<ide> def check_default_1(self):
<ide> for itype in '1bcsuwil':
<ide> def check_default_3(self):
<ide> #assert_equal(mintypecode('idF',savespace=1),'F')
<ide> assert_equal(mintypecode('idD'),'D')
<ide>
<del>class test_isscalar(ScipyTestCase):
<add>class test_isscalar(NumpyTestCase):
<ide> def check_basic(self):
<ide> assert(isscalar(3))
<ide> assert(not isscalar([3]))
<ide> def check_basic(self):
<ide> assert(isscalar(10L))
<ide> assert(isscalar(4.0))
<ide>
<del>class test_real(ScipyTestCase):
<add>class test_real(NumpyTestCase):
<ide> def check_real(self):
<ide> y = rand(10,)
<ide> assert_array_equal(y,real(y))
<ide> def check_cmplx(self):
<ide> y = rand(10,)+1j*rand(10,)
<ide> assert_array_equal(y.real,real(y))
<ide>
<del>class test_imag(ScipyTestCase):
<add>class test_imag(NumpyTestCase):
<ide> def check_real(self):
<ide> y = rand(10,)
<ide> assert_array_equal(0,imag(y))
<ide> def check_cmplx(self):
<ide> y = rand(10,)+1j*rand(10,)
<ide> assert_array_equal(y.imag,imag(y))
<ide>
<del>class test_iscomplex(ScipyTestCase):
<add>class test_iscomplex(NumpyTestCase):
<ide> def check_fail(self):
<ide> z = array([-1,0,1])
<ide> res = iscomplex(z)
<ide> def check_pass(self):
<ide> res = iscomplex(z)
<ide> assert_array_equal(res,[1,0,0])
<ide>
<del>class test_isreal(ScipyTestCase):
<add>class test_isreal(NumpyTestCase):
<ide> def check_pass(self):
<ide> z = array([-1,0,1j])
<ide> res = isreal(z)
<ide> def check_fail(self):
<ide> res = isreal(z)
<ide> assert_array_equal(res,[0,1,1])
<ide>
<del>class test_iscomplexobj(ScipyTestCase):
<add>class test_iscomplexobj(NumpyTestCase):
<ide> def check_basic(self):
<ide> z = array([-1,0,1])
<ide> assert(not iscomplexobj(z))
<ide> z = array([-1j,0,-1])
<ide> assert(iscomplexobj(z))
<ide>
<del>class test_isrealobj(ScipyTestCase):
<add>class test_isrealobj(NumpyTestCase):
<ide> def check_basic(self):
<ide> z = array([-1,0,1])
<ide> assert(isrealobj(z))
<ide> z = array([-1j,0,-1])
<ide> assert(not isrealobj(z))
<ide>
<del>class test_isnan(ScipyTestCase):
<add>class test_isnan(NumpyTestCase):
<ide> def check_goodvalues(self):
<ide> z = array((-1.,0.,1.))
<ide> res = isnan(z) == 0
<ide> def check_complex(self):
<ide> def check_complex1(self):
<ide> assert_all(isnan(array(0+0j)/0.) == 1)
<ide>
<del>class test_isfinite(ScipyTestCase):
<add>class test_isfinite(NumpyTestCase):
<ide> def check_goodvalues(self):
<ide> z = array((-1.,0.,1.))
<ide> res = isfinite(z) == 1
<ide> def check_complex(self):
<ide> def check_complex1(self):
<ide> assert_all(isfinite(array(1+1j)/0.) == 0)
<ide>
<del>class test_isinf(ScipyTestCase):
<add>class test_isinf(NumpyTestCase):
<ide> def check_goodvalues(self):
<ide> z = array((-1.,0.,1.))
<ide> res = isinf(z) == 0
<ide> def check_ind(self):
<ide> # assert_all(isinf(log(-1.)) == 0)
<ide> # assert_all(isnan(log(-1.)) == 1)
<ide>
<del>class test_isposinf(ScipyTestCase):
<add>class test_isposinf(NumpyTestCase):
<ide> def check_generic(self):
<ide> vals = isposinf(array((-1.,0,1))/0.)
<ide> assert(vals[0] == 0)
<ide> assert(vals[1] == 0)
<ide> assert(vals[2] == 1)
<ide>
<del>class test_isneginf(ScipyTestCase):
<add>class test_isneginf(NumpyTestCase):
<ide> def check_generic(self):
<ide> vals = isneginf(array((-1.,0,1))/0.)
<ide> assert(vals[0] == 1)
<ide> assert(vals[1] == 0)
<ide> assert(vals[2] == 0)
<ide>
<del>class test_nan_to_num(ScipyTestCase):
<add>class test_nan_to_num(NumpyTestCase):
<ide> def check_generic(self):
<ide> vals = nan_to_num(array((-1.,0,1))/0.)
<ide> assert_all(vals[0] < -1e10) and assert_all(isfinite(vals[0]))
<ide> def check_complex_bad2(self):
<ide> #assert_all(vals.real < -1e10) and assert_all(isfinite(vals))
<ide>
<ide>
<del>class test_real_if_close(ScipyTestCase):
<add>class test_real_if_close(NumpyTestCase):
<ide> def check_basic(self):
<ide> a = rand(10)
<ide> b = real_if_close(a+1e-15j)
<ide> def check_basic(self):
<ide> assert_all(isrealobj(b))
<ide>
<ide> if __name__ == "__main__":
<del> ScipyTest().run()
<add> NumpyTest().run() | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.