content_type
stringclasses 8
values | main_lang
stringclasses 7
values | message
stringlengths 1
50
| sha
stringlengths 40
40
| patch
stringlengths 52
962k
| file_count
int64 1
300
|
|---|---|---|---|---|---|
Javascript
|
Javascript
|
fix tintcolor prop platform in image
|
d3e5a96b1535e37f26faf7752ea0b724eb090744
|
<ide><path>Libraries/Image/ImageStylePropTypes.js
<ide> var ImageStylePropTypes = {
<ide> overflow: ReactPropTypes.oneOf(['visible', 'hidden']),
<ide>
<ide> /**
<del> * iOS-Specific style to "tint" an image.
<ide> * Changes the color of all the non-transparent pixels to the tintColor.
<del> * @platform ios
<ide> */
<ide> tintColor: ColorPropType,
<ide> opacity: ReactPropTypes.number,
| 1
|
Go
|
Go
|
fix race when reading exit status
|
a290f5d04cda8186eba93531b6f09bda8052717f
|
<ide><path>container/container.go
<ide> type Container struct {
<ide> Driver string
<ide> OS string
<ide> // MountLabel contains the options for the 'mount' command
<del> MountLabel string
<del> ProcessLabel string
<del> RestartCount int
<del> HasBeenStartedBefore bool
<del> HasBeenManuallyStopped bool // used for unless-stopped restart policy
<del> MountPoints map[string]*volumemounts.MountPoint
<del> HostConfig *containertypes.HostConfig `json:"-"` // do not serialize the host config in the json, otherwise we'll make the container unportable
<del> ExecCommands *exec.Store `json:"-"`
<del> DependencyStore agentexec.DependencyGetter `json:"-"`
<del> SecretReferences []*swarmtypes.SecretReference
<del> ConfigReferences []*swarmtypes.ConfigReference
<add> MountLabel string
<add> ProcessLabel string
<add> RestartCount int
<add> HasBeenStartedBefore bool
<add> HasBeenManuallyStopped bool // used for unless-stopped restart policy
<add> HasBeenManuallyRestarted bool `json:"-"` // used to distinguish restart caused by restart policy from the manual one
<add> MountPoints map[string]*volumemounts.MountPoint
<add> HostConfig *containertypes.HostConfig `json:"-"` // do not serialize the host config in the json, otherwise we'll make the container unportable
<add> ExecCommands *exec.Store `json:"-"`
<add> DependencyStore agentexec.DependencyGetter `json:"-"`
<add> SecretReferences []*swarmtypes.SecretReference
<add> ConfigReferences []*swarmtypes.ConfigReference
<ide> // logDriver for closing
<ide> LogDriver logger.Logger `json:"-"`
<ide> LogCopier *logger.Copier `json:"-"`
<ide><path>container/state.go
<ide> type State struct {
<ide> StartedAt time.Time
<ide> FinishedAt time.Time
<ide> Health *Health
<add> Removed bool `json:"-"`
<ide>
<del> waitStop chan struct{}
<del> waitRemove chan struct{}
<add> stopWaiters []chan<- StateStatus
<add> removeOnlyWaiters []chan<- StateStatus
<ide> }
<ide>
<ide> // StateStatus is used to return container wait results.
<ide> func (s StateStatus) Err() error {
<ide> return s.err
<ide> }
<ide>
<del>// NewState creates a default state object with a fresh channel for state changes.
<add>// NewState creates a default state object.
<ide> func NewState() *State {
<del> return &State{
<del> waitStop: make(chan struct{}),
<del> waitRemove: make(chan struct{}),
<del> }
<add> return &State{}
<ide> }
<ide>
<ide> // String returns a human-readable description of the state
<ide> func (s *State) Wait(ctx context.Context, condition WaitCondition) <-chan StateS
<ide> s.Lock()
<ide> defer s.Unlock()
<ide>
<del> if condition == WaitConditionNotRunning && !s.Running {
<del> // Buffer so we can put it in the channel now.
<del> resultC := make(chan StateStatus, 1)
<add> // Buffer so we can put status and finish even nobody receives it.
<add> resultC := make(chan StateStatus, 1)
<ide>
<del> // Send the current status.
<add> if s.conditionAlreadyMet(condition) {
<ide> resultC <- StateStatus{
<ide> exitCode: s.ExitCode(),
<ide> err: s.Err(),
<ide> func (s *State) Wait(ctx context.Context, condition WaitCondition) <-chan StateS
<ide> return resultC
<ide> }
<ide>
<del> // If we are waiting only for removal, the waitStop channel should
<del> // remain nil and block forever.
<del> var waitStop chan struct{}
<del> if condition < WaitConditionRemoved {
<del> waitStop = s.waitStop
<del> }
<del>
<del> // Always wait for removal, just in case the container gets removed
<del> // while it is still in a "created" state, in which case it is never
<del> // actually stopped.
<del> waitRemove := s.waitRemove
<add> waitC := make(chan StateStatus, 1)
<ide>
<del> resultC := make(chan StateStatus, 1)
<add> // Removal wakes up both removeOnlyWaiters and stopWaiters
<add> // Container could be removed while still in "created" state
<add> // in which case it is never actually stopped
<add> if condition == WaitConditionRemoved {
<add> s.removeOnlyWaiters = append(s.removeOnlyWaiters, waitC)
<add> } else {
<add> s.stopWaiters = append(s.stopWaiters, waitC)
<add> }
<ide>
<ide> go func() {
<ide> select {
<ide> func (s *State) Wait(ctx context.Context, condition WaitCondition) <-chan StateS
<ide> err: ctx.Err(),
<ide> }
<ide> return
<del> case <-waitStop:
<del> case <-waitRemove:
<del> }
<del>
<del> s.Lock()
<del> result := StateStatus{
<del> exitCode: s.ExitCode(),
<del> err: s.Err(),
<add> case status := <-waitC:
<add> resultC <- status
<ide> }
<del> s.Unlock()
<del>
<del> resultC <- result
<ide> }()
<ide>
<ide> return resultC
<ide> }
<ide>
<add>func (s *State) conditionAlreadyMet(condition WaitCondition) bool {
<add> switch condition {
<add> case WaitConditionNotRunning:
<add> return !s.Running
<add> case WaitConditionRemoved:
<add> return s.Removed
<add> }
<add>
<add> return false
<add>}
<add>
<ide> // IsRunning returns whether the running flag is set. Used by Container to check whether a container is running.
<ide> func (s *State) IsRunning() bool {
<ide> s.Lock()
<ide> func (s *State) SetStopped(exitStatus *ExitStatus) {
<ide> }
<ide> s.ExitCodeValue = exitStatus.ExitCode
<ide> s.OOMKilled = exitStatus.OOMKilled
<del> close(s.waitStop) // fire waiters for stop
<del> s.waitStop = make(chan struct{})
<add>
<add> s.notifyAndClear(&s.stopWaiters)
<ide> }
<ide>
<ide> // SetRestarting sets the container state to "restarting" without locking.
<ide> func (s *State) SetRestarting(exitStatus *ExitStatus) {
<ide> s.FinishedAt = time.Now().UTC()
<ide> s.ExitCodeValue = exitStatus.ExitCode
<ide> s.OOMKilled = exitStatus.OOMKilled
<del> close(s.waitStop) // fire waiters for stop
<del> s.waitStop = make(chan struct{})
<add>
<add> s.notifyAndClear(&s.stopWaiters)
<ide> }
<ide>
<ide> // SetError sets the container's error state. This is useful when we want to
<ide> func (s *State) IsDead() bool {
<ide> return res
<ide> }
<ide>
<del>// SetRemoved assumes this container is already in the "dead" state and
<del>// closes the internal waitRemove channel to unblock callers waiting for a
<del>// container to be removed.
<add>// SetRemoved assumes this container is already in the "dead" state and notifies all waiters.
<ide> func (s *State) SetRemoved() {
<ide> s.SetRemovalError(nil)
<ide> }
<ide>
<ide> // SetRemovalError is to be called in case a container remove failed.
<del>// It sets an error and closes the internal waitRemove channel to unblock
<del>// callers waiting for the container to be removed.
<add>// It sets an error and notifies all waiters.
<ide> func (s *State) SetRemovalError(err error) {
<ide> s.SetError(err)
<ide> s.Lock()
<del> close(s.waitRemove) // Unblock those waiting on remove.
<del> // Recreate the channel so next ContainerWait will work
<del> s.waitRemove = make(chan struct{})
<add> s.Removed = true
<add> s.notifyAndClear(&s.removeOnlyWaiters)
<add> s.notifyAndClear(&s.stopWaiters)
<ide> s.Unlock()
<ide> }
<ide>
<ide> func (s *State) Err() error {
<ide> }
<ide> return nil
<ide> }
<add>
<add>func (s *State) notifyAndClear(waiters *[]chan<- StateStatus) {
<add> result := StateStatus{
<add> exitCode: s.ExitCodeValue,
<add> err: s.Err(),
<add> }
<add>
<add> for _, c := range *waiters {
<add> c <- result
<add> }
<add> *waiters = nil
<add>}
<ide><path>container/state_test.go
<ide> func TestStateTimeoutWait(t *testing.T) {
<ide> }
<ide> }
<ide>
<add>// Related issue: #39352
<add>func TestCorrectStateWaitResultAfterRestart(t *testing.T) {
<add> s := NewState()
<add>
<add> s.Lock()
<add> s.SetRunning(0, true)
<add> s.Unlock()
<add>
<add> waitC := s.Wait(context.Background(), WaitConditionNotRunning)
<add> want := ExitStatus{ExitCode: 10, ExitedAt: time.Now()}
<add>
<add> s.Lock()
<add> s.SetRestarting(&want)
<add> s.Unlock()
<add>
<add> s.Lock()
<add> s.SetRunning(0, true)
<add> s.Unlock()
<add>
<add> got := <-waitC
<add> if got.exitCode != want.ExitCode {
<add> t.Fatalf("expected exit code %v, got %v", want.ExitCode, got.exitCode)
<add> }
<add>}
<add>
<ide> func TestIsValidStateString(t *testing.T) {
<ide> states := []struct {
<ide> state string
| 3
|
Python
|
Python
|
add a try_output_compile in numpy.distutils
|
66c792b0e2c3ba68e844e92770f312074ed9bc4a
|
<ide><path>numpy/distutils/ccompiler.py
<ide> def CCompiler_spawn(self, cmd, display=None):
<ide> else:
<ide> msg = ''
<ide> raise DistutilsExecError('Command "%s" failed with exit status %d%s' % (cmd, s, msg))
<add> if hasattr(self, 'config_output'):
<add> self.config_output += o
<ide>
<ide> replace_method(CCompiler, 'spawn', CCompiler_spawn)
<ide>
<ide><path>numpy/distutils/command/config.py
<ide> def try_run(self, body, headers=None, include_dirs=None,
<ide> return old_config.try_run(self, body, headers, include_dirs, libraries,
<ide> library_dirs, lang)
<ide>
<add> def try_output_compile(self, body, headers=None, include_dirs=None, lang="c"):
<add> """Try to compile a source file built from 'body' and 'headers'.
<add> Return true on success, false otherwise.
<add> """
<add> # XXX: this is fairly ugly. Passing the output of executed command
<add> # would require heroic efforts so instead we use a dynamically created
<add> # instance variable on the compiler class to pass output between
<add> # compiler and the config command.
<add> self.compiler.config_output = ""
<add> self._check_compiler()
<add> try:
<add> self._compile(body, headers, include_dirs, lang)
<add> status = True
<add> except CompileError:
<add> status = False
<add>
<add> log.info(status and "success!" or "failure.")
<add> self._clean()
<add> return status, self.compiler.config_output
<add>
<ide> def _check_compiler (self):
<ide> old_config._check_compiler(self)
<ide> from numpy.distutils.fcompiler import FCompiler, new_fcompiler
| 2
|
Javascript
|
Javascript
|
fix exports from es6ing of ember-application
|
fa94f3cb0a64aaebeff1b7ddd232b2f9406861b9
|
<ide><path>packages/ember/lib/main.js
<add>// ensure that minispade loads the following modules first
<ide> require('ember-metal');
<ide> require('ember-runtime');
<ide> require('ember-handlebars-compiler');
<ide> require('ember-routing');
<ide> require('ember-application');
<ide> require('ember-extension-support');
<ide>
<add>
<add>// ensure that the global exports have occurred for above
<add>// required packages
<add>requireModule('ember-metal');
<add>requireModule('ember-runtime');
<add>requireModule('ember-handlebars');
<add>requireModule('ember-views');
<add>requireModule('ember-routing');
<add>requireModule('ember-application');
<add>requireModule('ember-extension-support');
<add>
<ide> // do this to ensure that Ember.Test is defined properly on the global
<ide> // if it is present.
<ide> if (Ember.__loader.registry['ember-testing']) {
<ide><path>packages_es6/ember-application/lib/main.js
<add>import Ember from "ember-metal/core";
<ide> import {runLoadHooks} from "ember-runtime/system/lazy_load";
<ide>
<ide> /**
| 2
|
Javascript
|
Javascript
|
fix skin+morph and timescale
|
fbf78109160127c66a124e829b59ca702f73fecf
|
<ide><path>examples/js/loaders/sea3d/SEA3DLoader.js
<ide> THREE.SEA3D.Animator.prototype.getTimeScale = function() {
<ide>
<ide> THREE.SEA3D.Animator.prototype.updateTimeScale = function() {
<ide>
<del> this.currentAnimationAction.setEffectiveTimeScale( this.timeScale * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 ) );
<add> this.mixer.timeScale = this.timeScale * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 );
<ide>
<ide> };
<ide>
<ide> THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
<ide> if ( animation == this.currentAnimation ) {
<ide>
<ide> if ( offset !== undefined || ! animation.loop ) this.currentAnimationAction.time = offset !== undefined ? offset :
<del> ( this.currentAnimationAction.timeScale >= 0 ? 0 : this.currentAnimation.duration );
<add> ( this.mixer.timeScale >= 0 ? 0 : this.currentAnimation.duration );
<ide>
<ide> this.currentAnimationAction.setEffectiveWeight( weight !== undefined ? weight : 1 );
<ide> this.currentAnimationAction.paused = false;
<ide> THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
<ide> this.updateTimeScale();
<ide>
<ide> if ( offset !== undefined || ! animation.loop ) this.currentAnimationAction.time = offset !== undefined ? offset :
<del> ( this.currentAnimationAction.timeScale >= 0 ? 0 : this.currentAnimation.duration );
<add> ( this.mixer.timeScale >= 0 ? 0 : this.currentAnimation.duration );
<ide>
<ide> this.currentAnimationAction.setEffectiveWeight( weight !== undefined ? weight : 1 );
<ide>
<ide> THREE.SEA3D.SkinnedMesh = function( geometry, material, useVertexTexture ) {
<ide> THREE.SEA3D.SkinnedMesh.prototype = Object.create( THREE.SkinnedMesh.prototype );
<ide> THREE.SEA3D.SkinnedMesh.prototype.constructor = THREE.SEA3D.SkinnedMesh;
<ide>
<del>Object.assign( THREE.SEA3D.SkinnedMesh.prototype, THREE.SEA3D.Object3D.prototype );
<del>
<del>Object.assign( THREE.SEA3D.SkinnedMesh.prototype, THREE.SEA3D.Animator.prototype );
<add>Object.assign( THREE.SEA3D.SkinnedMesh.prototype, THREE.SEA3D.Mesh.prototype, THREE.SEA3D.Animator.prototype );
<ide>
<ide> THREE.SEA3D.SkinnedMesh.prototype.boneByName = function( name ) {
<ide>
<ide> THREE.SEA3D.VertexAnimationMesh = function( geometry, material ) {
<ide> THREE.SEA3D.VertexAnimationMesh.prototype = Object.create( THREE.Mesh.prototype );
<ide> THREE.SEA3D.VertexAnimationMesh.prototype.constructor = THREE.SEA3D.VertexAnimationMesh;
<ide>
<del>Object.assign( THREE.SEA3D.VertexAnimationMesh.prototype, THREE.SEA3D.Object3D.prototype );
<del>
<del>Object.assign( THREE.SEA3D.VertexAnimationMesh.prototype, THREE.SEA3D.Animator.prototype );
<add>Object.assign( THREE.SEA3D.VertexAnimationMesh.prototype, THREE.SEA3D.Mesh.prototype, THREE.SEA3D.Animator.prototype );
<ide>
<ide> THREE.SEA3D.VertexAnimationMesh.prototype.copy = function( source ) {
<ide>
| 1
|
Ruby
|
Ruby
|
simplify spec helper
|
b9de5c04908bbbe2e2c30fff57b1301e17082202
|
<ide><path>Library/Homebrew/cask/spec/spec_helper.rb
<ide> # pretend that the caskroom/cask Tap is installed
<ide> FileUtils.ln_s Pathname.new(ENV["HOMEBREW_LIBRARY"]).join("Taps", "caskroom", "homebrew-cask"), Tap.fetch("caskroom", "cask").path
<ide>
<add>HOMEBREW_CASK_DIRS = [
<add> :appdir,
<add> :caskroom,
<add> :prefpanedir,
<add> :qlplugindir,
<add> :servicedir,
<add> :binarydir,
<add>].freeze
<add>
<ide> RSpec.configure do |config|
<ide> config.order = :random
<ide> config.include(Test::Helper::Shutup)
<ide> config.around(:each) do |example|
<ide> begin
<del> @__appdir = Hbc.appdir
<del> @__caskroom = Hbc.caskroom
<del> @__prefpanedir = Hbc.prefpanedir
<del> @__qlplugindir = Hbc.qlplugindir
<del> @__servicedir = Hbc.servicedir
<add> @__dirs = HOMEBREW_CASK_DIRS.map { |dir|
<add> Pathname.new(TEST_TMPDIR).join(dir.to_s).tap { |path|
<add> path.mkpath
<add> Hbc.public_send("#{dir}=", path)
<add> }
<add> }
<ide>
<ide> @__argv = ARGV.dup
<ide> @__env = ENV.to_hash # dup doesn't work on ENV
<ide> ARGV.replace(@__argv)
<ide> ENV.replace(@__env)
<ide>
<del> Hbc.appdir = @__appdir
<del> Hbc.caskroom = @__caskroom
<del> Hbc.prefpanedir = @__prefpanedir
<del> Hbc.qlplugindir = @__qlplugindir
<del> Hbc.servicedir = @__servicedir
<del>
<del> FileUtils.rm_rf [
<del> Hbc.appdir.children,
<del> Hbc.caskroom.children,
<del> ]
<add> FileUtils.rm_rf @__dirs.map(&:children)
<ide> end
<ide> end
<ide> end
| 1
|
Ruby
|
Ruby
|
use raw block to return tty to proper state
|
c88f4c064556b867ec1a3460ab9f8820453cef18
|
<ide><path>Library/Homebrew/sandbox.rb
<ide> def exec(*args)
<ide> command = [SANDBOX_EXEC, "-f", seatbelt.path, *args]
<ide> # Start sandbox in a pseudoterminal to prevent access of the parent terminal.
<ide> T.unsafe(PTY).spawn(*command) do |r, w, pid|
<del> # Set the PTY's window size to match the parent terminal.
<del> # Some formula tests are sensitive to the terminal size and fail if this is not set.
<del> winch = proc do |_sig|
<del> w.winsize = if $stdout.tty?
<del> # We can only use IO#winsize if the IO object is a TTY.
<del> $stdout.winsize
<del> else
<del> # Otherwise, default to tput, if available.
<del> # This relies on ncurses rather than the system's ioctl.
<del> [Utils.popen_read("tput", "lines").to_i, Utils.popen_read("tput", "cols").to_i]
<add> write_to_pty = proc {
<add> # Set the PTY's window size to match the parent terminal.
<add> # Some formula tests are sensitive to the terminal size and fail if this is not set.
<add> winch = proc do |_sig|
<add> w.winsize = if $stdout.tty?
<add> # We can only use IO#winsize if the IO object is a TTY.
<add> $stdout.winsize
<add> else
<add> # Otherwise, default to tput, if available.
<add> # This relies on ncurses rather than the system's ioctl.
<add> [Utils.popen_read("tput", "lines").to_i, Utils.popen_read("tput", "cols").to_i]
<add> end
<ide> end
<del> end
<del> # Update the window size whenever the parent terminal's window size changes.
<del> old_winch = trap(:WINCH, &winch)
<del> winch.call(nil)
<ide>
<del> $stdin.raw! if $stdin.tty?
<del> stdin_thread = Thread.new { IO.copy_stream($stdin, w) }
<add> begin
<add> # Update the window size whenever the parent terminal's window size changes.
<add> old_winch = trap(:WINCH, &winch)
<add> winch.call(nil)
<add>
<add> stdin_thread = Thread.new { IO.copy_stream($stdin, w) }
<ide>
<del> r.each_char { |c| print(c) }
<add> r.each_char { |c| print(c) }
<ide>
<del> Process.wait(pid)
<del> ensure
<del> stdin_thread&.kill
<del> $stdin.cooked! if $stdin.tty?
<del> trap(:WINCH, old_winch)
<add> Process.wait(pid)
<add> ensure
<add> stdin_thread&.kill
<add> trap(:WINCH, old_winch)
<add> end
<add> }
<add> if $stdout.tty?
<add> $stdin.raw &write_to_pty
<add> else
<add> write_to_pty.call
<add> end
<ide> end
<ide> raise ErrorDuringExecution.new(command, status: $CHILD_STATUS) unless $CHILD_STATUS.success?
<ide> rescue
| 1
|
PHP
|
PHP
|
fix argument order passing to url generator
|
6c3e34b7e64b4757c827d10323f55c1a4f4b0ced
|
<ide><path>src/Illuminate/Routing/Redirector.php
<ide> public function back($status = 302, $headers = array())
<ide> */
<ide> public function to($path, $status = 302, $headers = array(), $secure = false)
<ide> {
<del> $path = $this->generator->to($path, $secure);
<add> $path = $this->generator->to($path, array(), $secure);
<ide>
<ide> return $this->createRedirect($path, $status, $headers);
<ide> }
| 1
|
Ruby
|
Ruby
|
fix dummy app for inclusion in rails
|
4f8be04f4e51c10fcaa0efd8eb004ea7860f1a56
|
<ide><path>activestorage/test/dummy/config/application.rb
<ide> require "action_controller/railtie"
<ide> require "action_view/railtie"
<ide> require "sprockets/railtie"
<add>require "active_storage/engine"
<ide> #require "action_mailer/railtie"
<ide> #require "rails/test_unit/railtie"
<ide> #require "action_cable/engine"
<ide>
<ide>
<ide> Bundler.require(*Rails.groups)
<del>require "active_storage"
<ide>
<ide> module Dummy
<ide> class Application < Rails::Application
<ide> class Application < Rails::Application
<ide> config.active_storage.service = :local
<ide> end
<ide> end
<del>
| 1
|
Javascript
|
Javascript
|
add tests for err_http2_frame_error
|
e30876121aa8db0317d22c368e4de08df0ba87d5
|
<ide><path>test/parallel/test-internal-errors.js
<ide> assert.strictEqual(
<ide> errors.message('ERR_HTTP2_HEADER_REQUIRED', ['test']),
<ide> 'The test header is required');
<ide>
<add>// Test ERR_HTTP2_FRAME_ERROR
<add>assert.strictEqual(
<add> errors.message('ERR_HTTP2_FRAME_ERROR', ['foo', 'bar', 'baz']),
<add> 'Error sending frame type foo for stream baz with code bar');
<add>assert.strictEqual(
<add> errors.message('ERR_HTTP2_FRAME_ERROR', ['foo', 'bar']),
<add> 'Error sending frame type foo with code bar');
<add>
<ide> // Test error messages for async_hooks
<ide> assert.strictEqual(
<ide> errors.message('ERR_ASYNC_CALLBACK', ['init']),
| 1
|
PHP
|
PHP
|
add various optional helpers
|
06de9b2beb9e3c13758d93cee86a1657545cb435
|
<ide><path>src/Illuminate/Http/Resources/Json/Resource.php
<ide> public function withResponse($request, $response)
<ide> * @param mixed $value
<ide> * @return \Illuminate\Http\Resources\MissingValue|mixed
<ide> */
<del> protected function when($condition, $value)
<add> protected function when($condition, $value, $default = null)
<ide> {
<ide> if ($condition) {
<ide> return value($value);
<ide> }
<ide>
<del> return new MissingValue;
<add> return func_num_args() === 3 ? value($default) : new MissingValue;
<ide> }
<ide>
<ide> /**
<ide> protected function when($condition, $value)
<ide> * @param string $relationship
<ide> * @return \Illuminate\Http\Resources\MissingValue|mixed
<ide> */
<del> protected function optional($relationship)
<add> protected function whenLoaded($relationship)
<ide> {
<ide> if ($this->resource->relationLoaded($relationship)) {
<ide> return $this->resource->{$relationship};
<ide> protected function optional($relationship)
<ide> return new MissingValue;
<ide> }
<ide>
<add> /**
<add> * Execute a callback if the given pivot table has been loaded.
<add> *
<add> * @param string $table
<add> * @param callable $value
<add> * @param mixed $default
<add> * @return \Illuminate\Http\Resources\MissingValue|mixed
<add> */
<add> protected function whenPivotLoaded($table, callable $value, $default = null)
<add> {
<add> return $this->when(
<add> $this->pivot && ($this->pivot instanceof $table || $this->pivot->getTable() === $table),
<add> ...array_filter([$value, $default])
<add> );
<add> }
<add>
<add> /**
<add> * Transform the given value if it is present.
<add> *
<add> * @param mixed $value
<add> * @param callable $callback
<add> * @param mixed $default
<add> * @return mixed
<add> */
<add> protected function transform($value, callable $callback, $default = null)
<add> {
<add> return transform(
<add> $value, $callback, func_num_args() === 3 ? $default : new MissingValue
<add> );
<add> }
<add>
<ide> /**
<ide> * Set the string that should wrap the outer-most resource array.
<ide> *
<ide><path>src/Illuminate/Support/Optional.php
<add><?php
<add>
<add>namespace Illuminate\Support;
<add>
<add>class Optional
<add>{
<add> use Traits\Macroable;
<add>
<add> /**
<add> * The underlying object.
<add> *
<add> * @var mixed
<add> */
<add> protected $value;
<add>
<add> /**
<add> * Create a new optional instance.
<add> *
<add> * @param mixed $value
<add> * @return void
<add> */
<add> public function __construct($value)
<add> {
<add> $this->value = $value;
<add> }
<add>
<add> /**
<add> * Dynamically access a property on the underlying object.
<add> *
<add> * @param string $key
<add> * @return mixed
<add> */
<add> public function __get($key)
<add> {
<add> if (is_object($this->value)) {
<add> return $this->value->{$key};
<add> }
<add> }
<add>
<add> /**
<add> * Dynamically pass a method to the underlying object.
<add> *
<add> * @param string $method
<add> * @param array $parameters
<add> * @return mixed
<add> */
<add> public function __call($method, $parameters)
<add> {
<add> if (is_object($this->value)) {
<add> return $this->value->{$method}(...$parameters);
<add> }
<add> }
<add>}
<ide><path>src/Illuminate/Support/helpers.php
<ide>
<ide> use Illuminate\Support\Arr;
<ide> use Illuminate\Support\Str;
<add>use Illuminate\Support\Optional;
<ide> use Illuminate\Support\Collection;
<ide> use Illuminate\Support\Debug\Dumper;
<ide> use Illuminate\Contracts\Support\Htmlable;
<ide> function array_wrap($value)
<ide> }
<ide> }
<ide>
<add>if (! function_exists('blank')) {
<add> /**
<add> * Determine if the given value is "blank".
<add> *
<add> * @author Derek MacDonald (https://github.com/derekmd)
<add> *
<add> * @param mixed $value
<add> * @return bool
<add> */
<add> function blank($value)
<add> {
<add> if (is_null($value)) {
<add> return true;
<add> }
<add>
<add> if (is_string($value)) {
<add> return trim($value) === '';
<add> }
<add>
<add> if (is_numeric($value) || is_bool($value)) {
<add> return false;
<add> }
<add>
<add> if ($value instanceof Countable) {
<add> return count($value) === 0;
<add> }
<add>
<add> return empty($value);
<add> }
<add>}
<add>
<ide> if (! function_exists('camel_case')) {
<ide> /**
<ide> * Convert a value to camel case.
<ide> function object_get($object, $key, $default = null)
<ide> }
<ide> }
<ide>
<add>if (! function_exists('optional')) {
<add> /**
<add> * Provide access to optional objects.
<add> *
<add> * @param mixed $value
<add> * @return mixed
<add> */
<add> function optional($value)
<add> {
<add> return new Optional($value);
<add> }
<add>}
<add>
<ide> if (! function_exists('preg_replace_array')) {
<ide> /**
<ide> * Replace a given pattern with each value in the array in sequentially.
<ide> function preg_replace_array($pattern, array $replacements, $subject)
<ide> }
<ide> }
<ide>
<add>if (! function_exists('present')) {
<add> /**
<add> * Determine if a value is "present".
<add> *
<add> * @author Derek MacDonald (https://github.com/derekmd)
<add> *
<add> * @param mixed $value
<add> * @return bool
<add> */
<add> function present($value)
<add> {
<add> return ! blank($value);
<add> }
<add>}
<add>
<ide> if (! function_exists('retry')) {
<ide> /**
<ide> * Retry an operation a given number of times.
<ide> function trait_uses_recursive($trait)
<ide> }
<ide> }
<ide>
<add>if (! function_exists('transform')) {
<add> /**
<add> * Transform the given value if it is present.
<add> *
<add> * @author Derek MacDonald (https://github.com/derekmd)
<add> *
<add> * @param mixed $value
<add> * @param callable $callback
<add> * @param mixed $default
<add> * @return mixed|null
<add> */
<add> function transform($value, callable $callback, $default = null)
<add> {
<add> if (present($value)) {
<add> return $callback($value);
<add> }
<add>
<add> if (is_callable($default)) {
<add> return $default($value);
<add> }
<add>
<add> return $default;
<add> }
<add>}
<add>
<ide> if (! function_exists('value')) {
<ide> /**
<ide> * Return the default value of the given value.
<ide><path>tests/Integration/Http/ResourceTest.php
<ide> public function test_resources_may_be_converted_to_json()
<ide> ]);
<ide> }
<ide>
<add> public function test_resources_may_have_optional_values()
<add> {
<add> Route::get('/', function () {
<add> return new PostResourceWithOptionalData(new Post([
<add> 'id' => 5,
<add> ]));
<add> });
<add>
<add> $response = $this->withoutExceptionHandling()->get(
<add> '/', ['Accept' => 'application/json']
<add> );
<add>
<add> $response->assertStatus(200);
<add>
<add> $response->assertJson([
<add> 'data' => [
<add> 'id' => 5,
<add> 'second' => 'value',
<add> 'third' => 'value',
<add> ],
<add> ]);
<add> }
<add>
<ide> public function test_resources_may_have_optional_relationships()
<ide> {
<ide> Route::get('/', function () {
<ide> public function test_resources_may_have_optional_relationships()
<ide> ]);
<ide> }
<ide>
<add> public function test_resources_may_have_optional_pivot_relationships()
<add> {
<add> Route::get('/', function () {
<add> $post = new Post(['id' => 5]);
<add> $post->setRelation('pivot', new Subscription);
<add>
<add> return new PostResourceWithOptionalPivotRelationship($post);
<add> });
<add>
<add> $response = $this->withoutExceptionHandling()->get(
<add> '/', ['Accept' => 'application/json']
<add> );
<add>
<add> $response->assertStatus(200);
<add>
<add> $response->assertExactJson([
<add> 'data' => [
<add> 'id' => 5,
<add> 'subscription' => [
<add> 'foo' => 'bar',
<add> ],
<add> ],
<add> ]);
<add> }
<add>
<ide> public function test_resource_is_url_routable()
<ide> {
<ide> $post = new PostResource(new Post([
<ide> public function withResponse($request, $response)
<ide> }
<ide> }
<ide>
<add>class PostResourceWithOptionalData extends Resource
<add>{
<add> public function toArray($request)
<add> {
<add> return [
<add> 'id' => $this->id,
<add> 'first' => $this->when(false, 'value'),
<add> 'second' => $this->when(true, 'value'),
<add> 'third' => $this->when(true, function () {
<add> return 'value';
<add> }),
<add> ];
<add> }
<add>}
<add>
<ide> class PostResourceWithOptionalRelationship extends PostResource
<ide> {
<ide> public function toArray($request)
<ide> {
<ide> return [
<ide> 'id' => $this->id,
<del> 'comments' => new CommentCollection($this->optional('comments')),
<add> 'comments' => new CommentCollection($this->whenLoaded('comments')),
<add> ];
<add> }
<add>}
<add>
<add>class PostResourceWithOptionalPivotRelationship extends PostResource
<add>{
<add> public function toArray($request)
<add> {
<add> return [
<add> 'id' => $this->id,
<add> 'subscription' => $this->whenPivotLoaded(Subscription::class, function () {
<add> return [
<add> 'foo' => 'bar',
<add> ];
<add> }),
<ide> ];
<ide> }
<ide> }
<ide>
<add>class Subscription {}
<add>
<ide> class CommentCollection extends ResourceCollection
<ide> {
<ide> //
<ide><path>tests/Support/SupportHelpersTest.php
<ide> public function testThrowWithString()
<ide> {
<ide> throw_if(true, RuntimeException::class, 'Test Message');
<ide> }
<add>
<add> public function testOptional()
<add> {
<add> $this->assertNull(optional(null)->something());
<add>
<add> $this->assertEquals(10, optional(new class {
<add> public function something()
<add> {
<add> return 10;
<add> }
<add> })->something());
<add> }
<add>
<add> public function testTransform()
<add> {
<add> $this->assertEquals(10, transform(5, function ($value) {
<add> return $value * 2;
<add> }));
<add>
<add> $this->assertNull(transform(null, function () {
<add> return 10;
<add> }));
<add> }
<ide> }
<ide>
<ide> trait SupportTestTraitOne
| 5
|
Javascript
|
Javascript
|
fix typo in eventdata property
|
6ec775e0cd799464ab675e7243e08fdba957b1b7
|
<ide><path>src/ngScenario/browserTrigger.js
<ide> evnt = createTouchEvent(element, eventType, x, y);
<ide> } else if (/key/.test(eventType)) {
<ide> evnt = window.document.createEvent('Events');
<del> evnt.initEvent(eventType, eventData.bubbles, eventData.canceable);
<add> evnt.initEvent(eventType, eventData.bubbles, eventData.cancelable);
<ide> evnt.view = window;
<ide> evnt.ctrlKey = pressed('ctrl');
<ide> evnt.altKey = pressed('alt');
| 1
|
Text
|
Text
|
improve the testing guide [ci skip]
|
577a6378ba4e2c38f38220c8537ea586997de3ed
|
<ide><path>guides/source/testing.md
<ide> Here's a sample YAML fixture file:
<ide> ```yaml
<ide> # lo & behold! I am a YAML comment!
<ide> david:
<del> name: David Heinemeier Hansson
<del> birthday: 1979-10-15
<del> profession: Systems development
<add> name: David Heinemeier Hansson
<add> birthday: 1979-10-15
<add> profession: Systems development
<ide>
<ide> steve:
<del> name: Steve Ross Kellock
<del> birthday: 1974-09-27
<del> profession: guy with keyboard
<add> name: Steve Ross Kellock
<add> birthday: 1974-09-27
<add> profession: guy with keyboard
<ide> ```
<ide>
<ide> Each fixture is given a name followed by an indented list of colon-separated key/value pairs. Records are typically separated by a blank space. You can place comments in a fixture file by using the # character in the first column. Keys which resemble YAML keywords such as 'yes' and 'no' are quoted so that the YAML Parser correctly interprets them.
<ide>
<add>If you are working with [associations](/association_basics.html), you can simply
<add>define a reference node between two different fixtures. Here's an example with
<add>a belongs_to/has_many association:
<add>
<add>```yaml
<add># In fixtures/categories.yml
<add>about:
<add> name: About
<add>
<add># In fixtures/articles.yml
<add>one:
<add> title: Welcome to Rails!
<add> body: Hello world!
<add> category: about
<add>```
<add>
<ide> #### ERB'in It Up
<ide>
<ide> ERB allows you to embed Ruby code within templates. The YAML fixture format is pre-processed with ERB when Rails loads fixtures. This allows you to use Ruby to help you generate some sample data. For example, the following code generates a thousand users:
<ide> class UserControllerTest < ActionController::TestCase
<ide> end
<ide> ```
<ide>
<add>Testing helpers
<add>---------------
<add>
<add>In order to test helpers, all you need to do is check that the output of the
<add>helper method matches what you'd expect. Tests related to the helpers are
<add>located under the `test/helpers` directory. Rails provides a generator which
<add>generates both the helper and the test file:
<add>
<add>```bash
<add>$ rails generate helper User
<add> create app/helpers/user_helper.rb
<add> invoke test_unit
<add> create test/helpers/user_helper_test.rb
<add>```
<add>
<add>The generated test file contains the following code:
<add>
<add>```ruby
<add>require 'test_helper'
<add>
<add>class UserHelperTest < ActionView::TestCase
<add>end
<add>```
<add>
<add>A helper is just a simple module where you can define methods which are
<add>available into your views. To test the output of the helper's methods, you just
<add>have to use a mixin like this:
<add>
<add>```ruby
<add>class UserHelperTest < ActionView::TestCase
<add> include UserHelper
<add>
<add> test "should return the user name" do
<add> # ...
<add> end
<add>end
<add>```
<add>
<add>Moreover, since the test class extends from `ActionView::TestCase`, you have
<add>access to Rails' helper methods such as `link_to` or `pluralize`.
<add>
<ide> Other Testing Approaches
<ide> ------------------------
<ide>
<ide> The built-in `test/unit` based testing is not the only way to test Rails applica
<ide> * [NullDB](http://avdi.org/projects/nulldb/), a way to speed up testing by avoiding database use.
<ide> * [Factory Girl](https://github.com/thoughtbot/factory_girl/tree/master), a replacement for fixtures.
<ide> * [Machinist](https://github.com/notahat/machinist/tree/master), another replacement for fixtures.
<add>* [Fixture Builder](https://github.com/rdy/fixture_builder), a tool that compiles Ruby factories into fixtures before a test run.
<ide> * [MiniTest::Spec Rails](https://github.com/metaskills/minitest-spec-rails), use the MiniTest::Spec DSL within your rails tests.
<ide> * [Shoulda](http://www.thoughtbot.com/projects/shoulda), an extension to `test/unit` with additional helpers, macros, and assertions.
<ide> * [RSpec](http://relishapp.com/rspec), a behavior-driven development framework
| 1
|
Ruby
|
Ruby
|
use parser to parse args
|
56fb2cb67c728f73a1f018eb0da26644ff2ea3c8
|
<ide><path>Library/Homebrew/dev-cmd/edit.rb
<ide> #: Open <formula> in the editor.
<ide>
<ide> require "formula"
<add>require "cli_parser"
<ide>
<ide> module Homebrew
<ide> module_function
<ide>
<ide> def edit
<add> args = Homebrew::CLI::Parser.new do
<add> switch "--force"
<add> end.parse
<add>
<ide> unless (HOMEBREW_REPOSITORY/".git").directory?
<ide> raise <<~EOS
<ide> Changes will be lost!
<ide> def edit
<ide> paths = ARGV.named.map do |name|
<ide> path = Formulary.path(name)
<ide>
<del> raise FormulaUnavailableError, name unless path.file? || ARGV.force?
<add> raise FormulaUnavailableError, name unless path.file? || args.force?
<ide>
<ide> path
<ide> end
| 1
|
Python
|
Python
|
fix backwards compatibility further
|
7c8b71d2012d56888f21b24c4844a6838dc3e4b1
|
<ide><path>airflow/providers/cncf/kubernetes/backcompat/backwards_compat_converters.py
<ide>
<ide> from typing import List
<ide>
<del>from kubernetes.client import models as k8s
<add>from kubernetes.client import ApiClient, models as k8s
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.providers.cncf.kubernetes.backcompat.pod import Port, Resources
<ide> def _convert_kube_model_object(obj, old_class, new_class):
<ide> raise AirflowException(f"Expected {old_class} or {new_class}, got {type(obj)}")
<ide>
<ide>
<add>def _convert_from_dict(obj, new_class):
<add> if isinstance(obj, new_class):
<add> return obj
<add> elif isinstance(obj, dict):
<add> api_client = ApiClient()
<add> return api_client._ApiClient__deserialize_model(obj, new_class) # pylint: disable=W0212
<add> else:
<add> raise AirflowException(f"Expected dict or {new_class}, got {type(obj)}")
<add>
<add>
<ide> def convert_volume(volume) -> k8s.V1Volume:
<ide> """
<ide> Converts an airflow Volume object into a k8s.V1Volume
<ide> def convert_configmap(configmaps) -> k8s.V1EnvFromSource:
<ide> :return:
<ide> """
<ide> return k8s.V1EnvFromSource(config_map_ref=k8s.V1ConfigMapEnvSource(name=configmaps))
<add>
<add>
<add>def convert_affinity(affinity) -> k8s.V1Affinity:
<add> """Converts a dict into an k8s.V1Affinity"""
<add> return _convert_from_dict(affinity, k8s.V1Affinity)
<add>
<add>
<add>def convert_node_selector(node_selector) -> k8s.V1NodeSelector:
<add> """Converts a dict into a k8s.V1NodeSelector"""
<add> return _convert_from_dict(node_selector, k8s.V1NodeSelector)
<add>
<add>
<add>def convert_toleration(toleration) -> k8s.V1Toleration:
<add> """Converts a dict into an k8s.V1Toleration"""
<add> return _convert_from_dict(toleration, k8s.V1Toleration)
<ide><path>airflow/providers/cncf/kubernetes/example_dags/example_kubernetes.py
<ide> args=["echo 10"],
<ide> )
<ide>
<del>affinity = {
<del> 'nodeAffinity': {
<del> 'preferredDuringSchedulingIgnoredDuringExecution': [
<del> {
<del> "weight": 1,
<del> "preference": {"matchExpressions": {"key": "disktype", "operator": "In", "values": ["ssd"]}},
<del> }
<add>affinity = k8s.V1Affinity(
<add> node_affinity=k8s.V1NodeAffinity(
<add> preferred_during_scheduling_ignored_during_execution=[
<add> k8s.V1PreferredSchedulingTerm(
<add> weight=1,
<add> preference=k8s.V1NodeSelectorTerm(
<add> match_expressions=[
<add> k8s.V1NodeSelectorRequirement(key="disktype", operator="in", values=["ssd"])
<add> ]
<add> ),
<add> )
<ide> ]
<del> },
<del> "podAffinity": {
<del> "requiredDuringSchedulingIgnoredDuringExecution": [
<del> {
<del> "labelSelector": {
<del> "matchExpressions": [{"key": "security", "operator": "In", "values": ["S1"]}]
<del> },
<del> "topologyKey": "failure-domain.beta.kubernetes.io/zone",
<del> }
<add> ),
<add> pod_affinity=k8s.V1PodAffinity(
<add> required_during_scheduling_ignored_during_execution=[
<add> k8s.V1WeightedPodAffinityTerm(
<add> pod_affinity_term=k8s.V1PodAffinityTerm(
<add> label_selector=k8s.V1LabelSelector(
<add> match_expressions=[
<add> k8s.V1LabelSelectorRequirement(key="security", operator="In", values="S1")
<add> ]
<add> ),
<add> topology_key="failure-domain.beta.kubernetes.io/zone",
<add> )
<add> )
<ide> ]
<del> },
<del> "podAntiAffinity": {
<del> "requiredDuringSchedulingIgnoredDuringExecution": [
<del> {
<del> "labelSelector": {
<del> "matchExpressions": [{"key": "security", "operator": "In", "values": ["S2"]}]
<del> },
<del> "topologyKey": "kubernetes.io/hostname",
<del> }
<del> ]
<del> },
<del>}
<add> ),
<add>)
<add>
<add>tolerations = [k8s.V1Toleration(key="key", operator="Equal", value="value")]
<ide>
<del>tolerations = [{'key': "key", 'operator': 'Equal', 'value': 'value'}]
<ide> # [END howto_operator_k8s_cluster_resources]
<ide>
<ide>
<ide><path>airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
<ide> # under the License.
<ide> """Executes task in a Kubernetes POD"""
<ide> import re
<add>import warnings
<ide> from typing import Any, Dict, Iterable, List, Optional, Tuple
<ide>
<ide> import yaml
<ide> from airflow.kubernetes.secret import Secret
<ide> from airflow.models import BaseOperator
<ide> from airflow.providers.cncf.kubernetes.backcompat.backwards_compat_converters import (
<add> convert_affinity,
<ide> convert_configmap,
<ide> convert_env_vars,
<ide> convert_image_pull_secrets,
<add> convert_node_selector,
<ide> convert_pod_runtime_info_env,
<ide> convert_port,
<ide> convert_resources,
<add> convert_toleration,
<ide> convert_volume,
<ide> convert_volume_mount,
<ide> )
<ide> class KubernetesPodOperator(BaseOperator): # pylint: disable=too-many-instance-
<ide> See also kubernetes.io/docs/concepts/configuration/manage-compute-resources-container
<ide> :type resources: k8s.V1ResourceRequirements
<ide> :param affinity: A dict containing a group of affinity scheduling rules.
<del> :type affinity: dict
<add> :type affinity: k8s.V1Affinity
<ide> :param config_file: The path to the Kubernetes config file. (templated)
<ide> If not specified, default value is ``~/.kube/config``
<ide> :type config_file: str
<ide> class KubernetesPodOperator(BaseOperator): # pylint: disable=too-many-instance-
<ide> :param hostnetwork: If True enable host networking on the pod.
<ide> :type hostnetwork: bool
<ide> :param tolerations: A list of kubernetes tolerations.
<del> :type tolerations: list tolerations
<add> :type tolerations: List[k8s.V1Toleration]
<ide> :param security_context: security options the pod should run with (PodSecurityContext).
<ide> :type security_context: dict
<ide> :param dnspolicy: dnspolicy for the pod.
<ide> def __init__( # pylint: disable=too-many-arguments,too-many-locals
<ide> image_pull_policy: str = 'IfNotPresent',
<ide> annotations: Optional[Dict] = None,
<ide> resources: Optional[k8s.V1ResourceRequirements] = None,
<del> affinity: Optional[Dict] = None,
<add> affinity: Optional[k8s.V1Affinity] = None,
<ide> config_file: Optional[str] = None,
<del> node_selectors: Optional[Dict] = None,
<add> node_selectors: Optional[k8s.V1NodeSelector] = None,
<add> node_selector: Optional[k8s.V1NodeSelector] = None,
<ide> image_pull_secrets: Optional[List[k8s.V1LocalObjectReference]] = None,
<ide> service_account_name: str = 'default',
<ide> is_delete_operator_pod: bool = False,
<ide> hostnetwork: bool = False,
<del> tolerations: Optional[List] = None,
<add> tolerations: Optional[List[k8s.V1Toleration]] = None,
<ide> security_context: Optional[Dict] = None,
<ide> dnspolicy: Optional[str] = None,
<ide> schedulername: Optional[str] = None,
<ide> def __init__( # pylint: disable=too-many-arguments,too-many-locals
<ide> self.reattach_on_restart = reattach_on_restart
<ide> self.get_logs = get_logs
<ide> self.image_pull_policy = image_pull_policy
<del> self.node_selectors = node_selectors or {}
<add> if node_selectors:
<add> # Node selectors is incorrect based on k8s API
<add> warnings.warn("node_selectors is deprecated. Please use node_selector instead.")
<add> self.node_selector = convert_node_selector(node_selectors)
<add> elif node_selector:
<add> self.node_selector = convert_node_selector(node_selector)
<add> else:
<add> self.node_selector = None
<ide> self.annotations = annotations or {}
<del> self.affinity = affinity or {}
<add> self.affinity = convert_affinity(affinity) if affinity else k8s.V1Affinity()
<ide> self.k8s_resources = convert_resources(resources) if resources else {}
<ide> self.config_file = config_file
<ide> self.image_pull_secrets = convert_image_pull_secrets(image_pull_secrets) if image_pull_secrets else []
<ide> self.service_account_name = service_account_name
<ide> self.is_delete_operator_pod = is_delete_operator_pod
<ide> self.hostnetwork = hostnetwork
<del> self.tolerations = tolerations or []
<add> self.tolerations = [convert_toleration(toleration) for toleration in tolerations] \
<add> if tolerations else []
<ide> self.security_context = security_context or {}
<ide> self.dnspolicy = dnspolicy
<ide> self.schedulername = schedulername
<ide> def create_pod_request_obj(self) -> k8s.V1Pod:
<ide> annotations=self.annotations,
<ide> ),
<ide> spec=k8s.V1PodSpec(
<del> node_selector=self.node_selectors,
<add> node_selector=self.node_selector,
<ide> affinity=self.affinity,
<ide> tolerations=self.tolerations,
<ide> init_containers=self.init_containers,
<ide><path>tests/providers/cncf/kubernetes/operators/test_kubernetes_pod.py
<ide> from unittest import mock
<ide>
<ide> import pendulum
<del>from kubernetes.client import models as k8s
<add>from kubernetes.client import ApiClient, models as k8s
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.models import DAG, TaskInstance
<ide> def test_no_need_to_describe_pod_on_success(self, mock_client, monitor_mock, sta
<ide> k.execute(context=context)
<ide>
<ide> assert not mock_client.return_value.read_namespaced_pod.called
<add>
<add> def test_create_with_affinity(self):
<add> name_base = 'test'
<add>
<add> affinity = {
<add> 'nodeAffinity': {
<add> 'preferredDuringSchedulingIgnoredDuringExecution': [
<add> {
<add> "weight": 1,
<add> "preference": {
<add> "matchExpressions": [{"key": "disktype", "operator": "In", "values": ["ssd"]}]
<add> },
<add> }
<add> ]
<add> }
<add> }
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name=name_base,
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> affinity=affinity,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> client = ApiClient()
<add> self.assertEqual(type(result.spec.affinity), k8s.V1Affinity)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['affinity'], affinity)
<add>
<add> k8s_api_affinity = k8s.V1Affinity(
<add> node_affinity=k8s.V1NodeAffinity(
<add> preferred_during_scheduling_ignored_during_execution=[
<add> k8s.V1PreferredSchedulingTerm(
<add> weight=1,
<add> preference=k8s.V1NodeSelectorTerm(
<add> match_expressions=[
<add> k8s.V1NodeSelectorRequirement(key="disktype", operator="In", values=["ssd"])
<add> ]
<add> ),
<add> )
<add> ]
<add> ),
<add> )
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name=name_base,
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> affinity=k8s_api_affinity,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> self.assertEqual(type(result.spec.affinity), k8s.V1Affinity)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['affinity'], affinity)
<add>
<add> def test_tolerations(self):
<add> k8s_api_tolerations = [k8s.V1Toleration(key="key", operator="Equal", value="value")]
<add>
<add> tolerations = [{'key': "key", 'operator': 'Equal', 'value': 'value'}]
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name="name",
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> tolerations=tolerations,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> client = ApiClient()
<add> self.assertEqual(type(result.spec.tolerations[0]), k8s.V1Toleration)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['tolerations'], tolerations)
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name="name",
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> tolerations=k8s_api_tolerations,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> self.assertEqual(type(result.spec.tolerations[0]), k8s.V1Toleration)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['tolerations'], tolerations)
<add>
<add> def test_node_selector(self):
<add> k8s_api_node_selector = k8s.V1NodeSelector(
<add> node_selector_terms=[
<add> k8s.V1NodeSelectorTerm(
<add> match_expressions=[
<add> k8s.V1NodeSelectorRequirement(key="disktype", operator="In", values=["ssd"])
<add> ]
<add> )
<add> ]
<add> )
<add>
<add> node_selector = {
<add> 'nodeSelectorTerms': [
<add> {'matchExpressions': [{'key': 'disktype', 'operator': 'In', 'values': ['ssd']}]}
<add> ]
<add> }
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name="name",
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> node_selector=k8s_api_node_selector,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> client = ApiClient()
<add> self.assertEqual(type(result.spec.node_selector), k8s.V1NodeSelector)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['nodeSelector'], node_selector)
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name="name",
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> node_selector=k8s_api_node_selector,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> client = ApiClient()
<add> self.assertEqual(type(result.spec.node_selector), k8s.V1NodeSelector)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['nodeSelector'], node_selector)
<add>
<add> # repeat tests using deprecated parameter
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name="name",
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> node_selectors=node_selector,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> client = ApiClient()
<add> self.assertEqual(type(result.spec.node_selector), k8s.V1NodeSelector)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['nodeSelector'], node_selector)
<add>
<add> k = KubernetesPodOperator(
<add> namespace='default',
<add> image="ubuntu:16.04",
<add> cmds=["bash", "-cx"],
<add> arguments=["echo 10"],
<add> labels={"foo": "bar"},
<add> name="name",
<add> task_id="task",
<add> in_cluster=False,
<add> do_xcom_push=False,
<add> cluster_context='default',
<add> node_selectors=node_selector,
<add> )
<add>
<add> result = k.create_pod_request_obj()
<add> client = ApiClient()
<add> self.assertEqual(type(result.spec.node_selector), k8s.V1NodeSelector)
<add> self.assertEqual(client.sanitize_for_serialization(result)['spec']['nodeSelector'], node_selector)
| 4
|
Text
|
Text
|
convert some backticks to apo's
|
205bd91fcab30292ac5f246ce9bdbb045ad1023f
|
<ide><path>docs/sources/reference/run.md
<ide> the container you might have an HTTP service listening on port 80 (and so you
<ide> 42800.
<ide>
<ide> To help a new client container reach the server container's internal port
<del>operator `--expose``d by the operator or `EXPOSE``d by the developer, the
<add>operator `--expose`'d by the operator or `EXPOSE`'d by the developer, the
<ide> operator has three choices: start the server container with `-P` or `-p,` or
<ide> start the client container with `--link`.
<ide>
| 1
|
Ruby
|
Ruby
|
fix deprecation warning in tests
|
12f08acbacf823041dae27afd1a1a1458bb1e3fa
|
<ide><path>actionpack/test/dispatch/session/mem_cache_store_test.rb
<ide> def with_test_route_set
<ide>
<ide> @app = self.class.build_app(set) do |middleware|
<ide> middleware.use ActionDispatch::Session::MemCacheStore, :key => '_session_id', :namespace => "mem_cache_store_test:#{SecureRandom.hex(10)}"
<del> middleware.delete "ActionDispatch::ShowExceptions"
<add> middleware.delete ActionDispatch::ShowExceptions
<ide> end
<ide>
<ide> yield
<ide><path>actionview/test/abstract_unit.rb
<ide> class ActionDispatch::IntegrationTest < ActiveSupport::TestCase
<ide>
<ide> def self.build_app(routes = nil)
<ide> RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware|
<del> middleware.use "ActionDispatch::ShowExceptions", ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")
<del> middleware.use "ActionDispatch::DebugExceptions"
<del> middleware.use "ActionDispatch::Callbacks"
<del> middleware.use "ActionDispatch::ParamsParser"
<del> middleware.use "ActionDispatch::Cookies"
<del> middleware.use "ActionDispatch::Flash"
<del> middleware.use "Rack::Head"
<add> middleware.use ActionDispatch::ShowExceptions, ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")
<add> middleware.use ActionDispatch::DebugExceptions
<add> middleware.use ActionDispatch::Callbacks
<add> middleware.use ActionDispatch::ParamsParser
<add> middleware.use ActionDispatch::Cookies
<add> middleware.use ActionDispatch::Flash
<add> middleware.use Rack::Head
<ide> yield(middleware) if block_given?
<ide> end
<ide> end
<ide><path>railties/lib/rails/application/bootstrap.rb
<ide> module Bootstrap
<ide> Rails.cache = ActiveSupport::Cache.lookup_store(config.cache_store)
<ide>
<ide> if Rails.cache.respond_to?(:middleware)
<del> config.middleware.insert_before("Rack::Runtime", Rails.cache.middleware)
<add> config.middleware.insert_before(::Rack::Runtime, Rails.cache.middleware)
<ide> end
<ide> end
<ide> end
| 3
|
Python
|
Python
|
remove unwanted code
|
0b54046ff8bbb60f0ec0ecbc1b6215be6bc1b2d9
|
<ide><path>src/transformers/models/deberta_v2/modeling_deberta_v2.py
<ide> def disentangled_attention_bias(self, query_layer, key_layer, relative_pos, rel_
<ide> r_pos = relative_pos
<ide>
<ide> p2c_pos = torch.clamp(-r_pos + att_span, 0, att_span * 2 - 1)
<del> if query_layer.size(-2) != key_layer.size(-2):
<del> pos_index = relative_pos[:, :, :, 0].unsqueeze(-1)
<ide>
<ide> if "p2c" in self.pos_att_type:
<ide> p2c_att = torch.bmm(key_layer, pos_query_layer.transpose(-1, -2))
<ide> def disentangled_attention_bias(self, query_layer, key_layer, relative_pos, rel_
<ide> dim=-1,
<ide> index=p2c_pos.squeeze(0).expand([query_layer.size(0), key_layer.size(-2), key_layer.size(-2)]),
<ide> ).transpose(-1, -2)
<del> if query_layer.size(-2) != key_layer.size(-2):
<del> p2c_att = torch.gather(
<del> p2c_att,
<del> dim=-2,
<del> index=pos_index.expand(p2c_att.size()[:2] + (pos_index.size(-2), key_layer.size(-2))),
<del> )
<ide> score += p2c_att / scale
<ide>
<ide> # position->position
<ide> if "p2p" in self.pos_att_type:
<ide> pos_query = pos_query_layer[:, :, att_span:, :]
<ide> p2p_att = torch.matmul(pos_query, pos_key_layer.transpose(-1, -2))
<ide> p2p_att = p2p_att.expand(query_layer.size()[:2] + p2p_att.size()[2:])
<del> if query_layer.size(-2) != key_layer.size(-2):
<del> p2p_att = torch.gather(
<del> p2p_att,
<del> dim=-2,
<del> index=pos_index.expand(query_layer.size()[:2] + (pos_index.size(-2), p2p_att.size(-1))),
<del> )
<ide> p2p_att = torch.gather(
<ide> p2p_att,
<ide> dim=-1,
| 1
|
Text
|
Text
|
modify the arrangement of text
|
11d4b464d372bd9318eaa218c34fe6fdf4c6d8da
|
<ide><path>guide/chinese/agile/rapid-application-development/index.md
<ide> localeTitle: 快速应用开发
<ide>
<ide> 快速应用程序开发(RAD)被设计为对传统软件开发方法问题的反应,特别是长时间开发的问题。它还解决了与开发过程中需求变化相关的问题。
<ide>
<del>RAD的主要原则如下: 1)增量发展。这是RAD处理不断变化的需求的主要手段。只有当用户看到并体验使用中的系统时,才会出现一些要求。要求从未被视为完整 - 由于环境的变化,它们会随着时间的推移而发展。 RAD流程从一个高级的,非特定的需求列表开始,这些需求在开发过程中得到了改进。 2)时间盒。通过时间框,系统可以分为多个单独开发的组件或时间盒。最重要的要求是在第一个时间框中开发的。功能快速而且经常提供。 3)帕累托原则。也称为80/20规则,这意味着大约80%的系统功能可以提供,占所需总工作量的20%左右。因此,最后(也是最复杂)20%的需求需要付出最大的努力和时间。因此,您应该在前几个时间框内选择尽可能多的80%。如果证明有必要,其余部分可以在随后的时间框中提供。 4)MoSCoW规则。 MoSCoW是一种用于在软件开发中确定工作项优先级的方法。项目被列为必须拥有,应拥有,可能拥有或希望具有的功能。必须具有必须包含在产品中以供其接受发布的项目,其他分类具有降序优先级。 5)JAD研讨会。联合应用程序开发(JAD)是一种促进会议,其中执行需求收集,特别是访问要开发的系统的用户。 JAD研讨会通常在开发过程的早期阶段进行,但如果在此过程中稍后需要,可以组织其他会议。 6)原型设计。构建原型有助于建立和阐明用户需求,并且在某些情况下,它会演变为系统本身。 7)赞助商和冠军。执行发起人是组织内需要系统的人,致力于实现该系统并准备为其提供资金。冠军是一个人,通常资历较低,而不是高管,他致力于该项目,并准备将其推进到完成阶段。 8)工具集。 RAD通常采用工具集作为加速开发过程和提高生产率的手段。工具可用于变更控制,配置管理和代码重用。
<add>RAD的主要原则如下:
<add>
<add>1)增量发展。这是RAD处理不断变化的需求的主要手段。只有当用户看到并体验使用中的系统时,才会出现一些要求。要求从未被视为完整 - 由于环境的变化,它们会随着时间的推移而发展。 RAD流程从一个高级的,非特定的需求列表开始,这些需求在开发过程中得到了改进。
<add>
<add>2)时间盒。通过时间框,系统可以分为多个单独开发的组件或时间盒。最重要的要求是在第一个时间框中开发的。功能快速而且经常提供。
<add>
<add>3)帕累托原则。也称为80/20规则,这意味着大约80%的系统功能可以提供,占所需总工作量的20%左右。因此,最后(也是最复杂)20%的需求需要付出最大的努力和时间。因此,您应该在前几个时间框内选择尽可能多的80%。如果证明有必要,其余部分可以在随后的时间框中提供。
<add>
<add>4)MoSCoW规则。 MoSCoW是一种用于在软件开发中确定工作项优先级的方法。项目被列为必须拥有,应拥有,可能拥有或希望具有的功能。必须具有必须包含在产品中以供其接受发布的项目,其他分类具有降序优先级。
<add>
<add>5)JAD研讨会。联合应用程序开发(JAD)是一种促进会议,其中执行需求收集,特别是访问要开发的系统的用户。 JAD研讨会通常在开发过程的早期阶段进行,但如果在此过程中稍后需要,可以组织其他会议。
<add>
<add>6)原型设计。构建原型有助于建立和阐明用户需求,并且在某些情况下,它会演变为系统本身。
<add>
<add>7)赞助商和冠军。执行发起人是组织内需要系统的人,致力于实现该系统并准备为其提供资金。冠军是一个人,通常资历较低,而不是高管,他致力于该项目,并准备将其 推进到完成阶段。
<add>
<add>8)工具集。 RAD通常采用工具集作为加速开发过程和提高生产率的手段。工具可用于变更控制,配置管理和代码重用。
<ide>
<ide> #### 更多信息:
<ide>
<ide> * https://en.wikipedia.org/wiki/Rapid _应用程序_开发 - 关于RAD的维基百科文章
<del>* https://www.tutorialspoint.com/sdlc/sdlc _rad_ model.htm - RAD上的TutorialsPoint教程
<ide>\ No newline at end of file
<add>* https://www.tutorialspoint.com/sdlc/sdlc _rad_ model.htm - RAD上的TutorialsPoint教程
| 1
|
Text
|
Text
|
add reference for == and != operators
|
1744836d9cb9e08b380f0b9b6a5548f179fdd361
|
<ide><path>doc/api/assert.md
<ide> more on color support in terminal environments, read the tty
<ide>
<ide> ## Legacy assertion mode
<ide>
<del>Legacy assertion mode uses the `==` operator in:
<add>Legacy assertion mode uses the [`==` operator][] in:
<ide>
<ide> * [`assert.deepEqual()`][]
<ide> * [`assert.equal()`][]
<ide> are also recursively evaluated by the following rules.
<ide>
<ide> ### Comparison details
<ide>
<del>* Primitive values are compared with the `==` operator,
<add>* Primitive values are compared with the [`==` operator][],
<ide> with the exception of `NaN`. It is treated as being identical in case
<ide> both sides are `NaN`.
<ide> * [Type tags][Object.prototype.toString()] of objects should be the same.
<ide> are also recursively evaluated by the following rules.
<ide> are not enumerable properties.
<ide>
<ide> The following example does not throw an [`AssertionError`][] because the
<del>primitives are compared using the `==` operator.
<add>primitives are compared using the [`==` operator][].
<ide>
<ide> ```mjs
<ide> import assert from 'assert';
<ide> An alias of [`assert.strictEqual()`][].
<ide> > Stability: 3 - Legacy: Use [`assert.strictEqual()`][] instead.
<ide>
<ide> Tests shallow, coercive equality between the `actual` and `expected` parameters
<del>using the `==` operator. `NaN` is specially handled
<add>using the [`==` operator][]. `NaN` is specially handled
<ide> and treated as being identical if both sides are `NaN`.
<ide>
<ide> ```mjs
<ide> An alias of [`assert.notStrictEqual()`][].
<ide>
<ide> > Stability: 3 - Legacy: Use [`assert.notStrictEqual()`][] instead.
<ide>
<del>Tests shallow, coercive inequality with the
<del>`!=` operator. `NaN` is specially handled and treated as being identical if
<del>sides are `NaN`.
<add>Tests shallow, coercive inequality with the [`!=` operator][]. `NaN` is
<add>specially handled and treated as being identical if both sides are `NaN`.
<ide>
<ide> ```mjs
<ide> import assert from 'assert';
<ide> argument.
<ide> [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
<ide> [SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue
<ide> [Strict Equality Comparison]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
<add>[`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality
<add>[`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
<ide> [`AssertionError`]: #class-assertassertionerror
<ide> [`CallTracker`]: #class-assertcalltracker
<ide> [`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
| 1
|
Javascript
|
Javascript
|
fix duplicate array creation
|
f649588c9c4926bb613c27142397ff6d81925f66
|
<ide><path>src/objects/InstancedMesh.js
<ide> InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
<ide> _instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );
<ide>
<ide>
<del> //The agent mesh represents this single instance
<add> //The mesh represents this single instance
<ide>
<ide> _mesh.matrixWorld = _instanceWorldMatrix;
<ide>
<ide> InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
<ide>
<ide> intersects.push( _instanceIntersects[ 0 ] );
<ide>
<del> _instanceIntersects = [];
<add> _instanceIntersects.length = 0;
<ide>
<ide> }
<ide>
| 1
|
Python
|
Python
|
fix flaky test
|
b91854ea9d9764ab670b7cccdcec40ae964195be
|
<ide><path>tests/test_model_saving.py
<ide> def test_sequential_model_saving():
<ide>
<ide> new_model = load_model(fname)
<ide> out2 = new_model.predict(x)
<del> assert_allclose(out, out2)
<add> assert_allclose(out, out2, atol=1e-05)
<ide>
<ide> # test that new updates are the same with both models
<ide> x = np.random.random((1, 3))
<ide> def test_sequential_model_saving():
<ide> new_model.train_on_batch(x, y)
<ide> out = model.predict(x)
<ide> out2 = new_model.predict(x)
<del> assert_allclose(out, out2)
<add> assert_allclose(out, out2, atol=1e-05)
<ide>
<ide>
<ide> @keras_test
<ide> def test_sequential_model_saving_2():
<ide>
<ide> new_model = load_model(fname)
<ide> out2 = new_model.predict(x)
<del> assert_allclose(out, out2)
<add> assert_allclose(out, out2, atol=1e-05)
<ide>
<ide> # test that new updates are the same with both models
<ide> x = np.random.random((1, 3))
<ide> def test_sequential_model_saving_2():
<ide> new_model.train_on_batch(x, y)
<ide> out = model.predict(x)
<ide> out2 = new_model.predict(x)
<del> assert_allclose(out, out2)
<add> assert_allclose(out, out2, atol=1e-05)
<ide>
<ide>
<ide> @keras_test
<ide> def test_sequential_model_saving_3():
<ide> custom_objects={'custom_opt': custom_opt,
<ide> 'custom_loss': custom_loss})
<ide> out2 = model.predict(x)
<del> assert_allclose(out, out2)
<add> assert_allclose(out, out2, atol=1e-05)
<ide>
<ide>
<ide> @keras_test
<ide> def test_fuctional_model_saving():
<ide>
<ide> model = load_model(fname)
<ide> out2 = model.predict(x)
<del> assert_allclose(out, out2)
<add> assert_allclose(out, out2, atol=1e-05)
<ide>
<ide>
<ide> @keras_test
| 1
|
Ruby
|
Ruby
|
improve otool failure handling
|
56e82c941efa6827a6095630bebbdcc5ad631ff7
|
<ide><path>Library/Homebrew/mach.rb
<ide> def initialize(path)
<ide> def parse_otool_L_output
<ide> ENV["HOMEBREW_MACH_O_FILE"] = path.expand_path.to_s
<ide> libs = `#{MacOS.locate("otool")} -L "$HOMEBREW_MACH_O_FILE"`.split("\n")
<del> return nil, [] if libs.empty?
<add> unless $?.success?
<add> raise ErrorDuringExecution.new(MacOS.locate("otool"),
<add> ["-L", ENV["HOMEBREW_MACH_O_FILE"]])
<add> end
<ide>
<ide> libs.shift # first line is the filename
<ide>
| 1
|
Ruby
|
Ruby
|
resolve warnings by instantizing @attrubtes as nil
|
3d87d01dad08f0ff84d38b1211ba8de0364e0efb
|
<ide><path>activerecord/test/cases/attribute_methods_test.rb
<ide> def test_respond_to_with_allocated_object
<ide> # by inspecting it.
<ide> def test_allocated_object_can_be_inspected
<ide> topic = Topic.allocate
<add> topic.instance_eval { @attributes = nil }
<ide> assert_nothing_raised { topic.inspect }
<ide> assert topic.inspect, "#<Topic not initialized>"
<ide> end
| 1
|
Go
|
Go
|
add missing parserepositorytag
|
c84d74df8c17f50c8ca7f5027ade4db8360f5ed3
|
<ide><path>server.go
<ide> func (srv *Server) deleteImage(img *Image, repoName, tag string) ([]APIRmi, erro
<ide> //If delete by id, see if the id belong only to one repository
<ide> if strings.Contains(img.ID, repoName) && tag == "" {
<ide> for _, repoAndTag := range srv.runtime.repositories.ByID()[img.ID] {
<del> parsedRepo := strings.Split(repoAndTag, ":")[0]
<add> parsedRepo, parsedTag := utils.ParseRepositoryTag(repoAndTag)
<ide> if strings.Contains(img.ID, repoName) {
<ide> repoName = parsedRepo
<del> if len(srv.runtime.repositories.ByID()[img.ID]) == 1 && len(strings.Split(repoAndTag, ":")) > 1 {
<del> tag = strings.Split(repoAndTag, ":")[1]
<add> if len(srv.runtime.repositories.ByID()[img.ID]) == 1 && len(parsedTag) > 1 {
<add> tag = parsedTag
<ide> }
<ide> } else if repoName != parsedRepo {
<ide> // the id belongs to multiple repos, like base:latest and user:test,
| 1
|
Javascript
|
Javascript
|
remove explicit call to `waitforangular()`
|
26acedde7c59cc15f156ba32d141a8be3cac46bc
|
<ide><path>test/e2e/tests/angular-already-loadedSpec.js
<ide> describe('App where angular is loaded more than once', function() {
<ide> beforeEach(function() {
<del> loadFixture('angular-already-loaded').andWaitForAngular();
<add> loadFixture('angular-already-loaded');
<ide> });
<ide>
<ide> it('should have the interpolated text', function() {
<ide><path>test/e2e/tests/helpers/main.js
<ide> var helper = {
<del> andWaitForAngular: function() {
<del> browser.waitForAngular();
<del> },
<ide> loadFixture: function(fixture) {
<ide> var i = 0;
<ide> while (fixture[i] === '/') ++i;
<ide><path>test/e2e/tests/loaderSpec.js
<ide> describe('angular-loader', function() {
<ide> beforeEach(function() {
<del> loadFixture('loader').andWaitForAngular();
<add> loadFixture('loader');
<ide> });
<ide>
<ide> it('should not be broken by loading the modules before core', function() {
<ide><path>test/e2e/tests/ngJqSpec.js
<ide> describe('Customizing the jqLite / jQuery version', function() {
<ide> it('should be able to force jqLite', function() {
<del> loadFixture('ngJq').andWaitForAngular();
<add> loadFixture('ngJq');
<ide> expect(element(by.binding('jqueryVersion')).getText()).toBe('jqLite');
<ide> });
<ide>
<ide> it('should be able to use a specific version jQuery', function() {
<del> loadFixture('ngJqJquery').andWaitForAngular();
<add> loadFixture('ngJqJquery');
<ide> expect(element(by.binding('jqueryVersion')).getText()).toBe('2.1.0');
<ide> });
<ide> });
<ide><path>test/e2e/tests/sampleSpec.js
<ide> // Sample E2E test:
<ide> describe('Sample', function() {
<ide> beforeEach(function() {
<del> loadFixture('sample').andWaitForAngular();
<add> loadFixture('sample');
<ide> });
<ide>
<ide> it('should have the interpolated text', function() {
| 5
|
Mixed
|
Ruby
|
fix incorrect caching of case-insensitivity
|
b39050e8d574b814d3580688276e933a3d08aca8
|
<ide><path>activerecord/CHANGELOG.md
<add>* Fix redundant updates to the column insensitivity cache
<add>
<add> Fixed redundant queries checking column capability for insensitive
<add> comparison.
<add>
<add> *Phil Pirozhkov*
<add>
<ide> * Allow disabling methods generated by `ActiveRecord.enum`.
<ide>
<ide> *Alfred Dominic*
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
<ide> def build_statement_pool
<ide>
<ide> def can_perform_case_insensitive_comparison_for?(column)
<ide> @case_insensitive_cache ||= {}
<del> @case_insensitive_cache[column.sql_type] ||= begin
<del> sql = <<~SQL
<del> SELECT exists(
<del> SELECT * FROM pg_proc
<del> WHERE proname = 'lower'
<del> AND proargtypes = ARRAY[#{quote column.sql_type}::regtype]::oidvector
<del> ) OR exists(
<del> SELECT * FROM pg_proc
<del> INNER JOIN pg_cast
<del> ON ARRAY[casttarget]::oidvector = proargtypes
<del> WHERE proname = 'lower'
<del> AND castsource = #{quote column.sql_type}::regtype
<del> )
<del> SQL
<del> execute_and_clear(sql, "SCHEMA", [], allow_retry: true, uses_transaction: false) do |result|
<del> result.getvalue(0, 0)
<add> @case_insensitive_cache.fetch(column.sql_type) do
<add> @case_insensitive_cache[column.sql_type] = begin
<add> sql = <<~SQL
<add> SELECT exists(
<add> SELECT * FROM pg_proc
<add> WHERE proname = 'lower'
<add> AND proargtypes = ARRAY[#{quote column.sql_type}::regtype]::oidvector
<add> ) OR exists(
<add> SELECT * FROM pg_proc
<add> INNER JOIN pg_cast
<add> ON ARRAY[casttarget]::oidvector = proargtypes
<add> WHERE proname = 'lower'
<add> AND castsource = #{quote column.sql_type}::regtype
<add> )
<add> SQL
<add> execute_and_clear(sql, "SCHEMA", [], allow_retry: true, uses_transaction: false) do |result|
<add> result.getvalue(0, 0)
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
<ide> def test_unparsed_defaults_are_at_least_set_when_saving
<ide> end
<ide> end
<ide>
<add> def test_only_check_for_insensitive_comparison_capability_once
<add> with_example_table "id SERIAL PRIMARY KEY, number INTEGER" do
<add> number_klass = Class.new(ActiveRecord::Base) do
<add> self.table_name = "ex"
<add> end
<add> attribute = number_klass.arel_table[:number]
<add> assert_queries :any, ignore_none: true do
<add> @connection.case_insensitive_comparison(attribute, "foo")
<add> end
<add> assert_no_queries do
<add> @connection.case_insensitive_comparison(attribute, "foo")
<add> end
<add> end
<add> end
<add>
<ide> private
<ide> def with_example_table(definition = "id serial primary key, number integer, data character varying(255)", &block)
<ide> super(@connection, "ex", definition, &block)
| 3
|
Javascript
|
Javascript
|
fix linter error
|
7d2aeeee226319d49b9bd5ae03931a69d02fdf08
|
<ide><path>src/renderers/webgl/WebGLCapabilities.js
<ide> function WebGLCapabilities( gl, extensions, parameters ) {
<ide> var maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
<ide>
<ide> var multiviewExt = extensions.get( 'OVR_multiview2' );
<del> var multiview = isWebGL2 && ( !! multiviewExt ) && !gl.getContextAttributes().antialias;
<add> var multiview = isWebGL2 && ( !! multiviewExt ) && ! gl.getContextAttributes().antialias;
<ide> var maxMultiviewViews = multiview ? gl.getParameter( multiviewExt.MAX_VIEWS_OVR ) : 0;
<ide>
<ide> return {
| 1
|
Text
|
Text
|
fix the link to the docs
|
5eb8f818dfe1b517517f83f447f3970d70c7c5d8
|
<ide><path>README.md
<ide> Airflow
<ide> ====
<ide> Airflow is a system to programmaticaly author, schedule and monitor data pipelines.
<ide>
<del>[Documentation](https://readthedocs.org/dashboard/flux-data-pipelines/)
<add>[Documentation](http://airflow.readthedocs.org/en/latest/)
| 1
|
Javascript
|
Javascript
|
replace common.fixturesdir with commonfixtures
|
03550a5c18f77d4c956e11b2e5b982572c57d92e
|
<ide><path>test/parallel/test-tls-net-connect-prefer-path.js
<ide> 'use strict';
<ide> const common = require('../common');
<add>const fixtures = require('../common/fixtures');
<ide>
<ide> // This tests that both tls and net will ignore host and port if path is
<ide> // provided.
<ide> function mkServer(lib, tcp, cb) {
<ide> const args = [handler];
<ide> if (lib === tls) {
<ide> args.unshift({
<del> cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
<del> key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
<add> cert: fixtures.readSync('test_cert.pem'),
<add> key: fixtures.readSync('test_key.pem')
<ide> });
<ide> }
<ide> const server = lib.createServer(...args);
| 1
|
Javascript
|
Javascript
|
set correct type in contextdependency
|
724987a8a7d47c45125c75889f23bd6d4bde51f1
|
<ide><path>lib/dependencies/ContextDependency.js
<ide> class ContextDependency extends Dependency {
<ide> super();
<ide> this.options = options;
<ide> this.userRequest = this.options.request;
<add> /** @type {false | string} */
<ide> this.critical = false;
<ide> this.hadGlobalOrStickyRegExp = false;
<ide> if (this.options.regExp.global || this.options.regExp.sticky) {
| 1
|
Go
|
Go
|
fix minor vet warnings
|
7a20a270bc7ce34c9a6f7cc9eebb38c0bb332b7f
|
<ide><path>daemon/discovery_test.go
<ide> func TestModifiedDiscoverySettings(t *testing.T) {
<ide> for _, c := range cases {
<ide> got := modifiedDiscoverySettings(c.current, c.modified.ClusterStore, c.modified.ClusterAdvertise, c.modified.ClusterOpts)
<ide> if c.expected != got {
<del> t.Fatalf("expected %v, got %v: current config %q, new config %q", c.expected, got, c.current, c.modified)
<add> t.Fatalf("expected %v, got %v: current config %v, new config %v", c.expected, got, c.current, c.modified)
<ide> }
<ide> }
<ide> }
<ide><path>integration-cli/docker_api_update_unix_test.go
<ide> func (s *DockerSuite) TestApiUpdateContainer(c *check.C) {
<ide> _, _, err := sockRequest("POST", "/containers/"+name+"/update", hostConfig)
<ide> c.Assert(err, check.IsNil)
<ide>
<del> memory := inspectField(c, name, "HostConfig.Memory")
<del> if memory != "314572800" {
<del> c.Fatalf("Got the wrong memory value, we got %d, expected 314572800(300M).", memory)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "314572800")
<ide> file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
<ide> out, _ := dockerCmd(c, "exec", name, "cat", file)
<ide> c.Assert(strings.TrimSpace(out), checker.Equals, "314572800")
<ide>
<del> memorySwap := inspectField(c, name, "HostConfig.MemorySwap")
<del> if memorySwap != "524288000" {
<del> c.Fatalf("Got the wrong memorySwap value, we got %d, expected 524288000(500M).", memorySwap)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.MemorySwap"), checker.Equals, "524288000")
<ide> file = "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"
<ide> out, _ = dockerCmd(c, "exec", name, "cat", file)
<ide> c.Assert(strings.TrimSpace(out), checker.Equals, "524288000")
<ide><path>integration-cli/docker_cli_update_unix_test.go
<ide> func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) {
<ide> dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "top")
<ide> dockerCmd(c, "update", "-m", "500M", name)
<ide>
<del> memory := inspectField(c, name, "HostConfig.Memory")
<del> if memory != "524288000" {
<del> c.Fatalf("Got the wrong memory value, we got %d, expected 524288000(500M).", memory)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "524288000")
<ide>
<ide> file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
<ide> out, _ := dockerCmd(c, "exec", name, "cat", file)
<ide> func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *check.C) {
<ide> dockerCmd(c, "update", "-m", "500M", name)
<ide> dockerCmd(c, "restart", name)
<ide>
<del> memory := inspectField(c, name, "HostConfig.Memory")
<del> if memory != "524288000" {
<del> c.Fatalf("Got the wrong memory value, we got %d, expected 524288000(500M).", memory)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "524288000")
<ide>
<ide> file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
<ide> out, _ := dockerCmd(c, "exec", name, "cat", file)
<ide> func (s *DockerSuite) TestUpdateStoppedContainer(c *check.C) {
<ide> dockerCmd(c, "run", "--name", name, "-m", "300M", "busybox", "cat", file)
<ide> dockerCmd(c, "update", "-m", "500M", name)
<ide>
<del> memory := inspectField(c, name, "HostConfig.Memory")
<del> if memory != "524288000" {
<del> c.Fatalf("Got the wrong memory value, we got %d, expected 524288000(500M).", memory)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "524288000")
<ide>
<ide> out, _ := dockerCmd(c, "start", "-a", name)
<ide> c.Assert(strings.TrimSpace(out), checker.Equals, "524288000")
<ide> func (s *DockerSuite) TestUpdatePausedContainer(c *check.C) {
<ide> dockerCmd(c, "pause", name)
<ide> dockerCmd(c, "update", "--cpu-shares", "500", name)
<ide>
<del> out := inspectField(c, name, "HostConfig.CPUShares")
<del> if out != "500" {
<del> c.Fatalf("Got the wrong cpu shares value, we got %d, expected 500.", out)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.CPUShares"), checker.Equals, "500")
<ide>
<ide> dockerCmd(c, "unpause", name)
<ide> file := "/sys/fs/cgroup/cpu/cpu.shares"
<del> out, _ = dockerCmd(c, "exec", name, "cat", file)
<add> out, _ := dockerCmd(c, "exec", name, "cat", file)
<ide> c.Assert(strings.TrimSpace(out), checker.Equals, "500")
<ide> }
<ide>
<ide> func (s *DockerSuite) TestUpdateKernelMemory(c *check.C) {
<ide> // Update kernel memory to a running container is not allowed.
<ide> c.Assert(err, check.NotNil)
<ide>
<del> out := inspectField(c, name, "HostConfig.KernelMemory")
<ide> // Update kernel memory to a running container with failure should not change HostConfig
<del> if out != "52428800" {
<del> c.Fatalf("Got the wrong memory value, we got %d, expected 52428800(50M).", out)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.KernelMemory"), checker.Equals, "52428800")
<ide>
<ide> dockerCmd(c, "stop", name)
<ide> dockerCmd(c, "update", "--kernel-memory", "100M", name)
<ide> dockerCmd(c, "start", name)
<ide>
<del> out = inspectField(c, name, "HostConfig.KernelMemory")
<del> if out != "104857600" {
<del> c.Fatalf("Got the wrong memory value, we got %d, expected 104857600(100M).", out)
<del> }
<add> c.Assert(inspectField(c, name, "HostConfig.KernelMemory"), checker.Equals, "104857600")
<ide>
<ide> file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
<del> out, _ = dockerCmd(c, "exec", name, "cat", file)
<add> out, _ := dockerCmd(c, "exec", name, "cat", file)
<ide> c.Assert(strings.TrimSpace(out), checker.Equals, "104857600")
<ide> }
<ide>
| 3
|
Javascript
|
Javascript
|
fix arguments order in test-fs-write-buffer
|
52c548b05d294765f0d2f0e39a9e5552fb007b2f
|
<ide><path>test/parallel/test-fs-write-buffer.js
<ide> tmpdir.refresh();
<ide> const cb = common.mustCall((err, written) => {
<ide> assert.ifError(err);
<ide>
<del> assert.strictEqual(2, written);
<add> assert.strictEqual(written, 2);
<ide> fs.closeSync(fd);
<ide>
<ide> const found = fs.readFileSync(filename, 'utf8');
<del> assert.strictEqual('lo', found);
<add> assert.strictEqual(found, 'lo');
<ide> });
<ide>
<ide> fs.write(fd, Buffer.from('hello'), 3, cb);
| 1
|
Text
|
Text
|
fix broken links
|
005aa45c32ca3bf48e0acc8d36c43ccc97507380
|
<ide><path>docs/samples/area/line-stacked.md
<ide> module.exports = {
<ide>
<ide> ## Docs
<ide> * [Area](../../charts/area.html)
<del> * [Filling modes](../../charts/area.htmll#filling-modes)
<add> * [Filling modes](../../charts/area.html#filling-modes)
<ide> * [Line](../../charts/line.html)
<ide> * [Data structures (`labels`)](../../general/data-structures.html)
<ide> * [Axes scales](../../axes/)
<ide><path>docs/samples/area/radar.md
<ide> module.exports = {
<ide>
<ide> ## Docs
<ide> * [Area](../../charts/area.html)
<del> * [Filling modes](../../charts/area.htmll#filling-modes)
<add> * [Filling modes](../../charts/area.html#filling-modes)
<ide> * [`propagate`](../../charts/area.html#propagate)
<ide> * [Radar](../../charts/radar.html)
<ide> * [Data structures (`labels`)](../../general/data-structures.html)
| 2
|
Ruby
|
Ruby
|
try blacklist for unknown formula names
|
b163ed03e9b7406ceefd88033943ff28d0ff7ebd
|
<ide><path>Library/Homebrew/cmd/info.rb
<ide> require 'tab'
<ide> require 'keg'
<ide> require 'caveats'
<add>require 'blacklist'
<ide>
<ide> module Homebrew extend self
<ide> def info
<ide> def print_info
<ide> elsif valid_url ARGV[0]
<ide> info_formula Formula.factory(ARGV.shift)
<ide> else
<del> ARGV.formulae.each{ |f| info_formula f }
<add> ARGV.named.each do |f|
<add> begin
<add> info_formula Formula.factory(f)
<add> rescue FormulaUnavailableError
<add> # No formula with this name, try a blacklist lookup
<add> blacklist = blacklisted?(f)
<add> puts blacklist if blacklist
<add> end
<add> end
<ide> end
<ide> end
<ide>
| 1
|
Javascript
|
Javascript
|
improve readability of normalizeencoding
|
34bf31ea8a027f8d43958ec6d79ecedc3a8188d4
|
<ide><path>benchmark/util/normalize-encoding.js
<add>'use strict';
<add>
<add>const common = require('../common.js');
<add>const assert = require('assert');
<add>
<add>const groupedInputs = {
<add> group_common: ['undefined', 'utf8', 'utf-8', 'base64', 'binary', 'latin1'],
<add> group_upper: ['UTF-8', 'UTF8', 'UCS2', 'UTF-16LE', 'UTF16LE', 'BASE64'],
<add> group_uncommon: [ 'foo', '1', 'false', 'undefined', '[]'],
<add> group_misc: ['', 'utf16le', 'usc2', 'hex', 'HEX', 'BINARY']
<add>};
<add>
<add>const inputs = [
<add> '', 'utf8', 'utf-8', 'UTF-8',
<add> 'UTF8', 'Utf8', 'uTf-8', 'utF-8', 'ucs2',
<add> 'UCS2', 'utf16le', 'utf-16le', 'UTF-16LE', 'UTF16LE',
<add> 'binary', 'BINARY', 'latin1', 'base64', 'BASE64',
<add> 'hex', 'HEX', 'foo', '1', 'false', 'undefined', '[]'];
<add>
<add>const bench = common.createBenchmark(main, {
<add> input: inputs.concat(Object.keys(groupedInputs)),
<add> n: [1e5]
<add>}, {
<add> flags: '--expose-internals'
<add>});
<add>
<add>function getInput(input) {
<add> switch (input) {
<add> case 'group_common':
<add> return groupedInputs.group_common;
<add> case 'group_upper':
<add> return groupedInputs.group_upper;
<add> case 'group_uncommon':
<add> return groupedInputs.group_uncommon;
<add> case 'group_misc':
<add> return groupedInputs.group_misc;
<add> case '1':
<add> return [1];
<add> case 'false':
<add> return [false];
<add> case 'undefined':
<add> return [undefined];
<add> case '[]':
<add> return [[]];
<add> default:
<add> return [input];
<add> }
<add>}
<add>
<add>function main(conf) {
<add> const normalizeEncoding = require('internal/util').normalizeEncoding;
<add>
<add> const n = conf.n | 0;
<add> const inputs = getInput(conf.input);
<add> var noDead = '';
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i += 1) {
<add> for (var j = 0; j < inputs.length; ++j) {
<add> noDead = normalizeEncoding(inputs[j]);
<add> }
<add> }
<add> bench.end(n);
<add> assert.ok(noDead === undefined || noDead.length > 0);
<add>}
<ide><path>lib/internal/util.js
<ide> exports.assertCrypto = function(exports) {
<ide> };
<ide>
<ide> exports.kIsEncodingSymbol = Symbol('node.isEncoding');
<add>
<add>// The loop should only run at most twice, retrying with lowercased enc
<add>// if there is no match in the first pass.
<add>// We use a loop instead of branching to retry with a helper
<add>// function in order to avoid the performance hit.
<add>// Return undefined if there is no match.
<ide> exports.normalizeEncoding = function normalizeEncoding(enc) {
<ide> if (!enc) return 'utf8';
<del> var low;
<del> for (;;) {
<add> var retried;
<add> while (true) {
<ide> switch (enc) {
<ide> case 'utf8':
<ide> case 'utf-8':
<ide> exports.normalizeEncoding = function normalizeEncoding(enc) {
<ide> case 'hex':
<ide> return enc;
<ide> default:
<del> if (low) return; // undefined
<add> if (retried) return; // undefined
<ide> enc = ('' + enc).toLowerCase();
<del> low = true;
<add> retried = true;
<ide> }
<ide> }
<ide> };
| 2
|
Ruby
|
Ruby
|
clarify error message
|
775c2fd245c5a2eb9976885778ff91d7b6c66b35
|
<ide><path>Library/Homebrew/livecheck/strategy/page_match.rb
<ide> def self.match?(url)
<ide> def self.page_matches(url, regex, &block)
<ide> page = Strategy.page_contents(url)
<ide>
<add> odebug "Page Contents", page
<add>
<ide> if block
<ide> data = { page: page }
<ide> case (value = block.call(data))
<ide> def self.page_matches(url, regex, &block)
<ide> when Array
<ide> return value
<ide> else
<del> raise TypeError, "Return value of `strategy :page_match` block must be a string or array."
<add> raise TypeError, "Return value of `strategy :page_match` block must be a string or array of strings."
<ide> end
<ide> end
<ide>
| 1
|
Ruby
|
Ruby
|
improve deprecation message
|
aca4c82d95721df874ae8ed5da2a476fdec42f11
|
<ide><path>actionpack/lib/action_dispatch/testing/integration.rb
<ide> def kwarg_request?(*args)
<ide> def non_kwarg_request_warning
<ide> ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc)
<ide> ActionDispatch::Integration::TestCase HTTP request methods will accept only
<del> keyword arguments in future Rails versions.
<add> the following keyword arguments in future Rails versions:
<add> #{REQUEST_KWARGS.join(', ')}
<ide>
<ide> Examples:
<ide>
<ide> get '/profile',
<ide> params: { id: 1 },
<ide> headers: { 'X-Extra-Header' => '123' },
<ide> env: { 'action_dispatch.custom' => 'custom' }
<add> xhr: true
<ide> MSG
<ide> end
<ide>
| 1
|
Text
|
Text
|
update the way of using module dimensions
|
331fb61376b8e4775ca3d247fc2435901fa2cf76
|
<ide><path>docs/Animations.md
<ide> make them customizable, React Native exposes a
<ide> [NavigatorSceneConfigs](https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js) API.
<ide>
<ide> ```javascript
<del>var SCREEN_WIDTH = require('Dimensions').get('window').width;
<add>var React = require('react-native');
<add>var { Dimensions } = React;
<add>var SCREEN_WIDTH = Dimensions.get('window').width;
<ide> var BaseConfig = Navigator.SceneConfigs.FloatFromRight;
<ide>
<ide> var CustomLeftToRightGesture = Object.assign({}, BaseConfig.gestures.pop, {
| 1
|
Text
|
Text
|
fix terms and add installation commands
|
34093dc3c32a786618ade6a9933d8964a87a7e9a
|
<ide><path>guide/portuguese/apache/index.md
<ide> localeTitle: Apache
<ide> ---
<ide> ## Apache
<ide>
<del>O Apache HTTP Server, comumente conhecido como Apache, é um servidor web de plataforma cruzada gratuito e de código aberto, lançado sob os termos da [Apache License 2.0](https://en.wikipedia.org/wiki/Apache_License) . O Apache é desenvolvido e mantido por uma comunidade aberta de desenvolvedores sob os auspícios da Apache Software Foundation.
<del>Acertar funcções no apache
<add>O Apache HTTP Server, comumente conhecido como Apache, é um servidor web de multi plataforma gratuito e de código aberto, lançado sob os termos da [Apache License 2.0](https://pt.wikipedia.org/wiki/Licen%C3%A7a_Apache). O Apache é desenvolvido e mantido por uma comunidade aberta de desenvolvedores sob a supervisão da Apache Software Foundation.
<add>O Apache, atualmente, funciona em 67% de todos os servidores web do mundo. Ele é rápido, confiável, e seguro. Ele pode ser altamente customizável para atender às necessidades de diversos ambientes através da utilização de extensões e módulos.
<add>
<add>
<add>### Instalação
<add>
<add>#### No Ubuntu
<add>```
<add>sudo apt install apache2
<add>```
<add>#### No Centos
<add>```
<add>sudo yum install httpd
<add>````
<add>#### No Arch
<add>```
<add>pacman -S apache
<add>```
| 1
|
Ruby
|
Ruby
|
initialize cxxstdlib set lazily
|
c1366b111f866a2a4e03ce606b52f93b1de10fdb
|
<ide><path>Library/Homebrew/formula.rb
<ide> class Formula
<ide>
<ide> attr_accessor :local_bottle_path
<ide>
<del> # Flag for marking whether this formula needs C++ standard library
<del> # compatibility check
<del> attr_reader :cxxstdlib
<del>
<ide> # Homebrew determines the name
<ide> def initialize name='__UNKNOWN__', path=self.class.path(name)
<ide> @name = name
<ide> def initialize name='__UNKNOWN__', path=self.class.path(name)
<ide> @pkg_version = PkgVersion.new(version, revision)
<ide>
<ide> @pin = FormulaPin.new(self)
<del>
<del> @cxxstdlib = Set.new
<ide> end
<ide>
<ide> def set_spec(name)
<ide> def recursive_requirements(&block)
<ide> Requirement.expand(self, &block)
<ide> end
<ide>
<add> # Flag for marking whether this formula needs C++ standard library
<add> # compatibility check
<add> def cxxstdlib
<add> @cxxstdlib ||= Set.new
<add> end
<add>
<ide> def to_hash
<ide> hsh = {
<ide> "name" => name,
| 1
|
Javascript
|
Javascript
|
fix debug_info env var
|
2e4b6a08085f5aee3df81e88af84848160073ef4
|
<ide><path>test/setupTestFramework.js
<ide> if (process.env.DEBUG_INFO) {
<ide> }
<ide> };
<ide> };
<del> const env = jasmine.getEnv();
<del> env.it = addDebugInfo(env.it);
<add> // eslint-disable-next-line no-global-assign
<add> it = addDebugInfo(it);
<ide> }
<ide>
<ide> // Workaround for a memory leak in wabt
| 1
|
Javascript
|
Javascript
|
fix linting issues
|
fea53502585c5b42d1b6f3a60f23ce0670e326a9
|
<ide><path>packages/welcome/lib/sunsetting-view.js
<ide> export default class SunsettingView {
<ide> this.props = props;
<ide> etch.initialize(this);
<ide>
<del> this.element.addEventListener('click', (event) => {
<add> this.element.addEventListener('click', event => {
<ide> const link = event.target.closest('a');
<ide> if (link && link.dataset.event) {
<ide> this.props.reporterProxy.sendEvent(
<ide> export default class SunsettingView {
<ide> serialize() {
<ide> return {
<ide> deserializer: 'SunsettingView',
<del> uri: this.props.uri,
<add> uri: this.props.uri
<ide> };
<ide> }
<ide>
<ide><path>packages/welcome/lib/welcome-package.js
<ide> export default class WelcomePackage {
<ide> this.subscriptions = new CompositeDisposable();
<ide>
<ide> this.subscriptions.add(
<del> atom.workspace.addOpener((filePath) => {
<add> atom.workspace.addOpener(filePath => {
<ide> if (filePath === SUNSETTING_URI) {
<ide> return this.createSunsettingView({ uri: SUNSETTING_URI });
<ide> }
<ide> })
<ide> );
<ide>
<ide> this.subscriptions.add(
<del> atom.workspace.addOpener((filePath) => {
<add> atom.workspace.addOpener(filePath => {
<ide> if (filePath === WELCOME_URI) {
<ide> return this.createWelcomeView({ uri: WELCOME_URI });
<ide> }
<ide> })
<ide> );
<ide>
<ide> this.subscriptions.add(
<del> atom.workspace.addOpener((filePath) => {
<add> atom.workspace.addOpener(filePath => {
<ide> if (filePath === GUIDE_URI) {
<ide> return this.createGuideView({ uri: GUIDE_URI });
<ide> }
<ide> })
<ide> );
<ide>
<ide> this.subscriptions.add(
<del> atom.workspace.addOpener((filePath) => {
<add> atom.workspace.addOpener(filePath => {
<ide> if (filePath === CONSENT_URI) {
<ide> return this.createConsentView({ uri: CONSENT_URI });
<ide> }
<ide> export default class WelcomePackage {
<ide> return Promise.all([
<ide> atom.workspace.open(WELCOME_URI, { split: 'left' }),
<ide> atom.workspace.open(SUNSETTING_URI, { split: 'left' }),
<del> atom.workspace.open(GUIDE_URI, { split: 'right' }),
<add> atom.workspace.open(GUIDE_URI, { split: 'right' })
<ide> ]);
<ide> }
<ide>
<ide><path>packages/welcome/lib/welcome-view.js
<ide> export default class WelcomeView {
<ide> this.props = props;
<ide> etch.initialize(this);
<ide>
<del> this.element.addEventListener('click', (event) => {
<add> this.element.addEventListener('click', event => {
<ide> const link = event.target.closest('a');
<ide> if (link && link.dataset.event) {
<ide> this.props.reporterProxy.sendEvent(
<ide> export default class WelcomeView {
<ide> serialize() {
<ide> return {
<ide> deserializer: 'WelcomeView',
<del> uri: this.props.uri,
<add> uri: this.props.uri
<ide> };
<ide> }
<ide>
| 3
|
Go
|
Go
|
move maxtime init() back to chtimes code
|
247f90c82e0846ec108a4abab51af93fa14b86a1
|
<ide><path>pkg/system/chtimes.go
<ide> package system // import "github.com/docker/docker/pkg/system"
<ide>
<ide> import (
<ide> "os"
<add> "syscall"
<ide> "time"
<add> "unsafe"
<ide> )
<ide>
<add>// Used by Chtimes
<add>var maxTime time.Time
<add>
<add>func init() {
<add> if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 {
<add> // This is a 64 bit timespec
<add> // os.Chtimes limits time to the following
<add> maxTime = time.Unix(0, 1<<63-1)
<add> } else {
<add> // This is a 32 bit timespec
<add> maxTime = time.Unix(1<<31-1, 0)
<add> }
<add>}
<add>
<ide> // Chtimes changes the access time and modified time of a file at the given path
<ide> func Chtimes(name string, atime time.Time, mtime time.Time) error {
<ide> unixMinTime := time.Unix(0, 0)
<ide><path>pkg/system/init.go
<del>package system // import "github.com/docker/docker/pkg/system"
<del>
<del>import (
<del> "syscall"
<del> "time"
<del> "unsafe"
<del>)
<del>
<del>// Used by chtimes
<del>var maxTime time.Time
<del>
<del>func init() {
<del> // chtimes initialization
<del> if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 {
<del> // This is a 64 bit timespec
<del> // os.Chtimes limits time to the following
<del> maxTime = time.Unix(0, 1<<63-1)
<del> } else {
<del> // This is a 32 bit timespec
<del> maxTime = time.Unix(1<<31-1, 0)
<del> }
<del>}
| 2
|
Ruby
|
Ruby
|
improve secret_token deprecation message
|
219e831d15b10eef43a7a65262bd0938e6baaabb
|
<ide><path>railties/lib/rails/application.rb
<ide> def key_generator
<ide> def env_config
<ide> @env_config ||= begin
<ide> if config.secret_key_base.nil?
<del> ActiveSupport::Deprecation.warn "You didn't set config.secret_key_base. " +
<del> "This should be used instead of the old deprecated config.secret_token. " +
<del> "Set config.secret_key_base instead of config.secret_token in config/initializers/secret_token.rb"
<add> ActiveSupport::Deprecation.warn "You didn't set config.secret_key_base in config/initializers/secret_token.rb file. " +
<add> "This should be used instead of the old deprecated config.secret_token in order to use the new EncryptedCookieStore. " +
<add> "To convert safely to the encrypted store (without losing existing cookies and sessions), see http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#action-pack"
<add>
<ide> if config.secret_token.blank?
<ide> raise "You must set config.secret_key_base in your app's config"
<ide> end
| 1
|
Text
|
Text
|
fix example link
|
fd937afcf5de381e9e015faacf0df9a2be12a744
|
<ide><path>threejs/lessons/threejs-scenegraph.md
<ide> One thing to notice is we set the `renderOrder` of the `AxesHelper`
<ide> to 2 and for the `GridHelper` to 1 so that the axes get drawn after the grid.
<ide> Otherwise the grid might overwrite the axes.
<ide>
<del>{{{example url="../threejs-scenegraph-sun-earth-moon-axes.html" }}}
<add>{{{example url="../threejs-scenegraph-sun-earth-moon-axes-grids.html" }}}
<ide>
<ide> Turn on the `solarSystem` and you'll see how the earth is exactly 10
<ide> units out from the center just like we set above. You can see how the
| 1
|
Javascript
|
Javascript
|
update deprecation errors
|
f230e45183f21278258cd47245f6f8ad7ef774bc
|
<ide><path>src/node.js
<ide>
<ide> // deprecation errors
<ide>
<add>GLOBAL.__module = function () {
<add> throw new Error("'__module' has been renamed to 'module'");
<add>};
<add>
<ide> GLOBAL.include = function () {
<del> throw new Error("include() has been removed. Use process.mixin(process, require(file)) to get the same effect.");
<add> throw new Error("include(module) has been removed. Use process.mixin(GLOBAL, require(module)) to get the same effect.");
<ide> };
<ide>
<ide> GLOBAL.puts = function () {
<del> throw new Error("puts() has moved. Use require('/sys.js') to bring it back.");
<add> throw new Error("puts() has moved. Use require('sys') to bring it back.");
<ide> }
<ide>
<ide> GLOBAL.print = function () {
<del> throw new Error("print() has moved. Use require('/sys.js') to bring it back.");
<add> throw new Error("print() has moved. Use require('sys') to bring it back.");
<ide> }
<ide>
<ide> GLOBAL.p = function () {
<del> throw new Error("p() has moved. Use require('/sys.js') to bring it back.");
<add> throw new Error("p() has moved. Use require('sys') to bring it back.");
<ide> }
<ide>
<ide> process.debug = function () {
<del> throw new Error("process.debug() has moved. Use require('/sys.js') to bring it back.");
<add> throw new Error("process.debug() has moved. Use require('sys') to bring it back.");
<ide> }
<ide>
<ide> process.error = function () {
<del> throw new Error("process.error() has moved. Use require('/sys.js') to bring it back.");
<add> throw new Error("process.error() has moved. Use require('sys') to bring it back.");
<ide> }
<ide>
<del>process.tcp.createServer = function () {
<del> throw new Error("process.tcp.createServer() has moved. Use require('/tcp.js') to access it.");
<add>GLOBAL.node = {};
<add>
<add>node.createProcess = function () {
<add> throw new Error("node.createProcess() has been changed to process.createChildProcess() update your code");
<ide> };
<ide>
<del>process.createProcess = function () {
<del> throw new Error("process.createProcess() has been changed to process.createChildProcess() update your code");
<add>node.exec = function () {
<add> throw new Error("process.exec() has moved. Use require('sys') to bring it back.");
<ide> };
<ide>
<del>process.exec = function () {
<del> throw new Error("process.exec() has moved. Use require('/sys.js') to bring it back.");
<del>}
<add>node.http = {};
<ide>
<del>process.http.createServer = function () {
<del> throw new Error("process.http.createServer() has moved. Use require('/http.js') to access it.");
<del>}
<add>node.http.createServer = function () {
<add> throw new Error("node.http.createServer() has moved. Use require('http') to access it.");
<add>};
<ide>
<del>process.http.createClient = function () {
<del> throw new Error("process.http.createClient() has moved. Use require('/http.js') to access it.");
<del>}
<add>node.http.createClient = function () {
<add> throw new Error("node.http.createClient() has moved. Use require('http') to access it.");
<add>};
<add>
<add>node.tcp = {};
<add>
<add>node.tcp.createServer = function () {
<add> throw new Error("node.tcp.createServer() has moved. Use require('tcp') to access it.");
<add>};
<add>
<add>node.tcp.createConnection = function () {
<add> throw new Error("node.tcp.createConnection() has moved. Use require('tcp') to access it.");
<add>};
<add>
<add>node.dns = {};
<ide>
<del>process.tcp.createConnection = function (port, host) {
<del> throw new Error("process.tcp.createConnection() has moved. Use require('/tcp.js') to access it.");
<add>node.dns.createConnection = function () {
<add> throw new Error("node.dns.createConnection() has moved. Use require('dns') to access it.");
<ide> };
<ide>
<ide>
| 1
|
Python
|
Python
|
add examples for isdigit and str_len
|
65eb581a3bd4b5e0ee390606e20dc4b6f8597b34
|
<ide><path>numpy/core/defchararray.py
<ide> def str_len(a):
<ide> See Also
<ide> --------
<ide> builtins.len
<add>
<add> Examples
<add> --------
<add> >>> a = np.array(['Grace Hopper Conference', 'Open Source Day'])
<add> >>> np.char.str_len(a)
<add> array([23, 15])
<add> >>> a = np.array([u'\u0420', u'\u043e'])
<add> >>> np.char.str_len(a)
<add> array([1, 1])
<add> >>> a = np.array([['hello', 'world'], [u'\u0420', u'\u043e']])
<add> >>> np.char.str_len(a)
<add> array([[5, 5], [1, 1]])
<ide> """
<ide> # Note: __len__, etc. currently return ints, which are not C-integers.
<ide> # Generally intp would be expected for lengths, although int is sufficient
<ide> def isdigit(a):
<ide> See Also
<ide> --------
<ide> str.isdigit
<add>
<add> Examples
<add> --------
<add> >>> a = np.array(['a', 'b', '0'])
<add> >>> np.char.isdigit(a)
<add> array([False, False, True])
<add> >>> a = np.array([['a', 'b', '0'], ['c', '1', '2']])
<add> >>> np.char.isdigit(a)
<add> array([[False, False, True], [False, True, True]])
<ide> """
<ide> return _vec_string(a, bool_, 'isdigit')
<ide>
| 1
|
PHP
|
PHP
|
pass delete method through eloquent query
|
4822f847c2cd2ba0342a9090eb704e33e2942ad5
|
<ide><path>laravel/database/eloquent/query.php
<ide> class Query {
<ide> */
<ide> public $passthru = array(
<ide> 'lists', 'only', 'insert', 'insert_get_id', 'update', 'increment',
<del> 'decrement', 'count', 'min', 'max', 'avg', 'sum',
<add> 'delete', 'decrement', 'count', 'min', 'max', 'avg', 'sum',
<ide> );
<ide>
<ide> /**
<ide> public function __call($method, $parameters)
<ide> $result = call_user_func_array(array($this->table, $method), $parameters);
<ide>
<ide> // Some methods may get their results straight from the fluent query
<del> // builder, such as the aggregate methods. If the called method is
<del> // one of these, we will return the result straight away.
<add> // builder such as the aggregate methods. If the called method is
<add> // one of these, we will just return the result straight away.
<ide> if (in_array($method, $this->passthru))
<ide> {
<ide> return $result;
| 1
|
Text
|
Text
|
remove accidental conflict diff
|
a8e090df04c9574aee9990f82715841aa797e220
|
<ide><path>docs/tutorial/quickstart.md
<ide> Because we're using viewsets instead of views, we can automatically generate the
<ide>
<ide> Again, if we need more control over the API URLs we can simply drop down to using regular class based views, and writing the URL conf explicitly.
<ide>
<del><<<<<<< HEAD
<del>Note that we're also including default login and logout views for use with the browsable API. That's optional, but useful if your API requires authentication and you want to use the browseable API.
<del>=======
<ide> Finally, we're including default login and logout views for use with the browsable API. That's optional, but useful if your API requires authentication and you want to use the browsable API.
<del>>>>>>>> master
<ide>
<ide> ## Settings
<ide>
| 1
|
PHP
|
PHP
|
highlight the discovered package name
|
ee051fb44425a5cbf363f640b6dd33f492d90940
|
<ide><path>src/Illuminate/Foundation/Console/PackageDiscoverCommand.php
<ide> public function handle(PackageManifest $manifest)
<ide> $manifest->build();
<ide>
<ide> foreach (array_keys($manifest->manifest) as $package) {
<del> $this->line("<info>Discovered Package:</info> {$package}");
<add> $this->line("Discovered Package: <info>{$package}</info>");
<ide> }
<ide>
<ide> $this->info('Package manifest generated successfully.');
| 1
|
PHP
|
PHP
|
update phpdoc comments to match signature
|
d2da49c113f995bce6ed64ac765ca3ab3fa6236c
|
<ide><path>src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php
<ide> public function makeHidden($attributes)
<ide> /**
<ide> * Make the given, typically visible, attributes hidden if the given truth test passes.
<ide> *
<del> * @param bool|Closure $truthTest
<add> * @param bool|Closure $condition
<ide> * @param array|string|null $attributes
<ide> * @return $this
<ide> */
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
<ide> public function orWherePivotNull($column, $not = false)
<ide> * Set a "or where not null" clause for a pivot table column.
<ide> *
<ide> * @param string $column
<del> * @param bool $not
<ide> * @return $this
<ide> */
<ide> public function orWherePivotNotNull($column)
<ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id')
<ide> /**
<ide> * Remove all existing orders and optionally add a new order.
<ide> *
<add> * @param string|null $column
<add> * @param string $direction
<ide> * @return $this
<ide> */
<ide> public function reorder($column = null, $direction = 'asc')
<ide><path>src/Illuminate/Log/LogManager.php
<ide> public function extend($driver, Closure $callback)
<ide> /**
<ide> * Unset the given channel instance.
<ide> *
<del> * @param string|null $name
<add> * @param string|null $driver
<ide> * @return $this
<ide> */
<ide> public function forgetChannel($driver = null)
<ide><path>src/Illuminate/Queue/CallQueuedClosure.php
<ide> public function __construct(SerializableClosure $closure)
<ide> /**
<ide> * Create a new job instance.
<ide> *
<del> * @param \Closure $closure
<add> * @param \Closure $job
<ide> * @return self
<ide> */
<ide> public static function create(Closure $job)
<ide><path>src/Illuminate/Queue/Worker.php
<ide> protected function markJobAsFailedIfWillExceedMaxAttempts($connectionName, $job,
<ide> *
<ide> * @param string $connectionName
<ide> * @param \Illuminate\Contracts\Queue\Job $job
<del> * @param int $maxTries
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<ide><path>src/Illuminate/Session/Middleware/StartSession.php
<ide> protected function sessionIsPersistent(array $config = null)
<ide> /**
<ide> * Resolve the given cache driver.
<ide> *
<del> * @param string $cache
<add> * @param string $driver
<ide> * @return \Illuminate\Cache\Store
<ide> */
<ide> protected function cache($driver)
<ide><path>src/Illuminate/Support/Collection.php
<ide> public function take($limit)
<ide> /**
<ide> * Take items in the collection until the given condition is met.
<ide> *
<del> * @param mixed $key
<add> * @param mixed $value
<ide> * @return static
<ide> */
<ide> public function takeUntil($value)
<ide> public function takeUntil($value)
<ide> /**
<ide> * Take items in the collection while the given condition is met.
<ide> *
<del> * @param mixed $key
<add> * @param mixed $value
<ide> * @return static
<ide> */
<ide> public function takeWhile($value)
<ide><path>src/Illuminate/Support/LazyCollection.php
<ide> public function take($limit)
<ide> /**
<ide> * Take items in the collection until the given condition is met.
<ide> *
<del> * @param mixed $key
<add> * @param mixed $value
<ide> * @return static
<ide> */
<ide> public function takeUntil($value)
<ide> public function takeUntil($value)
<ide> /**
<ide> * Take items in the collection while the given condition is met.
<ide> *
<del> * @param mixed $key
<add> * @param mixed $value
<ide> * @return static
<ide> */
<ide> public function takeWhile($value)
<ide><path>src/Illuminate/Support/Traits/EnumeratesValues.php
<ide> public function uniqueStrict($key = null)
<ide> *
<ide> * This is an alias to the "takeUntil" method.
<ide> *
<del> * @param mixed $key
<add> * @param mixed $value
<ide> * @return static
<ide> *
<ide> * @deprecated Use the "takeUntil" method directly.
<ide><path>src/Illuminate/View/ComponentAttributeBag.php
<ide> public function exceptProps($keys)
<ide> /**
<ide> * Merge additional attributes / values into the attribute bag.
<ide> *
<del> * @param array $attributes
<add> * @param array $attributeDefaults
<ide> * @return static
<ide> */
<ide> public function merge(array $attributeDefaults = [])
<ide> public function toHtml()
<ide> /**
<ide> * Merge additional attributes / values into the attribute bag.
<ide> *
<del> * @param array $attributes
<add> * @param array $attributeDefaults
<ide> * @return \Illuminate\Support\HtmlString
<ide> */
<ide> public function __invoke(array $attributeDefaults = [])
| 11
|
Ruby
|
Ruby
|
fix table comment dumping
|
0780c444dbf9793fdffaa631fa929d77f109e24f
|
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
<ide> def new_column(*args) # :nodoc:
<ide> end
<ide>
<ide> def table_options(table_name) # :nodoc:
<del> { comment: table_comment(table_name) }
<add> if comment = table_comment(table_name)
<add> { comment: comment }
<add> end
<ide> end
<ide>
<ide> # Returns a comment stored in database for given table
<ide><path>activerecord/lib/active_record/schema_dumper.rb
<ide> def foreign_keys(table, stream)
<ide> end
<ide>
<ide> def format_options(options)
<del> options.map { |key, value| "#{key}: #{value.inspect}" if value }.compact.join(", ")
<add> options.map { |key, value| "#{key}: #{value.inspect}" }.join(", ")
<ide> end
<ide>
<ide> def remove_prefix_and_suffix(table)
<ide><path>activerecord/test/cases/schema_dumper_test.rb
<ide> def test_schema_dump
<ide> output = standard_dump
<ide> assert_match %r{create_table "accounts"}, output
<ide> assert_match %r{create_table "authors"}, output
<add> assert_no_match %r{(?<=, ) do \|t\|}, output
<ide> assert_no_match %r{create_table "schema_migrations"}, output
<ide> assert_no_match %r{create_table "ar_internal_metadata"}, output
<ide> end
| 3
|
Ruby
|
Ruby
|
compare addresses case-insensitively
|
015c33f4cd6758e2c7d43f82ff5da93bac5cf3e3
|
<ide><path>lib/action_mailbox/router/route.rb
<ide> def initialize(address, to:)
<ide> def match?(inbound_email)
<ide> case address
<ide> when String
<del> recipients_from(inbound_email.mail).include?(address)
<add> recipients_from(inbound_email.mail).any? { |recipient| address.casecmp?(recipient) }
<ide> when Regexp
<del> recipients_from(inbound_email.mail).detect { |recipient| address.match?(recipient) }
<add> recipients_from(inbound_email.mail).any? { |recipient| address.match?(recipient) }
<ide> when Proc
<ide> address.call(inbound_email)
<ide> else
<ide><path>test/unit/router_test.rb
<ide> class RouterTest < ActiveSupport::TestCase
<ide> assert_equal inbound_email.mail, $processed_mail
<ide> end
<ide>
<add> test "single string routing case-insensitively" do
<add> @router.add_routes("first@example.com" => :first)
<add>
<add> inbound_email = create_inbound_email_from_mail(to: "FIRST@example.com", subject: "This is a reply")
<add> @router.route inbound_email
<add> assert_equal "FirstMailbox", $processed_by
<add> assert_equal inbound_email.mail, $processed_mail
<add> end
<add>
<ide> test "multiple string routes" do
<ide> @router.add_routes("first@example.com" => :first, "second@example.com" => :second)
<ide>
| 2
|
Text
|
Text
|
remove outstanding yaml comment
|
b3c3e0115f1c0341f0c34265f88aadb148f49e64
|
<ide><path>doc/api/buffer.md
<ide> This is the size (in bytes) of pre-allocated internal `Buffer` instances used
<ide> for pooling. This value may be modified.
<ide>
<ide> ### `buf[index]`
<del><!-- YAML
<del>type: property
<del>name: [index]
<del>-->
<ide>
<ide> * `index` {integer}
<ide>
| 1
|
PHP
|
PHP
|
use new fromshellcommandline method
|
e2e3dffbe0b3062620b7f6fd1e25f04e4f461909
|
<ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> protected function runCommandInForeground(Container $container)
<ide> {
<ide> $this->callBeforeCallbacks($container);
<ide>
<del> (new Process(
<del> $this->buildCommand(), base_path(), null, null, null
<del> ))->run();
<add> Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();
<ide>
<ide> $this->callAfterCallbacks($container);
<ide> }
<ide> protected function runCommandInBackground(Container $container)
<ide> {
<ide> $this->callBeforeCallbacks($container);
<ide>
<del> (new Process(
<del> $this->buildCommand(), base_path(), null, null, null
<del> ))->run();
<add> Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();
<ide> }
<ide>
<ide> /**
| 1
|
Javascript
|
Javascript
|
remove couple of spaces
|
a8b38b0e6b66edab2993e7a517ac37968dc1de92
|
<ide><path>src/manipulation.js
<ide> jQuery.fn.extend({
<ide> },
<ide>
<ide> before: function() {
<del> return this.domManip( arguments, false, function( elem ) {
<add> return this.domManip(arguments, false, function( elem ) {
<ide> if ( this.parentNode ) {
<ide> this.parentNode.insertBefore( elem, this );
<ide> }
<ide> });
<ide> },
<ide>
<ide> after: function() {
<del> return this.domManip( arguments, false, function( elem ) {
<add> return this.domManip(arguments, false, function( elem ) {
<ide> if ( this.parentNode ) {
<ide> this.parentNode.insertBefore( elem, this.nextSibling );
<ide> }
| 1
|
PHP
|
PHP
|
fix a styling issue
|
7c0d0f6baea9c89255e5da5a7df5ec0a0c5d9b82
|
<ide><path>src/Illuminate/Database/Schema/Builder.php
<ide> public function registerCustomDBALType($class, $name, $type)
<ide> if (! $this->connection->isDoctrineAvailable()) {
<ide> return;
<ide> }
<del>
<add>
<ide> if (! Type::hasType($name)) {
<ide> Type::addType($name, $class);
<add>
<ide> $this->connection
<ide> ->getDoctrineSchemaManager()
<ide> ->getDatabasePlatform()
| 1
|
Javascript
|
Javascript
|
add unit tests to flattenstyle
|
c6492111476859778248cabe707da804e32275dc
|
<ide><path>Libraries/StyleSheet/__tests__/flattenStyle-test.js
<add>/**
<add> * Copyright (c) 2015-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> */
<add>'use strict';
<add>
<add>jest.autoMockOff();
<add>
<add>var flattenStyle = require('flattenStyle');
<add>
<add>describe('flattenStyle', () => {
<add>
<add> it('should merge style objects', () => {
<add> var style1 = {width: 10};
<add> var style2 = {height: 20};
<add> var flatStyle = flattenStyle([style1, style2]);
<add> expect(flatStyle.width).toBe(10);
<add> expect(flatStyle.height).toBe(20);
<add> });
<add>
<add> it('should override style properties', () => {
<add> var style1 = {backgroundColor: '#000', width: 10};
<add> var style2 = {backgroundColor: '#023c69', width: null};
<add> var flatStyle = flattenStyle([style1, style2]);
<add> expect(flatStyle.backgroundColor).toBe('#023c69');
<add> expect(flatStyle.width).toBe(null);
<add> });
<add>
<add> it('should overwrite properties with `undefined`', () => {
<add> var style1 = {backgroundColor: '#000'};
<add> var style2 = {backgroundColor: undefined};
<add> var flatStyle = flattenStyle([style1, style2]);
<add> expect(flatStyle.backgroundColor).toBe(undefined);
<add> });
<add>
<add> it('should not fail on falsy values', () => {
<add> expect(() => flattenStyle([null, false, undefined])).not.toThrow();
<add> });
<add>
<add> it('should recursively flatten arrays', () => {
<add> var style1 = {width: 10};
<add> var style2 = {height: 20};
<add> var style3 = {width: 30};
<add> var flatStyle = flattenStyle([null, [], [style1, style2], style3]);
<add> expect(flatStyle.width).toBe(30);
<add> expect(flatStyle.height).toBe(20);
<add> });
<add>});
| 1
|
Javascript
|
Javascript
|
improve spliceone perf
|
b04d0921aeaa70521dea5fcb27256c686157eb87
|
<ide><path>benchmark/util/splice-one.js
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const bench = common.createBenchmark(main, {
<add> n: [1e7],
<add> pos: ['start', 'middle', 'end'],
<add> size: [10, 100, 500],
<add>}, { flags: ['--expose-internals'] });
<add>
<add>function main({ n, pos, size }) {
<add> const { spliceOne } = require('internal/util');
<add> const arr = new Array(size);
<add> arr.fill('');
<add> let index;
<add> switch (pos) {
<add> case 'end':
<add> index = size - 1;
<add> break;
<add> case 'middle':
<add> index = Math.floor(size / 2);
<add> break;
<add> default: // start
<add> index = 0;
<add> }
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i++) {
<add> spliceOne(arr, index);
<add> arr.push('');
<add> }
<add> bench.end(n);
<add>}
<ide><path>lib/internal/util.js
<ide> function join(output, separator) {
<ide> return str;
<ide> }
<ide>
<del>// About 1.5x faster than the two-arg version of Array#splice().
<add>// As of V8 6.6, depending on the size of the array, this is anywhere
<add>// between 1.5-10x faster than the two-arg version of Array#splice()
<ide> function spliceOne(list, index) {
<del> for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
<del> list[i] = list[k];
<add> for (; index + 1 < list.length; index++)
<add> list[index] = list[index + 1];
<ide> list.pop();
<ide> }
<ide>
<ide><path>test/parallel/test-benchmark-util.js
<ide> runBenchmark('util',
<ide> 'method=Array',
<ide> 'n=1',
<ide> 'option=none',
<add> 'pos=start',
<add> 'size=1',
<ide> 'type=',
<ide> 'version=native'],
<ide> { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
| 3
|
Python
|
Python
|
return empty dict if pod json encoding fails
|
fe5e689adfe3b2f9bcc37d3975ae1aea9b55e28a
|
<ide><path>airflow/utils/json.py
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<ide>
<add>import logging
<ide> from datetime import date, datetime
<ide> from decimal import Decimal
<ide>
<ide>
<ide> # Dates and JSON encoding/decoding
<ide>
<add>log = logging.getLogger(__name__)
<add>
<ide>
<ide> class AirflowJsonEncoder(JSONEncoder):
<ide> """Custom Airflow json encoder implementation."""
<ide> def _default(obj):
<ide> elif k8s is not None and isinstance(obj, (k8s.V1Pod, k8s.V1ResourceRequirements)):
<ide> from airflow.kubernetes.pod_generator import PodGenerator
<ide>
<del> return PodGenerator.serialize_pod(obj)
<add> def safe_get_name(pod):
<add> """
<add> We're running this in an except block, so we don't want it to
<add> fail under any circumstances, e.g. by accessing an attribute that isn't there
<add> """
<add> try:
<add> return pod.metadata.name
<add> except Exception:
<add> return None
<add>
<add> try:
<add> return PodGenerator.serialize_pod(obj)
<add> except Exception:
<add> log.warning("JSON encoding failed for pod %s", safe_get_name(obj))
<add> log.debug("traceback for pod JSON encode error", exc_info=True)
<add> return {}
<ide>
<ide> raise TypeError(f"Object of type '{obj.__class__.__name__}' is not JSON serializable")
| 1
|
Java
|
Java
|
fix malformed html in cglib javadoc
|
d6f73994c2385c98b9d70853f684866861364d80
|
<ide><path>spring-core/src/main/java/org/springframework/cglib/core/GeneratorStrategy.java
<ide> package org.springframework.cglib.core;
<ide>
<ide> /**
<del> * The <code>GeneratorStrategy</code. is responsible for taking a
<add> * The <code>GeneratorStrategy</code> is responsible for taking a
<ide> * {@link ClassGenerator} and producing a byte array containing the
<ide> * data for the generated <code>Class</code>. By providing your
<ide> * own strategy you may examine or modify the generated class before
<ide><path>spring-core/src/main/java/org/springframework/cglib/reflect/MethodDelegate.java
<ide> * }
<ide> *
<ide> * public int alternateMain( String[] args ) {
<del> * for (int i = 0; i < args.length; i++) {
<add> * for (int i = 0; i < args.length; i++) {
<ide> * System.out.println( args[i] );
<ide> * }
<ide> * return args.length;
| 2
|
Javascript
|
Javascript
|
remove unnecessary assignments
|
082cc8d6d8f5c7c797e58cefeb475b783c730635
|
<ide><path>test/internet/test-dns-txt-sigsegv.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dns = require('dns');
<ide>
<ide><path>test/internet/test-dns.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert'),
<ide> dns = require('dns'),
<ide> net = require('net'),
<ide><path>test/internet/test-http-dns-fail.js
<ide> * should trigger the error event after each attempt.
<ide> */
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<ide>
<ide><path>test/internet/test-net-connect-timeout.js
<ide> // https://groups.google.com/forum/#!topic/nodejs/UE0ZbfLt6t8
<ide> // https://groups.google.com/forum/#!topic/nodejs-dev/jR7-5UDqXkw
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var net = require('net');
<ide> var assert = require('assert');
<ide>
<ide><path>test/internet/test-net-connect-unref.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var net = require('net');
<ide>
<ide><path>test/message/2100bytes.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide>
<ide><path>test/message/core_line_numbers.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const punycode = require('punycode');
<ide>
<ide> // This test verifies that line numbers in core modules are reported correctly.
<ide><path>test/message/error_exit.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> process.on('exit', function(code) {
<ide><path>test/message/eval_messages.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var spawn = require('child_process').spawn;
<ide><path>test/message/hello_world.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> console.log('hello world');
<ide><path>test/message/max_tick_depth.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide>
<ide> process.maxTickDepth = 10;
<ide> var i = 20;
<ide><path>test/message/nexttick_throw.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> process.nextTick(function() {
<ide><path>test/message/stack_overflow.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> Error.stackTraceLimit = 0;
<ide><path>test/message/stdin_messages.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var spawn = require('child_process').spawn;
<ide><path>test/message/throw_custom_error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // custom error throwing
<ide><path>test/message/throw_in_line_with_tabs.js
<ide> /* eslint-disable indent */
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> console.error('before');
<ide><path>test/message/throw_non_error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // custom error throwing
<ide><path>test/message/throw_null.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> throw null;
<ide><path>test/message/throw_undefined.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> throw undefined;
<ide><path>test/message/timeout_throw.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> setTimeout(function() {
<ide><path>test/message/undefined_reference_in_new_context.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/message/vm_display_runtime_error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/message/vm_dont_display_syntax_error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-assert-typedarray-deepequal.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const a = require('assert');
<ide>
<ide><path>test/parallel/test-async-wrap-throw-no-init.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const async_wrap = process.binding('async_wrap');
<ide>
<ide><path>test/parallel/test-buffer-arraybuffer.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide>
<ide> const Buffer = require('buffer').Buffer;
<ide><path>test/parallel/test-buffer-ascii.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // ASCII conversion in node.js simply masks off the high bits,
<ide><path>test/parallel/test-buffer-bytelength.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Buffer = require('buffer').Buffer;
<ide>
<ide><path>test/parallel/test-buffer-concat.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var zero = [];
<ide><path>test/parallel/test-buffer-fakes.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const Buffer = require('buffer').Buffer;
<ide> const Bp = Buffer.prototype;
<ide><path>test/parallel/test-buffer-includes.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide>
<ide> const Buffer = require('buffer').Buffer;
<ide><path>test/parallel/test-buffer-indexof.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Buffer = require('buffer').Buffer;
<ide><path>test/parallel/test-buffer-inheritance.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide>
<ide>
<ide><path>test/parallel/test-buffer-inspect.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var util = require('util');
<ide><path>test/parallel/test-buffer-iterator.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var buffer = new Buffer([1, 2, 3, 4, 5]);
<ide><path>test/parallel/test-buffer-slow.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const buffer = require('buffer');
<ide> const Buffer = buffer.Buffer;
<ide><path>test/parallel/test-child-process-constructor.js
<ide> 'use strict';
<ide>
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide> var child_process = require('child_process');
<ide> var ChildProcess = child_process.ChildProcess;
<ide> assert.equal(typeof ChildProcess, 'function');
<ide><path>test/parallel/test-child-process-detached.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var path = require('path');
<ide>
<ide><path>test/parallel/test-child-process-fork-and-spawn.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var spawn = require('child_process').spawn;
<ide> var fork = require('child_process').fork;
<ide><path>test/parallel/test-child-process-fork-ref.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fork = require('child_process').fork;
<ide>
<ide><path>test/parallel/test-child-process-fork-ref2.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fork = require('child_process').fork;
<ide>
<ide><path>test/parallel/test-child-process-internal.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> //messages
<ide><path>test/parallel/test-child-process-set-blocking.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var ch = require('child_process');
<ide>
<ide><path>test/parallel/test-child-process-silent.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var childProcess = require('child_process');
<ide>
<ide><path>test/parallel/test-child-process-spawnsync-env.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cp = require('child_process');
<ide>
<ide><path>test/parallel/test-child-process-spawnsync-timeout.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var spawnSync = require('child_process').spawnSync;
<ide><path>test/parallel/test-child-process-stdin-ipc.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var spawn = require('child_process').spawn;
<ide><path>test/parallel/test-child-process-stdio-big-write-end.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var BUFSIZE = 1024;
<ide>
<ide><path>test/parallel/test-child-process-validate-stdio.js
<ide> 'use strict';
<ide> // Flags: --expose_internals
<ide>
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide> var _validateStdio = require('internal/child_process')._validateStdio;
<ide>
<ide> // should throw if string and not ignore, pipe, or inherit
<ide><path>test/parallel/test-cluster-debug-port.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-fork-env.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-setup-master-cumulative.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-setup-master-emit.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-setup-master-multiple.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-setup-master.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-uncaught-exception.js
<ide> // one that the cluster module installs.
<ide> // https://github.com/joyent/node/issues/2556
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide> var fork = require('child_process').fork;
<ide><path>test/parallel/test-cluster-worker-constructor.js
<ide> // test-cluster-worker-constructor.js
<ide> // validates correct behavior of the cluster.Worker constructor
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide> var worker;
<ide><path>test/parallel/test-cluster-worker-death.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide>
<ide><path>test/parallel/test-cluster-worker-init.js
<ide> // verifies that, when a child process is forked, the cluster.worker
<ide> // object can receive messages as expected
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide> var msg = 'foo';
<ide><path>test/parallel/test-console-instance.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Stream = require('stream');
<ide> var Console = require('console').Console;
<ide><path>test/parallel/test-console-not-call-toString.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var func = function() {};
<ide><path>test/parallel/test-console.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> assert.ok(process.stdout.writable);
<ide><path>test/parallel/test-delayed-require.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var a;
<ide><path>test/parallel/test-dgram-bind.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dgram = require('dgram');
<ide>
<ide><path>test/parallel/test-dgram-bytes-length.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dgram = require('dgram');
<ide>
<ide><path>test/parallel/test-dgram-listen-after-bind.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dgram = require('dgram');
<ide>
<ide><path>test/parallel/test-dgram-ref.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var dgram = require('dgram');
<ide>
<ide> // should not hang, see #1282
<ide><path>test/parallel/test-dgram-regress-4496.js
<ide> 'use strict';
<ide> // Remove this test once we support sending strings.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dgram = require('dgram');
<ide>
<ide><path>test/parallel/test-dgram-send-bad-arguments.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dgram = require('dgram');
<ide>
<ide><path>test/parallel/test-dgram-unref.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var dgram = require('dgram');
<ide><path>test/parallel/test-dh-padding.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> try {
<ide><path>test/parallel/test-dns-cares-domains.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dns = require('dns');
<ide> var domain = require('domain');
<ide><path>test/parallel/test-dns-lookup-cb-error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cares = process.binding('cares_wrap');
<ide>
<ide><path>test/parallel/test-dns-regress-7070.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var dns = require('dns');
<ide>
<ide><path>test/parallel/test-dns.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var dns = require('dns');
<ide><path>test/parallel/test-domain-exit-dispose.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide> var disposalFailed = false;
<ide><path>test/parallel/test-domain-from-timer.js
<ide> 'use strict';
<ide> // Simple tests of most basic domain functionality.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // timeouts call the callback directly from cc, so need to make sure the
<ide><path>test/parallel/test-domain-implicit-fs.js
<ide> 'use strict';
<ide> // Simple tests of most basic domain functionality.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide> var events = require('events');
<ide><path>test/parallel/test-domain-nested-throw.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var domain = require('domain');
<ide><path>test/parallel/test-domain-stack.js
<ide> 'use strict';
<ide> // Make sure that the domain stack doesn't get out of hand.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide> var events = require('events');
<ide><path>test/parallel/test-domain-timers.js
<ide> 'use strict';
<add>require('../common');
<ide> var domain = require('domain');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide>
<ide> var timeout_err, timeout, immediate_err;
<ide>
<ide><path>test/parallel/test-domain-top-level-error-handler-throw.js
<ide> * top-level error handler, not the one from the previous error.
<ide> */
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide>
<ide> const domainErrHandlerExMessage = 'exception from domain error handler';
<ide> const internalExMessage = 'You should NOT see me';
<ide><path>test/parallel/test-domain.js
<ide> 'use strict';
<ide> // Simple tests of most basic domain functionality.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide> var events = require('events');
<ide><path>test/parallel/test-event-emitter-add-listeners.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-check-listener-leaks.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-get-max-listeners.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var EventEmitter = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-listener-count.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const EventEmitter = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-listeners-side-effects.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-listeners.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-max-listeners.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-method-names.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-modify-in-emit.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-no-error-provided-to-error-event.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide> var domain = require('domain');
<ide><path>test/parallel/test-event-emitter-num-args.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-once.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-set-max-listeners-side-effects.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var events = require('events');
<ide>
<ide><path>test/parallel/test-event-emitter-subclass.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var EventEmitter = require('events').EventEmitter;
<ide> var util = require('util');
<ide><path>test/parallel/test-exception-handler.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var MESSAGE = 'catch me if you can';
<ide><path>test/parallel/test-exception-handler2.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> process.on('uncaughtException', function(err) {
<ide><path>test/parallel/test-exec-max-buffer.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var exec = require('child_process').exec;
<ide> var assert = require('assert');
<ide>
<ide><path>test/parallel/test-fs-exists.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide> var f = __filename;
<ide><path>test/parallel/test-fs-make-callback.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide>
<ide><path>test/parallel/test-fs-open-flags.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var constants = require('constants');
<ide><path>test/parallel/test-fs-open.js
<ide> 'use strict';
<add>require('../common');
<ide> var constants = require('constants');
<del>var common = require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide>
<ide><path>test/parallel/test-fs-read-file-sync-hostname.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide>
<ide><path>test/parallel/test-fs-readfile-zero-byte-liar.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide>
<ide><path>test/parallel/test-fs-stat.js
<ide> /* eslint-disable strict */
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide> var got_error = false;
<ide><path>test/parallel/test-fs-sync-fd-leak.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide>
<ide><path>test/parallel/test-fs-write-no-fd.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const fs = require('fs');
<ide> const assert = require('assert');
<ide>
<ide><path>test/parallel/test-handle-wrap-close-abort.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide>
<ide> process.on('uncaughtException', function() { });
<ide>
<ide><path>test/parallel/test-http-agent-false.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<ide>
<ide><path>test/parallel/test-http-agent-getname.js
<ide> 'use strict';
<ide>
<add>require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<del>var common = require('../common');
<ide>
<ide> var agent = new http.Agent();
<ide>
<ide><path>test/parallel/test-http-client-readable.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<ide> var util = require('util');
<ide><path>test/parallel/test-http-methods.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<ide> var util = require('util');
<ide><path>test/parallel/test-http-parser-bad-ref.js
<ide>
<ide> // Flags: --expose_gc
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var HTTPParser = process.binding('http_parser').HTTPParser;
<ide>
<ide><path>test/parallel/test-http-parser.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var HTTPParser = process.binding('http_parser').HTTPParser;
<ide><path>test/parallel/test-http-url.parse-only-support-http-https-protocol.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<ide> var url = require('url');
<ide><path>test/parallel/test-internal-modules-expose.js
<ide> 'use strict';
<ide> // Flags: --expose_internals
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> assert.equal(typeof require('internal/freelist').FreeList, 'function');
<ide><path>test/parallel/test-internal-modules.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> assert.throws(function() {
<ide><path>test/parallel/test-intl.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // does node think that i18n was enabled?
<ide><path>test/parallel/test-js-stream-call-properties.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const util = require('util');
<ide> const JSStream = process.binding('js_stream').JSStream;
<ide>
<ide><path>test/parallel/test-memory-usage.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var r = process.memoryUsage();
<ide><path>test/parallel/test-microtask-queue-integration-domain.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide>
<ide><path>test/parallel/test-microtask-queue-integration.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var implementations = [
<ide><path>test/parallel/test-microtask-queue-run-domain.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide>
<ide><path>test/parallel/test-microtask-queue-run-immediate-domain.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var domain = require('domain');
<ide>
<ide><path>test/parallel/test-microtask-queue-run-immediate.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> function enqueueMicrotask(fn) {
<ide><path>test/parallel/test-microtask-queue-run.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> function enqueueMicrotask(fn) {
<ide><path>test/parallel/test-module-loading-error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> console.error('load test-module-loading-error.js');
<ide><path>test/parallel/test-net-dns-error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var net = require('net');
<ide><path>test/parallel/test-net-end-without-connect.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var net = require('net');
<ide>
<ide> var sock = new net.Socket();
<ide><path>test/parallel/test-net-isip.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var net = require('net');
<ide>
<ide><path>test/parallel/test-net-listen-error.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var net = require('net');
<ide> var gotError = false;
<ide><path>test/parallel/test-net-server-connections.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var net = require('net');
<ide><path>test/parallel/test-net-server-unref-persistent.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var net = require('net');
<ide> var closed = false;
<ide><path>test/parallel/test-next-tick-domain.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var origNextTick = process.nextTick;
<ide><path>test/parallel/test-next-tick-errors.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var order = [],
<ide><path>test/parallel/test-next-tick-intentional-starvation.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // this is the inverse of test-next-tick-starvation.
<ide><path>test/parallel/test-next-tick-ordering.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var i;
<ide>
<ide><path>test/parallel/test-next-tick-ordering2.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var order = [];
<ide><path>test/parallel/test-next-tick.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var complete = 0;
<ide><path>test/parallel/test-path-zero-length-strings.js
<ide> // directory. This test makes sure that the behaviour is intact between commits.
<ide> // See: https://github.com/nodejs/node/pull/2106
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const path = require('path');
<ide> const pwd = process.cwd();
<ide><path>test/parallel/test-pipe-return-val.js
<ide> 'use strict';
<ide> // This test ensures SourceStream.pipe(DestStream) returns DestStream
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var Stream = require('stream').Stream;
<ide> var assert = require('assert');
<ide>
<ide><path>test/parallel/test-preload.js
<ide> 'use strict';
<del>var common = require('../common'),
<del> assert = require('assert'),
<add>require('../common');
<add>var assert = require('assert'),
<ide> path = require('path'),
<ide> child_process = require('child_process');
<ide>
<ide><path>test/parallel/test-process-before-exit.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide>
<ide> var N = 5;
<ide> var n = 0;
<ide><path>test/parallel/test-process-config.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var fs = require('fs');
<ide> var path = require('path');
<ide><path>test/parallel/test-process-env.js
<ide> // first things first, set the timezone; see tzset(3)
<ide> process.env.TZ = 'Europe/Amsterdam';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var spawn = require('child_process').spawn;
<ide>
<ide><path>test/parallel/test-process-exit-code.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> switch (process.argv[2]) {
<ide><path>test/parallel/test-process-exit.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // calling .exit() from within "exit" should not overflow the call stack
<ide><path>test/parallel/test-process-getactiverequests.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide>
<ide><path>test/parallel/test-process-getgroups.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var exec = require('child_process').exec;
<ide>
<ide><path>test/parallel/test-process-hrtime.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // the default behavior, return an Array "tuple" of numbers
<ide><path>test/parallel/test-process-kill-null.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var spawn = require('child_process').spawn;
<ide>
<ide><path>test/parallel/test-process-kill-pid.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // test variants of pid
<ide><path>test/parallel/test-process-next-tick.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var N = 2;
<ide> var tickCount = 0;
<ide><path>test/parallel/test-process-raw-debug.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var os = require('os');
<ide>
<ide><path>test/parallel/test-process-wrap.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Process = process.binding('process_wrap').Process;
<ide> var Pipe = process.binding('pipe_wrap').Pipe;
<ide><path>test/parallel/test-punycode.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var punycode = require('punycode');
<ide> var assert = require('assert');
<ide>
<ide><path>test/parallel/test-querystring-multichar-separator.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const qs = require('querystring');
<ide>
<ide><path>test/parallel/test-querystring.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // test using assert
<ide><path>test/parallel/test-readdouble.js
<ide> /*
<ide> * Tests to verify we're reading in doubles correctly
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> /*
<ide><path>test/parallel/test-readfloat.js
<ide> /*
<ide> * Tests to verify we're reading in floats correctly
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> /*
<ide><path>test/parallel/test-readint.js
<ide> /*
<ide> * Tests to verify we're reading in signed integers correctly
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> /*
<ide><path>test/parallel/test-readuint.js
<ide> * A battery of tests to help us read a series of uints
<ide> */
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> /*
<ide><path>test/parallel/test-ref-unref-return.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<ide> var net = require('net');
<ide> var dgram = require('dgram');
<del>var common = require('../common');
<ide>
<ide> assert.ok((new net.Server()).ref() instanceof net.Server);
<ide> assert.ok((new net.Server()).unref() instanceof net.Server);
<ide><path>test/parallel/test-regress-GH-6235.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> assert.doesNotThrow(function() {
<ide><path>test/parallel/test-regress-GH-7511.js
<ide> 'use strict';
<del>var common = require('../common'),
<del> assert = require('assert'),
<add>require('../common');
<add>var assert = require('assert'),
<ide> vm = require('vm');
<ide>
<ide> assert.doesNotThrow(function() {
<ide><path>test/parallel/test-regress-GH-897.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var t = Date.now();
<ide><path>test/parallel/test-repl-envvars.js
<ide>
<ide> // Flags: --expose-internals
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const stream = require('stream');
<ide> const REPL = require('internal/repl');
<ide> const assert = require('assert');
<ide><path>test/parallel/test-repl-harmony.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var spawn = require('child_process').spawn;
<ide><path>test/parallel/test-repl-require-cache.js
<ide> 'use strict';
<del>var common = require('../common'),
<del> assert = require('assert'),
<add>require('../common');
<add>var assert = require('assert'),
<ide> repl = require('repl');
<ide>
<ide> // https://github.com/joyent/node/issues/3226
<ide><path>test/parallel/test-repl-setprompt.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const spawn = require('child_process').spawn;
<ide> const os = require('os');
<ide><path>test/parallel/test-repl-syntax-error-handling.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> switch (process.argv[2]) {
<ide><path>test/parallel/test-repl-unexpected-token-recoverable.js
<ide> /*
<ide> * This is a regression test for https://github.com/joyent/node/issues/8874.
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var spawn = require('child_process').spawn;
<ide><path>test/parallel/test-require-cache.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> (function testInjectFakeModule() {
<ide><path>test/parallel/test-signal-safety.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Signal = process.binding('signal_wrap').Signal;
<ide>
<ide><path>test/parallel/test-stdin-hang.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide>
<ide> // This test *only* verifies that invoking the stdin getter does not
<ide> // cause node to hang indefinitely.
<ide><path>test/parallel/test-stdio-readable-writable.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> assert(process.stdout.writable);
<ide><path>test/parallel/test-stdout-close-unref.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide>
<ide> var errs = 0;
<ide>
<ide><path>test/parallel/test-stream-big-packet.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide> var stream = require('stream');
<ide><path>test/parallel/test-stream-big-push.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var stream = require('stream');
<ide> var str = 'asdfasdfasdfasdfasdf';
<ide><path>test/parallel/test-stream-duplex.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Duplex = require('stream').Transform;
<ide><path>test/parallel/test-stream-end-paused.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var gotEnd = false;
<ide>
<ide><path>test/parallel/test-stream-ispaused.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide>
<ide> var stream = require('stream');
<ide>
<ide><path>test/parallel/test-stream-pipe-after-end.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('_stream_readable');
<ide><path>test/parallel/test-stream-pipe-cleanup.js
<ide> // This test asserts that Stream.prototype.pipe does not leave listeners
<ide> // hanging on the source or dest.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var stream = require('stream');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide><path>test/parallel/test-stream-pipe-error-handling.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Stream = require('stream').Stream;
<ide>
<ide><path>test/parallel/test-stream-pipe-event.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var stream = require('stream');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide><path>test/parallel/test-stream-push-order.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var Readable = require('stream').Readable;
<ide> var assert = require('assert');
<ide>
<ide><path>test/parallel/test-stream-push-strings.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('stream').Readable;
<ide><path>test/parallel/test-stream-readable-constructor-set-methods.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('stream').Readable;
<ide><path>test/parallel/test-stream-readable-event.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('stream').Readable;
<ide><path>test/parallel/test-stream-readable-flow-recursion.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // this test verifies that passing a huge number to read(size)
<ide><path>test/parallel/test-stream-transform-constructor-set-methods.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Transform = require('stream').Transform;
<ide><path>test/parallel/test-stream-transform-objectmode-falsey-value.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var stream = require('stream');
<ide><path>test/parallel/test-stream-transform-split-objectmode.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Transform = require('stream').Transform;
<ide><path>test/parallel/test-stream-unshift-empty-chunk.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // This test verifies that stream.unshift(Buffer(0)) or
<ide><path>test/parallel/test-stream-unshift-read-race.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // This test verifies that:
<ide><path>test/parallel/test-stream-wrap.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide>
<ide> const StreamWrap = require('_stream_wrap');
<ide><path>test/parallel/test-stream-writable-change-default-encoding.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var stream = require('stream');
<ide><path>test/parallel/test-stream-writable-constructor-set-methods.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Writable = require('stream').Writable;
<ide><path>test/parallel/test-stream-writable-decoded-encoding.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var stream = require('stream');
<ide><path>test/parallel/test-stream-writev.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var stream = require('stream');
<ide><path>test/parallel/test-stream2-base64-single-char-read-end.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var R = require('_stream_readable');
<ide> var W = require('_stream_writable');
<ide> var assert = require('assert');
<ide><path>test/parallel/test-stream2-compatibility.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var R = require('_stream_readable');
<ide> var W = require('_stream_writable');
<ide> var assert = require('assert');
<ide><path>test/parallel/test-stream2-finish-pipe.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var stream = require('stream');
<ide> var Buffer = require('buffer').Buffer;
<ide>
<ide><path>test/parallel/test-stream2-large-read-stall.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // If everything aligns so that you do a read(n) of exactly the
<ide><path>test/parallel/test-stream2-objects.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var Readable = require('_stream_readable');
<ide> var Writable = require('_stream_writable');
<ide> var assert = require('assert');
<ide><path>test/parallel/test-stream2-pipe-error-handling.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var stream = require('stream');
<ide>
<ide><path>test/parallel/test-stream2-pipe-error-once-listener.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var util = require('util');
<ide><path>test/parallel/test-stream2-push.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var stream = require('stream');
<ide> var Readable = stream.Readable;
<ide> var Writable = stream.Writable;
<ide><path>test/parallel/test-stream2-read-sync-stack.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Readable = require('stream').Readable;
<ide> var r = new Readable();
<ide><path>test/parallel/test-stream2-readable-empty-buffer-no-eof.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('stream').Readable;
<ide><path>test/parallel/test-stream2-readable-from-list.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide> var fromList = require('_stream_readable')._fromList;
<ide>
<ide> // tiny node-tap lookalike.
<ide><path>test/parallel/test-stream2-readable-legacy-drain.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Stream = require('stream');
<ide><path>test/parallel/test-stream2-readable-non-empty-end.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide> var Readable = require('_stream_readable');
<ide>
<ide> var len = 0;
<ide><path>test/parallel/test-stream2-readable-wrap-empty.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('_stream_readable');
<ide><path>test/parallel/test-stream2-readable-wrap.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var Readable = require('_stream_readable');
<ide><path>test/parallel/test-stream2-set-encoding.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var R = require('_stream_readable');
<ide> var util = require('util');
<ide><path>test/parallel/test-stream2-transform.js
<ide> 'use strict';
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide> var PassThrough = require('_stream_passthrough');
<ide> var Transform = require('_stream_transform');
<ide>
<ide><path>test/parallel/test-stream2-unpipe-leak.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var stream = require('stream');
<ide>
<ide><path>test/parallel/test-stream2-writable.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var W = require('_stream_writable');
<ide> var D = require('_stream_duplex');
<ide> var assert = require('assert');
<ide><path>test/parallel/test-stream3-pause-then-read.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var stream = require('stream');
<ide><path>test/parallel/test-string-decoder.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var StringDecoder = require('string_decoder').StringDecoder;
<ide>
<ide><path>test/parallel/test-stringbytes-external.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> // minimum string size to overflow into external string space
<ide> var EXTERN_APEX = 0xFBEE9;
<ide><path>test/parallel/test-timers-active.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const active = require('timers').active;
<ide>
<ide><path>test/parallel/test-timers-args.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> function range(n) {
<ide><path>test/parallel/test-timers-immediate-queue.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // setImmediate should run clear its queued cbs once per event loop turn
<ide><path>test/parallel/test-timers-immediate.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var immediateA = false,
<ide><path>test/parallel/test-timers-linked-list.js
<ide>
<ide> // Flags: --expose-internals
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const L = require('_linklist');
<ide> const internalL = require('internal/linkedlist');
<ide><path>test/parallel/test-timers-now.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide>
<ide> // Return value of Timer.now() should easily fit in a SMI right after start-up.
<ide><path>test/parallel/test-timers-ordering.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Timer = process.binding('timer_wrap').Timer;
<ide>
<ide><path>test/parallel/test-timers-uncaught-exception.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var exceptions = 0;
<ide><path>test/parallel/test-timers-unref-active.js
<ide> * all 10 timeouts had the time to expire.
<ide> */
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const timers = require('timers');
<ide> const assert = require('assert');
<ide>
<ide><path>test/parallel/test-timers-unref-call.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide>
<ide> var Timer = process.binding('timer_wrap').Timer;
<ide> Timer.now = function() { return ++Timer.now.ticks; };
<ide><path>test/parallel/test-timers-unref-remove-other-unref-timers-only-one-fires.js
<ide> * This behavior is a private implementation detail and should not be
<ide> * considered public interface.
<ide> */
<del>const common = require('../common');
<add>require('../common');
<ide> const timers = require('timers');
<ide> const assert = require('assert');
<ide>
<ide><path>test/parallel/test-timers-unref.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var interval_fired = false,
<ide><path>test/parallel/test-timers-zero-timeout.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // https://github.com/joyent/node/issues/2079 - zero timeout drops extra args
<ide><path>test/parallel/test-timers.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var inputs = [
<ide><path>test/parallel/test-tls-parse-cert-string.js
<ide> 'use strict';
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const tls = require('tls');
<ide>
<ide><path>test/parallel/test-tty-stdout-end.js
<ide> 'use strict';
<ide> // Can't test this when 'make test' doesn't assign a tty to the stdout.
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide>
<ide> const shouldThrow = function() {
<ide><path>test/parallel/test-tty-wrap.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var TTY = process.binding('tty_wrap').TTY;
<ide><path>test/parallel/test-url.js
<ide> /* eslint-disable max-len */
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var url = require('url');
<ide><path>test/parallel/test-utf8-scripts.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // üäö
<ide><path>test/parallel/test-util-decorate-error-stack.js
<ide> // Flags: --expose_internals
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const internalUtil = require('internal/util');
<ide> const spawnSync = require('child_process').spawnSync;
<ide><path>test/parallel/test-util-format.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide> var symbol = Symbol('foo');
<ide><path>test/parallel/test-util-inspect.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide> const vm = require('vm');
<ide><path>test/parallel/test-util-internal.js
<ide> 'use strict';
<ide> // Flags: --expose_internals
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const internalUtil = require('internal/util');
<ide> const spawnSync = require('child_process').spawnSync;
<ide><path>test/parallel/test-util.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var util = require('util');
<ide> var context = require('vm').runInNewContext;
<ide><path>test/parallel/test-v8-flag-type-check.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var v8 = require('v8');
<ide>
<ide><path>test/parallel/test-v8-flags.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var v8 = require('v8');
<ide> var vm = require('vm');
<ide><path>test/parallel/test-v8-stats.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var v8 = require('v8');
<ide>
<ide><path>test/parallel/test-vm-basic.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-context-async-script.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-context-property-forwarding.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-context.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-create-and-run-in-context.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-create-context-accessors.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-create-context-arg.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-create-context-circular-reference.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-cross-context.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-function-declaration.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-global-define-property.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-global-identity.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-harmony-proxies.js
<ide> 'use strict';
<ide> // Flags: --harmony_proxies
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-harmony-symbols.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-is-context.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-vm-preserves-property.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-symbols.js
<ide> 'use strict';
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var vm = require('vm');
<ide><path>test/parallel/test-vm-syntax-error-message.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var child_process = require('child_process');
<ide>
<ide><path>test/parallel/test-vm-timeout.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var vm = require('vm');
<ide>
<ide><path>test/parallel/test-writedouble.js
<ide> /*
<ide> * Tests to verify we're writing doubles correctly
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> function test(clazz) {
<ide><path>test/parallel/test-writefloat.js
<ide> /*
<ide> * Tests to verify we're writing floats correctly
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> function test(clazz) {
<ide><path>test/parallel/test-writeint.js
<ide> /*
<ide> * Tests to verify we're writing signed integers correctly
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> function test8(clazz) {
<ide><path>test/parallel/test-writeuint.js
<ide> /*
<ide> * A battery of tests to help us read a series of uints
<ide> */
<del>var common = require('../common');
<add>require('../common');
<ide> var ASSERT = require('assert');
<ide>
<ide> /*
<ide><path>test/parallel/test-zlib-close-after-write.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var zlib = require('zlib');
<ide>
<ide><path>test/parallel/test-zlib-const.js
<ide> /* eslint-disable strict */
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var zlib = require('zlib');
<ide><path>test/parallel/test-zlib-convenience-methods.js
<ide> 'use strict';
<ide> // test convenience methods with and without options supplied
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var zlib = require('zlib');
<ide>
<ide><path>test/parallel/test-zlib-dictionary.js
<ide> 'use strict';
<ide> // test compression/decompression with dictionary
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const zlib = require('zlib');
<ide> const path = require('path');
<ide><path>test/parallel/test-zlib-flush-drain.js
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const zlib = require('zlib');
<ide> const path = require('path');
<ide><path>test/parallel/test-zlib-from-string.js
<ide> 'use strict';
<ide> // test compressing and uncompressing a string with zlib
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var zlib = require('zlib');
<ide>
<ide><path>test/parallel/test-zlib-invalid-input.js
<ide> 'use strict';
<ide> // test uncompressing invalid input
<ide>
<del>var common = require('../common'),
<del> assert = require('assert'),
<add>require('../common');
<add>var assert = require('assert'),
<ide> zlib = require('zlib');
<ide>
<ide> var nonStringInputs = [1, true, {a: 1}, ['a']];
<ide><path>test/parallel/test-zlib-truncated.js
<ide> 'use strict';
<ide> // tests zlib streams with truncated compressed input
<ide>
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const zlib = require ('zlib');
<ide>
<ide><path>test/parallel/test-zlib-write-after-close.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var zlib = require('zlib');
<ide>
<ide><path>test/parallel/test-zlib-write-after-flush.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var zlib = require('zlib');
<ide> var fs = require('fs');
<ide><path>test/parallel/test-zlib-zero-byte.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var zlib = require('zlib');
<ide><path>test/pummel/test-dtrace-jsstack.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var os = require('os');
<ide> var util = require('util');
<ide><path>test/pummel/test-next-tick-infinite-calls.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var complete = 0;
<ide><path>test/pummel/test-process-hrtime.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var start = process.hrtime();
<ide><path>test/pummel/test-process-uptime.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> console.error(process.uptime());
<ide><path>test/pummel/test-stream-pipe-multi.js
<ide> // Test that having a bunch of streams piping in parallel
<ide> // doesn't break anything.
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var Stream = require('stream').Stream;
<ide> var rr = [];
<ide><path>test/pummel/test-stream2-basic.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var R = require('_stream_readable');
<ide> var assert = require('assert');
<ide>
<ide><path>test/pummel/test-timer-wrap.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var timeouts = 0;
<ide><path>test/pummel/test-timer-wrap2.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> // Test that allocating a timer does not increase the loop's reference
<ide><path>test/pummel/test-timers.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var WINDOW = 200; // why is does this need to be so big?
<ide><path>test/pummel/test-vm-memleak.js
<ide> 'use strict';
<ide> // Flags: --max_old_space_size=32
<ide>
<add>require('../common');
<ide> var assert = require('assert');
<del>var common = require('../common');
<ide>
<ide> var start = Date.now();
<ide> var maxMem = 0;
<ide><path>test/sequential/test-debug-args.js
<ide> 'use strict';
<ide> // Flags: --debug-code
<ide>
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> assert.notEqual(process.execArgv.indexOf('--debug-code'), -1);
<ide><path>test/sequential/test-deprecation-flags.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var execFile = require('child_process').execFile;
<ide> var depmod = require.resolve('../fixtures/deprecated.js');
<ide><path>test/sequential/test-memory-usage-emfile.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide>
<ide> var fs = require('fs');
<ide><path>test/sequential/test-net-listen-exclusive-random-ports.js
<ide> 'use strict';
<del>var common = require('../common');
<add>require('../common');
<ide> var assert = require('assert');
<ide> var cluster = require('cluster');
<ide> var net = require('net');
| 300
|
Python
|
Python
|
add value to "namespaceid" of query
|
20847fdbf8ecd3be394d24d47ce151c26d018ea1
|
<ide><path>airflow/providers/google/cloud/example_dags/example_datastore.py
<ide>
<ide> # [START how_to_query_def]
<ide> QUERY = {
<del> "partitionId": {"projectId": GCP_PROJECT_ID, "namespaceId": ""},
<add> "partitionId": {"projectId": GCP_PROJECT_ID, "namespaceId": "query"},
<ide> "readOptions": {"transaction": begin_transaction_query.output},
<ide> "query": {},
<ide> }
| 1
|
Ruby
|
Ruby
|
add group documentation
|
d7a2309fe39d3807c1c97de116b23d6bb2c08d79
|
<ide><path>activerecord/lib/active_record/relation/query_methods.rb
<ide> def select!(value)
<ide> self
<ide> end
<ide>
<add> # Allows to specify a group attribute:
<add> #
<add> # User.group(:name)
<add> # => SELECT "users".* FROM "users" GROUP BY name
<add> #
<add> # Returns an array with uniq records based on the `group` attribute:
<add> #
<add> # User.select([:id, :name])
<add> # => [#<User id: 1, name: "Oscar">, #<User id: 2, name: "Oscar">, #<User id: 3, name: "Foo">
<add> #
<add> # User.group(:name)
<add> # => [#<User id: 3, name: "Foo", ...>, #<User id: 2, name: "Oscar", ...>]
<ide> def group(*args)
<ide> args.blank? ? self : spawn.group!(*args)
<ide> end
| 1
|
Python
|
Python
|
specify nccl as the all reduce algorithm
|
325dd7612a10a73364d334b7513dd65c7e98eb50
|
<ide><path>official/resnet/keras/keras_imagenet_main.py
<ide> def run(flags_obj):
<ide> strategy = distribution_utils.get_distribution_strategy(
<ide> distribution_strategy=flags_obj.distribution_strategy,
<ide> num_gpus=flags_obj.num_gpus,
<del> num_workers=distribution_utils.configure_cluster())
<add> num_workers=distribution_utils.configure_cluster(),
<add> all_reduce_alg='nccl')
<ide>
<ide> strategy_scope = distribution_utils.get_strategy_scope(strategy)
<ide>
| 1
|
Javascript
|
Javascript
|
add regression test for
|
e0e6b9c036abde428d3130738604fd5abb67aa8f
|
<ide><path>packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> expect(ref.current).not.toBe(null);
<ide> });
<ide>
<add> // @gate experimental
<add> it('regression test: does not overfire non-bubbling browser events', async () => {
<add> let suspend = false;
<add> let resolve;
<add> const promise = new Promise(resolvePromise => (resolve = resolvePromise));
<add>
<add> function Sibling({text}) {
<add> if (suspend) {
<add> throw promise;
<add> } else {
<add> return 'Hello';
<add> }
<add> }
<add>
<add> let submits = 0;
<add>
<add> function Form() {
<add> const [submitted, setSubmitted] = React.useState(false);
<add> if (submitted) {
<add> return null;
<add> }
<add> return (
<add> <form
<add> onSubmit={() => {
<add> setSubmitted(true);
<add> submits++;
<add> }}>
<add> Click me
<add> </form>
<add> );
<add> }
<add>
<add> function App() {
<add> return (
<add> <div>
<add> <Suspense fallback="Loading...">
<add> <Form />
<add> <Sibling />
<add> </Suspense>
<add> </div>
<add> );
<add> }
<add>
<add> suspend = false;
<add> const finalHTML = ReactDOMServer.renderToString(<App />);
<add> const container = document.createElement('div');
<add> container.innerHTML = finalHTML;
<add>
<add> // We need this to be in the document since we'll dispatch events on it.
<add> document.body.appendChild(container);
<add>
<add> const form = container.getElementsByTagName('form')[0];
<add>
<add> // On the client we don't have all data yet but we want to start
<add> // hydrating anyway.
<add> suspend = true;
<add> const root = ReactDOM.createRoot(container, {hydrate: true});
<add> root.render(<App />);
<add> Scheduler.unstable_flushAll();
<add> jest.runAllTimers();
<add>
<add> expect(container.textContent).toBe('Click meHello');
<add>
<add> // We're now partially hydrated.
<add> form.dispatchEvent(
<add> new Event('submit', {
<add> bubbles: true,
<add> }),
<add> );
<add> expect(submits).toBe(0);
<add>
<add> // Resolving the promise so that rendering can complete.
<add> suspend = false;
<add> resolve();
<add> await promise;
<add>
<add> Scheduler.unstable_flushAll();
<add> jest.runAllTimers();
<add> expect(submits).toBe(1);
<add> expect(container.textContent).toBe('Hello');
<add> document.body.removeChild(container);
<add> });
<add>
<ide> // This test fails, in both forks. Without a boundary, the deferred tree won't
<ide> // re-enter hydration mode. It doesn't come up in practice because there's
<ide> // always a parent Suspense boundary. But it's still a bug. Leaving for a
| 1
|
Python
|
Python
|
improve tests for timedistributed
|
b8c59acd779aede1c07782b2b174a344f242891e
|
<ide><path>tests/keras/layers/test_wrappers.py
<ide> def test_TimeDistributed():
<ide> model = Sequential()
<ide> model.add(wrappers.TimeDistributed(core.Dense(2), input_shape=(3, 4)))
<ide> model.add(core.Activation('relu'))
<del>
<ide> model.compile(optimizer='rmsprop', loss='mse')
<ide> model.fit(np.random.random((10, 3, 4)), np.random.random((10, 3, 2)), nb_epoch=1, batch_size=10)
<ide>
<add> # test config
<ide> model.get_config()
<ide>
<ide> # compare to TimeDistributedDense
<ide> def test_TimeDistributed():
<ide> reference = Sequential()
<ide> reference.add(core.TimeDistributedDense(2, input_shape=(3, 4), weights=weights))
<ide> reference.add(core.Activation('relu'))
<add> reference.compile(optimizer='rmsprop', loss='mse')
<add>
<add> reference_output = reference.predict(test_input)
<add> assert_allclose(test_output, reference_output, atol=1e-05)
<ide>
<add> # test when specifying a batch_input_shape
<add> reference = Sequential()
<add> reference.add(core.TimeDistributedDense(2, batch_input_shape=(1, 3, 4), weights=weights))
<add> reference.add(core.Activation('relu'))
<ide> reference.compile(optimizer='rmsprop', loss='mse')
<ide>
<ide> reference_output = reference.predict(test_input)
<ide> def test_TimeDistributed():
<ide> model = Sequential()
<ide> model.add(wrappers.TimeDistributed(convolutional.Convolution2D(5, 2, 2, border_mode='same'), input_shape=(2, 3, 4, 4)))
<ide> model.add(core.Activation('relu'))
<del>
<ide> model.compile(optimizer='rmsprop', loss='mse')
<ide> model.train_on_batch(np.random.random((1, 2, 3, 4, 4)), np.random.random((1, 2, 5, 4, 4)))
<ide>
<ide> model = model_from_json(model.to_json())
<ide> model.summary()
<ide>
<add> # test stacked layers
<add> model = Sequential()
<add> model.add(wrappers.TimeDistributed(core.Dense(2), input_shape=(3, 4)))
<add> model.add(wrappers.TimeDistributed(core.Dense(3)))
<add> model.add(core.Activation('relu'))
<add> model.compile(optimizer='rmsprop', loss='mse')
<add>
<add> model.fit(np.random.random((10, 3, 4)), np.random.random((10, 3, 3)), nb_epoch=1, batch_size=10)
<add>
<add>
<ide>
<ide> if __name__ == '__main__':
<ide> pytest.main([__file__])
| 1
|
Ruby
|
Ruby
|
use a when clause for the class check
|
9de32e0d70351998172e0d4888189bffb23849eb
|
<ide><path>actionpack/lib/action_controller/metal/request_forgery_protection.rb
<ide> def skip_forgery_protection(options = {})
<ide>
<ide> private
<ide> def protection_method_class(name)
<del> return name if name.is_a?(Class)
<del>
<ide> case name
<ide> when :null_session
<ide> ProtectionMethods::NullSession
<ide> when :reset_session
<ide> ProtectionMethods::ResetSession
<ide> when :exception
<ide> ProtectionMethods::Exception
<add> when Class
<add> name
<ide> else
<ide> raise ArgumentError, "Invalid request forgery protection method, use :null_session, :exception, :reset_session, or a custom forgery protection class."
<ide> end
| 1
|
PHP
|
PHP
|
preserve translation data in result formatter
|
00b30d095a4ed7eed7a42ad202495db4ee3c955e
|
<ide><path>src/ORM/Behavior/TranslateBehavior.php
<ide> public function groupTranslations($results)
<ide> return $row;
<ide> }
<ide> $translations = (array)$row->get('_i18n');
<add> if (empty($translations) && $row->get('_translations')) {
<add> return $row;
<add> }
<ide> $grouped = new Collection($translations);
<ide>
<ide> $result = [];
<ide><path>tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php
<ide> public function testFindSingleLocale()
<ide> $this->assertSame($expected, $results);
<ide> }
<ide>
<add> /**
<add> * Test that iterating in a formatResults() does not drop data.
<add> *
<add> * @return void
<add> */
<add> public function testFindTranslationsFormatResultsIteration()
<add> {
<add> $table = TableRegistry::get('Articles');
<add> $table->addBehavior('Translate', ['fields' => ['title', 'body']]);
<add> $table->locale('eng');
<add> $results = $table->find('translations')
<add> ->limit(1)
<add> ->formatResults(function ($results) {
<add> foreach ($results as $res) {
<add> $res->first = 'val';
<add> }
<add> foreach ($results as $res) {
<add> $res->second = 'loop';
<add> }
<add> return $results;
<add> })
<add> ->toArray();
<add> $this->assertCount(1, $results);
<add> $this->assertSame('Title #1', $results[0]->title);
<add> $this->assertSame('val', $results[0]->first);
<add> $this->assertSame('loop', $results[0]->second);
<add> $this->assertNotEmpty($results[0]->_translations);
<add> }
<add>
<ide> /**
<ide> * Tests that fields from a translated model use the I18n class locale
<ide> * and that it propogates to associated models
| 2
|
Python
|
Python
|
add support for none activations
|
b35b9433642ddb65081adaf4f08e06f667ee7115
|
<ide><path>keras/activations.py
<ide> def linear(x):
<ide>
<ide> from .utils.generic_utils import get_from_module
<ide> def get(identifier):
<add> if identifier is None:
<add> return linear
<ide> return get_from_module(identifier, globals(), 'activation function')
| 1
|
PHP
|
PHP
|
fix a number of failing tests
|
25c91c41e0d6b93d9dca5ef5569959e6171a4d74
|
<ide><path>lib/Cake/Test/TestApp/Controller/AbstractController.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since CakePHP(tm) v 3.0.0
<add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<add> */
<add>namespace TestApp\Controller;
<add>
<add>use Cake\Controller\Controller;
<add>
<add>abstract class AbstractController extends Controller {
<add>
<add> abstract public function index();
<add>
<add>}
<ide><path>lib/Cake/Test/TestApp/Controller/SomePagesController.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since CakePHP(tm) v 3.0.0
<add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<add> */
<add>namespace TestApp\Controller;
<add>
<add>use Cake\Controller\Controller;
<add>use Cake\Network\Response;
<add>
<add>/**
<add> * SomePagesController class
<add> *
<add> * @package Cake.Test.Case.Routing
<add> */
<add>class SomePagesController extends Controller {
<add>
<add>/**
<add> * name property
<add> *
<add> * @var string 'SomePages'
<add> */
<add> public $name = 'SomePages';
<add>
<add>/**
<add> * uses property
<add> *
<add> * @var array
<add> */
<add> public $uses = array();
<add>
<add>/**
<add> * display method
<add> *
<add> * @param mixed $page
<add> * @return void
<add> */
<add> public function display($page = null) {
<add> return $page;
<add> }
<add>
<add>/**
<add> * index method
<add> *
<add> * @return void
<add> */
<add> public function index() {
<add> return true;
<add> }
<add>
<add>/**
<add> * Test method for returning responses.
<add> *
<add> * @return Cake\Network\Response
<add> */
<add> public function responseGenerator() {
<add> return new Response(array('body' => 'new response'));
<add> }
<add>
<add>}
<add>
<ide><path>lib/Cake/Test/TestApp/Controller/SomePostsController.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since CakePHP(tm) v 3.0.0
<add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<add> */
<add>namespace TestApp\Controller;
<add>
<add>use Cake\Controller\Controller;
<add>
<add>/**
<add> * SomePostsController class
<add> *
<add> * @package Cake.Test.Case.Routing
<add> */
<add>class SomePostsController extends Controller {
<add>
<add>/**
<add> * name property
<add> *
<add> * @var string 'SomePosts'
<add> */
<add> public $name = 'SomePosts';
<add>
<add>/**
<add> * uses property
<add> *
<add> * @var array
<add> */
<add> public $uses = array();
<add>
<add>/**
<add> * autoRender property
<add> *
<add> * @var bool false
<add> */
<add> public $autoRender = false;
<add>
<add>/**
<add> * beforeFilter method
<add> *
<add> * @return void
<add> */
<add> public function beforeFilter() {
<add> if ($this->request->params['action'] == 'index') {
<add> $this->request->params['action'] = 'view';
<add> } else {
<add> $this->request->params['action'] = 'change';
<add> }
<add> $this->request->params['pass'] = array('changed');
<add> }
<add>
<add>/**
<add> * index method
<add> *
<add> * @return void
<add> */
<add> public function index() {
<add> return true;
<add> }
<add>
<add>/**
<add> * change method
<add> *
<add> * @return void
<add> */
<add> public function change() {
<add> return true;
<add> }
<add>
<add>}
<ide><path>lib/Cake/Test/TestApp/Controller/TestCachedPagesController.php
<add><?php
<add>namespace TestApp\Controller;
<add>
<add>use Cake\Controller\Controller;
<add>
<add>/**
<add> * TestCachedPagesController class
<add> *
<add> * @package Cake.Test.Case.Routing
<add> */
<add>class TestCachedPagesController extends Controller {
<add>
<add>/**
<add> * name property
<add> *
<add> * @var string 'TestCachedPages'
<add> */
<add> public $name = 'TestCachedPages';
<add>
<add>/**
<add> * uses property
<add> *
<add> * @var array
<add> */
<add> public $uses = array();
<add>
<add>/**
<add> * helpers property
<add> *
<add> * @var array
<add> */
<add> public $helpers = array('Cache', 'Html');
<add>
<add>/**
<add> * cacheAction property
<add> *
<add> * @var array
<add> */
<add> public $cacheAction = array(
<add> 'index' => '+2 sec',
<add> 'test_nocache_tags' => '+2 sec',
<add> 'view' => '+2 sec'
<add> );
<add>
<add>/**
<add> * Mock out the response object so it doesn't send headers.
<add> *
<add> * @var string
<add> */
<add> protected $_responseClass = 'Cake\Test\TestCase\Routing\DispatcherMockResponse';
<add>
<add>/**
<add> * viewPath property
<add> *
<add> * @var string 'posts'
<add> */
<add> public $viewPath = 'Posts';
<add>
<add>/**
<add> * index method
<add> *
<add> * @return void
<add> */
<add> public function index() {
<add> $this->render();
<add> }
<add>
<add>/**
<add> * test_nocache_tags method
<add> *
<add> * @return void
<add> */
<add> public function test_nocache_tags() {
<add> $this->render();
<add> }
<add>
<add>/**
<add> * view method
<add> *
<add> * @return void
<add> */
<add> public function view($id = null) {
<add> $this->render('index');
<add> }
<add>
<add>/**
<add> * test cached forms / tests view object being registered
<add> *
<add> * @return void
<add> */
<add> public function cache_form() {
<add> $this->cacheAction = 10;
<add> $this->helpers[] = 'Form';
<add> }
<add>
<add>/**
<add> * Test cached views with themes.
<add> */
<add> public function themed() {
<add> $this->cacheAction = 10;
<add> $this->viewClass = 'Theme';
<add> $this->theme = 'TestTheme';
<add> }
<add>
<add>}
<add>
<ide><path>lib/Cake/Test/TestApp/Controller/TestDispatchPagesController.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since CakePHP(tm) v 3.0.0
<add> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
<add> */
<add>namespace TestApp\Controller;
<add>
<add>use Cake\Controller\Controller;
<add>
<add>/**
<add> * TestDispatchPagesController class
<add> *
<add> * @package Cake.Test.Case.Routing
<add> */
<add>class TestDispatchPagesController extends Controller {
<add>
<add>/**
<add> * name property
<add> *
<add> * @var string 'TestDispatchPages'
<add> */
<add> public $name = 'TestDispatchPages';
<add>
<add>/**
<add> * uses property
<add> *
<add> * @var array
<add> */
<add> public $uses = array();
<add>
<add>/**
<add> * admin_index method
<add> *
<add> * @return void
<add> */
<add> public function admin_index() {
<add> return true;
<add> }
<add>
<add>/**
<add> * camelCased method
<add> *
<add> * @return void
<add> */
<add> public function camelCased() {
<add> return true;
<add> }
<add>
<add>}
<ide><path>lib/Cake/Test/TestCase/Routing/DispatcherTest.php
<ide> use Cake\Core\App;
<ide> use Cake\Core\Configure;
<ide> use Cake\Core\Plugin;
<add>use Cake\Error;
<ide> use Cake\Event\Event;
<ide> use Cake\Network\Request;
<ide> use Cake\Network\Response;
<ide> public function filterTest2($event) {
<ide> class MyPluginAppController extends Controller {
<ide> }
<ide>
<del>abstract class DispatcherTestAbstractController extends Controller {
<del>
<del> abstract public function index();
<del>
<del>}
<del>
<ide> interface DispatcherTestInterfaceController {
<ide>
<ide> public function index();
<ide> public function admin_add($id = null) {
<ide>
<ide> }
<ide>
<del>/**
<del> * SomePagesController class
<del> *
<del> * @package Cake.Test.Case.Routing
<del> */
<del>class SomePagesController extends Controller {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'SomePages'
<del> */
<del> public $name = 'SomePages';
<del>
<del>/**
<del> * uses property
<del> *
<del> * @var array
<del> */
<del> public $uses = array();
<del>
<del>/**
<del> * display method
<del> *
<del> * @param string $page
<del> * @return void
<del> */
<del> public function display($page = null) {
<del> return $page;
<del> }
<del>
<del>/**
<del> * index method
<del> *
<del> * @return void
<del> */
<del> public function index() {
<del> return true;
<del> }
<del>
<del>/**
<del> * Test method for returning responses.
<del> *
<del> * @return Cake\Network\Response
<del> */
<del> public function responseGenerator() {
<del> return new Response(array('body' => 'new response'));
<del> }
<del>
<del>}
<del>
<ide> /**
<ide> * OtherPagesController class
<ide> *
<ide> public function index() {
<ide>
<ide> }
<ide>
<del>/**
<del> * TestDispatchPagesController class
<del> *
<del> * @package Cake.Test.Case.Routing
<del> */
<del>class TestDispatchPagesController extends Controller {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'TestDispatchPages'
<del> */
<del> public $name = 'TestDispatchPages';
<del>
<del>/**
<del> * uses property
<del> *
<del> * @var array
<del> */
<del> public $uses = array();
<del>
<del>/**
<del> * admin_index method
<del> *
<del> * @return void
<del> */
<del> public function admin_index() {
<del> return true;
<del> }
<del>
<del>/**
<del> * camelCased method
<del> *
<del> * @return void
<del> */
<del> public function camelCased() {
<del> return true;
<del> }
<del>
<del>}
<del>
<ide> /**
<ide> * ArticlesTestAppController class
<ide> *
<ide> public function index() {
<ide>
<ide> }
<ide>
<del>/**
<del> * SomePostsController class
<del> *
<del> * @package Cake.Test.Case.Routing
<del> */
<del>class SomePostsController extends Controller {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'SomePosts'
<del> */
<del> public $name = 'SomePosts';
<del>
<del>/**
<del> * uses property
<del> *
<del> * @var array
<del> */
<del> public $uses = array();
<del>
<del>/**
<del> * autoRender property
<del> *
<del> * @var bool false
<del> */
<del> public $autoRender = false;
<del>
<del>/**
<del> * beforeFilter method
<del> *
<del> * @return void
<del> */
<del> public function beforeFilter() {
<del> if ($this->params['action'] == 'index') {
<del> $this->params['action'] = 'view';
<del> } else {
<del> $this->params['action'] = 'change';
<del> }
<del> $this->params['pass'] = array('changed');
<del> }
<del>
<del>/**
<del> * index method
<del> *
<del> * @return void
<del> */
<del> public function index() {
<del> return true;
<del> }
<del>
<del>/**
<del> * change method
<del> *
<del> * @return void
<del> */
<del> public function change() {
<del> return true;
<del> }
<del>
<del>}
<del>
<del>/**
<del> * TestCachedPagesController class
<del> *
<del> * @package Cake.Test.Case.Routing
<del> */
<del>class TestCachedPagesController extends Controller {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'TestCachedPages'
<del> */
<del> public $name = 'TestCachedPages';
<del>
<del>/**
<del> * uses property
<del> *
<del> * @var array
<del> */
<del> public $uses = array();
<del>
<del>/**
<del> * helpers property
<del> *
<del> * @var array
<del> */
<del> public $helpers = array('Cache', 'Html');
<del>
<del>/**
<del> * cacheAction property
<del> *
<del> * @var array
<del> */
<del> public $cacheAction = array(
<del> 'index' => '+2 sec',
<del> 'test_nocache_tags' => '+2 sec',
<del> 'view' => '+2 sec'
<del> );
<del>
<del>/**
<del> * Mock out the response object so it doesn't send headers.
<del> *
<del> * @var string
<del> */
<del> protected $_responseClass = 'Cake\Test\TestCase\Routing\DispatcherMockResponse';
<del>
<del>/**
<del> * viewPath property
<del> *
<del> * @var string 'posts'
<del> */
<del> public $viewPath = 'Posts';
<del>
<del>/**
<del> * index method
<del> *
<del> * @return void
<del> */
<del> public function index() {
<del> $this->render();
<del> }
<del>
<del>/**
<del> * test_nocache_tags method
<del> *
<del> * @return void
<del> */
<del> public function test_nocache_tags() {
<del> $this->render();
<del> }
<del>
<del>/**
<del> * view method
<del> *
<del> * @return void
<del> */
<del> public function view($id = null) {
<del> $this->render('index');
<del> }
<del>
<del>/**
<del> * test cached forms / tests view object being registered
<del> *
<del> * @return void
<del> */
<del> public function cache_form() {
<del> $this->cacheAction = 10;
<del> $this->helpers[] = 'Form';
<del> }
<del>
<del>/**
<del> * Test cached views with themes.
<del> */
<del> public function themed() {
<del> $this->cacheAction = 10;
<del> $this->viewClass = 'Theme';
<del> $this->theme = 'TestTheme';
<del> }
<del>
<del>}
<del>
<del>/**
<del> * TimesheetsController class
<del> *
<del> * @package Cake.Test.Case.Routing
<del> */
<del>class TimesheetsController extends Controller {
<del>
<del>/**
<del> * name property
<del> *
<del> * @var string 'Timesheets'
<del> */
<del> public $name = 'Timesheets';
<del>
<del>/**
<del> * uses property
<del> *
<del> * @var array
<del> */
<del> public $uses = array();
<del>
<del>/**
<del> * index method
<del> *
<del> * @return void
<del> */
<del> public function index() {
<del> return true;
<del> }
<del>
<del>}
<del>
<ide> /**
<ide> * DispatcherTest class
<ide> *
<ide> class DispatcherTest extends TestCase {
<ide> * @return void
<ide> */
<ide> public function setUp() {
<del> $this->_get = $_GET;
<add> parent::setUp();
<ide> $_GET = array();
<del> $this->_post = $_POST;
<del> $this->_files = $_FILES;
<del> $this->_server = $_SERVER;
<ide>
<ide> $this->_app = Configure::read('App');
<ide> Configure::write('App.base', false);
<ide> Configure::write('App.baseUrl', false);
<ide> Configure::write('App.dir', 'app');
<ide> Configure::write('App.webroot', 'webroot');
<add> Configure::write('App.namespace', 'TestApp');
<ide>
<ide> $this->_cache = Configure::read('Cache');
<ide> Configure::write('Cache.disable', true);
<ide> public function setUp() {
<ide> * @return void
<ide> */
<ide> public function tearDown() {
<del> $_GET = $this->_get;
<del> $_POST = $this->_post;
<del> $_FILES = $this->_files;
<del> $_SERVER = $this->_server;
<add> parent::tearDown();
<ide> App::build();
<ide> Plugin::unload();
<del> Configure::write('App', $this->_app);
<del> Configure::write('Cache', $this->_cache);
<del> Configure::write('debug', $this->_debug);
<ide> Configure::write('Dispatcher.filters', array());
<ide> }
<ide>
<ide> public function tearDown() {
<ide> * @return void
<ide> */
<ide> public function testParseParamsWithoutZerosAndEmptyPost() {
<add> Router::connect('/:controller/:action/*');
<ide> $Dispatcher = new Dispatcher();
<ide>
<ide> $request = new Request("/testcontroller/testaction/params1/params2/params3");
<ide> public function testQueryStringOnRoot() {
<ide> * testMissingController method
<ide> *
<ide> * @expectedException Cake\Error\MissingControllerException
<del> * @expectedExceptionMessage Controller class SomeControllerController could not be found.
<add> * @expectedExceptionMessage Controller class SomeController could not be found.
<ide> * @return void
<ide> */
<ide> public function testMissingController() {
<ide> public function testMissingController() {
<ide> * testMissingControllerInterface method
<ide> *
<ide> * @expectedException Cake\Error\MissingControllerException
<del> * @expectedExceptionMessage Controller class DispatcherTestInterfaceController could not be found.
<add> * @expectedExceptionMessage Controller class DispatcherTestInterface could not be found.
<ide> * @return void
<ide> */
<ide> public function testMissingControllerInterface() {
<ide> public function testMissingControllerInterface() {
<ide> * testMissingControllerInterface method
<ide> *
<ide> * @expectedException Cake\Error\MissingControllerException
<del> * @expectedExceptionMessage Controller class DispatcherTestAbstractController could not be found.
<add> * @expectedExceptionMessage Controller class Abstract could not be found.
<ide> * @return void
<ide> */
<ide> public function testMissingControllerAbstract() {
<ide> Router::connect('/:controller/:action/*');
<ide>
<ide> $Dispatcher = new TestDispatcher();
<del> Configure::write('App.baseUrl', '/index.php');
<del> $url = new Request('dispatcher_test_abstract/index');
<add> $url = new Request('abstract/index');
<ide> $response = $this->getMock('Cake\Network\Response');
<ide>
<ide> $Dispatcher->dispatch($url, $response, array('return' => 1));
<ide> public function testMissingControllerAbstract() {
<ide> * @return void
<ide> */
<ide> public function testDispatchBasic() {
<add> Router::connect('/pages/*', array('controller' => 'Pages', 'action' => 'display'));
<add> Router::connect('/:controller/:action/*');
<ide> App::build(array(
<ide> 'View' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS)
<ide> ));
<add>
<ide> $Dispatcher = new TestDispatcher();
<del> Configure::write('App.baseUrl', '/index.php');
<del> $url = new Request('pages/home/param:value/param2:value2');
<add> $url = new Request('pages/home');
<ide> $response = $this->getMock('Cake\Network\Response');
<ide>
<ide> $Dispatcher->dispatch($url, $response, array('return' => 1));
<ide> $expected = 'Pages';
<ide> $this->assertEquals($expected, $Dispatcher->controller->name);
<ide>
<del> $expected = array('0' => 'home', 'param' => 'value', 'param2' => 'value2');
<del> $this->assertSame($expected, $Dispatcher->controller->passedArgs);
<add> $expected = array('0' => 'home');
<add> $this->assertSame($expected, $controller->request->params['pass']);
<ide>
<ide> Configure::write('App.baseUrl', '/pages/index.php');
<ide>
<ide> public function testDispatchBasic() {
<ide>
<ide> require CAKE . 'Config' . DS . 'routes.php';
<ide> $Dispatcher = new TestDispatcher();
<del> Configure::write('App.baseUrl', '/timesheets/index.php');
<del>
<del> $url = new Request('timesheets');
<del> $Dispatcher->dispatch($url, $response, array('return' => 1));
<del>
<del> $expected = 'Timesheets';
<del> $this->assertEquals($expected, $Dispatcher->controller->name);
<del>
<del> $url = new Request('timesheets/');
<del> $Dispatcher->dispatch($url, $response, array('return' => 1));
<del>
<del> $this->assertEquals('Timesheets', $Dispatcher->controller->name);
<del> $this->assertEquals('/timesheets/index.php', $url->base);
<ide>
<ide> $url = new Request('test_dispatch_pages/camelCased');
<ide> $Dispatcher->dispatch($url, $response, array('return' => 1));
<ide> public function testDispatcherFilterCallable() {
<ide> * @return void
<ide> */
<ide> public function testChangingParamsFromBeforeFilter() {
<add> Router::connect('/:controller/:action/*');
<add>
<ide> $Dispatcher = new TestDispatcher();
<ide> $response = $this->getMock('Cake\Network\Response');
<ide> $url = new Request('some_posts/index/param:value/param2:value2');
<ide>
<ide> try {
<ide> $Dispatcher->dispatch($url, $response, array('return' => 1));
<ide> $this->fail('No exception.');
<del> } catch (MissingActionException $e) {
<add> } catch (Error\MissingActionException $e) {
<ide> $this->assertEquals('Action SomePostsController::view() could not be found.', $e->getMessage());
<ide> }
<ide>
<ide> public function testAssets() {
<ide>
<ide> $Dispatcher = new TestDispatcher();
<ide> $response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
<del>
<ide> try {
<ide> $Dispatcher->dispatch(new Request('theme/test_theme/../webroot/css/test_asset.css'), $response);
<ide> $this->fail('No exception');
<del> } catch (MissingControllerException $e) {
<del> $this->assertEquals('Controller class ThemeController could not be found.', $e->getMessage());
<add> } catch (Error\MissingControllerException $e) {
<add> $this->assertEquals('Controller class Theme could not be found.', $e->getMessage());
<ide> }
<ide>
<ide> try {
<ide> $Dispatcher->dispatch(new Request('theme/test_theme/pdfs'), $response);
<ide> $this->fail('No exception');
<del> } catch (MissingControllerException $e) {
<del> $this->assertEquals('Controller class ThemeController could not be found.', $e->getMessage());
<add> } catch (Error\MissingControllerException $e) {
<add> $this->assertEquals('Controller class Theme could not be found.', $e->getMessage());
<ide> }
<ide> }
<ide>
<ide> public function testHttpMethodOverrides() {
<ide> $request = new Request('/posts');
<ide> $event = new Event(__CLASS__, $dispatcher, array('request' => $request));
<ide> $dispatcher->parseParams($event);
<del> $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST');
<add> $expected = array(
<add> 'pass' => array(),
<add> 'plugin' => null,
<add> 'controller' => 'posts',
<add> 'action' => 'add',
<add> '[method]' => 'POST'
<add> );
<ide> foreach ($expected as $key => $value) {
<ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
<ide> }
<ide> public function testHttpMethodOverrides() {
<ide> $dispatcher->parseParams($event);
<ide> $expected = array(
<ide> 'pass' => array('5'),
<del> 'named' => array(),
<ide> 'id' => '5',
<ide> 'plugin' => null,
<ide> 'controller' => 'posts',
<ide> public function testHttpMethodOverrides() {
<ide> $request = new Request('/posts/5');
<ide> $event = new Event(__CLASS__, $dispatcher, array('request' => $request));
<ide> $dispatcher->parseParams($event);
<del> $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'view', '[method]' => 'GET');
<add> $expected = array(
<add> 'pass' => array('5'),
<add> 'id' => '5',
<add> 'plugin' => null,
<add> 'controller' => 'posts',
<add> 'action' => 'view',
<add> '[method]' => 'GET'
<add> );
<ide> foreach ($expected as $key => $value) {
<ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
<ide> }
<ide> public function testHttpMethodOverrides() {
<ide> $request = new Request('/posts/5');
<ide> $event = new Event(__CLASS__, $dispatcher, array('request' => $request));
<ide> $dispatcher->parseParams($event);
<del> $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT');
<add> $expected = array(
<add> 'pass' => array('5'),
<add> 'id' => '5',
<add> 'plugin' => null,
<add> 'controller' => 'posts',
<add> 'action' => 'edit',
<add> '[method]' => 'PUT'
<add> );
<ide> foreach ($expected as $key => $value) {
<ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
<ide> }
<ide> public function testHttpMethodOverrides() {
<ide> $event = new Event(__CLASS__, $dispatcher, array('request' => $request));
<ide> $dispatcher->parseParams($event);
<ide> $expected = array(
<del> 'pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add',
<del> '[method]' => 'POST', 'data' => array('extra' => 'data', 'Post' => array('title' => 'New Post')),
<add> 'pass' => array(),
<add> 'plugin' => null,
<add> 'controller' => 'posts',
<add> 'action' => 'add',
<add> '[method]' => 'POST',
<add> 'data' => array('extra' => 'data', 'Post' => array('title' => 'New Post')),
<ide> );
<ide> foreach ($expected as $key => $value) {
<ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
| 6
|
Ruby
|
Ruby
|
remove bitdefender diagnostic check
|
b6f9b7d3e05ebf983df6f6a190ca3e594d3fbbb3
|
<ide><path>Library/Homebrew/extend/os/mac/diagnostic.rb
<ide> def check_for_iconv
<ide> end
<ide> end
<ide>
<del> def check_for_bitdefender
<del> if !Pathname("/Library/Bitdefender/AVP/EndpointSecurityforMac.app").exist? &&
<del> !Pathname("/Library/Bitdefender/AVP/BDLDaemon").exist?
<del> return
<del> end
<del>
<del> <<~EOS
<del> You have installed Bitdefender. The "Traffic Scan" option interferes with
<del> Homebrew's ability to download packages. See:
<del> #{Formatter.url("https://github.com/Homebrew/brew/issues/5558")}
<del> EOS
<del> end
<del>
<ide> def check_for_multiple_volumes
<ide> return unless HOMEBREW_CELLAR.exist?
<ide>
| 1
|
Python
|
Python
|
remove leading space from namignizer code
|
74ae822126350c3699ff64becb8555eb019a0371
|
<ide><path>namignizer/names.py
<ide> def namignator(checkpoint_path, config):
<ide> print(map(lambda x: chr(x + 96), name))
<ide>
<ide>
<del> if __name__ == "__main__":
<del> train("data/SmallNames.txt", "model/namignizer", SmallConfig)
<add>if __name__ == "__main__":
<add> train("data/SmallNames.txt", "model/namignizer", SmallConfig)
<ide>
<del> namignize(["mary", "ida", "gazorbazorb", "mmmhmm", "bob"],
<del> tf.train.latest_checkpoint("model"), SmallConfig)
<add> namignize(["mary", "ida", "gazorbazorb", "mmmhmm", "bob"],
<add> tf.train.latest_checkpoint("model"), SmallConfig)
<ide>
<del> namignator(tf.train.latest_checkpoint("model"), SmallConfig)
<add> namignator(tf.train.latest_checkpoint("model"), SmallConfig)
| 1
|
Javascript
|
Javascript
|
fix snapshotexample in rn-tester
|
5fa3807c343c97280044ff632289b78031efc53c
|
<ide><path>packages/rn-tester/js/examples/Snapshot/SnapshotExample.js
<ide> class ScreenshotExample extends React.Component<{...}, $FlowFixMeState> {
<ide>
<ide> render() {
<ide> return (
<del> <View>
<add> <View style={style.container}>
<ide> <Text onPress={this.takeScreenshot} style={style.button}>
<ide> Click to take a screenshot
<ide> </Text>
<ide> class ScreenshotExample extends React.Component<{...}, $FlowFixMeState> {
<ide> }
<ide>
<ide> const style = StyleSheet.create({
<add> container: {
<add> flex: 1,
<add> },
<ide> button: {
<ide> marginBottom: 10,
<ide> fontWeight: '500',
<ide> },
<ide> image: {
<ide> flex: 1,
<del> height: 300,
<ide> resizeMode: 'contain',
<ide> backgroundColor: 'black',
<ide> },
| 1
|
Javascript
|
Javascript
|
add setup function for the event module
|
2c0b9027de841a437baf7b9c85262f196b9cb09e
|
<ide><path>test/unit/event.js
<del>module("event", { teardown: moduleTeardown });
<add>module( "event", {
<add> setup: function() {
<add> document.body.focus();
<add> },
<add> teardown: moduleTeardown
<add>});
<ide>
<ide> test("null or undefined handler", function() {
<ide> expect(2);
<ide> test( "Check order of focusin/focusout events", 2, function() {
<ide> var focus, blur,
<ide> input = jQuery( "#name" );
<ide>
<del> document.body.focus();
<del>
<ide> input.on( "focus", function() {
<ide> focus = true;
<ide>
| 1
|
Python
|
Python
|
update broadcasting documentation
|
294ee03d31b11ca1eceb8ae7a4c330b4f6ef213b
|
<ide><path>numpy/doc/broadcasting.py
<ide> 2) one of them is 1
<ide>
<ide> If these conditions are not met, a
<del>``ValueError: frames are not aligned`` exception is thrown, indicating that
<del>the arrays have incompatible shapes. The size of the resulting array
<del>is the maximum size along each dimension of the input arrays.
<add>``ValueError: operands could not be broadcast together`` exception is
<add>thrown, indicating that the arrays have incompatible shapes. The size of
<add>the resulting array is the maximum size along each dimension of the input
<add>arrays.
<ide>
<ide> Arrays do not need to have the same *number* of dimensions. For example,
<ide> if you have a ``256x256x3`` array of RGB values, and you want to scale
<ide> (5,)
<ide>
<ide> >>> x + y
<del> <type 'exceptions.ValueError'>: shape mismatch: objects cannot be broadcast to a single shape
<add> <type 'exceptions.ValueError'>: operands could not be broadcast together with shapes (4,) (5,)
<ide>
<ide> >>> xx.shape
<ide> (4, 1)
| 1
|
Python
|
Python
|
handle ioerror exception if no /etc/os-release
|
4f7773e3a8c5846e84e700ecd7aa29c6eed3f0ba
|
<ide><path>glances/plugins/glances_system.py
<ide> def _linux_os_release(self):
<ide> for key in keys:
<ide> if line.startswith(key):
<ide> ashtray[key] = line.strip().split('=')[1][1:-1]
<del> except OSError:
<add> except (OSError, IOError):
<ide> return pretty_name
<ide>
<ide> if ashtray:
| 1
|
Javascript
|
Javascript
|
show incorrect value on test failure
|
09c152e9b40ea9809c455073e1e615e4af5e1d63
|
<ide><path>test/async-hooks/test-promise.promise-before-init-hooks.js
<ide> hooks.enable();
<ide> p.then(function afterresolution(val) {
<ide> assert.strictEqual(val, 5);
<ide> const as = hooks.activitiesOfTypes('PROMISE');
<del> assert.strictEqual(as.length, 1, 'one activity');
<add> assert.strictEqual(as.length, 1);
<ide> checkInvocations(as[0], { init: 1, before: 1 },
<ide> 'after resolution child promise');
<ide> return val;
| 1
|
Python
|
Python
|
call convert_to_tensor on all hashing inputs
|
4bce69b55845b399263021fe46c8d8110f24d96d
|
<ide><path>keras/layers/preprocessing/hashing.py
<ide> from keras.engine import base_preprocessing_layer
<ide> from keras.layers.preprocessing import preprocessing_utils as utils
<ide> from keras.utils import layer_utils
<del>import numpy as np
<ide> import tensorflow.compat.v2 as tf
<ide> from tensorflow.python.util.tf_export import keras_export
<ide>
<ide> def __init__(self,
<ide> f'integers, or a single integer. Received: salt={salt}.')
<ide>
<ide> def call(self, inputs):
<del> if isinstance(inputs, (list, tuple, np.ndarray)):
<del> inputs = tf.convert_to_tensor(inputs)
<add> inputs = utils.ensure_tensor(inputs)
<ide> if isinstance(inputs, tf.SparseTensor):
<ide> indices = tf.SparseTensor(
<ide> indices=inputs.indices,
<ide><path>keras/layers/preprocessing/hashing_test.py
<ide> from keras.engine import input_layer
<ide> from keras.engine import training
<ide> from keras.layers.preprocessing import hashing
<add>from keras.layers.preprocessing import preprocessing_test_utils
<ide> import numpy as np
<ide> import tensorflow.compat.v2 as tf
<ide>
<ide>
<ide> @keras_parameterized.run_all_keras_modes(always_skip_v1=True)
<ide> class HashingTest(keras_parameterized.TestCase):
<ide>
<add> @parameterized.named_parameters(
<add> ('list', list),
<add> ('tuple', tuple),
<add> ('numpy', np.array),
<add> ('array_like', preprocessing_test_utils.ArrayLike),
<add> )
<add> def test_tensor_like_inputs(self, data_fn):
<add> input_data = data_fn([0, 1, 2, 3, 4])
<add> expected_output = [1, 0, 1, 0, 2]
<add>
<add> layer = hashing.Hashing(num_bins=3)
<add> output_data = layer(input_data)
<add> self.assertAllEqual(output_data, expected_output)
<add>
<ide> def test_hash_single_bin(self):
<ide> layer = hashing.Hashing(num_bins=1)
<ide> inp = np.asarray([['A'], ['B'], ['C'], ['D'], ['E']])
| 2
|
Python
|
Python
|
reuse _validate_axis in np.gradient
|
efa1bd2c0de6cd9c07b410002f2e1c0bae8cf385
|
<ide><path>numpy/lib/function_base.py
<ide> def gradient(f, *varargs, **kwargs):
<ide> axes = kwargs.pop('axis', None)
<ide> if axes is None:
<ide> axes = tuple(range(N))
<del> # check axes to have correct type and no duplicate entries
<del> if isinstance(axes, int):
<del> axes = (axes,)
<del> if not isinstance(axes, tuple):
<del> raise TypeError("A tuple of integers or a single integer is required")
<del>
<del> # normalize axis values:
<del> axes = tuple(x + N if x < 0 else x for x in axes)
<del> if max(axes) >= N or min(axes) < 0:
<del> raise ValueError("'axis' entry is out of bounds")
<add> else:
<add> axes = _nx._validate_axis(axes, N)
<ide>
<ide> len_axes = len(axes)
<del> if len(set(axes)) != len_axes:
<del> raise ValueError("duplicate value in 'axis'")
<del>
<ide> n = len(varargs)
<ide> if n == 0:
<ide> dx = [1.0] * len_axes
<ide><path>numpy/lib/tests/test_function_base.py
<ide> def test_specific_axes(self):
<ide> # test maximal number of varargs
<ide> assert_raises(TypeError, gradient, x, 1, 2, axis=1)
<ide>
<del> assert_raises(ValueError, gradient, x, axis=3)
<del> assert_raises(ValueError, gradient, x, axis=-3)
<del> assert_raises(TypeError, gradient, x, axis=[1,])
<add> assert_raises(np.AxisError, gradient, x, axis=3)
<add> assert_raises(np.AxisError, gradient, x, axis=-3)
<add> # assert_raises(TypeError, gradient, x, axis=[1,])
<ide>
<ide> def test_timedelta64(self):
<ide> # Make sure gradient() can handle special types like timedelta64
| 2
|
PHP
|
PHP
|
remove double spaces
|
372deaf5b606969efea696cda733121b82fc9eac
|
<ide><path>src/Illuminate/Routing/RouteRegistrar.php
<ide> * @method \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware)
<ide> * @method \Illuminate\Routing\RouteRegistrar name(string $value)
<ide> * @method \Illuminate\Routing\RouteRegistrar namespace(string|null $value)
<del> * @method \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
<add> * @method \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
<ide> * @method \Illuminate\Routing\RouteRegistrar scopeBindings()
<del> * @method \Illuminate\Routing\RouteRegistrar where(array $where)
<del> * @method \Illuminate\Routing\RouteRegistrar withoutMiddleware(array|string $middleware)
<add> * @method \Illuminate\Routing\RouteRegistrar where(array $where)
<add> * @method \Illuminate\Routing\RouteRegistrar withoutMiddleware(array|string $middleware)
<ide> */
<ide> class RouteRegistrar
<ide> {
<ide><path>src/Illuminate/Support/Facades/Broadcast.php
<ide> use Illuminate\Contracts\Broadcasting\Factory as BroadcastingFactoryContract;
<ide>
<ide> /**
<del> * @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(string $channel, callable|string $callback, array $options = [])
<add> * @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(string $channel, callable|string $callback, array $options = [])
<ide> * @method static \Illuminate\Broadcasting\BroadcastManager socket($request = null)
<ide> * @method static \Illuminate\Contracts\Broadcasting\Broadcaster connection($name = null);
<ide> * @method static mixed auth(\Illuminate\Http\Request $request)
<ide><path>src/Illuminate/Support/Facades/Cache.php
<ide> * @method static \Illuminate\Cache\TaggedCache tags(array|mixed $names)
<ide> * @method static \Illuminate\Contracts\Cache\Lock lock(string $name, int $seconds = 0, mixed $owner = null)
<ide> * @method static \Illuminate\Contracts\Cache\Lock restoreLock(string $name, string $owner)
<del> * @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
<add> * @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
<ide> * @method static \Illuminate\Contracts\Cache\Store getStore()
<ide> * @method static bool add(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl = null)
<ide> * @method static bool flush()
| 3
|
Java
|
Java
|
fix failing test
|
b1aebb2c0cd65d7aeaa153465a7797412b222747
|
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceUtils.java
<ide> import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService;
<ide> import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler;
<ide>
<add>import java.util.concurrent.ScheduledThreadPoolExecutor;
<add>
<ide> /**
<ide> * Provides utility methods for parsing common WebSocket XML namespace elements.
<ide> *
<ide> class WebSocketNamespaceUtils {
<ide>
<ide> // Check for setRemoveOnCancelPolicy method - available on JDK 7 and higher
<ide> private static boolean hasRemoveOnCancelPolicyMethod = ClassUtils.hasMethod(
<del> WebSocketConfigurationSupport.class, "setRemoveOnCancelPolicy", boolean.class);
<add> ScheduledThreadPoolExecutor.class, "setRemoveOnCancelPolicy", boolean.class);
<ide>
<ide>
<ide> public static RuntimeBeanReference registerHandshakeHandler(Element element, ParserContext parserContext, Object source) {
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurationSupport.java
<ide> import org.springframework.util.ClassUtils;
<ide> import org.springframework.web.servlet.HandlerMapping;
<ide>
<add>import java.util.concurrent.ScheduledThreadPoolExecutor;
<add>
<ide> /**
<ide> * Configuration support for WebSocket request handling.
<ide> *
<ide> public class WebSocketConfigurationSupport {
<ide>
<ide> // Check for setRemoveOnCancelPolicy method - available on JDK 7 and higher
<ide> private static boolean hasRemoveOnCancelPolicyMethod = ClassUtils.hasMethod(
<del> WebSocketConfigurationSupport.class, "setRemoveOnCancelPolicy", boolean.class);
<add> ScheduledThreadPoolExecutor.class, "setRemoveOnCancelPolicy", boolean.class);
<ide>
<ide>
<ide> @Bean
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurationSupport.java
<ide> package org.springframework.web.socket.config.annotation;
<ide>
<ide> import java.util.Collections;
<add>import java.util.concurrent.ScheduledThreadPoolExecutor;
<ide>
<ide> import org.springframework.beans.factory.config.CustomScopeConfigurer;
<ide> import org.springframework.context.annotation.Bean;
<ide> public abstract class WebSocketMessageBrokerConfigurationSupport extends Abstrac
<ide>
<ide> // Check for setRemoveOnCancelPolicy method - available on JDK 7 and higher
<ide> private static boolean hasRemoveOnCancelPolicyMethod = ClassUtils.hasMethod(
<del> WebSocketConfigurationSupport.class, "setRemoveOnCancelPolicy", boolean.class);
<add> ScheduledThreadPoolExecutor.class, "setRemoveOnCancelPolicy", boolean.class);
<ide>
<ide> private WebSocketTransportRegistration transportRegistration;
<ide>
| 3
|
Text
|
Text
|
point security to hackerone
|
20ad7f9cf6e69196b224f95e9fce4b8af8a6d284
|
<ide><path>README.md
<ide> We explicitly welcome contributions from people who have never contributed to op
<ide> A good starting point for contributing is running `brew audit --strict`with some of the packages you use (e.g. `brew audit --strict wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit --strict` shows no results and [submit a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html). If no formulae you use have warnings you can run `brew audit --strict` without arguments to have it run on all packages and pick one. Good luck!
<ide>
<ide> ## Security
<del>Please report security issues to security@brew.sh.
<del>
<del>This is our PGP key which is valid until May 24, 2017.
<del>* Key ID: `0xE33A3D3CCE59E297`
<del>* Fingerprint: `C657 8F76 2E23 441E C879 EC5C E33A 3D3C CE59 E297`
<del>* Full key: https://keybase.io/homebrew/key.asc
<add>Please report security issues to our [HackerOne](https://hackerone.com/homebrew/).
<ide>
<ide> ## Who Are You?
<ide> Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid).
| 1
|
Javascript
|
Javascript
|
fix typo in comment (noticable→noticeable)
|
2cfd73c4d02cfe4c745a1862ef4a9c44e8a41da4
|
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js
<ide> function finishConcurrentRender(root, exitStatus, lanes) {
<ide> if (!shouldForceFlushFallbacksInDEV()) {
<ide> // This is not a transition, but we did trigger an avoided state.
<ide> // Schedule a placeholder to display after a short delay, using the Just
<del> // Noticable Difference.
<add> // Noticeable Difference.
<ide> // TODO: Is the JND optimization worth the added complexity? If this is
<ide> // the only reason we track the event time, then probably not.
<ide> // Consider removing.
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.old.js
<ide> function finishConcurrentRender(root, exitStatus, lanes) {
<ide> if (!shouldForceFlushFallbacksInDEV()) {
<ide> // This is not a transition, but we did trigger an avoided state.
<ide> // Schedule a placeholder to display after a short delay, using the Just
<del> // Noticable Difference.
<add> // Noticeable Difference.
<ide> // TODO: Is the JND optimization worth the added complexity? If this is
<ide> // the only reason we track the event time, then probably not.
<ide> // Consider removing.
| 2
|
Ruby
|
Ruby
|
introduce default_headers config
|
2a290f7f7cdf775491eda05b3690be6d96cd9bf6
|
<ide><path>actionpack/lib/action_dispatch/http/response.rb
<ide> class Response
<ide> LOCATION = "Location".freeze
<ide>
<ide> cattr_accessor(:default_charset) { "utf-8" }
<add> cattr_accessor(:default_headers)
<ide>
<ide> include Rack::Response::Helpers
<ide> include ActionDispatch::Http::Cache::Response
<ide> def closed?
<ide> def initialize(status = 200, header = {}, body = [])
<ide> super()
<ide>
<add> if self.class.default_headers.respond_to?(:merge)
<add> header = self.class.default_headers.merge(header)
<add> end
<add>
<ide> self.body, self.header, self.status = body, header, status
<ide>
<ide> @sending_file = false
<ide><path>actionpack/lib/action_dispatch/railtie.rb
<ide> class Railtie < Rails::Railtie
<ide> ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length
<ide> ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header
<ide> ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding
<add> ActionDispatch::Response.default_headers = app.config.action_dispatch.default_headers
<ide>
<ide> ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses)
<ide> ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates)
<ide><path>railties/lib/rails/generators/rails/app/templates/config/application.rb
<ide> class Application < Rails::Application
<ide> # Configure sensitive parameters which will be filtered from the log file.
<ide> config.filter_parameters += [:password]
<ide>
<add> config.action_dispatch.default_headers = {
<add> 'X-Frame-Options' => 'SAMEORIGIN',
<add> 'X-XSS-Protection' => '1; mode=block'
<add> }
<add>
<ide> # Use SQL instead of Active Record's schema dumper when creating the database.
<ide> # This is necessary if your schema can't be completely dumped by the schema dumper,
<ide> # like if you have constraints or database-specific column types.
| 3
|
Javascript
|
Javascript
|
add constants to test-framework-detector
|
fb1f3e665cd9690784b8112434cc44e1ffd71b71
|
<ide><path>blueprints/test-framework-detector.js
<ide> module.exports = function (blueprint) {
<ide>
<ide> blueprint.filesPath = function () {
<ide> let type;
<add> const qunitRfcVersion = 'qunit-rfc-232';
<add> const mochaRfcVersion = 'mocha-rfc-232';
<add> const mochaVersion = 'mocha-0.12';
<ide>
<ide> let dependencies = this.project.dependencies();
<ide> if ('ember-qunit' in dependencies) {
<del> type = 'qunit-rfc-232';
<add> type = qunitRfcVersion;
<ide> } else if ('ember-cli-qunit' in dependencies) {
<ide> let checker = new VersionChecker(this.project);
<ide> if (
<del> fs.existsSync(this.path + '/qunit-rfc-232-files') &&
<add> fs.existsSync(`${this.path}/${qunitRfcVersion}-files`) &&
<ide> checker.for('ember-cli-qunit', 'npm').gte('4.2.0')
<ide> ) {
<del> type = 'qunit-rfc-232';
<add> type = qunitRfcVersion;
<ide> } else {
<ide> type = 'qunit';
<ide> }
<ide> } else if ('ember-mocha' in dependencies) {
<ide> let checker = new VersionChecker(this.project);
<ide> if (
<del> fs.existsSync(this.path + '/mocha-rfc-232-files') &&
<add> fs.existsSync(`${this.path}/${mochaRfcVersion}-files`) &&
<ide> checker.for('ember-mocha', 'npm').gte('0.14.0')
<ide> ) {
<del> type = 'mocha-rfc-232';
<add> type = mochaRfcVersion;
<ide> } else {
<del> type = 'mocha-0.12';
<add> type = mochaVersion;
<ide> }
<ide> } else if ('ember-cli-mocha' in dependencies) {
<ide> let checker = new VersionChecker(this.project);
<ide> if (
<del> fs.existsSync(this.path + '/mocha-0.12-files') &&
<add> fs.existsSync(`${this.path}/${mochaVersion}-files`) &&
<ide> checker.for('ember-cli-mocha', 'npm').gte('0.12.0')
<ide> ) {
<del> type = 'mocha-0.12';
<add> type = mochaVersion;
<ide> } else {
<ide> type = 'mocha';
<ide> }
| 1
|
Ruby
|
Ruby
|
allow preloads on instance dependent associations
|
b3d77575c5f37ef92f54e54d2432c465caaf2a2e
|
<ide><path>activerecord/lib/active_record/associations/preloader/association.rb
<ide> def load_records_in_batch(loaders)
<ide>
<ide> attr_reader :klass
<ide>
<del> def initialize(klass, owners, reflection, preload_scope, associate_by_default = true)
<add> def initialize(klass, owners, reflection, preload_scope, reflection_scope, associate_by_default)
<ide> @klass = klass
<ide> @owners = owners.uniq(&:__id__)
<ide> @reflection = reflection
<ide> @preload_scope = preload_scope
<add> @reflection_scope = reflection_scope
<ide> @associate = associate_by_default || !preload_scope || preload_scope.empty_scope?
<ide> @model = owners.first && owners.first.class
<ide> @run = false
<ide><path>activerecord/lib/active_record/associations/preloader/branch.rb
<ide> def grouped_records
<ide> end
<ide>
<ide> def preloaders_for_reflection(reflection, reflection_records)
<del> reflection_records.group_by { |record| record.association(reflection.name).klass }.map do |rhs_klass, rs|
<del> preloader_for(reflection).new(rhs_klass, rs, reflection, scope, associate_by_default)
<add> reflection_records.group_by do |record|
<add> klass = record.association(association).klass
<add>
<add> if reflection.scope && reflection.scope.arity != 0
<add> # For instance dependent scopes, the scope is potentially
<add> # different for each record. To allow this we'll group each
<add> # object separately into its own preloader
<add> reflection_scope = reflection.join_scopes(klass.arel_table, klass.predicate_builder, klass, record).inject(&:merge!)
<add> end
<add>
<add> [klass, reflection_scope]
<add> end.map do |(rhs_klass, reflection_scope), rs|
<add> preloader_for(reflection).new(rhs_klass, rs, reflection, scope, reflection_scope, associate_by_default)
<ide> end
<ide> end
<ide>
<ide> def build_children(children)
<ide> # and attach it to a relation. The class returned implements a `run` method
<ide> # that accepts a preloader.
<ide> def preloader_for(reflection)
<del> reflection.check_preloadable!
<del>
<ide> if reflection.options[:through]
<ide> ThroughAssociation
<ide> else
<ide><path>activerecord/lib/active_record/reflection.rb
<ide> def join_scope(table, foreign_table, foreign_klass)
<ide> klass_scope
<ide> end
<ide>
<del> def join_scopes(table, predicate_builder, klass = self.klass) # :nodoc:
<add> def join_scopes(table, predicate_builder, klass = self.klass, record = nil) # :nodoc:
<ide> if scope
<del> [scope_for(build_scope(table, predicate_builder, klass))]
<add> [scope_for(build_scope(table, predicate_builder, klass), record)]
<ide> else
<ide> []
<ide> end
<ide> def check_validity!
<ide> check_validity_of_inverse!
<ide> end
<ide>
<del> def check_preloadable!
<add> def check_eager_loadable!
<ide> return unless scope
<ide>
<ide> unless scope.arity == 0
<ide> raise ArgumentError, <<-MSG.squish
<ide> The association scope '#{name}' is instance dependent (the scope
<del> block takes an argument). Preloading instance dependent scopes is
<del> not supported.
<add> block takes an argument). Eager loading instance dependent scopes
<add> is not supported.
<ide> MSG
<ide> end
<ide> end
<del> alias :check_eager_loadable! :check_preloadable!
<ide>
<ide> def join_id_for(owner) # :nodoc:
<ide> owner[join_foreign_key]
<ide> def scopes
<ide> source_reflection.scopes + super
<ide> end
<ide>
<del> def join_scopes(table, predicate_builder, klass = self.klass) # :nodoc:
<del> source_reflection.join_scopes(table, predicate_builder, klass) + super
<add> def join_scopes(table, predicate_builder, klass = self.klass, record = nil) # :nodoc:
<add> source_reflection.join_scopes(table, predicate_builder, klass, record) + super
<ide> end
<ide>
<ide> def has_scope?
<ide> def initialize(reflection, previous_reflection)
<ide> @previous_reflection = previous_reflection
<ide> end
<ide>
<del> def join_scopes(table, predicate_builder, klass = self.klass) # :nodoc:
<del> scopes = @previous_reflection.join_scopes(table, predicate_builder) + super
<del> scopes << build_scope(table, predicate_builder, klass).instance_exec(nil, &source_type_scope)
<add> def join_scopes(table, predicate_builder, klass = self.klass, record = nil) # :nodoc:
<add> scopes = @previous_reflection.join_scopes(table, predicate_builder, record) + super
<add> scopes << build_scope(table, predicate_builder, klass).instance_exec(record, &source_type_scope)
<ide> end
<ide>
<ide> def constraints
<ide><path>activerecord/test/cases/associations/eager_test.rb
<ide> def test_preloading_has_many_through_with_custom_scope
<ide> assert_equal pets(:parrot), Owner.including_last_pet.first.last_pet
<ide> end
<ide>
<del> test "preloading and eager loading of instance dependent associations is not supported" do
<del> message = "association scope 'posts_with_signature' is"
<del> error = assert_raises(ArgumentError) do
<del> Author.includes(:posts_with_signature).to_a
<add> test "preloading of instance dependent associations is supported" do
<add> authors = Author.preload(:posts_with_signature).to_a
<add> assert_not authors.empty?
<add> authors.each do |author|
<add> assert_predicate author.posts_with_signature, :loaded?
<ide> end
<del> assert_match message, error.message
<del>
<del> error = assert_raises(ArgumentError) do
<del> Author.preload(:posts_with_signature).to_a
<del> end
<del> assert_match message, error.message
<add> end
<ide>
<add> test "eager loading of instance dependent associations is not supported" do
<add> message = "association scope 'posts_with_signature' is"
<ide> error = assert_raises(ArgumentError) do
<ide> Author.eager_load(:posts_with_signature).to_a
<ide> end
<ide> assert_match message, error.message
<ide> end
<ide>
<del> test "preloading and eager loading of optional instance dependent associations is not supported" do
<del> message = "association scope 'posts_mentioning_author' is"
<del> error = assert_raises(ArgumentError) do
<del> Author.includes(:posts_mentioning_author).to_a
<add> test "preloading of optional instance dependent associations is supported" do
<add> authors = Author.includes(:posts_mentioning_author).to_a
<add> assert_not authors.empty?
<add> authors.each do |author|
<add> assert_predicate author.posts_mentioning_author, :loaded?
<ide> end
<del> assert_match message, error.message
<del>
<del> error = assert_raises(ArgumentError) do
<del> Author.preload(:posts_mentioning_author).to_a
<del> end
<del> assert_match message, error.message
<add> end
<ide>
<add> test "eager loading of optional instance dependent associations is not supported" do
<add> message = "association scope 'posts_mentioning_author' is"
<ide> error = assert_raises(ArgumentError) do
<ide> Author.eager_load(:posts_mentioning_author).to_a
<ide> end
<ide> def test_preloading_has_many_through_with_custom_scope
<ide> end
<ide> end
<ide>
<del> test "including associations with extensions and an instance dependent scope is not supported" do
<del> e = assert_raises(ArgumentError) do
<del> Author.includes(:posts_with_extension_and_instance).to_a
<add> test "including associations with extensions and an instance dependent scope is supported" do
<add> authors = Author.includes(:posts_with_extension_and_instance).to_a
<add> assert_not authors.empty?
<add> authors.each do |author|
<add> assert_predicate author.posts_with_extension_and_instance, :loaded?
<ide> end
<del> assert_match(/Preloading instance dependent scopes is not supported/, e.message)
<ide> end
<ide>
<ide> test "preloading readonly association" do
<ide><path>activerecord/test/cases/associations_test.rb
<ide> def test_preload_grouped_queries_of_through_records
<ide> end
<ide> end
<ide>
<add> def test_preload_with_instance_dependent_scope
<add> david = authors(:david)
<add> david2 = Author.create!(name: "David")
<add> bob = authors(:bob)
<add> post = Post.create!(
<add> author: david,
<add> title: "test post",
<add> body: "this post is about David"
<add> )
<add> post2 = Post.create!(
<add> author: david,
<add> title: "test post 2",
<add> body: "this post is also about David"
<add> )
<add>
<add> assert_queries(2) do
<add> preloader = ActiveRecord::Associations::Preloader.new(records: [david, david2, bob], associations: :posts_mentioning_author)
<add> preloader.call
<add> end
<add>
<add> assert_predicate david.posts_mentioning_author, :loaded?
<add> assert_predicate david2.posts_mentioning_author, :loaded?
<add> assert_predicate bob.posts_mentioning_author, :loaded?
<add>
<add> assert_equal [post, post2].sort, david.posts_mentioning_author.sort
<add> assert_equal [], david2.posts_mentioning_author
<add> assert_equal [], bob.posts_mentioning_author
<add> end
<add>
<add> def test_preload_with_instance_dependent_through_scope
<add> david = authors(:david)
<add> david2 = Author.create!(name: "David")
<add> bob = authors(:bob)
<add> comment1 = david.posts.first.comments.create!(
<add> body: "Great post david!"
<add> )
<add> comment2 = david.posts.first.comments.create!(
<add> body: "I don't agree david"
<add> )
<add>
<add> assert_queries(2) do
<add> preloader = ActiveRecord::Associations::Preloader.new(records: [david, david2, bob], associations: :comments_mentioning_author)
<add> preloader.call
<add> end
<add>
<add> assert_predicate david.comments_mentioning_author, :loaded?
<add> assert_predicate david2.comments_mentioning_author, :loaded?
<add> assert_predicate bob.comments_mentioning_author, :loaded?
<add>
<add> assert_equal [comment1, comment2].sort, david.comments_mentioning_author.sort
<add> assert_equal [], david2.comments_mentioning_author
<add> assert_equal [], bob.comments_mentioning_author
<add> end
<add>
<add> def test_preload_with_through_instance_dependent_scope
<add> david = authors(:david)
<add> david2 = Author.create!(name: "David")
<add> bob = authors(:bob)
<add> post = Post.create!(
<add> author: david,
<add> title: "test post",
<add> body: "this post is about David"
<add> )
<add> Post.create!(
<add> author: david,
<add> title: "test post 2",
<add> body: "this post is also about David"
<add> )
<add> post3 = Post.create!(
<add> author: bob,
<add> title: "test post 3",
<add> body: "this post is about Bob"
<add> )
<add> comment1 = post.comments.create!(body: "hi!")
<add> comment2 = post.comments.create!(body: "hello!")
<add> comment3 = post3.comments.create!(body: "HI BOB!")
<add>
<add> assert_queries(3) do
<add> preloader = ActiveRecord::Associations::Preloader.new(records: [david, david2, bob], associations: :comments_on_posts_mentioning_author)
<add> preloader.call
<add> end
<add>
<add> assert_predicate david.comments_on_posts_mentioning_author, :loaded?
<add> assert_predicate david2.comments_on_posts_mentioning_author, :loaded?
<add> assert_predicate bob.comments_on_posts_mentioning_author, :loaded?
<add>
<add> assert_equal [comment1, comment2].sort, david.comments_on_posts_mentioning_author.sort
<add> assert_equal [], david2.comments_on_posts_mentioning_author
<add> assert_equal [comment3], bob.comments_on_posts_mentioning_author
<add> end
<add>
<ide> def test_some_already_loaded_associations
<ide> item_discount = Discount.create(amount: 5)
<ide> shipping_discount = Discount.create(amount: 20)
<ide><path>activerecord/test/models/author.rb
<ide> def ratings
<ide> has_many :posts_with_default_include, class_name: "PostWithDefaultInclude"
<ide> has_many :comments_on_posts_with_default_include, through: :posts_with_default_include, source: :comments
<ide>
<del> has_many :posts_with_signature, ->(record) { where("posts.title LIKE ?", "%by #{record.name.downcase}%") }, class_name: "Post"
<del> has_many :posts_mentioning_author, ->(record = nil) { where("posts.body LIKE ?", "%#{record&.name&.downcase}%") }, class_name: "Post"
<add> has_many :posts_with_signature, ->(record) { where(arel_table[:title].matches("%by #{record.name.downcase}%")) }, class_name: "Post"
<add> has_many :posts_mentioning_author, ->(record = nil) { where(arel_table[:body].matches("%#{record&.name&.downcase}%")) }, class_name: "Post"
<add> has_many :comments_on_posts_mentioning_author, through: :posts_mentioning_author, source: :comments
<add> has_many :comments_mentioning_author, ->(record) { where(arel_table[:body].matches("%#{record.name.downcase}%")) }, through: :posts, source: :comments
<ide>
<ide> has_one :recent_post, -> { order(id: :desc) }, class_name: "Post"
<ide> has_one :recent_response, through: :recent_post, source: :comments
| 6
|
Ruby
|
Ruby
|
allow eg. `brew --env libxml2`
|
fb8c7e0aafdd487533cce6853fe845346d97c87c
|
<ide><path>Library/Homebrew/cmd/--env.rb
<ide>
<ide> module Homebrew extend self
<ide> def __env
<add> if superenv?
<add> ENV.deps = ARGV.formulae.map(&:name) unless ARGV.named.empty?
<add> end
<ide> ENV.setup_build_environment
<ide> ENV.universal_binary if ARGV.build_universal?
<ide> if $stdout.tty?
<ide> dump_build_env ENV
<ide> else
<del> build_env_keys(ENV).each do |key|
<add> keys = build_env_keys(ENV) << 'HOMEBREW_BREW_FILE' << 'HOMEBREW_SDKROOT'
<add> keys.each do |key|
<ide> puts "export #{key}=\"#{ENV[key]}\""
<ide> end
<ide> end
| 1
|
Javascript
|
Javascript
|
remove imagestore js files from rn open source
|
8e16a60faa6a70c9b5131aa2a4bc388bf342a15e
|
<ide><path>Libraries/Image/ImageStore.js
<del>/**
<del> * Copyright (c) Facebook, Inc. and its affiliates.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> *
<del> * @flow
<del> * @format
<del> */
<del>'use strict';
<del>
<del>import NativeImageStore from './NativeImageStore';
<del>
<del>const Platform = require('../Utilities/Platform');
<del>
<del>const warnOnce = require('../Utilities/warnOnce');
<del>
<del>function warnUnimplementedMethod(methodName: string): void {
<del> warnOnce(
<del> `imagestore-${methodName}`,
<del> `react-native: ImageStore.${methodName}() is not implemented on ${
<del> Platform.OS
<del> }`,
<del> );
<del>}
<del>
<del>class ImageStore {
<del> /**
<del> * Check if the ImageStore contains image data for the specified URI.
<del> * @platform ios
<del> */
<del> static hasImageForTag(uri: string, callback: (hasImage: boolean) => void) {
<del> if (NativeImageStore.hasImageForTag) {
<del> NativeImageStore.hasImageForTag(uri, callback);
<del> } else {
<del> warnUnimplementedMethod('hasImageForTag');
<del> }
<del> }
<del>
<del> /**
<del> * Delete an image from the ImageStore. Images are stored in memory and
<del> * must be manually removed when you are finished with them, otherwise they
<del> * will continue to use up RAM until the app is terminated. It is safe to
<del> * call `removeImageForTag()` without first calling `hasImageForTag()`, it
<del> * will simply fail silently.
<del> * @platform ios
<del> */
<del> static removeImageForTag(uri: string) {
<del> if (NativeImageStore.removeImageForTag) {
<del> NativeImageStore.removeImageForTag(uri);
<del> } else {
<del> warnUnimplementedMethod('removeImageForTag');
<del> }
<del> }
<del>
<del> /**
<del> * Stores a base64-encoded image in the ImageStore, and returns a URI that
<del> * can be used to access or display the image later. Images are stored in
<del> * memory only, and must be manually deleted when you are finished with
<del> * them by calling `removeImageForTag()`.
<del> *
<del> * Note that it is very inefficient to transfer large quantities of binary
<del> * data between JS and native code, so you should avoid calling this more
<del> * than necessary.
<del> * @platform ios
<del> */
<del> static addImageFromBase64(
<del> base64ImageData: string,
<del> success: (uri: string) => void,
<del> failure: (error: any) => void,
<del> ) {
<del> if (NativeImageStore.addImageFromBase64) {
<del> NativeImageStore.addImageFromBase64(base64ImageData, success, failure);
<del> } else {
<del> warnUnimplementedMethod('addImageFromBase64');
<del> }
<del> }
<del>
<del> /**
<del> * Retrieves the base64-encoded data for an image in the ImageStore. If the
<del> * specified URI does not match an image in the store, the failure callback
<del> * will be called.
<del> *
<del> * Note that it is very inefficient to transfer large quantities of binary
<del> * data between JS and native code, so you should avoid calling this more
<del> * than necessary. To display an image in the ImageStore, you can just pass
<del> * the URI to an `<Image/>` component; there is no need to retrieve the
<del> * base64 data.
<del> */
<del> static getBase64ForTag(
<del> uri: string,
<del> success: (base64ImageData: string) => void,
<del> failure: (error: any) => void,
<del> ) {
<del> if (NativeImageStore.getBase64ForTag) {
<del> NativeImageStore.getBase64ForTag(uri, success, failure);
<del> } else {
<del> warnUnimplementedMethod('getBase64ForTag');
<del> }
<del> }
<del>}
<del>
<del>module.exports = ImageStore;
<ide><path>Libraries/Image/NativeImageStore.js
<del>/**
<del> * Copyright (c) Facebook, Inc. and its affiliates.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> *
<del> * @flow
<del> * @format
<del> */
<del>
<del>'use strict';
<del>
<del>import type {TurboModule} from '../TurboModule/RCTExport';
<del>import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
<del>
<del>export interface Spec extends TurboModule {
<del> // Common
<del> +getBase64ForTag: (
<del> uri: string,
<del> success: (base64ImageData: string) => void,
<del> failure: (error: Object) => void,
<del> ) => void;
<del>
<del> // iOS-only
<del> +hasImageForTag: (uri: string, callback: (hasImage: boolean) => void) => void;
<del> +removeImageForTag: (uri: string) => void;
<del> +addImageFromBase64: (
<del> base64ImageData: string,
<del> success: (uri: string) => void,
<del> failure: (error: Object) => void,
<del> ) => void;
<del>}
<del>
<del>export default TurboModuleRegistry.getEnforcing<Spec>('ImageStoreManager');
<ide><path>Libraries/react-native/react-native-implementation.js
<ide> module.exports = {
<ide> );
<ide> return require('../Image/ImageEditor');
<ide> },
<del> get ImageStore() {
<del> warnOnce(
<del> 'imagestore-deprecation',
<del> 'ImageStore is deprecated and will be removed in a future release. ' +
<del> 'To get a base64-encoded string from a local image use either of the following third-party libraries:' +
<del> "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" +
<del> "* react-native-fs: `readFile(filepath, 'base64')`",
<del> );
<del> return require('../Image/ImageStore');
<del> },
<ide> get InputAccessoryView() {
<ide> return require('../Components/TextInput/InputAccessoryView');
<ide> },
<ide> if (__DEV__) {
<ide> );
<ide> },
<ide> });
<add>
<add> // $FlowFixMe This is intentional: Flow will error when attempting to access ImageStore.
<add> Object.defineProperty(module.exports, 'ImageStore', {
<add> configurable: true,
<add> get() {
<add> invariant(
<add> false,
<add> 'ImageStore has been removed from React Native. ' +
<add> 'To get a base64-encoded string from a local image use either of the following third-party libraries:' +
<add> "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" +
<add> "* react-native-fs: `readFile(filepath, 'base64')`",
<add> );
<add> },
<add> });
<ide> }
| 3
|
Text
|
Text
|
fix missing line highlight in tutorial
|
05562a0b095293077f1fad56d075e537ca787553
|
<ide><path>docs/docs/tutorial.md
<ide> var CommentForm = React.createClass({
<ide>
<ide> Let's make the form interactive. When the user submits the form, we should clear it, submit a request to the server, and refresh the list of comments. To start, let's listen for the form's submit event and clear it.
<ide>
<del>```javascript{3-13,16-19}
<add>```javascript{3-14,16-19}
<ide> // tutorial16.js
<ide> var CommentForm = React.createClass({
<ide> handleSubmit: function(e) {
| 1
|
Ruby
|
Ruby
|
raise correct exception now journey is integrated
|
db06d128262b49c8b02e153cf95eb46f4eff364b
|
<ide><path>actionpack/lib/action_dispatch/journey/formatter.rb
<add>require 'action_controller/metal/exceptions'
<add>
<ide> module ActionDispatch
<ide> module Journey
<ide> # The Formatter class is used for formatting URLs. For example, parameters
<ide> def generate(type, name, options, recall = {}, parameterize = nil)
<ide> return [route.format(parameterized_parts), params]
<ide> end
<ide>
<del> raise Router::RoutingError.new "missing required keys: #{missing_keys}"
<add> message = "No route matches #{constraints.inspect}"
<add> message << " missing required keys: #{missing_keys.inspect}" if name
<add>
<add> raise ActionController::UrlGenerationError, message
<ide> end
<ide>
<ide> def clear
<ide><path>actionpack/lib/action_dispatch/routing/route_set.rb
<ide> def handle_nil_action!
<ide> recall[:action] = options.delete(:action) if options[:action] == 'index'
<ide> end
<ide>
<del> # Generates a path from routes, returns [path, params]
<del> # if no path is returned the formatter will raise Journey::Router::RoutingError
<add> # Generates a path from routes, returns [path, params].
<add> # If no route is generated the formatter will raise ActionController::UrlGenerationError
<ide> def generate
<ide> @set.formatter.generate(:path_info, named_route, options, recall, PARAMETERIZE)
<del> rescue Journey::Router::RoutingError => e
<del> raise ActionController::UrlGenerationError, "No route matches #{options.inspect} #{e.message}"
<ide> end
<ide>
<ide> def different_controller?
<ide><path>actionpack/test/journey/router_test.rb
<ide> def test_required_parts_verified_are_anchored
<ide> Router::Strexp.new("/foo/:id", { :id => /\d/ }, ['/', '.', '?'], false)
<ide> ]
<ide>
<del> assert_raises(Router::RoutingError) do
<add> assert_raises(ActionController::UrlGenerationError) do
<ide> @formatter.generate(:path_info, nil, { :id => '10' }, { })
<ide> end
<ide> end
<ide> def test_required_parts_are_verified_when_building
<ide> path, _ = @formatter.generate(:path_info, nil, { :id => '10' }, { })
<ide> assert_equal '/foo/10', path
<ide>
<del> assert_raises(Router::RoutingError) do
<add> assert_raises(ActionController::UrlGenerationError) do
<ide> @formatter.generate(:path_info, nil, { :id => 'aa' }, { })
<ide> end
<ide> end
<ide> def test_knows_what_parts_are_missing_from_named_route
<ide> path = Path::Pattern.new pattern
<ide> @router.routes.add_route nil, path, {}, {}, route_name
<ide>
<del> error = assert_raises(Router::RoutingError) do
<add> error = assert_raises(ActionController::UrlGenerationError) do
<ide> @formatter.generate(:path_info, route_name, { }, { })
<ide> end
<ide>
<del> assert_match(/required keys: \[:id\]/, error.message)
<add> assert_match(/missing required keys: \[:id\]/, error.message)
<ide> end
<ide>
<ide> def test_X_Cascade
| 3
|
Javascript
|
Javascript
|
fix displayname in reactperf.getinclusive() output
|
82e363c46477cc1c3b37a5dd94a1e8d92d6598ce
|
<ide><path>src/isomorphic/ReactPerf.js
<ide> function getInclusive(flushHistory = getFlushHistory()) {
<ide> function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) {
<ide> var {displayName, ownerID} = treeSnapshot[instanceID];
<ide> var owner = treeSnapshot[ownerID];
<del> var key = `${owner ? owner.displayName + ' >' : ''} ${displayName}`;
<add> var key = (owner ? owner.displayName + ' > ' : '') + displayName;
<ide> var stats = aggregatedStats[key];
<ide> if (!stats) {
<ide> affectedIDs[key] = {};
| 1
|
Text
|
Text
|
update fast refresh doc
|
e18f74fe2de0672e372aa6425b6b6313a23b91fa
|
<ide><path>docs/basic-features/fast-refresh.md
<ide> screen!
<ide>
<ide> Sometimes, this can lead to unexpected results. For example, even a `useEffect`
<ide> with an empty array of dependencies would still re-run once during Fast Refresh.
<del>However, writing code resilient to occasional re-running of `useEffect` is a
<del>good practice even without Fast Refresh. This makes it easier for you to later
<del>introduce new dependencies to it.
<add>
<add>However, writing code resilient to occasional re-running of `useEffect` is a good practice even
<add>without Fash Refresh. It will make it easier for you to introduce new dependencies to it later on
<add>and it's enforced by [React Strict Mode](/docs/api-reference/next.config.js/react-strict-mode),
<add>which we highly recommend enabling.
| 1
|
Ruby
|
Ruby
|
add `path` method to `caskroom` and `cache`
|
3d423b0587d54029cc60616d506318425c22e7a4
|
<ide><path>Library/Homebrew/cask/lib/hbc/cache.rb
<ide> module Hbc
<ide> module Cache
<ide> module_function
<ide>
<add> def path
<add> @path ||= HOMEBREW_CACHE.join("Cask")
<add> end
<add>
<ide> def ensure_cache_exists
<del> return if Hbc.cache.exist?
<add> return if path.exist?
<ide>
<del> odebug "Creating Cache at #{Hbc.cache}"
<del> Hbc.cache.mkpath
<add> odebug "Creating Cache at #{path}"
<add> path.mkpath
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/cask_loader.rb
<ide> def self.can_load?(ref)
<ide>
<ide> def initialize(url)
<ide> @url = URI(url)
<del> super Hbc.cache/File.basename(@url.path)
<add> super Cache.path/File.basename(@url.path)
<ide> end
<ide>
<ide> def load
<ide><path>Library/Homebrew/cask/lib/hbc/caskroom.rb
<ide> module Hbc
<ide> module Caskroom
<ide> module_function
<ide>
<add> def path
<add> @path ||= HOMEBREW_PREFIX.join("Caskroom")
<add> end
<add>
<ide> def ensure_caskroom_exists
<del> return if Hbc.caskroom.exist?
<add> return if path.exist?
<ide>
<del> ohai "Creating Caskroom at #{Hbc.caskroom}" if $stdout.tty?
<del> sudo = !Hbc.caskroom.parent.writable?
<add> ohai "Creating Caskroom at #{path}" if $stdout.tty?
<add> sudo = !path.parent.writable?
<ide>
<ide> ohai "We'll set permissions properly so we won't need sudo in the future" if $stdout.tty? && sudo
<ide>
<del> SystemCommand.run("/bin/mkdir", args: ["-p", Hbc.caskroom], sudo: sudo)
<del> SystemCommand.run("/bin/chmod", args: ["g+rwx", Hbc.caskroom], sudo: sudo)
<del> SystemCommand.run("/usr/sbin/chown", args: [Utils.current_user, Hbc.caskroom], sudo: sudo)
<del> SystemCommand.run("/usr/bin/chgrp", args: ["admin", Hbc.caskroom], sudo: sudo)
<add> SystemCommand.run("/bin/mkdir", args: ["-p", path], sudo: sudo)
<add> SystemCommand.run("/bin/chmod", args: ["g+rwx", path], sudo: sudo)
<add> SystemCommand.run("/usr/sbin/chown", args: [Utils.current_user, path], sudo: sudo)
<add> SystemCommand.run("/usr/bin/chgrp", args: ["admin", path], sudo: sudo)
<ide> end
<ide>
<ide> def casks
<del> Pathname.glob(Hbc.caskroom.join("*")).sort.select(&:directory?).map do |path|
<add> Pathname.glob(path.join("*")).sort.select(&:directory?).map do |path|
<ide> token = path.basename.to_s
<ide>
<ide> if tap_path = CaskLoader.tap_paths(token).first
<ide><path>Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
<ide> def self.needs_init?
<ide>
<ide> attr_reader :cache_location
<ide>
<del> def initialize(*args, cache_location: Hbc.cache)
<add> def initialize(*args, cache_location: Cache.path)
<ide> super(*args)
<ide> @cache_location = Pathname.new(cache_location)
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/cli/doctor.rb
<ide> def check_install_location
<ide> def check_staging_location
<ide> ohai "Homebrew-Cask Staging Location"
<ide>
<del> path = Pathname.new(user_tilde(Hbc.caskroom.to_s))
<add> path = Pathname.new(user_tilde(Caskroom.path.to_s))
<ide>
<ide> if !path.exist?
<ide> add_error "The staging path #{path} does not exist."
<ide> def check_cached_downloads
<ide> cleanup = CLI::Cleanup.new
<ide> count = cleanup.cache_files.count
<ide> size = cleanup.disk_cleanup_size
<del> msg = user_tilde(Hbc.cache.to_s)
<add> msg = user_tilde(Cache.path.to_s)
<ide> msg << " (#{number_readable(count)} files, #{disk_usage_readable(size)})" unless count.zero?
<ide> puts msg
<ide> end
<ide> def self.render_cached_downloads
<ide> cleanup = CLI::Cleanup.new
<ide> count = cleanup.cache_files.count
<ide> size = cleanup.disk_cleanup_size
<del> msg = user_tilde(Hbc.cache.to_s)
<add> msg = user_tilde(Cache.path.to_s)
<ide> msg << " (#{number_readable(count)} files, #{disk_usage_readable(size)})" unless count.zero?
<ide> msg
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/download_strategy.rb
<ide> class HbVCSDownloadStrategy < AbstractDownloadStrategy
<ide> def initialize(*args, **options)
<ide> super(*args, **options)
<ide> @ref_type, @ref = extract_ref
<del> @clone = Hbc.cache.join(cache_filename)
<add> @clone = Cache.path.join(cache_filename)
<ide> end
<ide>
<ide> def extract_ref
<ide> def clear_cache
<ide>
<ide> class CurlDownloadStrategy < AbstractDownloadStrategy
<ide> def tarball_path
<del> @tarball_path ||= Hbc.cache.join("#{name}--#{version}#{ext}")
<add> @tarball_path ||= Cache.path.join("#{name}--#{version}#{ext}")
<ide> end
<ide>
<ide> def temporary_path
<ide><path>Library/Homebrew/cask/lib/hbc/dsl.rb
<ide> def artifacts
<ide> end
<ide>
<ide> def caskroom_path
<del> @caskroom_path ||= Hbc.caskroom.join(token)
<add> @caskroom_path ||= Caskroom.path.join(token)
<ide> end
<ide>
<ide> def staged_path
<ide><path>Library/Homebrew/cask/lib/hbc/locations.rb
<ide> def self.included(base)
<ide> end
<ide>
<ide> module ClassMethods
<del> def caskroom
<del> @caskroom ||= HOMEBREW_PREFIX.join("Caskroom")
<del> end
<del>
<del> def cache
<del> @cache ||= HOMEBREW_CACHE.join("Cask")
<del> end
<del>
<ide> attr_writer :default_tap
<ide>
<ide> def default_tap
<ide><path>Library/Homebrew/compat/hbc/caskroom.rb
<ide> module Caskroom
<ide> class << self
<ide> module Compat
<ide> def migrate_legacy_caskroom
<del> return if Hbc.caskroom.exist?
<add> return if path.exist?
<ide>
<del> legacy_caskroom = Pathname.new("/opt/homebrew-cask/Caskroom")
<del> return if Hbc.caskroom == legacy_caskroom
<del> return unless legacy_caskroom.exist?
<del> return if legacy_caskroom.symlink?
<add> legacy_caskroom_path = Pathname.new("/opt/homebrew-cask/Caskroom")
<add> return if path == legacy_caskroom_path
<add> return unless legacy_caskroom_path.exist?
<add> return if legacy_caskroom_path.symlink?
<ide>
<del> ohai "Migrating Caskroom from #{legacy_caskroom} to #{Hbc.caskroom}."
<del> if Hbc.caskroom.parent.writable?
<del> FileUtils.mv legacy_caskroom, Hbc.caskroom
<add> ohai "Migrating Caskroom from #{legacy_caskroom_path} to #{path}."
<add> if path.parent.writable?
<add> FileUtils.mv legacy_caskroom_path, path
<ide> else
<del> opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
<del> SystemCommand.run("/bin/mv", args: [legacy_caskroom, Hbc.caskroom.parent], sudo: true)
<add> opoo "#{path.parent} is not writable, sudo is needed to move the Caskroom."
<add> SystemCommand.run("/bin/mv", args: [legacy_caskroom_path, path.parent], sudo: true)
<ide> end
<ide>
<del> ohai "Creating symlink from #{Hbc.caskroom} to #{legacy_caskroom}."
<del> if legacy_caskroom.parent.writable?
<del> FileUtils.ln_s Hbc.caskroom, legacy_caskroom
<add> ohai "Creating symlink from #{path} to #{legacy_caskroom_path}."
<add> if legacy_caskroom_path.parent.writable?
<add> FileUtils.ln_s path, legacy_caskroom_path
<ide> else
<del> opoo "#{legacy_caskroom.parent} is not writable, sudo is needed to link the Caskroom."
<del> SystemCommand.run("/bin/ln", args: ["-s", Hbc.caskroom, legacy_caskroom], sudo: true)
<add> opoo "#{legacy_caskroom_path.parent} is not writable, sudo is needed to link the Caskroom."
<add> SystemCommand.run("/bin/ln", args: ["-s", path, legacy_caskroom_path], sudo: true)
<ide> end
<ide> end
<ide>
<ide> def migrate_caskroom_from_repo_to_prefix
<del> repo_caskroom = HOMEBREW_REPOSITORY.join("Caskroom")
<del> return if Hbc.caskroom.exist?
<del> return unless repo_caskroom.directory?
<add> repo_caskroom_path = HOMEBREW_REPOSITORY.join("Caskroom")
<add> return if path.exist?
<add> return unless repo_caskroom_path.directory?
<ide>
<ide> ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
<ide>
<del> if Hbc.caskroom.parent.writable?
<del> FileUtils.mv repo_caskroom, Hbc.caskroom
<add> if path.parent.writable?
<add> FileUtils.mv repo_caskroom_path, path
<ide> else
<del> opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
<del> SystemCommand.run("/bin/mv", args: [repo_caskroom, Hbc.caskroom.parent], sudo: true)
<add> opoo "#{path.parent} is not writable, sudo is needed to move the Caskroom."
<add> SystemCommand.run("/bin/mv", args: [repo_caskroom_path, path.parent], sudo: true)
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/cask/cask_spec.rb
<ide> it "proposes a versioned metadata directory name for each instance" do
<ide> cask_token = "local-caffeine"
<ide> c = Hbc::CaskLoader.load(cask_token)
<del> metadata_timestamped_path = Hbc.caskroom.join(cask_token, ".metadata", c.version)
<add> metadata_timestamped_path = Hbc::Caskroom.path.join(cask_token, ".metadata", c.version)
<ide> expect(c.metadata_versioned_path.to_s).to eq(metadata_timestamped_path.to_s)
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/cask/cli/uninstall_spec.rb
<ide> [last_installed_version, "456000"],
<ide> ]
<ide> }
<del> let(:caskroom_path) { Hbc.caskroom.join(token).tap(&:mkpath) }
<add> let(:caskroom_path) { Hbc::Caskroom.path.join(token).tap(&:mkpath) }
<ide>
<ide> before do
<ide> timestamped_versions.each do |timestamped_version|
<ide>
<ide> describe "when Casks in Taps have been renamed or removed" do
<ide> let(:app) { Hbc::Config.global.appdir.join("ive-been-renamed.app") }
<del> let(:caskroom_path) { Hbc.caskroom.join("ive-been-renamed").tap(&:mkpath) }
<add> let(:caskroom_path) { Hbc::Caskroom.path.join("ive-been-renamed").tap(&:mkpath) }
<ide> let(:saved_caskfile) { caskroom_path.join(".metadata", "latest", "timestamp", "Casks").join("ive-been-renamed.rb") }
<ide>
<ide> before do
<ide><path>Library/Homebrew/test/cask/installer_spec.rb
<ide>
<ide> Hbc::Installer.new(caffeine).install
<ide>
<del> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).to be_a_directory
<ide> expect(Hbc::Config.global.appdir.join("Caffeine.app")).to be_a_directory
<ide> end
<ide>
<ide>
<ide> Hbc::Installer.new(asset).install
<ide>
<del> expect(Hbc.caskroom.join("container-dmg", asset.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("container-dmg", asset.version)).to be_a_directory
<ide> expect(Hbc::Config.global.appdir.join("container")).to be_a_file
<ide> end
<ide>
<ide>
<ide> Hbc::Installer.new(asset).install
<ide>
<del> expect(Hbc.caskroom.join("container-tar-gz", asset.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("container-tar-gz", asset.version)).to be_a_directory
<ide> expect(Hbc::Config.global.appdir.join("container")).to be_a_file
<ide> end
<ide>
<ide>
<ide> Hbc::Installer.new(asset).install
<ide>
<del> expect(Hbc.caskroom.join("container-xar", asset.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("container-xar", asset.version)).to be_a_directory
<ide> expect(Hbc::Config.global.appdir.join("container")).to be_a_file
<ide> end
<ide>
<ide>
<ide> Hbc::Installer.new(asset).install
<ide>
<del> expect(Hbc.caskroom.join("container-bzip2", asset.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("container-bzip2", asset.version)).to be_a_directory
<ide> expect(Hbc::Config.global.appdir.join("container-bzip2--#{asset.version}")).to be_a_file
<ide> end
<ide>
<ide>
<ide> Hbc::Installer.new(asset).install
<ide>
<del> expect(Hbc.caskroom.join("container-gzip", asset.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("container-gzip", asset.version)).to be_a_directory
<ide> expect(Hbc::Config.global.appdir.join("container")).to be_a_file
<ide> end
<ide>
<ide>
<ide> Hbc::Installer.new(naked_pkg).install
<ide>
<del> expect(Hbc.caskroom.join("container-pkg", naked_pkg.version, "container.pkg")).to be_a_file
<add> expect(Hbc::Caskroom.path.join("container-pkg", naked_pkg.version, "container.pkg")).to be_a_file
<ide> end
<ide>
<ide> it "works properly with an overridden container :type" do
<ide> naked_executable = Hbc::CaskLoader.load(cask_path("naked-executable"))
<ide>
<ide> Hbc::Installer.new(naked_executable).install
<ide>
<del> expect(Hbc.caskroom.join("naked-executable", naked_executable.version, "naked_executable")).to be_a_file
<add> expect(Hbc::Caskroom.path.join("naked-executable", naked_executable.version, "naked_executable")).to be_a_file
<ide> end
<ide>
<ide> it "works fine with a nested container" do
<ide> installer.install
<ide> installer.uninstall
<ide>
<del> expect(Hbc.caskroom.join("local-caffeine", caffeine.version, "Caffeine.app")).not_to be_a_directory
<del> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
<del> expect(Hbc.caskroom.join("local-caffeine")).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version, "Caffeine.app")).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine")).not_to be_a_directory
<ide> end
<ide>
<ide> it "uninstalls all versions if force is set" do
<ide>
<ide> Hbc::Installer.new(caffeine).install
<ide>
<del> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory
<del> expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory
<del> FileUtils.mv(Hbc.caskroom.join("local-caffeine", caffeine.version), Hbc.caskroom.join("local-caffeine", mutated_version))
<del> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
<del> expect(Hbc.caskroom.join("local-caffeine", mutated_version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", mutated_version)).not_to be_a_directory
<add> FileUtils.mv(Hbc::Caskroom.path.join("local-caffeine", caffeine.version), Hbc::Caskroom.path.join("local-caffeine", mutated_version))
<add> expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", mutated_version)).to be_a_directory
<ide>
<ide> Hbc::Installer.new(caffeine, force: true).uninstall
<ide>
<del> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
<del> expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory
<del> expect(Hbc.caskroom.join("local-caffeine")).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", caffeine.version)).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine", mutated_version)).not_to be_a_directory
<add> expect(Hbc::Caskroom.path.join("local-caffeine")).not_to be_a_directory
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb
<ide> begin
<ide> HOMEBREW_CASK_DIRS.values.each(&:mkpath)
<ide>
<del> [Hbc::Config.global.binarydir, Hbc.caskroom, Hbc.cache].each(&:mkpath)
<add> [Hbc::Config.global.binarydir, Hbc::Caskroom.path, Hbc::Cache.path].each(&:mkpath)
<ide>
<ide> Hbc.default_tap = Tap.fetch("Homebrew", "cask-spec").tap do |tap|
<ide> FileUtils.mkdir_p tap.path.dirname
<ide> example.run
<ide> ensure
<ide> FileUtils.rm_rf HOMEBREW_CASK_DIRS.values
<del> FileUtils.rm_rf [Hbc::Config.global.binarydir, Hbc.caskroom, Hbc.cache]
<add> FileUtils.rm_rf [Hbc::Config.global.binarydir, Hbc::Caskroom.path, Hbc::Cache.path]
<ide> Hbc.default_tap.path.unlink
<ide> third_party_tap.path.unlink
<ide> FileUtils.rm_rf third_party_tap.path.parent
| 13
|
Text
|
Text
|
add dcard to the list of companies using airflow
|
f37c36093f79b714b5be3b546f6c7f5658cfaf1a
|
<ide><path>INTHEWILD.md
<ide> Currently, **officially** using Airflow:
<ide> 1. [DataSprints](https://datasprints.com/) [[@lopesdiego12](https://github.com/lopesdiego12) & [@rafaelsantanaep](https://github.com/rafaelsantanaep)]
<ide> 1. [Datatonic](https://datatonic.com/) [[@teamdatatonic](https://github.com/teamdatatonic)]
<ide> 1. [Datumo](https://datumo.io) [[@michalmisiewicz](https://github.com/michalmisiewicz)]
<add>1. [Dcard](https://www.dcard.tw/) [[@damon09273](https://github.com/damon09273) & [@bruce3557](https://github.com/bruce3557) & [@kevin1kevin1k](http://github.com/kevin1kevin1k)]
<ide> 1. [Delft University of Technology](https://www.tudelft.nl/en/) [[@saveriogzz](https://github.com/saveriogzz)]
<ide> 1. [Dentsu Inc.](http://www.dentsu.com/) [[@bryan831](https://github.com/bryan831) & [@loozhengyuan](https://github.com/loozhengyuan)]
<ide> 1. [Deseret Digital Media](http://deseretdigital.com/) [[@formigone](https://github.com/formigone)
| 1
|
Ruby
|
Ruby
|
delegate all finders to relation
|
52ec4311f5bf8b596612f297da0b3be8e284b038
|
<ide><path>activerecord/lib/active_record/base.rb
<ide> def colorize_logging(*args)
<ide> end
<ide> alias :colorize_logging= :colorize_logging
<ide>
<del> # Find operates with four different retrieval approaches:
<del> #
<del> # * Find by id - This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]).
<del> # If no record can be found for all of the listed ids, then RecordNotFound will be raised.
<del> # * Find first - This will return the first record matched by the options used. These options can either be specific
<del> # conditions or merely an order. If no record can be matched, +nil+ is returned. Use
<del> # <tt>Model.find(:first, *args)</tt> or its shortcut <tt>Model.first(*args)</tt>.
<del> # * Find last - This will return the last record matched by the options used. These options can either be specific
<del> # conditions or merely an order. If no record can be matched, +nil+ is returned. Use
<del> # <tt>Model.find(:last, *args)</tt> or its shortcut <tt>Model.last(*args)</tt>.
<del> # * Find all - This will return all the records matched by the options used.
<del> # If no records are found, an empty array is returned. Use
<del> # <tt>Model.find(:all, *args)</tt> or its shortcut <tt>Model.all(*args)</tt>.
<del> #
<del> # All approaches accept an options hash as their last parameter.
<del> #
<del> # ==== Parameters
<del> #
<del> # * <tt>:conditions</tt> - An SQL fragment like "administrator = 1", <tt>[ "user_name = ?", username ]</tt>, or <tt>["user_name = :user_name", { :user_name => user_name }]</tt>. See conditions in the intro.
<del> # * <tt>:order</tt> - An SQL fragment like "created_at DESC, name".
<del> # * <tt>:group</tt> - An attribute name by which the result should be grouped. Uses the <tt>GROUP BY</tt> SQL-clause.
<del> # * <tt>:having</tt> - Combined with +:group+ this can be used to filter the records that a <tt>GROUP BY</tt> returns. Uses the <tt>HAVING</tt> SQL-clause.
<del> # * <tt>:limit</tt> - An integer determining the limit on the number of rows that should be returned.
<del> # * <tt>:offset</tt> - An integer determining the offset from where the rows should be fetched. So at 5, it would skip rows 0 through 4.
<del> # * <tt>:joins</tt> - Either an SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id" (rarely needed),
<del> # named associations in the same form used for the <tt>:include</tt> option, which will perform an <tt>INNER JOIN</tt> on the associated table(s),
<del> # or an array containing a mixture of both strings and named associations.
<del> # If the value is a string, then the records will be returned read-only since they will have attributes that do not correspond to the table's columns.
<del> # Pass <tt>:readonly => false</tt> to override.
<del> # * <tt>:include</tt> - Names associations that should be loaded alongside. The symbols named refer
<del> # to already defined associations. See eager loading under Associations.
<del> # * <tt>:select</tt> - By default, this is "*" as in "SELECT * FROM", but can be changed if you, for example, want to do a join but not
<del> # include the joined columns. Takes a string with the SELECT SQL fragment (e.g. "id, name").
<del> # * <tt>:from</tt> - By default, this is the table name of the class, but can be changed to an alternate table name (or even the name
<del> # of a database view).
<del> # * <tt>:readonly</tt> - Mark the returned records read-only so they cannot be saved or updated.
<del> # * <tt>:lock</tt> - An SQL fragment like "FOR UPDATE" or "LOCK IN SHARE MODE".
<del> # <tt>:lock => true</tt> gives connection's default exclusive lock, usually "FOR UPDATE".
<del> #
<del> # ==== Examples
<del> #
<del> # # find by id
<del> # Person.find(1) # returns the object for ID = 1
<del> # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6)
<del> # Person.find([7, 17]) # returns an array for objects with IDs in (7, 17)
<del> # Person.find([1]) # returns an array for the object with ID = 1
<del> # Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC")
<del> #
<del> # Note that returned records may not be in the same order as the ids you
<del> # provide since database rows are unordered. Give an explicit <tt>:order</tt>
<del> # to ensure the results are sorted.
<del> #
<del> # ==== Examples
<del> #
<del> # # find first
<del> # Person.find(:first) # returns the first object fetched by SELECT * FROM people
<del> # Person.find(:first, :conditions => [ "user_name = ?", user_name])
<del> # Person.find(:first, :conditions => [ "user_name = :u", { :u => user_name }])
<del> # Person.find(:first, :order => "created_on DESC", :offset => 5)
<del> #
<del> # # find last
<del> # Person.find(:last) # returns the last object fetched by SELECT * FROM people
<del> # Person.find(:last, :conditions => [ "user_name = ?", user_name])
<del> # Person.find(:last, :order => "created_on DESC", :offset => 5)
<del> #
<del> # # find all
<del> # Person.find(:all) # returns an array of objects for all the rows fetched by SELECT * FROM people
<del> # Person.find(:all, :conditions => [ "category IN (?)", categories], :limit => 50)
<del> # Person.find(:all, :conditions => { :friends => ["Bob", "Steve", "Fred"] }
<del> # Person.find(:all, :offset => 10, :limit => 10)
<del> # Person.find(:all, :include => [ :account, :friends ])
<del> # Person.find(:all, :group => "category")
<del> #
<del> # Example for find with a lock: Imagine two concurrent transactions:
<del> # each will read <tt>person.visits == 2</tt>, add 1 to it, and save, resulting
<del> # in two saves of <tt>person.visits = 3</tt>. By locking the row, the second
<del> # transaction has to wait until the first is finished; we get the
<del> # expected <tt>person.visits == 4</tt>.
<del> #
<del> # Person.transaction do
<del> # person = Person.find(1, :lock => true)
<del> # person.visits += 1
<del> # person.save!
<del> # end
<del> def find(*args)
<del> options = args.extract_options!
<del>
<del> relation = construct_finder_arel(options, current_scoped_methods)
<del>
<del> case args.first
<del> when :first, :last, :all
<del> relation.send(args.first)
<del> else
<del> relation.find(*args)
<del> end
<del> end
<del>
<add> delegate :find, :first, :last, :all, :to => :scoped
<ide> delegate :select, :group, :order, :limit, :joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly, :having, :to => :scoped
<ide> delegate :count, :average, :minimum, :maximum, :sum, :calculate, :to => :scoped
<ide>
<del> # A convenience wrapper for <tt>find(:first, *args)</tt>. You can pass in all the
<del> # same arguments to this method as you can to <tt>find(:first)</tt>.
<del> def first(*args)
<del> find(:first, *args)
<del> end
<del>
<del> # A convenience wrapper for <tt>find(:last, *args)</tt>. You can pass in all the
<del> # same arguments to this method as you can to <tt>find(:last)</tt>.
<del> def last(*args)
<del> find(:last, *args)
<del> end
<del>
<del> # A convenience wrapper for <tt>find(:all, *args)</tt>. You can pass in all the
<del> # same arguments to this method as you can to <tt>find(:all)</tt>.
<del> def all(*args)
<del> find(:all, *args)
<del> end
<del>
<ide> # Executes a custom SQL query against your database and returns all the results. The results will
<ide> # be returned as an array with columns requested encapsulated as attributes of the model you call
<ide> # this method from. If you call <tt>Product.find_by_sql</tt> then the results will be returned in
<ide><path>activerecord/lib/active_record/relation.rb
<ide> def to_a
<ide> @records
<ide> end
<ide>
<del> alias all to_a
<del>
<ide> def size
<ide> loaded? ? @records.length : count
<ide> end
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb
<ide> module ActiveRecord
<ide> module FinderMethods
<del>
<del> def find(*ids, &block)
<add> # Find operates with four different retrieval approaches:
<add> #
<add> # * Find by id - This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]).
<add> # If no record can be found for all of the listed ids, then RecordNotFound will be raised.
<add> # * Find first - This will return the first record matched by the options used. These options can either be specific
<add> # conditions or merely an order. If no record can be matched, +nil+ is returned. Use
<add> # <tt>Model.find(:first, *args)</tt> or its shortcut <tt>Model.first(*args)</tt>.
<add> # * Find last - This will return the last record matched by the options used. These options can either be specific
<add> # conditions or merely an order. If no record can be matched, +nil+ is returned. Use
<add> # <tt>Model.find(:last, *args)</tt> or its shortcut <tt>Model.last(*args)</tt>.
<add> # * Find all - This will return all the records matched by the options used.
<add> # If no records are found, an empty array is returned. Use
<add> # <tt>Model.find(:all, *args)</tt> or its shortcut <tt>Model.all(*args)</tt>.
<add> #
<add> # All approaches accept an options hash as their last parameter.
<add> #
<add> # ==== Parameters
<add> #
<add> # * <tt>:conditions</tt> - An SQL fragment like "administrator = 1", <tt>[ "user_name = ?", username ]</tt>, or <tt>["user_name = :user_name", { :user_name => user_name }]</tt>. See conditions in the intro.
<add> # * <tt>:order</tt> - An SQL fragment like "created_at DESC, name".
<add> # * <tt>:group</tt> - An attribute name by which the result should be grouped. Uses the <tt>GROUP BY</tt> SQL-clause.
<add> # * <tt>:having</tt> - Combined with +:group+ this can be used to filter the records that a <tt>GROUP BY</tt> returns. Uses the <tt>HAVING</tt> SQL-clause.
<add> # * <tt>:limit</tt> - An integer determining the limit on the number of rows that should be returned.
<add> # * <tt>:offset</tt> - An integer determining the offset from where the rows should be fetched. So at 5, it would skip rows 0 through 4.
<add> # * <tt>:joins</tt> - Either an SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id" (rarely needed),
<add> # named associations in the same form used for the <tt>:include</tt> option, which will perform an <tt>INNER JOIN</tt> on the associated table(s),
<add> # or an array containing a mixture of both strings and named associations.
<add> # If the value is a string, then the records will be returned read-only since they will have attributes that do not correspond to the table's columns.
<add> # Pass <tt>:readonly => false</tt> to override.
<add> # * <tt>:include</tt> - Names associations that should be loaded alongside. The symbols named refer
<add> # to already defined associations. See eager loading under Associations.
<add> # * <tt>:select</tt> - By default, this is "*" as in "SELECT * FROM", but can be changed if you, for example, want to do a join but not
<add> # include the joined columns. Takes a string with the SELECT SQL fragment (e.g. "id, name").
<add> # * <tt>:from</tt> - By default, this is the table name of the class, but can be changed to an alternate table name (or even the name
<add> # of a database view).
<add> # * <tt>:readonly</tt> - Mark the returned records read-only so they cannot be saved or updated.
<add> # * <tt>:lock</tt> - An SQL fragment like "FOR UPDATE" or "LOCK IN SHARE MODE".
<add> # <tt>:lock => true</tt> gives connection's default exclusive lock, usually "FOR UPDATE".
<add> #
<add> # ==== Examples
<add> #
<add> # # find by id
<add> # Person.find(1) # returns the object for ID = 1
<add> # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6)
<add> # Person.find([7, 17]) # returns an array for objects with IDs in (7, 17)
<add> # Person.find([1]) # returns an array for the object with ID = 1
<add> # Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC")
<add> #
<add> # Note that returned records may not be in the same order as the ids you
<add> # provide since database rows are unordered. Give an explicit <tt>:order</tt>
<add> # to ensure the results are sorted.
<add> #
<add> # ==== Examples
<add> #
<add> # # find first
<add> # Person.find(:first) # returns the first object fetched by SELECT * FROM people
<add> # Person.find(:first, :conditions => [ "user_name = ?", user_name])
<add> # Person.find(:first, :conditions => [ "user_name = :u", { :u => user_name }])
<add> # Person.find(:first, :order => "created_on DESC", :offset => 5)
<add> #
<add> # # find last
<add> # Person.find(:last) # returns the last object fetched by SELECT * FROM people
<add> # Person.find(:last, :conditions => [ "user_name = ?", user_name])
<add> # Person.find(:last, :order => "created_on DESC", :offset => 5)
<add> #
<add> # # find all
<add> # Person.find(:all) # returns an array of objects for all the rows fetched by SELECT * FROM people
<add> # Person.find(:all, :conditions => [ "category IN (?)", categories], :limit => 50)
<add> # Person.find(:all, :conditions => { :friends => ["Bob", "Steve", "Fred"] }
<add> # Person.find(:all, :offset => 10, :limit => 10)
<add> # Person.find(:all, :include => [ :account, :friends ])
<add> # Person.find(:all, :group => "category")
<add> #
<add> # Example for find with a lock: Imagine two concurrent transactions:
<add> # each will read <tt>person.visits == 2</tt>, add 1 to it, and save, resulting
<add> # in two saves of <tt>person.visits = 3</tt>. By locking the row, the second
<add> # transaction has to wait until the first is finished; we get the
<add> # expected <tt>person.visits == 4</tt>.
<add> #
<add> # Person.transaction do
<add> # person = Person.find(1, :lock => true)
<add> # person.visits += 1
<add> # person.save!
<add> # end
<add> def find(*args, &block)
<ide> return to_a.find(&block) if block_given?
<ide>
<del> expects_array = ids.first.kind_of?(Array)
<del> return ids.first if expects_array && ids.first.empty?
<del>
<del> ids = ids.flatten.compact.uniq
<add> options = args.extract_options!
<ide>
<del> case ids.size
<del> when 0
<del> raise RecordNotFound, "Couldn't find #{@klass.name} without an ID"
<del> when 1
<del> result = find_one(ids.first)
<del> expects_array ? [ result ] : result
<add> if options.present?
<add> apply_finder_options(options).find(*args)
<ide> else
<del> find_some(ids)
<add> case args.first
<add> when :first, :last, :all
<add> send(args.first)
<add> else
<add> find_with_ids(*args)
<add> end
<ide> end
<ide> end
<ide>
<del> def exists?(id = nil)
<del> relation = select(primary_key).limit(1)
<del> relation = relation.where(primary_key.eq(id)) if id
<del> relation.first ? true : false
<add> # A convenience wrapper for <tt>find(:first, *args)</tt>. You can pass in all the
<add> # same arguments to this method as you can to <tt>find(:first)</tt>.
<add> def first(*args)
<add> args.any? ? apply_finder_options(args.first).first : find_first
<ide> end
<ide>
<del> def first
<del> if loaded?
<del> @records.first
<del> else
<del> @first ||= limit(1).to_a[0]
<del> end
<add> # A convenience wrapper for <tt>find(:last, *args)</tt>. You can pass in all the
<add> # same arguments to this method as you can to <tt>find(:last)</tt>.
<add> def last(*args)
<add> args.any? ? apply_finder_options(args.first).last : find_last
<ide> end
<ide>
<del> def last
<del> if loaded?
<del> @records.last
<del> else
<del> @last ||= reverse_order.limit(1).to_a[0]
<del> end
<add> # A convenience wrapper for <tt>find(:all, *args)</tt>. You can pass in all the
<add> # same arguments to this method as you can to <tt>find(:all)</tt>.
<add> def all(*args)
<add> args.any? ? apply_finder_options(args.first).to_a : to_a
<add> end
<add>
<add> def exists?(id = nil)
<add> relation = select(primary_key).limit(1)
<add> relation = relation.where(primary_key.eq(id)) if id
<add> relation.first ? true : false
<ide> end
<ide>
<ide> protected
<ide> def find_or_instantiator_by_attributes(match, attributes, *args)
<ide> record
<ide> end
<ide>
<add> def find_with_ids(*ids, &block)
<add> return to_a.find(&block) if block_given?
<add>
<add> expects_array = ids.first.kind_of?(Array)
<add> return ids.first if expects_array && ids.first.empty?
<add>
<add> ids = ids.flatten.compact.uniq
<add>
<add> case ids.size
<add> when 0
<add> raise RecordNotFound, "Couldn't find #{@klass.name} without an ID"
<add> when 1
<add> result = find_one(ids.first)
<add> expects_array ? [ result ] : result
<add> else
<add> find_some(ids)
<add> end
<add> end
<add>
<ide> def find_one(id)
<ide> record = where(primary_key.eq(id)).first
<ide>
<ide> def find_some(ids)
<ide> end
<ide> end
<ide>
<add> def find_first
<add> if loaded?
<add> @records.first
<add> else
<add> @first ||= limit(1).to_a[0]
<add> end
<add> end
<add>
<add> def find_last
<add> if loaded?
<add> @records.last
<add> else
<add> @last ||= reverse_order.limit(1).to_a[0]
<add> end
<add> end
<add>
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/relation/spawn_methods.rb
<ide> def apply_finder_options(options)
<ide>
<ide> options.assert_valid_keys(VALID_FIND_OPTIONS)
<ide>
<del> relation = relation.joins(options[:joins]).
<del> where(options[:conditions]).
<del> select(options[:select]).
<del> group(options[:group]).
<del> having(options[:having]).
<del> order(options[:order]).
<del> limit(options[:limit]).
<del> offset(options[:offset]).
<del> from(options[:from]).
<del> includes(options[:include])
<del>
<del> relation = relation.lock(options[:lock]) if options[:lock].present?
<del> relation = relation.readonly(options[:readonly]) if options.has_key?(:readonly)
<add> [:joins, :select, :group, :having, :order, :limit, :offset, :from, :lock, :readonly].each do |finder|
<add> relation = relation.send(finder, options[finder]) if options.has_key?(finder)
<add> end
<add>
<add> relation = relation.where(options[:conditions]) if options.has_key?(:conditions)
<add> relation = relation.includes(options[:include]) if options.has_key?(:include)
<ide>
<ide> relation
<ide> end
| 4
|
Java
|
Java
|
improve performance of stringutils.deleteany()
|
e1951a098b6e732a5919e60dcd48375426ab801b
|
<ide><path>spring-core/src/main/java/org/springframework/util/StringUtils.java
<ide> public static String deleteAny(String inString, @Nullable String charsToDelete)
<ide> return inString;
<ide> }
<ide>
<del> StringBuilder sb = new StringBuilder(inString.length());
<add> int lastCharIndex = 0;
<add> char[] result = new char[inString.length()];
<ide> for (int i = 0; i < inString.length(); i++) {
<ide> char c = inString.charAt(i);
<ide> if (charsToDelete.indexOf(c) == -1) {
<del> sb.append(c);
<add> result[lastCharIndex++] = c;
<ide> }
<ide> }
<del> return sb.toString();
<add> return new String(result, 0, lastCharIndex);
<ide> }
<ide>
<del>
<ide> //---------------------------------------------------------------------
<ide> // Convenience methods for working with formatted Strings
<ide> //---------------------------------------------------------------------
<ide><path>spring-core/src/test/java/org/springframework/util/StringUtilsTests.java
<ide> void quote() {
<ide> void quoteIfString() {
<ide> assertThat(StringUtils.quoteIfString("myString")).isEqualTo("'myString'");
<ide> assertThat(StringUtils.quoteIfString("")).isEqualTo("''");
<del> assertThat(StringUtils.quoteIfString(5)).isEqualTo(Integer.valueOf(5));
<add> assertThat(StringUtils.quoteIfString(5)).isEqualTo(5);
<ide> assertThat(StringUtils.quoteIfString(null)).isNull();
<ide> }
<ide>
<ide> void tokenizeToStringArray() {
<ide> void tokenizeToStringArrayWithNotIgnoreEmptyTokens() {
<ide> String[] sa = StringUtils.tokenizeToStringArray("a,b , ,c", ",", true, false);
<ide> assertThat(sa.length).isEqualTo(4);
<del> assertThat(sa[0].equals("a") && sa[1].equals("b") && sa[2].equals("") && sa[3].equals("c")).as("components are correct").isTrue();
<add> assertThat(sa[0].equals("a") && sa[1].equals("b") && sa[2].isEmpty() && sa[3].equals("c")).as("components are correct").isTrue();
<ide> }
<ide>
<ide> @Test
<ide> void delimitedListToStringArrayWithSemicolon() {
<ide> }
<ide>
<ide> @Test
<del> void delimitedListToStringArrayWithEmptyString() {
<add> void delimitedListToStringArrayWithEmptyDelimiter() {
<ide> String[] sa = StringUtils.delimitedListToStringArray("a,b", "");
<ide> assertThat(sa.length).isEqualTo(3);
<ide> assertThat(sa[0]).isEqualTo("a");
<ide> void commaDelimitedListToStringArrayEmptyStrings() {
<ide> // Could read these from files
<ide> String[] sa = StringUtils.commaDelimitedListToStringArray("a,,b");
<ide> assertThat(sa.length).as("a,,b produces array length 3").isEqualTo(3);
<del> assertThat(sa[0].equals("a") && sa[1].equals("") && sa[2].equals("b")).as("components are correct").isTrue();
<add> assertThat(sa[0].equals("a") && sa[1].isEmpty() && sa[2].equals("b")).as("components are correct").isTrue();
<ide>
<ide> sa = new String[] {"", "", "a", ""};
<ide> doTestCommaDelimitedListToStringArrayLegalMatch(sa);
| 2
|
Ruby
|
Ruby
|
extract more mutations to the caller
|
49d50b9d80957e53a72ba8ffa1dd51f1247610b5
|
<ide><path>activerecord/lib/active_record/associations/builder/association.rb
<ide> def self.build(model, name, scope, options, &block)
<ide> raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol)
<ide>
<ide> builder = new(model, name, scope, options, &block)
<add> reflection = builder.build
<ide> builder.define_accessors model.generated_feature_methods
<del> builder.build
<add> builder.define_callbacks reflection
<add> reflection
<ide> end
<ide>
<ide> def initialize(model, name, scope, options)
<ide> def initialize(model, name, scope, options)
<ide>
<ide> def build
<ide> configure_dependency if options[:dependent]
<del> reflection = ActiveRecord::Reflection.create(macro, name, scope, options, model)
<del> Association.extensions.each do |extension|
<del> extension.build @model, reflection
<del> end
<del> reflection
<add> ActiveRecord::Reflection.create(macro, name, scope, options, model)
<ide> end
<ide>
<ide> def macro
<ide> def validate_options
<ide> options.assert_valid_keys(valid_options)
<ide> end
<ide>
<add> def define_callbacks(reflection)
<add> Association.extensions.each do |extension|
<add> extension.build @model, reflection
<add> end
<add> end
<add>
<ide> # Defines the setter and getter methods for the association
<ide> # class Post < ActiveRecord::Base
<ide> # has_many :comments
<ide><path>activerecord/lib/active_record/associations/builder/belongs_to.rb
<ide> def constructable?
<ide> !options[:polymorphic]
<ide> end
<ide>
<del> def build
<del> reflection = super
<del> add_counter_cache_callbacks(reflection) if options[:counter_cache]
<del> add_touch_callbacks(reflection) if options[:touch]
<del> reflection
<del> end
<del>
<ide> def valid_dependent_options
<ide> [:destroy, :delete]
<ide> end
<ide>
<add> def define_callbacks(reflection)
<add> super
<add> add_counter_cache_callbacks(reflection) if options[:counter_cache]
<add> add_touch_callbacks(reflection) if options[:touch]
<add> end
<add>
<ide> def define_accessors(mixin)
<ide> super
<ide> add_counter_cache_methods mixin
| 2
|
Python
|
Python
|
remove progress indicator from movielens download
|
ff9ab90b0ef1e093c8f348fc9ac5d5f73bc521e4
|
<ide><path>official/datasets/movielens.py
<ide> def _download_and_clean(dataset, data_dir):
<ide> temp_dir = tempfile.mkdtemp()
<ide> try:
<ide> zip_path = os.path.join(temp_dir, "{}.zip".format(dataset))
<del> def _progress(count, block_size, total_size):
<del> sys.stdout.write("\r>> Downloading {} {:.1f}%".format(
<del> zip_path, 100.0 * count * block_size / total_size))
<del> sys.stdout.flush()
<del>
<del> zip_path, _ = urllib.request.urlretrieve(url, zip_path, _progress)
<add> zip_path, _ = urllib.request.urlretrieve(url, zip_path)
<ide> statinfo = os.stat(zip_path)
<ide> # A new line to clear the carriage return from download progress
<ide> # tf.logging.info is not applicable here
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.