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
pull shared behavior into superclass
d476a84f4f1829cff818d18458d77f17c698fc92
<ide><path>Library/Homebrew/formulary.rb <ide> class FormulaLoader <ide> attr_reader :path <ide> <ide> # Gets the formula instance. <del> # Subclasses must define this. <del> def get_formula; end <add> def get_formula <add> klass.new(name, path) <add> end <ide> <ide> # Return the Class for this formula, `require`-ing it if <ide> # it has not been parsed before. <ide> def initialize bottle_name <ide> end <ide> <ide> def get_formula <del> formula = klass.new(name, path) <add> formula = super <ide> formula.local_bottle_path = @bottle_filename <del> return formula <add> formula <ide> end <ide> end <ide> <ide> def initialize name <ide> @name = name <ide> @path = Formula.path(name) <ide> end <del> <del> def get_formula <del> klass.new(name, path) <del> end <ide> end <ide> <ide> # Loads formulae from disk using a path <ide> def initialize path <ide> @path = Pathname.new(path).expand_path <ide> @name = @path.stem <ide> end <del> <del> def get_formula <del> klass.new(name, path) <del> end <ide> end <ide> <ide> # Loads formulae from URLs <ide> def fetch <ide> end <ide> <ide> def get_formula <del> return klass.new(name, path) <add> fetch <add> super <ide> end <ide> end <ide> <ide> def initialize tapped_name <ide> end <ide> <ide> def get_formula <del> klass.new(name, path) <add> super <ide> rescue FormulaUnavailableError => e <ide> raise TapFormulaUnavailableError.new(e.name) <ide> end <ide> def self.factory ref <ide> # If a URL is passed, download to the cache and install <ide> if ref =~ %r[(https?|ftp)://] <ide> f = FromUrlLoader.new(ref) <del> f.fetch <ide> elsif ref =~ Pathname::BOTTLE_EXTNAME_RX <ide> f = BottleLoader.new(ref) <ide> else
1
Javascript
Javascript
remove stream.pause/resume calls
81e356279dcd37fda20d827fbab3550026e74c63
<ide><path>lib/child_process.js <ide> var handleConversion = { <ide> 'net.Socket': { <ide> send: function(message, socket) { <ide> // pause socket so no data is lost, will be resumed later <del> socket.pause(); <ide> <ide> // if the socket wsa created by net.Server <ide> if (socket.server) { <ide> var handleConversion = { <ide> got: function(message, handle, emit) { <ide> var socket = new net.Socket({handle: handle}); <ide> socket.readable = socket.writable = true; <del> socket.pause(); <ide> <ide> // if the socket was created by net.Server we will track the socket <ide> if (message.key) { <ide> var handleConversion = { <ide> } <ide> <ide> emit(socket); <del> socket.resume(); <ide> } <ide> } <ide> };
1
Java
Java
add ifpresent utility methods on runtimehints
d6d4b98780132fff58ba610d2cde53419d32ce4a
<ide><path>spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java <ide> <ide> import org.springframework.aot.hint.TypeHint.Builder; <ide> import org.springframework.lang.Nullable; <add>import org.springframework.util.ClassUtils; <ide> <ide> /** <ide> * Gather the need for reflection at runtime. <ide> public ReflectionHints registerType(Class<?> type, Consumer<TypeHint.Builder> ty <ide> return registerType(TypeReference.of(type), typeHint); <ide> } <ide> <add> /** <add> * Register or customize reflection hints for the specified type if it <add> * is available using the specified {@link ClassLoader}. <add> * @param classLoader the classloader to use to check if the type is present <add> * @param typeName the type to customize <add> * @param typeHint a builder to further customize hints for that type <add> * @return {@code this}, to facilitate method chaining <add> */ <add> public ReflectionHints registerTypeIfPresent(@Nullable ClassLoader classLoader, <add> String typeName, Consumer<TypeHint.Builder> typeHint) { <add> if (ClassUtils.isPresent(typeName, classLoader)) { <add> registerType(TypeReference.of(typeName), typeHint); <add> } <add> return this; <add> } <add> <ide> /** <ide> * Register or customize reflection hints for the types defined by the <ide> * specified list of {@link TypeReference type references}. The specified <ide><path>spring-core/src/main/java/org/springframework/aot/hint/ResourceHints.java <ide> public Stream<ResourceBundleHint> resourceBundles() { <ide> return this.resourceBundleHints.stream(); <ide> } <ide> <add> /** <add> * Register a pattern if the given {@code location} is available on the <add> * classpath. This delegates to {@link ClassLoader#getResource(String)} <add> * which validates directories as well. The location is not included in <add> * the hint. <add> * @param classLoader the classloader to use <add> * @param location a '/'-separated path name that should exist <add> * @param resourceHint a builder to customize the resource pattern <add> * @return {@code this}, to facilitate method chaining <add> */ <add> public ResourceHints registerPatternIfPresent(@Nullable ClassLoader classLoader, String location, Consumer<ResourcePatternHints.Builder> resourceHint) { <add> ClassLoader classLoaderToUse = (classLoader != null) ? classLoader : getClass().getClassLoader(); <add> if (classLoaderToUse.getResource(location) != null) { <add> registerPattern(resourceHint); <add> } <add> return this; <add> } <add> <ide> /** <ide> * Register that the resources matching the specified pattern should be <ide> * made available at runtime. <ide><path>spring-core/src/test/java/org/springframework/aot/hint/ReflectionHintsTests.java <ide> import org.springframework.util.ReflectionUtils; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <add>import static org.mockito.Mockito.mock; <add>import static org.mockito.Mockito.verifyNoInteractions; <ide> <ide> /** <ide> * Tests for {@link ReflectionHints}. <ide> void registerType() { <ide> typeWithMemberCategories(String.class, MemberCategory.DECLARED_FIELDS)); <ide> } <ide> <add> @Test <add> void registerTypeIfPresentRegisterExistingClass() { <add> this.reflectionHints.registerTypeIfPresent(null, String.class.getName(), <add> hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS)); <add> assertThat(this.reflectionHints.typeHints()).singleElement().satisfies( <add> typeWithMemberCategories(String.class, MemberCategory.DECLARED_FIELDS)); <add> } <add> <add> @Test <add> @SuppressWarnings("unchecked") <add> void registerTypeIfPresentIgnoreMissingClass() { <add> Consumer<TypeHint.Builder> hintBuilder = mock(Consumer.class); <add> this.reflectionHints.registerTypeIfPresent(null, "com.example.DoesNotExist", hintBuilder); <add> assertThat(this.reflectionHints.typeHints()).isEmpty(); <add> verifyNoInteractions(hintBuilder); <add> } <add> <ide> @Test <ide> void getTypeUsingType() { <ide> this.reflectionHints.registerType(TypeReference.of(String.class), <ide><path>spring-core/src/test/java/org/springframework/aot/hint/ResourceHintsTests.java <ide> import org.springframework.aot.hint.ResourceHintsTests.Nested.Inner; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <add>import static org.mockito.Mockito.mock; <add>import static org.mockito.Mockito.verifyNoInteractions; <ide> <ide> /** <ide> * Tests for {@link ResourceHints}. <ide> void registerPatternWithIncludesAndExcludes() { <ide> List.of("com/example/to-ignore.properties"))); <ide> } <ide> <add> @Test <add> void registerIfPresentRegisterExistingLocation() { <add> this.resourceHints.registerPatternIfPresent(null, "META-INF/", <add> resourceHint -> resourceHint.includes("com/example/*.properties")); <add> assertThat(this.resourceHints.resourcePatterns()).singleElement().satisfies( <add> patternOf("com/example/*.properties")); <add> } <add> <add> @Test <add> @SuppressWarnings("unchecked") <add> void registerIfPresentIgnoreMissingLocation() { <add> Consumer<ResourcePatternHints.Builder> hintBuilder = mock(Consumer.class); <add> this.resourceHints.registerPatternIfPresent(null, "location/does-not-exist/", hintBuilder); <add> assertThat(this.resourceHints.resourcePatterns()).isEmpty(); <add> verifyNoInteractions(hintBuilder); <add> } <add> <ide> @Test <ide> void registerResourceBundle() { <ide> this.resourceHints.registerResourceBundle("com.example.message");
4
Ruby
Ruby
remove unused requires
8189abc1f23b78e4cad3857848a1333fd77eca37
<ide><path>activerecord/test/cases/serialized_attribute_test.rb <ide> # frozen_string_literal: true <ide> <ide> require "cases/helper" <del>require "models/topic" <ide> require "models/person" <ide> require "models/traffic_light" <ide> require "models/post" <del>require "bcrypt" <ide> <ide> class SerializedAttributeTest < ActiveRecord::TestCase <ide> fixtures :topics, :posts
1
Javascript
Javascript
add promise support to asyncstorage
2aa52880b73af86daa069232fb38ad2249568ec1
<ide><path>Examples/UIExplorer/AsyncStorageExample.js <ide> var COLORS = ['red', 'orange', 'yellow', 'green', 'blue']; <ide> <ide> var BasicStorageExample = React.createClass({ <ide> componentDidMount() { <del> AsyncStorage.getItem(STORAGE_KEY, (error, value) => { <del> if (error) { <del> this._appendMessage('AsyncStorage error: ' + error.message); <del> } else if (value !== null) { <del> this.setState({selectedValue: value}); <del> this._appendMessage('Recovered selection from disk: ' + value); <del> } else { <del> this._appendMessage('Initialized with no selection on disk.'); <del> } <del> }); <add> AsyncStorage.getItem(STORAGE_KEY) <add> .then((value) => { <add> if (value !== null){ <add> this.setState({selectedValue: value}); <add> this._appendMessage('Recovered selection from disk: ' + value); <add> } else { <add> this._appendMessage('Initialized with no selection on disk.'); <add> } <add> }) <add> .catch((error) => this._appendMessage('AsyncStorage error: ' + error.message)) <add> .done(); <ide> }, <ide> getInitialState() { <ide> return { <ide> var BasicStorageExample = React.createClass({ <ide> <ide> _onValueChange(selectedValue) { <ide> this.setState({selectedValue}); <del> AsyncStorage.setItem(STORAGE_KEY, selectedValue, (error) => { <del> if (error) { <del> this._appendMessage('AsyncStorage error: ' + error.message); <del> } else { <del> this._appendMessage('Saved selection to disk: ' + selectedValue); <del> } <del> }); <add> AsyncStorage.setItem(STORAGE_KEY, selectedValue) <add> .then(() => this._appendMessage('Saved selection to disk: ' + selectedValue)) <add> .catch((error) => this._appendMessage('AsyncStorage error: ' + error.message)) <add> .done(); <ide> }, <ide> <ide> _removeStorage() { <del> AsyncStorage.removeItem(STORAGE_KEY, (error) => { <del> if (error) { <del> this._appendMessage('AsyncStorage error: ' + error.message); <del> } else { <del> this._appendMessage('Selection removed from disk.'); <del> } <del> }); <add> AsyncStorage.removeItem(STORAGE_KEY) <add> .then(() => this._appendMessage('Selection removed from disk.')) <add> .catch((error) => { this._appendMessage('AsyncStorage error: ' + error.message) }) <add> .done(); <ide> }, <ide> <ide> _appendMessage(message) { <ide><path>Libraries/Storage/AsyncStorage.ios.js <ide> var RCTAsyncStorage = RCTAsyncRocksDBStorage || RCTAsyncLocalStorage; <ide> * operates globally. <ide> * <ide> * This JS code is a simple facad over the native iOS implementation to provide <del> * a clear JS API, real Error objects, and simple non-multi functions. <add> * a clear JS API, real Error objects, and simple non-multi functions. Each <add> * method returns a `Promise` object. <ide> */ <ide> var AsyncStorage = { <ide> /** <ide> * Fetches `key` and passes the result to `callback`, along with an `Error` if <del> * there is any. <add> * there is any. Returns a `Promise` object. <ide> */ <ide> getItem: function( <ide> key: string, <ide> callback: (error: ?Error, result: ?string) => void <del> ): void { <del> RCTAsyncStorage.multiGet([key], function(errors, result) { <del> // Unpack result to get value from [[key,value]] <del> var value = (result && result[0] && result[0][1]) ? result[0][1] : null; <del> callback((errors && convertError(errors[0])) || null, value); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiGet([key], function(errors, result) { <add> // Unpack result to get value from [[key,value]] <add> var value = (result && result[0] && result[0][1]) ? result[0][1] : null; <add> callback && callback((errors && convertError(errors[0])) || null, value); <add> if (errors) { <add> reject(convertError(errors[0])); <add> } else { <add> resolve(value); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <ide> * Sets `value` for `key` and calls `callback` on completion, along with an <del> * `Error` if there is any. <add> * `Error` if there is any. Returns a `Promise` object. <ide> */ <ide> setItem: function( <ide> key: string, <ide> value: string, <ide> callback: ?(error: ?Error) => void <del> ): void { <del> RCTAsyncStorage.multiSet([[key,value]], function(errors) { <del> callback && callback((errors && convertError(errors[0])) || null); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiSet([[key,value]], function(errors) { <add> callback && callback((errors && convertError(errors[0])) || null); <add> if (errors) { <add> reject(convertError(errors[0])); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <del> <add> /** <add> * Returns a `Promise` object. <add> */ <ide> removeItem: function( <ide> key: string, <ide> callback: ?(error: ?Error) => void <del> ): void { <del> RCTAsyncStorage.multiRemove([key], function(errors) { <del> callback && callback((errors && convertError(errors[0])) || null); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiRemove([key], function(errors) { <add> callback && callback((errors && convertError(errors[0])) || null); <add> if (errors) { <add> reject(convertError(errors[0])); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <del> * Merges existing value with input value, assuming they are stringified json. <add> * Merges existing value with input value, assuming they are stringified json. Returns a `Promise` object. <ide> * <ide> * Not supported by all native implementations. <ide> */ <ide> mergeItem: function( <ide> key: string, <ide> value: string, <ide> callback: ?(error: ?Error) => void <del> ): void { <del> RCTAsyncStorage.multiMerge([[key,value]], function(errors) { <del> callback && callback((errors && convertError(errors[0])) || null); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiMerge([[key,value]], function(errors) { <add> callback && callback((errors && convertError(errors[0])) || null); <add> if (errors) { <add> reject(convertError(errors[0])); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <ide> * Erases *all* AsyncStorage for all clients, libraries, etc. You probably <ide> * don't want to call this - use removeItem or multiRemove to clear only your <del> * own keys instead. <add> * own keys instead. Returns a `Promise` object. <ide> */ <del> clear: function(callback: ?(error: ?Error) => void) { <del> RCTAsyncStorage.clear(function(error) { <del> callback && callback(convertError(error)); <add> clear: function(callback: ?(error: ?Error) => void): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.clear(function(error) { <add> callback && callback(convertError(error)); <add> if (error && convertError(error)){ <add> reject(convertError(error)); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <del> * Gets *all* keys known to the system, for all callers, libraries, etc. <add> * Gets *all* keys known to the system, for all callers, libraries, etc. Returns a `Promise` object. <ide> */ <del> getAllKeys: function(callback: (error: ?Error) => void) { <del> RCTAsyncStorage.getAllKeys(function(error, keys) { <del> callback(convertError(error), keys); <add> getAllKeys: function(callback: (error: ?Error) => void): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.getAllKeys(function(error, keys) { <add> callback && callback(convertError(error), keys); <add> if (error) { <add> reject(convertError(error)); <add> } else { <add> resolve(keys); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> var AsyncStorage = { <ide> <ide> /** <ide> * multiGet invokes callback with an array of key-value pair arrays that <del> * matches the input format of multiSet. <add> * matches the input format of multiSet. Returns a `Promise` object. <ide> * <ide> * multiGet(['k1', 'k2'], cb) -> cb([['k1', 'val1'], ['k2', 'val2']]) <ide> */ <ide> multiGet: function( <ide> keys: Array<string>, <ide> callback: (errors: ?Array<Error>, result: ?Array<Array<string>>) => void <del> ): void { <del> RCTAsyncStorage.multiGet(keys, function(errors, result) { <del> callback( <del> (errors && errors.map((error) => convertError(error))) || null, <del> result <del> ); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiGet(keys, function(errors, result) { <add> var error = (errors && errors.map((error) => convertError(error))) || null; <add> callback && callback(error, result); <add> if (errors) { <add> reject(error); <add> } else { <add> resolve(result); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <ide> * multiSet and multiMerge take arrays of key-value array pairs that match <del> * the output of multiGet, e.g. <add> * the output of multiGet, e.g. Returns a `Promise` object. <ide> * <ide> * multiSet([['k1', 'val1'], ['k2', 'val2']], cb); <ide> */ <ide> multiSet: function( <ide> keyValuePairs: Array<Array<string>>, <ide> callback: ?(errors: ?Array<Error>) => void <del> ): void { <del> RCTAsyncStorage.multiSet(keyValuePairs, function(errors) { <del> callback && callback( <del> (errors && errors.map((error) => convertError(error))) || null <del> ); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiSet(keyValuePairs, function(errors) { <add> var error = (errors && errors.map((error) => convertError(error))) || null; <add> callback && callback(error); <add> if (errors) { <add> reject(error); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <del> * Delete all the keys in the `keys` array. <add> * Delete all the keys in the `keys` array. Returns a `Promise` object. <ide> */ <ide> multiRemove: function( <ide> keys: Array<string>, <ide> callback: ?(errors: ?Array<Error>) => void <del> ): void { <del> RCTAsyncStorage.multiRemove(keys, function(errors) { <del> callback && callback( <del> (errors && errors.map((error) => convertError(error))) || null <del> ); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiRemove(keys, function(errors) { <add> var error = (errors && errors.map((error) => convertError(error))) || null; <add> callback && callback(error); <add> if (errors) { <add> reject(error); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <ide> <ide> /** <ide> * Merges existing values with input values, assuming they are stringified <del> * json. <add> * json. Returns a `Promise` object. <ide> * <ide> * Not supported by all native implementations. <ide> */ <ide> multiMerge: function( <ide> keyValuePairs: Array<Array<string>>, <ide> callback: ?(errors: ?Array<Error>) => void <del> ): void { <del> RCTAsyncStorage.multiMerge(keyValuePairs, function(errors) { <del> callback && callback( <del> (errors && errors.map((error) => convertError(error))) || null <del> ); <add> ): Promise { <add> return new Promise((resolve, reject) => { <add> RCTAsyncStorage.multiMerge(keyValuePairs, function(errors) { <add> var error = (errors && errors.map((error) => convertError(error))) || null; <add> callback && callback(error); <add> if (errors) { <add> reject(error); <add> } else { <add> resolve(null); <add> } <add> }); <ide> }); <ide> }, <ide> };
2
Javascript
Javascript
add .tojson to bufferattribute
672258ec1dcaf18a809d1b2b52628540f1290ee7
<ide><path>src/core/BufferAttribute.js <ide> Object.assign( BufferAttribute.prototype, { <ide> <ide> return new this.constructor( this.array, this.itemSize ).copy( this ); <ide> <add> }, <add> <add> toJSON: function() { <add> <add> return { <add> itemSize: this.itemSize, <add> type: this.array.constructor.name, <add> array: Array.prototype.slice.call( this.array ), <add> normalized: this.normalized <add> }; <ide> } <ide> <ide> } ); <ide><path>src/core/BufferGeometry.js <ide> BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy <ide> <ide> var attribute = attributes[ key ]; <ide> <del> var attributeData = { <del> itemSize: attribute.itemSize, <del> type: attribute.array.constructor.name, <del> array: Array.prototype.slice.call( attribute.array ), <del> normalized: attribute.normalized <del> }; <add> var attributeData = attribute.toJSON(); <ide> <ide> if ( attribute.name !== '' ) attributeData.name = attribute.name; <ide> <ide> BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy <ide> <ide> var attribute = attributeArray[ i ]; <ide> <del> var attributeData = { <del> itemSize: attribute.itemSize, <del> type: attribute.array.constructor.name, <del> array: Array.prototype.slice.call( attribute.array ), <del> normalized: attribute.normalized <del> }; <add> var attributeData = attribute.toJSON(); <ide> <ide> if ( attribute.name !== '' ) attributeData.name = attribute.name; <ide> <ide><path>src/core/InstancedBufferAttribute.js <ide> InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribu <ide> <ide> return this; <ide> <add> }, <add> <add> toJSON: function () { <add> <add> var data = BufferAttribute.prototype.toJSON.call( this ); <add> <add> data.meshPerAttribute = this.meshPerAttribute; <add> <add> data.isInstancedBufferAttribute = true; <add> <add> return data; <add> <ide> } <ide> <ide> } );
3
Text
Text
fix url example to match behavior
3b1baf63722b34c75e75d2e9f0f21e867e113332
<ide><path>doc/api/url.md <ide> const myURL = new URL('https://%CF%80.example.com/foo'); <ide> console.log(myURL.href); <ide> // Prints https://xn--1xa.example.com/foo <ide> console.log(myURL.origin); <del>// Prints https://π.example.com <add>// Prints https://xn--1xa.example.com <ide> ``` <ide> <ide> [`Error`]: errors.html#errors_class_error
1
Javascript
Javascript
support multiple `setstate` invocation
2264e3d04401fc15192a253baaf0ad923096f4b8
<ide><path>src/renderers/testing/ReactShallowRendererEntry.js <ide> class Updater { <ide> } <ide> <ide> enqueueSetState(publicInstance, partialState, callback, callerName) { <add> const currentState = this._renderer._newState || publicInstance.state; <add> <ide> if (typeof partialState === 'function') { <del> partialState = partialState(publicInstance.state, publicInstance.props); <add> partialState = partialState(currentState, publicInstance.props); <ide> } <ide> <ide> this._renderer._newState = { <del> ...publicInstance.state, <add> ...currentState, <ide> ...partialState, <ide> }; <ide> <ide><path>src/renderers/testing/__tests__/ReactShallowRenderer-test.js <ide> describe('ReactShallowRenderer', () => { <ide> expect(result).toEqual(<div>doovy</div>); <ide> }); <ide> <add> it('can setState in componentWillMount repeatedly when shallow rendering', () => { <add> class SimpleComponent extends React.Component { <add> state = { <add> separator: '-', <add> }; <add> <add> componentWillMount() { <add> this.setState({groovy: 'doovy'}); <add> this.setState({doovy: 'groovy'}); <add> } <add> <add> render() { <add> const {groovy, doovy, separator} = this.state; <add> <add> return <div>{`${groovy}${separator}${doovy}`}</div>; <add> } <add> } <add> <add> const shallowRenderer = createRenderer(); <add> const result = shallowRenderer.render(<SimpleComponent />); <add> expect(result).toEqual(<div>doovy-groovy</div>); <add> }); <add> <add> it('can setState in componentWillMount with an updater function repeatedly when shallow rendering', () => { <add> class SimpleComponent extends React.Component { <add> state = { <add> separator: '-', <add> }; <add> <add> componentWillMount() { <add> this.setState(state => ({groovy: 'doovy'})); <add> this.setState(state => ({doovy: state.groovy})); <add> } <add> <add> render() { <add> const {groovy, doovy, separator} = this.state; <add> <add> return <div>{`${groovy}${separator}${doovy}`}</div>; <add> } <add> } <add> <add> const shallowRenderer = createRenderer(); <add> const result = shallowRenderer.render(<SimpleComponent />); <add> expect(result).toEqual(<div>doovy-doovy</div>); <add> }); <add> <ide> it('can setState in componentWillReceiveProps when shallow rendering', () => { <ide> class SimpleComponent extends React.Component { <ide> state = {count: 0};
2
Javascript
Javascript
fill more gaps for format 6 dense array
a772c9a2e2c40abdc52aa266fc67b4ecfaa3ea00
<ide><path>fonts.js <ide> var Font = (function () { <ide> var firstCode = FontsUtils.bytesToInteger(font.getBytes(2)); <ide> var entryCount = FontsUtils.bytesToInteger(font.getBytes(2)); <ide> <del> // Since Format 6 is a dense array, check for gaps in the indexes <del> // to fill them later if needed <del> var gaps = []; <del> for (var j = 1; j <= entryCount; j++) <del> gaps.push(j); <del> <del> var encoding = properties.encoding; <ide> var glyphs = []; <add> var min = 0xffff, max = 0; <ide> for (var j = 0; j < entryCount; j++) { <ide> var charcode = FontsUtils.bytesToInteger(font.getBytes(2)); <del> var index = gaps.indexOf(charcode); <del> if (index != -1) <del> gaps.splice(index, 1); <add> glyphs.push(charcode); <ide> <del> glyphs.push({unicode: charcode + firstCode}); <add> if (charcode < min) <add> min = charcode; <add> if (charcode > max) <add> max = charcode; <ide> } <ide> <del> while (gaps.length) <del> glyphs.push({unicode: gaps.pop() + firstCode }); <add> // Since Format 6 is a dense array, check for gaps <add> for (var j = min; j < max; j++) { <add> if (glyphs.indexOf(j) == -1) <add> glyphs.push(j); <add> } <ide> <del> var ranges = getRanges(glyphs); <add> for (var j = 0; j < glyphs.length; j++) <add> glyphs[j] = { unicode: glyphs[j] + firstCode }; <ide> <del> var pos = firstCode; <del> var bias = 1; <del> for (var j = 0; j < ranges.length; j++) { <del> var range = ranges[j]; <del> var start = range[0]; <del> var end = range[1]; <del> for (var k = start; k < end; k++) { <del> encoding[pos] = glyphs[pos - firstCode].unicode; <del> pos++; <del> } <del> } <add> var ranges= getRanges(glyphs); <add> assert(ranges.length == 1, "Got " + ranges.length + " ranges in a dense array"); <add> <add> var encoding = properties.encoding; <add> var denseRange = ranges[0]; <add> var start = denseRange[0]; <add> var end = denseRange[1]; <add> var index = firstCode; <add> for (var j = start; j <= end; j++) <add> encoding[index++] = glyphs[j - firstCode - 1].unicode; <ide> cmap.data = createCMapTable(glyphs); <ide> } <ide> }
1
Javascript
Javascript
remove unused parameters
130aa3fd18ff20eefb9c1b8c8c29f7a1f0900820
<ide><path>packages/next/client/page-loader.js <ide> export default class PageLoader { <ide> } <ide> <ide> if (document.readyState === 'complete') { <del> return this.loadPage(route).catch((e) => {}) <add> return this.loadPage(route).catch(() => {}) <ide> } else { <del> return new Promise((resolve, reject) => { <add> return new Promise((resolve) => { <ide> window.addEventListener('load', () => { <ide> this.loadPage(route).then(() => resolve(), () => resolve()) <ide> })
1
Python
Python
fix version comparison bug on py25
909010af44d3cab2066bfe02a916a36fe1040e54
<ide><path>numpy/distutils/mingw32ccompiler.py <ide> def __init__ (self, <ide> # bad consequences, like using Py_ModuleInit4 instead of <ide> # Py_ModuleInit4_64, etc... So we add it here <ide> if get_build_architecture() == 'AMD64': <del> if self.gcc_version < "4.": <add> if self.gcc_version < "4.0": <ide> self.set_executables( <ide> compiler='gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wall', <ide> compiler_so='gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wall -Wstrict-prototypes', <ide> def __init__ (self, <ide> linker_exe='g++ -mno-cygwin', <ide> linker_so='%s -mno-cygwin -mdll -static %s' <ide> % (self.linker, entry_point)) <del> elif self.gcc_version < "4.": <add> elif self.gcc_version < "4.0": <ide> self.set_executables(compiler='gcc -mno-cygwin -O2 -Wall', <ide> compiler_so='gcc -mno-cygwin -O2 -Wall -Wstrict-prototypes', <ide> linker_exe='g++ -mno-cygwin',
1
Javascript
Javascript
reset handle index on close
0c294362502684b9273e7e7c7039ec7028471014
<ide><path>lib/cluster.js <ide> function workerInit() { <ide> <ide> // obj is a net#Server or a dgram#Socket object. <ide> cluster._getServer = function(obj, options, cb) { <del> const key = [ options.address, <del> options.port, <del> options.addressType, <del> options.fd ].join(':'); <del> if (indexes[key] === undefined) <del> indexes[key] = 0; <add> const indexesKey = [ options.address, <add> options.port, <add> options.addressType, <add> options.fd ].join(':'); <add> if (indexes[indexesKey] === undefined) <add> indexes[indexesKey] = 0; <ide> else <del> indexes[key]++; <add> indexes[indexesKey]++; <ide> <ide> const message = util._extend({ <ide> act: 'queryServer', <del> index: indexes[key], <add> index: indexes[indexesKey], <ide> data: null <ide> }, options); <ide> <ide> function workerInit() { <ide> if (obj._setServerData) obj._setServerData(reply.data); <ide> <ide> if (handle) <del> shared(reply, handle, cb); // Shared listen socket. <add> shared(reply, handle, indexesKey, cb); // Shared listen socket. <ide> else <del> rr(reply, cb); // Round-robin. <add> rr(reply, indexesKey, cb); // Round-robin. <ide> }); <ide> obj.once('listening', function() { <ide> cluster.worker.state = 'listening'; <ide> function workerInit() { <ide> }; <ide> <ide> // Shared listen socket. <del> function shared(message, handle, cb) { <add> function shared(message, handle, indexesKey, cb) { <ide> var key = message.key; <ide> // Monkey-patch the close() method so we can keep track of when it's <ide> // closed. Avoids resource leaks when the handle is short-lived. <ide> var close = handle.close; <ide> handle.close = function() { <ide> send({ act: 'close', key: key }); <ide> delete handles[key]; <add> delete indexes[indexesKey]; <ide> return close.apply(this, arguments); <ide> }; <ide> assert(handles[key] === undefined); <ide> function workerInit() { <ide> } <ide> <ide> // Round-robin. Master distributes handles across workers. <del> function rr(message, cb) { <add> function rr(message, indexesKey, cb) { <ide> if (message.errno) <ide> return cb(message.errno, null); <ide> <ide> function workerInit() { <ide> if (key === undefined) return; <ide> send({ act: 'close', key: key }); <ide> delete handles[key]; <add> delete indexes[indexesKey]; <ide> key = undefined; <ide> } <ide> <ide><path>test/parallel/test-cluster-server-restart-none.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const cluster = require('cluster'); <add> <add>cluster.schedulingPolicy = cluster.SCHED_NONE; <add> <add>if (cluster.isMaster) { <add> const worker1 = cluster.fork(); <add> worker1.on('listening', common.mustCall(() => { <add> const worker2 = cluster.fork(); <add> worker2.on('exit', (code, signal) => { <add> assert.strictEqual(code, 0, 'worker2 did not exit normally'); <add> assert.strictEqual(signal, null, 'worker2 did not exit normally'); <add> worker1.disconnect(); <add> }); <add> })); <add> <add> worker1.on('exit', common.mustCall((code, signal) => { <add> assert.strictEqual(code, 0, 'worker1 did not exit normally'); <add> assert.strictEqual(signal, null, 'worker1 did not exit normally'); <add> })); <add>} else { <add> const net = require('net'); <add> const server = net.createServer(); <add> server.listen(common.PORT, common.mustCall(() => { <add> if (cluster.worker.id === 2) { <add> server.close(() => { <add> server.listen(common.PORT, common.mustCall(() => { <add> server.close(() => { <add> process.disconnect(); <add> }); <add> })); <add> }); <add> } <add> })); <add>} <ide><path>test/parallel/test-cluster-server-restart-rr.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const cluster = require('cluster'); <add> <add>cluster.schedulingPolicy = cluster.SCHED_RR; <add> <add>if (cluster.isMaster) { <add> const worker1 = cluster.fork(); <add> worker1.on('listening', common.mustCall(() => { <add> const worker2 = cluster.fork(); <add> worker2.on('exit', (code, signal) => { <add> assert.strictEqual(code, 0, 'worker2 did not exit normally'); <add> assert.strictEqual(signal, null, 'worker2 did not exit normally'); <add> worker1.disconnect(); <add> }); <add> })); <add> <add> worker1.on('exit', common.mustCall((code, signal) => { <add> assert.strictEqual(code, 0, 'worker1 did not exit normally'); <add> assert.strictEqual(signal, null, 'worker1 did not exit normally'); <add> })); <add>} else { <add> const net = require('net'); <add> const server = net.createServer(); <add> server.listen(common.PORT, common.mustCall(() => { <add> if (cluster.worker.id === 2) { <add> server.close(() => { <add> server.listen(common.PORT, common.mustCall(() => { <add> server.close(() => { <add> process.disconnect(); <add> }); <add> })); <add> }); <add> } <add> })); <add>}
3
Ruby
Ruby
improve inspect output for dependency collections
1a1f9aa323ae03ac59ae5ba4c006ef459a586b68
<ide><path>Library/Homebrew/dependencies.rb <ide> def ==(other) <ide> deps == other.deps <ide> end <ide> alias_method :eql?, :== <add> <add> def inspect <add> "#<#{self.class.name}: #{to_a.inspect}>" <add> end <ide> end <ide> <ide> class Requirements
1
Java
Java
fix failing test
8edbdf4ddb144cc4abd5e8cdf14d99c9732f6d4d
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/adapter/jetty/JettyWebSocketHandlerAdapterTests.java <ide> package org.springframework.web.socket.adapter.jetty; <ide> <ide> import org.eclipse.jetty.websocket.api.Session; <add>import org.eclipse.jetty.websocket.api.UpgradeRequest; <add>import org.eclipse.jetty.websocket.api.UpgradeResponse; <ide> import org.junit.Before; <ide> import org.junit.Test; <add>import org.mockito.Mockito; <ide> import org.springframework.web.socket.CloseStatus; <ide> import org.springframework.web.socket.WebSocketHandler; <ide> import org.springframework.web.socket.adapter.jetty.JettyWebSocketHandlerAdapter; <ide> public class JettyWebSocketHandlerAdapterTests { <ide> @Before <ide> public void setup() { <ide> this.session = mock(Session.class); <add> when(this.session.getUpgradeRequest()).thenReturn(Mockito.mock(UpgradeRequest.class)); <add> when(this.session.getUpgradeResponse()).thenReturn(Mockito.mock(UpgradeResponse.class)); <add> <ide> this.webSocketHandler = mock(WebSocketHandler.class); <ide> this.webSocketSession = new JettyWebSocketSession(null, null); <ide> this.adapter = new JettyWebSocketHandlerAdapter(this.webSocketHandler, this.webSocketSession);
1
Javascript
Javascript
restore only the contents of the challenge files
003492cd7c9c7d35e715907bab33085bf4d19093
<ide><path>client/src/templates/Challenges/redux/code-storage-epic.js <ide> function loadCodeEpic(action$, state$) { <ide> <ide> const codeFound = getCode(id); <ide> if (codeFound && isFilesAllPoly(codeFound)) { <del> finalFiles = codeFound; <add> finalFiles = { <add> ...fileKeys.map(key => files[key]).reduce( <add> (files, file) => ({ <add> ...files, <add> [file.key]: { <add> ...file, <add> contents: codeFound[file.key] <add> ? codeFound[file.key].contents <add> : file.contents <add> } <add> }), <add> {} <add> ) <add> }; <ide> } else { <ide> const legacyCode = getLegacyCode(legacyKey); <ide> if (legacyCode && !invalidForLegacy) {
1
Ruby
Ruby
fix false flag handling
c6cddacc5ef10703db87b277158548f3959085f1
<ide><path>Library/Homebrew/utils/curl.rb <ide> def curl_http_content_headers_and_checksum( <ide> file = Tempfile.new.tap(&:close) <ide> <ide> specs = specs.flat_map do |option, argument| <del> next if argument == false # No flag. <add> next [] if argument == false # No flag. <ide> <ide> args = ["--#{option.to_s.tr("_", "-")}"] <ide> args << argument unless argument == true # It's a flag.
1
Go
Go
fix merge issue
b438565609917439cb4172717e5505c265c4e291
<ide><path>commands.go <ide> func (cli *DockerCli) CmdHelp(args ...string) error { <ide> return nil <ide> } <ide> } <del> help := fmt.Sprintf("Usage: docker [OPTIONS] COMMAND [arg...]\n -H=\"%s:%d\": Host:port to bind/connect to\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n", cli.addr, cli.port) <add> help := fmt.Sprintf("Usage: docker [OPTIONS] COMMAND [arg...]\n -H=\"%s:%d\": Host:port to bind/connect to\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n", cli.host, cli.port) <ide> for cmd, description := range map[string]string{ <ide> "attach": "Attach to a running container", <ide> "build": "Build a container from Dockerfile or via stdin", <ide> func (cli *DockerCli) call(method, path string, data interface{}) ([]byte, int, <ide> params = bytes.NewBuffer(buf) <ide> } <ide> <del> req, err := http.NewRequest(method, fmt.Sprintf("http://%s:%d/v%g%s", cli.addr, cli.port, API_VERSION, path), params) <add> req, err := http.NewRequest(method, fmt.Sprintf("http://%s:%d/v%g%s", cli.host, cli.port, API_VERSION, path), params) <ide> if err != nil { <ide> return nil, -1, err <ide> } <ide> func (cli *DockerCli) stream(method, path string, in io.Reader, out io.Writer) e <ide> if (method == "POST" || method == "PUT") && in == nil { <ide> in = bytes.NewReader([]byte{}) <ide> } <del> req, err := http.NewRequest(method, fmt.Sprintf("http://%s:%d/v%g%s", cli.addr, cli.port, API_VERSION, path), in) <add> req, err := http.NewRequest(method, fmt.Sprintf("http://%s:%d/v%g%s", cli.host, cli.port, API_VERSION, path), in) <ide> if err != nil { <ide> return err <ide> } <ide> func (cli *DockerCli) hijack(method, path string, setRawTerminal bool) error { <ide> return err <ide> } <ide> req.Header.Set("Content-Type", "plain/text") <del> dial, err := net.Dial("tcp", fmt.Sprintf("%s:%d", cli.addr, cli.port)) <add> dial, err := net.Dial("tcp", fmt.Sprintf("%s:%d", cli.host, cli.port)) <ide> if err != nil { <ide> return err <ide> } <ide><path>term/term.go <ide> package term <ide> <ide> import ( <del> "github.com/dotcloud/docker/utils" <ide> "os" <ide> "os/signal" <ide> "syscall"
2
Python
Python
allow dynamic backends in _need_convert_kernel
d7884570b10951d156aa086ee29a4df9eab79cf3
<ide><path>keras/applications/nasnet.py <ide> def NASNet(input_shape=None, <ide> RuntimeError: If attempting to run this model with a <ide> backend that does not support separable convolutions. <ide> ''' <del> if K.backend() != 'tensorflow': <add> if K.backend() in ['cntk', 'theano']: <ide> raise RuntimeError('Only TensorFlow backend is currently supported, ' <ide> 'as other backends do not support ' <ide> 'separable convolution.') <ide><path>keras/engine/saving.py <ide> def _need_convert_kernel(original_backend): <ide> uses_correlation = {'tensorflow': True, <ide> 'theano': False, <ide> 'cntk': True} <del> return uses_correlation[original_backend] != uses_correlation[K.backend()] <add> if original_backend not in uses_correlation: <add> # By default, do not convert the kernels if the original backend is unknown <add> return False <add> if K.backend() in uses_correlation: <add> current_uses_correlation = uses_correlation[K.backend()] <add> else: <add> # Assume unknown backends use correlation <add> current_uses_correlation = True <add> return uses_correlation[original_backend] != current_uses_correlation <ide> <ide> <ide> def load_weights_from_hdf5_group(f, layers, reshape=False):
2
Text
Text
update readme - fix example command distil*
fa735208c96c18283b8d2f3fcbfc3157bbd12b1e
<ide><path>examples/distillation/README.md <ide> python train.py \ <ide> --student_config training_configs/distilbert-base-uncased.json \ <ide> --teacher_type bert \ <ide> --teacher_name bert-base-uncased \ <del> --alpha_ce 5.0 --alpha_mlm 2.0 --alpha_cos 1.0 --mlm \ <add> --alpha_ce 5.0 --alpha_mlm 2.0 --alpha_cos 1.0 --alpha_clm 0.0 --mlm \ <ide> --freeze_pos_embs \ <ide> --dump_path serialization_dir/my_first_training \ <ide> --data_file data/binarized_text.bert-base-uncased.pickle \ <ide> python -m torch.distributed.launch \ <ide> --student_config training_configs/distilbert-base-uncased.json \ <ide> --teacher_type bert \ <ide> --teacher_name bert-base-uncased \ <del> --alpha_ce 0.33 --alpha_mlm 0.33 --alpha_cos 0.33 --mlm \ <add> --alpha_ce 0.33 --alpha_mlm 0.33 --alpha_cos 0.33 --alpha_clm 0.0 --mlm \ <ide> --freeze_pos_embs \ <ide> --dump_path serialization_dir/my_first_training \ <ide> --data_file data/binarized_text.bert-base-uncased.pickle \ <ide> If you find the ressource useful, you should cite the following paper: <ide> booktitle={NeurIPS EMC^2 Workshop}, <ide> year={2019} <ide> } <del>``` <ide>\ No newline at end of file <add>```
1
Ruby
Ruby
fix missing dependency
eeac054d59dd9373313596dc3ef9db30c4b227d5
<ide><path>activesupport/test/core_ext/string_ext_test.rb <ide> <ide> require 'active_support/core_ext/string' <ide> require 'active_support/core_ext/time' <add>require 'active_support/core_ext/kernel/reporting' <ide> <ide> class StringInflectionsTest < Test::Unit::TestCase <ide> include InflectorTestCases
1
PHP
PHP
update doc block for logserviceprovider
2167722748982e0124082f9f7a54795b6eb66e1c
<ide><path>app/Providers/LogServiceProvider.php <ide> class LogServiceProvider extends ServiceProvider { <ide> /** <ide> * Configure the application's logging facilities. <ide> * <add> * @param \Illuminate\Contracts\Logging\Log $log <ide> * @return void <ide> */ <ide> public function boot(Log $log)
1
Text
Text
fix broken link.
fdd3ede6aa8e3678d3034d8b4e347819de7707ee
<ide><path>docs/axes/labelling.md <ide> The method receives 3 arguments: <ide> <ide> * `value` - the tick value in the **internal data format** of the associated scale. <ide> * `index` - the tick index in the ticks array. <del>* `ticks` - the array containing all of the [tick objects](../api/interfaces/tick). <add>* `ticks` - the array containing all of the [tick objects](../api/interfaces/Tick). <ide> <ide> The call to the method is scoped to the scale. `this` inside the method is the scale object. <ide>
1
Javascript
Javascript
convert the `viewhistory` to an es6 class
16b4132ebfe348462b34e7f740524bde80de54d4
<ide><path>web/view_history.js <ide> * limitations under the License. <ide> */ <ide> <del>var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; <add>const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; <ide> <ide> /** <ide> * View History - This is a utility for saving various view parameters for <ide> var DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; <ide> * - FIREFOX or MOZCENTRAL - uses sessionStorage. <ide> * - GENERIC or CHROME - uses localStorage, if it is available. <ide> */ <del>var ViewHistory = (function ViewHistoryClosure() { <del> function ViewHistory(fingerprint, cacheSize) { <add>class ViewHistory { <add> constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) { <ide> this.fingerprint = fingerprint; <del> this.cacheSize = cacheSize || DEFAULT_VIEW_HISTORY_CACHE_SIZE; <add> this.cacheSize = cacheSize; <ide> this.isInitializedPromiseResolved = false; <del> this.initializedPromise = <del> this._readFromStorage().then(function (databaseStr) { <add> this.initializedPromise = this._readFromStorage().then((databaseStr) => { <ide> this.isInitializedPromiseResolved = true; <ide> <ide> var database = JSON.parse(databaseStr || '{}'); <ide> var ViewHistory = (function ViewHistoryClosure() { <ide> } <ide> this.file = database.files[index]; <ide> this.database = database; <del> }.bind(this)); <add> }); <ide> } <ide> <del> ViewHistory.prototype = { <del> _writeToStorage: function ViewHistory_writeToStorage() { <del> return new Promise(function (resolve) { <del> var databaseStr = JSON.stringify(this.database); <add> _writeToStorage() { <add> return new Promise((resolve) => { <add> var databaseStr = JSON.stringify(this.database); <ide> <del> if (typeof PDFJSDev !== 'undefined' && <del> PDFJSDev.test('FIREFOX || MOZCENTRAL')) { <del> sessionStorage.setItem('pdfjs.history', databaseStr); <del> } else { <del> localStorage.setItem('pdfjs.history', databaseStr); <del> } <del> resolve(); <del> }.bind(this)); <del> }, <add> if (typeof PDFJSDev !== 'undefined' && <add> PDFJSDev.test('FIREFOX || MOZCENTRAL')) { <add> sessionStorage.setItem('pdfjs.history', databaseStr); <add> } else { <add> localStorage.setItem('pdfjs.history', databaseStr); <add> } <add> resolve(); <add> }); <add> } <ide> <del> _readFromStorage: function ViewHistory_readFromStorage() { <del> return new Promise(function (resolve) { <del> if (typeof PDFJSDev !== 'undefined' && <del> PDFJSDev.test('FIREFOX || MOZCENTRAL')) { <del> resolve(sessionStorage.getItem('pdfjs.history')); <del> } else { <del> var value = localStorage.getItem('pdfjs.history'); <add> _readFromStorage() { <add> return new Promise(function(resolve) { <add> if (typeof PDFJSDev !== 'undefined' && <add> PDFJSDev.test('FIREFOX || MOZCENTRAL')) { <add> resolve(sessionStorage.getItem('pdfjs.history')); <add> } else { <add> var value = localStorage.getItem('pdfjs.history'); <ide> <del> // TODO: Remove this key-name conversion after a suitable time-frame. <del> // Note that we only remove the old 'database' entry if it looks like <del> // it was created by PDF.js. to avoid removing someone else's data. <del> if (!value) { <del> var databaseStr = localStorage.getItem('database'); <del> if (databaseStr) { <del> try { <del> var database = JSON.parse(databaseStr); <del> if (typeof database.files[0].fingerprint === 'string') { <del> localStorage.setItem('pdfjs.history', databaseStr); <del> localStorage.removeItem('database'); <del> value = databaseStr; <del> } <del> } catch (ex) { } <del> } <add> // TODO: Remove this key-name conversion after a suitable time-frame. <add> // Note that we only remove the old 'database' entry if it looks like <add> // it was created by PDF.js, to avoid removing someone else's data. <add> if (!value) { <add> var databaseStr = localStorage.getItem('database'); <add> if (databaseStr) { <add> try { <add> var database = JSON.parse(databaseStr); <add> if (typeof database.files[0].fingerprint === 'string') { <add> localStorage.setItem('pdfjs.history', databaseStr); <add> localStorage.removeItem('database'); <add> value = databaseStr; <add> } <add> } catch (ex) { } <ide> } <del> <del> resolve(value); <ide> } <del> }); <del> }, <del> <del> set: function ViewHistory_set(name, val) { <del> if (!this.isInitializedPromiseResolved) { <del> return; <add> resolve(value); <ide> } <del> this.file[name] = val; <del> return this._writeToStorage(); <del> }, <add> }); <add> } <ide> <del> setMultiple: function ViewHistory_setMultiple(properties) { <del> if (!this.isInitializedPromiseResolved) { <del> return; <del> } <del> for (var name in properties) { <del> this.file[name] = properties[name]; <del> } <del> return this._writeToStorage(); <del> }, <add> set(name, val) { <add> if (!this.isInitializedPromiseResolved) { <add> return; <add> } <add> this.file[name] = val; <add> return this._writeToStorage(); <add> } <ide> <del> get: function ViewHistory_get(name, defaultValue) { <del> if (!this.isInitializedPromiseResolved) { <del> return defaultValue; <del> } <del> return this.file[name] || defaultValue; <add> setMultiple(properties) { <add> if (!this.isInitializedPromiseResolved) { <add> return; <add> } <add> for (var name in properties) { <add> this.file[name] = properties[name]; <ide> } <del> }; <add> return this._writeToStorage(); <add> } <ide> <del> return ViewHistory; <del>})(); <add> get(name, defaultValue) { <add> if (!this.isInitializedPromiseResolved) { <add> return defaultValue; <add> } <add> return this.file[name] || defaultValue; <add> } <add>} <ide> <ide> export { <ide> ViewHistory,
1
Javascript
Javascript
use regular expressions in throw assertions
e6eb5c00dada92754a4d1c33e52fae70047d1b59
<ide><path>test/addons-napi/test_constructor/test.js <ide> assert.strictEqual(test_object.readwriteValue, 1); <ide> test_object.readwriteValue = 2; <ide> assert.strictEqual(test_object.readwriteValue, 2); <ide> <del>assert.throws(() => { test_object.readonlyValue = 3; }, TypeError); <add>assert.throws(() => { test_object.readonlyValue = 3; }, <add> /^TypeError: Cannot assign to read only property 'readonlyValue' of object '#<MyObject>'$/); <ide> <ide> assert.ok(test_object.hiddenValue); <ide> <ide> assert.ok(!propertyNames.includes('readonlyAccessor2')); <ide> test_object.readwriteAccessor1 = 1; <ide> assert.strictEqual(test_object.readwriteAccessor1, 1); <ide> assert.strictEqual(test_object.readonlyAccessor1, 1); <del>assert.throws(() => { test_object.readonlyAccessor1 = 3; }, TypeError); <add>assert.throws(() => { test_object.readonlyAccessor1 = 3; }, <add> /^TypeError: Cannot assign to read only property 'readonlyAccessor1' of object '#<MyObject>'$/); <ide> test_object.readwriteAccessor2 = 2; <ide> assert.strictEqual(test_object.readwriteAccessor2, 2); <ide> assert.strictEqual(test_object.readonlyAccessor2, 2); <del>assert.throws(() => { test_object.readonlyAccessor2 = 3; }, TypeError); <add>assert.throws(() => { test_object.readonlyAccessor2 = 3; }, <add> /^TypeError: Cannot assign to read only property 'readonlyAccessor2' of object '#<MyObject>'$/); <ide> <ide> // validate that static properties are on the class as opposed <ide> // to the instance
1
PHP
PHP
create a new "crossjoin" method
4eb16f030d00f34d5086aac4a6f42d00f035b5e5
<ide><path>src/Illuminate/Support/Arr.php <ide> public static function collapse($array) <ide> return $results; <ide> } <ide> <add> /** <add> * Cross join the given arrays, returning all possible permutations. <add> * <add> * @param array ...$arrays <add> * @return array <add> */ <add> public static function crossJoin(...$arrays) <add> { <add> return array_reduce($arrays, function ($results, $array) { <add> return static::collapse(array_map(function ($parent) use ($array) { <add> return array_map(function ($item) use ($parent) { <add> return array_merge($parent, [$item]); <add> }, $array); <add> }, $results)); <add> }, [[]]); <add> } <add> <ide> /** <ide> * Divide an array into two arrays. One with keys and the other with values. <ide> * <ide><path>src/Illuminate/Support/Collection.php <ide> public function containsStrict($key, $value = null) <ide> return in_array($key, $this->items, true); <ide> } <ide> <add> /** <add> * Cross join with the given lists, returning all possible permutations. <add> * <add> * @param mixed ...$lists <add> * @return static <add> */ <add> public function crossJoin(...$lists) <add> { <add> return new static(Arr::crossJoin( <add> $this->items, ...array_map([$this, 'getArrayableItems'], $lists) <add> )); <add> } <add> <ide> /** <ide> * Get the items in the collection that are not present in the given items. <ide> * <ide><path>tests/Support/SupportArrTest.php <ide> public function testCollapse() <ide> $this->assertEquals(['foo', 'bar', 'baz'], Arr::collapse($data)); <ide> } <ide> <add> public function testCrossJoin() <add> { <add> // Single dimension <add> $this->assertEquals( <add> [[1, 'a'], [1, 'b'], [1, 'c']], <add> Arr::crossJoin([1], ['a', 'b', 'c']) <add> ); <add> <add> // Square matrix <add> $this->assertEquals( <add> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']], <add> Arr::crossJoin([1, 2], ['a', 'b']) <add> ); <add> <add> // Rectangular matrix <add> $this->assertEquals( <add> [[1, 'a'], [1, 'b'], [1, 'c'], [2, 'a'], [2, 'b'], [2, 'c']], <add> Arr::crossJoin([1, 2], ['a', 'b', 'c']) <add> ); <add> <add> // 3D matrix <add> $this->assertEquals( <add> [ <add> [1, 'a', 'I'], [1, 'a', 'II'], [1, 'a', 'III'], <add> [1, 'b', 'I'], [1, 'b', 'II'], [1, 'b', 'III'], <add> [2, 'a', 'I'], [2, 'a', 'II'], [2, 'a', 'III'], <add> [2, 'b', 'I'], [2, 'b', 'II'], [2, 'b', 'III'], <add> ], <add> Arr::crossJoin([1, 2], ['a', 'b'], ['I', 'II', 'III']) <add> ); <add> <add> // With 1 empty dimension <add> $this->assertEquals([], Arr::crossJoin([1, 2], [], ['I', 'II', 'III'])); <add> } <add> <ide> public function testDivide() <ide> { <ide> list($keys, $values) = Arr::divide(['name' => 'Desk']); <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testCollapseWithNestedCollactions() <ide> $this->assertEquals([1, 2, 3, 4, 5, 6], $data->collapse()->all()); <ide> } <ide> <add> public function testCrossJoin() <add> { <add> // Cross join with an array <add> $this->assertEquals( <add> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']], <add> (new Collection([1, 2]))->crossJoin(['a', 'b'])->all() <add> ); <add> <add> // Cross join with a collection <add> $this->assertEquals( <add> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']], <add> (new Collection([1, 2]))->crossJoin(new Collection(['a', 'b']))->all() <add> ); <add> <add> // Cross join with 2 collections <add> $this->assertEquals( <add> [ <add> [1, 'a', 'I'], [1, 'a', 'II'], <add> [1, 'b', 'I'], [1, 'b', 'II'], <add> [2, 'a', 'I'], [2, 'a', 'II'], <add> [2, 'b', 'I'], [2, 'b', 'II'], <add> ], <add> (new Collection([1, 2]))->crossJoin( <add> new Collection(['a', 'b']), <add> new Collection(['I', 'II']) <add> )->all() <add> ); <add> } <add> <ide> public function testSort() <ide> { <ide> $data = (new Collection([5, 3, 1, 2, 4]))->sort();
4
PHP
PHP
allow negative condition in presence verifier
e0c7d76bbbc829c4069bf142fe5d56545252b99e
<ide><path>src/Illuminate/Validation/DatabasePresenceVerifier.php <ide> <ide> namespace Illuminate\Validation; <ide> <add>use Illuminate\Support\Str; <ide> use Illuminate\Database\ConnectionResolverInterface; <ide> <ide> class DatabasePresenceVerifier implements PresenceVerifierInterface <ide> protected function addWhere($query, $key, $extraValue) <ide> $query->whereNull($key); <ide> } elseif ($extraValue === 'NOT_NULL') { <ide> $query->whereNotNull($key); <add> } elseif (Str::startsWith($extraValue, '!')) { <add> $query->where($key, '!=', mb_substr($extraValue, 1)); <ide> } else { <ide> $query->where($key, $extraValue); <ide> } <ide><path>tests/Validation/ValidationDatabasePresenceVerifierTest.php <ide> public function testBasicCount() <ide> $db->shouldReceive('connection')->once()->with('connection')->andReturn($conn = m::mock('StdClass')); <ide> $conn->shouldReceive('table')->once()->with('table')->andReturn($builder = m::mock('StdClass')); <ide> $builder->shouldReceive('where')->with('column', '=', 'value')->andReturn($builder); <del> $extra = ['foo' => 'NULL', 'bar' => 'NOT_NULL', 'baz' => 'taylor', 'faz' => true]; <add> $extra = ['foo' => 'NULL', 'bar' => 'NOT_NULL', 'baz' => 'taylor', 'faz' => true, 'not' => '!admin']; <ide> $builder->shouldReceive('whereNull')->with('foo'); <ide> $builder->shouldReceive('whereNotNull')->with('bar'); <ide> $builder->shouldReceive('where')->with('baz', 'taylor'); <ide> $builder->shouldReceive('where')->with('faz', true); <add> $builder->shouldReceive('where')->with('not', '!=', 'admin'); <ide> $builder->shouldReceive('count')->once()->andReturn(100); <ide> <ide> $this->assertEquals(100, $verifier->getCount('table', 'column', 'value', null, null, $extra));
2
Ruby
Ruby
use applescript to check if gui apps are running
d8afed206fc782a1411f1d9dfb5813caa9167670
<ide><path>Library/Homebrew/cask/artifact/abstract_uninstall.rb <ide> def running_processes(bundle_id) <ide> # :quit/:signal must come before :kext so the kext will not be in use by a running process <ide> def uninstall_quit(*bundle_ids, command: nil, **_) <ide> bundle_ids.each do |bundle_id| <del> next if running_processes(bundle_id).empty? <add> next unless running?(bundle_id) <ide> <ide> unless User.current.gui? <ide> opoo "Not logged into a GUI; skipping quitting application ID '#{bundle_id}'." <ide> def uninstall_quit(*bundle_ids, command: nil, **_) <ide> Kernel.loop do <ide> next unless quit(bundle_id).success? <ide> <del> if running_processes(bundle_id).empty? <del> puts "Application '#{bundle_id}' quit successfully." <del> break <del> end <add> next if running?(bundle_id) <add> <add> puts "Application '#{bundle_id}' quit successfully." <add> break <ide> end <ide> end <ide> rescue Timeout::Error <ide> def uninstall_quit(*bundle_ids, command: nil, **_) <ide> end <ide> end <ide> <add> def running?(bundle_id) <add> script = <<~JAVASCRIPT <add> 'use strict'; <add> <add> ObjC.import('stdlib') <add> <add> function run(argv) { <add> try { <add> var app = Application(argv[0]) <add> if (app.running()) { <add> $.exit(0) <add> } <add> } catch (err) { } <add> <add> $.exit(1) <add> } <add> JAVASCRIPT <add> <add> system_command("osascript", args: ["-l", "JavaScript", "-e", script, bundle_id], <add> print_stderr: true).status.success? <add> end <add> <ide> def quit(bundle_id) <ide> script = <<~JAVASCRIPT <ide> 'use strict'; <ide> def quit(bundle_id) <ide> JAVASCRIPT <ide> <ide> system_command "osascript", args: ["-l", "JavaScript", "-e", script, bundle_id], <del> print_stderr: false, <del> sudo: true <add> print_stderr: false <ide> end <ide> private :quit <ide> <ide><path>Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb <ide> it "is skipped when the user does not have automation access" do <ide> allow(User).to receive(:automation_access?).and_return false <ide> allow(User.current).to receive(:gui?).and_return true <del> allow(subject).to receive(:running_processes).with(bundle_id).and_return([[0, "", bundle_id]]) <add> allow(subject).to receive(:running?).with(bundle_id).and_return(true) <ide> <ide> expect { <ide> subject.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) <ide> <ide> it "is skipped when the user is not a GUI user" do <ide> allow(User.current).to receive(:gui?).and_return false <del> allow(subject).to receive(:running_processes).with(bundle_id).and_return([[0, "", bundle_id]]) <add> allow(subject).to receive(:running?).with(bundle_id).and_return(true) <ide> <ide> expect { <ide> subject.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) <ide> allow(User).to receive(:automation_access?).and_return true <ide> allow(User.current).to receive(:gui?).and_return true <ide> <del> expect(subject).to receive(:running_processes).with(bundle_id).ordered.and_return([[0, "", bundle_id]]) <add> expect(subject).to receive(:running?).with(bundle_id).ordered.and_return(true) <ide> expect(subject).to receive(:quit).with(bundle_id) <ide> .and_return(instance_double("SystemCommand::Result", success?: true)) <del> expect(subject).to receive(:running_processes).with(bundle_id).ordered.and_return([]) <add> expect(subject).to receive(:running?).with(bundle_id).ordered.and_return(false) <ide> <ide> expect { <ide> subject.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) <ide> allow(User).to receive(:automation_access?).and_return true <ide> allow(User.current).to receive(:gui?).and_return true <ide> <del> allow(subject).to receive(:running_processes).with(bundle_id).and_return([[0, "", bundle_id]]) <add> allow(subject).to receive(:running?).with(bundle_id).and_return(true) <ide> allow(subject).to receive(:quit).with(bundle_id) <ide> .and_return(instance_double("SystemCommand::Result", success?: false)) <ide>
2
Python
Python
add char classes to global language data
604f299cf6398fa490acc48c55f7999e935283ac
<ide><path>spacy/lang/char_classes.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>import regex as re <add> <add> <add>re.DEFAULT_VERSION = re.VERSION1 <add>merge_char_classes = lambda classes: '[{}]'.format('||'.join(classes)) <add>split_chars = lambda char: list(char.strip().split(' ')) <add>merge_chars = lambda char: char.strip().replace(' ', '|') <add> <add> <add>_bengali = r'[\p{L}&&\p{Bengali}]' <add>_hebrew = r'[\p{L}&&\p{Hebrew}]' <add>_latin_lower = r'[\p{Ll}&&\p{Latin}]' <add>_latin_upper = r'[\p{Lu}&&\p{Latin}]' <add>_latin = r'[[\p{Ll}||\p{Lu}]&&\p{Latin}]' <add> <add>_upper = [_latin_upper] <add>_lower = [_latin_lower] <add>_uncased = [_bengali, _hebrew] <add> <add> <add>ALPHA = merge_char_classes(_upper + _lower + _uncased) <add>ALPHA_LOWER = merge_char_classes(_lower + _uncased) <add>ALPHA_UPPER = merge_char_classes(_upper + _uncased) <add> <add> <add>_units = ('km km² km³ m m² m³ dm dm² dm³ cm cm² cm³ mm mm² mm³ ha µm nm yd in ft ' <add> 'kg g mg µg t lb oz m/s km/h kmh mph hPa Pa mbar mb MB kb KB gb GB tb ' <add> 'TB T G M K') <add>_currency = r'\$ £ € ¥ ฿ US\$ C\$ A\$' <add>_punct = r'… , : ; \! \? ¿ ¡ \( \) \[ \] \{ \} < > _ # \* &' <add>_quotes = r'\' \'\' " ” “ `` ` ‘ ´ ‚ , „ » «' <add>_hyphens = '- – — -- ---' <add> <add> <add>UNITS = merge_chars(_units) <add>CURRENCY = merge_chars(_currency) <add>QUOTES = merge_chars(_quotes) <add>PUNCT = merge_chars(_punct) <add>HYPHENS = merge_chars(_hyphens) <add> <add>LIST_UNITS = split_chars(_units) <add>LIST_CURRENCY = split_chars(_currency) <add>LIST_QUOTES = split_chars(_quotes) <add>LIST_PUNCT = split_chars(_punct) <add>LIST_HYPHENS = split_chars(_hyphens) <add>LIST_ELLIPSES = [r'\.\.+', '…']
1
Javascript
Javascript
use msie instead of $document[0].documentmode
45252c3a545336a0bac93be6ee28cde6afaa3cb4
<ide><path>src/ng/sce.js <ide> function $SceProvider() { <ide> $document, $parse, $sceDelegate) { <ide> // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow <ide> // the "expression(javascript expression)" syntax which is insecure. <del> if (enabled && $document[0].documentMode < 8) { <add> if (enabled && msie < 8) { <ide> throw $sceMinErr('iequirks', <ide> 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' + <ide> 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' + <ide><path>test/ng/sceSpecs.js <ide> describe('SCE', function() { <ide> }); <ide> <ide> describe('IE<11 quirks mode', function() { <add> /* global msie: true */ <add> var msieBackup; <add> <add> beforeEach(function() { <add> msieBackup = msie; <add> }); <add> <add> afterEach(function() { <add> msie = msieBackup; <add> }); <add> <ide> function runTest(enabled, documentMode, expectException) { <add> msie = documentMode; <ide> module(function($provide) { <del> $provide.value('$document', [{ <del> documentMode: documentMode <del> }]); <ide> $provide.value('$sceDelegate', {trustAs: null, valueOf: null, getTrusted: null}); <ide> }); <ide> <ide><path>test/ng/windowSpec.js <ide> describe('$window', function() { <ide> it("should inject $window", inject(function($window) { <ide> expect($window).toBe(window); <ide> })); <add> <add> it('should be able to mock $window without errors', function() { <add> module({$window: {}}); <add> inject(['$sce', angular.noop]); <add> }); <ide> });
3
Java
Java
remove outdated documentation in @reflective
1f0a35bacc8c35b75c72cc53b7f842c569eb9165
<ide><path>spring-core/src/main/java/org/springframework/aot/hint/annotation/Reflective.java <ide> * the annotated element. By default, a reflection hint is added on the <ide> * annotated element so that it can be discovered and invoked if necessary. <ide> * <del> * <p>A reflection hint is also added if necessary on the annotation that <del> * <em>directly</em> uses this annotation. <del> * <ide> * @author Stephane Nicoll <ide> * @author Sam Brannen <ide> * @since 6.0
1
Java
Java
remove redundant collections.unmodifiablelist()
3fa4e4168d4562f0b59a324ef6f06a7d32f4a196
<ide><path>spring-web/src/main/java/org/springframework/web/cors/CorsConfiguration.java <ide> public class CorsConfiguration { <ide> /** Wildcard representing <em>all</em> origins, methods, or headers. */ <ide> public static final String ALL = "*"; <ide> <del> private static final List<String> ALL_LIST = Collections.unmodifiableList( <del> Collections.singletonList(ALL)); <add> private static final List<String> ALL_LIST = Collections.singletonList(ALL); <ide> <ide> private static final OriginPattern ALL_PATTERN = new OriginPattern("*"); <ide> <del> private static final List<OriginPattern> ALL_PATTERN_LIST = Collections.unmodifiableList( <del> Collections.singletonList(ALL_PATTERN)); <add> private static final List<OriginPattern> ALL_PATTERN_LIST = Collections.singletonList(ALL_PATTERN); <ide> <del> private static final List<String> DEFAULT_PERMIT_ALL = Collections.unmodifiableList( <del> Collections.singletonList(ALL)); <add> private static final List<String> DEFAULT_PERMIT_ALL = Collections.singletonList(ALL); <ide> <ide> private static final List<HttpMethod> DEFAULT_METHODS = Collections.unmodifiableList( <ide> Arrays.asList(HttpMethod.GET, HttpMethod.HEAD));
1
Javascript
Javascript
use frombufferattribute
793f66f41c7eb7d5622cc357a681eae9a3ec68cc
<ide><path>examples/jsm/exporters/OBJExporter.js <ide> class OBJExporter { <ide> <ide> for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) { <ide> <del> vertex.x = vertices.getX( i ); <del> vertex.y = vertices.getY( i ); <del> vertex.z = vertices.getZ( i ); <add> vertex.fromBufferAttribute( vertices, i ); <ide> <ide> // transform the vertex to world space <ide> vertex.applyMatrix4( mesh.matrixWorld ); <ide> class OBJExporter { <ide> <ide> for ( let i = 0, l = uvs.count; i < l; i ++, nbVertexUvs ++ ) { <ide> <del> uv.x = uvs.getX( i ); <del> uv.y = uvs.getY( i ); <add> uv.fromBufferAttribute( uvs, i ); <ide> <ide> // transform the uv to export format <ide> output += 'vt ' + uv.x + ' ' + uv.y + '\n'; <ide> class OBJExporter { <ide> <ide> for ( let i = 0, l = normals.count; i < l; i ++, nbNormals ++ ) { <ide> <del> normal.x = normals.getX( i ); <del> normal.y = normals.getY( i ); <del> normal.z = normals.getZ( i ); <add> normal.fromBufferAttribute( normals, i ); <ide> <ide> // transform the normal to world space <ide> normal.applyMatrix3( normalMatrixWorld ).normalize(); <ide> class OBJExporter { <ide> <ide> for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) { <ide> <del> vertex.x = vertices.getX( i ); <del> vertex.y = vertices.getY( i ); <del> vertex.z = vertices.getZ( i ); <add> vertex.fromBufferAttribute( vertices, i ); <ide> <ide> // transform the vertex to world space <ide> vertex.applyMatrix4( line.matrixWorld ); <ide><path>examples/jsm/exporters/PLYExporter.js <ide> class PLYExporter { <ide> <ide> for ( let i = 0, l = vertices.count; i < l; i ++ ) { <ide> <del> vertex.x = vertices.getX( i ); <del> vertex.y = vertices.getY( i ); <del> vertex.z = vertices.getZ( i ); <add> vertex.fromBufferAttribute( vertices, i ); <ide> <ide> vertex.applyMatrix4( mesh.matrixWorld ); <ide> <ide> class PLYExporter { <ide> <ide> if ( normals != null ) { <ide> <del> vertex.x = normals.getX( i ); <del> vertex.y = normals.getY( i ); <del> vertex.z = normals.getZ( i ); <add> vertex.fromBufferAttribute( normals, i ); <ide> <ide> vertex.applyMatrix3( normalMatrixWorld ).normalize(); <ide> <ide> class PLYExporter { <ide> // form each line <ide> for ( let i = 0, l = vertices.count; i < l; i ++ ) { <ide> <del> vertex.x = vertices.getX( i ); <del> vertex.y = vertices.getY( i ); <del> vertex.z = vertices.getZ( i ); <add> vertex.fromBufferAttribute( vertices, i ); <ide> <ide> vertex.applyMatrix4( mesh.matrixWorld ); <ide> <ide> class PLYExporter { <ide> <ide> if ( normals != null ) { <ide> <del> vertex.x = normals.getX( i ); <del> vertex.y = normals.getY( i ); <del> vertex.z = normals.getZ( i ); <add> vertex.fromBufferAttribute( normals, i ); <ide> <ide> vertex.applyMatrix3( normalMatrixWorld ).normalize(); <ide> <ide><path>examples/jsm/helpers/VertexNormalsHelper.js <ide> class VertexNormalsHelper extends LineSegments { <ide> <ide> for ( let j = 0, jl = objPos.count; j < jl; j ++ ) { <ide> <del> _v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld ); <add> _v1.fromBufferAttribute( objPos, j ).applyMatrix4( matrixWorld ); <ide> <del> _v2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) ); <add> _v2.fromBufferAttribute( objNorm, j ); <ide> <ide> _v2.applyMatrix3( _normalMatrix ).normalize().multiplyScalar( this.size ).add( _v1 ); <ide> <ide><path>examples/jsm/helpers/VertexTangentsHelper.js <ide> class VertexTangentsHelper extends LineSegments { <ide> <ide> for ( let j = 0, jl = objPos.count; j < jl; j ++ ) { <ide> <del> _v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld ); <add> _v1.fromBufferAttribute( objPos, j ).applyMatrix4( matrixWorld ); <ide> <del> _v2.set( objTan.getX( j ), objTan.getY( j ), objTan.getZ( j ) ); <add> _v2.fromBufferAttribute( objTan, j ); <ide> <ide> _v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( _v1 ); <ide> <ide><path>src/core/BufferAttribute.js <ide> class BufferAttribute { <ide> <ide> for ( let i = 0, l = this.count; i < l; i ++ ) { <ide> <del> _vector.x = this.getX( i ); <del> _vector.y = this.getY( i ); <del> _vector.z = this.getZ( i ); <add> _vector.fromBufferAttribute( this, i ); <ide> <ide> _vector.applyMatrix4( m ); <ide> <ide> class BufferAttribute { <ide> <ide> for ( let i = 0, l = this.count; i < l; i ++ ) { <ide> <del> _vector.x = this.getX( i ); <del> _vector.y = this.getY( i ); <del> _vector.z = this.getZ( i ); <add> _vector.fromBufferAttribute( this, i ); <ide> <ide> _vector.applyNormalMatrix( m ); <ide> <ide> class BufferAttribute { <ide> <ide> for ( let i = 0, l = this.count; i < l; i ++ ) { <ide> <del> _vector.x = this.getX( i ); <del> _vector.y = this.getY( i ); <del> _vector.z = this.getZ( i ); <add> _vector.fromBufferAttribute( this, i ); <ide> <ide> _vector.transformDirection( m ); <ide> <ide><path>src/core/InterleavedBufferAttribute.js <ide> class InterleavedBufferAttribute { <ide> <ide> for ( let i = 0, l = this.data.count; i < l; i ++ ) { <ide> <del> _vector.x = this.getX( i ); <del> _vector.y = this.getY( i ); <del> _vector.z = this.getZ( i ); <add> _vector.fromBufferAttribute( this, i ); <ide> <ide> _vector.applyMatrix4( m ); <ide> <ide> class InterleavedBufferAttribute { <ide> <ide> for ( let i = 0, l = this.count; i < l; i ++ ) { <ide> <del> _vector.x = this.getX( i ); <del> _vector.y = this.getY( i ); <del> _vector.z = this.getZ( i ); <add> _vector.fromBufferAttribute( this, i ); <ide> <ide> _vector.applyNormalMatrix( m ); <ide> <ide> class InterleavedBufferAttribute { <ide> <ide> for ( let i = 0, l = this.count; i < l; i ++ ) { <ide> <del> _vector.x = this.getX( i ); <del> _vector.y = this.getY( i ); <del> _vector.z = this.getZ( i ); <add> _vector.fromBufferAttribute( this, i ); <ide> <ide> _vector.transformDirection( m ); <ide> <ide><path>src/objects/SkinnedMesh.js <ide> class SkinnedMesh extends Mesh { <ide> <ide> for ( let i = 0, l = skinWeight.count; i < l; i ++ ) { <ide> <del> vector.x = skinWeight.getX( i ); <del> vector.y = skinWeight.getY( i ); <del> vector.z = skinWeight.getZ( i ); <del> vector.w = skinWeight.getW( i ); <add> vector.fromBufferAttribute( skinWeight, i ); <ide> <ide> const scale = 1.0 / vector.manhattanLength(); <ide>
7
Python
Python
show listener info in the 'stats' control command
20c1fd67345bdcfcf60f15607cefd476c52f4b5a
<ide><path>celery/utils/info.py <ide> def format_queues(queues, indent=0): <ide> return textindent(info, indent=indent) <ide> <ide> <del>def get_broker_info(): <del> broker_connection = establish_connection() <add>def get_broker_info(broker_connection=None): <add> if broker_connection is None: <add> broker_connection = establish_connection() <ide> <ide> carrot_backend = broker_connection.backend_cls <ide> if carrot_backend and not isinstance(carrot_backend, str): <ide><path>celery/worker/control/builtins.py <ide> def dump_active(panel, safe=False, **kwargs): <ide> @Panel.register <ide> def stats(panel, **kwargs): <ide> return {"total": state.total_count, <add> "listener": panel.listener.info, <ide> "pool": panel.listener.pool.info} <ide> <ide> <ide><path>celery/worker/listener.py <ide> from celery.messaging import get_consumer_set, BroadcastConsumer <ide> from celery.exceptions import NotRegistered <ide> from celery.datastructures import SharedCounter <add>from celery.utils.info import get_broker_info <ide> <ide> RUN = 0x1 <ide> CLOSE = 0x2 <ide> def stop(self): <ide> """ <ide> self.logger.debug("CarrotListener: Stopping consumers...") <ide> self.stop_consumers(close=False) <add> <add> @property <add> def info(self): <add> conninfo = {} <add> if self.connection: <add> conninfo = get_broker_info(self.connection) <add> return {"broker": conninfo, <add> "prefetch_count": self.qos.next}
3
Javascript
Javascript
run all fixtures through prettier
d04618b28b4faf0e512878d073a93a779d735f96
<ide><path>fixtures/art/VectorWidget.js <ide> * LICENSE file in the root directory of this source tree. An additional grant <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> */ <del>"use strict"; <add>'use strict'; <ide> <ide> var React = require('react'); <ide> var ReactART = require('react-art'); <ide> class VectorWidget extends React.Component { <ide> */ <ide> render() { <ide> return ( <del> <Surface <del> width={700} <del> height={700} <del> style={{cursor: 'pointer'}}> <add> <Surface width={700} height={700} style={{cursor: 'pointer'}}> <ide> {this.renderGraphic(this.state.degrees)} <ide> </Surface> <ide> ); <ide> class VectorWidget extends React.Component { <ide> /** <ide> * Better SVG support for React coming soon. <ide> */ <del> renderGraphic = (rotation) => { <del> <add> renderGraphic = rotation => { <ide> return ( <del> <Group <del> onMouseDown={this.handleMouseDown} <del> onMouseUp={this.handleMouseUp}> <add> <Group onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}> <ide> <Group x={210} y={135}> <ide> <Shape fill="rgba(0,0,0,0.1)" d={BORDER_PATH} /> <ide> <Shape fill="#7BC7BA" d={BG_PATH} /> <ide> class VectorWidget extends React.Component { <ide> <Shape fill="#FFFFFF" d={CENTER_DOT_PATH} /> <ide> <Group> <ide> <Shape d={RING_ONE_PATH} stroke="#FFFFFF" strokeWidth={8} /> <del> <Shape d={RING_TWO_PATH} transform={RING_TWO_ROTATE} stroke="#FFFFFF" strokeWidth={8} /> <del> <Shape d={RING_THREE_PATH} transform={RING_THREE_ROTATE} stroke="#FFFFFF" strokeWidth={8} /> <add> <Shape <add> d={RING_TWO_PATH} <add> transform={RING_TWO_ROTATE} <add> stroke="#FFFFFF" <add> strokeWidth={8} <add> /> <add> <Shape <add> d={RING_THREE_PATH} <add> transform={RING_THREE_ROTATE} <add> stroke="#FFFFFF" <add> strokeWidth={8} <add> /> <ide> </Group> <ide> </Group> <ide> </Group> <ide> class VectorWidget extends React.Component { <ide> }; <ide> } <ide> <del>var BORDER_PATH = "M3.00191459,4 C1.34400294,4 0,5.34785514 0,7.00550479 L0,220.994495 C0,222.65439 1.34239483,224 3.00191459,224 L276.998085,224 C278.655997,224 280,222.652145 280,220.994495 L280,7.00550479 C280,5.34561033 278.657605,4 276.998085,4 L3.00191459,4 Z M3.00191459,4"; <del>var BG_PATH = "M3.00191459,1 C1.34400294,1 0,2.34785514 0,4.00550479 L0,217.994495 C0,219.65439 1.34239483,221 3.00191459,221 L276.998085,221 C278.655997,221 280,219.652145 280,217.994495 L280,4.00550479 C280,2.34561033 278.657605,1 276.998085,1 L3.00191459,1 Z M3.00191459,1"; <del>var BAR_PATH = "M3.00191459,0 C1.34400294,0 0,1.34559019 0,3.00878799 L0,21 C0,21 0,21 0,21 L280,21 C280,21 280,21 280,21 L280,3.00878799 C280,1.34708027 278.657605,0 276.998085,0 L3.00191459,0 Z M3.00191459,0"; <del>var RED_DOT_PATH = "M12.5,17 C16.0898511,17 19,14.0898511 19,10.5 C19,6.91014895 16.0898511,4 12.5,4 C8.91014895,4 6,6.91014895 6,10.5 C6,14.0898511 8.91014895,17 12.5,17 Z M12.5,17"; <del>var YELLOW_DOT_PATH = "M31.5,17 C35.0898511,17 38,14.0898511 38,10.5 C38,6.91014895 35.0898511,4 31.5,4 C27.9101489,4 25,6.91014895 25,10.5 C25,14.0898511 27.9101489,17 31.5,17 Z M31.5,17"; <del>var GREEN_DOT_PATH = "M50.5,17 C54.0898511,17 57,14.0898511 57,10.5 C57,6.91014895 54.0898511,4 50.5,4 C46.9101489,4 44,6.91014895 44,10.5 C44,14.0898511 46.9101489,17 50.5,17 Z M50.5,17"; <del>var CENTER_DOT_PATH = "M84,105 C92.8365564,105 100,97.8365564 100,89 C100,80.1634436 92.8365564,73 84,73 C75.1634436,73 68,80.1634436 68,89 C68,97.8365564 75.1634436,105 84,105 Z M84,105"; <del>var RING_ONE_PATH = "M84,121 C130.391921,121 168,106.673113 168,89 C168,71.3268871 130.391921,57 84,57 C37.6080787,57 0,71.3268871 0,89 C0,106.673113 37.6080787,121 84,121 Z M84,121"; <del>var RING_TWO_PATH = "M84,121 C130.391921,121 168,106.673113 168,89 C168,71.3268871 130.391921,57 84,57 C37.6080787,57 0,71.3268871 0,89 C0,106.673113 37.6080787,121 84,121 Z M84,121"; <del>var RING_THREE_PATH = "M84,121 C130.391921,121 168,106.673113 168,89 C168,71.3268871 130.391921,57 84,57 C37.6080787,57 0,71.3268871 0,89 C0,106.673113 37.6080787,121 84,121 Z M84,121"; <del>var RING_TWO_ROTATE = new Transform().translate(84.000000, 89.000000).rotate(-240.000000).translate(-84.000000, -89.000000); <del>var RING_THREE_ROTATE = new Transform().translate(84.000000, 89.000000).rotate(-300.000000).translate(-84.000000, -89.000000); <add>var BORDER_PATH = <add> 'M3.00191459,4 C1.34400294,4 0,5.34785514 0,7.00550479 L0,220.994495 C0,222.65439 1.34239483,224 3.00191459,224 L276.998085,224 C278.655997,224 280,222.652145 280,220.994495 L280,7.00550479 C280,5.34561033 278.657605,4 276.998085,4 L3.00191459,4 Z M3.00191459,4'; <add>var BG_PATH = <add> 'M3.00191459,1 C1.34400294,1 0,2.34785514 0,4.00550479 L0,217.994495 C0,219.65439 1.34239483,221 3.00191459,221 L276.998085,221 C278.655997,221 280,219.652145 280,217.994495 L280,4.00550479 C280,2.34561033 278.657605,1 276.998085,1 L3.00191459,1 Z M3.00191459,1'; <add>var BAR_PATH = <add> 'M3.00191459,0 C1.34400294,0 0,1.34559019 0,3.00878799 L0,21 C0,21 0,21 0,21 L280,21 C280,21 280,21 280,21 L280,3.00878799 C280,1.34708027 278.657605,0 276.998085,0 L3.00191459,0 Z M3.00191459,0'; <add>var RED_DOT_PATH = <add> 'M12.5,17 C16.0898511,17 19,14.0898511 19,10.5 C19,6.91014895 16.0898511,4 12.5,4 C8.91014895,4 6,6.91014895 6,10.5 C6,14.0898511 8.91014895,17 12.5,17 Z M12.5,17'; <add>var YELLOW_DOT_PATH = <add> 'M31.5,17 C35.0898511,17 38,14.0898511 38,10.5 C38,6.91014895 35.0898511,4 31.5,4 C27.9101489,4 25,6.91014895 25,10.5 C25,14.0898511 27.9101489,17 31.5,17 Z M31.5,17'; <add>var GREEN_DOT_PATH = <add> 'M50.5,17 C54.0898511,17 57,14.0898511 57,10.5 C57,6.91014895 54.0898511,4 50.5,4 C46.9101489,4 44,6.91014895 44,10.5 C44,14.0898511 46.9101489,17 50.5,17 Z M50.5,17'; <add>var CENTER_DOT_PATH = <add> 'M84,105 C92.8365564,105 100,97.8365564 100,89 C100,80.1634436 92.8365564,73 84,73 C75.1634436,73 68,80.1634436 68,89 C68,97.8365564 75.1634436,105 84,105 Z M84,105'; <add>var RING_ONE_PATH = <add> 'M84,121 C130.391921,121 168,106.673113 168,89 C168,71.3268871 130.391921,57 84,57 C37.6080787,57 0,71.3268871 0,89 C0,106.673113 37.6080787,121 84,121 Z M84,121'; <add>var RING_TWO_PATH = <add> 'M84,121 C130.391921,121 168,106.673113 168,89 C168,71.3268871 130.391921,57 84,57 C37.6080787,57 0,71.3268871 0,89 C0,106.673113 37.6080787,121 84,121 Z M84,121'; <add>var RING_THREE_PATH = <add> 'M84,121 C130.391921,121 168,106.673113 168,89 C168,71.3268871 130.391921,57 84,57 C37.6080787,57 0,71.3268871 0,89 C0,106.673113 37.6080787,121 84,121 Z M84,121'; <add>var RING_TWO_ROTATE = new Transform() <add> .translate(84.000000, 89.000000) <add> .rotate(-240.000000) <add> .translate(-84.000000, -89.000000); <add>var RING_THREE_ROTATE = new Transform() <add> .translate(84.000000, 89.000000) <add> .rotate(-300.000000) <add> .translate(-84.000000, -89.000000); <ide> <ide> module.exports = VectorWidget; <del> <ide><path>fixtures/art/app.js <del>"use strict"; <add>'use strict'; <ide> <ide> var React = require('react'); <ide> var ReactDOM = require('react-dom'); <ide><path>fixtures/art/webpack.config.js <ide> module.exports = { <ide> require.resolve('babel-preset-react'), <ide> ], <ide> }, <del> } <del> ] <add> }, <add> ], <ide> }, <ide> plugins: [ <ide> new webpack.DefinePlugin({ <ide> 'process.env': { <ide> NODE_ENV: JSON.stringify('development'), <ide> }, <del> }) <add> }), <ide> ], <ide> resolve: { <ide> alias: { <del> react: require.resolve('react') <del> } <del> } <add> react: require.resolve('react'), <add> }, <add> }, <ide> }; <ide><path>fixtures/dom/public/react-loader.js <ide> var version = query.version || 'local'; <ide> <ide> if (version !== 'local') { <ide> REACT_PATH = 'https://unpkg.com/react@' + version + '/dist/react.min.js'; <del> DOM_PATH = 'https://unpkg.com/react-dom@' + version + '/dist/react-dom.min.js'; <add> DOM_PATH = <add> 'https://unpkg.com/react-dom@' + version + '/dist/react-dom.min.js'; <ide> } <ide> <ide> document.write('<script src="' + REACT_PATH + '"></script>'); <ide><path>fixtures/dom/src/components/App.js <ide> import Fixtures from './fixtures'; <ide> <ide> import '../style.css'; <ide> <del>function App () { <add>function App() { <ide> return ( <ide> <div> <ide> <Header /> <del> <div className="container" > <add> <div className="container"> <ide> <Fixtures /> <ide> </div> <ide> </div> <ide><path>fixtures/dom/src/components/Fixture.js <ide> const propTypes = { <ide> <ide> class Fixture extends React.Component { <ide> render() { <del> const { children } = this.props; <add> const {children} = this.props; <ide> <ide> return ( <ide> <div className="test-fixture"> <ide> class Fixture extends React.Component { <ide> <ide> Fixture.propTypes = propTypes; <ide> <del>export default Fixture <add>export default Fixture; <ide><path>fixtures/dom/src/components/FixtureSet.js <ide> const propTypes = { <ide> }; <ide> <ide> class FixtureSet extends React.Component { <del> <ide> render() { <del> const { title, description, children } = this.props; <add> const {title, description, children} = this.props; <ide> <ide> return ( <ide> <div> <ide> <h1>{title}</h1> <del> {description && ( <del> <p>{description}</p> <del> )} <add> {description && <p>{description}</p>} <ide> <ide> {children} <ide> </div> <ide> class FixtureSet extends React.Component { <ide> <ide> FixtureSet.propTypes = propTypes; <ide> <del>export default FixtureSet <add>export default FixtureSet; <ide><path>fixtures/dom/src/components/Header.js <del>import { parse, stringify } from 'query-string'; <add>import {parse, stringify} from 'query-string'; <ide> import getVersionTags from '../tags'; <ide> const React = window.React; <ide> <ide> class Header extends React.Component { <ide> const query = parse(window.location.search); <ide> const version = query.version || 'local'; <ide> const versions = [version]; <del> this.state = { version, versions }; <add> this.state = {version, versions}; <ide> } <ide> componentWillMount() { <del> getVersionTags() <del> .then(tags => { <del> let versions = tags.map(tag => tag.name.slice(1)); <del> versions = [`local`, ...versions]; <del> this.setState({ versions }); <del> }) <add> getVersionTags().then(tags => { <add> let versions = tags.map(tag => tag.name.slice(1)); <add> versions = [`local`, ...versions]; <add> this.setState({versions}); <add> }); <ide> } <ide> handleVersionChange(event) { <ide> const query = parse(window.location.search); <ide> class Header extends React.Component { <ide> } <ide> render() { <ide> return ( <del> <header className="header"> <del> <div className="header__inner"> <del> <span className="header__logo"> <del> <img src="https://facebook.github.io/react/img/logo.svg" alt="" width="32" height="32" /> <del> React Sandbox (v{React.version}) <del> </span> <add> <header className="header"> <add> <div className="header__inner"> <add> <span className="header__logo"> <add> <img <add> src="https://facebook.github.io/react/img/logo.svg" <add> alt="" <add> width="32" <add> height="32" <add> /> <add> React Sandbox (v{React.version}) <add> </span> <ide> <del> <div className="header-controls"> <del> <label htmlFor="example"> <del> <span className="sr-only">Select an example</span> <del> <select value={window.location.pathname} onChange={this.handleFixtureChange}> <del> <option value="/">Select a Fixture</option> <del> <option value="/range-inputs">Range Inputs</option> <del> <option value="/text-inputs">Text Inputs</option> <del> <option value="/number-inputs">Number Input</option> <del> <option value="/password-inputs">Password Input</option> <del> <option value="/selects">Selects</option> <del> <option value="/textareas">Textareas</option> <del> <option value="/input-change-events">Input change events</option> <del> <option value="/buttons">Buttons</option> <del> </select> <del> </label> <del> <label htmlFor="react_version"> <del> <span className="sr-only">Select a version to test</span> <del> <select <del> value={this.state.version} <del> onChange={this.handleVersionChange}> <add> <div className="header-controls"> <add> <label htmlFor="example"> <add> <span className="sr-only">Select an example</span> <add> <select <add> value={window.location.pathname} <add> onChange={this.handleFixtureChange}> <add> <option value="/">Select a Fixture</option> <add> <option value="/range-inputs">Range Inputs</option> <add> <option value="/text-inputs">Text Inputs</option> <add> <option value="/number-inputs">Number Input</option> <add> <option value="/password-inputs">Password Input</option> <add> <option value="/selects">Selects</option> <add> <option value="/textareas">Textareas</option> <add> <option value="/input-change-events"> <add> Input change events <add> </option> <add> <option value="/buttons">Buttons</option> <add> </select> <add> </label> <add> <label htmlFor="react_version"> <add> <span className="sr-only">Select a version to test</span> <add> <select <add> value={this.state.version} <add> onChange={this.handleVersionChange}> <ide> {this.state.versions.map(version => ( <ide> <option key={version} value={version}>{version}</option> <ide> ))} <del> </select> <del> </label> <add> </select> <add> </label> <add> </div> <ide> </div> <del> </div> <del> </header> <add> </header> <ide> ); <ide> } <ide> } <ide><path>fixtures/dom/src/components/TestCase.js <ide> import cn from 'classnames'; <ide> import semver from 'semver'; <ide> import React from 'react'; <ide> import PropTypes from 'prop-types'; <del>import { parse } from 'query-string'; <del>import { semverString } from './propTypes'; <add>import {parse} from 'query-string'; <add>import {semverString} from './propTypes'; <ide> <ide> const propTypes = { <ide> children: PropTypes.node.isRequired, <ide> title: PropTypes.node.isRequired, <ide> resolvedIn: semverString, <del> resolvedBy: PropTypes.string <add> resolvedBy: PropTypes.string, <ide> }; <ide> <ide> class TestCase extends React.Component { <ide> class TestCase extends React.Component { <ide> }; <ide> } <ide> <del> handleChange = (e) => { <add> handleChange = e => { <ide> this.setState({ <del> complete: e.target.checked <del> }) <add> complete: e.target.checked, <add> }); <ide> }; <ide> <ide> render() { <ide> class TestCase extends React.Component { <ide> children, <ide> } = this.props; <ide> <del> let { complete } = this.state; <add> let {complete} = this.state; <ide> <del> const { version } = parse(window.location.search); <del> const isTestRelevant = ( <del> !version || <del> !resolvedIn || <del> semver.gte(version, resolvedIn) <del> ); <add> const {version} = parse(window.location.search); <add> const isTestRelevant = <add> !version || !resolvedIn || semver.gte(version, resolvedIn); <ide> <ide> complete = !isTestRelevant || complete; <ide> <ide> return ( <del> <section <del> className={cn( <del> "test-case", <del> complete && 'test-case--complete' <del> )} <del> > <add> <section className={cn('test-case', complete && 'test-case--complete')}> <ide> <h2 className="test-case__title type-subheading"> <ide> <label> <ide> <input <ide> class TestCase extends React.Component { <ide> </h2> <ide> <ide> <dl className="test-case__details"> <del> {resolvedIn && ( <del> <dt>First supported in: </dt>)} <del> {resolvedIn && ( <del> <dd> <del> <a href={'https://github.com/facebook/react/tag/v' + resolvedIn}> <del> <code>{resolvedIn}</code> <del> </a> <del> </dd> <del> )} <del> <del> {resolvedBy && ( <del> <dt>Fixed by: </dt>)} <del> {resolvedBy && ( <add> {resolvedIn && <dt>First supported in: </dt>} <add> {resolvedIn && <add> <dd> <add> <a href={'https://github.com/facebook/react/tag/v' + resolvedIn}> <add> <code>{resolvedIn}</code> <add> </a> <add> </dd>} <add> <add> {resolvedBy && <dt>Fixed by: </dt>} <add> {resolvedBy && <ide> <dd> <del> <a href={'https://github.com/facebook/react/pull/' + resolvedBy.slice(1)}> <add> <a <add> href={ <add> 'https://github.com/facebook/react/pull/' + <add> resolvedBy.slice(1) <add> }> <ide> <code>{resolvedBy}</code> <ide> </a> <del> </dd> <del> )} <del> <del> {affectedBrowsers && <del> <dt>Affected browsers: </dt>} <del> {affectedBrowsers && <del> <dd>{affectedBrowsers}</dd> <del> } <add> </dd>} <add> <add> {affectedBrowsers && <dt>Affected browsers: </dt>} <add> {affectedBrowsers && <dd>{affectedBrowsers}</dd>} <ide> </dl> <ide> <ide> <p className="test-case__desc"> <ide> {description} <ide> </p> <ide> <ide> <div className="test-case__body"> <del> {!isTestRelevant &&( <del> <p className="test-case__invalid-version"> <del> <strong>Note:</strong> This test case was fixed in a later version of React. <del> This test is not expected to pass for the selected version, and that's ok! <del> </p> <del> )} <add> {!isTestRelevant && <add> <p className="test-case__invalid-version"> <add> <strong>Note:</strong> <add> {' '} <add> This test case was fixed in a later version of React. <add> This test is not expected to pass for the selected version, and that's ok! <add> </p>} <ide> <ide> {children} <ide> </div> <ide> TestCase.propTypes = propTypes; <ide> <ide> TestCase.Steps = class extends React.Component { <ide> render() { <del> const { children } = this.props; <add> const {children} = this.props; <ide> return ( <ide> <div> <ide> <h3>Steps to reproduce:</h3> <ide> <ol> <ide> {children} <ide> </ol> <ide> </div> <del> ) <add> ); <ide> } <del>} <add>}; <ide> <ide> TestCase.ExpectedResult = class extends React.Component { <ide> render() { <del> const { children } = this.props <add> const {children} = this.props; <ide> return ( <ide> <div> <ide> <h3>Expected Result:</h3> <ide> <p> <ide> {children} <ide> </p> <ide> </div> <del> ) <add> ); <ide> } <del>} <del>export default TestCase <add>}; <add>export default TestCase; <ide><path>fixtures/dom/src/components/fixtures/buttons/index.js <ide> export default class ButtonTestCases extends React.Component { <ide> Nothing should happen <ide> </TestCase.ExpectedResult> <ide> <button disabled onClick={onButtonClick}>Click Me</button> <del> </TestCase> <del> <TestCase <del> title="onClick with disabled buttons containing other elements" <del> description="The onClick event handler should not be invoked when clicking on a disabled button that contains other elements"> <add> </TestCase> <add> <TestCase <add> title="onClick with disabled buttons containing other elements" <add> description="The onClick event handler should not be invoked when clicking on a disabled button that contains other elements"> <ide> <TestCase.Steps> <ide> <li>Click on the disabled button, which contains a span</li> <ide> </TestCase.Steps> <ide><path>fixtures/dom/src/components/fixtures/index.js <ide> function FixturesPage() { <ide> case '/password-inputs': <ide> return <PasswordInputFixtures />; <ide> case '/buttons': <del> return <ButtonFixtures /> <add> return <ButtonFixtures />; <ide> default: <ide> return <p>Please select a test fixture.</p>; <ide> } <ide><path>fixtures/dom/src/components/fixtures/input-change-events/InputPlaceholderFixture.js <ide> import React from 'react'; <ide> <ide> import Fixture from '../../Fixture'; <ide> <del> <del> <ide> class InputPlaceholderFixture extends React.Component { <ide> constructor(props, context) { <ide> super(props, context); <ide> class InputPlaceholderFixture extends React.Component { <ide> } <ide> <ide> handleChange = () => { <del> this.setState(({ changeCount }) => { <add> this.setState(({changeCount}) => { <ide> return { <del> changeCount: changeCount + 1 <del> } <del> }) <del> } <add> changeCount: changeCount + 1, <add> }; <add> }); <add> }; <ide> handleGeneratePlaceholder = () => { <ide> this.setState({ <del> placeholder: `A placeholder: ${Math.random() * 100}` <del> }) <del> } <add> placeholder: `A placeholder: ${Math.random() * 100}`, <add> }); <add> }; <ide> <ide> handleReset = () => { <ide> this.setState({ <ide> changeCount: 0, <del> }) <del> } <add> }); <add> }; <ide> <ide> render() { <del> const { placeholder, changeCount } = this.state; <add> const {placeholder, changeCount} = this.state; <ide> const color = changeCount === 0 ? 'green' : 'red'; <ide> <ide> return ( <ide> <Fixture> <ide> <input <del> type='text' <add> type="text" <ide> placeholder={placeholder} <ide> onChange={this.handleChange} <ide> /> <ide> class InputPlaceholderFixture extends React.Component { <ide> Change placeholder <ide> </button> <ide> <del> <p style={{ color }}> <add> <p style={{color}}> <ide> <code>onChange</code>{' calls: '}<strong>{changeCount}</strong> <ide> </p> <ide> <button onClick={this.handleReset}>Reset count</button> <ide> </Fixture> <del> ) <add> ); <ide> } <ide> } <ide> <ide><path>fixtures/dom/src/components/fixtures/input-change-events/RadioClickFixture.js <ide> class RadioClickFixture extends React.Component { <ide> } <ide> <ide> handleChange = () => { <del> this.setState(({ changeCount }) => { <add> this.setState(({changeCount}) => { <ide> return { <del> changeCount: changeCount + 1 <del> } <del> }) <del> } <add> changeCount: changeCount + 1, <add> }; <add> }); <add> }; <ide> <ide> handleReset = () => { <ide> this.setState({ <ide> changeCount: 0, <del> }) <del> } <add> }); <add> }; <ide> <ide> render() { <del> const { changeCount } = this.state; <add> const {changeCount} = this.state; <ide> const color = changeCount === 0 ? 'green' : 'red'; <del> <add> <ide> return ( <ide> <Fixture> <ide> <label> <del> <input <del> defaultChecked <del> type='radio' <del> onChange={this.handleChange} <del> /> <add> <input defaultChecked type="radio" onChange={this.handleChange} /> <ide> Test case radio input <ide> </label> <ide> {' '} <del> <p style={{ color }}> <add> <p style={{color}}> <ide> <code>onChange</code>{' calls: '}<strong>{changeCount}</strong> <ide> </p> <ide> <button onClick={this.handleReset}>Reset count</button> <ide> </Fixture> <del> ) <add> ); <ide> } <ide> } <ide> <ide><path>fixtures/dom/src/components/fixtures/input-change-events/RangeKeyboardFixture.js <ide> import React from 'react'; <ide> <ide> import Fixture from '../../Fixture'; <ide> <del> <ide> class RangeKeyboardFixture extends React.Component { <ide> constructor(props, context) { <ide> super(props, context); <ide> class RangeKeyboardFixture extends React.Component { <ide> } <ide> <ide> componentDidMount() { <del> this.input.addEventListener('keydown', this.handleKeydown, false) <add> this.input.addEventListener('keydown', this.handleKeydown, false); <ide> } <ide> <ide> componentWillUnmount() { <del> this.input.removeEventListener('keydown', this.handleKeydown, false) <add> this.input.removeEventListener('keydown', this.handleKeydown, false); <ide> } <ide> <ide> handleChange = () => { <del> this.setState(({ changeCount }) => { <add> this.setState(({changeCount}) => { <ide> return { <del> changeCount: changeCount + 1 <del> } <del> }) <del> } <add> changeCount: changeCount + 1, <add> }; <add> }); <add> }; <ide> <del> handleKeydown = (e) => { <add> handleKeydown = e => { <ide> // only interesting in arrow key events <del> if (![37, 38, 39, 40].includes(e.keyCode)) <del> return; <add> if (![37, 38, 39, 40].includes(e.keyCode)) return; <ide> <del> this.setState(({ keydownCount }) => { <add> this.setState(({keydownCount}) => { <ide> return { <del> keydownCount: keydownCount + 1 <del> } <del> }) <del> } <add> keydownCount: keydownCount + 1, <add> }; <add> }); <add> }; <ide> <ide> handleReset = () => { <ide> this.setState({ <ide> keydownCount: 0, <ide> changeCount: 0, <del> }) <del> } <add> }); <add> }; <ide> <ide> render() { <del> const { keydownCount, changeCount } = this.state; <add> const {keydownCount, changeCount} = this.state; <ide> const color = keydownCount === changeCount ? 'green' : 'red'; <ide> <ide> return ( <ide> <Fixture> <ide> <input <del> type='range' <del> ref={r => this.input = r} <add> type="range" <add> ref={r => (this.input = r)} <ide> onChange={this.handleChange} <ide> /> <ide> {' '} <ide> <del> <p style={{ color }}> <add> <p style={{color}}> <ide> <code>onKeyDown</code>{' calls: '}<strong>{keydownCount}</strong> <ide> {' vs '} <ide> <code>onChange</code>{' calls: '}<strong>{changeCount}</strong> <ide> </p> <ide> <button onClick={this.handleReset}>Reset counts</button> <ide> </Fixture> <del> ) <add> ); <ide> } <ide> } <ide> <ide><path>fixtures/dom/src/components/fixtures/input-change-events/index.js <ide> class InputChangeEvents extends React.Component { <ide> return ( <ide> <FixtureSet <ide> title="Input change events" <del> description="Tests proper behavior of the onChange event for inputs" <del> > <add> description="Tests proper behavior of the onChange event for inputs"> <ide> <TestCase <ide> title="Range keyboard changes" <ide> description={` <ide> Range inputs should fire onChange events for keyboard events <del> `} <del> > <add> `}> <ide> <TestCase.Steps> <ide> <li>Focus range input</li> <ide> <li>change value via the keyboard arrow keys</li> <ide> class InputChangeEvents extends React.Component { <ide> Radio inputs should only fire change events when the checked <ide> state changes. <ide> `} <del> resolvedIn="16.0.0" <del> > <add> resolvedIn="16.0.0"> <ide> <TestCase.Steps> <ide> <li>Click on the Radio input (or label text)</li> <ide> </TestCase.Steps> <ide> class InputChangeEvents extends React.Component { <ide> `} <ide> resolvedIn="15.0.0" <ide> resolvedBy="#5004" <del> affectedBrowsers="IE9+" <del> > <add> affectedBrowsers="IE9+"> <ide> <TestCase.Steps> <ide> <li>Click on the Text input</li> <ide> <li>Click on the "Change placeholder" button</li> <ide> class InputChangeEvents extends React.Component { <ide> } <ide> } <ide> <del> <del>export default InputChangeEvents <add>export default InputChangeEvents; <ide><path>fixtures/dom/src/components/fixtures/number-inputs/NumberInputDecimal.js <ide> const React = window.React; <ide> import Fixture from '../../Fixture'; <ide> <ide> class NumberInputDecimal extends React.Component { <del> state = { value: '.98' }; <add> state = {value: '.98'}; <ide> changeValue = () => { <ide> this.setState({ <ide> value: '0.98', <ide> }); <del> } <add> }; <ide> render() { <ide> const {value} = this.state; <ide> return ( <ide> class NumberInputDecimal extends React.Component { <ide> <input <ide> type="number" <ide> value={value} <del> onChange={(e) => { <del> this.setState({value: e.target.value}); <add> onChange={e => { <add> this.setState({value: e.target.value}); <ide> }} <ide> /> <ide> <button onClick={this.changeValue}>change.98 to 0.98</button> <ide><path>fixtures/dom/src/components/fixtures/number-inputs/NumberInputExtraZeroes.js <ide> const React = window.React; <ide> import Fixture from '../../Fixture'; <ide> <ide> class NumberInputExtraZeroes extends React.Component { <del> state = { value: '3.0000' } <add> state = {value: '3.0000'}; <ide> changeValue = () => { <ide> this.setState({ <del> value: '3.0000' <add> value: '3.0000', <ide> }); <del> } <add> }; <ide> onChange = event => { <del> this.setState({ value: event.target.value }); <del> } <add> this.setState({value: event.target.value}); <add> }; <ide> render() { <del> const { value } = this.state <add> const {value} = this.state; <ide> return ( <ide> <Fixture> <ide> <div>{this.props.children}</div> <ide><path>fixtures/dom/src/components/fixtures/number-inputs/NumberTestCase.js <ide> const React = window.React; <ide> import Fixture from '../../Fixture'; <ide> <ide> class NumberTestCase extends React.Component { <del> state = { value: '' }; <del> onChange = (event) => { <del> const parsed = parseFloat(event.target.value, 10) <del> const value = isNaN(parsed) ? '' : parsed <add> state = {value: ''}; <add> onChange = event => { <add> const parsed = parseFloat(event.target.value, 10); <add> const value = isNaN(parsed) ? '' : parsed; <ide> <del> this.setState({ value }) <del> } <add> this.setState({value}); <add> }; <ide> render() { <ide> return ( <ide> <Fixture> <ide> class NumberTestCase extends React.Component { <ide> <div className="control-box"> <ide> <fieldset> <ide> <legend>Controlled</legend> <del> <input type="number" value={this.state.value} onChange={this.onChange} /> <del> <span className="hint"> Value: {JSON.stringify(this.state.value)}</span> <add> <input <add> type="number" <add> value={this.state.value} <add> onChange={this.onChange} <add> /> <add> <span className="hint"> <add> {' '}Value: {JSON.stringify(this.state.value)} <add> </span> <ide> </fieldset> <ide> <ide> <fieldset> <ide><path>fixtures/dom/src/components/fixtures/number-inputs/index.js <ide> import NumberInputExtraZeroes from './NumberInputExtraZeroes'; <ide> function NumberInputs() { <ide> return ( <ide> <FixtureSet <del> title="Number inputs" <del> description="Number inputs inconsistently assign and report the value <del> property depending on the browser." <del> > <add> title="Number inputs" <add> description="Number inputs inconsistently assign and report the value <add> property depending on the browser."> <ide> <TestCase <del> title="Backspacing" <del> description="The decimal place should not be lost" <del> > <add> title="Backspacing" <add> description="The decimal place should not be lost"> <ide> <TestCase.Steps> <ide> <li>Type "3.1"</li> <ide> <li>Press backspace, eliminating the "1"</li> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Decimal precision" <del> description="Supports decimal precision greater than 2 places" <del> > <add> title="Decimal precision" <add> description="Supports decimal precision greater than 2 places"> <ide> <TestCase.Steps> <ide> <li>Type "0.01"</li> <ide> </TestCase.Steps> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Exponent form" <del> description="Supports exponent form ('2e4')" <del> > <add> title="Exponent form" <add> description="Supports exponent form ('2e4')"> <ide> <TestCase.Steps> <ide> <li>Type "2e"</li> <ide> <li>Type 4, to read "2e4"</li> <ide> function NumberInputs() { <ide> <NumberTestCase /> <ide> </TestCase> <ide> <del> <TestCase <del> title="Exponent Form" <del> description="Pressing 'e' at the end" <del> > <add> <TestCase title="Exponent Form" description="Pressing 'e' at the end"> <ide> <TestCase.Steps> <ide> <li>Type "3.14"</li> <ide> <li>Press "e", so that the input reads "3.14e"</li> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Exponent Form" <del> description="Supports pressing 'ee' in the middle of a number" <del> > <add> title="Exponent Form" <add> description="Supports pressing 'ee' in the middle of a number"> <ide> <TestCase.Steps> <ide> <li>Type "3.14"</li> <ide> <li>Move the text cursor to after the decimal place</li> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Trailing Zeroes" <del> description="Typing '3.0' preserves the trailing zero" <del> > <add> title="Trailing Zeroes" <add> description="Typing '3.0' preserves the trailing zero"> <ide> <TestCase.Steps> <ide> <li>Type "3.0"</li> <ide> </TestCase.Steps> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Inserting decimals precision" <del> description="Inserting '.' in to '300' maintains the trailing zeroes" <del> > <add> title="Inserting decimals precision" <add> description="Inserting '.' in to '300' maintains the trailing zeroes"> <ide> <TestCase.Steps> <ide> <li>Type "300"</li> <ide> <li>Move the cursor to after the "3"</li> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Replacing numbers with -" <del> description="Replacing a number with the '-' sign should not clear the value" <del> > <add> title="Replacing numbers with -" <add> description="Replacing a number with the '-' sign should not clear the value"> <ide> <TestCase.Steps> <ide> <li>Type "3"</li> <ide> <li>Select the entire value"</li> <ide> function NumberInputs() { <ide> </TestCase> <ide> <ide> <TestCase <del> title="Negative numbers" <del> description="Typing minus when inserting a negative number should work" <del> > <add> title="Negative numbers" <add> description="Typing minus when inserting a negative number should work"> <ide> <TestCase.Steps> <ide> <li>Type "-"</li> <ide> <li>Type '3'</li> <ide> function NumberInputs() { <ide> <NumberTestCase /> <ide> </TestCase> <ide> <TestCase <del> title="Decimal numbers" <del> description="eg: initial value is '.98', when format to '0.98', should change to '0.98' " <del> > <add> title="Decimal numbers" <add> description="eg: initial value is '.98', when format to '0.98', should change to '0.98' "> <ide> <TestCase.Steps> <ide> <li>initial value is '.98'</li> <ide> <li>setState to '0.98'</li> <ide> function NumberInputs() { <ide> <ide> <TestCase <ide> title="Trailing zeroes" <del> description="Extraneous zeroes should be retained when changing the value via setState" <del> > <add> description="Extraneous zeroes should be retained when changing the value via setState"> <ide> <TestCase.Steps> <ide> <li>Change the text to 4.0000</li> <ide> <li>Click "Reset to 3.0000"</li> <ide> function NumberInputs() { <ide> <p className="footnote"> <ide> <b>Notes:</b> Firefox drops extraneous zeroes when <ide> assigned. Zeroes are preserved when editing, however <del> directly assigning a new value will drop zeroes. This <a <del> href="https://bugzilla.mozilla.org/show_bug.cgi?id=1003896">is <del> a bug in Firefox</a> that we can not control for. <add> directly assigning a new value will drop zeroes. This <add> {' '} <add> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1003896"> <add> is <add> a bug in Firefox <add> </a> that we can not control for. <ide> </p> <ide> </TestCase> <ide> </FixtureSet> <ide><path>fixtures/dom/src/components/fixtures/password-inputs/PasswordTestCase.js <ide> const React = window.React; <ide> import Fixture from '../../Fixture'; <ide> <ide> class PasswordTestCase extends React.Component { <del> state = { value: '' }; <del> onChange = (event) => { <del> this.setState({ value: event.target.value }) <del> } <add> state = {value: ''}; <add> onChange = event => { <add> this.setState({value: event.target.value}); <add> }; <ide> render() { <ide> return ( <ide> <Fixture> <ide> class PasswordTestCase extends React.Component { <ide> <div className="control-box"> <ide> <fieldset> <ide> <legend>Controlled</legend> <del> <input type="password" value={this.state.value} onChange={this.onChange} /> <del> <span className="hint"> Value: {JSON.stringify(this.state.value)}</span> <add> <input <add> type="password" <add> value={this.state.value} <add> onChange={this.onChange} <add> /> <add> <span className="hint"> <add> {' '}Value: {JSON.stringify(this.state.value)} <add> </span> <ide> </fieldset> <ide> <ide> <fieldset> <ide><path>fixtures/dom/src/components/fixtures/password-inputs/index.js <ide> const React = window.React; <ide> <ide> import FixtureSet from '../../FixtureSet'; <ide> import TestCase from '../../TestCase'; <del>import PasswordTestCase from './PasswordTestCase' <add>import PasswordTestCase from './PasswordTestCase'; <ide> <ide> function NumberInputs() { <ide> return ( <ide><path>fixtures/dom/src/components/fixtures/range-inputs/index.js <ide> const React = window.React; <ide> <ide> class RangeInputs extends React.Component { <del> state = { value: 0.5 }; <del> onChange = (event) => { <del> this.setState({ value: event.target.value }); <del> } <add> state = {value: 0.5}; <add> onChange = event => { <add> this.setState({value: event.target.value}); <add> }; <ide> render() { <ide> return ( <ide> <form> <ide> <fieldset> <ide> <legend>Controlled</legend> <del> <input type="range" value={this.state.value} onChange={this.onChange} /> <add> <input <add> type="range" <add> value={this.state.value} <add> onChange={this.onChange} <add> /> <ide> <span className="hint">Value: {this.state.value}</span> <ide> </fieldset> <ide> <ide><path>fixtures/dom/src/components/fixtures/selects/index.js <ide> const React = window.React; <ide> <ide> class SelectFixture extends React.Component { <del> state = { value: '' }; <del> onChange = (event) => { <del> this.setState({ value: event.target.value }); <del> } <add> state = {value: ''}; <add> onChange = event => { <add> this.setState({value: event.target.value}); <add> }; <ide> render() { <ide> return ( <ide> <form> <ide><path>fixtures/dom/src/components/fixtures/text-inputs/InputTestCase.js <ide> class InputTestCase extends React.Component { <ide> static defaultProps = { <ide> type: 'text', <ide> defaultValue: '', <del> parseAs: 'text' <del> } <add> parseAs: 'text', <add> }; <ide> <del> constructor () { <add> constructor() { <ide> super(...arguments); <ide> <ide> this.state = { <del> value: this.props.defaultValue <add> value: this.props.defaultValue, <ide> }; <ide> } <ide> <del> onChange = (event) => { <add> onChange = event => { <ide> const raw = event.target.value; <ide> <ide> switch (this.props.type) { <ide> case 'number': <ide> const parsed = parseFloat(event.target.value, 10); <ide> <del> this.setState({ value: isNaN(parsed) ? '' : parsed }); <add> this.setState({value: isNaN(parsed) ? '' : parsed}); <ide> <ide> break; <ide> default: <del> this.setState({ value: raw }); <add> this.setState({value: raw}); <ide> } <del> } <add> }; <ide> <ide> render() { <del> const { children, type, defaultValue } = this.props; <del> const { value } = this.state; <add> const {children, type, defaultValue} = this.props; <add> const {value} = this.state; <ide> <ide> return ( <ide> <Fixture> <ide><path>fixtures/dom/src/components/fixtures/text-inputs/index.js <ide> class TextInputFixtures extends React.Component { <ide> return ( <ide> <FixtureSet <ide> title="Inputs" <del> description="Common behavior across controled and uncontrolled inputs" <del> > <add> description="Common behavior across controled and uncontrolled inputs"> <ide> <TestCase title="Numbers in a controlled text field with no handler"> <ide> <TestCase.Steps> <ide> <li>Move the cursor to after "2" in the text field</li> <ide> class TextInputFixtures extends React.Component { <ide> <ide> <fieldset> <ide> <legend>Value as string</legend> <del> <input value={"2"} onChange={() => {}} /> <add> <input value={'2'} onChange={() => {}} /> <ide> </fieldset> <ide> </div> <ide> </Fixture> <ide> class TextInputFixtures extends React.Component { <ide> <ide> <TestCase title="All inputs" description="General test of all inputs"> <ide> <InputTestCase type="text" defaultValue="Text" /> <del> <InputTestCase type="email" defaultValue="[email protected]"/> <add> <InputTestCase type="email" defaultValue="[email protected]" /> <ide> <InputTestCase type="number" defaultValue={0} /> <del> <InputTestCase type="url" defaultValue="http://example.com"/> <del> <InputTestCase type="tel" defaultValue="555-555-5555"/> <add> <InputTestCase type="url" defaultValue="http://example.com" /> <add> <InputTestCase type="tel" defaultValue="555-555-5555" /> <ide> <InputTestCase type="color" defaultValue="#ff0000" /> <ide> <InputTestCase type="date" defaultValue="2017-01-01" /> <del> <InputTestCase type="datetime-local" defaultValue="2017-01-01T01:00" /> <add> <InputTestCase <add> type="datetime-local" <add> defaultValue="2017-01-01T01:00" <add> /> <ide> <InputTestCase type="time" defaultValue="01:00" /> <ide> <InputTestCase type="month" defaultValue="2017-01" /> <ide> <InputTestCase type="week" defaultValue="2017-W01" /> <ide><path>fixtures/dom/src/components/fixtures/textareas/index.js <ide> const React = window.React; <ide> <ide> class TextAreaFixtures extends React.Component { <del> state = { value: '' }; <del> onChange = (event) => { <del> this.setState({ value: event.target.value }); <del> } <add> state = {value: ''}; <add> onChange = event => { <add> this.setState({value: event.target.value}); <add> }; <ide> render() { <ide> return ( <ide> <div> <ide><path>fixtures/dom/src/components/propTypes.js <ide> import PropTypes from 'prop-types'; <ide> import semver from 'semver'; <ide> <del>export function semverString (props, propName, componentName) { <add>export function semverString(props, propName, componentName) { <ide> let version = props[propName]; <ide> <ide> let error = PropTypes.string(...arguments); <ide> if (!error && version != null && !semver.valid(version)) <ide> error = new Error( <ide> `\`${propName}\` should be a valid "semantic version" matching ` + <del> 'an existing React version' <add> 'an existing React version', <ide> ); <ide> <ide> return error || null; <del>}; <add>} <ide><path>fixtures/dom/src/index.js <ide> const React = window.React; <ide> const ReactDOM = window.ReactDOM; <ide> import App from './components/App'; <ide> <del>ReactDOM.render( <del> <App />, <del> document.getElementById('root') <del>); <add>ReactDOM.render(<App />, document.getElementById('root')); <ide><path>fixtures/dom/src/tags.js <ide> const fallbackTags = [ <ide> '15.1.0', <ide> '15.0.2', <ide> '0.14.8', <del> '0.13.0' <del> ].map(version => ({ <del> name: `v${version}` <del> })) <add> '0.13.0', <add>].map(version => ({ <add> name: `v${version}`, <add>})); <ide> <ide> let canUseSessionStorage = true; <ide> <ide> try { <del> sessionStorage.setItem('foo', '') <add> sessionStorage.setItem('foo', ''); <ide> } catch (err) { <ide> canUseSessionStorage = false; <ide> } <ide> try { <ide> * the request is async, even if its loaded from sessionStorage. <ide> */ <ide> export default function getVersionTags() { <del> return new Promise((resolve) => { <add> return new Promise(resolve => { <ide> let cachedTags; <ide> if (canUseSessionStorage) { <ide> cachedTags = sessionStorage.getItem(TAGS_CACHE_KEY); <ide> export default function getVersionTags() { <ide> cachedTags = JSON.parse(cachedTags); <ide> resolve(cachedTags); <ide> } else { <del> fetch('https://api.github.com/repos/facebook/react/tags', { mode: 'cors' }) <add> fetch('https://api.github.com/repos/facebook/react/tags', {mode: 'cors'}) <ide> .then(res => res.json()) <ide> .then(tags => { <ide> // A message property indicates an error was sent from the API <ide> if (tags.message) { <del> return resolve(fallbackTags) <add> return resolve(fallbackTags); <ide> } <ide> if (canUseSessionStorage) { <del> sessionStorage.setItem(TAGS_CACHE_KEY, JSON.stringify(tags)) <add> sessionStorage.setItem(TAGS_CACHE_KEY, JSON.stringify(tags)); <ide> } <del> resolve(tags) <add> resolve(tags); <ide> }) <del> .catch(() => resolve(fallbackTags)) <add> .catch(() => resolve(fallbackTags)); <ide> } <del> }) <add> }); <ide> } <ide><path>fixtures/fiber-debugger/src/App.js <del>import React, { Component } from 'react'; <add>import React, {Component} from 'react'; <ide> import Draggable from 'react-draggable'; <ide> import ReactNoop from 'react-noop-renderer'; <ide> import Editor from './Editor'; <ide> import Fibers from './Fibers'; <ide> import describeFibers from './describeFibers'; <ide> <ide> // The only place where we use it. <del>const ReactFiberInstrumentation = ReactNoop.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactFiberInstrumentation; <add>const ReactFiberInstrumentation = <add> ReactNoop.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED <add> .ReactFiberInstrumentation; <ide> <ide> function getFiberState(root, workInProgress) { <ide> if (!root) { <ide> class App extends Component { <ide> return: false, <ide> fx: false, <ide> progressedChild: false, <del> progressedDel: false <del> } <add> progressedDel: false, <add> }, <ide> }; <ide> } <ide> <ide> class App extends Component { <ide> ReactNoop.render(null); <ide> ReactNoop.flush(); <ide> ReactFiberInstrumentation.debugTool = { <del> onMountContainer: (root) => { <add> onMountContainer: root => { <ide> currentRoot = root; <ide> }, <del> onUpdateContainer: (root) => { <add> onUpdateContainer: root => { <ide> currentRoot = root; <ide> }, <del> onBeginWork: (fiber) => { <add> onBeginWork: fiber => { <ide> const fibers = getFiberState(currentRoot, fiber); <ide> const stage = currentStage; <del> this.setState(({ history }) => ({ <add> this.setState(({history}) => ({ <ide> history: [ <del> ...history, { <add> ...history, <add> { <ide> action: 'BEGIN', <ide> fibers, <del> stage <del> } <del> ] <add> stage, <add> }, <add> ], <ide> })); <ide> }, <del> onCompleteWork: (fiber) => { <add> onCompleteWork: fiber => { <ide> const fibers = getFiberState(currentRoot, fiber); <ide> const stage = currentStage; <del> this.setState(({ history }) => ({ <add> this.setState(({history}) => ({ <ide> history: [ <del> ...history, { <add> ...history, <add> { <ide> action: 'COMPLETE', <ide> fibers, <del> stage <del> } <del> ] <add> stage, <add> }, <add> ], <ide> })); <ide> }, <del> onCommitWork: (fiber) => { <add> onCommitWork: fiber => { <ide> const fibers = getFiberState(currentRoot, fiber); <ide> const stage = currentStage; <del> this.setState(({ history }) => ({ <add> this.setState(({history}) => ({ <ide> history: [ <del> ...history, { <add> ...history, <add> { <ide> action: 'COMMIT', <ide> fibers, <del> stage <del> } <del> ] <add> stage, <add> }, <add> ], <ide> })); <ide> }, <ide> }; <ide> class App extends Component { <ide> toContain() {}, <ide> toEqual() {}, <ide> }); <del> window.log = s => currentStage = s; <add> window.log = s => (currentStage = s); <ide> // eslint-disable-next-line <del> eval(window.Babel.transform(code, { <del> presets: ['react', 'es2015'] <del> }).code); <add> eval( <add> window.Babel.transform(code, { <add> presets: ['react', 'es2015'], <add> }).code, <add> ); <ide> } <ide> <del> handleEdit = (e) => { <add> handleEdit = e => { <ide> e.preventDefault(); <ide> this.setState({ <del> isEditing: true <add> isEditing: true, <ide> }); <del> } <add> }; <ide> <del> handleCloseEdit = (nextCode) => { <add> handleCloseEdit = nextCode => { <ide> localStorage.setItem('fiber-debugger-code', nextCode); <ide> this.setState({ <ide> isEditing: false, <ide> history: [], <ide> currentStep: 0, <del> code: nextCode <add> code: nextCode, <ide> }); <ide> this.runCode(nextCode); <del> } <add> }; <ide> <ide> render() { <del> const { history, currentStep, isEditing, code } = this.state; <add> const {history, currentStep, isEditing, code} = this.state; <ide> if (isEditing) { <ide> return <Editor code={code} onClose={this.handleCloseEdit} />; <ide> } <ide> <del> const { fibers, action, stage } = history[currentStep] || {}; <add> const {fibers, action, stage} = history[currentStep] || {}; <ide> let friendlyAction; <ide> if (fibers) { <ide> let wipFiber = fibers.descriptions[fibers.workInProgressID]; <ide> class App extends Component { <ide> } <ide> <ide> return ( <del> <div style={{ height: '100%' }}> <add> <div style={{height: '100%'}}> <ide> {fibers && <ide> <Draggable> <ide> <Fibers fibers={fibers} show={this.state.show} /> <del> </Draggable> <del> } <del> <div style={{ <del> width: '100%', <del> textAlign: 'center', <del> position: 'fixed', <del> bottom: 0, <del> padding: 10, <del> zIndex: 1, <del> backgroundColor: '#fafafa', <del> border: '1px solid #ccc' <del> }}> <add> </Draggable>} <add> <div <add> style={{ <add> width: '100%', <add> textAlign: 'center', <add> position: 'fixed', <add> bottom: 0, <add> padding: 10, <add> zIndex: 1, <add> backgroundColor: '#fafafa', <add> border: '1px solid #ccc', <add> }}> <ide> <input <ide> type="range" <del> style={{ width: '25%' }} <add> style={{width: '25%'}} <ide> min={0} <ide> max={history.length - 1} <ide> value={currentStep} <del> onChange={e => this.setState({ currentStep: Number(e.target.value) })} <add> onChange={e => this.setState({currentStep: Number(e.target.value)})} <ide> /> <del> <p>Step {currentStep}: {friendlyAction} (<a style={{ color: 'gray' }} onClick={this.handleEdit} href='#'>Edit</a>)</p> <add> <p> <add> Step <add> {' '} <add> {currentStep} <add> : <add> {' '} <add> {friendlyAction} <add> {' '} <add> ( <add> <a style={{color: 'gray'}} onClick={this.handleEdit} href="#"> <add> Edit <add> </a> <add> ) <add> </p> <ide> {stage && <p>Stage: {stage}</p>} <del> {Object.keys(this.state.show).map(key => <del> <label style={{ marginRight: '10px' }} key={key}> <add> {Object.keys(this.state.show).map(key => ( <add> <label style={{marginRight: '10px'}} key={key}> <ide> <input <ide> type="checkbox" <ide> checked={this.state.show[key]} <ide> onChange={e => { <del> this.setState(({ show }) => ({ <del> show: {...show, [key]: !show[key]} <add> this.setState(({show}) => ({ <add> show: {...show, [key]: !show[key]}, <ide> })); <del> }} /> <add> }} <add> /> <ide> {key} <ide> </label> <del> )} <add> ))} <ide> </div> <ide> </div> <ide> ); <ide><path>fixtures/fiber-debugger/src/Editor.js <del>import React, { Component } from 'react'; <add>import React, {Component} from 'react'; <ide> <ide> class Editor extends Component { <ide> constructor(props) { <ide> super(props); <ide> this.state = { <del> code: props.code <add> code: props.code, <ide> }; <ide> } <ide> <ide> render() { <ide> return ( <del> <div style={{ <del> height: '100%', <del> width: '100%' <del> }}> <add> <div <add> style={{ <add> height: '100%', <add> width: '100%', <add> }}> <ide> <textarea <ide> value={this.state.code} <del> onChange={e => this.setState({ code: e.target.value })} <add> onChange={e => this.setState({code: e.target.value})} <ide> style={{ <ide> height: '80%', <ide> width: '100%', <del> fontSize: '15px' <del> }} /> <del> <div style={{ height: '20%', textAlign: 'center' }}> <del> <button onClick={() => this.props.onClose(this.state.code)} style={{ fontSize: 'large' }}> <add> fontSize: '15px', <add> }} <add> /> <add> <div style={{height: '20%', textAlign: 'center'}}> <add> <button <add> onClick={() => this.props.onClose(this.state.code)} <add> style={{fontSize: 'large'}}> <ide> Run <ide> </button> <ide> </div> <ide> </div> <del> ) <add> ); <ide> } <ide> } <ide> <ide><path>fixtures/fiber-debugger/src/Fibers.js <ide> import React from 'react'; <del>import { Motion, spring } from 'react-motion'; <add>import {Motion, spring} from 'react-motion'; <ide> import dagre from 'dagre'; <ide> // import prettyFormat from 'pretty-format'; <ide> // import reactElement from 'pretty-format/plugins/ReactElement'; <ide> function Graph(props) { <ide> g.setNode(child.key, { <ide> label: child, <ide> width: child.props.width, <del> height: child.props.height <add> height: child.props.height, <ide> }); <ide> } else if (child.type.isEdge) { <ide> const relationshipKey = child.props.source + ':' + child.props.target; <ide> function Graph(props) { <ide> g.setEdge(child.props.source, child.props.target, { <ide> label: child, <ide> allChildren: children.map(c => c.props.children), <del> weight: child.props.weight <add> weight: child.props.weight, <ide> }); <ide> }); <ide> <ide> dagre.layout(g); <ide> <del> var activeNode = g.nodes().map(v => g.node(v)).find(node => <del> node.label.props.isActive <del> ); <del> const [winX, winY] = [window.innerWidth / 2, window.innerHeight / 2] <del> var focusDx = activeNode ? (winX - activeNode.x) : 0; <del> var focusDy = activeNode ? (winY - activeNode.y) : 0; <add> var activeNode = g <add> .nodes() <add> .map(v => g.node(v)) <add> .find(node => node.label.props.isActive); <add> const [winX, winY] = [window.innerWidth / 2, window.innerHeight / 2]; <add> var focusDx = activeNode ? winX - activeNode.x : 0; <add> var focusDy = activeNode ? winY - activeNode.y : 0; <ide> <ide> var nodes = g.nodes().map(v => { <ide> var node = g.node(v); <ide> return ( <del> <Motion style={{ <del> x: props.isDragging ? node.x + focusDx : spring(node.x + focusDx), <del> y: props.isDragging ? node.y + focusDy : spring(node.y + focusDy) <del> }} key={node.label.key}> <add> <Motion <add> style={{ <add> x: props.isDragging ? node.x + focusDx : spring(node.x + focusDx), <add> y: props.isDragging ? node.y + focusDy : spring(node.y + focusDy), <add> }} <add> key={node.label.key}> <ide> {interpolatingStyle => <ide> React.cloneElement(node.label, { <ide> x: interpolatingStyle.x + props.dx, <ide> y: interpolatingStyle.y + props.dy, <ide> vanillaX: node.x, <ide> vanillaY: node.y, <del> }) <del> } <add> })} <ide> </Motion> <ide> ); <ide> }); <ide> function Graph(props) { <ide> var edge = g.edge(e); <ide> let idx = 0; <ide> return ( <del> <Motion style={edge.points.reduce((bag, point) => { <del> bag[idx + ':x'] = props.isDragging ? point.x + focusDx : spring(point.x + focusDx); <del> bag[idx + ':y'] = props.isDragging ? point.y + focusDy : spring(point.y + focusDy); <del> idx++; <del> return bag; <del> }, {})} key={edge.label.key}> <add> <Motion <add> style={edge.points.reduce((bag, point) => { <add> bag[idx + ':x'] = props.isDragging <add> ? point.x + focusDx <add> : spring(point.x + focusDx); <add> bag[idx + ':y'] = props.isDragging <add> ? point.y + focusDy <add> : spring(point.y + focusDy); <add> idx++; <add> return bag; <add> }, {})} <add> key={edge.label.key}> <ide> {interpolatedStyle => { <ide> let points = []; <ide> Object.keys(interpolatedStyle).forEach(key => { <ide> const [idx, prop] = key.split(':'); <ide> if (!points[idx]) { <del> points[idx] = { x: props.dx, y: props.dy }; <add> points[idx] = {x: props.dx, y: props.dy}; <ide> } <ide> points[idx][prop] += interpolatedStyle[key]; <ide> }); <ide> return React.cloneElement(edge.label, { <ide> points, <ide> id: edge.label.key, <del> children: edge.allChildren.join(', ') <add> children: edge.allChildren.join(', '), <ide> }); <ide> }} <ide> </Motion> <ide> ); <ide> }); <ide> <ide> return ( <del> <div style={{ <del> position: 'relative', <del> height: '100%' <del> }}> <add> <div <add> style={{ <add> position: 'relative', <add> height: '100%', <add> }}> <ide> {edges} <ide> {nodes} <ide> </div> <ide> function Vertex(props) { <ide> } <ide> <ide> return ( <del> <div style={{ <del> position: 'absolute', <del> border: '1px solid black', <del> left: (props.x-(props.width/2)), <del> top: (props.y-(props.height/2)), <del> width: props.width, <del> height: props.height, <del> overflow: 'hidden', <del> padding: '4px', <del> wordWrap: 'break-word' <del> }}> <add> <div <add> style={{ <add> position: 'absolute', <add> border: '1px solid black', <add> left: props.x - props.width / 2, <add> top: props.y - props.height / 2, <add> width: props.width, <add> height: props.height, <add> overflow: 'hidden', <add> padding: '4px', <add> wordWrap: 'break-word', <add> }}> <ide> {props.children} <ide> </div> <ide> ); <ide> const strokes = { <ide> return: 'red', <ide> fx: 'purple', <ide> progressedChild: 'cyan', <del> progressedDel: 'brown' <add> progressedDel: 'brown', <ide> }; <ide> <ide> function Edge(props) { <ide> var points = props.points; <del> var path = "M" + points[0].x + " " + points[0].y + " "; <add> var path = 'M' + points[0].x + ' ' + points[0].y + ' '; <ide> <ide> if (!points[0].x || !points[0].y) { <ide> return null; <ide> } <ide> <ide> for (var i = 1; i < points.length; i++) { <del> path += "L" + points[i].x + " " + points[i].y + " "; <del> if (!points[i].x || !points[i].y) { <del> return null; <del> } <add> path += 'L' + points[i].x + ' ' + points[i].y + ' '; <add> if (!points[i].x || !points[i].y) { <add> return null; <add> } <ide> } <ide> <ide> var lineID = props.id; <ide> <ide> return ( <del> <svg width="100%" height="100%" style={{ <del> position: 'absolute', <del> left: 0, <del> right: 0, <del> top: 0, <del> bottom: 0, <del> }}> <add> <svg <add> width="100%" <add> height="100%" <add> style={{ <add> position: 'absolute', <add> left: 0, <add> right: 0, <add> top: 0, <add> bottom: 0, <add> }}> <ide> <defs> <ide> <path d={path} id={lineID} /> <del> <marker id="markerCircle" markerWidth="8" markerHeight="8" refX="5" refY="5"> <del> <circle cx="5" cy="5" r="3" style={{stroke: 'none', fill:'black'}}/> <add> <marker <add> id="markerCircle" <add> markerWidth="8" <add> markerHeight="8" <add> refX="5" <add> refY="5"> <add> <circle cx="5" cy="5" r="3" style={{stroke: 'none', fill: 'black'}} /> <ide> </marker> <del> <marker id="markerArrow" markerWidth="13" markerHeight="13" refX="2" refY="6" <del> orient="auto"> <add> <marker <add> id="markerArrow" <add> markerWidth="13" <add> markerHeight="13" <add> refX="2" <add> refY="6" <add> orient="auto"> <ide> <path d="M2,2 L2,11 L10,6 L2,2" style={{fill: 'black'}} /> <ide> </marker> <ide> </defs> <ide> <del> <use xlinkHref={`#${lineID}`} fill="none" stroke={strokes[props.kind]} style={{ <del> markerStart: 'url(#markerCircle)', <del> markerEnd: 'url(#markerArrow)' <del> }} /> <add> <use <add> xlinkHref={`#${lineID}`} <add> fill="none" <add> stroke={strokes[props.kind]} <add> style={{ <add> markerStart: 'url(#markerCircle)', <add> markerEnd: 'url(#markerArrow)', <add> }} <add> /> <ide> <text> <ide> <textPath xlinkHref={`#${lineID}`}> <ide> {'     '}{props.children} <ide> function formatPriority(priority) { <ide> } <ide> } <ide> <del>export default function Fibers({ fibers, show, ...rest }) { <del> const items = Object.keys(fibers.descriptions).map(id => <del> fibers.descriptions[id] <add>export default function Fibers({fibers, show, ...rest}) { <add> const items = Object.keys(fibers.descriptions).map( <add> id => fibers.descriptions[id], <ide> ); <ide> <ide> const isDragging = rest.className.indexOf('dragging') > -1; <del> const [_, sdx, sdy] = rest.style.transform.match(/translate\((-?\d+)px,(-?\d+)px\)/) || []; <add> const [_, sdx, sdy] = rest.style.transform.match( <add> /translate\((-?\d+)px,(-?\d+)px\)/, <add> ) || []; <ide> const dx = Number(sdx); <ide> const dy = Number(sdy); <ide> <ide> return ( <del> <div {...rest} style={{ <del> width: '100%', <del> height: '100%', <del> position: 'absolute', <del> top: 0, <del> left: 0, <del> ...rest.style, <del> transform: null <del> }}> <del> <Graph <del> className="graph" <del> dx={dx} <del> dy={dy} <del> isDragging={isDragging} <del> > <add> <div <add> {...rest} <add> style={{ <add> width: '100%', <add> height: '100%', <add> position: 'absolute', <add> top: 0, <add> left: 0, <add> ...rest.style, <add> transform: null, <add> }}> <add> <Graph className="graph" dx={dx} dy={dy} isDragging={isDragging}> <ide> {items.map(fiber => [ <ide> <Vertex <ide> key={fiber.id} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> style={{ <ide> width: '100%', <ide> height: '100%', <del> backgroundColor: getFiberColor(fibers, fiber.id) <add> backgroundColor: getFiberColor(fibers, fiber.id), <ide> }} <ide> title={ <ide> /*prettyFormat(fiber, { plugins: [reactElement ]})*/ <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> <br /> <ide> {fiber.type} <ide> <br /> <del> {fibers.currentIDs.indexOf(fiber.id) === -1 ? <del> <small> <del> {fiber.pendingWorkPriority !== 0 && [ <del> <span style={{ <del> fontWeight: fiber.pendingWorkPriority <= fiber.progressedPriority ? <del> 'bold' : <del> 'normal' <del> }} key="span"> <del> Needs: {formatPriority(fiber.pendingWorkPriority)} <del> </span>, <del> <br key="br" /> <del> ]} <del> {fiber.progressedPriority !== 0 && [ <del> `Finished: ${formatPriority(fiber.progressedPriority)}`, <del> <br key="br" /> <del> ]} <del> {fiber.memoizedProps !== null && fiber.pendingProps !== null && [ <del> fiber.memoizedProps === fiber.pendingProps ? <del> 'Can reuse memoized.' : <del> 'Cannot reuse memoized.', <del> <br /> <del> ]} <del> </small> : <del> <small> <del> Committed <del> </small> <del> } <add> {fibers.currentIDs.indexOf(fiber.id) === -1 <add> ? <small> <add> {fiber.pendingWorkPriority !== 0 && [ <add> <span <add> style={{ <add> fontWeight: fiber.pendingWorkPriority <= <add> fiber.progressedPriority <add> ? 'bold' <add> : 'normal', <add> }} <add> key="span"> <add> Needs: {formatPriority(fiber.pendingWorkPriority)} <add> </span>, <add> <br key="br" />, <add> ]} <add> {fiber.progressedPriority !== 0 && [ <add> `Finished: ${formatPriority(fiber.progressedPriority)}`, <add> <br key="br" />, <add> ]} <add> {fiber.memoizedProps !== null && <add> fiber.pendingProps !== null && [ <add> fiber.memoizedProps === fiber.pendingProps <add> ? 'Can reuse memoized.' <add> : 'Cannot reuse memoized.', <add> <br />, <add> ]} <add> </small> <add> : <small> <add> Committed <add> </small>} <ide> </div> <ide> </Vertex>, <del> fiber.child && show.child && <add> fiber.child && <add> show.child && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.child} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.child}-child`}> <ide> child <ide> </Edge>, <del> fiber.progressedChild && show.progressedChild && <add> fiber.progressedChild && <add> show.progressedChild && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.progressedChild} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.progressedChild}-pChild`}> <ide> pChild <ide> </Edge>, <del> fiber.sibling && show.sibling && <add> fiber.sibling && <add> show.sibling && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.sibling} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.sibling}-sibling`}> <ide> sibling <ide> </Edge>, <del> fiber.return && show.return && <add> fiber.return && <add> show.return && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.return} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.return}-return`}> <ide> return <ide> </Edge>, <del> fiber.nextEffect && show.fx && <add> fiber.nextEffect && <add> show.fx && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.nextEffect} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.nextEffect}-nextEffect`}> <ide> nextFx <ide> </Edge>, <del> fiber.firstEffect && show.fx && <add> fiber.firstEffect && <add> show.fx && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.firstEffect} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.firstEffect}-firstEffect`}> <ide> firstFx <ide> </Edge>, <del> fiber.lastEffect && show.fx && <add> fiber.lastEffect && <add> show.fx && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.lastEffect} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.lastEffect}-lastEffect`}> <ide> lastFx <ide> </Edge>, <del> fiber.progressedFirstDeletion && show.progressedDel && <add> fiber.progressedFirstDeletion && <add> show.progressedDel && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.progressedFirstDeletion} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.progressedFirstDeletion}-pFD`}> <ide> pFDel <ide> </Edge>, <del> fiber.progressedLastDeletion && show.progressedDel && <add> fiber.progressedLastDeletion && <add> show.progressedDel && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.progressedLastDeletion} <ide> export default function Fibers({ fibers, show, ...rest }) { <ide> key={`${fiber.id}-${fiber.progressedLastDeletion}-pLD`}> <ide> pLDel <ide> </Edge>, <del> fiber.alternate && show.alt && <add> fiber.alternate && <add> show.alt && <ide> <Edge <ide> source={fiber.id} <ide> target={fiber.alternate} <ide><path>fixtures/fiber-debugger/src/describeFibers.js <ide> export default function describeFibers(rootFiber, workInProgress) { <ide> ...fiber, <ide> id: id, <ide> tag: getFriendlyTag(fiber.tag), <del> type: (fiber.type && ('<' + (fiber.type.name || fiber.type) + '>')), <add> type: fiber.type && '<' + (fiber.type.name || fiber.type) + '>', <ide> stateNode: `[${typeof fiber.stateNode}]`, <ide> return: acknowledgeFiber(fiber.return), <ide> child: acknowledgeFiber(fiber.child), <ide> export default function describeFibers(rootFiber, workInProgress) { <ide> descriptions, <ide> rootID, <ide> currentIDs: Array.from(currentIDs), <del> workInProgressID <add> workInProgressID, <ide> }; <ide> } <ide><path>fixtures/fiber-debugger/src/index.js <ide> import ReactDOM from 'react-dom'; <ide> import App from './App'; <ide> import './index.css'; <ide> <del>ReactDOM.render( <del> <App />, <del> document.getElementById('root') <del>); <add>ReactDOM.render(<App />, document.getElementById('root')); <ide><path>fixtures/packaging/browserify/dev/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/browserify/prod/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/brunch/dev/app/initialize.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/brunch/dev/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/brunch/prod/app/initialize.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/brunch/prod/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/build-all.js <ide> const fs = require('fs'); <ide> const path = require('path'); <ide> const child_process = require('child_process'); <ide> <del>const fixtureDirs = fs.readdirSync(__dirname).filter((file) => { <add>const fixtureDirs = fs.readdirSync(__dirname).filter(file => { <ide> return fs.statSync(path.join(__dirname, file)).isDirectory(); <ide> }); <ide> <ide><path>fixtures/packaging/rjs/dev/input.js <ide> require(['react', 'react-dom'], function(React, ReactDOM) { <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide> }); <ide><path>fixtures/packaging/rjs/prod/input.js <ide> require(['react', 'react-dom'], function(React, ReactDOM) { <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide> }); <ide><path>fixtures/packaging/systemjs-builder/dev/input.js <ide> import ReactDOM from 'react-dom'; <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/systemjs-builder/prod/input.js <ide> import ReactDOM from 'react-dom'; <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/webpack-alias/dev/config.js <ide> module.exports = { <ide> resolve: { <ide> root: path.resolve('../../../../build/packages'), <ide> alias: { <del> 'react': 'react/umd/react.development', <add> react: 'react/umd/react.development', <ide> 'react-dom': 'react-dom/umd/react-dom.development', <ide> }, <ide> }, <ide><path>fixtures/packaging/webpack-alias/dev/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/webpack-alias/prod/config.js <ide> module.exports = { <ide> resolve: { <ide> root: path.resolve('../../../../build/packages'), <ide> alias: { <del> 'react': 'react/umd/react.production.min', <add> react: 'react/umd/react.production.min', <ide> 'react-dom': 'react-dom/umd/react-dom.production.min', <ide> }, <ide> }, <ide><path>fixtures/packaging/webpack-alias/prod/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/webpack/dev/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/packaging/webpack/prod/config.js <ide> module.exports = { <ide> resolve: { <ide> root: path.resolve('../../../../build/packages/'), <ide> }, <del> plugins: [ <del> new webpack.DefinePlugin({ <del> 'process.env':{ <del> 'NODE_ENV': JSON.stringify('production') <del> } <del> }) <del> ] <add> plugins: [ <add> new webpack.DefinePlugin({ <add> 'process.env': { <add> NODE_ENV: JSON.stringify('production'), <add> }, <add> }), <add> ], <ide> }; <ide><path>fixtures/packaging/webpack/prod/input.js <ide> var ReactDOM = require('react-dom'); <ide> <ide> ReactDOM.render( <ide> React.createElement('h1', null, 'Hello World!'), <del> document.getElementById('container') <add> document.getElementById('container'), <ide> ); <ide><path>fixtures/ssr/server/index.js <ide> app.use(express.static(path.resolve(__dirname, '..', 'build'))); <ide> <ide> // Proxy everything else to create-react-app's webpack development server <ide> if (process.env.NODE_ENV === 'development') { <del> app.use('/', proxy({ <del> ws: true, <del> target: 'http://localhost:3001' <del> })); <add> app.use( <add> '/', <add> proxy({ <add> ws: true, <add> target: 'http://localhost:3001', <add> }), <add> ); <ide> } <ide> <ide> app.listen(3000, () => { <ide> app.on('error', function(error) { <ide> throw error; <ide> } <ide> <del> var bind = typeof port === 'string' <del> ? 'Pipe ' + port <del> : 'Port ' + port; <add> var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port; <ide> <ide> switch (error.code) { <ide> case 'EACCES': <ide><path>fixtures/ssr/server/render.js <ide> export default function render() { <ide> // There's no way to render a doctype in React so prepend manually. <ide> // Also append a bootstrap script tag. <ide> return '<!DOCTYPE html>' + html; <del>}; <add>} <ide><path>fixtures/ssr/src/components/App.js <del>import React, { Component } from 'react'; <add>import React, {Component} from 'react'; <ide> <ide> import Chrome from './Chrome'; <ide> import Page from './Page'; <ide><path>fixtures/ssr/src/components/Chrome.js <del>import React, { Component } from 'react'; <add>import React, {Component} from 'react'; <ide> <ide> import './Chrome.css'; <ide> <ide> export default class Chrome extends Component { <ide> </head> <ide> <body> <ide> {this.props.children} <del> <script dangerouslySetInnerHTML={{ <del> __html: `assetManifest = ${JSON.stringify(assets)};` <del> }} /> <add> <script <add> dangerouslySetInnerHTML={{ <add> __html: `assetManifest = ${JSON.stringify(assets)};`, <add> }} <add> /> <ide> <script src={assets['main.js']} /> <ide> </body> <ide> </html> <ide><path>fixtures/ssr/src/components/Page.js <del>import React, { Component } from 'react'; <add>import React, {Component} from 'react'; <ide> <ide> import './Page.css'; <ide> <ide> export default class Page extends Component { <del> state = { active: false }; <del> handleClick = (e) => { <del> this.setState({ active: true }); <del> } <add> state = {active: false}; <add> handleClick = e => { <add> this.setState({active: true}); <add> }; <ide> render() { <ide> const link = ( <ide> <a className="bold" onClick={this.handleClick}> <ide> export default class Page extends Component { <ide> return ( <ide> <div> <ide> <p> <del> {!this.state.active ? link : "Thanks!"} <add> {!this.state.active ? link : 'Thanks!'} <ide> </p> <ide> </div> <ide> ); <ide><path>fixtures/ssr/src/index.js <ide> import React from 'react'; <del>import { render } from 'react-dom'; <add>import {render} from 'react-dom'; <ide> <ide> import App from './components/App'; <ide> <ide><path>scripts/prettier/index.js <ide> const defaultOptions = { <ide> }; <ide> const config = { <ide> default: { <del> patterns: ['src/**/*.js'], <add> patterns: ['src/**/*.js', 'fixtures/**/*.js'], <ide> ignore: ['**/third_party/**', '**/node_modules/**'], <ide> }, <ide> scripts: {
59
Java
Java
simplify string concatenation
29f382b04eda1c3b8cabb231bcb014395643c725
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/BeanDefinitionHolder.java <ide> public String getShortDescription() { <ide> * @see #getBeanDefinition() <ide> */ <ide> public String getLongDescription() { <del> StringBuilder sb = new StringBuilder(getShortDescription()); <del> sb.append(": ").append(this.beanDefinition); <del> return sb.toString(); <add> return getShortDescription() + ": " + this.beanDefinition; <ide> } <ide> <ide> /** <ide><path>spring-core/src/main/java/org/springframework/core/ResolvableType.java <ide> public String toString() { <ide> return "?"; <ide> } <ide> } <del> StringBuilder result = new StringBuilder(this.resolved.getName()); <ide> if (hasGenerics()) { <del> result.append('<'); <del> result.append(StringUtils.arrayToDelimitedString(getGenerics(), ", ")); <del> result.append('>'); <add> return this.resolved.getName() + '<' + StringUtils.arrayToDelimitedString(getGenerics(), ", ") + '>'; <ide> } <del> return result.toString(); <add> return this.resolved.getName(); <ide> } <ide> <ide> <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java <ide> protected ValueRef getValueRef(ExpressionState state) throws EvaluationException <ide> <ide> @Override <ide> public String toStringAST() { <del> StringBuilder sb = new StringBuilder(); <add> return prefix() + getChild(0).toStringAST() + "]"; <add> } <add> <add> private String prefix() { <ide> switch (this.variant) { <del> case ALL: <del> sb.append("?["); <del> break; <del> case FIRST: <del> sb.append("^["); <del> break; <del> case LAST: <del> sb.append("$["); <del> break; <add> case ALL: return "?["; <add> case FIRST: return "^["; <add> case LAST: return "$["; <ide> } <del> return sb.append(getChild(0).toStringAST()).append("]").toString(); <add> return ""; <ide> } <ide> <ide> } <ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java <ide> public void setCharacterEncoding(@Nullable String characterEncoding) { <ide> <ide> private void updateContentTypeHeader() { <ide> if (StringUtils.hasLength(this.contentType)) { <del> StringBuilder sb = new StringBuilder(this.contentType); <del> if (!this.contentType.toLowerCase().contains(CHARSET_PREFIX) && <del> StringUtils.hasLength(this.characterEncoding)) { <del> sb.append(";").append(CHARSET_PREFIX).append(this.characterEncoding); <add> String value = this.contentType; <add> if (StringUtils.hasLength(this.characterEncoding) && !this.contentType.toLowerCase().contains(CHARSET_PREFIX)) { <add> value += ';' + CHARSET_PREFIX + this.characterEncoding; <ide> } <del> doAddHeaderValue(HttpHeaders.CONTENT_TYPE, sb.toString(), true); <add> doAddHeaderValue(HttpHeaders.CONTENT_TYPE, value, true); <ide> } <ide> } <ide> <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractMediaTypeExpression.java <ide> public int hashCode() { <ide> <ide> @Override <ide> public String toString() { <del> StringBuilder builder = new StringBuilder(); <ide> if (this.isNegated) { <del> builder.append('!'); <add> return '!' + this.mediaType.toString(); <ide> } <del> builder.append(this.mediaType.toString()); <del> return builder.toString(); <add> return this.mediaType.toString(); <ide> } <ide> <ide> } <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java <ide> public int hashCode() { <ide> <ide> @Override <ide> public String toString() { <del> StringBuilder builder = new StringBuilder(); <ide> if (this.isNegated) { <del> builder.append('!'); <add> return '!' + this.mediaType.toString(); <ide> } <del> builder.append(this.mediaType.toString()); <del> return builder.toString(); <add> return this.mediaType.toString(); <ide> } <ide> <ide> }
6
PHP
PHP
remove loadfixtures() when auto fixtures enabled
592ee6c180a98ebee14903b89d131882747b0c7f
<ide><path>tests/TestCase/ORM/QueryTest.php <ide> public function testWith(): void <ide> 'The current driver does not support window functions.' <ide> ); <ide> <del> $this->loadFixtures('Articles'); <del> <ide> $table = $this->getTableLocator()->get('Articles'); <ide> <ide> $cteQuery = $table
1
PHP
PHP
apply global scopes on update/delete
c1b2a7b8887a3e28096ea3d4b36d8861a050e1f9
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'p <ide> */ <ide> public function update(array $values) <ide> { <del> return $this->query->update($this->addUpdatedAtColumn($values)); <add> return $this->toBase()->update($this->addUpdatedAtColumn($values)); <ide> } <ide> <ide> /** <ide> public function delete() <ide> return call_user_func($this->onDelete, $this); <ide> } <ide> <del> return $this->query->delete(); <add> return $this->toBase()->delete(); <ide> } <ide> <ide> /**
1
Javascript
Javascript
remove usages of asynctest
e4f08b41f2b45f4970cbbe822d5a7079d7498bb8
<ide><path>packages/ember/tests/routing/basic_test.js <ide> QUnit.test('The loading state doesn\'t get entered for promises that resolve on <ide> assert.equal(jQuery('p', '#qunit-fixture').text(), '1', 'The app is now in the specials state'); <ide> }); <ide> <del>/* <del>asyncTest("The Special page returning an error fires the error hook on SpecialRoute", function(assert) { <del> Router.map(function() { <del> this.route("home", { path: "/" }); <del> this.route("special", { path: "/specials/:menu_item_id" }); <del> }); <del> <del> let menuItem; <del> <del> App.MenuItem = Ember.Object.extend(); <del> App.MenuItem.reopenClass({ <del> find: function(id) { <del> menuItem = App.MenuItem.create({ id: id }); <del> run.later(function() { menuItem.resolve(menuItem); }, 1); <del> return menuItem; <del> } <del> }); <del> <del> App.SpecialRoute = Route.extend({ <del> setup: function() { <del> throw 'Setup error'; <del> }, <del> actions: { <del> error: function(reason) { <del> equal(reason, 'Setup error'); <del> QUnit.start(); <del> } <del> } <del> }); <del> <del> bootApplication(); <del> <del> handleURLRejectsWith(assert, '/specials/1', 'Setup error'); <del>}); <del>*/ <del> <ide> QUnit.test('The Special page returning an error invokes SpecialRoute\'s error handler', function(assert) { <ide> Router.map(function() { <ide> this.route('home', { path: '/' }); <ide> QUnit.test('ApplicationRoute\'s default error handler can be overridden', functi <ide> run(() => resolve(menuItem)); <ide> }); <ide> <del>QUnit.asyncTest('Moving from one page to another triggers the correct callbacks', function(assert) { <add>QUnit.test('Moving from one page to another triggers the correct callbacks', function(assert) { <ide> assert.expect(3); <add> let done = assert.async(); <ide> <ide> Router.map(function() { <ide> this.route('home', { path: '/' }); <ide> QUnit.asyncTest('Moving from one page to another triggers the correct callbacks' <ide> return router.transitionTo('special', promiseContext); <ide> }).then(function() { <ide> assert.deepEqual(router.location.path, '/specials/1'); <del> QUnit.start(); <add> done(); <ide> }); <ide> }); <ide> }); <ide> <del>QUnit.asyncTest('Nested callbacks are not exited when moving to siblings', function(assert) { <add>QUnit.test('Nested callbacks are not exited when moving to siblings', function(assert) { <add> let done = assert.async(); <ide> Router.map(function() { <ide> this.route('root', { path: '/' }, function() { <ide> this.route('special', { path: '/specials/:menu_item_id', resetNamespace: true }); <ide> QUnit.asyncTest('Nested callbacks are not exited when moving to siblings', funct <ide> assert.deepEqual(router.location.path, '/specials/1'); <ide> assert.equal(currentPath, 'root.special'); <ide> <del> QUnit.start(); <add> done(); <ide> }); <ide> }); <ide> }); <ide> <del>QUnit.asyncTest('Events are triggered on the controller if a matching action name is implemented', function(assert) { <add>QUnit.test('Events are triggered on the controller if a matching action name is implemented', function(assert) { <add> let done = assert.async(); <add> <ide> Router.map(function() { <ide> this.route('home', { path: '/' }); <ide> }); <ide> QUnit.asyncTest('Events are triggered on the controller if a matching action nam <ide> showStuff(context) { <ide> assert.ok(stateIsNotCalled, 'an event on the state is not triggered'); <ide> assert.deepEqual(context, { name: 'Tom Dale' }, 'an event with context is passed'); <del> QUnit.start(); <add> done(); <ide> } <ide> } <ide> }); <ide> QUnit.asyncTest('Events are triggered on the controller if a matching action nam <ide> jQuery('#qunit-fixture a').click(); <ide> }); <ide> <del>QUnit.asyncTest('Events are triggered on the current state when defined in `actions` object', function(assert) { <add>QUnit.test('Events are triggered on the current state when defined in `actions` object', function(assert) { <add> let done = assert.async(); <ide> Router.map(function() { <ide> this.route('home', { path: '/' }); <ide> }); <ide> QUnit.asyncTest('Events are triggered on the current state when defined in `acti <ide> assert.ok(this instanceof App.HomeRoute, 'the handler is an App.HomeRoute'); <ide> // Using Ember.copy removes any private Ember vars which older IE would be confused by <ide> assert.deepEqual(copy(obj, true), { name: 'Tom Dale' }, 'the context is correct'); <del> QUnit.start(); <add> done(); <ide> } <ide> } <ide> }); <ide> QUnit.asyncTest('Events are triggered on the current state when defined in `acti <ide> jQuery('#qunit-fixture a').click(); <ide> }); <ide> <del>QUnit.asyncTest('Events defined in `actions` object are triggered on the current state when routes are nested', function(assert) { <add>QUnit.test('Events defined in `actions` object are triggered on the current state when routes are nested', function(assert) { <add> let done = assert.async(); <add> <ide> Router.map(function() { <ide> this.route('root', { path: '/' }, function() { <ide> this.route('index', { path: '/' }); <ide> QUnit.asyncTest('Events defined in `actions` object are triggered on the current <ide> assert.ok(this instanceof App.RootRoute, 'the handler is an App.HomeRoute'); <ide> // Using Ember.copy removes any private Ember vars which older IE would be confused by <ide> assert.deepEqual(copy(obj, true), { name: 'Tom Dale' }, 'the context is correct'); <del> QUnit.start(); <add> done(); <ide> } <ide> } <ide> }); <ide> QUnit.test('Events can be handled by inherited event handlers', function(assert) <ide> router.send('baz'); <ide> }); <ide> <del>QUnit.asyncTest('Actions are not triggered on the controller if a matching action name is implemented as a method', function(assert) { <add>QUnit.test('Actions are not triggered on the controller if a matching action name is implemented as a method', function(assert) { <add> let done = assert.async(); <add> <ide> Router.map(function() { <ide> this.route('home', { path: '/' }); <ide> }); <ide> QUnit.asyncTest('Actions are not triggered on the controller if a matching actio <ide> showStuff(context) { <ide> assert.ok(stateIsNotCalled, 'an event on the state is not triggered'); <ide> assert.deepEqual(context, { name: 'Tom Dale' }, 'an event with context is passed'); <del> QUnit.start(); <add> done(); <ide> } <ide> } <ide> }); <ide> QUnit.asyncTest('Actions are not triggered on the controller if a matching actio <ide> jQuery('#qunit-fixture a').click(); <ide> }); <ide> <del>QUnit.asyncTest('actions can be triggered with multiple arguments', function(assert) { <add>QUnit.test('actions can be triggered with multiple arguments', function(assert) { <add> let done = assert.async(); <ide> Router.map(function() { <ide> this.route('root', { path: '/' }, function() { <ide> this.route('index', { path: '/' }); <ide> QUnit.asyncTest('actions can be triggered with multiple arguments', function(ass <ide> // Using Ember.copy removes any private Ember vars which older IE would be confused by <ide> assert.deepEqual(copy(obj1, true), { name: 'Tilde' }, 'the first context is correct'); <ide> assert.deepEqual(copy(obj2, true), { name: 'Tom Dale' }, 'the second context is correct'); <del> QUnit.start(); <add> done(); <ide> } <ide> } <ide> });
1
Text
Text
add v3.25.4 to changelog.md
d3a764c35b5363c180519cf3cf0e04e1cf44f75e
<ide><path>CHANGELOG.md <ide> - [#19405](https://github.com/emberjs/ember.js/pull/19405) [BUGFIX] Avoid instantiation errors when `app/router.js` injects the router service. <ide> - [#19436](https://github.com/emberjs/ember.js/pull/19436) [BUGFIX] Support observer keys with colons <ide> <add>### v3.25.4 (March 24, 2021) <add> <add>- [#19473](https://github.com/emberjs/ember.js/pull/19473) Update Glimmer VM to latest. <add> <ide> ### v3.25.3 (March 7, 2021) <ide> <ide> - [#19448](https://github.com/emberjs/ember.js/pull/19448) Ensure query params are preserved through an intermediate loading state transition
1
Javascript
Javascript
add ability to add conditions to ng-required
3245209bdb9e656622756220c5bbeb80d3ae2eac
<ide><path>src/widgets.js <ide> function compileValidator(expr) { <ide> function valueAccessor(scope, element) { <ide> var validatorName = element.attr('ng-validate') || NOOP, <ide> validator = compileValidator(validatorName), <del> required = element.attr('ng-required'), <add> requiredExpr = element.attr('ng-required'), <ide> farmatterName = element.attr('ng-format') || NOOP, <ide> formatter = angularFormatter(farmatterName), <del> format, parse, lastError; <add> format, parse, lastError, required; <ide> invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop}; <ide> if (!validator) throw "Validator named '" + validatorName + "' not found."; <ide> if (!formatter) throw "Formatter named '" + farmatterName + "' not found."; <ide> format = formatter.format; <ide> parse = formatter.parse; <del> required = required || required === ''; <add> if (requiredExpr) { <add> scope.$watch(requiredExpr, function(newValue) {required = newValue; validate();}); <add> } else { <add> required = requiredExpr === ''; <add> } <add> <ide> <ide> element.data('$validate', validate); <ide> return { <ide><path>test/widgetsSpec.js <ide> describe("widget", function(){ <ide> expect(element.attr('ng-validation-error')).toEqual('Required'); <ide> }); <ide> <add> it('should allow conditions on ng-required', function() { <add> compile('<input type="text" name="price" ng-required="ineedz"/>'); <add> scope.$set('ineedz', false); <add> scope.$eval(); <add> expect(element.hasClass('ng-validation-error')).toBeFalsy(); <add> expect(element.attr('ng-validation-error')).toBeFalsy(); <add> <add> scope.$set('price', 'xxx'); <add> scope.$eval(); <add> expect(element.hasClass('ng-validation-error')).toBeFalsy(); <add> expect(element.attr('ng-validation-error')).toBeFalsy(); <add> <add> scope.$set('ineedz', true); <add> scope.$eval(); <add> expect(element.hasClass('ng-validation-error')).toBeFalsy(); <add> expect(element.attr('ng-validation-error')).toBeFalsy(); <add> <add> element.val(''); <add> element.trigger('keyup'); <add> expect(element.hasClass('ng-validation-error')).toBeTruthy(); <add> expect(element.attr('ng-validation-error')).toEqual('Required'); <add> }); <add> <ide> it("should process ng-required2", function() { <ide> compile('<textarea name="name">Misko</textarea>'); <ide> expect(scope.$get('name')).toEqual("Misko");
2
Javascript
Javascript
note precedence when used with filters
42ec95ebae716c81087684b55ed8fa8c13888abc
<ide><path>src/ng/directive/ngInit.js <ide> * should use {@link guide/controller controllers} rather than `ngInit` <ide> * to initialize values on a scope. <ide> * </div> <add> * <div class="alert alert-warning"> <add> * **Note**: If you have assignment in `ngInit` along with {@link api/ng.$filter `$filter`}, make <add> * sure you have parenthesis for correct precedence: <add> * <pre class="prettyprint"> <add> * <ng-init="test1 = (data | orderBy:'name')"> <add> * </pre> <add> * </div> <ide> * <ide> * @priority 450 <ide> *
1
Ruby
Ruby
fix #audit_head_branch error
942f419a48426d14a1b49d35f343cbe00a583e71
<ide><path>Library/Homebrew/resource_auditor.rb <ide> def audit_head_branch <ide> return if specs[:tag].present? <ide> <ide> branch = Utils.popen_read("git", "ls-remote", "--symref", url, "HEAD") <del> .match(%r{ref: refs/heads/(.*?)\s+HEAD})[1] <del> <del> return if branch == specs[:branch] <add> .match(%r{ref: refs/heads/(.*?)\s+HEAD})&.to_a&.second <add> return if branch.blank? || branch == specs[:branch] <ide> <ide> problem "Use `branch: \"#{branch}\"` to specify the default branch" <ide> end
1
Javascript
Javascript
fix separator keys for layoutanimation
e8f9c442d6eb3f503234fd0b55a097db07e36fe1
<ide><path>Libraries/Lists/VirtualizedList.js <ide> class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> { <ide> /> <ide> ); <ide> if (ItemSeparatorComponent && ii < end) { <del> cells.push(<ItemSeparatorComponent key={'sep' + ii}/>); <add> cells.push(<ItemSeparatorComponent key={'sep' + key}/>); <ide> } <ide> } <ide> }
1
Ruby
Ruby
prevent crash from nil exitstatus (#532)
b51283424321cb996d0a587e9a62a070d21f3342
<ide><path>Library/Homebrew/cmd/style.rb <ide> def check_style_impl(files, output_type, options = {}) <ide> !$?.success? <ide> when :json <ide> json = Utils.popen_read_text("rubocop", "--format", "json", *args) <del> # exit status of 1 just means violations were found; others are errors <del> raise "Error while running rubocop" if $?.exitstatus > 1 <add> # exit status of 1 just means violations were found; other numbers mean execution errors <add> # exitstatus can also be nil if RuboCop process crashes, e.g. due to <add> # native extension problems <add> raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1 <ide> RubocopResults.new(Utils::JSON.load(json)) <ide> else <ide> raise "Invalid output_type for check_style_impl: #{output_type}"
1
Javascript
Javascript
bring tagname regexes up to spec
fb9472c7fbf9979f48ef49aff76903ac130d0959
<ide><path>src/core/var/rsingleTag.js <ide> define( function() { <ide> <ide> // Match a standalone tag <del> return ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); <add> return ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); <ide> } ); <ide><path>src/manipulation.js <ide> define( [ <ide> dataPriv, dataUser, acceptData, DOMEval ) { <ide> <ide> var <del> rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, <add> rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, <ide> <ide> // Support: IE 10-11, Edge 10240+ <ide> // In IE/Edge using regex groups here causes severe slowdowns. <ide><path>src/manipulation/var/rtagName.js <ide> define( function() { <del> return ( /<([\w:-]+)/ ); <add> return ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); <ide> } ); <ide><path>test/unit/manipulation.js <ide> QUnit.test( "html(String) tag-hyphenated elements (Bug #1987)", function( assert <ide> assert.equal( j.children().text(), "text", "Tags with multiple hypens behave normally" ); <ide> } ); <ide> <add>QUnit.test( "Tag name processing respects the HTML Standard (gh-2005)", function( assert ) { <add> <add> assert.expect( 240 ); <add> <add> var wrapper = jQuery( "<div></div>" ), <add> nameTerminatingChars = "\x20\t\r\n\f".split( "" ), <add> specialChars = "[ ] { } _ - = + \\ ( ) * & ^ % $ # @ ! ~ ` ' ; ? ¥ « µ λ ⊕ ≈ ξ ℜ ♣ €" <add> .split( " " ); <add> <add> specialChars.push( specialChars.join( "" ) ); <add> <add> jQuery.each( specialChars, function( i, characters ) { <add> assertSpecialCharsSupport( "html", characters ); <add> assertSpecialCharsSupport( "append", characters ); <add> } ); <add> <add> jQuery.each( nameTerminatingChars, function( i, character ) { <add> assertNameTerminatingCharsHandling( "html", character ); <add> assertNameTerminatingCharsHandling( "append", character ); <add> } ); <add> <add> function buildChild( method, html ) { <add> wrapper[ method ]( html ); <add> return wrapper.children()[ 0 ]; <add> } <add> <add> function assertSpecialCharsSupport( method, characters ) { <add> var child, <add> codepoint = characters.charCodeAt( 0 ).toString( 16 ).toUpperCase(), <add> description = characters.length === 1 ? <add> "U+" + ( "000" + codepoint ).slice( -4 ) + " " + characters : <add> "all special characters", <add> nodeName = "valid" + characters + "tagname"; <add> <add> child = buildChild( method, "<" + nodeName + "></" + nodeName + ">" ); <add> assert.equal( child.nodeName.toUpperCase(), nodeName.toUpperCase(), <add> method + "(): Paired tag name includes " + description ); <add> <add> child = buildChild( method, "<" + nodeName + ">" ); <add> assert.equal( child.nodeName.toUpperCase(), nodeName.toUpperCase(), <add> method + "(): Unpaired tag name includes " + description ); <add> <add> child = buildChild( method, "<" + nodeName + "/>" ); <add> assert.equal( child.nodeName.toUpperCase(), nodeName.toUpperCase(), <add> method + "(): Self-closing tag name includes " + description ); <add> } <add> <add> function assertNameTerminatingCharsHandling( method, character ) { <add> var child, <add> codepoint = character.charCodeAt( 0 ).toString( 16 ).toUpperCase(), <add> description = "U+" + ( "000" + codepoint ).slice( -4 ) + " " + character, <add> nodeName = "div" + character + "this-will-be-discarded"; <add> <add> child = buildChild( method, "<" + nodeName + "></" + nodeName + ">" ); <add> assert.equal( child.nodeName.toUpperCase(), "DIV", <add> method + "(): Paired tag name terminated by " + description ); <add> <add> child = buildChild( method, "<" + nodeName + ">" ); <add> assert.equal( child.nodeName.toUpperCase(), "DIV", <add> method + "(): Unpaired open tag name terminated by " + description ); <add> <add> child = buildChild( method, "<" + nodeName + "/>" ); <add> assert.equal( child.nodeName.toUpperCase(), "DIV", <add> method + "(): Self-closing tag name terminated by " + description ); <add> } <add>} ); <add> <ide> QUnit.test( "IE8 serialization bug", function( assert ) { <ide> <ide> assert.expect( 2 );
4
PHP
PHP
remove legacy factories
54f543a3005447f5af67b793afbec8d6c3ca056a
<ide><path>src/Illuminate/Database/Eloquent/Factory.php <del><?php <del> <del>namespace Illuminate\Database\Eloquent; <del> <del>use ArrayAccess; <del>use Faker\Generator as Faker; <del>use Symfony\Component\Finder\Finder; <del> <del>class Factory implements ArrayAccess <del>{ <del> /** <del> * The model definitions in the container. <del> * <del> * @var array <del> */ <del> protected $definitions = []; <del> <del> /** <del> * The registered model states. <del> * <del> * @var array <del> */ <del> protected $states = []; <del> <del> /** <del> * The registered after making callbacks. <del> * <del> * @var array <del> */ <del> protected $afterMaking = []; <del> <del> /** <del> * The registered after creating callbacks. <del> * <del> * @var array <del> */ <del> protected $afterCreating = []; <del> <del> /** <del> * The Faker instance for the builder. <del> * <del> * @var \Faker\Generator <del> */ <del> protected $faker; <del> <del> /** <del> * Create a new factory instance. <del> * <del> * @param \Faker\Generator $faker <del> * @return void <del> */ <del> public function __construct(Faker $faker) <del> { <del> $this->faker = $faker; <del> } <del> <del> /** <del> * Create a new factory container. <del> * <del> * @param \Faker\Generator $faker <del> * @param string $pathToFactories <del> * @return static <del> */ <del> public static function construct(Faker $faker, $pathToFactories) <del> { <del> return (new static($faker))->load($pathToFactories); <del> } <del> <del> /** <del> * Define a class with a given set of attributes. <del> * <del> * @param string $class <del> * @param callable $attributes <del> * @return $this <del> */ <del> public function define($class, callable $attributes) <del> { <del> $this->definitions[$class] = $attributes; <del> <del> return $this; <del> } <del> <del> /** <del> * Define a state with a given set of attributes. <del> * <del> * @param string $class <del> * @param string $state <del> * @param callable|array $attributes <del> * @return $this <del> */ <del> public function state($class, $state, $attributes) <del> { <del> $this->states[$class][$state] = $attributes; <del> <del> return $this; <del> } <del> <del> /** <del> * Define a callback to run after making a model. <del> * <del> * @param string $class <del> * @param callable $callback <del> * @param string $name <del> * @return $this <del> */ <del> public function afterMaking($class, callable $callback, $name = 'default') <del> { <del> $this->afterMaking[$class][$name][] = $callback; <del> <del> return $this; <del> } <del> <del> /** <del> * Define a callback to run after making a model with given state. <del> * <del> * @param string $class <del> * @param string $state <del> * @param callable $callback <del> * @return $this <del> */ <del> public function afterMakingState($class, $state, callable $callback) <del> { <del> return $this->afterMaking($class, $callback, $state); <del> } <del> <del> /** <del> * Define a callback to run after creating a model. <del> * <del> * @param string $class <del> * @param callable $callback <del> * @param string $name <del> * @return $this <del> */ <del> public function afterCreating($class, callable $callback, $name = 'default') <del> { <del> $this->afterCreating[$class][$name][] = $callback; <del> <del> return $this; <del> } <del> <del> /** <del> * Define a callback to run after creating a model with given state. <del> * <del> * @param string $class <del> * @param string $state <del> * @param callable $callback <del> * @return $this <del> */ <del> public function afterCreatingState($class, $state, callable $callback) <del> { <del> return $this->afterCreating($class, $callback, $state); <del> } <del> <del> /** <del> * Create an instance of the given model and persist it to the database. <del> * <del> * @param string $class <del> * @param array $attributes <del> * @return mixed <del> */ <del> public function create($class, array $attributes = []) <del> { <del> return $this->of($class)->create($attributes); <del> } <del> <del> /** <del> * Create an instance of the given model. <del> * <del> * @param string $class <del> * @param array $attributes <del> * @return mixed <del> */ <del> public function make($class, array $attributes = []) <del> { <del> return $this->of($class)->make($attributes); <del> } <del> <del> /** <del> * Get the raw attribute array for a given model. <del> * <del> * @param string $class <del> * @param array $attributes <del> * @return array <del> */ <del> public function raw($class, array $attributes = []) <del> { <del> return array_merge( <del> call_user_func($this->definitions[$class], $this->faker), $attributes <del> ); <del> } <del> <del> /** <del> * Create a builder for the given model. <del> * <del> * @param string $class <del> * @return \Illuminate\Database\Eloquent\FactoryBuilder <del> */ <del> public function of($class) <del> { <del> return new FactoryBuilder( <del> $class, $this->definitions, $this->states, <del> $this->afterMaking, $this->afterCreating, $this->faker <del> ); <del> } <del> <del> /** <del> * Load factories from path. <del> * <del> * @param string $path <del> * @return $this <del> */ <del> public function load($path) <del> { <del> $factory = $this; <del> <del> if (is_dir($path)) { <del> foreach (Finder::create()->files()->name('*.php')->in($path) as $file) { <del> require $file->getRealPath(); <del> } <del> } <del> <del> return $factory; <del> } <del> <del> /** <del> * Determine if the given offset exists. <del> * <del> * @param string $offset <del> * @return bool <del> */ <del> public function offsetExists($offset) <del> { <del> return isset($this->definitions[$offset]); <del> } <del> <del> /** <del> * Get the value of the given offset. <del> * <del> * @param string $offset <del> * @return mixed <del> */ <del> public function offsetGet($offset) <del> { <del> return $this->make($offset); <del> } <del> <del> /** <del> * Set the given offset to the given value. <del> * <del> * @param string $offset <del> * @param callable $value <del> * @return void <del> */ <del> public function offsetSet($offset, $value) <del> { <del> $this->define($offset, $value); <del> } <del> <del> /** <del> * Unset the value at the given offset. <del> * <del> * @param string $offset <del> * @return void <del> */ <del> public function offsetUnset($offset) <del> { <del> unset($this->definitions[$offset]); <del> } <del>} <ide><path>src/Illuminate/Database/Eloquent/FactoryBuilder.php <del><?php <del> <del>namespace Illuminate\Database\Eloquent; <del> <del>use Faker\Generator as Faker; <del>use Illuminate\Support\Traits\Macroable; <del>use InvalidArgumentException; <del> <del>class FactoryBuilder <del>{ <del> use Macroable; <del> <del> /** <del> * The model definitions in the container. <del> * <del> * @var array <del> */ <del> protected $definitions; <del> <del> /** <del> * The model being built. <del> * <del> * @var string <del> */ <del> protected $class; <del> <del> /** <del> * The database connection on which the model instance should be persisted. <del> * <del> * @var string <del> */ <del> protected $connection; <del> <del> /** <del> * The model states. <del> * <del> * @var array <del> */ <del> protected $states; <del> <del> /** <del> * The model after making callbacks. <del> * <del> * @var array <del> */ <del> protected $afterMaking = []; <del> <del> /** <del> * The model after creating callbacks. <del> * <del> * @var array <del> */ <del> protected $afterCreating = []; <del> <del> /** <del> * The states to apply. <del> * <del> * @var array <del> */ <del> protected $activeStates = []; <del> <del> /** <del> * The Faker instance for the builder. <del> * <del> * @var \Faker\Generator <del> */ <del> protected $faker; <del> <del> /** <del> * The number of models to build. <del> * <del> * @var int|null <del> */ <del> protected $amount = null; <del> <del> /** <del> * Create an new builder instance. <del> * <del> * @param string $class <del> * @param array $definitions <del> * @param array $states <del> * @param array $afterMaking <del> * @param array $afterCreating <del> * @param \Faker\Generator $faker <del> * @return void <del> */ <del> public function __construct($class, array $definitions, array $states, <del> array $afterMaking, array $afterCreating, Faker $faker) <del> { <del> $this->class = $class; <del> $this->faker = $faker; <del> $this->states = $states; <del> $this->definitions = $definitions; <del> $this->afterMaking = $afterMaking; <del> $this->afterCreating = $afterCreating; <del> } <del> <del> /** <del> * Set the amount of models you wish to create / make. <del> * <del> * @param int $amount <del> * @return $this <del> */ <del> public function times($amount) <del> { <del> $this->amount = $amount; <del> <del> return $this; <del> } <del> <del> /** <del> * Set the state to be applied to the model. <del> * <del> * @param string $state <del> * @return $this <del> */ <del> public function state($state) <del> { <del> return $this->states([$state]); <del> } <del> <del> /** <del> * Set the states to be applied to the model. <del> * <del> * @param array|mixed $states <del> * @return $this <del> */ <del> public function states($states) <del> { <del> $this->activeStates = is_array($states) ? $states : func_get_args(); <del> <del> return $this; <del> } <del> <del> /** <del> * Set the database connection on which the model instance should be persisted. <del> * <del> * @param string $name <del> * @return $this <del> */ <del> public function connection($name) <del> { <del> $this->connection = $name; <del> <del> return $this; <del> } <del> <del> /** <del> * Create a model and persist it in the database if requested. <del> * <del> * @param array $attributes <del> * @return \Closure <del> */ <del> public function lazy(array $attributes = []) <del> { <del> return function () use ($attributes) { <del> return $this->create($attributes); <del> }; <del> } <del> <del> /** <del> * Create a collection of models and persist them to the database. <del> * <del> * @param array $attributes <del> * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed <del> */ <del> public function create(array $attributes = []) <del> { <del> $results = $this->make($attributes); <del> <del> if ($results instanceof Model) { <del> $this->store(collect([$results])); <del> <del> $this->callAfterCreating(collect([$results])); <del> } else { <del> $this->store($results); <del> <del> $this->callAfterCreating($results); <del> } <del> <del> return $results; <del> } <del> <del> /** <del> * Create a collection of models and persist them to the database. <del> * <del> * @param iterable $records <del> * @return \Illuminate\Database\Eloquent\Collection|mixed <del> */ <del> public function createMany(iterable $records) <del> { <del> return (new $this->class)->newCollection(array_map(function ($attribute) { <del> return $this->create($attribute); <del> }, $records)); <del> } <del> <del> /** <del> * Set the connection name on the results and store them. <del> * <del> * @param \Illuminate\Support\Collection $results <del> * @return void <del> */ <del> protected function store($results) <del> { <del> $results->each(function ($model) { <del> if (! isset($this->connection)) { <del> $model->setConnection($model->newQueryWithoutScopes()->getConnection()->getName()); <del> } <del> <del> $model->save(); <del> }); <del> } <del> <del> /** <del> * Create a collection of models. <del> * <del> * @param array $attributes <del> * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed <del> */ <del> public function make(array $attributes = []) <del> { <del> if ($this->amount === null) { <del> return tap($this->makeInstance($attributes), function ($instance) { <del> $this->callAfterMaking(collect([$instance])); <del> }); <del> } <del> <del> if ($this->amount < 1) { <del> return (new $this->class)->newCollection(); <del> } <del> <del> $instances = (new $this->class)->newCollection(array_map(function () use ($attributes) { <del> return $this->makeInstance($attributes); <del> }, range(1, $this->amount))); <del> <del> $this->callAfterMaking($instances); <del> <del> return $instances; <del> } <del> <del> /** <del> * Create an array of raw attribute arrays. <del> * <del> * @param array $attributes <del> * @return mixed <del> */ <del> public function raw(array $attributes = []) <del> { <del> if ($this->amount === null) { <del> return $this->getRawAttributes($attributes); <del> } <del> <del> if ($this->amount < 1) { <del> return []; <del> } <del> <del> return array_map(function () use ($attributes) { <del> return $this->getRawAttributes($attributes); <del> }, range(1, $this->amount)); <del> } <del> <del> /** <del> * Get a raw attributes array for the model. <del> * <del> * @param array $attributes <del> * @return mixed <del> * <del> * @throws \InvalidArgumentException <del> */ <del> protected function getRawAttributes(array $attributes = []) <del> { <del> if (! isset($this->definitions[$this->class])) { <del> throw new InvalidArgumentException("Unable to locate factory for [{$this->class}]."); <del> } <del> <del> $definition = call_user_func( <del> $this->definitions[$this->class], <del> $this->faker, $attributes <del> ); <del> <del> return $this->expandAttributes( <del> array_merge($this->applyStates($definition, $attributes), $attributes) <del> ); <del> } <del> <del> /** <del> * Make an instance of the model with the given attributes. <del> * <del> * @param array $attributes <del> * @return \Illuminate\Database\Eloquent\Model <del> */ <del> protected function makeInstance(array $attributes = []) <del> { <del> return Model::unguarded(function () use ($attributes) { <del> $instance = new $this->class( <del> $this->getRawAttributes($attributes) <del> ); <del> <del> if (isset($this->connection)) { <del> $instance->setConnection($this->connection); <del> } <del> <del> return $instance; <del> }); <del> } <del> <del> /** <del> * Apply the active states to the model definition array. <del> * <del> * @param array $definition <del> * @param array $attributes <del> * @return array <del> * <del> * @throws \InvalidArgumentException <del> */ <del> protected function applyStates(array $definition, array $attributes = []) <del> { <del> foreach ($this->activeStates as $state) { <del> if (! isset($this->states[$this->class][$state])) { <del> if ($this->stateHasAfterCallback($state)) { <del> continue; <del> } <del> <del> throw new InvalidArgumentException("Unable to locate [{$state}] state for [{$this->class}]."); <del> } <del> <del> $definition = array_merge( <del> $definition, <del> $this->stateAttributes($state, $attributes) <del> ); <del> } <del> <del> return $definition; <del> } <del> <del> /** <del> * Get the state attributes. <del> * <del> * @param string $state <del> * @param array $attributes <del> * @return array <del> */ <del> protected function stateAttributes($state, array $attributes) <del> { <del> $stateAttributes = $this->states[$this->class][$state]; <del> <del> if (! is_callable($stateAttributes)) { <del> return $stateAttributes; <del> } <del> <del> return $stateAttributes($this->faker, $attributes); <del> } <del> <del> /** <del> * Expand all attributes to their underlying values. <del> * <del> * @param array $attributes <del> * @return array <del> */ <del> protected function expandAttributes(array $attributes) <del> { <del> foreach ($attributes as &$attribute) { <del> if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { <del> $attribute = $attribute($attributes); <del> } <del> <del> if ($attribute instanceof static) { <del> $attribute = $attribute->create()->getKey(); <del> } <del> <del> if ($attribute instanceof Model) { <del> $attribute = $attribute->getKey(); <del> } <del> } <del> <del> return $attributes; <del> } <del> <del> /** <del> * Run after making callbacks on a collection of models. <del> * <del> * @param \Illuminate\Support\Collection $models <del> * @return void <del> */ <del> public function callAfterMaking($models) <del> { <del> $this->callAfter($this->afterMaking, $models); <del> } <del> <del> /** <del> * Run after creating callbacks on a collection of models. <del> * <del> * @param \Illuminate\Support\Collection $models <del> * @return void <del> */ <del> public function callAfterCreating($models) <del> { <del> $this->callAfter($this->afterCreating, $models); <del> } <del> <del> /** <del> * Call after callbacks for each model and state. <del> * <del> * @param array $afterCallbacks <del> * @param \Illuminate\Support\Collection $models <del> * @return void <del> */ <del> protected function callAfter(array $afterCallbacks, $models) <del> { <del> $states = array_merge(['default'], $this->activeStates); <del> <del> $models->each(function ($model) use ($states, $afterCallbacks) { <del> foreach ($states as $state) { <del> $this->callAfterCallbacks($afterCallbacks, $model, $state); <del> } <del> }); <del> } <del> <del> /** <del> * Call after callbacks for each model and state. <del> * <del> * @param array $afterCallbacks <del> * @param \Illuminate\Database\Eloquent\Model $model <del> * @param string $state <del> * @return void <del> */ <del> protected function callAfterCallbacks(array $afterCallbacks, $model, $state) <del> { <del> if (! isset($afterCallbacks[$this->class][$state])) { <del> return; <del> } <del> <del> foreach ($afterCallbacks[$this->class][$state] as $callback) { <del> $callback($model, $this->faker); <del> } <del> } <del> <del> /** <del> * Determine if the given state has an "after" callback. <del> * <del> * @param string $state <del> * @return bool <del> */ <del> protected function stateHasAfterCallback($state) <del> { <del> return isset($this->afterMaking[$this->class][$state]) || <del> isset($this->afterCreating[$this->class][$state]); <del> } <del>} <ide><path>tests/Integration/Database/EloquentFactoryBuilderTest.php <del><?php <del> <del>namespace Illuminate\Tests\Integration\Database; <del> <del>use Faker\Generator; <del>use Illuminate\Database\Eloquent\Collection; <del>use Illuminate\Database\Eloquent\Factory; <del>use Illuminate\Database\Eloquent\Model; <del>use Illuminate\Database\Schema\Blueprint; <del>use Illuminate\Support\Facades\Schema; <del>use Orchestra\Testbench\TestCase; <del> <del>/** <del> * @group integration <del> */ <del>class EloquentFactoryBuilderTest extends TestCase <del>{ <del> protected function getEnvironmentSetUp($app) <del> { <del> $app['config']->set('app.debug', 'true'); <del> <del> $app['config']->set('database.default', 'testbench'); <del> $app['config']->set('database.connections.testbench', [ <del> 'driver' => 'sqlite', <del> 'database' => ':memory:', <del> 'prefix' => '', <del> ]); <del> $app['config']->set('database.connections.alternative-connection', [ <del> 'driver' => 'sqlite', <del> 'database' => ':memory:', <del> 'prefix' => '', <del> ]); <del> <del> $factory = new Factory($app->make(Generator::class)); <del> <del> $factory->define(FactoryBuildableUser::class, function (Generator $faker) { <del> return [ <del> 'name' => $faker->name, <del> 'email' => $faker->unique()->safeEmail, <del> ]; <del> }); <del> <del> $factory->define(FactoryBuildableProfile::class, function (Generator $faker) { <del> return [ <del> 'user_id' => function () { <del> return factory(FactoryBuildableUser::class)->create()->id; <del> }, <del> ]; <del> }); <del> <del> $factory->afterMaking(FactoryBuildableUser::class, function (FactoryBuildableUser $user, Generator $faker) { <del> $profile = factory(FactoryBuildableProfile::class)->make(['user_id' => $user->id]); <del> $user->setRelation('profile', $profile); <del> }); <del> <del> $factory->afterMakingState(FactoryBuildableUser::class, 'with_callable_server', function (FactoryBuildableUser $user, Generator $faker) { <del> $server = factory(FactoryBuildableServer::class) <del> ->state('callable') <del> ->make(['user_id' => $user->id]); <del> <del> $user->servers->push($server); <del> }); <del> <del> $factory->define(FactoryBuildableTeam::class, function (Generator $faker) { <del> return [ <del> 'name' => $faker->name, <del> 'owner_id' => function () { <del> return factory(FactoryBuildableUser::class)->create()->id; <del> }, <del> ]; <del> }); <del> <del> $factory->afterCreating(FactoryBuildableTeam::class, function (FactoryBuildableTeam $team, Generator $faker) { <del> $team->users()->attach($team->owner); <del> }); <del> <del> $factory->define(FactoryBuildableServer::class, function (Generator $faker) { <del> return [ <del> 'name' => $faker->name, <del> 'status' => 'active', <del> 'tags' => ['Storage', 'Data'], <del> 'user_id' => function () { <del> return factory(FactoryBuildableUser::class)->create()->id; <del> }, <del> ]; <del> }); <del> <del> $factory->state(FactoryBuildableServer::class, 'callable', function (Generator $faker) { <del> return [ <del> 'status' => 'callable', <del> ]; <del> }); <del> <del> $factory->afterCreatingState(FactoryBuildableUser::class, 'with_callable_server', function (FactoryBuildableUser $user, Generator $faker) { <del> factory(FactoryBuildableServer::class) <del> ->state('callable') <del> ->create(['user_id' => $user->id]); <del> }); <del> <del> $factory->state(FactoryBuildableServer::class, 'inline', ['status' => 'inline']); <del> <del> $app->singleton(Factory::class, function ($app) use ($factory) { <del> return $factory; <del> }); <del> } <del> <del> protected function setUp(): void <del> { <del> parent::setUp(); <del> <del> Schema::create('users', function (Blueprint $table) { <del> $table->increments('id'); <del> $table->string('name'); <del> $table->string('email'); <del> }); <del> <del> Schema::create('profiles', function (Blueprint $table) { <del> $table->increments('id'); <del> $table->unsignedInteger('user_id'); <del> }); <del> <del> Schema::create('teams', function (Blueprint $table) { <del> $table->increments('id'); <del> $table->string('name'); <del> $table->string('owner_id'); <del> }); <del> <del> Schema::create('team_users', function (Blueprint $table) { <del> $table->increments('id'); <del> $table->unsignedInteger('team_id'); <del> $table->unsignedInteger('user_id'); <del> }); <del> <del> Schema::connection('alternative-connection')->create('users', function (Blueprint $table) { <del> $table->increments('id'); <del> $table->string('name'); <del> $table->string('email'); <del> }); <del> <del> Schema::create('servers', function (Blueprint $table) { <del> $table->increments('id'); <del> $table->string('name'); <del> $table->string('tags'); <del> $table->integer('user_id'); <del> $table->string('status'); <del> }); <del> } <del> <del> public function testCreatingFactoryModels() <del> { <del> $user = factory(FactoryBuildableUser::class)->create(); <del> <del> $dbUser = FactoryBuildableUser::find(1); <del> <del> $this->assertTrue($user->is($dbUser)); <del> } <del> <del> public function testCreatingFactoryModelsOverridingAttributes() <del> { <del> $user = factory(FactoryBuildableUser::class)->create(['name' => 'Zain']); <del> <del> $this->assertSame('Zain', $user->name); <del> } <del> <del> public function testCreatingCollectionOfModels() <del> { <del> $users = factory(FactoryBuildableUser::class, 3)->create(); <del> <del> $instances = factory(FactoryBuildableUser::class, 3)->make(); <del> <del> $this->assertInstanceOf(Collection::class, $users); <del> $this->assertInstanceOf(Collection::class, $instances); <del> $this->assertCount(3, $users); <del> $this->assertCount(3, $instances); <del> $this->assertCount(3, FactoryBuildableUser::find($users->pluck('id')->toArray())); <del> $this->assertCount(0, FactoryBuildableUser::find($instances->pluck('id')->toArray())); <del> } <del> <del> public function testCreateManyCollectionOfModels() <del> { <del> $users = factory(FactoryBuildableUser::class)->createMany([ <del> [ <del> 'name' => 'Taylor', <del> ], <del> [ <del> 'name' => 'John', <del> ], <del> [ <del> 'name' => 'Doe', <del> ], <del> ]); <del> $this->assertInstanceOf(Collection::class, $users); <del> $this->assertCount(3, $users); <del> $this->assertCount(3, FactoryBuildableUser::find($users->pluck('id')->toArray())); <del> $this->assertEquals(['Taylor', 'John', 'Doe'], $users->pluck('name')->toArray()); <del> } <del> <del> public function testCreatingModelsWithCallableState() <del> { <del> $server = factory(FactoryBuildableServer::class)->create(); <del> <del> $callableServer = factory(FactoryBuildableServer::class)->state('callable')->create(); <del> <del> $this->assertSame('active', $server->status); <del> $this->assertEquals(['Storage', 'Data'], $server->tags); <del> $this->assertSame('callable', $callableServer->status); <del> } <del> <del> public function testCreatingModelsWithInlineState() <del> { <del> $server = factory(FactoryBuildableServer::class)->create(); <del> <del> $inlineServer = factory(FactoryBuildableServer::class)->state('inline')->create(); <del> <del> $this->assertSame('active', $server->status); <del> $this->assertSame('inline', $inlineServer->status); <del> } <del> <del> public function testCreatingModelsWithRelationships() <del> { <del> factory(FactoryBuildableUser::class, 2) <del> ->create() <del> ->each(function ($user) { <del> $user->servers()->saveMany(factory(FactoryBuildableServer::class, 2)->make()); <del> }) <del> ->each(function ($user) { <del> $this->assertCount(2, $user->servers); <del> }); <del> } <del> <del> public function testCreatingModelsOnCustomConnection() <del> { <del> $user = factory(FactoryBuildableUser::class) <del> ->connection('alternative-connection') <del> ->create(); <del> <del> $dbUser = FactoryBuildableUser::on('alternative-connection')->find(1); <del> <del> $this->assertSame('alternative-connection', $user->getConnectionName()); <del> $this->assertTrue($user->is($dbUser)); <del> } <del> <del> public function testCreatingModelsWithAfterCallback() <del> { <del> $team = factory(FactoryBuildableTeam::class)->create(); <del> <del> $this->assertTrue($team->users->contains($team->owner)); <del> } <del> <del> public function testCreatingModelsWithAfterCallbackState() <del> { <del> $user = factory(FactoryBuildableUser::class)->state('with_callable_server')->create(); <del> <del> $this->assertNotNull($user->profile); <del> $this->assertNotNull($user->servers->where('status', 'callable')->first()); <del> } <del> <del> public function testMakingModelsWithACustomConnection() <del> { <del> $user = factory(FactoryBuildableUser::class) <del> ->connection('alternative-connection') <del> ->make(); <del> <del> $this->assertSame('alternative-connection', $user->getConnectionName()); <del> } <del> <del> public function testMakingModelsWithAfterCallback() <del> { <del> $user = factory(FactoryBuildableUser::class)->make(); <del> <del> $this->assertNotNull($user->profile); <del> } <del> <del> public function testMakingModelsWithAfterCallbackState() <del> { <del> $user = factory(FactoryBuildableUser::class)->state('with_callable_server')->make(); <del> <del> $this->assertNotNull($user->profile); <del> $this->assertNotNull($user->servers->where('status', 'callable')->first()); <del> } <del>} <del> <del>class FactoryBuildableUser extends Model <del>{ <del> public $table = 'users'; <del> public $timestamps = false; <del> protected $guarded = ['id']; <del> <del> public function servers() <del> { <del> return $this->hasMany(FactoryBuildableServer::class, 'user_id'); <del> } <del> <del> public function profile() <del> { <del> return $this->hasOne(FactoryBuildableProfile::class, 'user_id'); <del> } <del>} <del> <del>class FactoryBuildableProfile extends Model <del>{ <del> public $table = 'profiles'; <del> public $timestamps = false; <del> protected $guarded = ['id']; <del> <del> public function user() <del> { <del> return $this->belongsTo(FactoryBuildableUser::class, 'user_id'); <del> } <del>} <del> <del>class FactoryBuildableTeam extends Model <del>{ <del> public $table = 'teams'; <del> public $timestamps = false; <del> protected $guarded = ['id']; <del> <del> public function owner() <del> { <del> return $this->belongsTo(FactoryBuildableUser::class, 'owner_id'); <del> } <del> <del> public function users() <del> { <del> return $this->belongsToMany( <del> FactoryBuildableUser::class, <del> 'team_users', <del> 'team_id', <del> 'user_id' <del> ); <del> } <del>} <del> <del>class FactoryBuildableServer extends Model <del>{ <del> public $table = 'servers'; <del> public $timestamps = false; <del> protected $guarded = ['id']; <del> public $casts = ['tags' => 'array']; <del> <del> public function user() <del> { <del> return $this->belongsTo(FactoryBuildableUser::class, 'user_id'); <del> } <del>}
3
Javascript
Javascript
fix irregular whitespace issue
d66f18e6cde8cadf20e3c4ddc85ec495546d1fb4
<ide><path>test/parallel/test-promises-unhandled-rejections.js <ide> asyncTest('Catching the Promise.all() of a collection that includes a' + <ide> 'rejected promise prevents unhandledRejection', function(done) { <ide> var e = new Error(); <ide> onUnhandledFail(done); <del> Promise.all([Promise.reject(e)]).then(common.fail, function() {}); <add> Promise.all([Promise.reject(e)]).then(common.fail, function() {}); <ide> }); <ide> <ide> asyncTest( <ide> asyncTest( <ide> }); <ide> p = Promise.all([p]); <ide> process.nextTick(function() { <del> p.then(common.fail, function() {}); <add> p.then(common.fail, function() {}); <ide> }); <ide> } <ide> ); <ide> asyncTest('Waiting for some combination of process.nextTick + promise' + <ide> Promise.resolve().then(function() { <ide> process.nextTick(function() { <ide> Promise.resolve().then(function() { <del> a.catch(function() {}); <add> a.catch(function() {}); <ide> }); <ide> }); <ide> }); <ide> asyncTest('Waiting for some combination of process.nextTick + promise' + <ide> Promise.resolve().then(function() { <ide> process.nextTick(function() { <ide> Promise.resolve().then(function() { <del> a.catch(function() {}); <add> a.catch(function() {}); <ide> }); <ide> }); <ide> }); <ide> asyncTest('Waiting for some combination of process.nextTick + promise ' + <ide> Promise.resolve().then(function() { <ide> process.nextTick(function() { <ide> Promise.resolve().then(function() { <del> a.catch(function() {}); <add> a.catch(function() {}); <ide> }); <ide> }); <ide> }); <ide> asyncTest('Waiting for some combination of promise microtasks + ' + <ide> process.nextTick(function() { <ide> Promise.resolve().then(function() { <ide> process.nextTick(function() { <del> a.catch(function() {}); <add> a.catch(function() {}); <ide> }); <ide> }); <ide> }); <ide> asyncTest( <ide> process.nextTick(function() { <ide> Promise.resolve().then(function() { <ide> process.nextTick(function() { <del> a.catch(function() {}); <add> a.catch(function() {}); <ide> }); <ide> }); <ide> }); <ide> asyncTest('Waiting for some combination of promise microtasks +' + <ide> process.nextTick(function() { <ide> Promise.resolve().then(function() { <ide> process.nextTick(function() { <del> a.catch(function() {}); <add> a.catch(function() {}); <ide> }); <ide> }); <ide> });
1
Text
Text
fix typo s/create_at/created_at/ [ci skip]
e20654a12a3dc88c1a8e18ebf281bae9d06ec462
<ide><path>activerecord/CHANGELOG.md <ide> ``` <ide> <ide> From type casting and table/column name resolution's point of view, <del> `where("create_at >=": time)` is better alternative than `where("create_at >= ?", time)`. <add> `where("created_at >=": time)` is better alternative than `where("created_at >= ?", time)`. <ide> <ide> ```ruby <ide> class Post < ActiveRecord::Base
1
Python
Python
fix typo for load array
9777b51ee2f898c176b6e7d2c9412eb7556bb60b
<ide><path>keras/utils/io_utils.py <ide> def save_array(array, name): <ide> <ide> def load_array(name): <ide> if tables is None: <del> raise ImportError('The use of `save_array` requires ' <add> raise ImportError('The use of `load_array` requires ' <ide> 'the tables module.') <ide> f = tables.open_file(name) <ide> array = f.root.data
1
Text
Text
fix a typo in api.md
b62d444a37338596cd6f0dcc2058d2599fa1eeab
<ide><path>API.md <ide> Methods for computing basic summary statistics. <ide> * [d3.sum](https://github.com/d3/d3-array/blob/v2.12.0/README.md#sum) - compute the sum of an iterable of numbers. <ide> * [d3.mean](https://github.com/d3/d3-array/blob/v2.12.0/README.md#mean) - compute the arithmetic mean of an iterable of numbers. <ide> * [d3.median](https://github.com/d3/d3-array/blob/v2.12.0/README.md#median) - compute the median of an iterable of numbers (the 0.5-quantile). <del>* [d3.cumsum](https://github.com/d3/d3-array/blob/v2.12.0/README.md#cumsum) - comute the cumulative sum of an iterable. <add>* [d3.cumsum](https://github.com/d3/d3-array/blob/v2.12.0/README.md#cumsum) - compute the cumulative sum of an iterable. <ide> * [d3.quantile](https://github.com/d3/d3-array/blob/v2.12.0/README.md#quantile) - compute a quantile for an iterable of numbers. <ide> * [d3.quantileSorted](https://github.com/d3/d3-array/blob/v2.12.0/README.md#quantileSorted) - compute a quantile for a sorted array of numbers. <ide> * [d3.variance](https://github.com/d3/d3-array/blob/v2.12.0/README.md#variance) - compute the variance of an iterable of numbers.
1
Text
Text
update challengetype 11 to hidden
82a929681fb71214c3bdbdcbfed00454aa2c467a
<ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/build-your-own-functions.english.md <ide> id: 5e7b9f060b6c005b0e76f05b <ide> title: Build your own Functions <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: nLDychdBwUg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/comparing-and-sorting-tuples.english.md <ide> id: 5e7b9f0b0b6c005b0e76f06d <ide> title: Comparing and Sorting Tuples <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: dZXzBXUxxCs <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/conditional-execution.english.md <ide> id: 5e7b9f050b6c005b0e76f058 <ide> title: Conditional Execution <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: gz_IfIsZQtc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/data-visualization-mailing-lists.english.md <ide> id: 5e7b9f6a0b6c005b0e76f097 <ide> title: 'Data Visualization: Mailing Lists' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: RYdW660KkaQ <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/data-visualization-page-rank.english.md <ide> id: 5e7b9f6a0b6c005b0e76f096 <ide> title: 'Data Visualization: Page Rank' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 6-w_qIUwaxU <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/dictionaries-and-loops.english.md <ide> id: 5e7b9f0a0b6c005b0e76f069 <ide> title: Dictionaries and Loops <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: EEmekKiKG70 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/dictionaries-common-applications.english.md <ide> id: 5e7b9f090b6c005b0e76f068 <ide> title: "Dictionaries: Common Applications" <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: f17xPfIXct0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/files-as-a-sequence.english.md <ide> id: 5e7b9f080b6c005b0e76f063 <ide> title: Files as a Sequence <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: cIA0EokbaHE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/intermediate-expressions.english.md <ide> id: 5e7b9f050b6c005b0e76f057 <ide> title: Intermediate Expressions <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: dKgUaIa5ATg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/intermediate-strings.english.md <ide> id: 5e7b9f070b6c005b0e76f061 <ide> title: Intermediate Strings <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: KgT_fYLXnyk <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-elements-of-python.md <ide> id: 5e6a54c358d3af90110a60a3 <ide> title: 'Introduction: Elements of Python' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: aRY_xjL35v0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-hardware-achitecture.english.md <ide> id: 5e6a54af58d3af90110a60a1 <ide> title: 'Introduction: Hardware Architecture' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: H6qtjRTfSog <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-python-as-a-language.english.md <ide> id: 5e6a54ba58d3af90110a60a2 <ide> title: 'Introduction: Python as a Language' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 0QeGbZNS_bY <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/introduction-why-program.english.md <ide> id: 5e6a54a558d3af90110a60a0 <ide> title: 'Introduction: Why Program?' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 3muQV-Im3Z0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/iterations-definite-loops.english.md <ide> id: 5e7b9f070b6c005b0e76f05d <ide> title: 'Iterations: Definite Loops' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: hiRTRAqNlpE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/iterations-loop-idioms.english.md <ide> id: 5e7b9f070b6c005b0e76f05e <ide> title: 'Iterations: Loop Idioms' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: AelGAcoMXbI <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/iterations-more-patterns.english.md <ide> id: 5e7b9f070b6c005b0e76f05f <ide> title: 'Iterations: More Patterns' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 9Wtqo6vha1M <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/loops-and-iterations.english.md <ide> id: 5e7b9f060b6c005b0e76f05c <ide> title: Loops and Iterations <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: dLA-szNRnUY <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/make-a-relational-database.english.md <ide> id: 5e7b9f170b6c005b0e76f08b <ide> title: Make a Relational Database <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: MQ5z4bdF92U <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/more-conditional-structures.english.md <ide> id: 5e7b9f060b6c005b0e76f059 <ide> title: More Conditional Structures <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: HdL82tAZR20 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-protocol.english.md <ide> id: 5e7b9f0c0b6c005b0e76f072 <ide> title: Networking Protocol <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: c6vZGescaSc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-text-processing.english.md <ide> id: 5e7b9f0c0b6c005b0e76f074 <ide> title: 'Networking: Text Processing' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: Pv_pJgVu8WI <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-using-urllib-in-python.md <ide> id: 5e7b9f0d0b6c005b0e76f075 <ide> title: 'Networking: Using urllib in Python' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 7lFM1T_CxBs <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-web-scraping-with-python.english.md <ide> id: 5e7b9f0d0b6c005b0e76f076 <ide> title: 'Networking: Web Scraping with Python' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: Uyioq2q4cEg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-with-python.english.md <ide> id: 5e7b9f0c0b6c005b0e76f071 <ide> title: Networking with Python <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: _kJvneKVdNM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/networking-write-a-web-browser.english.md <ide> id: 5e7b9f0c0b6c005b0e76f073 <ide> title: 'Networking: Write a Web Browser' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: zjyT9DaAjx4 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/object-lifecycle.english.md <ide> id: 5e7b9f170b6c005b0e76f087 <ide> title: Object Lifecycle <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: p1r3h_AMMIM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/objects-a-sample-class.english.md <ide> id: 5e7b9f160b6c005b0e76f086 <ide> title: 'Objects: A Sample Class' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: FiABKEuaSJ8 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/objects-inheritance.english.md <ide> id: 5e7b9f170b6c005b0e76f088 <ide> title: 'Objects: Inheritance' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: FBL3alYrxRM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-dictionaries.english.md <ide> id: 5e7b9f090b6c005b0e76f067 <ide> title: Python Dictionaries <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: dnzvfimrRMg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-functions.english.md <ide> id: 5e7b9f060b6c005b0e76f05a <ide> title: Python Functions <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 3JGF-n3tDPU <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-lists.english.md <ide> id: 5e7b9f080b6c005b0e76f064 <ide> title: Python Lists <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: Y0cvfDpYC_c <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/python-objects.english.md <ide> id: 5e7b9f160b6c005b0e76f085 <ide> title: Python Objects <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: uJxGeTYy0us <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/reading-files.english.md <ide> id: 5e7b9f080b6c005b0e76f062 <ide> title: Reading Files <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: Fo1tW09KIwo <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/regular-expressions-matching-and-extracting-data.english.md <ide> id: 5e7b9f0b0b6c005b0e76f06f <ide> title: 'Regular Expressions: Matching and Extracting Data' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: LaCZnTbQGkE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/regular-expressions-practical-applications.english.md <ide> id: 5e7b9f0b0b6c005b0e76f070 <ide> title: 'Regular Expressions: Practical Applications' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: xCjFU9G6x48 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/regular-expressions.english.md <ide> id: 5e7b9f0b0b6c005b0e76f06e <ide> title: Regular Expressions <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: Yud_COr6pZo <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-database-design.english.md <ide> id: 5e7b9f180b6c005b0e76f08c <ide> title: Relational Database Design <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: AqdfbrpkbHk <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-and-sqlite.english.md <ide> id: 5e7b9f170b6c005b0e76f08a <ide> title: 'Relational Databases and SQLite' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: QlNod5-kFpA <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-join-operation.english.md <ide> id: 5e7b9f180b6c005b0e76f08f <ide> title: 'Relational Databases: Join Operation' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: jvDw3D9GKac <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-many-to-many-relationships.english.md <ide> --- <ide> id: 5e7b9f190b6c005b0e76f090 <del>title: 'Relational Databases: Many-to-many Relationships' <add>title: 'Relational Databases: Many-to-many Relationships' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: z-SBYcvEQOc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/relational-databases-relationship-building.english.md <ide> id: 5e7b9f180b6c005b0e76f08e <ide> title: 'Relational Databases: Relationship Building' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: A-t18zKJvmo <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/representing-relationships-in-a-relational-database.english.md <ide> id: 5e7b9f180b6c005b0e76f08d <ide> title: Representing Relationships in a Relational Database <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: -orenCNdC2Q <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/strings-and-lists.english.md <ide> id: 5e7b9f090b6c005b0e76f066 <ide> title: Strings and Lists <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: lxcFa7ldCi0 <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/strings-in-python.english.md <ide> id: 5e7b9f070b6c005b0e76f060 <ide> title: Strings in Python <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: LYZj207fKpQ <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/the-tuples-collection.english.md <ide> id: 5e7b9f0a0b6c005b0e76f06c <ide> title: The Tuples Collection <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: 3Lxpladfh2k <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/using-web-services.english.md <ide> id: 5e7b9f0e0b6c005b0e76f07a <ide> title: Using Web Services <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: oNl1OVDPGKE <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/variables-expressions-and-statements.english.md <ide> id: 5e7b9f050b6c005b0e76f056 <ide> title: Variables, Expressions, and Statements <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: nELR-uyyrok <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/visualizing-data-with-python.english.md <ide> id: 5e7b9f690b6c005b0e76f095 <ide> title: Visualizing Data with Python <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: e3lydkH0prw <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-api-rate-limiting-and-security.english.md <ide> id: 5e7b9f150b6c005b0e76f080 <ide> title: 'Web Services: API Rate Limiting and Security' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: pI-g0lI8ngs <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-apis.english.md <ide> id: 5e7b9f150b6c005b0e76f07f <ide> title: 'Web Services: APIs' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: oUNn1psfBJg <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-json.english.md <ide> id: 5e7b9f140b6c005b0e76f07d <ide> title: 'Web Services: JSON' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: ZJE-U56BppM <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-service-oriented-approach.english.md <ide> id: 5e7b9f140b6c005b0e76f07e <ide> title: 'Web Services: Service Oriented Approach' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: muerlsCHExI <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-xml-schema.english.md <ide> id: 5e7b9f0e0b6c005b0e76f07c <ide> title: 'Web Services: XML Schema' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: yWU9kTxW-nc <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/web-services-xml.english.md <ide> id: 5e7b9f0e0b6c005b0e76f07b <ide> title: 'Web Services: XML' <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: _pZ0srbg7So <ide> --- <ide><path>curriculum/challenges/english/07-scientific-computing-with-python/python-for-everybody/working-with-lists.english.md <ide> id: 5e7b9f090b6c005b0e76f065 <ide> title: Working with Lists <ide> challengeType: 11 <add>isHidden: true <ide> isRequired: true <ide> videoId: lCnHfTHkhbE <ide> --- <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-a.english.md <ide> id: 5e9a093a74c4063ca6f7c14d <ide> title: Data Analysis Example A <ide> challengeType: 11 <add>isHidden: true <ide> videoId: nVAaxZ34khk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-analysis-example-b.english.md <ide> id: 5e9a093a74c4063ca6f7c14e <ide> title: Data Analysis Example B <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 0kJz0q0pvgQ <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-and-visualizations.english.md <ide> id: 5e9a093a74c4063ca6f7c160 <ide> title: Data Cleaning and Visualizations <ide> challengeType: 11 <add>isHidden: true <ide> videoId: mHjxzFS5_Z0 <ide> --- <ide> <ide> question: <ide> text: 'When using Matplotlib''s global API, what does the order of numbers mean here <pre>plt.subplot(1, 2, 1)</pre>' <ide> answers: <ide> - 'My figure will have one column, two rows, and I am going to start drawing in the first (left) plot.' <del> - 'I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column.' <add> - 'I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column.' <ide> - 'My figure will have one row, two columns, and I am going to start drawing in the first (left) plot.' <ide> solution: 3 <ide> ``` <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-duplicates.english.md <ide> id: 5e9a093a74c4063ca6f7c15f <ide> title: Data Cleaning Duplicates <ide> challengeType: 11 <add>isHidden: true <ide> videoId: kj7QqjXhH6A <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c15d <ide> title: Data Cleaning Introduction <ide> challengeType: 11 <add>isHidden: true <ide> videoId: ovYNhnltVxY <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/data-cleaning-with-dataframes.english.md <ide> id: 5e9a093a74c4063ca6f7c15e <ide> title: Data Cleaning with DataFrames <ide> challengeType: 11 <add>isHidden: true <ide> videoId: sTMN_pdI6S0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/how-to-use-jupyter-notebooks-intro.english.md <ide> id: 5e9a093a74c4063ca6f7c14f <ide> title: How to use Jupyter Notebooks Intro <ide> challengeType: 11 <add>isHidden: true <ide> videoId: h8caJq2Bb9w <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/introduction-to-data-analysis.english.md <ide> id: 5e9a093a74c4063ca6f7c14c <ide> title: Introduction to Data Analysis <ide> challengeType: 11 <add>isHidden: true <ide> videoId: VJrP2FUzKP0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-cells.english.md <ide> id: 5e9a093a74c4063ca6f7c150 <ide> title: Jupyter Notebooks Cells <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 5PPegAs9aLA <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/jupyter-notebooks-importing-and-exporting-data.english.md <ide> id: 5e9a093a74c4063ca6f7c151 <ide> title: Jupyter Notebooks Importing and Exporting Data <ide> challengeType: 11 <add>isHidden: true <ide> videoId: k1msxD3JIxE <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-algebra-and-size.english.md <ide> id: 5e9a093a74c4063ca6f7c157 <ide> title: Numpy Algebra and Size <ide> challengeType: 11 <add>isHidden: true <ide> videoId: XAT97YLOKD8 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-arrays.english.md <ide> id: 5e9a093a74c4063ca6f7c154 <ide> title: Numpy Arrays <ide> challengeType: 11 <add>isHidden: true <ide> videoId: VDYVFHBL1AM <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-boolean-arrays.english.md <ide> id: 5e9a093a74c4063ca6f7c156 <ide> title: Numpy Boolean Arrays <ide> challengeType: 11 <add>isHidden: true <ide> videoId: N1ttsMmcVMM <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-a.english.md <ide> id: 5e9a093a74c4063ca6f7c152 <ide> title: Numpy Introduction A <ide> challengeType: 11 <add>isHidden: true <ide> videoId: P-JjV6GBCmk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-introduction-b.english.md <ide> id: 5e9a093a74c4063ca6f7c153 <ide> title: Numpy Introduction B <ide> challengeType: 11 <add>isHidden: true <ide> videoId: YIqgrNLAZkA <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/numpy-operations.english.md <ide> id: 5e9a093a74c4063ca6f7c155 <ide> title: Numpy Operations <ide> challengeType: 11 <add>isHidden: true <ide> videoId: eqSVcJbaPdk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-condtitional-selection-and-modifying-dataframes.english.md <ide> id: 5e9a093a74c4063ca6f7c15b <ide> title: Pandas Condtitional Selection and Modifying DataFrames <ide> challengeType: 11 <add>isHidden: true <ide> videoId: BFlH0fN5xRQ <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-creating-columns.english.md <ide> id: 5e9a093a74c4063ca6f7c15c <ide> title: Pandas Creating Columns <ide> challengeType: 11 <add>isHidden: true <ide> videoId: _sSo2XZoB3E <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-dataframes.english.md <ide> id: 5e9a093a74c4063ca6f7c15a <ide> title: Pandas DataFrames <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 7SgFBYXaiH0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-indexing-and-conditional-selection.english.md <ide> id: 5e9a093a74c4063ca6f7c159 <ide> title: Pandas Indexing and Conditional Selection <ide> challengeType: 11 <add>isHidden: true <ide> videoId: -ZOrgV_aA9A <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/pandas-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c158 <ide> title: Pandas Introduction <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 0xACW-8cZU0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/parsing-html-and-saving-data.english.md <ide> id: 5e9a093a74c4063ca6f7c164 <ide> title: Parsing HTML and Saving Data <ide> challengeType: 11 <add>isHidden: true <ide> videoId: bJaqnTWQmb0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/python-functions-and-collections.english.md <ide> id: 5e9a093a74c4063ca6f7c166 <ide> title: Python Functions and Collections <ide> challengeType: 11 <add>isHidden: true <ide> videoId: NzpU17ZVlUw <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/python-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c165 <ide> title: Python Introduction <ide> challengeType: 11 <add>isHidden: true <ide> videoId: PrQV9JkLhb4 <ide> --- <ide> <ide> question: <ide> text: 'How do we define blocks of code in the body of functions in Python?' <ide> answers: <ide> - 'We use a set of curly braces, one on either side of each new block of our code.' <del> - 'We use indentation, usually right-aligned 4 spaces.' <add> - 'We use indentation, usually right-aligned 4 spaces.' <ide> - 'We do not denote blocks of code.' <ide> - 'We could use curly braces or indentation to denote blocks of code.' <ide> solution: 2 <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/python-iteration-and-modules.english.md <ide> id: 5e9a093a74c4063ca6f7c167 <ide> title: Python Iteration and Modules <ide> challengeType: 11 <add>isHidden: true <ide> videoId: XzosGWLafrY <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-csv-and-txt.english.md <ide> id: 5e9a093a74c4063ca6f7c162 <ide> title: Reading Data CSV and TXT <ide> challengeType: 11 <add>isHidden: true <ide> videoId: ViGEv0zOzUk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-from-databases.english.md <ide> id: 5e9a093a74c4063ca6f7c163 <ide> title: Reading Data from Databases <ide> challengeType: 11 <add>isHidden: true <ide> videoId: MtgXS1MofRw <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-course/reading-data-introduction.english.md <ide> id: 5e9a093a74c4063ca6f7c161 <ide> title: Reading Data Introduction <ide> challengeType: 11 <add>isHidden: true <ide> videoId: cDnt02BcHng <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/accessing-and-changing-elements,-rows,-columns.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed4 <ide> title: Accessing and Changing Elements, Rows, Columns <ide> challengeType: 11 <add>isHidden: true <ide> videoId: v-7Y7koJ_N0 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/basics-of-numpy.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed3 <ide> title: Basics of Numpy <ide> challengeType: 11 <add>isHidden: true <ide> videoId: f9QrZrKQMLI <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/copying-arrays-warning.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed7 <ide> title: Copying Arrays Warning <ide> challengeType: 11 <add>isHidden: true <ide> videoId: iIoQ0_L0GvA <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/initialize-array-problem.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed6 <ide> title: Initialize Array Problem <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 0jGfH8BPfOk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/initializing-different-arrays.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed5 <ide> title: Initializing Different Arrays <ide> challengeType: 11 <add>isHidden: true <ide> videoId: CEykdsKT4U4 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/loading-data-and-advanced-indexing.english.md <ide> id: 5e9a0a8e09c5df3cc3600eda <ide> title: Loading Data and Advanced Indexing <ide> challengeType: 11 <add>isHidden: true <ide> videoId: tUdBZ7pF8Jg <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/mathematics.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed8 <ide> title: Mathematics <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 7txegvyhtVk <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/reorganizing-arrays.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed9 <ide> title: Reorganizing Arrays <ide> challengeType: 11 <add>isHidden: true <ide> videoId: VNWAQbEM-C8 <ide> --- <ide> <ide><path>curriculum/challenges/english/08-data-analysis-with-python/numpy/what-is-numpy.english.md <ide> id: 5e9a0a8e09c5df3cc3600ed2 <ide> title: What is NumPy <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 5Nwfs5Ej85Q <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/creating-a-tcp-client.english.md <ide> id: 5ea9997bbec2e9bc47e94db0 <ide> title: Creating a TCP Client <ide> challengeType: 11 <add>isHidden: true <ide> videoId: ugYfJNTawks <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-a-banner-grabber.english.md <ide> id: 5ea9997bbec2e9bc47e94db3 <ide> title: Developing a Banner Grabber <ide> challengeType: 11 <add>isHidden: true <ide> videoId: CeGW761BIsA <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-a-port-scanner.english.md <ide> id: 5ea9997bbec2e9bc47e94db4 <ide> title: Developing a Port Scanner <ide> challengeType: 11 <add>isHidden: true <ide> videoId: z_qkqZS7KZ4 <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-an-nmap-scanner-part-1.english.md <ide> id: 5ea9997bbec2e9bc47e94db1 <ide> title: Developing an Nmap Scanner part 1 <ide> challengeType: 11 <add>isHidden: true <ide> videoId: jYk9XaGoAnk <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/developing-and-nmap-scanner-part-2.english.md <ide> id: 5ea9997bbec2e9bc47e94db2 <ide> title: Developing and Nmap Scanner part 2 <ide> challengeType: 11 <add>isHidden: true <ide> videoId: a98PscnUsTg <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/introduction-and-setup.english.md <ide> id: 5ea9997bbec2e9bc47e94dae <ide> title: Introduction and Setup <ide> challengeType: 11 <add>isHidden: true <ide> videoId: XeQ7ZKtb998 <ide> --- <ide> <ide><path>curriculum/challenges/english/09-information-security/python-for-penetration-testing/understanding-sockets-and-creating-a-tcp-server.english.md <ide> id: 5ea9997bbec2e9bc47e94daf <ide> title: Understanding Sockets and Creating a TCP Server <ide> challengeType: 11 <add>isHidden: true <ide> videoId: F1QI9tNuDQg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/deep-learning-demystified.english.md <ide> id: 5e9a0e9ef99a403d019610cc <ide> title: Deep Learning Demystified <ide> challengeType: 11 <add>isHidden: true <ide> videoId: bejQ-W9BGJg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/how-convolutional-neural-networks-work.english.md <ide> id: 5e9a0e9ef99a403d019610cd <ide> title: How Convolutional Neural Networks work <ide> challengeType: 11 <add>isHidden: true <ide> videoId: Y5M7KH4A4n4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/how-deep-neural-networks-work.english.md <ide> id: 5e9a0e9ef99a403d019610ca <ide> title: How Deep Neural Networks Work <ide> challengeType: 11 <add>isHidden: true <ide> videoId: zvalnHWGtx4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/how-neural-networks-work/recurrent-neural-networks-rnn-and-long-short-term-memory-lstm.english.md <ide> id: 5e9a0e9ef99a403d019610cb <ide> title: Recurrent Neural Networks RNN and Long Short Term Memory LSTM <ide> challengeType: 11 <add>isHidden: true <ide> videoId: UVimlsy9eW0 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/conclusion.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da6 <ide> title: Conclusion <ide> challengeType: 11 <add>isHidden: true <ide> videoId: LMNub5frQi4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks-evaluating-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d99 <ide> title: 'Convolutional Neural Networks: Evaluating the Model' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: eCATNvwraXg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks-picking-a-pretrained-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9a <ide> title: 'Convolutional Neural Networks: Picking a Pretrained Model' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: h1XUt1AgIOI <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks-the-convolutional-layer.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d97 <ide> title: 'Convolutional Neural Networks: The Convolutional Layer' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: LrdmcQpTyLw <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/convolutional-neural-networks.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d96 <ide> title: Convolutional Neural Networks <ide> challengeType: 11 <add>isHidden: true <ide> videoId: _1kTP7uoU9E <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-building-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8e <ide> title: 'Core Learning Algorithms: Building the Model' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 5wHw8BTd2ZQ <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-classification.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8d <ide> title: 'Core Learning Algorithms: Classification' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: qFF7ZQNvK9E <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-clustering.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8f <ide> title: 'Core Learning Algorithms: Clustering' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 8sqIaHc9Cz4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-hidden-markov-models.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d90 <ide> title: 'Core Learning Algorithms: Hidden Markov Models' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: IZg24y4wEPY <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-the-training-process.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8c <ide> title: 'Core Learning Algorithms: The Training Process' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: _cEwvqVoBhI <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-training-and-testing-data.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8b <ide> title: 'Core Learning Algorithms: Training and Testing Data' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: wz9J1slsi7I <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-using-probabilities-to-make-predictions.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d91 <ide> title: 'Core Learning Algorithms: Using Probabilities to make Predictions' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: fYAYvLUawnc <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms-working-with-data.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d8a <ide> title: 'Core Learning Algorithms: Working with Data' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: u85IOSsJsPI <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/core-learning-algorithms.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d89 <ide> title: Core Learning Algorithms <ide> challengeType: 11 <add>isHidden: true <ide> videoId: u5lZURgcWnU <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/creating-a-convolutional-neural-network.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d98 <ide> title: Creating a Convolutional Neural Network <ide> challengeType: 11 <add>isHidden: true <ide> videoId: kfv0K8MtkIc <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/introduction-machine-learning-fundamentals.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d87 <ide> title: "Introduction: Machine Learning Fundamentals" <ide> challengeType: 11 <add>isHidden: true <ide> videoId: KwL1qTR5MT8 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/introduction-to-tensorflow.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d88 <ide> title: Introduction to TensorFlow <ide> challengeType: 11 <add>isHidden: true <ide> videoId: r9hRyGGjOgQ <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-building-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da1 <ide> title: 'Natural Language Processing With RNNs: Building the Model' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: 32WBFS7lfsw <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-create-a-play-generator.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da0 <ide> title: 'Natural Language Processing With RNNs: Create a Play Generator' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: j5xsxjq_Xk8 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-making-predictions.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9f <ide> title: 'Natural Language Processing With RNNs: Making Predictions' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: WO1hINnBj20 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-part-2.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9c <ide> title: 'Natural Language Processing With RNNs: Part 2' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: mUU9YXOFbZg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-recurring-neural-networks.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9d <ide> title: 'Natural Language Processing With RNNs: Recurring Neural Networks' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: bX5681NPOcA <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-sentimental-analysis.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9e <ide> title: 'Natural Language Processing With RNNs: Sentiment Analysis' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: lYeLtu8Nq7c <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns-training-the-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da2 <ide> title: 'Natural Language Processing With RNNs: Training the Model' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: hEUiK7j9UI8 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/natural-language-processing-with-rnns.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d9b <ide> title: Natural Language Processing With RNNs <ide> challengeType: 11 <add>isHidden: true <ide> videoId: ZyCaF5S-lKg <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-activation-functions.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d93 <ide> title: 'Neural Networks: Activation Functions' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: S45tqW6BqRs <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-creating-a-model.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d95 <ide> title: 'Neural Networks: Creating a Model' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: K8bz1bmOCTw <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-optimizers.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d94 <ide> title: 'Neural Networks: Optimizers' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: hdOtRPQe1o4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/neural-networks-with-tensorflow.english.md <ide> id: 5e8f2f13c4cdbe86b5c72d92 <ide> title: Neural Networks with TensorFlow <ide> challengeType: 11 <add>isHidden: true <ide> videoId: uisdfrNrZW4 <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/reinforcement-learning-with-q-learning-example.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da5 <ide> title: 'Reinforcement Learning With Q-Learning: Example' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: RBBSNta234s <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/reinforcement-learning-with-q-learning-part-2.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da4 <ide> title: 'Reinforcement Learning With Q-Learning: Part 2' <ide> challengeType: 11 <add>isHidden: true <ide> videoId: DX7hJuaUZ7o <ide> --- <ide> <ide><path>curriculum/challenges/english/11-machine-learning-with-python/tensorflow/reinforcement-learning-with-q-learning.english.md <ide> id: 5e8f2f13c4cdbe86b5c72da3 <ide> title: Reinforcement Learning With Q-Learning <ide> challengeType: 11 <add>isHidden: true <ide> videoId: Cf7DSU0gVb4 <ide> --- <ide>
136
Ruby
Ruby
remove 4 unroutable routes from actionmailbox
c9e48feef2e29f1a81250dabe0a7c52667886ea9
<ide><path>actionmailbox/config/routes.rb <ide> <ide> # TODO: Should these be mounted within the engine only? <ide> scope "rails/conductor/action_mailbox/", module: "rails/conductor/action_mailbox" do <del> resources :inbound_emails, as: :rails_conductor_inbound_emails <add> resources :inbound_emails, as: :rails_conductor_inbound_emails, only: %i[index new show create] <ide> get "inbound_emails/sources/new", to: "inbound_emails/sources#new", as: :new_rails_conductor_inbound_email_source <ide> post "inbound_emails/sources", to: "inbound_emails/sources#create", as: :rails_conductor_inbound_email_sources <ide> <ide><path>railties/test/commands/routes_test.rb <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> RUBY <ide> <ide> assert_equal <<~MESSAGE, run_routes_command <del> Prefix Verb URI Pattern Controller#Action <del> rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create <del> rails_relay_inbound_emails POST /rails/action_mailbox/relay/inbound_emails(.:format) action_mailbox/ingresses/relay/inbound_emails#create <del> rails_sendgrid_inbound_emails POST /rails/action_mailbox/sendgrid/inbound_emails(.:format) action_mailbox/ingresses/sendgrid/inbound_emails#create <del> rails_mandrill_inbound_health_check GET /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#health_check <del> rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create <del> rails_mailgun_inbound_emails POST /rails/action_mailbox/mailgun/inbound_emails/mime(.:format) action_mailbox/ingresses/mailgun/inbound_emails#create <del> rails_conductor_inbound_emails GET /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#index <del> POST /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#create <del> new_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/new(.:format) rails/conductor/action_mailbox/inbound_emails#new <del> edit_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id/edit(.:format) rails/conductor/action_mailbox/inbound_emails#edit <del> rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show <del> PATCH /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update <del> PUT /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update <del> DELETE /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#destroy <del>new_rails_conductor_inbound_email_source GET /rails/conductor/action_mailbox/inbound_emails/sources/new(.:format) rails/conductor/action_mailbox/inbound_emails/sources#new <del> rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create <del> rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create <del>rails_conductor_inbound_email_incinerate POST /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format) rails/conductor/action_mailbox/incinerates#create <del> rails_service_blob GET /rails/active_storage/blobs/redirect/:signed_id/*filename(.:format) active_storage/blobs/redirect#show <del> rails_service_blob_proxy GET /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format) active_storage/blobs/proxy#show <del> GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs/redirect#show <del> rails_blob_representation GET /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#show <del> rails_blob_representation_proxy GET /rails/active_storage/representations/proxy/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/proxy#show <del> GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#show <del> rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show <del> update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update <del> rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create <add> Prefix Verb URI Pattern Controller#Action <add> rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create <add> rails_relay_inbound_emails POST /rails/action_mailbox/relay/inbound_emails(.:format) action_mailbox/ingresses/relay/inbound_emails#create <add> rails_sendgrid_inbound_emails POST /rails/action_mailbox/sendgrid/inbound_emails(.:format) action_mailbox/ingresses/sendgrid/inbound_emails#create <add> rails_mandrill_inbound_health_check GET /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#health_check <add> rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create <add> rails_mailgun_inbound_emails POST /rails/action_mailbox/mailgun/inbound_emails/mime(.:format) action_mailbox/ingresses/mailgun/inbound_emails#create <add> rails_conductor_inbound_emails GET /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#index <add> POST /rails/conductor/action_mailbox/inbound_emails(.:format) rails/conductor/action_mailbox/inbound_emails#create <add> new_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/new(.:format) rails/conductor/action_mailbox/inbound_emails#new <add> rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show <add>new_rails_conductor_inbound_email_source GET /rails/conductor/action_mailbox/inbound_emails/sources/new(.:format) rails/conductor/action_mailbox/inbound_emails/sources#new <add> rails_conductor_inbound_email_sources POST /rails/conductor/action_mailbox/inbound_emails/sources(.:format) rails/conductor/action_mailbox/inbound_emails/sources#create <add> rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create <add>rails_conductor_inbound_email_incinerate POST /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format) rails/conductor/action_mailbox/incinerates#create <add> rails_service_blob GET /rails/active_storage/blobs/redirect/:signed_id/*filename(.:format) active_storage/blobs/redirect#show <add> rails_service_blob_proxy GET /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format) active_storage/blobs/proxy#show <add> GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs/redirect#show <add> rails_blob_representation GET /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#show <add> rails_blob_representation_proxy GET /rails/active_storage/representations/proxy/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/proxy#show <add> GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations/redirect#show <add> rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show <add> update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update <add> rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create <ide> MESSAGE <ide> end <ide> <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> URI | /rails/conductor/action_mailbox/inbound_emails/new(.:format) <ide> Controller#Action | rails/conductor/action_mailbox/inbound_emails#new <ide> --[ Route 11 ]------------- <del> Prefix | edit_rails_conductor_inbound_email <del> Verb | GET <del> URI | /rails/conductor/action_mailbox/inbound_emails/:id/edit(.:format) <del> Controller#Action | rails/conductor/action_mailbox/inbound_emails#edit <del> --[ Route 12 ]------------- <ide> Prefix | rails_conductor_inbound_email <ide> Verb | GET <ide> URI | /rails/conductor/action_mailbox/inbound_emails/:id(.:format) <ide> Controller#Action | rails/conductor/action_mailbox/inbound_emails#show <del> --[ Route 13 ]------------- <del> Prefix | <del> Verb | PATCH <del> URI | /rails/conductor/action_mailbox/inbound_emails/:id(.:format) <del> Controller#Action | rails/conductor/action_mailbox/inbound_emails#update <del> --[ Route 14 ]------------- <del> Prefix | <del> Verb | PUT <del> URI | /rails/conductor/action_mailbox/inbound_emails/:id(.:format) <del> Controller#Action | rails/conductor/action_mailbox/inbound_emails#update <del> --[ Route 15 ]------------- <del> Prefix | <del> Verb | DELETE <del> URI | /rails/conductor/action_mailbox/inbound_emails/:id(.:format) <del> Controller#Action | rails/conductor/action_mailbox/inbound_emails#destroy <del> --[ Route 16 ]------------- <add> --[ Route 12 ]------------- <ide> Prefix | new_rails_conductor_inbound_email_source <ide> Verb | GET <ide> URI | /rails/conductor/action_mailbox/inbound_emails/sources/new(.:format) <ide> Controller#Action | rails/conductor/action_mailbox/inbound_emails/sources#new <del> --[ Route 17 ]------------- <add> --[ Route 13 ]------------- <ide> Prefix | rails_conductor_inbound_email_sources <ide> Verb | POST <ide> URI | /rails/conductor/action_mailbox/inbound_emails/sources(.:format) <ide> Controller#Action | rails/conductor/action_mailbox/inbound_emails/sources#create <del> --[ Route 18 ]------------- <add> --[ Route 14 ]------------- <ide> Prefix | rails_conductor_inbound_email_reroute <ide> Verb | POST <ide> URI | /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) <ide> Controller#Action | rails/conductor/action_mailbox/reroutes#create <del> --[ Route 19 ]------------- <add> --[ Route 15 ]------------- <ide> Prefix | rails_conductor_inbound_email_incinerate <ide> Verb | POST <ide> URI | /rails/conductor/action_mailbox/:inbound_email_id/incinerate(.:format) <ide> Controller#Action | rails/conductor/action_mailbox/incinerates#create <del> --[ Route 20 ]------------- <add> --[ Route 16 ]------------- <ide> Prefix | rails_service_blob <ide> Verb | GET <ide> URI | /rails/active_storage/blobs/redirect/:signed_id/*filename(.:format) <ide> Controller#Action | active_storage/blobs/redirect#show <del> --[ Route 21 ]------------- <add> --[ Route 17 ]------------- <ide> Prefix | rails_service_blob_proxy <ide> Verb | GET <ide> URI | /rails/active_storage/blobs/proxy/:signed_id/*filename(.:format) <ide> Controller#Action | active_storage/blobs/proxy#show <del> --[ Route 22 ]------------- <add> --[ Route 18 ]------------- <ide> Prefix | <ide> Verb | GET <ide> URI | /rails/active_storage/blobs/:signed_id/*filename(.:format) <ide> Controller#Action | active_storage/blobs/redirect#show <del> --[ Route 23 ]------------- <add> --[ Route 19 ]------------- <ide> Prefix | rails_blob_representation <ide> Verb | GET <ide> URI | /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename(.:format) <ide> Controller#Action | active_storage/representations/redirect#show <del> --[ Route 24 ]------------- <add> --[ Route 20 ]------------- <ide> Prefix | rails_blob_representation_proxy <ide> Verb | GET <ide> URI | /rails/active_storage/representations/proxy/:signed_blob_id/:variation_key/*filename(.:format) <ide> Controller#Action | active_storage/representations/proxy#show <del> --[ Route 25 ]------------- <add> --[ Route 21 ]------------- <ide> Prefix | <ide> Verb | GET <ide> URI | /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) <ide> Controller#Action | active_storage/representations/redirect#show <del> --[ Route 26 ]------------- <add> --[ Route 22 ]------------- <ide> Prefix | rails_disk_service <ide> Verb | GET <ide> URI | /rails/active_storage/disk/:encoded_key/*filename(.:format) <ide> Controller#Action | active_storage/disk#show <del> --[ Route 27 ]------------- <add> --[ Route 23 ]------------- <ide> Prefix | update_rails_disk_service <ide> Verb | PUT <ide> URI | /rails/active_storage/disk/:encoded_token(.:format) <ide> Controller#Action | active_storage/disk#update <del> --[ Route 28 ]------------- <add> --[ Route 24 ]------------- <ide> Prefix | rails_direct_uploads <ide> Verb | POST <ide> URI | /rails/active_storage/direct_uploads(.:format)
2
PHP
PHP
fix additional tests
8dc9715494a36dbe58ff242d105c9fed495fcd4e
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> class ValidateUsersTable extends Table { <ide> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), <ide> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <ide> 'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <del> 'balance' => array('type' => 'float', 'null' => false, 'length' => '5,2'), <del> 'cost_decimal' => array('type' => 'decimal', 'null' => false, 'length' => '6,3'), <del> 'ratio' => array('type' => 'decimal', 'null' => false, 'length' => '10,6'), <del> 'population' => array('type' => 'decimal', 'null' => false, 'length' => '15,0'), <add> 'balance' => array('type' => 'float', 'null' => false, 'length' => 5, 'precision' => 2), <add> 'cost_decimal' => array('type' => 'decimal', 'null' => false, 'length' => 6, 'precision' => 3), <add> 'ratio' => array('type' => 'decimal', 'null' => false, 'length' => 10, 'precision' => 6), <add> 'population' => array('type' => 'decimal', 'null' => false, 'length' => 15, 'precision' => 0), <ide> 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), <ide> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null), <ide> '_constraints' => array('primary' => ['type' => 'primary', 'columns' => ['id']])
1
PHP
PHP
fix lint errors
87e41d14947dbb6a00d2e975c3371834d627f5e7
<ide><path>tests/TestCase/I18n/I18nTest.php <ide> public function tearDown() <ide> Plugin::unload(); <ide> Cache::clear(false, '_cake_core_'); <ide> } <del> <add> <ide> /** <ide> * Tests that the default locale is set correctly <ide> * <ide> * @return void <ide> */ <del> public function testDefaultLocale() { <add> public function testDefaultLocale() <add> { <ide> $newLocale = 'de_DE'; <ide> I18n::setLocale($newLocale); <ide> $this->assertEquals($newLocale, I18n::getLocale());
1
PHP
PHP
add a test for overlapping aliases
fd701cc4fa1f39226372644f12e834ee10774e83
<ide><path>tests/TestCase/ORM/TableRegistryTest.php <ide> public function testGetPluginWithFullNamespaceName() <ide> $this->assertTrue(TableRegistry::exists('Comments'), 'Class name should exist'); <ide> } <ide> <add> /** <add> * Test get() with same-alias models in different plugins <add> * <add> * @return void <add> */ <add> public function testGetMultiplePlugins() <add> { <add> Plugin::load('TestPlugin'); <add> Plugin::load('TestPluginTwo'); <add> <add> $app = TableRegistry::get('Comments'); <add> $plugin1 = TableRegistry::get('TestPlugin.Comments'); <add> $plugin2 = TableRegistry::get('TestPluginTwo.Comments'); <add> <add> $this->assertInstanceOf('Cake\ORM\Table', $app, 'Should be an app table instance'); <add> $this->assertInstanceOf('TestPlugin\Model\Table\CommentsTable', $plugin1, 'Should be a plugin 1 table instance'); <add> $this->assertInstanceOf('TestPluginTwo\Model\Table\CommentsTable', $plugin2, 'Should be a plugin 2 table instance'); <add> <add> $plugin2 = TableRegistry::get('TestPluginTwo.Comments'); <add> $plugin1 = TableRegistry::get('TestPlugin.Comments'); <add> $app = TableRegistry::get('Comments'); <add> <add> $this->assertInstanceOf('Cake\ORM\Table', $app, 'Should still be an app table instance'); <add> $this->assertInstanceOf('TestPlugin\Model\Table\CommentsTable', $plugin1, 'Should still be a plugin 1 table instance'); <add> $this->assertInstanceOf('TestPluginTwo\Model\Table\CommentsTable', $plugin2, 'Should still be a plugin 2 table instance'); <add> } <add> <ide> /** <ide> * Tests that table options can be pre-configured for the factory method <ide> * <ide><path>tests/test_app/Plugin/TestPluginTwo/src/Model/Table/CommentsTable.php <add><?php <add>/** <add> * CakePHP : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakefoundation.org/projects/info/cakephp CakePHP Project <add> * @since 3.0.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace TestPluginTwo\Model\Table; <add> <add>use Cake\ORM\Table; <add> <add>/** <add> * Class CommentsTable <add> */ <add>class CommentsTable extends Table <add>{ <add> <add>}
2
Python
Python
update vocab init
d5155376fd7d913734507f0647ddd4d33c625bbe
<ide><path>spacy/cli/init_pipeline.py <ide> from wasabi import msg <ide> import typer <ide> from thinc.api import Config, fix_random_seed, set_gpu_allocator <add>import srsly <ide> <ide> from .. import util <del>from ..util import registry, resolve_dot_names <add>from ..util import registry, resolve_dot_names, OOV_RANK <ide> from ..schemas import ConfigSchemaTraining, ConfigSchemaPretrain <ide> from ..language import Language <add>from ..lookups import Lookups <ide> from ..errors import Errors <ide> from ._util import init_cli, Arg, Opt, parse_config_overrides, show_validation_error <ide> from ._util import import_code, get_sourced_components, load_from_paths <ide> <ide> <add>DEFAULT_OOV_PROB = -20 <add> <add> <ide> @init_cli.command( <ide> "nlp", context_settings={"allow_extra_args": True, "ignore_unknown_options": True}, <ide> ) <ide> def init_pipeline(config: Config, use_gpu: int = -1) -> Language: <ide> T = registry.resolve(config["training"], schema=ConfigSchemaTraining) <ide> dot_names = [T["train_corpus"], T["dev_corpus"], T["raw_text"]] <ide> train_corpus, dev_corpus, raw_text = resolve_dot_names(config, dot_names) <del> util.load_vocab_data_into_model(nlp, lookups=T["lookups"]) <add> # TODO: move lookups to [initialize], add vocab data <add> init_vocab(nlp, lookups=T["lookups"]) <ide> msg.good("Created vocabulary") <ide> if T["vectors"] is not None: <ide> add_vectors(nlp, T["vectors"]) <ide> def init_pipeline(config: Config, use_gpu: int = -1) -> Language: <ide> return nlp <ide> <ide> <add>def init_vocab( <add> nlp: Language, <add> *, <add> vocab_data: Optional[Path] = None, <add> lookups: Optional[Lookups] = None, <add>) -> Language: <add> if lookups: <add> nlp.vocab.lookups = lookups <add> msg.good(f"Added vocab lookups: {', '.join(lookups.tables)}") <add> data_path = util.ensure_path(vocab_data) <add> if data_path is not None: <add> lex_attrs = srsly.read_jsonl(data_path) <add> for lexeme in nlp.vocab: <add> lexeme.rank = OOV_RANK <add> for attrs in lex_attrs: <add> if "settings" in attrs: <add> continue <add> lexeme = nlp.vocab[attrs["orth"]] <add> lexeme.set_attrs(**attrs) <add> if len(nlp.vocab): <add> oov_prob = min(lex.prob for lex in nlp.vocab) - 1 <add> else: <add> oov_prob = DEFAULT_OOV_PROB <add> nlp.vocab.cfg.update({"oov_prob": oov_prob}) <add> msg.good(f"Added {len(nlp.vocab)} lexical entries to the vocab") <add> <add> <ide> def add_tok2vec_weights(config: Config, nlp: Language) -> None: <ide> # Load pretrained tok2vec weights - cf. CLI command 'pretrain' <ide> weights_data = load_from_paths(config) <ide> def add_vectors(nlp: Language, vectors: str) -> None: <ide> title=title, desc=desc, hint_fill=False, show_config=False <ide> ): <ide> util.load_vectors_into_model(nlp, vectors) <add> msg(f"Added {len(nlp.vocab.vectors)} vectors from {vectors}") <ide> <ide> <ide> def verify_config(nlp: Language) -> None: <ide><path>spacy/training/initialize.py <del>from pathlib import Path <del>from typing import Dict <del>from ._util import app, init_cli, Arg, Opt <del>from ..vectors import Vectors <del>from ..errors import Errors, Warnings <del>from ..language import Language <del>from ..util import ensure_path, get_lang_class, load_model, OOV_RANK <del> <del>try: <del> import ftfy <del>except ImportError: <del> ftfy = None <del> <del> <del>def must_initialize(init_path: Path, config_path: Path, overrides: Dict) -> bool: <del> config = util.load_config(config_path, overrides=overrides) <del> if not init_path.exists(): <del> return True <del> elif not (init_path / "config.cfg").exists(): <del> return True <del> else: <del> init_cfg = util.load_config(init_path / "config.cfg", interpolate=True) <del> if config.to_str() != init_cfg.to_str(): <del> return True <del> else: <del> return False <del> <del> <del>def init_pipeline(config: Config, use_gpu: int=-1): <del> raw_config = config <del> config = raw_config.interpolate() <del> if config["training"]["seed"] is not None: <del> fix_random_seed(config["training"]["seed"]) <del> allocator = config["training"]["gpu_allocator"] <del> if use_gpu >= 0 and allocator: <del> set_gpu_allocator(allocator) <del> # Use original config here before it's resolved to functions <del> sourced_components = get_sourced_components(config) <del> with show_validation_error(config_path): <del> nlp = util.load_model_from_config(raw_config) <del> # Resolve all training-relevant sections using the filled nlp config <del> T = registry.resolve( <del> config["training"], <del> schema=TrainingSchema, <del> validate=validate, <del> ) <del> # TODO: It might not be 'corpora' <del> corpora = registry.resolve(config["corpora"], validate=True) <del> raw_text, tag_map, morph_rules, weights_data = load_from_paths(config) <del> util.load_vocab_data_into_model(nlp, lookups=T["lookups"]) <del> if T["vectors"] is not None: <del> add_vectors(nlp, T["vectors"]) <del> score_weights = T["score_weights"] <del> optimizer = T["optimizer"] <del> train_corpus = dot_to_object({"corpora": corpora}, T["train_corpus"]) <del> dev_corpus = dot_to_object({"corpora": corpora}, T["dev_corpus"]) <del> batcher = T["batcher"] <del> train_logger = T["logger"] <del> before_to_disk = create_before_to_disk_callback(T["before_to_disk"]) <del> # Components that shouldn't be updated during training <del> frozen_components = T["frozen_components"] <del> # Sourced components that require resume_training <del> resume_components = [p for p in sourced_components if p not in frozen_components] <del> msg.info(f"Pipeline: {nlp.pipe_names}") <del> if resume_components: <del> with nlp.select_pipes(enable=resume_components): <del> msg.info(f"Resuming training for: {resume_components}") <del> nlp.resume_training(sgd=optimizer) <del> with nlp.select_pipes(disable=[*frozen_components, *resume_components]): <del> nlp.begin_training(lambda: train_corpus(nlp), sgd=optimizer) <del> # Verify the config after calling 'begin_training' to ensure labels <del> # are properly initialized <del> verify_config(nlp) <del> <del> if tag_map: <del> # Replace tag map with provided mapping <del> nlp.vocab.morphology.load_tag_map(tag_map) <del> if morph_rules: <del> # Load morph rules <del> nlp.vocab.morphology.load_morph_exceptions(morph_rules) <del> <del> # Load pretrained tok2vec weights - cf. CLI command 'pretrain' <del> if weights_data is not None: <del> tok2vec_component = C["pretraining"]["component"] <del> if tok2vec_component is None: <del> msg.fail( <del> f"To use pretrained tok2vec weights, [pretraining.component] " <del> f"needs to specify the component that should load them.", <del> exits=1, <del> ) <del> layer = nlp.get_pipe(tok2vec_component).model <del> tok2vec_layer = C["pretraining"]["layer"] <del> if tok2vec_layer: <del> layer = layer.get_ref(tok2vec_layer) <del> layer.from_bytes(weights_data) <del> msg.info(f"Loaded pretrained weights into component '{tok2vec_component}'") <del> return nlp <del> <del> <del>def init_vocab( <del> lang: str, <del> output_dir: Path, <del> freqs_loc: Optional[Path] = None, <del> clusters_loc: Optional[Path] = None, <del> jsonl_loc: Optional[Path] = None, <del> vectors_loc: Optional[Path] = None, <del> prune_vectors: int = -1, <del> truncate_vectors: int = 0, <del> vectors_name: Optional[str] = None, <del> model_name: Optional[str] = None, <del> base_model: Optional[str] = None, <del> silent: bool = True, <del>) -> Language: <del> msg = Printer(no_print=silent, pretty=not silent) <del> if jsonl_loc is not None: <del> if freqs_loc is not None or clusters_loc is not None: <del> settings = ["-j"] <del> if freqs_loc: <del> settings.append("-f") <del> if clusters_loc: <del> settings.append("-c") <del> msg.warn( <del> "Incompatible arguments", <del> "The -f and -c arguments are deprecated, and not compatible " <del> "with the -j argument, which should specify the same " <del> "information. Either merge the frequencies and clusters data " <del> "into the JSONL-formatted file (recommended), or use only the " <del> "-f and -c files, without the other lexical attributes.", <del> ) <del> jsonl_loc = ensure_path(jsonl_loc) <del> lex_attrs = srsly.read_jsonl(jsonl_loc) <del> else: <del> clusters_loc = ensure_path(clusters_loc) <del> freqs_loc = ensure_path(freqs_loc) <del> if freqs_loc is not None and not freqs_loc.exists(): <del> msg.fail("Can't find words frequencies file", freqs_loc, exits=1) <del> lex_attrs = read_attrs_from_deprecated(msg, freqs_loc, clusters_loc) <del> <del> with msg.loading("Creating blank pipeline..."): <del> nlp = create_model(lang, lex_attrs, name=model_name, base_model=base_model) <del> <del> msg.good("Successfully created blank pipeline") <del> if vectors_loc is not None: <del> add_vectors( <del> msg, nlp, vectors_loc, truncate_vectors, prune_vectors, vectors_name <del> ) <del> vec_added = len(nlp.vocab.vectors) <del> lex_added = len(nlp.vocab) <del> msg.good( <del> "Sucessfully compiled vocab", f"{lex_added} entries, {vec_added} vectors", <del> ) <del> if not output_dir.exists(): <del> output_dir.mkdir() <del> nlp.to_disk(output_dir) <del> return nlp <del> <del> <del>def open_file(loc: Union[str, Path]) -> IO: <del> """Handle .gz, .tar.gz or unzipped files""" <del> loc = ensure_path(loc) <del> if tarfile.is_tarfile(str(loc)): <del> return tarfile.open(str(loc), "r:gz") <del> elif loc.parts[-1].endswith("gz"): <del> return (line.decode("utf8") for line in gzip.open(str(loc), "r")) <del> elif loc.parts[-1].endswith("zip"): <del> zip_file = zipfile.ZipFile(str(loc)) <del> names = zip_file.namelist() <del> file_ = zip_file.open(names[0]) <del> return (line.decode("utf8") for line in file_) <del> else: <del> return loc.open("r", encoding="utf8") <del> <del> <del>def read_attrs_from_deprecated( <del> msg: Printer, freqs_loc: Optional[Path], clusters_loc: Optional[Path] <del>) -> List[Dict[str, Any]]: <del> if freqs_loc is not None: <del> with msg.loading("Counting frequencies..."): <del> probs, _ = read_freqs(freqs_loc) <del> msg.good("Counted frequencies") <del> else: <del> probs, _ = ({}, DEFAULT_OOV_PROB) # noqa: F841 <del> if clusters_loc: <del> with msg.loading("Reading clusters..."): <del> clusters = read_clusters(clusters_loc) <del> msg.good("Read clusters") <del> else: <del> clusters = {} <del> lex_attrs = [] <del> sorted_probs = sorted(probs.items(), key=lambda item: item[1], reverse=True) <del> if len(sorted_probs): <del> for i, (word, prob) in tqdm(enumerate(sorted_probs)): <del> attrs = {"orth": word, "id": i, "prob": prob} <del> # Decode as a little-endian string, so that we can do & 15 to get <del> # the first 4 bits. See _parse_features.pyx <del> if word in clusters: <del> attrs["cluster"] = int(clusters[word][::-1], 2) <del> else: <del> attrs["cluster"] = 0 <del> lex_attrs.append(attrs) <del> return lex_attrs <del> <del> <del>def create_model( <del> lang: str, <del> lex_attrs: List[Dict[str, Any]], <del> name: Optional[str] = None, <del> base_model: Optional[Union[str, Path]] = None, <del>) -> Language: <del> if base_model: <del> nlp = load_model(base_model) <del> # keep the tokenizer but remove any existing pipeline components due to <del> # potentially conflicting vectors <del> for pipe in nlp.pipe_names: <del> nlp.remove_pipe(pipe) <del> else: <del> lang_class = get_lang_class(lang) <del> nlp = lang_class() <del> for lexeme in nlp.vocab: <del> lexeme.rank = OOV_RANK <del> for attrs in lex_attrs: <del> if "settings" in attrs: <del> continue <del> lexeme = nlp.vocab[attrs["orth"]] <del> lexeme.set_attrs(**attrs) <del> if len(nlp.vocab): <del> oov_prob = min(lex.prob for lex in nlp.vocab) - 1 <del> else: <del> oov_prob = DEFAULT_OOV_PROB <del> nlp.vocab.cfg.update({"oov_prob": oov_prob}) <del> if name: <del> nlp.meta["name"] = name <del> return nlp <del> <del> <del>def add_vectors( <del> msg: Printer, <del> nlp: Language, <del> vectors_loc: Optional[Path], <del> truncate_vectors: int, <del> prune_vectors: int, <del> name: Optional[str] = None, <del>) -> None: <del> vectors_loc = ensure_path(vectors_loc) <del> if vectors_loc and vectors_loc.parts[-1].endswith(".npz"): <del> nlp.vocab.vectors = Vectors(data=numpy.load(vectors_loc.open("rb"))) <del> for lex in nlp.vocab: <del> if lex.rank and lex.rank != OOV_RANK: <del> nlp.vocab.vectors.add(lex.orth, row=lex.rank) <del> else: <del> if vectors_loc: <del> with msg.loading(f"Reading vectors from {vectors_loc}"): <del> vectors_data, vector_keys = read_vectors( <del> msg, vectors_loc, truncate_vectors <del> ) <del> msg.good(f"Loaded vectors from {vectors_loc}") <del> else: <del> vectors_data, vector_keys = (None, None) <del> if vector_keys is not None: <del> for word in vector_keys: <del> if word not in nlp.vocab: <del> nlp.vocab[word] <del> if vectors_data is not None: <del> nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys) <del> if name is None: <del> # TODO: Is this correct? Does this matter? <del> nlp.vocab.vectors.name = f"{nlp.meta['lang']}_{nlp.meta['name']}.vectors" <del> else: <del> nlp.vocab.vectors.name = name <del> nlp.meta["vectors"]["name"] = nlp.vocab.vectors.name <del> if prune_vectors >= 1: <del> nlp.vocab.prune_vectors(prune_vectors) <del> <del> <del>def read_vectors(msg: Printer, vectors_loc: Path, truncate_vectors: int): <del> f = open_file(vectors_loc) <del> f = ensure_shape(f) <del> shape = tuple(int(size) for size in next(f).split()) <del> if truncate_vectors >= 1: <del> shape = (truncate_vectors, shape[1]) <del> vectors_data = numpy.zeros(shape=shape, dtype="f") <del> vectors_keys = [] <del> for i, line in enumerate(tqdm(f)): <del> line = line.rstrip() <del> pieces = line.rsplit(" ", vectors_data.shape[1]) <del> word = pieces.pop(0) <del> if len(pieces) != vectors_data.shape[1]: <del> msg.fail(Errors.E094.format(line_num=i, loc=vectors_loc), exits=1) <del> vectors_data[i] = numpy.asarray(pieces, dtype="f") <del> vectors_keys.append(word) <del> if i == truncate_vectors - 1: <del> break <del> return vectors_data, vectors_keys <del> <del> <del>def ensure_shape(lines): <del> """Ensure that the first line of the data is the vectors shape. <del> <del> If it's not, we read in the data and output the shape as the first result, <del> so that the reader doesn't have to deal with the problem. <del> """ <del> first_line = next(lines) <del> try: <del> shape = tuple(int(size) for size in first_line.split()) <del> except ValueError: <del> shape = None <del> if shape is not None: <del> # All good, give the data <del> yield first_line <del> yield from lines <del> else: <del> # Figure out the shape, make it the first value, and then give the <del> # rest of the data. <del> width = len(first_line.split()) - 1 <del> captured = [first_line] + list(lines) <del> length = len(captured) <del> yield f"{length} {width}" <del> yield from captured <del> <del> <del>def read_freqs( <del> freqs_loc: Path, max_length: int = 100, min_doc_freq: int = 5, min_freq: int = 50 <del>): <del> counts = PreshCounter() <del> total = 0 <del> with freqs_loc.open() as f: <del> for i, line in enumerate(f): <del> freq, doc_freq, key = line.rstrip().split("\t", 2) <del> freq = int(freq) <del> counts.inc(i + 1, freq) <del> total += freq <del> counts.smooth() <del> log_total = math.log(total) <del> probs = {} <del> with freqs_loc.open() as f: <del> for line in tqdm(f): <del> freq, doc_freq, key = line.rstrip().split("\t", 2) <del> doc_freq = int(doc_freq) <del> freq = int(freq) <del> if doc_freq >= min_doc_freq and freq >= min_freq and len(key) < max_length: <del> try: <del> word = literal_eval(key) <del> except SyntaxError: <del> # Take odd strings literally. <del> word = literal_eval(f"'{key}'") <del> smooth_count = counts.smoother(int(freq)) <del> probs[word] = math.log(smooth_count) - log_total <del> oov_prob = math.log(counts.smoother(0)) - log_total <del> return probs, oov_prob <del> <del> <del>def read_clusters(clusters_loc: Path) -> dict: <del> clusters = {} <del> if ftfy is None: <del> warnings.warn(Warnings.W004) <del> with clusters_loc.open() as f: <del> for line in tqdm(f): <del> try: <del> cluster, word, freq = line.split() <del> if ftfy is not None: <del> word = ftfy.fix_text(word) <del> except ValueError: <del> continue <del> # If the clusterer has only seen the word a few times, its <del> # cluster is unreliable. <del> if int(freq) >= 3: <del> clusters[word] = cluster <del> else: <del> clusters[word] = "0" <del> # Expand clusters with re-casing <del> for word, cluster in list(clusters.items()): <del> if word.lower() not in clusters: <del> clusters[word.lower()] = cluster <del> if word.title() not in clusters: <del> clusters[word.title()] = cluster <del> if word.upper() not in clusters: <del> clusters[word.upper()] = cluster <del> return clusters <ide><path>spacy/util.py <ide> def load_vectors_into_model( <ide> nlp.vocab.strings.add(vectors_nlp.vocab.strings[key]) <ide> <ide> <del>def load_vocab_data_into_model( <del> nlp: "Language", *, lookups: Optional["Lookups"] = None <del>) -> None: <del> """Load vocab data.""" <del> if lookups: <del> nlp.vocab.lookups = lookups <del> <del> <ide> def load_model( <ide> name: Union[str, Path], <ide> *, <ide> def resolve_training_config( <ide> return registry.resolve(config, validate=validate) <ide> <ide> <del>def resolve_dot_names(config: Config, dot_names: List[Optional[str]]) -> List[Optional[Callable]]: <del> """Resolve one or more "dot notation" names, e.g. corpora.train. <add>def resolve_dot_names( <add> config: Config, dot_names: List[Optional[str]] <add>) -> List[Optional[Callable]]: <add> """Resolve one or more "dot notation" names, e.g. corpora.train. <ide> The paths could point anywhere into the config, so we don't know which <ide> top-level section we'll be looking within. <del> <add> <ide> We resolve the whole top-level section, although we could resolve less -- <ide> we could find the lowest part of the tree. <ide> """
3
Go
Go
use imagestore.children instead of whole the map
1350e8b7b8025d73056b800963c001fb9619a85c
<ide><path>daemon/daemon.go <ide> func (daemon *Daemon) GetRemappedUIDGID() (int, int) { <ide> return uid, gid <ide> } <ide> <del>// ImageGetCached returns the earliest created image that is a child <add>// ImageGetCached returns the most recent created image that is a child <ide> // of the image with imgID, that had the same config when it was <ide> // created. nil is returned if a child cannot be found. An error is <ide> // returned if the parent image cannot be found. <ide> func (daemon *Daemon) ImageGetCached(imgID image.ID, config *containertypes.Config) (*image.Image, error) { <del> // Retrieve all images <del> imgs := daemon.Map() <add> // Loop on the children of the given image and check the config <add> getMatch := func(siblings []image.ID) (*image.Image, error) { <add> var match *image.Image <add> for _, id := range siblings { <add> img, err := daemon.imageStore.Get(id) <add> if err != nil { <add> return nil, fmt.Errorf("unable to find image %q", id) <add> } <ide> <del> var siblings []image.ID <del> for id, img := range imgs { <del> if img.Parent == imgID { <del> siblings = append(siblings, id) <add> if runconfig.Compare(&img.ContainerConfig, config) { <add> // check for the most up to date match <add> if match == nil || match.Created.Before(img.Created) { <add> match = img <add> } <add> } <ide> } <add> return match, nil <ide> } <ide> <del> // Loop on the children of the given image and check the config <del> var match *image.Image <del> for _, id := range siblings { <del> img, ok := imgs[id] <del> if !ok { <del> return nil, fmt.Errorf("unable to find image %q", id) <del> } <del> if runconfig.Compare(&img.ContainerConfig, config) { <del> if match == nil || match.Created.Before(img.Created) { <del> match = img <add> // In this case, this is `FROM scratch`, which isn't an actual image. <add> if imgID == "" { <add> images := daemon.imageStore.Map() <add> var siblings []image.ID <add> for id, img := range images { <add> if img.Parent == imgID { <add> siblings = append(siblings, id) <ide> } <ide> } <add> return getMatch(siblings) <ide> } <del> return match, nil <add> <add> // find match from child images <add> siblings := daemon.imageStore.Children(imgID) <add> return getMatch(siblings) <ide> } <ide> <ide> // tempDir returns the default directory to use for temporary files.
1
Text
Text
fix typographical issues
6f4721b7335f7f849c04af8c1158067eaf4ddae3
<ide><path>doc/api/synopsis.md <ide> An example of a [web server][] written with Node.js which responds with <ide> <ide> Commands displayed in this document are shown starting with `$` or `>` <ide> to replicate how they would appear in a user's terminal. <del>Do not include the `$` and `>` character they are there to <add>Do not include the `$` and `>` characters. They are there to <ide> indicate the start of each command. <ide> <ide> There are many tutorials and examples that follow this <ide> the output of the previous command. <ide> Firstly, make sure to have downloaded and installed Node.js. <ide> See [this guide][] for further install information. <ide> <del>Now, create an empty project folder called `projects`, navigate into it: <del>Project folder can be named base on user's current project title but <add>Now, create an empty project folder called `projects`, then navigate into it. <add>The project folder can be named based on the user's current project title, but <ide> this example will use `projects` as the project folder. <ide> <ide> Linux and Mac: <ide> hyphens (`-`) or underscores (`_`) to separate <ide> multiple words in filenames. <ide> <ide> Open `hello-world.js` in any preferred text editor and <del>paste in the following content. <add>paste in the following content: <ide> <ide> ```js <ide> const http = require('http');
1
Text
Text
fix the sqlite gem name
700c6c65bcce17d4c61423ceaef031bcbe203337
<ide><path>guides/source/development_dependencies_install.md <ide> $ sudo yum install libxml2 libxml2-devel libxslt libxslt-devel <ide> <ide> If you have any problems with these libraries, you can install them manually by compiling the source code. Just follow the instructions at the [Red Hat/CentOS section of the Nokogiri tutorials](http://nokogiri.org/tutorials/installing_nokogiri.html#red_hat__centos) . <ide> <del>Also, SQLite3 and its development files for the `sqlite3-ruby` gem — in Ubuntu you're done with just <add>Also, SQLite3 and its development files for the `sqlite3` gem — in Ubuntu you're done with just <ide> <ide> ```bash <ide> $ sudo apt-get install sqlite3 libsqlite3-dev
1
Go
Go
use consts for http methods
90aa0901da11582da7639cc1ab202260183799e0
<ide><path>api/server/router/local.go <ide> package router // import "github.com/docker/docker/api/server/router" <ide> <ide> import ( <add> "net/http" <add> <ide> "github.com/docker/docker/api/server/httputils" <ide> ) <ide> <ide> func NewRoute(method, path string, handler httputils.APIFunc, opts ...RouteWrapp <ide> <ide> // NewGetRoute initializes a new route with the http method GET. <ide> func NewGetRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route { <del> return NewRoute("GET", path, handler, opts...) <add> return NewRoute(http.MethodGet, path, handler, opts...) <ide> } <ide> <ide> // NewPostRoute initializes a new route with the http method POST. <ide> func NewPostRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route { <del> return NewRoute("POST", path, handler, opts...) <add> return NewRoute(http.MethodPost, path, handler, opts...) <ide> } <ide> <ide> // NewPutRoute initializes a new route with the http method PUT. <ide> func NewPutRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route { <del> return NewRoute("PUT", path, handler, opts...) <add> return NewRoute(http.MethodPut, path, handler, opts...) <ide> } <ide> <ide> // NewDeleteRoute initializes a new route with the http method DELETE. <ide> func NewDeleteRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route { <del> return NewRoute("DELETE", path, handler, opts...) <add> return NewRoute(http.MethodDelete, path, handler, opts...) <ide> } <ide> <ide> // NewOptionsRoute initializes a new route with the http method OPTIONS. <ide> func NewOptionsRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route { <del> return NewRoute("OPTIONS", path, handler, opts...) <add> return NewRoute(http.MethodOptions, path, handler, opts...) <ide> } <ide> <ide> // NewHeadRoute initializes a new route with the http method HEAD. <ide> func NewHeadRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route { <del> return NewRoute("HEAD", path, handler, opts...) <add> return NewRoute(http.MethodHead, path, handler, opts...) <ide> }
1
Javascript
Javascript
handle null or undefined
04234bd95a18f1ea1dbda0d5b9e26249ce369dfb
<ide><path>src/panel-container-element.js <ide> class PanelContainerElement extends HTMLElement { <ide> if (visible) { this.hideAllPanelsExcept(panel) } <ide> })) <ide> <del> if (panel.autoFocus !== false) { <add> if (panel.autoFocus) { <ide> const focusOptions = { <ide> // focus-trap will attempt to give focus to the first tabbable element <ide> // on activation. If there aren't any tabbable elements,
1
Python
Python
add test for fix to issue
d7ffaea9855834c6d1a51a788ff0e6ffbe929e01
<ide><path>numpy/ma/tests/test_core.py <ide> def test_masked_where_shape_constraint(self): <ide> test = masked_equal(a, 1) <ide> assert_equal(test.mask, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]) <ide> <add> def test_masked_where_structured(self): <add> # test that masked_where on a structured array sets a structured <add> # mask (see issue #2972) <add> a = np.zeros(10, dtype=[("A", "<f2"), ("B", "<f4")]) <add> am = np.ma.masked_where(a["A"]<5, a) <add> assert_equal(am.mask.dtype.names, am.dtype.names) <add> assert_equal(am["A"], <add> np.ma.masked_array(np.zeros(10), np.ones(10))) <add> <ide> def test_masked_otherfunctions(self): <ide> assert_equal(masked_inside(list(range(5)), 1, 3), <ide> [0, 199, 199, 199, 4])
1
Python
Python
fix linting errors
5de0eb4ec44f5edc05b7ec31b6ecb67dd4b5acf6
<ide><path>libcloud/compute/drivers/dimensiondata.py <ide> def _to_firewall_address(self, element): <ide> port_list_id=port_list.get('id', None) <ide> if port_list is not None else None, <ide> address_list_id=address_list.get('id') <del> if address_list is not None else None <del> ) <add> if address_list is not None else None) <ide> else: <ide> return DimensionDataFirewallAddress( <ide> any_ip=False, <ide> def _to_firewall_address(self, element): <ide> port_list_id=port_list.get('id', None) <ide> if port_list is not None else None, <ide> address_list_id=address_list.get('id') <del> if address_list is not None else None <del> ) <add> if address_list is not None else None) <ide> <ide> def _to_ip_blocks(self, object): <ide> blocks = []
1
Text
Text
fix changelog [ci skip]
526e5e845a552abadf7e718ed1f1c5e0bf7c8876
<ide><path>railties/CHANGELOG.md <ide> * Remove deprecated `test:all` and `test:all:db` tasks. <ide> <add> *Rafael Mendonça França* <add> <ide> * Remove deprecated `Rails::Rack::LogTailer`. <ide> <ide> *Rafael Mendonça França*
1
Ruby
Ruby
pull construction of @clone into superclass
932091f9e0881ebbc26df08d98544298af1a6116
<ide><path>Library/Homebrew/download_strategy.rb <ide> class VCSDownloadStrategy < AbstractDownloadStrategy <ide> def initialize name, resource <ide> super <ide> @ref_type, @ref = destructure_spec_hash(resource.specs) <add> @clone = HOMEBREW_CACHE/cache_filename <ide> end <ide> <ide> def destructure_spec_hash(spec) <ide> spec.each { |o| return o } <ide> end <ide> <del> def cache_filename(tag) <add> def cache_filename(tag=cache_tag) <ide> if name.empty? || name == '__UNKNOWN__' <ide> "#{ERB::Util.url_encode(@url)}--#{tag}" <ide> else <ide> "#{name}--#{tag}" <ide> end <ide> end <ide> <add> def cache_tag <add> "__UNKNOWN__" <add> end <add> <ide> def cached_location <ide> @clone <ide> end <ide> def _fetch <ide> end <ide> <ide> class SubversionDownloadStrategy < VCSDownloadStrategy <del> def initialize name, resource <del> super <del> @@svn ||= 'svn' <add> @@svn ||= 'svn' <ide> <del> if ARGV.build_head? <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("svn-HEAD")}") <del> else <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("svn")}") <del> end <add> def cache_tag <add> ARGV.build_head? ? "svn-HEAD" : "svn" <ide> end <ide> <ide> def repo_valid? <ide> def fetch_repo target, url, revision=nil, ignore_externals=false <ide> end <ide> <ide> class GitDownloadStrategy < VCSDownloadStrategy <del> def initialize name, resource <del> super <del> @@git ||= 'git' <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("git")}") <del> end <add> @@git ||= 'git' <add> <add> def cache_tag; "git" end <ide> <ide> def fetch <ide> ohai "Cloning #@url" <ide> def checkout_submodules(dst) <ide> end <ide> <ide> class CVSDownloadStrategy < VCSDownloadStrategy <del> def initialize name, resource <del> super <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("cvs")}") <del> end <add> def cache_tag; "cvs" end <ide> <ide> def fetch <ide> ohai "Checking out #{@url}" <ide> def split_url(in_url) <ide> end <ide> <ide> class MercurialDownloadStrategy < VCSDownloadStrategy <del> def initialize name, resource <del> super <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("hg")}") <del> end <add> def cache_tag; "hg" end <ide> <ide> def hgpath <ide> # #{HOMEBREW_PREFIX}/share/python/hg is deprecated, but we levae it in for a while <ide> def stage <ide> end <ide> <ide> class BazaarDownloadStrategy < VCSDownloadStrategy <del> def initialize name, resource <del> super <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("bzr")}") <del> end <add> def cache_tag; "bzr" end <ide> <ide> def bzrpath <ide> @path ||= %W[ <ide> def stage <ide> end <ide> <ide> class FossilDownloadStrategy < VCSDownloadStrategy <del> def initialize name, resource <del> super <del> @clone = Pathname.new("#{HOMEBREW_CACHE}/#{cache_filename("fossil")}") <del> end <add> def cache_tag; "fossil" end <ide> <ide> def fossilpath <ide> @path ||= %W[
1
Javascript
Javascript
add monitor module for logging instrumentation
eee04b19e1866fdf5fb40298dbbfe7804b691d26
<ide><path>src/browser/dom/DOMPropertyOperations.js <ide> var DOMProperty = require('DOMProperty'); <ide> <ide> var escapeTextForBrowser = require('escapeTextForBrowser'); <ide> var memoizeStringOnly = require('memoizeStringOnly'); <add>var warning = require('warning'); <ide> <ide> function shouldIgnoreValue(name, value) { <ide> return value == null || <ide> if (__DEV__) { <ide> <ide> // For now, only warn when we have a suggested correction. This prevents <ide> // logging too much when using transferPropsTo. <del> if (standardName != null) { <del> console.warn( <del> 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?' <del> ); <del> } <add> warning( <add> standardName == null, <add> 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?' <add> ); <ide> <ide> }; <ide> } <ide><path>src/browser/dom/components/LinkedValueUtils.js <ide> var ReactPropTypes = require('ReactPropTypes'); <ide> <ide> var invariant = require('invariant'); <add>var warning = require('warning'); <ide> <ide> var hasReadOnlyValue = { <ide> 'button': true, <ide> var LinkedValueUtils = { <ide> propTypes: { <ide> value: function(props, propName, componentName) { <ide> if (__DEV__) { <del> if (props[propName] && <del> !hasReadOnlyValue[props.type] && <del> !props.onChange && <del> !props.readOnly && <del> !props.disabled) { <del> console.warn( <del> 'You provided a `value` prop to a form field without an ' + <del> '`onChange` handler. This will render a read-only field. If ' + <del> 'the field should be mutable use `defaultValue`. Otherwise, ' + <del> 'set either `onChange` or `readOnly`.' <del> ); <del> } <add> warning( <add> !props[propName] || <add> hasReadOnlyValue[props.type] || <add> props.onChange || <add> props.readOnly || <add> props.disabled, <add> 'You provided a `value` prop to a form field without an ' + <add> '`onChange` handler. This will render a read-only field. If ' + <add> 'the field should be mutable use `defaultValue`. Otherwise, ' + <add> 'set either `onChange` or `readOnly`.' <add> ); <ide> } <ide> }, <ide> checked: function(props, propName, componentName) { <ide> if (__DEV__) { <del> if (props[propName] && <del> !props.onChange && <del> !props.readOnly && <del> !props.disabled) { <del> console.warn( <del> 'You provided a `checked` prop to a form field without an ' + <del> '`onChange` handler. This will render a read-only field. If ' + <del> 'the field should be mutable use `defaultChecked`. Otherwise, ' + <del> 'set either `onChange` or `readOnly`.' <del> ); <del> } <add> warning( <add> !props[propName] || <add> props.onChange || <add> props.readOnly || <add> props.disabled, <add> 'You provided a `checked` prop to a form field without an ' + <add> '`onChange` handler. This will render a read-only field. If ' + <add> 'the field should be mutable use `defaultChecked`. Otherwise, ' + <add> 'set either `onChange` or `readOnly`.' <add> ); <ide> } <ide> }, <ide> onChange: ReactPropTypes.func <ide><path>src/browser/dom/components/ReactDOMOption.js <ide> var ReactBrowserComponentMixin = require('ReactBrowserComponentMixin'); <ide> var ReactCompositeComponent = require('ReactCompositeComponent'); <ide> var ReactDOM = require('ReactDOM'); <ide> <add>var warning = require('warning'); <add> <ide> // Store a reference to the <option> `ReactDOMComponent`. <ide> var option = ReactDOM.option; <ide> <ide> var ReactDOMOption = ReactCompositeComponent.createClass({ <ide> <ide> componentWillMount: function() { <ide> // TODO (yungsters): Remove support for `selected` in <option>. <del> if (this.props.selected != null) { <del> if (__DEV__) { <del> console.warn( <del> 'Use the `defaultValue` or `value` props on <select> instead of ' + <del> 'setting `selected` on <option>.' <del> ); <del> } <add> if (__DEV__) { <add> warning( <add> this.props.selected == null, <add> 'Use the `defaultValue` or `value` props on <select> instead of ' + <add> 'setting `selected` on <option>.' <add> ); <ide> } <ide> }, <ide> <ide><path>src/browser/dom/components/ReactDOMTextarea.js <ide> var ReactDOM = require('ReactDOM'); <ide> var invariant = require('invariant'); <ide> var merge = require('merge'); <ide> <add>var warning = require('warning'); <add> <ide> // Store a reference to the <textarea> `ReactDOMComponent`. <ide> var textarea = ReactDOM.textarea; <ide> <ide> var ReactDOMTextarea = ReactCompositeComponent.createClass({ <ide> var children = this.props.children; <ide> if (children != null) { <ide> if (__DEV__) { <del> console.warn( <add> warning( <add> false, <ide> 'Use the `defaultValue` or `value` props instead of setting ' + <ide> 'children on <textarea>.' <ide> ); <ide><path>src/core/ReactComponent.js <ide> var ReactUpdates = require('ReactUpdates'); <ide> var invariant = require('invariant'); <ide> var keyMirror = require('keyMirror'); <ide> var merge = require('merge'); <add>var monitorCodeUse = require('monitorCodeUse'); <ide> <ide> /** <ide> * Every React component is in one of these life cycles. <ide> function validateExplicitKey(component) { <ide> } <ide> <ide> message += ' See http://fb.me/react-warning-keys for more information.'; <add> monitorCodeUse('react_key_warning'); <ide> console.warn(message); <ide> } <ide> <ide> function validatePropertyKey(name) { <ide> } <ide> ownerHasPropertyWarning[currentName] = true; <ide> <add> monitorCodeUse('react_numeric_key_warning'); <ide> console.warn( <ide> 'Child objects should have non-numeric keys so ordering is preserved. ' + <ide> 'Check the render method of ' + currentName + '. ' + <ide><path>src/core/ReactCompositeComponent.js <ide> var invariant = require('invariant'); <ide> var keyMirror = require('keyMirror'); <ide> var merge = require('merge'); <ide> var mixInto = require('mixInto'); <add>var monitorCodeUse = require('monitorCodeUse'); <ide> var objMap = require('objMap'); <ide> var shouldUpdateReactComponent = require('shouldUpdateReactComponent'); <add>var warning = require('warning'); <ide> <ide> /** <ide> * Policies that describe methods in `ReactCompositeComponentInterface`. <ide> if (__DEV__) { <ide> var context = owner ? ' in ' + ownerName + '.' : ' at the top level.'; <ide> var staticMethodExample = '<' + name + ' />.type.' + key + '(...)'; <ide> <add> monitorCodeUse('react_descriptor_property_access', { component: name }); <ide> console.warn( <ide> 'Invalid access to component property "' + key + '" on ' + name + <ide> context + ' See http://fb.me/react-warning-descriptors .' + <ide> var ReactCompositeComponentMixin = { <ide> 'setState(...): takes an object of state variables to update.' <ide> ); <ide> if (__DEV__){ <del> if (partialState == null) { <del> console.warn( <del> 'setState(...): You passed an undefined or null state object; ' + <del> 'instead, use forceUpdate().' <del> ); <del> } <add> warning( <add> partialState != null, <add> 'setState(...): You passed an undefined or null state object; ' + <add> 'instead, use forceUpdate().' <add> ); <ide> } <ide> // Merge with `_pendingState` if it exists, otherwise with existing state. <ide> this.replaceState( <ide> var ReactCompositeComponentMixin = { <ide> // ignore the value of "this" that the user is trying to use, so <ide> // let's warn. <ide> if (newThis !== component && newThis !== null) { <add> monitorCodeUse('react_bind_warning', { component: componentName }); <ide> console.warn( <ide> 'bind(): React component methods may only be bound to the ' + <ide> 'component instance. See ' + componentName <ide> ); <ide> } else if (!args.length) { <add> monitorCodeUse('react_bind_warning', { component: componentName }); <ide> console.warn( <ide> 'bind(): You are binding a component method to the component. ' + <ide> 'React does this for you automatically in a high-performance ' + <ide> var ReactCompositeComponent = { <ide> <ide> if (__DEV__) { <ide> if (Constructor.prototype.componentShouldUpdate) { <add> monitorCodeUse( <add> 'react_component_should_update_warning', <add> { component: spec.displayName } <add> ); <ide> console.warn( <ide> (spec.displayName || 'A component') + ' has a method called ' + <ide> 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + <ide><path>src/event/EventPluginHub.js <ide> var accumulate = require('accumulate'); <ide> var forEachAccumulated = require('forEachAccumulated'); <ide> var invariant = require('invariant'); <ide> var isEventSupported = require('isEventSupported'); <add>var monitorCodeUse = require('monitorCodeUse'); <ide> <ide> /** <ide> * Internal store for event listeners <ide> var EventPluginHub = { <ide> // bubble. <ide> if (registrationName === 'onScroll' && <ide> !isEventSupported('scroll', true)) { <add> monitorCodeUse('react_no_scroll_event'); <ide> console.warn('This browser doesn\'t support the `onScroll` event'); <ide> } <ide> } <ide><path>src/utils/cloneWithProps.js <ide> var ReactPropTransferer = require('ReactPropTransferer'); <ide> <ide> var keyOf = require('keyOf'); <add>var warning = require('warning'); <ide> <ide> var CHILDREN_PROP = keyOf({children: null}); <ide> <ide> var CHILDREN_PROP = keyOf({children: null}); <ide> */ <ide> function cloneWithProps(child, props) { <ide> if (__DEV__) { <del> if (child.props.ref) { <del> console.warn( <del> 'You are calling cloneWithProps() on a child with a ref. This is ' + <del> 'dangerous because you\'re creating a new child which will not be ' + <del> 'added as a ref to its parent.' <del> ); <del> } <add> warning( <add> !child.props.ref, <add> 'You are calling cloneWithProps() on a child with a ref. This is ' + <add> 'dangerous because you\'re creating a new child which will not be ' + <add> 'added as a ref to its parent.' <add> ); <ide> } <ide> <ide> var newProps = ReactPropTransferer.mergeProps(props, child.props);
8
Ruby
Ruby
pass strings to factory, not symbols
ad320c96fd7675ada7daa77b4975417109c4abbc
<ide><path>Library/Homebrew/cmd/irb.rb <ide> <ide> class Symbol <ide> def f <del> Formula.factory(self) <add> Formula.factory(self.to_s) <ide> end <ide> end <ide> class String
1
Java
Java
avoid expensive assertions in httprange
da557e741519f6d110bccd6f10e1f808c40d661b
<ide><path>spring-web/src/main/java/org/springframework/http/HttpRange.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public ResourceRegion toResourceRegion(Resource resource) { <ide> return new ResourceRegion(resource, start, end - start + 1); <ide> } <ide> <del> private static long getLengthFor(Resource resource) { <del> long contentLength; <del> try { <del> contentLength = resource.contentLength(); <del> Assert.isTrue(contentLength > 0, "Resource content length should be > 0"); <del> } <del> catch (IOException ex) { <del> throw new IllegalArgumentException("Failed to obtain Resource content length", ex); <del> } <del> return contentLength; <del> } <del> <ide> /** <ide> * Return the start of the range given the total length of a representation. <ide> * @param length the length of the representation <ide> public static HttpRange createSuffixRange(long suffixLength) { <ide> * <p>This method can be used to parse an {@code Range} header. <ide> * @param ranges the string to parse <ide> * @return the list of ranges <del> * @throws IllegalArgumentException if the string cannot be parsed, or if <del> * the number of ranges is greater than 100. <add> * @throws IllegalArgumentException if the string cannot be parsed <add> * or if the number of ranges is greater than 100 <ide> */ <ide> public static List<HttpRange> parseRanges(@Nullable String ranges) { <ide> if (!StringUtils.hasLength(ranges)) { <ide> public static List<HttpRange> parseRanges(@Nullable String ranges) { <ide> ranges = ranges.substring(BYTE_RANGE_PREFIX.length()); <ide> <ide> String[] tokens = StringUtils.tokenizeToStringArray(ranges, ","); <del> Assert.isTrue(tokens.length <= MAX_RANGES, () -> "Too many ranges " + tokens.length); <add> if (tokens.length > MAX_RANGES) { <add> throw new IllegalArgumentException("Too many ranges: " + tokens.length); <add> } <ide> List<HttpRange> result = new ArrayList<>(tokens.length); <ide> for (String token : tokens) { <ide> result.add(parseRange(token)); <ide> private static HttpRange parseRange(String range) { <ide> if (dashIdx > 0) { <ide> long firstPos = Long.parseLong(range.substring(0, dashIdx)); <ide> if (dashIdx < range.length() - 1) { <del> Long lastPos = Long.parseLong(range.substring(dashIdx + 1, range.length())); <add> Long lastPos = Long.parseLong(range.substring(dashIdx + 1)); <ide> return new ByteRange(firstPos, lastPos); <ide> } <ide> else { <ide> public static List<ResourceRegion> toResourceRegions(List<HttpRange> ranges, Res <ide> if (ranges.size() > 1) { <ide> long length = getLengthFor(resource); <ide> long total = regions.stream().map(ResourceRegion::getCount).reduce(0L, (count, sum) -> sum + count); <del> Assert.isTrue(total < length, <del> () -> "The sum of all ranges (" + total + ") " + <del> "should be less than the resource length (" + length + ")"); <add> if (total >= length) { <add> throw new IllegalArgumentException("The sum of all ranges (" + total + <add> ") should be less than the resource length (" + length + ")"); <add> } <ide> } <ide> return regions; <ide> } <ide> <add> private static long getLengthFor(Resource resource) { <add> try { <add> long contentLength = resource.contentLength(); <add> Assert.isTrue(contentLength > 0, "Resource content length should be > 0"); <add> return contentLength; <add> } <add> catch (IOException ex) { <add> throw new IllegalArgumentException("Failed to obtain Resource content length", ex); <add> } <add> } <add> <ide> /** <ide> * Return a string representation of the given list of {@code HttpRange} objects. <ide> * <p>This method can be used to for an {@code Range} header. <ide><path>spring-web/src/main/java/org/springframework/http/codec/ResourceHttpMessageWriter.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> /** <ide> * {@code HttpMessageWriter} that can write a {@link Resource}. <ide> * <del> * <p>Also an implementation of {@code HttpMessageWriter} with support <del> * for writing one or more {@link ResourceRegion}'s based on the HTTP ranges <del> * specified in the request. <add> * <p>Also an implementation of {@code HttpMessageWriter} with support for writing one <add> * or more {@link ResourceRegion}'s based on the HTTP ranges specified in the request. <ide> * <ide> * <p>For reading to a Resource, use {@link ResourceDecoder} wrapped with <ide> * {@link DecoderHttpMessageReader}. <ide> private static Optional<Mono<Void>> zeroCopy(Resource resource, @Nullable Resour <ide> // Server-side only: single Resource or sub-regions... <ide> <ide> @Override <del> @SuppressWarnings("unchecked") <ide> public Mono<Void> write(Publisher<? extends Resource> inputStream, @Nullable ResolvableType actualType, <ide> ResolvableType elementType, @Nullable MediaType mediaType, ServerHttpRequest request, <ide> ServerHttpResponse response, Map<String, Object> hints) { <ide> public Mono<Void> write(Publisher<? extends Resource> inputStream, @Nullable Res <ide> } <ide> <ide> return Mono.from(inputStream).flatMap(resource -> { <del> <ide> if (ranges.isEmpty()) { <ide> return writeResource(resource, elementType, mediaType, response, hints); <ide> } <del> <ide> response.setStatusCode(HttpStatus.PARTIAL_CONTENT); <ide> List<ResourceRegion> regions = HttpRange.toResourceRegions(ranges, resource); <ide> MediaType resourceMediaType = getResourceMediaType(mediaType, resource, hints); <del> <ide> if (regions.size() == 1){ <ide> ResourceRegion region = regions.get(0); <ide> headers.setContentType(resourceMediaType);
2
Javascript
Javascript
fix tests that got broken by a spelling change
377b36b263ed2e82b6ce4d8fa9bd0bafbbf7a71a
<ide><path>packages/ember-metal/tests/main_test.js <ide> QUnit.test('SEMVER_REGEX properly validates and invalidates version numbers', fu <ide> QUnit.test('Ember.keys is deprecated', function() { <ide> expectDeprecation(function() { <ide> Ember.keys({}); <del> }, 'Ember.keys is deprecated in-favour of Object.keys'); <add> }, 'Ember.keys is deprecated in favor of Object.keys'); <ide> }); <ide> <ide> QUnit.test('Ember.keys is deprecated', function() { <ide> expectDeprecation(function() { <ide> Ember.create(null); <del> }, 'Ember.create is deprecated in-favour of Object.create'); <add> }, 'Ember.create is deprecated in favor of Object.create'); <ide> });
1
Java
Java
fix faulty tests
897557fd1b14a169e017f262b5336b84da23369e
<ide><path>spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java <ide> package org.springframework.orm.jpa.support; <ide> <ide> import java.util.concurrent.Callable; <add>import java.util.concurrent.CountDownLatch; <add>import java.util.concurrent.TimeUnit; <ide> import java.util.concurrent.atomic.AtomicInteger; <ide> <ide> import javax.persistence.EntityManager; <ide> public class OpenEntityManagerInViewTests { <ide> <ide> private ServletWebRequest webRequest; <ide> <add> private final TestTaskExecutor taskExecutor = new TestTaskExecutor(); <add> <ide> <ide> @BeforeEach <ide> public void setUp() { <ide> public void testOpenEntityManagerInViewInterceptorAsyncScenario() throws Excepti <ide> <ide> AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, this.response); <ide> WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.webRequest); <del> asyncManager.setTaskExecutor(new SyncTaskExecutor()); <add> asyncManager.setTaskExecutor(this.taskExecutor); <ide> asyncManager.setAsyncWebRequest(asyncWebRequest); <ide> asyncManager.startCallableProcessing((Callable<String>) () -> "anything"); <ide> <add> this.taskExecutor.await(); <add> assertThat(asyncManager.getConcurrentResult()).as("Concurrent result ").isEqualTo("anything"); <add> <ide> interceptor.afterConcurrentHandlingStarted(this.webRequest); <ide> assertThat(TransactionSynchronizationManager.hasResource(factory)).isFalse(); <ide> <ide> public void testOpenEntityManagerInViewInterceptorAsyncTimeoutScenario() throws <ide> <ide> AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, this.response); <ide> WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); <del> asyncManager.setTaskExecutor(new SyncTaskExecutor()); <add> asyncManager.setTaskExecutor(this.taskExecutor); <ide> asyncManager.setAsyncWebRequest(asyncWebRequest); <ide> asyncManager.startCallableProcessing((Callable<String>) () -> "anything"); <ide> <add> this.taskExecutor.await(); <add> assertThat(asyncManager.getConcurrentResult()).as("Concurrent result ").isEqualTo("anything"); <add> <ide> interceptor.afterConcurrentHandlingStarted(this.webRequest); <ide> assertThat(TransactionSynchronizationManager.hasResource(this.factory)).isFalse(); <ide> <ide> public void testOpenEntityManagerInViewInterceptorAsyncErrorScenario() throws Ex <ide> <ide> AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, this.response); <ide> WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); <del> asyncManager.setTaskExecutor(new SyncTaskExecutor()); <add> asyncManager.setTaskExecutor(this.taskExecutor); <ide> asyncManager.setAsyncWebRequest(asyncWebRequest); <ide> asyncManager.startCallableProcessing((Callable<String>) () -> "anything"); <ide> <add> this.taskExecutor.await(); <add> assertThat(asyncManager.getConcurrentResult()).as("Concurrent result ").isEqualTo("anything"); <add> <ide> interceptor.afterConcurrentHandlingStarted(this.webRequest); <ide> assertThat(TransactionSynchronizationManager.hasResource(this.factory)).isFalse(); <ide> <ide> public void testOpenEntityManagerInViewFilterAsyncScenario() throws Exception { <ide> given(asyncWebRequest.isAsyncStarted()).willReturn(true); <ide> <ide> WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); <del> asyncManager.setTaskExecutor(new SyncTaskExecutor()); <add> asyncManager.setTaskExecutor(this.taskExecutor); <ide> asyncManager.setAsyncWebRequest(asyncWebRequest); <ide> asyncManager.startCallableProcessing((Callable<String>) () -> "anything"); <ide> <add> this.taskExecutor.await(); <add> assertThat(asyncManager.getConcurrentResult()).as("Concurrent result ").isEqualTo("anything"); <add> <ide> assertThat(TransactionSynchronizationManager.hasResource(factory)).isFalse(); <ide> assertThat(TransactionSynchronizationManager.hasResource(factory2)).isFalse(); <ide> filter2.doFilter(this.request, this.response, filterChain3); <ide> public void testOpenEntityManagerInViewFilterAsyncScenario() throws Exception { <ide> <ide> <ide> @SuppressWarnings("serial") <del> private static class SyncTaskExecutor extends SimpleAsyncTaskExecutor { <add> private static class TestTaskExecutor extends SimpleAsyncTaskExecutor { <add> <add> private final CountDownLatch latch = new CountDownLatch(1); <ide> <ide> @Override <ide> public void execute(Runnable task, long startTimeout) { <del> task.run(); <add> Runnable decoratedTask = () -> { <add> try { <add> task.run(); <add> } <add> finally { <add> latch.countDown(); <add> } <add> }; <add> super.execute(decoratedTask, startTimeout); <add> } <add> <add> void await() throws InterruptedException { <add> this.latch.await(5, TimeUnit.SECONDS); <ide> } <ide> } <add> <ide> }
1
Python
Python
add __len__ method to ma.mvoid; closes #576
216d8cbc46f808eeff1942b3a607afca427125f2
<ide><path>numpy/ma/core.py <ide> def __iter__(self): <ide> else: <ide> yield d <ide> <add> def __len__(self): <add> return self._data.__len__() <add> <ide> def filled(self, fill_value=None): <ide> """ <ide> Return a copy with masked fields filled with a given value. <ide><path>numpy/ma/tests/test_core.py <ide> def test_setitem(self): <ide> a[0]['a'] = 2 <ide> assert_equal(a.mask, control) <ide> <add> def test_element_len(self): <add> # check that len() works for mvoid (Github issue #576) <add> for rec in self.data['base']: <add> assert_equal(len(rec), len(self.data['ddtype'])) <ide> <ide> #------------------------------------------------------------------------------ <ide>
2
Ruby
Ruby
add tests for fileutils call in system
7dfe09ccae5b1a8309326e5a5cb3172fbcd795d3
<ide><path>Library/Homebrew/rubocops/lines_cop.rb <ide> def audit_formula(_node, _class_node, _parent_class_node, body_node) <ide> problem "Dir([\"#{string_content(path)}\"]) is unnecessary; just use \"#{match[0]}\"" <ide> end <ide> <del> # <del> # fileUtils_methods= FileUtils.singleton_methods(false).map { |m| Regexp.escape(m) }.join "|" <del> # find_method_with_args(body_node, :system, /fileUtils_methods/) do |m| <del> # method = string_content(@offensive_node) <del> # problem "Use the `#{method}` Ruby method instead of `#{m.source}`" <del> # end <del> # <add> <add> fileUtils_methods= Regexp.new(FileUtils.singleton_methods(false).map { |m| Regexp.escape(m) }.join "|") <add> find_every_method_call_by_name(body_node, :system).each do |m| <add> param = parameters(m).first <add> next unless match = regex_match_group(param, fileUtils_methods) <add> problem "Use the `#{match}` Ruby method instead of `#{m.source}`" <add> end <add> <ide> # if find_method_def(@processed_source.ast) <ide> # problem "Define method #{method_name(@offensive_node)} in the class body, not at the top-level" <ide> # end <ide><path>Library/Homebrew/test/rubocops/lines_cop_spec.rb <ide> class Foo < Formula <ide> <ide> inspect_source(cop, source) <ide> <add> expected_offenses.zip(cop.offenses).each do |expected, actual| <add> expect_offense(expected, actual) <add> end <add> end <add> it "with system call to fileUtils Method" do <add> source = <<-EOS.undent <add> class Foo < Formula <add> desc "foo" <add> url 'http://example.com/foo-1.0.tgz' <add> system "mkdir", "foo" <add> end <add> EOS <add> <add> expected_offenses = [{ message: "Use the `mkdir` Ruby method instead of `system \"mkdir\", \"foo\"`", <add> severity: :convention, <add> line: 4, <add> column: 10, <add> source: source }] <add> <add> inspect_source(cop, source) <add> <ide> expected_offenses.zip(cop.offenses).each do |expected, actual| <ide> expect_offense(expected, actual) <ide> end
2
Python
Python
fix text preprocessing test
69932604f9b9ecd6bf63af60aaf4b2b854759d56
<ide><path>tests/keras/preprocessing/test_text.py <ide> def test_tokenizer(): <ide> texts = ['The cat sat on the mat.', <ide> 'The dog sat on the log.', <ide> 'Dogs and cats living together.'] <del> tokenizer = Tokenizer(nb_words=20) <add> tokenizer = Tokenizer(nb_words=10) <ide> tokenizer.fit_on_texts(texts) <ide> <ide> sequences = [] <ide> for seq in tokenizer.texts_to_sequences_generator(texts): <ide> sequences.append(seq) <del> assert np.max(np.max(sequences)) == 12 <add> assert np.max(np.max(sequences)) < 10 <ide> assert np.min(np.min(sequences)) == 1 <ide> <ide> tokenizer.fit_on_sequences(sequences)
1
Javascript
Javascript
transfer defaultwidth for files without the file
a0ef97fb6044c6028b7ca4b63a4cd884d9181933
<ide><path>fonts.js <ide> var Font = (function Font() { <ide> // name ArialBlack for example will be replaced by Helvetica. <ide> this.black = (name.search(/Black/g) != -1); <ide> <add> this.defaultWidth = properties.defaultWidth; <ide> this.loadedName = fontName.split('-')[0]; <ide> this.loading = false; <ide> return;
1
PHP
PHP
remove api shell
78284801c36fb3ada9a2ce4594f81200d9d8963a
<ide><path>Cake/Console/Command/ApiShell.php <del><?php <del>/** <del> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * For full copyright and license information, please see the LICENSE.txt <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <del> * @link http://cakephp.org CakePHP(tm) Project <del> * @since CakePHP(tm) v 1.2.0.5012 <del> * @license http://www.opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Console\Command; <del> <del>use Cake\Console\Shell; <del>use Cake\Core\App; <del>use Cake\Utility\Inflector; <del> <del>/** <del> * API shell to show method signatures of CakePHP core classes. <del> * <del> * Implementation of a Cake Shell to show CakePHP core method signatures. <del> * <del> */ <del>class ApiShell extends Shell { <del> <del>/** <del> * Map between short name for paths and real paths. <del> * <del> * @var array <del> */ <del> public $paths = array(); <del> <del>/** <del> * Override initialize of the Shell <del> * <del> * @return void <del> */ <del> public function initialize() { <del> $this->paths = array_merge($this->paths, array( <del> 'behavior' => CAKE . 'Model/Behavior/', <del> 'cache' => CAKE . 'Cache/', <del> 'controller' => CAKE . 'Controller/', <del> 'component' => CAKE . 'Controller/Component/', <del> 'helper' => CAKE . 'View/Helper/', <del> 'model' => CAKE . 'Model/', <del> 'view' => CAKE . 'View/', <del> 'core' => CAKE <del> )); <del> } <del> <del>/** <del> * Override main() to handle action <del> * <del> * @return void <del> */ <del> public function main() { <del> if (empty($this->args)) { <del> return $this->out($this->OptionParser->help()); <del> } <del> <del> $type = strtolower($this->args[0]); <del> <del> if (isset($this->paths[$type])) { <del> $path = $this->paths[$type]; <del> } else { <del> $path = $this->paths['core']; <del> } <del> <del> $count = count($this->args); <del> if ($count > 1) { <del> $file = Inflector::underscore($this->args[1]); <del> $class = Inflector::camelize($this->args[1]); <del> } elseif ($count) { <del> $file = $type; <del> $class = Inflector::camelize($type); <del> } <del> $path = $path . Inflector::camelize($type); <del> $file = $path . '.php'; <del> $classPath = str_replace(CORE_PATH, '', $path); <del> $className = str_replace(DS, '\\', $classPath); <del> <del> if (!class_exists($className)) { <del> return $this->error(__d('cake_console', '%s not found', $class)); <del> } <del> <del> $parsed = $this->_parseClass($className); <del> <del> if (!empty($parsed)) { <del> if (isset($this->params['method'])) { <del> if (!isset($parsed[$this->params['method']])) { <del> $this->err(__d('cake_console', '%s::%s() could not be found', $class, $this->params['method'])); <del> return $this->_stop(); <del> } <del> $method = $parsed[$this->params['method']]; <del> $this->out($class . '::' . $method['method'] . $method['parameters']); <del> $this->hr(); <del> $this->out($method['comment'], true); <del> } else { <del> $this->out(ucwords($class)); <del> $this->hr(); <del> $i = 0; <del> foreach ($parsed as $method) { <del> $list[] = ++$i . ". " . $method['method'] . $method['parameters']; <del> } <del> $this->out($list); <del> <del> $methods = array_keys($parsed); <del> while ($number = strtolower($this->in(__d('cake_console', 'Select a number to see the more information about a specific method. q to quit. l to list.'), null, 'q'))) { <del> if ($number === 'q') { <del> $this->out(__d('cake_console', 'Done')); <del> return $this->_stop(); <del> } <del> <del> if ($number === 'l') { <del> $this->out($list); <del> } <del> <del> if (isset($methods[--$number])) { <del> $method = $parsed[$methods[$number]]; <del> $this->hr(); <del> $this->out($class . '::' . $method['method'] . $method['parameters']); <del> $this->hr(); <del> $this->out($method['comment'], true); <del> } <del> } <del> } <del> } <del> } <del> <del>/** <del> * Get and configure the optionparser. <del> * <del> * @return ConsoleOptionParser <del> */ <del> public function getOptionParser() { <del> $parser = parent::getOptionParser(); <del> $parser->addArgument('type', array( <del> 'help' => __d('cake_console', 'Either a full path or type of class (model, behavior, controller, component, view, helper)') <del> ))->addArgument('className', array( <del> 'help' => __d('cake_console', 'A CakePHP core class name (e.g: Component, HtmlHelper).') <del> ))->addOption('method', array( <del> 'short' => 'm', <del> 'help' => __d('cake_console', 'The specific method you want help on.') <del> ))->description(__d('cake_console', 'Lookup doc block comments for classes in CakePHP.')); <del> return $parser; <del> } <del> <del>/** <del> * Show help for this shell. <del> * <del> * @return void <del> */ <del> public function help() { <del> $head = "Usage: cake api [<type>] <className> [-m <method>]\n"; <del> $head .= "-----------------------------------------------\n"; <del> $head .= "Parameters:\n\n"; <del> <del> $commands = array( <del> 'path' => "\t<type>\n" . <del> "\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n" . <del> "\t\tAvailable values:\n\n" . <del> "\t\tbehavior\tLook for class in CakePHP behavior path\n" . <del> "\t\tcache\tLook for class in CakePHP cache path\n" . <del> "\t\tcontroller\tLook for class in CakePHP controller path\n" . <del> "\t\tcomponent\tLook for class in CakePHP component path\n" . <del> "\t\thelper\tLook for class in CakePHP helper path\n" . <del> "\t\tmodel\tLook for class in CakePHP model path\n" . <del> "\t\tview\tLook for class in CakePHP view path\n", <del> 'className' => "\t<className>\n" . <del> "\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n" <del> ); <del> <del> $this->out($head); <del> if (!isset($this->args[1])) { <del> foreach ($commands as $cmd) { <del> $this->out("{$cmd}\n\n"); <del> } <del> } elseif (isset($commands[strtolower($this->args[1])])) { <del> $this->out($commands[strtolower($this->args[1])] . "\n\n"); <del> } else { <del> $this->out(__d('cake_console', 'Command %s not found', $this->args[1])); <del> } <del> } <del> <del>/** <del> * Parse a given class (located on given file) and get public methods and their <del> * signatures. <del> * <del> * @param string $class Class name <del> * @return array Methods and signatures indexed by method name <del> */ <del> protected function _parseClass($class) { <del> $parsed = array(); <del> <del> $reflection = new \ReflectionClass($class); <del> <del> foreach ($reflection->getMethods() as $method) { <del> if (!$method->isPublic()) { <del> continue; <del> } <del> if ($method->getDeclaringClass()->getName() != $class) { <del> continue; <del> } <del> $args = array(); <del> foreach ($method->getParameters() as $param) { <del> $paramString = '$' . $param->getName(); <del> if ($param->isDefaultValueAvailable()) { <del> $paramString .= ' = ' . str_replace("\n", '', var_export($param->getDefaultValue(), true)); <del> } <del> $args[] = $paramString; <del> } <del> $parsed[$method->getName()] = array( <del> 'comment' => str_replace(array('/*', '*/', '*'), '', $method->getDocComment()), <del> 'method' => $method->getName(), <del> 'parameters' => '(' . implode(', ', $args) . ')' <del> ); <del> } <del> ksort($parsed); <del> return $parsed; <del> } <del> <del>} <ide><path>Cake/Test/TestCase/Console/Command/ApiShellTest.php <del><?php <del>/** <del> * CakePHP : Rapid Development Framework (http://cakephp.org) <del> * Copyright 2005-2012, Cake Software Foundation, Inc. <del> * <del> * Licensed under The MIT License <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. <del> * @link http://cakephp.org CakePHP Project <del> * @since CakePHP v 1.2.0.7726 <del> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <del> */ <del>namespace Cake\Test\TestCase\Console\Command; <del> <del>use Cake\Console\Command\ApiShellShell; <del>use Cake\TestSuite\TestCase; <del> <del>/** <del> * ApiShellTest class <del> * <del> */ <del>class ApiShellTest extends TestCase { <del> <del>/** <del> * setUp method <del> * <del> * @return void <del> */ <del> public function setUp() { <del> parent::setUp(); <del> $out = $this->getMock('Cake\Console\ConsoleOutput', [], [], '', false); <del> $in = $this->getMock('Cake\Console\ConsoleInput', [], [], '', false); <del> <del> $this->Shell = $this->getMock( <del> 'Cake\Console\Command\ApiShell', <del> ['in', 'out', 'createFile', 'hr', '_stop'], <del> [$out, $out, $in] <del> ); <del> } <del> <del>/** <del> * Test that method names are detected properly including those with no arguments. <del> * <del> * @return void <del> */ <del> public function testMethodNameDetection() { <del> $this->Shell->expects($this->any()) <del> ->method('in')->will($this->returnValue('q')); <del> $this->Shell->expects($this->at(0)) <del> ->method('out')->with('Controller'); <del> <del> $this->Shell->expects($this->at(2)) <del> ->method('out') <del> ->with($this->logicalAnd( <del> $this->contains('8. beforeFilter($event)'), <del> $this->contains('21. render($view = NULL, $layout = NULL)') <del> )); <del> <del> $this->Shell->args = ['controller']; <del> $this->Shell->paths['controller'] = CAKE . 'Controller/'; <del> $this->Shell->main(); <del> } <del>} <ide><path>Cake/Test/TestCase/Console/Command/CommandListShellTest.php <ide> public function testMain() { <ide> $expected = "/\[.*TestPluginTwo.*\] example, welcome/"; <ide> $this->assertRegExp($expected, $output); <ide> <del> $expected = "/\[.*CORE.*\] acl, api, bake, command_list, completion, i18n, server, test, upgrade/"; <add> $expected = "/\[.*CORE.*\] acl, bake, command_list, completion, i18n, server, test, upgrade/"; <ide> $this->assertRegExp($expected, $output); <ide> <ide> $expected = "/\[.*app.*\] sample/"; <ide><path>Cake/Test/TestCase/Console/Command/CompletionShellTest.php <ide> public function testCommands() { <ide> $this->Shell->runCommand('commands', array()); <ide> $output = $this->Shell->stdout->output; <ide> <del> $expected = "TestPlugin.example TestPluginTwo.example TestPluginTwo.welcome acl api bake command_list completion i18n server test upgrade sample\n"; <add> $expected = "TestPlugin.example TestPluginTwo.example TestPluginTwo.welcome acl bake command_list completion i18n server test upgrade sample\n"; <ide> $this->assertEquals($expected, $output); <ide> } <ide>
4
Ruby
Ruby
remove obsolete method, add migrate_taps
171c3dd2d9cba6b7da8f1a97667a437ea1776c4b
<ide><path>Library/Homebrew/cmd/prune.rb <ide> def prune <ide> end <ide> end <ide> <del> repair_taps(false) unless ARGV.dry_run? <add> migrate_taps :force => true unless ARGV.dry_run? <ide> <ide> if ObserverPathnameExtension.total.zero? <ide> puts "Nothing pruned" if ARGV.verbose? <ide><path>Library/Homebrew/cmd/tap.rb <ide> def tap <ide> puts "#{user.basename}/#{repo.basename.sub("homebrew-", "")}" if (repo/".git").directory? <ide> end <ide> elsif ARGV.first == "--repair" <del> repair_taps <add> migrate_taps :force => true <ide> else <ide> opoo "Already tapped!" unless install_tap(*tap_args) <ide> end <ide> def install_tap user, repo <ide> <ide> files = [] <ide> tapd.find_formula { |file| files << file } <del> link_tap_formula(files) <ide> puts "Tapped #{files.length} formula#{plural(files.length, 'e')} (#{tapd.abv})" <ide> <ide> if private_tap?(repouser, repo) then puts <<-EOS.undent <ide> def install_tap user, repo <ide> true <ide> end <ide> <del> def link_tap_formula(paths, warn_about_conflicts=true) <del> ignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] <del> tapped = 0 <del> <del> paths.each do |path| <del> to = HOMEBREW_LIBRARY.join("Formula", path.basename) <del> <del> # Unexpected, but possible, lets proceed as if nothing happened <del> to.delete if to.symlink? && to.resolved_path == path <del> <del> begin <del> to.make_relative_symlink(path) <del> rescue SystemCallError <del> to = to.resolved_path if to.symlink? <del> opoo <<-EOS.undent if warn_about_conflicts <del> Could not create link for #{Tty.white}#{tap_ref(path)}#{Tty.reset}, as it <del> conflicts with #{Tty.white}#{tap_ref(to)}#{Tty.reset}. You will need to use the <del> fully-qualified name when referring this formula, e.g. <del> brew install #{tap_ref(path)} <del> EOS <del> else <del> ignores << path.basename.to_s <del> tapped += 1 <del> end <del> end <del> <del> HOMEBREW_LIBRARY.join("Formula/.gitignore").atomic_write(ignores.uniq.join("\n")) <del> <del> tapped <del> end <del> <del> def repair_taps(warn_about_conflicts=true) <del> count = 0 <del> # prune dead symlinks in Formula <del> Dir.glob("#{HOMEBREW_LIBRARY}/Formula/*.rb") do |fn| <del> if not File.exist? fn <del> File.delete fn <del> count += 1 <del> end <del> end <del> puts "Pruned #{count} dead formula#{plural(count, 'e')}" <del> <del> return unless HOMEBREW_REPOSITORY.join("Library/Taps").exist? <del> <del> count = 0 <del> # check symlinks are all set in each tap <del> each_tap do |user, repo| <del> files = [] <del> repo.find_formula { |file| files << file } <del> count += link_tap_formula(files, warn_about_conflicts) <del> end <del> <del> puts "Tapped #{count} formula#{plural(count, 'e')}" <add> # Migrate tapped formulae from symlink-based to directory-based structure. <add> def migrate_taps(options={}) <add> ignore = HOMEBREW_LIBRARY/"Formula/.gitignore" <add> return unless ignore.exist? || options.fetch(:force, false) <add> (HOMEBREW_LIBRARY/"Formula").children.select(&:symlink?).each(&:unlink) <add> ignore.unlink if ignore.exist? <ide> end <ide> <ide> private <ide> def private_tap?(user, repo) <ide> rescue GitHub::Error <ide> false <ide> end <del> <del> def tap_ref(path) <del> case path.to_s <del> when %r{^#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Formula}o <del> "Homebrew/homebrew/#{path.basename(".rb")}" <del> when HOMEBREW_TAP_PATH_REGEX <del> "#{$1}/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}" <del> end <del> end <ide> end <ide><path>Library/Homebrew/cmd/untap.rb <ide> def untap <ide> <ide> files = [] <ide> tapd.find_formula { |file| files << file } <del> unlink_tap_formula(files) <ide> tapd.rmtree <ide> tapd.dirname.rmdir_if_possible <ide> puts "Untapped #{files.length} formula#{plural(files.length, 'e')}" <ide> end <ide> end <del> <del> def unlink_tap_formula paths <del> untapped = 0 <del> gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] <del> <del> paths.each do |path| <del> link = HOMEBREW_LIBRARY.join("Formula", path.basename) <del> <del> if link.symlink? && (!link.exist? || link.resolved_path == path) <del> link.delete <del> gitignores.delete(path.basename.to_s) <del> untapped += 1 <del> end <del> end <del> <del> HOMEBREW_REPOSITORY.join("Library/Formula/.gitignore").atomic_write(gitignores * "\n") <del> <del> untapped <del> end <ide> end <ide><path>Library/Homebrew/cmd/update.rb <ide> require 'cmd/tap' <del>require 'cmd/untap' <ide> <ide> module Homebrew <ide> def update <ide> def update <ide> cd HOMEBREW_REPOSITORY <ide> git_init_if_necessary <ide> <del> tapped_formulae = [] <del> HOMEBREW_LIBRARY.join("Formula").children.each do |path| <del> next unless path.symlink? <del> tapped_formulae << path.resolved_path <del> end <del> unlink_tap_formula(tapped_formulae) <add> # migrate to new directories based tap structure <add> migrate_taps <ide> <ide> report = Report.new <ide> master_updater = Updater.new(HOMEBREW_REPOSITORY) <del> begin <del> master_updater.pull! <del> ensure <del> link_tap_formula(tapped_formulae) <del> end <add> master_updater.pull! <ide> report.update(master_updater.report) <ide> <ide> # rename Taps directories <ide> def update <ide> end <ide> end <ide> <del> # we unlink first in case the formula has moved to another tap <del> Homebrew.unlink_tap_formula(report.removed_tapped_formula) <del> Homebrew.link_tap_formula(report.new_tapped_formula) <del> <ide> # automatically tap any migrated formulae's new tap <ide> report.select_formula(:D).each do |f| <ide> next unless (HOMEBREW_CELLAR/f).exist? <ide> def git_init_if_necessary <ide> end <ide> <ide> def rename_taps_dir_if_necessary <del> need_repair_taps = false <ide> Dir.glob("#{HOMEBREW_LIBRARY}/Taps/*/") do |tapd| <ide> begin <ide> tapd_basename = File.basename(tapd) <ide> def rename_taps_dir_if_necessary <ide> <ide> FileUtils.mkdir_p("#{HOMEBREW_LIBRARY}/Taps/#{user.downcase}") <ide> FileUtils.mv(tapd, "#{HOMEBREW_LIBRARY}/Taps/#{user.downcase}/homebrew-#{repo.downcase}") <del> need_repair_taps = true <ide> <ide> if tapd_basename.count("-") >= 2 <ide> opoo "Homebrew changed the structure of Taps like <someuser>/<sometap>. "\ <ide> def rename_taps_dir_if_necessary <ide> next # next tap directory <ide> end <ide> end <del> <del> repair_taps if need_repair_taps <ide> end <ide> <ide> def load_tap_migrations
4
Text
Text
fix the lint of an example in cluster.md
8637c27b7754e2f7527e8eee9b3243ddce68f2c7
<ide><path>doc/api/cluster.md <ide> Similar to the `cluster.on('exit')` event, but specific to this worker. <ide> ```js <ide> const worker = cluster.fork(); <ide> worker.on('exit', (code, signal) => { <del> if( signal ) { <add> if (signal) { <ide> console.log(`worker was killed by signal: ${signal}`); <del> } else if( code !== 0 ) { <add> } else if (code !== 0) { <ide> console.log(`worker exited with error code: ${code}`); <ide> } else { <ide> console.log('worker success!'); <ide> if (cluster.isMaster) { <ide> server.listen(8000); <ide> <ide> process.on('message', (msg) => { <del> if(msg === 'shutdown') { <add> if (msg === 'shutdown') { <ide> // initiate graceful close of any connections to server <ide> } <ide> });
1
Javascript
Javascript
add querystring test for hasownproperty usage
b3af074a0258aa6694bec8eabfc04d2871be57b9
<ide><path>test/simple/test-querystring.js <ide> var qsTestCases = [ <ide> [' foo = bar ', '%20foo%20=%20bar%20', {' foo ': ' bar '}], <ide> ['foo=%zx', 'foo=%25zx', {'foo': '%zx'}], <ide> ['foo=%EF%BF%BD', 'foo=%EF%BF%BD', {'foo': '\ufffd' }], <del> [ 'toString=foo&valueOf=bar&__defineGetter__=baz', <del> 'toString=foo&valueOf=bar&__defineGetter__=baz', <del> { toString: 'foo', <add> [ 'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz', <add> 'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz', <add> { hasOwnProperty: 'x', <add> toString: 'foo', <ide> valueOf: 'bar', <ide> __defineGetter__: 'baz' } ] <ide> ];
1
PHP
PHP
add failing tests for patches from 'teddyzeenny'
2f51ef00ed4cd215e797c6c80c6c9aaeb2c4f34f
<ide><path>lib/Cake/Test/Case/Network/CakeRequestTest.php <ide> public function testGetParamsWithDot() { <ide> $this->assertEquals(array(), $request->query); <ide> } <ide> <add>/** <add> * Test that a request with urlencoded bits in the main GET parameter are filtered out. <add> * <add> * @return void <add> */ <add> public function testGetParamWithUrlencodedElement() { <add> $_GET['/posts/add/∂∂'] = ''; <add> $_SERVER['PHP_SELF'] = '/cake_dev/app/webroot/index.php'; <add> $_SERVER['REQUEST_URI'] = '/cake_dev/posts/add/%2202%2202'; <add> <add> $request = new CakeRequest(); <add> $this->assertEquals(array(), $request->query); <add> } <add> <ide> /** <ide> * generator for environment configurations <ide> * <ide><path>lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php <ide> public function testParse() { <ide> $this->assertEquals($result['action'], 'index'); <ide> } <ide> <add>/** <add> * Test that :key elements are urldecoded <add> * <add> * @return void <add> */ <add> public function testParseUrlDecodeElements() { <add> $route = new Cakeroute( <add> '/:controller/:slug', <add> array('action' => 'view') <add> ); <add> $route->compile(); <add> $result = $route->parse('/posts/%2202%2202'); <add> $this->assertEquals($result['controller'], 'posts'); <add> $this->assertEquals($result['action'], 'view'); <add> $this->assertEquals($result['slug'], '∂∂'); <add> } <add> <ide> /** <ide> * test numerically indexed defaults, get appeneded to pass <ide> *
2
Text
Text
remove a colon in rosetta-code/happy-numbers
8a5711dda7b62b7c8e57d39131e3f86fc6f84491
<ide><path>curriculum/challenges/english/10-coding-interview-prep/rosetta-code/happy-numbers.md <ide> assert(typeof happy === 'function'); <ide> assert(typeof happy(1) === 'boolean'); <ide> ``` <ide> <del>`happy(1)` should return true. <add>`happy(1)` should return `true`. <ide> <ide> ```js <ide> assert(happy(1)); <ide> ``` <ide> <del>`happy(2)` should return false. <add>`happy(2)` should return `false`. <ide> <ide> ```js <ide> assert(!happy(2)); <ide> ``` <ide> <del>`happy(7)` should return true. <add>`happy(7)` should return `true`. <ide> <ide> ```js <ide> assert(happy(7)); <ide> ``` <ide> <del>`happy(10)` should return true. <add>`happy(10)` should return `true`. <ide> <ide> ```js <ide> assert(happy(10)); <ide> ``` <ide> <del>`happy(13)` should return true. <add>`happy(13)` should return `true`. <ide> <ide> ```js <ide> assert(happy(13)); <ide> ``` <ide> <del>`happy(19)` should return true. <add>`happy(19)` should return `true`. <ide> <ide> ```js <ide> assert(happy(19)); <ide> ``` <ide> <del>`happy(23)` should return true. <add>`happy(23)` should return `true`. <ide> <ide> ```js <ide> assert(happy(23)); <ide> ``` <ide> <del>`happy(28)` should return true. <add>`happy(28)` should return `true`. <ide> <ide> ```js <ide> assert(happy(28)); <ide> ``` <ide> <del>`happy(31)` should return true. <add>`happy(31)` should return `true`. <ide> <ide> ```js <ide> assert(happy(31)); <ide> ``` <ide> <del>`happy(32)` should return true:. <add>`happy(32)` should return `true`. <ide> <ide> ```js <ide> assert(happy(32)); <ide> ``` <ide> <del>`happy(33)` should return false. <add>`happy(33)` should return `false`. <ide> <ide> ```js <ide> assert(!happy(33));
1
Javascript
Javascript
fix broken link $xhr docs
cc5dfaf0ab4c0ce580a292e54ae64508ef7ee114
<ide><path>src/service/xhr.js <ide> * {@link angular.service.$browser $browser.xhr()} and adds error handling and security features. <ide> * While $xhr service provides nicer api than raw XmlHttpRequest, it is still considered a lower <ide> * level api in angular. For a higher level abstraction that utilizes `$xhr`, please check out the <del> * {@link angular.service$resource $resource} service. <add> * {@link angular.service.$resource $resource} service. <ide> * <ide> * # Error handling <ide> * All XHR responses with response codes other then `2xx` are delegated to
1
Python
Python
add test_connection method to `googlebasehook`
3b35325840e484f86df00e087410f5d5da4b9130
<ide><path>airflow/providers/google/common/hooks/base_google.py <ide> import google.auth.credentials <ide> import google.oauth2.service_account <ide> import google_auth_httplib2 <add>import requests <ide> import tenacity <ide> from google.api_core.exceptions import Forbidden, ResourceExhausted, TooManyRequests <ide> from google.api_core.gapic_v1.client_info import ClientInfo <ide> def _get_credentials(self) -> google.auth.credentials.Credentials: <ide> <ide> def _get_access_token(self) -> str: <ide> """Returns a valid access token from Google API Credentials""" <del> return self._get_credentials().token <add> credentials = self._get_credentials() <add> auth_req = google.auth.transport.requests.Request() <add> # credentials.token is None <add> # Need to refresh credentials to populate the token <add> credentials.refresh(auth_req) <add> return credentials.token <ide> <ide> @functools.lru_cache(maxsize=None) <ide> def _get_credentials_email(self) -> str: <ide> def download_content_from_request(file_handle, request: dict, chunk_size: int) - <ide> while done is False: <ide> _, done = downloader.next_chunk() <ide> file_handle.flush() <add> <add> def test_connection(self): <add> """Test the Google cloud connectivity from UI""" <add> status, message = False, '' <add> try: <add> token = self._get_access_token() <add> url = f"https://www.googleapis.com/oauth2/v3/tokeninfo?access_token={token}" <add> response = requests.post(url) <add> if response.status_code == 200: <add> status = True <add> message = 'Connection successfully tested' <add> except Exception as e: <add> status = False <add> message = str(e) <add> <add> return status, message <ide><path>tests/providers/google/common/hooks/test_base_google.py <ide> def test_get_credentials_and_project_id_with_default_auth(self, mock_get_creds_a <ide> ) <ide> assert ('CREDENTIALS', 'PROJECT_ID') == result <ide> <add> @mock.patch('requests.post') <add> @mock.patch(MODULE_NAME + '.get_credentials_and_project_id') <add> def test_connection_success(self, mock_get_creds_and_proj_id, requests_post): <add> requests_post.return_value.status_code = 200 <add> credentials = mock.MagicMock() <add> type(credentials).token = mock.PropertyMock(return_value="TOKEN") <add> mock_get_creds_and_proj_id.return_value = (credentials, "PROJECT_ID") <add> self.instance.extras = {} <add> result = self.instance.test_connection() <add> assert result == (True, 'Connection successfully tested') <add> <add> @mock.patch(MODULE_NAME + '.get_credentials_and_project_id') <add> def test_connection_failure(self, mock_get_creds_and_proj_id): <add> mock_get_creds_and_proj_id.side_effect = AirflowException('Invalid key JSON.') <add> self.instance.extras = {} <add> result = self.instance.test_connection() <add> assert result == (False, 'Invalid key JSON.') <add> <ide> @mock.patch(MODULE_NAME + '.get_credentials_and_project_id') <ide> def test_get_credentials_and_project_id_with_service_account_file(self, mock_get_creds_and_proj_id): <ide> mock_credentials = mock.MagicMock()
2
PHP
PHP
implement test generation for cell classes
7be6da04821965e64a9db25253a91d87905aef76
<ide><path>src/Console/Command/Task/TestTask.php <ide> class TestTask extends BakeTask { <ide> 'Behavior' => 'Model\Behavior', <ide> 'Helper' => 'View\Helper', <ide> 'Shell' => 'Console\Command', <add> 'Cell' => 'View\Cell', <ide> ]; <ide> <ide> /** <ide> class TestTask extends BakeTask { <ide> 'behavior' => 'Behavior', <ide> 'helper' => 'Helper', <ide> 'shell' => 'Shell', <add> 'cell' => 'Cell', <ide> ]; <ide> <ide> /** <ide> public function generateConstructor($type, $fullClassName) { <ide> $pre = "\$this->io = \$this->getMock('Cake\Console\ConsoleIo');\n"; <ide> $construct = "new {$className}(\$this->io);\n"; <ide> } <add> if ($type === 'cell') { <add> $pre = "\$this->request = \$this->getMock('Cake\Network\Request');\n"; <add> $pre .= "\t\t\$this->response = \$this->getMock('Cake\Network\Response');\n"; <add> $construct = "new {$className}(\$this->request, \$this->response);\n"; <add> } <ide> return [$pre, $construct, $post]; <ide> } <ide> <ide><path>tests/TestCase/Console/Command/Task/TestTaskTest.php <ide> public static function realClassProvider() { <ide> ['component', 'AuthComponent', 'App\Controller\Component\AuthComponent'], <ide> ['Shell', 'Example', 'App\Console\Command\ExampleShell'], <ide> ['shell', 'Example', 'App\Console\Command\ExampleShell'], <add> ['Cell', 'Example', 'App\View\Cell\ExampleCell'], <add> ['cell', 'Example', 'App\View\Cell\ExampleCell'], <ide> ]; <ide> } <ide> <ide> public function testBakeFixturesParam() { <ide> $this->assertNotContains("''", $result); <ide> } <ide> <add>/** <add> * Test baking a test for a cell. <add> * <add> * @return void <add> */ <add> public function testBakeCellTest() { <add> $this->Task->expects($this->once()) <add> ->method('createFile') <add> ->will($this->returnValue(true)); <add> <add> $result = $this->Task->bake('Cell', 'Articles'); <add> <add> $this->assertContains("use App\View\Cell\ArticlesCell", $result); <add> $this->assertContains('class ArticlesCellTest extends TestCase', $result); <add> <add> $this->assertContains('function setUp()', $result); <add> $this->assertContains("\$this->request = \$this->getMock('Cake\Network\Request')", $result); <add> $this->assertContains("\$this->response = \$this->getMock('Cake\Network\Response')", $result); <add> $this->assertContains("\$this->Articles = new ArticlesCell(\$this->request, \$this->response", $result); <add> } <add> <ide> /** <ide> * Test baking a test for a concrete model. <ide> *
2
Javascript
Javascript
introduce registry#container method
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3
<ide><path>packages/container/lib/container.js <ide> Container.prototype = { <ide> <ide> ```javascript <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('api:twitter', Twitter); <ide> <ide> Container.prototype = { <ide> <ide> ```javascript <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('api:twitter', Twitter); <ide> <ide><path>packages/container/lib/registry.js <ide> import Ember from 'ember-metal/core'; // Ember.assert <ide> import dictionary from 'ember-metal/dictionary'; <add>import Container from 'container/container'; <ide> <ide> var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/; <ide> <ide> Registry.prototype = { <ide> */ <ide> _typeOptions: null, <ide> <add> /** <add> Creates a container based on this registry. <add> <add> @method container <add> @param {Object} options <add> */ <add> container: function(options) { <add> return new Container(this, options); <add> }, <add> <ide> /** <ide> Registers a factory for later injection. <ide> <ide> Registry.prototype = { <ide> <ide> ```javascript <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> // if all of type `connection` must not be singletons <ide> registry.optionsForType('connection', { singleton: false }); <ide> Registry.prototype = { <ide> <ide> ```javascript <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('router:main', Router); <ide> registry.register('controller:user', UserController); <ide> Registry.prototype = { <ide> <ide> ```javascript <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('source:main', Source); <ide> registry.register('model:user', User); <ide> Registry.prototype = { <ide> <ide> ```javascript <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('store:main', Store); <ide> registry.register('store:secondary', OtherStore); <ide><path>packages/container/tests/container_test.js <ide> import { <ide> factory <ide> } from 'container/tests/container_helper'; <ide> <del>import Container from 'container/container'; <ide> import Registry from 'container/registry'; <ide> <ide> var originalModelInjections; <ide> QUnit.module("Container", { <ide> <ide> test("A registered factory returns the same instance each time", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.register('controller:post', PostController); <ide> test("A registered factory returns the same instance each time", function() { <ide> <ide> test("A registered factory is returned from lookupFactory", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.register('controller:post', PostController); <ide> test("A registered factory is returned from lookupFactory", function() { <ide> <ide> test("A registered factory is returned from lookupFactory is the same factory each time", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.register('controller:post', PostController); <ide> test("A registered factory is returned from lookupFactory is the same factory ea <ide> <ide> test("A factory returned from lookupFactory has a debugkey", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.register('controller:post', PostController); <ide> test("A factory returned from lookupFactory has a debugkey", function() { <ide> <ide> test("fallback for to create time injections if factory has no extend", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var AppleController = factory(); <ide> var PostController = factory(); <ide> <ide> test("fallback for to create time injections if factory has no extend", function <ide> <ide> test("The descendants of a factory returned from lookupFactory have a container and debugkey", function(){ <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var instance; <ide> <ide> test("The descendants of a factory returned from lookupFactory have a container <ide> <ide> test("A registered factory returns a fresh instance if singleton: false is passed as an option", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.register('controller:post', PostController); <ide> test("A registered factory returns a fresh instance if singleton: false is passe <ide> <ide> test("A container lookup has access to the container", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.register('controller:post', PostController); <ide> test("A container lookup has access to the container", function() { <ide> <ide> test("A factory type with a registered injection's instances receive that injection", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var Store = factory(); <ide> <ide> test("A factory type with a registered injection's instances receive that inject <ide> <ide> test("An individual factory with a registered injection receives the injection", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var Store = factory(); <ide> <ide> test("An individual factory with a registered injection receives the injection", <ide> <ide> test("A factory with both type and individual injections", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var Store = factory(); <ide> var Router = factory(); <ide> test("A factory with both type and individual injections", function() { <ide> <ide> test("A factory with both type and individual factoryInjections", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var Store = factory(); <ide> var Router = factory(); <ide> test("A factory with both type and individual factoryInjections", function() { <ide> <ide> test("A non-singleton instance is never cached", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostView = factory(); <ide> <ide> registry.register('view:post', PostView, { singleton: false }); <ide> test("A non-singleton instance is never cached", function() { <ide> <ide> test("A non-instantiated property is not instantiated", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var template = function() {}; <ide> registry.register('template:foo', template, { instantiate: false }); <ide> test("A non-instantiated property is not instantiated", function() { <ide> <ide> test("A failed lookup returns undefined", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> equal(container.lookup('doesnot:exist'), undefined); <ide> }); <ide> <ide> test("An invalid factory throws an error", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:foo', {}); <ide> <ide> test("Injecting a failed lookup raises an error", function() { <ide> Ember.MODEL_FACTORY_INJECTIONS = true; <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var fooInstance = {}; <ide> var fooFactory = {}; <ide> test("Injecting a failed lookup raises an error", function() { <ide> <ide> test("Injecting a falsy value does not raise an error", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var ApplicationController = factory(); <ide> <ide> registry.register('controller:application', ApplicationController); <ide> test("Injecting a falsy value does not raise an error", function() { <ide> <ide> test("Destroying the container destroys any cached singletons", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var PostView = factory(); <ide> var template = function() {}; <ide> test("Destroying the container destroys any cached singletons", function() { <ide> <ide> test("The container can use a registry hook to resolve factories lazily", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.resolver = function(fullName) { <ide> test("The container can use a registry hook to resolve factories lazily", functi <ide> <ide> test("The container normalizes names before resolving", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.normalizeFullName = function(fullName) { <ide> test("The container normalizes names before resolving", function() { <ide> <ide> test("The container normalizes names when looking factory up", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> <ide> registry.normalizeFullName = function(fullName) { <ide> test("The container normalizes names when looking factory up", function() { <ide> <ide> test("The container can get options that should be applied to a given factory", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostView = factory(); <ide> <ide> registry.resolver = function(fullName) { <ide> test("The container can get options that should be applied to a given factory", <ide> <ide> test("The container can get options that should be applied to all factories for a given type", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostView = factory(); <ide> <ide> registry.resolver = function(fullName) { <ide> test("The container can get options that should be applied to all factories for <ide> <ide> test("factory resolves are cached", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var resolveWasCalled = []; <ide> registry.resolve = function(fullName) { <ide> test("factory resolves are cached", function() { <ide> <ide> test("factory for non extendables (MODEL) resolves are cached", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = factory(); <ide> var resolveWasCalled = []; <ide> registry.resolve = function(fullName) { <ide> test("factory for non extendables (MODEL) resolves are cached", function() { <ide> <ide> test("factory for non extendables resolves are cached", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var PostController = {}; <ide> var resolveWasCalled = []; <ide> <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> expect(2); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var Apple = factory(); <ide> <ide> Apple.reopenClass({ <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("A factory's lazy injections are validated when first instantiated", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var Apple = factory(); <ide> var Orange = factory(); <ide> <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> expect(1); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var Apple = factory(); <ide> var Orange = factory(); <ide> <ide><path>packages/ember-application/lib/system/application.js <ide> */ <ide> import DAG from 'dag-map'; <ide> import Registry from 'container/registry'; <del>import Container from 'container/container'; <ide> <ide> import Ember from "ember-metal"; // Ember.FEATURES, Ember.deprecate, Ember.assert, Ember.libraries, LOG_VERSION, Namespace, BOOTED <ide> import { get } from "ember-metal/property_get"; <ide> var Application = Namespace.extend(DeferredMixin, { <ide> @return {Ember.Container} the configured container <ide> */ <ide> buildContainer: function() { <del> var container = this.__container__ = new Container(this.__registry__); <add> var container = this.__container__ = this.__registry__.container(); <ide> <ide> return container; <ide> }, <ide><path>packages/ember-application/tests/system/controller_test.js <ide> import Controller from "ember-runtime/controllers/controller"; <ide> import "ember-application/ext/controller"; <ide> <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { A } from "ember-runtime/system/native_array"; <ide> import ArrayController from "ember-runtime/controllers/array_controller"; <ide> import { computed } from "ember-metal/computed"; <ide> test("If a controller specifies a dependency, but does not have a container it s <ide> <ide> test("If a controller specifies a dependency, it is accessible", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:post', Controller.extend({ <ide> needs: 'posts' <ide> test("If a controller specifies a dependency, it is accessible", function() { <ide> <ide> test("If a controller specifies an unavailable dependency, it raises", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:post', Controller.extend({ <ide> needs: ['comments'] <ide> test("If a controller specifies an unavailable dependency, it raises", function( <ide> <ide> test("Mixin sets up controllers if there is needs before calling super", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:other', ArrayController.extend({ <ide> needs: 'posts', <ide> test("Mixin sets up controllers if there is needs before calling super", functio <ide> <ide> test("raises if trying to get a controller that was not pre-defined in `needs`", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:foo', Controller.extend()); <ide> registry.register('controller:bar', Controller.extend({ <ide> test("raises if trying to get a controller that was not pre-defined in `needs`", <ide> <ide> test ("setting the value of a controller dependency should not be possible", function(){ <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:post', Controller.extend({ <ide> needs: 'posts' <ide> test ("setting the value of a controller dependency should not be possible", fun <ide> <ide> test("raises if a dependency with a period is requested", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:big.bird', Controller.extend()); <ide> registry.register('controller:foo', Controller.extend({ <ide><path>packages/ember-htmlbars/tests/compat/handlebars_get_test.js <ide> import Ember from "ember-metal/core"; // Ember.lookup <ide> import _MetamorphView from "ember-views/views/metamorph_view"; <ide> import EmberView from "ember-views/views/view"; <ide> import handlebarsGet from "ember-htmlbars/compat/handlebars-get"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> <ide> import EmberHandlebars from "ember-htmlbars/compat"; <ide> QUnit.module("ember-htmlbars: Ember.Handlebars.get", { <ide> setup: function() { <ide> Ember.lookup = lookup = {}; <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.optionsForType('helper', { instantiate: false }); <ide> registry.register('view:default', _MetamorphView); <ide><path>packages/ember-htmlbars/tests/compat/make-view-helper_test.js <ide> import EmberView from "ember-views/views/view"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import makeViewHelper from "ember-htmlbars/system/make-view-helper"; <ide> import Component from "ember-views/views/component"; <ide> var registry, container, view; <ide> QUnit.module('ember-htmlbars: makeViewHelper compat', { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('helper', { instantiate: false }); <ide> }, <ide> <ide><path>packages/ember-htmlbars/tests/helpers/bind_attr_test.js <ide> import EmberObject from "ember-runtime/system/object"; <ide> import { A } from "ember-runtime/system/native_array"; <ide> import { computed } from "ember-metal/computed"; <ide> import { observersFor } from "ember-metal/observer"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { set } from "ember-metal/property_set"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> import { equalInnerHTML } from "htmlbars-test-helpers"; <ide> QUnit.module("ember-htmlbars: {{bind-attr}}", { <ide> Ember.lookup = lookup = {}; <ide> lookup.TemplateTests = TemplateTests = Namespace.create(); <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide><path>packages/ember-htmlbars/tests/helpers/bind_test.js <ide> import EmberObject from "ember-runtime/system/object"; <ide> import run from "ember-metal/run_loop"; <ide> import _MetamorphView from 'ember-views/views/metamorph_view'; <ide> import compile from "ember-htmlbars/system/compile"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import ObjectController from "ember-runtime/controllers/object_controller"; <ide> <ide> import { get } from "ember-metal/property_get"; <ide> var view, registry, container; <ide> QUnit.module("ember-htmlbars: {{bind}} helper", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide> test("it should render the current value of a string path on the context", funct <ide> QUnit.module("ember-htmlbars: {{bind}} with a container, block forms", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> }, <ide> teardown: function() { <ide><path>packages/ember-htmlbars/tests/helpers/collection_test.js <ide> import EmberObject from "ember-runtime/system/object"; <ide> import EmberView from "ember-views/views/view"; <ide> import ArrayProxy from "ember-runtime/system/array_proxy"; <ide> import Namespace from "ember-runtime/system/namespace"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { A } from "ember-runtime/system/native_array"; <ide> import run from "ember-metal/run_loop"; <ide> import { get } from "ember-metal/property_get"; <ide> QUnit.module("collection helper", { <ide> Ember.lookup = lookup = {}; <ide> lookup.TemplateTests = TemplateTests = Namespace.create(); <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> registry.optionsForType('template', { instantiate: false }); <ide> // registry.register('view:default', _MetamorphView); <ide> test("passing a block to the collection helper sets it as the template for examp <ide> <ide> test("collection helper should try to use container to resolve view", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var ACollectionView = CollectionView.extend({ <ide> tagName: 'ul', <ide> test("tagName works in the #collection helper", function() { <ide> <ide> test("should render nested collections", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> registry.register('view:inner-list', CollectionView.extend({ <ide> tagName: 'ul', <ide> content: A(['one','two','three']) <ide> test("context should be content", function() { <ide> var view; <ide> <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> var items = A([ <ide> EmberObject.create({name: 'Dave'}), <ide><path>packages/ember-htmlbars/tests/helpers/each_test.js <ide> import ArrayController from "ember-runtime/controllers/array_controller"; <ide> import { A } from "ember-runtime/system/native_array"; <ide> import { default as EmberController } from "ember-runtime/controllers/controller"; <ide> import ObjectController from "ember-runtime/controllers/object_controller"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> <ide> import { get } from "ember-metal/property_get"; <ide> import { set } from "ember-metal/property_set"; <ide> QUnit.module("the #each helper [DEPRECATED]", { <ide> people = A([{ name: "Steve Holt" }, { name: "Annabelle" }]); <ide> <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide> function testEachWithItem(moduleName, useBlockParams) { <ide> QUnit.module(moduleName, { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide> function testEachWithItem(moduleName, useBlockParams) { <ide> }); <ide> <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> people = A([{ name: "Steve Holt" }, { name: "Annabelle" }]); <ide> <ide> function testEachWithItem(moduleName, useBlockParams) { <ide> controllerName: 'controller:people' <ide> }); <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> registry.register('controller:people', PeopleController); <ide> registry.register('controller:person', PersonController); <ide><path>packages/ember-htmlbars/tests/helpers/if_unless_test.js <ide> import run from "ember-metal/run_loop"; <ide> import Namespace from 'ember-runtime/system/namespace'; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import EmberView from "ember-views/views/view"; <ide> import ObjectProxy from "ember-runtime/system/object_proxy"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> QUnit.module("ember-htmlbars: {{#if}} and {{#unless}} helpers", { <ide> Ember.lookup = lookup = {}; <ide> lookup.TemplateTests = TemplateTests = Namespace.create(); <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide><path>packages/ember-htmlbars/tests/helpers/partial_test.js <ide> import run from "ember-metal/run_loop"; <ide> import EmberView from "ember-views/views/view"; <ide> import jQuery from "ember-views/system/jquery"; <ide> var trim = jQuery.trim; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> <ide> QUnit.module("Support for {{partial}} helper", { <ide> Ember.lookup = lookup = { Ember: Ember }; <ide> MyApp = lookup.MyApp = EmberObject.create({}); <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> }, <ide> teardown: function() { <ide><path>packages/ember-htmlbars/tests/helpers/template_test.js <ide> import EmberObject from "ember-runtime/system/object"; <ide> import jQuery from "ember-views/system/jquery"; <ide> var trim = jQuery.trim; <ide> <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> <ide> QUnit.module("Support for {{template}} helper", { <ide> Ember.lookup = lookup = { Ember: Ember }; <ide> MyApp = lookup.MyApp = EmberObject.create({}); <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> }, <ide> teardown: function() { <ide><path>packages/ember-htmlbars/tests/helpers/unbound_test.js <ide> import helpers from "ember-htmlbars/helpers"; <ide> import registerBoundHelper from "ember-htmlbars/compat/register-bound-helper"; <ide> import makeBoundHelper from "ember-htmlbars/compat/make-bound-helper"; <ide> <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> <ide> function expectDeprecationInHTMLBars() { <ide> QUnit.module("ember-htmlbars: {{#unbound}} helper -- Container Lookup", { <ide> setup: function() { <ide> Ember.lookup = lookup = { Ember: Ember }; <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('helper', { instantiate: false }); <ide> }, <ide> <ide><path>packages/ember-htmlbars/tests/helpers/view_test.js <ide> import { set } from "ember-metal/property_set"; <ide> import EmberView from "ember-views/views/view"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import run from "ember-metal/run_loop"; <ide> import jQuery from "ember-views/system/jquery"; <ide> import TextField from 'ember-views/views/text_field'; <ide> QUnit.module("ember-htmlbars: {{#view}} helper", { <ide> Ember.lookup = lookup = {}; <ide> <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide> test("allows you to pass attributes that will be assigned to the class instance, <ide> expect(4); <ide> <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.register('view:toplevel', EmberView.extend()); <ide> <ide> view = EmberView.extend({ <ide><path>packages/ember-htmlbars/tests/helpers/with_test.js <ide> import { computed } from "ember-metal/computed"; <ide> import { set } from "ember-metal/property_set"; <ide> import { get } from "ember-metal/property_get"; <ide> import ObjectController from "ember-runtime/controllers/object_controller"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> <ide> test("it should wrap context with object controller [DEPRECATED]", function() { <ide> <ide> var person = EmberObject.create({name: 'Steve Holt'}); <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var parentController = EmberObject.create({ <ide> container: container, <ide> test("it should still have access to original parentController within an {{#each <ide> <ide> var people = A([{ name: "Steve Holt" }, { name: "Carl Weathers" }]); <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var parentController = EmberObject.create({ <ide> container: container, <ide> test("it should wrap keyword with object controller", function() { <ide> <ide> var person = EmberObject.create({name: 'Steve Holt'}); <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var parentController = EmberObject.create({ <ide> container: container, <ide> test("destroys the controller generated with {{with foo controller='blah'}} [DEP <ide> <ide> var person = EmberObject.create({name: 'Steve Holt'}); <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var parentController = EmberObject.create({ <ide> container: container, <ide> test("destroys the controller generated with {{with foo as bar controller='blah' <ide> <ide> var person = EmberObject.create({name: 'Steve Holt'}); <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var parentController = EmberObject.create({ <ide> container: container, <ide><path>packages/ember-htmlbars/tests/helpers/yield_test.js <ide> import run from "ember-metal/run_loop"; <ide> import EmberView from "ember-views/views/view"; <ide> import { computed } from "ember-metal/computed"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import { get } from "ember-metal/property_get"; <ide> import { set } from "ember-metal/property_set"; <ide> import { A } from "ember-runtime/system/native_array"; <ide> var view, registry, container; <ide> QUnit.module("ember-htmlbars: Support for {{yield}} helper", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> }, <ide> teardown: function() { <ide><path>packages/ember-htmlbars/tests/hooks/component_test.js <ide> import ComponentLookup from "ember-views/component_lookup"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import EmberView from "ember-views/views/view"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide> QUnit.module("ember-htmlbars: component hook", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.register('component-lookup:main', ComponentLookup); <ide><path>packages/ember-htmlbars/tests/integration/block_params_test.js <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import run from "ember-metal/run_loop"; <ide> import ComponentLookup from 'ember-views/component_lookup'; <ide> import View from "ember-views/views/view"; <ide> QUnit.module("ember-htmlbars: block params", { <ide> registerHelper('alias', aliasHelper); <ide> <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('component', { singleton: false }); <ide> registry.optionsForType('view', { singleton: false }); <ide> registry.optionsForType('template', { instantiate: false }); <ide><path>packages/ember-htmlbars/tests/integration/component_invocation_test.js <ide> import EmberView from "ember-views/views/view"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import jQuery from "ember-views/system/jquery"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import ComponentLookup from 'ember-views/component_lookup'; <ide> var registry, container, view; <ide> QUnit.module('component - invocation', { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('component', { singleton: false }); <ide> registry.optionsForType('view', { singleton: false }); <ide> registry.optionsForType('template', { instantiate: false }); <ide><path>packages/ember-htmlbars/tests/integration/with_view_test.js <ide> import run from 'ember-metal/run_loop'; <ide> import jQuery from 'ember-views/system/jquery'; <ide> import EmberView from 'ember-views/views/view'; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import EmberObject from 'ember-runtime/system/object'; <ide> import _MetamorphView from 'ember-views/views/metamorph_view'; <ide> import compile from 'ember-htmlbars/system/compile'; <ide> var trim = jQuery.trim; <ide> QUnit.module('ember-htmlbars: {{#with}} and {{#view}} integration', { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> registry.register('view:default', _MetamorphView); <ide> registry.register('view:toplevel', EmberView.extend()); <ide><path>packages/ember-htmlbars/tests/system/lookup-helper_test.js <ide> import lookupHelper from "ember-htmlbars/system/lookup-helper"; <ide> import ComponentLookup from "ember-views/component_lookup"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import Component from "ember-views/views/component"; <ide> <ide> function generateEnv(helpers) { <ide> function generateEnv(helpers) { <ide> <ide> function generateContainer() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.optionsForType('helper', { instantiate: false }); <ide> registry.register('component-lookup:main', ComponentLookup); <ide><path>packages/ember-htmlbars/tests/system/make_bound_helper_test.js <ide> import EmberView from "ember-views/views/view"; <ide> import run from "ember-metal/run_loop"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import makeBoundHelper from "ember-htmlbars/system/make_bound_helper"; <ide> import compile from "ember-htmlbars/system/compile"; <ide> import { runAppend, runDestroy } from "ember-runtime/tests/utils"; <ide> if (Ember.FEATURES.isEnabled('ember-htmlbars')) { <ide> QUnit.module("ember-htmlbars: makeBoundHelper", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('helper', { instantiate: false }); <ide> }, <ide> <ide><path>packages/ember-routing-htmlbars/tests/helpers/action_test.js <ide> import run from "ember-metal/run_loop"; <ide> import EventDispatcher from "ember-views/system/event_dispatcher"; <ide> import ActionManager from "ember-views/system/action_manager"; <ide> <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> import { default as EmberController } from "ember-runtime/controllers/controller"; <ide> import EmberObjectController from "ember-runtime/controllers/object_controller"; <ide> test("should target the with-controller inside an {{#with controller='person'}} <ide> <ide> var PersonController = EmberObjectController.extend(); <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var parentController = EmberObject.create({ <ide> container: container <ide> }); <ide> test("should target the with-controller inside an {{each}} in a {{#with controll <ide> }); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var parentController = EmberObject.create({ <ide> container: container, <ide> people: Ember.A([ <ide><path>packages/ember-routing-htmlbars/tests/helpers/outlet_test.js <ide> import { set } from "ember-metal/property_set"; <ide> import run from "ember-metal/run_loop"; <ide> <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import Namespace from "ember-runtime/system/namespace"; <ide> import { <ide> decamelize, <ide> var buildRegistry = function(namespace) { <ide> }; <ide> <ide> var buildContainer = function(registry) { <del> return new Container(registry); <add> return registry.container(); <ide> }; <ide> <ide> function resolverFor(namespace) { <ide><path>packages/ember-routing-htmlbars/tests/helpers/render_test.js <ide> import { canDefineNonEnumerableProperties } from 'ember-metal/platform'; <ide> import { observer } from 'ember-metal/mixin'; <ide> <ide> import Registry from 'container/registry'; <del>import Container from 'container/container'; <ide> import Namespace from "ember-runtime/system/namespace"; <ide> import { <ide> classify, <ide> function set(object, key, value) { <ide> <ide> function buildContainer(namespace) { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.set = emberSet; <ide> registry.resolver = resolverFor(namespace); <ide><path>packages/ember-routing/tests/system/controller_for_test.js <ide> import { set } from "ember-metal/property_set"; <ide> import run from "ember-metal/run_loop"; <ide> <ide> import Registry from 'container/registry'; <del>import Container from 'container/container'; <ide> import Namespace from "ember-runtime/system/namespace"; <ide> import { classify } from "ember-runtime/system/string"; <ide> import Controller from "ember-runtime/controllers/controller"; <ide> import { <ide> <ide> var buildContainer = function(namespace) { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.set = set; <ide> registry.resolver = resolverFor(namespace); <ide><path>packages/ember-routing/tests/system/route_test.js <ide> import run from "ember-metal/run_loop"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import Service from "ember-runtime/system/service"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> import EmberRoute from "ember-routing/system/route"; <ide> test("'store' can be injected by data persistence frameworks", function() { <ide> run(route, 'destroy'); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var post = { <ide> id: 1 <ide> }; <ide> test("assert if 'store.find' method is not found", function() { <ide> run(route, 'destroy'); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var Post = EmberObject.extend(); <ide> <ide> registry.register('route:index', EmberRoute); <ide> test("asserts if model class is not found", function() { <ide> run(route, 'destroy'); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> registry.register('route:index', EmberRoute); <ide> <ide> route = container.lookup('route:index'); <ide> test("'store' does not need to be injected", function() { <ide> run(route, 'destroy'); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('route:index', EmberRoute); <ide> <ide> test("'store' does not need to be injected", function() { <ide> <ide> test("modelFor doesn't require the router", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> route.container = container; <ide> <ide> var foo = { name: 'foo' }; <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("services can be injected into routes", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('route:application', EmberRoute.extend({ <ide> authService: inject.service('auth') <ide><path>packages/ember-routing/tests/system/router_test.js <ide> import copy from "ember-runtime/copy"; <ide> import merge from "ember-metal/merge"; <ide> import { map } from "ember-metal/enumerable_utils"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import HashLocation from "ember-routing/location/hash_location"; <ide> import AutoLocation from "ember-routing/location/auto_location"; <ide> import EmberRouter from "ember-routing/system/router"; <ide> function createRouter(overrides) { <ide> QUnit.module("Ember Router", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> //register the HashLocation (the default) <ide> registry.register('location:hash', HashLocation); <ide><path>packages/ember-runtime/tests/controllers/controller_test.js <ide> import Service from "ember-runtime/system/service"; <ide> import ObjectController from "ember-runtime/controllers/object_controller"; <ide> import Mixin from "ember-metal/mixin"; <ide> import Object from "ember-runtime/system/object"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import inject from "ember-runtime/inject"; <ide> import { get } from "ember-metal/property_get"; <ide> <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> test("defining a controller on a non-controller should fail assertion", function(){ <ide> expectAssertion(function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var AnObject = Object.extend({ <ide> container: container, <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("controllers can be injected into controllers", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:post', Controller.extend({ <ide> postsController: inject.controller('posts') <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("services can be injected into controllers", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('controller:application', Controller.extend({ <ide> authService: inject.service('auth') <ide><path>packages/ember-runtime/tests/controllers/item_controller_class_test.js <ide> import ArrayController from "ember-runtime/controllers/array_controller"; <ide> import ObjectController from "ember-runtime/controllers/object_controller"; <ide> import {sort} from "ember-runtime/computed/reduce_computed_macros"; <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> <ide> var lannisters, arrayController, controllerClass, otherControllerClass, registry, container, itemControllerCount, <ide> tywin, jaime, cersei, tyrion; <ide> <ide> QUnit.module("Ember.ArrayController - itemController", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> tywin = EmberObject.create({ name: 'Tywin' }); <ide> jaime = EmberObject.create({ name: 'Jaime' }); <ide> test("`itemController`'s life cycle should be entangled with its parent controll <ide> QUnit.module('Ember.ArrayController - itemController with arrayComputed', { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> <ide> cersei = EmberObject.create({ name: 'Cersei' }); <ide> jaime = EmberObject.create({ name: 'Jaime' }); <ide><path>packages/ember-runtime/tests/inject_test.js <ide> import { <ide> createInjectionHelper, <ide> default as inject <ide> } from "ember-runtime/inject"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import Object from "ember-runtime/system/object"; <ide> <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> }); <ide> <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> var AnObject = Object.extend({ <ide> container: container, <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("attempting to inject a nonexistent container key should error", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> var AnObject = Object.extend({ <ide> container: container, <ide> foo: new InjectedProperty('bar', 'baz') <ide><path>packages/ember-views/tests/views/component_test.js <ide> import { set } from "ember-metal/property_set"; <ide> import run from "ember-metal/run_loop"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> import Service from "ember-runtime/system/service"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import inject from "ember-runtime/inject"; <ide> import { get } from "ember-metal/property_get"; <ide> <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("services can be injected into components", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('component:application', Component.extend({ <ide> profilerService: inject.service('profiler') <ide><path>packages/ember-views/tests/views/view/inject_test.js <ide> import Service from "ember-runtime/system/service"; <del>import { Registry, Container } from "ember-runtime/system/container"; <add>import { Registry } from "ember-runtime/system/container"; <ide> import inject from "ember-runtime/inject"; <ide> import View from "ember-views/views/view"; <ide> <ide> if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { <ide> <ide> test("services can be injected into views", function() { <ide> var registry = new Registry(); <del> var container = new Container(registry); <add> var container = registry.container(); <ide> <ide> registry.register('view:application', View.extend({ <ide> profilerService: inject.service('profiler') <ide><path>packages/ember-views/tests/views/view/layout_test.js <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import { get } from "ember-metal/property_get"; <ide> import run from "ember-metal/run_loop"; <ide> import EmberView from "ember-views/views/view"; <ide> var registry, container, view; <ide> QUnit.module("EmberView - Layout Functionality", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> }, <ide> <ide><path>packages/ember-views/tests/views/view/nested_view_ordering_test.js <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import run from "ember-metal/run_loop"; <ide> <ide> import EmberView from "ember-views/views/view"; <ide> var registry, container, view; <ide> QUnit.module("EmberView - Nested View Ordering", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> }, <ide> teardown: function() { <ide> run(function() { <ide><path>packages/ember-views/tests/views/view/template_test.js <ide> import Registry from "container/registry"; <del>import Container from "container/container"; <ide> import { get } from "ember-metal/property_get"; <ide> import run from "ember-metal/run_loop"; <ide> import EmberObject from "ember-runtime/system/object"; <ide> var registry, container, view; <ide> QUnit.module("EmberView - Template Functionality", { <ide> setup: function() { <ide> registry = new Registry(); <del> container = new Container(registry); <add> container = registry.container(); <ide> registry.optionsForType('template', { instantiate: false }); <ide> }, <ide> teardown: function() {
38
PHP
PHP
move middleware into core
2eae07bd5f60966788ad52887eeb6572443d612a
<ide><path>src/Illuminate/Foundation/Http/Middleware/UnderMaintenance.php <add><?php namespace Illuminate\Foundation\Http\Middleware; <add> <add>use Closure; <add>use Illuminate\Http\Response; <add>use Illuminate\Contracts\Routing\Middleware; <add>use Illuminate\Contracts\Foundation\Application; <add> <add>class UnderMaintenance implements Middleware { <add> <add> /** <add> * The application implementation. <add> * <add> * @var Application <add> */ <add> protected $app; <add> <add> /** <add> * Create a new filter instance. <add> * <add> * @param Application $app <add> * @return void <add> */ <add> public function __construct(Application $app) <add> { <add> $this->app = $app; <add> } <add> <add> /** <add> * Handle an incoming request. <add> * <add> * @param \Illuminate\Http\Request $request <add> * @param \Closure $next <add> * @return mixed <add> */ <add> public function handle($request, Closure $next) <add> { <add> if ($this->app->isDownForMaintenance()) <add> { <add> return new Response(view('framework.maintenance'), 503); <add> } <add> <add> return $next($request); <add> } <add> <add>}
1
Javascript
Javascript
throw exception on missing key/cert
8bec26122d6de0b230f74731c1d09da267c95add
<ide><path>lib/tls.js <ide> function Server(/* [options], listener */) { <ide> // Handle option defaults: <ide> this.setOptions(options); <ide> <add> if (!self.pfx && (!self.cert || !self.key)) { <add> throw new Error('Missing PFX or certificate + private key.'); <add> } <add> <ide> var sharedCreds = crypto.createCredentials({ <ide> pfx: self.pfx, <ide> key: self.key, <ide><path>test/simple/test-tls-junk-closes-server.js <ide> var options = { <ide> cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem') <ide> }; <ide> <del>var server = tls.createServer(function(s) { <add>var server = tls.createServer(options, function(s) { <ide> s.write('welcome!\n'); <ide> s.pipe(s); <ide> }); <ide><path>test/simple/test-tls-server-missing-options.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>if (!process.versions.openssl) { <add> console.error('Skipping because node compiled without OpenSSL.'); <add> process.exit(0); <add>} <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add>var https = require('https'); <add>var tls = require('tls'); <add> <add>assert.throws(function() { <add> tls.createServer({ /* empty */}).listen(0); <add>}, /missing.+certificate/i); <add> <add>assert.throws(function() { <add> https.createServer({ /* empty */}).listen(0); <add>}, /missing.+certificate/i);
3
Text
Text
fix typo in path doc
db1087c9757c31a82c50a1eba368d8cba95b57d0
<ide><path>doc/api/path.md <ide> added: v0.1.16 <ide> <ide> * `...paths` {String} A sequence of path segments <ide> <del>The `path.join()` method join all given `path` segments together using the <add>The `path.join()` method joins all given `path` segments together using the <ide> platform specific separator as a delimiter, then normalizes the resulting path. <ide> <ide> Zero-length `path` segments are ignored. If the joined path string is a
1
Text
Text
fix typo in the plugins guide
3ea078d40b1320f2d4a189430ccdb42cdf7efd1d
<ide><path>docs/guides/plugins.md <ide> For any given plugin initialization, there are four events to be aware of: <ide> * `beforepluginsetup`: Triggered immediately before any plugin is initialized. <ide> * `beforepluginsetup:examplePlugin` Triggered immediately before the `examplePlugin` is initialized. <ide> * `pluginsetup`: Triggered after any plugin is initialized. <del>* `pluginsetup:examplePlugin`: Triggered after he `examplePlugin` is initialized. <add>* `pluginsetup:examplePlugin`: Triggered after the `examplePlugin` is initialized. <ide> <ide> These events work for both basic and advanced plugins. They are triggered on the player and each includes an object of [extra event data](#extra-event-data) as a second argument to its listeners. <ide>
1
Python
Python
skip failing test until they are fixed
8f400775fc5bc1011a2674dcfd5408d30d69f678
<ide><path>tests/pipelines/test_pipelines_image_segmentation.py <ide> def run_pipeline_test(self, image_segmenter, examples): <ide> def test_small_model_tf(self): <ide> pass <ide> <add> @unittest.skip("Model has moved, skip until it's fixed.") <ide> @require_torch <ide> def test_small_model_pt(self): <ide> model_id = "mishig/tiny-detr-mobilenetsv3-panoptic" <ide><path>tests/pipelines/test_pipelines_object_detection.py <ide> def run_pipeline_test(self, object_detector, examples): <ide> def test_small_model_tf(self): <ide> pass <ide> <add> @unittest.skip("Model has moved, skip until it's fixed.") <ide> @require_torch <ide> def test_small_model_pt(self): <ide> model_id = "mishig/tiny-detr-mobilenetsv3"
2
Python
Python
replace raw prints with io_utils.print_msg
b2e4b0485304705dc4e4ea22710b5b79eac90ced
<ide><path>keras/utils/dataset_utils.py <ide> import numpy as np <ide> import tensorflow.compat.v2 as tf <ide> <add>from keras.utils import io_utils <add> <ide> # isort: off <ide> from tensorflow.python.util.tf_export import keras_export <ide> <ide> def index_directory( <ide> i += len(partial_labels) <ide> <ide> if labels is None: <del> print(f"Found {len(filenames)} files.") <add> io_utils.print_msg(f"Found {len(filenames)} files.") <ide> else: <del> print( <add> io_utils.print_msg( <ide> f"Found {len(filenames)} files belonging " <ide> f"to {len(class_names)} classes." <ide> )
1
Python
Python
fix typos in partition method
692a0aff0ac96129eac67d34247427e7212ef088
<ide><path>numpy/add_newdocs.py <ide> def luf(lamdaexpr, *args, **kwargs): <ide> """ <ide> a.partition(kth, axis=-1, kind='introselect', order=None) <ide> <del> Rearranges the elements in the array in such a way that value of the <add> Rearranges the elements in the array in such a way that the value of the <ide> element in kth position is in the position it would be in a sorted array. <ide> All elements smaller than the kth element are moved before this element and <ide> all equal or greater are moved behind it. The ordering of the elements in <ide> def luf(lamdaexpr, *args, **kwargs): <ide> Element index to partition by. The kth element value will be in its <ide> final sorted position and all smaller elements will be moved before it <ide> and all equal or greater elements behind it. <del> The order all elements in the partitions is undefined. <add> The order of all elements in the partitions is undefined. <ide> If provided with a sequence of kth it will partition all elements <ide> indexed by kth of them into their sorted position at once. <ide> axis : int, optional <ide> def luf(lamdaexpr, *args, **kwargs): <ide> Selection algorithm. Default is 'introselect'. <ide> order : str or list of str, optional <ide> When `a` is an array with fields defined, this argument specifies <del> which fields to compare first, second, etc. A single field can <del> be specified as a string, and not all fields need be specified, <add> which fields to compare first, second, etc. A single field can <add> be specified as a string, and not all fields need to be specified, <ide> but unspecified fields will still be used, in the order in which <ide> they come up in the dtype, to break ties. <ide>
1
Text
Text
remove duplicated line
f585eee125c36c200edfc470377ea3ab747d9cff
<ide><path>docs/api-guide/serializers.md <ide> Here's an example of how you might choose to implement multiple updates: <ide> # We need to identify elements in the list using their primary key, <ide> # so use a writable field here, rather than the default which would be read-only. <ide> id = serializers.IntegerField() <del> <ide> ... <del> id = serializers.IntegerField(required=False) <ide> <ide> class Meta: <ide> list_serializer_class = BookListSerializer
1
Python
Python
make tests to clean temp files properly
1bb5bb5529d78ba95e76c802544f8b6efa84ec33
<ide><path>numpy/core/tests/test_memmap.py <ide> def setUp(self): <ide> self.data = arange(12, dtype=self.dtype) <ide> self.data.resize(self.shape) <ide> <add> def tearDown(self): <add> self.tmpfp.close() <add> <ide> def test_roundtrip(self): <ide> # Write data to file <ide> fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+', <ide><path>numpy/core/tests/test_multiarray.py <ide> import tempfile <ide> import sys <add>import os <ide> import numpy as np <ide> from numpy.testing import * <ide> from numpy.core import * <ide> def test_file(self): <ide> tmp_file.flush() <ide> y = np.fromfile(tmp_file.name,dtype=self.dtype) <ide> assert_array_equal(y,self.x.flat) <add> tmp_file.close() <ide> <ide> def test_filename(self): <ide> filename = tempfile.mktemp() <ide> def test_filename(self): <ide> f.close() <ide> y = np.fromfile(filename,dtype=self.dtype) <ide> assert_array_equal(y,self.x.flat) <add> os.unlink(filename) <ide> <ide> def test_malformed(self): <ide> filename = tempfile.mktemp() <ide> def test_malformed(self): <ide> f.close() <ide> y = np.fromfile(filename, sep=' ') <ide> assert_array_equal(y, [1.234, 1.]) <add> os.unlink(filename) <ide> <ide> class TestFromBuffer(TestCase): <ide> def tst_basic(self,buffer,expected,kwargs):
2
PHP
PHP
fix whitespace errors
c6d62884c165656e5cdac096bc76df665851e2f4
<ide><path>lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php <ide> * @package Cake.Test.Case.TestSuite <ide> */ <ide> if (!class_exists('AppController', false)) { <del> /** <del> * AppController class <del> * <del> * @package Cake.Test.Case.TestSuite <del> */ <add>/** <add> * AppController class <add> * <add> * @package Cake.Test.Case.TestSuite <add> */ <ide> class AppController extends Controller { <ide> <ide> /**
1
PHP
PHP
add datetimeimmutable as valid date to model.php
8499b3a9774729bc1ebb3058f8c7c8a98d8e647d
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> protected function asDateTime($value) <ide> if ($value instanceof DateTime) { <ide> return Carbon::instance($value); <ide> } <add> <add> // If the value is a DateTimeImmutable instance, also skip the rest of these <add> // checks. Just return the DateTimeImmutable right away. <add> if($value instanceof DateTimeImmutable) { <add> return new Carbon($value->format('Y-m-d H:i:s.u'), $value->getTimeZone()); <add> } <ide> <ide> // If this value is an integer, we will assume it is a UNIX timestamp's value <ide> // and format a Carbon object from this timestamp. This allows flexibility
1
Ruby
Ruby
delegate delete_all to relation
f216fadc0e4a54d1807fe5a9462f7bd34e9024b0
<ide><path>activerecord/lib/active_record/base.rb <ide> def colorize_logging(*args) <ide> end <ide> alias :colorize_logging= :colorize_logging <ide> <del> delegate :find, :first, :last, :all, :destroy, :destroy_all, :exists?, :delete, :to => :scoped <add> delegate :find, :first, :last, :all, :destroy, :destroy_all, :exists?, :delete, :delete_all, :to => :scoped <ide> delegate :select, :group, :order, :limit, :joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly, :having, :to => :scoped <ide> delegate :count, :average, :minimum, :maximum, :sum, :calculate, :to => :scoped <ide> <ide> def update_all(updates, conditions = nil, options = {}) <ide> relation.update(sanitize_sql_for_assignment(updates)) <ide> end <ide> <del> # Deletes the records matching +conditions+ without instantiating the records first, and hence not <del> # calling the +destroy+ method nor invoking callbacks. This is a single SQL DELETE statement that <del> # goes straight to the database, much more efficient than +destroy_all+. Be careful with relations <del> # though, in particular <tt>:dependent</tt> rules defined on associations are not honored. Returns <del> # the number of rows affected. <del> # <del> # ==== Parameters <del> # <del> # * +conditions+ - Conditions are specified the same way as with +find+ method. <del> # <del> # ==== Example <del> # <del> # Post.delete_all("person_id = 5 AND (category = 'Something' OR category = 'Else')") <del> # Post.delete_all(["person_id = ? AND (category = ? OR category = ?)", 5, 'Something', 'Else']) <del> # <del> # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent <del> # associations or call your <tt>before_*</tt> or +after_destroy+ callbacks, use the +destroy_all+ method instead. <del> def delete_all(conditions = nil) <del> where(conditions).delete_all <del> end <del> <ide> # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part. <ide> # The use of this method should be restricted to complicated SQL queries that can't be executed <ide> # using the ActiveRecord::Calculations class methods. Look into those before using this. <ide><path>activerecord/lib/active_record/relation.rb <ide> def destroy(id) <ide> end <ide> end <ide> <del> def delete_all <del> arel.delete.tap { reset } <add> # Deletes the records matching +conditions+ without instantiating the records first, and hence not <add> # calling the +destroy+ method nor invoking callbacks. This is a single SQL DELETE statement that <add> # goes straight to the database, much more efficient than +destroy_all+. Be careful with relations <add> # though, in particular <tt>:dependent</tt> rules defined on associations are not honored. Returns <add> # the number of rows affected. <add> # <add> # ==== Parameters <add> # <add> # * +conditions+ - Conditions are specified the same way as with +find+ method. <add> # <add> # ==== Example <add> # <add> # Post.delete_all("person_id = 5 AND (category = 'Something' OR category = 'Else')") <add> # Post.delete_all(["person_id = ? AND (category = ? OR category = ?)", 5, 'Something', 'Else']) <add> # <add> # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent <add> # associations or call your <tt>before_*</tt> or +after_destroy+ callbacks, use the +destroy_all+ method instead. <add> def delete_all(conditions = nil) <add> conditions ? where(conditions).delete_all : arel.delete.tap { reset } <ide> end <ide> <ide> # Deletes the row with a primary key matching the +id+ argument, using a
2
PHP
PHP
fix incorrect paramerter name in docblock
a039b0c627dc26d3b132e5ab56bd288b23806f65
<ide><path>src/Illuminate/Validation/Concerns/FormatsMessages.php <ide> protected function replaceAttributePlaceholder($message, $value) <ide> * Replace the :input placeholder in the given message. <ide> * <ide> * @param string $message <del> * @param string $value <add> * @param string $attribute <ide> * @return string <ide> */ <ide> protected function replaceInputPlaceholder($message, $attribute)
1
Text
Text
clarify `button_to` helper changes in rails 7.0
f52a6f49822e6ab5894486890005843fad799126
<ide><path>guides/source/7_0_release_notes.md <ide> Please refer to the [Changelog][action-view] for detailed changes. <ide> <ide> ### Notable changes <ide> <add>* `button_to` infers HTTP verb [method] from an Active Record object if object is used to build URL <add> <add> ```ruby <add> button_to("Do a POST", [:do_post_action, Workshop.find(1)]) <add> # Before <add> #=> <input type="hidden" name="_method" value="post" autocomplete="off" /> <add> # After <add> #=> <input type="hidden" name="_method" value="patch" autocomplete="off" /> <add> <ide> Action Mailer <ide> ------------- <ide> <ide><path>guides/source/upgrading_ruby_on_rails.md <ide> Upgrading from Rails 7.0 to Rails 7.1 <ide> Upgrading from Rails 6.1 to Rails 7.0 <ide> ------------------------------------- <ide> <add>### `ActionView::Helpers::UrlHelper#button_to` changed behavior <add> <add>Starting from Rails 7.0 `button_to` renders a `form` tag with `patch` HTTP verb if a persisted Active Record object is used to build button URL. <add>To keep current behavior consider explicitly passing `method:` option: <add> <add>```diff <add>-button_to("Do a POST", [:my_custom_post_action_on_workshop, Workshop.find(1)]) <add>+button_to("Do a POST", [:my_custom_post_action_on_workshop, Workshop.find(1)], method: :post) <add>``` <add> <add>or using helper to build the URL: <add> <add>```diff <add>-button_to("Do a POST", [:my_custom_post_action_on_workshop, Workshop.find(1)]) <add>+button_to("Do a POST", my_custom_post_action_on_workshop_workshop_path(Workshop.find(1))) <add>``` <add> <ide> ### Spring <ide> <ide> If your application uses Spring, it needs to be upgraded to at least version 3.0.0. Otherwise you'll get
2
Javascript
Javascript
highlight the $templatecache service
1c3bbada27f2f628a431e1ce9e8f5024a29eba20
<ide><path>src/ng/cacheFactory.js <ide> function $CacheFactoryProvider() { <ide> * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE, <ide> * element with ng-app attribute), otherwise the template will be ignored. <ide> * <del> * Adding via the $templateCache service: <add> * Adding via the `$templateCache` service: <ide> * <ide> * ```js <ide> * var myApp = angular.module('myApp', []);
1
Python
Python
fix impersonation issue with localtaskjob
feea38057ae16b5c09dfdda19552a5e75c01a2dd
<ide><path>airflow/jobs/local_task_job.py <ide> import signal <ide> from typing import Optional <ide> <add>import psutil <ide> from sqlalchemy.exc import OperationalError <ide> <ide> from airflow.configuration import conf <ide> def heartbeat_callback(self, session=None): <ide> fqdn, <ide> ) <ide> raise AirflowException("Hostname of job runner does not match") <del> <ide> current_pid = self.task_runner.process.pid <ide> same_process = ti.pid == current_pid <add> if ti.run_as_user: <add> same_process = psutil.Process(ti.pid).ppid() == current_pid <ide> if ti.pid is not None and not same_process: <ide> self.log.warning("Recorded pid %s does not match " "the current pid %s", ti.pid, current_pid) <ide> raise AirflowException("PID of job runner does not match") <ide><path>tests/jobs/test_local_task_job.py <ide> def test_localtaskjob_heartbeat(self): <ide> with pytest.raises(AirflowException): <ide> job1.heartbeat_callback() <ide> <add> @mock.patch('airflow.jobs.local_task_job.psutil') <add> def test_localtaskjob_heartbeat_with_run_as_user(self, psutil_mock): <add> session = settings.Session() <add> dag = DAG('test_localtaskjob_heartbeat', start_date=DEFAULT_DATE, default_args={'owner': 'owner1'}) <add> <add> with dag: <add> op1 = DummyOperator(task_id='op1', run_as_user='myuser') <add> <add> dag.clear() <add> dr = dag.create_dagrun( <add> run_id="test", <add> state=State.SUCCESS, <add> execution_date=DEFAULT_DATE, <add> start_date=DEFAULT_DATE, <add> session=session, <add> ) <add> <add> ti = dr.get_task_instance(task_id=op1.task_id, session=session) <add> ti.state = State.RUNNING <add> ti.pid = 2 <add> ti.hostname = get_hostname() <add> session.commit() <add> <add> job1 = LocalTaskJob(task_instance=ti, ignore_ti_state=True, executor=SequentialExecutor()) <add> ti.task = op1 <add> ti.refresh_from_task(op1) <add> job1.task_runner = StandardTaskRunner(job1) <add> job1.task_runner.process = mock.Mock() <add> job1.task_runner.process.pid = 2 <add> # Here, ti.pid is 2, the parent process of ti.pid is a mock(different). <add> # And task_runner process is 2. Should fail <add> with pytest.raises(AirflowException, match='PID of job runner does not match'): <add> job1.heartbeat_callback() <add> <add> job1.task_runner.process.pid = 1 <add> # We make the parent process of ti.pid to equal the task_runner process id <add> psutil_mock.Process.return_value.ppid.return_value = 1 <add> ti.state = State.RUNNING <add> ti.pid = 2 <add> # The task_runner process id is 1, same as the parent process of ti.pid <add> # as seen above <add> assert ti.run_as_user <add> session.merge(ti) <add> session.commit() <add> job1.heartbeat_callback(session=None) <add> <add> # Here the task_runner process id is changed to 2 <add> # while parent process of ti.pid is kept at 1, which is different <add> job1.task_runner.process.pid = 2 <add> with pytest.raises(AirflowException, match='PID of job runner does not match'): <add> job1.heartbeat_callback() <add> <ide> def test_heartbeat_failed_fast(self): <ide> """ <ide> Test that task heartbeat will sleep when it fails fast
2