content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
apply suggestions from code review
2688e7e56bf2983670d6a1e187006fe3a8feba3b
<ide><path>Library/Homebrew/style.rb <ide> def check_style_impl(files, output_type, <ide> run_shellcheck(shell_files, output_type) <ide> end <ide> <del> run_shfmt(shell_files, inplace: fix) if ruby_files.none? || shell_files.any? <add> run_shfmt(shell_files, fix: fix) if ruby_files.none? || shell_files.any? <ide> <ide> if output_type == :json <ide> Offenses.new(rubocop_result + shellcheck_result) <ide> def run_rubocop(files, output_type, <ide> end <ide> <ide> def run_shellcheck(files, output_type) <del> files = [*shell_scripts, HOMEBREW_REPOSITORY/"Dockerfile"] if files.empty? <add> files = shell_scripts if files.blank? <ide> <ide> args = ["--shell=bash", "--enable=all", "--external-sources", "--source-path=#{HOMEBREW_LIBRARY}", "--", *files] <ide> <ide> def run_shellcheck(files, output_type) <ide> end <ide> end <ide> <del> def run_shfmt(files, inplace: false) <del> files = shell_scripts if files.empty? <add> def run_shfmt(files, fix: false) <add> files = shell_scripts if files.blank? <ide> # Do not format completions and Dockerfile <ide> files.delete(HOMEBREW_REPOSITORY/"completions/bash/brew") <ide> files.delete(HOMEBREW_REPOSITORY/"Dockerfile") <ide> <add> # shfmt options: <add> # -i 2 : indent by 2 spaces <add> # -ci : indent switch cases <add> # -ln bash : language variant to parse ("bash") <add> # -w : write result to file instead of stdout (inplace fixing) <add> # "--" is needed for `utils/shfmt.sh` <ide> args = ["-i", "2", "-ci", "-ln", "bash", "--", *files] <ide> <del> args.unshift("-w") if inplace <add> # Do inplace fixing <add> args << "-w" if fix <ide> <ide> system shfmt, *args <ide> $CHILD_STATUS.success?
1
Python
Python
fix refactoring error in static_folder docstring
11d2eec3acb7d0cf291b572e3b6b493df5fadc6b
<ide><path>flask/app.py <ide> class Flask(_PackageBoundObject): <ide> :param static_folder: the folder with static files that should be served <ide> at `static_url_path`. Defaults to the ``'static'`` <ide> folder in the root path of the application. <del> folder in the root path of the application. Defaults <del> to None. <ide> :param host_matching: sets the app's ``url_map.host_matching`` to the given <ide> given value. Defaults to False. <ide> :param static_host: the host to use when adding the static route. Defaults
1
Go
Go
fix spelling of 'existent'
899caaca9c990067d541231c6d288de89dbb79e7
<ide><path>integration-cli/docker_cli_volume_test.go <ide> func (s *DockerSuite) TestVolumeCliInspect(c *check.C) { <ide> c.Assert( <ide> exec.Command(dockerBinary, "volume", "inspect", "doesntexist").Run(), <ide> check.Not(check.IsNil), <del> check.Commentf("volume inspect should error on non-existant volume"), <add> check.Commentf("volume inspect should error on non-existent volume"), <ide> ) <ide> <ide> out, _ := dockerCmd(c, "volume", "create") <ide> func (s *DockerSuite) TestVolumeCliRm(c *check.C) { <ide> c.Assert( <ide> exec.Command("volume", "rm", "doesntexist").Run(), <ide> check.Not(check.IsNil), <del> check.Commentf("volume rm should fail with non-existant volume"), <add> check.Commentf("volume rm should fail with non-existent volume"), <ide> ) <ide> } <ide> <ide><path>pkg/filenotify/poller_test.go <ide> func TestPollerAddRemove(t *testing.T) { <ide> w := NewPollingWatcher() <ide> <ide> if err := w.Add("no-such-file"); err == nil { <del> t.Fatal("should have gotten error when adding a non-existant file") <add> t.Fatal("should have gotten error when adding a non-existent file") <ide> } <ide> if err := w.Remove("no-such-file"); err == nil { <del> t.Fatal("should have gotten error when removing non-existant watch") <add> t.Fatal("should have gotten error when removing non-existent watch") <ide> } <ide> <ide> f, err := ioutil.TempFile("", "asdf") <ide><path>volume/volume.go <ide> func (m *MountPoint) Setup() (string, error) { <ide> return "", err <ide> } <ide> if runtime.GOOS != "windows" { // Windows does not have deprecation issues here <del> logrus.Warnf("Auto-creating non-existant volume host path %s, this is deprecated and will be removed soon", m.Source) <add> logrus.Warnf("Auto-creating non-existent volume host path %s, this is deprecated and will be removed soon", m.Source) <ide> if err := system.MkdirAll(m.Source, 0755); err != nil { <ide> return "", err <ide> }
3
Text
Text
replace string with template string
76dbde19a73d4b86ce24f4221d9a8d01a9e14303
<ide><path>doc/api/stream.md <ide> available data. In the latter case, [`stream.read()`][stream-read] will return <ide> const fs = require('fs'); <ide> const rr = fs.createReadStream('foo.txt'); <ide> rr.on('readable', () => { <del> console.log('readable:', rr.read()); <add> console.log(`readable: ${rr.read()}`); <ide> }); <ide> rr.on('end', () => { <ide> console.log('end');
1
Ruby
Ruby
add edge test cases for integer and string types
25b3cbb241a334d750eed24f5094151e52ed7c69
<ide><path>activemodel/test/cases/type/integer_test.rb <ide> class IntegerTest < ActiveModel::TestCase <ide> assert_equal 7200, type.cast(2.hours) <ide> end <ide> <add> test "casting empty string" do <add> type = Type::Integer.new <add> assert_nil type.cast("") <add> assert_nil type.serialize("") <add> assert_equal 0, type.deserialize("") <add> end <add> <ide> test "changed?" do <ide> type = Type::Integer.new <ide> <ide><path>activemodel/test/cases/type/string_test.rb <ide> class StringTest < ActiveModel::TestCase <ide> assert_equal "123", type.cast(123) <ide> end <ide> <add> test "type casting for database" do <add> type = Type::String.new <add> object, array, hash = Object.new, [true], { a: :b } <add> assert_equal object, type.serialize(object) <add> assert_equal array, type.serialize(array) <add> assert_equal hash, type.serialize(hash) <add> end <add> <ide> test "cast strings are mutable" do <ide> type = Type::String.new <ide>
2
PHP
PHP
add comparefields() method
a37d9554dfe66c8bcb1946a784d109489462e3f6
<ide><path>src/Validation/Validation.php <ide> public static function comparison($check1, $operator, $check2) <ide> * @param string $field The field to check $check against. This field must be present in $context. <ide> * @param array $context The validation context. <ide> * @return bool <add> * @deprecated 3.6.0 Use compareFields() instead. <ide> */ <ide> public static function compareWith($check, $field, $context) <add> { <add> return self::compareFields($check, $field, true, $context); <add> } <add> <add> /** <add> * Compare one field to another. <add> * <add> * Return true if the comparison match the expected result. <add> * <add> * @param mixed $check The value to find in $field. <add> * @param string $field The field to check $check against. This field must be present in $context. <add> * @param bool $result The expected result of field comparison. <add> * @param array $context The validation context. <add> * @return bool <add> * @since 3.6.0 <add> */ <add> public static function compareFields($check, $field, $result, $context) <ide> { <ide> if (!isset($context['data'][$field])) { <ide> return false; <ide> } <ide> <del> return $context['data'][$field] === $check; <add> $comparison = $context['data'][$field] === $check; <add> <add> return $comparison === $result; <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Validation/ValidationTest.php <ide> public function testUploadedFilePsr7($expected, $options) <ide> } <ide> <ide> /** <del> * Test the compareWith method. <add> * Test the compareFields method with true result. <ide> * <ide> * @return void <ide> */ <del> public function testCompareWith() <add> public function testCompareFieldsTrue() <ide> { <ide> $context = [ <ide> 'data' => [ <ide> 'other' => 'a value' <ide> ] <ide> ]; <del> $this->assertTrue(Validation::compareWith('a value', 'other', $context)); <add> $this->assertTrue(Validation::compareFields('a value', 'other', true, $context)); <ide> <ide> $context = [ <ide> 'data' => [ <ide> 'other' => 'different' <ide> ] <ide> ]; <del> $this->assertFalse(Validation::compareWith('a value', 'other', $context)); <add> $this->assertFalse(Validation::compareFields('a value', 'other', true, $context)); <ide> <ide> $context = []; <del> $this->assertFalse(Validation::compareWith('a value', 'other', $context)); <add> $this->assertFalse(Validation::compareFields('a value', 'other', true, $context)); <add> } <add> <add> /** <add> * Test the compareFields method with false result. <add> * <add> * @return void <add> */ <add> public function testCompareFieldsFalse() <add> { <add> $context = [ <add> 'data' => [ <add> 'other' => 'different' <add> ] <add> ]; <add> $this->assertTrue(Validation::compareFields('a value', 'other', false, $context)); <add> <add> $context = [ <add> 'data' => [ <add> 'other' => 'a value' <add> ] <add> ]; <add> $this->assertFalse(Validation::compareFields('a value', 'other', false, $context)); <add> <add> $context = []; <add> $this->assertFalse(Validation::compareFields('a value', 'other', false, $context)); <ide> } <ide> <ide> /**
2
Python
Python
fix spelling on line 44 of bucket sort (#824)
c1130490d7534412bea66cb3864e2bb7f7e13dd7
<ide><path>sorts/bucket_sort.py <ide> def bucket_sort(my_list,bucket_size=DEFAULT_BUCKET_SIZE): <ide> <ide> <ide> #test <del>#besd on python 3.7.3 <add>#best on python 3.7.3 <ide> user_input =input('Enter numbers separated by a comma:').strip() <ide> unsorted =[int(item) for item in user_input.split(',')] <ide> print(bucket_sort(unsorted))
1
Java
Java
avoid infinite loop in annotationscanner
650cbeee1433aa38619691946c316d9d03a6512d
<ide><path>spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java <ide> private static <C, R> R processClassInheritedAnnotations(C context, Class<?> sou <ide> return result; <ide> } <ide> if (isFiltered(source, context, classFilter)) { <add> source = source.getSuperclass(); <add> aggregateIndex++; <ide> continue; <ide> } <ide> Annotation[] declaredAnnotations = <ide><path>spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java <ide> public String finish(String result) { <ide> assertThat(result).isEqualTo("OK"); <ide> } <ide> <add> @Test <add> void scanWithFilteredAll() { <add> List<Integer> indexes = new ArrayList<>(); <add> String result = AnnotationsScanner.scan(this, WithSingleSuperclass.class, <add> SearchStrategy.INHERITED_ANNOTATIONS, <add> (context, aggregateIndex, source, annotations) -> { <add> indexes.add(aggregateIndex); <add> return ""; <add> }, <add> (context,cls)->{ <add> return true; <add> } <add> ); <add> assertThat(result).isNull(); <add> } <add> <ide> <ide> private Method methodFrom(Class<?> type) { <ide> return ReflectionUtils.findMethod(type, "method");
2
Ruby
Ruby
add missing space to error message
bb8f9d3d0c54b2565893c25dae0403c6531830ea
<ide><path>activerecord/lib/active_record/encryption/scheme.rb <ide> def validate_keys! <ide> <ide> def validate_credential(key, error_message = "is not configured") <ide> unless ActiveRecord::Encryption.config.public_send(key).present? <del> raise Errors::Configuration, "#{key} #{error_message}. Please configure it via credential"\ <add> raise Errors::Configuration, "#{key} #{error_message}. Please configure it via credential "\ <ide> "active_record_encryption.#{key} or by setting config.active_record.encryption.#{key}" <ide> end <ide> end
1
Javascript
Javascript
remove usereducer eager bailout
66388150ef1dfef1388c634a2d2ce6760a92012f
<ide><path>packages/react-reconciler/src/ReactFiberHooks.new.js <ide> const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals; <ide> type Update<S, A> = {| <ide> lane: Lane, <ide> action: A, <del> eagerReducer: ((S, A) => S) | null, <add> hasEagerState: boolean, <ide> eagerState: S | null, <ide> next: Update<S, A>, <ide> |}; <ide> function mountReducer<S, I, A>( <ide> lastRenderedState: (initialState: any), <ide> }; <ide> hook.queue = queue; <del> const dispatch: Dispatch<A> = (queue.dispatch = (dispatchAction.bind( <add> const dispatch: Dispatch<A> = (queue.dispatch = (dispatchReducerAction.bind( <ide> null, <ide> currentlyRenderingFiber, <ide> queue, <ide> function updateReducer<S, I, A>( <ide> const clone: Update<S, A> = { <ide> lane: updateLane, <ide> action: update.action, <del> eagerReducer: update.eagerReducer, <add> hasEagerState: update.hasEagerState, <ide> eagerState: update.eagerState, <ide> next: (null: any), <ide> }; <ide> function updateReducer<S, I, A>( <ide> // this will never be skipped by the check above. <ide> lane: NoLane, <ide> action: update.action, <del> eagerReducer: update.eagerReducer, <add> hasEagerState: update.hasEagerState, <ide> eagerState: update.eagerState, <ide> next: (null: any), <ide> }; <ide> newBaseQueueLast = newBaseQueueLast.next = clone; <ide> } <ide> <ide> // Process this update. <del> if (update.eagerReducer === reducer) { <del> // If this update was processed eagerly, and its reducer matches the <del> // current reducer, we can use the eagerly computed state. <add> if (update.hasEagerState) { <add> // If this update is a state update (not a reducer) and was processed eagerly, <add> // we can use the eagerly computed state <ide> newState = ((update.eagerState: any): S); <ide> } else { <ide> const action = update.action; <ide> function useMutableSource<Source, Snapshot>( <ide> lastRenderedReducer: basicStateReducer, <ide> lastRenderedState: snapshot, <ide> }; <del> newQueue.dispatch = setSnapshot = (dispatchAction.bind( <add> newQueue.dispatch = setSnapshot = (dispatchSetState.bind( <ide> null, <ide> currentlyRenderingFiber, <ide> newQueue, <ide> function mountState<S>( <ide> hook.queue = queue; <ide> const dispatch: Dispatch< <ide> BasicStateAction<S>, <del> > = (queue.dispatch = (dispatchAction.bind( <add> > = (queue.dispatch = (dispatchSetState.bind( <ide> null, <ide> currentlyRenderingFiber, <ide> queue, <ide> function refreshCache<T>(fiber: Fiber, seedKey: ?() => T, seedValue: T) { <ide> // TODO: Warn if unmounted? <ide> } <ide> <del>function dispatchAction<S, A>( <add>function dispatchReducerAction<S, A>( <ide> fiber: Fiber, <ide> queue: UpdateQueue<S, A>, <ide> action: A, <ide> function dispatchAction<S, A>( <ide> const update: Update<S, A> = { <ide> lane, <ide> action, <del> eagerReducer: null, <add> hasEagerState: false, <add> eagerState: null, <add> next: (null: any), <add> }; <add> <add> const alternate = fiber.alternate; <add> if ( <add> fiber === currentlyRenderingFiber || <add> (alternate !== null && alternate === currentlyRenderingFiber) <add> ) { <add> // This is a render phase update. Stash it in a lazily-created map of <add> // queue -> linked list of updates. After this render pass, we'll restart <add> // and apply the stashed updates on top of the work-in-progress hook. <add> didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; <add> const pending = queue.pending; <add> if (pending === null) { <add> // This is the first update. Create a circular list. <add> update.next = update; <add> } else { <add> update.next = pending.next; <add> pending.next = update; <add> } <add> queue.pending = update; <add> } else { <add> if (isInterleavedUpdate(fiber, lane)) { <add> const interleaved = queue.interleaved; <add> if (interleaved === null) { <add> // This is the first update. Create a circular list. <add> update.next = update; <add> // At the end of the current render, this queue's interleaved updates will <add> // be transferred to the pending queue. <add> pushInterleavedQueue(queue); <add> } else { <add> update.next = interleaved.next; <add> interleaved.next = update; <add> } <add> queue.interleaved = update; <add> } else { <add> const pending = queue.pending; <add> if (pending === null) { <add> // This is the first update. Create a circular list. <add> update.next = update; <add> } else { <add> update.next = pending.next; <add> pending.next = update; <add> } <add> queue.pending = update; <add> } <add> <add> if (__DEV__) { <add> // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests <add> if ('undefined' !== typeof jest) { <add> warnIfNotCurrentlyActingUpdatesInDev(fiber); <add> } <add> } <add> const root = scheduleUpdateOnFiber(fiber, lane, eventTime); <add> <add> if (isTransitionLane(lane) && root !== null) { <add> let queueLanes = queue.lanes; <add> <add> // If any entangled lanes are no longer pending on the root, then they <add> // must have finished. We can remove them from the shared queue, which <add> // represents a superset of the actually pending lanes. In some cases we <add> // may entangle more than we need to, but that's OK. In fact it's worse if <add> // we *don't* entangle when we should. <add> queueLanes = intersectLanes(queueLanes, root.pendingLanes); <add> <add> // Entangle the new transition lane with the other transition lanes. <add> const newQueueLanes = mergeLanes(queueLanes, lane); <add> queue.lanes = newQueueLanes; <add> // Even if queue.lanes already include lane, we don't know for certain if <add> // the lane finished since the last time we entangled it. So we need to <add> // entangle it again, just to be sure. <add> markRootEntangled(root, newQueueLanes); <add> } <add> } <add> <add> if (__DEV__) { <add> if (enableDebugTracing) { <add> if (fiber.mode & DebugTracingMode) { <add> const name = getComponentNameFromFiber(fiber) || 'Unknown'; <add> logStateUpdateScheduled(name, lane, action); <add> } <add> } <add> } <add> <add> if (enableSchedulingProfiler) { <add> markStateUpdateScheduled(fiber, lane); <add> } <add>} <add> <add>function dispatchSetState<S, A>( <add> fiber: Fiber, <add> queue: UpdateQueue<S, A>, <add> action: A, <add>) { <add> if (__DEV__) { <add> if (typeof arguments[3] === 'function') { <add> console.error( <add> "State updates from the useState() and useReducer() Hooks don't support the " + <add> 'second callback argument. To execute a side effect after ' + <add> 'rendering, declare it in the component body with useEffect().', <add> ); <add> } <add> } <add> <add> const eventTime = requestEventTime(); <add> const lane = requestUpdateLane(fiber); <add> <add> const update: Update<S, A> = { <add> lane, <add> action, <add> hasEagerState: false, <ide> eagerState: null, <ide> next: (null: any), <ide> }; <ide> function dispatchAction<S, A>( <ide> // it, on the update object. If the reducer hasn't changed by the <ide> // time we enter the render phase, then the eager state can be used <ide> // without calling the reducer again. <del> update.eagerReducer = lastRenderedReducer; <add> update.hasEagerState = true; <ide> update.eagerState = eagerState; <ide> if (is(eagerState, currentState)) { <ide> // Fast path. We can bail out without scheduling React to re-render. <ide><path>packages/react-reconciler/src/ReactFiberHooks.old.js <ide> const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals; <ide> type Update<S, A> = {| <ide> lane: Lane, <ide> action: A, <del> eagerReducer: ((S, A) => S) | null, <add> hasEagerState: boolean, <ide> eagerState: S | null, <ide> next: Update<S, A>, <ide> |}; <ide> function mountReducer<S, I, A>( <ide> lastRenderedState: (initialState: any), <ide> }; <ide> hook.queue = queue; <del> const dispatch: Dispatch<A> = (queue.dispatch = (dispatchAction.bind( <add> const dispatch: Dispatch<A> = (queue.dispatch = (dispatchReducerAction.bind( <ide> null, <ide> currentlyRenderingFiber, <ide> queue, <ide> function updateReducer<S, I, A>( <ide> const clone: Update<S, A> = { <ide> lane: updateLane, <ide> action: update.action, <del> eagerReducer: update.eagerReducer, <add> hasEagerState: update.hasEagerState, <ide> eagerState: update.eagerState, <ide> next: (null: any), <ide> }; <ide> function updateReducer<S, I, A>( <ide> // this will never be skipped by the check above. <ide> lane: NoLane, <ide> action: update.action, <del> eagerReducer: update.eagerReducer, <add> hasEagerState: update.hasEagerState, <ide> eagerState: update.eagerState, <ide> next: (null: any), <ide> }; <ide> newBaseQueueLast = newBaseQueueLast.next = clone; <ide> } <ide> <ide> // Process this update. <del> if (update.eagerReducer === reducer) { <del> // If this update was processed eagerly, and its reducer matches the <del> // current reducer, we can use the eagerly computed state. <add> if (update.hasEagerState) { <add> // If this update is a state update (not a reducer) and was processed eagerly, <add> // we can use the eagerly computed state <ide> newState = ((update.eagerState: any): S); <ide> } else { <ide> const action = update.action; <ide> function useMutableSource<Source, Snapshot>( <ide> lastRenderedReducer: basicStateReducer, <ide> lastRenderedState: snapshot, <ide> }; <del> newQueue.dispatch = setSnapshot = (dispatchAction.bind( <add> newQueue.dispatch = setSnapshot = (dispatchSetState.bind( <ide> null, <ide> currentlyRenderingFiber, <ide> newQueue, <ide> function mountState<S>( <ide> hook.queue = queue; <ide> const dispatch: Dispatch< <ide> BasicStateAction<S>, <del> > = (queue.dispatch = (dispatchAction.bind( <add> > = (queue.dispatch = (dispatchSetState.bind( <ide> null, <ide> currentlyRenderingFiber, <ide> queue, <ide> function refreshCache<T>(fiber: Fiber, seedKey: ?() => T, seedValue: T) { <ide> // TODO: Warn if unmounted? <ide> } <ide> <del>function dispatchAction<S, A>( <add>function dispatchReducerAction<S, A>( <ide> fiber: Fiber, <ide> queue: UpdateQueue<S, A>, <ide> action: A, <ide> function dispatchAction<S, A>( <ide> const update: Update<S, A> = { <ide> lane, <ide> action, <del> eagerReducer: null, <add> hasEagerState: false, <add> eagerState: null, <add> next: (null: any), <add> }; <add> <add> const alternate = fiber.alternate; <add> if ( <add> fiber === currentlyRenderingFiber || <add> (alternate !== null && alternate === currentlyRenderingFiber) <add> ) { <add> // This is a render phase update. Stash it in a lazily-created map of <add> // queue -> linked list of updates. After this render pass, we'll restart <add> // and apply the stashed updates on top of the work-in-progress hook. <add> didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; <add> const pending = queue.pending; <add> if (pending === null) { <add> // This is the first update. Create a circular list. <add> update.next = update; <add> } else { <add> update.next = pending.next; <add> pending.next = update; <add> } <add> queue.pending = update; <add> } else { <add> if (isInterleavedUpdate(fiber, lane)) { <add> const interleaved = queue.interleaved; <add> if (interleaved === null) { <add> // This is the first update. Create a circular list. <add> update.next = update; <add> // At the end of the current render, this queue's interleaved updates will <add> // be transferred to the pending queue. <add> pushInterleavedQueue(queue); <add> } else { <add> update.next = interleaved.next; <add> interleaved.next = update; <add> } <add> queue.interleaved = update; <add> } else { <add> const pending = queue.pending; <add> if (pending === null) { <add> // This is the first update. Create a circular list. <add> update.next = update; <add> } else { <add> update.next = pending.next; <add> pending.next = update; <add> } <add> queue.pending = update; <add> } <add> <add> if (__DEV__) { <add> // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests <add> if ('undefined' !== typeof jest) { <add> warnIfNotCurrentlyActingUpdatesInDev(fiber); <add> } <add> } <add> const root = scheduleUpdateOnFiber(fiber, lane, eventTime); <add> <add> if (isTransitionLane(lane) && root !== null) { <add> let queueLanes = queue.lanes; <add> <add> // If any entangled lanes are no longer pending on the root, then they <add> // must have finished. We can remove them from the shared queue, which <add> // represents a superset of the actually pending lanes. In some cases we <add> // may entangle more than we need to, but that's OK. In fact it's worse if <add> // we *don't* entangle when we should. <add> queueLanes = intersectLanes(queueLanes, root.pendingLanes); <add> <add> // Entangle the new transition lane with the other transition lanes. <add> const newQueueLanes = mergeLanes(queueLanes, lane); <add> queue.lanes = newQueueLanes; <add> // Even if queue.lanes already include lane, we don't know for certain if <add> // the lane finished since the last time we entangled it. So we need to <add> // entangle it again, just to be sure. <add> markRootEntangled(root, newQueueLanes); <add> } <add> } <add> <add> if (__DEV__) { <add> if (enableDebugTracing) { <add> if (fiber.mode & DebugTracingMode) { <add> const name = getComponentNameFromFiber(fiber) || 'Unknown'; <add> logStateUpdateScheduled(name, lane, action); <add> } <add> } <add> } <add> <add> if (enableSchedulingProfiler) { <add> markStateUpdateScheduled(fiber, lane); <add> } <add>} <add> <add>function dispatchSetState<S, A>( <add> fiber: Fiber, <add> queue: UpdateQueue<S, A>, <add> action: A, <add>) { <add> if (__DEV__) { <add> if (typeof arguments[3] === 'function') { <add> console.error( <add> "State updates from the useState() and useReducer() Hooks don't support the " + <add> 'second callback argument. To execute a side effect after ' + <add> 'rendering, declare it in the component body with useEffect().', <add> ); <add> } <add> } <add> <add> const eventTime = requestEventTime(); <add> const lane = requestUpdateLane(fiber); <add> <add> const update: Update<S, A> = { <add> lane, <add> action, <add> hasEagerState: false, <ide> eagerState: null, <ide> next: (null: any), <ide> }; <ide> function dispatchAction<S, A>( <ide> // it, on the update object. If the reducer hasn't changed by the <ide> // time we enter the render phase, then the eager state can be used <ide> // without calling the reducer again. <del> update.eagerReducer = lastRenderedReducer; <add> update.hasEagerState = true; <ide> update.eagerState = eagerState; <ide> if (is(eagerState, currentState)) { <ide> // Fast path. We can bail out without scheduling React to re-render. <ide><path>packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js <ide> describe('ReactHooksWithNoopRenderer', () => { <ide> }); <ide> }); <ide> <del> it('eager bailout optimization should always compare to latest rendered reducer', () => { <add> it('useReducer does not eagerly bail out of state updates', () => { <ide> // Edge case based on a bug report <ide> let setCounter; <ide> function App() { <ide> describe('ReactHooksWithNoopRenderer', () => { <ide> 'Render: -1', <ide> 'Effect: 1', <ide> 'Reducer: 1', <del> 'Reducer: 1', <ide> 'Render: 1', <ide> ]); <ide> expect(ReactNoop).toMatchRenderedOutput('1'); <ide> describe('ReactHooksWithNoopRenderer', () => { <ide> 'Render: 1', <ide> 'Effect: 2', <ide> 'Reducer: 2', <del> 'Reducer: 2', <ide> 'Render: 2', <ide> ]); <ide> expect(ReactNoop).toMatchRenderedOutput('2'); <ide> }); <ide> <add> it('useReducer does not replay previous no-op actions when other state changes', () => { <add> let increment; <add> let setDisabled; <add> <add> function Counter() { <add> const [disabled, _setDisabled] = useState(true); <add> const [count, dispatch] = useReducer((state, action) => { <add> if (disabled) { <add> return state; <add> } <add> if (action.type === 'increment') { <add> return state + 1; <add> } <add> return state; <add> }, 0); <add> <add> increment = () => dispatch({type: 'increment'}); <add> setDisabled = _setDisabled; <add> <add> Scheduler.unstable_yieldValue('Render disabled: ' + disabled); <add> Scheduler.unstable_yieldValue('Render count: ' + count); <add> return count; <add> } <add> <add> ReactNoop.render(<Counter />); <add> expect(Scheduler).toFlushAndYield([ <add> 'Render disabled: true', <add> 'Render count: 0', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> <add> act(() => { <add> // These increments should have no effect, since disabled=true <add> increment(); <add> increment(); <add> increment(); <add> }); <add> expect(Scheduler).toHaveYielded([ <add> 'Render disabled: true', <add> 'Render count: 0', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> <add> act(() => { <add> // Enabling the updater should *not* replay the previous increment() actions <add> setDisabled(false); <add> }); <add> expect(Scheduler).toHaveYielded([ <add> 'Render disabled: false', <add> 'Render count: 0', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> }); <add> <add> it('useReducer does not replay previous no-op actions when props change', () => { <add> let setDisabled; <add> let increment; <add> <add> function Counter({disabled}) { <add> const [count, dispatch] = useReducer((state, action) => { <add> if (disabled) { <add> return state; <add> } <add> if (action.type === 'increment') { <add> return state + 1; <add> } <add> return state; <add> }, 0); <add> <add> increment = () => dispatch({type: 'increment'}); <add> <add> Scheduler.unstable_yieldValue('Render count: ' + count); <add> return count; <add> } <add> <add> function App() { <add> const [disabled, _setDisabled] = useState(true); <add> setDisabled = _setDisabled; <add> Scheduler.unstable_yieldValue('Render disabled: ' + disabled); <add> return <Counter disabled={disabled} />; <add> } <add> <add> ReactNoop.render(<App />); <add> expect(Scheduler).toFlushAndYield([ <add> 'Render disabled: true', <add> 'Render count: 0', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> <add> act(() => { <add> // These increments should have no effect, since disabled=true <add> increment(); <add> increment(); <add> increment(); <add> }); <add> expect(Scheduler).toHaveYielded(['Render count: 0']); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> <add> act(() => { <add> // Enabling the updater should *not* replay the previous increment() actions <add> setDisabled(false); <add> }); <add> expect(Scheduler).toHaveYielded([ <add> 'Render disabled: false', <add> 'Render count: 0', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> }); <add> <add> it('useReducer applies potential no-op changes if made relevant by other updates in the batch', () => { <add> let setDisabled; <add> let increment; <add> <add> function Counter({disabled}) { <add> const [count, dispatch] = useReducer((state, action) => { <add> if (disabled) { <add> return state; <add> } <add> if (action.type === 'increment') { <add> return state + 1; <add> } <add> return state; <add> }, 0); <add> <add> increment = () => dispatch({type: 'increment'}); <add> <add> Scheduler.unstable_yieldValue('Render count: ' + count); <add> return count; <add> } <add> <add> function App() { <add> const [disabled, _setDisabled] = useState(true); <add> setDisabled = _setDisabled; <add> Scheduler.unstable_yieldValue('Render disabled: ' + disabled); <add> return <Counter disabled={disabled} />; <add> } <add> <add> ReactNoop.render(<App />); <add> expect(Scheduler).toFlushAndYield([ <add> 'Render disabled: true', <add> 'Render count: 0', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('0'); <add> <add> act(() => { <add> // Although the increment happens first (and would seem to do nothing since disabled=true), <add> // because these calls are in a batch the parent updates first. This should cause the child <add> // to re-render with disabled=false and *then* process the increment action, which now <add> // increments the count and causes the component output to change. <add> increment(); <add> setDisabled(false); <add> }); <add> expect(Scheduler).toHaveYielded([ <add> 'Render disabled: false', <add> 'Render count: 1', <add> ]); <add> expect(ReactNoop).toMatchRenderedOutput('1'); <add> }); <add> <ide> // Regression test. Covers a case where an internal state variable <ide> // (`didReceiveUpdate`) is not reset properly. <ide> it('state bail out edge case (#16359)', async () => {
3
Python
Python
remove infunc imports
0dc662a910c8c012bb5ec1740527e3ec4c31bbf6
<ide><path>numpy/distutils/command/scons.py <ide> import os <add>import sys <ide> import os.path <ide> from os.path import join as pjoin, dirname as pdirname <ide> <ide> from numpy.distutils.exec_command import find_executable <ide> from numpy.distutils import log <ide> from numpy.distutils.misc_util import is_bootstrapping, get_cmd <add>from numpy.distutils.misc_util import get_numpy_include_dirs as _incdir <ide> <add># A few notes: <add># - numscons is not mandatory to build numpy, so we cannot import it here. <add># Any numscons import has to happen once we check numscons is available and <add># is required for the build (call through setupscons.py or native numscons <add># build). <ide> def get_scons_build_dir(): <ide> """Return the top path where everything produced by scons will be put. <ide> <ide> def get_python_exec_invoc(): <ide> # than the caller ? This may not be necessary, since os.system is said to <ide> # take into accound os.environ. This actually also works for my way of <ide> # using "local python", using the alias facility of bash. <del> import sys <ide> return sys.executable <ide> <ide> def get_numpy_include_dirs(sconscript_path): <ide> """Return include dirs for numpy. <ide> <ide> The paths are relatively to the setup.py script path.""" <del> from numpy.distutils.misc_util import get_numpy_include_dirs as _incdir <ide> from numscons import get_scons_build_dir <ide> scdir = pjoin(get_scons_build_dir(), pdirname(sconscript_path)) <ide> n = scdir.count(os.sep) <ide> def check_numscons(minver=(0, 10, 2)): <ide> if isinstance(version_info[0], str): <ide> raise ValueError("Numscons %s or above expected " \ <ide> "(detected 0.10.0)" % str(minver)) <add> # Stupid me used list instead of tuple in numscons <add> version_info = tuple(version_info) <ide> if version_info[:3] < minver: <ide> raise ValueError("Numscons %s or above expected (got %s) " <del> % (str(minver), str(version_info))) <add> % (str(minver), str(version_info[:3]))) <ide> except ImportError: <ide> raise RuntimeError("You need numscons >= %s to build numpy "\ <ide> "with numscons (imported numscons path " \
1
PHP
PHP
set exception handler even on non daemon
d5bbda95a6435fa8cb38b8b640440b38de6b7f83
<ide><path>src/Illuminate/Queue/Console/WorkCommand.php <ide> public function fire() <ide> */ <ide> protected function runWorker($connection, $queue, $delay, $memory, $daemon = false) <ide> { <add> $this->worker->setDaemonExceptionHandler( <add> $this->laravel['Illuminate\Contracts\Debug\ExceptionHandler'] <add> ); <add> <ide> if ($daemon) { <ide> $this->worker->setCache($this->laravel['cache']->driver()); <ide> <del> $this->worker->setDaemonExceptionHandler( <del> $this->laravel['Illuminate\Contracts\Debug\ExceptionHandler'] <del> ); <del> <ide> return $this->worker->daemon( <ide> $connection, $queue, $delay, $memory, <ide> $this->option('sleep'), $this->option('tries')
1
Python
Python
fix issue #260
d71b29482e77875a835c5dbefd9ec7bf21cba72c
<ide><path>glances/glances.py <ide> batinfo_lib_tag = False <ide> else: <ide> batinfo_lib_tag = True <add>else: <add> batinfo_lib_tag = False <ide> <ide> try: <ide> # HTML output (optional)
1
PHP
PHP
add missing mailgun.domain option
ffe21c53e1de9b0731849fb43b0b24df16093f36
<ide><path>app/config/services.php <ide> */ <ide> <ide> 'mailgun' => array( <add> 'domain' => '', <ide> 'secret' => '', <ide> ), <ide>
1
Javascript
Javascript
remove this.$() jquery integration
26145d2899658102cf9681a4341edcaffe814311
<ide><path>packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js <ide> import { DEBUG } from '@glimmer/env'; <ide> import { alias, set, get, observer, on, computed, tracked } from '@ember/-internals/metal'; <ide> import Service, { inject as injectService } from '@ember/service'; <ide> import { Object as EmberObject, A as emberA } from '@ember/-internals/runtime'; <del>import { jQueryDisabled } from '@ember/-internals/views'; <ide> <ide> import { Component, compile, htmlSafe } from '../../utils/helpers'; <ide> import { backtrackingMessageFor } from '../../utils/debug-stack'; <ide> moduleFor( <ide> } <ide> } <ide> ); <del> <del>if (jQueryDisabled) { <del> moduleFor( <del> 'Components test: curly components: jQuery disabled', <del> class extends RenderingTestCase { <del> ['@test jQuery proxy is not available without jQuery']() { <del> let instance; <del> <del> let FooBarComponent = Component.extend({ <del> init() { <del> this._super(); <del> instance = this; <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: 'hello', <del> }); <del> <del> this.render('{{foo-bar}}'); <del> <del> expectAssertion(() => { <del> instance.$()[0]; <del> }, 'You cannot access this.$() with `jQuery` disabled.'); <del> } <del> } <del> ); <del>} else { <del> moduleFor( <del> 'Components test: curly components: jQuery enabled', <del> class extends RenderingTestCase { <del> ['@test it has a jQuery proxy to the element']() { <del> let instance; <del> let element1; <del> let element2; <del> <del> let FooBarComponent = Component.extend({ <del> init() { <del> this._super(); <del> instance = this; <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: 'hello', <del> }); <del> <del> this.render('{{foo-bar}}'); <del> <del> expectDeprecation(() => { <del> element1 = instance.$()[0]; <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> this.assertComponentElement(element1, { content: 'hello' }); <del> <del> runTask(() => this.rerender()); <del> <del> expectDeprecation(() => { <del> element2 = instance.$()[0]; <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> this.assertComponentElement(element2, { content: 'hello' }); <del> <del> this.assertSameNode(element2, element1); <del> } <del> <del> ['@test it scopes the jQuery proxy to the component element'](assert) { <del> let instance; <del> let $span; <del> <del> let FooBarComponent = Component.extend({ <del> init() { <del> this._super(); <del> instance = this; <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: '<span class="inner">inner</span>', <del> }); <del> <del> this.render('<span class="outer">outer</span>{{foo-bar}}'); <del> <del> expectDeprecation(() => { <del> $span = instance.$('span'); <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> assert.equal($span.length, 1); <del> assert.equal($span.attr('class'), 'inner'); <del> <del> runTask(() => this.rerender()); <del> <del> expectDeprecation(() => { <del> $span = instance.$('span'); <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> assert.equal($span.length, 1); <del> assert.equal($span.attr('class'), 'inner'); <del> } <del> } <del> ); <del>} <ide><path>packages/@ember/-internals/glimmer/tests/integration/components/dynamic-components-test.js <ide> import { DEBUG } from '@glimmer/env'; <ide> import { moduleFor, RenderingTestCase, strip, runTask } from 'internal-test-helpers'; <ide> <ide> import { set, computed } from '@ember/-internals/metal'; <del>import { jQueryDisabled } from '@ember/-internals/views'; <ide> <ide> import { Component } from '../../utils/helpers'; <ide> import { backtrackingMessageFor } from '../../utils/debug-stack'; <ide> moduleFor( <ide> } <ide> } <ide> ); <del> <del>if (jQueryDisabled) { <del> moduleFor( <del> 'Components test: dynamic components: jQuery disabled', <del> class extends RenderingTestCase { <del> ['@test jQuery proxy is not available without jQuery']() { <del> let instance; <del> <del> let FooBarComponent = Component.extend({ <del> init() { <del> this._super(); <del> instance = this; <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: 'hello', <del> }); <del> <del> this.render('{{component "foo-bar"}}'); <del> <del> expectAssertion(() => { <del> instance.$()[0]; <del> }, 'You cannot access this.$() with `jQuery` disabled.'); <del> } <del> } <del> ); <del>} else { <del> moduleFor( <del> 'Components test: dynamic components : jQuery enabled', <del> class extends RenderingTestCase { <del> ['@test it has a jQuery proxy to the element']() { <del> let instance; <del> let element1; <del> let element2; <del> <del> let FooBarComponent = Component.extend({ <del> init() { <del> this._super(); <del> instance = this; <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: 'hello', <del> }); <del> <del> this.render('{{component "foo-bar"}}'); <del> <del> expectDeprecation(() => { <del> element1 = instance.$()[0]; <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> this.assertComponentElement(element1, { content: 'hello' }); <del> <del> runTask(() => this.rerender()); <del> <del> expectDeprecation(() => { <del> element2 = instance.$()[0]; <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> this.assertComponentElement(element2, { content: 'hello' }); <del> <del> this.assertSameNode(element2, element1); <del> } <del> <del> ['@test it scopes the jQuery proxy to the component element'](assert) { <del> let instance; <del> let $span; <del> <del> let FooBarComponent = Component.extend({ <del> init() { <del> this._super(); <del> instance = this; <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: '<span class="inner">inner</span>', <del> }); <del> <del> this.render('<span class="outer">outer</span>{{component "foo-bar"}}'); <del> <del> expectDeprecation(() => { <del> $span = instance.$('span'); <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> assert.equal($span.length, 1); <del> assert.equal($span.attr('class'), 'inner'); <del> <del> runTask(() => this.rerender()); <del> <del> expectDeprecation(() => { <del> $span = instance.$('span'); <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> <del> assert.equal($span.length, 1); <del> assert.equal($span.attr('class'), 'inner'); <del> } <del> } <del> ); <del>} <ide><path>packages/@ember/-internals/glimmer/tests/integration/components/fragment-components-test.js <ide> moduleFor( <ide> this.assertText('baz'); <ide> } <ide> <del> ['@test throws an error if when $() is accessed on component where `tagName` is an empty string']() { <del> let template = `hit dem folks`; <del> let FooBarComponent = Component.extend({ <del> tagName: '', <del> init() { <del> this._super(); <del> this.$(); <del> }, <del> }); <del> <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template, <del> }); <del> <del> expectAssertion(() => { <del> this.render(`{{#foo-bar}}{{/foo-bar}}`); <del> }, /You cannot access this.\$\(\) on a component with `tagName: ''` specified/); <del> } <del> <ide> ['@test renders a contained view with omitted start tag and tagless parent view context']() { <ide> this.registerComponent('root-component', { <ide> ComponentClass: Component.extend({ <ide><path>packages/@ember/-internals/glimmer/tests/integration/components/life-cycle-test.js <del>import { <del> moduleFor, <del> RenderingTestCase, <del> classes, <del> strip, <del> runAppend, <del> runTask, <del>} from 'internal-test-helpers'; <add>import { classes, moduleFor, RenderingTestCase, runTask, strip } from 'internal-test-helpers'; <ide> <ide> import { schedule } from '@ember/runloop'; <ide> import { set, setProperties } from '@ember/-internals/metal'; <ide> import { A as emberA } from '@ember/-internals/runtime'; <del>import { getViewId, getViewElement, jQueryDisabled } from '@ember/-internals/views'; <add>import { getViewElement, getViewId } from '@ember/-internals/views'; <ide> <ide> import { Component } from '../../utils/helpers'; <ide> <ide> moduleFor( <ide> } <ide> ); <ide> <del>if (!jQueryDisabled) { <del> moduleFor( <del> 'Run loop and lifecycle hooks - jQuery only', <del> class extends RenderingTestCase { <del> ['@test lifecycle hooks have proper access to this.$()'](assert) { <del> assert.expect(7); <del> let component; <del> let FooBarComponent = Component.extend({ <del> tagName: 'div', <del> init() { <del> assert.notOk(this.$(), 'no access to element via this.$() on init() enter'); <del> this._super(...arguments); <del> assert.notOk(this.$(), 'no access to element via this.$() after init() finished'); <del> }, <del> willInsertElement() { <del> component = this; <del> assert.ok(this.$(), 'willInsertElement has access to element via this.$()'); <del> }, <del> didInsertElement() { <del> assert.ok(this.$(), 'didInsertElement has access to element via this.$()'); <del> }, <del> willDestroyElement() { <del> assert.ok(this.$(), 'willDestroyElement has access to element via this.$()'); <del> }, <del> didDestroyElement() { <del> assert.notOk( <del> this.$(), <del> 'didDestroyElement does not have access to element via this.$()' <del> ); <del> }, <del> }); <del> this.registerComponent('foo-bar', { <del> ComponentClass: FooBarComponent, <del> template: 'hello', <del> }); <del> let { owner } = this; <del> <del> expectDeprecation(() => { <del> let comp = owner.lookup('component:foo-bar'); <del> runAppend(comp); <del> runTask(() => component.destroy?.()); <del> }, 'Using this.$() in a component has been deprecated, consider using this.element'); <del> runTask(() => component.destroy?.()); <del> } <del> } <del> ); <del>} <del> <ide> function assertDestroyHooks(assert, _actual, _expected) { <ide> _expected.forEach((expected, i) => { <ide> let name = expected.name; <ide><path>packages/@ember/-internals/views/lib/mixins/view_support.js <ide> import { descriptorForProperty, Mixin, nativeDescDecorator } from '@ember/-inter <ide> import { assert } from '@ember/debug'; <ide> import { hasDOM } from '@ember/-internals/browser-environment'; <ide> import { matches } from '../system/utils'; <del>import { jQuery, jQueryDisabled } from '../system/jquery'; <del>import { deprecate } from '@ember/debug'; <del>import { JQUERY_INTEGRATION } from '@ember/deprecated-features'; <ide> <ide> function K() { <ide> return this; <ide> let mixin = { <ide> }, <ide> }; <ide> <del>if (JQUERY_INTEGRATION) { <del> /** <del> Returns a jQuery object for this view's element. If you pass in a selector <del> string, this method will return a jQuery object, using the current element <del> as its buffer. <del> <del> For example, calling `view.$('li')` will return a jQuery object containing <del> all of the `li` elements inside the DOM element of this view. <del> <del> @method $ <del> @param {String} [selector] a jQuery-compatible selector string <del> @return {jQuery} the jQuery object for the DOM node <del> @public <del> @deprecated <del> */ <del> mixin.$ = function $(sel) { <del> assert( <del> "You cannot access this.$() on a component with `tagName: ''` specified.", <del> this.tagName !== '' <del> ); <del> assert('You cannot access this.$() with `jQuery` disabled.', !jQueryDisabled); <del> deprecate( <del> 'Using this.$() in a component has been deprecated, consider using this.element', <del> false, <del> { <del> id: 'ember-views.curly-components.jquery-element', <del> until: '4.0.0', <del> url: 'https://deprecations.emberjs.com/v3.x#toc_jquery-apis', <del> for: 'ember-source', <del> since: { <del> enabled: '3.9.0', <del> }, <del> } <del> ); <del> if (this.element) { <del> return sel ? jQuery(sel, this.element) : jQuery(this.element); <del> } <del> }; <del>} <del> <ide> /** <ide> @class ViewMixin <ide> @namespace Ember
5
Text
Text
fix typo in the changelog_v6
80478a5240d2cafe51110fac43480f8827cc5930
<ide><path>doc/changelogs/CHANGELOG_V6.md <ide> October 2016. <ide> <ide> ### Notable changes <ide> <del>* **buffer**: Added `buffer.swap64()` to compliment `swap16()` & `swap32()`. (Zach Bjornson) [#7157](https://github.com/nodejs/node/pull/7157) <add>* **buffer**: Added `buffer.swap64()` to complement `swap16()` & `swap32()`. (Zach Bjornson) [#7157](https://github.com/nodejs/node/pull/7157) <ide> * **build**: New `configure` options have been added for building Node.js as a shared library. (Stefan Budeanu) [#6994](https://github.com/nodejs/node/pull/6994) <ide> - The options are: `--shared`, `--without-v8-platform` & `--without-bundled-v8`. <ide> * **crypto**: Root certificates have been updated. (Ben Noordhuis) [#7363](https://github.com/nodejs/node/pull/7363)
1
PHP
PHP
remove duplicate newlines according to cs
036954b52d7bbbbcd6986fdb65669f6dfc804245
<ide><path>lib/Cake/Test/Case/Controller/ComponentTest.php <ide> class SomethingWithEmailComponent extends Component { <ide> public $components = array('Email'); <ide> } <ide> <del> <ide> /** <ide> * ComponentTest class <ide> * <ide><path>lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php <ide> class MergePostsController extends MergeVarPluginAppController { <ide> public $uses = array(); <ide> } <ide> <del> <ide> /** <ide> * Test Case for Controller Merging of Vars. <ide> * <ide><path>lib/Cake/Test/Case/Controller/ControllerTest.php <ide> class ControllerTestAppController extends Controller { <ide> public $components = array('Cookie'); <ide> } <ide> <del> <ide> /** <ide> * ControllerPost class <ide> * <ide><path>lib/Cake/Test/Case/Error/ExceptionRendererTest.php <ide> public function missingWidgetThing() { <ide> class MissingWidgetThingException extends NotFoundException { <ide> } <ide> <del> <ide> /** <ide> * ExceptionRendererTest class <ide> * <ide><path>lib/Cake/Test/Case/Model/models.php <ide> class MyCategoriesMyProduct extends CakeTestModel { <ide> public $name = 'MyCategoriesMyProduct'; <ide> } <ide> <del> <ide> /** <ide> * NumberTree class <ide> * <ide><path>lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php <ide> class StringsTestFixture extends CakeTestFixture { <ide> ); <ide> } <ide> <del> <ide> /** <ide> * CakeTestFixtureImportFixture class <ide> * <ide> class FixturePrefixTest extends Model { <ide> public $useDbConfig = 'test'; <ide> } <ide> <del> <ide> /** <ide> * Test case for CakeTestFixture <ide> * <ide><path>lib/Cake/Test/Case/View/ViewTest.php <ide> public function afterLayout($layoutFile) { <ide> <ide> } <ide> <del> <ide> /** <ide> * ViewTest class <ide> *
7
PHP
PHP
add _ext test in route
9eca07a3002b2034c3dc65e44e11aa53095cc798
<ide><path>lib/Cake/Test/TestCase/Routing/Route/RouteTest.php <ide> public function testMatchWithPassedArgs() { <ide> $this->assertFalse($result); <ide> } <ide> <add>/** <add> * Test that extensions work. <add> * <add> * @return void <add> */ <add> public function testMatchWithExtension() { <add> $route = new Route('/:controller/:action'); <add> $result = $route->match(array( <add> 'controller' => 'posts', <add> 'action' => 'index', <add> '_ext' => 'json' <add> )); <add> $this->assertEquals('/posts/index.json', $result); <add> } <add> <ide> /** <ide> * test that match with patterns works. <ide> *
1
Ruby
Ruby
relocate all text files
b9cdfe21fc7c1dbfa2f6ce7a087a47556dfff5df
<ide><path>Library/Homebrew/keg.rb <ide> require "extend/pathname" <del>require "keg_fix_install_names" <add>require "keg_relocate" <ide> require "formula_lock" <ide> require "ostruct" <ide> <add><path>Library/Homebrew/keg_relocate.rb <del><path>Library/Homebrew/keg_fix_install_names.rb <ide> def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, optio <ide> end <ide> end <ide> <del> files = pkgconfig_files | libtool_files | script_files | plist_files <del> files << tab_file if tab_file.file? <del> <del> files.group_by { |f| f.stat.ino }.each_value do |first, *rest| <add> text_files.group_by { |f| f.stat.ino }.each_value do |first, *rest| <ide> s = first.open("rb", &:read) <ide> changed = s.gsub!(old_cellar, new_cellar) <ide> changed = s.gsub!(old_prefix, new_prefix) || changed <ide> def mach_o_files <ide> mach_o_files <ide> end <ide> <del> def script_files <del> script_files = [] <del> <del> # find all files with shebangs <del> find do |pn| <add> def text_files <add> text_files = [] <add> path.find do |pn| <ide> next if pn.symlink? or pn.directory? <del> script_files << pn if pn.text_executable? <del> end <del> <del> script_files <del> end <del> <del> def pkgconfig_files <del> pkgconfig_files = [] <del> <del> %w[lib share].each do |dir| <del> pcdir = path.join(dir, "pkgconfig") <del> <del> pcdir.find do |pn| <del> next if pn.symlink? or pn.directory? or pn.extname != '.pc' <del> pkgconfig_files << pn <del> end if pcdir.directory? <add> next if Metafiles::EXTENSIONS.include? pn.extname <add> text_files << pn if Utils.popen_read("/usr/bin/file", pn).include?("text") <ide> end <ide> <del> pkgconfig_files <del> end <del> <del> def libtool_files <del> libtool_files = [] <del> <del> # find .la files, which are stored in lib/ <del> lib.find do |pn| <del> next if pn.symlink? or pn.directory? or pn.extname != '.la' <del> libtool_files << pn <del> end if lib.directory? <del> libtool_files <del> end <del> <del> def plist_files <del> plist_files = [] <del> <del> self.find do |pn| <del> next if pn.symlink? or pn.directory? or pn.extname != '.plist' <del> plist_files << pn <del> end <del> plist_files <del> end <del> <del> def tab_file <del> join(Tab::FILENAME) <add> text_files <ide> end <ide> end
2
Java
Java
remove rxjava 1.x variants of webclient adapters
11aa920785151c76c381f482e8b3810ccf59929f
<ide><path>spring-web/src/main/java/org/springframework/web/client/reactive/support/RxJava1ClientWebRequestBuilder.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.web.client.reactive.support; <del> <del>import java.net.URI; <del> <del>import reactor.adapter.RxJava1Adapter; <del>import reactor.core.publisher.Mono; <del>import rx.Observable; <del>import rx.Single; <del> <del>import org.springframework.core.ResolvableType; <del>import org.springframework.http.HttpCookie; <del>import org.springframework.http.HttpHeaders; <del>import org.springframework.http.HttpMethod; <del>import org.springframework.http.MediaType; <del>import org.springframework.http.client.reactive.ClientHttpRequest; <del>import org.springframework.web.client.RestClientException; <del>import org.springframework.web.client.reactive.ClientWebRequest; <del>import org.springframework.web.client.reactive.ClientWebRequestBuilder; <del>import org.springframework.web.client.reactive.ClientWebRequestPostProcessor; <del>import org.springframework.web.client.reactive.DefaultClientWebRequestBuilder; <del> <del>/** <del> * Builds a {@link ClientHttpRequest} using a {@code Observable} <del> * or {@code Single} as request body. <del> * <del> * <p>See static factory methods in {@link RxJava1ClientWebRequestBuilders} <del> * <del> * @author Brian Clozel <del> * @see RxJava1ClientWebRequestBuilders <del> */ <del>public class RxJava1ClientWebRequestBuilder implements ClientWebRequestBuilder { <del> <del> private final DefaultClientWebRequestBuilder delegate; <del> <del> public RxJava1ClientWebRequestBuilder(HttpMethod httpMethod, String urlTemplate, <del> Object... urlVariables) throws RestClientException { <del> this.delegate = new DefaultClientWebRequestBuilder(httpMethod, urlTemplate, urlVariables); <del> } <del> <del> public RxJava1ClientWebRequestBuilder(HttpMethod httpMethod, URI url) { <del> this.delegate = new DefaultClientWebRequestBuilder(httpMethod, url); <del> } <del> <del> /** <del> * Add an HTTP request header <del> */ <del> public RxJava1ClientWebRequestBuilder header(String name, String... values) { <del> this.delegate.header(name, values); <del> return this; <del> } <del> <del> /** <del> * Add all provided HTTP request headers <del> */ <del> public RxJava1ClientWebRequestBuilder headers(HttpHeaders httpHeaders) { <del> this.delegate.headers(httpHeaders); <del> return this; <del> } <del> <del> /** <del> * Set the Content-Type request header to the given {@link MediaType} <del> */ <del> public RxJava1ClientWebRequestBuilder contentType(MediaType contentType) { <del> this.delegate.contentType(contentType); <del> return this; <del> } <del> <del> /** <del> * Set the Content-Type request header to the given media type <del> */ <del> public RxJava1ClientWebRequestBuilder contentType(String contentType) { <del> this.delegate.contentType(contentType); <del> return this; <del> } <del> <del> /** <del> * Set the Accept request header to the given {@link MediaType}s <del> */ <del> public RxJava1ClientWebRequestBuilder accept(MediaType... mediaTypes) { <del> this.delegate.accept(mediaTypes); <del> return this; <del> } <del> <del> /** <del> * Set the Accept request header to the given media types <del> */ <del> public RxJava1ClientWebRequestBuilder accept(String... mediaTypes) { <del> this.delegate.accept(mediaTypes); <del> return this; <del> } <del> <del> /** <del> * Add a Cookie to the HTTP request <del> */ <del> public RxJava1ClientWebRequestBuilder cookie(String name, String value) { <del> this.delegate.cookie(name, value); <del> return this; <del> } <del> <del> /** <del> * Add a Cookie to the HTTP request <del> */ <del> public RxJava1ClientWebRequestBuilder cookie(HttpCookie cookie) { <del> this.delegate.cookie(cookie); <del> return this; <del> } <del> <del> /** <del> * Allows performing more complex operations with a strategy. For example, a <del> * {@link ClientWebRequestPostProcessor} implementation might accept the arguments of username <del> * and password and set an HTTP Basic authentication header. <del> * <del> * @param postProcessor the {@link ClientWebRequestPostProcessor} to use. Cannot be null. <del> * <del> * @return this instance for further modifications. <del> */ <del> public RxJava1ClientWebRequestBuilder apply(ClientWebRequestPostProcessor postProcessor) { <del> this.delegate.apply(postProcessor); <del> return this; <del> } <del> <del> /** <del> * Use the given object as the request body <del> */ <del> public RxJava1ClientWebRequestBuilder body(Object content) { <del> this.delegate.body(Mono.just(content), ResolvableType.forInstance(content)); <del> return this; <del> } <del> <del> /** <del> * Use the given {@link Single} as the request body and use its {@link ResolvableType} <del> * as type information for the element published by this reactive stream <del> */ <del> public RxJava1ClientWebRequestBuilder body(Single<?> content, ResolvableType elementType) { <del> this.delegate.body(RxJava1Adapter.singleToMono(content), elementType); <del> return this; <del> } <del> <del> /** <del> * Use the given {@link Observable} as the request body and use its {@link ResolvableType} <del> * as type information for the elements published by this reactive stream <del> */ <del> public RxJava1ClientWebRequestBuilder body(Observable<?> content, ResolvableType elementType) { <del> this.delegate.body(RxJava1Adapter.observableToFlux(content), elementType); <del> return this; <del> } <del> <del> @Override <del> public ClientWebRequest build() { <del> return this.delegate.build(); <del> } <del> <del>} <ide><path>spring-web/src/main/java/org/springframework/web/client/reactive/support/RxJava1ClientWebRequestBuilders.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.web.client.reactive.support; <del> <del>import org.springframework.http.HttpMethod; <del> <del>/** <del> * Static factory methods for {@link RxJava1ClientWebRequestBuilder ClientWebRequestBuilders} <del> * using the {@link rx.Observable} and {@link rx.Single} API. <del> * <del> * @author Brian Clozel <del> */ <del>public abstract class RxJava1ClientWebRequestBuilders { <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a GET request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder get(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.GET, urlTemplate, urlVariables); <del> } <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a POST request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder post(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.POST, urlTemplate, urlVariables); <del> } <del> <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a PUT request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder put(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.PUT, urlTemplate, urlVariables); <del> } <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a PATCH request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder patch(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.PATCH, urlTemplate, urlVariables); <del> } <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a DELETE request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder delete(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.DELETE, urlTemplate, urlVariables); <del> } <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for an OPTIONS request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder options(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.OPTIONS, urlTemplate, urlVariables); <del> } <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a HEAD request. <del> * <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder head(String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(HttpMethod.HEAD, urlTemplate, urlVariables); <del> } <del> <del> /** <del> * Create a {@link RxJava1ClientWebRequestBuilder} for a request with the given HTTP method. <del> * <del> * @param httpMethod the HTTP method <del> * @param urlTemplate a URL template; the resulting URL will be encoded <del> * @param urlVariables zero or more URL variables <del> */ <del> public static RxJava1ClientWebRequestBuilder request(HttpMethod httpMethod, String urlTemplate, Object... urlVariables) { <del> return new RxJava1ClientWebRequestBuilder(httpMethod, urlTemplate, urlVariables); <del> } <del>} <ide><path>spring-web/src/main/java/org/springframework/web/client/reactive/support/RxJava1ResponseExtractors.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.web.client.reactive.support; <del> <del>import java.util.Collections; <del>import java.util.List; <del> <del>import reactor.adapter.RxJava1Adapter; <del>import reactor.core.publisher.Flux; <del>import reactor.core.publisher.Mono; <del>import rx.Observable; <del>import rx.Single; <del> <del>import org.springframework.core.ResolvableType; <del>import org.springframework.http.HttpHeaders; <del>import org.springframework.http.MediaType; <del>import org.springframework.http.ResponseEntity; <del>import org.springframework.http.client.reactive.ClientHttpResponse; <del>import org.springframework.http.codec.HttpMessageReader; <del>import org.springframework.web.client.reactive.BodyExtractor; <del>import org.springframework.web.client.reactive.ResponseExtractor; <del>import org.springframework.web.client.reactive.WebClientException; <del> <del>/** <del> * Static factory methods for {@link ResponseExtractor} and {@link BodyExtractor}, <del> * based on the {@link Observable} and {@link Single} APIs. <del> * <del> * @author Brian Clozel <del> * @since 5.0 <del> */ <del>public class RxJava1ResponseExtractors { <del> <del> /** <del> * Extract the response body and decode it, returning it as a {@code Single<T>}. <del> * @see ResolvableType#forClassWithGenerics(Class, Class[]) <del> */ <del> @SuppressWarnings("unchecked") <del> public static <T> ResponseExtractor<Single<T>> body(ResolvableType bodyType) { <del> <del> return (clientResponse, webClientConfig) -> (Single<T>) RxJava1Adapter <del> .publisherToSingle(clientResponse <del> .doOnNext(response -> webClientConfig.getResponseErrorHandler() <del> .handleError(response, webClientConfig.getMessageReaders())) <del> .flatMap(resp -> decodeResponseBodyAsMono(resp, bodyType, webClientConfig.getMessageReaders()))); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as a {@code Single<T>}. <del> */ <del> public static <T> ResponseExtractor<Single<T>> body(Class<T> sourceClass) { <del> ResolvableType bodyType = ResolvableType.forClass(sourceClass); <del> return body(bodyType); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as a {@code Single<T>}. <del> * @see ResolvableType#forClassWithGenerics(Class, Class[]) <del> */ <del> @SuppressWarnings("unchecked") <del> public static <T> BodyExtractor<Single<T>> as(ResolvableType bodyType) { <del> return (clientResponse, messageConverters) -> <del> (Single<T>) RxJava1Adapter.publisherToSingle( <del> decodeResponseBodyAsMono(clientResponse, bodyType, messageConverters)); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as a {@code Single<T>} <del> */ <del> public static <T> BodyExtractor<Single<T>> as(Class<T> sourceClass) { <del> ResolvableType bodyType = ResolvableType.forClass(sourceClass); <del> return as(bodyType); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as an {@code Observable<T>} <del> * @see ResolvableType#forClassWithGenerics(Class, Class[]) <del> */ <del> public static <T> ResponseExtractor<Observable<T>> bodyStream(ResolvableType bodyType) { <del> <del> return (clientResponse, webClientConfig) -> RxJava1Adapter <del> .publisherToObservable(clientResponse <del> .doOnNext(response -> webClientConfig.getResponseErrorHandler() <del> .handleError(response, webClientConfig.getMessageReaders())) <del> .flatMap(resp -> decodeResponseBody(resp, bodyType, webClientConfig.getMessageReaders()))); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as an {@code Observable<T>}. <del> */ <del> public static <T> ResponseExtractor<Observable<T>> bodyStream(Class<T> sourceClass) { <del> <del> ResolvableType bodyType = ResolvableType.forClass(sourceClass); <del> return bodyStream(bodyType); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as a {@code Observable<T>}. <del> * @see ResolvableType#forClassWithGenerics(Class, Class[]) <del> */ <del> @SuppressWarnings("unchecked") <del> public static <T> BodyExtractor<Observable<T>> asStream(ResolvableType bodyType) { <del> return (clientResponse, messageConverters) -> <del> (Observable<T>) RxJava1Adapter <del> .publisherToObservable(decodeResponseBody(clientResponse, bodyType, messageConverters)); <del> } <del> <del> /** <del> * Extract the response body and decode it, returning it as a {@code Observable<T>}. <del> */ <del> public static <T> BodyExtractor<Observable<T>> asStream(Class<T> sourceClass) { <del> ResolvableType bodyType = ResolvableType.forClass(sourceClass); <del> return asStream(bodyType); <del> } <del> <del> /** <del> * Extract the full response body as a {@code ResponseEntity} <del> * with its body decoded as a single type {@code T}. <del> * @see ResolvableType#forClassWithGenerics(Class, Class[]) <del> */ <del> @SuppressWarnings("unchecked") <del> public static <T> ResponseExtractor<Single<ResponseEntity<T>>> response(ResolvableType bodyType) { <del> <del> return (clientResponse, webClientConfig) -> <del> RxJava1Adapter.publisherToSingle(clientResponse <del> .then(response -> <del> Mono.when( <del> decodeResponseBody(response, bodyType, webClientConfig.getMessageReaders()).next(), <del> Mono.just(response.getHeaders()), <del> Mono.just(response.getStatusCode()))) <del> .map(tuple -> <del> new ResponseEntity<>((T) tuple.getT1(), tuple.getT2(), tuple.getT3()))); <del> } <del> <del> /** <del> * Extract the full response body as a {@code ResponseEntity} <del> * with its body decoded as a single type {@code T}. <del> */ <del> public static <T> ResponseExtractor<Single<ResponseEntity<T>>> response(Class<T> sourceClass) { <del> <del> ResolvableType bodyType = ResolvableType.forClass(sourceClass); <del> return response(bodyType); <del> } <del> <del> /** <del> * Extract the full response body as a {@code ResponseEntity} <del> * with its body decoded as an {@code Observable<T>}. <del> */ <del> public static <T> ResponseExtractor<Single<ResponseEntity<Observable<T>>>> responseStream(Class<T> sourceClass) { <del> ResolvableType resolvableType = ResolvableType.forClass(sourceClass); <del> return responseStream(resolvableType); <del> } <del> <del> /** <del> * Extract the full response body as a {@code ResponseEntity} <del> * with its body decoded as an {@code Observable<T>} <del> * @see ResolvableType#forClassWithGenerics(Class, Class[]) <del> */ <del> public static <T> ResponseExtractor<Single<ResponseEntity<Observable<T>>>> responseStream(ResolvableType bodyType) { <del> return (clientResponse, webClientConfig) -> RxJava1Adapter.publisherToSingle(clientResponse <del> .map(response -> new ResponseEntity<>( <del> RxJava1Adapter <del> .publisherToObservable( <del> // RxJava1ResponseExtractors.<T> is required for Eclipse JDT. <del> RxJava1ResponseExtractors.<T> decodeResponseBody(response, bodyType, webClientConfig.getMessageReaders())), <del> response.getHeaders(), <del> response.getStatusCode()))); <del> } <del> <del> /** <del> * Extract the response headers as an {@code HttpHeaders} instance. <del> */ <del> public static ResponseExtractor<Single<HttpHeaders>> headers() { <del> return (clientResponse, messageConverters) -> RxJava1Adapter <del> .publisherToSingle(clientResponse.map(resp -> resp.getHeaders())); <del> } <del> <del> @SuppressWarnings("unchecked") <del> protected static <T> Flux<T> decodeResponseBody(ClientHttpResponse response, <del> ResolvableType responseType, List<HttpMessageReader<?>> messageReaders) { <del> <del> MediaType contentType = response.getHeaders().getContentType(); <del> HttpMessageReader<?> converter = resolveMessageReader(messageReaders, responseType, contentType); <del> return (Flux<T>) converter.read(responseType, response, Collections.emptyMap()); <del> } <del> <del> @SuppressWarnings("unchecked") <del> protected static <T> Mono<T> decodeResponseBodyAsMono(ClientHttpResponse response, <del> ResolvableType responseType, List<HttpMessageReader<?>> messageReaders) { <del> <del> MediaType contentType = response.getHeaders().getContentType(); <del> HttpMessageReader<?> converter = resolveMessageReader(messageReaders, responseType, contentType); <del> return (Mono<T>) converter.readMono(responseType, response, Collections.emptyMap()); <del> } <del> <del> protected static HttpMessageReader<?> resolveMessageReader(List<HttpMessageReader<?>> messageReaders, <del> ResolvableType responseType, MediaType contentType) { <del> <del> return messageReaders.stream() <del> .filter(e -> e.canRead(responseType, contentType)) <del> .findFirst() <del> .orElseThrow(() -> <del> new WebClientException( <del> "Could not decode response body of type '" + contentType <del> + "' with target type '" + responseType.toString() + "'")); <del> } <del> <del>} <ide><path>spring-web/src/main/java/org/springframework/web/client/reactive/support/package-info.java <del>/** <del> * Support classes for the reactive WebClient. <del> */ <del>package org.springframework.web.client.reactive.support; <ide><path>spring-web/src/test/java/org/springframework/web/client/reactive/RxJava1WebClientIntegrationTests.java <del>/* <del> * Copyright 2002-2016 the original author or authors. <del> * <del> * Licensed under the Apache License, Version 2.0 (the "License"); <del> * you may not use this file except in compliance with the License. <del> * You may obtain a copy of the License at <del> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <del> * <del> * Unless required by applicable law or agreed to in writing, software <del> * distributed under the License is distributed on an "AS IS" BASIS, <del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <del> * See the License for the specific language governing permissions and <del> * limitations under the License. <del> */ <del> <del>package org.springframework.web.client.reactive; <del> <del>import static org.junit.Assert.*; <del>import static org.springframework.web.client.reactive.support.RxJava1ClientWebRequestBuilders.*; <del>import static org.springframework.web.client.reactive.support.RxJava1ResponseExtractors.*; <del> <del>import java.util.concurrent.TimeUnit; <del> <del>import okhttp3.HttpUrl; <del>import okhttp3.mockwebserver.MockResponse; <del>import okhttp3.mockwebserver.MockWebServer; <del>import okhttp3.mockwebserver.RecordedRequest; <del>import org.hamcrest.Matchers; <del>import org.junit.After; <del>import org.junit.Before; <del>import org.junit.Test; <del>import rx.Observable; <del>import rx.Single; <del>import rx.observers.TestSubscriber; <del> <del>import org.springframework.http.HttpHeaders; <del>import org.springframework.http.MediaType; <del>import org.springframework.http.ResponseEntity; <del>import org.springframework.http.client.reactive.ReactorClientHttpConnector; <del>import org.springframework.http.codec.Pojo; <del> <del>/** <del> * {@link WebClient} integration tests with the {@code Observable} and {@code Single} API. <del> * <del> * @author Brian Clozel <del> */ <del>public class RxJava1WebClientIntegrationTests { <del> <del> private MockWebServer server; <del> <del> private WebClient webClient; <del> <del> @Before <del> public void setup() { <del> this.server = new MockWebServer(); <del> this.webClient = new WebClient(new ReactorClientHttpConnector()); <del> } <del> <del> @Test <del> public void shouldGetHeaders() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/greeting?name=Spring"); <del> this.server.enqueue(new MockResponse().setHeader("Content-Type", "text/plain").setBody("Hello Spring!")); <del> <del> Single<HttpHeaders> result = this.webClient <del> .perform(get(baseUrl.toString())) <del> .extract(headers()); <del> <del> TestSubscriber<HttpHeaders> ts = new TestSubscriber<HttpHeaders>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> HttpHeaders httpHeaders = ts.getOnNextEvents().get(0); <del> assertEquals(MediaType.TEXT_PLAIN, httpHeaders.getContentType()); <del> assertEquals(13L, httpHeaders.getContentLength()); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("*/*", request.getHeader(HttpHeaders.ACCEPT)); <del> assertEquals("/greeting?name=Spring", request.getPath()); <del> } <del> <del> @Test <del> public void shouldGetPlainTextResponseAsObject() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/greeting?name=Spring"); <del> this.server.enqueue(new MockResponse().setBody("Hello Spring!")); <del> <del> Single<String> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .header("X-Test-Header", "testvalue")) <del> .extract(body(String.class)); <del> <del> TestSubscriber<String> ts = new TestSubscriber<String>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> String response = ts.getOnNextEvents().get(0); <del> assertEquals("Hello Spring!", response); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("testvalue", request.getHeader("X-Test-Header")); <del> assertEquals("*/*", request.getHeader(HttpHeaders.ACCEPT)); <del> assertEquals("/greeting?name=Spring", request.getPath()); <del> } <del> <del> @Test <del> public void shouldGetPlainTextResponse() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/greeting?name=Spring"); <del> this.server.enqueue(new MockResponse().setHeader("Content-Type", "text/plain").setBody("Hello Spring!")); <del> <del> Single<ResponseEntity<String>> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .accept(MediaType.TEXT_PLAIN)) <del> .extract(response(String.class)); <del> <del> TestSubscriber<ResponseEntity<String>> ts = new TestSubscriber<ResponseEntity<String>>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> ResponseEntity<String> response = ts.getOnNextEvents().get(0); <del> assertEquals(200, response.getStatusCode().value()); <del> assertEquals(MediaType.TEXT_PLAIN, response.getHeaders().getContentType()); <del> assertEquals("Hello Spring!", response.getBody()); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/greeting?name=Spring", request.getPath()); <del> assertEquals("text/plain", request.getHeader(HttpHeaders.ACCEPT)); <del> } <del> <del> @Test <del> public void shouldGetJsonAsMonoOfString() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/json"); <del> String content = "{\"bar\":\"barbar\",\"foo\":\"foofoo\"}"; <del> this.server.enqueue(new MockResponse().setHeader("Content-Type", "application/json") <del> .setBody(content)); <del> <del> Single<String> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .accept(MediaType.APPLICATION_JSON)) <del> .extract(body(String.class)); <del> <del> TestSubscriber<String> ts = new TestSubscriber<String>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> String response = ts.getOnNextEvents().get(0); <del> assertEquals(content, response); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/json", request.getPath()); <del> assertEquals("application/json", request.getHeader(HttpHeaders.ACCEPT)); <del> } <del> <del> @Test <del> public void shouldGetJsonAsMonoOfPojo() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/pojo"); <del> this.server.enqueue(new MockResponse().setHeader("Content-Type", "application/json") <del> .setBody("{\"bar\":\"barbar\",\"foo\":\"foofoo\"}")); <del> <del> Single<Pojo> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .accept(MediaType.APPLICATION_JSON)) <del> .extract(body(Pojo.class)); <del> <del> TestSubscriber<Pojo> ts = new TestSubscriber<Pojo>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> Pojo response = ts.getOnNextEvents().get(0); <del> assertEquals("barbar", response.getBar()); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/pojo", request.getPath()); <del> assertEquals("application/json", request.getHeader(HttpHeaders.ACCEPT)); <del> } <del> <del> @Test <del> public void shouldGetJsonAsFluxOfPojos() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/pojos"); <del> this.server.enqueue(new MockResponse().setHeader("Content-Type", "application/json") <del> .setBody("[{\"bar\":\"bar1\",\"foo\":\"foo1\"},{\"bar\":\"bar2\",\"foo\":\"foo2\"}]")); <del> <del> Observable<Pojo> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .accept(MediaType.APPLICATION_JSON)) <del> .extract(bodyStream(Pojo.class)); <del> <del> TestSubscriber<Pojo> ts = new TestSubscriber<Pojo>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> assertThat(ts.getOnNextEvents().get(0).getBar(), Matchers.is("bar1")); <del> assertThat(ts.getOnNextEvents().get(1).getBar(), Matchers.is("bar2")); <del> ts.assertValueCount(2); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/pojos", request.getPath()); <del> assertEquals("application/json", request.getHeader(HttpHeaders.ACCEPT)); <del> } <del> <del> @Test <del> public void shouldGetJsonAsResponseOfPojosStream() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/pojos"); <del> this.server.enqueue(new MockResponse().setHeader("Content-Type", "application/json") <del> .setBody("[{\"bar\":\"bar1\",\"foo\":\"foo1\"},{\"bar\":\"bar2\",\"foo\":\"foo2\"}]")); <del> <del> Single<ResponseEntity<Observable<Pojo>>> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .accept(MediaType.APPLICATION_JSON)) <del> .extract(responseStream(Pojo.class)); <del> <del> TestSubscriber<ResponseEntity<Observable<Pojo>>> ts = new TestSubscriber<ResponseEntity<Observable<Pojo>>>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> ResponseEntity<Observable<Pojo>> response = ts.getOnNextEvents().get(0); <del> assertEquals(200, response.getStatusCode().value()); <del> assertEquals(MediaType.APPLICATION_JSON, response.getHeaders().getContentType()); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/pojos", request.getPath()); <del> assertEquals("application/json", request.getHeader(HttpHeaders.ACCEPT)); <del> } <del> <del> @Test <del> public void shouldPostPojoAsJson() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/pojo/capitalize"); <del> this.server.enqueue(new MockResponse() <del> .setHeader("Content-Type", "application/json") <del> .setBody("{\"bar\":\"BARBAR\",\"foo\":\"FOOFOO\"}")); <del> <del> Pojo spring = new Pojo("foofoo", "barbar"); <del> Single<Pojo> result = this.webClient <del> .perform(post(baseUrl.toString()) <del> .body(spring) <del> .contentType(MediaType.APPLICATION_JSON) <del> .accept(MediaType.APPLICATION_JSON)) <del> .extract(body(Pojo.class)); <del> <del> TestSubscriber<Pojo> ts = new TestSubscriber<Pojo>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> assertThat(ts.getOnNextEvents().get(0).getBar(), Matchers.is("BARBAR")); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/pojo/capitalize", request.getPath()); <del> assertEquals("{\"foo\":\"foofoo\",\"bar\":\"barbar\"}", request.getBody().readUtf8()); <del> assertEquals("chunked", request.getHeader(HttpHeaders.TRANSFER_ENCODING)); <del> assertEquals("application/json", request.getHeader(HttpHeaders.ACCEPT)); <del> assertEquals("application/json", request.getHeader(HttpHeaders.CONTENT_TYPE)); <del> } <del> <del> @Test <del> public void shouldSendCookieHeader() throws Exception { <del> HttpUrl baseUrl = server.url("/test"); <del> this.server.enqueue(new MockResponse() <del> .setHeader("Content-Type", "text/plain").setBody("test")); <del> <del> Single<String> result = this.webClient <del> .perform(get(baseUrl.toString()) <del> .cookie("testkey", "testvalue")) <del> .extract(body(String.class)); <del> <del> TestSubscriber<String> ts = new TestSubscriber<String>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> String response = ts.getOnNextEvents().get(0); <del> assertEquals("test", response); <del> ts.assertValueCount(1); <del> ts.assertCompleted(); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("/test", request.getPath()); <del> assertEquals("testkey=testvalue", request.getHeader(HttpHeaders.COOKIE)); <del> } <del> <del> @Test <del> public void shouldGetErrorWhen404() throws Exception { <del> <del> HttpUrl baseUrl = server.url("/greeting?name=Spring"); <del> this.server.enqueue(new MockResponse().setResponseCode(404) <del> .setHeader("Content-Type", "text/plain").setBody("Not Found")); <del> <del> Single<String> result = this.webClient <del> .perform(get(baseUrl.toString())) <del> .extract(body(String.class)); <del> <del> TestSubscriber<String> ts = new TestSubscriber<String>(); <del> result.subscribe(ts); <del> ts.awaitTerminalEvent(2, TimeUnit.SECONDS); <del> <del> ts.assertError(WebClientErrorException.class); <del> WebClientErrorException exc = (WebClientErrorException) ts.getOnErrorEvents().get(0); <del> assertEquals(404, exc.getStatus().value()); <del> assertEquals(MediaType.TEXT_PLAIN, exc.getResponseHeaders().getContentType()); <del> <del> RecordedRequest request = server.takeRequest(); <del> assertEquals(1, server.getRequestCount()); <del> assertEquals("*/*", request.getHeader(HttpHeaders.ACCEPT)); <del> assertEquals("/greeting?name=Spring", request.getPath()); <del> } <del> <del> @After <del> public void tearDown() throws Exception { <del> this.server.shutdown(); <del> } <del> <del>}
5
Ruby
Ruby
require clt on 10.9
ed3343565a6b02f85d6e0a21b8f64be81c1cd0a3
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_for_broken_symlinks <ide> end <ide> <ide> def check_xcode_clt <del> if MacOS::Xcode.installed? <add> if MacOS.version >= :mavericks <add> __check_clt_up_to_date <add> elsif MacOS::Xcode.installed? <ide> __check_xcode_up_to_date <ide> elsif MacOS.version >= :lion <ide> __check_clt_up_to_date
1
PHP
PHP
contain verbose debug
6d9aaea8213254b05c156b968240377cb26c350f
<ide><path>src/TestSuite/Constraint/Console/ContentsContain.php <ide> public function matches($other): bool <ide> */ <ide> public function toString(): string <ide> { <del> return sprintf('is in %s', $this->output); <add> return sprintf('is in %s,' . PHP_EOL . 'actual result:' . PHP_EOL . $this->contents, $this->output); <ide> } <ide> } <ide><path>tests/TestCase/TestSuite/ConsoleIntegrationTestTraitTest.php <ide> public function testCommandStringToArgs() <ide> public function testAssertionFailureMessages($assertion, $message, $command, ...$rest) <ide> { <ide> $this->expectException(AssertionFailedError::class); <del> $this->expectExceptionMessage($message); <add> $this->expectExceptionMessageMatches('#' . preg_quote($message, '#') . '.?#'); <ide> <ide> $this->useCommandRunner(); <ide> $this->exec($command); <ide> public function testAssertionFailureMessages($assertion, $message, $command, ... <ide> public function assertionFailureMessagesProvider() <ide> { <ide> return [ <del> 'assertExitCode' => ['assertExitCode', 'Failed asserting that 1 matches exit code 0.', 'routes', Shell::CODE_ERROR], <del> 'assertOutputEmpty' => ['assertOutputEmpty', 'Failed asserting that output is empty.', 'routes'], <del> 'assertOutputContains' => ['assertOutputContains', 'Failed asserting that \'missing\' is in output.', 'routes', 'missing'], <del> 'assertOutputNotContains' => ['assertOutputNotContains', 'Failed asserting that \'controller\' is not in output.', 'routes', 'controller'], <del> 'assertOutputRegExp' => ['assertOutputRegExp', 'Failed asserting that `/missing/` PCRE pattern found in output.', 'routes', '/missing/'], <del> 'assertOutputContainsRow' => ['assertOutputContainsRow', 'Failed asserting that `Array (...)` row was in output.', 'routes', ['test', 'missing']], <del> 'assertErrorContains' => ['assertErrorContains', 'Failed asserting that \'test\' is in error output.', 'routes', 'test'], <del> 'assertErrorRegExp' => ['assertErrorRegExp', 'Failed asserting that `/test/` PCRE pattern found in error output.', 'routes', '/test/'], <del> 'assertErrorEmpty' => ['assertErrorEmpty', 'Failed asserting that error output is empty.', 'integration args_and_options'], <add> 'assertExitCode' => ['assertExitCode', 'Failed asserting that 1 matches exit code 0', 'routes', Shell::CODE_ERROR], <add> 'assertOutputEmpty' => ['assertOutputEmpty', 'Failed asserting that output is empty', 'routes'], <add> 'assertOutputContains' => ['assertOutputContains', 'Failed asserting that \'missing\' is in output', 'routes', 'missing'], <add> 'assertOutputNotContains' => ['assertOutputNotContains', 'Failed asserting that \'controller\' is not in output', 'routes', 'controller'], <add> 'assertOutputRegExp' => ['assertOutputRegExp', 'Failed asserting that `/missing/` PCRE pattern found in output', 'routes', '/missing/'], <add> 'assertOutputContainsRow' => ['assertOutputContainsRow', 'Failed asserting that `Array (...)` row was in output', 'routes', ['test', 'missing']], <add> 'assertErrorContains' => ['assertErrorContains', 'Failed asserting that \'test\' is in error output', 'routes', 'test'], <add> 'assertErrorRegExp' => ['assertErrorRegExp', 'Failed asserting that `/test/` PCRE pattern found in error output', 'routes', '/test/'], <add> 'assertErrorEmpty' => ['assertErrorEmpty', 'Failed asserting that error output is empty', 'integration args_and_options'], <ide> ]; <ide> } <ide> }
2
PHP
PHP
fix failing test
ffb812c44502a2f19293c47cbf28b992f1f8ceec
<ide><path>tests/Database/DatabaseConnectionTest.php <ide> public function testTransactionRetriesOnSerializationFailure() <ide> <ide> $pdo = $this->getMockBuilder(DatabaseConnectionTestMockPDO::class)->setMethods(['beginTransaction', 'commit', 'rollBack'])->getMock(); <ide> $mock = $this->getMockConnection([], $pdo); <del> $pdo->method('commit')->will($this->throwException(new DatabaseConnectionTestMockPDOException('Serialization failure', '40001'))); <add> $pdo->expects($this->exactly(3))->method('commit')->will($this->throwException(new DatabaseConnectionTestMockPDOException('Serialization failure', '40001'))); <ide> $pdo->expects($this->exactly(3))->method('beginTransaction'); <ide> $pdo->expects($this->never())->method('rollBack'); <del> $pdo->expects($this->exactly(3))->method('commit'); <ide> $mock->transaction(function () { <ide> }, 3); <ide> }
1
PHP
PHP
move fixture cleanup to teardown
e6bf47ee2d51c8344e7382e267fc39cee70778d3
<ide><path>src/TestSuite/Fixture/TruncationStrategy.php <ide> public function __construct(FixtureLoader $loader) <ide> * <ide> * @return void <ide> */ <del> public function setupTest(): void <add> public function teardownTest(): void <ide> { <ide> $connections = ConnectionManager::configured(); <ide> foreach ($connections as $connection) { <ide> public function setupTest(): void <ide> * <ide> * @return void <ide> */ <del> public function teardownTest(): void <add> public function setupTest(): void <ide> { <ide> } <ide> <ide><path>tests/TestCase/TestSuite/Fixture/TruncationStrategyTest.php <ide> class TruncationStrategyTest extends TestCase <ide> /** <ide> * Test that beforeTest truncates tables from the previous test <ide> */ <del> public function testSetupSimple(): void <add> public function testTeardownSimple(): void <ide> { <ide> $articles = TableRegistry::get('Articles'); <ide> $articlesTags = TableRegistry::get('ArticlesTags'); <ide> public function testSetupSimple(): void <ide> $this->assertGreaterThan(0, $rowCount); <ide> <ide> $strategy = new TruncationStrategy($this->fixtureManager); <del> $strategy->setupTest(); <add> $strategy->teardownTest(); <ide> <ide> $rowCount = $articles->find()->count(); <ide> $this->assertEquals(0, $rowCount);
2
PHP
PHP
apply fixes from styleci
6c0ffe3b274aeff16661efc33921ae5211b5f7d2
<ide><path>tests/Validation/ValidationValidatorTest.php <ide> public function message() <ide> $this->assertSame('my custom message', $v->messages()->first('name')); <ide> <ide> $trans = $this->getIlluminateArrayTranslator(); <del> $v = new Validator($trans, ['name' => 'Ryan'], ['name' => $rule], ['name.' . $rule::class => 'my custom message']); <add> $v = new Validator($trans, ['name' => 'Ryan'], ['name' => $rule], ['name.'.$rule::class => 'my custom message']); <ide> $this->assertFalse($v->passes()); <ide> $v->messages()->setFormat(':message'); <ide> $this->assertSame('my custom message', $v->messages()->first('name')); <ide> <ide> $trans = $this->getIlluminateArrayTranslator(); <del> $v = new Validator($trans, ['name' => ['foo', 'bar']], ['name.*' => $rule], ['name.*.' . $rule::class => 'my custom message']); <add> $v = new Validator($trans, ['name' => ['foo', 'bar']], ['name.*' => $rule], ['name.*.'.$rule::class => 'my custom message']); <ide> $this->assertFalse($v->passes()); <ide> $v->messages()->setFormat(':message'); <ide> $this->assertSame('my custom message', $v->messages()->first('name.0'));
1
Javascript
Javascript
add side effects to avoid optimization
6d64eb0eae2986a18a688f64e40d039b54100c27
<ide><path>test/cases/parsing/webpack-is-included/moduleUnused.js <ide> export default 2; <add>console.log.bind(); <ide><path>test/cases/parsing/webpack-is-included/moduleUsed.js <ide> export default 1; <add>console.log.bind();
2
PHP
PHP
add missing import at redisbroadcaster
9edd86235328fa805b9ad23eb7f6a61d04562b2e
<ide><path>src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php <ide> namespace Illuminate\Broadcasting\Broadcasters; <ide> <ide> use Illuminate\Support\Arr; <add>use Illuminate\Support\Str; <ide> use Illuminate\Contracts\Redis\Database as RedisDatabase; <ide> use Symfony\Component\HttpKernel\Exception\HttpException; <ide>
1
Javascript
Javascript
remove unused popup classes
295889b36b15d9f4b296384c347b780bfb8d42e2
<ide><path>src/js/popup/popup-button.js <del>/** <del> * @file popup-button.js <del> */ <del>import ClickableComponent from '../clickable-component.js'; <del>import Component from '../component.js'; <del> <del>/** <del> * A button class for use with {@link Popup} controls <del> * <del> * @extends ClickableComponent <del> */ <del>class PopupButton extends ClickableComponent { <del> <del> /** <del> * Create an instance of this class. <del> * <del> * @param {Player} player <del> * The `Player` that this class should be attached to. <del> * <del> * @param {Object} [options] <del> * The key/value store of player options. <del> */ <del> constructor(player, options = {}) { <del> super(player, options); <del> <del> this.update(); <del> } <del> <del> /** <del> * Update the `Popup` that this button is attached to. <del> */ <del> update() { <del> const popup = this.createPopup(); <del> <del> if (this.popup) { <del> this.removeChild(this.popup); <del> } <del> <del> this.popup = popup; <del> this.addChild(popup); <del> <del> if (this.items && this.items.length === 0) { <del> this.hide(); <del> } else if (this.items && this.items.length > 1) { <del> this.show(); <del> } <del> } <del> <del> /** <del> * Create a `Popup`. - Override with specific functionality for component <del> * <del> * @abstract <del> */ <del> createPopup() {} <del> <del> /** <del> * Create the `PopupButton`s DOM element. <del> * <del> * @return {Element} <del> * The element that gets created. <del> */ <del> createEl() { <del> return super.createEl('div', { <del> className: this.buildCSSClass() <del> }); <del> } <del> <del> /** <del> * Builds the default DOM `className`. <del> * <del> * @return {string} <del> * The DOM `className` for this object. <del> */ <del> buildCSSClass() { <del> let menuButtonClass = 'vjs-menu-button'; <del> <del> // If the inline option is passed, we want to use different styles altogether. <del> if (this.options_.inline === true) { <del> menuButtonClass += '-inline'; <del> } else { <del> menuButtonClass += '-popup'; <del> } <del> <del> return `vjs-menu-button ${menuButtonClass} ${super.buildCSSClass()}`; <del> } <del>} <del> <del>Component.registerComponent('PopupButton', PopupButton); <del>export default PopupButton; <ide><path>src/js/popup/popup.js <del>/** <del> * @file popup.js <del> */ <del>import Component from '../component.js'; <del>import * as Dom from '../utils/dom.js'; <del>import * as Fn from '../utils/fn.js'; <del>import * as Events from '../utils/events.js'; <del> <del>/** <del> * The Popup component is used to build pop up controls. <del> * <del> * @extends Component <del> */ <del>class Popup extends Component { <del> <del> /** <del> * Add a popup item to the popup <del> * <del> * @param {Object|string} component <del> * Component or component type to add <del> * <del> */ <del> addItem(component) { <del> this.addChild(component); <del> component.on('click', Fn.bind(this, function() { <del> this.unlockShowing(); <del> })); <del> } <del> <del> /** <del> * Create the `PopupButton`s DOM element. <del> * <del> * @return {Element} <del> * The element that gets created. <del> */ <del> createEl() { <del> const contentElType = this.options_.contentElType || 'ul'; <del> <del> this.contentEl_ = Dom.createEl(contentElType, { <del> className: 'vjs-menu-content' <del> }); <del> <del> const el = super.createEl('div', { <del> append: this.contentEl_, <del> className: 'vjs-menu' <del> }); <del> <del> el.appendChild(this.contentEl_); <del> <del> // Prevent clicks from bubbling up. Needed for Popup Buttons, <del> // where a click on the parent is significant <del> Events.on(el, 'click', function(event) { <del> event.preventDefault(); <del> event.stopImmediatePropagation(); <del> }); <del> <del> return el; <del> } <del> <del> dispose() { <del> this.contentEl_ = null; <del> <del> super.dispose(); <del> } <del>} <del> <del>Component.registerComponent('Popup', Popup); <del>export default Popup;
2
Text
Text
fix weird documentation line
89d66410892b9c42bf2a11f7308d6c8bf8d656c8
<ide><path>guides/source/active_model_basics.md <ide> class Person <ide> end <ide> <ide> def last_name <del> @last_nameperson.changes # => {"first_name"=>[nil, "First Name"]} <add> @last_name <ide> end <ide> <ide> def last_name=(value)
1
Text
Text
add instructions on installing numpy (#68)
b1f7d549dc1d3be088eecd1f8de682d17eb090e3
<ide><path>syntaxnet/README.md <ide> source. You'll need to install: <ide> * upgrade to a supported version with `pip install -U protobuf==3.0.0b2` <ide> * asciitree, to draw parse trees on the console for the demo: <ide> * `pip install asciitree` <del> <add>* numpy, package for scientific computing: <add> * `pip install numpy` <add> <ide> Once you completed the above steps, you can build and test SyntaxNet with the <ide> following commands: <ide>
1
Ruby
Ruby
extract messageid concern
456d79b853aaec14f14c4c4deaa04cfb66c5b357
<ide><path>app/controllers/action_mailroom/inbound_emails_controller.rb <ide> class ActionMailroom::InboundEmailsController < ActionController::Base <ide> before_action :require_rfc822_message, only: :create <ide> <ide> def create <del> ActionMailroom::InboundEmail.create_from_raw_email!(params[:message]) <add> ActionMailroom::InboundEmail.create_and_extract_message_id!(params[:message]) <ide> head :created <ide> end <ide> <ide><path>app/models/action_mailroom/inbound_email.rb <ide> class ActionMailroom::InboundEmail < ActiveRecord::Base <ide> self.table_name = "action_mailroom_inbound_emails" <ide> <del> include Incineratable, Routable <add> include Incineratable, MessageId, Routable <ide> <ide> has_one_attached :raw_email <ide> enum status: %i[ pending processing delivered failed bounced ] <ide> <del> before_save :generate_missing_message_id <del> <del> class << self <del> def create_from_raw_email!(raw_email, **options) <del> create! raw_email: raw_email, message_id: extract_message_id(raw_email), **options <del> end <del> <del> def mail_from_source(source) <del> Mail.new(Mail::Utilities.binary_unsafe_to_crlf(source.to_s)) <del> end <del> <del> private <del> def extract_message_id(raw_email) <del> mail_from_source(raw_email.read).message_id <del> rescue => e <del> # FIXME: Add logging with "Couldn't extract Message ID, so will generating a new random ID instead" <del> end <add> def self.mail_from_source(source) <add> Mail.new Mail::Utilities.binary_unsafe_to_crlf(source.to_s) <ide> end <ide> <ide> def mail <ide> def mail <ide> def source <ide> @source ||= raw_email.download <ide> end <del> <del> private <del> def generate_missing_message_id <del> self.message_id ||= Mail::MessageIdField.new.message_id <del> end <ide> end <ide><path>app/models/action_mailroom/inbound_email/message_id.rb <add>module ActionMailroom::InboundEmail::MessageId <add> extend ActiveSupport::Concern <add> <add> included do <add> before_save :generate_missing_message_id <add> end <add> <add> module ClassMethods <add> def create_and_extract_message_id!(raw_email, **options) <add> create! raw_email: raw_email, message_id: extract_message_id(raw_email), **options <add> end <add> <add> private <add> def extract_message_id(raw_email) <add> mail_from_source(raw_email.read).message_id <add> rescue => e <add> # FIXME: Add logging with "Couldn't extract Message ID, so will generating a new random ID instead" <add> end <add> end <add> <add> private <add> def generate_missing_message_id <add> self.message_id ||= Mail::MessageIdField.new.message_id <add> end <add>end <ide><path>lib/action_mailroom/test_helper.rb <ide> def create_inbound_email_from_mail(status: :processing, **mail_options) <ide> end <ide> <ide> def create_inbound_email(io, filename: 'mail.eml', status: :processing) <del> ActionMailroom::InboundEmail.create_from_raw_email! \ <add> ActionMailroom::InboundEmail.create_and_extract_message_id! \ <ide> ActionDispatch::Http::UploadedFile.new(tempfile: io, filename: filename, type: 'message/rfc822'), <ide> status: status <ide> end
4
Python
Python
allow uppercase methods in action decorator
fa9f5fb8dcf6d51b2db70d4e2a991779b056d1d4
<ide><path>rest_framework/routers.py <ide> def get_routes(self, viewset): <ide> attr = getattr(viewset, methodname) <ide> httpmethods = getattr(attr, 'bind_to_methods', None) <ide> if httpmethods: <add> httpmethods = [method.lower() for method in httpmethods] <ide> dynamic_routes.append((httpmethods, methodname)) <ide> <ide> ret = []
1
Javascript
Javascript
use template literlals
a1cfed33d60a20c6f20b0026e2040140bce720a1
<ide><path>lib/ExtendedAPIPlugin.js <ide> class ExtendedAPIPlugin { <ide> compilation.dependencyFactories.set(ConstDependency, new NullFactory()); <ide> compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); <ide> compilation.mainTemplate.plugin("require-extensions", function(source, chunk, hash) { <del> var buf = [source]; <add> const buf = [source]; <ide> buf.push(""); <ide> buf.push("// __webpack_hash__"); <del> buf.push(this.requireFn + ".h = " + JSON.stringify(hash) + ";"); <add> buf.push(`${this.requireFn}.h = ${JSON.stringify(hash)};`); <ide> return this.asString(buf); <ide> }); <ide> compilation.mainTemplate.plugin("global-hash", () => true); <ide> <ide> params.normalModuleFactory.plugin("parser", (parser, parserOptions) => { <ide> Object.keys(REPLACEMENTS).forEach(key => { <del> parser.plugin("expression " + key, ParserHelpers.toConstantDependency(REPLACEMENTS[key])); <del> parser.plugin("evaluate typeof " + key, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])); <add> parser.plugin(`expression ${key}`, ParserHelpers.toConstantDependency(REPLACEMENTS[key])); <add> parser.plugin(`evaluate typeof ${key}`, ParserHelpers.evaluateToString(REPLACEMENT_TYPES[key])); <ide> }); <ide> }); <ide> });
1
Python
Python
fix flakes from master
f5bcca4fd4cedc3c8c65a3ddadc5d93da6363374
<ide><path>celery/bin/__init__.py <ide> from __future__ import absolute_import <ide> <del>from collections import defaultdict <del> <ide> from .base import Option # noqa <ide><path>celery/bootsteps.py <ide> from kombu.utils import symbol_by_name <ide> <ide> from .datastructures import DependencyGraph <del>from .utils.imports import instantiate, qualname, symbol_by_name <add>from .utils.imports import instantiate, qualname <ide> from .utils.log import get_logger <ide> from .utils.threads import default_socket_timeout <ide> <ide><path>celery/tests/worker/test_control.py <ide> def test_pool_restart_import_modules(self): <ide> self.assertEqual([(('foo',), {}), (('bar',), {})], <ide> _import.call_args_list) <ide> <del> def test_pool_restart_relaod_modules(self): <add> def test_pool_restart_reload_modules(self): <ide> consumer = Consumer() <ide> consumer.controller = _WC(app=current_app) <ide> consumer.controller.pool.restart = Mock() <ide><path>celery/tests/worker/test_worker.py <ide> def test_exceeds_short(self): <ide> self.assertEqual(qos.value, PREFETCH_COUNT_MAX - 1) <ide> <ide> def test_consumer_increment_decrement(self): <del> consumer = Mock() <del> qos = QoS(consumer, 10) <add> mconsumer = Mock() <add> qos = QoS(mconsumer, 10) <ide> qos.update() <ide> self.assertEqual(qos.value, 10) <del> consumer.qos.assert_called_with(prefetch_count=10) <add> mconsumer.qos.assert_called_with(prefetch_count=10) <ide> qos.decrement_eventually() <ide> qos.update() <ide> self.assertEqual(qos.value, 9) <del> consumer.qos.assert_called_with(prefetch_count=9) <add> mconsumer.qos.assert_called_with(prefetch_count=9) <ide> qos.decrement_eventually() <ide> self.assertEqual(qos.value, 8) <del> consumer.qos.assert_called_with(prefetch_count=9) <del> self.assertIn({'prefetch_count': 9}, consumer.qos.call_args) <add> mconsumer.qos.assert_called_with(prefetch_count=9) <add> self.assertIn({'prefetch_count': 9}, mconsumer.qos.call_args) <ide> <ide> # Does not decrement 0 value <ide> qos.value = 0 <ide> def test_consumer_increment_decrement(self): <ide> self.assertEqual(qos.value, 0) <ide> <ide> def test_consumer_decrement_eventually(self): <del> consumer = Mock() <del> qos = QoS(consumer, 10) <add> mconsumer = Mock() <add> qos = QoS(mconsumer, 10) <ide> qos.decrement_eventually() <ide> self.assertEqual(qos.value, 9) <ide> qos.value = 0 <ide> qos.decrement_eventually() <ide> self.assertEqual(qos.value, 0) <ide> <ide> def test_set(self): <del> consumer = Mock() <del> qos = QoS(consumer, 10) <add> mconsumer = Mock() <add> qos = QoS(mconsumer, 10) <ide> qos.set(12) <ide> self.assertEqual(qos.prev, 12) <ide> qos.set(qos.prev) <ide> def test__green_pidbox_node(self): <ide> l = MyKombuConsumer(self.ready_queue, timer=self.timer, pool=pool) <ide> l.node = Mock() <ide> controller = find_step(l, consumer.Control) <del> box = controller.box <ide> <ide> class BConsumer(Mock): <ide> <ide><path>celery/utils/text.py <ide> <ide> from pprint import pformat <ide> <del>from kombu.utils.encoding import safe_repr <del> <ide> <ide> def dedent_initial(s, n=4): <ide> return s[n:] if s[:n] == ' ' * n else s
5
Python
Python
add callback for consumer start
efc6f43291e3d77396d22ef7fd21d8eec546d036
<ide><path>celery/worker/consumer.py <ide> class Consumer(object): <ide> #: Will only be called once, even if the connection is lost and <ide> #: re-established. <ide> init_callback = None <del> <add> <add> <add> #: List of callbacks to be called when the connection is started/reset, <add> #: applied with the connection instance as sole argument. <add> on_reset_conncetion = None <add> <add> <add> #: List of callbacks to be called before the connection is closed, <add> #: applied with the connection instance as sole argument. <add> on_close_connection = None <add> <ide> #: The current hostname. Defaults to the system hostname. <ide> hostname = None <ide> <ide> def __init__(self, ready_queue, <ide> self.connection = None <ide> self.task_consumer = None <ide> self.controller = controller <add> self.on_reset_connection = [] <add> self.on_close_connection = [] <ide> self.broadcast_consumer = None <ide> self.actor_registry = {} <ide> self.ready_queue = ready_queue <ide> def start(self): <ide> """ <ide> <ide> self.init_callback(self) <del> <ide> while self._state != CLOSE: <ide> self.maybe_shutdown() <ide> try: <ide> self.reset_connection() <ide> self.consume_messages() <ide> except self.connection_errors + self.channel_errors: <ide> error(RETRY_CONNECTION, exc_info=True) <del> <ide> def on_poll_init(self, hub): <ide> hub.update_readers(self.connection.eventmap) <ide> self.connection.transport.on_poll_init(hub.poller) <ide> def on_control(self, body, message): <ide> error('Control command error: %r', exc, exc_info=True) <ide> self.reset_pidbox_node() <ide> <del> def add_actor(self, actor_name): <add> def add_actor(self, actor_name, actor_id): <ide> """Add actor to the actor registry and start the actor main method""" <ide> try: <del> actor = instantiate(actor_name, connection = self.connection) <add> actor = instantiate(actor_name, connection = self.connection, <add> id = actor_id) <ide> consumer = actor.Consumer(self.connection.channel()) <ide> consumer.consume() <ide> self.actor_registry[actor.id] = consumer <del> print 'Register actor in the actor registry: %s' % actor_name <add> info('Register actor in the actor registry: %s' % actor_name) <ide> return actor.id <ide> except Exception as exc: <ide> error('Start actor error: %r', exc, exc_info=True) <ide> def stop_all_actors(self): <ide> for _, consumer in self.actor_registry.items(): <ide> self.maybe_conn_error(consumer.cancel) <ide> self.actor_registry.clear() <add> <ide> <ide> def reset_actor_nodes(self): <ide> for _, consumer in self.actor_registry.items(): <ide> def maybe_conn_error(self, fun): <ide> def close_connection(self): <ide> """Closes the current broker connection and all open channels.""" <ide> <add> <ide> # We must set self.connection to None here, so <ide> # that the green pidbox thread exits. <ide> connection, self.connection = self.connection, None <ide> def close_connection(self): <ide> <ide> self.stop_pidbox_node() <ide> self.stop_all_actors() <add> <add> [callback() for callback in self.on_close_connection] <ide> <ide> if connection: <ide> debug('Closing broker connection...') <ide> def reset_connection(self): <ide> <ide> # We're back! <ide> self._state = RUN <add> <add> for callback in self.on_reset_connection: <add> callback(self.connection) <ide> <ide> def restart_heartbeat(self): <ide> """Restart the heartbeat thread. <ide> def stop(self): <ide> # anymore. <ide> self.close() <ide> debug('Stopping consumers...') <add> <ide> self.stop_consumers(close_connection=False) <ide> <ide> def close(self):
1
Text
Text
fix changelog for v10.18.1
5170daaca51bc9383df78b06ac1234867549c663
<ide><path>doc/changelogs/CHANGELOG_V10.md <ide> <ide> * [[`a80c59130e`](https://github.com/nodejs/node/commit/a80c59130e)] - **build**: fix configure script to work with Apple Clang 11 (Saagar Jha) [#28071](https://github.com/nodejs/node/pull/28071) <ide> * [[`68b2b5cc51`](https://github.com/nodejs/node/commit/68b2b5cc51)] - **build,win**: propagate error codes in vcbuild (João Reis) [#30724](https://github.com/nodejs/node/pull/30724) <del>* [[`3e0709cf5e`](https://github.com/nodejs/node/commit/3e0709cf5e)] - **deps**: V8: backport fb63e5cf55e9 (Michaël Zasso) <del>* [[`25b8fbda35`](https://github.com/nodejs/node/commit/25b8fbda35)] - **doc**: allow <code> in header elements (Rich Trott) [#31086](https://github.com/nodejs/node/pull/31086) <add>* [[`3e0709cf5e`](https://github.com/nodejs/node/commit/3e0709cf5e)] - **deps**: V8: backport fb63e5cf55e9 (Michaël Zasso) [#30372](https://github.com/nodejs/node/pull/30372) <add>* [[`25b8fbda35`](https://github.com/nodejs/node/commit/25b8fbda35)] - **doc**: allow \<code\> in header elements (Rich Trott) [#31086](https://github.com/nodejs/node/pull/31086) <ide> * [[`a1b095dd46`](https://github.com/nodejs/node/commit/a1b095dd46)] - **doc,dns**: use code markup/markdown in headers (Rich Trott) [#31086](https://github.com/nodejs/node/pull/31086) <ide> * [[`8f3b8ca515`](https://github.com/nodejs/node/commit/8f3b8ca515)] - **http2**: fix session memory accounting after pausing (Michael Lehenbauer) [#30684](https://github.com/nodejs/node/pull/30684) <ide> * [[`20f64a96de`](https://github.com/nodejs/node/commit/20f64a96de)] - **http2**: use the latest settings (ZYSzys) [#29780](https://github.com/nodejs/node/pull/29780)
1
Javascript
Javascript
replace concatenation with template literal
cf253244763a9401b110dc67133fcb348dfee837
<ide><path>test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js <ide> 'use strict'; <ide> const common = require('../common'); <ide> const assert = require('assert'); <del> <del>const content = require(common.fixturesDir + <del> '/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js'); <add>const filePath = '/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js'; <add>const content = require(`${common.fixturesDir}${filePath}`); <ide> <ide> assert.notStrictEqual(content.rocko, 'artischocko'); <ide> assert.strictEqual(content, 'hello from module-stub!');
1
Ruby
Ruby
add relation#size and relation#empty?
f290e685f0497427b348a2fae760300429d5f0cd
<ide><path>activerecord/lib/active_record/relation.rb <ide> def last <ide> end <ide> end <ide> <add> def size <add> loaded? ? @records.length : count <add> end <add> <add> def empty? <add> loaded? ? @records.empty? : count.zero? <add> end <add> <ide> def destroy_all <ide> to_a.each {|object| object.destroy} <ide> reset <ide><path>activerecord/test/cases/relations_test.rb <ide> def test_finding_with_conditions <ide> <ide> def test_finding_with_order <ide> topics = Topic.order('id') <del> assert_equal 4, topics.size <add> assert_equal 4, topics.to_a.size <ide> assert_equal topics(:first).title, topics.first.title <ide> end <ide> <ide> def test_finding_with_order_and_take <ide> def test_finding_with_order_limit_and_offset <ide> entrants = Entrant.order("id ASC").limit(2).offset(1) <ide> <del> assert_equal 2, entrants.size <add> assert_equal 2, entrants.to_a.size <ide> assert_equal entrants(:second).name, entrants.first.name <ide> <ide> entrants = Entrant.order("id ASC").limit(2).offset(2) <del> assert_equal 1, entrants.size <add> assert_equal 1, entrants.to_a.size <ide> assert_equal entrants(:third).name, entrants.first.name <ide> end <ide> <ide> def test_count_explicit_columns <ide> assert_equal 0, posts.count(:comments_count) <ide> assert_equal 0, posts.count('comments_count') <ide> end <add> <add> def test_size <add> posts = Post.scoped <add> <add> assert_queries(1) { assert_equal 7, posts.size } <add> assert ! posts.loaded? <add> <add> best_posts = posts.where(:comments_count => 0) <add> best_posts.to_a # force load <add> assert_no_queries { assert_equal 5, best_posts.size } <add> end <add> <ide> end
2
Go
Go
update daemon to new swarmkit
a83bba467a8bd24924b1a0cf55b954ac49937b5b
<ide><path>daemon/cluster/cluster.go <ide> func New(config Config) (*Cluster, error) { <ide> select { <ide> case <-time.After(swarmConnectTimeout): <ide> logrus.Errorf("swarm component could not be started before timeout was reached") <del> case <-n.Ready(context.Background()): <add> case <-n.Ready(): <ide> case <-ctx.Done(): <ide> } <ide> if ctx.Err() != nil { <ide> func (c *Cluster) startNewNode(forceNewCluster bool, listenAddr, joinAddr, secre <ide> <ide> go func() { <ide> select { <del> case <-node.Ready(context.Background()): <add> case <-node.Ready(): <ide> c.Lock() <ide> c.reconnectDelay = initialReconnectDelay <ide> c.Unlock() <ide> func (c *Cluster) Init(req types.InitRequest) (string, error) { <ide> c.Unlock() <ide> <ide> select { <del> case <-n.Ready(context.Background()): <add> case <-n.Ready(): <ide> if err := initAcceptancePolicy(n, req.Spec.AcceptancePolicy); err != nil { <ide> return "", err <ide> } <ide> func (c *Cluster) Join(req types.JoinRequest) error { <ide> return fmt.Errorf("Timeout reached before node was joined. Your cluster settings may be preventing this node from automatically joining. To accept this node into cluster run `docker node accept %v` in an existing cluster manager", nodeid) <ide> } <ide> return ErrSwarmJoinTimeoutReached <del> case <-n.Ready(context.Background()): <add> case <-n.Ready(): <ide> go c.reconnectOnFailure(ctx) <ide> return nil <ide> case <-ctx.Done(): <ide><path>daemon/cluster/executor/container/adapter.go <ide> func newContainerAdapter(b executorpkg.Backend, task *api.Task) (*containerAdapt <ide> <ide> func (c *containerAdapter) pullImage(ctx context.Context) error { <ide> // if the image needs to be pulled, the auth config will be retrieved and updated <del> encodedAuthConfig := c.container.task.ServiceAnnotations.Labels[fmt.Sprintf("%v.registryauth", systemLabelPrefix)] <add> encodedAuthConfig := c.container.spec().RegistryAuth <ide> <ide> authConfig := &types.AuthConfig{} <ide> if encodedAuthConfig != "" { <ide><path>daemon/cluster/executor/container/controller.go <ide> package container <ide> <ide> import ( <ide> "fmt" <del> "strings" <ide> <ide> executorpkg "github.com/docker/docker/daemon/cluster/executor" <ide> "github.com/docker/engine-api/types" <ide> "github.com/docker/swarmkit/agent/exec" <ide> "github.com/docker/swarmkit/api" <ide> "github.com/docker/swarmkit/log" <add> "github.com/pkg/errors" <ide> "golang.org/x/net/context" <ide> ) <ide> <ide> func (r *controller) Prepare(ctx context.Context) error { <ide> return err <ide> } <ide> <del> for { <del> if err := r.checkClosed(); err != nil { <del> return err <del> } <del> if err := r.adapter.create(ctx, r.backend); err != nil { <del> if isContainerCreateNameConflict(err) { <del> if _, err := r.adapter.inspect(ctx); err != nil { <del> return err <del> } <del> <del> // container is already created. success! <del> return exec.ErrTaskPrepared <del> } <add> if err := r.adapter.pullImage(ctx); err != nil { <add> // NOTE(stevvooe): We always try to pull the image to make sure we have <add> // the most up to date version. This will return an error, but we only <add> // log it. If the image truly doesn't exist, the create below will <add> // error out. <add> // <add> // This gives us some nice behavior where we use up to date versions of <add> // mutable tags, but will still run if the old image is available but a <add> // registry is down. <add> // <add> // If you don't want this behavior, lock down your image to an <add> // immutable tag or digest. <add> log.G(ctx).WithError(err).Error("pulling image failed") <add> } <ide> <del> if !strings.Contains(err.Error(), "No such image") { // todo: better error detection <del> return err <del> } <del> if err := r.adapter.pullImage(ctx); err != nil { <add> if err := r.adapter.create(ctx, r.backend); err != nil { <add> if isContainerCreateNameConflict(err) { <add> if _, err := r.adapter.inspect(ctx); err != nil { <ide> return err <ide> } <ide> <del> continue // retry to create the container <add> // container is already created. success! <add> return exec.ErrTaskPrepared <ide> } <ide> <del> break <add> return err <ide> } <ide> <ide> return nil <ide> func (r *controller) Start(ctx context.Context) error { <ide> } <ide> <ide> if err := r.adapter.start(ctx); err != nil { <del> return err <add> return errors.Wrap(err, "starting container failed") <ide> } <ide> <ide> return nil
3
Javascript
Javascript
apply the review comment to gltfexporter
28f5d746b861edf65e1878e4ac881367c1f56967
<ide><path>examples/js/exporters/GLTFExporter.js <ide> THREE.GLTFExporter.prototype = { <ide> <ide> var target = {}; <ide> <add> var warned = false; <add> <ide> for ( var attributeName in geometry.morphAttributes ) { <ide> <ide> // glTF 2.0 morph supports only POSITION/NORMAL/TANGENT. <del> // <del> // @TODO TANGENT support <add> // Three.js doesn't support TANGENT yet. <ide> <ide> if ( attributeName !== 'position' && attributeName !== 'normal' ) { <ide> <add> if ( ! warned ) { <add> <add> console.warn( 'GLTFExporter: Only POSITION and NORMAL morph are supported.' ); <add> warned = true; <add> <add> } <add> <ide> continue; <ide> <ide> } <ide> <ide> var attribute = geometry.morphAttributes[ attributeName ][ i ]; <ide> <del> // Three.js morph attribute has absolute values <del> // while the one of glTF has relative values. <del> // So we convert here. <add> // Three.js morph attribute has absolute values while the one of glTF has relative values. <ide> // <ide> // glTF 2.0 Specification: <ide> // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#morph-targets <ide> <ide> var baseAttribute = geometry.attributes[ attributeName ]; <ide> // Clones attribute not to override <del> var attribute2 = attribute.clone(); <add> var relativeAttribute = attribute.clone(); <ide> <ide> for ( var j = 0, jl = attribute.count; j < jl; j ++ ) { <ide> <del> attribute2.setXYZ( <add> relativeAttribute.setXYZ( <ide> j, <ide> attribute.getX( j ) - baseAttribute.getX( j ), <ide> attribute.getY( j ) - baseAttribute.getY( j ), <ide> THREE.GLTFExporter.prototype = { <ide> <ide> } <ide> <del> target[ attributeName.toUpperCase() ] = processAccessor( attribute2, geometry ); <add> target[ attributeName.toUpperCase() ] = processAccessor( relativeAttribute, geometry ); <ide> <ide> } <ide>
1
Mixed
Javascript
add autocomplete prop
f15145639dab1e8d7a1c79a127b7d45c91d025a8
<ide><path>Libraries/Components/TextInput/TextInput.js <ide> type IOSProps = $ReadOnly<{| <ide> |}>; <ide> <ide> type AndroidProps = $ReadOnly<{| <add> autoCompleteType?: ?( <add> | 'cc-csc' <add> | 'cc-exp' <add> | 'cc-exp-month' <add> | 'cc-exp-year' <add> | 'cc-number' <add> | 'email' <add> | 'name' <add> | 'password' <add> | 'postal-code' <add> | 'street-address' <add> | 'tel' <add> | 'username' <add> | 'off' <add> ), <ide> returnKeyLabel?: ?string, <ide> numberOfLines?: ?number, <ide> disableFullscreenUI?: ?boolean, <ide> const TextInput = createReactClass({ <ide> 'words', <ide> 'characters', <ide> ]), <add> /** <add> * Determines which content to suggest on auto complete, e.g.`username`. <add> * To disable auto complete, use `off`. <add> * <add> * *Android Only* <add> * <add> * The following values work on Android only: <add> * <add> * - `username` <add> * - `password` <add> * - `email` <add> * - `name` <add> * - `tel` <add> * - `street-address` <add> * - `postal-code` <add> * - `cc-number` <add> * - `cc-csc` <add> * - `cc-exp` <add> * - `cc-exp-month` <add> * - `cc-exp-year` <add> * - `off` <add> * <add> * @platform android <add> */ <add> autoCompleteType: PropTypes.oneOf([ <add> 'cc-csc', <add> 'cc-exp', <add> 'cc-exp-month', <add> 'cc-exp-year', <add> 'cc-number', <add> 'email', <add> 'name', <add> 'password', <add> 'postal-code', <add> 'street-address', <add> 'tel', <add> 'username', <add> 'off', <add> ]), <ide> /** <ide> * If `false`, disables auto-correct. The default value is `true`. <ide> */ <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java <ide> public void setMaxLength(ReactEditText view, @Nullable Integer maxLength) { <ide> view.setFilters(newFilters); <ide> } <ide> <add> @ReactProp(name = "autoComplete") <add> public void setTextContentType(ReactEditText view, @Nullable String autocomplete) { <add> if (autocomplete == null) { <add> view.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); <add> } else if ("username".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_USERNAME); <add> } else if ("password".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_PASSWORD); <add> } else if ("email".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_EMAIL_ADDRESS); <add> } else if ("name".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_NAME); <add> } else if ("tel".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_PHONE); <add> } else if ("street-address".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_POSTAL_ADDRESS); <add> } else if ("postal-code".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_POSTAL_CODE); <add> } else if ("cc-number".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_NUMBER); <add> } else if ("cc-csc".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE); <add> } else if ("cc-exp".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE); <add> } else if ("cc-exp-month".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH); <add> } else if ("cc-exp-year".equals(autocomplete)) { <add> view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR); <add> } else if ("off".equals(autocomplete)) { <add> view.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); <add> } else { <add> throw new JSApplicationIllegalArgumentException("Invalid autocomplete option: " + autocomplete); <add> } <add> } <add> <ide> @ReactProp(name = "autoCorrect") <ide> public void setAutoCorrect(ReactEditText view, @Nullable Boolean autoCorrect) { <ide> // clear auto correct flags, set SUGGESTIONS or NO_SUGGESTIONS depending on value
2
Ruby
Ruby
remove checks for enumerator#size method
90f851a18b1aca6323c77d21153761e36f864079
<ide><path>activerecord/test/cases/batches_test.rb <ide> def test_each_should_return_an_enumerator_if_no_block_is_present <ide> end <ide> end <ide> <del> if Enumerator.method_defined? :size <del> def test_each_should_return_a_sized_enumerator <del> assert_equal 11, Post.find_each(batch_size: 1).size <del> assert_equal 5, Post.find_each(batch_size: 2, start: 7).size <del> assert_equal 11, Post.find_each(batch_size: 10_000).size <del> end <add> def test_each_should_return_a_sized_enumerator <add> assert_equal 11, Post.find_each(batch_size: 1).size <add> assert_equal 5, Post.find_each(batch_size: 2, start: 7).size <add> assert_equal 11, Post.find_each(batch_size: 10_000).size <ide> end <ide> <ide> def test_each_enumerator_should_execute_one_query_per_batch <ide> def test_in_batches_relations_update_all_should_not_affect_matching_records_in_o <ide> assert_equal 2, person.reload.author_id # incremented only once <ide> end <ide> <del> if Enumerator.method_defined? :size <del> def test_find_in_batches_should_return_a_sized_enumerator <del> assert_equal 11, Post.find_in_batches(batch_size: 1).size <del> assert_equal 6, Post.find_in_batches(batch_size: 2).size <del> assert_equal 4, Post.find_in_batches(batch_size: 2, start: 4).size <del> assert_equal 4, Post.find_in_batches(batch_size: 3).size <del> assert_equal 1, Post.find_in_batches(batch_size: 10_000).size <del> end <add> def test_find_in_batches_should_return_a_sized_enumerator <add> assert_equal 11, Post.find_in_batches(batch_size: 1).size <add> assert_equal 6, Post.find_in_batches(batch_size: 2).size <add> assert_equal 4, Post.find_in_batches(batch_size: 2, start: 4).size <add> assert_equal 4, Post.find_in_batches(batch_size: 3).size <add> assert_equal 1, Post.find_in_batches(batch_size: 10_000).size <ide> end <ide> <ide> [true, false].each do |load| <ide><path>activerecord/test/cases/result_test.rb <ide> def result <ide> end <ide> end <ide> <del> if Enumerator.method_defined? :size <del> test "each without block returns a sized enumerator" do <del> assert_equal 3, result.each.size <del> end <add> test "each without block returns a sized enumerator" do <add> assert_equal 3, result.each.size <ide> end <ide> <ide> test "cast_values returns rows after type casting" do <ide><path>activesupport/test/core_ext/enumerable_test.rb <ide> def test_index_by <ide> assert_equal({ 5 => Payment.new(5), 15 => Payment.new(15), 10 => Payment.new(10) }, <ide> payments.index_by(&:price)) <ide> assert_equal Enumerator, payments.index_by.class <del> if Enumerator.method_defined? :size <del> assert_nil payments.index_by.size <del> assert_equal 42, (1..42).index_by.size <del> end <add> assert_nil payments.index_by.size <add> assert_equal 42, (1..42).index_by.size <ide> assert_equal({ 5 => Payment.new(5), 15 => Payment.new(15), 10 => Payment.new(10) }, <ide> payments.index_by.each(&:price)) <ide> end
3
Python
Python
add root imports
bfbdbb05bc349257e0ac0eef186f7bdb91a89e17
<ide><path>keras/__init__.py <add>from __future__ import absolute_import <ide> __version__ = '1.0.1' <add>from . import backend <add>from . import datasets <add>from . import engine <add>from . import layers <add>from . import preprocessing <add>from . import utils <add>from . import wrappers <add>from . import callbacks <add>from . import constraints <add>from . import initializations <add>from . import metrics <add>from . import models <add>from . import objectives <add>from . import optimizers <add>from . import regularizers
1
Ruby
Ruby
fix two message typos
a0540058833dcf89d4bba3734828393d8ac4164d
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_homepage <ide> # "Software" is redirected to https://wiki.freedesktop.org/www/Software/project_name <ide> if homepage =~ %r[^http://((?:www|nice|libopenraw|liboil|telepathy|xorg)\.)?freedesktop\.org/(?:wiki/)?] <ide> if homepage =~ /Software/ <del> problem "The url should be styled `https://wiki.freedesktop.org/www/Software/project_name`, not #{homepage})." <add> problem "The url should be styled `https://wiki.freedesktop.org/www/Software/project_name`, not #{homepage}." <ide> else <del> problem "The url should be styled `https://wiki.freedesktop.org/project_name`, not #{homepage})." <add> problem "The url should be styled `https://wiki.freedesktop.org/project_name`, not #{homepage}." <ide> end <ide> end <ide>
1
Ruby
Ruby
fix false positive audit warning
0bf3ec593de9d20b873c947f420e8b19b84d50ad
<ide><path>Library/Homebrew/cmd/audit.rb <ide> def audit_line(line, lineno) <ide> problem "Use new-style option definitions" <ide> end <ide> <del> if line =~ /def test/ <add> if line =~ /def test$/ <ide> problem "Use new-style test definitions (test do)" <ide> end <ide>
1
Ruby
Ruby
document the csrf whitelisting on get requests
39856627e0e3d50db4eb400bdfaca3bc0958d211
<ide><path>actionpack/lib/action_controller/metal/request_forgery_protection.rb <ide> class InvalidAuthenticityToken < ActionControllerError #:nodoc: <ide> # Controller actions are protected from Cross-Site Request Forgery (CSRF) attacks <ide> # by including a token in the rendered html for your application. This token is <ide> # stored as a random string in the session, to which an attacker does not have <del> # access. When a request reaches your application, \Rails verifies the received <del> # token with the token in the session. Only HTML and JavaScript requests are checked, <del> # so this will not protect your XML API (presumably you'll have a different <del> # authentication scheme there anyway). Also, GET requests are not protected as these <del> # should be idempotent. <add> # access. When a request reaches your application, Rails verifies the received <add> # token with the token in the session. All requests are checked except GET requests <add> # as these should be idempotent. It's is important to remember that XML or JSON <add> # requests are also affected and if you're building an API you'll need <add> # something like that: <add> # <add> # class ApplicationController < ActionController::Base <add> # protect_from_forgery <add> # skip_before_filter :verify_authenticity_token, :if => json_request? <add> # <add> # protected <add> # <add> # def json_request? <add> # request.format.json? <add> # end <add> # end <ide> # <ide> # CSRF protection is turned on with the <tt>protect_from_forgery</tt> method, <ide> # which checks the token and resets the session if it doesn't match what was expected.
1
PHP
PHP
require native prepares for most drivers
2044d6db296c27bff734c28442b40cf469adeb39
<ide><path>src/Database/Driver/Mysql.php <ide> public function connect() <ide> $config['flags'] += [ <ide> PDO::ATTR_PERSISTENT => $config['persistent'], <ide> PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, <del> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <add> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, <ide> ]; <ide> <ide> if (!empty($config['ssl_key']) && !empty($config['ssl_cert'])) { <ide><path>src/Database/Driver/Postgres.php <ide> public function connect() <ide> $config = $this->_config; <ide> $config['flags'] += [ <ide> PDO::ATTR_PERSISTENT => $config['persistent'], <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> if (empty($config['unix_socket'])) { <ide><path>src/Database/Driver/Sqlite.php <ide> public function connect() <ide> $config = $this->_config; <ide> $config['flags'] += [ <ide> PDO::ATTR_PERSISTENT => $config['persistent'], <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> <ide><path>src/Database/Driver/Sqlserver.php <ide> public function connect() <ide> $config = $this->_config; <ide> $config['flags'] += [ <ide> PDO::ATTR_PERSISTENT => $config['persistent'], <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> <ide><path>tests/TestCase/Database/Driver/PostgresTest.php <ide> public function testConnectionConfigDefault() <ide> <ide> $expected['flags'] += [ <ide> PDO::ATTR_PERSISTENT => true, <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> <ide> public function testConnectionConfigCustom() <ide> $expected = $config; <ide> $expected['flags'] += [ <ide> PDO::ATTR_PERSISTENT => false, <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> <ide><path>tests/TestCase/Database/Driver/SqliteTest.php <ide> public function testConnectionConfigDefault() <ide> <ide> $expected['flags'] += [ <ide> PDO::ATTR_PERSISTENT => false, <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> $driver->expects($this->once())->method('_connect') <ide> public function testConnectionConfigCustom() <ide> $expected += ['username' => null, 'password' => null]; <ide> $expected['flags'] += [ <ide> PDO::ATTR_PERSISTENT => true, <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION <ide> ]; <ide> <ide><path>tests/TestCase/Database/Driver/SqlserverTest.php <ide> public function testConnectionConfigCustom() <ide> $expected = $config; <ide> $expected['flags'] += [ <ide> PDO::ATTR_PERSISTENT => false, <add> PDO::ATTR_EMULATE_PREPARES => false, <ide> PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, <ide> PDO::SQLSRV_ATTR_ENCODING => 'a-language' <ide> ];
7
Javascript
Javascript
use webpack for transpiling too
577e2c27a76712de0ef585d3965d53a6731a9fb3
<ide><path>server/build/bundle.js <del>import { resolve, dirname, basename } from 'path' <del>import webpack from 'webpack' <del> <del>export default function bundle (src, dst) { <del> const compiler = webpack({ <del> entry: src, <del> output: { <del> path: dirname(dst), <del> filename: basename(dst), <del> libraryTarget: 'commonjs2' <del> }, <del> externals: [ <del> 'react', <del> 'react-dom', <del> { <del> [require.resolve('react')]: 'react', <del> [require.resolve('../../lib/link')]: 'next/link', <del> [require.resolve('../../lib/css')]: 'next/css', <del> [require.resolve('../../lib/head')]: 'next/head' <del> } <del> ], <del> resolveLoader: { <del> root: resolve(__dirname, '..', '..', 'node_modules') <del> }, <del> plugins: [ <del> new webpack.optimize.UglifyJsPlugin({ <del> compress: { warnings: false }, <del> sourceMap: false <del> }) <del> ], <del> module: { <del> preLoaders: [ <del> { test: /\.json$/, loader: 'json-loader' } <del> ] <del> } <del> }) <del> <del> return new Promise((resolve, reject) => { <del> compiler.run((err, stats) => { <del> if (err) return reject(err) <del> <del> const jsonStats = stats.toJson() <del> if (jsonStats.errors.length > 0) { <del> const error = new Error(jsonStats.errors[0]) <del> error.errors = jsonStats.errors <del> error.warnings = jsonStats.warnings <del> return reject(error) <del> } <del> <del> resolve() <del> }) <del> }) <del>} <ide><path>server/build/index.js <del>import { resolve } from 'path' <del>import glob from 'glob-promise' <del>import transpile from './transpile' <del>import bundle from './bundle' <add>import webpack from './webpack' <ide> <ide> export default async function build (dir) { <del> const dstDir = resolve(dir, '.next') <del> const templateDir = resolve(__dirname, '..', '..', 'pages') <add> const compiler = await webpack(dir) <ide> <del> // create `.next/pages/_error.js` <del> // which may be overwriten by the user sciprt, `pages/_error.js` <del> const templatPaths = await glob('**/*.js', { cwd: templateDir }) <del> await Promise.all(templatPaths.map(async (p) => { <del> await transpile(resolve(templateDir, p), resolve(dstDir, 'pages', p)) <del> })) <add> return new Promise((resolve, reject) => { <add> compiler.run((err, stats) => { <add> if (err) return reject(err) <ide> <del> const paths = await glob('**/*.js', { cwd: dir, ignore: 'node_modules/**' }) <del> await Promise.all(paths.map(async (p) => { <del> await transpile(resolve(dir, p), resolve(dstDir, p)) <del> })) <add> const jsonStats = stats.toJson() <add> if (jsonStats.errors.length > 0) { <add> const error = new Error(jsonStats.errors[0]) <add> error.errors = jsonStats.errors <add> error.warnings = jsonStats.warnings <add> return reject(error) <add> } <ide> <del> const pagePaths = await glob('pages/**/*.js', { cwd: dstDir }) <del> await Promise.all(pagePaths.map(async (p) => { <del> await bundle(resolve(dstDir, p), resolve(dstDir, '_bundles', p)) <del> })) <add> resolve() <add> }) <add> }) <ide> } <ide><path>server/build/transpile.js <del>import { dirname } from 'path' <del>import fs from 'mz/fs' <del>import mkdirp from 'mkdirp-then'; <del>import { transformFile } from 'babel-core' <del>import preset2015 from 'babel-preset-es2015' <del>import presetReact from 'babel-preset-react' <del>import transformAsyncToGenerator from 'babel-plugin-transform-async-to-generator' <del>import transformClassProperties from 'babel-plugin-transform-class-properties' <del>import transformObjectRestSpread from 'babel-plugin-transform-object-rest-spread' <del>import transformRuntime from 'babel-plugin-transform-runtime' <del>import moduleAlias from 'babel-plugin-module-alias' <del> <del>const babelRuntimePath = require.resolve('babel-runtime/package') <del>.replace(/[\\\/]package\.json$/, ''); <del> <del>const babelOptions = { <del> presets: [preset2015, presetReact], <del> plugins: [ <del> transformAsyncToGenerator, <del> transformClassProperties, <del> transformObjectRestSpread, <del> transformRuntime, <del> [ <del> moduleAlias, <del> [ <del> { src: `npm:${babelRuntimePath}`, expose: 'babel-runtime' }, <del> { src: `npm:${require.resolve('react')}`, expose: 'react' }, <del> { src: `npm:${require.resolve('../../lib/link')}`, expose: 'next/link' }, <del> { src: `npm:${require.resolve('../../lib/css')}`, expose: 'next/css' }, <del> { src: `npm:${require.resolve('../../lib/head')}`, expose: 'next/head' } <del> ] <del> ] <del> ], <del> ast: false <del>} <del> <del>export default async function transpile (src, dst) { <del> const code = await new Promise((resolve, reject) => { <del> transformFile(src, babelOptions, (err, result) => { <del> if (err) return reject(err) <del> resolve(result.code) <del> }) <del> }) <del> <del> await writeFile(dst, code) <del>} <del> <del>async function writeFile (path, data) { <del> await mkdirp(dirname(path)) <del> await fs.writeFile(path, data, { encoding: 'utf8', flag: 'w+' }) <del>}
3
Ruby
Ruby
fix reference to self
4a457d191d8136fada802eb203b2769ebd92d130
<ide><path>Library/Homebrew/formula.rb <ide> def outdated_versions <ide> <ide> if oldname && !rack.exist? && (dir = HOMEBREW_CELLAR/oldname).directory? && <ide> !dir.subdirs.empty? && tap == Tab.for_keg(dir.subdirs.first).tap <del> raise Migrator::MigrationNeededError.new(f) <add> raise Migrator::MigrationNeededError.new(self) <ide> end <ide> <ide> rack.subdirs.each do |keg_dir|
1
Text
Text
add section about extensions
14c89f8f6350653038efbb19362ff8f095e682a2
<ide><path>guide/english/swift/view-controller/index.md <ide> This is an example of what a basic view in Swift looks like. <ide> ``` <ide> 1. Loads view after the controller loads. <ide> 2. Overrides the UIViewController class. This is a necessary step for any view controller. <del>3. Sets background color to white. <ide>\ No newline at end of file <add>3. Sets background color to white. <add> <add>## Extending View Controllers <add> <add>Extensions can help keep your code clean when conforming to multiple protocols. <add> <add>This is an example of how you can add a TableView to a Basic View Controller. <add> <add>```Swift <add> import UIKit <add> <add> class ViewController: UIViewController { <add> // 1 <add> @IBOutlet weak var tableView: UITableView! <add> <add> // 2 <add> let data = ["New York, NY", "Los Angeles, CA", "Chicago, IL", "Houston, TX", <add> "Philadelphia, PA", "Phoenix, AZ", "San Diego, CA", "San Antonio, TX", <add> "Dallas, TX", "Detroit, MI", "San Jose, CA", "Indianapolis, IN", <add> "Jacksonville, FL", "San Francisco, CA", "Columbus, OH", "Austin, TX", <add> "Memphis, TN", "Baltimore, MD", "Charlotte, ND", "Fort Worth, TX"] <add> <add> override func viewDidLoad() { <add> super.viewDidLoad() <add> <add> // 10 <add> tableView.dataSource = self <add> // 11 <add> tableView.register(UITableViewCell.self, forCellReuseIdentifier: "myCellIdentifier") <add> } <add> } <add> <add> // 3 <add> extension ViewController: UITableViewDataSource { <add> <add> // 4 <add> func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { <add> // 5 <add> let cell = tableView.dequeueReusableCell(withIdentifier: "myCellIdentifier", for: indexPath) <add> // 6 <add> cell.textLabel?.text = data[indexPath.row] <add> // 7 <add> return cell <add> } <add> <add> // 8 <add> func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { <add> // 9 <add> return data.count <add> } <add> } <add>``` <add>1. Define the outlet for our tableView <add>2. Define the data that we'll be loading into our tableView <add>3. Adds extension to ViewController class that conforms to UITableViewDataSource <add>4. Implement the UITableViewDataSource stubs for required methods - cellForRowAt (defines what goes in a specific cell) <add>5. Define a cell as a resuable element with the identifier "myCellIdentifier" <add>6. Provide our cell's textLabel with the referenced data <add>7. Return that cell <add>8. Implement the UITableViewDataSource stubs for required methods - numberOfRowsInSection (defines how many rows will be in your tableView) <add>9. Return the size of our data array <add>10. Set the tableView's dataSource to self when the view loads <add>11. register the tableView's cell
1
Text
Text
add article for vue.js components
e9713ceb775cd012f3150cbc5831c9bc5f806cc7
<ide><path>client/src/pages/guide/english/vue/components/index.md <add>--- <add>title: Components <add>--- <add> <add>## Components <add> <add>A classic problem that web developers face when working is HTML duplication, not <add>in a simple example such as a list, but sometimes all you want is a "import" to <add>be able to use the same code in several different places. Well, Vue.js gives you <add>this feature with Components. <add> <add>Suppose you're developing a landing page for your company's product and you need <add>to display the 4 main features of it following the same structure of a card-like <add>object, with a icon, a title and a short description. <add> <add>```javascript <add>Vue.component('feature-card', { <add> props: ["iconSrc", "iconAltText", "featureTitle", "featureDescription"], <add> template: ` <add> <div class="card"> <add> <div class="icon-wrapper"> <add> <img <add> class="icon" <add> :src="iconSrc" <add> :alt="iconAltText"> <add> </div> <add> <h4 class="title"> <add> {{ featureTitle }} <add> </h4> <add> <p class="description"> <add> {{ featureDescription }} <add> </p> <add> </div> <add> ` <add>}); <add>``` <add> <add>> Note that here we binded the image `src` attribute with another syntax `:src`. <add>This changes nothing, it is simply a syntax sugar to `v-bind:src` -- whenever <add>you want to bind some attribute to a variable, you can prepend a `:` to the <add>attribute name instead of using the full form `v-bind`. <add> <add>With this code, we did a lot of new things: <add>* we created a new component called `feature-card` <add>* we defined `feature-card` default **structure** with the `template` attribute <add>* we opened a list of properties that that component accept with the `props` <add> list <add> <add>When we defined the name of the components, whenever we desire to reuse it, we <add>can just reference it by using as a tag. In our example, we can use the tag <add>`<feature-card>`: <add> <add>```html <add><div id="app"> <add> <feature-card <add> iconSrc="https://freedesignfile.com/upload/2017/08/rocket-icon-vector.png" <add> iconAltText="rocket" <add> featureTitle="Processing speed" <add> featureDescription="Our solution has astonishing benchmarks grades"> <add> </feature-card> <add></div> <add>``` <add> <add>In this case, we called the `<feature-card>` as it was an existing tag, as well <add>as we setted `iconSrc` or `featureTitle` as they were valid attributes. And the <add>purpose of Vue.js components is this: increment your toolbox with your own <add>tools. <add>
1
Go
Go
remove deprecated fields for cluster-advertise
494dadb8a38d0e1d566dc33cd0ba1f1e324d57de
<ide><path>api/types/types.go <ide> type Info struct { <ide> Labels []string <ide> ExperimentalBuild bool <ide> ServerVersion string <del> ClusterStore string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated <del> ClusterAdvertise string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated <ide> Runtimes map[string]Runtime <ide> DefaultRuntime string <ide> Swarm swarm.Info
1
Javascript
Javascript
add dataview test case for v8 serdes
c14284fb0bf4b99cf021f17274c190f55d8debc3
<ide><path>test/parallel/test-v8-serdes.js <ide> const objects = [ <ide> { bar: 'baz' }, <ide> new Uint8Array([1, 2, 3, 4]), <ide> new Uint32Array([1, 2, 3, 4]), <add> new DataView(new ArrayBuffer(42)), <ide> Buffer.from([1, 2, 3, 4]), <ide> undefined, <ide> null,
1
Python
Python
add missing variable assignment
2ed6882a73d00df6baa465435980c2dbf3c2a835
<ide><path>libcloud/httplib_ssl.py <ide> def set_http_proxy(self, proxy_url): <ide> self.proxy_scheme = scheme <ide> self.proxy_host = host <ide> self.proxy_port = port <add> self.http_proxy_used = True <ide> <ide> self._setup_http_proxy() <ide>
1
Python
Python
fix textcat simple train example
42a0fbf29168f12a4bc3afc53bbf7148b9d008f6
<ide><path>spacy/tests/pipeline/test_textcat.py <add># coding: utf8 <add> <ide> from __future__ import unicode_literals <ide> from ...language import Language <ide> <add> <ide> def test_simple_train(): <ide> nlp = Language() <del> <ide> nlp.add_pipe(nlp.create_pipe('textcat')) <del> nlp.get_pipe('textcat').add_label('is_good') <del> <add> nlp.get_pipe('textcat').add_label('answer') <ide> nlp.begin_training() <del> <ide> for i in range(5): <ide> for text, answer in [('aaaa', 1.), ('bbbb', 0), ('aa', 1.), <ide> ('bbbbbbbbb', 0.), ('aaaaaa', 1)]: <ide> nlp.update([text], [{'cats': {'answer': answer}}]) <ide> doc = nlp(u'aaa') <del> assert 'is_good' in doc.cats <del> assert doc.cats['is_good'] >= 0.5 <del> <add> assert 'answer' in doc.cats <add> assert doc.cats['answer'] >= 0.5
1
Python
Python
add auto_name to config
c6c3a0247c70fbea7344ef2e5ea710a9244e7745
<ide><path>keras/layers/core.py <ide> def get_config(self): <ide> config = {"name": self.__class__.__name__, <ide> "layers": [l.get_config() for l in self.layers], <ide> "mode": self.mode, <del> "concat_axis": self.concat_axis} <add> "concat_axis": self.concat_axis, <add> "auto_name": self.auto_name} <ide> base_config = super(Merge, self).get_config() <ide> return dict(list(base_config.items()) + list(config.items())) <ide>
1
Text
Text
fix dead link in oracle.md
ffda2035e5a9e6a723c4c84cd5f88c5f4a9dc2ba
<ide><path>docs/sources/installation/oracle.md <ide> Request at [My Oracle Support](http://support.oracle.com). <ide> <ide> If you do not have an Oracle Linux Support Subscription, you can use the [Oracle <ide> Linux <del>Forum](https://community.oracle.com/community/server_%26_storage_systems/linux/ <del>oracle_linux) for community-based support. <add>Forum](https://community.oracle.com/community/server_%26_storage_systems/linux/oracle_linux) for community-based support.
1
Python
Python
remove print from gogrid
f2515273bc74870d8ae5015a8a3297be492efead
<ide><path>test/test_gogrid.py <ide> def setUp(self): <ide> <ide> def test_list_nodes(self): <ide> ret = self.conn.list_nodes() <del> print ret
1
Javascript
Javascript
remove fieldset from wrapmap
378ab82865f92a5aec4324d22c7345eff0a737a0
<ide><path>src/manipulation.js <ide> var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^> <ide> <ide> // Support: IE 9 <ide> option: [ 1, "<select multiple='multiple'>" ], <del> legend: [ 1, "<fieldset>" ], <ide> param: [ 1, "<object>" ], <ide> thead: [ 1, "<table>" ], <ide> tr: [ 2, "<table><tbody>" ],
1
Javascript
Javascript
add doc for refreshcontrol
b34f6c9f7451421678d7e4785bab9e6dad819d53
<ide><path>website/server/extractDocs.js <ide> var components = [ <ide> '../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js', <ide> '../Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js', <ide> '../Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js', <add> '../Libraries/Components/RefreshControl/RefreshControl.js', <ide> '../Libraries/Components/ScrollView/ScrollView.js', <ide> '../Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js', <ide> '../Libraries/Components/SliderIOS/SliderIOS.ios.js',
1
Text
Text
add "labels" key to output of /containers/json
b245bcd458492c9b348b790a9422dd7478f9af83
<ide><path>docs/reference/api/docker_remote_api_v1.18.md <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], <add> "Labels": { <add> "com.example.vendor": "Acme", <add> "com.example.license": "GPL", <add> "com.example.version": "1.0" <add> }, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> "Ports":[], <add> "Labels": {}, <ide> "SizeRw":12288, <ide> "SizeRootFs":0 <ide> }, <ide> List containers <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> } <ide><path>docs/reference/api/docker_remote_api_v1.19.md <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], <add> "Labels": { <add> "com.example.vendor": "Acme", <add> "com.example.license": "GPL", <add> "com.example.version": "1.0" <add> }, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> "Ports":[], <add> "Labels": {}, <ide> "SizeRw":12288, <ide> "SizeRootFs":0 <ide> }, <ide> List containers <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> } <ide><path>docs/reference/api/docker_remote_api_v1.20.md <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], <add> "Labels": { <add> "com.example.vendor": "Acme", <add> "com.example.license": "GPL", <add> "com.example.version": "1.0" <add> }, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> "Ports":[], <add> "Labels": {}, <ide> "SizeRw":12288, <ide> "SizeRootFs":0 <ide> }, <ide> List containers <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> } <ide><path>docs/reference/api/docker_remote_api_v1.21.md <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], <add> "Labels": { <add> "com.example.vendor": "Acme", <add> "com.example.license": "GPL", <add> "com.example.version": "1.0" <add> }, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }, <ide> List containers <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> "Ports":[], <add> "Labels": {}, <ide> "SizeRw":12288, <ide> "SizeRootFs":0 <ide> }, <ide> List containers <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> "Ports": [], <add> "Labels": {}, <ide> "SizeRw": 12288, <ide> "SizeRootFs": 0 <ide> }
4
Javascript
Javascript
add a failing test for
8ec69ba1cb086faa21d5d66fd09aa0f386c1c943
<ide><path>packages/ember-glimmer/tests/integration/components/curly-components-test.js <ide> moduleFor('Components test: curly components', class extends RenderingTest { <ide> this.assertComponentElement(this.firstChild, { content: 'yielded: [hello] - In component' }); <ide> } <ide> <add> ['@test it can render a basic component with a block param when the yield is in a partial']() { <add> this.registerPartial('_partialWithYield', 'yielded: [{{yield "hello"}}]'); <add> <add> this.registerComponent('foo-bar', { template: '{{partial "partialWithYield"}} - In component' }); <add> <add> this.render('{{#foo-bar as |value|}}{{value}}{{/foo-bar}}'); <add> <add> this.assertComponentElement(this.firstChild, { content: 'yielded: [hello] - In component' }); <add> <add> this.runTask(() => this.rerender()); <add> <add> this.assertComponentElement(this.firstChild, { content: 'yielded: [hello] - In component' }); <add> } <add> <ide> ['@test it renders the layout with the component instance as the context']() { <ide> let instance; <ide>
1
Ruby
Ruby
enable use of mysql stored procedures by default
c9d3c48dc6389feb2001372cd76e96274e773c9b
<ide><path>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb <ide> def self.mysql_connection(config) # :nodoc: <ide> raise <ide> end <ide> end <add> <ide> MysqlCompat.define_all_hashes_method! <ide> <ide> mysql = Mysql.init <ide> mysql.ssl_set(config[:sslkey], config[:sslcert], config[:sslca], config[:sslcapath], config[:sslcipher]) if config[:sslca] || config[:sslkey] <ide> <del> ConnectionAdapters::MysqlAdapter.new(mysql, logger, [host, username, password, database, port, socket], config) <add> default_flags = Mysql.const_defined?(:CLIENT_MULTI_RESULTS) ? Mysql::CLIENT_MULTI_RESULTS : 0 <add> options = [host, username, password, database, port, socket, default_flags] <add> ConnectionAdapters::MysqlAdapter.new(mysql, logger, options, config) <ide> end <ide> end <ide> <ide><path>activerecord/test/cases/connection_test_mysql.rb <ide> def test_successful_reconnection_after_timeout_with_verify <ide> sleep 2 <ide> @connection.verify! <ide> assert @connection.active? <add> end <add> <add> # Test that MySQL allows multiple results for stored procedures <add> if Mysql.const_defined?(:CLIENT_MULTI_RESULTS) <add> def test_multi_results <add> rows = ActiveRecord::Base.connection.select_rows('CALL ten();') <add> assert_equal 10, rows[0][0].to_i, "ten() did not return 10 as expected: #{rows.inspect}" <add> end <ide> end <ide> <ide> private <ide><path>activerecord/test/schema/mysql_specific_schema.rb <ide> t.text :medium_text, :limit => 16777215 <ide> t.text :long_text, :limit => 2147483647 <ide> end <add> <add> ActiveRecord::Base.connection.execute <<-SQL <add>DROP PROCEDURE IF EXISTS ten; <add>SQL <add> <add> ActiveRecord::Base.connection.execute <<-SQL <add>CREATE PROCEDURE ten() SQL SECURITY INVOKER <add>BEGIN <add> select 10; <add>END <add>SQL <add> <ide> end
3
PHP
PHP
add use closure;
034c63b39deb190fd909294022bc8d80d5cf7ae9
<ide><path>laravel/database/schema.php <ide> <?php namespace Laravel\Database; <ide> <add>use Closure; <ide> use Laravel\Fluent; <ide> use Laravel\Database as DB; <ide>
1
Javascript
Javascript
resize stderr on sigwinch
bf2cd225a84a686d94549ee00100772d02f17551
<ide><path>src/node.js <ide> er = er || new Error('process.stderr cannot be closed.'); <ide> stderr.emit('error', er); <ide> }; <add> if (stderr.isTTY) { <add> process.on('SIGWINCH', function() { <add> stderr._refreshSize(); <add> }); <add> } <ide> return stderr; <ide> }); <ide>
1
Javascript
Javascript
destroy $rootscope after each test
b75c0d8d0549261ece551210a11d8be48c3ab3cc
<ide><path>src/ngMock/angular-mocks.js <ide> if (window.jasmine || window.mocha) { <ide> <ide> if (injector) { <ide> injector.get('$rootElement').off(); <add> injector.get('$rootScope').$destroy(); <ide> } <ide> <ide> // clean up jquery's fragment cache <ide><path>test/ngMock/angular-mocksSpec.js <ide> describe('ngMock', function() { <ide> }); <ide> <ide> <add> describe('$rootScope', function() { <add> var destroyed = false; <add> var oldRootScope; <add> <add> it('should destroy $rootScope after each test', inject(function($rootScope) { <add> $rootScope.$on('$destroy', function() { <add> destroyed = true; <add> }); <add> oldRootScope = $rootScope; <add> })); <add> <add> it('should have destroyed the $rootScope from the previous test', inject(function($rootScope) { <add> expect(destroyed).toBe(true); <add> expect($rootScope).not.toBe(oldRootScope); <add> expect(oldRootScope.$$destroyed).toBe(true); <add> })); <add> }); <add> <add> <ide> describe('$rootScopeDecorator', function() { <ide> <ide> describe('$countChildScopes', function() {
2
PHP
PHP
extract a trait that provides repository()
8a8ac0f01d755356fd1382b40ce44249524bc059
<ide><path>Cake/Controller/Controller.php <ide> use Cake\Utility\ClassRegistry; <ide> use Cake\Utility\Inflector; <ide> use Cake\Utility\MergeVariablesTrait; <add>use Cake\Utility\RepositoryAwareTrait; <ide> use Cake\Utility\ViewVarsTrait; <ide> use Cake\View\View; <ide> <ide> class Controller extends Object implements EventListener { <ide> <ide> use MergeVariablesTrait; <ide> use RequestActionTrait; <add> use RepositoryAwareTrait; <ide> use ViewVarsTrait; <ide> <ide> /** <ide> class Controller extends Object implements EventListener { <ide> */ <ide> public $methods = array(); <ide> <del>/** <del> * This controller's primary model class name, the Inflector::singularize()'ed version of <del> * the controller's $name property. <del> * <del> * Example: For a controller named 'Comments', the modelClass would be 'Comment' <del> * <del> * @var string <del> */ <del> public $modelClass = null; <del> <del>/** <del> * This controller's model key name, an underscored version of the controller's $modelClass property. <del> * <del> * Example: For a controller named 'ArticleComments', the modelKey would be 'article_comment' <del> * <del> * @var string <del> */ <del> public $modelKey = null; <del> <ide> /** <ide> * Holds any validation errors produced by the last call of the validateErrors() method/ <ide> * <ide> public function __construct($request = null, $response = null) { <ide> $this->viewPath = $viewPath; <ide> } <ide> <del> $this->modelClass = Inflector::singularize($this->name); <del> $this->modelKey = Inflector::underscore($this->modelClass); <add> $this->_setModelClass($this->name); <ide> <ide> $childMethods = get_class_methods($this); <ide> $parentMethods = get_class_methods('Cake\Controller\Controller'); <ide> public function shutdownProcess() { <ide> $this->getEventManager()->dispatch(new Event('Controller.shutdown', $this)); <ide> } <ide> <del>/** <del> * Loads and constructs repository objects required by this controller. <del> * <del> * Typically used to load ORM Table objects as required. Can <del> * also be used to load other types of repository objects your application uses. <del> * <del> * If a repository provider does not return an object a MissingModelException will <del> * be thrown. <del> * <del> * @param string $modelClass Name of model class to load. Defaults to $this->modelClass <del> * @param string $type The type of repository to load. Defaults to 'Table' which <del> * delegates to Cake\ORM\TableRegistry. <del> * @return boolean True when single repository found and instance created. <del> * @throws Cake\Error\MissingModelException if the model class cannot be found. <del> */ <del> public function repository($modelClass = null, $type = 'Table') { <del> if (isset($this->{$modelClass})) { <del> return $this->{$modelClass}; <del> } <del> <del> if ($modelClass === null) { <del> $modelClass = $this->modelClass; <del> } <del> <del> list($plugin, $modelClass) = pluginSplit($modelClass, true); <del> <del> if ($type === 'Table') { <del> $this->{$modelClass} = TableRegistry::get($plugin . $modelClass); <del> } <del> if (!$this->{$modelClass}) { <del> throw new Error\MissingModelException($modelClass); <del> } <del> return true; <del> } <del> <ide> /** <ide> * Redirects to given $url, after turning off $this->autoRender. <ide> * Script execution is halted after the redirect. <ide><path>Cake/Utility/RepositoryAwareTrait.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) 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 http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Utility; <add> <add>use Cake\ORM\TableRegistry; <add>use Cake\Utility\Inflector; <add> <add>/** <add> * Provides functionality for loading table classes <add> * and other repositories onto properties of the host object. <add> * <add> * Example users of this trait are Cake\Controller\Controller and <add> * Cake\Console\Shell. <add> */ <add>trait RepositoryAwareTrait { <add> <add>/** <add> * This object's primary model class name, the Inflector::singularize()'ed version of <add> * the object's $name property. <add> * <add> * Example: For a object named 'Comments', the modelClass would be 'Comment' <add> * <add> * @var string <add> */ <add> public $modelClass; <add> <add>/** <add> * This objects's repository key name, an underscored version of the objects's $modelClass property. <add> * <add> * Example: For an object named 'ArticleComments', the modelKey would be 'article_comment' <add> * <add> * @var string <add> */ <add> public $modelKey; <add> <add>/** <add> * Set the modelClass and modelKey properties based on conventions. <add> * <add> * If the properties are already set they w <add> */ <add> protected function _setModelClass($name) { <add> $this->modelClass = Inflector::singularize($this->name); <add> $this->modelKey = Inflector::underscore($this->modelClass); <add> } <add>/** <add> * Loads and constructs repository objects required by this object <add> * <add> * Typically used to load ORM Table objects as required. Can <add> * also be used to load other types of repository objects your application uses. <add> * <add> * If a repository provider does not return an object a MissingModelException will <add> * be thrown. <add> * <add> * @param string $modelClass Name of model class to load. Defaults to $this->modelClass <add> * @param string $type The type of repository to load. Defaults to 'Table' which <add> * delegates to Cake\ORM\TableRegistry. <add> * @return boolean True when single repository found and instance created. <add> * @throws Cake\Error\MissingModelException if the model class cannot be found. <add> */ <add> public function repository($modelClass = null, $type = 'Table') { <add> if (isset($this->{$modelClass})) { <add> return $this->{$modelClass}; <add> } <add> <add> if ($modelClass === null) { <add> $modelClass = $this->modelClass; <add> } <add> <add> list($plugin, $modelClass) = pluginSplit($modelClass, true); <add> <add> if ($type === 'Table') { <add> $this->{$modelClass} = TableRegistry::get($plugin . $modelClass); <add> } <add> // TODO add other providers <add> if (!$this->{$modelClass}) { <add> throw new Error\MissingModelException($modelClass); <add> } <add> return true; <add> } <add> <add>}
2
Java
Java
expose status in subprotocolwebsockethandler
fe92486cca981d3040124748221345f2fbc8dfe3
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> private final ReentrantLock sessionCheckLock = new ReentrantLock(); <ide> <del> private final Stats stats = new Stats(); <add> private final DefaultStats stats = new DefaultStats(); <ide> <ide> private volatile boolean running = false; <ide> <ide> public String getStatsInfo() { <ide> return this.stats.toString(); <ide> } <ide> <add> /** <add> * Return a {@link Stats} object that containers various session counters. <add> * @since 5.2 <add> */ <add> public Stats getStats() { <add> return this.stats; <add> } <add> <add> <ide> <ide> @Override <ide> public final void start() { <ide> public String toString() { <ide> } <ide> <ide> <del> private class Stats { <add> /** <add> * Contract for access to session counters. <add> * @since 5.2 <add> */ <add> public interface Stats { <add> <add> int getTotalSessions(); <add> <add> int getWebSocketSessions(); <add> <add> int getHttpStreamingSessions(); <add> <add> int getHttpPollingSessions(); <add> <add> int getLimitExceededSessions(); <add> <add> int getNoMessagesReceivedSessions(); <add> <add> int getTransportErrorSessions(); <add> } <add> <add> private class DefaultStats implements Stats { <ide> <ide> private final AtomicInteger total = new AtomicInteger(); <ide> <ide> private class Stats { <ide> <ide> private final AtomicInteger transportError = new AtomicInteger(); <ide> <del> public void incrementSessionCount(WebSocketSession session) { <add> <add> @Override <add> public int getTotalSessions() { <add> return this.total.get(); <add> } <add> <add> @Override <add> public int getWebSocketSessions() { <add> return this.webSocket.get(); <add> } <add> <add> @Override <add> public int getHttpStreamingSessions() { <add> return this.httpStreaming.get(); <add> } <add> <add> @Override <add> public int getHttpPollingSessions() { <add> return this.httpPolling.get(); <add> } <add> <add> @Override <add> public int getLimitExceededSessions() { <add> return this.limitExceeded.get(); <add> } <add> <add> @Override <add> public int getNoMessagesReceivedSessions() { <add> return this.noMessagesReceived.get(); <add> } <add> <add> @Override <add> public int getTransportErrorSessions() { <add> return this.transportError.get(); <add> } <add> <add> void incrementSessionCount(WebSocketSession session) { <ide> getCountFor(session).incrementAndGet(); <ide> this.total.incrementAndGet(); <ide> } <ide> <del> public void decrementSessionCount(WebSocketSession session) { <add> void decrementSessionCount(WebSocketSession session) { <ide> getCountFor(session).decrementAndGet(); <ide> } <ide> <del> public void incrementLimitExceededCount() { <add> void incrementLimitExceededCount() { <ide> this.limitExceeded.incrementAndGet(); <ide> } <ide> <del> public void incrementNoMessagesReceivedCount() { <add> void incrementNoMessagesReceivedCount() { <ide> this.noMessagesReceived.incrementAndGet(); <ide> } <ide> <del> public void incrementTransportError() { <add> void incrementTransportError() { <ide> this.transportError.incrementAndGet(); <ide> } <ide> <del> private AtomicInteger getCountFor(WebSocketSession session) { <add> AtomicInteger getCountFor(WebSocketSession session) { <ide> if (session instanceof PollingSockJsSession) { <ide> return this.httpPolling; <ide> }
1
Java
Java
fix typo in javadoc for @requestmapping
d2e1150c7999b347d159ffc8247b123a406bf382
<ide><path>spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java <ide> * produces = "text/plain;charset=UTF-8" <ide> * </pre> <ide> * <p>If a declared media type contains a parameter (e.g. "charset=UTF-8", <del> * "type=feed", type="entry") and if a compatible media type from the request <add> * "type=feed", "type=entry") and if a compatible media type from the request <ide> * has that parameter too, then the parameter values must match. Otherwise <ide> * if the media type from the request does not contain the parameter, it is <ide> * assumed the client accepts any value. <ide> * If specified at both levels, the method level produces condition overrides <ide> * the type level condition. <ide> * @see org.springframework.http.MediaType <del> * @see org.springframework.http.MediaType <ide> */ <ide> String[] produces() default {}; <ide>
1
Java
Java
implement fabricuimanagermodule in android
4371d1e1d0318c3aa03738583a24b833f0a33ba1
<ide><path>ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java <ide> public List<String> getViewManagerNames() { <ide> } else { <ide> return new UIManagerModule( <ide> reactContext, <del> mReactInstanceManager.createAllViewManagers(reactContext), <add> mReactInstanceManager.getOrCreateViewManagers(reactContext), <ide> mUIImplementationProvider, <ide> mMinTimeLeftInFrameForNonBatchedOperationMs); <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java <ide> public interface ReactInstanceEventListener { <ide> private final boolean mLazyNativeModulesEnabled; <ide> private final boolean mDelayViewManagerClassLoadsEnabled; <ide> private final @Nullable BridgeListener mBridgeListener; <add> private List<ViewManager> mViewManagers; <ide> <ide> private class ReactContextInitParams { <ide> private final JavaScriptExecutorFactory mJsExecutorFactory; <ide> public void detachRootView(ReactRootView rootView) { <ide> /** <ide> * Uses configured {@link ReactPackage} instances to create all view managers. <ide> */ <del> public List<ViewManager> createAllViewManagers( <add> public List<ViewManager> getOrCreateViewManagers( <ide> ReactApplicationContext catalystApplicationContext) { <ide> ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START); <ide> Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers"); <ide> try { <del> synchronized (mPackages) { <del> List<ViewManager> allViewManagers = new ArrayList<>(); <del> for (ReactPackage reactPackage : mPackages) { <del> allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext)); <add> if (mViewManagers == null) { <add> synchronized (mPackages) { <add> if (mViewManagers == null) { <add> mViewManagers = new ArrayList<>(); <add> for (ReactPackage reactPackage : mPackages) { <add> mViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext)); <add> } <add> return mViewManagers; <add> } <ide> } <del> return allViewManagers; <ide> } <add> return mViewManagers; <ide> } finally { <ide> Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); <ide> ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END); <ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerModule.java <ide> <ide> import com.facebook.react.bridge.ReactApplicationContext; <ide> import com.facebook.react.bridge.ReadableMap; <add>import com.facebook.react.uimanager.MeasureSpecProvider; <add>import com.facebook.react.uimanager.NativeViewHierarchyOptimizer; <add>import com.facebook.react.uimanager.ReactRootViewTagGenerator; <ide> import com.facebook.react.uimanager.ReactShadowNode; <add>import com.facebook.react.uimanager.ReactStylesDiffMap; <add>import com.facebook.react.uimanager.SizeMonitoringFrameLayout; <add>import com.facebook.react.uimanager.UIModule; <add>import com.facebook.react.uimanager.ViewManager; <add>import com.facebook.react.uimanager.ViewManagerRegistry; <ide> import java.util.ArrayList; <ide> import java.util.List; <ide> import javax.annotation.Nullable; <ide> * This class is responsible to create, clone and update {@link ReactShadowNode} using the <ide> * Fabric API. <ide> */ <del>public class FabricUIManagerModule { <add>@SuppressWarnings("unused") // used from JNI <add>public class FabricUIManagerModule implements UIModule { <ide> <ide> private final ReactApplicationContext mReactApplicationContext; <add> private final ViewManagerRegistry mViewManagerRegistry; <ide> <del> public FabricUIManagerModule(ReactApplicationContext reactContext) { <add> public FabricUIManagerModule(ReactApplicationContext reactContext, <add> ViewManagerRegistry viewManagerRegistry) { <ide> mReactApplicationContext = reactContext; <add> mViewManagerRegistry = viewManagerRegistry; <ide> } <ide> <ide> /** <ide> public FabricUIManagerModule(ReactApplicationContext reactContext) { <ide> public ReactShadowNode createNode(int reactTag, <ide> String viewName, <ide> int rootTag, <del> ReadableMap props, <del> int instanceHandle) { <del> //TODO T25560658 <del> return null; <add> ReadableMap props) { <add> <add> ViewManager viewManager = mViewManagerRegistry.get(viewName); <add> ReactShadowNode shadowNode = viewManager.createShadowNodeInstance(mReactApplicationContext); <add> shadowNode.setRootTag(rootTag); <add> shadowNode.setReactTag(reactTag); <add> ReactStylesDiffMap styles = updateProps(props, shadowNode); <add> <add> return shadowNode; <add> } <add> <add> private ReactStylesDiffMap updateProps(ReadableMap props, ReactShadowNode shadowNode) { <add> ReactStylesDiffMap styles = null; <add> if (props != null) { <add> styles = new ReactStylesDiffMap(props); <add> shadowNode.updateProperties(styles); <add> } <add> return styles; <ide> } <ide> <ide> /** <ide> public ReactShadowNode createNode(int reactTag, <ide> */ <ide> @Nullable <ide> public ReactShadowNode cloneNode(ReactShadowNode node) { <del> //TODO T25560658 <del> return null; <add> return node.mutableCopy(); <ide> } <ide> <ide> /** <ide> public ReactShadowNode cloneNode(ReactShadowNode node) { <ide> */ <ide> @Nullable <ide> public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node) { <del> //TODO T25560658 <del> return null; <add> ReactShadowNode clone = cloneNode(node); <add> clone.removeAllChildren(); <add> return clone; <ide> } <ide> <ide> /** <ide> public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node) { <ide> */ <ide> @Nullable <ide> public ReactShadowNode cloneNodeWithNewProps(ReactShadowNode node, ReadableMap newProps) { <del> //TODO T25560658 <del> return null; <add> ReactShadowNode clone = cloneNode(node); <add> updateProps(newProps, clone); <add> return clone; <ide> } <ide> <ide> /** <ide> public ReactShadowNode cloneNodeWithNewProps(ReactShadowNode node, ReadableMap n <ide> public ReactShadowNode cloneNodeWithNewChildrenAndProps( <ide> ReactShadowNode node, <ide> ReadableMap newProps) { <del> //TODO T25560658 <del> return null; <add> ReactShadowNode clone = cloneNodeWithNewChildren(node); <add> updateProps(newProps, clone); <add> return clone; <ide> } <ide> <ide> /** <ide> public ReactShadowNode cloneNodeWithNewChildrenAndProps( <ide> */ <ide> @Nullable <ide> public void appendChild(ReactShadowNode parent, ReactShadowNode child) { <del> //TODO T25560658 <add> parent.addChildAt(child, parent.getChildCount()); <ide> } <ide> <ide> /** <ide> public void appendChildToSet(List<ReactShadowNode> childList, ReactShadowNode ch <ide> } <ide> <ide> public void completeRoot(int rootTag, List<ReactShadowNode> childList) { <del> //TODO T25560658 <add> // TODO Diffing old Tree with new Tree? <add> // Do we need to hold references to old and new tree? <add> } <add> <add> @Override <add> public <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> int addRootView( <add> final T rootView) { <add> // TODO: complete with actual implementation <add> return ReactRootViewTagGenerator.getNextRootViewTag(); <ide> } <ide> <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java <ide> public void createView(int tag, String className, int rootViewTag, ReadableMap p <ide> cssNode.setReactTag(tag); <ide> cssNode.setViewClassName(className); <ide> cssNode.setRootNode(rootNode); <add> if (rootNode != null) cssNode.setRootTag(rootNode.getReactTag()); <ide> cssNode.setThemedContext(rootNode.getThemedContext()); <ide> <ide> mShadowNodeRegistry.addNode(cssNode); <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java <ide> */ <ide> @ReactModule(name = UIManagerModule.NAME) <ide> public class UIManagerModule extends ReactContextBaseJavaModule implements <del> OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter { <add> OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter, UIModule { <ide> <ide> /** <ide> * Enables lazy discovery of a specific {@link ViewManager} by its name. <ide> public Map<String, Long> getPerformanceCounters() { <ide> * <ide> * <p>TODO(6242243): Make addRootView thread safe NB: this method is horribly not-thread-safe. <ide> */ <add> @Override <ide> public <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> int addRootView( <ide> final T rootView) { <ide> Systrace.beginSection( <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/UIModule.java <add>package com.facebook.react.uimanager; <add> <add>public interface UIModule { <add> <add> <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> int addRootView(final T rootView); <add> <add>}
6
Python
Python
fix indentation for epytext
22c9289eb95a925f838ccc1260f104ff44fee704
<ide><path>libcloud/drivers/slicehost.py <ide> def destroy_node(self, node): <ide> """Destroys the node <ide> <ide> Requires 'Allow Slices to be deleted or rebuilt from the API' to be <del> ticked at https://manage.slicehost.com/api, otherwise returns: <del> <del> <errors> <del> <error>You must enable slice deletes in the SliceManager</error> <del> <error>Permission denied</error> <del> </errors> <add> ticked at https://manage.slicehost.com/api, otherwise returns:: <add> <errors> <add> <error>You must enable slice deletes in the SliceManager</error> <add> <error>Permission denied</error> <add> </errors> <ide> """ <ide> uri = '/slices/%s/destroy.xml' % (node.id) <ide> ret = self.connection.request(uri, method='PUT')
1
Ruby
Ruby
ensure pop stack
8749ecc3839c6093f56c6b80ebf794266a611472
<ide><path>Library/Homebrew/dependency.rb <ide> def expand(dependent, deps = dependent.deps, &block) <ide> end <ide> end <ide> <del> @expand_stack.pop <ide> merge_repeats(expanded_deps) <add> ensure <add> @expand_stack.pop <ide> end <ide> <ide> def action(dependent, dep, &_block)
1
Javascript
Javascript
remove special case for edge
70b801f3269738290e8edb2cd1326da7920d11f9
<ide><path>test/AngularSpec.js <ide> describe('angular', function() { <ide> protocol = 'browserext:'; // Upcoming standard scheme. <ide> } <ide> <del> <del> if (protocol === 'ms-browser-extension:') { <del> // Support: Edge 13-15 <del> // In Edge, URLs with protocol 'ms-browser-extension:' return "null" for the origin, <del> // therefore it's impossible to know if a script is same-origin. <del> it('should not bootstrap for same-origin documents', function() { <del> expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(false); <del> }); <del> <del> } else { <del> it('should bootstrap for same-origin documents', function() { <del> <del> expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true); <del> }); <del> } <add> it('should bootstrap for same-origin documents', function() { <add> expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something'}, protocol))).toBe(true); <add> }); <ide> <ide> it('should not bootstrap for cross-origin documents', function() { <ide> expect(allowAutoBootstrap(createFakeDoc({src: protocol + '//something-else'}, protocol))).toBe(false);
1
Javascript
Javascript
tohavebeencalledonce jasmine matcher
b99b0a80723ad3a9b43e9ef36869f521eaec19ec
<ide><path>test/testabilityPatch.js <ide> beforeEach(function(){ <ide> return "Expected " + expected + " to match an Error with message " + toJson(messageRegexp); <ide> }; <ide> return this.actual.name == 'Error' && messageRegexp.test(this.actual.message); <add> }, <add> <add> toHaveBeenCalledOnce: function() { <add> if (arguments.length > 0) { <add> throw new Error('toHaveBeenCalledOnce does not take arguments, use toHaveBeenCalledWith'); <add> } <add> <add> if (!jasmine.isSpy(this.actual)) { <add> throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); <add> } <add> <add> this.message = function() { <add> var msg = 'Expected spy ' + this.actual.identity + ' to have been called once, but was ', <add> count = this.actual.callCount; <add> return [ <add> count == 0 ? msg + 'never called.' <add> : msg + 'called ' + count + ' times.', <add> msg.replace('to have', 'not to have') + 'called once.' <add> ]; <add> }; <add> <add> return this.actual.callCount == 1; <ide> } <ide> }); <ide>
1
PHP
PHP
fix redis docblocks
df527d731c2fc21d9c18d513a515e1ba09e550d4
<ide><path>src/Illuminate/Redis/Connectors/PredisConnector.php <ide> class PredisConnector <ide> * Create a new clustered Predis connection. <ide> * <ide> * @param array $config <del> * @param array $clusterOptions <ide> * @param array $options <del> * @return \Illuminate\Redis\PredisConnection <add> * @return \Illuminate\Redis\Connections\PredisConnection <ide> */ <ide> public function connect(array $config, array $options) <ide> { <ide> public function connect(array $config, array $options) <ide> * @param array $config <ide> * @param array $clusterOptions <ide> * @param array $options <del> * @return \Illuminate\Redis\PredisClusterConnection <add> * @return \Illuminate\Redis\Connections\PredisClusterConnection <ide> */ <ide> public function connectToCluster(array $config, array $clusterOptions, array $options) <ide> {
1
PHP
PHP
fix cs errors
03b6149217edd7d4971ef0987b3ff584f8ad20eb
<ide><path>Cake/ORM/Association/BelongsToMany.php <ide> public function cascadeDelete(Entity $entity, $options = []) { <ide> $conditions = array_combine($foreignKey, $entity->extract((array)$primaryKey)); <ide> } <ide> <del> <ide> $table = $this->junction(); <ide> $hasMany = $this->source()->association($table->alias()); <ide> if ($this->_cascadeCallbacks) { <ide><path>Cake/ORM/Associations.php <ide> public function saveChildren(Table $table, Entity $entity, $associations, $optio <ide> * @param boolean $owningSide Compared with association classes' <ide> * isOwningSide method. <ide> * @return boolean Success <del> * @throws new \InvalidArgumentException When an unknown alias is used. <add> * @throws InvalidArgumentException When an unknown alias is used. <ide> */ <ide> protected function _saveAssociations($table, $entity, $associations, $options, $owningSide) { <ide> unset($options['associated']); <ide><path>Cake/Test/TestCase/ORM/AssociationsTest.php <ide> */ <ide> namespace Cake\Test\TestCase\ORM; <ide> <del>use Cake\ORM\Association\BelongsTo; <ide> use Cake\ORM\Associations; <add>use Cake\ORM\Association\BelongsTo; <ide> use Cake\ORM\Entity; <ide> use Cake\TestSuite\TestCase; <ide>
3
Java
Java
add application/*+xml to jaxb2xmlencoder
6d4c0091b545e6dd4596b6856e957e90797365e5
<ide><path>spring-web/src/main/java/org/springframework/http/codec/xml/Jaxb2XmlEncoder.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2021 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import org.springframework.core.io.buffer.DataBufferFactory; <ide> import org.springframework.core.io.buffer.DataBufferUtils; <ide> import org.springframework.core.log.LogFormatUtils; <add>import org.springframework.http.MediaType; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.util.MimeType; <ide> public class Jaxb2XmlEncoder extends AbstractSingleValueEncoder<Object> { <ide> <ide> <ide> public Jaxb2XmlEncoder() { <del> super(MimeTypeUtils.APPLICATION_XML, MimeTypeUtils.TEXT_XML); <add> super(MimeTypeUtils.APPLICATION_XML, MimeTypeUtils.TEXT_XML, new MediaType("application", "*+xml")); <ide> } <ide> <ide> <ide><path>spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2021 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> import static java.nio.charset.StandardCharsets.UTF_8; <ide> import static org.assertj.core.api.Assertions.assertThat; <add>import static org.springframework.core.ResolvableType.forClass; <ide> import static org.springframework.core.io.buffer.DataBufferUtils.release; <ide> <ide> /** <ide> public Jaxb2XmlEncoderTests() { <ide> @Override <ide> @Test <ide> public void canEncode() { <del> assertThat(this.encoder.canEncode(ResolvableType.forClass(Pojo.class), <del> MediaType.APPLICATION_XML)).isTrue(); <del> assertThat(this.encoder.canEncode(ResolvableType.forClass(Pojo.class), <del> MediaType.TEXT_XML)).isTrue(); <del> assertThat(this.encoder.canEncode(ResolvableType.forClass(Pojo.class), <del> MediaType.APPLICATION_JSON)).isFalse(); <del> <del> assertThat(this.encoder.canEncode( <del> ResolvableType.forClass(Jaxb2XmlDecoderTests.TypePojo.class), <del> MediaType.APPLICATION_XML)).isTrue(); <del> <del> assertThat(this.encoder.canEncode(ResolvableType.forClass(getClass()), <del> MediaType.APPLICATION_XML)).isFalse(); <add> assertThat(this.encoder.canEncode(forClass(Pojo.class), MediaType.APPLICATION_XML)).isTrue(); <add> assertThat(this.encoder.canEncode(forClass(Pojo.class), MediaType.TEXT_XML)).isTrue(); <add> assertThat(this.encoder.canEncode(forClass(Pojo.class), new MediaType("application", "foo+xml"))).isTrue(); <add> assertThat(this.encoder.canEncode(forClass(Pojo.class), MediaType.APPLICATION_JSON)).isFalse(); <add> <add> assertThat(this.encoder.canEncode(forClass(Jaxb2XmlDecoderTests.TypePojo.class), MediaType.APPLICATION_XML)).isTrue(); <add> assertThat(this.encoder.canEncode(forClass(getClass()), MediaType.APPLICATION_XML)).isFalse(); <ide> <ide> // SPR-15464 <ide> assertThat(this.encoder.canEncode(ResolvableType.NONE, null)).isFalse();
2
PHP
PHP
move skiplog handling to exceptiontrap
63585377e7c06311bcc66e8688a646b0566491e6
<ide><path>src/Error/ErrorLogger.php <ide> class ErrorLogger implements ErrorLoggerInterface <ide> /** <ide> * Default configuration values. <ide> * <del> * - `skipLog` List of exceptions to skip logging. Exceptions that <del> * extend one of the listed exceptions will also not be logged. <ide> * - `trace` Should error logs include stack traces? <ide> * <ide> * @var array<string, mixed> <ide> */ <ide> protected $_defaultConfig = [ <del> 'skipLog' => [], <ide> 'trace' => false, <ide> ]; <ide> <ide> public function logMessage($level, string $message, array $context = []): bool <ide> */ <ide> public function log(Throwable $exception, ?ServerRequestInterface $request = null): bool <ide> { <del> foreach ($this->getConfig('skipLog') as $class) { <del> if ($exception instanceof $class) { <del> return false; <del> } <del> } <del> <ide> $message = $this->getMessage($exception); <ide> <ide> if ($request !== null) { <ide><path>src/Error/ExceptionTrap.php <ide> public function handleFatalError(int $code, string $description, string $file, i <ide> */ <ide> public function logException(Throwable $exception, ?ServerRequestInterface $request = null): void <ide> { <del> if ($this->_config['log']) { <add> $shouldLog = $this->_config['log']; <add> if ($shouldLog) { <add> foreach ($this->getConfig('skipLog') as $class) { <add> if ($exception instanceof $class) { <add> $shouldLog = false; <add> } <add> } <add> } <add> if ($shouldLog) { <ide> $this->logger()->log($exception, $request); <ide> } <ide> $this->dispatchEvent('Exception.beforeRender', ['exception' => $exception]);
2
Text
Text
make notice in the readme into a link
d94e186442ef4ba3103a6ad72666782179d3c2b8
<ide><path>README.md <ide> We are always open to suggestions on process improvements, and are always lookin <ide> ### Legal <ide> <ide> *Brought to you courtesy of our legal counsel. For more context, <del>please see the "NOTICE" document in this repo.* <add>please see the [NOTICE](https://github.com/docker/docker/blob/master/NOTICE) document in this repo.* <ide> <ide> Use and transfer of Docker may be subject to certain restrictions by the <ide> United States and other governments.
1
PHP
PHP
add method for consistency
ed24e391a965d0eb2a73daeb625bb235257e6745
<ide><path>src/Illuminate/Mail/Mailer.php <ide> public function queue($view, array $data, $callback, $queue = null) <ide> * @param \Closure|string $callback <ide> * @return mixed <ide> */ <del> public function queueOn($queue, $view, array $data, $callback) <add> public function onQueue($queue, $view, array $data, $callback) <ide> { <ide> return $this->queue($view, $data, $callback, $queue); <ide> } <ide> <add> /** <add> * Queue a new e-mail message for sending on the given queue. <add> * <add> * This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue". <add> * <add> * @param string $queue <add> * @param string|array $view <add> * @param array $data <add> * @param \Closure|string $callback <add> * @return mixed <add> */ <add> public function queueOn($queue, $view, array $data, $callback) <add> { <add> return $this->onQueue($view, $data, $callback, $queue); <add> } <add> <ide> /** <ide> * Queue a new e-mail message for sending after (n) seconds. <ide> *
1
Text
Text
fix typo in actionview changelog [ci skip]
6ff026a1cdad6166bf2771ea24b7fa0f6a61e565
<ide><path>actionview/CHANGELOG.md <ide> * Change the default template handler from `ERB` to `Raw`. <ide> <del> Files without a template handler in their extension will be rended using the raw <add> Files without a template handler in their extension will be rendered using the raw <ide> handler instead of ERB. <ide> <ide> *Rafael Mendonça França*
1
Go
Go
improve chroot driver by mounting proc
92e6db7beba8ad58e425119cc9885c355a5755e7
<ide><path>execdriver/chroot/driver.go <ide> package chroot <ide> <ide> import ( <del> "fmt" <ide> "github.com/dotcloud/docker/execdriver" <del> "io/ioutil" <ide> "os/exec" <del> "path" <ide> "time" <ide> ) <ide> <ide> func NewDriver() (execdriver.Driver, error) { <ide> return &driver{}, nil <ide> } <ide> <add>func (d *driver) String() string { <add> return "chroot" <add>} <add> <ide> func (d *driver) Start(c *execdriver.Process) error { <del> data, _ := ioutil.ReadFile(c.SysInitPath) <del> ioutil.WriteFile(path.Join(c.Rootfs, ".dockerinit"), data, 0644) <ide> params := []string{ <ide> "chroot", <ide> c.Rootfs, <ide> "/.dockerinit", <add> "-driver", <add> d.String(), <ide> } <del> // need to mount proc <ide> params = append(params, c.Entrypoint) <ide> params = append(params, c.Arguments...) <ide> <ide><path>execdriver/driver.go <ide> type Driver interface { <ide> Kill(c *Process, sig int) error <ide> Wait(id string, duration time.Duration) error // Wait on an out of process option - lxc ghosts <ide> Version() string <add> String() string <ide> } <ide> <ide> // Network settings of the container <ide><path>execdriver/lxc/driver.go <ide> func NewDriver(root string, apparmor bool) (execdriver.Driver, error) { <ide> }, nil <ide> } <ide> <add>func (d *driver) String() string { <add> return "lxc" <add>} <add> <ide> func (d *driver) Start(c *execdriver.Process) error { <ide> params := []string{ <ide> startPath, <ide> "-n", c.ID, <ide> "-f", c.ConfigPath, <ide> "--", <ide> c.InitPath, <add> "-driver", <add> d.String(), <ide> } <ide> <ide> if c.Network != nil { <ide><path>mount/mount.go <ide> func Mounted(mountpoint string) (bool, error) { <ide> return false, nil <ide> } <ide> <del>// Mount the specified options at the target path <add>// Mount the specified options at the target path only if <add>// the target is not mounted <ide> // Options must be specified as fstab style <ide> func Mount(device, target, mType, options string) error { <ide> if mounted, err := Mounted(target); err != nil || mounted { <ide> return err <ide> } <add> return ForceMount(device, target, mType, options) <add>} <ide> <add>// Mount the specified options at the target path <add>// reguardless if the target is mounted or not <add>// Options must be specified as fstab style <add>func ForceMount(device, target, mType, options string) error { <ide> flag, data := parseOptions(options) <ide> if err := mount(device, target, mType, uintptr(flag), data); err != nil { <ide> return err <ide> } <ide> return nil <del> <ide> } <ide> <ide> // Unmount the target only if it is mounted <del>func Unmount(target string) (err error) { <add>func Unmount(target string) error { <ide> if mounted, err := Mounted(target); err != nil || !mounted { <ide> return err <ide> } <add> return ForceUnmount(target) <add>} <ide> <add>// Unmount the target reguardless if it is mounted or not <add>func ForceUnmount(target string) (err error) { <ide> // Simple retry logic for unmount <ide> for i := 0; i < 10; i++ { <ide> if err = unmount(target, 0); err == nil { <ide><path>sysinit/sysinit.go <ide> import ( <ide> "encoding/json" <ide> "flag" <ide> "fmt" <add> "github.com/dotcloud/docker/mount" <ide> "github.com/dotcloud/docker/pkg/netlink" <ide> "github.com/dotcloud/docker/utils" <ide> "github.com/syndtr/gocapability/capability" <ide> type DockerInitArgs struct { <ide> env []string <ide> args []string <ide> mtu int <add> driver string <ide> } <ide> <ide> func setupHostname(args *DockerInitArgs) error { <ide> func setupWorkingDirectory(args *DockerInitArgs) error { <ide> return nil <ide> } <ide> <add>func setupMounts(args *DockerInitArgs) error { <add> return mount.ForceMount("proc", "proc", "proc", "") <add>} <add> <ide> // Takes care of dropping privileges to the desired user <ide> func changeUser(args *DockerInitArgs) error { <ide> if args.user == "" { <ide> func getEnv(args *DockerInitArgs, key string) string { <ide> func executeProgram(args *DockerInitArgs) error { <ide> setupEnv(args) <ide> <del> if false { <add> if args.driver == "lxc" { <ide> if err := setupHostname(args); err != nil { <ide> return err <ide> } <ide> func executeProgram(args *DockerInitArgs) error { <ide> if err := changeUser(args); err != nil { <ide> return err <ide> } <add> } else if args.driver == "chroot" { <add> // TODO: @crosbymichael @creack how do we unmount this after the <add> // process exists? <add> if err := setupMounts(args); err != nil { <add> return err <add> } <ide> } <ide> <ide> path, err := exec.LookPath(args.args[0]) <ide> func SysInit() { <ide> workDir := flag.String("w", "", "workdir") <ide> privileged := flag.Bool("privileged", false, "privileged mode") <ide> mtu := flag.Int("mtu", 1500, "interface mtu") <add> driver := flag.String("driver", "", "exec driver") <ide> flag.Parse() <ide> <ide> // Get env <ide> func SysInit() { <ide> env: env, <ide> args: flag.Args(), <ide> mtu: *mtu, <add> driver: *driver, <ide> } <ide> <ide> if err := executeProgram(args); err != nil {
5
Text
Text
add release notes for action text [ci skip]
1a2de86568b34bab46b1a2b6e5b8e4567f914ded
<ide><path>actiontext/CHANGELOG.md <del>* Add method to confirm rich text content existence by adding `?` after content name. <add>* Add method to confirm rich text content existence by adding `?` after rich <add> text attribute. <add> <add> ```ruby <add> message = Message.create!(body: "<h1>Funny times!</h1>") <add> message.body? #=> true <add> ``` <ide> <ide> *Kyohei Toyoda* <ide> <del>* The `fill_in_rich_text_area` system test helper locates a Trix editor and fills it in with the given HTML: <add>* The `fill_in_rich_text_area` system test helper locates a Trix editor <add> and fills it in with the given HTML. <ide> <ide> ```ruby <ide> # <trix-editor id="message_content" ...></trix-editor> <ide><path>guides/source/6_1_release_notes.md <ide> Please refer to the [Changelog][active-storage] for detailed changes. <ide> <ide> ### Deprecations <ide> <add>* Deprecate `Blob.create_after_upload` in favor of `Blob.create_and_upload`. <add> ([Pull Request](https://github.com/rails/rails/pull/34827)) <add> <ide> ### Notable changes <ide> <add>* Add `Blob.create_and_upload` to create a new blob and upload the given `io` <add> to the service. <add> ([Pull Request](https://github.com/rails/rails/pull/34827)) <add> <ide> Active Model <ide> ------------ <ide> <ide> Please refer to the [Changelog][active-job] for detailed changes. <ide> <ide> ### Notable changes <ide> <add>Action Text <add>---------- <add> <add>Please refer to the [Changelog][action-text] for detailed changes. <add> <add>### Removals <add> <add>### Deprecations <add> <add>### Notable changes <add> <add>* Add method to confirm rich text content existence by adding `?` after <add> name of the rich text attribute. <add> ([Pull Request](https://github.com/rails/rails/pull/37951)) <add> <add>* Add `fill_in_rich_text_area` system test case helper to find a trix <add> editor and fill it with given HTML content. <add> ([Pull Request](https://github.com/rails/rails/pull/35885)) <add> <add>Action Mailbox <add>---------- <add> <add>Please refer to the [Changelog][action-mailbox] for detailed changes. <add> <add>### Removals <add> <add>### Deprecations <add> <add>### Notable changes <add> <ide> Ruby on Rails Guides <ide> -------------------- <ide> <ide> framework it is. Kudos to all of them. <ide> [active-model]: https://github.com/rails/rails/blob/master/activemodel/CHANGELOG.md <ide> [active-support]: https://github.com/rails/rails/blob/master/activesupport/CHANGELOG.md <ide> [active-job]: https://github.com/rails/rails/blob/master/activejob/CHANGELOG.md <add>[action-text]: https://github.com/rails/rails/blob/master/actiontext/CHANGELOG.md <add>[action-mailbox]: https://github.com/rails/rails/blob/master/actionmailbox/CHANGELOG.md <ide> [guides]: https://github.com/rails/rails/blob/master/guides/CHANGELOG.md
2
PHP
PHP
adjust deprecation texts
1c3d6af547114f90fa7a9322134b7014ec96c598
<ide><path>src/ORM/Table.php <ide> public function hasBehavior($name) <ide> /** <ide> * Returns an association object configured for the specified alias if any. <ide> * <del> * @deprecated 3.6.0 Use getAssociation() instead. <add> * @deprecated 3.6.0 Use getAssociation() and Table::hasAssocation() instead. <ide> * @param string $name the alias used for the association. <ide> * @return \Cake\ORM\Association|null Either the association or null. <ide> */ <ide> public function association($name) <ide> } <ide> <ide> /** <del> * Returns an association object configured for the specified alias if any. <add> * Returns an association object configured for the specified alias. <ide> * <ide> * The name argument also supports dot syntax to access deeper associations. <ide> *
1
Javascript
Javascript
handle file checksumming errors
5a66a14226912ec873c039e6e681f837b0fde2e0
<ide><path>activestorage/app/javascript/activestorage/direct_upload.js <ide> export class DirectUpload { <ide> <ide> create(callback) { <ide> FileChecksum.create(this.file, (error, checksum) => { <add> if (error) { <add> callback(error) <add> return <add> } <add> <ide> const blob = new BlobRecord(this.file, checksum, this.url) <ide> notify(this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr) <add> <ide> blob.create(error => { <ide> if (error) { <ide> callback(error)
1
Ruby
Ruby
add bintray class
e303a97aa710e781c9ccb0b5b7c7675f26862be3
<ide><path>Library/Homebrew/bottles.rb <ide> def bottle_filename_formula_name filename <ide> basename.rpartition("-#{version}").first <ide> end <ide> <add>class Bintray <add> def self.repository(tap=nil) <add> return "bottles" if tap.to_s.empty? <add> "bottles-#{tap.sub(/^homebrew\/homebrew-/i, "")}" <add> end <add> <add> def self.version(path) <add> BottleVersion.parse(path).to_s <add> end <add>end <add> <ide> class BottleCollector <ide> def initialize <ide> @checksums = {}
1
Javascript
Javascript
add a filter to issue-2895
ff2342001a15997ed025ba6516ecfd7a34dbb94b
<ide><path>test/cases/parsing/issue-2895/test.filter.js <add>var supportsBlockScoping = require("../../../helpers/supportsBlockScoping"); <add> <add>module.exports = function(config) { <add> return !config.minimize && supportsBlockScoping(); <add>}; <ide><path>test/helpers/supportsBlockScoping.js <add>module.exports = function supportsBlockScoping() { <add> try { <add> var f = eval("(function f() { const x = 1; if (true) { const x = 2; } return x; })"); <add> return f() === 1; <add> } catch(e) { <add> return false; <add> } <add>};
2
Python
Python
add format class attributes
12905449a5591cef2b2fc94d68cc273dc6df0463
<ide><path>rest_framework/fields.py <ide> class DateField(WritableField): <ide> 'invalid': _("Date has wrong format. Use one of these formats instead: %s"), <ide> } <ide> empty = None <add> input_formats = api_settings.DATE_INPUT_FORMATS <add> output_format = api_settings.DATE_OUTPUT_FORMAT <ide> <ide> def __init__(self, input_formats=None, output_format=None, *args, **kwargs): <del> self.input_formats = input_formats or api_settings.DATE_INPUT_FORMATS <del> self.output_format = output_format or api_settings.DATE_OUTPUT_FORMAT <add> self.input_formats = input_formats if input_formats is not None else self.input_formats <add> self.output_format = output_format if output_format is not None else self.output_format <ide> super(DateField, self).__init__(*args, **kwargs) <ide> <ide> def from_native(self, value): <ide> class DateTimeField(WritableField): <ide> 'invalid': _("Datetime has wrong format. Use one of these formats instead: %s"), <ide> } <ide> empty = None <add> input_formats = api_settings.DATETIME_INPUT_FORMATS <add> output_format = api_settings.DATETIME_OUTPUT_FORMAT <ide> <ide> def __init__(self, input_formats=None, output_format=None, *args, **kwargs): <del> self.input_formats = input_formats or api_settings.DATETIME_INPUT_FORMATS <del> self.output_format = output_format or api_settings.DATETIME_OUTPUT_FORMAT <add> self.input_formats = input_formats if input_formats is not None else self.input_formats <add> self.output_format = output_format if output_format is not None else self.output_format <ide> super(DateTimeField, self).__init__(*args, **kwargs) <ide> <ide> def from_native(self, value): <ide> class TimeField(WritableField): <ide> 'invalid': _("Time has wrong format. Use one of these formats instead: %s"), <ide> } <ide> empty = None <add> input_formats = api_settings.TIME_INPUT_FORMATS <add> output_format = api_settings.TIME_OUTPUT_FORMAT <ide> <ide> def __init__(self, input_formats=None, output_format=None, *args, **kwargs): <del> self.input_formats = input_formats or api_settings.TIME_INPUT_FORMATS <del> self.output_format = output_format or api_settings.TIME_OUTPUT_FORMAT <add> self.input_formats = input_formats if input_formats is not None else self.input_formats <add> self.output_format = output_format if output_format is not None else self.output_format <ide> super(TimeField, self).__init__(*args, **kwargs) <ide> <ide> def from_native(self, value):
1
Ruby
Ruby
add missing comma
62133326df3c7edff67a2e57ae32c95bf6e8a818
<ide><path>actionpack/lib/action_dispatch/testing/integration.rb <ide> def non_kwarg_request_warning <ide> get '/profile', <ide> params: { id: 1 }, <ide> headers: { 'X-Extra-Header' => '123' }, <del> env: { 'action_dispatch.custom' => 'custom' } <add> env: { 'action_dispatch.custom' => 'custom' }, <ide> xhr: true <ide> MSG <ide> end
1
Ruby
Ruby
cache the engine in the formatter
020b03749fff4b1fcea52553846ece822ea8e840
<ide><path>lib/arel/engines/sql/formatters.rb <ide> module Arel <ide> module Sql <ide> class Formatter <del> attr_reader :environment, :christener <add> attr_reader :environment, :christener, :engine <ide> <ide> def initialize(environment) <ide> @environment = environment <ide> @christener = environment.christener <add> @engine = environment.engine <ide> end <ide> <ide> def name_for thing <ide> @christener.name_for thing <ide> end <ide> <del> def engine <del> @environment.engine <del> end <del> <ide> def quote_column_name name <ide> engine.connection.quote_column_name name <ide> end
1
Javascript
Javascript
move commonjschunkformat into separate plugin
6ac97b3f58efca64df9c7102eb24801ec8dab9de
<ide><path>lib/javascript/CommonJsChunkFormatPlugin.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add> Author Tobias Koppers @sokra <add>*/ <add> <add>"use strict"; <add> <add>const { ConcatSource } = require("webpack-sources"); <add>const RuntimeGlobals = require("../RuntimeGlobals"); <add>const Template = require("../Template"); <add>const { getEntryInfo } = require("../web/JsonpHelpers"); <add>const { <add> getChunkFilenameTemplate, <add> chunkHasJs, <add> getCompilationHooks <add>} = require("./JavascriptModulesPlugin"); <add> <add>/** @typedef {import("../Compiler")} Compiler */ <add> <add>class CommonJsChunkFormatPlugin { <add> /** <add> * Apply the plugin <add> * @param {Compiler} compiler the compiler instance <add> * @returns {void} <add> */ <add> apply(compiler) { <add> compiler.hooks.thisCompilation.tap( <add> "CommonJsChunkFormatPlugin", <add> compilation => { <add> const hooks = getCompilationHooks(compilation); <add> hooks.renderChunk.tap( <add> "CommonJsChunkFormatPlugin", <add> (modules, renderContext) => { <add> const { chunk, chunkGraph, runtimeTemplate } = renderContext; <add> const source = new ConcatSource(); <add> source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); <add> source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); <add> source.add(`exports.modules = `); <add> source.add(modules); <add> source.add(";\n"); <add> const runtimeModules = chunkGraph.getChunkRuntimeModulesInOrder( <add> chunk <add> ); <add> if (runtimeModules.length > 0) { <add> source.add("exports.runtime =\n"); <add> source.add( <add> Template.renderChunkRuntimeModules( <add> runtimeModules, <add> renderContext <add> ) <add> ); <add> } <add> const entries = Array.from( <add> chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) <add> ); <add> if (entries.length > 0) { <add> const runtimeChunk = entries[0][1].getRuntimeChunk(); <add> const currentOutputName = compilation <add> .getPath( <add> getChunkFilenameTemplate(chunk, compilation.outputOptions), <add> { <add> chunk, <add> contentHashType: "javascript" <add> } <add> ) <add> .split("/"); <add> const runtimeOutputName = compilation <add> .getPath( <add> getChunkFilenameTemplate( <add> runtimeChunk, <add> compilation.outputOptions <add> ), <add> { <add> chunk: runtimeChunk, <add> contentHashType: "javascript" <add> } <add> ) <add> .split("/"); <add> <add> // remove filename, we only need the directory <add> currentOutputName.pop(); <add> <add> // remove common parts <add> while ( <add> currentOutputName.length > 0 && <add> runtimeOutputName.length > 0 && <add> currentOutputName[0] === runtimeOutputName[0] <add> ) { <add> currentOutputName.shift(); <add> runtimeOutputName.shift(); <add> } <add> <add> // create final path <add> const runtimePath = <add> (currentOutputName.length > 0 <add> ? "../".repeat(currentOutputName.length) <add> : "./") + runtimeOutputName.join("/"); <add> <add> const entrySource = new ConcatSource(); <add> entrySource.add( <add> `(${ <add> runtimeTemplate.supportsArrowFunction() <add> ? "() => " <add> : "function() " <add> }{\n` <add> ); <add> entrySource.add("var exports = {};\n"); <add> entrySource.add(source); <add> entrySource.add(";\n\n// load runtime\n"); <add> entrySource.add( <add> `var __webpack_require__ = require(${JSON.stringify( <add> runtimePath <add> )});\n` <add> ); <add> entrySource.add( <add> `${RuntimeGlobals.externalInstallChunk}(exports);\n` <add> ); <add> for (let i = 0; i < entries.length; i++) { <add> const [module, entrypoint] = entries[i]; <add> entrySource.add( <add> `${i === entries.length - 1 ? "return " : ""}${ <add> RuntimeGlobals.startupEntrypoint <add> }(${JSON.stringify( <add> entrypoint.chunks <add> .filter(c => c !== chunk && c !== runtimeChunk) <add> .map(c => c.id) <add> )}, ${JSON.stringify(chunkGraph.getModuleId(module))});\n` <add> ); <add> } <add> entrySource.add("})()"); <add> return entrySource; <add> } <add> return source; <add> } <add> ); <add> hooks.chunkHash.tap( <add> "CommonJsChunkFormatPlugin", <add> (chunk, hash, { chunkGraph }) => { <add> if (chunk.hasRuntime()) return; <add> hash.update("CommonJsChunkFormatPlugin"); <add> hash.update("1"); <add> hash.update( <add> JSON.stringify( <add> getEntryInfo(chunkGraph, chunk, c => chunkHasJs(c, chunkGraph)) <add> ) <add> ); <add> } <add> ); <add> } <add> ); <add> } <add>} <add> <add>module.exports = CommonJsChunkFormatPlugin; <ide><path>lib/node/NodeTemplatePlugin.js <ide> <ide> "use strict"; <ide> <del>const { ConcatSource } = require("webpack-sources"); <ide> const RuntimeGlobals = require("../RuntimeGlobals"); <del>const Template = require("../Template"); <del>const JavascriptModulesPlugin = require("../javascript/JavascriptModulesPlugin"); <del>const { <del> getChunkFilenameTemplate <del>} = require("../javascript/JavascriptModulesPlugin"); <add>const CommonJsChunkFormatPlugin = require("../javascript/CommonJsChunkFormatPlugin"); <ide> const StartupChunkDependenciesPlugin = require("../runtime/StartupChunkDependenciesPlugin"); <ide> <ide> /** @typedef {import("../Compiler")} Compiler */ <ide> class NodeTemplatePlugin { <ide> asyncChunkLoading: this.asyncChunkLoading, <ide> exposedGlobal: "module.exports" <ide> }).apply(compiler); <add> new CommonJsChunkFormatPlugin().apply(compiler); <ide> compiler.hooks.thisCompilation.tap("NodeTemplatePlugin", compilation => { <del> const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); <del> hooks.renderChunk.tap("NodeTemplatePlugin", (modules, renderContext) => { <del> const { chunk, chunkGraph, runtimeTemplate } = renderContext; <del> const source = new ConcatSource(); <del> source.add(`exports.id = ${JSON.stringify(chunk.id)};\n`); <del> source.add(`exports.ids = ${JSON.stringify(chunk.ids)};\n`); <del> source.add(`exports.modules = `); <del> source.add(modules); <del> source.add(";\n"); <del> const runtimeModules = chunkGraph.getChunkRuntimeModulesInOrder(chunk); <del> if (runtimeModules.length > 0) { <del> source.add("exports.runtime =\n"); <del> source.add( <del> Template.renderChunkRuntimeModules(runtimeModules, renderContext) <del> ); <del> } <del> const entries = Array.from( <del> chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk) <del> ); <del> if (entries.length > 0) { <del> const runtimeChunk = entries[0][1].getRuntimeChunk(); <del> const currentOutputName = compilation <del> .getPath( <del> getChunkFilenameTemplate(chunk, compilation.outputOptions), <del> { <del> chunk, <del> contentHashType: "javascript" <del> } <del> ) <del> .split("/"); <del> const runtimeOutputName = compilation <del> .getPath( <del> getChunkFilenameTemplate(runtimeChunk, compilation.outputOptions), <del> { <del> chunk: runtimeChunk, <del> contentHashType: "javascript" <del> } <del> ) <del> .split("/"); <del> <del> // remove filename, we only need the directory <del> currentOutputName.pop(); <del> <del> // remove common parts <del> while ( <del> currentOutputName.length > 0 && <del> runtimeOutputName.length > 0 && <del> currentOutputName[0] === runtimeOutputName[0] <del> ) { <del> currentOutputName.shift(); <del> runtimeOutputName.shift(); <del> } <del> <del> // create final path <del> const runtimePath = <del> (currentOutputName.length > 0 <del> ? "../".repeat(currentOutputName.length) <del> : "./") + runtimeOutputName.join("/"); <del> <del> const entrySource = new ConcatSource(); <del> entrySource.add( <del> `(${ <del> runtimeTemplate.supportsArrowFunction() ? "() => " : "function() " <del> }{\n` <del> ); <del> entrySource.add("var exports = {};\n"); <del> entrySource.add(source); <del> entrySource.add(";\n\n// load runtime\n"); <del> entrySource.add( <del> `var __webpack_require__ = require(${JSON.stringify( <del> runtimePath <del> )});\n` <del> ); <del> entrySource.add(`${RuntimeGlobals.externalInstallChunk}(exports);\n`); <del> for (let i = 0; i < entries.length; i++) { <del> const [module, entrypoint] = entries[i]; <del> entrySource.add( <del> `${i === entries.length - 1 ? "return " : ""}${ <del> RuntimeGlobals.startupEntrypoint <del> }(${JSON.stringify( <del> entrypoint.chunks <del> .filter(c => c !== chunk && c !== runtimeChunk) <del> .map(c => c.id) <del> )}, ${JSON.stringify(chunkGraph.getModuleId(module))});\n` <del> ); <del> } <del> entrySource.add("})()"); <del> return entrySource; <del> } <del> return source; <del> }); <del> hooks.render.tap("NodeTemplatePlugin", (source, renderContext) => { <del> const { chunk, chunkGraph } = renderContext; <del> if (!chunk.hasRuntime()) return source; <del> if (chunkGraph.getNumberOfEntryModules(chunk) > 0) return source; <del> // const result = new ConcatSource(); <del> //return result; <del> }); <del> hooks.chunkHash.tap("NodeTemplatePlugin", (chunk, hash) => { <del> if (chunk.hasRuntime()) return; <del> hash.update("node"); <del> hash.update("1"); <del> }); <del> <ide> const onceForChunkSet = new WeakSet(); <ide> const handler = (chunk, set) => { <ide> if (onceForChunkSet.has(chunk)) return;
2
PHP
PHP
add plugin shell
37f542d72d8f731aa08008d64d5e26c7d39e777b
<ide><path>src/Shell/PluginShell.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since 3.0.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Shell; <add> <add>use Cake\Console\Shell; <add> <add>/** <add> * Shell for Plugin management. <add> * <add> */ <add>class PluginShell extends Shell { <add> <add>/** <add> * Contains tasks to load and instantiate <add> * <add> * @var array <add> */ <add> public $tasks = ['SymlinkAssets']; <add> <add>/** <add> * Override main() for help message hook <add> * <add> * @return void <add> */ <add> public function main() { <add> $this->out('<info>Plugin Shell</info>'); <add> $this->hr(); <add> $this->out('[S]ymlink / copy assets to app\'s webroot'); <add> $this->out('[H]elp'); <add> $this->out('[Q]uit'); <add> <add> $choice = strtolower($this->in('What would you like to do?', ['S', 'H', 'Q'])); <add> switch ($choice) { <add> case 's': <add> $this->SymlinkAssets->main(); <add> break; <add> case 'h': <add> $this->out($this->OptionParser->help()); <add> break; <add> case 'q': <add> return $this->_stop(); <add> default: <add> $this->out('You have made an invalid selection. Please choose a command to execute by entering S, H, or Q.'); <add> } <add> $this->hr(); <add> $this->main(); <add> } <add> <add>/** <add> * Gets the option parser instance and configures it. <add> * <add> * @return \Cake\Console\ConsoleOptionParser <add> */ <add> public function getOptionParser() { <add> $parser = parent::getOptionParser(); <add> <add> $parser->description( <add> 'Plugin Shell symlinks your plugin assets to app\'s webroot.' <add> )->addSubcommand('symlink_assets', [ <add> 'help' => 'Symlink assets to app\'s webroot', <add> 'parser' => $this->SymlinkAssets->getOptionParser() <add> ]); <add> <add> return $parser; <add> } <add> <add>} <ide><path>src/Shell/Task/SymlinkAssetsTask.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since 3.0.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Shell\Task; <add> <add>use Cake\Console\Shell; <add>use Cake\Core\App; <add>use Cake\Core\Plugin; <add>use Cake\Filesystem\Folder; <add>use Cake\Utility\Inflector; <add> <add>/** <add> * Language string extractor <add> * <add> */ <add>class SymlinkAssetsTask extends Shell { <add> <add>/** <add> * Execution method always used for tasks <add> * <add> * @return void <add> */ <add> public function main() { <add> $this->_symlink(); <add> } <add> <add>/** <add> * Symlink folder <add> * <add> * @return void <add> */ <add> protected function _symlink() { <add> $this->out(); <add> $this->out(); <add> $this->out('Symlinking...'); <add> $this->hr(); <add> $plugins = Plugin::loaded(); <add> foreach ($plugins as $plugin) { <add> $this->out('For plugin: ' . $plugin); <add> $this->out(); <add> <add> $link = Inflector::underscore($plugin); <add> $dir = WWW_ROOT; <add> if (file_exists($dir . $link)) { <add> $this->out($link . ' already exists'); <add> $this->out(); <add> continue; <add> } <add> <add> if (strpos('/', $link) !== false) { <add> $parts = explode('/', $link); <add> $link = array_pop($parts); <add> $dir = WWW_ROOT . implode(DS, $parts) . DS; <add> if (!is_dir($dir)) { <add> $this->out('Creating directory: ' . $dir); <add> $this->out(); <add> $old = umask(0); <add> mkdir($dir, 0755, true); <add> umask($old); <add> } <add> } <add> <add> $path = Plugin::path($plugin) . 'webroot'; <add> $this->out('Creating symlink: ' . $dir); <add> $this->out(); <add> // @codingStandardsIgnoreStart <add> $result = @symlink($path, $dir . $link); <add> // @codingStandardsIgnoreEnd <add> <add> if (!$result) { <add> $this->err('Symlink creation failed'); <add> $this->out('Copying to directory:' . $dir); <add> $this->out(); <add> $folder = new Folder($path); <add> $folder->copy(['to' => $dir . $link]); <add> } <add> } <add> <add> $this->out(); <add> $this->out('Done.'); <add> } <add> <add>} <ide><path>tests/TestCase/Shell/Task/SymlinkAssetsTaskTest.php <add><?php <add>/** <add> * CakePHP : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP Project <add> * @since 3.0.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\Shell\Task; <add> <add>use Cake\Core\App; <add>use Cake\Core\Configure; <add>use Cake\Core\Plugin; <add>use Cake\Filesystem\Folder; <add>use Cake\Shell\Task\SymlinkAssetsTask; <add>use Cake\TestSuite\TestCase; <add> <add>/** <add> * SymlinkAssetsTask class <add> * <add> */ <add>class SymlinkAssetsTaskTest extends TestCase { <add> <add>/** <add> * setUp method <add> * <add> * @return void <add> */ <add> public function setUp() { <add> parent::setUp(); <add> $this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); <add> <add> $this->Task = $this->getMock( <add> 'Cake\Shell\Task\SymlinkAssetsTask', <add> array('in', 'out', 'err', '_stop'), <add> array($this->io) <add> ); <add> } <add> <add>/** <add> * tearDown method <add> * <add> * @return void <add> */ <add> public function tearDown() { <add> parent::tearDown(); <add> unset($this->Task); <add> Plugin::unload(); <add> } <add> <add>/** <add> * testExecute method <add> * <add> * @return void <add> */ <add> public function testExecute() { <add> Plugin::load('TestPlugin'); <add> Plugin::load('Company/TestPluginThree'); <add> <add> $this->Task->main(); <add> <add> $path = WWW_ROOT . 'test_plugin'; <add> $link = new \SplFileInfo($path); <add> $this->assertTrue($link->isLink()); <add> $this->assertTrue(file_exists($path . DS . 'root.js')); <add> unlink($path); <add> <add> $path = WWW_ROOT . 'company' . DS . 'test_plugin_three'; <add> $link = new \SplFileInfo($path); <add> $this->assertTrue($link->isLink()); <add> $this->assertTrue(file_exists($path . DS . 'css' . DS . 'company.css')); <add> $folder = new Folder(WWW_ROOT . 'company'); <add> $folder->delete(); <add> } <add> <add>}
3
Ruby
Ruby
fix rubocop warnings
5e0c22202955243e07ab18a56ea8019b3dd200c6
<ide><path>Library/Homebrew/cmd/desc.rb <ide> def desc <ide> results.print <ide> elsif search_type.size > 1 <ide> odie "Pick one, and only one, of -s/--search, -n/--name, or -d/--description." <add> elsif arg = ARGV.named.first <add> regex = Homebrew.query_regexp(arg) <add> results = Descriptions.search(regex, search_type.first) <add> results.print <ide> else <del> if arg = ARGV.named.first <del> regex = Homebrew::query_regexp(arg) <del> results = Descriptions.search(regex, search_type.first) <del> results.print <del> else <del> odie "You must provide a search term." <del> end <add> odie "You must provide a search term." <ide> end <ide> end <ide> end
1
Ruby
Ruby
remove need for macro instance var
8c263d53b3b9d190a8ae564ca043b96b76c76877
<ide><path>activerecord/lib/active_record/reflection.rb <ide> class MacroReflection < AbstractReflection <ide> # <tt>has_many :clients</tt> returns <tt>:clients</tt> <ide> attr_reader :name <ide> <del> # Returns the macro type. <del> # <del> # <tt>composed_of :balance, class_name: 'Money'</tt> returns <tt>:composed_of</tt> <del> # <tt>has_many :clients</tt> returns <tt>:has_many</tt> <del> attr_reader :macro <del> <ide> attr_reader :scope <ide> <ide> # Returns the hash of options used for the macro. <ide> def scope_chain <ide> scope ? [[scope]] : [[]] <ide> end <ide> <del> alias :source_macro :macro <add> def source_macro; macro; end <ide> <ide> def has_inverse? <ide> inverse_name <ide> def polymorphic_inverse_of(associated_class) <ide> end <ide> end <ide> <add> # Returns the macro type. <add> # <add> # <tt>has_many :clients</tt> returns <tt>:has_many</tt> <add> def macro; raise NotImplementedError; end <add> <ide> # Returns whether or not this association reflection is for a collection <ide> # association. Returns +true+ if the +macro+ is either +has_many+ or <ide> # +has_and_belongs_to_many+, +false+ otherwise. <ide> def primary_key(klass) <ide> <ide> class HasManyReflection < AssociationReflection #:nodoc: <ide> def initialize(name, scope, options, active_record) <del> @macro = :has_many <ide> super(name, scope, options, active_record) <ide> end <ide> <add> def macro; :has_many; end <add> <ide> def collection? <ide> true <ide> end <ide> end <ide> <ide> class HasOneReflection < AssociationReflection #:nodoc: <ide> def initialize(name, scope, options, active_record) <del> @macro = :has_one <ide> super(name, scope, options, active_record) <ide> end <add> <add> def macro; :has_one; end <ide> end <ide> <ide> class BelongsToReflection < AssociationReflection #:nodoc: <ide> def initialize(name, scope, options, active_record) <del> @macro = :belongs_to <ide> super(name, scope, options, active_record) <ide> end <add> <add> def macro; :belongs_to; end <ide> end <ide> <ide> class HasAndBelongsToManyReflection < AssociationReflection #:nodoc: <ide> def initialize(name, scope, options, active_record) <del> @macro = :has_and_belongs_to_many <ide> super <ide> end <ide> <add> def macro; :has_and_belongs_to_many; end <add> <ide> def collection? <ide> true <ide> end
1
Ruby
Ruby
remove redefined method
c967c5eb8331569f69de4f04b5a73f2a8923565b
<ide><path>actionpack/lib/action_dispatch/http/response.rb <ide> def delete_cookie(key, value={}) <ide> end <ide> <ide> # The location header we'll be responding with. <del> def location <del> headers[LOCATION] <del> end <ide> alias_method :redirect_url, :location <ide> <ide> # Sets the location header we'll be responding with.
1
Python
Python
avoid dropout at runtime
f8a1c1afd6fff111b4434e6d19a2b1aec5b55501
<ide><path>spacy/about.py <ide> # fmt: off <ide> __title__ = "spacy-nightly" <del>__version__ = "3.0.0a40" <add>__version__ = "3.0.0a41" <ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download" <ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json" <ide> __projects__ = "https://github.com/explosion/projects" <ide><path>spacy/ml/staticvectors.py <ide> def forward( <ide> key_attr = model.attrs["key_attr"] <ide> W = cast(Floats2d, model.ops.as_contig(model.get_param("W"))) <ide> V = cast(Floats2d, docs[0].vocab.vectors.data) <del> mask = _get_drop_mask(model.ops, W.shape[0], model.attrs.get("dropout_rate")) <ide> rows = model.ops.flatten( <ide> [doc.vocab.vectors.find(keys=doc.to_array(key_attr)) for doc in docs] <ide> ) <ide> output = Ragged( <ide> model.ops.gemm(model.ops.as_contig(V[rows]), W, trans2=True), <ide> model.ops.asarray([len(doc) for doc in docs], dtype="i"), <ide> ) <del> if mask is not None: <del> output.data *= mask <add> mask = None <add> if is_train: <add> mask = _get_drop_mask(model.ops, W.shape[0], model.attrs.get("dropout_rate")) <add> if mask is not None: <add> output.data *= mask <ide> <ide> def backprop(d_output: Ragged) -> List[Doc]: <ide> if mask is not None:
2
Ruby
Ruby
remove unused require
88aaa36bec984ed84d148dee6c3d56d92c96f026
<ide><path>Library/Homebrew/cmd/list.rb <ide> def list <ide> return unless HOMEBREW_CELLAR.exist? <ide> <ide> if ARGV.include? '--pinned' <del> require 'formula' <ide> list_pinned <ide> elsif ARGV.include? '--versions' <ide> list_versions
1
Go
Go
prevent user from deleting pre-defined networks
ead62b59522bba132b9a14712e4350439e7fa2a5
<ide><path>api/server/router/network/network_routes.go <ide> import ( <ide> "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/daemon/network" <ide> "github.com/docker/docker/pkg/parsers/filters" <add> "github.com/docker/docker/runconfig" <ide> "github.com/docker/libnetwork" <ide> ) <ide> <ide> func (n *networkRouter) postNetworkCreate(ctx context.Context, w http.ResponseWr <ide> return err <ide> } <ide> <add> if runconfig.IsPreDefinedNetwork(create.Name) { <add> return httputils.WriteJSON(w, http.StatusForbidden, <add> fmt.Sprintf("%s is a pre-defined network and cannot be created", create.Name)) <add> } <add> <ide> nw, err := n.daemon.GetNetwork(create.Name, daemon.NetworkByName) <ide> if _, ok := err.(libnetwork.ErrNoSuchNetwork); err != nil && !ok { <ide> return err <ide> func (n *networkRouter) deleteNetwork(ctx context.Context, w http.ResponseWriter <ide> return err <ide> } <ide> <add> if runconfig.IsPreDefinedNetwork(nw.Name()) { <add> return httputils.WriteJSON(w, http.StatusForbidden, <add> fmt.Sprintf("%s is a pre-defined network and cannot be removed", nw.Name())) <add> } <add> <ide> return nw.Delete() <ide> } <ide> <ide><path>integration-cli/docker_api_network_test.go <ide> func (s *DockerSuite) TestApiNetworkIpamMultipleBridgeNetworks(c *check.C) { <ide> } <ide> } <ide> <add>func (s *DockerSuite) TestApiCreateDeletePredefinedNetworks(c *check.C) { <add> createDeletePredefinedNetwork(c, "bridge") <add> createDeletePredefinedNetwork(c, "none") <add> createDeletePredefinedNetwork(c, "host") <add>} <add> <add>func createDeletePredefinedNetwork(c *check.C, name string) { <add> // Create pre-defined network <add> config := types.NetworkCreate{ <add> Name: name, <add> CheckDuplicate: true, <add> } <add> shouldSucceed := false <add> createNetwork(c, config, shouldSucceed) <add> deleteNetwork(c, name, shouldSucceed) <add>} <add> <ide> func isNetworkAvailable(c *check.C, name string) bool { <ide> status, body, err := sockRequest("GET", "/networks", nil) <ide> c.Assert(status, checker.Equals, http.StatusOK) <ide> func deleteNetwork(c *check.C, id string, shouldSucceed bool) { <ide> status, _, err := sockRequest("DELETE", "/networks/"+id, nil) <ide> if !shouldSucceed { <ide> c.Assert(status, checker.Not(checker.Equals), http.StatusOK) <del> c.Assert(err, checker.NotNil) <ide> return <ide> } <ide> c.Assert(status, checker.Equals, http.StatusOK) <ide><path>runconfig/hostconfig_unix.go <ide> func (n NetworkMode) IsUserDefined() bool { <ide> return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() <ide> } <ide> <add>// IsPreDefinedNetwork indicates if a network is predefined by the daemon <add>func IsPreDefinedNetwork(network string) bool { <add> n := NetworkMode(network) <add> return n.IsBridge() || n.IsHost() || n.IsNone() <add>} <add> <ide> //UserDefined indicates user-created network <ide> func (n NetworkMode) UserDefined() string { <ide> if n.IsUserDefined() { <ide><path>runconfig/hostconfig_windows.go <ide> func MergeConfigs(config *Config, hostConfig *HostConfig) *ContainerConfigWrappe <ide> hostConfig, <ide> } <ide> } <add> <add>// IsPreDefinedNetwork indicates if a network is predefined by the daemon <add>func IsPreDefinedNetwork(network string) bool { <add> return false <add>}
4
Python
Python
remove manual check for regularizers (use auto)
4d267f5ba3c24781dd190aeb633f93558c0100f6
<ide><path>tests/manual/check_activity_reg.py <del>from keras.datasets import mnist <del>from keras.models import Sequential <del>from keras.layers.core import Dense, Flatten, ActivityRegularization <del>from keras.utils import np_utils <del>from keras.regularizers import activity_l1 <del> <del>import numpy as np <del> <del>np.random.seed(1337) <del> <del>max_train_samples = 128*8 <del>max_test_samples = 1000 <del> <del>(X_train, y_train), (X_test, y_test) = mnist.load_data() <del> <del>X_train = X_train.reshape((-1, 28*28)) <del>X_test = X_test.reshape((-1, 28*28)) <del> <del>nb_classes = len(np.unique(y_train)) <del>Y_train = np_utils.to_categorical(y_train, nb_classes)[:max_train_samples] <del>Y_test = np_utils.to_categorical(y_test, nb_classes)[:max_test_samples] <del> <del>model_noreg = Sequential() <del>model_noreg.add(Flatten()) <del>model_noreg.add(Dense(28*28, 20, activation='sigmoid')) <del>model_noreg.add(Dense(20, 10, activation='sigmoid')) <del> <del>model_noreg.compile(loss='categorical_crossentropy', optimizer='rmsprop') <del>model_noreg.fit(X_train, Y_train) <del> <del>score_noreg = model_noreg.evaluate(X_test, Y_test) <del>score_train_noreg = model_noreg.evaluate(X_train, Y_train) <del> <del>model_reg = Sequential() <del>model_reg.add(Flatten()) <del>model_reg.add(Dense(28*28, 20, activation='sigmoid')) <del>model_reg.add(ActivityRegularization(activity_l1(0.1))) <del>model_reg.add(Dense(20, 10, activation='sigmoid')) <del> <del>model_reg.compile(loss='categorical_crossentropy', optimizer='rmsprop') <del>model_reg.fit(X_train, Y_train) <del> <del>score_reg = model_reg.evaluate(X_test, Y_test) <del>score_train_reg = model_reg.evaluate(X_train, Y_train) <del> <del>print <del>print <del>print "Overfitting without regularisation: %f - %f = %f" % ( score_noreg , score_train_noreg , score_noreg-score_train_noreg) <del>print "Overfitting with regularisation: %f - %f = %f" % ( score_reg , score_train_reg , score_reg-score_train_reg)
1
Ruby
Ruby
fix dependency equality
6eced20b351a4dab4a1cbf75fe7a9d1975602512
<ide><path>Library/Homebrew/dependencies.rb <ide> def to_s <ide> end <ide> <ide> def ==(other_dep) <del> @name = other_dep.to_s <add> @name == other_dep.to_s <ide> end <ide> <ide> def options
1