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
|
|---|---|---|---|---|---|
Go
|
Go
|
remove unnecessary job "initserverpidfile"
|
b4efcd53e0a62a8ce1080e94e28358ac1a2d6ae2
|
<ide><path>builtins/builtins.go
<ide> func remote(eng *engine.Engine) error {
<ide> // These components should be broken off into plugins of their own.
<ide> //
<ide> func daemon(eng *engine.Engine) error {
<del> if err := eng.Register("initserverpidfile", server.InitPidfile); err != nil {
<del> return err
<del> }
<ide> if err := eng.Register("initserver", server.InitServer); err != nil {
<ide> return err
<ide> }
<ide><path>docker/daemon.go
<ide> func mainDaemon() {
<ide> log.Fatal(err)
<ide> }
<ide>
<del> // handle the pidfile early. https://github.com/docker/docker/issues/6973
<del> if len(*pidfile) > 0 {
<del> job := eng.Job("initserverpidfile", *pidfile)
<del> if err := job.Run(); err != nil {
<del> log.Fatal(err)
<del> }
<del> }
<del>
<ide> // load the daemon in the background so we can immediately start
<ide> // the http api so that connections don't fail while the daemon
<ide> // is booting
<ide><path>server/init.go
<ide> package server
<ide>
<ide> import (
<del> "fmt"
<del>
<ide> "github.com/docker/docker/daemon"
<ide> "github.com/docker/docker/daemonconfig"
<ide> "github.com/docker/docker/engine"
<del> "github.com/docker/docker/utils"
<ide> )
<ide>
<ide> func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
<ide> func (srv *Server) handlerWrap(h engine.Handler) engine.Handler {
<ide> }
<ide> }
<ide>
<del>func InitPidfile(job *engine.Job) engine.Status {
<del> if len(job.Args) == 0 {
<del> return job.Error(fmt.Errorf("no pidfile provided to initialize"))
<del> }
<del> job.Logf("Creating pidfile")
<del> if err := utils.CreatePidFile(job.Args[0]); err != nil {
<del> return job.Error(err)
<del> }
<del> return engine.StatusOK
<del>}
<del>
<ide> // jobInitApi runs the remote api server `srv` as a daemon,
<ide> // Only one api server can run at the same time - this is enforced by a pidfile.
<ide> // The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
| 3
|
Javascript
|
Javascript
|
fix timer display in progress output
|
a08fcc02f8549635d6c79c11545777ce07ec185a
|
<ide><path>benchmark/_benchmark_progress.js
<ide> function fraction(numerator, denominator) {
<ide>
<ide> function getTime(diff) {
<ide> const time = Math.ceil(diff[0] + diff[1] / 1e9);
<del> const seconds = pad(time % 60, 2, '0');
<del> const minutes = pad(Math.floor(time / 60) % (60 * 60), 2, '0');
<del> const hours = pad(Math.floor(time / (60 * 60)), 2, '0');
<add> const hours = pad(Math.floor(time / 3600), 2, '0');
<add> const minutes = pad(Math.floor((time % 3600) / 60), 2, '0');
<add> const seconds = pad((time % 3600) % 60, 2, '0');
<ide> return `${hours}:${minutes}:${seconds}`;
<ide> }
<ide>
| 1
|
Java
|
Java
|
unregister jsdevsupport from debugcorepackage
|
c20963e11cc1c10f20a2a0a3c209f5b403c9e899
|
<ide><path>ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java
<ide> @ReactModuleList(
<ide> nativeModules = {
<ide> JSCHeapCapture.class,
<del> JSDevSupport.class,
<ide> })
<ide> public class DebugCorePackage extends TurboReactPackage {
<ide> public DebugCorePackage() {}
<ide> public NativeModule getModule(String name, ReactApplicationContext reactContext)
<ide> switch (name) {
<ide> case JSCHeapCapture.TAG:
<ide> return new JSCHeapCapture(reactContext);
<del> case JSDevSupport.MODULE_NAME:
<del> return new JSDevSupport(reactContext);
<ide> default:
<ide> throw new IllegalArgumentException(
<ide> "In CoreModulesPackage, could not find Native module for " + name);
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDevSupport.java
<ide> import java.util.HashMap;
<ide> import java.util.Map;
<ide>
<del>@ReactModule(name = JSDevSupport.MODULE_NAME, canOverrideExistingModule = true)
<add>@ReactModule(name = JSDevSupport.MODULE_NAME)
<ide> public class JSDevSupport extends NativeJSDevSupportSpec {
<ide> public static final String MODULE_NAME = "JSDevSupport";
<ide>
| 2
|
Go
|
Go
|
kill exec process on ctx cancel
|
4b84a3321723a849295d5cbf7342ec36077f9179
|
<ide><path>daemon/exec.go
<ide> import (
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide>
<del>// Seconds to wait after sending TERM before trying KILL
<del>const termProcessTimeout = 10 * time.Second
<del>
<ide> func (daemon *Daemon) registerExecCommand(container *container.Container, config *exec.Config) {
<ide> // Storing execs in container in order to kill them gracefully whenever the container is stopped or removed.
<ide> container.ExecCommands.Add(config.ID, config)
<ide> func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, optio
<ide> CloseStdin: true,
<ide> }
<ide> ec.StreamConfig.AttachStreams(&attachConfig)
<del> attachErr := ec.StreamConfig.CopyStreams(ctx, &attachConfig)
<add> // using context.Background() so that attachErr does not race ctx.Done().
<add> copyCtx, cancel := context.WithCancel(context.Background())
<add> defer cancel()
<add> attachErr := ec.StreamConfig.CopyStreams(copyCtx, &attachConfig)
<ide>
<ide> // Synchronize with libcontainerd event loop
<ide> ec.Lock()
<ide> func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, optio
<ide>
<ide> select {
<ide> case <-ctx.Done():
<del> logrus.Debugf("Sending TERM signal to process %v in container %v", name, c.ID)
<del> daemon.containerd.SignalProcess(ctx, c.ID, name, signal.SignalMap["TERM"])
<del>
<del> timeout := time.NewTimer(termProcessTimeout)
<del> defer timeout.Stop()
<del>
<del> select {
<del> case <-timeout.C:
<del> logrus.Infof("Container %v, process %v failed to exit within %v of signal TERM - using the force", c.ID, name, termProcessTimeout)
<del> daemon.containerd.SignalProcess(ctx, c.ID, name, signal.SignalMap["KILL"])
<del> case <-attachErr:
<del> // TERM signal worked
<add> log := logrus.
<add> WithField("container", c.ID).
<add> WithField("exec", name)
<add> log.Debug("Sending KILL signal to container process")
<add> sigCtx, cancelFunc := context.WithTimeout(context.Background(), 30*time.Second)
<add> defer cancelFunc()
<add> err := daemon.containerd.SignalProcess(sigCtx, c.ID, name, signal.SignalMap["KILL"])
<add> if err != nil {
<add> log.WithError(err).Error("Could not send KILL signal to container process")
<ide> }
<ide> return ctx.Err()
<ide> case err := <-attachErr:
<ide><path>daemon/health.go
<ide> func (p *cmdProbe) run(ctx context.Context, d *Daemon, cntr *container.Container
<ide> case <-tm.C:
<ide> cancelProbe()
<ide> logrus.WithContext(ctx).Debugf("Health check for container %s taking too long", cntr.ID)
<del> // Wait for probe to exit (it might take a while to respond to the TERM
<del> // signal and we don't want dying probes to pile up).
<add> // Wait for probe to exit (it might take some time to call containerd to kill
<add> // the process and we don't want dying probes to pile up).
<ide> <-execErr
<ide> return &types.HealthcheckResult{
<ide> ExitCode: -1,
<ide><path>integration/container/health_test.go
<ide> package container // import "github.com/docker/docker/integration/container"
<ide>
<ide> import (
<ide> "context"
<add> "fmt"
<ide> "testing"
<ide> "time"
<ide>
<ide> while true; do sleep 1; done
<ide> poll.WaitOn(t, pollForHealthStatus(ctxPoll, client, id, "healthy"), poll.WithDelay(100*time.Millisecond))
<ide> }
<ide>
<add>// TestHealthCheckProcessKilled verifies that health-checks exec get killed on time-out.
<add>func TestHealthCheckProcessKilled(t *testing.T) {
<add> skip.If(t, testEnv.RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
<add> defer setupTest(t)()
<add> ctx := context.Background()
<add> apiClient := testEnv.APIClient()
<add>
<add> cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
<add> c.Config.Healthcheck = &containertypes.HealthConfig{
<add> Test: []string{"CMD", "sh", "-c", "sleep 60"},
<add> Interval: 100 * time.Millisecond,
<add> Timeout: 50 * time.Millisecond,
<add> Retries: 1,
<add> }
<add> })
<add> poll.WaitOn(t, pollForHealthCheckLog(ctx, apiClient, cID, "Health check exceeded timeout (50ms)"))
<add>}
<add>
<add>func pollForHealthCheckLog(ctx context.Context, client client.APIClient, containerID string, expected string) func(log poll.LogT) poll.Result {
<add> return func(log poll.LogT) poll.Result {
<add> inspect, err := client.ContainerInspect(ctx, containerID)
<add> if err != nil {
<add> return poll.Error(err)
<add> }
<add> healthChecksTotal := len(inspect.State.Health.Log)
<add> if healthChecksTotal > 0 {
<add> output := inspect.State.Health.Log[healthChecksTotal-1].Output
<add> if output == expected {
<add> return poll.Success()
<add> }
<add> return poll.Error(fmt.Errorf("expected %q, got %q", expected, output))
<add> }
<add> return poll.Continue("waiting for container healthcheck logs")
<add> }
<add>}
<add>
<ide> func pollForHealthStatus(ctx context.Context, client client.APIClient, containerID string, healthStatus string) func(log poll.LogT) poll.Result {
<ide> return func(log poll.LogT) poll.Result {
<ide> inspect, err := client.ContainerInspect(ctx, containerID)
| 3
|
PHP
|
PHP
|
fix connection aliasing
|
cd1257bde64baf448a40863ebcf56a78df7370bb
|
<ide><path>src/Datasource/ConnectionManager.php
<ide> public static function parseDsn($config = null)
<ide> *
<ide> * You can remove aliases with ConnectionManager::dropAlias().
<ide> *
<del> * @param string $from The connection to add an alias to.
<del> * @param string $to The alias to create. $from should return when loaded with get().
<add> * @param string $original The connection to add an alias to.
<add> * @param string $target The alias to create. Fetching $original will return $target when loaded with get().
<ide> * @return void
<ide> * @throws \Cake\Datasource\Exception\MissingDatasourceConfigException When aliasing a
<ide> * connection that does not exist.
<ide> */
<del> public static function alias($from, $to)
<add> public static function alias($original, $target)
<ide> {
<del> if (empty(static::$_config[$to]) && empty(static::$_config[$from])) {
<add> if (empty(static::$_config[$target]) && empty(static::$_config[$original])) {
<ide> throw new MissingDatasourceConfigException(
<del> sprintf('Cannot create alias of "%s" as it does not exist.', $from)
<add> sprintf('Cannot create alias of "%s" as it does not exist.', $original)
<ide> );
<ide> }
<del> static::$_aliasMap[$to] = $from;
<add> static::$_aliasMap[$target] = $original;
<ide> }
<ide>
<ide> /**
<ide><path>src/TestSuite/Fixture/FixtureManager.php
<ide> protected function _aliasConnections()
<ide> continue;
<ide> }
<ide> if (strpos($connection, 'test_') === 0) {
<del> $map[substr($connection, 5)] = $connection;
<add> $map[$connection] = substr($connection, 5);
<ide> } else {
<ide> $map['test_' . $connection] = $connection;
<ide> }
| 2
|
Javascript
|
Javascript
|
swap the order of arguments
|
2535aa5f7d080fa2f88dc9aeda08ee7fea8004b4
|
<ide><path>test/parallel/test-fs-write-sync.js
<ide> tmpdir.refresh();
<ide> const fd = fs.openSync(filename, 'w');
<ide>
<ide> let written = fs.writeSync(fd, '');
<del> assert.strictEqual(0, written);
<add> assert.strictEqual(written, 0);
<ide>
<ide> fs.writeSync(fd, 'foo');
<ide>
<ide> tmpdir.refresh();
<ide> const fd = fs.openSync(filename, 'w');
<ide>
<ide> let written = fs.writeSync(fd, '');
<del> assert.strictEqual(0, written);
<add> assert.strictEqual(written, 0);
<ide>
<ide> fs.writeSync(fd, 'foo');
<ide>
<ide> tmpdir.refresh();
<ide> const fd = fs.openSync(filename, 'w');
<ide>
<ide> let written = fs.writeSync(fd, '');
<del> assert.strictEqual(0, written);
<add> assert.strictEqual(written, 0);
<ide>
<ide> fs.writeSync(fd, 'foo');
<ide>
| 1
|
Javascript
|
Javascript
|
add issue ref for known_issues test
|
a98426a771957ce37792e4666b3606e55df2adf7
|
<ide><path>test/known_issues/test-fs-open-no-close.js
<ide> 'use strict';
<ide>
<add>// Refs: https://github.com/nodejs/node/issues/34266
<ide> // Failing to close a file should not keep the event loop open.
<ide>
<ide> const common = require('../common');
| 1
|
PHP
|
PHP
|
remove usage of realpath and getrealpath
|
29e898e45886c5c4b141b3fc90e16e426f53527d
|
<ide><path>src/Illuminate/Filesystem/Filesystem.php
<ide> public function size($path)
<ide> */
<ide> public function lastModified($path)
<ide> {
<del> return filemtime(realpath($path));
<add> return filemtime($path);
<ide> }
<ide>
<ide> /**
<ide> public function directories($directory)
<ide>
<ide> foreach (Finder::create()->in($directory)->directories()->depth(0) as $dir)
<ide> {
<del> $directories[] = $dir->getRealPath();
<add> $directories[] = $dir->getPathname();
<ide> }
<ide>
<ide> return $directories;
<ide> public function copyDirectory($directory, $destination, $options = null)
<ide>
<ide> if ($item->isDir())
<ide> {
<del> $path = $item->getRealPath();
<add> $path = $item->getPathname();
<ide>
<ide> if ( ! $this->copyDirectory($path, $target, $options)) return false;
<ide> }
<ide> public function copyDirectory($directory, $destination, $options = null)
<ide> // and return false, so the developer is aware that the copy process failed.
<ide> else
<ide> {
<del> if ( ! $this->copy($item->getRealPath(), $target)) return false;
<add> if ( ! $this->copy($item->getPathname(), $target)) return false;
<ide> }
<ide> }
<ide>
<ide> public function deleteDirectory($directory, $preserve = false)
<ide> // keep iterating through each file until the directory is cleaned.
<ide> if ($item->isDir())
<ide> {
<del> $this->deleteDirectory($item->getRealPath());
<add> $this->deleteDirectory($item->getPathname());
<ide> }
<ide>
<ide> // If the item is just a file, we can go ahead and delete it since we're
<ide> // just looping through and waxing all of the files in this directory
<ide> // and calling directories recursively, so we delete the real path.
<ide> else
<ide> {
<del> $this->delete($item->getRealPath());
<add> $this->delete($item->getPathname());
<ide> }
<ide> }
<ide>
| 1
|
Ruby
|
Ruby
|
remove needless comments
|
8a5f17e55ac9c429060b76c8e107eb529b4bbf34
|
<ide><path>actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb
<del># Be sure to restart your server when you modify this file. Action Cable runs in
<del># a loop that does not support auto reloading.
<ide> module ApplicationCable
<ide> class Channel < ActionCable::Channel::Base
<ide> end
<ide><path>actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb
<del># Be sure to restart your server when you modify this file. Action Cable runs in
<del># a loop that does not support auto reloading.
<ide> module ApplicationCable
<ide> class Connection < ActionCable::Connection::Base
<ide> end
<ide><path>actioncable/lib/rails/generators/channel/templates/channel.rb
<del># Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
<ide> <% module_namespacing do -%>
<ide> class <%= class_name %>Channel < ApplicationCable::Channel
<ide> def subscribed
| 3
|
Go
|
Go
|
cleanup some assertions
|
ef01dea8935932486f03a37069720987e805dce6
|
<ide><path>daemon/logger/awslogs/cloudwatchlogs.go
<ide> type logStream struct {
<ide> sequenceToken *string
<ide> }
<ide>
<add>var _ logger.SizedLogger = &logStream{}
<add>
<ide> type api interface {
<ide> CreateLogGroup(*cloudwatchlogs.CreateLogGroupInput) (*cloudwatchlogs.CreateLogGroupOutput, error)
<ide> CreateLogStream(*cloudwatchlogs.CreateLogStreamInput) (*cloudwatchlogs.CreateLogStreamOutput, error)
<ide><path>daemon/logger/awslogs/cloudwatchlogs_test.go
<ide> func TestCreateTagSuccess(t *testing.T) {
<ide> }
<ide> }
<ide>
<del>func TestIsSizedLogger(t *testing.T) {
<del> awslogs := &logStream{}
<del> assert.Implements(t, (*logger.SizedLogger)(nil), awslogs, "awslogs should implement SizedLogger")
<del>}
<del>
<ide> func BenchmarkUnwrapEvents(b *testing.B) {
<ide> events := make([]wrappedEvent, maximumLogEventsPerPut)
<ide> for i := 0; i < maximumLogEventsPerPut; i++ {
<ide> func BenchmarkUnwrapEvents(b *testing.B) {
<ide> }
<ide> }
<ide>
<del> as := assert.New(b)
<ide> b.ResetTimer()
<ide> for i := 0; i < b.N; i++ {
<ide> res := unwrapEvents(events)
<del> as.Len(res, maximumLogEventsPerPut)
<add> assert.Len(b, res, maximumLogEventsPerPut)
<ide> }
<ide> }
<ide>
<ide><path>pkg/term/proxy_test.go
<ide> package term // import "github.com/docker/docker/pkg/term"
<ide> import (
<ide> "bytes"
<ide> "fmt"
<del> "reflect"
<ide> "testing"
<ide>
<add> "github.com/stretchr/testify/assert"
<ide> "github.com/stretchr/testify/require"
<ide> )
<ide>
<ide> func TestEscapeProxyRead(t *testing.T) {
<ide> nr, err = reader.Read(buf)
<ide> require.Error(t, err, "Should throw error when no keys are to read")
<ide> require.EqualValues(t, nr, 0, "nr should be zero")
<del> require.Condition(t, func() (success bool) { return len(keys) == 0 && len(buf) == 0 }, "keys & the read buffer size should be zero")
<add> assert.Len(t, keys, 0)
<add> assert.Len(t, buf, 0)
<ide>
<ide> escapeKeys, _ = ToBytes("ctrl-x,ctrl-@")
<ide> keys, _ = ToBytes("DEL")
<ide> func TestEscapeProxyRead(t *testing.T) {
<ide> reader = NewEscapeProxy(bytes.NewReader(keys), escapeKeys)
<ide> buf = make([]byte, len(keys))
<ide> nr, err = reader.Read(buf)
<del> require.Condition(t, func() (success bool) {
<del> return reflect.TypeOf(err).Name() == "EscapeError"
<del> }, err)
<add> require.EqualError(t, err, "read escape sequence")
<ide> require.EqualValues(t, nr, 0, "nr should be equal to 0")
<ide> require.Equal(t, keys, buf, "keys & the read buffer should be equal")
<ide>
<ide> func TestEscapeProxyRead(t *testing.T) {
<ide> require.EqualValues(t, nr, 0, "nr should be equal to 0")
<ide> require.Equal(t, keys[0:1], buf, "keys & the read buffer should be equal")
<ide> nr, err = reader.Read(buf)
<del> require.Condition(t, func() (success bool) {
<del> return reflect.TypeOf(err).Name() == "EscapeError"
<del> }, err)
<add> require.EqualError(t, err, "read escape sequence")
<ide> require.EqualValues(t, nr, 0, "nr should be equal to 0")
<ide> require.Equal(t, keys[1:], buf, "keys & the read buffer should be equal")
<ide>
| 3
|
Javascript
|
Javascript
|
convert the hand tool to es6 syntax
|
bc49524ac76a834fd914ccb5c7e91a1d01fcc4bf
|
<ide><path>web/hand_tool.js
<ide> import { localized } from './ui_utils';
<ide> * @typedef {Object} HandToolOptions
<ide> * @property {HTMLDivElement} container - The document container.
<ide> * @property {EventBus} eventBus - The application event bus.
<add> * @property {BasePreferences} preferences - Object for reading/writing
<add> * persistent settings.
<ide> */
<ide>
<del>/**
<del> * @class
<del> */
<del>var HandTool = (function HandToolClosure() {
<add>class HandTool {
<ide> /**
<del> * @constructs HandTool
<ide> * @param {HandToolOptions} options
<ide> */
<del> function HandTool(options) {
<del> this.container = options.container;
<del> this.eventBus = options.eventBus;
<del> var preferences = options.preferences;
<add> constructor({ container, eventBus, preferences, }) {
<add> this.container = container;
<add> this.eventBus = eventBus;
<ide>
<ide> this.wasActive = false;
<ide>
<ide> var HandTool = (function HandToolClosure() {
<ide>
<ide> this.eventBus.on('togglehandtool', this.toggle.bind(this));
<ide>
<del> Promise.all([localized,
<del> preferences.get('enableHandToolOnLoad')]).then((values) => {
<add> let enableOnLoad = preferences.get('enableHandToolOnLoad');
<add> Promise.all([localized, enableOnLoad]).then((values) => {
<ide> if (values[1] === true) {
<ide> this.handTool.activate();
<ide> }
<del> }).catch(function rejected(reason) { });
<add> }).catch(function(reason) {});
<ide>
<ide> this.eventBus.on('presentationmodechanged', (evt) => {
<ide> if (evt.switchInProgress) {
<ide> var HandTool = (function HandToolClosure() {
<ide> });
<ide> }
<ide>
<del> HandTool.prototype = {
<del> /**
<del> * @return {boolean}
<del> */
<del> get isActive() {
<del> return !!this.handTool.active;
<del> },
<del>
<del> toggle: function HandTool_toggle() {
<del> this.handTool.toggle();
<del> },
<add> /**
<add> * @return {boolean}
<add> */
<add> get isActive() {
<add> return !!this.handTool.active;
<add> }
<ide>
<del> enterPresentationMode: function HandTool_enterPresentationMode() {
<del> if (this.isActive) {
<del> this.wasActive = true;
<del> this.handTool.deactivate();
<del> }
<del> },
<add> toggle() {
<add> this.handTool.toggle();
<add> }
<ide>
<del> exitPresentationMode: function HandTool_exitPresentationMode() {
<del> if (this.wasActive) {
<del> this.wasActive = false;
<del> this.handTool.activate();
<del> }
<add> enterPresentationMode() {
<add> if (this.isActive) {
<add> this.wasActive = true;
<add> this.handTool.deactivate();
<ide> }
<del> };
<add> }
<ide>
<del> return HandTool;
<del>})();
<add> exitPresentationMode() {
<add> if (this.wasActive) {
<add> this.wasActive = false;
<add> this.handTool.activate();
<add> }
<add> }
<add>}
<ide>
<ide> export {
<ide> HandTool,
| 1
|
PHP
|
PHP
|
remove redundant checks
|
6ee25a0dd7799874c4f5f0db2318cbd9e3958429
|
<ide><path>tests/TestCase/Cache/Engine/MemcachedEngineTest.php
<ide> public function testDeleteCache()
<ide> */
<ide> public function testDeleteMany()
<ide> {
<del> $this->skipIf(defined('HHVM_VERSION'), 'HHVM does not implement deleteMulti');
<ide> $this->_configCache();
<ide> $data = [
<ide> 'App.falseTest' => false,
<ide><path>tests/TestCase/Core/ConfigureTest.php
<ide> public function testWrite()
<ide> */
<ide> public function testDebugSettingDisplayErrors()
<ide> {
<del> $this->skipIf(
<del> defined('HHVM_VERSION'),
<del> 'Cannot change display_errors at runtime in HHVM'
<del> );
<ide> Configure::write('debug', false);
<ide> $result = ini_get('display_errors');
<ide> $this->assertSame('0', $result);
<ide><path>tests/TestCase/Http/ResponseTest.php
<ide> public function testWithCache()
<ide> */
<ide> public function testCompress()
<ide> {
<del> $this->skipIf(defined('HHVM_VERSION'), 'HHVM does not implement ob_gzhandler');
<del>
<ide> $response = new Response();
<ide> if (ini_get('zlib.output_compression') === '1' || !extension_loaded('zlib')) {
<ide> $this->assertFalse($response->compress());
<ide> public function testOutputCompressed()
<ide> $this->markTestSkipped('Skipping further tests for outputCompressed as zlib extension is not loaded');
<ide> }
<ide>
<del> $this->skipIf(defined('HHVM_VERSION'), 'HHVM does not implement ob_gzhandler');
<del>
<ide> if (ini_get('zlib.output_compression') !== '1') {
<ide> ob_start('ob_gzhandler');
<ide> }
| 3
|
Javascript
|
Javascript
|
add note for ios9 url scheme changes
|
cab3bd6e860204a54f88fba21d660a3e9e65410b
|
<ide><path>Libraries/LinkingIOS/LinkingIOS.js
<ide> class LinkingIOS {
<ide> }
<ide>
<ide> /**
<del> * Determine wether or not an installed app can handle a given `url`
<add> * Determine whether or not an installed app can handle a given `url`
<ide> * The callback function will be called with `bool supported` as the only argument
<add> *
<add> * NOTE: As of iOS 9, your app needs to provide a `LSApplicationQueriesSchemes` key
<add> * inside `Info.plist`.
<ide> */
<ide> static canOpenURL(url: string, callback: Function) {
<ide> invariant(
| 1
|
Ruby
|
Ruby
|
add missing require
|
2692e38efac7287cffd0d31f46eed52938983763
|
<ide><path>activesupport/lib/active_support/core_ext/string/zones.rb
<add>require 'active_support/core_ext/string/conversions'
<ide> require 'active_support/core_ext/time/zones'
<ide>
<ide> class String
| 1
|
PHP
|
PHP
|
show error message if a task is not found
|
c186656ae3e6e94b5ec27f43594e1b90a7ee54db
|
<ide><path>cake/scripts/bake2.php
<ide> function defineConstants() {
<ide>
<ide> function executeTask($taskName, $params) {
<ide> $class = getTaskClass($taskName);
<del> $class->execute($params);
<add>
<add> if ($class != null) {
<add> $class->execute($params);
<add> } else {
<add> echo "Task not found: " . $taskName . "\n";
<add> }
<ide> }
<ide>
<ide> function getAppPath($appPathShortcut) {
<ide> function getAppPath($appPathShortcut) {
<ide> function getTaskClass($taskName) {
<ide> $scriptDir = dirname(__FILE__);
<ide> $taskPath = 'tasks'.DS.$taskName.'_task.php';
<add> $fileExists = true;
<ide> require($scriptDir.DS.'tasks'.DS.'bake_task.php');
<ide>
<ide> if (file_exists(VENDORS.$taskPath)) {
<ide> require(VENDORS.$taskPath);
<del> } else {
<add> } elseif (file_exists($scriptDir.DS.$taskPath)) {
<ide> require($scriptDir.DS.$taskPath);
<add> } else {
<add> $fileExists = false;
<add> }
<add>
<add> if ($fileExists) {
<add> $className = $taskName.'Task';
<add> return new $className;
<ide> }
<ide>
<del> $className = $taskName.'Task';
<del> return new $className;
<add> return null;
<ide> }
<ide>
<ide> function includeCoreFiles($cakePath) {
| 1
|
Javascript
|
Javascript
|
add compat support for nested array headers
|
5dacbf594ef80f8eadea274f537cc17cc1e5ebe1
|
<ide><path>lib/internal/http2/compat.js
<ide> class Http2ServerResponse extends Stream {
<ide> if (headers === undefined && typeof statusMessage === 'object')
<ide> headers = statusMessage;
<ide>
<del> if (typeof headers === 'object') {
<add> var i;
<add> if (Array.isArray(headers)) {
<add> for (i = 0; i < headers.length; i++) {
<add> const header = headers[i];
<add> this[kSetHeader](header[0], header[1]);
<add> }
<add> } else if (typeof headers === 'object') {
<ide> const keys = Object.keys(headers);
<ide> let key = '';
<del> for (var i = 0; i < keys.length; i++) {
<add> for (i = 0; i < keys.length; i++) {
<ide> key = keys[i];
<ide> this[kSetHeader](key, headers[key]);
<ide> }
<ide><path>test/parallel/test-http2-compat-serverresponse-writehead-array.js
<add>'use strict';
<add>
<add>const common = require('../common');
<add>if (!common.hasCrypto)
<add> common.skip('missing crypto');
<add>const assert = require('assert');
<add>const h2 = require('http2');
<add>
<add>// Http2ServerResponse.writeHead should support nested arrays
<add>
<add>const server = h2.createServer();
<add>server.listen(0, common.mustCall(() => {
<add> const port = server.address().port;
<add> server.once('request', common.mustCall((request, response) => {
<add> response.writeHead(200, [
<add> ['foo', 'bar'],
<add> ['ABC', 123]
<add> ]);
<add> response.end(common.mustCall(() => { server.close(); }));
<add> }));
<add>
<add> const url = `http://localhost:${port}`;
<add> const client = h2.connect(url, common.mustCall(() => {
<add> const headers = {
<add> ':path': '/',
<add> ':method': 'GET',
<add> ':scheme': 'http',
<add> ':authority': `localhost:${port}`
<add> };
<add> const request = client.request(headers);
<add> request.on('response', common.mustCall((headers) => {
<add> assert.strictEqual(headers.foo, 'bar');
<add> assert.strictEqual(headers.abc, '123');
<add> assert.strictEqual(headers[':status'], 200);
<add> }, 1));
<add> request.on('end', common.mustCall(() => {
<add> client.close();
<add> }));
<add> request.end();
<add> request.resume();
<add> }));
<add>}));
| 2
|
Java
|
Java
|
ignore parse errors in httpputformcontentfilter
|
2ff3d53962c1249dccfb493eb46f12e30612de05
|
<ide><path>spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java
<ide> public InputStream getBody() throws IOException {
<ide> else {
<ide> filterChain.doFilter(request, response);
<ide> }
<del>
<ide> }
<ide>
<ide> private boolean isFormContentType(HttpServletRequest request) {
<ide> String contentType = request.getContentType();
<ide> if (contentType != null) {
<del> MediaType mediaType = MediaType.parseMediaType(contentType);
<del> return (MediaType.APPLICATION_FORM_URLENCODED.includes(mediaType));
<add> try {
<add> MediaType mediaType = MediaType.parseMediaType(contentType);
<add> return (MediaType.APPLICATION_FORM_URLENCODED.includes(mediaType));
<add> }
<add> catch (IllegalArgumentException ex) {
<add> return false;
<add> }
<ide> }
<ide> else {
<ide> return false;
<ide><path>spring-web/src/test/java/org/springframework/web/filter/HttpPutFormContentFilterTests.java
<ide> public void wrapFormEncodedOnly() throws Exception {
<ide> }
<ide> }
<ide>
<add> @Test
<add> public void invalidMediaType() throws Exception {
<add> request.setContent("".getBytes("ISO-8859-1"));
<add> request.setContentType("foo");
<add> filterChain = new MockFilterChain();
<add> filter.doFilter(request, response, filterChain);
<add> assertSame(request, filterChain.getRequest());
<add> }
<add>
<ide> @Test
<ide> public void getParameter() throws Exception {
<ide> request.setContent("name=value".getBytes("ISO-8859-1"));
| 2
|
Javascript
|
Javascript
|
disable the test if uglifyjs is used
|
e4ac0838d4e4b4c10674b2c6fd7ad0c372687415
|
<ide><path>test/cases/parsing/optional-catch-binding/test.filter.js
<ide> const supportsOptionalCatchBinding = require("../../../helpers/supportsOptionalCatchBinding");
<ide>
<ide> module.exports = function(config) {
<add> // XXX: Disable this test if UglifyJS is used because it does not support ES 2019
<add> if (config.mode === "production") {
<add> return false;
<add> }
<ide> return supportsOptionalCatchBinding();
<ide> };
| 1
|
Text
|
Text
|
release notes for 1.0.0rc1
|
5e3db61b1de79aae9cdec41173d930eb93c410dd
|
<ide><path>CHANGELOG.md
<ide> - The Latest Stable Release: <a href="#0.9.19">0.9.19 canine-psychokinesis</a>
<del>- The Latest Unstable Release: <a href="#0.10.6">0.10.6 bubblewrap-cape</a>
<add>- The Latest Unstable Release: <a href="#1.0.0rc1">1.0.0rc1 moiré-vision</a>
<add>
<add><a name="1.0.0rc1"></a>
<add># 1.0.0rc1 moiré-vision (in-progress)
<add>
<add>## $compile rewrite
<add>
<add>The compiler was completely rewritten from scratch using ideas from this
<add>[design document](https://docs.google.com/document/d/1PNh4lxlYpSRK2RhEwD4paJLMwdcnddcYJn3rsDsdayc/edit).
<add>Please check out the [$compile] and
<add>[$compileProvider.directive](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)
<add>docs. The biggest improvements and changes are listed below.
<add>
<add>- the compiler now transparently supports several directive syntaxes. For example while before there
<add> was just one way to use `ng:include` directive: `<ng:include src="someSrc"></ng:include>`. The new
<add> compiler treats all of the following as equivalent:
<add>
<add> - `<ng:include src="someSrc"></ng:include>`
<add> - `<ng-include src="someSrc"></ng-include>`
<add> - `<x-ng-include src="someSrc"></x-ng-include>`
<add> - `<div ng:include src="someSrc"></div>`
<add> - `<div ng-include src="someSrc"></div>`
<add> - `<div data-ng-include src="someSrc"></div>`
<add> - `<div ng:include="someSrc"></div>`
<add> - `<div ng-include="someSrc"></div>`
<add> - `<div data-ng-include="someSrc"></div>`
<add> - `<div class="ng-include: someSrc"></div>`
<add>
<add> This will give template creators great flexibility to consider the tradeoffs between html code
<add> validity and code conciseness and pick the syntax that works the best for them.
<add>
<add>- we are switching all of our code/docs/examples to use `ng-foo` directive name style instead of
<add> `ng:foo`. The new compiler doesn't distinguish between these and other name styles (all of them
<add> are [equally supported](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)),
<add> the main difference is that `ng-foo` is easier to select with css selectors. Check out the
<add> [Internet Explorer Compatibility](http://docs-next.angularjs.org/guide/ie.ngdoc)
<add> doc to learn about various IE-related requirements for different directive naming styles.
<add>
<add>- `angular.directive`, `angular.widget`, `angular.attrWidget` were merged into a single concept: a
<add> `directive` which is registered via
<add> [myModule.directive](http://docs-next.angularjs.org/api/angular.Module#directive) or
<add> [$compileProvider.directive](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive).
<add> You can control execution priority of multiple directives on the same element (previously the main
<add> difference between a attribute widget and a directive) via a directive priority setting.
<add>
<add>- previously the linking functions of directives were called top to bottom following the DOM tree,
<add> to enable a linking fn to work child DOM nodes that were already processed by child linking fns
<add> the order was changed as follows: compile functions run top to bottom following the DOM tree, but
<add> linking functions run bottom-up following the DOM tree. In some rare cases it is desirable for
<add> linking fns to be called top to bottom and for these it is possible to register "prelinking"
<add> functions (check out
<add> [the docs](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)
<add> for the return value of the compile function).
<add>
<add>- `angular.markup` and `angular.attrMarkup` were replaced with interpolation via `$interpolate`
<add> service.
<add>
<add> - In the past `{{foo}}` markup was getting translated to `<span ng-bind="foo"></span>` during the
<add> early stage of template compilation. Addition of this extra node was in some cases undesirable
<add> and caused problems. The new compiler with the help of the $interpolate service removes the need
<add> for these artificial nodes.
<add>
<add> - As a side-effect of not using artificial nodes available for all bindings, the `html` filter
<add> which used to innerHTML (sanitized) html into the artificial node was converted into a directive.
<add> So instead of `{{ someRawHtml | html }}` use `<div ng-bind-html="someRawHtml"></div>` and
<add> instead of `{{ someRawHtml | html:"unsafe" }}` use `<div ng-bind-html-unsafe="someRawHtml"></div>`.
<add> Please check out the
<add> [ng-bind-html](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-bind-html)
<add> and
<add> [ng-bind-html-unsafe](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-bind-html-unsafe)
<add> directive docs.
<add>
<add> - Custom markup has been used by developers only to switch from `{{ }}` markup to `(( ))` or
<add> something similar in order to avoid conflicts with server-side templating libraries. We made it
<add> easier to do this kind of customization by making the start and end symbol of the interpolation
<add> configurable via [$interpolateProvider](http://docs-next.angularjs.org/api/angular.module.ng.$interpolateProvider).
<add>
<add>- [template loader](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.script)
<add> loads template fragments from script elements and populates the $templateCache with them. Templates
<add> loaded in this way can be then used with `ng-include`, `ng-view` as well as directive templates
<add> (see the `templateUrl` property of the
<add> [directive config object](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)).
<add>
<add>
<add>## Forms / input controls / two-way data binding
<add>
<add>The implementation of forms and input bindings was modified to address issues around composability,
<add>ease of adding custom validation and formatting. Please check out the
<add>[forms dev guide article](http://docs-next.angularjs.org/guide/dev_guide.forms) to learn about forms,
<add>form control bindings and input validation. The biggest changes are listed below.
<add>
<add>- any directive can add formatter/parser (validators, convertors) to an input type. This allows
<add> better composability of input types with custom validators and formatters. So instead of creating
<add> new custom input type for everything, it's now possible to take existing input type and add an
<add> additional formatter and/or validator to it via a custom directive.
<add>
<add>- inputs propagates changes only on the blur event by default (use new `ng-model-instant` directive
<add> if you want to propagate changes on each keystroke).
<add>
<add>- no more custom input types, use directives to customize existing types.
<add>
<add>- removed $formFactory.
<add>
<add>- removed parallel scope hierarchy (forms, widgets).
<add>
<add>- removed `list` input type (use `ng-list` directive instead).
<add>
<add>- removed integer input type.
<add>
<add>
<add>## Controller-scope separation
<add>
<add>Controllers are now standalone objects, created using the "new" operator, and not mixed with scope
<add>object anymore. This addresses many issues including:
<add>[#321](https://github.com/angular/angular.js/issues/321) and
<add>[#425](https://github.com/angular/angular.js/issues/425).
<add>
<add>The [design doc](https://docs.google.com/document/pub?id=1SsgVj17ec6tnZEX3ugsvg0rVVR11wTso5Md-RdEmC0k)
<add>explains the reasoning for this major change and how it solves many issues.
<add>
<add>### Before:
<add>
<add><pre>
<add>function MyCtrl() {
<add> var self = this;
<add>
<add> this.model = 'some model of any type';
<add>
<add> this.fnUsedFromTemplate = function() {
<add> someApiThatTakesCallback(function callbackFn() {
<add> self.model = 'updatedModel';
<add> });
<add> };
<add>}
<add></pre>
<add>
<add>### After:
<add>
<add><pre>
<add>function MyCtrl($scope) {
<add> $scope.mode = 'some model of any type';
<add>
<add> $scope.fnUsedFromTemplate = function() {
<add> someApiThatTakesCallback(function() {
<add> $scope.model = 'updatedModel';
<add> });
<add> }
<add>}
<add></pre>
<add>
<add>Temporary backwards compatibility: Load the following module in your app to recreate the previous
<add>behavior and migrate your controllers one at a time: <https://gist.github.com/1649788>
<add>
<add>
<add>## $route service changes
<add>
<add>- As advertised in the past we moved the $route configuration from the run phase of the application
<add> to the config phase. This means that instead of defining routes via `$route.when`/`$route.otherwise`
<add> you should use `$routeProvider.when`/`$routeProvider.otherwise` instead.
<add>
<add>- route scope is now being created by the `ng-view` rather than by `$route`, this resolved many
<add> issues we've previously faced. For more info, read the
<add> [commit message](https://github.com/angular/angular.js/commit/60743fc52aea9eabee58258a31f4ba465013cb4e).
<add>
<add>- removed `$route.parent()` - it's unnecessary because the scope is properly created in the scope
<add> hierarchy by `ng-view`.
<add>
<add>- new `$viewContentLoaded` and `$includeContentLoaded` events which directives can use to be
<add> notified when a template content is (re)loaded.
<add>
<add>- `ng-view` now has `onload` attribute which behaves similarly to the one on `ng-include`.
<add>
<add>
<add>## Directives
<add>
<add>- `ng-model` binding on select[multiple] element should support binding to an array
<add> ([commit](https://github.com/angular/angular.js/commit/85b2084f578652cc0dcba46c689683fc550554fe))
<add>- event object is now accessible as `$event` in `ng-click` and other directives
<add> ([commit](https://github.com/angular/angular.js/commit/1752c8c44a7058e974ef208e583683eac8817789),
<add> issue [#259](https://github.com/angular/angular.js/issues/259)
<add>- `ng-class` directive now support map of classnames and conditions
<add> e.g. `<div ng-class="{'hide': !visible, 'warning': isAlert()}"...` (contributed by Kai Groner)
<add> ([commit](https://github.com/angular/angular.js/commit/56bcc04c54ed24c19204f68de52b8c30c00e08f0))
<add>
<add>
<add>## Scope changes
<add>
<add>- `scope.$emit`/`$broadcast` return the event object, add cancelled property
<add> ([commit](https://github.com/angular/angular.js/commit/6e635012fb30905e5fe659a024864e275f1c14b5))
<add>
<add>- `scope.$new()` takes one argument - a boolean indicating if the newly-created child scope should be
<add> isolated (not prototypically inheriting from the current scope). Previously the first argument was
<add> reference to the controller constructor, but because of the scope/controller separation the
<add> controllers should be instantiated via the `$controller` service.
<add> ([commit](https://github.com/angular/angular.js/commit/78656fe0dfc99c341ce02d71e7006e9c05b1fe3f))
<add>
<add>- fn signature change for change listener functions registered via `scope.$watch` - this means that
<add> the scope object can be listed in the arguments list only if its needed and skipped otherwise.
<add> ([commit](https://github.com/angular/angular.js/commit/0196411dbe179afe24f4faa6d6503ff3f69472da))
<add>
<add> - before: `scope.$watch('someModel', function(scope, newVal, oldVal) {})`
<add> - after: `scope.$watch('someModel', function(newVal, oldVal, scope) {})`
<add>
<add>- `scope.$watch` now compares object by reference and only if extra boolean flag is passed
<add> comparison by equality is used. This was done to avoid unintended performance issues.
<add> ([commit](https://github.com/angular/angular.js/commit/d6e3e1baabc3acc930e4fda387b62cbd03e64577))
<add>
<add> - before: `scope.$watch('expression', function(scope, newVal, oldVal) {})`
<add> - after: `scope.$watch('expression', function(newVal, oldVal, scope) {}, true)`
<add>
<add>
<add>## New directives:
<add>
<add>- [ng-mouseleave](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-mouseleave)
<add>- [ng-mousemove](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-mousemove)
<add>- [ng-mouseover](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-mouseover)
<add>- [ng-mouseup](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-mouseup)
<add>- [ng-mousedown](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-mousedown)
<add>- [ng-dblclick](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-dblclick)
<add>- [ng-model-instant](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive.ng-model-instant)
<add>
<add>
<add>## $injector / modules
<add>
<add>- `$injector.instantiate` should return the object returned from constructor if one was returned
<add> ([commit](https://github.com/angular/angular.js/commit/776739299b698a965ef818eeda75d4eddd10c491))
<add>- `$injector.instantiate` should support array annotations for Type argument (e.g. instantiate(['dep1', 'dep2', Type]))
<add> ([commit](https://github.com/angular/angular.js/commit/eb92735c9ea3e5ddc747b66d8e895b6187a5f9e0))
<add>- quickly fail if circular dependencies are detected during instantiation
<add> ([commit](https://github.com/angular/angular.js/commit/fbcb7fdd141c277d326dc3ed34545210c4d5628f))
<add>- added [$provide.constant](http://docs-next.angularjs.org/api/angular.module.AUTO.$provide#constant)
<add> to enable registration of constants that are available in both the config and run phase
<add> ([commit](https://github.com/angular/angular.js/commit/80edcadb1dd418dcf5adf85704c6693940c8bb28))
<add>- `$provide.service` was renamed to $provide.provider
<add> ([commit](https://github.com/angular/angular.js/commit/00d4427388eeec81d434f9ee96bb7ccc70190923))
<add>- `$provide.service` takes a constructor fn and creates a service instance by using $injector.instantiate
<add>
<add>
<add>## New services:
<add>
<add>- [$sanitize](http://docs-next.angularjs.org/api/angular.module.ng.$sanitize)
<add>- [$interpolate](http://docs-next.angularjs.org/api/angular.module.ng.$interpolate)
<add>
<add>
<add>## jqLite (angular.element)
<add>
<add>- added `contents()` ([commit](https://github.com/angular/angular.js/commit/97dae0d0a0226ee527771578bfad1342d51bf4dd))
<add>- added `wrap()` ([commit](https://github.com/angular/angular.js/commit/4a051efb89cf33e30d56f1227d1f6084ead4cd42))
<add>- fix memory leaking in IE8 (remove monkey patched methods on Event)
<add> ([commit](https://github.com/angular/angular.js/commit/3173d8603db4ae1c2373e13a7a490988126bb1e7),
<add> [commit](https://github.com/angular/angular.js/commit/230f29d0a78a04a6963514da8b1e34cc03e553d0))
<add>
<add>
<add>## Docs
<add>
<add>- new [Modules dev guide article](http://docs-next.angularjs.org/guide/module.ngdoc)
<add>
<add>
<add>## Small bug fixes
<add>
<add>- fix incorrect comparison of dates by angular.equals
<add> ([commit](https://github.com/angular/angular.js/commit/ffa84418862a9f768ce5b9b681916438f14a0d79))
<add>- `scope.$watch` support watching functions
<add> ([commit](https://github.com/angular/angular.js/commit/7da2bdb82a72dffc8c72c1becf6f62aae52d32ce),
<add> [commit](https://github.com/angular/angular.js/commit/39b3297fc34b6b15bb3487f619ad1e93c4480741))
<add>- `$http` should not json-serialize File objects, instead just send them raw
<add> ([commit](https://github.com/angular/angular.js/commit/5b0d0683584e304db30462f3448d9f090120c444)
<add>- `$compile` should ignore content of style and script elements
<add> ([commit](https://github.com/angular/angular.js/commit/4c1c50fd9bfafaa89cdc66dfde818a3f8f4b0c6b),
<add> [commit](https://github.com/angular/angular.js/commit/d656d11489a0dbce0f549b20006052b215c4b500))
<add>- `TzDate#getDay()` should take into account the timezone offset (contributed by Stephane Bisson)
<add> ([commit](https://github.com/angular/angular.js/commit/e86bafecd212789cde61050073a69c1e49ffd011))
<add>
<add>
<add>## Small features
<add>
<add>- `$parse` service now supports local vars in expressions
<add> ([commit](https://github.com/angular/angular.js/commit/761b2ed85ad9685c35f85513e17363abf17ce6b3))
<ide>
<del><a name="0.10.7"></a>
<del># 0.10.7 moiré-vision (in-progress)
<ide>
<ide>
<ide> <a name="0.10.6"></a>
| 1
|
Python
|
Python
|
update basic_binary_tree.py (#748)
|
56de3df784a8ff2bca54946b9218ca039776a2d7
|
<ide><path>binary_tree/basic_binary_tree.py
<ide> def __init__(self, data):
<ide> self.left = None
<ide> self.right = None
<ide>
<add>def display(tree): #In Order traversal of the tree
<add>
<add> if tree is None:
<add> return
<add>
<add> if tree.left is not None:
<add> display(tree.left)
<add>
<add> print(tree.data)
<add>
<add> if tree.right is not None:
<add> display(tree.right)
<add>
<add> return
<ide>
<ide> def depth_of_tree(tree): #This is the recursive function to find the depth of binary tree.
<ide> if tree is None:
<ide> def main(): # Main func for testing.
<ide>
<ide> print(is_full_binary_tree(tree))
<ide> print(depth_of_tree(tree))
<add> print("Tree is: ")
<add> display(tree)
<ide>
<ide>
<ide> if __name__ == '__main__':
| 1
|
Python
|
Python
|
refine bf16 test for deepspeed
|
36d46479934c18eeb83599e75ade685159eb62d4
|
<ide><path>src/transformers/utils/__init__.py
<ide> is_tokenizers_available,
<ide> is_torch_available,
<ide> is_torch_bf16_available,
<add> is_torch_bf16_cpu_available,
<add> is_torch_bf16_gpu_available,
<ide> is_torch_cuda_available,
<ide> is_torch_fx_available,
<ide> is_torch_fx_proxy,
<ide><path>src/transformers/utils/import_utils.py
<ide> def is_torch_cuda_available():
<ide> return False
<ide>
<ide>
<del>def is_torch_bf16_available():
<add>def is_torch_bf16_gpu_available():
<ide> if not is_torch_available():
<ide> return False
<ide>
<ide> def is_torch_bf16_available():
<ide> # 4. torch.autocast exists
<ide> # XXX: one problem here is that it may give invalid results on mixed gpus setup, so it's
<ide> # really only correct for the 0th gpu (or currently set default device if different from 0)
<del> is_torch_gpu_bf16_available = True
<del> is_torch_cpu_bf16_available = True
<ide> if version.parse(torch.__version__) < version.parse("1.10"):
<del> is_torch_gpu_bf16_available = False
<del> is_torch_cpu_bf16_available = False
<add> return False
<ide>
<ide> if torch.cuda.is_available() and torch.version.cuda is not None:
<ide> if torch.cuda.get_device_properties(torch.cuda.current_device()).major < 8:
<del> is_torch_gpu_bf16_available = False
<add> return False
<ide> if int(torch.version.cuda.split(".")[0]) < 11:
<del> is_torch_gpu_bf16_available = False
<add> return False
<ide> if not hasattr(torch.cuda.amp, "autocast"):
<del> is_torch_gpu_bf16_available = False
<add> return False
<ide> else:
<del> is_torch_gpu_bf16_available = False
<add> return False
<add>
<add> return True
<add>
<add>
<add>def is_torch_bf16_cpu_available():
<add> if not is_torch_available():
<add> return False
<add>
<add> import torch
<add>
<add> if version.parse(torch.__version__) < version.parse("1.10"):
<add> return False
<ide>
<del> # checking CPU
<ide> try:
<ide> # multiple levels of AttributeError depending on the pytorch version so do them all in one check
<ide> _ = torch.cpu.amp.autocast
<ide> except AttributeError:
<del> is_torch_cpu_bf16_available = False
<add> return False
<add>
<add> return True
<ide>
<del> return is_torch_cpu_bf16_available or is_torch_gpu_bf16_available
<add>
<add>def is_torch_bf16_available():
<add> return is_torch_bf16_cpu_available() or is_torch_bf16_gpu_available()
<ide>
<ide>
<ide> def is_torch_tf32_available():
<ide><path>tests/deepspeed/test_deepspeed.py
<ide> slow,
<ide> )
<ide> from transformers.trainer_utils import get_last_checkpoint, set_seed
<del>from transformers.utils import WEIGHTS_NAME, is_torch_bf16_available
<add>from transformers.utils import WEIGHTS_NAME, is_torch_bf16_gpu_available
<ide>
<ide>
<ide> if is_torch_available():
<ide> def get_launcher(distributed=False):
<ide> BF16 = "bf16"
<ide>
<ide> stages = [ZERO2, ZERO3]
<del>if is_torch_bf16_available():
<add>if is_torch_bf16_gpu_available():
<ide> dtypes = [FP16, BF16]
<ide> else:
<ide> dtypes = [FP16]
<ide> def test_resume_train_not_from_ds_checkpoint(self, stage, dtype):
<ide> @require_torch_multi_gpu
<ide> @parameterized.expand(["bf16", "fp16", "fp32"])
<ide> def test_inference(self, dtype):
<del> if dtype == "bf16" and not is_torch_bf16_available():
<add> if dtype == "bf16" and not is_torch_bf16_gpu_available():
<ide> self.skipTest("test requires bfloat16 hardware support")
<ide>
<ide> # this is just inference, so no optimizer should be loaded
| 3
|
Text
|
Text
|
add @kuriyosh to collaborators
|
e64613d5859b99de9f1fe617c5a9d8fc84b15592
|
<ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Juan José Arboleda** <<soyjuanarbol@gmail.com>> (he/him)
<ide> * [JungMinu](https://github.com/JungMinu) -
<ide> **Minwoo Jung** <<nodecorelab@gmail.com>> (he/him)
<add>* [kuriyosh](https://github.com/kuriyosh) -
<add> **Yoshiki Kurihara** <<yosyos0306@gmail.com>> (he/him)
<ide> * [legendecas](https://github.com/legendecas) -
<ide> **Chengzhong Wu** <<legendecas@gmail.com>> (he/him)
<ide> * [Leko](https://github.com/Leko) -
| 1
|
Ruby
|
Ruby
|
remove magic comment in generated `schema.rb`
|
2a71885a3f88562c57f81230d31518e5189c0dda
|
<ide><path>activerecord/lib/active_record/schema_dumper.rb
<ide> def initialize(connection, options = {})
<ide> def header(stream)
<ide> define_params = @version ? "version: #{@version}" : ""
<ide>
<del> if stream.respond_to?(:external_encoding) && stream.external_encoding
<del> stream.puts "# encoding: #{stream.external_encoding.name}"
<del> end
<del>
<ide> stream.puts <<HEADER
<ide> # This file is auto-generated from the current state of the database. Instead
<ide> # of editing this file, please use the migrations feature of Active Record to
<ide><path>activerecord/test/cases/schema_dumper_test.rb
<ide> def test_dump_schema_information_outputs_lexically_ordered_versions
<ide> end
<ide> end
<ide>
<del> def test_magic_comment
<del> assert_match "# encoding: #{Encoding.default_external.name}", standard_dump
<del> end
<del>
<ide> def test_schema_dump
<ide> output = standard_dump
<ide> assert_match %r{create_table "accounts"}, output
| 2
|
Javascript
|
Javascript
|
prefer object.create(null) for vertex by name map
|
d5bd2b9b9d1519791d0959fda997942e8ca714bc
|
<ide><path>packages/ember-application/lib/system/dag.js
<ide> function visit(vertex, fn, visited, path) {
<ide> */
<ide> function DAG() {
<ide> this.names = [];
<del> this.vertices = {};
<add> this.vertices = Object.create(null);
<add>}
<add>
<ide> /**
<ide> * DAG Vertex
<ide> *
<ide> function Vertex(name) {
<ide> * @param {String} name The name of the vertex to add
<ide> */
<ide> DAG.prototype.add = function(name) {
<del><<<<<<< HEAD
<del> if (this.vertices.hasOwnProperty(name)) {
<del> if (!name) { throw new Error("Can't add Vertex without name"); }
<del>=======
<ide> if (!name) {
<ide> throw new Error("Can't add Vertex without name");
<ide> }
<ide> if (this.vertices[name] !== undefined) {
<del>>>>>>>> f30005d... asdf
<ide> return this.vertices[name];
<ide> }
<ide> var vertex = new Vertex(name);
| 1
|
Ruby
|
Ruby
|
apply suggestions from code review
|
62a63063bb4cc191acd268ac96fec6b96e9d3888
|
<ide><path>Library/Homebrew/cmd/update-report.rb
<ide> def update_report_args
<ide> end
<ide>
<ide> def update_report
<del> return update_report_impl if $stdout.tty?
<add> return output_update_report if $stdout.tty?
<ide>
<ide> redirect_stdout($stderr) do
<del> return update_report_impl
<add> output_update_report
<ide> end
<ide> end
<ide>
<del> def update_report_impl
<add> def output_update_report
<ide> args = update_report_args.parse
<ide>
<ide> # Run `brew update` (again) if we've got a linuxbrew-core CoreTap
<ide><path>Library/Homebrew/style.rb
<ide> def shell_scripts
<ide> end
<ide>
<ide> def shellcheck
<del> # Always use the latest brewed shellcheck
<ide> ensure_formula_installed!("shellcheck", latest: true,
<ide> reason: "shell style checks").opt_bin/"shellcheck"
<ide> end
<ide>
<ide> def shfmt
<del> # Always use the latest brewed shfmt
<ide> ensure_formula_installed!("shfmt", latest: true,
<ide> reason: "formatting shell scripts")
<ide> HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh"
<ide><path>Library/Homebrew/utils.rb
<ide> def redirect_stdout(file)
<ide>
<ide> # Ensure the given formula is installed
<ide> # This is useful for installing a utility formula (e.g. `shellcheck` for `brew style`)
<del> def ensure_formula_installed!(formula_or_name, latest: false, reason: "",
<add> def ensure_formula_installed!(formula_or_name, reason: "", latest: false,
<ide> output_to_stderr: true, quiet: false)
<ide> if output_to_stderr || quiet
<ide> file = if quiet
| 3
|
Javascript
|
Javascript
|
enable imports for tests
|
14df2c6722ea521a57ceceadb75dade7d100ae34
|
<ide><path>karma.conf.js
<ide> module.exports = function(karma) {
<ide> ].concat((args.inputs || 'test/specs/**/*.js').split(';')),
<ide>
<ide> preprocessors: {
<add> 'test/specs/**/*.js': ['rollup'],
<ide> 'test/index.js': ['rollup'],
<ide> 'src/index.js': ['sources']
<ide> },
<ide><path>test/specs/helpers.math.tests.js
<ide> 'use strict';
<ide>
<add>import * as math from '../../src/helpers/helpers.math';
<ide>
<ide> describe('Chart.helpers.math', function() {
<del> var math = Chart.helpers.math;
<ide> var factorize = math._factorize;
<ide> var decimalPlaces = math._decimalPlaces;
<ide>
| 2
|
Mixed
|
Ruby
|
remove most traces of python@2
|
c46a30b5757f901d111dafc585e53df35a46e407
|
<ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_versioned_keg_only
<ide> bash-completion@2
<ide> gnupg@1.4
<ide> lua@5.1
<del> python@2
<ide> numpy@1.16
<ide> ].freeze
<ide>
<ide> def audit_specs
<ide> versioned_head_spec = %w[
<ide> bash-completion@2
<ide> imagemagick@6
<del> python@2
<ide> ]
<ide> problem head_spec_message unless versioned_head_spec.include?(formula.name)
<ide> end
<ide><path>Library/Homebrew/exceptions.rb
<ide> class FormulaAmbiguousPythonError < RuntimeError
<ide> def initialize(formula)
<ide> super <<~EOS
<ide> The version of python to use with the virtualenv in the `#{formula.full_name}` formula
<del> cannot be guessed automatically. If the simultaneous use of python and python@2
<del> is intentional, please add `:using => "python"` or `:using => "python@2"` to
<add> cannot be guessed automatically. If the simultaneous use of multiple pythons
<add> is intentional, please add `:using => "python@x.y"` to
<ide> `virtualenv_install_with_resources` to resolve the ambiguity manually.
<ide> EOS
<ide> end
<ide><path>Library/Homebrew/formula.rb
<ide> def go_resource(name, &block)
<ide> # depends_on "postgresql" if build.without? "sqlite"</pre>
<ide> # <pre># Python 3.x if the `--with-python` is given to `brew install example`
<ide> # depends_on "python3" => :optional</pre>
<del> # <pre># Python 2.7:
<del> # depends_on "python@2"</pre>
<ide> def depends_on(dep)
<ide> specs.each { |spec| spec.depends_on(dep) }
<ide> end
<ide><path>Library/Homebrew/language/python.rb
<ide> def self.site_packages(python = "python3.7")
<ide> def self.each_python(build, &block)
<ide> original_pythonpath = ENV["PYTHONPATH"]
<ide> pythons = { "python@3" => "python3",
<del> "python@2" => "python2.7",
<ide> "pypy" => "pypy",
<ide> "pypy3" => "pypy3" }
<ide> pythons.each do |python_formula, python|
<ide> def needs_python?(python)
<ide> # Creates a virtualenv in `libexec`, installs all `resource`s defined
<ide> # on the formula, and then installs the formula. An options hash may be
<ide> # passed (e.g., `:using => "python"`) to override the default, guessed
<del> # formula preference for python or python2, or to resolve an ambiguous
<del> # case where it's not clear whether python or python2 should be the
<add> # formula preference for python or python@x.y, or to resolve an ambiguous
<add> # case where it's not clear whether python or python@x.y should be the
<ide> # default guess.
<ide> def virtualenv_install_with_resources(options = {})
<ide> python = options[:using]
<ide> if python.nil?
<del> pythons = %w[python python@2 python2 python3 python@3 python@3.8 pypy pypy3]
<add> pythons = %w[python python3 python@3 python@3.8 pypy pypy3]
<ide> wanted = pythons.select { |py| needs_python?(py) }
<ide> raise FormulaAmbiguousPythonError, self if wanted.size > 1
<ide>
<del> python = wanted.first || "python2.7"
<ide> python = "python3" if python == "python"
<ide> end
<ide> venv = virtualenv_create(libexec, python.delete("@"))
<ide> def create
<ide> next unless f.symlink?
<ide> next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR
<ide>
<del> python = rp.include?("python@2") ? "python@2" : "python"
<del> new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
<add> new_target = rp.sub %r{#{HOMEBREW_CELLAR}/python/[^/]+}, Formula["python"].opt_prefix
<ide> f.unlink
<ide> f.make_symlink new_target
<ide> end
<ide>
<ide> Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file|
<ide> prefix_path = prefix_file.read
<del> python = prefix_path.include?("python@2") ? "python@2" : "python"
<del> prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix
<add> prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula["python"].opt_prefix
<ide> prefix_file.atomic_write prefix_path
<ide> end
<ide> end
<ide><path>docs/Gems,-Eggs-and-Perl-Modules.md
<ide> writable location. But if you installed Homebrew as we recommend,
<ide> `/usr/local` will be writable without sudo. So now you are good to
<ide> install the development tools you need without risking the use of sudo.
<ide>
<del>## Python packages (eggs) without sudo
<del>
<del>Rather than changing the rights on `/Library/Python`, we recommend the
<del>following options:
<del>
<del>### With a brewed Python
<del>Note, `easy_install` is deprecated. We install `pip` (or `pip2` for
<del>Python 2) along with python/python2.
<del>
<del>We set up distutils such that `pip install` will always put modules in
<del>`$(brew --prefix)/lib/pythonX.Y/site-packages` and scripts in
<del>`$(brew --prefix)/share/python`. Therefore, you won’t need sudo!
<del>
<del>Do `brew info python` or `brew info python@2` for precise information
<del>about the paths. Note, a brewed Python still searches for modules in
<del>`/Library/Python/X.Y/site-packages` and also in
<del>`~/Library/Python/X.Y/lib/python/site-packages`.
<del>
<del>### With system’s Python
<add>### Python packages (eggs) without sudo using system’s Python
<ide> _This is only recommended if you **don't** use a brewed Python._
<ide>
<ide> On macOS, any [Python version X.Y also searches in
<ide> following content:
<ide> install_lib = ~/Library/Python/$py_version_short/lib/python/site-packages
<ide> ```
<ide>
<del>### Using virtualenv (works with brewed and system’s Python)
<add>### Using virtualenv (with system Python)
<ide>
<ide> [Virtualenv](https://virtualenv.pypa.io/) ships `pip` and
<ide> creates isolated Python environments with separate site-packages,
<ide><path>docs/Homebrew-and-Python.md
<ide> This page describes how Python is handled in Homebrew for users. See [Python for
<ide>
<ide> Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python.
<ide>
<del>Homebrew provides formulae to brew Python 3.x and a more up-to-date Python 2.7.x.
<add>Homebrew provides formulae to brew Python 3.x.
<ide>
<del>**Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur.
<add>Homebrew provided a `python@2` formula until the end of 2019, at which point it was removed due to the Python 2 deprecation.
<ide>
<del>## Python 3.x or Python 2.x
<del>Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`).
<add>**Important:** If you choose to use a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur.
<ide>
<del>The executables are organised as follows so that Python 2 and Python 3 can both be installed without conflict:
<add>## Python 3.x
<add>Homebrew provides a formula for Python 3.x (`python`).
<add>
<add>The executables are organised as follows:
<ide>
<ide> * `python3` points to Homebrew's Python 3.x (if installed)
<del>* `python2` points to Homebrew's Python 2.7.x (if installed)
<del>* `python` points to Homebrew's Python 2.7.x (if installed) otherwise the macOS system Python. Check out `brew info python` if you wish to add Homebrew's 3.x `python` to your `PATH`.
<ide> * `pip3` points to Homebrew's Python 3.x's pip (if installed)
<del>* `pip` and `pip2` point to Homebrew's Python 2.7.x's pip (if installed)
<del>
<del>([Wondering which one to choose?](https://wiki.python.org/moin/Python2orPython3))
<ide>
<ide> ## Setuptools, Pip, etc.
<del>The Python formulae install [pip](https://pip.pypa.io/) (as `pip` or `pip2`) and [Setuptools](https://pypi.python.org/pypi/setuptools).
<add>The Python formulae install [pip](https://pip.pypa.io/) (as `pip3`) and [Setuptools](https://pypi.python.org/pypi/setuptools).
<ide>
<del>Setuptools can be updated via pip, without having to re-brew Python:
<add>Setuptools can be updated via pip3, without having to re-brew Python:
<ide>
<ide> ```sh
<del>python -m pip install --upgrade setuptools
<add>python3 -m pip3 install --upgrade setuptools
<ide> ```
<ide>
<del>Similarly, pip can be used to upgrade itself via:
<del>
<del>```sh
<del>python -m pip install --upgrade pip
<del>```
<del>
<del>### Note on `pip install --user`
<del>The normal `pip install --user` is disabled for brewed Python. This is because of a bug in distutils, because Homebrew writes a `distutils.cfg` which sets the package `prefix`.
<del>
<del>A possible workaround (which puts executable scripts in `~/Library/Python/<X>.<Y>/bin`) is:
<add>Similarly, pip3 can be used to upgrade itself via:
<ide>
<ide> ```sh
<del>python -m pip install --user --install-option="--prefix=" <package-name>
<add>python3 -m pip3 install --upgrade pip3
<ide> ```
<ide>
<ide> ## `site-packages` and the `PYTHONPATH`
<ide> These should be installed via `pip install <package>`. To discover, you can use
<ide> **Note:** macOS's system Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.
<ide>
<ide> ## Brewed Python modules
<del>For brewed Python, modules installed with `pip` or `python setup.py install` will be installed to the `$(brew --prefix)/lib/pythonX.Y/site-packages` directory (explained above). Executable Python scripts will be in `$(brew --prefix)/bin`.
<add>For brewed Python, modules installed with `pip3` or `python3 setup.py install` will be installed to the `$(brew --prefix)/lib/pythonX.Y/site-packages` directory (explained above). Executable Python scripts will be in `$(brew --prefix)/bin`.
<ide>
<ide> The system Python may not know which compiler flags to set in order to build bindings for software installed in Homebrew so you may need to run:
<ide>
<ide> Homebrew will still install Python modules into Homebrew's `site-packages` and *
<ide> Virtualenv has a `--system-site-packages` switch to allow "global" (i.e. Homebrew's) `site-packages` to be accessible from within the virtualenv.
<ide>
<ide> ## Why is Homebrew's Python being installed as a dependency?
<del>Formulae that declare an unconditional dependency on the `"python"` or `"python@2"` formulae are bottled against Homebrew's Python 3.x or 2.7.x and require it to be installed.
<add>Formulae that declare an unconditional dependency on the `"python"` formula are bottled against Homebrew's Python 3.x and require it to be installed.
<ide><path>docs/Homebrew-homebrew-core-Merge-Checklist.md
<ide> Check for:
<ide> - other teams drop new version with minor release 0 but promote it to stable only after a few minor releases
<ide> - if the software uses only hosted version control (such as GitHub, GitLab or Bitbucket), the release should be tagged and if upstream marks latest/pre-releases, PR must use latest
<ide> - does changelog mention addition/removal of dependency and is it addressed in the PR
<del> - does formula depend on versioned formula (for example `python@2`, `go@1.10`, `erlang@17`) that can be upgraded
<add> - does formula depend on versioned formula (for example `python@3.7`, `go@1.10`, `erlang@17`) that can be upgraded
<ide> - commits
<ide> - contain one formula change per commit
<ide> - ask author to squash
<ide><path>docs/Python-for-Formula-Authors.md
<ide> Sometimes we have to edit a `Makefile` on-the-fly to use our prefix for the Pyth
<ide>
<ide> Libraries built for Python 3 should include `depends_on "python"`, which will bottle against Homebrew's Python 3.x. Python 2.x libraries must function when they are installed against either the system Python or brewed Python.
<ide>
<del>Python 2 libraries do not need a `depends_on "python@2"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it's an upstream bug; [here's some advice for resolving it](https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/).
<add>Python 2 libraries need a `uses_from_macos "python@2"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it's an upstream bug; [here's some advice for resolving it](https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/).
<ide>
<ide> ### Installing
<ide>
| 8
|
Ruby
|
Ruby
|
convert extensions and basenames from array to set
|
ce33f593b4259d5710cdf36da808be884ddedeef
|
<ide><path>Library/Homebrew/metafiles.rb
<add>require "set"
<add>
<ide> class Metafiles
<ide> # https://github.com/github/markup#markups
<ide> EXTENSIONS = %w[
<ide> .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
<ide> .org .pod .rdoc .rst .rtf .textile .txt .wiki
<del> ].freeze
<add> ].to_set.freeze
<ide> BASENAMES = %w[
<ide> about authors changelog changes copying copyright history license licence
<ide> news notes notice readme todo
<del> ].freeze
<add> ].to_set.freeze
<ide>
<ide> def self.list?(file)
<ide> return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file)
| 1
|
Go
|
Go
|
avoid fallback to ssl protocols < tls1.0
|
7a062b2b8f7751fbb926e6ddc9f7df8a1b281eb6
|
<ide><path>api/server/server.go
<ide> func ListenAndServe(proto, addr string, job *engine.Job) error {
<ide> tlsConfig := &tls.Config{
<ide> NextProtos: []string{"http/1.1"},
<ide> Certificates: []tls.Certificate{cert},
<add> // Avoid fallback on insecure SSL protocols
<add> MinVersion: tls.VersionTLS10,
<ide> }
<ide> if job.GetenvBool("TlsVerify") {
<ide> certPool := x509.NewCertPool()
<ide><path>docker/docker.go
<ide> func main() {
<ide> }
<ide> tlsConfig.Certificates = []tls.Certificate{cert}
<ide> }
<add> // Avoid fallback to SSL protocols < TLS1.0
<add> tlsConfig.MinVersion = tls.VersionTLS10
<ide> }
<ide>
<ide> if *flTls || *flTlsVerify {
<ide><path>registry/registry.go
<ide> const (
<ide> )
<ide>
<ide> func newClient(jar http.CookieJar, roots *x509.CertPool, cert *tls.Certificate, timeout TimeoutType) *http.Client {
<del> tlsConfig := tls.Config{RootCAs: roots}
<add> tlsConfig := tls.Config{
<add> RootCAs: roots,
<add> // Avoid fallback to SSL protocols < TLS1.0
<add> MinVersion: tls.VersionTLS10,
<add> }
<ide>
<ide> if cert != nil {
<ide> tlsConfig.Certificates = append(tlsConfig.Certificates, *cert)
| 3
|
Java
|
Java
|
fix minor error in annotationutilstests
|
8f0849f328ee5725af1c02d0aa02697a6ac93590
|
<ide><path>spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public static class TransactionalClass {
<ide> }
<ide>
<ide> @Order
<del> public static class TransactionalAndOrderedClass {
<add> public static class TransactionalAndOrderedClass extends TransactionalClass {
<ide> }
<ide>
<ide> public static class SubTransactionalAndOrderedClass extends TransactionalAndOrderedClass {
| 1
|
Ruby
|
Ruby
|
show diff before trying to commit
|
2e7c4236090c06def65b9d6fc64409337dcb9f55
|
<ide><path>Library/Homebrew/cmd/bottle.rb
<ide> def merge
<ide>
<ide> update_or_add = has_bottle_block ? 'update' : 'add'
<ide>
<add> system 'git', 'diff'
<ide> safe_system 'git', 'commit', '--no-edit', '--verbose',
<ide> "--message=#{f.name}: #{update_or_add} #{f.version} bottle.",
<ide> '--', f.path
| 1
|
Ruby
|
Ruby
|
add mocha mocking library
|
1f505af56670599dbdb29d84ef2b683479315e6f
|
<ide><path>Library/Homebrew/test/testing_env.rb
<ide> def shutup
<ide> end
<ide>
<ide> require 'test/unit' # must be after at_exit
<del>
<ide> require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser
<del>ARGV.extend(HomebrewArgvExtension)
<del>
<ide> require 'extend/ENV'
<add>ARGV.extend(HomebrewArgvExtension)
<ide> ENV.extend(HomebrewEnvExtension)
<ide>
<add>begin
<add> require 'rubygems'
<add> require 'mocha/setup'
<add>rescue LoadError
<add> warn 'The mocha gem is required to run some tests, expect failures'
<add>end
<add>
<ide> module VersionAssertions
<ide> def version v
<ide> Version.new(v)
| 1
|
Go
|
Go
|
add dynamic buffer sizing
|
7ef34407509fa76e3ead12a20c8b731f434e1971
|
<ide><path>pkg/tarsum/tarsum.go
<ide> import (
<ide> "github.com/docker/docker/pkg/log"
<ide> )
<ide>
<add>const (
<add> buf8K = 8 * 1024
<add> buf16K = 16 * 1024
<add> buf32K = 32 * 1024
<add>)
<add>
<ide> type TarSum struct {
<ide> io.Reader
<ide> tarR *tar.Reader
<ide> tarW *tar.Writer
<ide> gz writeCloseFlusher
<ide> bufTar *bytes.Buffer
<ide> bufGz *bytes.Buffer
<del> bufData [8192]byte
<add> bufData []byte
<ide> h hash.Hash
<ide> sums map[string]string
<ide> currentFile string
<ide> func (ts *TarSum) Read(buf []byte) (int, error) {
<ide> if ts.finished {
<ide> return ts.bufGz.Read(buf)
<ide> }
<del> var buf2 []byte
<del> if len(buf) > 8192 {
<del> buf2 = make([]byte, len(buf), cap(buf))
<del> } else {
<del> buf2 = ts.bufData[:len(buf)-1]
<add> if ts.bufData == nil {
<add> switch {
<add> case len(buf) <= buf8K:
<add> ts.bufData = make([]byte, buf8K)
<add> case len(buf) <= buf16K:
<add> ts.bufData = make([]byte, buf16K)
<add> case len(buf) <= buf32K:
<add> ts.bufData = make([]byte, buf32K)
<add> default:
<add> ts.bufData = make([]byte, len(buf))
<add> }
<ide> }
<add> buf2 := ts.bufData[:len(buf)-1]
<ide>
<ide> n, err := ts.tarR.Read(buf2)
<ide> if err != nil {
| 1
|
PHP
|
PHP
|
support closures in sequences
|
3c66f6cda2ac4ee2844a67fc98e676cb170ff4b1
|
<ide><path>src/Illuminate/Database/Eloquent/Factories/Sequence.php
<ide> public function __invoke()
<ide> $this->index = 0;
<ide> }
<ide>
<del> return tap($this->sequence[$this->index], function () {
<add> return tap(value($this->sequence[$this->index]), function () {
<ide> $this->index = $this->index + 1;
<ide> });
<ide> }
| 1
|
PHP
|
PHP
|
allow colon as first separator
|
dfff0dd133eff56b93dbc27f61f15fb4882fcfbc
|
<ide><path>src/Illuminate/View/Compilers/ComponentTagCompiler.php
<ide> protected function compileOpeningTags(string $value)
<ide> $pattern = "/
<ide> <
<ide> \s*
<del> x-([\w\-\:\.]*)
<add> x[-\:]([\w\-\:\.]*)
<ide> (?<attributes>
<ide> (?:
<ide> \s+
<ide> protected function compileSelfClosingTags(string $value)
<ide> $pattern = "/
<ide> <
<ide> \s*
<del> x-([\w\-\:\.]*)
<add> x[-\:]([\w\-\:\.]*)
<ide> \s*
<ide> (?<attributes>
<ide> (?:
<ide> protected function partitionDataAndAttributes($class, array $attributes)
<ide> */
<ide> protected function compileClosingTags(string $value)
<ide> {
<del> return preg_replace("/<\/\s*x-[\w\-\:\.]*\s*>/", '@endcomponentClass', $value);
<add> return preg_replace("/<\/\s*x[-\:][\w\-\:\.]*\s*>/", '@endcomponentClass', $value);
<ide> }
<ide>
<ide> /**
<ide><path>tests/View/Blade/BladeComponentTagCompilerTest.php
<ide> public function testColonNestedComponentParsing()
<ide> <?php \$component->withAttributes([]); ?>@endcomponentClass", trim($result));
<ide> }
<ide>
<add> public function testColonStartingNestedComponentParsing()
<add> {
<add> $result = (new ComponentTagCompiler(['foo:alert' => TestAlertComponent::class]))->compileTags('<x:foo:alert></x-foo:alert>');
<add>
<add> $this->assertEquals("@component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
<add><?php \$component->withAttributes([]); ?>@endcomponentClass", trim($result));
<add> }
<add>
<ide> public function testSelfClosingComponentsCanBeCompiled()
<ide> {
<ide> $result = (new ComponentTagCompiler(['alert' => TestAlertComponent::class]))->compileTags('<div><x-alert/></div>');
| 2
|
Python
|
Python
|
fix lxmert with dataparallel
|
886ef35ce6216187a7eb3b9aaaaed072e8fa7fe3
|
<ide><path>src/transformers/modeling_lxmert.py
<ide> def forward(
<ide> # positions we want to attend and -10000.0 for masked positions.
<ide> # Since we are adding it to the raw scores before the softmax, this is
<ide> # effectively the same as removing these entirely.
<del> extended_attention_mask = extended_attention_mask.to(dtype=next(self.parameters()).dtype)
<add> extended_attention_mask = extended_attention_mask.to(dtype=self.dtype)
<ide> extended_attention_mask = (1.0 - extended_attention_mask) * -10000.0
<ide>
<ide> # Process the visual attention mask
| 1
|
Javascript
|
Javascript
|
ensure correct attribute name in usage example
|
31ebeeef7d1429dc1a4792f4678dd22c31d473b4
|
<ide><path>src/ng/directive/form.js
<ide> function FormController(element, attrs) {
<ide> * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
<ide> * sub-group of controls needs to be determined.
<ide> *
<del> * @param {string=} name|ngForm Name of the form. If specified, the form controller will be published into
<add> * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
<ide> * related scope, under this name.
<ide> *
<ide> */
| 1
|
Ruby
|
Ruby
|
fix regression in `brew deps`
|
aafae73cf980b59c34a7ec9c13a4ed6adc6180b3
|
<ide><path>Library/Homebrew/cmd/deps.rb
<ide> def deps
<ide> puts_deps_tree ARGV.formulae
<ide> else
<ide> raise FormulaUnspecifiedError if ARGV.named.empty?
<del> all_deps = deps_for_formulae(ARGV.formulae, ARGV.one?)
<add> all_deps = deps_for_formulae(ARGV.formulae, !ARGV.one?)
<ide> all_deps.sort! unless mode.topo_order?
<ide> puts all_deps
<ide> end
| 1
|
Javascript
|
Javascript
|
simplify getstring method
|
a064db482a032e3c1539eca99611777ae24b00b8
|
<ide><path>examples/js/loaders/FBXLoader.js
<ide>
<ide> getString: function ( size ) {
<ide>
<del> var a = new Uint8Array( size );
<add> var a = new Uint8Array( this.getUint8Array( size ) );
<ide>
<del> for ( var i = 0; i < size; i ++ ) {
<add> // for ( var i = 0; i < size; i ++ ) {
<ide>
<del> a[ i ] = this.getUint8();
<add> // a[ i ] = this.getUint8();
<ide>
<del> }
<add> // }
<ide>
<ide> return THREE.LoaderUtils.decodeText( a );
<ide>
| 1
|
Python
|
Python
|
drop alembic version_table in resetdb
|
d4c977b557daacfeecbb77addedab6e2d1d3cad0
|
<ide><path>airflow/utils.py
<ide>
<ide> from alembic.config import Config
<ide> from alembic import command
<add>from alembic.migration import MigrationContext
<ide>
<ide> from contextlib import contextmanager
<ide>
<ide> def resetdb():
<ide>
<ide> logging.info("Dropping tables that exist")
<ide> models.Base.metadata.drop_all(settings.engine)
<add> mc = MigrationContext.configure(settings.engine)
<add> if mc._version.exists(settings.engine):
<add> mc._version.drop(settings.engine)
<ide> initdb()
<ide>
<ide>
| 1
|
Javascript
|
Javascript
|
add typed reactlink to reactprops
|
3a49ee7d82f6b3481012e81bcd18506eea150641
|
<ide><path>src/addons/link/ReactLink.js
<ide> * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
<ide> */
<ide>
<add>var React = require('React');
<add>
<ide> /**
<ide> * @param {*} value current value of the link
<ide> * @param {function} requestChange callback to request a change
<ide> function ReactLink(value, requestChange) {
<ide> this.requestChange = requestChange;
<ide> }
<ide>
<add>/**
<add> * Creates a PropType that enforces the ReactLink API and optionally checks the
<add> * type of the value being passed inside the link. Example:
<add> *
<add> * MyComponent.propTypes = {
<add> * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
<add> * }
<add> */
<add>function createLinkTypeChecker(linkType) {
<add> var shapes = {
<add> value: typeof linkType === 'undefined'
<add> ? React.PropTypes.any.isRequired
<add> : linkType.isRequired,
<add> requestChange: React.PropTypes.func.isRequired
<add> };
<add> return React.PropTypes.shape(shapes);
<add>}
<add>
<add>ReactLink.PropTypes = {
<add> link: createLinkTypeChecker
<add>};
<add>
<ide> module.exports = ReactLink;
<ide><path>src/addons/link/__tests__/ReactLinkPropTypes-test.js
<add>/**
<add> * Copyright 2013-2014 Facebook, Inc.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> *
<add> * @jsx React.DOM
<add> * @emails react-core
<add> */
<add>
<add>"use strict";
<add>
<add>var emptyFunction = require('emptyFunction');
<add>var LinkPropTypes = require('ReactLink').PropTypes;
<add>var React = require('React');
<add>var ReactPropTypeLocations = require('ReactPropTypeLocations');
<add>
<add>var invalidMessage = 'Invalid prop `testProp` supplied to `testComponent`.';
<add>var requiredMessage =
<add> 'Required prop `testProp` was not specified in `testComponent`.';
<add>
<add>function typeCheckFail(declaration, value, message) {
<add> var props = {testProp: value};
<add> var error = declaration(
<add> props,
<add> 'testProp',
<add> 'testComponent',
<add> ReactPropTypeLocations.prop
<add> );
<add> expect(error instanceof Error).toBe(true);
<add> expect(error.message).toBe(message);
<add>}
<add>
<add>function typeCheckPass(declaration, value) {
<add> var props = {testProp: value};
<add> var error = declaration(
<add> props,
<add> 'testProp',
<add> 'testComponent',
<add> ReactPropTypeLocations.prop
<add> );
<add> expect(error).toBe(undefined);
<add>}
<add>
<add>describe('ReactLink', function() {
<add> it('should fail if the argument does not implement the Link API', function() {
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.any),
<add> {},
<add> 'Required prop `value` was not specified in `testComponent`.'
<add> );
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.any),
<add> {value: 123},
<add> 'Required prop `requestChange` was not specified in `testComponent`.'
<add> );
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.any),
<add> {requestChange: emptyFunction},
<add> 'Required prop `value` was not specified in `testComponent`.'
<add> );
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.any),
<add> {value: null, requestChange: null},
<add> 'Required prop `value` was not specified in `testComponent`.'
<add> );
<add> });
<add>
<add> it('should allow valid links even if no type was specified', function() {
<add> typeCheckPass(
<add> LinkPropTypes.link(),
<add> {value: 42, requestChange: emptyFunction}
<add> );
<add> typeCheckPass(
<add> LinkPropTypes.link(),
<add> {value: {}, requestChange: emptyFunction
<add> });
<add> });
<add>
<add> it('should allow no link to be passed at all', function() {
<add> typeCheckPass(
<add> LinkPropTypes.link(React.PropTypes.string),
<add> undefined
<add> );
<add> });
<add>
<add> it('should allow valid links with correct value format', function() {
<add> typeCheckPass(
<add> LinkPropTypes.link(React.PropTypes.any),
<add> {value: 42, requestChange: emptyFunction}
<add> );
<add> typeCheckPass(
<add> LinkPropTypes.link(React.PropTypes.number),
<add> {value: 42, requestChange: emptyFunction}
<add> );
<add> typeCheckPass(
<add> LinkPropTypes.link(React.PropTypes.renderable),
<add> {value: 42, requestChange: emptyFunction}
<add> );
<add> });
<add>
<add> it('should fail if the link`s value type does not match', function() {
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.string),
<add> {value: 123, requestChange: emptyFunction},
<add> 'Invalid prop `value` of type `number` supplied to `testComponent`,' +
<add> ' expected `string`.'
<add> );
<add> });
<add>
<add> it('should be implicitly optional and not warn without values', function() {
<add> typeCheckPass(LinkPropTypes.link(), null);
<add> typeCheckPass(LinkPropTypes.link(), undefined);
<add> typeCheckPass(LinkPropTypes.link(React.PropTypes.string), null);
<add> typeCheckPass(LinkPropTypes.link(React.PropTypes.string), undefined);
<add> });
<add>
<add> it('should warn for missing required values', function() {
<add> typeCheckFail(LinkPropTypes.link().isRequired, null, requiredMessage);
<add> typeCheckFail(LinkPropTypes.link().isRequired, undefined, requiredMessage);
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.string).isRequired,
<add> null,
<add> requiredMessage
<add> );
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.string).isRequired,
<add> undefined,
<add> requiredMessage
<add> );
<add> });
<add>
<add> it('should be compatible with React.PropTypes.oneOfType', function() {
<add> typeCheckPass(
<add> React.PropTypes.oneOfType([LinkPropTypes.link(React.PropTypes.number)]),
<add> {value: 123, requestChange: emptyFunction}
<add> );
<add> typeCheckFail(
<add> React.PropTypes.oneOfType([LinkPropTypes.link(React.PropTypes.number)]),
<add> 123,
<add> invalidMessage
<add> );
<add> typeCheckPass(
<add> LinkPropTypes.link(React.PropTypes.oneOfType([React.PropTypes.number])),
<add> {value: 123, requestChange: emptyFunction}
<add> );
<add> typeCheckFail(
<add> LinkPropTypes.link(React.PropTypes.oneOfType([React.PropTypes.number])),
<add> {value: 'imastring', requestChange: emptyFunction},
<add> 'Invalid prop `value` supplied to `testComponent`.'
<add> );
<add> });
<add>});
| 2
|
Go
|
Go
|
remove errdefs dependency
|
a1afad3aabb6504a073bc44568fc40fcabc4f775
|
<ide><path>api/server/router/network/network_routes.go
<ide> func (n *networkRouter) getNetworksList(ctx context.Context, w http.ResponseWrit
<ide> }
<ide>
<ide> if err := network.ValidateFilters(filter); err != nil {
<del> return err
<add> return errdefs.InvalidParameter(err)
<ide> }
<ide>
<ide> var list []types.NetworkResource
<ide><path>api/types/network/network.go
<ide> package network // import "github.com/docker/docker/api/types/network"
<ide> import (
<ide> "github.com/docker/docker/api/types/filters"
<del> "github.com/docker/docker/errdefs"
<ide> )
<ide>
<ide> // Address represents an IP address
<ide> var acceptedFilters = map[string]bool{
<ide>
<ide> // ValidateFilters validates the list of filter args with the available filters.
<ide> func ValidateFilters(filter filters.Args) error {
<del> return errdefs.InvalidParameter(filter.Validate(acceptedFilters))
<add> return filter.Validate(acceptedFilters)
<ide> }
| 2
|
PHP
|
PHP
|
update docblock type
|
09ed70308029817da9bcf6dd1e162485f6023dfb
|
<ide><path>src/Routing/RouteCollection.php
<ide> class RouteCollection
<ide> /**
<ide> * The routes connected to this collection.
<ide> *
<del> * @var array
<add> * @var array<string, array<\Cake\Routing\Route\Route>>
<ide> */
<ide> protected $_routeTable = [];
<ide>
<ide> public function match(array $url, array $context): string
<ide> if (empty($this->_routeTable[$name])) {
<ide> continue;
<ide> }
<del> /** @var \Cake\Routing\Route\Route $route */
<ide> foreach ($this->_routeTable[$name] as $route) {
<ide> $match = $route->match($url, $context);
<ide> if ($match) {
| 1
|
Python
|
Python
|
improve example dag for ml engine
|
a001489b5928ebfc35f990a29d1c9c2ecb80bd61
|
<ide><path>airflow/providers/google/cloud/example_dags/example_mlengine.py
<ide>
<ide> training >> create_version
<ide> training >> create_version_2
<del> create_model >> get_model >> get_model_result
<add> create_model >> get_model >> [get_model_result, delete_model]
<ide> create_model >> create_version >> create_version_2 >> set_defaults_version >> list_version
<ide> create_version >> prediction
<ide> create_version_2 >> prediction
| 1
|
Javascript
|
Javascript
|
eliminate var in function _memory
|
024842f8f4f139a4af310976e7f78dff51f12654
|
<ide><path>lib/repl.js
<ide> function _memory(cmd) {
<ide> let up = cmd.match(/[})]/g);
<ide> up = up ? up.length : 0;
<ide> dw = dw ? dw.length : 0;
<del> var depth = dw - up;
<add> let depth = dw - up;
<ide>
<ide> if (depth) {
<ide> (function workIt() {
<ide> function _memory(cmd) {
<ide> });
<ide> } else if (depth < 0) {
<ide> // Going... up.
<del> var curr = self.lines.level.pop();
<add> const curr = self.lines.level.pop();
<ide> if (curr) {
<del> var tmp = curr.depth + depth;
<add> const tmp = curr.depth + depth;
<ide> if (tmp < 0) {
<ide> // More to go, recurse
<ide> depth += curr.depth;
| 1
|
Javascript
|
Javascript
|
remove remaining iifes from core
|
518d2463af8cd73a6c21137728493ff98124f857
|
<ide><path>src/Three.Legacy.js
<ide> Object.assign( Matrix4.prototype, {
<ide> },
<ide> getPosition: function () {
<ide>
<del> var v1;
<add> console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
<add> return new Vector3().setFromMatrixColumn( this, 3 );
<ide>
<del> return function getPosition() {
<del>
<del> if ( v1 === undefined ) v1 = new Vector3();
<del> console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
<del> return v1.setFromMatrixColumn( this, 3 );
<del>
<del> };
<del>
<del> }(),
<add> },
<ide> setRotationFromQuaternion: function ( q ) {
<ide>
<ide> console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
<ide><path>src/animation/PropertyBinding.js
<ide> */
<ide>
<ide> // Characters [].:/ are reserved for track binding syntax.
<del>var RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
<add>var _RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
<add>
<add>var _reservedRe;
<add>var _trackRe, _supportedObjectNames;
<ide>
<ide> function Composite( targetGroup, path, optionalParsedPath ) {
<ide>
<ide> Object.assign( PropertyBinding, {
<ide> * @param {string} name Node name to be sanitized.
<ide> * @return {string}
<ide> */
<del> sanitizeNodeName: ( function () {
<add> sanitizeNodeName: function ( name ) {
<ide>
<del> var reservedRe = new RegExp( '[' + RESERVED_CHARS_RE + ']', 'g' );
<add> if ( _reservedRe === undefined ) {
<ide>
<del> return function sanitizeNodeName( name ) {
<add> _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );
<ide>
<del> return name.replace( /\s/g, '_' ).replace( reservedRe, '' );
<add> }
<ide>
<del> };
<add> return name.replace( /\s/g, '_' ).replace( _reservedRe, '' );
<ide>
<del> }() ),
<add> },
<ide>
<del> parseTrackName: function () {
<add> parseTrackName: function ( trackName ) {
<ide>
<del> // Attempts to allow node names from any language. ES5's `\w` regexp matches
<del> // only latin characters, and the unicode \p{L} is not yet supported. So
<del> // instead, we exclude reserved characters and match everything else.
<del> var wordChar = '[^' + RESERVED_CHARS_RE + ']';
<del> var wordCharOrDot = '[^' + RESERVED_CHARS_RE.replace( '\\.', '' ) + ']';
<add> if ( _supportedObjectNames === undefined ) {
<ide>
<del> // Parent directories, delimited by '/' or ':'. Currently unused, but must
<del> // be matched to parse the rest of the track name.
<del> var directoryRe = /((?:WC+[\/:])*)/.source.replace( 'WC', wordChar );
<add> // Attempts to allow node names from any language. ES5's `\w` regexp matches
<add> // only latin characters, and the unicode \p{L} is not yet supported. So
<add> // instead, we exclude reserved characters and match everything else.
<add> var wordChar = '[^' + _RESERVED_CHARS_RE + ']';
<add> var wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\.', '' ) + ']';
<ide>
<del> // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
<del> var nodeRe = /(WCOD+)?/.source.replace( 'WCOD', wordCharOrDot );
<add> // Parent directories, delimited by '/' or ':'. Currently unused, but must
<add> // be matched to parse the rest of the track name.
<add> var directoryRe = /((?:WC+[\/:])*)/.source.replace( 'WC', wordChar );
<ide>
<del> // Object on target node, and accessor. May not contain reserved
<del> // characters. Accessor may contain any character except closing bracket.
<del> var objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace( 'WC', wordChar );
<add> // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
<add> var nodeRe = /(WCOD+)?/.source.replace( 'WCOD', wordCharOrDot );
<ide>
<del> // Property and accessor. May not contain reserved characters. Accessor may
<del> // contain any non-bracket characters.
<del> var propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace( 'WC', wordChar );
<add> // Object on target node, and accessor. May not contain reserved
<add> // characters. Accessor may contain any character except closing bracket.
<add> var objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace( 'WC', wordChar );
<ide>
<del> var trackRe = new RegExp( ''
<del> + '^'
<del> + directoryRe
<del> + nodeRe
<del> + objectRe
<del> + propertyRe
<del> + '$'
<del> );
<add> // Property and accessor. May not contain reserved characters. Accessor may
<add> // contain any non-bracket characters.
<add> var propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace( 'WC', wordChar );
<ide>
<del> var supportedObjectNames = [ 'material', 'materials', 'bones' ];
<add> _trackRe = new RegExp( ''
<add> + '^'
<add> + directoryRe
<add> + nodeRe
<add> + objectRe
<add> + propertyRe
<add> + '$'
<add> );
<ide>
<del> return function parseTrackName( trackName ) {
<add> _supportedObjectNames = [ 'material', 'materials', 'bones' ];
<ide>
<del> var matches = trackRe.exec( trackName );
<add> }
<ide>
<del> if ( ! matches ) {
<add> var matches = _trackRe.exec( trackName );
<ide>
<del> throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
<add> if ( ! matches ) {
<ide>
<del> }
<add> throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
<ide>
<del> var results = {
<del> // directoryName: matches[ 1 ], // (tschw) currently unused
<del> nodeName: matches[ 2 ],
<del> objectName: matches[ 3 ],
<del> objectIndex: matches[ 4 ],
<del> propertyName: matches[ 5 ], // required
<del> propertyIndex: matches[ 6 ]
<del> };
<add> }
<ide>
<del> var lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );
<add> var results = {
<add> // directoryName: matches[ 1 ], // (tschw) currently unused
<add> nodeName: matches[ 2 ],
<add> objectName: matches[ 3 ],
<add> objectIndex: matches[ 4 ],
<add> propertyName: matches[ 5 ], // required
<add> propertyIndex: matches[ 6 ]
<add> };
<ide>
<del> if ( lastDot !== undefined && lastDot !== - 1 ) {
<add> var lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );
<ide>
<del> var objectName = results.nodeName.substring( lastDot + 1 );
<add> if ( lastDot !== undefined && lastDot !== - 1 ) {
<ide>
<del> // Object names must be checked against a whitelist. Otherwise, there
<del> // is no way to parse 'foo.bar.baz': 'baz' must be a property, but
<del> // 'bar' could be the objectName, or part of a nodeName (which can
<del> // include '.' characters).
<del> if ( supportedObjectNames.indexOf( objectName ) !== - 1 ) {
<add> var objectName = results.nodeName.substring( lastDot + 1 );
<ide>
<del> results.nodeName = results.nodeName.substring( 0, lastDot );
<del> results.objectName = objectName;
<add> // Object names must be checked against a whitelist. Otherwise, there
<add> // is no way to parse 'foo.bar.baz': 'baz' must be a property, but
<add> // 'bar' could be the objectName, or part of a nodeName (which can
<add> // include '.' characters).
<add> if ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {
<ide>
<del> }
<add> results.nodeName = results.nodeName.substring( 0, lastDot );
<add> results.objectName = objectName;
<ide>
<ide> }
<ide>
<del> if ( results.propertyName === null || results.propertyName.length === 0 ) {
<add> }
<ide>
<del> throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );
<add> if ( results.propertyName === null || results.propertyName.length === 0 ) {
<ide>
<del> }
<add> throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );
<ide>
<del> return results;
<add> }
<ide>
<del> };
<add> return results;
<ide>
<del> }(),
<add> },
<ide>
<ide> findNode: function ( root, nodeName ) {
<ide>
<ide><path>src/core/BufferGeometry.js
<ide> import { arrayMax } from '../utils.js';
<ide> * @author mrdoob / http://mrdoob.com/
<ide> */
<ide>
<del>var bufferGeometryId = 1; // BufferGeometry uses odd numbers as Id
<add>var _bufferGeometryId = 1; // BufferGeometry uses odd numbers as Id
<add>var _m1, _obj, _offset;
<add>var _box, _boxMorphTargets;
<add>var _vector;
<ide>
<ide> function BufferGeometry() {
<ide>
<del> Object.defineProperty( this, 'id', { value: bufferGeometryId += 2 } );
<add> Object.defineProperty( this, 'id', { value: _bufferGeometryId += 2 } );
<ide>
<ide> this.uuid = _Math.generateUUID();
<ide>
<ide> BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
<ide>
<ide> },
<ide>
<del> rotateX: function () {
<add> rotateX: function ( angle ) {
<ide>
<ide> // rotate geometry around world x-axis
<ide>
<del> var m1 = new Matrix4();
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> return function rotateX( angle ) {
<add> _m1.makeRotationX( angle );
<ide>
<del> m1.makeRotationX( angle );
<add> this.applyMatrix( _m1 );
<ide>
<del> this.applyMatrix( m1 );
<del>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> rotateY: function () {
<add> rotateY: function ( angle ) {
<ide>
<ide> // rotate geometry around world y-axis
<ide>
<del> var m1 = new Matrix4();
<del>
<del> return function rotateY( angle ) {
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> m1.makeRotationY( angle );
<add> _m1.makeRotationY( angle );
<ide>
<del> this.applyMatrix( m1 );
<add> this.applyMatrix( _m1 );
<ide>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> rotateZ: function () {
<add> rotateZ: function ( angle ) {
<ide>
<ide> // rotate geometry around world z-axis
<ide>
<del> var m1 = new Matrix4();
<del>
<del> return function rotateZ( angle ) {
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> m1.makeRotationZ( angle );
<add> _m1.makeRotationZ( angle );
<ide>
<del> this.applyMatrix( m1 );
<del>
<del> return this;
<add> this.applyMatrix( _m1 );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> translate: function () {
<add> translate: function ( x, y, z ) {
<ide>
<ide> // translate geometry
<ide>
<del> var m1 = new Matrix4();
<del>
<del> return function translate( x, y, z ) {
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> m1.makeTranslation( x, y, z );
<add> _m1.makeTranslation( x, y, z );
<ide>
<del> this.applyMatrix( m1 );
<add> this.applyMatrix( _m1 );
<ide>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> scale: function () {
<add> scale: function ( x, y, z ) {
<ide>
<ide> // scale geometry
<ide>
<del> var m1 = new Matrix4();
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> return function scale( x, y, z ) {
<add> _m1.makeScale( x, y, z );
<ide>
<del> m1.makeScale( x, y, z );
<del>
<del> this.applyMatrix( m1 );
<del>
<del> return this;
<del>
<del> };
<add> this.applyMatrix( _m1 );
<ide>
<del> }(),
<add> return this;
<ide>
<del> lookAt: function () {
<add> },
<ide>
<del> var obj = new Object3D();
<add> lookAt: function ( vector ) {
<ide>
<del> return function lookAt( vector ) {
<add> if ( _obj === undefined ) _obj = new Object3D();
<ide>
<del> obj.lookAt( vector );
<add> _obj.lookAt( vector );
<ide>
<del> obj.updateMatrix();
<add> _obj.updateMatrix();
<ide>
<del> this.applyMatrix( obj.matrix );
<add> this.applyMatrix( _obj.matrix );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<ide> center: function () {
<ide>
<del> var offset = new Vector3();
<add> if ( _offset === undefined ) _offset = new Vector3();
<ide>
<del> return function center() {
<add> this.computeBoundingBox();
<ide>
<del> this.computeBoundingBox();
<del>
<del> this.boundingBox.getCenter( offset ).negate();
<add> this.boundingBox.getCenter( _offset ).negate();
<ide>
<del> this.translate( offset.x, offset.y, offset.z );
<del>
<del> return this;
<add> this.translate( _offset.x, _offset.y, _offset.z );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<ide> setFromObject: function ( object ) {
<ide>
<ide> BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
<ide>
<ide> computeBoundingBox: function () {
<ide>
<del> var box = new Box3();
<add> if ( _box === undefined ) {
<ide>
<del> return function computeBoundingBox() {
<add> _box = new Box3();
<ide>
<del> if ( this.boundingBox === null ) {
<add> }
<ide>
<del> this.boundingBox = new Box3();
<add> if ( this.boundingBox === null ) {
<ide>
<del> }
<add> this.boundingBox = new Box3();
<ide>
<del> var position = this.attributes.position;
<del> var morphAttributesPosition = this.morphAttributes.position;
<add> }
<ide>
<del> if ( position !== undefined ) {
<add> var position = this.attributes.position;
<add> var morphAttributesPosition = this.morphAttributes.position;
<ide>
<del> this.boundingBox.setFromBufferAttribute( position );
<add> if ( position !== undefined ) {
<ide>
<del> // process morph attributes if present
<add> this.boundingBox.setFromBufferAttribute( position );
<ide>
<del> if ( morphAttributesPosition ) {
<add> // process morph attributes if present
<ide>
<del> for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
<add> if ( morphAttributesPosition ) {
<ide>
<del> var morphAttribute = morphAttributesPosition[ i ];
<del> box.setFromBufferAttribute( morphAttribute );
<add> for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
<ide>
<del> this.boundingBox.expandByPoint( box.min );
<del> this.boundingBox.expandByPoint( box.max );
<add> var morphAttribute = morphAttributesPosition[ i ];
<add> _box.setFromBufferAttribute( morphAttribute );
<ide>
<del> }
<add> this.boundingBox.expandByPoint( _box.min );
<add> this.boundingBox.expandByPoint( _box.max );
<ide>
<ide> }
<ide>
<del> } else {
<add> }
<ide>
<del> this.boundingBox.makeEmpty();
<add> } else {
<ide>
<del> }
<add> this.boundingBox.makeEmpty();
<ide>
<del> if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
<add> }
<ide>
<del> console.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
<add> if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
<ide>
<del> }
<add> console.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
<ide>
<del> };
<add> }
<ide>
<del> }(),
<add> },
<ide>
<ide> computeBoundingSphere: function () {
<ide>
<del> var box = new Box3();
<del> var boxMorphTargets = new Box3();
<del> var vector = new Vector3();
<add> if ( _boxMorphTargets === undefined ) {
<ide>
<del> return function computeBoundingSphere() {
<add> _box = new Box3();
<add> _vector = new Vector3();
<add> _boxMorphTargets = new Box3();
<ide>
<del> if ( this.boundingSphere === null ) {
<add> }
<ide>
<del> this.boundingSphere = new Sphere();
<add> if ( this.boundingSphere === null ) {
<ide>
<del> }
<add> this.boundingSphere = new Sphere();
<ide>
<del> var position = this.attributes.position;
<del> var morphAttributesPosition = this.morphAttributes.position;
<add> }
<ide>
<del> if ( position ) {
<add> var position = this.attributes.position;
<add> var morphAttributesPosition = this.morphAttributes.position;
<ide>
<del> // first, find the center of the bounding sphere
<add> if ( position ) {
<ide>
<del> var center = this.boundingSphere.center;
<add> // first, find the center of the bounding sphere
<ide>
<del> box.setFromBufferAttribute( position );
<add> var center = this.boundingSphere.center;
<ide>
<del> // process morph attributes if present
<add> _box.setFromBufferAttribute( position );
<ide>
<del> if ( morphAttributesPosition ) {
<add> // process morph attributes if present
<ide>
<del> for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
<add> if ( morphAttributesPosition ) {
<ide>
<del> var morphAttribute = morphAttributesPosition[ i ];
<del> boxMorphTargets.setFromBufferAttribute( morphAttribute );
<add> for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
<ide>
<del> box.expandByPoint( boxMorphTargets.min );
<del> box.expandByPoint( boxMorphTargets.max );
<add> var morphAttribute = morphAttributesPosition[ i ];
<add> _boxMorphTargets.setFromBufferAttribute( morphAttribute );
<ide>
<del> }
<add> _box.expandByPoint( _boxMorphTargets.min );
<add> _box.expandByPoint( _boxMorphTargets.max );
<ide>
<ide> }
<ide>
<del> box.getCenter( center );
<add> }
<ide>
<del> // second, try to find a boundingSphere with a radius smaller than the
<del> // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
<add> _box.getCenter( center );
<ide>
<del> var maxRadiusSq = 0;
<add> // second, try to find a boundingSphere with a radius smaller than the
<add> // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
<ide>
<del> for ( var i = 0, il = position.count; i < il; i ++ ) {
<add> var maxRadiusSq = 0;
<ide>
<del> vector.fromBufferAttribute( position, i );
<add> for ( var i = 0, il = position.count; i < il; i ++ ) {
<ide>
<del> maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
<add> _vector.fromBufferAttribute( position, i );
<ide>
<del> }
<add> maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
<ide>
<del> // process morph attributes if present
<add> }
<ide>
<del> if ( morphAttributesPosition ) {
<add> // process morph attributes if present
<ide>
<del> for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
<add> if ( morphAttributesPosition ) {
<ide>
<del> var morphAttribute = morphAttributesPosition[ i ];
<add> for ( var i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
<ide>
<del> for ( var j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
<add> var morphAttribute = morphAttributesPosition[ i ];
<ide>
<del> vector.fromBufferAttribute( morphAttribute, j );
<add> for ( var j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
<ide>
<del> maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
<add> _vector.fromBufferAttribute( morphAttribute, j );
<ide>
<del> }
<add> maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
<ide>
<ide> }
<ide>
<ide> }
<ide>
<del> this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
<add> }
<ide>
<del> if ( isNaN( this.boundingSphere.radius ) ) {
<add> this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
<ide>
<del> console.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
<add> if ( isNaN( this.boundingSphere.radius ) ) {
<ide>
<del> }
<add> console.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
<ide>
<ide> }
<ide>
<del> };
<add> }
<ide>
<del> }(),
<add> },
<ide>
<ide> computeFaceNormals: function () {
<ide>
<ide> BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
<ide>
<ide> normalizeNormals: function () {
<ide>
<del> var vector = new Vector3();
<add> if ( _vector === undefined ) _vector = new Vector3();
<ide>
<del> return function normalizeNormals() {
<add> var normals = this.attributes.normal;
<ide>
<del> var normals = this.attributes.normal;
<add> for ( var i = 0, il = normals.count; i < il; i ++ ) {
<ide>
<del> for ( var i = 0, il = normals.count; i < il; i ++ ) {
<add> _vector.x = normals.getX( i );
<add> _vector.y = normals.getY( i );
<add> _vector.z = normals.getZ( i );
<ide>
<del> vector.x = normals.getX( i );
<del> vector.y = normals.getY( i );
<del> vector.z = normals.getZ( i );
<add> _vector.normalize();
<ide>
<del> vector.normalize();
<add> normals.setXYZ( i, _vector.x, _vector.y, _vector.z );
<ide>
<del> normals.setXYZ( i, vector.x, vector.y, vector.z );
<del>
<del> }
<del>
<del> };
<add> }
<ide>
<del> }(),
<add> },
<ide>
<ide> toNonIndexed: function () {
<ide>
<ide><path>src/core/Geometry.js
<ide> import { _Math } from '../math/Math.js';
<ide> * @author bhouston / http://clara.io
<ide> */
<ide>
<del>var geometryId = 0; // Geometry uses even numbers as Id
<add>var _geometryId = 0; // Geometry uses even numbers as Id
<add>var _m1, _obj, _offset;
<ide>
<ide> function Geometry() {
<ide>
<del> Object.defineProperty( this, 'id', { value: geometryId += 2 } );
<add> Object.defineProperty( this, 'id', { value: _geometryId += 2 } );
<ide>
<ide> this.uuid = _Math.generateUUID();
<ide>
<ide> Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
<ide>
<ide> },
<ide>
<del> rotateX: function () {
<add> rotateX: function ( angle ) {
<ide>
<ide> // rotate geometry around world x-axis
<ide>
<del> var m1 = new Matrix4();
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> return function rotateX( angle ) {
<add> _m1.makeRotationX( angle );
<ide>
<del> m1.makeRotationX( angle );
<add> this.applyMatrix( _m1 );
<ide>
<del> this.applyMatrix( m1 );
<del>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> rotateY: function () {
<add> rotateY: function ( angle ) {
<ide>
<ide> // rotate geometry around world y-axis
<ide>
<del> var m1 = new Matrix4();
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> return function rotateY( angle ) {
<add> _m1.makeRotationY( angle );
<ide>
<del> m1.makeRotationY( angle );
<add> this.applyMatrix( _m1 );
<ide>
<del> this.applyMatrix( m1 );
<del>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> rotateZ: function () {
<add> rotateZ: function ( angle ) {
<ide>
<ide> // rotate geometry around world z-axis
<ide>
<del> var m1 = new Matrix4();
<del>
<del> return function rotateZ( angle ) {
<del>
<del> m1.makeRotationZ( angle );
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> this.applyMatrix( m1 );
<add> _m1.makeRotationZ( angle );
<ide>
<del> return this;
<add> this.applyMatrix( _m1 );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> translate: function () {
<add> translate: function ( x, y, z ) {
<ide>
<ide> // translate geometry
<ide>
<del> var m1 = new Matrix4();
<del>
<del> return function translate( x, y, z ) {
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> m1.makeTranslation( x, y, z );
<add> _m1.makeTranslation( x, y, z );
<ide>
<del> this.applyMatrix( m1 );
<add> this.applyMatrix( _m1 );
<ide>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> scale: function () {
<add> scale: function ( x, y, z ) {
<ide>
<ide> // scale geometry
<ide>
<del> var m1 = new Matrix4();
<del>
<del> return function scale( x, y, z ) {
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> m1.makeScale( x, y, z );
<add> _m1.makeScale( x, y, z );
<ide>
<del> this.applyMatrix( m1 );
<add> this.applyMatrix( _m1 );
<ide>
<del> return this;
<del>
<del> };
<del>
<del> }(),
<add> return this;
<ide>
<del> lookAt: function () {
<add> },
<ide>
<del> var obj = new Object3D();
<add> lookAt: function ( vector ) {
<ide>
<del> return function lookAt( vector ) {
<add> if ( _obj === undefined ) _obj = new Object3D();
<ide>
<del> obj.lookAt( vector );
<add> _obj.lookAt( vector );
<ide>
<del> obj.updateMatrix();
<add> _obj.updateMatrix();
<ide>
<del> this.applyMatrix( obj.matrix );
<add> this.applyMatrix( _obj.matrix );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<ide> fromBufferGeometry: function ( geometry ) {
<ide>
<ide> Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
<ide>
<ide> center: function () {
<ide>
<del> var offset = new Vector3();
<del>
<del> return function center() {
<del>
<del> this.computeBoundingBox();
<add> if ( _offset === undefined ) _offset = new Vector3();
<ide>
<del> this.boundingBox.getCenter( offset ).negate();
<add> this.computeBoundingBox();
<ide>
<del> this.translate( offset.x, offset.y, offset.z );
<add> this.boundingBox.getCenter( _offset ).negate();
<ide>
<del> return this;
<add> this.translate( _offset.x, _offset.y, _offset.z );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<ide> normalize: function () {
<ide>
<ide><path>src/core/Object3D.js
<ide> import { TrianglesDrawMode } from '../constants.js';
<ide> * @author elephantatwork / www.elephantatwork.ch
<ide> */
<ide>
<del>var object3DId = 0;
<add>var _object3DId = 0;
<add>var _m1, _q1, _v1;
<add>var _xAxis, _yAxis, _zAxis;
<add>var _target, _position, _scale, _quaternion;
<ide>
<ide> function Object3D() {
<ide>
<del> Object.defineProperty( this, 'id', { value: object3DId ++ } );
<add> Object.defineProperty( this, 'id', { value: _object3DId ++ } );
<ide>
<ide> this.uuid = _Math.generateUUID();
<ide>
<ide> Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
<ide>
<ide> },
<ide>
<del> rotateOnAxis: function () {
<add> rotateOnAxis: function ( axis, angle ) {
<ide>
<ide> // rotate object on axis in object space
<ide> // axis is assumed to be normalized
<ide>
<del> var q1 = new Quaternion();
<add> if ( _q1 === undefined ) _q1 = new Quaternion();
<ide>
<del> return function rotateOnAxis( axis, angle ) {
<add> _q1.setFromAxisAngle( axis, angle );
<ide>
<del> q1.setFromAxisAngle( axis, angle );
<add> this.quaternion.multiply( _q1 );
<ide>
<del> this.quaternion.multiply( q1 );
<del>
<del> return this;
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> rotateOnWorldAxis: function () {
<add> rotateOnWorldAxis: function ( axis, angle ) {
<ide>
<ide> // rotate object on axis in world space
<ide> // axis is assumed to be normalized
<ide> // method assumes no rotated parent
<ide>
<del> var q1 = new Quaternion();
<del>
<del> return function rotateOnWorldAxis( axis, angle ) {
<del>
<del> q1.setFromAxisAngle( axis, angle );
<del>
<del> this.quaternion.premultiply( q1 );
<del>
<del> return this;
<del>
<del> };
<del>
<del> }(),
<del>
<del> rotateX: function () {
<del>
<del> var v1 = new Vector3( 1, 0, 0 );
<add> if ( _q1 === undefined ) _q1 = new Quaternion();
<ide>
<del> return function rotateX( angle ) {
<add> _q1.setFromAxisAngle( axis, angle );
<ide>
<del> return this.rotateOnAxis( v1, angle );
<add> this.quaternion.premultiply( _q1 );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> rotateY: function () {
<add> rotateX: function ( angle ) {
<ide>
<del> var v1 = new Vector3( 0, 1, 0 );
<add> if ( _xAxis === undefined ) _xAxis = new Vector3( 1, 0, 0 );
<ide>
<del> return function rotateY( angle ) {
<add> return this.rotateOnAxis( _xAxis, angle );
<ide>
<del> return this.rotateOnAxis( v1, angle );
<add> },
<ide>
<del> };
<add> rotateY: function ( angle ) {
<ide>
<del> }(),
<add> if ( _yAxis === undefined ) _yAxis = new Vector3( 0, 1, 0 );
<ide>
<del> rotateZ: function () {
<add> return this.rotateOnAxis( _yAxis, angle );
<ide>
<del> var v1 = new Vector3( 0, 0, 1 );
<add> },
<ide>
<del> return function rotateZ( angle ) {
<add> rotateZ: function ( angle ) {
<ide>
<del> return this.rotateOnAxis( v1, angle );
<add> if ( _zAxis === undefined ) _zAxis = new Vector3( 0, 0, 1 );
<ide>
<del> };
<add> return this.rotateOnAxis( _zAxis, angle );
<ide>
<del> }(),
<add> },
<ide>
<del> translateOnAxis: function () {
<add> translateOnAxis: function ( axis, distance ) {
<ide>
<ide> // translate object by distance along axis in object space
<ide> // axis is assumed to be normalized
<ide>
<del> var v1 = new Vector3();
<del>
<del> return function translateOnAxis( axis, distance ) {
<del>
<del> v1.copy( axis ).applyQuaternion( this.quaternion );
<del>
<del> this.position.add( v1.multiplyScalar( distance ) );
<del>
<del> return this;
<del>
<del> };
<del>
<del> }(),
<del>
<del> translateX: function () {
<add> if ( _v1 === undefined ) _v1 = new Vector3();
<ide>
<del> var v1 = new Vector3( 1, 0, 0 );
<add> _v1.copy( axis ).applyQuaternion( this.quaternion );
<ide>
<del> return function translateX( distance ) {
<add> this.position.add( _v1.multiplyScalar( distance ) );
<ide>
<del> return this.translateOnAxis( v1, distance );
<del>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<del> translateY: function () {
<add> translateX: function ( distance ) {
<ide>
<del> var v1 = new Vector3( 0, 1, 0 );
<add> if ( _xAxis === undefined ) _xAxis = new Vector3( 1, 0, 0 );
<ide>
<del> return function translateY( distance ) {
<add> return this.translateOnAxis( _xAxis, distance );
<ide>
<del> return this.translateOnAxis( v1, distance );
<add> },
<ide>
<del> };
<add> translateY: function ( distance ) {
<ide>
<del> }(),
<add> if ( _yAxis === undefined ) _yAxis = new Vector3( 0, 1, 0 );
<ide>
<del> translateZ: function () {
<add> return this.translateOnAxis( _yAxis, distance );
<ide>
<del> var v1 = new Vector3( 0, 0, 1 );
<add> },
<ide>
<del> return function translateZ( distance ) {
<add> translateZ: function ( distance ) {
<ide>
<del> return this.translateOnAxis( v1, distance );
<add> if ( _zAxis === undefined ) _zAxis = new Vector3( 0, 0, 1 );
<ide>
<del> };
<add> return this.translateOnAxis( _zAxis, distance );
<ide>
<del> }(),
<add> },
<ide>
<ide> localToWorld: function ( vector ) {
<ide>
<ide> return vector.applyMatrix4( this.matrixWorld );
<ide>
<ide> },
<ide>
<del> worldToLocal: function () {
<del>
<del> var m1 = new Matrix4();
<del>
<del> return function worldToLocal( vector ) {
<add> worldToLocal: function ( vector ) {
<ide>
<del> return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) );
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> };
<add> return vector.applyMatrix4( _m1.getInverse( this.matrixWorld ) );
<ide>
<del> }(),
<add> },
<ide>
<del> lookAt: function () {
<add> lookAt: function ( x, y, z ) {
<ide>
<ide> // This method does not support objects having non-uniformly-scaled parent(s)
<ide>
<del> var q1 = new Quaternion();
<del> var m1 = new Matrix4();
<del> var target = new Vector3();
<del> var position = new Vector3();
<add> if ( _position === undefined ) {
<ide>
<del> return function lookAt( x, y, z ) {
<add> _q1 = new Quaternion();
<add> _m1 = new Matrix4();
<add> _target = new Vector3();
<add> _position = new Vector3();
<ide>
<del> if ( x.isVector3 ) {
<add> }
<ide>
<del> target.copy( x );
<add> if ( x.isVector3 ) {
<ide>
<del> } else {
<add> _target.copy( x );
<ide>
<del> target.set( x, y, z );
<add> } else {
<ide>
<del> }
<add> _target.set( x, y, z );
<ide>
<del> var parent = this.parent;
<add> }
<ide>
<del> this.updateWorldMatrix( true, false );
<add> var parent = this.parent;
<ide>
<del> position.setFromMatrixPosition( this.matrixWorld );
<add> this.updateWorldMatrix( true, false );
<ide>
<del> if ( this.isCamera || this.isLight ) {
<add> _position.setFromMatrixPosition( this.matrixWorld );
<ide>
<del> m1.lookAt( position, target, this.up );
<add> if ( this.isCamera || this.isLight ) {
<ide>
<del> } else {
<add> _m1.lookAt( _position, _target, this.up );
<ide>
<del> m1.lookAt( target, position, this.up );
<add> } else {
<ide>
<del> }
<add> _m1.lookAt( _target, _position, this.up );
<ide>
<del> this.quaternion.setFromRotationMatrix( m1 );
<add> }
<ide>
<del> if ( parent ) {
<add> this.quaternion.setFromRotationMatrix( _m1 );
<ide>
<del> m1.extractRotation( parent.matrixWorld );
<del> q1.setFromRotationMatrix( m1 );
<del> this.quaternion.premultiply( q1.inverse() );
<add> if ( parent ) {
<ide>
<del> }
<add> _m1.extractRotation( parent.matrixWorld );
<add> _q1.setFromRotationMatrix( _m1 );
<add> this.quaternion.premultiply( _q1.inverse() );
<ide>
<del> };
<add> }
<ide>
<del> }(),
<add> },
<ide>
<ide> add: function ( object ) {
<ide>
<ide> Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
<ide>
<ide> },
<ide>
<del> attach: function () {
<add> attach: function ( object ) {
<ide>
<ide> // adds object as a child of this, while maintaining the object's world transform
<ide>
<del> var m = new Matrix4();
<add> if ( _m1 === undefined ) _m1 = new Matrix4();
<ide>
<del> return function attach( object ) {
<add> this.updateWorldMatrix( true, false );
<ide>
<del> this.updateWorldMatrix( true, false );
<add> _m1.getInverse( this.matrixWorld );
<ide>
<del> m.getInverse( this.matrixWorld );
<add> if ( object.parent !== null ) {
<ide>
<del> if ( object.parent !== null ) {
<del>
<del> object.parent.updateWorldMatrix( true, false );
<add> object.parent.updateWorldMatrix( true, false );
<ide>
<del> m.multiply( object.parent.matrixWorld );
<del>
<del> }
<add> _m1.multiply( object.parent.matrixWorld );
<ide>
<del> object.applyMatrix( m );
<add> }
<ide>
<del> object.updateWorldMatrix( false, false );
<add> object.applyMatrix( _m1 );
<ide>
<del> this.add( object );
<add> object.updateWorldMatrix( false, false );
<ide>
<del> return this;
<add> this.add( object );
<ide>
<del> };
<add> return this;
<ide>
<del> }(),
<add> },
<ide>
<ide> getObjectById: function ( id ) {
<ide>
<ide> Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
<ide>
<ide> },
<ide>
<del> getWorldQuaternion: function () {
<add> getWorldQuaternion: function ( target ) {
<ide>
<del> var position = new Vector3();
<del> var scale = new Vector3();
<add> if ( _scale === undefined ) {
<ide>
<del> return function getWorldQuaternion( target ) {
<add> _position = new Vector3();
<add> _scale = new Vector3();
<ide>
<del> if ( target === undefined ) {
<add> }
<ide>
<del> console.warn( 'THREE.Object3D: .getWorldQuaternion() target is now required' );
<del> target = new Quaternion();
<add> if ( target === undefined ) {
<ide>
<del> }
<add> console.warn( 'THREE.Object3D: .getWorldQuaternion() target is now required' );
<add> target = new Quaternion();
<ide>
<del> this.updateMatrixWorld( true );
<add> }
<ide>
<del> this.matrixWorld.decompose( position, target, scale );
<add> this.updateMatrixWorld( true );
<ide>
<del> return target;
<add> this.matrixWorld.decompose( _position, target, _scale );
<ide>
<del> };
<add> return target;
<ide>
<del> }(),
<add> },
<ide>
<del> getWorldScale: function () {
<add> getWorldScale: function ( target ) {
<ide>
<del> var position = new Vector3();
<del> var quaternion = new Quaternion();
<add> if ( _quaternion === undefined ) {
<ide>
<del> return function getWorldScale( target ) {
<add> _position = new Vector3();
<add> _quaternion = new Quaternion();
<ide>
<del> if ( target === undefined ) {
<add> }
<ide>
<del> console.warn( 'THREE.Object3D: .getWorldScale() target is now required' );
<del> target = new Vector3();
<add> if ( target === undefined ) {
<ide>
<del> }
<add> console.warn( 'THREE.Object3D: .getWorldScale() target is now required' );
<add> target = new Vector3();
<ide>
<del> this.updateMatrixWorld( true );
<add> }
<ide>
<del> this.matrixWorld.decompose( position, quaternion, target );
<add> this.updateMatrixWorld( true );
<ide>
<del> return target;
<add> this.matrixWorld.decompose( _position, _quaternion, target );
<ide>
<del> };
<add> return target;
<ide>
<del> }(),
<add> },
<ide>
<ide> getWorldDirection: function ( target ) {
<ide>
<ide><path>src/loaders/Loader.js
<ide> import { Color } from '../math/Color.js';
<ide> * @author alteredq / http://alteredqualia.com/
<ide> */
<ide>
<add>var _BlendingMode, _color, _textureLoader, _materialLoader;
<add>
<ide> function Loader() {}
<ide>
<ide> Loader.Handlers = {
<ide> Object.assign( Loader.prototype, {
<ide>
<ide> },
<ide>
<del> createMaterial: ( function () {
<add> createMaterial: function ( m, texturePath, crossOrigin ) {
<ide>
<del> var BlendingMode = {
<del> NoBlending: NoBlending,
<del> NormalBlending: NormalBlending,
<del> AdditiveBlending: AdditiveBlending,
<del> SubtractiveBlending: SubtractiveBlending,
<del> MultiplyBlending: MultiplyBlending,
<del> CustomBlending: CustomBlending
<del> };
<add> if ( _materialLoader === undefined ) {
<ide>
<del> var color = new Color();
<del> var textureLoader = new TextureLoader();
<del> var materialLoader = new MaterialLoader();
<add> _BlendingMode = {
<add> NoBlending: NoBlending,
<add> NormalBlending: NormalBlending,
<add> AdditiveBlending: AdditiveBlending,
<add> SubtractiveBlending: SubtractiveBlending,
<add> MultiplyBlending: MultiplyBlending,
<add> CustomBlending: CustomBlending
<add> };
<ide>
<del> return function createMaterial( m, texturePath, crossOrigin ) {
<add> _color = new Color();
<add> _textureLoader = new TextureLoader();
<add> _materialLoader = new MaterialLoader();
<add>
<add> }
<ide>
<del> // convert from old material format
<add> // convert from old material format
<ide>
<del> var textures = {};
<add> var textures = {};
<ide>
<del> function loadTexture( path, repeat, offset, wrap, anisotropy ) {
<add> //
<ide>
<del> var fullPath = texturePath + path;
<del> var loader = Loader.Handlers.get( fullPath );
<add> var json = {
<add> uuid: _Math.generateUUID(),
<add> type: 'MeshLambertMaterial'
<add> };
<ide>
<del> var texture;
<add> for ( var name in m ) {
<add>
<add> var value = m[ name ];
<add>
<add> switch ( name ) {
<add>
<add> case 'DbgColor':
<add> case 'DbgIndex':
<add> case 'opticalDensity':
<add> case 'illumination':
<add> break;
<add> case 'DbgName':
<add> json.name = value;
<add> break;
<add> case 'blending':
<add> json.blending = _BlendingMode[ value ];
<add> break;
<add> case 'colorAmbient':
<add> case 'mapAmbient':
<add> console.warn( 'THREE.Loader.createMaterial:', name, 'is no longer supported.' );
<add> break;
<add> case 'colorDiffuse':
<add> json.color = _color.fromArray( value ).getHex();
<add> break;
<add> case 'colorSpecular':
<add> json.specular = _color.fromArray( value ).getHex();
<add> break;
<add> case 'colorEmissive':
<add> json.emissive = _color.fromArray( value ).getHex();
<add> break;
<add> case 'specularCoef':
<add> json.shininess = value;
<add> break;
<add> case 'shading':
<add> if ( value.toLowerCase() === 'basic' ) json.type = 'MeshBasicMaterial';
<add> if ( value.toLowerCase() === 'phong' ) json.type = 'MeshPhongMaterial';
<add> if ( value.toLowerCase() === 'standard' ) json.type = 'MeshStandardMaterial';
<add> break;
<add> case 'mapDiffuse':
<add> json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapDiffuseRepeat':
<add> case 'mapDiffuseOffset':
<add> case 'mapDiffuseWrap':
<add> case 'mapDiffuseAnisotropy':
<add> break;
<add> case 'mapEmissive':
<add> json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapEmissiveRepeat':
<add> case 'mapEmissiveOffset':
<add> case 'mapEmissiveWrap':
<add> case 'mapEmissiveAnisotropy':
<add> break;
<add> case 'mapLight':
<add> json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapLightRepeat':
<add> case 'mapLightOffset':
<add> case 'mapLightWrap':
<add> case 'mapLightAnisotropy':
<add> break;
<add> case 'mapAO':
<add> json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapAORepeat':
<add> case 'mapAOOffset':
<add> case 'mapAOWrap':
<add> case 'mapAOAnisotropy':
<add> break;
<add> case 'mapBump':
<add> json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapBumpScale':
<add> json.bumpScale = value;
<add> break;
<add> case 'mapBumpRepeat':
<add> case 'mapBumpOffset':
<add> case 'mapBumpWrap':
<add> case 'mapBumpAnisotropy':
<add> break;
<add> case 'mapNormal':
<add> json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapNormalFactor':
<add> json.normalScale = value;
<add> break;
<add> case 'mapNormalRepeat':
<add> case 'mapNormalOffset':
<add> case 'mapNormalWrap':
<add> case 'mapNormalAnisotropy':
<add> break;
<add> case 'mapSpecular':
<add> json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapSpecularRepeat':
<add> case 'mapSpecularOffset':
<add> case 'mapSpecularWrap':
<add> case 'mapSpecularAnisotropy':
<add> break;
<add> case 'mapMetalness':
<add> json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapMetalnessRepeat':
<add> case 'mapMetalnessOffset':
<add> case 'mapMetalnessWrap':
<add> case 'mapMetalnessAnisotropy':
<add> break;
<add> case 'mapRoughness':
<add> json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapRoughnessRepeat':
<add> case 'mapRoughnessOffset':
<add> case 'mapRoughnessWrap':
<add> case 'mapRoughnessAnisotropy':
<add> break;
<add> case 'mapAlpha':
<add> json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy, textures, texturePath, crossOrigin );
<add> break;
<add> case 'mapAlphaRepeat':
<add> case 'mapAlphaOffset':
<add> case 'mapAlphaWrap':
<add> case 'mapAlphaAnisotropy':
<add> break;
<add> case 'flipSided':
<add> json.side = BackSide;
<add> break;
<add> case 'doubleSided':
<add> json.side = DoubleSide;
<add> break;
<add> case 'transparency':
<add> console.warn( 'THREE.Loader.createMaterial: transparency has been renamed to opacity' );
<add> json.opacity = value;
<add> break;
<add> case 'depthTest':
<add> case 'depthWrite':
<add> case 'colorWrite':
<add> case 'opacity':
<add> case 'reflectivity':
<add> case 'transparent':
<add> case 'visible':
<add> case 'wireframe':
<add> json[ name ] = value;
<add> break;
<add> case 'vertexColors':
<add> if ( value === true ) json.vertexColors = VertexColors;
<add> if ( value === 'face' ) json.vertexColors = FaceColors;
<add> break;
<add> default:
<add> console.error( 'THREE.Loader.createMaterial: Unsupported', name, value );
<add> break;
<ide>
<del> if ( loader !== null ) {
<add> }
<ide>
<del> texture = loader.load( fullPath );
<add> }
<ide>
<del> } else {
<add> if ( json.type === 'MeshBasicMaterial' ) delete json.emissive;
<add> if ( json.type !== 'MeshPhongMaterial' ) delete json.specular;
<ide>
<del> textureLoader.setCrossOrigin( crossOrigin );
<del> texture = textureLoader.load( fullPath );
<add> if ( json.opacity < 1 ) json.transparent = true;
<ide>
<del> }
<add> _materialLoader.setTextures( textures );
<ide>
<del> if ( repeat !== undefined ) {
<add> return _materialLoader.parse( json );
<ide>
<del> texture.repeat.fromArray( repeat );
<add> }
<ide>
<del> if ( repeat[ 0 ] !== 1 ) texture.wrapS = RepeatWrapping;
<del> if ( repeat[ 1 ] !== 1 ) texture.wrapT = RepeatWrapping;
<add>} );
<ide>
<del> }
<add>function loadTexture( path, repeat, offset, wrap, anisotropy, textures, texturePath, crossOrigin ) {
<ide>
<del> if ( offset !== undefined ) {
<add> var fullPath = texturePath + path;
<add> var loader = Loader.Handlers.get( fullPath );
<ide>
<del> texture.offset.fromArray( offset );
<add> var texture;
<ide>
<del> }
<add> if ( loader !== null ) {
<ide>
<del> if ( wrap !== undefined ) {
<add> texture = loader.load( fullPath );
<ide>
<del> if ( wrap[ 0 ] === 'repeat' ) texture.wrapS = RepeatWrapping;
<del> if ( wrap[ 0 ] === 'mirror' ) texture.wrapS = MirroredRepeatWrapping;
<add> } else {
<ide>
<del> if ( wrap[ 1 ] === 'repeat' ) texture.wrapT = RepeatWrapping;
<del> if ( wrap[ 1 ] === 'mirror' ) texture.wrapT = MirroredRepeatWrapping;
<add> _textureLoader.setCrossOrigin( crossOrigin );
<add> texture = _textureLoader.load( fullPath );
<ide>
<del> }
<add> }
<ide>
<del> if ( anisotropy !== undefined ) {
<add> if ( repeat !== undefined ) {
<ide>
<del> texture.anisotropy = anisotropy;
<add> texture.repeat.fromArray( repeat );
<ide>
<del> }
<add> if ( repeat[ 0 ] !== 1 ) texture.wrapS = RepeatWrapping;
<add> if ( repeat[ 1 ] !== 1 ) texture.wrapT = RepeatWrapping;
<ide>
<del> var uuid = _Math.generateUUID();
<add> }
<ide>
<del> textures[ uuid ] = texture;
<add> if ( offset !== undefined ) {
<ide>
<del> return uuid;
<add> texture.offset.fromArray( offset );
<ide>
<del> }
<add> }
<ide>
<del> //
<add> if ( wrap !== undefined ) {
<ide>
<del> var json = {
<del> uuid: _Math.generateUUID(),
<del> type: 'MeshLambertMaterial'
<del> };
<add> if ( wrap[ 0 ] === 'repeat' ) texture.wrapS = RepeatWrapping;
<add> if ( wrap[ 0 ] === 'mirror' ) texture.wrapS = MirroredRepeatWrapping;
<ide>
<del> for ( var name in m ) {
<del>
<del> var value = m[ name ];
<del>
<del> switch ( name ) {
<del>
<del> case 'DbgColor':
<del> case 'DbgIndex':
<del> case 'opticalDensity':
<del> case 'illumination':
<del> break;
<del> case 'DbgName':
<del> json.name = value;
<del> break;
<del> case 'blending':
<del> json.blending = BlendingMode[ value ];
<del> break;
<del> case 'colorAmbient':
<del> case 'mapAmbient':
<del> console.warn( 'THREE.Loader.createMaterial:', name, 'is no longer supported.' );
<del> break;
<del> case 'colorDiffuse':
<del> json.color = color.fromArray( value ).getHex();
<del> break;
<del> case 'colorSpecular':
<del> json.specular = color.fromArray( value ).getHex();
<del> break;
<del> case 'colorEmissive':
<del> json.emissive = color.fromArray( value ).getHex();
<del> break;
<del> case 'specularCoef':
<del> json.shininess = value;
<del> break;
<del> case 'shading':
<del> if ( value.toLowerCase() === 'basic' ) json.type = 'MeshBasicMaterial';
<del> if ( value.toLowerCase() === 'phong' ) json.type = 'MeshPhongMaterial';
<del> if ( value.toLowerCase() === 'standard' ) json.type = 'MeshStandardMaterial';
<del> break;
<del> case 'mapDiffuse':
<del> json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy );
<del> break;
<del> case 'mapDiffuseRepeat':
<del> case 'mapDiffuseOffset':
<del> case 'mapDiffuseWrap':
<del> case 'mapDiffuseAnisotropy':
<del> break;
<del> case 'mapEmissive':
<del> json.emissiveMap = loadTexture( value, m.mapEmissiveRepeat, m.mapEmissiveOffset, m.mapEmissiveWrap, m.mapEmissiveAnisotropy );
<del> break;
<del> case 'mapEmissiveRepeat':
<del> case 'mapEmissiveOffset':
<del> case 'mapEmissiveWrap':
<del> case 'mapEmissiveAnisotropy':
<del> break;
<del> case 'mapLight':
<del> json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy );
<del> break;
<del> case 'mapLightRepeat':
<del> case 'mapLightOffset':
<del> case 'mapLightWrap':
<del> case 'mapLightAnisotropy':
<del> break;
<del> case 'mapAO':
<del> json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy );
<del> break;
<del> case 'mapAORepeat':
<del> case 'mapAOOffset':
<del> case 'mapAOWrap':
<del> case 'mapAOAnisotropy':
<del> break;
<del> case 'mapBump':
<del> json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy );
<del> break;
<del> case 'mapBumpScale':
<del> json.bumpScale = value;
<del> break;
<del> case 'mapBumpRepeat':
<del> case 'mapBumpOffset':
<del> case 'mapBumpWrap':
<del> case 'mapBumpAnisotropy':
<del> break;
<del> case 'mapNormal':
<del> json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy );
<del> break;
<del> case 'mapNormalFactor':
<del> json.normalScale = value;
<del> break;
<del> case 'mapNormalRepeat':
<del> case 'mapNormalOffset':
<del> case 'mapNormalWrap':
<del> case 'mapNormalAnisotropy':
<del> break;
<del> case 'mapSpecular':
<del> json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy );
<del> break;
<del> case 'mapSpecularRepeat':
<del> case 'mapSpecularOffset':
<del> case 'mapSpecularWrap':
<del> case 'mapSpecularAnisotropy':
<del> break;
<del> case 'mapMetalness':
<del> json.metalnessMap = loadTexture( value, m.mapMetalnessRepeat, m.mapMetalnessOffset, m.mapMetalnessWrap, m.mapMetalnessAnisotropy );
<del> break;
<del> case 'mapMetalnessRepeat':
<del> case 'mapMetalnessOffset':
<del> case 'mapMetalnessWrap':
<del> case 'mapMetalnessAnisotropy':
<del> break;
<del> case 'mapRoughness':
<del> json.roughnessMap = loadTexture( value, m.mapRoughnessRepeat, m.mapRoughnessOffset, m.mapRoughnessWrap, m.mapRoughnessAnisotropy );
<del> break;
<del> case 'mapRoughnessRepeat':
<del> case 'mapRoughnessOffset':
<del> case 'mapRoughnessWrap':
<del> case 'mapRoughnessAnisotropy':
<del> break;
<del> case 'mapAlpha':
<del> json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );
<del> break;
<del> case 'mapAlphaRepeat':
<del> case 'mapAlphaOffset':
<del> case 'mapAlphaWrap':
<del> case 'mapAlphaAnisotropy':
<del> break;
<del> case 'flipSided':
<del> json.side = BackSide;
<del> break;
<del> case 'doubleSided':
<del> json.side = DoubleSide;
<del> break;
<del> case 'transparency':
<del> console.warn( 'THREE.Loader.createMaterial: transparency has been renamed to opacity' );
<del> json.opacity = value;
<del> break;
<del> case 'depthTest':
<del> case 'depthWrite':
<del> case 'colorWrite':
<del> case 'opacity':
<del> case 'reflectivity':
<del> case 'transparent':
<del> case 'visible':
<del> case 'wireframe':
<del> json[ name ] = value;
<del> break;
<del> case 'vertexColors':
<del> if ( value === true ) json.vertexColors = VertexColors;
<del> if ( value === 'face' ) json.vertexColors = FaceColors;
<del> break;
<del> default:
<del> console.error( 'THREE.Loader.createMaterial: Unsupported', name, value );
<del> break;
<del>
<del> }
<add> if ( wrap[ 1 ] === 'repeat' ) texture.wrapT = RepeatWrapping;
<add> if ( wrap[ 1 ] === 'mirror' ) texture.wrapT = MirroredRepeatWrapping;
<ide>
<del> }
<add> }
<ide>
<del> if ( json.type === 'MeshBasicMaterial' ) delete json.emissive;
<del> if ( json.type !== 'MeshPhongMaterial' ) delete json.specular;
<add> if ( anisotropy !== undefined ) {
<ide>
<del> if ( json.opacity < 1 ) json.transparent = true;
<add> texture.anisotropy = anisotropy;
<ide>
<del> materialLoader.setTextures( textures );
<add> }
<ide>
<del> return materialLoader.parse( json );
<add> var uuid = _Math.generateUUID();
<ide>
<del> };
<add> textures[ uuid ] = texture;
<ide>
<del> } )()
<add> return uuid;
<ide>
<del>} );
<add>}
<ide>
<ide> export { Loader };
<ide><path>src/polyfills.js
<ide> if ( Object.assign === undefined ) {
<ide> // Missing in IE
<ide> // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
<ide>
<del> ( function () {
<add> Object.assign = function ( target ) {
<ide>
<del> Object.assign = function ( target ) {
<add> 'use strict';
<ide>
<del> 'use strict';
<add> if ( target === undefined || target === null ) {
<ide>
<del> if ( target === undefined || target === null ) {
<add> throw new TypeError( 'Cannot convert undefined or null to object' );
<ide>
<del> throw new TypeError( 'Cannot convert undefined or null to object' );
<del>
<del> }
<del>
<del> var output = Object( target );
<add> }
<ide>
<del> for ( var index = 1; index < arguments.length; index ++ ) {
<add> var output = Object( target );
<ide>
<del> var source = arguments[ index ];
<add> for ( var index = 1; index < arguments.length; index ++ ) {
<ide>
<del> if ( source !== undefined && source !== null ) {
<add> var source = arguments[ index ];
<ide>
<del> for ( var nextKey in source ) {
<add> if ( source !== undefined && source !== null ) {
<ide>
<del> if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
<add> for ( var nextKey in source ) {
<ide>
<del> output[ nextKey ] = source[ nextKey ];
<add> if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
<ide>
<del> }
<add> output[ nextKey ] = source[ nextKey ];
<ide>
<ide> }
<ide>
<ide> }
<ide>
<ide> }
<ide>
<del> return output;
<add> }
<ide>
<del> };
<add> return output;
<ide>
<del> } )();
<add> };
<ide>
<ide> }
| 7
|
Javascript
|
Javascript
|
make normals and uvs optional
|
0ed9bdc25b3b5474c3797ade3f444a506f3e0a99
|
<ide><path>examples/js/loaders/SVGLoader.js
<ide> THREE.SVGLoader.pointsToStrokeWithBuffers = function () {
<ide> // This function can be called to update existing arrays or buffers.
<ide> // Accepts same parameters as pointsToStroke, plus the buffers and optional offset.
<ide> // Param vertexOffset: Offset vertices to start writing in the buffers (3 elements/vertex for vertices and normals, and 2 elements/vertex for uvs)
<del> // Returns number of written vertices / normals / uvs
<add> // Returns number of written vertices / normals / uvs pairs
<ide> // if 'vertices' parameter is undefined no triangles will be generated, but the returned vertices count will still be valid (useful to preallocate the buffers)
<add> // 'normals' and 'uvs' buffers are optional
<ide>
<ide> arcLengthDivisions = arcDivisions !== undefined ? arcDivisions : 12;
<ide> minDistance = minDistance !== undefined ? minDistance : 0.001;
<ide> THREE.SVGLoader.pointsToStrokeWithBuffers = function () {
<ide> vertices[ currentCoordinate + 1 ] = position.y;
<ide> vertices[ currentCoordinate + 2 ] = 0;
<ide>
<del> normals[ currentCoordinate ] = 0;
<del> normals[ currentCoordinate + 1 ] = 0;
<del> normals[ currentCoordinate + 2 ] = 1;
<add> if ( normals ) {
<ide>
<del> uvs[ currentCoordinateUV ] = u;
<del> uvs[ currentCoordinateUV + 1 ] = v;
<add> normals[ currentCoordinate ] = 0;
<add> normals[ currentCoordinate + 1 ] = 0;
<add> normals[ currentCoordinate + 2 ] = 1;
<add>
<add> }
<ide>
<ide> currentCoordinate += 3;
<del> currentCoordinateUV += 2;
<add>
<add> if ( uvs ) {
<add>
<add> uvs[ currentCoordinateUV ] = u;
<add> uvs[ currentCoordinateUV + 1 ] = v;
<add>
<add> currentCoordinateUV += 2;
<add>
<add> }
<ide>
<ide> }
<ide>
| 1
|
Python
|
Python
|
add ufunc argument parsing benchmarks
|
2fa37890ccba346629e574ad1411928fb52cff43
|
<ide><path>benchmarks/benchmarks/bench_ufunc.py
<ide> def time_add_scalar_conv(self):
<ide>
<ide> def time_add_scalar_conv_complex(self):
<ide> (self.y + self.z)
<add>
<add>
<add>class ArgParsing(Benchmark):
<add> # In order to benchmark the speed of argument parsing, all but the
<add> # out arguments are chosen such that they have no effect on the
<add> # calculation. In particular, subok=True and where=True are
<add> # defaults, and the dtype is the correct one (the latter will
<add> # still have some effect on the search for the correct inner loop).
<add> x = np.array(1.)
<add> y = np.array(2.)
<add> out = np.array(3.)
<add> param_names = ['arg_kwarg']
<add> params = [[
<add> ((x, y), dict()),
<add> ((x, y, out), dict()),
<add> ((x, y), dict(out=out)),
<add> ((x, y), dict(out=(out,))),
<add> ((x, y), dict(out=out, subok=True, where=True)),
<add> ((x, y), dict(subok=True)),
<add> ((x, y), dict(subok=True, where=True)),
<add> ((x, y, out), dict(subok=True, where=True))
<add> ]]
<add>
<add> def time_add_arg_parsing(self, arg_kwarg):
<add> np.add(*arg_kwarg[0], **arg_kwarg[1])
<add>
<add>
<add>class ArgParsingReduce(Benchmark):
<add> # In order to benchmark the speed of argument parsing, all but the
<add> # out arguments are chosen such that they have minimal effect on the
<add> # calculation.
<add> a = np.arange(2.)
<add> out = np.array(0.)
<add> param_names = ['arg_kwarg']
<add> params = [[
<add> ((a,), dict()),
<add> ((a, 0), dict()),
<add> ((a,), dict(axis=0)),
<add> ((a, 0, None), dict()),
<add> ((a,), dict(axis=0, dtype=None)),
<add> ((a, 0, None, out), dict()),
<add> ((a,), dict(axis=0, dtype=None, out=out)),
<add> ((a,), dict(out=out))
<add> ]]
<add>
<add> def time_add_reduce_arg_parsing(self, arg_kwarg):
<add> np.add.reduce(*arg_kwarg[0], **arg_kwarg[1])
| 1
|
Text
|
Text
|
clarify fs.utimes() arguments
|
99ab686cd3684b965e40e85f96d089f8ef437fa1
|
<ide><path>doc/api/fs.md
<ide> added: v0.1.31
<ide> Asynchronous realpath(3). The `callback` gets two arguments `(err,
<ide> resolvedPath)`. May use `process.cwd` to resolve relative paths.
<ide>
<del>Only paths that can be converted to UTF8 strings are supported.
<add>Only paths that can be converted to UTF8 strings are supported.
<ide>
<ide> The optional `options` argument can be a string specifying an encoding, or an
<ide> object with an `encoding` property specifying the character encoding to use for
<ide> added: v0.4.2
<ide>
<ide> Change file timestamps of the file referenced by the supplied path.
<ide>
<del>Note: the arguments `atime` and `mtime` of the following related functions does
<del>follow the below rules:
<add>Note: the arguments `atime` and `mtime` of the following related functions
<add>follow these rules:
<ide>
<del>- If the value is a numberable string like `'123456789'`, the value would get
<del> converted to corresponding number.
<del>- If the value is `NaN` or `Infinity`, the value would get converted to
<del> `Date.now()`.
<add>- The value should be a Unix timestamp in seconds. For example, `Date.now()`
<add> returns milliseconds, so it should be divided by 1000 before passing it in.
<add>- If the value is a numeric string like `'123456789'`, the value will get
<add> converted to the corresponding number.
<add>- If the value is `NaN` or `Infinity`, the value will get converted to
<add> `Date.now() / 1000`.
<ide>
<ide> ## fs.utimesSync(path, atime, mtime)
<ide> <!-- YAML
| 1
|
Ruby
|
Ruby
|
overwrite broken symlinks with --overwrite
|
ba93e6d3630c6007290567f160a9a16bc17253c5
|
<ide><path>Library/Homebrew/extend/pathname.rb
<ide> def make_relative_symlink src
<ide> raise <<-EOS.undent
<ide> Could not symlink file: #{src.expand_path}
<ide> Target #{self} already exists. You may need to delete it.
<del> To force the link and delete this file, do:
<add> To force the link and overwrite all other conflicting files, do:
<add> brew link --overwrite formula_name
<add>
<add> To list all files that would be deleted:
<add> brew link --overwrite --dry-run formula_name
<add> EOS
<add> # #exist? will return false for symlinks whose target doesn't exist
<add> elsif self.symlink?
<add> raise <<-EOS.undent
<add> Could not symlink file: #{src.expand_path}
<add> Target #{self} already exists as a symlink to #{readlink}.
<add> If this file is from another formula, you may need to
<add> `brew unlink` it. Otherwise, you may want to delete it.
<add> To force the link and overwrite all other conflicting files, do:
<ide> brew link --overwrite formula_name
<ide>
<ide> To list all files that would be deleted:
<ide><path>Library/Homebrew/keg.rb
<ide> def make_relative_symlink dst, src, mode=OpenStruct.new
<ide> puts "Skipping; already exists: #{dst}" if ARGV.verbose?
<ide> # cf. git-clean -n: list files to delete, don't really link or delete
<ide> elsif mode.dry_run and mode.overwrite
<del> puts dst if dst.exist?
<add> puts dst if dst.exist? or dst.symlink?
<ide> return
<ide> # list all link targets
<ide> elsif mode.dry_run
<ide> puts dst
<ide> return
<ide> else
<del> dst.delete if mode.overwrite && dst.exist?
<add> dst.delete if mode.overwrite && (dst.exist? or dst.symlink?)
<ide> dst.make_relative_symlink src
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/test_keg.rb
<ide> def test_link_overwrite
<ide> assert_equal 3, @keg.link(mode)
<ide> end
<ide>
<add> def test_link_overwrite_broken_symlinks
<add> FileUtils.cd HOMEBREW_PREFIX/"bin" do
<add> FileUtils.ln_s "nowhere", "helloworld"
<add> end
<add> mode = OpenStruct.new
<add> mode.overwrite = true
<add> assert_equal 3, @keg.link(mode)
<add> end
<add>
<ide> def test_link_overwrite_dryrun
<ide> FileUtils.touch HOMEBREW_PREFIX/"bin/helloworld"
<ide> mode = OpenStruct.new
| 3
|
Javascript
|
Javascript
|
fix memory leak in ie
|
d72b8307de97a715c8916d571278b4bc35be23a6
|
<ide><path>src/selector.js
<ide>
<ide> var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
<ide> done = 0,
<del> toString = Object.prototype.toString;
<add> toString = Object.prototype.toString,
<add> hasDuplicate = false;
<ide>
<ide> var Sizzle = function(selector, context, results, seed) {
<ide> results = results || [];
<ide> var Sizzle = function(selector, context, results, seed) {
<ide> if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
<ide> return [];
<ide> }
<del>
<add>
<ide> if ( !selector || typeof selector !== "string" ) {
<ide> return results;
<ide> }
<ide>
<ide> var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context);
<del>
<add>
<ide> // Reset the position of the chunker regexp (start from head)
<ide> chunker.lastIndex = 0;
<del>
<add>
<ide> while ( (m = chunker.exec(selector)) !== null ) {
<ide> parts.push( m[1] );
<del>
<add>
<ide> if ( m[2] ) {
<ide> extra = RegExp.rightContext;
<ide> break;
<ide> Sizzle.find = function(expr, context, isXML){
<ide>
<ide> for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
<ide> var type = Expr.order[i], match;
<del>
<add>
<ide> if ( (match = Expr.match[ type ].exec( expr )) ) {
<ide> var left = RegExp.leftContext;
<ide>
<ide> var Expr = Sizzle.selectors = {
<ide> },
<ide> ATTR: function(match, curLoop, inplace, result, not, isXML){
<ide> var name = match[1].replace(/\\/g, "");
<del>
<add>
<ide> if ( !isXML && Expr.attrMap[name] ) {
<ide> match[1] = Expr.attrMap[name];
<ide> }
<ide> var Expr = Sizzle.selectors = {
<ide> } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
<ide> return true;
<ide> }
<del>
<add>
<ide> return match;
<ide> },
<ide> POS: function(match){
<ide> var Expr = Sizzle.selectors = {
<ide> if ( first == 1 && last == 0 ) {
<ide> return true;
<ide> }
<del>
<add>
<ide> var doneName = match[0],
<ide> parent = elem.parentNode;
<del>
<add>
<ide> if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
<ide> var count = 0;
<ide> for ( node = parent.firstChild; node; node = node.nextSibling ) {
<ide> if ( node.nodeType === 1 ) {
<ide> node.nodeIndex = ++count;
<ide> }
<del> }
<add> }
<ide> parent.sizcache = doneName;
<ide> }
<del>
<add>
<ide> var diff = elem.nodeIndex - last;
<ide> if ( first == 0 ) {
<ide> return diff == 0;
<ide> var makeArray = function(array, results) {
<ide> results.push.apply( results, array );
<ide> return results;
<ide> }
<del>
<add>
<ide> return array;
<ide> };
<ide>
<ide> if ( document.documentElement.compareDocumentPosition ) {
<ide> }
<ide>
<ide> root.removeChild( form );
<add> root = form = null; // release memory in IE
<ide> })();
<ide>
<ide> (function(){
<ide> if ( document.documentElement.compareDocumentPosition ) {
<ide> return elem.getAttribute("href", 2);
<ide> };
<ide> }
<add>
<add> div = null; // release memory in IE
<ide> })();
<ide>
<ide> if ( document.querySelectorAll ) (function(){
<ide> if ( document.querySelectorAll ) (function(){
<ide> if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
<ide> return;
<ide> }
<del>
<add>
<ide> Sizzle = function(query, context, extra, seed){
<ide> context = context || document;
<ide>
<ide> if ( document.querySelectorAll ) (function(){
<ide> return makeArray( context.querySelectorAll(query), extra );
<ide> } catch(e){}
<ide> }
<del>
<add>
<ide> return oldSizzle(query, context, extra, seed);
<ide> };
<ide>
<ide> for ( var prop in oldSizzle ) {
<ide> Sizzle[ prop ] = oldSizzle[ prop ];
<ide> }
<add>
<add> div = null; // release memory in IE
<ide> })();
<ide>
<ide> if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
<ide> if ( document.getElementsByClassName && document.documentElement.getElementsByCl
<ide> return context.getElementsByClassName(match[1]);
<ide> }
<ide> };
<add>
<add> div = null; // release memory in IE
<ide> })();
<ide>
<ide> function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
<ide> jQuery.expr = Sizzle.selectors;
<ide> jQuery.expr[":"] = jQuery.expr.filters;
<ide>
<ide> Sizzle.selectors.filters.hidden = function(elem){
<del> return elem.offsetWidth === 0 && elem.offsetHeight === 0;
<add> return elem.offsetWidth === 0 || elem.offsetHeight === 0;
<ide> };
<ide>
<ide> Sizzle.selectors.filters.visible = function(elem){
| 1
|
Javascript
|
Javascript
|
change didinit event to just init
|
39d6bd88ae6ad0d465aec6dd6636ffd07d32a3c2
|
<ide><path>packages/ember-runtime/lib/system/core_object.js
<ide> function makeCtor() {
<ide> m.proto = proto;
<ide> finishChains(this);
<ide> this.init.apply(this, arguments);
<del> sendEvent(this, "didInit");
<add> sendEvent(this, "init");
<ide> };
<ide>
<ide> Class.toString = Mixin.prototype.toString;
<ide><path>packages/ember-runtime/tests/system/object/create_test.js
<ide> test("Calls all mixin inits if defined", function() {
<ide> equal(completed, 2, 'should have called init for both mixins.');
<ide> });
<ide>
<del>test("Triggers didInit", function() {
<add>test("Triggers init", function() {
<ide> var completed = false;
<ide> var obj = Ember.Object.createWithMixins({
<del> markAsCompleted: Ember.on("didInit", function(){
<add> markAsCompleted: Ember.on("init", function(){
<ide> completed = true;
<ide> })
<ide> });
<ide>
<del> ok(completed, 'should have triggered didInit which should have run markAsCompleted');
<add> ok(completed, 'should have triggered init which should have run markAsCompleted');
<ide> });
<ide>
<ide> test('creating an object with required properties', function() {
| 2
|
Ruby
|
Ruby
|
fix invalid range in comparison
|
5ee797eb610205c232ab6d5f76c68bfc5834f6b9
|
<ide><path>Library/Homebrew/os/mac/xcode.rb
<ide> def uncached_version
<ide> case MacOS.llvm_build_version.to_i
<ide> when 1..2063 then "3.1.0"
<ide> when 2064..2065 then "3.1.4"
<del> when 2366..2325
<add> when 2066..2325
<ide> # we have no data for this range so we are guessing
<ide> "3.2.0"
<ide> when 2326
| 1
|
Python
|
Python
|
add support for dynamic rnns in tensorflow.
|
08014eea360fd8d66b7baab19cdb9335f52c167b
|
<ide><path>examples/imdb_lstm.py
<ide> '''Trains a LSTM on the IMDB sentiment classification task.
<del>
<ide> The dataset is actually too small for LSTM to be of any advantage
<ide> compared to simpler, much faster methods such as TF-IDF + LogReg.
<del>
<ide> Notes:
<ide>
<ide> - RNNs are tricky. Choice of batch size is important,
<ide><path>keras/backend/tensorflow_backend.py
<ide> def repeat(x, n):
<ide> the output will have shape (samples, 2, dim)
<ide> '''
<ide> assert ndim(x) == 2
<del> tensors = [x] * n
<del> stacked = tf.pack(tensors)
<del> return tf.transpose(stacked, (1, 0, 2))
<add> x = tf.expand_dims(x, 1)
<add> pattern = tf.pack([1, n, 1])
<add> return tf.tile(x, pattern)
<ide>
<ide>
<ide> def tile(x, n):
<del> if not hasattr(n, 'shape') and not hasattr(n, '__len__'):
<add> if not hasattr(n, 'shape') and not hasattr(n, '__len__') and not hasattr(n, '_shape'):
<ide> n = [n]
<ide> return tf.tile(x, n)
<ide>
<ide> def rnn(step_function, inputs, initial_states,
<ide> time step.
<ide> states: list of tensors.
<ide> Returns:
<del> output: tensor with shape (samples, ...) (no time dimension),
<add> output: tensor with shape (samples, output_dim) (no time dimension),
<ide> new_states: list of tensors, same length and shapes
<del> as 'states'.
<del> initial_states: tensor with shape (samples, ...) (no time dimension),
<add> as 'states'. The first state in the list must be the
<add> output tensor at the previous timestep.
<add> initial_states: tensor with shape (samples, output_dim) (no time dimension),
<ide> containing the initial values for the states used in
<ide> the step function.
<ide> go_backwards: boolean. If True, do the iteration over
<ide> def rnn(step_function, inputs, initial_states,
<ide> the step function, of shape (samples, ...).
<ide> '''
<ide> ndim = len(inputs.get_shape())
<del> assert ndim >= 3, "Input should be at least 3D."
<add> assert ndim >= 3, 'Input should be at least 3D.'
<ide> axes = [1, 0] + list(range(2, ndim))
<ide> inputs = tf.transpose(inputs, (axes))
<del> input_list = tf.unpack(inputs)
<add>
<ide> if constants is None:
<ide> constants = []
<ide>
<del> states = initial_states
<del> successive_states = []
<del> successive_outputs = []
<del> if go_backwards:
<del> input_list.reverse()
<add> if unroll:
<add> if not inputs.get_shape()[0]:
<add> raise Exception('Unrolling requires a fixed number of timesteps.')
<ide>
<del> if mask is not None:
<del> # Transpose not supported by bool tensor types, hence round-trip to uint8.
<del> mask = tf.cast(mask, tf.uint8)
<del> if len(mask.get_shape()) == ndim-1:
<del> mask = expand_dims(mask)
<del> mask = tf.cast(tf.transpose(mask, axes), tf.bool)
<del> mask_list = tf.unpack(mask)
<add> states = initial_states
<add> successive_states = []
<add> successive_outputs = []
<ide>
<add> input_list = tf.unpack(inputs)
<ide> if go_backwards:
<del> mask_list.reverse()
<add> input_list.reverse()
<add>
<add> if mask is not None:
<add> # Transpose not supported by bool tensor types, hence round-trip to uint8.
<add> mask = tf.cast(mask, tf.uint8)
<add> if len(mask.get_shape()) == ndim - 1:
<add> mask = expand_dims(mask)
<add> mask = tf.cast(tf.transpose(mask, axes), tf.bool)
<add> mask_list = tf.unpack(mask)
<add>
<add> if go_backwards:
<add> mask_list.reverse()
<add>
<add> for input, mask_t in zip(input_list, mask_list):
<add> output, new_states = step_function(input, states + constants)
<add>
<add> # tf.select needs its condition tensor to be the same shape as its two
<add> # result tensors, but in our case the condition (mask) tensor is
<add> # (nsamples, 1), and A and B are (nsamples, ndimensions). So we need to
<add> # broadcast the mask to match the shape of A and B. That's what the
<add> # tile call does, is just repeat the mask along its second dimension
<add> # ndimensions times.
<add> tiled_mask_t = tf.tile(mask_t, tf.pack([1, tf.shape(output)[1]]))
<add>
<add> if len(successive_outputs) == 0:
<add> prev_output = zeros_like(output)
<add> else:
<add> prev_output = successive_outputs[-1]
<add>
<add> output = tf.select(tiled_mask_t, output, prev_output)
<add>
<add> return_states = []
<add> for state, new_state in zip(states, new_states):
<add> # (see earlier comment for tile explanation)
<add> tiled_mask_t = tf.tile(mask_t, tf.pack([1, tf.shape(new_state)[1]]))
<add> return_states.append(tf.select(tiled_mask_t, new_state, state))
<add>
<add> states = return_states
<add> successive_outputs.append(output)
<add> successive_states.append(states)
<add> last_output = successive_outputs[-1]
<add> new_states = successive_states[-1]
<add> outputs = tf.pack(successive_outputs)
<add> else:
<add> for input in input_list:
<add> output, states = step_function(input, states + constants)
<add> successive_outputs.append(output)
<add> successive_states.append(states)
<add> last_output = successive_outputs[-1]
<add> new_states = successive_states[-1]
<add> outputs = tf.pack(successive_outputs)
<ide>
<del> for input, mask_t in zip(input_list, mask_list):
<del> output, new_states = step_function(input, states + constants)
<add> else:
<add> from tensorflow.python.ops.rnn import _dynamic_rnn_loop
<ide>
<del> # tf.select needs its condition tensor to be the same shape as its two
<del> # result tensors, but in our case the condition (mask) tensor is
<del> # (nsamples, 1), and A and B are (nsamples, ndimensions). So we need to
<del> # broadcast the mask to match the shape of A and B. That's what the
<del> # tile call does, is just repeat the mask along its second dimension
<del> # ndimensions times.
<del> tiled_mask_t = tf.tile(mask_t, tf.pack([1, tf.shape(output)[1]]))
<add> if go_backwards:
<add> inputs = tf.reverse(inputs, [True, False, False])
<add>
<add> states = initial_states
<add> nb_states = len(states)
<add> if nb_states == 0:
<add> raise Exception('No initial states provided.')
<add> elif nb_states == 1:
<add> state = states[0]
<add> else:
<add> state = tf.concat(1, states)
<add>
<add> state_size = int(states[0].get_shape()[-1])
<add>
<add> if mask is not None:
<add> if go_backwards:
<add> mask = tf.reverse(mask, [True, False, False])
<add>
<add> # Transpose not supported by bool tensor types, hence round-trip to uint8.
<add> mask = tf.cast(mask, tf.uint8)
<add> if len(mask.get_shape()) == ndim - 1:
<add> mask = expand_dims(mask)
<add> mask = tf.transpose(mask, axes)
<add> inputs = tf.concat(2, [tf.cast(mask, inputs.dtype), inputs])
<add>
<add> def _step(input, state):
<add> if nb_states > 1:
<add> states = []
<add> for i in range(nb_states):
<add> states.append(state[:, i * state_size: (i + 1) * state_size])
<add> else:
<add> states = [state]
<add> mask_t = tf.cast(input[:, 0], tf.bool)
<add> input = input[:, 1:]
<add> output, new_states = step_function(input, states + constants)
<ide>
<del> if len(successive_outputs) == 0:
<del> prev_output = zeros_like(output)
<del> else:
<del> prev_output = successive_outputs[-1]
<add> output = tf.select(mask_t, output, states[0])
<add> new_states = [tf.select(mask_t, new_states[i], states[i]) for i in range(len(states))]
<ide>
<del> output = tf.select(tiled_mask_t, output, prev_output)
<add> if len(new_states) == 1:
<add> new_state = new_states[0]
<add> else:
<add> new_state = tf.concat(1, new_states)
<ide>
<del> return_states = []
<del> for state, new_state in zip(states, new_states):
<del> # (see earlier comment for tile explanation)
<del> tiled_mask_t = tf.tile(mask_t, tf.pack([1, tf.shape(new_state)[1]]))
<del> return_states.append(tf.select(tiled_mask_t, new_state, state))
<add> return output, new_state
<add> else:
<add> def _step(input, state):
<add> if nb_states > 1:
<add> states = []
<add> for i in range(nb_states):
<add> states.append(state[:, i * state_size: (i + 1) * state_size])
<add> else:
<add> states = [state]
<add> output, new_states = step_function(input, states + constants)
<ide>
<del> states = return_states
<del> successive_outputs.append(output)
<del> successive_states.append(states)
<del> else:
<del> for input in input_list:
<del> output, states = step_function(input, states + constants)
<del> successive_outputs.append(output)
<del> successive_states.append(states)
<del>
<del> last_output = successive_outputs[-1]
<del> outputs = tf.pack(successive_outputs)
<del> new_states = successive_states[-1]
<add> if len(new_states) == 1:
<add> new_state = new_states[0]
<add> else:
<add> new_state = tf.concat(1, new_states)
<add> return output, new_state
<add>
<add> # state size is assumed to be the same as output size
<add> # (always the case)
<add> _step.state_size = state_size * nb_states
<add> _step.output_size = state_size
<add>
<add> (outputs, final_state) = _dynamic_rnn_loop(
<add> _step,
<add> inputs,
<add> state,
<add> parallel_iterations=32,
<add> swap_memory=True,
<add> sequence_length=None)
<add>
<add> if nb_states > 1:
<add> new_states = []
<add> for i in range(nb_states):
<add> new_states.append(final_state[:, i * state_size: (i + 1) * state_size])
<add> else:
<add> new_states = [final_state]
<add>
<add> # all this circus is to recover the last vector in the sequence.
<add> begin = tf.pack([tf.shape(outputs)[0] - 1, 0, 0])
<add> size = tf.pack([1, -1, -1])
<add> last_output = tf.slice(outputs, begin, size)
<add> last_output = tf.squeeze(last_output, [0])
<ide>
<ide> axes = [1, 0] + list(range(2, len(outputs.get_shape())))
<ide> outputs = tf.transpose(outputs, axes)
<ide><path>keras/layers/recurrent.py
<ide> def time_distributed_dense(x, w, b=None, dropout=None,
<ide> '''Apply y.w + b for every temporal slice y of x.
<ide> '''
<ide> if not input_dim:
<del> # won't work with TensorFlow
<ide> input_dim = K.shape(x)[2]
<ide> if not timesteps:
<del> # won't work with TensorFlow
<ide> timesteps = K.shape(x)[1]
<ide> if not output_dim:
<del> # won't work with TensorFlow
<ide> output_dim = K.shape(w)[1]
<ide>
<ide> if dropout is not None and 0. < dropout < 1.:
<ide> def time_distributed_dense(x, w, b=None, dropout=None,
<ide>
<ide> # collapse time dimension and batch dimension together
<ide> x = K.reshape(x, (-1, input_dim))
<del>
<ide> x = K.dot(x, w)
<ide> if b:
<ide> x = x + b
<ide> # reshape to 3D tensor
<del> x = K.reshape(x, (-1, timesteps, output_dim))
<add> x = K.reshape(x, K.pack([-1, timesteps, output_dim]))
<add> if K.backend() == 'tensorflow':
<add> x.set_shape([None, None, output_dim])
<ide> return x
<ide>
<ide>
<ide> class Recurrent(Layer):
<ide> use an [Embedding](embeddings.md) layer with the `mask_zero` parameter
<ide> set to `True`.
<ide>
<del> # TensorFlow warning
<del> For the time being, when using the TensorFlow backend,
<del> the number of timesteps used must be specified in your model.
<del> Make sure to pass an `input_length` int argument to your
<del> recurrent layer (if it comes first in your model),
<del> or to pass a complete `input_shape` argument to the first layer
<del> in your model otherwise.
<del>
<add> # Note on performance
<add> You will see much better performance with RNNs in Theano compared to
<add> TensorFlow. Additionally, when using TensorFlow, it is preferable
<add> to set `unroll=True` for better performance.
<ide>
<ide> # Note on using statefulness in RNNs
<ide> You can set RNN layers to be 'stateful', which means that the states
<ide> class Recurrent(Layer):
<ide>
<ide> To reset the states of your model, call `.reset_states()` on either
<ide> a specific layer, or on your entire model.
<del>
<del> # Note on using dropout with TensorFlow
<del> When using the TensorFlow backend, specify a fixed batch size for your model
<del> following the notes on statefulness RNNs.
<ide> '''
<ide> def __init__(self, weights=None,
<ide> return_sequences=False, go_backwards=False, stateful=False,
<ide> def call(self, x, mask=None):
<ide> # note that the .build() method of subclasses MUST define
<ide> # self.input_spec with a complete input shape.
<ide> input_shape = self.input_spec[0].shape
<del> if K._BACKEND == 'tensorflow':
<del> if not input_shape[1]:
<del> raise Exception('When using TensorFlow, you should define '
<del> 'explicitly the number of timesteps of '
<del> 'your sequences.\n'
<del> 'If your first layer is an Embedding, '
<del> 'make sure to pass it an "input_length" '
<del> 'argument. Otherwise, make sure '
<del> 'the first layer has '
<del> 'an "input_shape" or "batch_input_shape" '
<del> 'argument, including the time axis. '
<del> 'Found input shape at layer ' + self.name +
<del> ': ' + str(input_shape))
<ide> if self.stateful:
<ide> initial_states = self.states
<ide> else:
<ide><path>tests/keras/backend/test_backends.py
<ide> def step_function(x, states):
<ide> return output, [output]
<ide> return step_function
<ide>
<add> # test default setup
<ide> th_rnn_step_fn = rnn_step_fn(input_dim, output_dim, KTH)
<ide> th_inputs = KTH.variable(input_val)
<ide> th_initial_states = [KTH.variable(init_state_val)]
<ide> def step_function(x, states):
<ide> assert_allclose(th_outputs, unrolled_th_outputs, atol=1e-04)
<ide> assert_allclose(th_state, unrolled_th_state, atol=1e-04)
<ide>
<add> # test go_backwards
<add> th_rnn_step_fn = rnn_step_fn(input_dim, output_dim, KTH)
<add> th_inputs = KTH.variable(input_val)
<add> th_initial_states = [KTH.variable(init_state_val)]
<add> last_output, outputs, new_states = KTH.rnn(th_rnn_step_fn, th_inputs,
<add> th_initial_states,
<add> go_backwards=True,
<add> mask=None)
<add> th_last_output = KTH.eval(last_output)
<add> th_outputs = KTH.eval(outputs)
<add> assert len(new_states) == 1
<add> th_state = KTH.eval(new_states[0])
<add>
<add> tf_rnn_step_fn = rnn_step_fn(input_dim, output_dim, KTF)
<add> tf_inputs = KTF.variable(input_val)
<add> tf_initial_states = [KTF.variable(init_state_val)]
<add> last_output, outputs, new_states = KTF.rnn(tf_rnn_step_fn, tf_inputs,
<add> tf_initial_states,
<add> go_backwards=True,
<add> mask=None)
<add> tf_last_output = KTF.eval(last_output)
<add> tf_outputs = KTF.eval(outputs)
<add> assert len(new_states) == 1
<add> tf_state = KTF.eval(new_states[0])
<add>
<add> assert_allclose(tf_last_output, th_last_output, atol=1e-04)
<add> assert_allclose(tf_outputs, th_outputs, atol=1e-04)
<add> assert_allclose(tf_state, th_state, atol=1e-04)
<add>
<ide> # test unroll with backwards = True
<ide> bwd_last_output, bwd_outputs, bwd_new_states = KTH.rnn(
<ide> th_rnn_step_fn, th_inputs,
<ide><path>tests/keras/engine/test_topology.py
<ide> def test_recursion():
<ide> y = Dense(2)(x)
<ide>
<ide>
<del>@keras_test
<del>def test_functional_guide():
<del> # MNIST
<del> from keras.layers import Input, Dense, LSTM
<del> from keras.models import Model
<del> from keras.utils import np_utils
<del>
<del> # this returns a tensor
<del> inputs = Input(shape=(784,))
<del>
<del> # a layer instance is callable on a tensor, and returns a tensor
<del> x = Dense(64, activation='relu')(inputs)
<del> x = Dense(64, activation='relu')(x)
<del> predictions = Dense(10, activation='softmax')(x)
<del>
<del> # this creates a model that includes
<del> # the Input layer and three Dense layers
<del> model = Model(input=inputs, output=predictions)
<del> model.compile(optimizer='rmsprop',
<del> loss='categorical_crossentropy',
<del> metrics=['accuracy'])
<del>
<del> # the data, shuffled and split between tran and test sets
<del> X_train = np.random.random((100, 784))
<del> Y_train = np.random.random((100, 10))
<del>
<del> model.fit(X_train, Y_train, nb_epoch=2, batch_size=128)
<del>
<del> assert model.inputs == [inputs]
<del> assert model.outputs == [predictions]
<del> assert model.input == inputs
<del> assert model.output == predictions
<del> assert model.input_shape == (None, 784)
<del> assert model.output_shape == (None, 10)
<del>
<del> # try calling the sequential model
<del> inputs = Input(shape=(784,))
<del> new_outputs = model(inputs)
<del> new_model = Model(input=inputs, output=new_outputs)
<del> new_model.compile(optimizer='rmsprop',
<del> loss='categorical_crossentropy',
<del> metrics=['accuracy'])
<del>
<del> ##################################################
<del> # multi-io
<del> ##################################################
<del> tweet_a = Input(shape=(4, 25))
<del> tweet_b = Input(shape=(4, 25))
<del> # this layer can take as input a matrix
<del> # and will return a vector of size 64
<del> shared_lstm = LSTM(64)
<del>
<del> # when we reuse the same layer instance
<del> # multiple times, the weights of the layer
<del> # are also being reused
<del> # (it is effectively *the same* layer)
<del> encoded_a = shared_lstm(tweet_a)
<del> encoded_b = shared_lstm(tweet_b)
<del>
<del> # we can then concatenate the two vectors:
<del> merged_vector = merge([encoded_a, encoded_b],
<del> mode='concat', concat_axis=-1)
<del>
<del> # and add a logistic regression on top
<del> predictions = Dense(1, activation='sigmoid')(merged_vector)
<del>
<del> # we define a trainable model linking the
<del> # tweet inputs to the predictions
<del> model = Model(input=[tweet_a, tweet_b], output=predictions)
<del>
<del> model.compile(optimizer='rmsprop',
<del> loss='binary_crossentropy',
<del> metrics=['accuracy'])
<del> data_a = np.random.random((1000, 4, 25))
<del> data_b = np.random.random((1000, 4, 25))
<del> labels = np.random.random((1000,))
<del> model.fit([data_a, data_b], labels, nb_epoch=1)
<del>
<del> model.summary()
<del> assert model.inputs == [tweet_a, tweet_b]
<del> assert model.outputs == [predictions]
<del> assert model.input == [tweet_a, tweet_b]
<del> assert model.output == predictions
<del>
<del> assert model.output == predictions
<del> assert model.input_shape == [(None, 4, 25), (None, 4, 25)]
<del> assert model.output_shape == (None, 1)
<del>
<del> assert shared_lstm.get_output_at(0) == encoded_a
<del> assert shared_lstm.get_output_at(1) == encoded_b
<del> assert shared_lstm.input_shape == (None, 4, 25)
<add># @keras_test
<add># def test_functional_guide():
<add># # MNIST
<add># from keras.layers import Input, Dense, LSTM
<add># from keras.models import Model
<add># from keras.utils import np_utils
<add>
<add># # this returns a tensor
<add># inputs = Input(shape=(784,))
<add>
<add># # a layer instance is callable on a tensor, and returns a tensor
<add># x = Dense(64, activation='relu')(inputs)
<add># x = Dense(64, activation='relu')(x)
<add># predictions = Dense(10, activation='softmax')(x)
<add>
<add># # this creates a model that includes
<add># # the Input layer and three Dense layers
<add># model = Model(input=inputs, output=predictions)
<add># model.compile(optimizer='rmsprop',
<add># loss='categorical_crossentropy',
<add># metrics=['accuracy'])
<add>
<add># # the data, shuffled and split between tran and test sets
<add># X_train = np.random.random((100, 784))
<add># Y_train = np.random.random((100, 10))
<add>
<add># model.fit(X_train, Y_train, nb_epoch=2, batch_size=128)
<add>
<add># assert model.inputs == [inputs]
<add># assert model.outputs == [predictions]
<add># assert model.input == inputs
<add># assert model.output == predictions
<add># assert model.input_shape == (None, 784)
<add># assert model.output_shape == (None, 10)
<add>
<add># # try calling the sequential model
<add># inputs = Input(shape=(784,))
<add># new_outputs = model(inputs)
<add># new_model = Model(input=inputs, output=new_outputs)
<add># new_model.compile(optimizer='rmsprop',
<add># loss='categorical_crossentropy',
<add># metrics=['accuracy'])
<add>
<add># ##################################################
<add># # multi-io
<add># ##################################################
<add># tweet_a = Input(shape=(4, 25))
<add># tweet_b = Input(shape=(4, 25))
<add># # this layer can take as input a matrix
<add># # and will return a vector of size 64
<add># shared_lstm = LSTM(64)
<add>
<add># # when we reuse the same layer instance
<add># # multiple times, the weights of the layer
<add># # are also being reused
<add># # (it is effectively *the same* layer)
<add># encoded_a = shared_lstm(tweet_a)
<add># encoded_b = shared_lstm(tweet_b)
<add>
<add># # we can then concatenate the two vectors:
<add># merged_vector = merge([encoded_a, encoded_b],
<add># mode='concat', concat_axis=-1)
<add>
<add># # and add a logistic regression on top
<add># predictions = Dense(1, activation='sigmoid')(merged_vector)
<add>
<add># # we define a trainable model linking the
<add># # tweet inputs to the predictions
<add># model = Model(input=[tweet_a, tweet_b], output=predictions)
<add>
<add># model.compile(optimizer='rmsprop',
<add># loss='binary_crossentropy',
<add># metrics=['accuracy'])
<add># data_a = np.random.random((1000, 4, 25))
<add># data_b = np.random.random((1000, 4, 25))
<add># labels = np.random.random((1000,))
<add># model.fit([data_a, data_b], labels, nb_epoch=1)
<add>
<add># model.summary()
<add># assert model.inputs == [tweet_a, tweet_b]
<add># assert model.outputs == [predictions]
<add># assert model.input == [tweet_a, tweet_b]
<add># assert model.output == predictions
<add>
<add># assert model.output == predictions
<add># assert model.input_shape == [(None, 4, 25), (None, 4, 25)]
<add># assert model.output_shape == (None, 1)
<add>
<add># assert shared_lstm.get_output_at(0) == encoded_a
<add># assert shared_lstm.get_output_at(1) == encoded_b
<add># assert shared_lstm.input_shape == (None, 4, 25)
<ide>
<ide>
<ide> @keras_test
| 5
|
Javascript
|
Javascript
|
remove extraneous binds from some fixtures
|
c31297b6d95b720d4e9f41985805001a31da30d2
|
<ide><path>fixtures/src/components/fixtures/range-inputs/index.js
<ide> const RangeInputs = React.createClass({
<ide> <form>
<ide> <fieldset>
<ide> <legend>Controlled</legend>
<del> <input type="range" value={this.state.value} onChange={this.onChange.bind(this)} />
<add> <input type="range" value={this.state.value} onChange={this.onChange} />
<ide> <span className="hint">Value: {this.state.value}</span>
<ide> </fieldset>
<ide>
<ide><path>fixtures/src/components/fixtures/textareas/index.js
<ide> const TextAreaFixtures = React.createClass({
<ide> <form>
<ide> <fieldset>
<ide> <legend>Controlled</legend>
<del> <textarea value={this.state.value} onChange={this.onChange.bind(this)} />
<add> <textarea value={this.state.value} onChange={this.onChange} />
<ide> </fieldset>
<ide>
<ide> <fieldset>
| 2
|
Ruby
|
Ruby
|
ignore empty version strings
|
91ce799fe2c7432795a0f74e5ce84b6fd272d1f4
|
<ide><path>Library/Homebrew/dev-cmd/bump-unversioned-casks.rb
<ide> def self.guess_cask_version(cask, installer)
<ide> def self.version_from_info_plist(info_plist_path)
<ide> plist = system_command!("plutil", args: ["-convert", "xml1", "-o", "-", info_plist_path]).plist
<ide>
<del> short_version = plist["CFBundleShortVersionString"]
<del> version = plist["CFBundleVersion"]
<add> short_version = plist["CFBundleShortVersionString"].presence
<add> version = plist["CFBundleVersion"].presence
<ide>
<ide> return decide_between_versions(short_version, version) if short_version && version
<ide> end
<ide> def self.version_from_info_plist(info_plist_path)
<ide> def self.version_from_package_info(package_info_path)
<ide> contents = package_info_path.read
<ide>
<del> short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1]
<del> version = contents[/CFBundleVersion="([^"]*)"/, 1]
<add> short_version = contents[/CFBundleShortVersionString="([^"]*)"/, 1].presence
<add> version = contents[/CFBundleVersion="([^"]*)"/, 1].presence
<ide>
<ide> return decide_between_versions(short_version, version) if short_version && version
<ide> end
| 1
|
Ruby
|
Ruby
|
fix message presentation
|
567b5a96d6f7f95f36f1010986fb0e390ada6ffc
|
<ide><path>Library/Homebrew/diagnostic.rb
<ide> def check_user_path_1
<ide> message = inject_file_list conflicts, <<~EOS
<ide> /usr/bin occurs before #{HOMEBREW_PREFIX}/bin
<ide> This means that system-provided programs will be used instead of those
<del> provided by Homebrew. The following tools exist at both paths:
<del>
<del> Consider setting your PATH so that #{HOMEBREW_PREFIX}/bin
<del> occurs before /usr/bin. Here is a one-liner:
<add> provided by Homebrew. Consider setting your PATH so that
<add> #{HOMEBREW_PREFIX}/bin occurs before /usr/bin. Here is a one-liner:
<ide> #{Utils::Shell.prepend_path_in_profile("#{HOMEBREW_PREFIX}/bin")}
<add>
<add> The following tools exist at both paths:
<ide> EOS
<ide> end
<ide> end
| 1
|
Ruby
|
Ruby
|
add formula#pkgshare path
|
10495fb1fa29a4229d9f1edbc3ab5a90f84c3fd0
|
<ide><path>Library/Homebrew/formula.rb
<ide> def sbin; prefix+'sbin' end
<ide> # `brew link` for formulae that are not keg-only.
<ide> def share; prefix+'share' end
<ide>
<add> # The directory where the formula's shared files should be installed,
<add> # with the name of the formula appended to avoid linking conflicts.
<add> # This is symlinked into `HOMEBREW_PREFIX` after installation or with
<add> # `brew link` for formulae that are not keg-only.
<add> def pkgshare; prefix+'share'+name end
<add>
<ide> # The directory where the formula's Frameworks should be installed.
<ide> # This is symlinked into `HOMEBREW_PREFIX` after installation or with
<ide> # `brew link` for formulae that are not keg-only.
| 1
|
PHP
|
PHP
|
use table prefix in database sessions
|
21cec23be8d22bd3ce608bb545d34edda02a0a89
|
<ide><path>src/Illuminate/Session/SessionManager.php
<ide> protected function createNativeDriver()
<ide> */
<ide> protected function createDatabaseDriver()
<ide> {
<del> $pdo = $this->getDatabaseConnection()->getPdo();
<add> $connection = $this->getDatabaseConnection();
<ide>
<del> $table = $this->app['config']['session.table'];
<add> $table = $connection->getTablePrefix().$this->app['config']['session.table'];
<ide>
<del> return $this->buildSession(new PdoSessionHandler($pdo, $this->getDatabaseOptions()));
<add> return $this->buildSession(new PdoSessionHandler($connection->getPdo(), $this->getDatabaseOptions($table)));
<ide> }
<ide>
<ide> /**
<ide> protected function getDatabaseConnection()
<ide> *
<ide> * @return array
<ide> */
<del> protected function getDatabaseOptions()
<add> protected function getDatabaseOptions($table)
<ide> {
<del> $table = $this->app['config']['session.table'];
<del>
<ide> return array('db_table' => $table, 'db_id_col' => 'id', 'db_data_col' => 'payload', 'db_time_col' => 'last_activity');
<ide> }
<ide>
| 1
|
Java
|
Java
|
fix textalign prop in fabric
|
229fa32ab6c530d1d7fe8c8d4fe6930a8a8eab7d
|
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java
<ide> public Object updateState(
<ide> textViewProps.getTopPadding(),
<ide> textViewProps.getEndPadding(),
<ide> textViewProps.getBottomPadding(),
<del> 0,
<add> textViewProps.getTextAlign(),
<ide> textBreakStrategy,
<ide> justificationMode);
<ide> }
| 1
|
PHP
|
PHP
|
testaddinggeneratedcolumnwithcharset
|
e03d7156a74e00783213113da5f71634050d8c98
|
<ide><path>tests/Database/DatabaseMySqlSchemaGrammarTest.php
<ide> public function testAddingGeneratedColumn()
<ide> $this->assertEquals('alter table `products` add `price` int not null, add `discounted_virtual` int as (price - 5), add `discounted_stored` int as (price - 5) stored', $statements[0]);
<ide> }
<ide>
<add> public function testAddingGeneratedColumnWithCharset()
<add> {
<add> $blueprint = new Blueprint('links');
<add> $blueprint->string('url', 2083)->charset('ascii');
<add> $blueprint->string('url_hash_virtual', 64)->virtualAs('sha2(url, 256)')->charset('ascii');
<add> $blueprint->string('url_hash_stored', 64)->storedAs('sha2(url, 256)')->charset('ascii');
<add> $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
<add>
<add> $this->assertCount(1, $statements);
<add> $this->assertEquals('alter table `links` add `url` varchar(2083) character set ascii not null, add `url_hash_virtual` varchar(64) character set ascii as (sha2(url, 256)), add `url_hash_stored` varchar(64) character set ascii as (sha2(url, 256)) stored', $statements[0]);
<add> }
<add>
<ide> public function testAddingString()
<ide> {
<ide> $blueprint = new Blueprint('users');
| 1
|
Ruby
|
Ruby
|
show linux formulae details and analytics
|
727f9671c7a7ef0644b931fda17c1d4467cd4eb6
|
<ide><path>Library/Homebrew/cmd/info.rb
<ide> def output_analytics(filter: nil)
<ide> end
<ide>
<ide> def output_formula_analytics(f)
<del> json = formulae_api_json("formula/#{f}.json")
<add> json = formulae_api_json("#{formula_path}/#{f}.json")
<ide> return if json.blank? || json["analytics"].blank?
<ide>
<ide> full_analytics = args.analytics? || args.verbose?
<ide> def format_count(count)
<ide> def format_percent(percent)
<ide> format("%<percent>.2f", percent: percent)
<ide> end
<add>
<add> def formula_path
<add> "formula"
<add> end
<add> alias_method :generic_formula_path, :formula_path
<add>
<add> def analytics_path
<add> "analytics"
<add> end
<add> alias_method :generic_analytics_path, :analytics_path
<add>
<add> require "extend/os/cmd/info"
<ide> end
<ide><path>Library/Homebrew/extend/os/cmd/info.rb
<add># frozen_string_literal: true
<add>
<add>require "extend/os/linux/info" if OS.linux?
<ide><path>Library/Homebrew/extend/os/linux/info.rb
<add># frozen_string_literal: true
<add>
<add>module Homebrew
<add> module_function
<add>
<add> def formula_path
<add> return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
<add>
<add> "formula-linux"
<add> end
<add>
<add> def analytics_path
<add> return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
<add>
<add> "analytics-linux"
<add> end
<add>end
| 3
|
Javascript
|
Javascript
|
replace some flushexpired callsites
|
ca99ae97b485963249c81a933c08cb092d6ca14b
|
<ide><path>packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
<ide> describe('ReactSuspense', () => {
<ide>
<ide> await LazyClass;
<ide>
<del> expect(Scheduler).toFlushExpired(['Hi', 'Did mount: Hi']);
<add> expect(Scheduler).toFlushUntilNextPaint(['Hi', 'Did mount: Hi']);
<ide> expect(root).toMatchRenderedOutput('Hi');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(100);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [B:1]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> 'B:1',
<ide> 'Unmount [Loading...]',
<ide> // Should be a mount, not an update
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(100);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [B:2]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> 'B:2',
<ide> 'Unmount [Loading...]',
<ide> 'Update [B:2]',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [A]']);
<del> expect(Scheduler).toFlushExpired(['A']);
<add> expect(Scheduler).toFlushUntilNextPaint(['A']);
<ide> expect(root).toMatchRenderedOutput('Stateful: 1A');
<ide>
<ide> root.update(<App text="B" />);
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [B]']);
<del> expect(Scheduler).toFlushExpired(['B']);
<add> expect(Scheduler).toFlushUntilNextPaint(['B']);
<ide> expect(root).toMatchRenderedOutput('Stateful: 2B');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [A]']);
<del> expect(Scheduler).toFlushExpired(['A']);
<add> expect(Scheduler).toFlushUntilNextPaint(['A']);
<ide> expect(root).toMatchRenderedOutput('Stateful: 1A');
<ide>
<ide> root.update(<App text="B" />);
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [B]']);
<del> expect(Scheduler).toFlushExpired(['B']);
<add> expect(Scheduler).toFlushUntilNextPaint(['B']);
<ide> expect(root).toMatchRenderedOutput('Stateful: 2B');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(500);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [A]']);
<del> expect(Scheduler).toFlushExpired(['A', 'Did commit: A']);
<add> expect(Scheduler).toFlushUntilNextPaint(['A', 'Did commit: A']);
<ide> });
<ide>
<ide> it('retries when an update is scheduled on a timed out tree', () => {
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [Child 1]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> 'Child 1',
<ide> 'Suspend! [Child 2]',
<ide> 'Suspend! [Child 3]',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [Child 2]']);
<del> expect(Scheduler).toFlushExpired(['Child 2', 'Suspend! [Child 3]']);
<add> expect(Scheduler).toFlushUntilNextPaint([
<add> 'Child 2',
<add> 'Suspend! [Child 3]',
<add> ]);
<ide>
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [Child 3]']);
<del> expect(Scheduler).toFlushExpired(['Child 3']);
<add> expect(Scheduler).toFlushUntilNextPaint(['Child 3']);
<ide> expect(root).toMatchRenderedOutput(
<ide> ['Child 1', 'Child 2', 'Child 3'].join(''),
<ide> );
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [Tab: 0]']);
<del> expect(Scheduler).toFlushExpired(['Tab: 0']);
<add> expect(Scheduler).toFlushUntilNextPaint(['Tab: 0']);
<ide> expect(root).toMatchRenderedOutput('Tab: 0 + sibling');
<ide>
<ide> act(() => setTab(1));
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [Tab: 1]']);
<del> expect(Scheduler).toFlushExpired(['Tab: 1']);
<add> expect(Scheduler).toFlushUntilNextPaint(['Tab: 1']);
<ide> expect(root).toMatchRenderedOutput('Tab: 1 + sibling');
<ide>
<ide> act(() => setTab(2));
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [Tab: 2]']);
<del> expect(Scheduler).toFlushExpired(['Tab: 2']);
<add> expect(Scheduler).toFlushUntilNextPaint(['Tab: 2']);
<ide> expect(root).toMatchRenderedOutput('Tab: 2 + sibling');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [A:0]']);
<del> expect(Scheduler).toFlushExpired(['A:0']);
<add> expect(Scheduler).toFlushUntilNextPaint(['A:0']);
<ide> expect(root).toMatchRenderedOutput('A:0');
<ide>
<ide> act(() => setStep(1));
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [A]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> 'A',
<ide> // The promises for B and C have now been thrown twice
<ide> 'Suspend! [B]',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [B]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> // Even though the promise for B was thrown twice, we should only
<ide> // re-render once.
<ide> 'B',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [C]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> // Even though the promise for C was thrown three times, we should only
<ide> // re-render once.
<ide> 'C',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [A]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> 'A',
<ide> // The promises for B and C have now been thrown twice
<ide> 'Suspend! [B]',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [B]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> // Even though the promise for B was thrown twice, we should only
<ide> // re-render once.
<ide> 'B',
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [default]']);
<del> expect(Scheduler).toFlushExpired(['default']);
<add> expect(Scheduler).toFlushUntilNextPaint(['default']);
<ide> expect(root).toMatchRenderedOutput('default');
<ide>
<ide> act(() => setValue('new value'));
<ide> expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']);
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [new value]']);
<del> expect(Scheduler).toFlushExpired(['new value']);
<add> expect(Scheduler).toFlushUntilNextPaint(['new value']);
<ide> expect(root).toMatchRenderedOutput('new value');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [default]']);
<del> expect(Scheduler).toFlushExpired(['default']);
<add> expect(Scheduler).toFlushUntilNextPaint(['default']);
<ide> expect(root).toMatchRenderedOutput('default');
<ide>
<ide> act(() => setValue('new value'));
<ide> expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']);
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [new value]']);
<del> expect(Scheduler).toFlushExpired(['new value']);
<add> expect(Scheduler).toFlushUntilNextPaint(['new value']);
<ide> expect(root).toMatchRenderedOutput('new value');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [default]']);
<del> expect(Scheduler).toFlushExpired(['default']);
<add> expect(Scheduler).toFlushUntilNextPaint(['default']);
<ide> expect(root).toMatchRenderedOutput('default');
<ide>
<ide> act(() => setValue('new value'));
<ide> expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']);
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [new value]']);
<del> expect(Scheduler).toFlushExpired(['new value']);
<add> expect(Scheduler).toFlushUntilNextPaint(['new value']);
<ide> expect(root).toMatchRenderedOutput('new value');
<ide> });
<ide>
<ide> describe('ReactSuspense', () => {
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [default]']);
<del> expect(Scheduler).toFlushExpired(['default']);
<add> expect(Scheduler).toFlushUntilNextPaint(['default']);
<ide> expect(root).toMatchRenderedOutput('default');
<ide>
<ide> act(() => setValue('new value'));
<ide> expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']);
<ide> jest.advanceTimersByTime(1000);
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [new value]']);
<del> expect(Scheduler).toFlushExpired(['new value']);
<add> expect(Scheduler).toFlushUntilNextPaint(['new value']);
<ide> expect(root).toMatchRenderedOutput('new value');
<ide> });
<ide> });
<ide><path>packages/react/src/__tests__/ReactProfiler-test.internal.js
<ide> describe('Profiler', () => {
<ide> await resourcePromise;
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [loaded]']);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushUntilNextPaint([
<ide> 'onPostCommit',
<ide> 'AsyncText [loaded]',
<ide> ]);
<ide> describe('Profiler', () => {
<ide> await resourcePromise;
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [loaded]']);
<del> expect(Scheduler).toFlushExpired(['onPostCommit', 'render']);
<add> expect(Scheduler).toFlushUntilNextPaint(['onPostCommit', 'render']);
<ide>
<ide> expect(onInteractionScheduledWorkCompleted).not.toHaveBeenCalled();
<ide>
<ide> describe('Profiler', () => {
<ide> await originalPromise;
<ide>
<ide> expect(Scheduler).toHaveYielded(['Promise resolved [loaded]']);
<del> expect(Scheduler).toFlushExpired(['AsyncText [loaded]']);
<add> expect(Scheduler).toFlushUntilNextPaint(['AsyncText [loaded]']);
<ide> expect(renderer.toJSON()).toEqual(['loaded', 'updated']);
<ide> expect(Scheduler).toFlushAndYield(['onPostCommit']);
<ide>
<ide><path>packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js
<ide> describe('ReactProfiler DevTools integration', () => {
<ide> root.update(<Text text="B" />);
<ide>
<ide> // Update B should not instantly expire.
<del> expect(Scheduler).toFlushExpired([]);
<add> expect(Scheduler).toFlushAndYieldThrough([]);
<ide>
<ide> expect(Scheduler).toFlushAndYield(['B']);
<ide> expect(root).toMatchRenderedOutput('B');
<ide><path>packages/scheduler/src/__tests__/SchedulerMock-test.js
<ide> describe('Scheduler', () => {
<ide>
<ide> // Advance by just a bit more to expire the user blocking callbacks
<ide> Scheduler.unstable_advanceTime(1);
<del> expect(Scheduler).toFlushExpired([
<add> expect(Scheduler).toFlushAndYieldThrough([
<ide> 'B (did timeout: true)',
<ide> 'C (did timeout: true)',
<ide> ]);
<ide>
<ide> // Expire A
<ide> Scheduler.unstable_advanceTime(4600);
<del> expect(Scheduler).toFlushExpired(['A (did timeout: true)']);
<add> expect(Scheduler).toFlushAndYieldThrough(['A (did timeout: true)']);
<ide>
<ide> // Flush the rest without expiring
<ide> expect(Scheduler).toFlushAndYield([
<ide><path>packages/scheduler/src/forks/SchedulerMock.js
<ide> function cancelHostTimeout(): void {
<ide>
<ide> function shouldYieldToHost(): boolean {
<ide> if (
<add> (expectedNumberOfYields === 0 && yieldedValues === null) ||
<ide> (expectedNumberOfYields !== -1 &&
<ide> yieldedValues !== null &&
<ide> yieldedValues.length >= expectedNumberOfYields) ||
| 5
|
Javascript
|
Javascript
|
fix some test failures
|
86a52d030233944cdedc14bc1c5076c74826ea87
|
<ide><path>src/core/core.scale.js
<ide> reverse: false,
<ide> show: true,
<ide> callback: function(value) {
<del> return value;
<add> return '' + value;
<ide> },
<ide> },
<ide> };
<ide><path>src/scales/scale.logarithmic.js
<ide>
<ide> // label settings
<ide> ticks: {
<del> template: "<%var remain = value / (Math.pow(10, Math.floor(Chart.helpers.log10(value))));if (remain === 1 || remain === 2 || remain === 5) {%><%=value.toExponential()%><%} else {%><%= null %><%}%>",
<add> callback: function(value) {
<add> var remain = value / (Math.pow(10, Math.floor(Chart.helpers.log10(value))));
<add>
<add> if (remain === 1 || remain === 2 || remain === 5) {
<add> return value.toExponential()
<add> } else {
<add> return '';
<add> }
<add> }
<ide> }
<ide> };
<ide>
| 2
|
Javascript
|
Javascript
|
fix dispatch config type for skipbubbling
|
b075f974229f5eee820e97e87c2c73056c12c0b7
|
<ide><path>packages/react-native-renderer/src/ReactNativeTypes.js
<ide> export type ViewConfig = $ReadOnly<{
<ide> phasedRegistrationNames: $ReadOnly<{
<ide> captured: string,
<ide> bubbled: string,
<del> skipBubble?: ?boolean,
<add> skipBubbling?: ?boolean,
<ide> }>,
<ide> }>,
<ide> ...,
| 1
|
PHP
|
PHP
|
remove helper_tests constant
|
90a6bcb9d50ade67a0cf3922d38ee39ba998a780
|
<ide><path>lib/Cake/bootstrap.php
<ide> define('CAKE_TESTS', CAKE.'Test'.DS);
<ide> }
<ide>
<del>/**
<del> * Path to the helpers test directory.
<del> */
<del> define('HELPER_TESTS', TESTS.'Case'.DS.'View'.DS.'Helper'.DS);
<del>
<ide> /**
<ide> * Path to the models' test directory.
<ide> */
| 1
|
Javascript
|
Javascript
|
call `this.resume()` after `this.run()`
|
6410534ec1062c8e3140bd3c2fc4f3d8a5bbdab7
|
<ide><path>lib/_debugger.js
<ide> function Interface(stdin, stdout, args) {
<ide> // Run script automatically
<ide> this.pause();
<ide>
<del> setImmediate(() => { this.run(); });
<add> setImmediate(() => { this.run(() => this.resume()); });
<ide> }
<ide>
<ide>
<ide><path>test/parallel/test-debug-prompt.js
<add>'use strict';
<add>
<add>const assert = require('assert');
<add>const common = require('../common');
<add>const spawn = require('child_process').spawn;
<add>
<add>const proc = spawn(process.execPath, ['debug', 'foo']);
<add>proc.stdout.setEncoding('utf8');
<add>
<add>proc.stdout.once('data', common.mustCall((data) => {
<add> assert.strictEqual(data, 'debug> ');
<add> proc.kill();
<add>}));
| 2
|
Javascript
|
Javascript
|
remove 1 second delay from test
|
e98bcfa2cb3ea3442c785c9b95d4be0e4e02dcba
|
<ide><path>test/parallel/test-cluster-worker-wait-server-close.js
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide> var net = require('net');
<ide>
<add>var serverClosed = false;
<add>
<ide> if (cluster.isWorker) {
<del> net.createServer(function(socket) {
<add> var server = net.createServer(function(socket) {
<ide> // Wait for any data, then close connection
<ide> socket.write('.');
<del> socket.on('data', function discard() {
<del> });
<add> socket.on('data', function discard() {});
<ide> }).listen(common.PORT, common.localhostIPv4);
<del>} else if (cluster.isMaster) {
<ide>
<del> var connectionDone;
<del> var ok;
<add> server.once('close', function() {
<add> serverClosed = true;
<add> });
<ide>
<add> // Although not typical, the worker process can exit before the disconnect
<add> // event fires. Use this to keep the process open until the event has fired.
<add> var keepOpen = setInterval(function() {}, 9999);
<add>
<add> // Check worker events and properties
<add> process.once('disconnect', function() {
<add> // disconnect should occur after socket close
<add> assert(serverClosed);
<add> clearInterval(keepOpen);
<add> });
<add>} else if (cluster.isMaster) {
<ide> // start worker
<ide> var worker = cluster.fork();
<ide>
<add> var socket;
<ide> // Disconnect worker when it is ready
<ide> worker.once('listening', function() {
<ide> net.createConnection(common.PORT, common.localhostIPv4, function() {
<del> var socket = this;
<add> socket = this;
<ide> this.on('data', function() {
<ide> console.log('got data from client');
<ide> // socket definitely connected to worker if we got data
<ide> worker.disconnect();
<del> setTimeout(function() {
<del> socket.end();
<del> connectionDone = true;
<del> }, 1000);
<add> socket.end();
<ide> });
<ide> });
<ide> });
<del>
<del> // Check worker events and properties
<del> worker.once('disconnect', function() {
<del> assert.ok(connectionDone, 'disconnect should occur after socket close');
<del> ok = true;
<del> });
<del>
<del> process.once('exit', function() {
<del> assert.ok(ok);
<del> });
<ide> }
| 1
|
Javascript
|
Javascript
|
escape params that have <object> in their type
|
2123772a653eeb969ef6f8c21d1daee878098fe1
|
<ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> * - **headers** – `{function([headerName])}` – Header getter function.
<ide> * - **config** – `{Object}` – The configuration object that was used to generate the request.
<ide> *
<del> * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
<add> * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
<ide> * requests. This is primarily meant to be used for debugging purposes.
<ide> *
<ide> *
<ide><path>src/ngResource/resource.js
<ide> function shallowClearAndCopy(src, dst) {
<ide> * If the parameter value is prefixed with `@` then the value of that parameter is extracted from
<ide> * the data object (useful for non-GET operations).
<ide> *
<del> * @param {Object.<Object>=} actions Hash with declaration of custom action that should extend the
<del> * default set of resource actions. The declaration should be created in the format of {@link
<add> * @param {Object.<Object>=} actions Hash with declaration of custom action that should extend
<add> * the default set of resource actions. The declaration should be created in the format of {@link
<ide> * ng.$http#usage_parameters $http.config}:
<ide> *
<ide> * {action1: {method:?, params:?, isArray:?, headers:?, ...},
<ide> function shallowClearAndCopy(src, dst) {
<ide> *
<ide> * @returns {Object} A resource "class" object with methods for the default set of resource actions
<ide> * optionally extended with custom `actions`. The default set contains these actions:
<del> *
<del> * { 'get': {method:'GET'},
<del> * 'save': {method:'POST'},
<del> * 'query': {method:'GET', isArray:true},
<del> * 'remove': {method:'DELETE'},
<del> * 'delete': {method:'DELETE'} };
<del> *
<add> * ```js
<add> * { 'get': {method:'GET'},
<add> * 'save': {method:'POST'},
<add> * 'query': {method:'GET', isArray:true},
<add> * 'remove': {method:'DELETE'},
<add> * 'delete': {method:'DELETE'} };
<add> * ```
<add> *
<ide> * Calling these methods invoke an {@link ng.$http} with the specified http method,
<ide> * destination and parameters. When the data is returned from the server then the object is an
<ide> * instance of the resource class. The actions `save`, `remove` and `delete` are available on it
<ide> * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
<ide> * read, update, delete) on server-side data like this:
<ide> * ```js
<del> var User = $resource('/user/:userId', {userId:'@id'});
<del> var user = User.get({userId:123}, function() {
<del> user.abc = true;
<del> user.$save();
<del> });
<del> ```
<add> * var User = $resource('/user/:userId', {userId:'@id'});
<add> * var user = User.get({userId:123}, function() {
<add> * user.abc = true;
<add> * user.$save();
<add> * });
<add> * ```
<ide> *
<ide> * It is important to realize that invoking a $resource object method immediately returns an
<ide> * empty reference (object or array depending on `isArray`). Once the data is returned from the
<ide><path>src/ngRoute/route.js
<ide> function $RouteProvider(){
<ide> *
<ide> * If `template` is a function, it will be called with the following parameters:
<ide> *
<del> * - `{Array.<Object>}` - route parameters extracted from the current
<add> * - `{Array.<Object>}` - route parameters extracted from the current
<ide> * `$location.path()` by applying the current route
<ide> *
<ide> * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
<ide> * template that should be used by {@link ngRoute.directive:ngView ngView}.
<ide> *
<ide> * If `templateUrl` is a function, it will be called with the following parameters:
<ide> *
<del> * - `{Array.<Object>}` - route parameters extracted from the current
<add> * - `{Array.<Object>}` - route parameters extracted from the current
<ide> * `$location.path()` by applying the current route
<ide> *
<ide> * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
<ide> function $RouteProvider(){
<ide> * - `$scope` - The current route scope.
<ide> * - `$template` - The current route template HTML.
<ide> *
<del> * @property {Array.<Object>} routes Array of all configured routes.
<add> * @property {Array.<Object>} routes Array of all configured routes.
<ide> *
<ide> * @description
<ide> * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
| 3
|
Javascript
|
Javascript
|
stabilize new dev test
|
9b512a850cff7d4ff1329c3dcfff097c5c5f4e2b
|
<ide><path>test/integration/invalid-href/test/index.test.js
<ide> const showsError = async (
<ide>
<ide> const noError = async (pathname, click = false) => {
<ide> const browser = await webdriver(appPort, '/')
<add> await waitFor(2000)
<ide> await browser.eval(`(function() {
<ide> window.caughtErrors = []
<ide> window.addEventListener('error', function (error) {
<ide> const noError = async (pathname, click = false) => {
<ide> })
<ide> window.next.router.replace('${pathname}')
<ide> })()`)
<del> await waitFor(250)
<add> // wait for page to be built and navigated to
<add> await waitFor(3000)
<ide> if (click) {
<ide> await browser.elementByCss('a').click()
<ide> }
| 1
|
Python
|
Python
|
fix e714 flake8 warning (x8)
|
fd2f17a7a1197529474c24551f1f1d8f534168a3
|
<ide><path>examples/summarization/modeling_bertabs.py
<ide> def unshape(x):
<ide>
<ide> attn = self.softmax(scores)
<ide>
<del> if not predefined_graph_1 is None:
<add> if predefined_graph_1 is not None:
<ide> attn_masked = attn[:, -1] * predefined_graph_1
<ide> attn_masked = attn_masked / (torch.sum(attn_masked, 2).unsqueeze(2) + 1e-9)
<ide>
<ide><path>templates/adding_a_new_model/modeling_tf_xxx.py
<ide> def call(
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
<ide> # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.num_hidden_layers
<ide><path>transformers/modeling_tf_albert.py
<ide> def call(
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
<ide> # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.num_hidden_layers
<ide><path>transformers/modeling_tf_bert.py
<ide> def call(
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
<ide> # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.num_hidden_layers
<ide><path>transformers/modeling_tf_gpt2.py
<ide> def call(
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
<ide> # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.num_hidden_layers
<ide><path>transformers/modeling_tf_openai.py
<ide> def call(
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
<ide> # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.num_hidden_layers
<ide><path>transformers/modeling_tf_t5.py
<ide> def call(
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
<ide> # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.num_hidden_layers
<ide><path>transformers/modeling_tf_transfo_xl.py
<ide> def call(self, inputs, mems=None, head_mask=None, inputs_embeds=None, training=F
<ide> # attention_probs has shape bsz x n_heads x N x N
<ide> # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads] (a head_mask for each layer)
<ide> # and head_mask is converted to shape [num_hidden_layers x qlen x klen x bsz x n_head]
<del> if not head_mask is None:
<add> if head_mask is not None:
<ide> raise NotImplementedError
<ide> else:
<ide> head_mask = [None] * self.n_layer
| 8
|
Javascript
|
Javascript
|
fix lint errors
|
8c59866b6954bc8333588b93ad2f9ee8be0439d2
|
<ide><path>packager/react-packager/src/DependencyResolver/DependencyGraph/DeprecatedAssetMap.js
<ide> class DeprecatedAssetMap {
<ide> fileWatcher,
<ide> ignoreFilePath,
<ide> helpers,
<del> activity
<add> activity,
<ide> }) {
<ide> if (roots == null || roots.length === 0) {
<ide> this._disabled = true;
<ide> class DeprecatedAssetMap {
<ide> }
<ide>
<ide> _processAsset(file) {
<del> let ext = this._helpers.extname(file);
<add> const ext = this._helpers.extname(file);
<ide> if (this._assetExts.indexOf(ext) !== -1) {
<del> let name = assetName(file, ext);
<add> const name = assetName(file, ext);
<ide> if (this._map[name] != null) {
<ide> debug('Conflcting assets', name);
<ide> }
<ide><path>packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js
<ide> class HasteMap {
<ide> this._map = Object.create(null);
<ide>
<ide> let promises = this._fastfs.findFilesByExt('js', {
<del> ignore: (file) => this._helpers.isNodeModulesDir(file)
<add> ignore: (file) => this._helpers.isNodeModulesDir(file),
<ide> }).map(file => this._processHasteModule(file));
<ide>
<ide> promises = promises.concat(
<ide> this._fastfs.findFilesByName('package.json', {
<del> ignore: (file) => this._helpers.isNodeModulesDir(file)
<add> ignore: (file) => this._helpers.isNodeModulesDir(file),
<ide> }).map(file => this._processHastePackage(file))
<ide> );
<ide>
<ide> class HasteMap {
<ide> return Promise.resolve().then(() => {
<ide> /*eslint no-labels: 0 */
<ide> if (type === 'delete' || type === 'change') {
<del> loop: for (let name in this._map) {
<add> loop: for (const name in this._map) {
<ide> const modulesMap = this._map[name];
<del> for (let platform in modulesMap) {
<add> for (const platform in modulesMap) {
<ide> const module = modulesMap[platform];
<ide> if (module.path === absPath) {
<ide> delete modulesMap[platform];
<ide> class HasteMap {
<ide> }
<ide>
<ide> if (type === 'delete') {
<del> return;
<add> return null;
<ide> }
<ide> }
<ide>
<ide><path>packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionResponse.js
<ide> class ResolutionResponse {
<ide> this.dependencies.unshift(module);
<ide> }
<ide>
<del> pushAsyncDependency(dependency){
<add> pushAsyncDependency(dependency) {
<ide> this._assertNotFinalized();
<ide> this.asyncDependencies.push(dependency);
<ide> }
<ide><path>packager/react-packager/src/DependencyResolver/DependencyGraph/__tests__/DependencyGraph-test.js
<ide> describe('DependencyGraph', function() {
<ide> on: function() {
<ide> return this;
<ide> },
<del> isWatchman: () => Promise.resolve(false)
<add> isWatchman: () => Promise.resolve(false),
<ide> };
<ide>
<ide> defaults = {
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'require("a")'
<add> 'require("a")',
<ide> ].join('\n'),
<ide> 'a.js': [
<ide> '/**',
<ide> ' * @providesModule a',
<ide> ' */',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> isJSON: false,
<ide> isPolyfill: false,
<ide> resolution: undefined,
<del> resolveDependency: undefined
<add> resolveDependency: undefined,
<ide> },
<ide> {
<ide> id: 'a',
<ide> describe('DependencyGraph', function() {
<ide> isJSON: false,
<ide> isPolyfill: false,
<ide> resolution: undefined,
<del> resolveDependency: undefined
<add> resolveDependency: undefined,
<ide> },
<ide> ]);
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'require("a")'
<add> 'require("a")',
<ide> ].join('\n'),
<ide> 'a.js': [
<ide> '/**',
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule a',
<ide> ' */',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> fs.__setMockFilesystem({
<ide> 'root': {
<ide> 'package.json': JSON.stringify({
<del> name: 'package'
<add> name: 'package',
<ide> }),
<ide> 'index.js': [
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("./a.json")',
<del> 'require("./b")'
<add> 'require("./b")',
<ide> ].join('\n'),
<ide> 'a.json': JSON.stringify({}),
<ide> 'b.json': JSON.stringify({}),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> fs.__setMockFilesystem({
<ide> 'root': {
<ide> 'package.json': JSON.stringify({
<del> name: 'package'
<add> name: 'package',
<ide> }),
<ide> 'index.js': [
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("./package.json")',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'require("image!a")'
<add> 'require("image!a")',
<ide> ].join('\n'),
<ide> 'imgs': {
<del> 'a.png': ''
<add> 'a.png': '',
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'require("./imgs/a.png")'
<add> 'require("./imgs/a.png")',
<ide> ].join('\n'),
<ide> 'imgs': {
<del> 'a.png': ''
<add> 'a.png': '',
<ide> },
<ide> 'package.json': JSON.stringify({
<del> name: 'rootPackage'
<add> name: 'rootPackage',
<ide> }),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'c@2x.png': '',
<ide> },
<ide> 'package.json': JSON.stringify({
<del> name: 'rootPackage'
<add> name: 'rootPackage',
<ide> }),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'c@2x.ios.png': '',
<ide> },
<ide> 'package.json': JSON.stringify({
<del> name: 'rootPackage'
<add> name: 'rootPackage',
<ide> }),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'require("image!a")',
<ide> ].join('\n'),
<ide> 'imgs': {
<del> 'a.png': ''
<add> 'a.png': '',
<ide> },
<ide> 'package.json': JSON.stringify({
<del> name: 'rootPackage'
<add> name: 'rootPackage',
<ide> }),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ' */',
<ide> 'require("index")',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<del> 'main.js': 'lol'
<del> }
<del> }
<add> 'main.js': 'lol',
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<del> 'main.js': 'lol'
<del> }
<del> }
<add> 'main.js': 'lol',
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'sha.js': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'sha.js',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<del> 'main.js': 'lol'
<add> 'main.js': 'lol',
<ide> },
<ide> 'x.y.z': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'x.y.z',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<del> 'main.js': 'lol'
<del> }
<del> }
<add> 'main.js': 'lol',
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> name: 'aPackage',
<ide> }),
<ide> 'index.js': 'lol',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule EpicModule',
<ide> ' */',
<ide> ].join('\n'),
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> lib: {
<ide> 'index.js': 'lol',
<ide> },
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> lib: {
<ide> 'index.js': 'lol',
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'index.js': 'lol',
<ide> 'main.js': 'lol',
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': 'lol',
<del> 'main.js': 'lol'
<del> }
<del> }
<add> 'main.js': 'lol',
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> const _exit = process.exit;
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("lolomg")',
<del> ].join('\n')
<del> }
<add> ].join('\n'),
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> isPolyfill: false,
<ide> resolution: undefined,
<ide> resolveDependency: undefined,
<del> }
<add> },
<ide> ]);
<ide> });
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'lol',
<ide> 'subdir': {
<del> 'lolynot.js': 'lolynot'
<del> }
<del> }
<del> }
<add> 'lolynot.js': 'lolynot',
<add> },
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'symlinkedPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'lol',
<ide> 'subdir': {
<del> 'lolynot.js': 'lolynot'
<del> }
<add> 'lolynot.js': 'lolynot',
<add> },
<ide> },
<ide> 'root': {
<ide> 'index.js': [
<ide> describe('DependencyGraph', function() {
<ide> 'require("aPackage/subdir/lolynot")',
<ide> ].join('\n'),
<ide> 'aPackage': { SYMLINK: '/symlinkedPackage' },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'require("./subdir/lolynot")',
<ide> 'subdir': {
<del> 'lolynot.js': 'require("../other")'
<add> 'lolynot.js': 'require("../other")',
<ide> },
<del> 'other.js': 'some code'
<del> }
<del> }
<add> 'other.js': 'some code',
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'some other code',
<ide> 'client.js': 'some code',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'some other code',
<ide> 'client.js': 'some code',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'some other code',
<ide> 'client.js': 'some code',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'some other code',
<ide> 'client.js': 'some code',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> },
<ide> 'hello.js': 'hello',
<ide> 'bye.js': 'bye',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> name: 'aPackage',
<ide> browser: {
<ide> 'node-package': 'browser-package',
<del> }
<add> },
<ide> }),
<ide> 'index.js': 'require("node-package")',
<ide> 'node-package': {
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'index.js': 'some browser code',
<ide> },
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'bar 1 module',
<ide> },
<del> }
<add> },
<ide> },
<ide> 'bar': {
<ide> 'package.json': JSON.stringify({
<ide> describe('DependencyGraph', function() {
<ide> 'main.js': 'bar 2 module',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'bar': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'bar',
<del> main: 'main'
<add> main: 'main',
<ide> }),
<ide> 'main.ios.js': '',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> isPolyfill: false,
<ide> resolution: undefined,
<ide> },
<del> ]);
<add> ]);
<ide> });
<ide> });
<ide>
<ide> describe('DependencyGraph', function() {
<ide> 'main.js': 'bar 1 module',
<ide> 'lol.js': '',
<ide> },
<del> }
<add> },
<ide> },
<ide> 'bar': {
<ide> 'package.json': JSON.stringify({
<ide> describe('DependencyGraph', function() {
<ide> 'main.js': 'bar 2 module',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> name: 'bar',
<ide> main: 'main.js',
<ide> browser: {
<del> './lol': './wow'
<del> }
<add> './lol': './wow',
<add> },
<ide> }),
<ide> 'main.js': 'bar 1 module',
<ide> 'lol.js': '',
<ide> 'wow.js': '',
<ide> },
<del> }
<add> },
<ide> },
<ide> 'bar': {
<ide> 'package.json': JSON.stringify({
<ide> describe('DependencyGraph', function() {
<ide> 'main2.js': 'bar 2 module',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> },
<ide> 'node_modules': {},
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'log()',
<ide> },
<del> }
<add> },
<ide> },
<ide> 'ember': {
<ide> 'package.json': JSON.stringify({
<ide> describe('DependencyGraph', function() {
<ide> ].join('\n'),
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ].join('\n'),
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'main.js': 'foo module',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'sha.js': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'sha.js',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<del> 'main.js': 'lol'
<del> }
<del> }
<del> }
<add> 'main.js': 'lol',
<add> },
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> * @providesModule a
<ide> */
<ide> `,
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> * @providesModule a
<ide> */
<ide> `,
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'a.ios.js': '',
<ide> 'a.android.js': '',
<ide> 'a.js': '',
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'main.js': 'require("./package.json")',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> describe('file watch updating', function() {
<ide> var triggerFileChange;
<ide> var mockStat = {
<del> isDirectory: () => false
<add> isDirectory: () => false,
<ide> };
<ide>
<ide> beforeEach(function() {
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("aPackage")',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n'),
<ide> 'foo': [
<ide> '/**',
<ide> ' * @providesModule foo',
<ide> ' */',
<del> 'require("aPackage")'
<add> 'require("aPackage")',
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("aPackage")',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n'),
<ide> 'foo.js': [
<ide> '/**',
<ide> ' * @providesModule foo',
<ide> ' */',
<del> 'require("aPackage")'
<add> 'require("aPackage")',
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("aPackage")',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n'),
<ide> 'foo.js': [
<ide> '/**',
<ide> ' * @providesModule foo',
<ide> ' */',
<del> 'require("aPackage")'
<add> 'require("aPackage")',
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> isPolyfill: false,
<ide> resolution: undefined,
<ide> },
<del> ]);
<add> ]);
<ide> });
<ide> });
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("aPackage")',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n'),
<ide> 'foo.js': [
<ide> '/**',
<ide> ' * @providesModule foo',
<ide> ' */',
<del> 'require("aPackage")'
<add> 'require("aPackage")',
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule bar',
<ide> ' */',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n');
<ide> triggerFileChange('add', 'bar.js', root, mockStat);
<ide>
<ide> describe('DependencyGraph', function() {
<ide> resolution: undefined,
<ide> resolveDependency: undefined,
<ide> },
<del> ]);
<add> ]);
<ide> });
<ide> });
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'require("image!foo")'
<add> 'require("image!foo")',
<ide> ].join('\n'),
<ide> },
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> isPolyfill: false,
<ide> resolution: undefined,
<ide> resolveDependency: undefined,
<del> }
<add> },
<ide> ]);
<ide>
<ide> filesystem.root['foo.png'] = '';
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'require("./foo.png")'
<add> 'require("./foo.png")',
<ide> ].join('\n'),
<ide> 'package.json': JSON.stringify({
<del> name: 'aPackage'
<add> name: 'aPackage',
<ide> }),
<ide> },
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> isPolyfill: false,
<ide> resolution: undefined,
<ide> resolveDependency: undefined,
<del> }
<add> },
<ide> ]);
<ide>
<ide> filesystem.root['foo.png'] = '';
<ide> describe('DependencyGraph', function() {
<ide> isJSON: false,
<ide> isPolyfill: false,
<ide> resolveDependency: undefined,
<del> },
<del> ]);
<add> },
<add> ]);
<ide> });
<ide> });
<ide> });
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("aPackage")',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n'),
<ide> 'foo.js': [
<ide> '/**',
<ide> ' * @providesModule foo',
<ide> ' */',
<del> 'require("aPackage")'
<add> 'require("aPackage")',
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule bar',
<ide> ' */',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n');
<ide> triggerFileChange('add', 'bar.js', root, mockStat);
<ide>
<ide> describe('DependencyGraph', function() {
<ide> ' * @providesModule index',
<ide> ' */',
<ide> 'require("aPackage")',
<del> 'require("foo")'
<add> 'require("foo")',
<ide> ].join('\n'),
<ide> 'foo.js': [
<ide> '/**',
<ide> ' * @providesModule foo',
<ide> ' */',
<del> 'require("aPackage")'
<add> 'require("aPackage")',
<ide> ].join('\n'),
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide> var dgraph = new DependencyGraph({
<ide> ...defaults,
<ide> roots: [root],
<ide> });
<ide> return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function() {
<ide> triggerFileChange('change', 'aPackage', '/root', {
<del> isDirectory: function(){ return true; }
<add> isDirectory: () => true,
<ide> });
<ide> return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function(deps) {
<ide> expect(deps)
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<ide> 'browser.js': 'browser',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'aPackage': {
<ide> 'package.json': JSON.stringify({
<ide> name: 'aPackage',
<del> main: 'main.js'
<add> main: 'main.js',
<ide> }),
<ide> 'main.js': 'main',
<ide> 'browser.js': 'browser',
<del> }
<del> }
<add> },
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> }),
<ide> 'main.js': 'bar 1 module',
<ide> },
<del> }
<add> },
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> 'browser.js': 'foo module',
<ide> },
<ide> },
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> describe('DependencyGraph', function() {
<ide> '/**',
<ide> ' * @providesModule index',
<ide> ' */',
<del> 'System.import("a")'
<add> 'System.import("a")',
<ide> ].join('\n'),
<ide> 'a.js': [
<ide> '/**',
<ide> ' * @providesModule a',
<ide> ' */',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> var dgraph = new DependencyGraph({
<ide> ...defaults,
<ide> roots: [root],
<ide> });
<ide>
<del> return dgraph.getDependencies('/root/index.js')
<del> .then(response => response.finalize())
<del> .then(({ asyncDependencies }) => {
<del> expect(asyncDependencies).toEqual([
<del> ['/root/a.js']
<del> ]);
<del> });
<add> return dgraph.getDependencies('/root/index.js')
<add> .then(response => response.finalize())
<add> .then(({ asyncDependencies }) => {
<add> expect(asyncDependencies).toEqual([
<add> ['/root/a.js'],
<add> ]);
<add> });
<ide> });
<ide> });
<ide> });
<ide><path>packager/react-packager/src/DependencyResolver/Module.js
<ide> class Module {
<ide> */
<ide> const blockCommentRe = /\/\*(.|\n)*?\*\//g;
<ide> const lineCommentRe = /\/\/.+(\n|$)/g;
<del>function extractRequires(code /*: string*/) /*: Array<string>*/ {
<add>function extractRequires(code) {
<ide> var deps = {
<ide> sync: [],
<ide> async: [],
<ide><path>packager/react-packager/src/DependencyResolver/ModuleCache.js
<ide> class ModuleCache {
<ide>
<ide> getPackage(filePath) {
<ide> filePath = path.resolve(filePath);
<del> if (!this._packageCache[filePath]){
<add> if (!this._packageCache[filePath]) {
<ide> this._packageCache[filePath] = new Package(
<ide> filePath,
<ide> this._fastfs,
<ide><path>packager/react-packager/src/DependencyResolver/__tests__/Module-test.js
<ide> describe('Module', () => {
<ide> fs.__setMockFilesystem({
<ide> 'root': {
<ide> 'index.js': 'System.import("dep1")',
<del> }
<add> },
<ide> });
<ide>
<ide> return expectAsyncDependenciesToEqual([['dep1']]);
<ide> describe('Module', () => {
<ide> fs.__setMockFilesystem({
<ide> 'root': {
<ide> 'index.js': 'System.import(\'dep1\')',
<del> }
<add> },
<ide> });
<ide>
<ide> return expectAsyncDependenciesToEqual([['dep1']]);
<ide> describe('Module', () => {
<ide> 'System.import("dep1")',
<ide> 'System.import("dep2")',
<ide> ].join('\n'),
<del> }
<add> },
<ide> });
<ide>
<ide> return expectAsyncDependenciesToEqual([
<ide> describe('Module', () => {
<ide> fs.__setMockFilesystem({
<ide> 'root': {
<ide> 'index.js': 'System.import(\n"dep1"\n)',
<del> }
<add> },
<ide> });
<ide>
<ide> return expectAsyncDependenciesToEqual([['dep1']]);
<ide><path>packager/react-packager/src/DependencyResolver/fastfs.js
<ide> class Fastfs extends EventEmitter {
<ide> }
<ide>
<ide> matches(dir, pattern) {
<del> let dirFile = this._getFile(dir);
<add> const dirFile = this._getFile(dir);
<ide> if (!dirFile.isDir) {
<ide> throw new Error(`Expected file ${dirFile.path} to be a directory`);
<ide> }
<ide> class Fastfs extends EventEmitter {
<ide>
<ide> _getRoot(filePath) {
<ide> for (let i = 0; i < this._roots.length; i++) {
<del> let possibleRoot = this._roots[i];
<add> const possibleRoot = this._roots[i];
<ide> if (isDescendant(possibleRoot.path, filePath)) {
<ide> return possibleRoot;
<ide> }
<ide> class File {
<ide> /*eslint consistent-this:0*/
<ide> let file = this;
<ide> for (let i = 0; i < parts.length; i++) {
<del> let fileName = parts[i];
<add> const fileName = parts[i];
<ide> if (!fileName) {
<ide> continue;
<ide> }
<ide><path>packager/react-packager/src/DependencyResolver/lib/getPlatformExtension.js
<ide> */
<ide> 'use strict';
<ide>
<del>const path = require('path');
<del>
<ide> const SUPPORTED_PLATFORM_EXTS = ['android', 'ios', 'web'];
<ide>
<ide> const re = new RegExp(
| 9
|
PHP
|
PHP
|
allow callable array syntax in route definition
|
d9d3c52d4ff380d901cca0c4d748bfed6e8ae9fe
|
<ide><path>src/Illuminate/Routing/RouteAction.php
<ide> public static function parse($uri, $action)
<ide> // as the "uses" property, because there is nothing else we need to do when
<ide> // it is available. Otherwise we will need to find it in the action list.
<ide> if (is_callable($action)) {
<add>
<add> if (\is_array($action)) {
<add> [$class, $method] = $action;
<add> $action = $class . '@' . $method;
<add> }
<add>
<ide> return ['uses' => $action];
<ide> }
<ide>
<ide><path>tests/Routing/RoutingRouteTest.php
<ide> public function testControllerRouting()
<ide> $this->assertFalse(isset($_SERVER['route.test.controller.except.middleware']));
<ide> }
<ide>
<add> public function testControllerRoutingArrayCallable()
<add> {
<add> unset(
<add> $_SERVER['route.test.controller.middleware'], $_SERVER['route.test.controller.except.middleware'],
<add> $_SERVER['route.test.controller.middleware.class'],
<add> $_SERVER['route.test.controller.middleware.parameters.one'], $_SERVER['route.test.controller.middleware.parameters.two']
<add> );
<add>
<add> $router = $this->getRouter();
<add>
<add> $router->get('foo/bar', [RouteTestControllerStub::class, 'index']);
<add>
<add> $this->assertEquals('Hello World', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent());
<add> $this->assertTrue($_SERVER['route.test.controller.middleware']);
<add> $this->assertEquals(\Illuminate\Http\Response::class, $_SERVER['route.test.controller.middleware.class']);
<add> $this->assertEquals(0, $_SERVER['route.test.controller.middleware.parameters.one']);
<add> $this->assertEquals(['foo', 'bar'], $_SERVER['route.test.controller.middleware.parameters.two']);
<add> $this->assertFalse(isset($_SERVER['route.test.controller.except.middleware']));
<add> }
<add>
<ide> public function testCallableControllerRouting()
<ide> {
<ide> $router = $this->getRouter();
| 2
|
Java
|
Java
|
add a unit test for debounce's backpressure issue
|
8b6035208b8995a8d246b8bc743b9e86a70d88cd
|
<ide><path>src/test/java/rx/internal/operators/OperatorDebounceTest.java
<ide> import static org.mockito.Mockito.times;
<ide> import static org.mockito.Mockito.verify;
<ide>
<add>import java.util.Arrays;
<ide> import java.util.concurrent.TimeUnit;
<ide>
<ide> import org.junit.Before;
<ide> import rx.exceptions.TestException;
<ide> import rx.functions.Action0;
<ide> import rx.functions.Func1;
<add>import rx.observers.TestSubscriber;
<ide> import rx.schedulers.TestScheduler;
<ide> import rx.subjects.PublishSubject;
<ide>
<ide> public Observable<Integer> call(Integer t1) {
<ide> verify(o).onCompleted();
<ide> verify(o, never()).onError(any(Throwable.class));
<ide> }
<add>
<add> @Test
<add> public void debounceWithTimeBackpressure() throws InterruptedException {
<add> TestScheduler scheduler = new TestScheduler();
<add> TestSubscriber<Integer> subscriber = new TestSubscriber<Integer>();
<add> Observable.merge(
<add> Observable.just(1),
<add> Observable.just(2).delay(10, TimeUnit.MILLISECONDS, scheduler)
<add> ).debounce(20, TimeUnit.MILLISECONDS, scheduler).take(1).subscribe(subscriber);
<add>
<add> scheduler.advanceTimeBy(30, TimeUnit.MILLISECONDS);
<add>
<add> subscriber.assertReceivedOnNext(Arrays.asList(2));
<add> subscriber.assertTerminalEvent();
<add> subscriber.assertNoErrors();
<add> }
<ide> }
<ide>\ No newline at end of file
| 1
|
Javascript
|
Javascript
|
fix eslint crash on empty react effect hook
|
e8eff119e036485b74b2acb6f57045390703f6fb
|
<ide><path>packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js
<ide> const tests = {
<ide> },
<ide> ],
<ide> },
<add> {
<add> code: normalizeIndent`
<add> function MyComponent() {
<add> useEffect()
<add> useLayoutEffect()
<add> useCallback()
<add> useMemo()
<add> }
<add> `,
<add> errors: [
<add> {
<add> message:
<add> 'React Hook useEffect requires an effect callback. ' +
<add> 'Did you forget to pass a callback to the hook?',
<add> suggestions: undefined,
<add> },
<add> {
<add> message:
<add> 'React Hook useLayoutEffect requires an effect callback. ' +
<add> 'Did you forget to pass a callback to the hook?',
<add> suggestions: undefined,
<add> },
<add> {
<add> message:
<add> 'React Hook useCallback requires an effect callback. ' +
<add> 'Did you forget to pass a callback to the hook?',
<add> suggestions: undefined,
<add> },
<add> {
<add> message:
<add> 'React Hook useMemo requires an effect callback. ' +
<add> 'Did you forget to pass a callback to the hook?',
<add> suggestions: undefined,
<add> },
<add> ],
<add> },
<ide> {
<ide> // Regression test
<ide> code: normalizeIndent`
<ide><path>packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
<ide> export default {
<ide> const declaredDependenciesNode = node.arguments[callbackIndex + 1];
<ide> const isEffect = /Effect($|[^a-z])/g.test(reactiveHookName);
<ide>
<add> // Check whether a callback is supplied. If there is no callback supplied
<add> // then the hook will not work and React will throw a TypeError.
<add> // So no need to check for dependency inclusion.
<add> if (!callback) {
<add> reportProblem({
<add> node: reactiveHook,
<add> message:
<add> `React Hook ${reactiveHookName} requires an effect callback. ` +
<add> `Did you forget to pass a callback to the hook?`,
<add> });
<add> return;
<add> }
<add>
<ide> // Check the declared dependencies for this reactive hook. If there is no
<ide> // second argument then the reactive callback will re-run on every render.
<ide> // So no need to check for dependency inclusion.
| 2
|
Javascript
|
Javascript
|
remove animated prop
|
1e9db7bd6df3055b9b81d23f15a54bb250621a41
|
<ide><path>Libraries/Modal/Modal.js
<ide> export type Props = $ReadOnly<{|
<ide> */
<ide> onDismiss?: ?() => mixed,
<ide>
<del> /**
<del> * Deprecated. Use the `animationType` prop instead.
<del> */
<del> animated?: ?boolean,
<del>
<ide> /**
<ide> * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
<ide> *
<ide> class Modal extends React.Component<Props> {
<ide> backgroundColor: this.props.transparent ? 'transparent' : 'white',
<ide> };
<ide>
<del> let animationType = this.props.animationType;
<del> if (!animationType) {
<del> // manually setting default prop here to keep support for the deprecated 'animated' prop
<del> animationType = 'none';
<del> if (this.props.animated) {
<del> animationType = 'slide';
<del> }
<del> }
<add> let animationType = this.props.animationType || 'none';
<ide>
<ide> let presentationStyle = this.props.presentationStyle;
<ide> if (!presentationStyle) {
| 1
|
PHP
|
PHP
|
handle `0.ctp` template name
|
a11a1032a455bfb5e0b4adcf0851afe460b5ded7
|
<ide><path>src/Mailer/Mailer.php
<ide> public function send($action, $args = [], $headers = [])
<ide>
<ide> call_user_func_array([$this, $action], $args);
<ide>
<del> if (empty($this->template)) {
<add> if ($this->template === null) {
<ide> $this->template = $action;
<ide> }
<ide>
| 1
|
Go
|
Go
|
add option to enable networkdb debug
|
a97e45794ea8318a08daf763a5b63b04184a886b
|
<ide><path>cmd/dockerd/config.go
<ide> func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
<ide> flags.IntVar(&maxConcurrentDownloads, "max-concurrent-downloads", config.DefaultMaxConcurrentDownloads, "Set the max concurrent downloads for each pull")
<ide> flags.IntVar(&maxConcurrentUploads, "max-concurrent-uploads", config.DefaultMaxConcurrentUploads, "Set the max concurrent uploads for each push")
<ide> flags.IntVar(&conf.ShutdownTimeout, "shutdown-timeout", defaultShutdownTimeout, "Set the default shutdown timeout")
<add> flags.IntVar(&conf.NetworkDiagnosticPort, "network-diagnostic-port", 0, "TCP port number of the network diagnostic server")
<add> flags.MarkHidden("network-diagnostic-port")
<ide>
<ide> flags.StringVar(&conf.SwarmDefaultAdvertiseAddr, "swarm-default-advertise-addr", "", "Set default address or interface for swarm advertised address")
<ide> flags.BoolVar(&conf.Experimental, "experimental", false, "Enable experimental features")
<ide><path>daemon/config/config.go
<ide> type CommonTLSOptions struct {
<ide> // It includes json tags to deserialize configuration from a file
<ide> // using the same names that the flags in the command line use.
<ide> type CommonConfig struct {
<del> AuthzMiddleware *authorization.Middleware `json:"-"`
<del> AuthorizationPlugins []string `json:"authorization-plugins,omitempty"` // AuthorizationPlugins holds list of authorization plugins
<del> AutoRestart bool `json:"-"`
<del> Context map[string][]string `json:"-"`
<del> DisableBridge bool `json:"-"`
<del> DNS []string `json:"dns,omitempty"`
<del> DNSOptions []string `json:"dns-opts,omitempty"`
<del> DNSSearch []string `json:"dns-search,omitempty"`
<del> ExecOptions []string `json:"exec-opts,omitempty"`
<del> GraphDriver string `json:"storage-driver,omitempty"`
<del> GraphOptions []string `json:"storage-opts,omitempty"`
<del> Labels []string `json:"labels,omitempty"`
<del> Mtu int `json:"mtu,omitempty"`
<del> Pidfile string `json:"pidfile,omitempty"`
<del> RawLogs bool `json:"raw-logs,omitempty"`
<del> RootDeprecated string `json:"graph,omitempty"`
<del> Root string `json:"data-root,omitempty"`
<del> ExecRoot string `json:"exec-root,omitempty"`
<del> SocketGroup string `json:"group,omitempty"`
<del> CorsHeaders string `json:"api-cors-header,omitempty"`
<add> AuthzMiddleware *authorization.Middleware `json:"-"`
<add> AuthorizationPlugins []string `json:"authorization-plugins,omitempty"` // AuthorizationPlugins holds list of authorization plugins
<add> AutoRestart bool `json:"-"`
<add> Context map[string][]string `json:"-"`
<add> DisableBridge bool `json:"-"`
<add> DNS []string `json:"dns,omitempty"`
<add> DNSOptions []string `json:"dns-opts,omitempty"`
<add> DNSSearch []string `json:"dns-search,omitempty"`
<add> ExecOptions []string `json:"exec-opts,omitempty"`
<add> GraphDriver string `json:"storage-driver,omitempty"`
<add> GraphOptions []string `json:"storage-opts,omitempty"`
<add> Labels []string `json:"labels,omitempty"`
<add> Mtu int `json:"mtu,omitempty"`
<add> NetworkDiagnosticPort int `json:"network-diagnostic-port,omitempty"`
<add> Pidfile string `json:"pidfile,omitempty"`
<add> RawLogs bool `json:"raw-logs,omitempty"`
<add> RootDeprecated string `json:"graph,omitempty"`
<add> Root string `json:"data-root,omitempty"`
<add> ExecRoot string `json:"exec-root,omitempty"`
<add> SocketGroup string `json:"group,omitempty"`
<add> CorsHeaders string `json:"api-cors-header,omitempty"`
<ide>
<ide> // TrustKeyPath is used to generate the daemon ID and for signing schema 1 manifests
<ide> // when pushing to a registry which does not support schema 2. This field is marked as
<ide><path>daemon/reload.go
<ide> func (daemon *Daemon) Reload(conf *config.Config) (err error) {
<ide> if err := daemon.reloadLiveRestore(conf, attributes); err != nil {
<ide> return err
<ide> }
<add> if err := daemon.reloadNetworkDiagnosticPort(conf, attributes); err != nil {
<add> return err
<add> }
<ide> return nil
<ide> }
<ide>
<ide> func (daemon *Daemon) reloadLiveRestore(conf *config.Config, attributes map[stri
<ide> attributes["live-restore"] = fmt.Sprintf("%t", daemon.configStore.LiveRestoreEnabled)
<ide> return nil
<ide> }
<add>
<add>// reloadNetworkDiagnosticPort updates the network controller starting the diagnose mode if the config is valid
<add>func (daemon *Daemon) reloadNetworkDiagnosticPort(conf *config.Config, attributes map[string]string) error {
<add> if conf == nil || daemon.netController == nil {
<add> return nil
<add> }
<add> // Enable the network diagnose if the flag is set with a valid port withing the range
<add> if conf.IsValueSet("network-diagnostic-port") && conf.NetworkDiagnosticPort > 0 && conf.NetworkDiagnosticPort < 65536 {
<add> logrus.Warnf("Calling the diagnostic start with %d", conf.NetworkDiagnosticPort)
<add> daemon.netController.StartDiagnose(conf.NetworkDiagnosticPort)
<add> } else {
<add> daemon.netController.StopDiagnose()
<add> }
<add> return nil
<add>}
<ide><path>daemon/reload_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/discovery"
<ide> _ "github.com/docker/docker/pkg/discovery/memory"
<ide> "github.com/docker/docker/registry"
<add> "github.com/docker/libnetwork"
<ide> "github.com/stretchr/testify/assert"
<ide> )
<ide>
<ide> func TestDaemonDiscoveryReloadOnlyClusterAdvertise(t *testing.T) {
<ide> t.Fatal(e)
<ide> }
<ide> }
<add>
<add>func TestDaemonReloadNetworkDiagnosticPort(t *testing.T) {
<add> daemon := &Daemon{}
<add> daemon.configStore = &config.Config{}
<add>
<add> valuesSet := make(map[string]interface{})
<add> valuesSet["network-diagnostic-port"] = 2000
<add> enableConfig := &config.Config{
<add> CommonConfig: config.CommonConfig{
<add> NetworkDiagnosticPort: 2000,
<add> ValuesSet: valuesSet,
<add> },
<add> }
<add> disableConfig := &config.Config{
<add> CommonConfig: config.CommonConfig{},
<add> }
<add>
<add> netOptions, err := daemon.networkOptions(enableConfig, nil, nil)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> controller, err := libnetwork.New(netOptions...)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> daemon.netController = controller
<add>
<add> // Enable/Disable the server for some iterations
<add> for i := 0; i < 10; i++ {
<add> enableConfig.CommonConfig.NetworkDiagnosticPort++
<add> if err := daemon.Reload(enableConfig); err != nil {
<add> t.Fatal(err)
<add> }
<add> // Check that the diagnose is enabled
<add> if !daemon.netController.IsDiagnoseEnabled() {
<add> t.Fatalf("diagnosed should be enable")
<add> }
<add>
<add> // Reload
<add> if err := daemon.Reload(disableConfig); err != nil {
<add> t.Fatal(err)
<add> }
<add> // Check that the diagnose is disabled
<add> if daemon.netController.IsDiagnoseEnabled() {
<add> t.Fatalf("diagnosed should be disable")
<add> }
<add> }
<add>
<add> enableConfig.CommonConfig.NetworkDiagnosticPort++
<add> // 2 times the enable should not create problems
<add> if err := daemon.Reload(enableConfig); err != nil {
<add> t.Fatal(err)
<add> }
<add> // Check that the diagnose is enabled
<add> if !daemon.netController.IsDiagnoseEnabled() {
<add> t.Fatalf("diagnosed should be enable")
<add> }
<add>
<add> // Check that another reload does not cause issues
<add> if err := daemon.Reload(enableConfig); err != nil {
<add> t.Fatal(err)
<add> }
<add> // Check that the diagnose is enable
<add> if !daemon.netController.IsDiagnoseEnabled() {
<add> t.Fatalf("diagnosed should be enable")
<add> }
<add>
<add>}
| 4
|
Mixed
|
Javascript
|
add resetcalls to mockfunctioncontext
|
01b7ac60512fe6948dea108a03f06a951bdc02fa
|
<ide><path>doc/api/test.md
<ide> test('changes a mock behavior once', (t) => {
<ide> });
<ide> ```
<ide>
<add>### `ctx.resetCalls()`
<add>
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>Resets the call history of the mock function.
<add>
<ide> ### `ctx.restore()`
<ide>
<ide> <!-- YAML
<ide><path>lib/internal/test_runner/mock.js
<ide> class MockFunctionContext {
<ide> }
<ide> }
<ide>
<add> resetCalls() {
<add> this.#calls = [];
<add> }
<add>
<ide> trackCall(call) {
<ide> ArrayPrototypePush(this.#calls, call);
<ide> }
<ide><path>test/parallel/test-runner-mocking.js
<ide> test('local mocks are auto restored after the test finishes', async (t) => {
<ide> assert.strictEqual(originalBar, obj.bar);
<ide> });
<ide>
<add>test('reset mock calls', (t) => {
<add> const sum = (arg1, arg2) => arg1 + arg2;
<add> const difference = (arg1, arg2) => arg1 - arg2;
<add> const fn = t.mock.fn(sum, difference);
<add>
<add> assert.strictEqual(fn(1, 2), -1);
<add> assert.strictEqual(fn(2, 1), 1);
<add> assert.strictEqual(fn.mock.calls.length, 2);
<add> assert.strictEqual(fn.mock.callCount(), 2);
<add>
<add> fn.mock.resetCalls();
<add> assert.strictEqual(fn.mock.calls.length, 0);
<add> assert.strictEqual(fn.mock.callCount(), 0);
<add>
<add> assert.strictEqual(fn(3, 2), 1);
<add>});
<add>
<ide> test('uses top level mock', () => {
<ide> function sum(a, b) {
<ide> return a + b;
| 3
|
Javascript
|
Javascript
|
add react production aliases
|
87773b98dc08391d023898aea6413d922e80c89b
|
<ide><path>server/build/webpack.js
<ide> export default async function createCompiler (dir, { dev = false, quiet = false,
<ide> performance: { hints: false }
<ide> }
<ide>
<add> if (!dev) {
<add> webpackConfig.resolve.alias = {
<add> 'react': require.resolve('react/dist/react.min.js'),
<add> 'react-dom': require.resolve('react-dom/dist/react-dom.min.js'),
<add> 'react-dom/server': require.resolve('react-dom/dist/react-dom-server.min.js')
<add> }
<add> }
<add>
<ide> if (config.webpack) {
<ide> console.log('> Using "webpack" config function defined in next.config.js.')
<ide> webpackConfig = await config.webpack(webpackConfig, { dev })
| 1
|
Go
|
Go
|
fix a longstanding todo
|
61dad306b12f4d48d3643d9331c059b9cdef731c
|
<ide><path>daemon/oci_windows.go
<ide> func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
<ide> return nil, err
<ide> }
<ide>
<del> // TODO Windows - this can be removed. Not used (UID/GID)
<del> rootUID, rootGID := daemon.GetRemappedUIDGID()
<del> if err := c.SetupWorkingDirectory(rootUID, rootGID); err != nil {
<add> if err := c.SetupWorkingDirectory(0, 0); err != nil {
<ide> return nil, err
<ide> }
<ide>
| 1
|
Ruby
|
Ruby
|
check core tap is installed
|
25e61f65dbd57836cd6a42af7c941b2a91c406df
|
<ide><path>Library/Homebrew/cmd/update-report.rb
<ide> def update_report
<ide> args = update_report_args.parse
<ide>
<ide> # Run `brew update` (again) if we've got a linuxbrew-core CoreTap
<del> if CoreTap.instance.linuxbrew_core? && ENV["HOMEBREW_LINUXBREW_CORE_MIGRATION"].blank?
<add> if CoreTap.instance.installed? && CoreTap.instance.linuxbrew_core? &&
<add> ENV["HOMEBREW_LINUXBREW_CORE_MIGRATION"].blank?
<ide> ohai_stdout_or_stderr "Re-running `brew update` for linuxbrew-core migration"
<ide>
<ide> if ENV["HOMEBREW_CORE_DEFAULT_GIT_REMOTE"] != ENV["HOMEBREW_CORE_GIT_REMOTE"]
| 1
|
Javascript
|
Javascript
|
add picture on github signin/up
|
83397b7e1b302ceaadd1e9f22a6673000d3e7439
|
<ide><path>common/models/User-Identity.js
<ide> function setProfileFromGithub(
<ide> username
<ide> },
<ide> {
<del> location,
<del> email: githubEmail,
<ide> id: githubId,
<add> 'avatar_url': picture,
<add> email: githubEmail,
<ide> 'created_at': joinedGithubOn,
<ide> blog: website,
<add> location,
<ide> name
<ide> }
<ide> ) {
<ide> function setProfileFromGithub(
<ide> location,
<ide> joinedGithubOn,
<ide> website,
<add> picture,
<ide> githubId,
<ide> githubURL,
<ide> githubEmail,
<ide><path>server/server.js
<ide> function setProfileFromGithub(
<ide> username
<ide> },
<ide> {
<del> location,
<del> email: githubEmail,
<ide> id: githubId,
<add> 'avatar_url': picture,
<add> email: githubEmail,
<ide> 'created_at': joinedGithubOn,
<ide> blog: website,
<add> location,
<ide> name
<ide> }
<ide> ) {
<ide> function setProfileFromGithub(
<ide> location,
<ide> joinedGithubOn,
<ide> website,
<add> picture,
<ide> githubId,
<ide> githubURL,
<ide> githubEmail,
| 2
|
Python
|
Python
|
add druidoperator template_fields_renderers fields
|
5cd8085d27fc214465259161b802c244a0dce4bf
|
<ide><path>airflow/providers/apache/druid/operators/druid.py
<ide> class DruidOperator(BaseOperator):
<ide>
<ide> template_fields = ('json_index_file',)
<ide> template_ext = ('.json',)
<add> template_fields_renderers = {'json_index_file': 'json'}
<ide>
<ide> def __init__(
<ide> self,
| 1
|
Python
|
Python
|
update standard name
|
a003256bdc63c13db6840058b3566c0b3bf90f9c
|
<ide><path>keras/utils/timeseries_dataset.py
<ide> def timeseries_dataset_from_array(
<ide> ```python
<ide> input_data = data[:-10]
<ide> targets = data[10:]
<del> dataset = tf.keras.preprocessing.timeseries_dataset_from_array(
<add> dataset = tf.keras.utils.timeseries_dataset_from_array(
<ide> input_data, targets, sequence_length=10)
<ide> for batch in dataset:
<ide> inputs, targets = batch
<ide> def timeseries_dataset_from_array(
<ide> Y = X*2
<ide>
<ide> sample_length = 20
<del> input_dataset = tf.keras.preprocessing.timeseries_dataset_from_array(
<add> input_dataset = tf.keras.utils.timeseries_dataset_from_array(
<ide> X, None, sequence_length=sample_length, sequence_stride=sample_length)
<del> target_dataset = tf.keras.preprocessing.timeseries_dataset_from_array(
<add> target_dataset = tf.keras.utils.timeseries_dataset_from_array(
<ide> Y, None, sequence_length=sample_length, sequence_stride=sample_length)
<ide>
<ide> for batch in zip(input_dataset, target_dataset):
| 1
|
Text
|
Text
|
put information about the past in details tags
|
60646cade747d4b4a0ebbb8ef98d86eb95fdd379
|
<ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> * [Trott](https://github.com/Trott) -
<ide> **Rich Trott** <rtrott@gmail.com> (he/him)
<ide>
<add><details>
<add>
<add><summary>Emeriti</summary>
<add>
<ide> ### TSC emeriti
<ide>
<ide> * [addaleax](https://github.com/addaleax) -
<ide> For information about the governance of the Node.js project, see
<ide> * [trevnorris](https://github.com/trevnorris) -
<ide> **Trevor Norris** <trev.norris@gmail.com>
<ide>
<add></details>
<add>
<ide> ### Collaborators
<ide>
<ide> * [addaleax](https://github.com/addaleax) -
<ide> For information about the governance of the Node.js project, see
<ide> * [ZYSzys](https://github.com/ZYSzys) -
<ide> **Yongsheng Zhang** <zyszys98@gmail.com> (he/him)
<ide>
<add><details>
<add>
<add><summary>Emeriti</summary>
<add>
<ide> ### Collaborator emeriti
<ide>
<ide> * [andrasq](https://github.com/andrasq) -
<ide> For information about the governance of the Node.js project, see
<ide> **Vse Mozhet Byt** <vsemozhetbyt@gmail.com> (he/him)
<ide> * [whitlockjc](https://github.com/whitlockjc) -
<ide> **Jeremy Whitlock** <jwhitlock@apache.org>
<add>
<add></details>
<ide> <!--lint enable prohibited-strings-->
<ide>
<ide> Collaborators follow the [Collaborator Guide](./doc/guides/collaborator-guide.md) in
<ide> gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF139
<ide> See the section above on [Verifying Binaries](#verifying-binaries) for how to
<ide> use these keys to verify a downloaded file.
<ide>
<del>Other keys used to sign some previous releases:
<add><details>
<add>
<add><summary>Other keys used to sign some previous releases</summary>
<ide>
<ide> * **Chris Dickinson** <christopher.s.dickinson@gmail.com>
<ide> `9554F04D7259F04124DE6B476D5A82AC7E37093B`
<ide> Other keys used to sign some previous releases:
<ide> * **Timothy J Fontaine** <tjfontaine@gmail.com>
<ide> `7937DFD2AB06298B2293C3187D33FF9D0246406D`
<ide>
<add></details>
<add>
<ide> ## License
<ide>
<ide> Node.js is available under the
| 1
|
Text
|
Text
|
improve text input docs
|
76f8f4261509bfe37b46cf576269b260c4d14e1a
|
<ide><path>docs/HandlingTextInput.md
<ide> next: using-a-scrollview
<ide> ---
<ide>
<ide> [`TextInput`](/react-native/docs/textinput.html#content) is a basic component that allows the user to enter text. It has an `onChangeText` prop that takes
<del>a function to be called every time the text changed.
<add>a function to be called every time the text changed, and an `onSubmitEditing` prop that takes a function to be called when the text is submitted.
<ide>
<del>This example shows how to count the number of characters that have been typed in a box.
<add>For example, let's say that as the user types, you're translating their words into a different language. In this new language, every single word is written the same way: 🍕. So the sentence "Hello there Bob" would be translated
<add>as "🍕🍕🍕".
<ide>
<ide> ```ReactNativeWebPlayer
<ide> import React, { Component } from 'react';
<ide> import { AppRegistry, Text, TextInput, View } from 'react-native';
<ide>
<del>class CharacterCounter extends Component {
<add>class PizzaTranslator extends Component {
<ide> constructor(props) {
<ide> super(props);
<ide> this.state = {text: ''};
<ide> class CharacterCounter extends Component {
<ide> <View style={{padding: 10}}>
<ide> <TextInput
<ide> style={{height: 40}}
<del> placeholder="Pleeeease type on me!"
<add> placeholder="Type here to translate!"
<ide> onChangeText={(text) => this.setState({text})}
<ide> />
<del> <Text style={{padding: 10}}>{this.state.text.length}</Text>
<add> <Text style={{padding: 10, fontSize: 42}}>
<add> {this.state.text.split(' ').map((word) => word && '🍕').join(' ')}
<add> </Text>
<ide> </View>
<ide> );
<ide> }
<ide> }
<ide>
<del>AppRegistry.registerComponent('CharacterCounter', () => CharacterCounter);
<add>AppRegistry.registerComponent('PizzaTranslator', () => PizzaTranslator);
<ide> ```
<ide>
<ide> In this example, we store `text` in the state, because it changes over time.
<ide>
<del>There are a lot more advanced things you might want to do with a text input. For example, you could validate the text inside while the user types. For more detailed examples, see the [React docs on controlled components](https://facebook.github.io/react/docs/forms.html), or the [reference docs for TextInput](/react-native/docs/textinput.html).
<add>There are a lot more things you might want to do with a text input. For example, you could validate the text inside while the user types. For more detailed examples, see the [React docs on controlled components](https://facebook.github.io/react/docs/forms.html), or the [reference docs for TextInput](/react-native/docs/textinput.html).
<ide>
<ide> Text input is probably the simplest example of a component whose state naturally changes over time. Next, let's look at another type of component like this is one that controls layout, and [learn about the ScrollView](/react-native/docs/using-a-scrollview.html).
| 1
|
Text
|
Text
|
remove unmaintained gem from readme [ci skip]
|
32bb46899d7a0a8827cb43fe0382cd14a2d841c3
|
<ide><path>activejob/README.md
<ide> their gem, or as a stand-alone gem. For discussion about this see the
<ide> following PRs: [23311](https://github.com/rails/rails/issues/23311#issuecomment-176275718),
<ide> [21406](https://github.com/rails/rails/pull/21406#issuecomment-138813484), and [#32285](https://github.com/rails/rails/pull/32285).
<ide>
<del>## Auxiliary gems
<del>
<del>* [activejob-stats](https://github.com/seuros/activejob-stats)
<ide>
<ide> ## Download and installation
<ide>
<ide> Source code can be downloaded as part of the Rails project on GitHub:
<ide>
<ide> * https://github.com/rails/rails/tree/master/activejob
<ide>
<add>
<ide> ## License
<ide>
<ide> Active Job is released under the MIT license:
| 1
|
PHP
|
PHP
|
fix delete queries with alias on sqlite
|
5369bec0dd94eb8f0b4cbff4da98c0dae4c74729
|
<ide><path>src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
<ide> public function prepareBindingsForUpdate(array $bindings, array $values)
<ide> public function compileDelete(Builder $query)
<ide> {
<ide> if (isset($query->joins) || isset($query->limit)) {
<del> $selectSql = parent::compileSelect($query->select("{$query->from}.rowid"));
<del>
<del> return "delete from {$this->wrapTable($query->from)} where {$this->wrap('rowid')} in ({$selectSql})";
<add> return $this->compileDeleteWithJoinsOrLimit($query);
<ide> }
<ide>
<ide> $wheres = is_array($query->wheres) ? $this->compileWheres($query) : '';
<ide>
<ide> return trim("delete from {$this->wrapTable($query->from)} $wheres");
<ide> }
<ide>
<add> /**
<add> * Compile a delete statement with joins or limit into SQL.
<add> *
<add> * @param \Illuminate\Database\Query\Builder $query
<add> * @return string
<add> */
<add> protected function compileDeleteWithJoinsOrLimit(Builder $query)
<add> {
<add> $segments = preg_split('/\s+as\s+/i', $query->from);
<add>
<add> $alias = $segments[1] ?? $segments[0];
<add>
<add> $selectSql = parent::compileSelect($query->select($alias.'.rowid'));
<add>
<add> return "delete from {$this->wrapTable($query->from)} where {$this->wrap('rowid')} in ({$selectSql})";
<add> }
<add>
<ide> /**
<ide> * Prepare the bindings for a delete statement.
<ide> *
<ide><path>tests/Database/DatabaseQueryBuilderTest.php
<ide> public function testDeleteWithJoinMethod()
<ide> $result = $builder->from('users')->join('contacts', 'users.id', '=', 'contacts.id')->where('users.email', '=', 'foo')->orderBy('users.id')->limit(1)->delete();
<ide> $this->assertEquals(1, $result);
<ide>
<add> $builder = $this->getSqliteBuilder();
<add> $builder->getConnection()->shouldReceive('delete')->once()->with('delete from "users" as "u" where "rowid" in (select "u"."rowid" from "users" as "u" inner join "contacts" as "c" on "u"."id" = "c"."id")', [])->andReturn(1);
<add> $result = $builder->from('users as u')->join('contacts as c', 'u.id', '=', 'c.id')->delete();
<add> $this->assertEquals(1, $result);
<add>
<ide> $builder = $this->getMySqlBuilder();
<ide> $builder->getConnection()->shouldReceive('delete')->once()->with('delete `users` from `users` inner join `contacts` on `users`.`id` = `contacts`.`id` where `email` = ?', ['foo'])->andReturn(1);
<ide> $result = $builder->from('users')->join('contacts', 'users.id', '=', 'contacts.id')->where('email', '=', 'foo')->orderBy('id')->limit(1)->delete();
| 2
|
Go
|
Go
|
fix typo in log-message
|
5c3418e38b9603e8ff582d53c2face57f0f01cce
|
<ide><path>libcontainerd/remote_daemon.go
<ide> func (r *remote) monitorConnection(client *containerd.Client) {
<ide>
<ide> select {
<ide> case <-r.shutdownContext.Done():
<del> r.logger.Info("stopping healtcheck following graceful shutdown")
<add> r.logger.Info("stopping healthcheck following graceful shutdown")
<ide> client.Close()
<ide> return
<ide> default:
| 1
|
Text
|
Text
|
change incorrect link on contribute page
|
b8667061a100c904f57ff7dcf242c0f8db61c31f
|
<ide><path>docs/index.md
<ide> You can help expand and improve the curriculum. You can also update project user
<ide>
<ide> We are localizing freeCodeCamp.org to major world languages.
<ide>
<del>Certifications are already live in some major world languages like [Chinese (中文)](https://chinese.freecodecamp.org/learn), [Spanish (Español)](https://www.freecodecamp.org/espanol/learn/), [Italian (Italiano)](https://www.freecodecamp.org/espanol/learn/), [Portuguese (Português)](https://www.freecodecamp.org/espanol/learn/). We encourage you to read the [announcement here](https://www.freecodecamp.org/news/world-language-translation-effort) and share it with your friends to get them excited about this.
<add>Certifications are already live in some major world languages like [Chinese (中文)](https://chinese.freecodecamp.org/learn), [Spanish (Español)](https://www.freecodecamp.org/espanol/learn), [Italian (Italiano)](https://www.freecodecamp.org/italian/learn), [Portuguese (Português)](https://www.freecodecamp.org/portuguese/learn). We encourage you to read the [announcement here](https://www.freecodecamp.org/news/world-language-translation-effort) and share it with your friends to get them excited about this.
<ide>
<ide> **If you're interested in translating, here's [how to translate freeCodeCamp's resources](how-to-translate-files.md).**
<ide>
| 1
|
Text
|
Text
|
remove duplicate code block
|
0d483049f0296a5ec1f40d729afa9af98823bb1a
|
<ide><path>docs/devops.md
<ide> Provisioning VMs with the Code
<ide> cd client
<ide> ```
<ide>
<del> ```console
<del> git clone https://github.com/freeCodeCamp/client-config.git client
<del> cd client
<del> ```
<del>
<ide> Start placeholder instances for the web client, these will be updated with
<ide> artifacts from the Azure pipeline.
<ide>
| 1
|
Text
|
Text
|
move changelog to the top [ci skip]
|
877dfcbb6437acfd56c7ead4f9998b5b0bf82c0e
|
<ide><path>activerecord/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* Fix associations with `:inverse_of` option when building association
<add> with a block. Inside the block the parent object was different then
<add> after the block.
<add>
<add> Example:
<add>
<add> parent.association.build do |child|
<add> child.parent.equal?(parent) # false
<add> end
<add>
<add> # vs
<add>
<add> child = parent.association.build
<add> child.parent.equal?(parent) # true
<add>
<add> *Michal Cichra*
<add>
<ide> * `has_many` using `:through` now obeys the order clause mentioned in
<ide> through association. Fixes #10016.
<ide>
<ide> # This will expand the order :name to "authors".name.
<ide> Author.joins(:books).where('books.published = 1').order(:name)
<ide>
<del>* Fix associations with `:inverse_of` option when building association
<del> with a block. Inside the block the parent object was different then
<del> after the block.
<del>
<del> Example:
<del>
<del> parent.association.build do |child|
<del> child.parent.equal?(parent) # false
<del> end
<del>
<del> # vs
<del>
<del> child = parent.association.build
<del> child.parent.equal?(parent) # true
<del>
<del> *Michal Cichra*
<del>
<ide>
<ide> ## Rails 4.0.0.beta1 (February 25, 2013) ##
<ide>
| 1
|
Python
|
Python
|
use np.ndim not asarray, to allow duck-types
|
24508c1220a608df116db9035df30418bfc74a9b
|
<ide><path>numpy/lib/function_base.py
<ide> def gradient(f, *varargs, **kwargs):
<ide> S0025-5718-1988-0935077-0/S0025-5718-1988-0935077-0.pdf>`_.
<ide> """
<ide> f = np.asanyarray(f)
<del> varargs = [asanyarray(d) for d in varargs]
<ide> N = f.ndim # number of dimensions
<ide>
<ide> axes = kwargs.pop('axis', None)
<ide> def gradient(f, *varargs, **kwargs):
<ide> n = len(varargs)
<ide> if n == 0:
<ide> # no spacing argument - use 1 in all axes
<del> dx = [np.array(1.0)] * len_axes
<del> elif n == 1 and varargs[0].ndim == 0:
<add> dx = [1.0] * len_axes
<add> elif n == 1 and np.ndim(varargs[0]) == 0:
<ide> # single scalar for all axes
<ide> dx = varargs * len_axes
<ide> elif n == len_axes:
<ide> # scalar or 1d array for each axis
<del> dx = varargs[:]
<add> dx = list(varargs)
<ide> for i, distances in enumerate(dx):
<del> if distances.ndim == 0:
<add> if np.ndim(distances) == 0:
<ide> continue
<del> elif distances.ndim != 1:
<add> elif np.ndim(distances) != 1:
<ide> raise ValueError("distances must be either scalars or 1d")
<ide> if len(distances) != f.shape[axes[i]]:
<ide> raise ValueError("when 1d, distances must match "
<ide> def gradient(f, *varargs, **kwargs):
<ide> # result allocation
<ide> out = np.empty_like(y, dtype=otype)
<ide>
<del> uniform_spacing = dx[i].ndim == 0
<add> uniform_spacing = np.ndim(dx[i]) == 0
<ide>
<ide> # Numerical differentiation: 2nd order interior
<ide> slice1[axis] = slice(1, -1)
| 1
|
Go
|
Go
|
add todo for config reload logic
|
c46e2e85ee54d9c0b3addeec0a8058a247adeb6b
|
<ide><path>daemon/config/config.go
<ide> func Reload(configFile string, flags *pflag.FlagSet, reload func(*Config)) error
<ide> }
<ide> newConfig.Labels = newLabels
<ide>
<add> // TODO(thaJeztah) This logic is problematic and needs a rewrite;
<add> // This is validating newConfig before the "reload()" callback is executed.
<add> // At this point, newConfig may be a partial configuration, to be merged
<add> // with the existing configuration in the "reload()" callback. Validating
<add> // this config before it's merged can result in incorrect validation errors.
<add> //
<add> // However, the current "reload()" callback we use is DaemonCli.reloadConfig(),
<add> // which includes a call to Daemon.Reload(), which both performs "merging"
<add> // and validation, as well as actually updating the daemon configuration.
<add> // Calling DaemonCli.reloadConfig() *before* validation, could thus lead to
<add> // a failure in that function (making the reload non-atomic).
<add> //
<add> // While *some* errors could always occur when applying/updating the config,
<add> // we should make it more atomic, and;
<add> //
<add> // 1. get (a copy of) the active configuration
<add> // 2. get the new configuration
<add> // 3. apply the (reloadable) options from the new configuration
<add> // 4. validate the merged results
<add> // 5. apply the new configuration.
<ide> if err := Validate(newConfig); err != nil {
<ide> return errors.Wrap(err, "file configuration validation failed")
<ide> }
| 1
|
Text
|
Text
|
add contributing guide
|
5f548627b319694f80ff9cbe4045633ccdd427ae
|
<ide><path>docs/index.md
<ide> * [Creating a Package](creating-a-package.md)
<ide> * [Creating a Theme](creating-a-theme.md)
<ide> * [Publishing a Package](publishing-a-package.md)
<add>* [Contributing](contributing.md)
<ide>
<ide> ### Advanced Topics
<ide>
| 1
|
Javascript
|
Javascript
|
test absolute span
|
f0b3212aad1f029393d99bb917556994a865fdb0
|
<ide><path>examples/js/loaders/FBXLoader.js
<ide> var initialValue = curve.values[ i - 1 ];
<ide> var valuesSpan = curve.values[ i ] - initialValue;
<ide>
<del> if ( valuesSpan >= 180 ) {
<add> var absoluteSpan = Math.abs( valuesSpan );
<ide>
<del> var numSubIntervals = Math.abs( valuesSpan / 180 );
<add> if ( absoluteSpan >= 180 ) {
<add>
<add> var numSubIntervals = absoluteSpan / 180;
<ide>
<ide> var step = valuesSpan / numSubIntervals;
<ide> var nextValue = initialValue + step;
| 1
|
Python
|
Python
|
maintain subclass info for `np.kron`
|
730f3154f48e33f22b2ea8814eb10a45aa273e17
|
<ide><path>numpy/lib/shape_base.py
<ide> def kron(a, b):
<ide> bs = (1,)*max(0, nda-ndb) + bs
<ide>
<ide> # Compute the product
<del> a_arr = _nx.asarray(a).reshape(a.size, 1)
<del> b_arr = _nx.asarray(b).reshape(1, b.size)
<del> result = a_arr * b_arr
<add> a_arr = a.reshape(a.size, 1)
<add> b_arr = b.reshape(1, b.size)
<add> is_any_mat = isinstance(a_arr, matrix) or isinstance(b_arr, matrix)
<add> # In case of `mat`, convert result to `array`
<add> result = _nx.multiply(a_arr, b_arr, subok=(not is_any_mat))
<ide>
<ide> # Reshape back
<ide> result = result.reshape(as_+bs)
<ide> transposer = _nx.arange(nd*2).reshape([2, nd]).ravel(order='f')
<ide> result = result.transpose(transposer)
<ide> result = result.reshape(_nx.multiply(as_, bs))
<ide>
<del> wrapper = get_array_prepare(a, b)
<del> if wrapper is not None:
<del> result = wrapper(result)
<del> wrapper = get_array_wrap(a, b)
<del> if wrapper is not None:
<del> result = wrapper(result)
<del> return result
<add> return result if not is_any_mat else matrix(result, copy=False)
<ide>
<ide>
<ide> def _tile_dispatcher(A, reps):
| 1
|
Python
|
Python
|
fix browser mode with python3
|
2dc3de8956411f8076e6356e345bf88aa31c6003
|
<ide><path>glances/outputs/glances_curses.py
<ide> def __init__(self, args=None):
<ide> 'OFFLINE': self.ifCRITICAL_color2,
<ide> 'PROTECTED': self.ifWARNING_color2,
<ide> }
<del> self.colors_list = dict(self.colors_list.items() + _colors_list.items())
<add> self.colors_list.update(_colors_list)
<ide>
<ide> # First time scan tag
<ide> # Used to display a specific message when the browser is started
| 1
|
Javascript
|
Javascript
|
fix typo in reactnativetypes
|
053b8f6c9377fdef294d11088ff5d7ed2c311a2f
|
<ide><path>Libraries/Renderer/shims/ReactNativeTypes.js
<ide> export type ReactNativeEventTarget = {
<ide> ...
<ide> };
<ide>
<del>export type ReactFaricEventTouch = {
<add>export type ReactFabricEventTouch = {
<ide> identifier: number,
<ide> locationX: number,
<ide> locationY: number,
<ide> export type ReactFaricEventTouch = {
<ide> ...
<ide> };
<ide>
<del>export type ReactFaricEvent = {
<del> touches: Array<ReactFaricEventTouch>,
<del> changedTouches: Array<ReactFaricEventTouch>,
<del> targetTouches: Array<ReactFaricEventTouch>,
<add>export type ReactFabricEvent = {
<add> touches: Array<ReactFabricEventTouch>,
<add> changedTouches: Array<ReactFabricEventTouch>,
<add> targetTouches: Array<ReactFabricEventTouch>,
<ide> target: number,
<ide> ...
<ide> };
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.