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
reduce memory allocations
4ea64630aa3f0699f1fa6872b10faf1d0e1a9cd8
<ide><path>actionpack/lib/action_dispatch/journey/router/utils.rb <ide> class UriEncoder # :nodoc: <ide> US_ASCII = Encoding::US_ASCII <ide> UTF_8 = Encoding::UTF_8 <ide> EMPTY = (+"").force_encoding(US_ASCII).freeze <del> DEC2HEX = (0..255).to_a.map { |i| ENCODE % i }.map { |s| s.force_encoding(US_ASCII) } <add> DEC2HEX = (0..255).map { |i| (ENCODE % i).force_encoding(US_ASCII) }.freeze <ide> <ide> ALPHA = "a-zA-Z" <ide> DIGIT = "0-9"
1
Javascript
Javascript
add nested flatlist rntester example
be620298cd99b0fa995b2a64f08a67e4ea621541
<ide><path>packages/rn-tester/js/examples/FlatList/FlatList-nested.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow strict-local <add> */ <add> <add>'use strict'; <add> <add>import * as React from 'react'; <add>import {useCallback, useEffect, useReducer} from 'react'; <add>import {FlatList, StyleSheet, Text, View} from 'react-native'; <add> <add>import RNTesterPage from '../../components/RNTesterPage'; <add>import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; <add> <add>type OuterItem = 'head' | 'vertical' | 'horizontal' | 'filler'; <add> <add>const outerItems: OuterItem[] = [ <add> 'head', <add> 'vertical', <add> 'filler', <add> 'horizontal', <add> 'filler', <add> 'vertical', <add>]; <add> <add>const items = [1, 2, 3, 4, 5]; <add> <add>type ItemsState = { <add> renderedItems: number[], <add> viewableItems: number[], <add>}; <add> <add>const initialItemsState: ItemsState = { <add> renderedItems: [], <add> viewableItems: [], <add>}; <add> <add>type ItemsAction = { <add> type: 'add-rendered' | 'add-viewable' | 'remove-rendered' | 'remove-viewable', <add> item: number, <add>}; <add> <add>function reducer(state: ItemsState, action: ItemsAction): ItemsState { <add> if (action.type === 'add-rendered') { <add> if (state.renderedItems.includes(action.item)) { <add> return state; <add> } else { <add> return {...state, renderedItems: [...state.renderedItems, action.item]}; <add> } <add> } else if (action.type === 'add-viewable') { <add> if (state.viewableItems.includes(action.item)) { <add> return state; <add> } else { <add> return {...state, viewableItems: [...state.viewableItems, action.item]}; <add> } <add> } else if (action.type === 'remove-rendered') { <add> return { <add> ...state, <add> renderedItems: state.renderedItems.filter(i => i !== action.item), <add> }; <add> } else if (action.type === 'remove-viewable') { <add> return { <add> ...state, <add> viewableItems: state.viewableItems.filter(i => i !== action.item), <add> }; <add> } <add> <add> return state; <add>} <add> <add>function NestedListExample(): React.Node { <add> const [outer, dispatchOuter] = useReducer(reducer, initialItemsState); <add> const [inner, dispatchInner] = useReducer(reducer, initialItemsState); <add> <add> const onViewableItemsChanged = useCallback( <add> ({changed}) => { <add> for (const token of changed) { <add> dispatchOuter({ <add> type: token.isViewable ? 'add-viewable' : 'remove-viewable', <add> item: token.index ?? -1, <add> }); <add> } <add> }, <add> [dispatchOuter], <add> ); <add> <add> return ( <add> <RNTesterPage noSpacer={true} noScroll={true}> <add> <Text style={styles.debugText}> <add> <Text style={styles.debugTextHeader}>Outer Viewable:{'\n'}</Text> <add> {outerItems <add> .map((item, i) => ({item, i})) <add> .filter(o => outer.viewableItems.includes(o.i)) <add> .map(({item, i}) => `${i} (${item})`) <add> .join(', ')} <add> </Text> <add> <Text style={styles.debugText}> <add> <Text style={styles.debugTextHeader}>Outer Rendered:{'\n'}</Text> <add> {outerItems <add> .map((item, i) => ({item, i})) <add> .filter(o => outer.renderedItems.includes(o.i)) <add> .map(({item, i}) => `${i} (${item})`) <add> .join(', ')} <add> </Text> <add> <Text style={styles.debugText}> <add> <Text style={styles.debugTextHeader}>Inner Viewable:{'\n'}</Text> <add> {inner.viewableItems.sort((a, b) => a - b).join(', ')} <add> </Text> <add> <Text style={styles.debugText}> <add> <Text style={styles.debugTextHeader}>Inner Rendered:{'\n'}</Text> <add> {inner.renderedItems.sort((a, b) => a - b).join(', ')} <add> </Text> <add> <add> <FlatList <add> data={outerItems} <add> renderItem={({index, item}) => ( <add> <OuterItemRenderer <add> index={index} <add> item={item} <add> dispatchOuter={dispatchOuter} <add> dispatchInner={dispatchInner} <add> /> <add> )} <add> style={styles.list} <add> windowSize={3} <add> initialNumToRender={1} <add> onViewableItemsChanged={onViewableItemsChanged} <add> /> <add> </RNTesterPage> <add> ); <add>} <add> <add>function OuterItemRenderer({ <add> index, <add> item, <add> dispatchOuter, <add> dispatchInner, <add>}: { <add> index: number, <add> item: OuterItem, <add> dispatchOuter: ItemsAction => void, <add> dispatchInner: ItemsAction => void, <add> ... <add>}) { <add> useEffect(() => { <add> dispatchOuter({ <add> type: 'add-rendered', <add> item: index, <add> }); <add> <add> return () => { <add> dispatchOuter({ <add> type: 'remove-rendered', <add> item: index, <add> }); <add> }; <add> }, [dispatchOuter, index]); <add> <add> const onViewableItemsChanged = useCallback( <add> ({changed}) => { <add> for (const token of changed) { <add> dispatchInner({ <add> type: token.isViewable ? 'add-viewable' : 'remove-viewable', <add> item: token.item, <add> }); <add> } <add> }, <add> [dispatchInner], <add> ); <add> <add> switch (item) { <add> case 'head': <add> return ( <add> <View style={styles.header}> <add> <Text>Header</Text> <add> </View> <add> ); <add> <add> case 'vertical': <add> return ( <add> <View style={styles.body}> <add> <View style={styles.col}> <add> <FlatList <add> data={items.map(i => index * items.length * 3 + i)} <add> listKey={`${index}-col1`} <add> renderItem={p => ( <add> <InnerItemRenderer <add> item={p.item} <add> dispatchInner={dispatchInner} <add> /> <add> )} <add> style={styles.childList} <add> onViewableItemsChanged={onViewableItemsChanged} <add> windowSize={1} <add> initialNumToRender={1} <add> /> <add> </View> <add> <View style={styles.col}> <add> <FlatList <add> data={items.map(i => index * items.length * 3 + i + items.length)} <add> listKey={`${index}-col2`} <add> renderItem={p => ( <add> <InnerItemRenderer <add> item={p.item} <add> dispatchInner={dispatchInner} <add> /> <add> )} <add> style={styles.childList} <add> onViewableItemsChanged={onViewableItemsChanged} <add> windowSize={1} <add> initialNumToRender={1} <add> /> <add> </View> <add> </View> <add> ); <add> <add> case 'horizontal': <add> return ( <add> <View style={styles.row}> <add> <FlatList <add> horizontal={true} <add> data={items.map( <add> i => index * items.length * 3 + i + 2 * items.length, <add> )} <add> renderItem={p => ( <add> <InnerItemRenderer item={p.item} dispatchInner={dispatchInner} /> <add> )} <add> style={styles.childList} <add> onViewableItemsChanged={onViewableItemsChanged} <add> /> <add> </View> <add> ); <add> <add> case 'filler': <add> return <View style={styles.filler} />; <add> } <add>} <add> <add>function InnerItemRenderer({ <add> item, <add> dispatchInner, <add>}: { <add> item: number, <add> dispatchInner: ItemsAction => void, <add> ... <add>}) { <add> useEffect(() => { <add> dispatchInner({ <add> type: 'add-rendered', <add> item: item, <add> }); <add> <add> return () => { <add> dispatchInner({ <add> type: 'remove-rendered', <add> item: item, <add> }); <add> }; <add> }, [dispatchInner, item]); <add> <add> return ( <add> <View style={styles.cell}> <add> <View style={styles.item}> <add> <Text>{item}</Text> <add> </View> <add> </View> <add> ); <add>} <add> <add>const styles = StyleSheet.create({ <add> debugText: { <add> fontSize: 10, <add> }, <add> debugTextHeader: { <add> fontWeight: 'bold', <add> }, <add> list: { <add> borderWidth: 1, <add> borderColor: 'black', <add> }, <add> body: { <add> flexDirection: 'row', <add> justifyContent: 'space-around', <add> }, <add> col: { <add> flex: 1, <add> padding: 10, <add> }, <add> row: { <add> flex: 1, <add> }, <add> filler: { <add> height: 72, <add> backgroundColor: 'lightblue', <add> }, <add> childList: { <add> backgroundColor: 'lightgreen', <add> }, <add> header: { <add> height: 40, <add> backgroundColor: 'lightcoral', <add> alignItems: 'center', <add> justifyContent: 'center', <add> }, <add> cell: { <add> padding: 10, <add> }, <add> item: { <add> alignItems: 'center', <add> justifyContent: 'center', <add> borderWidth: 1, <add> borderColor: 'black', <add> backgroundColor: 'oldlace', <add> height: 72, <add> minWidth: 144, <add> }, <add>}); <add> <add>export default ({ <add> title: 'Nested', <add> description: 'Nested FlatLists of same and opposite orientation', <add> name: 'nested', <add> render: NestedListExample, <add>}: RNTesterModuleExample); <ide><path>packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js <ide> import onViewableItemsChangedExample from './FlatList-onViewableItemsChanged'; <ide> import WithSeparatorsExample from './FlatList-withSeparators'; <ide> import MultiColumnExample from './FlatList-multiColumn'; <ide> import StickyHeadersExample from './FlatList-stickyHeaders'; <add>import NestedExample from './FlatList-nested'; <ide> <ide> export default ({ <ide> framework: 'React', <ide> export default ({ <ide> WithSeparatorsExample, <ide> MultiColumnExample, <ide> StickyHeadersExample, <add> NestedExample, <ide> ], <ide> }: RNTesterModule);
2
PHP
PHP
remove useless braces in constructors.
cfc5264204b83309226412e6104313ad6e6f1023
<ide><path>src/Illuminate/Foundation/Application.php <ide> public function detectEnvironment(Closure $callback) <ide> { <ide> $args = isset($_SERVER['argv']) ? $_SERVER['argv'] : null; <ide> <del> return $this['env'] = (new EnvironmentDetector())->detect($callback, $args); <add> return $this['env'] = (new EnvironmentDetector)->detect($callback, $args); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Mail/TransportManager.php <ide> protected function addSesCredentials(array $config) <ide> */ <ide> protected function createMailDriver() <ide> { <del> return new MailTransport(); <add> return new MailTransport; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Routing/RoutingServiceProvider.php <ide> protected function registerPsrRequest() <ide> protected function registerPsrResponse() <ide> { <ide> $this->app->bind(ResponseInterface::class, function ($app) { <del> return new PsrResponse(); <add> return new PsrResponse; <ide> }); <ide> } <ide> <ide><path>tests/Auth/AuthorizesResourcesTest.php <ide> class AuthorizesResourcesTest extends TestCase <ide> { <ide> public function testCreateMethod() <ide> { <del> $controller = new AuthorizesResourcesController(); <add> $controller = new AuthorizesResourcesController; <ide> <ide> $this->assertHasMiddleware($controller, 'create', 'can:create,App\User'); <ide> } <ide> <ide> public function testStoreMethod() <ide> { <del> $controller = new AuthorizesResourcesController(); <add> $controller = new AuthorizesResourcesController; <ide> <ide> $this->assertHasMiddleware($controller, 'store', 'can:create,App\User'); <ide> } <ide> <ide> public function testShowMethod() <ide> { <del> $controller = new AuthorizesResourcesController(); <add> $controller = new AuthorizesResourcesController; <ide> <ide> $this->assertHasMiddleware($controller, 'show', 'can:view,user'); <ide> } <ide> <ide> public function testEditMethod() <ide> { <del> $controller = new AuthorizesResourcesController(); <add> $controller = new AuthorizesResourcesController; <ide> <ide> $this->assertHasMiddleware($controller, 'edit', 'can:update,user'); <ide> } <ide> <ide> public function testUpdateMethod() <ide> { <del> $controller = new AuthorizesResourcesController(); <add> $controller = new AuthorizesResourcesController; <ide> <ide> $this->assertHasMiddleware($controller, 'update', 'can:update,user'); <ide> } <ide> <ide> public function testDestroyMethod() <ide> { <del> $controller = new AuthorizesResourcesController(); <add> $controller = new AuthorizesResourcesController; <ide> <ide> $this->assertHasMiddleware($controller, 'destroy', 'can:delete,user'); <ide> } <ide><path>tests/Broadcasting/BroadcasterTest.php <ide> public function tearDown() <ide> <ide> public function testExtractingParametersWhileCheckingForUserAccess() <ide> { <del> $broadcaster = new FakeBroadcaster(); <add> $broadcaster = new FakeBroadcaster; <ide> <ide> $callback = function ($user, BroadcasterTestEloquentModelStub $model, $nonModel) { <ide> }; <ide> public function testExtractingParametersWhileCheckingForUserAccess() <ide> */ <ide> public function testNotFoundThrowsHttpException() <ide> { <del> $broadcaster = new FakeBroadcaster(); <add> $broadcaster = new FakeBroadcaster; <ide> $callback = function ($user, BroadcasterTestEloquentModelNotFoundStub $model) { <ide> }; <ide> $broadcaster->extractAuthParameters('asd.{model}', 'asd.1', $callback); <ide><path>tests/Cache/CacheEventsTest.php <ide> protected function getDispatcher() <ide> <ide> protected function getRepository($dispatcher) <ide> { <del> $repository = new \Illuminate\Cache\Repository(new \Illuminate\Cache\ArrayStore()); <add> $repository = new \Illuminate\Cache\Repository(new \Illuminate\Cache\ArrayStore); <ide> $repository->put('baz', 'qux', 99); <ide> $repository->tags('taylor')->put('baz', 'qux', 99); <ide> $repository->setEventDispatcher($dispatcher); <ide><path>tests/Cache/CacheFileStoreTest.php <ide> public function tearDown() <ide> public function testNullIsReturnedIfFileDoesntExist() <ide> { <ide> $files = $this->mockFilesystem(); <del> $files->expects($this->once())->method('get')->will($this->throwException(new FileNotFoundException())); <add> $files->expects($this->once())->method('get')->will($this->throwException(new FileNotFoundException)); <ide> $store = new FileStore($files, __DIR__); <ide> $value = $store->get('foo'); <ide> $this->assertNull($value); <ide><path>tests/Cache/CacheMemcachedStoreTest.php <ide> public function testGetAndSetPrefix() <ide> $this->markTestSkipped('Memcached module not installed'); <ide> } <ide> <del> $store = new MemcachedStore(new Memcached(), 'bar'); <add> $store = new MemcachedStore(new Memcached, 'bar'); <ide> $this->assertEquals('bar:', $store->getPrefix()); <ide> $store->setPrefix('foo'); <ide> $this->assertEquals('foo:', $store->getPrefix()); <ide><path>tests/Cache/CacheTableCommandTest.php <ide> public function testCreateMakesMigration() <ide> ); <ide> $creator = m::mock('Illuminate\Database\Migrations\MigrationCreator')->shouldIgnoreMissing(); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $app->useDatabasePath(__DIR__); <ide> $app['migration.creator'] = $creator; <ide> $command->setLaravel($app); <ide><path>tests/Cache/CacheTaggedCacheTest.php <ide> public function testCacheCanBeSetWithDatetimeArgument() <ide> { <ide> $store = new ArrayStore; <ide> $tags = ['bop', 'zap']; <del> $duration = new DateTime(); <add> $duration = new DateTime; <ide> $duration->add(new DateInterval('PT10M')); <ide> $store->tags($tags)->put('foo', 'bar', $duration); <ide> $this->assertEquals('bar', $store->tags($tags)->get('foo')); <ide><path>tests/Cache/ClearCommandTest.php <ide> public function testClearWithNoStoreArgument() <ide> <ide> $cacheRepository = m::mock('Illuminate\Contracts\Cache\Repository'); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $command->setLaravel($app); <ide> <ide> $cacheManager->shouldReceive('store')->once()->with(null)->andReturn($cacheRepository); <ide> public function testClearWithStoreArgument() <ide> <ide> $cacheRepository = m::mock('Illuminate\Contracts\Cache\Repository'); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $command->setLaravel($app); <ide> <ide> $cacheManager->shouldReceive('store')->once()->with('foo')->andReturn($cacheRepository); <ide> public function testClearWithInvalidStoreArgument() <ide> <ide> $cacheRepository = m::mock('Illuminate\Contracts\Cache\Repository'); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $command->setLaravel($app); <ide> <ide> $cacheManager->shouldReceive('store')->once()->with('bar')->andThrow('InvalidArgumentException'); <ide> public function testClearWithTagsOption() <ide> <ide> $cacheRepository = m::mock('Illuminate\Contracts\Cache\Repository'); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $command->setLaravel($app); <ide> <ide> $cacheManager->shouldReceive('store')->once()->with(null)->andReturn($cacheRepository); <ide> public function testClearWithStoreArgumentAndTagsOption() <ide> <ide> $cacheRepository = m::mock('Illuminate\Contracts\Cache\Repository'); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $command->setLaravel($app); <ide> <ide> $cacheManager->shouldReceive('store')->once()->with('redis')->andReturn($cacheRepository); <ide><path>tests/Container/ContainerTest.php <ide> public function testCallWithAtSignBasedClassReferences() <ide> public function testCallWithCallableArray() <ide> { <ide> $container = new Container; <del> $stub = new ContainerTestCallStub(); <add> $stub = new ContainerTestCallStub; <ide> $result = $container->call([$stub, 'work'], ['foo', 'bar']); <ide> $this->assertEquals(['foo', 'bar'], $result); <ide> } <ide><path>tests/Cookie/Middleware/EncryptCookiesTest.php <ide> class EncryptCookiesTestController extends Controller <ide> { <ide> public function setCookies() <ide> { <del> $response = new Response(); <add> $response = new Response; <ide> $response->headers->setCookie(new Cookie('encrypted_cookie', 'value')); <ide> $response->headers->setCookie(new Cookie('unencrypted_cookie', 'value')); <ide> <ide> public function setCookies() <ide> <ide> public function queueCookies() <ide> { <del> return new Response(); <add> return new Response; <ide> } <ide> } <ide> <ide><path>tests/Database/DatabaseEloquentGlobalScopesTest.php <ide> public function tearDown() <ide> <ide> public function testGlobalScopeIsApplied() <ide> { <del> $model = new EloquentGlobalScopesTestModel(); <add> $model = new EloquentGlobalScopesTestModel; <ide> $query = $model->newQuery(); <ide> $this->assertEquals('select * from "table" where "active" = ?', $query->toSql()); <ide> $this->assertEquals([1], $query->getBindings()); <ide> } <ide> <ide> public function testGlobalScopeCanBeRemoved() <ide> { <del> $model = new EloquentGlobalScopesTestModel(); <add> $model = new EloquentGlobalScopesTestModel; <ide> $query = $model->newQuery()->withoutGlobalScope(ActiveScope::class); <ide> $this->assertEquals('select * from "table"', $query->toSql()); <ide> $this->assertEquals([], $query->getBindings()); <ide> } <ide> <ide> public function testClosureGlobalScopeIsApplied() <ide> { <del> $model = new EloquentClosureGlobalScopesTestModel(); <add> $model = new EloquentClosureGlobalScopesTestModel; <ide> $query = $model->newQuery(); <ide> $this->assertEquals('select * from "table" where "active" = ? order by "name" asc', $query->toSql()); <ide> $this->assertEquals([1], $query->getBindings()); <ide> } <ide> <ide> public function testClosureGlobalScopeCanBeRemoved() <ide> { <del> $model = new EloquentClosureGlobalScopesTestModel(); <add> $model = new EloquentClosureGlobalScopesTestModel; <ide> $query = $model->newQuery()->withoutGlobalScope('active_scope'); <ide> $this->assertEquals('select * from "table" order by "name" asc', $query->toSql()); <ide> $this->assertEquals([], $query->getBindings()); <ide> } <ide> <ide> public function testGlobalScopeCanBeRemovedAfterTheQueryIsExecuted() <ide> { <del> $model = new EloquentClosureGlobalScopesTestModel(); <add> $model = new EloquentClosureGlobalScopesTestModel; <ide> $query = $model->newQuery(); <ide> $this->assertEquals('select * from "table" where "active" = ? order by "name" asc', $query->toSql()); <ide> $this->assertEquals([1], $query->getBindings()); <ide> public function testGlobalScopeCanBeRemovedAfterTheQueryIsExecuted() <ide> <ide> public function testAllGlobalScopesCanBeRemoved() <ide> { <del> $model = new EloquentClosureGlobalScopesTestModel(); <add> $model = new EloquentClosureGlobalScopesTestModel; <ide> $query = $model->newQuery()->withoutGlobalScopes(); <ide> $this->assertEquals('select * from "table"', $query->toSql()); <ide> $this->assertEquals([], $query->getBindings()); <ide> public function testAllGlobalScopesCanBeRemoved() <ide> <ide> public function testGlobalScopesWithOrWhereConditionsAreNested() <ide> { <del> $model = new EloquentClosureGlobalScopesWithOrTestModel(); <add> $model = new EloquentClosureGlobalScopesWithOrTestModel; <ide> <ide> $query = $model->newQuery(); <ide> $this->assertEquals('select "email", "password" from "table" where ("email" = ? or "email" = ?) and "active" = ? order by "name" asc', $query->toSql()); <ide><path>tests/Database/DatabaseEloquentHasOneTest.php <ide> public function testHasOneWithDefault() <ide> <ide> $this->builder->shouldReceive('first')->once()->andReturnNull(); <ide> <del> $newModel = new EloquentHasOneModelStub(); <add> $newModel = new EloquentHasOneModelStub; <ide> <ide> $this->related->shouldReceive('newInstance')->once()->andReturn($newModel); <ide> <ide> public function testHasOneWithDynamicDefault() <ide> <ide> $this->builder->shouldReceive('first')->once()->andReturnNull(); <ide> <del> $newModel = new EloquentHasOneModelStub(); <add> $newModel = new EloquentHasOneModelStub; <ide> <ide> $this->related->shouldReceive('newInstance')->once()->andReturn($newModel); <ide> <ide> public function testHasOneWithArrayDefault() <ide> <ide> $this->builder->shouldReceive('first')->once()->andReturnNull(); <ide> <del> $newModel = new EloquentHasOneModelStub(); <add> $newModel = new EloquentHasOneModelStub; <ide> <ide> $this->related->shouldReceive('newInstance')->once()->andReturn($newModel); <ide> <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testTimestampsAreCreatedFromStringsAndIntegers() <ide> <ide> public function testFromDateTime() <ide> { <del> $model = new EloquentModelStub(); <add> $model = new EloquentModelStub; <ide> <ide> $value = \Carbon\Carbon::parse('2015-04-17 22:59:01'); <ide> $this->assertEquals('2015-04-17 22:59:01', $model->fromDateTime($value)); <ide><path>tests/Database/DatabaseEloquentRelationTest.php <ide> public function testMacroable() <ide> return 'foo'; <ide> }); <ide> <del> $model = new EloquentRelationResetModelStub(); <add> $model = new EloquentRelationResetModelStub; <ide> $relation = new EloquentRelationStub($model->newQuery(), $model); <ide> <ide> $result = $relation->foo(); <ide><path>tests/Database/DatabaseSchemaBlueprintIntegrationTest.php <ide> public function testRenamingAndChangingColumnsWork() <ide> $table->integer('age')->change(); <ide> }); <ide> <del> $queries = $blueprint->toSql($this->db->connection(), new \Illuminate\Database\Schema\Grammars\SQLiteGrammar()); <add> $queries = $blueprint->toSql($this->db->connection(), new \Illuminate\Database\Schema\Grammars\SQLiteGrammar); <ide> <ide> $expected = [ <ide> 'CREATE TEMPORARY TABLE __temp__users AS SELECT name, age FROM users', <ide><path>tests/Events/EventsDispatcherTest.php <ide> public function testShouldBroadcastSuccess() <ide> <ide> $d->makePartial()->shouldAllowMockingProtectedMethods(); <ide> <del> $event = new BroadcastEvent(); <add> $event = new BroadcastEvent; <ide> <ide> $this->assertTrue($d->shouldBroadcast([$event])); <ide> } <ide> public function testShouldBroadcastFail() <ide> <ide> $d->makePartial()->shouldAllowMockingProtectedMethods(); <ide> <del> $event = new BroadcastFalseCondition(); <add> $event = new BroadcastFalseCondition; <ide> <ide> $this->assertFalse($d->shouldBroadcast([$event])); <ide> } <ide><path>tests/Filesystem/FilesystemTest.php <ide> public function setUp() <ide> <ide> public function tearDown() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->deleteDirectory($this->tempDir); <ide> } <ide> <ide> public function testGetRetrievesFiles() <ide> { <ide> file_put_contents($this->tempDir.'/file.txt', 'Hello World'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('Hello World', $files->get($this->tempDir.'/file.txt')); <ide> } <ide> <ide> public function testPutStoresFiles() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->put($this->tempDir.'/file.txt', 'Hello World'); <ide> $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello World'); <ide> } <ide> <ide> public function testSetChmod() <ide> { <ide> file_put_contents($this->tempDir.'/file.txt', 'Hello World'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->chmod($this->tempDir.'/file.txt', 0755); <ide> $filePermisson = substr(sprintf('%o', fileperms($this->tempDir.'/file.txt')), -4); <ide> $this->assertEquals('0755', $filePermisson); <ide> public function testGetChmod() <ide> { <ide> file_put_contents($this->tempDir.'/file.txt', 'Hello World'); <ide> chmod($this->tempDir.'/file.txt', 0755); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $filePermisson = $files->chmod($this->tempDir.'/file.txt'); <ide> $this->assertEquals('0755', $filePermisson); <ide> } <ide> public function testDeleteRemovesFiles() <ide> file_put_contents($this->tempDir.'/file2.txt', 'Hello World'); <ide> file_put_contents($this->tempDir.'/file3.txt', 'Hello World'); <ide> <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->delete($this->tempDir.'/file1.txt'); <ide> $this->assertFileNotExists($this->tempDir.'/file1.txt'); <ide> <ide> public function testDeleteRemovesFiles() <ide> <ide> public function testPrependExistingFiles() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->put($this->tempDir.'/file.txt', 'World'); <ide> $files->prepend($this->tempDir.'/file.txt', 'Hello '); <ide> $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello World'); <ide> } <ide> <ide> public function testPrependNewFiles() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->prepend($this->tempDir.'/file.txt', 'Hello World'); <ide> $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello World'); <ide> } <ide> public function testDeleteDirectory() <ide> { <ide> mkdir($this->tempDir.'/foo'); <ide> file_put_contents($this->tempDir.'/foo/file.txt', 'Hello World'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->deleteDirectory($this->tempDir.'/foo'); <ide> $this->assertFalse(is_dir($this->tempDir.'/foo')); <ide> $this->assertFileNotExists($this->tempDir.'/foo/file.txt'); <ide> public function testCleanDirectory() <ide> { <ide> mkdir($this->tempDir.'/foo'); <ide> file_put_contents($this->tempDir.'/foo/file.txt', 'Hello World'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->cleanDirectory($this->tempDir.'/foo'); <ide> $this->assertTrue(is_dir($this->tempDir.'/foo')); <ide> $this->assertFileNotExists($this->tempDir.'/foo/file.txt'); <ide> public function testCleanDirectory() <ide> public function testMacro() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'Hello World'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $tempDir = $this->tempDir; <ide> $files->macro('getFoo', function () use ($files, $tempDir) { <ide> return $files->get($tempDir.'/foo.txt'); <ide> public function testFilesMethod() <ide> file_put_contents($this->tempDir.'/foo/1.txt', '1'); <ide> file_put_contents($this->tempDir.'/foo/2.txt', '2'); <ide> mkdir($this->tempDir.'/foo/bar'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals([$this->tempDir.'/foo/1.txt', $this->tempDir.'/foo/2.txt'], $files->files($this->tempDir.'/foo')); <ide> unset($files); <ide> } <ide> <ide> public function testCopyDirectoryReturnsFalseIfSourceIsntDirectory() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertFalse($files->copyDirectory($this->tempDir.'/foo/bar/baz/breeze/boom', $this->tempDir)); <ide> } <ide> <ide> public function testCopyDirectoryMovesEntireDirectory() <ide> mkdir($this->tempDir.'/tmp/nested', 0777, true); <ide> file_put_contents($this->tempDir.'/tmp/nested/baz.txt', ''); <ide> <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->copyDirectory($this->tempDir.'/tmp', $this->tempDir.'/tmp2'); <ide> $this->assertTrue(is_dir($this->tempDir.'/tmp2')); <ide> $this->assertFileExists($this->tempDir.'/tmp2/foo.txt'); <ide> public function testMoveDirectoryMovesEntireDirectory() <ide> mkdir($this->tempDir.'/tmp/nested', 0777, true); <ide> file_put_contents($this->tempDir.'/tmp/nested/baz.txt', ''); <ide> <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->moveDirectory($this->tempDir.'/tmp', $this->tempDir.'/tmp2'); <ide> $this->assertTrue(is_dir($this->tempDir.'/tmp2')); <ide> $this->assertFileExists($this->tempDir.'/tmp2/foo.txt'); <ide> public function testMoveDirectoryMovesEntireDirectoryAndOverwrites() <ide> file_put_contents($this->tempDir.'/tmp2/foo2.txt', ''); <ide> file_put_contents($this->tempDir.'/tmp2/bar2.txt', ''); <ide> <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->moveDirectory($this->tempDir.'/tmp', $this->tempDir.'/tmp2', true); <ide> $this->assertTrue(is_dir($this->tempDir.'/tmp2')); <ide> $this->assertFileExists($this->tempDir.'/tmp2/foo.txt'); <ide> public function testMoveDirectoryMovesEntireDirectoryAndOverwrites() <ide> */ <ide> public function testGetThrowsExceptionNonexisitingFile() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->get($this->tempDir.'/unknown-file.txt'); <ide> } <ide> <ide> public function testGetRequireReturnsProperly() <ide> { <ide> file_put_contents($this->tempDir.'/file.php', '<?php return "Howdy?"; ?>'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('Howdy?', $files->getRequire($this->tempDir.'/file.php')); <ide> } <ide> <ide> public function testGetRequireReturnsProperly() <ide> */ <ide> public function testGetRequireThrowsExceptionNonexisitingFile() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->getRequire($this->tempDir.'/file.php'); <ide> } <ide> <ide> public function testAppendAddsDataToFile() <ide> { <ide> file_put_contents($this->tempDir.'/file.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $bytesWritten = $files->append($this->tempDir.'/file.txt', 'bar'); <ide> $this->assertEquals(mb_strlen('bar', '8bit'), $bytesWritten); <ide> $this->assertFileExists($this->tempDir.'/file.txt'); <ide> public function testAppendAddsDataToFile() <ide> public function testMoveMovesFiles() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->move($this->tempDir.'/foo.txt', $this->tempDir.'/bar.txt'); <ide> $this->assertFileExists($this->tempDir.'/bar.txt'); <ide> $this->assertFileNotExists($this->tempDir.'/foo.txt'); <ide> public function testMoveMovesFiles() <ide> public function testExtensionReturnsExtension() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('txt', $files->extension($this->tempDir.'/foo.txt')); <ide> } <ide> <ide> public function testBasenameReturnsBasename() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('foo.txt', $files->basename($this->tempDir.'/foo.txt')); <ide> } <ide> <ide> public function testDirnameReturnsDirectory() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals($this->tempDir, $files->dirname($this->tempDir.'/foo.txt')); <ide> } <ide> <ide> public function testTypeIndentifiesFile() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('file', $files->type($this->tempDir.'/foo.txt')); <ide> } <ide> <ide> public function testTypeIndentifiesDirectory() <ide> { <ide> mkdir($this->tempDir.'/foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('dir', $files->type($this->tempDir.'/foo')); <ide> } <ide> <ide> public function testSizeOutputsSize() <ide> { <ide> $size = file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals($size, $files->size($this->tempDir.'/foo.txt')); <ide> } <ide> <ide> public function testSizeOutputsSize() <ide> public function testMimeTypeOutputsMimeType() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertEquals('text/plain', $files->mimeType($this->tempDir.'/foo.txt')); <ide> } <ide> <ide> public function testIsWritable() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> @chmod($this->tempDir.'/foo.txt', 0444); <ide> $this->assertFalse($files->isWritable($this->tempDir.'/foo.txt')); <ide> @chmod($this->tempDir.'/foo.txt', 0777); <ide> public function testIsWritable() <ide> public function testIsReadable() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> // chmod is noneffective on Windows <ide> if (DIRECTORY_SEPARATOR === '\\') { <ide> $this->assertTrue($files->isReadable($this->tempDir.'/foo.txt')); <ide> public function testGlobFindsFiles() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <ide> file_put_contents($this->tempDir.'/bar.txt', 'bar'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $glob = $files->glob($this->tempDir.'/*.txt'); <ide> $this->assertContains($this->tempDir.'/foo.txt', $glob); <ide> $this->assertContains($this->tempDir.'/bar.txt', $glob); <ide> public function testAllFilesFindsFiles() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <ide> file_put_contents($this->tempDir.'/bar.txt', 'bar'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $allFiles = []; <ide> foreach ($files->allFiles($this->tempDir) as $file) { <ide> $allFiles[] = $file->getFilename(); <ide> public function testDirectoriesFindsDirectories() <ide> { <ide> mkdir($this->tempDir.'/foo'); <ide> mkdir($this->tempDir.'/bar'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $directories = $files->directories($this->tempDir); <ide> $this->assertContains($this->tempDir.DIRECTORY_SEPARATOR.'foo', $directories); <ide> $this->assertContains($this->tempDir.DIRECTORY_SEPARATOR.'bar', $directories); <ide> } <ide> <ide> public function testMakeDirectory() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $this->assertTrue($files->makeDirectory($this->tempDir.'/foo')); <ide> $this->assertFileExists($this->tempDir.'/foo'); <ide> } <ide> public function testSharedGet() <ide> $pid = pcntl_fork(); <ide> <ide> if (! $pid) { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $files->put($this->tempDir.'/file.txt', $content, true); <ide> $read = $files->get($this->tempDir.'/file.txt', true); <ide> <ide> public function testSharedGet() <ide> <ide> public function testRequireOnceRequiresFileProperly() <ide> { <del> $filesystem = new Filesystem(); <add> $filesystem = new Filesystem; <ide> mkdir($this->tempDir.'/foo'); <ide> file_put_contents($this->tempDir.'/foo/foo.php', '<?php function random_function_xyz(){};'); <ide> $filesystem->requireOnce($this->tempDir.'/foo/foo.php'); <ide> public function testRequireOnceRequiresFileProperly() <ide> <ide> public function testCopyCopiesFileProperly() <ide> { <del> $filesystem = new Filesystem(); <add> $filesystem = new Filesystem; <ide> $data = 'contents'; <ide> mkdir($this->tempDir.'/foo'); <ide> file_put_contents($this->tempDir.'/foo/foo.txt', $data); <ide> public function testCopyCopiesFileProperly() <ide> <ide> public function testIsFileChecksFilesProperly() <ide> { <del> $filesystem = new Filesystem(); <add> $filesystem = new Filesystem; <ide> mkdir($this->tempDir.'/foo'); <ide> file_put_contents($this->tempDir.'/foo/foo.txt', 'contents'); <ide> $this->assertTrue($filesystem->isFile($this->tempDir.'/foo/foo.txt')); <ide> public function testFilesMethodReturnsFileInfoObjects() <ide> file_put_contents($this->tempDir.'/foo/1.txt', '1'); <ide> file_put_contents($this->tempDir.'/foo/2.txt', '2'); <ide> mkdir($this->tempDir.'/foo/bar'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> foreach ($files->files($this->tempDir.'/foo') as $file) { <ide> $this->assertInstanceOf(\SplFileInfo::class, $file); <ide> } <ide> public function testAllFilesReturnsFileInfoObjects() <ide> { <ide> file_put_contents($this->tempDir.'/foo.txt', 'foo'); <ide> file_put_contents($this->tempDir.'/bar.txt', 'bar'); <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $allFiles = []; <ide> foreach ($files->allFiles($this->tempDir) as $file) { <ide> $this->assertInstanceOf(\SplFileInfo::class, $file); <ide><path>tests/Foundation/FoundationTestResponseTest.php <ide> public function testMacroable() <ide> <ide> public function testCanBeCreatedFromBinaryFileResponses() <ide> { <del> $files = new Filesystem(); <add> $files = new Filesystem; <ide> $tempDir = __DIR__.'/tmp'; <ide> $files->makeDirectory($tempDir, 0755, false, true); <ide> $files->put($tempDir.'/file.txt', 'Hello World'); <ide><path>tests/Foundation/Http/Middleware/TransformsRequestTest.php <ide> class TransformsRequestTest extends TestCase <ide> { <ide> public function testLowerAgeAndAddBeer() <ide> { <del> $middleware = new ManipulateInput(); <add> $middleware = new ManipulateInput; <ide> $request = new Request( <ide> [ <ide> 'name' => 'Damian', <ide> public function testLowerAgeAndAddBeer() <ide> <ide> public function testAjaxLowerAgeAndAddBeer() <ide> { <del> $middleware = new ManipulateInput(); <add> $middleware = new ManipulateInput; <ide> $request = new Request( <ide> [ <ide> 'name' => 'Damian', <ide><path>tests/Http/HttpResponseTest.php <ide> public function testJsonResponsesAreConvertedAndHeadersAreSet() <ide> $this->assertEquals('{"foo":"bar"}', $response->getContent()); <ide> $this->assertEquals('application/json', $response->headers->get('Content-Type')); <ide> <del> $response = new \Illuminate\Http\Response(); <add> $response = new \Illuminate\Http\Response; <ide> $response->setContent(['foo' => 'bar']); <ide> $this->assertEquals('{"foo":"bar"}', $response->getContent()); <ide> $this->assertEquals('application/json', $response->headers->get('Content-Type')); <ide> public function testRenderablesAreRendered() <ide> <ide> public function testHeader() <ide> { <del> $response = new \Illuminate\Http\Response(); <add> $response = new \Illuminate\Http\Response; <ide> $this->assertNull($response->headers->get('foo')); <ide> $response->header('foo', 'bar'); <ide> $this->assertEquals('bar', $response->headers->get('foo')); <ide> public function testHeader() <ide> <ide> public function testWithCookie() <ide> { <del> $response = new \Illuminate\Http\Response(); <add> $response = new \Illuminate\Http\Response; <ide> $this->assertCount(0, $response->headers->getCookies()); <ide> $this->assertEquals($response, $response->withCookie(new \Symfony\Component\HttpFoundation\Cookie('foo', 'bar'))); <ide> $cookies = $response->headers->getCookies(); <ide> public function testWithCookie() <ide> public function testGetOriginalContent() <ide> { <ide> $arr = ['foo' => 'bar']; <del> $response = new \Illuminate\Http\Response(); <add> $response = new \Illuminate\Http\Response; <ide> $response->setContent($arr); <ide> $this->assertSame($arr, $response->getOriginalContent()); <ide> } <ide><path>tests/Integration/Notifications/SendingMailNotificationsTest.php <ide> public function setUp() <ide> <ide> public function test_mail_is_sent() <ide> { <del> $notification = new TestMailNotification(); <add> $notification = new TestMailNotification; <ide> <ide> $user = NotifiableUser::forceCreate([ <ide> 'email' => '[email protected]', <ide> public function test_mail_is_sent() <ide> <ide> public function test_mail_is_sent_with_subject() <ide> { <del> $notification = new TestMailNotificationWithSubject(); <add> $notification = new TestMailNotificationWithSubject; <ide> <ide> $user = NotifiableUser::forceCreate([ <ide> 'email' => '[email protected]', <ide> public function test_mail_is_sent_with_subject() <ide> <ide> public function test_mail_is_sent_using_mailable() <ide> { <del> $notification = new TestMailNotificationWithMailable(); <add> $notification = new TestMailNotificationWithMailable; <ide> <ide> $user = NotifiableUser::forceCreate([ <ide> 'email' => '[email protected]', <ide><path>tests/Mail/MailMailerTest.php <ide> public function getTransport() <ide> <ide> public function createMessage() <ide> { <del> return new \Swift_Message(); <add> return new \Swift_Message; <ide> } <ide> } <ide><path>tests/Queue/QueueDatabaseQueueUnitTest.php <ide> public function testFailureToCreatePayloadFromObject() <ide> { <ide> $this->expectException('InvalidArgumentException'); <ide> <del> $job = new stdClass(); <add> $job = new stdClass; <ide> $job->invalid = "\xc3\x28"; <ide> <ide> $queue = $this->getMockForAbstractClass('Illuminate\Queue\Queue'); <ide><path>tests/Queue/QueueListenerTest.php <ide> public function testListenerStopsWhenMemoryIsExceeded() <ide> public function testMakeProcessCorrectlyFormatsCommandLine() <ide> { <ide> $listener = new \Illuminate\Queue\Listener(__DIR__); <del> $options = new \Illuminate\Queue\ListenerOptions(); <add> $options = new \Illuminate\Queue\ListenerOptions; <ide> $options->delay = 1; <ide> $options->memory = 2; <ide> $options->timeout = 3; <ide><path>tests/Queue/QueueSyncQueueTest.php <ide> class FailingSyncQueueTestHandler <ide> { <ide> public function fire($job, $data) <ide> { <del> throw new Exception(); <add> throw new Exception; <ide> } <ide> <ide> public function failed() <ide><path>tests/Routing/RouteCollectionTest.php <ide> public function setUp() <ide> { <ide> parent::setUp(); <ide> <del> $this->routeCollection = new RouteCollection(); <add> $this->routeCollection = new RouteCollection; <ide> } <ide> <ide> public function testRouteCollectionCanBeConstructed() <ide><path>tests/Routing/RoutingRouteTest.php <ide> public function testModelBindingWithBindingClosure() <ide> return $name; <ide> }]); <ide> $router->model('bar', 'Illuminate\Tests\Routing\RouteModelBindingNullStub', function ($value) { <del> return (new RouteModelBindingClosureStub())->findAlternate($value); <add> return (new RouteModelBindingClosureStub)->findAlternate($value); <ide> }); <ide> $this->assertEquals('tayloralt', $router->dispatch(Request::create('foo/TAYLOR', 'GET'))->getContent()); <ide> } <ide> public function first() <ide> <ide> public function firstOrFail() <ide> { <del> throw new \Illuminate\Database\Eloquent\ModelNotFoundException(); <add> throw new \Illuminate\Database\Eloquent\ModelNotFoundException; <ide> } <ide> } <ide> <ide><path>tests/Session/SessionStoreTest.php <ide> public function testHandlerNeedsRequest() <ide> $this->assertFalse($session->handlerNeedsRequest()); <ide> $session->getHandler()->shouldReceive('setRequest')->never(); <ide> <del> $session = new \Illuminate\Session\Store('test', m::mock(new \Illuminate\Session\CookieSessionHandler(new \Illuminate\Cookie\CookieJar(), 60))); <add> $session = new \Illuminate\Session\Store('test', m::mock(new \Illuminate\Session\CookieSessionHandler(new \Illuminate\Cookie\CookieJar, 60))); <ide> $this->assertTrue($session->handlerNeedsRequest()); <ide> $session->getHandler()->shouldReceive('setRequest')->once(); <del> $request = new \Symfony\Component\HttpFoundation\Request(); <add> $request = new \Symfony\Component\HttpFoundation\Request; <ide> $session->setRequestOnHandler($request); <ide> } <ide> <ide><path>tests/Session/SessionTableCommandTest.php <ide> public function testCreateMakesMigration() <ide> ); <ide> $creator = m::mock('Illuminate\Database\Migrations\MigrationCreator')->shouldIgnoreMissing(); <ide> <del> $app = new Application(); <add> $app = new Application; <ide> $app->useDatabasePath(__DIR__); <ide> $app['migration.creator'] = $creator; <ide> $command->setLaravel($app); <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testShiftReturnsAndRemovesFirstItemInCollection() <ide> <ide> public function testEmptyCollectionIsEmpty() <ide> { <del> $c = new Collection(); <add> $c = new Collection; <ide> <ide> $this->assertTrue($c->isEmpty()); <ide> } <ide> public function testTimesMethod() <ide> <ide> public function testConstructMakeFromObject() <ide> { <del> $object = new stdClass(); <add> $object = new stdClass; <ide> $object->foo = 'bar'; <ide> $collection = Collection::make($object); <ide> $this->assertEquals(['foo' => 'bar'], $collection->all()); <ide> public function testConstructMethodFromNull() <ide> $collection = new Collection(null); <ide> $this->assertEquals([], $collection->all()); <ide> <del> $collection = new Collection(); <add> $collection = new Collection; <ide> $this->assertEquals([], $collection->all()); <ide> } <ide> <ide> public function testConstructMethodFromArray() <ide> <ide> public function testConstructMethodFromObject() <ide> { <del> $object = new stdClass(); <add> $object = new stdClass; <ide> $object->foo = 'bar'; <ide> $collection = new Collection($object); <ide> $this->assertEquals(['foo' => 'bar'], $collection->all()); <ide> public function testCanSumValuesWithoutACallback() <ide> <ide> public function testGettingSumFromEmptyCollection() <ide> { <del> $c = new Collection(); <add> $c = new Collection; <ide> $this->assertEquals(0, $c->sum('foo')); <ide> } <ide> <ide> public function testGettingMaxItemsFromCollection() <ide> $c = new Collection([1, 2, 3, 4, 5]); <ide> $this->assertEquals(5, $c->max()); <ide> <del> $c = new Collection(); <add> $c = new Collection; <ide> $this->assertNull($c->max()); <ide> } <ide> <ide> public function testGettingMinItemsFromCollection() <ide> $c = new Collection([0, 1, 2, 3, 4]); <ide> $this->assertEquals(0, $c->min()); <ide> <del> $c = new Collection(); <add> $c = new Collection; <ide> $this->assertNull($c->min()); <ide> } <ide> <ide> public function testGettingAvgItemsFromCollection() <ide> $c = new Collection([1, 2, 3, 4, 5]); <ide> $this->assertEquals(3, $c->avg()); <ide> <del> $c = new Collection(); <add> $c = new Collection; <ide> $this->assertNull($c->avg()); <ide> } <ide> <ide> public function testJsonSerialize() <ide> { <ide> $c = new Collection([ <del> new TestArrayableObject(), <del> new TestJsonableObject(), <del> new TestJsonSerializeObject(), <add> new TestArrayableObject, <add> new TestJsonableObject, <add> new TestJsonSerializeObject, <ide> 'baz', <ide> ]); <ide> <ide> public function testMedianOutOfOrderCollection() <ide> <ide> public function testMedianOnEmptyCollectionReturnsNull() <ide> { <del> $collection = new Collection(); <add> $collection = new Collection; <ide> $this->assertNull($collection->median()); <ide> } <ide> <ide> public function testModeOnNullCollection() <ide> { <del> $collection = new Collection(); <add> $collection = new Collection; <ide> $this->assertNull($collection->mode()); <ide> } <ide> <ide> public function testSplitCollectionWithCountLessThenDivisor() <ide> <ide> public function testSplitEmptyCollection() <ide> { <del> $collection = new Collection(); <add> $collection = new Collection; <ide> <ide> $this->assertEquals( <ide> [], <ide> public function testPartitionPreservesKeys() <ide> <ide> public function testPartitionEmptyCollection() <ide> { <del> $collection = new Collection(); <add> $collection = new Collection; <ide> <ide> $this->assertCount(2, $collection->partition(function () { <ide> return true; <ide><path>tests/Translation/TranslationMessageSelectorTest.php <ide> class TranslationMessageSelectorTest extends TestCase <ide> */ <ide> public function testChoose($expected, $id, $number) <ide> { <del> $selector = new MessageSelector(); <add> $selector = new MessageSelector; <ide> <ide> $this->assertEquals($expected, $selector->choose($id, $number, 'en')); <ide> } <ide><path>tests/Validation/ValidationValidatorTest.php <ide> public function testValidateDateAndFormat() <ide> $v = new Validator($trans, ['x' => ['Not', 'a', 'date']], ['x' => 'date']); <ide> $this->assertTrue($v->fails()); <ide> <del> $v = new Validator($trans, ['x' => new DateTime()], ['x' => 'date']); <add> $v = new Validator($trans, ['x' => new DateTime], ['x' => 'date']); <ide> $this->assertTrue($v->passes()); <ide> <ide> $v = new Validator($trans, ['x' => '2000-01-01'], ['x' => 'date_format:Y-m-d']);
35
PHP
PHP
add unicode to message
30016408a6911afba4aa7739d69948d13612ea06
<ide><path>src/Illuminate/Notifications/Channels/NexmoSmsChannel.php <ide> public function send($notifiable, Notification $notification) <ide> } <ide> <ide> return $this->nexmo->message()->send([ <del> 'type' => 'unicode', <add> 'type' => $message->type, <ide> 'from' => $message->from ?: $this->from, <ide> 'to' => $to, <ide> 'text' => trim($message->content), <ide><path>src/Illuminate/Notifications/Messages/NexmoMessage.php <ide> class NexmoMessage <ide> */ <ide> public $from; <ide> <add> /** <add> * The message type. <add> * <add> * @var string <add> */ <add> public $type = 'text'; <add> <ide> /** <ide> * Create a new message instance. <ide> * <ide> public function from($from) <ide> <ide> return $this; <ide> } <add> <add> /** <add> * Set the message type. <add> * <add> * @return $this <add> */ <add> public function unicode() <add> { <add> $this->type = 'unicode'; <add> <add> return $this; <add> } <ide> } <ide><path>tests/Notifications/NotificationNexmoChannelTest.php <ide> public function testSmsIsSentViaNexmo() <ide> ); <ide> <ide> $nexmo->shouldReceive('message->send')->with([ <add> 'type' => 'text', <ide> 'from' => '4444444444', <ide> 'to' => '5555555555', <ide> 'text' => 'this is my message', <ide> public function testSmsIsSentViaNexmoWithCustomFrom() <ide> ); <ide> <ide> $nexmo->shouldReceive('message->send')->with([ <add> 'type' => 'unicode', <ide> 'from' => '5554443333', <ide> 'to' => '5555555555', <ide> 'text' => 'this is my message', <ide> class NotificationNexmoChannelTestCustomFromNotification extends Notification <ide> { <ide> public function toNexmo($notifiable) <ide> { <del> return (new NexmoMessage('this is my message'))->from('5554443333'); <add> return (new NexmoMessage('this is my message'))->from('5554443333')->unicode(); <ide> } <ide> }
3
Javascript
Javascript
avoid race in file write stream handle tests
4e6fdb3e12b3a19cf7bcabc18a2aaa1d03181a07
<ide><path>test/parallel/test-fs-write-stream-file-handle-2.js <add>'use strict'; <add>const common = require('../common'); <add>const fs = require('fs'); <add>const path = require('path'); <add>const assert = require('assert'); <add>const tmpdir = require('../common/tmpdir'); <add>const file = path.join(tmpdir.path, 'write_stream_filehandle_test.txt'); <add>const input = 'hello world'; <add> <add>tmpdir.refresh(); <add> <add>fs.promises.open(file, 'w+').then((handle) => { <add> let calls = 0; <add> const { <add> write: originalWriteFunction, <add> writev: originalWritevFunction <add> } = handle; <add> handle.write = function write() { <add> calls++; <add> return Reflect.apply(originalWriteFunction, this, arguments); <add> }; <add> handle.writev = function writev() { <add> calls++; <add> return Reflect.apply(originalWritevFunction, this, arguments); <add> }; <add> const stream = fs.createWriteStream(null, { fd: handle }); <add> <add> stream.end(input); <add> stream.on('close', common.mustCall(() => { <add> assert(calls > 0, 'expected at least one call to fileHandle.write or ' + <add> 'fileHandle.writev, got 0'); <add> })); <add>}).then(common.mustCall()); <ide><path>test/parallel/test-fs-write-stream-file-handle.js <ide> fs.promises.open(file, 'w+').then((handle) => { <ide> assert.strictEqual(output, input); <ide> })); <ide> }).then(common.mustCall()); <del> <del>fs.promises.open(file, 'w+').then((handle) => { <del> let calls = 0; <del> const { <del> write: originalWriteFunction, <del> writev: originalWritevFunction <del> } = handle; <del> handle.write = function write() { <del> calls++; <del> return Reflect.apply(originalWriteFunction, this, arguments); <del> }; <del> handle.writev = function writev() { <del> calls++; <del> return Reflect.apply(originalWritevFunction, this, arguments); <del> }; <del> const stream = fs.createWriteStream(null, { fd: handle }); <del> <del> stream.end(input); <del> stream.on('close', common.mustCall(() => { <del> assert(calls > 0, 'expected at least one call to fileHandle.write or ' + <del> 'fileHandle.writev, got 0'); <del> })); <del>}).then(common.mustCall());
2
Javascript
Javascript
fix the tests to not use global msie
affcbad501ad5e17b8cb30ad8a2c0d1de6686722
<ide><path>test/ngMock/angular-mocksSpec.js <ide> describe('ngMock', function() { <ide> }); <ide> }); <ide> <add> <ide> // We don't run the following tests on IE8. <ide> // IE8 throws "Object does not support this property or method." error, <ide> // when thrown from a function defined on window (which `inject` is). <del> if (msie <= 8) return; <ide> <del> it('should not change thrown Errors', function() { <del> expect(function(){ <del> throw new Error('test message'); <add> it('should not change thrown Errors', inject(function($sniffer) { <add> if ($sniffer.msie <= 8) return; <add> <add> expect(function() { <add> inject(function() { <add> throw new Error('test message'); <add> }); <ide> }).toThrow('test message'); <del> }); <add> })); <ide> <del> it('should not change thrown strings', function(){ <del> expect(function(){ <del> throw 'test message'; <add> it('should not change thrown strings', inject(function($sniffer) { <add> if ($sniffer.msie <= 8) return; <add> <add> expect(function() { <add> inject(function() { <add> throw 'test message'; <add> }); <ide> }).toThrow('test message'); <del> }); <add> })); <ide> }); <ide> }); <ide>
1
Javascript
Javascript
remove temporary files
f2064b87e62c8aa4cd7ca908ac5394ea7464f1e2
<ide><path>test/ChangesAndRemovalsTemp/temp-file.js <del>module.exports = function temp() {return 'temp file';}; <del> require('./temp-file2') <ide>\ No newline at end of file <ide><path>test/ChangesAndRemovalsTemp/temp-file2.js <del>module.exports = function temp2() {return 'temp file 2';}; <ide>\ No newline at end of file
2
Ruby
Ruby
make most parameters to the aliastracker required
c24ea241e224b2d58e3184fa119beddac096b1f2
<ide><path>activerecord/lib/active_record/associations/alias_tracker.rb <ide> class AliasTracker # :nodoc: <ide> attr_reader :aliases, :table_joins, :connection <ide> <ide> # table_joins is an array of arel joins which might conflict with the aliases we assign here <del> def initialize(connection = Base.connection, table_joins = []) <add> def initialize(connection, table_joins = []) <ide> @aliases = Hash.new { |h,k| h[k] = initial_count_for(k) } <ide> @table_joins = table_joins <ide> @connection = connection <ide> end <ide> <del> def aliased_table_for(table_name, aliased_name = nil) <add> def aliased_table_for(table_name, aliased_name) <ide> table_alias = aliased_name_for(table_name, aliased_name) <ide> <ide> if table_alias == table_name <ide> def aliased_table_for(table_name, aliased_name = nil) <ide> end <ide> end <ide> <del> def aliased_name_for(table_name, aliased_name = nil) <del> aliased_name ||= table_name <del> <add> def aliased_name_for(table_name, aliased_name) <ide> if aliases[table_name].zero? <ide> # If it's zero, we can have our table_name <ide> aliases[table_name] = 1 <ide><path>activerecord/lib/active_record/associations/join_dependency.rb <ide> def self.walk_tree(associations, hash) <ide> # <ide> def initialize(base, associations, joins) <ide> @alias_tracker = AliasTracker.new(base.connection, joins) <del> @alias_tracker.aliased_name_for(base.table_name) # Updates the count for base.table_name to 1 <add> @alias_tracker.aliased_name_for(base.table_name, base.table_name) # Updates the count for base.table_name to 1 <ide> tree = self.class.make_tree associations <ide> @join_root = JoinBase.new base, build(tree, base) <ide> @join_root.children.each { |child| construct_tables! @join_root, child }
2
Text
Text
add author credit for [ci skip]
497353ebe9bc294ed1097ffbbc2596d5a360fc38
<ide><path>activerecord/CHANGELOG.md <ide> otherwise specified. This will reduce memory pressure for applications which <ide> do not generally mutate string properties of Active Record objects. <ide> <del> *Sean Griffin* <add> *Sean Griffin*, *Ryuta Kamizono* <ide> <ide> * Deprecate `map!` and `collect!` on `ActiveRecord::Result`. <ide>
1
PHP
PHP
add @link to set methods
708ae873a59b2ab3b23657bbdfb8adf9cdf5bffb
<ide><path>lib/Cake/Utility/Set.php <ide> class Set { <ide> * @param array $arr1 Array to be merged <ide> * @param array $arr2 Array to merge with <ide> * @return array Merged array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::merge <ide> */ <ide> public static function merge($arr1, $arr2 = null) { <ide> $args = func_get_args(); <ide> public static function merge($arr1, $arr2 = null) { <ide> * <ide> * @param array $var Either an array to filter, or value when in callback <ide> * @return mixed Either filtered array, or true/false when in callback <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::filter <ide> */ <ide> public static function filter(array $var) { <ide> foreach ($var as $k => $v) { <ide> protected static function _filter($var) { <ide> * @param mixed $array Original array <ide> * @param mixed $array2 Differences to push <ide> * @return array Combined array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::pushDiff <ide> */ <ide> public static function pushDiff($array, $array2) { <ide> if (empty($array) && !empty($array2)) { <ide> public static function pushDiff($array, $array2) { <ide> * @param string $class A class name of the type of object to map to <ide> * @param string $tmp A temporary class name used as $class if $class is an array <ide> * @return object Hierarchical object <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::map <ide> */ <ide> public static function map($class = 'stdClass', $tmp = 'stdClass') { <ide> if (is_array($class)) { <ide> protected static function _map(&$array, $class, $primary = false) { <ide> * <ide> * @param array $array The array to check. If null, the value of the current Set object <ide> * @return boolean true if values are numeric, false otherwise <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::numeric <ide> */ <ide> public static function numeric($array = null) { <ide> if (empty($array)) { <ide> public static function numeric($array = null) { <ide> * @param mixed $select Key in $list to return <ide> * @param mixed $list can be an array or a comma-separated list. <ide> * @return string the value of the array key or null if no match <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::enum <ide> */ <ide> public static function enum($select, $list = null) { <ide> if (empty($list)) { <ide> public static function enum($select, $list = null) { <ide> * @param string $format Format string into which values will be inserted, see sprintf() <ide> * @param array $keys An array containing one or more Set::extract()-style key paths <ide> * @return array An array of strings extracted from $keys and formatted with $format <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::format <ide> */ <ide> public static function format($data, $format, $keys) { <ide> $extracted = array(); <ide> public static function format($data, $format, $keys) { <ide> * @param array $data An array of data to extract from <ide> * @param array $options Currently only supports 'flatten' which can be disabled for higher XPath-ness <ide> * @return array An array of matched items <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::extract <ide> */ <ide> public static function extract($path, $data = null, $options = array()) { <ide> if (is_string($data)) { <ide> public static function extract($path, $data = null, $options = array()) { <ide> * @param integer $i Optional: The 'nth'-number of the item being matched. <ide> * @param integer $length <ide> * @return boolean <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::matches <ide> */ <ide> public static function matches($conditions, $data = array(), $i = null, $length = null) { <ide> if (empty($conditions)) { <ide> public static function matches($conditions, $data = array(), $i = null, $length <ide> * @param array $data Array from where to extract <ide> * @param mixed $path As an array, or as a dot-separated string. <ide> * @return array Extracted data <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::classicExtract <ide> */ <ide> public static function classicExtract($data, $path = null) { <ide> if (empty($path)) { <ide> public static function classicExtract($data, $path = null) { <ide> * @param mixed $path A dot-separated string. <ide> * @param array $data Data to insert <ide> * @return array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::insert <ide> */ <ide> public static function insert($list, $path, $data = null) { <ide> if (!is_array($path)) { <ide> public static function insert($list, $path, $data = null) { <ide> * @param mixed $list From where to remove <ide> * @param mixed $path A dot-separated string. <ide> * @return array Array with $path removed from its value <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::remove <ide> */ <ide> public static function remove($list, $path = null) { <ide> if (empty($path)) { <ide> public static function remove($list, $path = null) { <ide> * @param mixed $data Data to check on <ide> * @param mixed $path A dot-separated string. <ide> * @return boolean true if path is found, false otherwise <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::check <ide> */ <ide> public static function check($data, $path = null) { <ide> if (empty($path)) { <ide> public static function check($data, $path = null) { <ide> * @param mixed $val2 Second value <ide> * @return array Returns the key => value pairs that are not common in $val1 and $val2 <ide> * The expression for this function is ($val1 - $val2) + ($val2 - ($val1 - $val2)) <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::diff <ide> */ <ide> public static function diff($val1, $val2 = null) { <ide> if (empty($val1)) { <ide> public static function diff($val1, $val2 = null) { <ide> * @param array $val1 First value <ide> * @param array $val2 Second value <ide> * @return boolean true if $val1 contains $val2, false otherwise <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::contains <ide> */ <ide> public static function contains($val1, $val2 = null) { <ide> if (empty($val1) || empty($val2)) { <ide> public static function contains($val1, $val2 = null) { <ide> * @param boolean $all Set to true to count the dimension considering all elements in array <ide> * @param integer $count Start the dimension count at this number <ide> * @return integer The number of dimensions in $array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::countDim <ide> */ <ide> public static function countDim($array = null, $all = false, $count = 0) { <ide> if ($all) { <ide> public static function countDim($array = null, $all = false, $count = 0) { <ide> * @param string $sep If $list is a string, it will be split into an array with $sep <ide> * @param boolean $trim If true, separated strings will be trimmed <ide> * @return array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::normalize <ide> */ <ide> public static function normalize($list, $assoc = true, $sep = ',', $trim = true) { <ide> if (is_string($list)) { <ide> public static function normalize($list, $assoc = true, $sep = ',', $trim = true) <ide> * @param mixed $path2 As an array, or as a dot-separated string. <ide> * @param string $groupPath As an array, or as a dot-separated string. <ide> * @return array Combined array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::combine <ide> */ <ide> public static function combine($data, $path1 = null, $path2 = null, $groupPath = null) { <ide> if (empty($data)) { <ide> public static function combine($data, $path1 = null, $path2 = null, $groupPath = <ide> * Converts an object into an array. <ide> * @param object $object Object to reverse <ide> * @return array Array representation of given object <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::reverse <ide> */ <ide> public static function reverse($object) { <ide> $out = array(); <ide> public static function reverse($object) { <ide> * @param array $data Array to flatten <ide> * @param string $separator String used to separate array key elements in a path, defaults to '.' <ide> * @return array <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::flatten <ide> */ <ide> public static function flatten($data, $separator = '.') { <ide> $result = array(); <ide> protected static function _flatten($results, $key = null) { <ide> * @param string $path A Set-compatible path to the array value <ide> * @param string $dir Direction of sorting - either ascending (ASC), or descending (DESC) <ide> * @return array Sorted array of data <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::sort <ide> */ <ide> public static function sort($data, $path, $dir) { <ide> $originalKeys = array_keys($data); <ide> public static function sort($data, $path, $dir) { <ide> * to array_map, reduce will handoff to array_reduce, and pass will <ide> * use call_user_func_array(). <ide> * @return mixed Result of the callback when applied to extracted data <add> * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::apply <ide> */ <ide> public static function apply($path, $data, $callback, $options = array()) { <ide> $defaults = array('type' => 'pass');
1
Ruby
Ruby
remove env access from debug_exceptions
feb248ca76de7bd3c1cbb08914d0bba66c5b41be
<ide><path>actionpack/lib/action_dispatch/middleware/debug_exceptions.rb <ide> def call(env) <ide> response <ide> rescue Exception => exception <ide> raise exception unless request.show_exceptions? <del> render_exception(env, exception) <add> render_exception(request, exception) <ide> end <ide> <ide> private <ide> <del> def render_exception(env, exception) <del> backtrace_cleaner = env['action_dispatch.backtrace_cleaner'] <add> def render_exception(request, exception) <add> backtrace_cleaner = request.get_header('action_dispatch.backtrace_cleaner') <ide> wrapper = ExceptionWrapper.new(backtrace_cleaner, exception) <del> log_error(env, wrapper) <add> log_error(request, wrapper) <ide> <del> if env['action_dispatch.show_detailed_exceptions'] <del> request = Request.new(env) <add> if request.get_header('action_dispatch.show_detailed_exceptions') <ide> traces = wrapper.traces <ide> <ide> trace_to_show = 'Application Trace' <ide> def render(status, body, format) <ide> [status, {'Content-Type' => "#{format}; charset=#{Response.default_charset}", 'Content-Length' => body.bytesize.to_s}, [body]] <ide> end <ide> <del> def log_error(env, wrapper) <del> logger = logger(env) <add> def log_error(request, wrapper) <add> logger = logger(request) <ide> return unless logger <ide> <ide> exception = wrapper.exception <ide> def log_error(env, wrapper) <ide> end <ide> end <ide> <del> def logger(env) <del> env['action_dispatch.logger'] || stderr_logger <add> def logger(request) <add> request.logger || stderr_logger <ide> end <ide> <ide> def stderr_logger
1
Python
Python
add tasks to build arch specifics wininst
644588a77e2d320375ec96a3c8f426317dad7c06
<ide><path>pavement.py <ide> DMG_CONTENT = paver.path.path('numpy-macosx-installer') / 'content' <ide> <ide> options(sphinx=Bunch(builddir="build", sourcedir="source", docroot='doc'), <del> virtualenv=Bunch(script_name=BOOTSTRAP_SCRIPT)) <add> virtualenv=Bunch(script_name=BOOTSTRAP_SCRIPT), <add> wininst=Bunch(pyver="2.5")) <ide> <ide> # Bootstrap stuff <ide> @task <ide> def sdist(): <ide> # do not play well together. <ide> sh('python setup.py sdist --formats=gztar,zip') <ide> <add>#------------------ <add># Wine-based builds <add>#------------------ <add>_SSE3_CFG = r"""[atlas] <add>library_dirs = C:\local\lib\yop\sse3""" <add>_SSE2_CFG = r"""[atlas] <add>library_dirs = C:\local\lib\yop\sse2""" <add>_NOSSE_CFG = r"""[DEFAULT] <add>library_dirs = C:\local\lib\yop\nosse""" <add> <add>SITECFG = {"sse2" : _SSE2_CFG, "sse3" : _SSE3_CFG, "nosse" : _NOSSE_CFG} <add> <add>def internal_wininst_name(arch, ismsi=False): <add> """Return the name of the wininst as it will be inside the superpack (i.e. <add> with the arch encoded.""" <add> if ismsi: <add> ext = '.msi' <add> else: <add> ext = '.exe' <add> return "numpy-%s-%s%s" % (FULLVERSION, arch, ext) <add> <add>def wininst_name(pyver, ismsi=False): <add> """Return the name of the installer built by wininst command.""" <add> # Yeah, the name logic is harcoded in distutils. We have to reproduce it <add> # here <add> if ismsi: <add> ext = '.msi' <add> else: <add> ext = '.exe' <add> name = "numpy-%s.win32-py%s%s" % (FULLVERSION, pyver, ext) <add> return name <add> <add>def bdist_wininst_arch(pyver, arch): <add> """Arch specific wininst build.""" <add> _bdist_wininst(pyver, SITECFG[arch]) <add> source = os.path.join('dist', wininst_name(pyver)) <add> target = os.path.join('dist', internal_wininst_name(arch)) <add> if os.path.exists(target): <add> os.remove(target) <add> os.rename(source, target) <add> <ide> @task <ide> @needs('clean') <del>def bdist_wininst_26(): <del> _bdist_wininst(pyver='2.6') <add>def bdist_wininst_nosse(options): <add> """Build the nosse wininst installer.""" <add> bdist_wininst_arch(options.wininst.pyver, 'nosse') <ide> <ide> @task <ide> @needs('clean') <del>def bdist_wininst_25(): <del> _bdist_wininst(pyver='2.5') <add>def bdist_wininst_sse2(options): <add> """Build the sse2 wininst installer.""" <add> bdist_wininst_arch(options.wininst.pyver, 'sse2') <ide> <ide> @task <del>@needs('bdist_wininst_25', 'bdist_wininst_26') <del>def bdist_wininst(): <add>@needs('clean') <add>def bdist_wininst_sse3(options): <add> """Build the sse3 wininst installer.""" <add> bdist_wininst_arch(options.wininst.pyver, 'sse3') <add> <add>@task <add>@needs('bdist_wininst_nosse', 'bdist_wininst_sse2', 'bdist_wininst_sse3') <add>def bdist_wininst_all(options): <add> """Build all arch specific wininst installers.""" <ide> pass <ide> <ide> @task <ide> @needs('clean', 'bdist_wininst') <del>def winbin(): <del> pass <add>def bdist_wininst_simple(): <add> """Simple wininst-based installer.""" <add> _bdist_wininst(pyver=options.wininst.pyver) <ide> <del>def _bdist_wininst(pyver): <add>def _bdist_wininst(pyver, cfgstr=WINE_SITE_CFG): <ide> site = paver.path.path('site.cfg') <ide> exists = site.exists() <ide> try: <ide> if exists: <ide> site.move('site.cfg.bak') <ide> a = open(str(site), 'w') <del> a.writelines(WINE_SITE_CFG) <add> a.writelines(cfgstr) <ide> a.close() <ide> sh('%s setup.py build -c mingw32 bdist_wininst' % WINE_PYS[pyver]) <ide> finally: <ide> site.remove() <ide> if exists: <ide> paver.path.path('site.cfg.bak').move(site) <ide> <add>#------------------- <ide> # Mac OS X installer <add>#------------------- <ide> def macosx_version(): <ide> if not sys.platform == 'darwin': <ide> raise ValueError("Not darwin ??")
1
PHP
PHP
update copyright statements in docblocks
5ae1c29836e57550c06e49b197ee87c2d11ddc7c
<ide><path>src/Console/Error/ConsoleException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Console/Error/MissingShellException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Console/Error/MissingShellMethodException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Console/Error/MissingTaskException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Controller/Error/MissingActionException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Controller/Error/MissingComponentException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Controller/Error/MissingControllerException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Controller/Error/PrivateActionException.php <ide> * PrivateActionException class <ide> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Core/Error/MissingPluginException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Datasource/Error/MissingDatasourceConfigException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Datasource/Error/MissingDatasourceException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/BadRequestException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/BaseException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/Exception.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/FatalErrorException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/ForbiddenException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/HttpException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/InternalErrorException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/MethodNotAllowedException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/NotFoundException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/NotImplementedException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Error/UnauthorizedException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Log/Log.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 0.2.9 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Log/LogTrait.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Error/SocketException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Adapter/Stream.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Auth/Basic.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Auth/Digest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Auth/Oauth.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Client.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Cookies.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/FormData.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/FormData/Part.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Message.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Request.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Network/Http/Response.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/ORM/Error/MissingBehaviorException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/ORM/Error/MissingTableClassException.php <ide> * MissingTableClassException class <ide> * <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide><path>src/Routing/Error/MissingDispatcherFilterException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Routing/RequestActionTrait.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Routing/RouteCollection.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/Utility/Error/XmlException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/View/Error/MissingHelperException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/View/Error/MissingLayoutException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>src/View/Error/MissingViewException.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Core/AppTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 2.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Core/PluginTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 2.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Database/Expression/FunctionExpressionTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The Open Group Test Suite License <ide> * Redistributions of files must retain the above copyright notice. <ide><path>tests/TestCase/Database/FunctionsBuilderTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The Open Group Test Suite License <ide> * Redistributions of files must retain the above copyright notice. <ide><path>tests/TestCase/Log/Engine/ConsoleLogTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <ide> * @since 1.3.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Log/LogTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <ide> * @since 1.2.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Log/LogTraitTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/Adapter/StreamTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/Auth/DigestTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/Auth/OauthTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/ClientTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/CookiesTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/FormDataTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/RequestTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Network/Http/ResponseTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Routing/DispatcherTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <ide> * @since 1.2.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Routing/Filter/AssetDispatcherTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The Open Group Test Suite License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests <ide> * @since 2.2.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Routing/RequestActionTraitTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/TestCase/Utility/StringTest.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <ide> * @since 1.2.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/bootstrap.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide><path>tests/test_app/Plugin/Company/TestPluginThree/Utility/Hello.php <ide> <?php <ide> /** <ide> * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/Plugin/TestPlugin/Controller/Admin/CommentsController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/Plugin/TestPlugin/View/Cell/DummyCell.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/AbstractController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/Admin/PostsController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/CommentsController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/Component/AppleComponent.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/Component/SomethingWithCookieComponent.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/OrangeSessionTestController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/SessionTestController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/SomePagesController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/SomePostsController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/Controller/TestDispatchPagesController.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/View/Cell/ArticlesCell.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide><path>tests/test_app/TestApp/View/CustomJsonView.php <ide> <?php <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * <ide> * Licensed under The MIT License <ide> * Redistributions of files must retain the above copyright notice. <ide> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://cakephp.org CakePHP(tm) Project <ide> * @since 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
80
PHP
PHP
implement timestamp behavior
2e01e08da5818e130431ba4314456a5dcd7d9804
<ide><path>Cake/Model/Behavior/TimestampBehavior.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 MIT License (http://www.opensource.org/licenses/mit-license.php) <add> */ <add>namespace Cake\Model\Behavior; <add> <add>use Cake\Event\Event; <add>use Cake\ORM\Behavior; <add>use Cake\ORM\Entity; <add>use Cake\ORM\Table; <add> <add>class TimestampBehavior extends Behavior { <add> <add>/** <add> * Default settings <add> * <add> * These are merged with user-provided settings when the behavior is used. <add> * <add> * refreshTimestamp - if true (the default) the timestamp used will be the current time when <add> * the code is executed, to set to an explicit date time value - set refreshTimetamp to false <add> * and call setTimestamp() on the behavior class before use. <add> * <add> * @var array <add> */ <add> protected $_defaultSettings = [ <add> 'fields' => [ <add> 'created' => 'created', <add> 'updated' => 'modified' <add> ], <add> 'refreshTimestamp' => true <add> ]; <add> <add>/** <add> * Current timestamp <add> * <add> * @var \DateTime <add> */ <add> protected $_ts; <add> <add>/** <add> * Constructor <add> * <add> * Merge settings with the default and store in the settings property <add> * <add> * @param Table $table The table this behavior is attached to. <add> * @param array $settings The settings for this behavior. <add> */ <add> public function __construct(Table $table, array $settings = []) { <add> $this->_settings = $settings + $this->_defaultSettings; <add> } <add> <add>/** <add> * beforeSave <add> * <add> * There is only one event handler, it can be configured to be called for any event <add> * <add> * @param Event $event <add> * @param Entity $entity <add> * @return true (irrespective of the behavior logic, the save will not be prevented) <add> */ <add> public function beforeSave(Event $event, Entity $entity) { <add> $settings = $this->settings(); <add> $new = $entity->isNew() !== false; <add> <add> if ($new) { <add> $this->_updateField($entity, $settings['fields']['created'], $settings['refreshTimestamp']); <add> } <add> $this->_updateField($entity, $settings['fields']['updated'], $settings['refreshTimestamp']); <add> <add> return true; <add> } <add> <add>/** <add> * getTimestamp <add> * <add> * Gets the current timestamp. If $refreshTimestamp is not truthy, the existing timestamp will be <add> * returned <add> * <add> * @return \DateTime <add> */ <add> public function getTimestamp($refreshTimestamp = null) { <add> if ($this->_ts === null || $refreshTimestamp) { <add> $this->setTimestamp(); <add> } <add> <add> return $this->_ts; <add> } <add> <add>/** <add> * setTimestamp <add> * <add> * Set the timestamp to the given DateTime object, or if not passed a new DateTime object <add> * <add> * @param int $ts <add> * @return void <add> */ <add> public function setTimestamp(\DateTime $ts = null) { <add> if ($ts === null) { <add> $ts = new \DateTime(); <add> } <add> $this->_ts = $ts; <add> } <add> <add>/** <add> * Update a field, if it hasn't been updated already <add> * <add> * @param Entity $entity <add> * @param string $field <add> * @param bool $refreshTimestamp <add> * @return void <add> */ <add> protected function _updateField(Entity $entity, $field, $refreshTimestamp) { <add> if ($entity->dirty($field)) { <add> return; <add> } <add> $entity->set($field, $this->getTimestamp($refreshTimestamp)); <add> } <add>} <ide><path>Cake/Test/TestCase/Model/Behavior/TimestampBehaviorTest.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 MIT License (http://www.opensource.org/licenses/mit-license.php) <add> */ <add>namespace Cake\Test\TestCase\Model\Behavior; <add> <add>use Cake\Event\Event; <add>use Cake\Model\Behavior\TimestampBehavior; <add>use Cake\ORM\Entity; <add>use Cake\TestSuite\TestCase; <add> <add>/** <add> * Behavior test case <add> */ <add>class TimestampBehaviorTest extends TestCase { <add> <add>/** <add> * Sanity check Implemented events <add> * <add> * @return void <add> */ <add> public function testImplementedEvents() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table); <add> <add> $expected = [ <add> 'Model.beforeSave' => 'beforeSave' <add> ]; <add> $this->assertEquals($expected, $this->Behavior->implementedEvents()); <add> } <add> <add>/** <add> * testCreatedAbsent <add> * <add> * @return void <add> */ <add> public function testCreatedAbsent() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table, ['refreshTimestamp' => false]); <add> $ts = new \DateTime('2000-01-01'); <add> $this->Behavior->setTimestamp($ts); <add> <add> $event = new Event('Model.beforeSave'); <add> $entity = new Entity(['name' => 'Foo']); <add> <add> $return = $this->Behavior->beforeSave($event, $entity); <add> $this->assertTrue($return, 'Handle Event is expected to always return true'); <add> $this->assertSame($ts, $entity->created, 'Created timestamp is expected to be the mocked value'); <add> } <add> <add>/** <add> * testCreatedPresent <add> * <add> * @return void <add> */ <add> public function testCreatedPresent() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table, ['refreshTimestamp' => false]); <add> $ts = new \DateTime('2000-01-01'); <add> $this->Behavior->setTimestamp($ts); <add> <add> $event = new Event('Model.beforeSave'); <add> $existingValue = new \DateTime('2011-11-11'); <add> $entity = new Entity(['name' => 'Foo', 'created' => $existingValue]); <add> <add> $return = $this->Behavior->beforeSave($event, $entity); <add> $this->assertTrue($return, 'Handle Event is expected to always return true'); <add> $this->assertSame($existingValue, $entity->created, 'Created timestamp is expected to be unchanged'); <add> } <add> <add>/** <add> * testCreatedNotNew <add> * <add> * @return void <add> */ <add> public function testCreatedNotNew() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table, ['refreshTimestamp' => false]); <add> $ts = new \DateTime('2000-01-01'); <add> $this->Behavior->setTimestamp($ts); <add> <add> $event = new Event('Model.beforeSave'); <add> $entity = new Entity(['name' => 'Foo']); <add> $entity->isNew(false); <add> <add> $return = $this->Behavior->beforeSave($event, $entity); <add> $this->assertTrue($return, 'Handle Event is expected to always return true'); <add> $this->assertNull($entity->created, 'Created timestamp is expected to be untouched if the entity is not new'); <add> } <add> <add>/** <add> * testModifiedAbsent <add> * <add> * @return void <add> */ <add> public function testModifiedAbsent() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table, ['refreshTimestamp' => false]); <add> $ts = new \DateTime('2000-01-01'); <add> $this->Behavior->setTimestamp($ts); <add> <add> $event = new Event('Model.beforeSave'); <add> $entity = new Entity(['name' => 'Foo']); <add> $entity->isNew(false); <add> <add> $return = $this->Behavior->beforeSave($event, $entity); <add> $this->assertTrue($return, 'Handle Event is expected to always return true'); <add> $this->assertSame($ts, $entity->modified, 'Modified timestamp is expected to be the mocked value'); <add> } <add> <add>/** <add> * testModifiedPresent <add> * <add> * @return void <add> */ <add> public function testModifiedPresent() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table, ['refreshTimestamp' => false]); <add> $ts = new \DateTime('2000-01-01'); <add> $this->Behavior->setTimestamp($ts); <add> <add> $event = new Event('Model.beforeSave'); <add> $existingValue = new \DateTime('2011-11-11'); <add> $entity = new Entity(['name' => 'Foo', 'modified' => $existingValue]); <add> $entity->clean(); <add> $entity->isNew(false); <add> <add> $return = $this->Behavior->beforeSave($event, $entity); <add> $this->assertTrue($return, 'Handle Event is expected to always return true'); <add> $this->assertSame($ts, $entity->modified, 'Modified timestamp is expected to be updated'); <add> } <add> <add>/** <add> * testGetTimestamp <add> * <add> * @return void <add> */ <add> public function testGetTimestamp() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table); <add> <add> $property = new \ReflectionProperty('Cake\Model\Behavior\TimestampBehavior', '_ts'); <add> $property->setAccessible(true); <add> <add> $this->assertNull($property->getValue($this->Behavior), 'Should be null be default'); <add> <add> $return = $this->Behavior->getTimestamp(); <add> $this->assertInstanceOf( <add> 'DateTime', <add> $return, <add> 'After calling for the first time, should be a date time object' <add> ); <add> <add> return $this->Behavior; <add> } <add> <add>/** <add> * testGetTimestampPersists <add> * <add> * @depends testGetTimestamp <add> * @return void <add> */ <add> public function testGetTimestampPersists($behavior) { <add> $this->Behavior = $behavior; <add> <add> $property = new \ReflectionProperty('Cake\Model\Behavior\TimestampBehavior', '_ts'); <add> $property->setAccessible(true); <add> <add> $initialValue = $property->getValue($this->Behavior); <add> $this->Behavior->getTimestamp(); <add> $postValue = $property->getValue($this->Behavior); <add> <add> $this->assertSame( <add> $initialValue, <add> $postValue, <add> 'The timestamp should be exactly the same value' <add> ); <add> } <add> <add>/** <add> * testGetTimestampRefreshes <add> * <add> * @depends testGetTimestamp <add> * @return void <add> */ <add> public function testGetTimestampRefreshes($behavior) { <add> $this->Behavior = $behavior; <add> <add> $property = new \ReflectionProperty('Cake\Model\Behavior\TimestampBehavior', '_ts'); <add> $property->setAccessible(true); <add> <add> $initialValue = $property->getValue($this->Behavior); <add> $this->Behavior->getTimestamp(true); <add> $postValue = $property->getValue($this->Behavior); <add> <add> $this->assertNotSame( <add> $initialValue, <add> $postValue, <add> 'The timestamp should be a different object if refreshTimestamp is truthy' <add> ); <add> } <add> <add>/** <add> * testSetTimestampDefault <add> * <add> * @return void <add> */ <add> public function testSetTimestampDefault() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table); <add> <add> $this->Behavior->setTimestamp(); <add> <add> $property = new \ReflectionProperty('Cake\Model\Behavior\TimestampBehavior', '_ts'); <add> $property->setAccessible(true); <add> $set = $property->getValue($this->Behavior); <add> <add> $this->assertInstanceOf( <add> 'DateTime', <add> $set, <add> 'After calling for the first time, should be a date time object' <add> ); <add> } <add> <add>/** <add> * testSetTimestampExplicit <add> * <add> * @return void <add> */ <add> public function testSetTimestampExplicit() { <add> $table = $this->getMock('Cake\ORM\Table'); <add> $this->Behavior = new TimestampBehavior($table); <add> <add> $ts = new \DateTime(); <add> $this->Behavior->setTimestamp($ts); <add> <add> $property = new \ReflectionProperty('Cake\Model\Behavior\TimestampBehavior', '_ts'); <add> $property->setAccessible(true); <add> $set = $property->getValue($this->Behavior); <add> <add> $this->assertInstanceOf( <add> 'DateTime', <add> $set, <add> 'After calling for the first time, should be a date time object' <add> ); <add> <add> $this->assertSame( <add> $ts, <add> $set, <add> 'Should have set the same object passed in' <add> ); <add> } <add>}
2
Ruby
Ruby
fail parallel tests if workers exit early
9fd02d181a0706cd3a98e08b2caa7c9ed3c39b50
<ide><path>activesupport/lib/active_support/testing/parallelization.rb <ide> def <<(o) <ide> @queue << o <ide> end <ide> <add> def length <add> @queue.length <add> end <add> <ide> def pop; @queue.pop; end <ide> end <ide> <ide> def <<(work) <ide> def shutdown <ide> @queue_size.times { @queue << nil } <ide> @pool.each { |pid| Process.waitpid pid } <add> <add> if @queue.length > 0 <add> raise "Queue not empty, but all workers have finished. This probably means that a worker crashed and #{@queue.length} tests were missed." <add> end <ide> end <ide> <ide> private <ide><path>railties/test/application/test_runner_test.rb <ide> def test_run_in_parallel_with_processes <ide> assert_no_match "create_table(:users)", output <ide> end <ide> <add> def test_run_in_parallel_with_process_worker_crash <add> exercise_parallelization_regardless_of_machine_core_count(with: :processes) <add> <add> file_name = app_file("test/models/parallel_test.rb", <<-RUBY) <add> require 'test_helper' <add> <add> class ParallelTest < ActiveSupport::TestCase <add> def test_crash <add> Kernel.exit 1 <add> end <add> end <add> RUBY <add> <add> output = run_test_command(file_name) <add> <add> assert_match %r{Queue not empty, but all workers have finished. This probably means that a worker crashed and 1 tests were missed.}, output <add> end <add> <ide> def test_run_in_parallel_with_threads <ide> exercise_parallelization_regardless_of_machine_core_count(with: :threads) <ide>
2
Python
Python
fix e731 flake8 warning (x3)
7dce8dc7ac061f81a0ba2062cf586db52cd1ffd8
<ide><path>examples/summarization/run_summarization.py <ide> def save_rouge_scores(str_scores): <ide> def build_data_iterator(args, tokenizer): <ide> dataset = load_and_cache_examples(args, tokenizer) <ide> sampler = SequentialSampler(dataset) <del> collate_fn = lambda data: collate(data, tokenizer, block_size=512, device=args.device) <add> <add> def collate_fn(data): <add> return collate(data, tokenizer, block_size=512, device=args.device) <add> <ide> iterator = DataLoader(dataset, sampler=sampler, batch_size=args.batch_size, collate_fn=collate_fn,) <ide> <ide> return iterator <ide><path>transformers/commands/serving.py <ide> _serve_dependancies_installed = True <ide> except (ImportError, AttributeError): <ide> BaseModel = object <del> Body = lambda *x, **y: None <add> <add> def Body(*x, **y): <add> pass <add> <ide> _serve_dependancies_installed = False <ide> <ide> <ide><path>transformers/modeling_utils.py <ide> class PreTrainedModel(nn.Module): <ide> """ <ide> config_class = None <ide> pretrained_model_archive_map = {} <del> load_tf_weights = lambda model, config, path: None <ide> base_model_prefix = "" <ide> <ide> @property
3
PHP
PHP
unskip relevant select() tests
9d0ebce8c4ef47902ad23b9cd7938d7ec2b334f8
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> public function testDomIdSuffixCollisionResolvement() { <ide> * @return void <ide> */ <ide> public function testSelect() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $result = $this->Form->select('Model.field', array()); <ide> $expected = array( <ide> 'select' => array('name' => 'Model[field]', 'id' => 'ModelField'), <ide> public function testSelect() { <ide> * @return void <ide> */ <ide> public function testSelectOptionGroupEscaping() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $options = array( <ide> '>< Key' => array( <ide> 1 => 'One', <ide> public function testSelectOptionGroupEscaping() { <ide> * @return void <ide> */ <ide> public function testSelectWithNullAttributes() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $result = $this->Form->select('Model.field', array('first', 'second'), array('empty' => false)); <ide> $expected = array( <ide> 'select' => array('name' => 'Model[field]', 'id' => 'ModelField'), <ide> public function testNestedSelect() { <ide> * @return void <ide> */ <ide> public function testSelectMultiple() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $options = array('first', 'second', 'third'); <ide> $result = $this->Form->select( <ide> 'Model.multi_field', $options, array('multiple' => true) <ide> public function testCheckboxZeroValue() { <ide> * @return void <ide> */ <ide> public function testSelectMultipleWithDisabledElements() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy'); <ide> $disabled = array(2, 3); <ide> $result = $this->Form->select('Contact.multiple', $options, array('multiple' => 'multiple', 'disabled' => $disabled)); <ide> public function testSelectMultipleWithDisabledElements() { <ide> * @return void <ide> */ <ide> public function testSelectWithDisabledElements() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy'); <ide> $disabled = array(2, 3); <ide> $result = $this->Form->select('Model.field', $options, array('disabled' => $disabled)); <ide> public function testSelectMultipleCheckboxSecurity() { <ide> * @return void <ide> */ <ide> public function testSelectMultipleSecureWithNoOptions() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $this->Form->request->params['_csrfToken'] = 'testkey'; <ide> $this->assertEquals(array(), $this->Form->fields); <ide> <ide> public function testSelectHiddenFieldOmission() { <ide> * @return void <ide> */ <ide> public function testSelectCheckboxMultipleOverrideName() { <del> $this->markTestIncomplete('Need to revisit once models work again.'); <ide> $result = $this->Form->input('category', array( <ide> 'type' => 'select', <ide> 'multiple' => 'checkbox',
1
Python
Python
add gif as known mime type for `make server`
7a8a9b9d93ad0f4a273fea8653f96471a283c656
<ide><path>test/test.py <ide> def prompt(question): <ide> '.svg': 'image/svg+xml', <ide> '.pdf': 'application/pdf', <ide> '.xhtml': 'application/xhtml+xml', <add> '.gif': 'image/gif', <ide> '.ico': 'image/x-icon', <ide> '.log': 'text/plain' <ide> }
1
Python
Python
fix word embedding example
b7a5d4de702b863eaa86d609da5b2c77a8c96240
<ide><path>examples/skipgram_word_embeddings.py <ide> and compute a proximity score between the embeddings (= p(context|word)), <ide> trained with our positive and negative labels. <ide> <del> We then use the weights computed by WordContextProduct to instantiate <del> a simple Embedding, which we use to encode words and demonstrate <del> that the geometry of the embedding space captures certain useful semantic properties. <add> We then use the weights computed by WordContextProduct to encode words <add> and demonstrate that the geometry of the embedding space <add> captures certain useful semantic properties. <ide> <ide> Read more about skip-gram in this particularly gnomic paper by Mikolov et al.: <ide> http://arxiv.org/pdf/1301.3781v3.pdf <ide> train_model = True <ide> save_dir = os.path.expanduser("~/.keras/models") <ide> model_load_fname = "HN_skipgram_model_full_256.pkl" <del>model_save_fname = "HN_skipgram_model_full_256-0.pkl" <add>model_save_fname = "HN_skipgram_model_full_256.pkl" <ide> tokenizer_fname = "HN_tokenizer.pkl" <ide> <ide> data_path = os.path.expanduser("~/")+"HNCommentsAll.1perline.json" <ide> def closest_to_point(point, nb_closest=10): <ide> tups.sort(key=lambda x: x[1], reverse=True) <ide> return [(reverse_word_index.get(t[0]), t[1]) for t in tups[:nb_closest]] <ide> <del>def closest_to_word(word, nb_closest=10): <add>def closest_to_word(w, nb_closest=10): <ide> i = word_index.get(w) <ide> if (not i) or (i<skip_top) or (i>=max_features): <ide> return []
1
Java
Java
restore sleep interval between recovery attempt
bb45fb4538d723ecdc136ceaaba032bcf8cdb42c
<ide><path>spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java <ide> public void run() { <ide> } <ide> catch (Throwable ex) { <ide> clearResources(); <add> if (!this.lastMessageSucceeded) { <add> // We failed more than once in a row or on startup - sleep before <add> // first recovery attempt. <add> sleepBeforeRecoveryAttempt(); <add> } <ide> this.lastMessageSucceeded = false; <ide> boolean alreadyRecovered = false; <ide> synchronized (recoveryMonitor) { <ide> private void clearResources() { <ide> this.session = null; <ide> } <ide> <add> /** <add> * Apply the back off time once. In a regular scenario, the back off is only applied if we <add> * failed to recover with the broker. This additional sleep period avoids a burst retry <add> * scenario when the broker is actually up but something else if failing (i.e. listener <add> * specific). <add> */ <add> private void sleepBeforeRecoveryAttempt() { <add> BackOffExecution execution = DefaultMessageListenerContainer.this.backOff.start(); <add> applyBackOffTime(execution); <add> } <add> <ide> @Override <ide> public boolean isLongLived() { <ide> return (maxMessagesPerTask < 0);
1
Javascript
Javascript
remove redundant logic
a775a767a1d61ef07024cbe9adc9e8f4099d9546
<ide><path>packages/react-reconciler/src/ReactFiberScheduler.js <ide> function computeExpirationForFiber(currentTime: ExpirationTime, fiber: Fiber) { <ide> // This is an interactive update. Keep track of the lowest pending <ide> // interactive expiration time. This allows us to synchronously flush <ide> // all interactive updates when needed. <del> if ( <del> lowestPriorityPendingInteractiveExpirationTime === NoWork || <del> expirationTime > lowestPriorityPendingInteractiveExpirationTime <del> ) { <add> if (expirationTime > lowestPriorityPendingInteractiveExpirationTime) { <ide> lowestPriorityPendingInteractiveExpirationTime = expirationTime; <ide> } <ide> }
1
Ruby
Ruby
remove unused var
bc556a21e2d5722f42dfac810c04d453076e09fb
<ide><path>activerecord/lib/active_record/associations/has_many_through_association.rb <ide> def insert_record(record, force = true, validate = true) <ide> end <ide> <ide> through_association = @owner.send(@reflection.through_reflection.name) <del> through_record = through_association.create!(construct_join_attributes(record)) <add> through_association.create!(construct_join_attributes(record)) <ide> end <ide> <ide> # TODO - add dependent option support
1
Ruby
Ruby
prevent duplicate dependency display
e547438ff43426e31dac3ef070b2feecd8a4621b
<ide><path>Library/Homebrew/cmd/info.rb <ide> def info_formula f <ide> unless f.deps.empty? <ide> ohai "Dependencies" <ide> %w{build required recommended optional}.map do |type| <del> deps = f.deps.send(type) <add> deps = f.deps.send(type).uniq <ide> puts "#{type.capitalize}: #{decorate_dependencies deps}" unless deps.empty? <ide> end <ide> end <ide><path>Library/Homebrew/formula.rb <ide> def to_hash <ide> "installed" => [], <ide> "linked_keg" => (linked_keg.resolved_path.basename.to_s if linked_keg.exist?), <ide> "keg_only" => keg_only?, <del> "dependencies" => deps.map(&:name), <add> "dependencies" => deps.map(&:name).uniq, <ide> "conflicts_with" => conflicts.map(&:name), <ide> "caveats" => caveats <ide> }
2
Javascript
Javascript
add test case for global in harmony modules
bd45bdc6fbb6ae3688a564f8d7c334765fd85442
<ide><path>test/configCases/parsing/harmony-global/index.js <add>require("should"); <add>it("should be able to use global in a harmony module", function() { <add> var x = require("./module1"); <add> (x.default === global).should.be.ok(); <add>}); <ide><path>test/configCases/parsing/harmony-global/module.js <add>export default 1; <ide><path>test/configCases/parsing/harmony-global/module1.js <add>var freeGlobal = typeof global === "object" && global && global.Object === Object && global; <add> <add>export default freeGlobal; <ide><path>test/configCases/parsing/harmony-global/webpack.config.js <add>module.exports = { <add> target: "web", <add> performance: { <add> hints: false <add> } <add>};
4
PHP
PHP
improve _readerror to not use deprecated methods
7e2cb9b630f4fcd0912099f6547f695abbf2b2fd
<ide><path>src/Datasource/EntityTrait.php <ide> protected function _nestedErrors($field) <ide> */ <ide> protected function _readError($object, $path = null) <ide> { <add> if ($path !== null && $object instanceof EntityInterface) { <add> return $object->getError($path); <add> } <ide> if ($object instanceof EntityInterface) { <del> return $object->errors($path); <add> return $object->getErrors(); <ide> } <ide> if (is_array($object)) { <ide> $array = array_map(function ($val) { <ide> if ($val instanceof EntityInterface) { <del> return $val->errors(); <add> return $val->getErrors(); <ide> } <ide> }, $object); <ide>
1
PHP
PHP
remove unnecessary else
6b7dbc7144b6a1e6d5ff5490e8769b071ea0fb23
<ide><path>src/Illuminate/Queue/Console/ListFailedCommand.php <ide> protected function matchJobName($payload) <ide> <ide> if (isset($matches[1])) { <ide> return $matches[1]; <del> } else { <del> return $payload['job'] ?? null; <ide> } <add> <add> return $payload['job'] ?? null; <ide> } <ide> <ide> /**
1
PHP
PHP
add a way to restore 3.x behavior for last=true
8dc0da258714d6b6c46ecaaf416896936a1dc78d
<ide><path>src/Validation/Validator.php <ide> class Validator implements ArrayAccess, IteratorAggregate, Countable <ide> */ <ide> protected $_allowEmptyFlags = []; <ide> <add> /** <add> * Whether to apply last flag to generated rule(s). <add> * <add> * @var bool <add> */ <add> protected $_stopOnFailure = false; <add> <ide> /** <ide> * Constructor <ide> */ <ide> public function __construct() <ide> $this->_providers = self::$_defaultProviders; <ide> } <ide> <add> /** <add> * Whether to apply last flag to generated rule(s). <add> * The first failing one will abort then per rule. <add> * <add> * @param bool $stopOnFailure If to apply last flag. <add> * <add> * @return $this <add> */ <add> public function stopOnFailure(bool $stopOnFailure = true) <add> { <add> $this->_stopOnFailure = $stopOnFailure; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Validates and returns an array of failed fields and their error messages. <ide> * <ide> public function add(string $field, $name, $rule = []) <ide> <ide> foreach ($rules as $name => $rule) { <ide> if (is_array($rule)) { <del> $rule += ['rule' => $name]; <add> $rule += [ <add> 'rule' => $name, <add> 'last' => $this->_stopOnFailure, <add> ]; <ide> } <ide> if (!is_string($name)) { <ide> /** @psalm-suppress PossiblyUndefinedMethod */ <ide> public function __debugInfo(): array <ide> '_allowEmptyMessages' => $this->_allowEmptyMessages, <ide> '_allowEmptyFlags' => $this->_allowEmptyFlags, <ide> '_useI18n' => $this->_useI18n, <add> '_stopOnFailure' => $this->_stopOnFailure, <ide> '_providers' => array_keys($this->_providers), <ide> '_fields' => $fields, <ide> ]; <ide><path>tests/TestCase/Validation/ValidatorTest.php <ide> public function testUsingClosureAsRule() <ide> $this->assertEquals($expected, $validator->validate(['name' => 'foo'])); <ide> } <ide> <add> /** <add> * Tests that setting last globally will stop validating the rest of the rules <add> * <add> * @return void <add> */ <add> public function testErrorsWithLastRuleGlobal(): void <add> { <add> $validator = new Validator(); <add> $validator->stopOnFailure() <add> ->notBlank('email', 'Fill something in!') <add> ->email('email', false, 'Y u no write email?'); <add> $errors = $validator->validate(['email' => '']); <add> $expected = [ <add> 'email' => [ <add> 'notBlank' => 'Fill something in!', <add> ], <add> ]; <add> <add> $this->assertEquals($expected, $errors); <add> } <add> <ide> /** <ide> * Tests that setting last to a rule will stop validating the rest of the rules <ide> * <ide> public function testDebugInfo() <ide> 'published' => Validator::EMPTY_STRING, <ide> ], <ide> '_useI18n' => true, <add> '_stopOnFailure' => false, <ide> ]; <ide> $this->assertEquals($expected, $result); <ide> }
2
Javascript
Javascript
fix more headers tables
1c78d8fdb40216ab4cefe2a0b857f9b9363d35ba
<ide><path>fonts.js <ide> var Font = (function () { <ide> <ide> // Wrap the CFF data inside an OTF font file <ide> data = this.convert(name, cff, properties); <add> writeToFile(data, "/tmp/file." + fontName + "-" + fontCount + ".otf"); <ide> break; <ide> <ide> case "TrueType": <ide> var Font = (function () { <ide> <ide> for (var i = 1; i < charset.length; i++) { <ide> var code = GlyphsUnicode[charset[i]]; <del> if (code < firstCharIndex || !firstCharIndex) <add> if (firstCharIndex > code || !firstCharIndex) <ide> firstCharIndex = code; <del> if (code > lastCharIndex) <add> if (lastCharIndex < code) <ide> lastCharIndex = code; <ide> <ide> var position = getUnicodeRangeFor(code); <ide> var Font = (function () { <ide> "\x02\x24" + // xAvgCharWidth <ide> "\x01\xF4" + // usWeightClass <ide> "\x00\x05" + // usWidthClass <del> "\x00\x00" + // fstype <add> "\x00\x02" + // fstype <ide> "\x02\x8A" + // ySubscriptXSize <ide> "\x02\xBB" + // ySubscriptYSize <ide> "\x00\x00" + // ySubscriptXOffset <ide> var Font = (function () { <ide> "\x00\x31" + // yStrikeOutSize <ide> "\x01\x02" + // yStrikeOutPosition <ide> "\x00\x00" + // sFamilyClass <del> "\x02\x00\x06\x03\x00\x00\x00\x00\x00\x00" + // Panose <add> "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + <add> "\x00\x00\x00\x00\x00\x00" + // Panose <ide> string32(ulUnicodeRange1) + // ulUnicodeRange1 (Bits 0-31) <ide> string32(ulUnicodeRange2) + // ulUnicodeRange2 (Bits 32-63) <ide> string32(ulUnicodeRange3) + // ulUnicodeRange3 (Bits 64-95) <ide> string32(ulUnicodeRange4) + // ulUnicodeRange4 (Bits 96-127) <ide> "\x2A\x32\x31\x2A" + // achVendID <del> "\x00\x00" + // fsSelection <add> string16(properties.italicAngle ? 1 : 0) + // fsSelection <ide> string16(firstCharIndex || properties.firstChar) + // usFirstCharIndex <ide> string16(lastCharIndex || properties.lastChar) + // usLastCharIndex <del> "\x00\x20" + // sTypoAscender <del> "\x00\x00" + // sTypeDescender <del> "\x00\x00" + // sTypoLineGap <add> string16(properties.ascent) + // sTypoAscender <add> string16(properties.descent) + // sTypoDescender <add> "\x00\x64" + // sTypoLineGap (7%-10% of the unitsPerEM value) <ide> string16(properties.ascent) + // usWinAscent <del> string16(properties.descent) + // usWinDescent <add> string16(-properties.descent) + // usWinDescent <ide> "\x00\x00\x00\x00" + // ulCodePageRange1 (Bits 0-31) <ide> "\x00\x00\x00\x00" + // ulCodePageRange2 (Bits 32-63) <ide> string16(properties.xHeight) + // sxHeight <ide> string16(properties.capHeight) + // sCapHeight <ide> string16(0) + // usDefaultChar <ide> string16(firstCharIndex || properties.firstChar) + // usBreakChar <del> "\x00\x00"; // usMaxContext <add> "\x00\x03"; // usMaxContext <ide> }; <ide> <ide> function createPostTable(properties) { <del> TODO("Fill with real values from the font dict"); <del> <del> return "\x00\x03\x00\x00" + // Version number <del> string32(properties.italicAngle) + // italicAngle <del> "\x00\x00" + // underlinePosition <del> "\x00\x00" + // underlineThickness <del> "\x00\x00\x00\x00" + // isFixedPitch <del> "\x00\x00\x00\x00" + // minMemType42 <del> "\x00\x00\x00\x00" + // maxMemType42 <del> "\x00\x00\x00\x00" + // minMemType1 <del> "\x00\x00\x00\x00"; // maxMemType1 <add> var angle = Math.floor(properties.italicAngle * (Math.pow(2, 16))); <add> return "\x00\x03\x00\x00" + // Version number <add> string32(angle) + // italicAngle <add> "\x00\x00" + // underlinePosition <add> "\x00\x00" + // underlineThickness <add> string32(properties.fixedPitch) + // isFixedPitch <add> "\x00\x00\x00\x00" + // minMemType42 <add> "\x00\x00\x00\x00" + // maxMemType42 <add> "\x00\x00\x00\x00" + // minMemType1 <add> "\x00\x00\x00\x00"; // maxMemType1 <ide> }; <ide> <ide> constructor.prototype = { <ide> var Font = (function () { <ide> nameTable += strings.join("") + stringsUnicode.join(""); <ide> return nameTable; <ide> } <add> <add> function isFixedPitch(glyphs) { <add> for (var i = 0; i < glyphs.length - 1; i++) { <add> if (glyphs[i] != glyphs[i+1]) <add> return false; <add> } <add> return true; <add> }; <ide> <ide> // Required Tables <ide> var CFF = <ide> var Font = (function () { <ide> createTableEntry(otf, offsets, "CFF ", CFF); <ide> <ide> /** OS/2 */ <add> var charstrings = font.charstrings; <add> properties.fixedPitch = isFixedPitch(charstrings); <ide> OS2 = stringToArray(createOS2Table(properties)); <ide> createTableEntry(otf, offsets, "OS/2", OS2); <ide> <ide> /** CMAP */ <del> var charstrings = font.charstrings; <ide> cmap = createCMapTable(charstrings.slice()); <ide> createTableEntry(otf, offsets, "cmap", cmap); <ide> <ide> var Font = (function () { <ide> "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + // creation date <ide> "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + // modifification date <ide> "\x00\x00" + // xMin <del> "\x00\x00" + // yMin <del> "\x00\x00" + // xMax <del> "\x00\x00" + // yMax <del> string16(properties.italicAngle ? 1 : 0) + // macStyle <add> string16(properties.descent) + // yMin <add> "\x0F\xFF" + // xMax <add> string16(properties.ascent) + // yMax <add> string16(properties.italicAngle ? 2 : 0) + // macStyle <ide> "\x00\x11" + // lowestRecPPEM <ide> "\x00\x00" + // fontDirectionHint <ide> "\x00\x00" + // indexToLocFormat <ide> var Font = (function () { <ide> string16(properties.ascent) + // Typographic Ascent <ide> string16(properties.descent) + // Typographic Descent <ide> "\x00\x00" + // Line Gap <del> "\xFF\xFF" + // advanceWidthMax <add> "\x00\xFF" + // advanceWidthMax <ide> "\x00\x00" + // minLeftSidebearing <ide> "\x00\x00" + // minRightSidebearing <ide> "\x00\x00" + // xMaxExtent <del> "\x00\x00" + // caretSlopeRise <del> string16(properties.italicAngle) + // caretSlopeRun <add> string16(properties.capHeight) + // caretSlopeRise <add> string16(Math.tan(properties.italicAngle) * properties.xHeight) + // caretSlopeRun <ide> "\x00\x00" + // caretOffset <ide> "\x00\x00" + // -reserved- <ide> "\x00\x00" + // -reserved- <ide> var Font = (function () { <ide> * have to touch the 'hmtx' table <ide> */ <ide> hmtx = "\x00\x00\x00\x00"; // Fake .notdef <del> var width = 0, lsb = 0; <ide> for (var i = 0; i < charstrings.length; i++) { <del> var charstring = charstrings[i]; <del> hmtx += string16(charstring.width) + string16(0); <add> hmtx += string16(charstrings[i].width) + string16(0); <ide> } <ide> hmtx = stringToArray(hmtx); <ide> createTableEntry(otf, offsets, "hmtx", hmtx);
1
Javascript
Javascript
fix path.relative unc path result
c1e47ed8c883afba3c240e89d763a28a57ec1373
<ide><path>lib/path.js <ide> const win32 = { <ide> <ide> // We found a mismatch before the first common path separator was seen, so <ide> // return the original `to`. <del> // TODO: do this just for device roots (and not UNC paths)? <ide> if (i !== length && lastCommonSep === -1) { <del> if (toStart > 0) <del> return toOrig.slice(toStart); <del> else <del> return toOrig; <add> return toOrig; <ide> } <ide> <ide> var out = ''; <ide><path>test/parallel/test-path.js <ide> const relativeTests = [ <ide> ['C:\\baz-quux', 'C:\\baz', '..\\baz'], <ide> ['C:\\baz', 'C:\\baz-quux', '..\\baz-quux'], <ide> ['\\\\foo\\baz-quux', '\\\\foo\\baz', '..\\baz'], <del> ['\\\\foo\\baz', '\\\\foo\\baz-quux', '..\\baz-quux'] <add> ['\\\\foo\\baz', '\\\\foo\\baz-quux', '..\\baz-quux'], <add> ['C:\\baz', '\\\\foo\\bar\\baz', '\\\\foo\\bar\\baz'], <add> ['\\\\foo\\bar\\baz', 'C:\\baz', 'C:\\baz'] <ide> ] <ide> ], <ide> [ path.posix.relative,
2
Python
Python
improve unit test coverage
908d86655831e153bb11aa8ce2c9bdaf821b1154
<ide><path>keras/datasets/imdb.py <ide> def load_data(path="imdb.pkl", nb_words=None, skip_top=0, <ide> new_labels.append(y) <ide> X = new_X <ide> labels = new_labels <del> <add> if not X: <add> raise Exception('After filtering for sequences shorter than maxlen=' + <add> str(maxlen) + ', no sequence was kept. ' <add> 'Increase maxlen.') <ide> if not nb_words: <ide> nb_words = max([max(x) for x in X]) <ide> <ide><path>tests/keras/datasets/test_datasets.py <ide> def test_cifar(): <ide> <ide> def test_reuters(): <ide> (X_train, y_train), (X_test, y_test) = reuters.load_data() <add> (X_train, y_train), (X_test, y_test) = reuters.load_data(maxlen=10) <ide> <ide> <ide> def test_mnist(): <ide> def test_mnist(): <ide> <ide> def test_imdb(): <ide> (X_train, y_train), (X_test, y_test) = imdb.load_data() <add> (X_train, y_train), (X_test, y_test) = imdb.load_data(maxlen=40) <ide> <ide> <ide> if __name__ == '__main__': <ide><path>tests/keras/layers/test_core.py <ide> def _runner(layer): <ide> <ide> if __name__ == '__main__': <ide> pytest.main([__file__]) <del> <ide><path>tests/keras/layers/test_noise.py <add>import pytest <add>import numpy as np <add>from keras import backend as K <add>from keras.layers import core <add>from keras.layers import noise <add> <add>input_shape = (10, 10) <add>batch_input_shape = (10, 10, 10) <add> <add> <add>def test_GaussianNoise(): <add> layer = noise.GaussianNoise(sigma=1., input_shape=input_shape) <add> _runner(layer) <add> <add> <add>def test_GaussianDropout(): <add> layer = noise.GaussianDropout(p=0.2, input_shape=input_shape) <add> _runner(layer) <add> <add> <add>def _runner(layer): <add> assert isinstance(layer, core.Layer) <add> layer.build() <add> conf = layer.get_config() <add> assert (type(conf) == dict) <add> <add> param = layer.get_params() <add> # Typically a list or a tuple, but may be any iterable <add> assert hasattr(param, '__iter__') <add> layer.input = K.variable(np.random.random(batch_input_shape)) <add> output = layer.get_output(train=False) <add> output_np = K.eval(output) <add> assert output_np.shape == batch_input_shape <add> <add> output = layer.get_output(train=True) <add> output_np = K.eval(output) <add> assert output_np.shape == batch_input_shape <add> <add> <add>if __name__ == '__main__': <add> pytest.main([__file__])
4
Python
Python
fix bart tests
9a0399e18d094e17a21521407a781f2f55c394b0
<ide><path>tests/test_modeling_bart.py <ide> BartForSequenceClassification, <ide> BartModel, <ide> BartTokenizer, <del> BartTokenizerFast, <ide> pipeline, <ide> ) <ide> from transformers.models.bart.modeling_bart import BartDecoder, BartEncoder, shift_tokens_right <ide> class BartModelIntegrationTests(unittest.TestCase): <ide> def default_tokenizer(self): <ide> return BartTokenizer.from_pretrained("facebook/bart-large") <ide> <del> @cached_property <del> def default_tokenizer_fast(self): <del> return BartTokenizerFast.from_pretrained("facebook/bart-large") <del> <ide> @slow <ide> def test_inference_no_head(self): <ide> model = BartModel.from_pretrained("facebook/bart-large").to(torch_device) <ide> def test_base_mask_filling(self): <ide> pbase = pipeline(task="fill-mask", model="facebook/bart-base") <ide> src_text = [" I went to the <mask>."] <ide> results = [x["token_str"] for x in pbase(src_text)] <del> assert "Ġbathroom" in results <add> assert " bathroom" in results <ide> <ide> @slow <ide> def test_large_mask_filling(self): <ide> plarge = pipeline(task="fill-mask", model="facebook/bart-large") <ide> src_text = [" I went to the <mask>."] <ide> results = [x["token_str"] for x in plarge(src_text)] <del> expected_results = ["Ġbathroom", "Ġgym", "Ġwrong", "Ġmovies", "Ġhospital"] <add> expected_results = [" bathroom", " gym", " wrong", " movies", " hospital"] <ide> self.assertListEqual(results, expected_results) <ide> <ide> @slow
1
Javascript
Javascript
remove trailing comma
c3309ee9b9f52aa9a4d9fdad67dda81fc9bfe0bd
<ide><path>src/main-process/atom-window.js <ide> class AtomWindow extends EventEmitter { <ide> <ide> Object.defineProperty(this.browserWindow, 'loadSettingsJSON', { <ide> get: () => JSON.stringify(Object.assign({ <del> userSettings: this.atomApplication.configFile.get(), <add> userSettings: this.atomApplication.configFile.get() <ide> }, this.loadSettings)), <ide> configurable: true <ide> })
1
Python
Python
add file mistakenly left out of r12986. refs
a288f97a2a99ee238e984cf155643d4afc25a46b
<ide><path>tests/regressiontests/templates/templatetags/broken_tag.py <add>from django import Xtemplate
1
PHP
PHP
apply fixes from styleci
f16eb62f70d25e1a8ed85e35d486615d8d245a19
<ide><path>src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php <ide> public function getOriginal($key = null, $default = null) <ide> <ide> /** <ide> * Get a subset of the model's attributes. <del> * <add> * <ide> * @param array|mixed $attributes <ide> * @return array <ide> */
1
Python
Python
use importlib instead of __import__
66897eb475c60748bd93a5f673aa1508fecdc501
<ide><path>celery/backends/__init__.py <ide> import sys <add>import importlib <ide> <ide> from billiard.utils.functional import curry <ide> from carrot.utils import rpartition <ide> def resolve_backend(backend): <ide> <ide> def _get_backend_cls(backend): <ide> backend_module_name, backend_cls_name = resolve_backend(backend) <del> __import__(backend_module_name) <del> backend_module = sys.modules[backend_module_name] <add> backend_module = importlib.import_module(backend_module_name) <ide> return getattr(backend_module, backend_cls_name) <ide> <ide> <ide> def get_backend_cls(backend): <del> """Get backend class by name. <del> <del> If the name does not include "``.``" (is not fully qualified), <del> ``"celery.backends."`` will be prepended to the name. e.g. <del> ``"database"`` becomes ``"celery.backends.database"``. <del> <del> """ <add> """Get backend class by name/alias""" <ide> if backend not in _backend_cache: <ide> _backend_cache[backend] = _get_backend_cls(backend) <ide> return _backend_cache[backend]
1
Python
Python
improve printing of arrays with multi-line reprs
1511c1f267c35b8e619b3b1c913f336ae7505910
<ide><path>numpy/core/arrayprint.py <ide> def array2string(a, max_line_width=None, precision=None, <ide> def _extendLine(s, line, word, line_width, next_line_prefix, legacy): <ide> needs_wrap = len(line) + len(word) > line_width <ide> if legacy != '1.13': <del> s# don't wrap lines if it won't help <add> # don't wrap lines if it won't help <ide> if len(line) <= len(next_line_prefix): <ide> needs_wrap = False <ide> <ide> def _extendLine(s, line, word, line_width, next_line_prefix, legacy): <ide> return s, line <ide> <ide> <add>def _extendLine_pretty(s, line, word, line_width, next_line_prefix, legacy): <add> """ <add> Extends line with nicely formatted (possibly multi-line) string ``word``. <add> """ <add> if legacy == '1.13': <add> return _extendLine(s, line, word, line_width, next_line_prefix, legacy) <add> <add> words = word.splitlines() <add> line_length = len(line) <add> s, line = _extendLine( <add> s, line, words[0], line_width, next_line_prefix, legacy) <add> for word in words[1::]: <add> s += line.rstrip() + '\n' <add> if line_length + len(word) > line_width \ <add> and line_length > len(next_line_prefix): <add> line = next_line_prefix + word <add> else: <add> line = line_length*' ' + word <add> <add> return s, line <add> <ide> def _formatArray(a, format_function, line_width, next_line_prefix, <ide> separator, edge_items, summary_insert, legacy): <ide> """formatArray is designed for two modes of operation: <ide> def recurser(index, hanging_indent, curr_width): <ide> line = hanging_indent <ide> for i in range(leading_items): <ide> word = recurser(index + (i,), next_hanging_indent, next_width) <del> s, line = _extendLine( <add> s, line = _extendLine_pretty( <ide> s, line, word, elem_width, hanging_indent, legacy) <ide> line += separator <ide> <ide> def recurser(index, hanging_indent, curr_width): <ide> <ide> for i in range(trailing_items, 1, -1): <ide> word = recurser(index + (-i,), next_hanging_indent, next_width) <del> s, line = _extendLine( <add> s, line = _extendLine_pretty( <ide> s, line, word, elem_width, hanging_indent, legacy) <ide> line += separator <ide> <ide> if legacy == '1.13': <ide> # width of the separator is not considered on 1.13 <ide> elem_width = curr_width <ide> word = recurser(index + (-1,), next_hanging_indent, next_width) <del> s, line = _extendLine( <add> s, line = _extendLine_pretty( <ide> s, line, word, elem_width, hanging_indent, legacy) <ide> <ide> s += line <ide> def recurser(index, hanging_indent, curr_width): <ide> # performance and PyPy friendliness, we break the cycle: <ide> recurser = None <ide> <add> <add> <ide> def _none_or_positive_arg(x, name): <ide> if x is None: <ide> return -1 <ide><path>numpy/core/tests/test_arrayprint.py <ide> def test_wide_element(self): <ide> "[ 'xxxxx']" <ide> ) <ide> <add> def test_multiline_repr(self): <add> class MultiLine: <add> def __repr__(self): <add> return "Line 1\nLine 2" <add> <add> a = np.array([[None, MultiLine()], [MultiLine(), None]]) <add> <add> assert_equal( <add> np.array2string(a), <add> '[[None Line 1\n' <add> ' Line 2]\n' <add> ' [Line 1\n' <add> ' Line 2 None]]' <add> ) <add> assert_equal( <add> np.array2string(a, max_line_width=5), <add> '[[None\n' <add> ' Line 1\n' <add> ' Line 2]\n' <add> ' [Line 1\n' <add> ' Line 2\n' <add> ' None]]' <add> ) <add> assert_equal( <add> np.array_repr(a), <add> 'array([[None, Line 1\n' <add> ' Line 2],\n' <add> ' [Line 1\n' <add> ' Line 2, None]], dtype=object)' <add> ) <add> <ide> @given(hynp.from_dtype(np.dtype("U"))) <ide> def test_any_text(self, text): <ide> # This test checks that, given any value that can be represented in an
2
Python
Python
fix mypy errors in google cloud provider
a22d5bd07696d9cafe10a3e246ea9f3a381585ee
<ide><path>airflow/providers/google/cloud/example_dags/example_cloud_build.py <ide> from pathlib import Path <ide> from typing import Any, Dict <ide> <add>import yaml <ide> from future.backports.urllib.parse import urlparse <ide> <ide> from airflow import models <ide> create_build_from_file = CloudBuildCreateBuildOperator( <ide> task_id="create_build_from_file", <ide> project_id=GCP_PROJECT_ID, <del> build=str(CURRENT_FOLDER.joinpath('example_cloud_build.yaml')), <add> build=yaml.safe_load((Path(CURRENT_FOLDER) / 'example_cloud_build.yaml').read_text()), <ide> params={'name': 'Airflow'}, <ide> ) <ide> # [END howto_operator_gcp_create_build_from_yaml_body] <ide><path>airflow/providers/google/cloud/example_dags/example_tasks.py <ide> from google.api_core.retry import Retry <ide> from google.cloud.tasks_v2.types import Queue <ide> from google.protobuf import timestamp_pb2 <add>from google.protobuf.field_mask_pb2 import FieldMask <ide> <ide> from airflow import models <ide> from airflow.models.baseoperator import chain <ide> task_queue=Queue(stackdriver_logging_config=dict(sampling_ratio=1)), <ide> location=LOCATION, <ide> queue_name=QUEUE_ID, <del> update_mask={"paths": ["stackdriver_logging_config.sampling_ratio"]}, <add> update_mask=FieldMask(paths=["stackdriver_logging_config.sampling_ratio"]), <ide> task_id="update_queue", <ide> ) <ide> # [END update_queue] <ide><path>airflow/providers/google/cloud/example_dags/example_workflows.py <ide> import os <ide> from datetime import datetime <ide> <add>from google.protobuf.field_mask_pb2 import FieldMask <add> <ide> from airflow import DAG <ide> from airflow.providers.google.cloud.operators.workflows import ( <ide> WorkflowsCancelExecutionOperator, <ide> location=LOCATION, <ide> project_id=PROJECT_ID, <ide> workflow_id=WORKFLOW_ID, <del> update_mask={"paths": ["name", "description"]}, <add> update_mask=FieldMask(paths=["name", "description"]), <ide> ) <ide> # [END how_to_update_workflow] <ide> <ide><path>airflow/providers/google/cloud/hooks/datastore.py <ide> def delete_operation(self, name: str) -> dict: <ide> <ide> return resp <ide> <del> def poll_operation_until_done(self, name: str, polling_interval_in_seconds: int) -> Dict: <add> def poll_operation_until_done(self, name: str, polling_interval_in_seconds: float) -> Dict: <ide> """ <ide> Poll backup operation state until it's completed. <ide> <ide> :param name: the name of the operation resource <ide> :type name: str <ide> :param polling_interval_in_seconds: The number of seconds to wait before calling another request. <del> :type polling_interval_in_seconds: int <add> :type polling_interval_in_seconds: float <ide> :return: a resource operation instance. <ide> :rtype: dict <ide> """ <ide> while True: <del> result = self.get_operation(name) # type: Dict <add> result: Dict = self.get_operation(name) <ide> <del> state = result['metadata']['common']['state'] # type: str <add> state: str = result['metadata']['common']['state'] <ide> if state == 'PROCESSING': <ide> self.log.info( <ide> 'Operation is processing. Re-polling state in %s seconds', polling_interval_in_seconds <ide><path>airflow/providers/google/cloud/hooks/dlp.py <ide> def create_inspect_template( <ide> self, <ide> organization_id: Optional[str] = None, <ide> project_id: Optional[str] = None, <del> inspect_template: Optional[Union[dict, InspectTemplate]] = None, <add> inspect_template: Optional[InspectTemplate] = None, <ide> template_id: Optional[str] = None, <ide> retry: Optional[Retry] = None, <ide> timeout: Optional[float] = None, <ide><path>airflow/providers/google/cloud/hooks/gcs.py <ide> from io import BytesIO <ide> from os import path <ide> from tempfile import NamedTemporaryFile <del>from typing import Callable, List, Optional, Sequence, Set, Tuple, TypeVar, Union, cast <add>from typing import Callable, List, Optional, Sequence, Set, Tuple, TypeVar, Union, cast, overload <ide> from urllib.parse import urlparse <ide> <ide> from google.api_core.exceptions import NotFound <ide> def rewrite( <ide> destination_bucket.name, # type: ignore[attr-defined] <ide> ) <ide> <add> @overload <add> def download( <add> self, <add> bucket_name: str, <add> object_name: str, <add> filename: None = None, <add> chunk_size: Optional[int] = None, <add> timeout: Optional[int] = DEFAULT_TIMEOUT, <add> num_max_attempts: Optional[int] = 1, <add> ) -> bytes: <add> ... <add> <add> @overload <add> def download( <add> self, <add> bucket_name: str, <add> object_name: str, <add> filename: str, <add> chunk_size: Optional[int] = None, <add> timeout: Optional[int] = DEFAULT_TIMEOUT, <add> num_max_attempts: Optional[int] = 1, <add> ) -> str: <add> ... <add> <ide> def download( <ide> self, <ide> bucket_name: str, <ide> def download_as_byte_array( <ide> :type num_max_attempts: int <ide> """ <ide> # We do not pass filename, so will never receive string as response <del> return cast( <del> bytes, <del> self.download( <del> bucket_name=bucket_name, <del> object_name=object_name, <del> chunk_size=chunk_size, <del> timeout=timeout, <del> num_max_attempts=num_max_attempts, <del> ), <add> return self.download( <add> bucket_name=bucket_name, <add> object_name=object_name, <add> chunk_size=chunk_size, <add> timeout=timeout, <add> num_max_attempts=num_max_attempts, <ide> ) <ide> <ide> @_fallback_object_url_to_object_name_and_bucket_name() <ide><path>airflow/providers/google/cloud/hooks/stackdriver.py <ide> def list_alert_policies( <ide> order_by: Optional[str] = None, <ide> page_size: Optional[int] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> Any: <ide> """ <ide> def _toggle_policy_status( <ide> project_id: str = PROVIDE_PROJECT_ID, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ): <ide> client = self._get_policy_client() <ide> def enable_alert_policies( <ide> project_id: str = PROVIDE_PROJECT_ID, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide> def disable_alert_policies( <ide> project_id: str = PROVIDE_PROJECT_ID, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide> def upsert_alert( <ide> alerts: str, <ide> project_id: str = PROVIDE_PROJECT_ID, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide> def delete_alert_policy( <ide> self, <ide> name: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide> def list_notification_channels( <ide> order_by: Optional[str] = None, <ide> page_size: Optional[int] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[str] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> Any: <ide> """ <ide> def _toggle_channel_status( <ide> project_id: str = PROVIDE_PROJECT_ID, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[str] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> client = self._get_channel_client() <ide> def enable_notification_channels( <ide> project_id: str = PROVIDE_PROJECT_ID, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[str] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide> def disable_notification_channels( <ide> project_id: str, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[str] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide> def upsert_channel( <ide> channels: str, <ide> project_id: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> dict: <ide> """ <ide> def delete_notification_channel( <ide> self, <ide> name: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[str] = DEFAULT, <add> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> ) -> None: <ide> """ <ide><path>airflow/providers/google/cloud/operators/bigquery.py <ide> import uuid <ide> import warnings <ide> from datetime import datetime <del>from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Set, SupportsAbs, Union, cast <add>from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Set, SupportsAbs, Union <ide> <ide> import attr <ide> from google.api_core.exceptions import Conflict <ide> def __init__( <ide> sql: Union[str, Iterable], <ide> destination_dataset_table: Optional[str] = None, <ide> write_disposition: str = 'WRITE_EMPTY', <del> allow_large_results: Optional[bool] = False, <add> allow_large_results: bool = False, <ide> flatten_results: Optional[bool] = None, <ide> gcp_conn_id: str = 'google_cloud_default', <ide> bigquery_conn_id: Optional[str] = None, <ide> def execute(self, context: 'Context'): <ide> impersonation_chain=self.impersonation_chain, <ide> ) <ide> if isinstance(self.sql, str): <del> job_id = self.hook.run_query( <add> job_id: Union[str, List[str]] = self.hook.run_query( <ide> sql=self.sql, <ide> destination_dataset_table=self.destination_dataset_table, <ide> write_disposition=self.write_disposition, <ide> def execute(self, context: 'Context') -> None: <ide> delegate_to=self.delegate_to, <ide> impersonation_chain=self.impersonation_chain, <ide> ) <del> schema_fields_bytes_or_string = gcs_hook.download(self.bucket, self.schema_object) <del> if hasattr(schema_fields_bytes_or_string, 'decode'): <del> schema_fields_bytes_or_string = cast(bytes, schema_fields_bytes_or_string).decode("utf-8") <del> schema_fields = json.loads(schema_fields_bytes_or_string) <add> schema_fields = json.loads(gcs_hook.download(self.bucket, self.schema_object).decode("utf-8")) <ide> else: <ide> schema_fields = self.schema_fields <ide> <ide> def __init__( <ide> self, <ide> *, <ide> schema_fields_updates: List[Dict[str, Any]], <del> include_policy_tags: Optional[bool] = False, <del> dataset_id: Optional[str] = None, <del> table_id: Optional[str] = None, <add> dataset_id: str, <add> table_id: str, <add> include_policy_tags: bool = False, <ide> project_id: Optional[str] = None, <ide> gcp_conn_id: str = 'google_cloud_default', <ide> delegate_to: Optional[str] = None, <ide><path>airflow/providers/google/cloud/operators/cloud_build.py <ide> class CloudBuildCreateBuildOperator(BaseOperator): <ide> def __init__( <ide> self, <ide> *, <del> build: Optional[Union[Dict, Build, str]] = None, <add> build: Optional[Union[Dict, Build]] = None, <ide> body: Optional[Dict] = None, <ide> project_id: Optional[str] = None, <ide> wait: bool = True, <ide> def __init__( <ide> **kwargs, <ide> ) -> None: <ide> super().__init__(**kwargs) <del> self.build = build <del> # Not template fields to keep original value <del> self.build_raw = build <del> self.body = body <ide> self.project_id = project_id <ide> self.wait = wait <ide> self.retry = retry <ide> self.timeout = timeout <ide> self.metadata = metadata <ide> self.gcp_conn_id = gcp_conn_id <ide> self.impersonation_chain = impersonation_chain <add> self.body = body <ide> <del> if self.body and self.build: <del> raise AirflowException("Either build or body should be passed.") <del> <del> if self.body: <add> if body and build: <add> raise AirflowException("You should not pass both build or body parameters. Both are set.") <add> if body is not None: <ide> warnings.warn( <ide> "The body parameter has been deprecated. You should pass body using the build parameter.", <ide> DeprecationWarning, <ide> stacklevel=4, <ide> ) <del> self.build = self.build_raw = self.body <add> actual_build = body <add> else: <add> if build is None: <add> raise AirflowException("You should pass one of the build or body parameters. Both are None") <add> actual_build = build <add> <add> self.build = actual_build <add> # Not template fields to keep original value <add> self.build_raw = actual_build <ide> <ide> def prepare_template(self) -> None: <ide> # if no file is specified, skip <ide><path>airflow/providers/google/cloud/operators/cloud_sql.py <ide> <ide> from airflow.exceptions import AirflowException <ide> from airflow.hooks.base import BaseHook <del>from airflow.models import BaseOperator <add>from airflow.models import BaseOperator, Connection <ide> from airflow.providers.google.cloud.hooks.cloud_sql import CloudSQLDatabaseHook, CloudSQLHook <ide> from airflow.providers.google.cloud.utils.field_validator import GcpBodyFieldValidator <ide> from airflow.providers.mysql.hooks.mysql import MySqlHook <ide> def __init__( <ide> self.gcp_cloudsql_conn_id = gcp_cloudsql_conn_id <ide> self.autocommit = autocommit <ide> self.parameters = parameters <del> self.gcp_connection = None <add> self.gcp_connection: Optional[Connection] = None <ide> <ide> def _execute_query( <ide> self, hook: CloudSQLDatabaseHook, database_hook: Union[PostgresHook, MySqlHook] <ide><path>airflow/providers/google/cloud/operators/dataflow.py <ide> def __init__( <ide> poll_sleep: int = 10, <ide> job_class: Optional[str] = None, <ide> check_if_running: CheckJobRunning = CheckJobRunning.WaitForRun, <del> multiple_jobs: Optional[bool] = None, <add> multiple_jobs: bool = False, <ide> cancel_timeout: Optional[int] = 10 * 60, <ide> wait_until_finished: Optional[bool] = None, <ide> **kwargs, <ide><path>airflow/providers/google/cloud/operators/dlp.py <ide> which allow you to perform basic operations using <ide> Cloud DLP. <ide> """ <del>from typing import TYPE_CHECKING, Dict, Optional, Sequence, Tuple, Union <add>from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, Union <ide> <ide> from google.api_core.exceptions import AlreadyExists, InvalidArgument, NotFound <ide> from google.api_core.retry import Retry <ide> def execute(self, context: 'Context'): <ide> metadata=self.metadata, <ide> ) <ide> except AlreadyExists: <add> if self.template_id is None: <add> raise RuntimeError("The template_id should be set here!") <ide> template = hook.get_deidentify_template( <ide> organization_id=self.organization_id, <ide> project_id=self.project_id, <ide> def execute(self, context: 'Context'): <ide> wait_until_finished=self.wait_until_finished, <ide> ) <ide> except AlreadyExists: <add> if self.job_id is None: <add> raise RuntimeError("The job_id must be set here!") <ide> job = hook.get_dlp_job( <ide> project_id=self.project_id, <ide> dlp_job_id=self.job_id, <ide> def __init__( <ide> organization_id: Optional[str] = None, <ide> project_id: Optional[str] = None, <ide> inspect_template: Optional[InspectTemplate] = None, <del> template_id: Optional[Union[Dict, InspectTemplate]] = None, <add> template_id: Optional[str] = None, <ide> retry: Optional[Retry] = None, <ide> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide> def execute(self, context: 'Context'): <ide> metadata=self.metadata, <ide> ) <ide> except AlreadyExists: <add> if self.template_id is None: <add> raise RuntimeError("The template_id should be set here!") <ide> template = hook.get_inspect_template( <ide> organization_id=self.organization_id, <ide> project_id=self.project_id, <ide> def execute(self, context: 'Context'): <ide> except InvalidArgument as e: <ide> if "already in use" not in e.message: <ide> raise <add> if self.trigger_id is None: <add> raise RuntimeError("The trigger_id should be set here!") <ide> trigger = hook.get_job_trigger( <ide> project_id=self.project_id, <ide> job_trigger_id=self.trigger_id, <ide> def execute(self, context: 'Context'): <ide> except InvalidArgument as e: <ide> if "already exists" not in e.message: <ide> raise <add> if self.stored_info_type_id is None: <add> raise RuntimeError("The stored_info_type_id should be set here!") <ide> info = hook.get_stored_info_type( <ide> organization_id=self.organization_id, <ide> project_id=self.project_id, <ide> def execute(self, context: 'Context'): <ide> timeout=self.timeout, <ide> metadata=self.metadata, <ide> ) <del> return MessageToDict(template) <add> # the MessageToDict does not have the right type defined as possible to pass in constructor <add> return MessageToDict(template) # type: ignore[arg-type] <ide> <ide> <ide> class CloudDLPListDLPJobsOperator(BaseOperator): <ide> def execute(self, context: 'Context'): <ide> timeout=self.timeout, <ide> metadata=self.metadata, <ide> ) <del> return MessageToDict(job) <add> # the MessageToDict does not have the right type defined as possible to pass in constructor <add> return MessageToDict(job) # type: ignore[arg-type] <ide> <ide> <ide> class CloudDLPListInfoTypesOperator(BaseOperator): <ide> def __init__( <ide> *, <ide> project_id: Optional[str] = None, <ide> inspect_config: Optional[Union[Dict, InspectConfig]] = None, <del> image_redaction_configs: Optional[Union[Dict, RedactImageRequest.ImageRedactionConfig]] = None, <add> image_redaction_configs: Optional[ <add> Union[List[dict], List[RedactImageRequest.ImageRedactionConfig]] <add> ] = None, <ide> include_findings: Optional[bool] = None, <ide> byte_item: Optional[Union[Dict, ByteContentItem]] = None, <ide> retry: Optional[Retry] = None, <ide><path>airflow/providers/google/cloud/operators/kubernetes_engine.py <ide> class GKEStartPodOperator(KubernetesPodOperator): <ide> :type is_delete_operator_pod: bool <ide> """ <ide> <del> template_fields = {'project_id', 'location', 'cluster_name'} | set(KubernetesPodOperator.template_fields) <add> template_fields: Sequence[str] = tuple( <add> {'project_id', 'location', 'cluster_name'} | set(KubernetesPodOperator.template_fields) <add> ) <ide> <ide> def __init__( <ide> self, <ide><path>airflow/providers/google/cloud/operators/spanner.py <ide> def execute(self, context: 'Context'): <ide> gcp_conn_id=self.gcp_conn_id, <ide> impersonation_chain=self.impersonation_chain, <ide> ) <del> queries = self.query <ide> if isinstance(self.query, str): <ide> queries = [x.strip() for x in self.query.split(';')] <ide> self.sanitize_queries(queries) <add> else: <add> queries = self.query <ide> self.log.info( <ide> "Executing DML query(-ies) on projects/%s/instances/%s/databases/%s", <ide> self.project_id, <ide><path>airflow/providers/google/cloud/operators/stackdriver.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> <del>from typing import TYPE_CHECKING, Optional, Sequence, Union <add>from typing import TYPE_CHECKING, Optional, Sequence, Tuple, Union <ide> <ide> from google.api_core.gapic_v1.method import DEFAULT <ide> from google.cloud.monitoring_v3 import AlertPolicy, NotificationChannel <ide> class StackdriverListAlertPoliciesOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> order_by: Optional[str] = None, <ide> page_size: Optional[int] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverEnableAlertPoliciesOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverDisableAlertPoliciesOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverUpsertAlertOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> alerts: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverDeleteAlertOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> name: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverListNotificationChannelsOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> order_by: Optional[str] = None, <ide> page_size: Optional[int] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverEnableNotificationChannelsOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverDisableNotificationChannelsOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> filter_: Optional[str] = None, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverUpsertNotificationChannelOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> channels: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[str] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide> class StackdriverDeleteNotificationChannelOperator(BaseOperator): <ide> specified, the timeout applies to each individual attempt. <ide> :type timeout: float <ide> :param metadata: Additional metadata that is provided to the method. <del> :type metadata: str <add> :type metadata: Sequence[Tuple[str, str]] <ide> :param gcp_conn_id: (Optional) The connection ID used to connect to Google <ide> Cloud Platform. <ide> :type gcp_conn_id: str <ide> def __init__( <ide> *, <ide> name: str, <ide> retry: Optional[str] = DEFAULT, <del> timeout: Optional[float] = DEFAULT, <del> metadata: Optional[str] = None, <add> timeout: Optional[float] = None, <add> metadata: Sequence[Tuple[str, str]] = (), <ide> gcp_conn_id: str = 'google_cloud_default', <ide> project_id: Optional[str] = None, <ide> delegate_to: Optional[str] = None, <ide><path>airflow/providers/google/cloud/operators/tasks.py <ide> def execute(self, context: 'Context'): <ide> metadata=self.metadata, <ide> ) <ide> except AlreadyExists: <add> if self.queue_name is None: <add> raise RuntimeError("The queue name should be set here!") <ide> queue = hook.get_queue( <ide> location=self.location, <ide> project_id=self.project_id, <ide> def __init__( <ide> project_id: Optional[str] = None, <ide> location: Optional[str] = None, <ide> queue_name: Optional[str] = None, <del> update_mask: Optional[Union[Dict, FieldMask]] = None, <add> update_mask: Optional[FieldMask] = None, <ide> retry: Optional[Retry] = None, <ide> timeout: Optional[float] = None, <ide> metadata: MetaData = (), <ide><path>airflow/providers/google/cloud/operators/workflows.py <ide> import re <ide> import uuid <ide> from datetime import datetime, timedelta <del>from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, Union <add>from typing import TYPE_CHECKING, Dict, Optional, Sequence, Tuple, Union <ide> <ide> import pytz <ide> from google.api_core.exceptions import AlreadyExists <ide> def __init__( <ide> workflow_id: str, <ide> location: str, <ide> project_id: Optional[str] = None, <del> update_mask: Optional[Union[FieldMask, Dict[str, List[str]]]] = None, <add> update_mask: Optional[FieldMask] = None, <ide> retry: Optional[Retry] = None, <ide> timeout: Optional[float] = None, <ide> metadata: Sequence[Tuple[str, str]] = (), <ide><path>airflow/providers/google/cloud/transfers/adls_to_gcs.py <ide> def execute(self, context: 'Context'): <ide> # ADLS and not in Google Cloud Storage <ide> bucket_name, prefix = _parse_gcs_url(self.dest_gcs) <ide> existing_files = g_hook.list(bucket_name=bucket_name, prefix=prefix) <del> files = set(files) - set(existing_files) <add> files = list(set(files) - set(existing_files)) <ide> <ide> if files: <ide> hook = AzureDataLakeHook(azure_data_lake_conn_id=self.azure_data_lake_conn_id) <ide><path>airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py <ide> def execute(self, context: 'Context'): <ide> <ide> if files: <ide> self.log.info('%s files are going to be synced.', len(files)) <del> else: <del> self.log.info('There are no new files to sync. Have a nice day!') <del> <del> for file in files: <del> with NamedTemporaryFile() as temp_file: <del> azure_fileshare_hook.get_file_to_stream( <del> stream=temp_file, <del> share_name=self.share_name, <del> directory_name=self.directory_name, <del> file_name=file, <del> ) <del> temp_file.flush() <del> <del> # There will always be a '/' before file because it is <del> # enforced at instantiation time <del> dest_gcs_object = dest_gcs_object_prefix + file <del> gcs_hook.upload(dest_gcs_bucket, dest_gcs_object, temp_file.name, gzip=self.gzip) <del> <del> if files: <add> if self.directory_name is None: <add> raise RuntimeError("The directory_name must be set!.") <add> for file in files: <add> with NamedTemporaryFile() as temp_file: <add> azure_fileshare_hook.get_file_to_stream( <add> stream=temp_file, <add> share_name=self.share_name, <add> directory_name=self.directory_name, <add> file_name=file, <add> ) <add> temp_file.flush() <add> <add> # There will always be a '/' before file because it is <add> # enforced at instantiation time <add> dest_gcs_object = dest_gcs_object_prefix + file <add> gcs_hook.upload(dest_gcs_bucket, dest_gcs_object, temp_file.name, gzip=self.gzip) <ide> self.log.info("All done, uploaded %d files to Google Cloud Storage.", len(files)) <ide> else: <add> self.log.info('There are no new files to sync. Have a nice day!') <ide> self.log.info('In sync, no files needed to be uploaded to Google Cloud Storage') <ide> <ide> return files <ide><path>airflow/providers/google/cloud/transfers/gcs_to_bigquery.py <ide> def execute(self, context: 'Context'): <ide> escaped_table_name = f'`{self.destination_project_dataset_table}`' <ide> <ide> if self.max_id_key: <del> cursor.execute(f'SELECT MAX({self.max_id_key}) FROM {escaped_table_name}') <add> select_command = f'SELECT MAX({self.max_id_key}) FROM {escaped_table_name}' <add> cursor.execute(select_command) <ide> row = cursor.fetchone() <del> max_id = row[0] if row[0] else 0 <del> self.log.info( <del> 'Loaded BQ data with max %s.%s=%s', <del> self.destination_project_dataset_table, <del> self.max_id_key, <del> max_id, <del> ) <add> if row: <add> max_id = row[0] if row[0] else 0 <add> self.log.info( <add> 'Loaded BQ data with max %s.%s=%s', <add> self.destination_project_dataset_table, <add> self.max_id_key, <add> max_id, <add> ) <add> else: <add> raise RuntimeError(f"The f{select_command} returned no rows!") <ide><path>airflow/providers/google/cloud/transfers/gcs_to_local.py <ide> def __init__( <ide> # To preserve backward compatibility <ide> # TODO: Remove one day <ide> if object_name is None: <del> if 'object' in kwargs: <del> object_name = kwargs['object'] <add> object_name = kwargs.get('object') <add> if object_name is not None: <add> self.object_name = object_name <ide> DeprecationWarning("Use 'object_name' instead of 'object'.") <ide> else: <ide> TypeError("__init__() missing 1 required positional argument: 'object_name'") <ide> def __init__( <ide> <ide> super().__init__(**kwargs) <ide> self.bucket = bucket <del> self.object_name = object_name <ide> self.filename = filename <add> self.object_name = object_name <ide> self.store_to_xcom_key = store_to_xcom_key <ide> self.gcp_conn_id = gcp_conn_id <ide> self.delegate_to = delegate_to <ide><path>airflow/providers/google/cloud/transfers/gdrive_to_gcs.py <ide> def __init__( <ide> **kwargs, <ide> ) -> None: <ide> super().__init__(**kwargs) <del> self.bucket_name = destination_bucket or bucket_name <ide> if destination_bucket: <ide> warnings.warn( <ide> "`destination_bucket` is deprecated please use `bucket_name`", <ide> DeprecationWarning, <ide> stacklevel=2, <ide> ) <add> actual_bucket = destination_bucket or bucket_name <add> if actual_bucket is None: <add> raise RuntimeError("One of the destination_bucket or bucket_name must be set") <add> self.bucket_name: str = actual_bucket <ide> self.object_name = destination_object or object_name <ide> if destination_object: <ide> warnings.warn( <ide><path>airflow/providers/google/suite/hooks/drive.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> """Hook for Google Drive service""" <del>from io import TextIOWrapper <del>from typing import Any, Optional, Sequence, Union <add>from typing import IO, Any, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import Resource, build <ide> from googleapiclient.http import HttpRequest, MediaFileUpload <ide> def upload_file(self, local_location: str, remote_location: str) -> str: <ide> self.log.info("File %s uploaded to gdrive://%s.", local_location, remote_location) <ide> return file.get("id") <ide> <del> def download_file(self, file_id: str, file_handle: TextIOWrapper, chunk_size: int = 104857600): <add> def download_file(self, file_id: str, file_handle: IO, chunk_size: int = 104857600): <ide> """ <ide> Download a file from Google Drive. <ide> <ide><path>airflow/providers/microsoft/azure/hooks/fileshare.py <ide> # under the License. <ide> # <ide> import warnings <del>from typing import Any, Dict, List, Optional <add>from typing import IO, Any, Dict, List, Optional <ide> <ide> from azure.storage.file import File, FileService <ide> <ide> def get_file( <ide> self.get_conn().get_file_to_path(share_name, directory_name, file_name, file_path, **kwargs) <ide> <ide> def get_file_to_stream( <del> self, stream: str, share_name: str, directory_name: str, file_name: str, **kwargs <add> self, stream: IO, share_name: str, directory_name: str, file_name: str, **kwargs <ide> ) -> None: <ide> """ <ide> Download a file from Azure File Share. <ide><path>tests/providers/google/cloud/hooks/test_stackdriver.py <ide> def test_stackdriver_list_alert_policies(self, mock_policy_client, mock_get_cred <ide> method.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=TEST_FILTER, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_enable_alert_policy(self, mock_policy_client, mock_get_cred <ide> mock_policy_client.return_value.list_alert_policies.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=TEST_FILTER, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> mask = FieldMask(paths=["enabled"]) <ide> alert_policy_disabled.enabled = True <ide> mock_policy_client.return_value.update_alert_policy.assert_called_once_with( <ide> request=dict(alert_policy=alert_policy_disabled, update_mask=mask), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_disable_alert_policy(self, mock_policy_client, mock_get_cre <ide> mock_policy_client.return_value.list_alert_policies.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=TEST_FILTER, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> mask = FieldMask(paths=["enabled"]) <ide> alert_policy_enabled.enabled = False <ide> mock_policy_client.return_value.update_alert_policy.assert_called_once_with( <ide> request=dict(alert_policy=alert_policy_enabled, update_mask=mask), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_upsert_alert_policy( <ide> page_size=None, <ide> ), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> mock_policy_client.return_value.list_alert_policies.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=None, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> alert_policy_to_create.name = None <ide> def test_stackdriver_upsert_alert_policy( <ide> alert_policy=alert_policy_to_create, <ide> ), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> existing_alert_policy.creation_record = None <ide> existing_alert_policy.mutation_record = None <ide> mock_policy_client.return_value.update_alert_policy.assert_called_once_with( <del> request=dict(alert_policy=existing_alert_policy), retry=DEFAULT, timeout=DEFAULT, metadata=() <add> request=dict(alert_policy=existing_alert_policy), retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> @mock.patch( <ide> def test_stackdriver_upsert_alert_policy_without_channel( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=None, order_by=None, page_size=None), <ide> metadata=(), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> ) <ide> mock_policy_client.return_value.list_alert_policies.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=None, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> existing_alert_policy.creation_record = None <ide> existing_alert_policy.mutation_record = None <ide> mock_policy_client.return_value.update_alert_policy.assert_called_once_with( <del> request=dict(alert_policy=existing_alert_policy), retry=DEFAULT, timeout=DEFAULT, metadata=() <add> request=dict(alert_policy=existing_alert_policy), retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> @mock.patch( <ide> def test_stackdriver_delete_alert_policy(self, mock_policy_client, mock_get_cred <ide> mock_policy_client.return_value.delete_alert_policy.assert_called_once_with( <ide> request=dict(name='test-alert'), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_list_notification_channel(self, mock_channel_client, mock_g <ide> mock_channel_client.return_value.list_notification_channels.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=TEST_FILTER, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_enable_notification_channel( <ide> mock_channel_client.return_value.update_notification_channel.assert_called_once_with( <ide> request=dict(notification_channel=notification_channel_disabled, update_mask=mask), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_disable_notification_channel( <ide> mock_channel_client.return_value.update_notification_channel.assert_called_once_with( <ide> request=dict(notification_channel=notification_channel_enabled, update_mask=mask), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_upsert_channel(self, mock_channel_client, mock_get_creds_an <ide> mock_channel_client.return_value.list_notification_channels.assert_called_once_with( <ide> request=dict(name=f'projects/{PROJECT_ID}', filter=None, order_by=None, page_size=None), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> mock_channel_client.return_value.update_notification_channel.assert_called_once_with( <ide> request=dict(notification_channel=existing_notification_channel), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> notification_channel_to_be_created.name = None <ide> def test_stackdriver_upsert_channel(self, mock_channel_client, mock_get_creds_an <ide> name=f'projects/{PROJECT_ID}', notification_channel=notification_channel_to_be_created <ide> ), <ide> retry=DEFAULT, <del> timeout=DEFAULT, <add> timeout=None, <ide> metadata=(), <ide> ) <ide> <ide> def test_stackdriver_delete_notification_channel( <ide> name='test-channel', <ide> ) <ide> mock_channel_client.return_value.delete_notification_channel.assert_called_once_with( <del> request=dict(name='test-channel'), retry=DEFAULT, timeout=DEFAULT, metadata=() <add> request=dict(name='test-channel'), retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide><path>tests/providers/google/cloud/operators/test_cloud_build.py <ide> def test_create_build_with_body(self, mock_hook): <ide> @mock.patch("airflow.providers.google.cloud.operators.cloud_build.CloudBuildHook") <ide> def test_create_build_with_body_and_build(self, mock_hook): <ide> mock_hook.return_value.create_build.return_value = Build() <del> with pytest.raises(AirflowException, match="Either build or body should be passed."): <add> with pytest.raises( <add> AirflowException, match="You should not pass both build or body parameters. Both are set." <add> ): <ide> CloudBuildCreateBuildOperator(build=BUILD, body=BUILD, task_id="id") <ide> <ide> @parameterized.expand( <ide><path>tests/providers/google/cloud/operators/test_dataflow.py <ide> def test_exec(self, gcs_hook, dataflow_hook_mock, beam_hook_mock, mock_callback_ <ide> job_id=mock.ANY, <ide> job_name=job_name, <ide> location=TEST_LOCATION, <del> multiple_jobs=None, <add> multiple_jobs=False, <ide> ) <ide> <ide> provide_gcloud_mock.assert_called_once_with() <ide> def set_is_job_dataflow_running_variables(*args, **kwargs): <ide> job_id=mock.ANY, <ide> job_name=job_name, <ide> location=TEST_LOCATION, <del> multiple_jobs=None, <add> multiple_jobs=False, <ide> ) <ide> <ide> @mock.patch( <ide><path>tests/providers/google/cloud/operators/test_stackdriver.py <ide> def test_execute(self, mock_hook): <ide> order_by=None, <ide> page_size=None, <ide> retry=DEFAULT, <del> timeout=DEFAULT, <del> metadata=None, <add> timeout=None, <add> metadata=(), <ide> ) <ide> assert [ <ide> { <ide> def test_execute(self, mock_hook): <ide> operator = StackdriverEnableAlertPoliciesOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) <ide> operator.execute(None) <ide> mock_hook.return_value.enable_alert_policies.assert_called_once_with( <del> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=DEFAULT, metadata=None <add> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> operator = StackdriverDisableAlertPoliciesOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) <ide> operator.execute(None) <ide> mock_hook.return_value.disable_alert_policies.assert_called_once_with( <del> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=DEFAULT, metadata=None <add> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> alerts=json.dumps({"policies": [TEST_ALERT_POLICY_1, TEST_ALERT_POLICY_2]}), <ide> project_id=None, <ide> retry=DEFAULT, <del> timeout=DEFAULT, <del> metadata=None, <add> timeout=None, <add> metadata=(), <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> ) <ide> operator.execute(None) <ide> mock_hook.return_value.delete_alert_policy.assert_called_once_with( <del> name='test-alert', retry=DEFAULT, timeout=DEFAULT, metadata=None <add> name='test-alert', retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> order_by=None, <ide> page_size=None, <ide> retry=DEFAULT, <del> timeout=DEFAULT, <del> metadata=None, <add> timeout=None, <add> metadata=(), <ide> ) <ide> # Depending on the version of google-apitools installed we might receive the response either with or <ide> # without mutation_records. <ide> def test_execute(self, mock_hook): <ide> operator = StackdriverEnableNotificationChannelsOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) <ide> operator.execute(None) <ide> mock_hook.return_value.enable_notification_channels.assert_called_once_with( <del> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=DEFAULT, metadata=None <add> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> operator = StackdriverDisableNotificationChannelsOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) <ide> operator.execute(None) <ide> mock_hook.return_value.disable_notification_channels.assert_called_once_with( <del> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=DEFAULT, metadata=None <add> project_id=None, filter_=TEST_FILTER, retry=DEFAULT, timeout=None, metadata=() <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> channels=json.dumps({"channels": [TEST_NOTIFICATION_CHANNEL_1, TEST_NOTIFICATION_CHANNEL_2]}), <ide> project_id=None, <ide> retry=DEFAULT, <del> timeout=DEFAULT, <del> metadata=None, <add> timeout=None, <add> metadata=(), <ide> ) <ide> <ide> <ide> def test_execute(self, mock_hook): <ide> ) <ide> operator.execute(None) <ide> mock_hook.return_value.delete_notification_channel.assert_called_once_with( <del> name='test-channel', retry=DEFAULT, timeout=DEFAULT, metadata=None <add> name='test-channel', retry=DEFAULT, timeout=None, metadata=() <ide> )
28
Python
Python
add failing test for `listfield` schema generation
b1048984a7a839234ca604d199edbc9985c8a059
<ide><path>tests/schemas/test_openapi.py <ide> def test_list_field_mapping(self): <ide> (serializers.ListField(child=serializers.CharField()), {'items': {'type': 'string'}, 'type': 'array'}), <ide> (serializers.ListField(child=serializers.IntegerField(max_value=4294967295)), <ide> {'items': {'type': 'integer', 'format': 'int64'}, 'type': 'array'}), <add> (serializers.ListField(child=serializers.ChoiceField(choices=[('a', 'Choice A'), ('b', 'Choice B')])), <add> {'items': {'enum': ['a', 'b']}, 'type': 'array'}), <ide> (serializers.IntegerField(min_value=2147483648), <ide> {'type': 'integer', 'minimum': 2147483648, 'format': 'int64'}), <ide> ]
1
Python
Python
handle relative import in ccompiler
f7dd25718e2e8135be2287bfa22967c1c7981448
<ide><path>numpy/distutils/ccompiler.py <ide> def CCompiler_compile(self, sources, output_dir=None, macros=None, <ide> # method to support pre Python 2.3 distutils. <ide> if not sources: <ide> return [] <del> from fcompiler import FCompiler <add> # FIXME:RELATIVE_IMPORT <add> if sys.version_info[0] < 3: <add> from fcompiler import FCompiler <add> else: <add> from numpy.distutils.fcompiler import FCompiler <ide> if isinstance(self, FCompiler): <ide> display = [] <ide> for fc in ['f77','f90','fix']:
1
Ruby
Ruby
remove multibyte utils
51648a6fee31c9642d3ce8899a1c718e1604f4bc
<ide><path>activesupport/lib/active_support/multibyte.rb <ide> def self.proxy_class=(klass) <ide> def self.proxy_class <ide> @proxy_class ||= ActiveSupport::Multibyte::Chars <ide> end <del> <del> # Regular expressions that describe valid byte sequences for a character <del> VALID_CHARACTER = { <del> # Borrowed from the Kconv library by Shinji KONO - (also as seen on the W3C site) <del> 'UTF-8' => /\A(?: <del> [\x00-\x7f] | <del> [\xc2-\xdf] [\x80-\xbf] | <del> \xe0 [\xa0-\xbf] [\x80-\xbf] | <del> [\xe1-\xef] [\x80-\xbf] [\x80-\xbf] | <del> \xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] | <del> [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] | <del> \xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf])\z /xn, <del> # Quick check for valid Shift-JIS characters, disregards the odd-even pairing <del> 'Shift_JIS' => /\A(?: <del> [\x00-\x7e\xa1-\xdf] | <del> [\x81-\x9f\xe0-\xef] [\x40-\x7e\x80-\x9e\x9f-\xfc])\z /xn <del> } <ide> end <del>end <del> <del>require 'active_support/multibyte/utils' <ide>\ No newline at end of file <add>end <ide>\ No newline at end of file <ide><path>activesupport/lib/active_support/multibyte/utils.rb <del># encoding: utf-8 <del> <del>module ActiveSupport #:nodoc: <del> module Multibyte #:nodoc: <del> # Returns a regular expression that matches valid characters in the current encoding <del> def self.valid_character <del> VALID_CHARACTER[Encoding.default_external.to_s] <del> end <del> <del> # Verifies the encoding of a string <del> def self.verify(string) <del> string.valid_encoding? <del> end <del> <del> # Verifies the encoding of the string and raises an exception when it's not valid <del> def self.verify!(string) <del> raise EncodingError.new("Found characters with invalid encoding") unless verify(string) <del> end <del> <del> # Removes all invalid characters from the string. <del> # <del> # Note: this method is a no-op in Ruby 1.9 <del> def self.clean(string) <del> string <del> end <del> end <del>end <ide><path>activesupport/test/multibyte_utils_test.rb <del># encoding: utf-8 <del> <del>require 'abstract_unit' <del>require 'multibyte_test_helpers' <del> <del>class MultibyteUtilsTest < ActiveSupport::TestCase <del> include MultibyteTestHelpers <del> <del> test "valid_character returns an expression for the current encoding" do <del> with_encoding('None') do <del> assert_nil ActiveSupport::Multibyte.valid_character <del> end <del> with_encoding('UTF8') do <del> assert_equal ActiveSupport::Multibyte::VALID_CHARACTER['UTF-8'], ActiveSupport::Multibyte.valid_character <del> end <del> with_encoding('SJIS') do <del> assert_equal ActiveSupport::Multibyte::VALID_CHARACTER['Shift_JIS'], ActiveSupport::Multibyte.valid_character <del> end <del> end <del> <del> test "verify verifies ASCII strings are properly encoded" do <del> with_encoding('None') do <del> examples.each do |example| <del> assert ActiveSupport::Multibyte.verify(example) <del> end <del> end <del> end <del> <del> test "verify verifies UTF-8 strings are properly encoded" do <del> with_encoding('UTF8') do <del> assert ActiveSupport::Multibyte.verify(example('valid UTF-8')) <del> assert !ActiveSupport::Multibyte.verify(example('invalid UTF-8')) <del> end <del> end <del> <del> test "verify verifies Shift-JIS strings are properly encoded" do <del> with_encoding('SJIS') do <del> assert ActiveSupport::Multibyte.verify(example('valid Shift-JIS')) <del> assert !ActiveSupport::Multibyte.verify(example('invalid Shift-JIS')) <del> end <del> end <del> <del> test "verify! raises an exception when it finds an invalid character" do <del> with_encoding('UTF8') do <del> assert_raises(ActiveSupport::Multibyte::EncodingError) do <del> ActiveSupport::Multibyte.verify!(example('invalid UTF-8')) <del> end <del> end <del> end <del> <del> test "verify! doesn't raise an exception when the encoding is valid" do <del> with_encoding('UTF8') do <del> assert_nothing_raised do <del> ActiveSupport::Multibyte.verify!(example('valid UTF-8')) <del> end <del> end <del> end <del> <del> test "clean is a no-op" do <del> with_encoding('UTF8') do <del> assert_equal example('invalid Shift-JIS'), ActiveSupport::Multibyte.clean(example('invalid Shift-JIS')) <del> end <del> end <del> <del> private <del> <del> STRINGS = { <del> 'valid ASCII' => [65, 83, 67, 73, 73].pack('C*'), <del> 'invalid ASCII' => [128].pack('C*'), <del> 'valid UTF-8' => [227, 129, 147, 227, 129, 171, 227, 129, 161, 227, 130, 143].pack('C*'), <del> 'invalid UTF-8' => [184, 158, 8, 136, 165].pack('C*'), <del> 'valid Shift-JIS' => [131, 122, 129, 91, 131, 128].pack('C*'), <del> 'invalid Shift-JIS' => [184, 158, 8, 0, 255, 136, 165].pack('C*') <del> } <del> <del> def example(key) <del> STRINGS[key].force_encoding(Encoding.default_external) <del> end <del> <del> def examples <del> STRINGS.values.map { |s| s.force_encoding(Encoding.default_external) } <del> end <del> <del> KCODE_TO_ENCODING = Hash.new(Encoding::BINARY). <del> update('UTF8' => Encoding::UTF_8, 'SJIS' => Encoding::Shift_JIS) <del> <del> def with_encoding(enc) <del> before = Encoding.default_external <del> silence_warnings { Encoding.default_external = KCODE_TO_ENCODING[enc] } <del> yield <del> silence_warnings { Encoding.default_external = before } <del> end <del>end
3
Python
Python
return boolean value according to the doc
4f6c3b5d184455b0fdacd7968bbba53583dddb03
<ide><path>celery/platforms.py <ide> def reset_alarm(self): <ide> def supported(self, name): <ide> """Return true value if signal by ``name`` exists on this platform.""" <ide> try: <del> return self.signum(name) <add> self.signum(name) <ide> except AttributeError: <del> pass <add> return False <add> else: <add> return True <ide> <ide> def signum(self, name): <ide> """Get signal number by name."""
1
Javascript
Javascript
fix events to go through the navigation bar layers
db69004300faf1d850f8127a57859d88205450a7
<ide><path>Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js <ide> var NavigatorNavigationBar = React.createClass({ <ide> ref={(ref) => { <ide> this._components[componentName] = this._components[componentName].set(route, ref); <ide> }} <add> pointerEvents="box-none" <ide> style={initialStage[componentName]}> <ide> {content} <ide> </View>
1
Ruby
Ruby
remove outdated comment [ci skip]
8b18feb077410219be27c4dea90b95516339e420
<ide><path>activerecord/test/cases/validations/i18n_validation_test.rb <ide> def replied_topic <ide> # [ "given on condition", {on: :save}, {}] <ide> ] <ide> <del> # validates_uniqueness_of w/ mocha <del> <ide> COMMON_CASES.each do |name, validation_options, generate_message_options| <ide> test "validates_uniqueness_of on generated message #{name}" do <ide> Topic.validates_uniqueness_of :title, validation_options <ide> def replied_topic <ide> end <ide> end <ide> <del> # validates_associated w/ mocha <del> <ide> COMMON_CASES.each do |name, validation_options, generate_message_options| <ide> test "validates_associated on generated message #{name}" do <ide> Topic.validates_associated :replies, validation_options <ide> def replied_topic <ide> end <ide> end <ide> <del> # validates_associated w/o mocha <del> <ide> def test_validates_associated_finds_custom_model_key_translation <ide> I18n.backend.store_translations 'en', :activerecord => {:errors => {:models => {:topic => {:attributes => {:replies => {:invalid => 'custom message'}}}}}} <ide> I18n.backend.store_translations 'en', :activerecord => {:errors => {:messages => {:invalid => 'global message'}}}
1
Javascript
Javascript
use countdown in test file
0a28f94df6e23f7669fd0fa9e52f7174175f78c4
<ide><path>test/parallel/test-http-pipeline-regr-3332.js <ide> 'use strict'; <ide> require('../common'); <del>const assert = require('assert'); <ide> const http = require('http'); <ide> const net = require('net'); <add>const Countdown = require('../common/countdown'); <ide> <ide> const big = Buffer.alloc(16 * 1024, 'A'); <ide> <ide> const COUNT = 1e4; <ide> <del>let received = 0; <add>const countdown = new Countdown(COUNT, () => { <add> server.close(); <add> client.end(); <add>}); <ide> <ide> let client; <ide> const server = http.createServer(function(req, res) { <ide> res.end(big, function() { <del> if (++received === COUNT) { <del> server.close(); <del> client.end(); <del> } <add> countdown.dec(); <ide> }); <ide> }).listen(0, function() { <ide> const req = 'GET / HTTP/1.1\r\n\r\n'.repeat(COUNT); <ide> client = net.connect(this.address().port, function() { <ide> client.write(req); <ide> }); <del> <del> // Just let the test terminate instead of hanging <del> client.on('close', function() { <del> if (received !== COUNT) <del> server.close(); <del> }); <ide> client.resume(); <ide> }); <del> <del>process.on('exit', function() { <del> // The server should pause connection on pipeline flood, but it shoul still <del> // resume it and finish processing the requests, when its output queue will <del> // be empty again. <del> assert.strictEqual(received, COUNT); <del>});
1
Javascript
Javascript
remove unnecessary object check
35e233661d991cce084681f8ad72d3008b793529
<ide><path>Libraries/Image/Image.ios.js <ide> let Image = ( <ide> } <ide> } <ide> <del> const resizeMode = props.resizeMode || (style || {}).resizeMode || 'cover'; // Workaround for flow bug t7737108 <del> const tintColor = (style || {}).tintColor; // Workaround for flow bug t7737108 <add> const resizeMode = props.resizeMode || style.resizeMode; <add> const tintColor = style.tintColor; <ide> <ide> if (props.src != null) { <ide> console.warn(
1
Go
Go
lock os threads when exec'ing with pdeathsig
1f22b15030e6869fb38256fd73d3b94bc94e3c58
<ide><path>daemon/graphdriver/overlay2/mount.go <ide> func mountFrom(dir, device, target, mType string, flags uintptr, label string) e <ide> output := bytes.NewBuffer(nil) <ide> cmd.Stdout = output <ide> cmd.Stderr = output <add> <add> // reexec.Command() sets cmd.SysProcAttr.Pdeathsig on Linux, which <add> // causes the started process to be signaled when the creating OS thread <add> // dies. Ensure that the reexec is not prematurely signaled. See <add> // https://go.dev/issue/27505 for more information. <add> runtime.LockOSThread() <add> defer runtime.UnlockOSThread() <ide> if err := cmd.Start(); err != nil { <ide> w.Close() <ide> return fmt.Errorf("mountfrom error on re-exec cmd: %v", err) <ide><path>libcontainerd/supervisor/remote_daemon.go <ide> import ( <ide> "os" <ide> "os/exec" <ide> "path/filepath" <add> "runtime" <ide> "strconv" <ide> "strings" <ide> "time" <ide> func (r *remote) startContainerd() error { <ide> cmd.Env = append(cmd.Env, e) <ide> } <ide> } <del> if err := cmd.Start(); err != nil { <del> return err <del> } <ide> <del> r.daemonWaitCh = make(chan struct{}) <add> startedCh := make(chan error) <ide> go func() { <add> // On Linux, when cmd.SysProcAttr.Pdeathsig is set, <add> // the signal is sent to the subprocess when the creating thread <add> // terminates. The runtime terminates a thread if a goroutine <add> // exits while locked to it. Prevent the containerd process <add> // from getting killed prematurely by ensuring that the thread <add> // used to start it remains alive until it or the daemon process <add> // exits. See https://go.dev/issue/27505 for more details. <add> runtime.LockOSThread() <add> defer runtime.UnlockOSThread() <add> err := cmd.Start() <add> startedCh <- err <add> if err != nil { <add> return <add> } <add> <add> r.daemonWaitCh = make(chan struct{}) <ide> // Reap our child when needed <ide> if err := cmd.Wait(); err != nil { <ide> r.logger.WithError(err).Errorf("containerd did not exit successfully") <ide> } <ide> close(r.daemonWaitCh) <ide> }() <add> if err := <-startedCh; err != nil { <add> return err <add> } <ide> <ide> r.daemonPid = cmd.Process.Pid <ide> <ide><path>libnetwork/portmapper/proxy_linux.go <ide> import ( <ide> "net" <ide> "os" <ide> "os/exec" <add> "runtime" <ide> "strconv" <ide> "syscall" <ide> "time" <ide> func newProxyCommand(proto string, hostIP net.IP, hostPort int, containerIP net. <ide> Path: path, <ide> Args: args, <ide> SysProcAttr: &syscall.SysProcAttr{ <del> Pdeathsig: syscall.SIGTERM, // send a sigterm to the proxy if the daemon process dies <add> Pdeathsig: syscall.SIGTERM, // send a sigterm to the proxy if the creating thread in the daemon process dies (https://go.dev/issue/27505) <ide> }, <ide> }, <add> wait: make(chan error, 1), <ide> }, nil <ide> } <ide> <ide> // proxyCommand wraps an exec.Cmd to run the userland TCP and UDP <ide> // proxies as separate processes. <ide> type proxyCommand struct { <del> cmd *exec.Cmd <add> cmd *exec.Cmd <add> wait chan error <ide> } <ide> <ide> func (p *proxyCommand) Start() error { <ide> func (p *proxyCommand) Start() error { <ide> } <ide> defer r.Close() <ide> p.cmd.ExtraFiles = []*os.File{w} <del> if err := p.cmd.Start(); err != nil { <add> <add> // As p.cmd.SysProcAttr.Pdeathsig is set, the signal will be sent to the <add> // process when the OS thread on which p.cmd.Start() was executed dies. <add> // If the thread is allowed to be released back into the goroutine <add> // thread pool, the thread could get terminated at any time if a <add> // goroutine gets scheduled onto it which calls runtime.LockOSThread() <add> // and exits without a matching number of runtime.UnlockOSThread() <add> // calls. Ensure that the thread from which Start() is called stays <add> // alive until the proxy or the daemon process exits to prevent the <add> // proxy from getting terminated early. See https://go.dev/issue/27505 <add> // for more details. <add> started := make(chan error) <add> go func() { <add> runtime.LockOSThread() <add> defer runtime.UnlockOSThread() <add> err := p.cmd.Start() <add> started <- err <add> if err != nil { <add> return <add> } <add> p.wait <- p.cmd.Wait() <add> }() <add> if err := <-started; err != nil { <ide> return err <ide> } <ide> w.Close() <ide> func (p *proxyCommand) Stop() error { <ide> if err := p.cmd.Process.Signal(os.Interrupt); err != nil { <ide> return err <ide> } <del> return p.cmd.Wait() <add> return <-p.wait <ide> } <ide> return nil <ide> } <ide><path>pkg/chrootarchive/archive_unix.go <ide> func invokeUnpack(decompressedArchive io.Reader, dest string, options *archive.T <ide> cmd.Stdout = output <ide> cmd.Stderr = output <ide> <add> // reexec.Command() sets cmd.SysProcAttr.Pdeathsig on Linux, which <add> // causes the started process to be signaled when the creating OS thread <add> // dies. Ensure that the reexec is not prematurely signaled. See <add> // https://go.dev/issue/27505 for more information. <add> runtime.LockOSThread() <add> defer runtime.UnlockOSThread() <ide> if err := cmd.Start(); err != nil { <ide> w.Close() <ide> return fmt.Errorf("Untar error on re-exec cmd: %v", err) <ide> func invokePack(srcPath string, options *archive.TarOptions, root string) (io.Re <ide> return nil, errors.Wrap(err, "error getting options pipe for tar process") <ide> } <ide> <del> if err := cmd.Start(); err != nil { <del> return nil, errors.Wrap(err, "tar error on re-exec cmd") <del> } <del> <add> started := make(chan error) <ide> go func() { <add> // reexec.Command() sets cmd.SysProcAttr.Pdeathsig on Linux, <add> // which causes the started process to be signaled when the <add> // creating OS thread dies. Ensure that the subprocess is not <add> // prematurely signaled. See https://go.dev/issue/27505 for more <add> // information. <add> runtime.LockOSThread() <add> defer runtime.UnlockOSThread() <add> if err := cmd.Start(); err != nil { <add> started <- err <add> return <add> } <add> close(started) <ide> err := cmd.Wait() <ide> err = errors.Wrapf(err, "error processing tar file: %s", errBuff) <ide> tarW.CloseWithError(err) <ide> }() <add> if err := <-started; err != nil { <add> return nil, errors.Wrap(err, "tar error on re-exec cmd") <add> } <ide> <ide> if err := json.NewEncoder(stdin).Encode(options); err != nil { <ide> stdin.Close() <ide><path>pkg/chrootarchive/diff_unix.go <ide> func applyLayerHandler(dest string, layer io.Reader, options *archive.TarOptions <ide> outBuf, errBuf := new(bytes.Buffer), new(bytes.Buffer) <ide> cmd.Stdout, cmd.Stderr = outBuf, errBuf <ide> <add> // reexec.Command() sets cmd.SysProcAttr.Pdeathsig on Linux, which <add> // causes the started process to be signaled when the creating OS thread <add> // dies. Ensure that the reexec is not prematurely signaled. See <add> // https://go.dev/issue/27505 for more information. <add> runtime.LockOSThread() <add> defer runtime.UnlockOSThread() <ide> if err = cmd.Run(); err != nil { <ide> return 0, fmt.Errorf("ApplyLayer %s stdout: %s stderr: %s", err, outBuf, errBuf) <ide> } <ide><path>pkg/reexec/command_linux.go <ide> func Self() string { <ide> // SysProcAttr.Pdeathsig to SIGTERM. <ide> // This will use the in-memory version (/proc/self/exe) of the current binary, <ide> // it is thus safe to delete or replace the on-disk binary (os.Args[0]). <add>// <add>// As SysProcAttr.Pdeathsig is set, the signal will be sent to the process when <add>// the OS thread which created the process dies. It is the caller's <add>// responsibility to ensure that the creating thread is not terminated <add>// prematurely. See https://go.dev/issue/27505 for more details. <ide> func Command(args ...string) *exec.Cmd { <ide> return &exec.Cmd{ <ide> Path: Self(),
6
Javascript
Javascript
remove usage of require('util')
01a129635cad8f645b7b2aa12526eeb2ba826527
<ide><path>lib/internal/worker/io.js <ide> const { <ide> <ide> const { Readable, Writable } = require('stream'); <ide> const EventEmitter = require('events'); <del>const util = require('util'); <add>const { inspect } = require('internal/util/inspect'); <ide> <ide> let debuglog; <ide> function debug(...args) { <ide> MessagePort.prototype.close = function(cb) { <ide> MessagePortPrototype.close.call(this); <ide> }; <ide> <del>Object.defineProperty(MessagePort.prototype, util.inspect.custom, { <add>Object.defineProperty(MessagePort.prototype, inspect.custom, { <ide> enumerable: false, <ide> writable: false, <ide> value: function inspect() { // eslint-disable-line func-name-matching
1
Ruby
Ruby
fix missed reference to cookies.rb in cd1aeda0a9
c26b65382e94c4c9ad48c15ba839a2ae2ccb0775
<ide><path>railties/lib/rails/generators/rails/app/app_generator.rb <ide> def config_when_updating <ide> end <ide> <ide> if options[:api] <del> unless cookies_config_exist <del> remove_file "config/initializers/cookies.rb" <add> unless cookie_serializer_config_exist <add> remove_file "config/initializers/cookies_serializer.rb" <ide> end <ide> <ide> unless csp_config_exist
1
Ruby
Ruby
add some note on adding index to habtm table
f0be2cb19274bb6029f84ca274a72c4d7fbee2d3
<ide><path>activerecord/lib/active_record/associations.rb <ide> def belongs_to(name, options = {}) <ide> # end <ide> # end <ide> # <add> # It's also a good idea to add indexes to each of those columns to speed up the joins process. <add> # However, in MySQL it is advised to add a compound index for both of the columns as MySQL only <add> # uses one index per table during the lookup. <add> # <ide> # Adds the following methods for retrieval and query: <ide> # <ide> # [collection(force_reload = false)]
1
Text
Text
translate tips 11 to korean
78f59da8dff0a35808ad5fcaadb63a2b82bebd4c
<ide><path>docs/docs/03-interactivity-and-dynamic-uis.ko-KR.md <ide> React에서의 이벤트 핸들러는 HTML에서 그러던 것처럼 간단히 <ide> <ide> <ide> ## 기본 구현: 오토바인딩과 이벤트 델리게이션 <add><a name="under-the-hood-autobinding-and-event-delegation"></a> <ide> <ide> 코드를 고성능으로 유지하고 이해하기 쉽게 하기 위해, React는 보이지 않는 곳에서 몇 가지 일을 수행합니다. <ide> <ide><path>docs/tips/11-dom-event-listeners.ko-KR.md <add>--- <add>id: dom-event-listeners-ko-KR <add>title: 컴포넌트에서 DOM 이벤트 리스너 <add>layout: tips <add>permalink: dom-event-listeners-ko-KR.html <add>prev: props-in-getInitialState-as-anti-pattern-ko-KR.html <add>next: initial-ajax-ko-KR.html <add>--- <add> <add>> 주의: <add>> <add>> 이 글은 React에서 제공되지 않은 DOM 이벤트를 어떻게 붙이는지 설명합니다. ([더 자세한 정보는 여기에서 보세요.](/react/docs/events-ko-KR.html)). 이는 jQuery 같은 다른 라이브러리들을 통합할 때 좋습니다. <add> <add>윈도우 크기를 조절해봅시다. <add> <add>```js <add>var Box = React.createClass({ <add> getInitialState: function() { <add> return {windowWidth: window.innerWidth}; <add> }, <add> <add> handleResize: function(e) { <add> this.setState({windowWidth: window.innerWidth}); <add> }, <add> <add> componentDidMount: function() { <add> window.addEventListener('resize', this.handleResize); <add> }, <add> <add> componentWillUnmount: function() { <add> window.removeEventListener('resize', this.handleResize); <add> }, <add> <add> render: function() { <add> return <div>Current window width: {this.state.windowWidth}</div>; <add> } <add>}); <add> <add>React.render(<Box />, mountNode); <add>``` <add> <add>컴포넌트가 마운트 되고 DOM 표현을 가지게 되면 `componentDidMount`가 호출됩니다. 일반적인 DOM 이벤트를 붙이는 곳으로 여기를 종종 사용합니다. <add> <add>이벤트 콜백은 원래 엘리먼트 대신 React 컴포넌트에 바인드하는 걸 주의합시다. React는 [오토바인드](/react/docs/interactivity-and-dynamic-uis-ko-KR.html#under-the-hood-autobinding-and-event-delegation) 과정에서 메서드를 현재 컴포넌트 인스턴스로 바인드합니다. <add>
2
PHP
PHP
add test for unmanaged fixtures
d04265aa1be32bbe6d570b3f574fc638ed862b86
<ide><path>tests/Fixture/UnmanagedFixture.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 4.2.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\Fixture; <add> <add>use Cake\TestSuite\Fixture\TestFixture; <add> <add>/** <add> * Fixture that wraps a pre-existing table <add> * without importing and with no fields. <add> */ <add>class UnmanagedFixture extends TestFixture <add>{ <add> /** <add> * @inheritDoc <add> */ <add> public $table = 'unmanaged'; <add> <add> /** <add> * @inheritDoc <add> */ <add> public $records = [ <add> ['title' => 'a title', 'body' => 'a body'], <add> ['title' => 'another title', 'body' => 'another body'], <add> ]; <add>} <ide><path>tests/TestCase/TestSuite/FixtureManagerTest.php <ide> public function testFixturizeInvalidType() <ide> $this->manager->fixturize($test); <ide> } <ide> <add> /** <add> * Tests handling unmnaged fixtures which don't <add> * import a schema or defined fields. These tables <add> * should only insert records and not drop/create. <add> * <add> * @return void <add> */ <add> public function testLoadUnmanagedFixtures() <add> { <add> $schema = new TableSchema('unmanaged', [ <add> 'title' => ['type' => 'string', 'length' => 100], <add> 'body' => ['type' => 'string', 'length' => 100], <add> ]); <add> <add> $conn = ConnectionManager::get('test'); <add> foreach ($schema->createSql($conn) as $sql) { <add> $conn->execute($sql); <add> } <add> $conn->newQuery() <add> ->insert(['title', 'body']) <add> ->into('unmanaged') <add> ->values([ <add> 'title' => 'Existing title', <add> 'body' => 'Existing body', <add> ]) <add> ->execute(); <add> <add> $buffer = new ConsoleOutput(); <add> Log::setConfig('testQueryLogger', [ <add> 'className' => 'Console', <add> 'stream' => $buffer, <add> ]); <add> <add> $test = $this->getMockBuilder('Cake\TestSuite\TestCase')->getMock(); <add> $test->expects($this->any()) <add> ->method('getFixtures') <add> ->willReturn(['core.Unmanaged']); <add> <add> $conn->enableQueryLogging(true); <add> $this->manager->setDebug(true); <add> $this->manager->fixturize($test); <add> $this->manager->load($test); <add> $this->assertStringNotContainsString('DROP TABLE', implode('', $buffer->messages())); <add> <add> $stmt = $conn->newQuery()->select(['title', 'body'])->from('unmanaged')->execute(); <add> $rows = $stmt->fetchAll(); <add> $this->assertCount(2, $rows); <add> <add> $this->manager->shutDown(); <add> $this->assertStringNotContainsString('DROP TABLE', implode('', $buffer->messages())); <add> $this->assertContains('unmanaged', $conn->getSchemaCollection()->listTables()); <add> <add> foreach ($schema->dropSql($conn) as $sql) { <add> $conn->execute($sql); <add> } <add> } <add> <ide> /** <ide> * Test load uses aliased connections via a mock. <ide> *
2
Text
Text
clarify that path on windows accepts / and \
86067f0129a7f0dc30ad867a5a50941ceb00263b
<ide><path>doc/api/path.md <ide> path.isAbsolute('.') // false <ide> On Windows: <ide> <ide> ```js <del>path.isAbsolute('//server') // true <del>path.isAbsolute('C:/foo/..') // true <del>path.isAbsolute('bar\\baz') // false <del>path.isAbsolute('.') // false <add>path.isAbsolute('//server') // true <add>path.isAbsolute('\\\\server') // true <add>path.isAbsolute('C:/foo/..') // true <add>path.isAbsolute('C:\\foo\\..') // true <add>path.isAbsolute('bar\\baz') // false <add>path.isAbsolute('bar/baz') // false <add>path.isAbsolute('.') // false <ide> ``` <ide> <ide> A [`TypeError`][] is thrown if `path` is not a string. <ide> added: v0.11.15 <ide> The `path.win32` property provides access to Windows-specific implementations <ide> of the `path` methods. <ide> <add>*Note*: On Windows, both the forward slash (`/`) and backward slash (`\`) <add>characters are accepted as path delimiters; however, only the backward slash <add>(`\`) will be used in return values. <add> <ide> [`path.posix`]: #path_path_posix <ide> [`path.win32`]: #path_path_win32 <ide> [`path.parse()`]: #path_path_parse_path
1
Go
Go
fix some ineffectual assignments
ba0afd70e89562aa3c668c87fb9191ed9edb7260
<ide><path>integration-cli/docker_cli_build_unix_test.go <ide> func (s *DockerSuite) TestBuildCancellationKillsSleep(c *check.C) { <ide> buildCmd.Dir = ctx.Dir <ide> <ide> stdoutBuild, err := buildCmd.StdoutPipe() <add> c.Assert(err, checker.IsNil) <add> <ide> if err := buildCmd.Start(); err != nil { <ide> c.Fatalf("failed to run build: %s", err) <ide> } <ide><path>integration-cli/docker_cli_commit_test.go <ide> func (s *DockerSuite) TestCommitHardlink(c *check.C) { <ide> imageID, _ := dockerCmd(c, "commit", "hardlinks", "hardlinks") <ide> imageID = strings.TrimSpace(imageID) <ide> <del> secondOutput, _ := dockerCmd(c, "run", "-t", "hardlinks", "ls", "-di", "file1", "file2") <add> secondOutput, _ := dockerCmd(c, "run", "-t", imageID, "ls", "-di", "file1", "file2") <ide> <ide> chunks = strings.Split(strings.TrimSpace(secondOutput), " ") <ide> inode = chunks[0] <ide> func (s *DockerSuite) TestCommitTTY(c *check.C) { <ide> imageID, _ := dockerCmd(c, "commit", "tty", "ttytest") <ide> imageID = strings.TrimSpace(imageID) <ide> <del> dockerCmd(c, "run", "ttytest", "/bin/ls") <add> dockerCmd(c, "run", imageID, "/bin/ls") <ide> } <ide> <ide> func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) { <ide> func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) { <ide> imageID, _ := dockerCmd(c, "commit", "bind-commit", "bindtest") <ide> imageID = strings.TrimSpace(imageID) <ide> <del> dockerCmd(c, "run", "bindtest", "true") <add> dockerCmd(c, "run", imageID, "true") <ide> } <ide> <ide> func (s *DockerSuite) TestCommitChange(c *check.C) { <ide><path>integration-cli/docker_cli_cp_test.go <ide> func (s *DockerSuite) TestCpSpecialFiles(c *check.C) { <ide> <ide> expected, err = readContainerFile(containerID, "hostname") <ide> actual, err = ioutil.ReadFile(outDir + "/hostname") <add> c.Assert(err, checker.IsNil) <ide> <ide> // Expected copied file to be duplicate of the container resolvconf <ide> c.Assert(bytes.Equal(actual, expected), checker.True) <ide> func (s *DockerSuite) TestCpToDot(c *check.C) { <ide> c.Assert(os.Chdir(tmpdir), checker.IsNil) <ide> dockerCmd(c, "cp", containerID+":/test", ".") <ide> content, err := ioutil.ReadFile("./test") <add> c.Assert(err, checker.IsNil) <ide> c.Assert(string(content), checker.Equals, "lololol\n") <ide> } <ide> <ide> func (s *DockerSuite) TestCpNameHasColon(c *check.C) { <ide> defer os.RemoveAll(tmpdir) <ide> dockerCmd(c, "cp", containerID+":/te:s:t", tmpdir) <ide> content, err := ioutil.ReadFile(tmpdir + "/te:s:t") <add> c.Assert(err, checker.IsNil) <ide> c.Assert(string(content), checker.Equals, "lololol\n") <ide> } <ide> <ide> func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) { <ide> dockerCmd(c, "cp", "-L", cleanedContainerID+":"+"/dir_link", expectedPath) <ide> <ide> actual, err = ioutil.ReadFile(expectedPath) <add> c.Assert(err, checker.IsNil) <ide> <ide> if !bytes.Equal(actual, expected) { <ide> c.Fatalf("Expected copied file to be duplicate of the container symbol link target") <ide><path>integration-cli/docker_cli_cp_to_container_test.go <ide> func (s *DockerSuite) TestCpToErrSrcNotDir(c *check.C) { <ide> } <ide> <ide> // Test for error when SRC is a valid file or directory, <del>// bu the DST parent directory does not exist. <add>// but the DST parent directory does not exist. <ide> func (s *DockerSuite) TestCpToErrDstParentNotExists(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> containerID := makeTestContainer(c, testContainerOptions{addContent: true}) <ide> func (s *DockerSuite) TestCpToErrDstParentNotExists(c *check.C) { <ide> // Try with a directory source. <ide> srcPath = cpPath(tmpDir, "dir1") <ide> <add> err = runDockerCp(c, srcPath, dstPath) <ide> c.Assert(err, checker.NotNil) <ide> <ide> c.Assert(isCpNotExist(err), checker.True, check.Commentf("expected IsNotExist error, but got %T: %s", err, err)) <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) { <ide> <ide> containerName := "error-values" <ide> // Make a container with both a non 0 exit code and an error message <del> out, err := s.d.Cmd("run", "--name", containerName, "busybox", "toto") <add> // We explicitly disable `--init` for this test, because `--init` is enabled by default <add> // on "experimental". Enabling `--init` results in a different behavior; because the "init" <add> // process itself is PID1, the container does not fail on _startup_ (i.e., `docker-init` starting), <add> // but directly after. The exit code of the container is still 127, but the Error Message is not <add> // captured, so `.State.Error` is empty. <add> // See the discussion on https://github.com/docker/docker/pull/30227#issuecomment-274161426, <add> // and https://github.com/docker/docker/pull/26061#r78054578 for more information. <add> out, err := s.d.Cmd("run", "--name", containerName, "--init=false", "busybox", "toto") <ide> c.Assert(err, checker.NotNil) <ide> <ide> // Check that those values were saved on disk <ide> func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) { <ide> c.Assert(err, checker.IsNil) <ide> c.Assert(out, checker.Equals, "127") <ide> <del> out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName) <del> out = strings.TrimSpace(out) <add> errMsg1, err := s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName) <add> errMsg1 = strings.TrimSpace(errMsg1) <ide> c.Assert(err, checker.IsNil) <add> c.Assert(errMsg1, checker.Contains, "executable file not found") <ide> <ide> // now restart daemon <ide> s.d.Restart(c) <ide> func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) { <ide> out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName) <ide> out = strings.TrimSpace(out) <ide> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Equals, errMsg1) <ide> } <ide> <ide> func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) { <ide><path>integration-cli/docker_cli_exec_test.go <ide> func (s *DockerSuite) TestExecInspectID(c *check.C) { <ide> // result in a 404 (not 'container not running') <ide> out, ec := dockerCmd(c, "rm", "-f", id) <ide> c.Assert(ec, checker.Equals, 0, check.Commentf("error removing container: %s", out)) <del> sc, body, err = request.SockRequest("GET", "/exec/"+execID+"/json", nil, daemonHost()) <add> sc, body, _ = request.SockRequest("GET", "/exec/"+execID+"/json", nil, daemonHost()) <ide> c.Assert(sc, checker.Equals, http.StatusNotFound, check.Commentf("received status != 404: %d\n%s", sc, body)) <ide> } <ide> <ide><path>integration-cli/docker_cli_external_volume_driver_unix_test.go <ide> func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C <ide> <ide> // make sure hidden --name option conflicts with positional arg name <ide> out, _, err = dockerCmdWithError("volume", "create", "--name", "test2", "test2") <del> c.Assert(err, check.NotNil, check.Commentf("Conflicting options: either specify --name or provide positional arg, not both")) <add> c.Assert(err, check.NotNil) <add> c.Assert(strings.TrimSpace(out), checker.Equals, "Conflicting options: either specify --name or provide positional arg, not both") <ide> } <ide> <ide> func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) { <ide><path>integration-cli/docker_cli_network_unix_test.go <ide> func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) { <ide> <ide> networkResources = []types.NetworkResource{} <ide> err = json.Unmarshal([]byte(result.Stdout()), &networkResources) <add> c.Assert(err, check.IsNil) <ide> c.Assert(networkResources, checker.HasLen, 1) <ide> <ide> // Should print an error and return an exitCode, nothing else <ide><path>integration-cli/docker_cli_pull_local_test.go <ide> func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *check.C) { <ide> dockerCmd(c, "rmi", repoTag1) <ide> dockerCmd(c, "rmi", repoTag2) <ide> <del> out, _, err := dockerCmdWithError("run", repo) <del> c.Assert(err, check.IsNil) <add> out, _ := dockerCmd(c, "run", repo) <ide> c.Assert(out, checker.Contains, fmt.Sprintf("Unable to find image '%s:latest' locally", repo)) <ide> <ide> // There should be only one line for repo, the one with repo:latest <del> outImageCmd, _, err := dockerCmdWithError("images", repo) <add> outImageCmd, _ := dockerCmd(c, "images", repo) <ide> splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n") <ide> c.Assert(splitOutImageCmd, checker.HasLen, 2) <ide> } <ide><path>integration-cli/docker_cli_run_test.go <ide> func (s *DockerSuite) TestRunDNSOptions(c *check.C) { <ide> c.Fatalf("expected 'search mydomain nameserver 127.0.0.1 options ndots:9', but says: %q", actual) <ide> } <ide> <del> out, stderr, _ = dockerCmdWithStdoutStderr(c, "run", "--dns=127.0.0.1", "--dns-search=.", "--dns-opt=ndots:3", "busybox", "cat", "/etc/resolv.conf") <add> out, _ = dockerCmd(c, "run", "--dns=1.1.1.1", "--dns-search=.", "--dns-opt=ndots:3", "busybox", "cat", "/etc/resolv.conf") <ide> <ide> actual = strings.Replace(strings.Trim(strings.Trim(out, "\r\n"), " "), "\n", " ", -1) <del> if actual != "nameserver 127.0.0.1 options ndots:3" { <del> c.Fatalf("expected 'nameserver 127.0.0.1 options ndots:3', but says: %q", actual) <add> if actual != "nameserver 1.1.1.1 options ndots:3" { <add> c.Fatalf("expected 'nameserver 1.1.1.1 options ndots:3', but says: %q", actual) <ide> } <ide> } <ide> <ide> func (s *DockerSuite) TestRunDNSOptionsBasedOnHostResolvConf(c *check.C) { <ide> c.Fatalf("/etc/resolv.conf does not exist") <ide> } <ide> <del> hostNameservers = resolvconf.GetNameservers(resolvConf, types.IP) <ide> hostSearch = resolvconf.GetSearchDomains(resolvConf) <ide> <ide> out, _ = dockerCmd(c, "run", "busybox", "cat", "/etc/resolv.conf") <ide><path>integration-cli/docker_cli_search_test.go <ide> func (s *DockerSuite) TestSearchWithLimit(c *check.C) { <ide> c.Assert(outSlice, checker.HasLen, limit+2) // 1 header, 1 carriage return <ide> <ide> limit = 0 <del> out, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker") <add> _, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker") <ide> c.Assert(err, checker.Not(checker.IsNil)) <ide> <ide> limit = 200 <del> out, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker") <add> _, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker") <ide> c.Assert(err, checker.Not(checker.IsNil)) <ide> } <ide><path>integration-cli/docker_cli_swarm_test.go <ide> func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *check.C) { <ide> _, err = d.Cmd("rm", "-f", cID) <ide> c.Assert(err, checker.IsNil) <ide> <del> out, err = d.Cmd("network", "rm", "testnet") <add> _, err = d.Cmd("network", "rm", "testnet") <ide> c.Assert(err, checker.IsNil) <ide> <ide> checkNetwork := func(*check.C) (interface{}, check.CommentInterface) { <ide><path>pkg/ioutils/buffer_test.go <ide> func TestFixedBufferWrite(t *testing.T) { <ide> } <ide> <ide> n, err = buf.Write(bytes.Repeat([]byte{1}, 64)) <add> if n != 59 { <add> t.Fatalf("expected 59 bytes written before buffer is full, got %d", n) <add> } <ide> if err != errBufferFull { <ide> t.Fatalf("expected errBufferFull, got %v - %v", err, buf.buf[:64]) <ide> }
13
Go
Go
use prctl() from x/sys/unix
6c9d715a8c64a7c782b8c7b57925e1dc19b29517
<ide><path>pkg/sysinfo/sysinfo_linux.go <ide> import ( <ide> "golang.org/x/sys/unix" <ide> ) <ide> <del>const ( <del> // SeccompModeFilter refers to the syscall argument SECCOMP_MODE_FILTER. <del> SeccompModeFilter = uintptr(2) <del>) <del> <ide> func findCgroupMountpoints() (map[string]string, error) { <ide> cgMounts, err := cgroups.GetCgroupMounts(false) <ide> if err != nil { <ide> func New(quiet bool) *SysInfo { <ide> } <ide> <ide> // Check if Seccomp is supported, via CONFIG_SECCOMP. <del> if _, _, err := unix.RawSyscall(unix.SYS_PRCTL, unix.PR_GET_SECCOMP, 0, 0); err != unix.EINVAL { <add> if err := unix.Prctl(unix.PR_GET_SECCOMP, 0, 0, 0, 0); err != unix.EINVAL { <ide> // Make sure the kernel has CONFIG_SECCOMP_FILTER. <del> if _, _, err := unix.RawSyscall(unix.SYS_PRCTL, unix.PR_SET_SECCOMP, SeccompModeFilter, 0); err != unix.EINVAL { <add> if err := unix.Prctl(unix.PR_SET_SECCOMP, unix.SECCOMP_MODE_FILTER, 0, 0, 0); err != unix.EINVAL { <ide> sysInfo.Seccomp = true <ide> } <ide> } <ide><path>pkg/sysinfo/sysinfo_linux_test.go <ide> import ( <ide> "os" <ide> "path" <ide> "path/filepath" <del> "syscall" <ide> "testing" <ide> <ide> "github.com/stretchr/testify/require" <add> "golang.org/x/sys/unix" <ide> ) <ide> <ide> func TestReadProcBool(t *testing.T) { <ide> func TestNew(t *testing.T) { <ide> <ide> func checkSysInfo(t *testing.T, sysInfo *SysInfo) { <ide> // Check if Seccomp is supported, via CONFIG_SECCOMP.then sysInfo.Seccomp must be TRUE , else FALSE <del> if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_GET_SECCOMP, 0, 0); err != syscall.EINVAL { <add> if err := unix.Prctl(unix.PR_GET_SECCOMP, 0, 0, 0, 0); err != unix.EINVAL { <ide> // Make sure the kernel has CONFIG_SECCOMP_FILTER. <del> if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_SECCOMP, SeccompModeFilter, 0); err != syscall.EINVAL { <add> if err := unix.Prctl(unix.PR_SET_SECCOMP, unix.SECCOMP_MODE_FILTER, 0, 0, 0); err != unix.EINVAL { <ide> require.True(t, sysInfo.Seccomp) <ide> } <ide> } else {
2
Text
Text
fix typo in changelog
5e751962b4bf1a589da4bf75632da37c0b7b44a0
<ide><path>railties/CHANGELOG.md <del>* Add Yarn support in new apps using --yarn option. This add a package.json <add>* Add Yarn support in new apps using --yarn option. This adds a package.json <ide> and the settings needed to get npm modules integrated in new apps. <ide> <ide> *Liceth Ovalles*, *Guillermo Iguaran*
1
Go
Go
migrate some copy tests to integration
00d409f03ed825f623b6ef8ec5a3a91cd26194c2
<ide><path>integration-cli/docker_cli_cp_from_container_test.go <ide> import ( <ide> "github.com/go-check/check" <ide> ) <ide> <del>// docker cp CONTAINER:PATH LOCALPATH <del> <ide> // Try all of the test cases from the archive package which implements the <ide> // internals of `docker cp` and ensure that the behavior matches when actually <ide> // copying to and from containers. <ide> import ( <ide> // 3. DST parent directory must exist. <ide> // 4. If DST exists as a file, it must not end with a trailing separator. <ide> <del>// First get these easy error cases out of the way. <del> <del>// Test for error when SRC does not exist. <del>func (s *DockerSuite) TestCpFromErrSrcNotExists(c *check.C) { <del> containerID := makeTestContainer(c, testContainerOptions{}) <del> <del> tmpDir := getTestDir(c, "test-cp-from-err-src-not-exists") <del> defer os.RemoveAll(tmpDir) <del> <del> err := runDockerCp(c, containerCpPath(containerID, "file1"), tmpDir, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotExist(err), checker.True, check.Commentf("expected IsNotExist error, but got %T: %s", err, err)) <del>} <del> <del>// Test for error when SRC ends in a trailing <del>// path separator but it exists as a file. <del>func (s *DockerSuite) TestCpFromErrSrcNotDir(c *check.C) { <del> testRequires(c, DaemonIsLinux) <del> containerID := makeTestContainer(c, testContainerOptions{addContent: true}) <del> <del> tmpDir := getTestDir(c, "test-cp-from-err-src-not-dir") <del> defer os.RemoveAll(tmpDir) <del> <del> err := runDockerCp(c, containerCpPathTrailingSep(containerID, "file1"), tmpDir, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotDir(err), checker.True, check.Commentf("expected IsNotDir error, but got %T: %s", err, err)) <del>} <del> <del>// Test for error when DST ends in a trailing <del>// path separator but exists as a file. <del>func (s *DockerSuite) TestCpFromErrDstNotDir(c *check.C) { <del> testRequires(c, DaemonIsLinux) <del> containerID := makeTestContainer(c, testContainerOptions{addContent: true}) <del> <del> tmpDir := getTestDir(c, "test-cp-from-err-dst-not-dir") <del> defer os.RemoveAll(tmpDir) <del> <del> makeTestContentInDir(c, tmpDir) <del> <del> // Try with a file source. <del> srcPath := containerCpPath(containerID, "/file1") <del> dstPath := cpPathTrailingSep(tmpDir, "file1") <del> <del> err := runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotDir(err), checker.True, check.Commentf("expected IsNotDir error, but got %T: %s", err, err)) <del> <del> // Try with a directory source. <del> srcPath = containerCpPath(containerID, "/dir1") <del> <del> err = runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotDir(err), checker.True, check.Commentf("expected IsNotDir error, but got %T: %s", err, err)) <del>} <del> <ide> // Check that copying from a container to a local symlink copies to the symlink <ide> // target and does not overwrite the local symlink itself. <add>// TODO: move to docker/cli and/or integration/container/copy_test.go <ide> func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> containerID := makeTestContainer(c, testContainerOptions{addContent: true}) <ide><path>integration-cli/docker_cli_cp_to_container_test.go <ide> package main <ide> <ide> import ( <ide> "os" <del> "runtime" <del> "strings" <ide> <ide> "github.com/docker/docker/integration-cli/checker" <ide> "github.com/go-check/check" <ide> ) <ide> <del>// docker cp LOCALPATH CONTAINER:PATH <del> <ide> // Try all of the test cases from the archive package which implements the <ide> // internals of `docker cp` and ensure that the behavior matches when actually <ide> // copying to and from containers. <ide> import ( <ide> // 3. DST parent directory must exist. <ide> // 4. If DST exists as a file, it must not end with a trailing separator. <ide> <del>// First get these easy error cases out of the way. <del> <del>// Test for error when SRC does not exist. <del>func (s *DockerSuite) TestCpToErrSrcNotExists(c *check.C) { <del> containerID := makeTestContainer(c, testContainerOptions{}) <del> <del> tmpDir := getTestDir(c, "test-cp-to-err-src-not-exists") <del> defer os.RemoveAll(tmpDir) <del> <del> srcPath := cpPath(tmpDir, "file1") <del> dstPath := containerCpPath(containerID, "file1") <del> _, srcStatErr := os.Stat(srcPath) <del> c.Assert(os.IsNotExist(srcStatErr), checker.True) <del> <del> err := runDockerCp(c, srcPath, dstPath, nil) <del> if runtime.GOOS == "windows" { <del> // Go 1.9+ on Windows returns a different error for `os.Stat()`, see <del> // https://github.com/golang/go/commit/6144c7270e5812d9de8fb97456ee4e5ae657fcbb#diff-f63e1a4b4377b2fe0b05011db3df9599 <del> // <del> // Go 1.8: CreateFile C:\not-exist: The system cannot find the file specified. <del> // Go 1.9: GetFileAttributesEx C:\not-exist: The system cannot find the file specified. <del> // <del> // Due to the CLI using a different version than the daemon, comparing the <del> // error message won't work, so just hard-code the common part here. <del> // <del> // TODO this should probably be a test in the CLI repository instead <del> c.Assert(strings.ToLower(err.Error()), checker.Contains, "cannot find the file specified") <del> c.Assert(strings.ToLower(err.Error()), checker.Contains, strings.ToLower(tmpDir)) <del> } else { <del> c.Assert(strings.ToLower(err.Error()), checker.Contains, strings.ToLower(srcStatErr.Error())) <del> } <del>} <del> <del>// Test for error when SRC ends in a trailing <del>// path separator but it exists as a file. <del>func (s *DockerSuite) TestCpToErrSrcNotDir(c *check.C) { <del> containerID := makeTestContainer(c, testContainerOptions{}) <del> <del> tmpDir := getTestDir(c, "test-cp-to-err-src-not-dir") <del> defer os.RemoveAll(tmpDir) <del> <del> makeTestContentInDir(c, tmpDir) <del> <del> srcPath := cpPathTrailingSep(tmpDir, "file1") <del> dstPath := containerCpPath(containerID, "testDir") <del> <del> err := runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotDir(err), checker.True, check.Commentf("expected IsNotDir error, but got %T: %s", err, err)) <del>} <del> <del>// Test for error when SRC is a valid file or directory, <del>// but the DST parent directory does not exist. <del>func (s *DockerSuite) TestCpToErrDstParentNotExists(c *check.C) { <del> testRequires(c, DaemonIsLinux) <del> containerID := makeTestContainer(c, testContainerOptions{addContent: true}) <del> <del> tmpDir := getTestDir(c, "test-cp-to-err-dst-parent-not-exists") <del> defer os.RemoveAll(tmpDir) <del> <del> makeTestContentInDir(c, tmpDir) <del> <del> // Try with a file source. <del> srcPath := cpPath(tmpDir, "file1") <del> dstPath := containerCpPath(containerID, "/notExists", "file1") <del> <del> err := runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotExist(err), checker.True, check.Commentf("expected IsNotExist error, but got %T: %s", err, err)) <del> <del> // Try with a directory source. <del> srcPath = cpPath(tmpDir, "dir1") <del> <del> err = runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpNotExist(err), checker.True, check.Commentf("expected IsNotExist error, but got %T: %s", err, err)) <del>} <del> <del>// Test for error when DST ends in a trailing path separator but exists as a <del>// file. Also test that we cannot overwrite an existing directory with a <del>// non-directory and cannot overwrite an existing <del>func (s *DockerSuite) TestCpToErrDstNotDir(c *check.C) { <del> testRequires(c, DaemonIsLinux) <del> containerID := makeTestContainer(c, testContainerOptions{addContent: true}) <del> <del> tmpDir := getTestDir(c, "test-cp-to-err-dst-not-dir") <del> defer os.RemoveAll(tmpDir) <del> <del> makeTestContentInDir(c, tmpDir) <del> <del> // Try with a file source. <del> srcPath := cpPath(tmpDir, "dir1/file1-1") <del> dstPath := containerCpPathTrailingSep(containerID, "file1") <del> <del> // The client should encounter an error trying to stat the destination <del> // and then be unable to copy since the destination is asserted to be a <del> // directory but does not exist. <del> err := runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExist error, but got %T: %s", err, err)) <del> <del> // Try with a directory source. <del> srcPath = cpPath(tmpDir, "dir1") <del> <del> // The client should encounter an error trying to stat the destination and <del> // then decide to extract to the parent directory instead with a rebased <del> // name in the source archive, but this directory would overwrite the <del> // existing file with the same name. <del> err = runDockerCp(c, srcPath, dstPath, nil) <del> c.Assert(err, checker.NotNil) <del> <del> c.Assert(isCannotOverwriteNonDirWithDir(err), checker.True, check.Commentf("expected CannotOverwriteNonDirWithDir error, but got %T: %s", err, err)) <del>} <del> <ide> // Check that copying from a local path to a symlink in a container copies to <ide> // the symlink target and does not overwrite the container symlink itself. <ide> func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) { <ide><path>integration-cli/docker_cli_cp_utils_test.go <ide> func getTestDir(c *check.C, label string) (tmpDir string) { <ide> return <ide> } <ide> <del>func isCpNotExist(err error) bool { <del> return strings.Contains(strings.ToLower(err.Error()), "could not find the file") <del>} <del> <ide> func isCpDirNotExist(err error) bool { <ide> return strings.Contains(err.Error(), archive.ErrDirNotExists.Error()) <ide> } <ide> <del>func isCpNotDir(err error) bool { <del> return strings.Contains(err.Error(), archive.ErrNotDirectory.Error()) || strings.Contains(err.Error(), "filename, directory name, or volume label syntax is incorrect") <del>} <del> <ide> func isCpCannotCopyDir(err error) bool { <ide> return strings.Contains(err.Error(), archive.ErrCannotCopyDir.Error()) <ide> } <ide> func isCpCannotCopyReadOnly(err error) bool { <ide> return strings.Contains(err.Error(), "marked read-only") <ide> } <ide> <del>func isCannotOverwriteNonDirWithDir(err error) bool { <del> return strings.Contains(err.Error(), "cannot overwrite non-directory") <del>} <del> <ide> func fileContentEquals(c *check.C, filename, contents string) (err error) { <ide> c.Logf("checking that file %q contains %q\n", filename, contents) <ide> <ide><path>integration/container/copy_test.go <add>package container // import "github.com/docker/docker/integration/container" <add> <add>import ( <add> "context" <add> "fmt" <add> "testing" <add> <add> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/client" <add> "github.com/docker/docker/integration/internal/container" <add> "github.com/docker/docker/internal/testutil" <add> "github.com/gotestyourself/gotestyourself/skip" <add> "github.com/stretchr/testify/require" <add>) <add> <add>func TestCopyFromContainerPathDoesNotExist(t *testing.T) { <add> defer setupTest(t)() <add> <add> ctx := context.Background() <add> apiclient := testEnv.APIClient() <add> cid := container.Create(t, ctx, apiclient) <add> <add> _, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne") <add> require.True(t, client.IsErrNotFound(err)) <add> expected := fmt.Sprintf("No such container:path: %s:%s", cid, "/dne") <add> testutil.ErrorContains(t, err, expected) <add>} <add> <add>func TestCopyFromContainerPathIsNotDir(t *testing.T) { <add> defer setupTest(t)() <add> skip.If(t, testEnv.OSType == "windows") <add> <add> ctx := context.Background() <add> apiclient := testEnv.APIClient() <add> cid := container.Create(t, ctx, apiclient) <add> <add> _, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/") <add> require.Contains(t, err.Error(), "not a directory") <add>} <add> <add>func TestCopyToContainerPathDoesNotExist(t *testing.T) { <add> defer setupTest(t)() <add> skip.If(t, testEnv.OSType == "windows") <add> <add> ctx := context.Background() <add> apiclient := testEnv.APIClient() <add> cid := container.Create(t, ctx, apiclient) <add> <add> err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{}) <add> require.True(t, client.IsErrNotFound(err)) <add> expected := fmt.Sprintf("No such container:path: %s:%s", cid, "/dne") <add> testutil.ErrorContains(t, err, expected) <add>} <add> <add>func TestCopyToContainerPathIsNotDir(t *testing.T) { <add> defer setupTest(t)() <add> skip.If(t, testEnv.OSType == "windows") <add> <add> ctx := context.Background() <add> apiclient := testEnv.APIClient() <add> cid := container.Create(t, ctx, apiclient) <add> <add> err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{}) <add> require.Contains(t, err.Error(), "not a directory") <add>}
4
PHP
PHP
add deprecation warning for global state usage
8e746c6c7a5e76b73e7e28a1b5089f2dfae70e60
<ide><path>src/Routing/Route/Route.php <ide> namespace Cake\Routing\Route; <ide> <ide> use Cake\Http\ServerRequest; <add>use Cake\Http\ServerRequestFactory; <ide> use Cake\Routing\Router; <ide> use InvalidArgumentException; <ide> use Psr\Http\Message\ServerRequestInterface; <ide> public function parse($url, $method = '') <ide> <ide> if (isset($this->defaults['_method'])) { <ide> if (empty($method)) { <add> deprecationWarning( <add> 'Extracting the request method from global state when parsing routes is deprecated. ' . <add> 'Instead adopt Route::parseRequest() which extracts the method from the passed request.' <add> ); <ide> // Deprecated reading the global state is deprecated and will be removed in 4.x <del> $request = Router::getRequest(true) ?: ServerRequest::createFromGlobals(); <add> $request = Router::getRequest(true) ?: ServerRequestFactory::fromGlobals(); <ide> $method = $request->getMethod(); <ide> } <ide> if (!in_array($method, (array)$this->defaults['_method'], true)) { <ide><path>tests/TestCase/Routing/Route/RouteTest.php <ide> public function testParseWithMultipleHttpMethodConditions() <ide> ]); <ide> $this->assertFalse($route->parse('/sample', 'GET')); <ide> <del> // Test for deprecated behavior <del> $_SERVER['REQUEST_METHOD'] = 'POST'; <ide> $expected = [ <ide> 'controller' => 'posts', <ide> 'action' => 'index', <ide> 'pass' => [], <ide> '_method' => ['PUT', 'POST'], <ide> '_matchedRoute' => '/sample' <ide> ]; <del> $this->assertEquals($expected, $route->parse('/sample')); <add> $this->assertEquals($expected, $route->parse('/sample', 'POST')); <add> } <add> <add> /** <add> * Test deprecated globals reading for method matching <add> * <add> * @group deprecated <add> * @return void <add> */ <add> public function testParseWithMultipleHttpMethodDeprecated() <add> { <add> $this->deprecated(function () { <add> $_SERVER['REQUEST_METHOD'] = 'GET'; <add> $route = new Route('/sample', [ <add> 'controller' => 'posts', <add> 'action' => 'index', <add> '_method' => ['PUT', 'POST'] <add> ]); <add> $this->assertFalse($route->parse('/sample')); <add> <add> $_SERVER['REQUEST_METHOD'] = 'POST'; <add> $expected = [ <add> 'controller' => 'posts', <add> 'action' => 'index', <add> 'pass' => [], <add> '_method' => ['PUT', 'POST'], <add> '_matchedRoute' => '/sample' <add> ]; <add> $this->assertEquals($expected, $route->parse('/sample')); <add> }); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Routing/RouteBuilderTest.php <ide> public function testResourcesInScope() <ide> $this->assertEquals('/api/articles/99.json', $url); <ide> } <ide> <add> /** <add> * Test resource parsing. <add> * <add> * @group deprecated <add> * @return void <add> */ <add> public function testResourcesParsingReadGlobals() <add> { <add> $this->deprecated(function () { <add> $routes = new RouteBuilder($this->collection, '/'); <add> $routes->resources('Articles'); <add> <add> $_SERVER['REQUEST_METHOD'] = 'GET'; <add> $result = $this->collection->parse('/articles'); <add> $this->assertEquals('Articles', $result['controller']); <add> $this->assertEquals('index', $result['action']); <add> $this->assertEquals([], $result['pass']); <add> <add> $_SERVER['REQUEST_METHOD'] = 'POST'; <add> $result = $this->collection->parse('/articles'); <add> $this->assertEquals('Articles', $result['controller']); <add> $this->assertEquals('add', $result['action']); <add> $this->assertEquals([], $result['pass']); <add> }); <add> } <add> <ide> /** <ide> * Test resource parsing. <ide> * <ide> public function testResourcesParsing() <ide> $routes = new RouteBuilder($this->collection, '/'); <ide> $routes->resources('Articles'); <ide> <del> $_SERVER['REQUEST_METHOD'] = 'GET'; <del> $result = $this->collection->parse('/articles'); <add> $result = $this->collection->parse('/articles', 'GET'); <ide> $this->assertEquals('Articles', $result['controller']); <ide> $this->assertEquals('index', $result['action']); <ide> $this->assertEquals([], $result['pass']); <ide> <del> $result = $this->collection->parse('/articles/1'); <add> $result = $this->collection->parse('/articles/1', 'GET'); <ide> $this->assertEquals('Articles', $result['controller']); <ide> $this->assertEquals('view', $result['action']); <ide> $this->assertEquals([1], $result['pass']); <ide> <del> $_SERVER['REQUEST_METHOD'] = 'POST'; <del> $result = $this->collection->parse('/articles'); <add> $result = $this->collection->parse('/articles', 'POST'); <ide> $this->assertEquals('Articles', $result['controller']); <ide> $this->assertEquals('add', $result['action']); <ide> $this->assertEquals([], $result['pass']); <ide> <del> $_SERVER['REQUEST_METHOD'] = 'PUT'; <del> $result = $this->collection->parse('/articles/1'); <add> $result = $this->collection->parse('/articles/1', 'PUT'); <ide> $this->assertEquals('Articles', $result['controller']); <ide> $this->assertEquals('edit', $result['action']); <ide> $this->assertEquals([1], $result['pass']); <ide> <del> $_SERVER['REQUEST_METHOD'] = 'DELETE'; <del> $result = $this->collection->parse('/articles/1'); <add> $result = $this->collection->parse('/articles/1', 'DELETE'); <ide> $this->assertEquals('Articles', $result['controller']); <ide> $this->assertEquals('delete', $result['action']); <ide> $this->assertEquals([1], $result['pass']);
3
PHP
PHP
replace network with http
56698ec023179ece25b56cb65fc39c8096b6bb57
<ide><path>src/Routing/Router.php <ide> public static function reverseToArray($params) <ide> * are used for CakePHP internals and should not normally be part of an output URL. <ide> * <ide> * @param \Cake\Http\ServerRequest|array $params The params array or <del> * Cake\Network\Request object that needs to be reversed. <add> * Cake\Http\ServerRequest object that needs to be reversed. <ide> * @param bool $full Set to true to include the full URL including the <ide> * protocol when reversing the URL. <ide> * @return string The string that is the reversed result of the array <ide><path>tests/test_app/TestApp/Controller/PostsController.php <ide> public function index($layout = 'default') <ide> /** <ide> * Sets a flash message and redirects (no rendering) <ide> * <del> * @return \Cake\Network\Response <add> * @return \Cake\Http\Response <ide> */ <ide> public function flashNoRender() <ide> {
2
Ruby
Ruby
favor composition over inheritance
494610792530bc21f5c284a4eb66278b07953a5b
<ide><path>railties/lib/rails/paths.rb <ide> module Paths <ide> # path.eager_load? # => true <ide> # path.is_a?(Rails::Paths::Path) # => true <ide> # <del> # The +Path+ object is simply an array and allows you to easily add extra paths: <add> # The +Path+ object is simply an enumerable and allows you to easily add extra paths: <ide> # <del> # path.is_a?(Array) # => true <del> # path.inspect # => ["app/controllers"] <add> # path.is_a?(Enumerable) # => true <add> # path.to_ary.inspect # => ["app/controllers"] <ide> # <ide> # path << "lib/controllers" <del> # path.inspect # => ["app/controllers", "lib/controllers"] <add> # path.to_ary.inspect # => ["app/controllers", "lib/controllers"] <ide> # <ide> # Notice that when you add a path using +add+, the path object created already <ide> # contains the path with the same path value given to +add+. In some situations, <ide> def filter_by(constraint) <ide> end <ide> end <ide> <del> class Path < Array <add> class Path <add> include Enumerable <add> <ide> attr_reader :path <ide> attr_accessor :glob <ide> <ide> def initialize(root, current, paths, options = {}) <del> super(paths) <del> <add> @paths = paths <ide> @current = current <ide> @root = root <ide> @glob = options[:glob] <ide> def #{m}? # def eager_load? <ide> RUBY <ide> end <ide> <add> def each(&block) <add> @paths.each &block <add> end <add> <add> def <<(path) <add> @paths << path <add> end <add> alias :push :<< <add> <add> def concat(paths) <add> @paths.concat paths <add> end <add> <add> def unshift(path) <add> @paths.unshift path <add> end <add> <add> def to_ary <add> @paths <add> end <add> <ide> # Expands all paths against the root and return all unique values. <ide> def expanded <ide> raise "You need to set a path root" unless @root.path <ide><path>railties/test/paths_test.rb <ide> def setup <ide> root = Rails::Paths::Root.new(nil) <ide> root.add "app" <ide> root.path = "/root" <del> assert_equal ["app"], root["app"] <add> assert_equal ["app"], root["app"].to_ary <ide> assert_equal ["/root/app"], root["app"].to_a <ide> end <ide>
2
PHP
PHP
change visibility of some belongstomany methods
601e395a130df9f673de1d62d58a255e75fdfffa
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php <ide> protected function attachNew(array $records, array $current, $touch = true) <ide> * @param bool $touch <ide> * @return void <ide> */ <del> protected function updateExistingPivot($id, array $attributes, $touch) <add> public function updateExistingPivot($id, array $attributes, $touch) <ide> { <ide> if (in_array($this->updatedAt(), $this->pivotColumns)) <ide> { <ide> public function newPivotStatement() <ide> * @param mixed $id <ide> * @return \Illuminate\Database\Query\Builder <ide> */ <del> protected function newPivotStatementForId($id) <add> public function newPivotStatementForId($id) <ide> { <ide> $pivot = $this->newPivotStatement(); <ide> <ide> public function getTable() <ide> return $this->table; <ide> } <ide> <del>} <ide>\ No newline at end of file <add>}
1
Javascript
Javascript
fix scope issue
30e3cfe40679f2247179bfe54f4768f2cbbc8161
<ide><path>packages/react-dom/src/events/DOMPluginEventSystem.js <ide> export function accumulateSinglePhaseListeners( <ide> enableCreateEventHandleAPI && <ide> enableScopeAPI && <ide> tag === ScopeComponent && <del> lastHostComponent !== null <add> lastHostComponent !== null && <add> stateNode !== null <ide> ) { <ide> const reactScopeInstance = stateNode; <ide> const eventHandlerlisteners = getEventHandlerListeners(
1
Text
Text
add v4.8.1 to changelog
53ca013f87509315200c5969a8f55417af913786
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v4.8.1 (November 2, 2022) <add> <add>- [CVE pending](https://emberjs.com/blog/ember-4-8-1-released) Fix a prototype pollution vulnerability in `set` and `setProperties` <add> <ide> ### v4.4.4 (November 2, 2022) <ide> <ide> - [CVE pending](https://emberjs.com/blog/ember-4-8-1-released) Fix a prototype pollution vulnerability in `set` and `setProperties
1
Javascript
Javascript
fix typo on $eval
c0b9e94dec21a89784febd96fbd2036abb31b14f
<ide><path>src/ng/rootScope.js <ide> function $RootScopeProvider(){ <ide> * <ide> * @description <ide> * Executes the `expression` on the current scope returning the result. Any exceptions in the <del> * expression are propagated (uncaught). This is useful when evaluating engular expressions. <add> * expression are propagated (uncaught). This is useful when evaluating Angular expressions. <ide> * <ide> * # Example <ide> * <pre>
1
Ruby
Ruby
use digest#file if it's available
93d8e716410bdf04346791e64b7446528371dfed
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def text_executable? <ide> %r[^#!\s*\S+] === open('r') { |f| f.read(1024) } <ide> end <ide> <del> def incremental_hash(hasher) <del> incr_hash = hasher.new <del> buf = "" <del> open('rb') { |f| incr_hash << buf while f.read(1024, buf) } <del> incr_hash.hexdigest <add> def incremental_hash(klass) <add> digest = klass.new <add> if digest.respond_to?(:file) <add> digest.file(self) <add> else <add> buf = "" <add> open("rb") { |f| digest << buf while f.read(1024, buf) } <add> end <add> digest.hexdigest <ide> end <ide> <ide> def sha1
1
Javascript
Javascript
touch support to trackballcontrols
5816003656333fd317e5b978ee52e2ffbb7d7c26
<ide><path>examples/js/controls/TrackballControls.js <ide> THREE.TrackballControls = function ( object, domElement ) { <ide> <ide> } <ide> <add> function touchstart( event ) { <add> <add> if ( ! _this.enabled ) return; <add> <add> event.preventDefault(); <add> <add> switch ( event.touches.length ) { <add> <add> case 1: <add> _rotateStart = _rotateEnd = _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); <add> break; <add> case 2: <add> _zoomStart = _zoomEnd = _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); <add> break; <add> case 3: <add> _panStart = _panEnd = _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); <add> break; <add> <add> } <add> <add> } <add> <add> function touchmove( event ) { <add> <add> if ( ! _this.enabled ) return; <add> <add> event.preventDefault(); <add> <add> switch ( event.touches.length ) { <add> <add> case 1: <add> _rotateEnd = _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); <add> break; <add> case 2: <add> _zoomEnd = _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); <add> break; <add> case 3: <add> _panEnd = _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); <add> break; <add> <add> } <add> <add> } <add> <ide> this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false ); <ide> <ide> this.domElement.addEventListener( 'mousedown', mousedown, false ); <del> this.domElement.addEventListener( 'DOMMouseScroll', mousewheel, false ); <add> <ide> this.domElement.addEventListener( 'mousewheel', mousewheel, false ); <add> this.domElement.addEventListener( 'DOMMouseScroll', mousewheel, false ); // firefox <add> <add> this.domElement.addEventListener( 'touchstart', touchstart, false ); <add> this.domElement.addEventListener( 'touchend', touchstart, false ); <add> this.domElement.addEventListener( 'touchmove', touchmove, false ); <ide> <ide> window.addEventListener( 'keydown', keydown, false ); <ide> window.addEventListener( 'keyup', keyup, false );
1
Python
Python
reduce tests for applications
1365ed5d9a872631b0d451f8508cc61d79228dc0
<ide><path>tests/integration_tests/applications_test.py <ide> reason='Runs only when the relevant files have been modified.') <ide> <ide> <del>MOBILENET_LIST = [(applications.MobileNet, 1024), <del> (applications.MobileNetV2, 1280)] <del>DENSENET_LIST = [(applications.DenseNet121, 1024), <del> (applications.DenseNet169, 1664), <del> (applications.DenseNet201, 1920)] <del>NASNET_LIST = [(applications.NASNetMobile, 1056), <del> (applications.NASNetLarge, 4032)] <add>MODEL_LIST = [ <add> (applications.ResNet50, 2048), <add> (applications.VGG16, 512), <add> (applications.VGG19, 512), <add> (applications.Xception, 2048), <add> (applications.InceptionV3, 2048), <add> (applications.InceptionResNetV2, 1536), <add> (applications.MobileNet, 1024), <add> (applications.MobileNetV2, 1280), <add> (applications.DenseNet121, 1024), <add> (applications.DenseNet169, 1664), <add> (applications.DenseNet201, 1920) <add> # TODO: enable nasnet tests if they support Theano and CNTK <add> # (applications.NASNetMobile, 1056), <add> # (applications.NASNetLarge, 4032) <add>] <ide> <ide> <ide> def _get_output_shape(model_fn): <ide> def _test_application_notop(app, last_dim): <ide> assert output_shape == (None, None, None, last_dim) <ide> <ide> <del>@keras_test <del>def _test_application_variable_input_channels(app, last_dim): <del> if K.image_data_format() == 'channels_first': <del> input_shape = (1, None, None) <del> else: <del> input_shape = (None, None, 1) <del> output_shape = _get_output_shape( <del> lambda: app(weights=None, include_top=False, input_shape=input_shape)) <del> assert output_shape == (None, None, None, last_dim) <del> <del> if K.image_data_format() == 'channels_first': <del> input_shape = (4, None, None) <del> else: <del> input_shape = (None, None, 4) <del> output_shape = _get_output_shape( <del> lambda: app(weights=None, include_top=False, input_shape=input_shape)) <del> assert output_shape == (None, None, None, last_dim) <del> <del> <del>@keras_test <del>def _test_app_pooling(app, last_dim): <del> output_shape = _get_output_shape( <del> lambda: app(weights=None, <del> include_top=False, <del> pooling=random.choice(['avg', 'max']))) <del> assert output_shape == (None, last_dim) <del> <del> <del>def test_resnet50(): <del> app = applications.ResNet50 <del> last_dim = 2048 <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>def test_vgg(): <del> app = random.choice([applications.VGG16, applications.VGG19]) <del> last_dim = 512 <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>def test_xception(): <del> app = applications.Xception <del> last_dim = 2048 <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>def test_inceptionv3(): <del> app = applications.InceptionV3 <del> last_dim = 2048 <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>def test_inceptionresnetv2(): <del> app = applications.InceptionResNetV2 <del> last_dim = 1536 <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>def test_mobilenet(): <del> app, last_dim = random.choice(MOBILENET_LIST) <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>def test_densenet(): <del> app, last_dim = random.choice(DENSENET_LIST) <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <del> <del> <del>@pytest.mark.skipif((K.backend() != 'tensorflow'), <del> reason='NASNets are supported only on TensorFlow') <del>def test_nasnet(): <del> app, last_dim = random.choice(NASNET_LIST) <del> _test_application_basic(app) <del> _test_application_notop(app, last_dim) <del> _test_application_variable_input_channels(app, last_dim) <del> _test_app_pooling(app, last_dim) <add>def test_applications(): <add> for _ in range(3): <add> app, last_dim = random.choice(MODEL_LIST) <add> _test_application_basic(app) <add> _test_application_notop(app, last_dim) <ide> <ide> <ide> if __name__ == '__main__':
1
Text
Text
add instructions to re-seed the changed files
762ac787b98279df60c0053973d3e02804514bd7
<ide><path>CONTRIBUTING.md <ide> For more about creating challenges, see [seed/README](seed/README.md) and [seed/ <ide> <ide> #### Changes to the seed files <ide> <del>If you made changes to any file in the `/seed` directory, you need to run <add>If you made changes to any file in the `/seed` directory, you then need to stop the server by typing CTRL-C, then you need to run <ide> ```shell <ide> $ node seed <ide> ``` <del>in order to see the changes. <add>Then run <add>```shell <add>$ npm run develop <add>``` <add>in order to restart the server and see the changes you just made to the files. <ide> <ide> ### Run The Test Suite <ide>
1
Javascript
Javascript
fix script after video dom
fd798f3dac7f8594ffc492b5d02bf2426d050ca4
<ide><path>src/js/setup.js <ide> vjs.one(window, 'load', function(){ <ide> }); <ide> <ide> // Run Auto-load players <del>vjs.autoSetup(); <add>// You have to wait at least once in case this script is loaded after your video in the DOM (weird behavior only with minified version) <add>vjs.autoSetupTimeout(1);
1
Javascript
Javascript
omit transitionhydrationlane from transitionlanes
483358c38f8623358dd44a3e57476bc02e6357bc
<ide><path>packages/react-reconciler/src/ReactFiberLane.new.js <ide> const InputContinuousLane: Lanes = /* */ 0b0000000000000000000 <ide> export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000001000000; <ide> export const DefaultLane: Lanes = /* */ 0b0000000000000000000000010000000; <ide> <del>const TransitionLanes: Lanes = /* */ 0b0000000011111111111111100000000; <ide> const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000100000000; <add>const TransitionLanes: Lanes = /* */ 0b0000000011111111111111000000000; <ide> const TransitionLane1: Lane = /* */ 0b0000000000000000000001000000000; <ide> const TransitionLane2: Lane = /* */ 0b0000000000000000000010000000000; <ide> const TransitionLane3: Lane = /* */ 0b0000000000000000000100000000000; <ide><path>packages/react-reconciler/src/ReactFiberLane.old.js <ide> const InputContinuousLane: Lanes = /* */ 0b0000000000000000000 <ide> export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000001000000; <ide> export const DefaultLane: Lanes = /* */ 0b0000000000000000000000010000000; <ide> <del>const TransitionLanes: Lanes = /* */ 0b0000000011111111111111100000000; <ide> const TransitionHydrationLane: Lane = /* */ 0b0000000000000000000000100000000; <add>const TransitionLanes: Lanes = /* */ 0b0000000011111111111111000000000; <ide> const TransitionLane1: Lane = /* */ 0b0000000000000000000001000000000; <ide> const TransitionLane2: Lane = /* */ 0b0000000000000000000010000000000; <ide> const TransitionLane3: Lane = /* */ 0b0000000000000000000100000000000;
2
PHP
PHP
add separate method to discover plugin commands
d96c60094a280f6823a0bb85b18561f19dd700c5
<ide><path>src/Console/CommandCollection.php <ide> public function count() <ide> return count($this->commands); <ide> } <ide> <add> /** <add> * Auto-discover shell & commands from the named plugin. <add> * <add> * Discovered commands will have their names de-duplicated with <add> * existing commands in the collection. If a command is already <add> * defined in the collection and discovered in a plugin, only <add> * the long name (`plugin.command`) will be returned. <add> * <add> * @param string $plugin The plugin to scan. <add> * @return array Discovered plugin commands. <add> */ <add> public function discoverPlugin($plugin) <add> { <add> $scanner = new CommandScanner(); <add> $shells = $scanner->scanPlugin($plugin); <add> <add> return $this->resolveNames($shells); <add> } <add> <add> /** <add> * Resolve names based on existing commands <add> * <add> * @param array $input The results of a CommandScanner operation. <add> * @return array A flat map of command names => class names. <add> */ <add> protected function resolveNames(array $input) <add> { <add> $out = []; <add> foreach ($input as $info) { <add> $name = $info['name']; <add> $addLong = $name !== $info['fullName']; <add> <add> // If the short name has been used, use the full name. <add> // This allows app shells to have name preference. <add> // and app shells to overwrite core shells. <add> if ($this->has($name) && $addLong) { <add> $name = $info['fullName']; <add> } <add> <add> $out[$name] = $info['class']; <add> if ($addLong) { <add> $out[$info['fullName']] = $info['class']; <add> } <add> } <add> <add> return $out; <add> } <add> <ide> /** <ide> * Automatically discover shell commands in CakePHP, the application and all plugins. <ide> * <ide> public function count() <ide> * <ide> * - CakePHP provided commands <ide> * - Application commands <del> * - Plugin commands <ide> * <del> * Commands from plugins will be added based on the order plugins are loaded. <del> * Plugin shells will attempt to use a short name. If however, a plugin <del> * provides a shell that conflicts with CakePHP or the application shells, <del> * the full `plugin_name.shell` name will be used. Plugin shells are added <del> * in the order that plugins were loaded. <add> * Commands defined in the application will ovewrite commands with <add> * the same name provided by CakePHP. <ide> * <ide> * @return array An array of command names and their classes. <ide> */ <ide> public function autoDiscover() <ide> { <ide> $scanner = new CommandScanner(); <del> $shells = $scanner->scanAll(); <ide> <del> $adder = function ($out, $shells, $key) { <del> if (empty($shells[$key])) { <del> return $out; <del> } <del> <del> foreach ($shells[$key] as $info) { <del> $name = $info['name']; <del> $addLong = $name !== $info['fullName']; <del> <del> // If the short name has been used, use the full name. <del> // This allows app shells to have name preference. <del> // and app shells to overwrite core shells. <del> if (isset($out[$name]) && $addLong) { <del> $name = $info['fullName']; <del> } <del> <del> $out[$name] = $info['class']; <del> if ($addLong) { <del> $out[$info['fullName']] = $info['class']; <del> } <del> } <del> <del> return $out; <del> }; <add> $core = $this->resolveNames($scanner->scanCore()); <add> $app = $this->resolveNames($scanner->scanApp()); <ide> <del> $out = $adder([], $shells, 'CORE'); <del> $out = $adder($out, $shells, 'app'); <del> foreach (array_keys($shells['plugins']) as $key) { <del> $out = $adder($out, $shells['plugins'], $key); <del> } <del> <del> return $out; <add> return array_merge($core, $app); <ide> } <ide> } <ide><path>src/Console/CommandScanner.php <ide> use Cake\Core\Plugin; <ide> use Cake\Filesystem\Folder; <ide> use Cake\Utility\Inflector; <add>use InvalidArgumentException; <ide> <ide> /** <ide> * Used by CommandCollection and CommandTask to scan the filesystem <ide> */ <ide> class CommandScanner <ide> { <del> /** <del> * Scan CakePHP core, the applications and plugins for shell classes <del> * <del> * @return array <del> */ <del> public function scanAll() <del> { <del> $shellList = [ <del> 'CORE' => $this->scanCore(), <del> 'app' => $this->scanApp(), <del> 'plugins' => $this->scanPlugins() <del> ]; <del> <del> return $shellList; <del> } <del> <ide> /** <ide> * Scan CakePHP internals for shells & commands. <ide> * <ide> * @return array A list of command metadata. <ide> */ <del> protected function scanCore() <add> public function scanCore() <ide> { <ide> $coreShells = $this->scanDir( <ide> dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Shell' . DIRECTORY_SEPARATOR, <ide> protected function scanCore() <ide> * <ide> * @return array A list of command metadata. <ide> */ <del> protected function scanApp() <add> public function scanApp() <ide> { <ide> $appNamespace = Configure::read('App.namespace'); <ide> $appShells = $this->scanDir( <ide> protected function scanApp() <ide> } <ide> <ide> /** <del> * Scan the plugins for shells & commands. <add> * Scan the named plugin for shells and commands <ide> * <add> * @param string $plugin The named plugin. <ide> * @return array A list of command metadata. <ide> */ <del> protected function scanPlugins() <add> public function scanPlugin($plugin) <ide> { <del> $plugins = []; <del> foreach (Plugin::loaded() as $plugin) { <del> $path = Plugin::classPath($plugin); <del> $namespace = str_replace('/', '\\', $plugin); <del> $prefix = Inflector::underscore($plugin) . '.'; <del> <del> $commands = $this->scanDir($path . 'Command', $namespace . '\Command\\', $prefix, []); <del> $shells = $this->scanDir($path . 'Shell', $namespace . '\Shell\\', $prefix, []); <del> <del> $plugins[$plugin] = array_merge($shells, $commands); <add> if (!Plugin::loaded($plugin)) { <add> return []; <ide> } <add> $path = Plugin::classPath($plugin); <add> $namespace = str_replace('/', '\\', $plugin); <add> $prefix = Inflector::underscore($plugin) . '.'; <add> <add> $commands = $this->scanDir($path . 'Command', $namespace . '\Command\\', $prefix, []); <add> $shells = $this->scanDir($path . 'Shell', $namespace . '\Shell\\', $prefix, []); <ide> <del> return $plugins; <add> return array_merge($shells, $commands); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Console/CommandCollectionTest.php <ide> use Cake\Shell\I18nShell; <ide> use Cake\Shell\RoutesShell; <ide> use Cake\TestSuite\TestCase; <add>use InvalidArgumentException; <ide> use stdClass; <ide> use TestApp\Command\DemoCommand; <ide> <ide> public function testAutoDiscoverCore() <ide> $this->assertSame('Cake\Command\VersionCommand', $collection->get('version')); <ide> } <ide> <add> /** <add> * test missing plugin discovery <add> * <add> * @return void <add> */ <add> public function testDiscoverPluginUnknown() <add> { <add> $this->assertSame([], $collection = new CommandCollection()); <add> } <add> <ide> /** <ide> * test autodiscovering plugin shells <ide> * <ide> * @return void <ide> */ <del> public function testAutoDiscoverPlugin() <add> public function testDiscoverPlugin() <ide> { <ide> Plugin::load('TestPlugin'); <ide> Plugin::load('Company/TestPluginThree'); <add> <ide> $collection = new CommandCollection(); <del> $collection->addMany($collection->autoDiscover()); <add> // Add a dupe to test de-duping <add> $collection->add('sample', DemoCommand::class); <ide> <del> $this->assertTrue( <del> $collection->has('example'), <add> $result = $collection->discoverPlugin('TestPlugin'); <add> <add> $this->assertArrayHasKey( <add> 'example', <add> $result, <ide> 'Used short name for unique plugin shell' <ide> ); <del> $this->assertTrue( <del> $collection->has('test_plugin.example'), <add> $this->assertArrayHasKey( <add> 'test_plugin.example', <add> $result, <ide> 'Long names are stored for unique shells' <ide> ); <del> $this->assertTrue( <del> $collection->has('sample'), <del> 'Has app shell' <del> ); <del> $this->assertTrue( <del> $collection->has('test_plugin.sample'), <add> $this->assertArrayNotHasKey('sample', $result, 'Existing command not output'); <add> $this->assertArrayHasKey( <add> 'test_plugin.sample', <add> $result, <ide> 'Duplicate shell was given a full alias' <ide> ); <del> $this->assertTrue( <del> $collection->has('company'), <add> $this->assertEquals('TestPlugin\Shell\ExampleShell', $result['example']); <add> $this->assertEquals($result['example'], $result['test_plugin.example']); <add> $this->assertEquals('TestPlugin\Shell\SampleShell', $result['test_plugin.sample']); <add> <add> $result = $collection->discoverPlugin('Company/TestPluginThree'); <add> $this->assertArrayHasKey( <add> 'company', <add> $result, <ide> 'Used short name for unique plugin shell' <ide> ); <del> $this->assertTrue( <del> $collection->has('company/test_plugin_three.company'), <add> $this->assertArrayHasKey( <add> 'company/test_plugin_three.company', <add> $result, <ide> 'Long names are stored as well' <ide> ); <del> <del> $this->assertEquals('TestPlugin\Shell\ExampleShell', $collection->get('example')); <del> $this->assertEquals($collection->get('example'), $collection->get('test_plugin.example')); <del> $this->assertEquals( <del> 'TestApp\Shell\SampleShell', <del> $collection->get('sample'), <del> 'Should prefer app shells over plugin ones' <del> ); <del> $this->assertEquals('TestPlugin\Shell\SampleShell', $collection->get('test_plugin.sample')); <add> $this->assertSame($result['company'], $result['company/test_plugin_three.company']); <ide> } <ide> }
3
Python
Python
fix bug in the clean up code
784b67cdef76dfb31c7722371aeb955829bf9106
<ide><path>integration/storage/test_azure_blobs.py <ide> <ide> from integration.storage.base import Integration, random_string <ide> <add># Prefix which is added to all the groups created by tests <add>RESOURCE_GROUP_NAME_PREFIX = 'libcloud' <add># RESOURCE_GROUP_NAME_PREFIX = 'libcloud-tests-' <ide> DEFAULT_TIMEOUT_SECONDS = 300 <ide> DEFAULT_AZURE_LOCATION = 'EastUS2' <ide> MAX_STORAGE_ACCOUNT_NAME_LENGTH = 24 <ide> def setUpClass(cls): <ide> ) <ide> <ide> location = os.getenv('AZURE_LOCATION', DEFAULT_AZURE_LOCATION) <del> name = 'libcloud-itests-' <del> name = 'libcloud' <add> name = RESOURCE_GROUP_NAME_PREFIX <ide> name += random_string(MAX_STORAGE_ACCOUNT_NAME_LENGTH - len(name)) <ide> timeout = float(os.getenv('AZURE_TIMEOUT_SECONDS', DEFAULT_TIMEOUT_SECONDS)) <ide> <ide> def setUpClass(cls): <ide> resource_create_ts = int(resource_group.tags.get('create_ts', <ide> delete_threshold_ts - 100)) <ide> <del> if resource_group.name.startswith(name) and resource_group.location == location and \ <add> if resource_group.name.startswith(RESOURCE_GROUP_NAME_PREFIX) and \ <add> resource_group.location.lower() == location.lower() and \ <ide> 'test' in resource_group.tags and resource_create_ts <= delete_threshold_ts: <ide> print("Deleting old stray resource group: %s..." % (resource_group.name)) <ide>
1
Javascript
Javascript
add hasevent method for sniffing events
a22e0699bef61a7083b0b628fb6043531c0ca1c0
<ide><path>src/ng/sniffer.js <ide> * @description <ide> * This is very simple implementation of testing browser's features. <ide> */ <del>function $SnifferProvider(){ <del> this.$get = ['$window', function($window){ <add>function $SnifferProvider() { <add> this.$get = ['$window', function($window) { <add> var eventSupport = {}; <add> <ide> return { <ide> history: !!($window.history && $window.history.pushState), <ide> hashchange: 'onhashchange' in $window && <ide> // IE8 compatible mode lies <del> (!$window.document.documentMode || $window.document.documentMode > 7) <add> (!$window.document.documentMode || $window.document.documentMode > 7), <add> hasEvent: function(event) { <add> if (isUndefined(eventSupport[event])) { <add> var divElm = $window.document.createElement('div'); <add> eventSupport[event] = 'on' + event in divElm; <add> } <add> <add> return eventSupport[event]; <add> } <ide> }; <ide> }]; <ide> } <ide><path>test/ng/snifferSpec.js <ide> describe('$sniffer', function() { <ide> expect(sniffer({onhashchange: true, document: {documentMode: 7}}).hashchange).toBe(false); <ide> }); <ide> }); <add> <add> <add> describe('hasEvent', function() { <add> var mockDocument, mockDivElement, $sniffer; <add> <add> beforeEach(function() { <add> mockDocument = {createElement: jasmine.createSpy('createElement')}; <add> mockDocument.createElement.andCallFake(function(elm) { <add> if (elm === 'div') return mockDivElement; <add> }); <add> <add> $sniffer = sniffer({document: mockDocument}); <add> }); <add> <add> <add> it('should return true if "oninput" is present in a div element', function() { <add> mockDivElement = {oninput: noop}; <add> <add> expect($sniffer.hasEvent('input')).toBe(true); <add> }); <add> <add> <add> it('should return false if "oninput" is not present in a div element', function() { <add> mockDivElement = {}; <add> <add> expect($sniffer.hasEvent('input')).toBe(false); <add> }); <add> <add> <add> it('should only create the element once', function() { <add> mockDivElement = {}; <add> <add> $sniffer.hasEvent('input'); <add> $sniffer.hasEvent('input'); <add> $sniffer.hasEvent('input'); <add> <add> expect(mockDocument.createElement).toHaveBeenCalledOnce(); <add> }); <add> }); <ide> });
2
Javascript
Javascript
add resourcequery to contextmodule identifier
b608ee7f7b82c06384f57d85e969e506a757a75c
<ide><path>lib/ContextModule.js <ide> class ContextModule extends Module { <ide> <ide> identifier() { <ide> let identifier = this.context; <add> if(this.options.resourceQuery) <add> identifier += ` ${this.options.resourceQuery}`; <ide> if(this.options.mode) <ide> identifier += ` ${this.options.mode}`; <ide> if(!this.options.recursive) <ide> class ContextModule extends Module { <ide> <ide> readableIdentifier(requestShortener) { <ide> let identifier = requestShortener.shorten(this.context); <add> if(this.options.resourceQuery) <add> identifier += ` ${this.options.resourceQuery}`; <ide> if(this.options.mode) <ide> identifier += ` ${this.options.mode}`; <ide> if(!this.options.recursive)
1
Text
Text
fix typo in test runner code examples
391690c9822c734c544ef78ee7e3e3edc789f0ea
<ide><path>doc/api/test.md <ide> before each subtest of the current suite. <ide> <ide> ```js <ide> describe('tests', async () => { <del> beforeEach(() => t.diagnostics('about to run a test')); <add> beforeEach(() => t.diagnostic('about to run a test')); <ide> it('is a subtest', () => { <ide> assert.ok('some relevant assertion here'); <ide> }); <ide> after each subtest of the current test. <ide> <ide> ```js <ide> describe('tests', async () => { <del> afterEach(() => t.diagnostics('about to run a test')); <add> afterEach(() => t.diagnostic('about to run a test')); <ide> it('is a subtest', () => { <ide> assert.ok('some relevant assertion here'); <ide> }); <ide> before each subtest of the current test. <ide> <ide> ```js <ide> test('top level test', async (t) => { <del> t.beforeEach((t) => t.diagnostics(`about to run ${t.name}`)); <add> t.beforeEach((t) => t.diagnostic(`about to run ${t.name}`)); <ide> await t.test( <ide> 'This is a subtest', <ide> (t) => { <ide> after each subtest of the current test. <ide> <ide> ```js <ide> test('top level test', async (t) => { <del> t.afterEach((t) => t.diagnostics(`finished running ${t.name}`)); <add> t.afterEach((t) => t.diagnostic(`finished running ${t.name}`)); <ide> await t.test( <ide> 'This is a subtest', <ide> (t) => {
1
Text
Text
fix small typos in documentation files
d1e72baa15fb81a6dcf80e6727b884fc8ff67335
<ide><path>docs/misc/deprecated.md <ide> The following double-dash options are deprecated and have no replacement: <ide> docker search --trusted <ide> <ide> ### Auto-creating missing host paths for bind mounts <del>**Deprected in Release: v1.9** <add>**Deprecated in Release: v1.9** <ide> <ide> **Target for Removal in Release: 1.11** <ide> <ide><path>docs/reference/api/docker_remote_api.md <ide> container. Previously this was only available when starting a container. <ide> * `DELETE /containers/(id)` when using `force`, the container will be immediately killed with SIGKILL. <ide> * `POST /containers/(id)/start` the `hostConfig` option accepts the field `CapAdd`, which specifies a list of capabilities <ide> to add, and the field `CapDrop`, which specifies a list of capabilities to drop. <del>* `POST /images/create` th `fromImage` and `repo` parameters supportthe <add>* `POST /images/create` th `fromImage` and `repo` parameters support the <ide> `repo:tag` format. Consequently, the `tag` parameter is now obsolete. Using the <ide> new format and the `tag` parameter at the same time will return an error. <ide><path>pkg/locker/README.md <ide> func (i *important) Create(name string, data interface{}) { <ide> i.locks.Lock(name) <ide> defer i.locks.Unlock(name) <ide> <del> i.createImporatant(data) <add> i.createImportant(data) <ide> <ide> s.mu.Lock() <ide> i.data[name] = data <ide><path>vendor/src/github.com/docker/notary/tuf/README.md <ide> from Docker should be considered the official CLI to be used with this implement <ide> - [ ] Ensure consistent capitalization in naming (TUF\_\_\_ vs Tuf\_\_\_) <ide> - [X] Make caching of metadata files smarter - PR #5 <ide> - [ ] ~~Add configuration for CLI commands. Order of configuration priority from most to least: flags, config file, defaults~~ Notary should be the official CLI <del>- [X] Reasses organization of data types. Possibly consolidate a few things into the data package but break up package into a few more distinct files <add>- [X] Reassess organization of data types. Possibly consolidate a few things into the data package but break up package into a few more distinct files <ide> - [ ] Comprehensive test cases <ide> - [ ] Delete files no longer in use <ide> - [ ] Fix up errors. Some have to be instantiated, others don't, the inconsistency is annoying. <ide><path>vendor/src/github.com/hashicorp/memberlist/README.md <ide> The changes from SWIM are noted here: <ide> also will periodically send out dedicated gossip messages on their own. This <ide> feature lets you have a higher gossip rate (for example once per 200ms) <ide> and a slower failure detection rate (such as once per second), resulting <del> in overall faster convergence rates and data propogation speeds. This feature <del> can be totally disabed as well, if you wish. <add> in overall faster convergence rates and data propagation speeds. This feature <add> can be totally disabled as well, if you wish. <ide> <ide> * memberlist stores around the state of dead nodes for a set amount of time, <ide> so that when full syncs are requested, the requester also receives information <ide><path>vendor/src/github.com/opencontainers/runc/libcontainer/nsenter/README.md <ide> which will give the process of the container that should be joined. Namespaces f <ide> be found from `/proc/[pid]/ns` and set by `setns` syscall. <ide> <ide> And then get the pipe number from `_LIBCONTAINER_INITPIPE`, error message could <del>be transfered through it. If tty is added, `_LIBCONTAINER_CONSOLE_PATH` will <add>be transferred through it. If tty is added, `_LIBCONTAINER_CONSOLE_PATH` will <ide> have value and start a console for output. <ide> <ide> Finally, `nsexec()` will clone a child process , exit the parent process and let <ide><path>vendor/src/github.com/philhofer/fwd/README.md <ide> in the stream, and uses the `io.Seeker` interface if the underlying <ide> stream implements it. `(*fwd.Reader).Next` returns a slice pointing <ide> to the next `n` bytes in the read buffer (like `Peek`), but also <ide> increments the read position. This allows users to process streams <del>in aribtrary block sizes without having to manage appropriately-sized <add>in arbitrary block sizes without having to manage appropriately-sized <ide> slices. Additionally, obviating the need to copy the data from the <ide> buffer to another location in memory can improve performance dramatically <ide> in CPU-bound applications. <ide> func (r *Reader) Skip(n int) (int, error) <ide> ``` <ide> Skip moves the reader forward 'n' bytes. <ide> Returns the number of bytes skipped and any <del>errors encountered. It is analagous to Seek(n, 1). <add>errors encountered. It is analogous to Seek(n, 1). <ide> If the underlying reader implements io.Seeker, then <ide> that method will be used to skip forward. <ide> <ide><path>vendor/src/github.com/ugorji/go/codec/README.md <ide> Rich Feature Set includes: <ide> - Encode/Decode from/to chan types (for iterative streaming support) <ide> - Drop-in replacement for encoding/json. `json:` key in struct tag supported. <ide> - Provides a RPC Server and Client Codec for net/rpc communication protocol. <del> - Handle unique idiosynchracies of codecs e.g. <add> - Handle unique idiosyncrasies of codecs e.g. <ide> - For messagepack, configure how ambiguities in handling raw bytes are resolved <ide> - For messagepack, provide rpc server/client codec to support <ide> msgpack-rpc protocol defined at:
8
PHP
PHP
throw an exception instead of triggering a notice
2cb85337a6235ce4aedab7a29a4dbfd468bf2392
<ide><path>src/Database/SqlDialectTrait.php <ide> protected function _updateQueryTranslator($query) <ide> * <ide> * @param \Cake\Database\Query $query The query to process. <ide> * @return \Cake\Database\Query The modified query. <add> * @throws \RuntimeException In case the processed query contains any joins, as removing <add> * aliases from the conditions can break references to the joined tables. <ide> */ <ide> protected function _removeAliasesFromConditions($query) <ide> { <ide> if (!empty($query->clause('join'))) { <del> trigger_error( <add> throw new \RuntimeException( <ide> 'Aliases are being removed from conditions for UPDATE/DELETE queries, ' . <del> 'this can break references to joined tables.', <del> E_USER_NOTICE <add> 'this can break references to joined tables.' <ide> ); <ide> } <ide> <ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testDeleteNoFrom() <ide> * warning about possible incompatibilities with aliases being removed <ide> * from the conditions. <ide> * <add> * <add> * @expectedException \RuntimeException <add> * @expectedExceptionMessage Aliases are being removed from conditions for UPDATE/DELETE queries, this can break references to joined tables. <ide> * @return void <ide> */ <ide> public function testDeleteRemovingAliasesCanBreakJoins() <ide> { <del> $message = null; <del> $oldHandler = set_error_handler(function ($errno, $errstr) use (&$oldHandler, &$message) { <del> if ($errno === E_USER_NOTICE) { <del> $message = $errstr; <del> } else { <del> call_user_func_array($oldHandler, func_get_args()); <del> } <del> }); <del> <ide> $query = new Query($this->connection); <ide> <ide> $query <ide> public function testDeleteRemovingAliasesCanBreakJoins() <ide> ->where(['a.id' => 1]); <ide> <ide> $query->sql(); <del> <del> restore_error_handler(); <del> <del> $expected = 'Aliases are being removed from conditions for UPDATE/DELETE queries, ' . <del> 'this can break references to joined tables.'; <del> $this->assertEquals($expected, $message); <ide> } <ide> <ide> /** <ide> public function testUpdateStripAliasesFromConditions() <ide> * warning about possible incompatibilities with aliases being removed <ide> * from the conditions. <ide> * <add> * @expectedException \RuntimeException <add> * @expectedExceptionMessage Aliases are being removed from conditions for UPDATE/DELETE queries, this can break references to joined tables. <ide> * @return void <ide> */ <ide> public function testUpdateRemovingAliasesCanBreakJoins() <ide> { <del> $message = null; <del> $oldHandler = set_error_handler(function ($errno, $errstr) use (&$oldHandler, &$message) { <del> if ($errno === E_USER_NOTICE) { <del> $message = $errstr; <del> } else { <del> call_user_func_array($oldHandler, func_get_args()); <del> } <del> }); <del> <ide> $query = new Query($this->connection); <ide> <ide> $query <ide> public function testUpdateRemovingAliasesCanBreakJoins() <ide> ->where(['a.id' => 1]); <ide> <ide> $query->sql(); <del> <del> restore_error_handler(); <del> <del> $expected = 'Aliases are being removed from conditions for UPDATE/DELETE queries, ' . <del> 'this can break references to joined tables.'; <del> $this->assertEquals($expected, $message); <ide> } <ide> <ide> /**
2
Ruby
Ruby
remove unnecessary nil check
89ed0c544b75dd828a0cfbc7d8a9902330c16f4b
<ide><path>Library/Homebrew/os/mac.rb <ide> def gcc_42_build_version <ide> @gcc_42_build_version ||= <ide> begin <ide> gcc = MacOS.locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2") <del> if gcc && gcc.exist? && gcc.realpath.basename.to_s !~ /^llvm/ <add> if gcc.exist? && gcc.realpath.basename.to_s !~ /^llvm/ <ide> %x{#{gcc} --version}[/build (\d{4,})/, 1].to_i <ide> end <ide> end
1
PHP
PHP
add iterable type into generator doc
d40d4cd78f8a7a218257528e18194fac81b6c4fa
<ide><path>src/Core/PluginCollection.php <ide> public function valid(): bool <ide> * Filter the plugins to those with the named hook enabled. <ide> * <ide> * @param string $hook The hook to filter plugins by <del> * @return \Generator A generator containing matching plugins. <add> * @return \Generator|\Cake\Core\PluginInterface[] A generator containing matching plugins. <ide> * @throws \InvalidArgumentException on invalid hooks <ide> */ <ide> public function with(string $hook): Generator
1
PHP
PHP
add docblock for exception
3414dcfcbe27cf0f4deee0670f022983e8016392
<ide><path>src/Illuminate/Console/Application.php <ide> public static function forgetBootstrappers() <ide> * @param array $parameters <ide> * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer <ide> * @return int <add> * <add> * @throws \Symfony\Component\Console\Exception\CommandNotFoundException <ide> */ <ide> public function call($command, array $parameters = [], $outputBuffer = null) <ide> {
1
PHP
PHP
fix sorting of `datetimeimmutable` instances
162336b66979aed0fbe805cd83ce1096a976d6aa
<ide><path>src/Collection/Iterator/SortIterator.php <ide> namespace Cake\Collection\Iterator; <ide> <ide> use Cake\Collection\Collection; <del>use DateTime; <add>use DateTimeInterface; <ide> <ide> /** <ide> * An iterator that will return the passed items in order. The order is given by <ide> public function __construct($items, $callback, $dir = SORT_DESC, $type = SORT_NU <ide> $results = []; <ide> foreach ($items as $key => $value) { <ide> $value = $callback($value); <del> if ($value instanceof DateTime && $type === SORT_NUMERIC) { <add> if ($value instanceof DateTimeInterface && $type === SORT_NUMERIC) { <ide> $value = $value->format('U'); <ide> } <ide> $results[$key] = $value; <ide><path>tests/TestCase/Collection/Iterator/SortIteratorTest.php <ide> public function testSortDateTime() <ide> $items = new ArrayObject([ <ide> new \DateTime('2014-07-21'), <ide> new \DateTime('2015-06-30'), <del> new \DateTime('2013-08-12') <add> new \DateTimeImmutable('2013-08-12') <ide> ]); <del> $a = new \DateTime(); <ide> <ide> $callback = function ($a) { <ide> return $a->add(new \DateInterval('P1Y')); <ide> public function testSortDateTime() <ide> $expected = [ <ide> new \DateTime('2016-06-30'), <ide> new \DateTime('2015-07-21'), <del> new \DateTime('2014-08-12') <add> new \DateTimeImmutable('2013-08-12') <ide> <ide> ]; <ide> $this->assertEquals($expected, $sorted->toList()); <ide> <ide> $items = new ArrayObject([ <ide> new \DateTime('2014-07-21'), <ide> new \DateTime('2015-06-30'), <del> new \DateTime('2013-08-12') <add> new \DateTimeImmutable('2013-08-12') <ide> ]); <ide> <ide> $sorted = new SortIterator($items, $callback, SORT_ASC); <ide> $expected = [ <del> new \DateTime('2014-08-12'), <add> new \DateTimeImmutable('2013-08-12'), <ide> new \DateTime('2015-07-21'), <ide> new \DateTime('2016-06-30'), <ide> ];
2
Javascript
Javascript
add test for async event dispatching
fc6a9f1a1ebb5585c543126d397cc945a95f3196
<ide><path>packages/react-dom/src/events/__tests__/DOMEventResponderSystem-test.internal.js <ide> describe('DOMEventResponderSystem', () => { <ide> <ide> expect(eventLog).toEqual(['magic event fired', 'magicclick']); <ide> }); <add> <add> it('async event dispatching works', () => { <add> let eventLog = []; <add> const buttonRef = React.createRef(); <add> <add> const LongPressEventComponent = createReactEventComponent( <add> ['click'], <add> (context, props) => { <add> const pressEvent = { <add> listener: props.onPress, <add> target: context.eventTarget, <add> type: 'press', <add> }; <add> context.dispatchEvent(pressEvent, {discrete: true}); <add> <add> setTimeout( <add> () => <add> context.withAsyncDispatching(() => { <add> if (props.onLongPress) { <add> const longPressEvent = { <add> listener: props.onLongPress, <add> target: context.eventTarget, <add> type: 'longpress', <add> }; <add> context.dispatchEvent(longPressEvent, {discrete: true}); <add> } <add> <add> if (props.onLongPressChange) { <add> const longPressChangeEvent = { <add> listener: props.onLongPressChange, <add> target: context.eventTarget, <add> type: 'longpresschange', <add> }; <add> context.dispatchEvent(longPressChangeEvent, {discrete: true}); <add> } <add> }), <add> 500, <add> ); <add> }, <add> ); <add> <add> function log(msg) { <add> eventLog.push(msg); <add> } <add> <add> const Test = () => ( <add> <LongPressEventComponent <add> onPress={() => log('press')} <add> onLongPress={() => log('longpress')} <add> onLongPressChange={() => log('longpresschange')}> <add> <button ref={buttonRef}>Click me!</button> <add> </LongPressEventComponent> <add> ); <add> <add> ReactDOM.render(<Test />, container); <add> <add> // Clicking the button should trigger the event responder handleEvent() <add> let buttonElement = buttonRef.current; <add> dispatchClickEvent(buttonElement); <add> jest.runAllTimers(); <add> <add> expect(eventLog).toEqual(['press', 'longpress', 'longpresschange']); <add> }); <ide> });
1
Go
Go
fix a bug in idm.getidinrange()
b495131861e0b6c0873bc341184b11537562236f
<ide><path>libnetwork/idm/idm.go <ide> type Idm struct { <ide> handle *bitseq.Handle <ide> } <ide> <del>// New returns an instance of id manager for a set of [start-end] numerical ids <add>// New returns an instance of id manager for a [start,end] set of numerical ids <ide> func New(ds datastore.DataStore, id string, start, end uint64) (*Idm, error) { <ide> if id == "" { <ide> return nil, fmt.Errorf("Invalid id") <ide> func (i *Idm) GetSpecificID(id uint64) error { <ide> return i.handle.Set(id - i.start) <ide> } <ide> <del>// GetIDInRange returns the first available id in the set within a range <add>// GetIDInRange returns the first available id in the set within a [start,end] range <ide> func (i *Idm) GetIDInRange(start, end uint64) (uint64, error) { <ide> if i.handle == nil { <ide> return 0, fmt.Errorf("ID set is not initialized") <ide> func (i *Idm) GetIDInRange(start, end uint64) (uint64, error) { <ide> return 0, fmt.Errorf("Requested range does not belong to the set") <ide> } <ide> <del> return i.handle.SetAnyInRange(start, end-start) <add> ordinal, err := i.handle.SetAnyInRange(start-i.start, end-i.start) <add> <add> return i.start + ordinal, err <ide> } <ide> <ide> // Release releases the specified id <ide><path>libnetwork/idm/idm_test.go <ide> func TestUninitialized(t *testing.T) { <ide> t.Fatalf("Expected failure but succeeded") <ide> } <ide> } <add> <add>func TestAllocateInRange(t *testing.T) { <add> i, err := New(nil, "myset", 5, 10) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> o, err := i.GetIDInRange(6, 6) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 6 { <add> t.Fatalf("Unexpected id returned. Expected: 6. Got: %d", o) <add> } <add> <add> if err = i.GetSpecificID(6); err == nil { <add> t.Fatalf("Expected failure but succeeded") <add> } <add> <add> o, err = i.GetID() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 5 { <add> t.Fatalf("Unexpected id returned. Expected: 5. Got: %d", o) <add> } <add> <add> i.Release(6) <add> <add> o, err = i.GetID() <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 6 { <add> t.Fatalf("Unexpected id returned. Expected: 6. Got: %d", o) <add> } <add> <add> for n := 7; n <= 10; n++ { <add> o, err := i.GetIDInRange(7, 10) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != uint64(n) { <add> t.Fatalf("Unexpected id returned. Expected: %d. Got: %d", n, o) <add> } <add> } <add> <add> if err = i.GetSpecificID(7); err == nil { <add> t.Fatalf("Expected failure but succeeded") <add> } <add> <add> if err = i.GetSpecificID(10); err == nil { <add> t.Fatalf("Expected failure but succeeded") <add> } <add> <add> i.Release(10) <add> <add> o, err = i.GetIDInRange(5, 10) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 10 { <add> t.Fatalf("Unexpected id returned. Expected: 10. Got: %d", o) <add> } <add> <add> i.Release(5) <add> <add> o, err = i.GetIDInRange(5, 10) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 5 { <add> t.Fatalf("Unexpected id returned. Expected: 5. Got: %d", o) <add> } <add> <add> for n := 5; n <= 10; n++ { <add> i.Release(uint64(n)) <add> } <add> <add> for n := 5; n <= 10; n++ { <add> o, err := i.GetIDInRange(5, 10) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != uint64(n) { <add> t.Fatalf("Unexpected id returned. Expected: %d. Got: %d", n, o) <add> } <add> } <add> <add> for n := 5; n <= 10; n++ { <add> if err = i.GetSpecificID(uint64(n)); err == nil { <add> t.Fatalf("Expected failure but succeeded for id: %d", n) <add> } <add> } <add> <add> // New larger set <add> ul := uint64((1 << 24) - 1) <add> i, err = New(nil, "newset", 0, ul) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> o, err = i.GetIDInRange(4096, ul) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 4096 { <add> t.Fatalf("Unexpected id returned. Expected: 4096. Got: %d", o) <add> } <add> <add> o, err = i.GetIDInRange(4096, ul) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 4097 { <add> t.Fatalf("Unexpected id returned. Expected: 4097. Got: %d", o) <add> } <add> <add> o, err = i.GetIDInRange(4096, ul) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if o != 4098 { <add> t.Fatalf("Unexpected id returned. Expected: 4098. Got: %d", o) <add> } <add>}
2
PHP
PHP
add parameter comments
103e5793652265534112eae72425450da3c58316
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> public function assertResponseNotContains($content, $message = '') <ide> /** <ide> * Asserts that the response body matches a given regular expression. <ide> * <del> * @param string $pattern <del> * @param string $message <add> * @param string $pattern The pattern to compare against. <add> * @param string $message The failure message that will be appended to the generated message. <ide> * @return void <ide> */ <ide> public function assertResponseRegExp($pattern, $message = '') <ide> public function assertResponseRegExp($pattern, $message = '') <ide> /** <ide> * Asserts that the response body does not match a given regular expression. <ide> * <del> * @param string $pattern <del> * @param string $message <add> * @param string $pattern The pattern to compare against. <add> * @param string $message The failure message that will be appended to the generated message. <ide> * @return void <ide> */ <ide> public function assertResponseNotRegExp($pattern, $message = '')
1
Text
Text
add a changelog entry for [ci skip]
5d5beccc8ce0e844dca3ebac6e0ec8dd3fcc1b91
<ide><path>activerecord/CHANGELOG.md <add>* Calling `delete_all` on an unloaded `CollectionProxy` no longer <add> generates a SQL statement containing each id of the collection: <add> <add> Before: <add> <add> DELETE FROM `model` WHERE `model`.`parent_id` = 1 <add> AND `model`.`id` IN (1, 2, 3...) <add> <add> After: <add> <add> DELETE FROM `model` WHERE `model`.`parent_id` = 1 <add> <add> *Eileen M. Uchitelle*, *Aaron Patterson* <add> <ide> * Fixed error for aggregate methods (`empty?`, `any?`, `count`) with `select` <ide> which created invalid SQL. <ide>
1
Go
Go
use checker for docker_cli_run_unix_test.go
7a82429b3d0fc7a93f61406117c170aaf9a4f9be
<ide><path>integration-cli/docker_cli_run_unix_test.go <ide> import ( <ide> func (s *DockerSuite) TestRunRedirectStdout(c *check.C) { <ide> checkRedirect := func(command string) { <ide> _, tty, err := pty.Open() <del> if err != nil { <del> c.Fatalf("Could not open pty: %v", err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("Could not open pty")) <ide> cmd := exec.Command("sh", "-c", command) <ide> cmd.Stdin = tty <ide> cmd.Stdout = tty <ide> cmd.Stderr = tty <del> if err := cmd.Start(); err != nil { <del> c.Fatalf("start err: %v", err) <del> } <add> c.Assert(cmd.Start(), checker.IsNil) <ide> ch := make(chan error) <ide> go func() { <ide> ch <- cmd.Wait() <ide> func (s *DockerSuite) TestRunRedirectStdout(c *check.C) { <ide> case <-time.After(10 * time.Second): <ide> c.Fatal("command timeout") <ide> case err := <-ch: <del> if err != nil { <del> c.Fatalf("wait err=%v", err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("wait err")) <ide> } <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *check.C) { <ide> // /tmp gets permission denied <ide> testRequires(c, NotUserNamespace) <ide> tmpDir, err := ioutil.TempDir("", "docker_recursive_mount_test") <del> if err != nil { <del> c.Fatal(err) <del> } <add> c.Assert(err, checker.IsNil) <ide> <ide> defer os.RemoveAll(tmpDir) <ide> <ide> // Create a temporary tmpfs mount. <ide> tmpfsDir := filepath.Join(tmpDir, "tmpfs") <del> if err := os.MkdirAll(tmpfsDir, 0777); err != nil { <del> c.Fatalf("failed to mkdir at %s - %s", tmpfsDir, err) <del> } <del> if err := mount.Mount("tmpfs", tmpfsDir, "tmpfs", ""); err != nil { <del> c.Fatalf("failed to create a tmpfs mount at %s - %s", tmpfsDir, err) <del> } <add> c.Assert(os.MkdirAll(tmpfsDir, 0777), checker.IsNil, check.Commentf("failed to mkdir at %s", tmpfsDir)) <add> c.Assert(mount.Mount("tmpfs", tmpfsDir, "tmpfs", ""), checker.IsNil, check.Commentf("failed to create a tmpfs mount at %s", tmpfsDir)) <ide> <ide> f, err := ioutil.TempFile(tmpfsDir, "touch-me") <del> if err != nil { <del> c.Fatal(err) <del> } <add> c.Assert(err, checker.IsNil) <ide> defer f.Close() <ide> <ide> runCmd := exec.Command(dockerBinary, "run", "--name", "test-data", "--volume", fmt.Sprintf("%s:/tmp:ro", tmpDir), "busybox:latest", "ls", "/tmp/tmpfs") <del> out, stderr, exitCode, err := runCommandWithStdoutStderr(runCmd) <del> if err != nil && exitCode != 0 { <del> c.Fatal(out, stderr, err) <del> } <del> if !strings.Contains(out, filepath.Base(f.Name())) { <del> c.Fatal("Recursive bind mount test failed. Expected file not found") <del> } <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> c.Assert(err, checker.IsNil) <add> c.Assert(out, checker.Contains, filepath.Base(f.Name()), check.Commentf("Recursive bind mount test failed. Expected file not found")) <ide> } <ide> <ide> func (s *DockerSuite) TestRunDeviceDirectory(c *check.C) { <ide> func (s *DockerSuite) TestRunDeviceDirectory(c *check.C) { <ide> } <ide> <ide> out, _ := dockerCmd(c, "run", "--device", "/dev/snd:/dev/snd", "busybox", "sh", "-c", "ls /dev/snd/") <del> if actual := strings.Trim(out, "\r\n"); !strings.Contains(out, "timer") { <del> c.Fatalf("expected output /dev/snd/timer, received %s", actual) <del> } <add> c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "timer", check.Commentf("expected output /dev/snd/timer")) <ide> <ide> out, _ = dockerCmd(c, "run", "--device", "/dev/snd:/dev/othersnd", "busybox", "sh", "-c", "ls /dev/othersnd/") <del> if actual := strings.Trim(out, "\r\n"); !strings.Contains(out, "seq") { <del> c.Fatalf("expected output /dev/othersnd/seq, received %s", actual) <del> } <add> c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "seq", check.Commentf("expected output /dev/othersnd/seq")) <ide> } <ide> <ide> // TestRunDetach checks attaching and detaching with the escape sequence. <ide> func (s *DockerSuite) TestRunAttachDetach(c *check.C) { <ide> name := "attach-detach" <ide> cmd := exec.Command(dockerBinary, "run", "--name", name, "-it", "busybox", "cat") <ide> stdout, err := cmd.StdoutPipe() <del> if err != nil { <del> c.Fatal(err) <del> } <add> c.Assert(err, checker.IsNil) <ide> cpty, tty, err := pty.Open() <del> if err != nil { <del> c.Fatal(err) <del> } <add> c.Assert(err, checker.IsNil) <ide> defer cpty.Close() <ide> cmd.Stdin = tty <del> if err := cmd.Start(); err != nil { <del> c.Fatal(err) <del> } <add> c.Assert(cmd.Start(), checker.IsNil) <ide> c.Assert(waitRun(name), check.IsNil) <ide> <del> if _, err := cpty.Write([]byte("hello\n")); err != nil { <del> c.Fatal(err) <del> } <add> _, err = cpty.Write([]byte("hello\n")) <add> c.Assert(err, checker.IsNil) <ide> <ide> out, err := bufio.NewReader(stdout).ReadString('\n') <del> if err != nil { <del> c.Fatal(err) <del> } <del> if strings.TrimSpace(out) != "hello" { <del> c.Fatalf("expected 'hello', got %q", out) <del> } <add> c.Assert(err, checker.IsNil) <add> c.Assert(strings.TrimSpace(out), checker.Equals, "hello") <ide> <ide> // escape sequence <del> if _, err := cpty.Write([]byte{16}); err != nil { <del> c.Fatal(err) <del> } <add> _, err = cpty.Write([]byte{16}) <add> c.Assert(err, checker.IsNil) <ide> time.Sleep(100 * time.Millisecond) <del> if _, err := cpty.Write([]byte{17}); err != nil { <del> c.Fatal(err) <del> } <add> _, err = cpty.Write([]byte{17}) <add> c.Assert(err, checker.IsNil) <ide> <ide> ch := make(chan struct{}) <ide> go func() { <ide> func (s *DockerSuite) TestRunAttachDetach(c *check.C) { <ide> }() <ide> <ide> running, err := inspectField(name, "State.Running") <del> if err != nil { <del> c.Fatal(err) <del> } <del> if running != "true" { <del> c.Fatal("expected container to still be running") <del> } <add> c.Assert(err, checker.IsNil) <add> c.Assert(running, checker.Equals, "true", check.Commentf("expected container to still be running")) <ide> <ide> go func() { <ide> exec.Command(dockerBinary, "kill", name).Run() <ide> func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) { <ide> testRequires(c, cpuCfsQuota) <ide> <ide> out, _, err := dockerCmdWithError("run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test") <del> if err != nil { <del> c.Fatalf("failed to run container: %v, output: %q", err, out) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to run container, output: %q", out)) <ide> out = strings.TrimSpace(out) <del> if out != "test" { <del> c.Errorf("container should've printed 'test'") <del> } <add> c.Assert(out, checker.Equals, "test", check.Commentf("container should've printed 'test'")) <ide> <ide> out, err = inspectField("test", "HostConfig.CpuQuota") <ide> c.Assert(err, check.IsNil) <ide> <del> if out != "8000" { <del> c.Fatalf("setting the CPU CFS quota failed") <del> } <add> c.Assert(out, checker.Equals, "8000", check.Commentf("setting the CPU CFS quota failed")) <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) { <ide> testRequires(c, cpuCfsPeriod) <ide> <del> if _, _, err := dockerCmdWithError("run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil { <del> c.Fatalf("failed to run container: %v", err) <del> } <add> dockerCmd(c, "run", "--cpu-period", "50000", "--name", "test", "busybox", "true") <ide> <ide> out, err := inspectField("test", "HostConfig.CpuPeriod") <ide> c.Assert(err, check.IsNil) <del> if out != "50000" { <del> c.Fatalf("setting the CPU CFS period failed") <del> } <add> c.Assert(out, checker.Equals, "50000", check.Commentf("setting the CPU CFS period failed")) <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) { <ide> func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) { <ide> func (s *DockerSuite) TestRunEchoStdoutWitCPUShares(c *check.C) { <ide> testRequires(c, cpuShare) <ide> out, _ := dockerCmd(c, "run", "--cpu-shares", "1000", "busybox", "echo", "test") <del> if out != "test\n" { <del> c.Errorf("container should've printed 'test', got %q instead", out) <del> } <add> c.Assert(out, checker.Equals, "test\n", check.Commentf("container should've printed 'test'")) <ide> } <ide> <ide> // "test" should be printed <ide> func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *check.C) { <ide> testRequires(c, cpuShare) <ide> testRequires(c, memoryLimitSupport) <ide> out, _, _ := dockerCmdWithStdoutStderr(c, "run", "--cpu-shares", "1000", "-m", "32m", "busybox", "echo", "test") <del> if out != "test\n" { <del> c.Errorf("container should've printed 'test', got %q instead", out) <del> } <add> c.Assert(out, checker.Equals, "test\n", check.Commentf("container should've printed 'test'")) <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithCpuset(c *check.C) { <ide> testRequires(c, cgroupCpuset) <del> if _, code := dockerCmd(c, "run", "--cpuset", "0", "busybox", "true"); code != 0 { <del> c.Fatalf("container should run successfully with cpuset of 0") <del> } <add> dockerCmd(c, "run", "--cpuset", "0", "busybox", "true") <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithCpusetCpus(c *check.C) { <ide> testRequires(c, cgroupCpuset) <del> if _, code := dockerCmd(c, "run", "--cpuset-cpus", "0", "busybox", "true"); code != 0 { <del> c.Fatalf("container should run successfully with cpuset-cpus of 0") <del> } <add> dockerCmd(c, "run", "--cpuset-cpus", "0", "busybox", "true") <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithCpusetMems(c *check.C) { <ide> testRequires(c, cgroupCpuset) <del> if _, code := dockerCmd(c, "run", "--cpuset-mems", "0", "busybox", "true"); code != 0 { <del> c.Fatalf("container should run successfully with cpuset-mems of 0") <del> } <add> dockerCmd(c, "run", "--cpuset-mems", "0", "busybox", "true") <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) { <ide> testRequires(c, blkioWeight) <del> if _, code := dockerCmd(c, "run", "--blkio-weight", "300", "busybox", "true"); code != 0 { <del> c.Fatalf("container should run successfully with blkio-weight of 300") <del> } <add> dockerCmd(c, "run", "--blkio-weight", "300", "busybox", "true") <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithBlkioInvalidWeight(c *check.C) { <ide> func (s *DockerSuite) TestRunEchoStdoutWithMemoryLimit(c *check.C) { <ide> out, _, _ := dockerCmdWithStdoutStderr(c, "run", "-m", "32m", "busybox", "echo", "test") <ide> out = strings.Trim(out, "\r\n") <ide> <del> if expected := "test"; out != expected { <del> c.Fatalf("container should've printed %q but printed %q", expected, out) <del> } <add> c.Assert(out, checker.Equals, "test", check.Commentf("container should've printed 'test'")) <ide> } <ide> <ide> // TestRunWithoutMemoryswapLimit sets memory limit and disables swap <ide> func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *check.C) { <ide> out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true") <ide> c.Assert(err, check.NotNil) <ide> expected := "Minimum memory limit should be larger than memory reservation limit" <del> if !strings.Contains(strings.TrimSpace(out), expected) { <del> c.Fatalf("run container should fail with invalid memory reservation, output: %q", out) <del> } <add> c.Assert(strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation")) <ide> } <ide> <ide> func (s *DockerSuite) TestStopContainerSignal(c *check.C) { <ide> out, _ := dockerCmd(c, "run", "--stop-signal", "SIGUSR1", "-d", "busybox", "/bin/sh", "-c", `trap 'echo "exit trapped"; exit 0' USR1; while true; do sleep 1; done`) <ide> containerID := strings.TrimSpace(out) <ide> <del> if err := waitRun(containerID); err != nil { <del> c.Fatal(err) <del> } <add> c.Assert(waitRun(containerID), checker.IsNil) <ide> <ide> dockerCmd(c, "stop", containerID) <ide> out, _ = dockerCmd(c, "logs", containerID) <ide> <del> if !strings.Contains(out, "exit trapped") { <del> c.Fatalf("Expected `exit trapped` in the log, got %v", out) <del> } <add> c.Assert(out, checker.Contains, "exit trapped", check.Commentf("Expected `exit trapped` in the log")) <ide> } <ide> <ide> func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) { <ide> func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) { <ide> expected := "Minimum memoryswap limit should be larger than memory limit" <ide> c.Assert(err, check.NotNil) <ide> <del> if !strings.Contains(out, expected) { <del> c.Fatalf("Expected output to contain %q, not %q", out, expected) <del> } <add> c.Assert(out, checker.Contains, expected) <ide> } <ide> <ide> func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) { <ide> func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) { <ide> out, _, err := dockerCmdWithError("run", "--cpuset-cpus", strconv.Itoa(invalid), "busybox", "true") <ide> c.Assert(err, check.NotNil) <ide> expected := fmt.Sprintf("Error response from daemon: Requested CPUs are not available - requested %s, available: %s", strconv.Itoa(invalid), sysInfo.Cpus) <del> if !(strings.Contains(out, expected)) { <del> c.Fatalf("Expected output to contain %q, got %q", expected, out) <del> } <add> c.Assert(out, checker.Contains, expected) <ide> } <ide> <ide> func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) { <ide> func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) { <ide> out, _, err := dockerCmdWithError("run", "--cpuset-mems", strconv.Itoa(invalid), "busybox", "true") <ide> c.Assert(err, check.NotNil) <ide> expected := fmt.Sprintf("Error response from daemon: Requested memory nodes are not available - requested %s, available: %s", strconv.Itoa(invalid), sysInfo.Mems) <del> if !(strings.Contains(out, expected)) { <del> c.Fatalf("Expected output to contain %q, got %q", expected, out) <del> } <add> c.Assert(out, checker.Contains, expected) <ide> } <ide> <ide> func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) {
1
Text
Text
change info to note
29051b60a26951ee71d9129a4eb5bc399f9a6cb0
<ide><path>guides/source/active_storage_overview.md <ide> production: <ide> - s3_west_coast <ide> ``` <ide> <add>NOTE: Files are served from the primary service. <add> <ide> Mirrored services can be used to facilitate a migration between services in <ide> production. You can start mirroring to the new service, copy existing files from <ide> the old service to the new, then go all-in on the new service. <ide> directly from the client to the cloud. <ide> 1. Include `activestorage.js` in your application's JavaScript bundle. <ide> <ide> Using the asset pipeline: <add> <ide> ```js <ide> //= require activestorage <add> <ide> ``` <add> <ide> Using the npm package: <add> <ide> ```js <ide> import * as ActiveStorage from "activestorage" <ide> ActiveStorage.start() <ide> ``` <add> <ide> 2. Annotate file inputs with the direct upload URL. <ide> <ide> ```ruby <ide> You can use these events to show the progress of an upload. <ide> ![direct-uploads](https://user-images.githubusercontent.com/5355/28694528-16e69d0c-72f8-11e7-91a7-c0b8cfc90391.gif) <ide> <ide> To show the uploaded files in a form: <add> <ide> ```js <ide> // direct_uploads.js <ide> <ide> addEventListener("direct-upload:end", event => { <ide> }) <ide> ``` <ide> <del>Add styles: <add>Add styles: <ide> <ide> ```css <ide> /* direct_uploads.css */
1
Ruby
Ruby
restore old winch trap
be41b12e4c0dd0adb013b831dcfe56be58203b5a
<ide><path>Library/Homebrew/sandbox.rb <ide> def exec(*args) <ide> seatbelt.close <ide> @start = Time.now <ide> <del> $stdin.raw! if $stdin.tty? <del> stdin_thread = T.let(nil, T.nilable(Thread)) <del> <ide> begin <ide> command = [SANDBOX_EXEC, "-f", seatbelt.path, *args] <ide> # Start sandbox in a pseudoterminal to prevent access of the parent terminal. <ide> T.unsafe(PTY).spawn(*command) do |r, w, pid| <del> if $stdout.tty? <del> w.winsize = $stdout.winsize <del> trap(:WINCH) { w.winsize = $stdout.winsize } <del> end <add> old_winch = trap(:WINCH) { w.winsize = $stdout.winsize if $stdout.tty? } <add> w.winsize = $stdout.winsize if $stdout.tty? <add> <add> $stdin.raw! if $stdin.tty? <ide> stdin_thread = Thread.new { IO.copy_stream($stdin, w) } <add> <ide> r.each_char { |c| print(c) } <add> <ide> Process.wait(pid) <add> ensure <add> stdin_thread&.kill <add> $stdin.cooked! if $stdin.tty? <add> trap(:WINCH, old_winch) <ide> end <ide> raise ErrorDuringExecution.new(command, status: $CHILD_STATUS) unless $CHILD_STATUS.success? <ide> rescue <ide> @failed = true <ide> raise <ide> ensure <del> stdin_thread&.kill <del> $stdin.cooked! if $stdin.tty? <del> <ide> seatbelt.unlink <ide> sleep 0.1 # wait for a bit to let syslog catch up the latest events. <ide> syslog_args = [
1
Python
Python
set version to v2.0.5
a6b43729c66916defbeb4a97554c8d4c7f59c3aa
<ide><path>spacy/about.py <ide> # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py <ide> <ide> __title__ = 'spacy' <del>__version__ = '2.0.5.dev0' <add>__version__ = '2.0.5' <ide> __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' <ide> __uri__ = 'https://spacy.io' <ide> __author__ = 'Explosion AI'
1
Ruby
Ruby
add test to make sure form_for is not affected by
d82b7061843994897db9339a301b01c51d37f9fc
<ide><path>actionview/test/template/form_helper_test.rb <ide> def test_form_for <ide> assert_dom_equal expected, output_buffer <ide> end <ide> <add> def test_form_for_is_not_affected_by_form_with_generates_ids <add> old_value = ActionView::Helpers::FormHelper.form_with_generates_ids <add> ActionView::Helpers::FormHelper.form_with_generates_ids = false <add> <add> form_for(@post, html: { id: "create-post" }) do |f| <add> concat f.label(:title) { "The Title" } <add> concat f.text_field(:title) <add> concat f.text_area(:body) <add> concat f.check_box(:secret) <add> concat f.submit("Create post") <add> concat f.button("Create post") <add> concat f.button { <add> concat content_tag(:span, "Create post") <add> } <add> end <add> <add> expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do <add> "<label for='post_title'>The Title</label>" \ <add> "<input name='post[title]' type='text' id='post_title' value='Hello World' />" \ <add> "<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \ <add> "<input name='post[secret]' type='hidden' value='0' />" \ <add> "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" \ <add> "<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />" \ <add> "<button name='button' type='submit'>Create post</button>" \ <add> "<button name='button' type='submit'><span>Create post</span></button>" <add> end <add> <add> assert_dom_equal expected, output_buffer <add> ensure <add> ActionView::Helpers::FormHelper.form_with_generates_ids = old_value <add> end <add> <ide> def test_form_for_with_collection_radio_buttons <ide> post = Post.new <ide> def post.active; false; end
1
Mixed
Javascript
update context documentation
aae8a06c37c0fd9ae60ae76c50735bcdcbef77da
<ide><path>docs/docs/general/options.md <ide> A plugin can provide `additionalOptionScopes` array of paths to additionally loo <ide> Scriptable options also accept a function which is called for each of the underlying data values and that takes the unique argument `context` representing contextual information (see [option context](options.md#option-context)). <ide> A resolver is passed as second parameter, that can be used to access other options in the same context. <ide> <add>> **Note:** the `context` argument should be validated in the scriptable function, because the function can be invoked in different contexts. The `type` field is a good candidate for this validation. <add> <ide> Example: <ide> <ide> ```javascript <ide> In addition to [chart](#chart) <ide> * `active`: true if element is active (hovered) <ide> * `dataset`: dataset at index `datasetIndex` <ide> * `datasetIndex`: index of the current dataset <del>* `index`: getter for `datasetIndex` <add>* `index`: same as `datasetIndex` <ide> * `mode`: the update mode <ide> * `type`: `'dataset'` <ide> <ide> In addition to [dataset](#dataset) <ide> * `parsed`: the parsed data values for the given `dataIndex` and `datasetIndex` <ide> * `raw`: the raw data values for the given `dataIndex` and `datasetIndex` <ide> * `element`: the element (point, arc, bar, etc.) for this data <del>* `index`: getter for `dataIndex` <del>* `mode`: the update mode <add>* `index`: same as `dataIndex` <ide> * `type`: `'data'` <ide> <ide> ### scale <ide><path>src/core/core.datasetController.js <ide> function createDatasetContext(parent, index, dataset) { <ide> dataset, <ide> datasetIndex: index, <ide> index, <add> mode: 'default', <ide> type: 'dataset' <ide> } <ide> );
2
Ruby
Ruby
check xcode installed before using version
e300713f253029ef91a86bc4006d316582fc6d13
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def version <ide> def detect_version <ide> # CLT isn't a distinct entity pre-4.3, and pkgutil doesn't exist <ide> # at all on Tiger, so just count it as installed if Xcode is installed <del> return MacOS::Xcode.version if MacOS::Xcode.version < "3.0" <add> if MacOS::Xcode.installed? && MacOS::Xcode.version < "3.0" <add> return MacOS::Xcode.version <add> end <ide> <ide> version = nil <ide> [MAVERICKS_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id|
1
Javascript
Javascript
remove lanepriority from computeexpirationtime
77be527297402a11523cb6321bcb2a0ae2b4be6c
<ide><path>packages/react-reconciler/src/ReactFiberLane.new.js <ide> export function getMostRecentEventTime(root: FiberRoot, lanes: Lanes): number { <ide> } <ide> <ide> function computeExpirationTime(lane: Lane, currentTime: number) { <del> // TODO: Expiration heuristic is constant per lane, so could use a map. <del> getHighestPriorityLanes(lane); <del> const priority = return_highestLanePriority; <del> if (priority >= InputContinuousLanePriority) { <del> // User interactions should expire slightly more quickly. <del> // <del> // NOTE: This is set to the corresponding constant as in Scheduler.js. When <del> // we made it larger, a product metric in www regressed, suggesting there's <del> // a user interaction that's being starved by a series of synchronous <del> // updates. If that theory is correct, the proper solution is to fix the <del> // starvation. However, this scenario supports the idea that expiration <del> // times are an important safeguard when starvation does happen. <del> // <del> // Also note that, in the case of user input specifically, this will soon no <del> // longer be an issue because we plan to make user input synchronous by <del> // default (until you enter `startTransition`, of course.) <del> // <del> // If weren't planning to make these updates synchronous soon anyway, I <del> // would probably make this number a configurable parameter. <del> return currentTime + 250; <del> } else if (priority >= TransitionPriority) { <del> return currentTime + 5000; <del> } else { <del> // Anything idle priority or lower should never expire. <del> return NoTimestamp; <add> switch (lane) { <add> case SyncLane: <add> case InputContinuousHydrationLane: <add> case InputContinuousLane: <add> // User interactions should expire slightly more quickly. <add> // <add> // NOTE: This is set to the corresponding constant as in Scheduler.js. <add> // When we made it larger, a product metric in www regressed, suggesting <add> // there's a user interaction that's being starved by a series of <add> // synchronous updates. If that theory is correct, the proper solution is <add> // to fix the starvation. However, this scenario supports the idea that <add> // expiration times are an important safeguard when starvation <add> // does happen. <add> return currentTime + 250; <add> case DefaultHydrationLane: <add> case DefaultLane: <add> case TransitionHydrationLane: <add> case TransitionLane1: <add> case TransitionLane2: <add> case TransitionLane3: <add> case TransitionLane4: <add> case TransitionLane5: <add> case TransitionLane6: <add> case TransitionLane7: <add> case TransitionLane8: <add> case TransitionLane9: <add> case TransitionLane10: <add> case TransitionLane11: <add> case TransitionLane12: <add> case TransitionLane13: <add> case TransitionLane14: <add> case TransitionLane15: <add> case TransitionLane16: <add> case RetryLane1: <add> case RetryLane2: <add> case RetryLane3: <add> case RetryLane4: <add> case RetryLane5: <add> return currentTime + 5000; <add> case SelectiveHydrationLane: <add> case IdleHydrationLane: <add> case IdleLane: <add> case OffscreenLane: <add> // Anything idle priority or lower should never expire. <add> return NoTimestamp; <add> default: <add> if (__DEV__) { <add> console.error( <add> 'Should have found matching lanes. This is a bug in React.', <add> ); <add> } <add> return NoTimestamp; <ide> } <ide> } <ide> <ide><path>packages/react-reconciler/src/ReactFiberLane.old.js <ide> export function getMostRecentEventTime(root: FiberRoot, lanes: Lanes): number { <ide> } <ide> <ide> function computeExpirationTime(lane: Lane, currentTime: number) { <del> // TODO: Expiration heuristic is constant per lane, so could use a map. <del> getHighestPriorityLanes(lane); <del> const priority = return_highestLanePriority; <del> if (priority >= InputContinuousLanePriority) { <del> // User interactions should expire slightly more quickly. <del> // <del> // NOTE: This is set to the corresponding constant as in Scheduler.js. When <del> // we made it larger, a product metric in www regressed, suggesting there's <del> // a user interaction that's being starved by a series of synchronous <del> // updates. If that theory is correct, the proper solution is to fix the <del> // starvation. However, this scenario supports the idea that expiration <del> // times are an important safeguard when starvation does happen. <del> // <del> // Also note that, in the case of user input specifically, this will soon no <del> // longer be an issue because we plan to make user input synchronous by <del> // default (until you enter `startTransition`, of course.) <del> // <del> // If weren't planning to make these updates synchronous soon anyway, I <del> // would probably make this number a configurable parameter. <del> return currentTime + 250; <del> } else if (priority >= TransitionPriority) { <del> return currentTime + 5000; <del> } else { <del> // Anything idle priority or lower should never expire. <del> return NoTimestamp; <add> switch (lane) { <add> case SyncLane: <add> case InputContinuousHydrationLane: <add> case InputContinuousLane: <add> // User interactions should expire slightly more quickly. <add> // <add> // NOTE: This is set to the corresponding constant as in Scheduler.js. <add> // When we made it larger, a product metric in www regressed, suggesting <add> // there's a user interaction that's being starved by a series of <add> // synchronous updates. If that theory is correct, the proper solution is <add> // to fix the starvation. However, this scenario supports the idea that <add> // expiration times are an important safeguard when starvation <add> // does happen. <add> return currentTime + 250; <add> case DefaultHydrationLane: <add> case DefaultLane: <add> case TransitionHydrationLane: <add> case TransitionLane1: <add> case TransitionLane2: <add> case TransitionLane3: <add> case TransitionLane4: <add> case TransitionLane5: <add> case TransitionLane6: <add> case TransitionLane7: <add> case TransitionLane8: <add> case TransitionLane9: <add> case TransitionLane10: <add> case TransitionLane11: <add> case TransitionLane12: <add> case TransitionLane13: <add> case TransitionLane14: <add> case TransitionLane15: <add> case TransitionLane16: <add> case RetryLane1: <add> case RetryLane2: <add> case RetryLane3: <add> case RetryLane4: <add> case RetryLane5: <add> return currentTime + 5000; <add> case SelectiveHydrationLane: <add> case IdleHydrationLane: <add> case IdleLane: <add> case OffscreenLane: <add> // Anything idle priority or lower should never expire. <add> return NoTimestamp; <add> default: <add> if (__DEV__) { <add> console.error( <add> 'Should have found matching lanes. This is a bug in React.', <add> ); <add> } <add> return NoTimestamp; <ide> } <ide> } <ide>
2
Ruby
Ruby
remove some more globals from tests
5d4fce640ef80b2e50589625320dd011d1097dda
<ide><path>railties/test/application/multiple_applications_test.rb <ide> def test_initialize_new_application_with_all_previous_initialization_variables <ide> end <ide> <ide> def test_rake_tasks_defined_on_different_applications_go_to_the_same_class <del> $run_count = 0 <add> run_count = 0 <ide> <ide> application1 = AppTemplate::Application.new <ide> application1.rake_tasks do <del> $run_count += 1 <add> run_count += 1 <ide> end <ide> <ide> application2 = AppTemplate::Application.new <ide> application2.rake_tasks do <del> $run_count += 1 <add> run_count += 1 <ide> end <ide> <ide> require "#{app_path}/config/environment" <ide> <del> assert_equal 0, $run_count, "The count should stay at zero without any calls to the rake tasks" <add> assert_equal 0, run_count, "The count should stay at zero without any calls to the rake tasks" <ide> require 'rake' <ide> require 'rake/testtask' <ide> require 'rdoc/task' <ide> Rails.application.load_tasks <del> assert_equal 2, $run_count, "Calling a rake task should result in two increments to the count" <add> assert_equal 2, run_count, "Calling a rake task should result in two increments to the count" <ide> end <ide> <ide> def test_multiple_applications_can_be_initialized <ide> def test_multiple_applications_can_be_initialized <ide> <ide> def test_initializers_run_on_different_applications_go_to_the_same_class <ide> application1 = AppTemplate::Application.new <del> $run_count = 0 <add> run_count = 0 <ide> <ide> AppTemplate::Application.initializer :init0 do <del> $run_count += 1 <add> run_count += 1 <ide> end <ide> <ide> application1.initializer :init1 do <del> $run_count += 1 <add> run_count += 1 <ide> end <ide> <ide> AppTemplate::Application.new.initializer :init2 do <del> $run_count += 1 <add> run_count += 1 <ide> end <ide> <del> assert_equal 0, $run_count, "Without loading the initializers, the count should be 0" <add> assert_equal 0, run_count, "Without loading the initializers, the count should be 0" <ide> <ide> # Set config.eager_load to false so that an eager_load warning doesn't pop up <ide> AppTemplate::Application.new { config.eager_load = false }.initialize! <ide> <del> assert_equal 3, $run_count, "There should have been three initializers that incremented the count" <add> assert_equal 3, run_count, "There should have been three initializers that incremented the count" <ide> end <ide> <ide> def test_consoles_run_on_different_applications_go_to_the_same_class <del> $run_count = 0 <del> AppTemplate::Application.console { $run_count += 1 } <del> AppTemplate::Application.new.console { $run_count += 1 } <add> run_count = 0 <add> AppTemplate::Application.console { run_count += 1 } <add> AppTemplate::Application.new.console { run_count += 1 } <ide> <del> assert_equal 0, $run_count, "Without loading the consoles, the count should be 0" <add> assert_equal 0, run_count, "Without loading the consoles, the count should be 0" <ide> Rails.application.load_console <del> assert_equal 2, $run_count, "There should have been two consoles that increment the count" <add> assert_equal 2, run_count, "There should have been two consoles that increment the count" <ide> end <ide> <ide> def test_generators_run_on_different_applications_go_to_the_same_class <del> $run_count = 0 <del> AppTemplate::Application.generators { $run_count += 1 } <del> AppTemplate::Application.new.generators { $run_count += 1 } <add> run_count = 0 <add> AppTemplate::Application.generators { run_count += 1 } <add> AppTemplate::Application.new.generators { run_count += 1 } <ide> <del> assert_equal 0, $run_count, "Without loading the generators, the count should be 0" <add> assert_equal 0, run_count, "Without loading the generators, the count should be 0" <ide> Rails.application.load_generators <del> assert_equal 2, $run_count, "There should have been two generators that increment the count" <add> assert_equal 2, run_count, "There should have been two generators that increment the count" <ide> end <ide> <ide> def test_runners_run_on_different_applications_go_to_the_same_class <del> $run_count = 0 <del> AppTemplate::Application.runner { $run_count += 1 } <del> AppTemplate::Application.new.runner { $run_count += 1 } <add> run_count = 0 <add> AppTemplate::Application.runner { run_count += 1 } <add> AppTemplate::Application.new.runner { run_count += 1 } <ide> <del> assert_equal 0, $run_count, "Without loading the runners, the count should be 0" <add> assert_equal 0, run_count, "Without loading the runners, the count should be 0" <ide> Rails.application.load_runner <del> assert_equal 2, $run_count, "There should have been two runners that increment the count" <add> assert_equal 2, run_count, "There should have been two runners that increment the count" <ide> end <ide> <ide> def test_isolate_namespace_on_an_application
1
Javascript
Javascript
remove duplicate assignment
9012ab9ace5086fc7c56f5e3be4690d78e398845
<ide><path>lib/ContextModule.js <ide> class ContextModule extends Module { <ide> identifier += " strict namespace object"; <ide> else if (this.options.namespaceObject) identifier += " namespace object"; <ide> <del> this._identifier = identifier; <del> <ide> return identifier; <ide> } <ide>
1
Text
Text
clearify changelog for [ci skip]
ffded19faf497c0a0bb392c07f98d9eee62f6925
<ide><path>activesupport/CHANGELOG.md <del>* Fix parsing JSON time in `YYYY-MM-DD hh:mm:ss` (without `Z`). <del> Before such time was considered in UTC timezone, now, to comply with standard, it uses local timezone. <add>* Support parsing JSON time in ISO8601 local time strings in <add> `ActiveSupport::JSON.decode` when `parse_json_times` is enabled. <add> Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at <add> the end) will be parsed in the local timezone (`Time.zone`). In <add> addition, date strings (`YYYY-MM-DD`) are now parsed into `Date` <add> objects. <ide> <ide> *Grzegorz Witek* <ide> <ide><path>guides/source/5_0_release_notes.md <ide> Please refer to the [Changelog][active-support] for detailed changes. <ide> <ide> * `ActiveSupport::JSON.decode` now supports parsing ISO8601 local times when <ide> `parse_json_times` is enabled. <del> ([Pull Request](https://github.com/rails/rails/pull/16917)) <add> ([Pull Request](https://github.com/rails/rails/pull/23011)) <ide> <ide> * `ActiveSupport::JSON.decode` now return `Date` objects for date strings. <del> ([Pull Request](https://github.com/rails/rails/pull/16917)) <add> ([Pull Request](https://github.com/rails/rails/pull/23011)) <ide> <ide> * Added ability to `TaggedLogging` to allow loggers to be instantiated multiple <ide> times so that they don't share tags with each other.
2
PHP
PHP
change the name of the tags class to tagset
6bbfa3bf5a698e75bc2f417a44fe63eefd038ba6
<add><path>src/Illuminate/Cache/TagSet.php <del><path>src/Illuminate/Cache/Tags.php <ide> <?php namespace Illuminate\Cache; <ide> <del>class Tags { <add>class TagSet { <ide> <ide> /** <ide> * The cache store implementation. <ide> class Tags { <ide> protected $names = array(); <ide> <ide> /** <del> * Create a new tags instance. <add> * Create a new TagSet instance. <ide> * <ide> * @param \Illuminate\Cache\StoreInterface $store <ide> * @param string $names <ide><path>src/Illuminate/Cache/TaggedCache.php <ide> class TaggedCache implements StoreInterface { <ide> */ <ide> public function __construct(StoreInterface $store, $names) <ide> { <del> $this->tags = new Tags($store, $names); <add> $this->tags = new TagSet($store, $names); <ide> $this->store = $store; <ide> } <ide>
2
Javascript
Javascript
run bintestcases without deprecations
3f453a4f3ce37666dd5732b061fd12cbade549e8
<ide><path>test/BinTestCases.test.js <ide> const child_process = require("child_process"); <ide> <ide> function spawn(args, options) { <ide> if(process.env.running_under_istanbul) { <del> args = [require.resolve("istanbul/lib/cli.js"), "cover", "--report", "none", "--print", "none", "--include-pid", "--dir", path.resolve("coverage"), "--", require.resolve("./helpers/exec-in-directory.js"), options.cwd].concat(args); <add> args = ["--no-deprecation", require.resolve("istanbul/lib/cli.js"), "cover", "--report", "none", "--print", "none", "--include-pid", "--dir", path.resolve("coverage"), "--", require.resolve("./helpers/exec-in-directory.js"), options.cwd].concat(args); <ide> options = Object.assign({}, options, { <ide> cwd: undefined <ide> }); <ide> } <del> return child_process.spawn(process.execPath, args, options); <add> return child_process.spawn(process.execPath, ["--no-deprecation"].concat(args), options); <ide> } <ide> <ide> function loadOptsFile(optsPath) {
1
PHP
PHP
fix styleci stuff
ba6f51822405f4a6ee4e3cb12b651504f95f31e4
<ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testPostgresUpdateWrappingJsonArrayAndObject() <ide> $builder->getConnection()->shouldReceive('update') <ide> ->with('update "users" set "options" = ?, "meta" = jsonb_set("meta"::jsonb, \'{"tags"}\', ?), "group_id" = 45', [ <ide> json_encode(['2fa' => false, 'presets' => ['laravel', 'vue']]), <del> json_encode(['white', 'large']) <add> json_encode(['white', 'large']), <ide> ]); <ide> <ide> $builder->from('users')->update([
1
Ruby
Ruby
upload documentation to the new server
928206259bfcceb282a4e2aa6994ecdb216b22c3
<ide><path>release.rb <ide> `cd release/railties && rake template=jamis package` <ide> <ide> # Upload documentation <del>`cd release/rails/doc/api && scp -r * [email protected]:public_html/rails` <add>`cd release/rails/doc/api && scp -r * [email protected]:public_html/rails` <ide> PACKAGES.each do |p| <ide> `cd release/#{p} && echo "Publishing documentation for #{p}" && rake template=jamis pdoc` <ide> end
1
PHP
PHP
add test case
93f5d920ef75cf49acad1fa0113a83209c23f00c
<ide><path>tests/TestCase/Database/Type/DateTimeTypeTest.php <ide> public function marshalProvider() <ide> [1392387900, new Time('@1392387900')], <ide> ['2014-02-14 00:00:00', new Time('2014-02-14 00:00:00')], <ide> ['2014-02-14 13:14:15', new Time('2014-02-14 13:14:15')], <add> ['2017-04-05T17:18:00+00:00', new Time('2017-04-05T17:18:00+00:00')], <ide> <ide> // valid array types <ide> [
1