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
PHP
PHP
extract credentials retrieval to method
549bd4aa94c2dddbeb74630ffb5b8ddd4f4d7fbd
<ide><path>src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php <ide> public function postLogin(Request $request) <ide> 'email' => 'required|email', 'password' => 'required', <ide> ]); <ide> <del> $credentials = $request->only('email', 'password'); <add> $credentials = $this->getCredentials($request); <ide> <ide> if (Auth::attempt($credentials, $request->has('remember'))) <ide> { <ide> protected function getFailedLoginMessage() <ide> { <ide> return 'These credentials do not match our records.'; <ide> } <add> <add> /** <add> * Get needed for authorization credentials from request <add> * <add> * @param Request $request <add> * <add> * @return array <add> */ <add> protected function getCredentials(Request $request) <add> { <add> return $request->only('email', 'password'); <add> } <ide> <ide> /** <ide> * Log the user out of the application.
1
Text
Text
add section on apm unlink to debugging doc
f9e28af59b860ab01939db68778a2a51bd5f87c8
<ide><path>docs/debugging.md <ide> Atom provides several tools to help you understand unexpected behavior and debug problems. This guide describes some of those tools and a few approaches to help you debug and provide more helpful information when [submitting issues]: <ide> <ide> * [Update to the latest version](#update-to-the-latest-version) <del>* [Check Atom and package settings](#check-atom-and-package-settings) <add>* [Check for linked packages](#check-for-linked-packages) <add>* [Check Atom and package settings](#check-atom-and-package-settings) <ide> * [Check the keybindings](#check-the-keybindings) <ide> * [Check if the problem shows up in safe mode](#check-if-the-problem-shows-up-in-safe-mode) <ide> * [Check your config files](#check-your-config-files) <ide> $ atom --version <ide> <ide> Head on over to the [list of releases][atom releases] and see if there's a more recent release. You can update to the most recent release by downloading Atom from the releases page, or with the in-app auto-updater. The in-app auto-updater checks for and downloads a new version after you restart Atom, or if you use the Atom > Check for Update menu option. <ide> <add>## Check for linked packages <add> <add>If you develop or contribute to Atom packages, there may be left-over packages linked to your `~/.atom/packages` or `~/.atom/dev/packages` directories. You can use: <add> <add>```shell <add>$ apm links <add>``` <add> <add>to list all linked development packages. You can remove the links using the `apm unlink` command. See `apm unlink --help` for details. <add> <ide> ## Check Atom and package settings <ide> <ide> In some cases, unexpected behavior might be caused by misconfigured or unconfigured settings in Atom or in one of the packages.
1
Java
Java
avoid collection lookups in stompcommand
899ebd8ee2e7acdc6bc0296d0c0db332cc4b43a5
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompCommand.java <ide> <ide> package org.springframework.messaging.simp.stomp; <ide> <del>import java.util.Arrays; <del>import java.util.Collection; <del>import java.util.HashMap; <del>import java.util.Map; <del> <ide> import org.springframework.messaging.simp.SimpMessageType; <ide> <ide> /** <ide> * Represents a STOMP command. <ide> * <ide> * @author Rossen Stoyanchev <add> * @author Juergen Hoeller <ide> * @since 4.0 <ide> */ <ide> public enum StompCommand { <ide> <ide> // client <del> CONNECT, <del> STOMP, <del> DISCONNECT, <del> SUBSCRIBE, <del> UNSUBSCRIBE, <del> SEND, <del> ACK, <del> NACK, <del> BEGIN, <del> COMMIT, <del> ABORT, <add> STOMP(SimpMessageType.CONNECT), <add> CONNECT(SimpMessageType.CONNECT), <add> DISCONNECT(SimpMessageType.DISCONNECT), <add> SUBSCRIBE(SimpMessageType.SUBSCRIBE, true, true, false), <add> UNSUBSCRIBE(SimpMessageType.UNSUBSCRIBE, false, true, false), <add> SEND(SimpMessageType.MESSAGE, true, false, true), <add> ACK(SimpMessageType.OTHER), <add> NACK(SimpMessageType.OTHER), <add> BEGIN(SimpMessageType.OTHER), <add> COMMIT(SimpMessageType.OTHER), <add> ABORT(SimpMessageType.OTHER), <ide> <ide> // server <del> CONNECTED, <del> MESSAGE, <del> RECEIPT, <del> ERROR; <del> <del> <del> private static Map<StompCommand, SimpMessageType> messageTypes = new HashMap<>(); <del> static { <del> messageTypes.put(StompCommand.CONNECT, SimpMessageType.CONNECT); <del> messageTypes.put(StompCommand.STOMP, SimpMessageType.CONNECT); <del> messageTypes.put(StompCommand.SEND, SimpMessageType.MESSAGE); <del> messageTypes.put(StompCommand.MESSAGE, SimpMessageType.MESSAGE); <del> messageTypes.put(StompCommand.SUBSCRIBE, SimpMessageType.SUBSCRIBE); <del> messageTypes.put(StompCommand.UNSUBSCRIBE, SimpMessageType.UNSUBSCRIBE); <del> messageTypes.put(StompCommand.DISCONNECT, SimpMessageType.DISCONNECT); <del> } <add> CONNECTED(SimpMessageType.OTHER), <add> RECEIPT(SimpMessageType.OTHER), <add> MESSAGE(SimpMessageType.MESSAGE, true, true, true), <add> ERROR(SimpMessageType.OTHER, false, false, true); <add> <ide> <del> private static Collection<StompCommand> destinationRequired = Arrays.asList(SEND, SUBSCRIBE, MESSAGE); <del> private static Collection<StompCommand> subscriptionIdRequired = Arrays.asList(SUBSCRIBE, UNSUBSCRIBE, MESSAGE); <del> private static Collection<StompCommand> contentLengthRequired = Arrays.asList(SEND, MESSAGE, ERROR); <del> private static Collection<StompCommand> bodyAllowed = Arrays.asList(SEND, MESSAGE, ERROR); <add> private final SimpMessageType messageType; <ide> <add> private final boolean destination; <add> <add> private final boolean subscriptionId; <add> <add> private final boolean body; <add> <add> <add> StompCommand(SimpMessageType messageType) { <add> this(messageType, false, false, false); <add> } <add> <add> StompCommand(SimpMessageType messageType, boolean destination, boolean subscriptionId, boolean body) { <add> this.messageType = messageType; <add> this.destination = destination; <add> this.subscriptionId = subscriptionId; <add> this.body = body; <add> } <ide> <ide> <ide> public SimpMessageType getMessageType() { <del> SimpMessageType type = messageTypes.get(this); <del> return (type != null) ? type : SimpMessageType.OTHER; <add> return this.messageType; <ide> } <ide> <ide> public boolean requiresDestination() { <del> return destinationRequired.contains(this); <add> return this.destination; <ide> } <ide> <ide> public boolean requiresSubscriptionId() { <del> return subscriptionIdRequired.contains(this); <add> return this.subscriptionId; <ide> } <ide> <ide> public boolean requiresContentLength() { <del> return contentLengthRequired.contains(this); <add> return this.body; <ide> } <ide> <ide> public boolean isBodyAllowed() { <del> return bodyAllowed.contains(this); <add> return this.body; <ide> } <ide> <ide> } <del> <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompCommandTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.messaging.simp.stomp; <add> <add>import java.util.Arrays; <add>import java.util.Collection; <add>import java.util.EnumMap; <add>import java.util.Map; <add> <add>import org.junit.Test; <add> <add>import org.springframework.messaging.simp.SimpMessageType; <add> <add>import static org.junit.Assert.*; <add> <add>/** <add> * @author Juergen Hoeller <add> */ <add>public class StompCommandTests { <add> <add> private static final Collection<StompCommand> destinationRequired = <add> Arrays.asList(StompCommand.SEND, StompCommand.SUBSCRIBE, StompCommand.MESSAGE); <add> <add> private static final Collection<StompCommand> subscriptionIdRequired = <add> Arrays.asList(StompCommand.SUBSCRIBE, StompCommand.UNSUBSCRIBE, StompCommand.MESSAGE); <add> <add> private static final Collection<StompCommand> contentLengthRequired = <add> Arrays.asList(StompCommand.SEND, StompCommand.MESSAGE, StompCommand.ERROR); <add> <add> private static final Collection<StompCommand> bodyAllowed = <add> Arrays.asList(StompCommand.SEND, StompCommand.MESSAGE, StompCommand.ERROR); <add> <add> private static final Map<StompCommand, SimpMessageType> messageTypes = <add> new EnumMap<>(StompCommand.class); <add> <add> static { <add> messageTypes.put(StompCommand.STOMP, SimpMessageType.CONNECT); <add> messageTypes.put(StompCommand.CONNECT, SimpMessageType.CONNECT); <add> messageTypes.put(StompCommand.DISCONNECT, SimpMessageType.DISCONNECT); <add> messageTypes.put(StompCommand.SUBSCRIBE, SimpMessageType.SUBSCRIBE); <add> messageTypes.put(StompCommand.UNSUBSCRIBE, SimpMessageType.UNSUBSCRIBE); <add> messageTypes.put(StompCommand.SEND, SimpMessageType.MESSAGE); <add> messageTypes.put(StompCommand.MESSAGE, SimpMessageType.MESSAGE); <add> } <add> <add> <add> @Test <add> public void getMessageType() throws Exception { <add> for (StompCommand stompCommand : StompCommand.values()) { <add> SimpMessageType simp = messageTypes.get(stompCommand); <add> if (simp == null) { <add> simp = SimpMessageType.OTHER; <add> } <add> assertSame(simp, stompCommand.getMessageType()); <add> } <add> } <add> <add> @Test <add> public void requiresDestination() throws Exception { <add> for (StompCommand stompCommand : StompCommand.values()) { <add> assertEquals(destinationRequired.contains(stompCommand), stompCommand.requiresDestination()); <add> } <add> } <add> <add> @Test <add> public void requiresSubscriptionId() throws Exception { <add> for (StompCommand stompCommand : StompCommand.values()) { <add> assertEquals(subscriptionIdRequired.contains(stompCommand), stompCommand.requiresSubscriptionId()); <add> } <add> } <add> <add> @Test <add> public void requiresContentLength() throws Exception { <add> for (StompCommand stompCommand : StompCommand.values()) { <add> assertEquals(contentLengthRequired.contains(stompCommand), stompCommand.requiresContentLength()); <add> } <add> } <add> <add> @Test <add> public void isBodyAllowed() throws Exception { <add> for (StompCommand stompCommand : StompCommand.values()) { <add> assertEquals(bodyAllowed.contains(stompCommand), stompCommand.isBodyAllowed()); <add> } <add> } <add> <add>}
2
PHP
PHP
add every2/3/4minutes to scheduler
5c841b38b6f93345d976c1c756be1d9c2790e955
<ide><path>src/Illuminate/Console/Scheduling/ManagesFrequencies.php <ide> public function everyMinute() <ide> return $this->spliceIntoPosition(1, '*'); <ide> } <ide> <add> /** <add> * Schedule the event to run every two minutes. <add> * <add> * @return $this <add> */ <add> public function everyTwoMinutes() <add> { <add> return $this->spliceIntoPosition(1, '*/2'); <add> } <add> <add> /** <add> * Schedule the event to run every three minutes. <add> * <add> * @return $this <add> */ <add> public function everyThreeMinutes() <add> { <add> return $this->spliceIntoPosition(1, '*/3'); <add> } <add> <add> /** <add> * Schedule the event to run every four minutes. <add> * <add> * @return $this <add> */ <add> public function everyFourMinutes() <add> { <add> return $this->spliceIntoPosition(1, '*/4'); <add> } <add> <ide> /** <ide> * Schedule the event to run every five minutes. <ide> * <ide><path>tests/Console/Scheduling/FrequencyTest.php <ide> public function testEveryMinute() <ide> $this->assertSame('* * * * *', $this->event->everyMinute()->getExpression()); <ide> } <ide> <del> public function testEveryFiveMinutes() <add> public function testEveryXMinutes() <ide> { <add> $this->assertSame('*/2 * * * *', $this->event->everyTwoMinutes()->getExpression()); <add> $this->assertSame('*/3 * * * *', $this->event->everyThreeMinutes()->getExpression()); <add> $this->assertSame('*/4 * * * *', $this->event->everyFourMinutes()->getExpression()); <ide> $this->assertSame('*/5 * * * *', $this->event->everyFiveMinutes()->getExpression()); <ide> } <ide>
2
Text
Text
remove extra whitespace
80bdf73929b4531482631ff3ac766af09873a9ef
<ide><path>errors/invalid-getstaticpaths-value.md <ide> export async function unstable_getStaticProps() { <ide> } <ide> } <ide> ``` <del>
1
Python
Python
add max fenwick tree
f46ce47274e89ab52581b56fec0aefa0e844dfa7
<ide><path>data_structures/binary_tree/maximum_fenwick_tree.py <add>class MaxFenwickTree: <add> """ <add> Maximum Fenwick Tree <add> <add> More info: https://cp-algorithms.com/data_structures/fenwick.html <add> --------- <add> >>> ft = MaxFenwickTree(5) <add> >>> ft.query(0, 5) <add> 0 <add> >>> ft.update(4, 100) <add> >>> ft.query(0, 5) <add> 100 <add> >>> ft.update(4, 0) <add> >>> ft.update(2, 20) <add> >>> ft.query(0, 5) <add> 20 <add> >>> ft.update(4, 10) <add> >>> ft.query(2, 5) <add> 10 <add> >>> ft.query(1, 5) <add> 20 <add> >>> ft.update(2, 0) <add> >>> ft.query(0, 5) <add> 10 <add> >>> ft = MaxFenwickTree(10000) <add> >>> ft.update(255, 30) <add> >>> ft.query(0, 10000) <add> 30 <add> """ <add> <add> def __init__(self, size: int) -> None: <add> """ <add> Create empty Maximum Fenwick Tree with specified size <add> <add> Parameters: <add> size: size of Array <add> <add> Returns: <add> None <add> """ <add> self.size = size <add> self.arr = [0] * size <add> self.tree = [0] * size <add> <add> @staticmethod <add> def get_next(index: int) -> int: <add> """ <add> Get next index in O(1) <add> """ <add> return index + (index & -index) <add> <add> @staticmethod <add> def get_prev(index: int) -> int: <add> """ <add> Get previous index in O(1) <add> """ <add> return index - (index & -index) <add> <add> def update(self, index: int, value: int) -> None: <add> """ <add> Set index to value in O(lg^2 N) <add> <add> Parameters: <add> index: index to update <add> value: value to set <add> <add> Returns: <add> None <add> """ <add> self.arr[index] = value <add> while index < self.size: <add> self.tree[index] = max(value, self.query(self.get_prev(index), index)) <add> index = self.get_next(index) <add> <add> def query(self, left: int, right: int) -> int: <add> """ <add> Answer the query of maximum range [l, r) in O(lg^2 N) <add> <add> Parameters: <add> left: left index of query range (inclusive) <add> right: right index of query range (exclusive) <add> <add> Returns: <add> Maximum value of range [left, right) <add> """ <add> right -= 1 # Because of right is exclusive <add> result = 0 <add> while left < right: <add> current_left = self.get_prev(right) <add> if left < current_left: <add> result = max(result, self.tree[right]) <add> right = current_left <add> else: <add> result = max(result, self.arr[right]) <add> right -= 1 <add> return result <add> <add> <add>if __name__ == "__main__": <add> import doctest <add> <add> doctest.testmod()
1
PHP
PHP
clean _original on entity clean()
b3b6859b926fc70a755d3a6d6a3b18be1442215c
<ide><path>src/Datasource/EntityTrait.php <ide> public function clean() <ide> $this->_dirty = []; <ide> $this->_errors = []; <ide> $this->_invalid = []; <add> $this->_original = []; <ide> } <ide> <ide> /**
1
Text
Text
restructure ecosystem page
3e74e002a39217dd40e9b4362eca903779b227f0
<ide><path>docs/README.md <ide> * [Core Concepts](/docs/introduction/CoreConcepts.md) <ide> * [Three Principles](/docs/introduction/ThreePrinciples.md) <ide> * [Prior Art](/docs/introduction/PriorArt.md) <add> * [Learning Resources](/docs/introduction/LearningResources.md) <ide> * [Ecosystem](/docs/introduction/Ecosystem.md) <ide> * [Examples](/docs/introduction/Examples.md) <ide> * [Basics](/docs/basics/README.md) <ide><path>docs/introduction/Ecosystem.md <ide> # Ecosystem <ide> <del>Redux is a tiny library, but its contracts and APIs are carefully chosen to spawn an ecosystem of tools and extensions. <del> <del>For an extensive list of everything related to Redux, we recommend [Awesome Redux](https://github.com/xgrommx/awesome-redux). It contains examples, boilerplates, middleware, utility libraries, and more. [React/Redux Links](https://github.com/markerikson/react-redux-links) contains tutorials and other useful resources for anyone learning React or Redux, and [Redux Ecosystem Links](https://github.com/markerikson/redux-ecosystem-links) lists many Redux-related libraries and addons. <del> <del>On this page we will only feature a few of them that the Redux maintainers have vetted personally. Don't let this discourage you from trying the rest of them! The ecosystem is growing too fast, and we have a limited time to look at everything. Consider these the “staff picks”, and don't hesitate to submit a PR if you've built something wonderful with Redux. <del> <del>## Learning Redux <del> <del>### Screencasts <del> <del>* **[Getting Started with Redux](https://egghead.io/series/getting-started-with-redux)** — Learn the basics of Redux directly from its creator (30 free videos) <del>* **[Learn Redux](https://learnredux.com)** — Build a simple photo app that will simplify the core ideas behind Redux, React Router and React.js <del> <del>### Example Apps <del> <del>* [Official Examples](Examples.md) — A few official examples covering different Redux techniques <del>* [SoundRedux](https://github.com/andrewngu/sound-redux) — A SoundCloud client built with Redux <del>* [grafgiti](https://github.com/mohebifar/grafgiti) — Create graffiti on your GitHub contributions wall <del>* [React-lego](https://github.com/peter-mouland/react-lego) — How to plug into React, one block at a time. <del> <del>### Tutorials and Articles <del> <del>* [Redux Tutorial](https://github.com/happypoulp/redux-tutorial) <del>* [Redux Egghead Course Notes](https://github.com/tayiorbeii/egghead.io_redux_course_notes) <del>* [Integrating Data with React Native](http://makeitopen.com/docs/en/1-3-data.html) <del>* [What the Flux?! Let's Redux.](https://blog.andyet.com/2015/08/06/what-the-flux-lets-redux) <del>* [Leveling Up with React: Redux](https://css-tricks.com/learning-react-redux/) <del>* [A cartoon intro to Redux](https://code-cartoons.com/a-cartoon-intro-to-redux-3afb775501a6) <del>* [Understanding Redux](http://www.youhavetolearncomputers.com/blog/2015/9/15/a-conceptual-overview-of-redux-or-how-i-fell-in-love-with-a-javascript-state-container) <del>* [Handcrafting an Isomorphic Redux Application (With Love)](https://medium.com/@bananaoomarang/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4) <del>* [Full-Stack Redux Tutorial](http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html) <del>* [Getting Started with React, Redux, and Immutable](http://www.theodo.fr/blog/2016/03/getting-started-with-react-redux-and-immutable-a-test-driven-tutorial-part-2/) <del>* [Secure Your React and Redux App with JWT Authentication](https://auth0.com/blog/2016/01/04/secure-your-react-and-redux-app-with-jwt-authentication/) <del>* [Understanding Redux Middleware](https://medium.com/@meagle/understanding-87566abcfb7a) <del>* [Angular 2 — Introduction to Redux](https://medium.com/google-developer-experts/angular-2-introduction-to-redux-1cf18af27e6e) <del>* [Apollo Client: GraphQL with React and Redux](https://medium.com/apollo-stack/apollo-client-graphql-with-react-and-redux-49b35d0f2641) <del>* [Using redux-saga To Simplify Your Growing React Native Codebase](https://shift.infinite.red/using-redux-saga-to-simplify-your-growing-react-native-codebase-2b8036f650de) <del>* [Build an Image Gallery Using Redux Saga](http://joelhooks.com/blog/2016/03/20/build-an-image-gallery-using-redux-saga) <del>* [Working with VK API (in Russian)](https://www.gitbook.com/book/maxfarseer/redux-course-ru/details) <del> <del>### Talks <del> <del>* [Live React: Hot Reloading and Time Travel](http://youtube.com/watch?v=xsSnOQynTHs) — See how constraints enforced by Redux make hot reloading with time travel easy <del>* [Cleaning the Tar: Using React within the Firefox Developer Tools](https://www.youtube.com/watch?v=qUlRpybs7_c) — Learn how to gradually migrate existing MVC applications to Redux <del>* [Redux: Simplifying Application State](https://www.youtube.com/watch?v=okdC5gcD-dM) — An intro to Redux architecture <del> <del>## Using Redux <del> <del>### Bindings <del> <del>* [react-redux](https://github.com/gaearon/react-redux) — React <del>* [ng-redux](https://github.com/wbuchwalter/ng-redux) — Angular <del>* [ng2-redux](https://github.com/wbuchwalter/ng2-redux) — Angular 2 <del>* [backbone-redux](https://github.com/redbooth/backbone-redux) — Backbone <del>* [redux-falcor](https://github.com/ekosz/redux-falcor) — Falcor <del>* [deku-redux](https://github.com/troch/deku-redux) — Deku <del>* [polymer-redux](https://github.com/tur-nr/polymer-redux) - Polymer <del>* [ember-redux](https://github.com/toranb/ember-redux) - Ember.js <del> <del>### Middleware <del> <del>* [redux-thunk](http://github.com/gaearon/redux-thunk) — The easiest way to write async action creators <del>* [redux-promise](https://github.com/acdlite/redux-promise) — [FSA](https://github.com/acdlite/flux-standard-action)-compliant promise middleware <del>* [redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware) — Redux middleware for fetching data with axios HTTP client <del>* [redux-observable](https://github.com/redux-observable/redux-observable/) — RxJS middleware for action side effects using "Epics" <del>* [redux-cycles](https://github.com/cyclejs-community/redux-cycles) — Handle Redux async actions using Cycle.js <del>* [redux-logger](https://github.com/fcomb/redux-logger) — Log every Redux action and the next state <del>* [redux-immutable-state-invariant](https://github.com/leoasis/redux-immutable-state-invariant) — Warns about state mutations in development <del>* [redux-unhandled-action](https://github.com/socialtables/redux-unhandled-action) — Warns about actions that produced no state changes in development <del>* [redux-analytics](https://github.com/markdalgleish/redux-analytics) — Analytics middleware for Redux <del>* [redux-gen](https://github.com/weo-edu/redux-gen) — Generator middleware for Redux <del>* [redux-saga](https://github.com/yelouafi/redux-saga) — An alternative side effect model for Redux apps <del>* [redux-action-tree](https://github.com/cerebral/redux-action-tree) — Composable Cerebral-style signals for Redux <del>* [apollo-client](https://github.com/apollostack/apollo-client) — A simple caching client for any GraphQL server and UI framework built on top of Redux <del> <del>### Routing <del> <del>* [react-router-redux](https://github.com/reactjs/react-router-redux) — Ruthlessly simple bindings to keep React Router and Redux in sync <del>* [redial](https://github.com/markdalgleish/redial) — Universal data fetching and route lifecycle management for React that works great with Redux <del>* [redux-little-router](https://github.com/FormidableLabs/redux-little-router) — A tiny router for Redux that lets the URL do the talking <del> <del>### Components <del> <del>* [redux-form](https://github.com/erikras/redux-form) — Keep React form state in Redux <del>* [react-redux-form](https://github.com/davidkpiano/react-redux-form) — Create forms easily in React with Redux <del>* [redux-resource](https://github.com/jmeas/redux-resource) — Manage remote resources with Redux <del> <del>### Enhancers <del> <del>* [redux-batched-subscribe](https://github.com/tappleby/redux-batched-subscribe) — Customize batching and debouncing calls to the store subscribers <del>* [redux-history-transitions](https://github.com/johanneslumpe/redux-history-transitions) — History transitions based on arbitrary actions <del>* [redux-optimist](https://github.com/ForbesLindesay/redux-optimist) — Optimistically apply actions that can be later committed or reverted <del>* [redux-optimistic-ui](https://github.com/mattkrick/redux-optimistic-ui) — A reducer enhancer to enable type-agnostic optimistic updates <del>* [redux-undo](https://github.com/omnidan/redux-undo) — Effortless undo/redo and action history for your reducers <del>* [redux-ignore](https://github.com/omnidan/redux-ignore) — Ignore redux actions by array or filter function <del>* [redux-recycle](https://github.com/omnidan/redux-recycle) — Reset the redux state on certain actions <del>* [redux-batched-actions](https://github.com/tshelburne/redux-batched-actions) — Dispatch several actions with a single subscriber notification <del>* [redux-search](https://github.com/treasure-data/redux-search) — Automatically index resources in a web worker and search them without blocking <del>* [redux-electron-store](https://github.com/samiskin/redux-electron-store) — Store enhancers that synchronize Redux stores across Electron processes <del>* [redux-loop](https://github.com/raisemarketplace/redux-loop) — Sequence effects purely and naturally by returning them from your reducers <del>* [redux-side-effects](https://github.com/salsita/redux-side-effects) — Utilize Generators for declarative yielding of side effects from your pure reducers <del> <del>### Utilities <del> <del>* [reselect](https://github.com/faassen/reselect) — Efficient derived data selectors inspired by NuclearJS <del>* [normalizr](https://github.com/paularmstrong/normalizr) — Normalize nested API responses for easier consumption by the reducers <del>* [redux-actions](https://github.com/acdlite/redux-actions) — Reduces the boilerplate in writing reducers and action creators <del>* [redux-act](https://github.com/pauldijou/redux-act) — An opinionated library for making reducers and action creators <del>* [redux-transducers](https://github.com/acdlite/redux-transducers) — Transducer utilities for Redux <del>* [redux-immutable](https://github.com/gajus/redux-immutable) — Used to create an equivalent function of Redux `combineReducers` that works with [Immutable.js](https://facebook.github.io/immutable-js/) state. <del>* [redux-tcomb](https://github.com/gcanti/redux-tcomb) — Immutable and type-checked state and actions for Redux <del>* [redux-mock-store](https://github.com/arnaudbenard/redux-mock-store) — Mock redux store for testing your app <del>* [redux-actions-assertions](https://github.com/dmitry-zaets/redux-actions-assertions) — Assertions for Redux actions testing <del>* [redux-bootstrap](https://github.com/remojansen/redux-bootstrap) — Bootstrapping function for Redux applications <del>* [redux-data-structures](https://redux-data-structures.js.org/) — Reducer factory (higher-order functions) for counters, maps, lists (queues, stacks), sets, etc. <del> <del>### DevTools <del> <del>* [Redux DevTools](http://github.com/gaearon/redux-devtools) — An action logger with time travel UI, hot reloading and error handling for the reducers, [first demoed at React Europe](https://www.youtube.com/watch?v=xsSnOQynTHs) <del>* [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension) — A Chrome extension wrapping Redux DevTools and providing additional functionality <del> <del>### DevTools Monitors <del> <del>* [Log Monitor](https://github.com/gaearon/redux-devtools-log-monitor) — The default monitor for Redux DevTools with a tree view <del>* [Dock Monitor](https://github.com/gaearon/redux-devtools-dock-monitor) — A resizable and movable dock for Redux DevTools monitors <del>* [Slider Monitor](https://github.com/calesce/redux-slider-monitor) — A custom monitor for Redux DevTools to replay recorded Redux actions <del>* [Inspector](https://github.com/alexkuz/redux-devtools-inspector) — A custom monitor for Redux DevTools that lets you filter actions, inspect diffs, and pin deep paths in the state to observe their changes <del>* [Diff Monitor](https://github.com/whetstone/redux-devtools-diff-monitor) — A monitor for Redux Devtools that diffs the Redux store mutations between actions <del>* [Filterable Log Monitor](https://github.com/bvaughn/redux-devtools-filterable-log-monitor/) — Filterable tree view monitor for Redux DevTools <del>* [Chart Monitor](https://github.com/romseguy/redux-devtools-chart-monitor) — A chart monitor for Redux DevTools <del>* [Filter Actions](https://github.com/zalmoxisus/redux-devtools-filter-actions) — Redux DevTools composable monitor with the ability to filter actions <del> <del> <del>### Community Conventions <del> <del>* [Flux Standard Action](https://github.com/acdlite/flux-standard-action) — A human-friendly standard for Flux action objects <del>* [Canonical Reducer Composition](https://github.com/gajus/canonical-reducer-composition) — An opinionated standard for nested reducer composition <del>* [Ducks: Redux Reducer Bundles](https://github.com/erikras/ducks-modular-redux) — A proposal for bundling reducers, action types and actions <del> <del>### Translations <del> <del>* [中文文档](http://camsong.github.io/redux-in-chinese/) — Chinese <del>* [繁體中文文件](https://github.com/chentsulin/redux) — Traditional Chinese <del>* [Redux in Russian](https://github.com/rajdee/redux-in-russian) — Russian <del>* [Redux en Español](http://es.redux.js.org/) - Spanish <del> <del>## More <del> <del>[Awesome Redux](https://github.com/xgrommx/awesome-redux) is an extensive list of Redux-related repositories. <del>[React-Redux Links](https://github.com/markerikson/react-redux-links) is a curated list of high-quality articles, tutorials, and related content for React, Redux, ES6, and more. <del>[Redux Ecosystem Links](https://github.com/markerikson/redux-ecosystem-links) is a categorized collection of Redux-related libraries, addons, and utilities. <add>Redux is a tiny library, but its contracts and APIs are carefully chosen to spawn an ecosystem of tools and extensions, and the community has created a wide variety of helpful addons, libraries, and tools. You don't need to use any of these addons to use Redux, but they can help make it easier to implement features and solve problems in your application. <add> <add>For an extensive catalog of libraries, addons, and tools related to Redux, check out the [Redux Ecosystem Links](https://github.com/markerikson/redux-ecosystem-links) list. Also, the [React/Redux Links](https://github.com/markerikson/react-redux-links) list contains tutorials and other useful resources for anyone learning React or Redux. <add> <add>This page lists some of the Redux-related addons that the Redux maintainers have vetted personally, or that have shown widespread adoption in the community. Don't let this discourage you from trying the rest of them! The ecosystem is growing too fast, and we have a limited time to look at everything. Consider these the “staff picks”, and don't hesitate to submit a PR if you've built something wonderful with Redux. <add> <add> <add>## Table of Contents <add> <add>- [Library Integration and Bindings](#library-integration-and-bindings) <add>- [Reducers](#reducers) <add> - [Reducer Combination](#reducer-combination) <add> - [Reducer Composition](#reducer-composition) <add> - [Higher-Order Reducers](#higher-order-reducers) <add>- [Actions](#actions) <add>- [Utilities](#utilities) <add>- [Store](#store) <add> - [Change Subscriptions](#change-subscriptions) <add> - [Batching](#batching) <add> - [Persistence](#persistence) <add>- [Immutable Data](#immutable-data) <add> - [Data Structures](#data-structures) <add> - [Immutable Update Utilities](#immutable-update-utilities) <add> - [Immutable/Redux Interop](#immutable-redux-interop) <add>- [Side Effects](#side-effects) <add> - [Widely Used](#widely-used) <add> - [Promises](#promises) <add>- [Middleware](#middleware) <add> - [Networks and Sockets](#networks-and-sockets) <add> - [Async Behavior](#async-behavior) <add> - [Analytics](#analytics) <add>- [Entities and Collections](#entities-and-collections) <add>- [Component State and Encapsulation](#component-state-and-encapsulation) <add>- [Dev Tools](#dev-tools) <add> - [Debuggers and Viewers](#debuggers-and-viewers) <add> - [Logging](#logging) <add> - [Mutation Detection](#mutation-detection) <add>- [Testing](#testing) <add>- [Routing](#routing) <add>- [Forms](#forms) <add>- [Higher-Level Abstractions](#higher-level-abstractions) <add>- [Community Conventions](#community-conventions) <add> <add> <add> <add>## Library Integration and Bindings <add> <add>**[reactjs/react-redux](https://github.com/reactjs/react-redux)** <add>The official React bindings for Redux, maintained by the Redux team <add> <add>**[angular-redux/ng-redux](https://github.com/angular-redux/ng-redux)** <add>Angular 1 bindings for Redux <add> <add>**[angular-redux/store](https://github.com/angular-redux/store)** <add>Angular 2+ bindings for Redux <add> <add>**[ember-redux/ember-redux](https://github.com/ember-redux/ember-redux)** <add>Ember bindings for Redux <add> <add>**[glimmer-redux/glimmer-redux](glimmer-redux/glimmer-redux)** <add>Redux bindings for Ember's Glimmer component engine <add> <add>**[revue/revue](https://github.com/revue/revue)** <add>Redux bindings for Vue <add> <add>**[tur-nr/polymer-redux](https://github.com/tur-nr/polymer-redux)** <add>Redux bindings for Polymer <add> <add> <add>## Reducers <add> <add>#### Reducer Combination <add> <add>**[ryo33/combineSectionReducers](https://github.com/ryo33/combine-section-reducers)** <add>An expanded version of `combineReducers`, which allows passing `state` as a third argument to all slice reducers. <add> <add>**[KodersLab/topologically-combine-reducers](https://github.com/KodersLab/topologically-combine-reducers)** <add>A `combineReducers` variation that allows defining cross-slice dependencies for ordering and data passing <add>```js <add>var masterReducer = topologicallyCombineReducers( <add> {auth, users, todos}, <add> // define the dependency tree <add> { auth: ['users'], todos: ['auth'] } <add>); <add>``` <add> <add>#### Reducer Composition <add> <add>**[acdlite/reduce-reducers](https://github.com/acdlite/reduce-reducers)** <add>Provides sequential composition of reducers at the same level <add>```js <add>const combinedReducer = combineReducers({users, posts, comments}); <add>const rootReducer = reduceReducers(combinedReducer, otherTopLevelFeatureReducer); <add>``` <add> <add>**[mhelmer/redux-xforms](https://github.com/mhelmer/redux-xforms)** <add>A collection of composable reducer transformers <add>```js <add>const createByFilter = (predicate, mapActionToKey) => compose( <add> withInitialState({}), // inject initial state as {} <add> withFilter(predicate), // let through if action has filterName <add> updateSlice(mapActionToKey), // update a single key in the state <add> isolateSlice(mapActionToKey) // run the reducer on a single state slice <add>) <add>``` <add> <add>**[adrienjt/redux-data-structures](https://github.com/adrienjt/redux-data-structures)** <add>Reducer factory functions for common data structures: counters, maps, lists (queues, stacks), sets <add>```js <add>const myCounter = counter({ <add> incrementActionTypes: ['INCREMENT'], <add> decrementActionTypes: ['DECREMENT'], <add>}); <add>``` <add> <add>#### Higher-Order Reducers <add> <add>**[omnidan/redux-undo](https://github.com/omnidan/redux-undo)** <add>Effortless undo/redo and action history for your reducers <add> <add>**[omnidan/redux-ignore](https://github.com/omnidan/redux-ignore)** <add>Ignore redux actions by array or filter function <add> <add>**[omnidan/redux-recycle](https://github.com/omnidan/redux-recycle)** <add>Reset the redux state on certain actions <add> <add>**[ForbesLindesay/redux-optimist](https://github.com/ForbesLindesay/redux-optimist)** <add>A reducer enhancer to enable type-agnostic optimistic updates <add> <add> <add>## Actions <add> <add>**[reduxactions/redux-actions](https://github.com/reduxactions/redux-actions)** <add>Flux Standard Action utilities for Redux <add>```js <add>const increment = createAction('INCREMENT'); <add>const reducer = handleActions({ [increment] : (state, action) => state + 1 }, 0); <add>const store = createStore(reducer); <add>store.dispatch(increment()); <add>``` <add> <add>**[BerkeleyTrue/redux-create-types](https://github.com/BerkeleyTrue/redux-create-types)** <add>Creates standard and async action types based on namespaces <add>```js <add>export const types = createTypes( [ 'openModal', createAsyncTypes('fetch') ], 'app'); <add>// { openModal : "app.openModal", fetch : { start : "app.fetch.start", complete: 'app.fetch.complete' } } <add>``` <add> <add>**[maxhallinan/kreighter](https://github.com/maxhallinan/kreighter)** <add>Generates action creators based on types and expected fields <add>```js <add>const formatTitle = (id, title) => ({ <add> id, title: toTitleCase(title), <add>}); <add>const updateBazTitle = fromType('UPDATE_BAZ_TITLE', formatTitle); <add>updateBazTitle(1, 'foo bar baz'); <add>// -> { type: 'UPDATE_BAZ_TITLE', id: 1, title: 'Foo Bar Baz', } <add>``` <add> <add> <add>## Utilities <add> <add>**[reactjs/reselect](https://github.com/reactjs/reselect)** <add>Creates composable memoized selector functions for efficiently deriving data from the store state <add>```js <add>const taxSelector = createSelector( <add> [subtotalSelector, taxPercentSelector], <add> (subtotal, taxPercent) => subtotal * (taxPercent / 100) <add>) <add>``` <add> <add>**[paularmstrong/normalizr](https://github.com/paularmstrong/normalizr)** <add>Normalizes nested JSON according to a schema <add>```js <add>const user = new schema.Entity('users'); <add>const comment = new schema.Entity('comments', { commenter: user}); <add>const article = new schema.Entity('articles', { author: user, comments: [ comment ] }); <add>const normalizedData = normalize(originalData, article); <add>``` <add> <add>**[planttheidea/selectorator](https://github.com/planttheidea/selectorator)** <add>Abstractions over Reselect for common selector use cases <add>```js <add>const getBarBaz = createSelector(['foo.bar', 'baz'], <add> (bar, baz) => `${bar} ${baz}` <add>); <add>getBarBaz({foo: {bar: 'a'}, baz: 'b'}); // "a b" <add>``` <add> <add> <add>## Store <add> <add>#### Change Subscriptions <add> <add>**[jprichardson/redux-watch](https://github.com/jprichardson/redux-watch)** <add>Watch for state changes based on key paths or selectors <add>```js <add>let w = watch(() => mySelector(store.getState()) ); <add>store.subscribe( w((newVal, oldVal) => { <add> console.log(newval, oldVal) <add>})) <add>``` <add> <add> <add>**[ashaffer/redux-subscribe](https://github.com/ashaffer/redux-subscribe)** <add>Centralized subscriptions to state changes based on paths <add>```js <add>store.dispatch( subscribe("users.byId.abcd", "subscription1", () => {} ); <add>``` <add> <add>#### Batching <add> <add>**[tappleby/redux-batched-subscribe](https://github.com/tappleby/redux-batched-subscribe)** <add>Store enhancer that can debounce subscription notifications <add>```js <add>const debounceNotify = _.debounce(notify => notify()); <add>const store = createStore(reducer, intialState, batchedSubscribe(debounceNotify)); <add>``` <add> <add>**[manaflair/redux-batch](https://github.com/manaflair/redux-batch)** <add>Store enhancer that allows dispatching arrays of actions <add>```js <add>const store = createStore(reducer, reduxBatch); <add>store.dispatch([ {type : "INCREMENT"}, {type : "INCREMENT"} ]); <add>``` <add> <add>**[laysent/redux-batch-actions-enhancer](https://github.com/laysent/redux-batch-actions-enhancer)** <add>Store enhancer that accepts batched actions <add>```js <add>const store = createStore(reducer, initialState, batch().enhancer); <add>store.dispatch(createAction({type : "INCREMENT"}, {type : "INCREMENT"})); <add>``` <add> <add>**[tshelburne/redux-batched-actions](https://github.com/tshelburne/redux-batched-actions)** <add>Higher-order reducer that handles batched actions <add>```js <add>const store = createStore(enableBatching(reducer), initialState) <add>store.dispatch(batchActions([ {type : "INCREMENT"}, {type : "INCREMENT"} ])) <add>``` <add> <add>#### Persistence <add> <add> <add>**[rt2zz/redux-persist]()** <add>Persist and rehydrate a Redux store, with many extensible options <add>```js <add>const store = createStore( reducer, autoRehydrate()); <add>persistStore(store); <add>``` <add> <add>**[react-stack/redux-storage]()** <add>Persistence layer for Redux with flexible backends <add>```js <add>const reducer = storage.reducer(combineReducers(reducers)); <add>const engine = createEngineLocalStorage('my-save-key'); <add>const storageMiddleware = storage.createMiddleware(engine); <add>const store = createStore(reducer, applyMiddleware(storageMiddleware)); <add>``` <add> <add>**[redux-offline/redux-offline]()** <add>Persistent store for Offline-First apps, with support for optimistic UIs <add>```js <add>const store = createStore(reducer, offline(offlineConfig)); <add>store.dispatch({ <add> type: 'FOLLOW_USER_REQUEST', <add> meta: { offline: { effect: { }, commit: { }, rollback: { } } } <add>}); <add>``` <add> <add> <add>## Immutable Data <add> <add>#### Data Structures <add> <add>**[facebook/immutable-js]()** <add>Immutable persistent data collections for Javascript <add>```js <add>const map1 = Map({ a: 1, b: 2, c: 3 }) <add>const map2 = map1.set('b', 50) <add>map1.get('b') // 2 <add>map2.get('b') // 50 <add>``` <add> <add>**[rtfeldman/seamless-immutable]()** <add>Frozen immutable arrays/objects, backwards-compatible with JS <add>```js <add>const array = Immutable(["totally", "immutable", {a : 42}]); <add>array[0] = "edited"; // does nothing <add>``` <add> <add>**[planttheidea/crio]()** <add>Immutable JS objects with a natural API <add>```js <add>const foo = crio(['foo']); <add>const fooBar = foo.push('bar'); // new array: ['foo', 'bar'] <add>``` <add> <add> <add>**[aearly/icepick]()** <add>Utilities for treating frozen JS objects as persistent immutable collections. <add>```js <add>const newObj = icepick.assocIn({c : {d : "bar" } }, ["c", "d"], "baz"); <add>const obj3 = icepicke.merge(obj1, obj2); <add>``` <add> <add>#### Immutable Update Utilities <add> <add>**[kolodny/immutability-helper]()** <add>A drop-in replacement for react-addons-update <add>```js <add>const newData = update(myData, { <add> x: {y: {z: {$set: 7}}}, <add> a: {b: {$push: [9]}} <add>}); <add>``` <add> <add>**[mariocasciaro/object-path-immutable]()** <add>Simpler alternative to immutability-helpers and Immutable.js <add>```js <add>const newObj = immutable(obj) <add> .set('a.b', 'f') <add> .del(['a', 'c', 0]) <add> .value() <add>``` <add> <add> <add> <add>**[debitoor/dot-prop-immutable]()** <add>Immutable version of the dot-prop lib, with some extensions <add>```js <add>const newState = dotProp.set(state, `todos.${index}.complete`, true) <add>const endOfArray = dotProp.get(obj, 'foo.$end') <add>``` <add> <add>**[hex13/transmutable]()** <add>Immutable updates with normal mutative code, using Proxies <add>```js <add>const copy = transform(foo, stage => { <add> stage.bar.baz = 123; <add>}); <add>``` <add> <add>#### Immutable/Redux Interop <add> <add>**[gajus/redux-immutable]()** <add>combineReducers equivalent that works with Immutable.js Maps <add>```js <add>const initialState = Immutable.Map(); <add>const rootReducer = combineReducers({}); <add>const store = createStore(rootReducer, initialState); <add>``` <add> <add>**[eadmundo/redux-seamless-immutable]()** <add>combineReducers equivalent that works with seamless-immutable values <add>```js <add>import { combineReducers } from 'redux-seamless-immutable'; <add>const rootReducer = combineReducers({ userReducer, posts <add>``` <add> <add> <add>## Side Effects <add> <add>#### Widely Used <add> <add>**[gaearon/redux-thunk](https://github.com/gaearon/redux-thunk)** <add>Dispatch functions, which are called and given `dispatch` and `getState` as parameters. This acts as a loophole for AJAX calls and other async behavior. <add> <add>**Best for**: getting started, simple async and complex synchronous logic. <add>```js <add>function fetchData(someValue) { <add> return (dispatch, getState) => { <add> dispatch({type : "REQUEST_STARTED"}); <add> <add> myAjaxLib.post("/someEndpoint", {data : someValue}) <add> .then(response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}) <add> .catch(error => dispatch({type : "REQUEST_FAILED", error : error}); <add> }; <add>} <add> <add>function addTodosIfAllowed(todoText) { <add> return (dispatch, getState) => { <add> const state = getState(); <add> <add> if(state.todos.length < MAX_TODOS) { <add> dispatch({type : "ADD_TODO", text : todoText}); <add> } <add> } <add>} <add>``` <add> <add> <add>**[redux-saga/redux-saga](https://github.com/redux-saga/redux-saga)** <add>Handle async logic using synchronous-looking generator functions. Sagas return descriptions of effects, which are executed by the saga middleware, and act like "background threads" for JS applications. <add> <add>**Best for**: complex async logic, decoupled workflows <add>```js <add>function* fetchData(action) { <add> const {someValue} = action; <add> try { <add> const result = yield call(myAjaxLib.post, "/someEndpoint", {data : someValue}); <add> yield put({type : "REQUEST_SUCCEEDED", payload : response}); <add> } <add> catch(error) { <add> yield put({type : "REQUEST_FAILED", error : error}); <add> } <add>} <add> <add>function* addTodosIfAllowed(action) { <add> const {todoText} = action; <add> const todos = yield select(state => state.todos); <add> <add> if(todos.length < MAX_TODOS) { <add> yield put({type : "ADD_TODO", text : todoText}); <add> } <add>} <add>``` <add> <add>**[redux-observable/redux-observable](https://github.com/redux-observable/redux-observable)** <add> <add>Handle async logic using RxJS observable chains called "epics". <add>Compose and cancel async actions to create side effects and more. <add> <add>**Best for**: complex async logic, decoupled workflows <add>```js <add>const loginRequestEpic = (action$) => <add> action$.ofType(LOGIN_REQUEST) <add> .mergeMap(({ payload: { username, password } }) => <add> Observable.from(postLogin(username, password)) <add> .map(loginSuccess) <add> .catch(loginFailure) <add> ); <add> <add>const loginSuccessfulEpic = (action$) => <add> action$.ofType(LOGIN_SUCCESS) <add> .delay(2000) <add> .mergeMap(({ payload: { msg } }) => <add> showMessage(msg) <add> ); <add> <add>const rootEpic = combineEpics(loginRequestEpic, loginSuccessfulEpic); <add>``` <add> <add> <add>**[redux-loop/redux-loop](https://github.com/redux-loop/redux-loop)** <add> <add>A port of the Elm Architecture to Redux that allows you to sequence your effects naturally and purely by returning them from your reducers. Reducers now return both a state value and a side effect description. <add> <add>**Best for**: trying to be as much like Elm as possible in Redux+JS <add>```js <add>export const reducer = (state = {}, action) => { <add> switch(action.type) { <add> case ActionType.LOGIN_REQUEST: <add> const {username, password} = action.payload; <add> return loop( <add> {pending : true}, <add> Effect.promise(loginPromise, username, password) <add> ); <add> case ActionType.LOGIN_SUCCESS: <add> const {user, msg} = action.payload; <add> return loop( <add> {pending : false, user}, <add> Effect.promise(delayMessagePromise, msg, 2000) <add> ); <add> case ActionType.LOGIN_FAILURE: <add> return {pending : false, err : action.payload}; <add> default : return state; <add> } <add>} <add>``` <add> <add>**[jeffbski/redux-logic](https://github.com/jeffbski/redux-logic)** <add> <add>Side effects lib built with observables, but allows use of callbacks, promises, async/await, or observables. Provides declarative processing of actions. <add> <add>**Best for**: very decoupled async logic <add>```js <add>const loginLogic = createLogic({ <add> type : Actions.LOGIN_REQUEST, <add> <add> process({getState, action}, dispatch, done) { <add> const {username, password} = action.payload; <add> <add> postLogin(username, password) <add> .then( ({user, msg}) => { <add> dispatch(loginSucceeded(user)); <add> <add> setTimeout(() => dispatch(showMessage(msg)), 2000); <add> }, <add> (err) => dispatch(loginFailure(err)) <add> ) <add> .then(done); <add> } <add>}); <add>``` <add> <add>#### Promises <add> <add>**[acdlite/redux-promise](https://github.com/acdlite/redux-promise)** <add>Dispatch promises as action payloads, and have FSA-compliant actions dispatched as the promise resolves or rejects. <add>```js <add>dispatch({type : "FETCH_DATA", payload : myAjaxLib.get("/data") }); <add>// will dispatch either {type : "FETCH_DATA", payload : response} if resolved, <add>// or dispatch {type : "FETCH_DATA", payload : error, error : true} if rejected <add>``` <add> <add> <add>**[lelandrichardson/redux-pack](https://github.com/lelandrichardson/redux-pack)** <add>Sensible, declarative, convention-based promise handling that guides users in a good direction without exposing the full power of dispatch. <add>```js <add>dispatch({type : "FETCH_DATA", payload : myAjaxLib.get("/data") }); <add> <add>// in a reducer: <add> case "FETCH_DATA": = <add> return handle(state, action, { <add> start: prevState => ({ <add> ...prevState, <add> isLoading: true, <add> fooError: null <add> }), <add> finish: prevState => ({ ...prevState, isLoading: false }), <add> failure: prevState => ({ ...prevState, fooError: payload }), <add> success: prevState => ({ ...prevState, foo: payload }), <add> }); <add>``` <add> <add> <add> <add>## Middleware <add> <add>#### Networks and Sockets <add> <add>**[svrcekmichal/redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware)** <add>Fetches data with Axios and dispatches start/success/fail actions <add>```js <add>export const loadCategories() => ({ type: 'LOAD', payload: { request : { url: '/categories'} } }); <add>``` <add> <add>**[agraboso/redux-api-middleware](https://github.com/agraboso/redux-api-middleware)** <add>Reads API call actions, fetches, and dispatches FSAs <add>```js <add>const fetchUsers = () => ({ <add> [CALL_API]: { endpoint: 'http://www.example.com/api/users', method: 'GET', types: ['REQUEST', 'SUCCESS', 'FAILURE'] } <add>}); <add>``` <add> <add>**[itaylor/redux-socket.io](https://github.com/itaylor/redux-socket.io)** <add>An opinionated connector between socket.io and redux. <add>```js <add>const store = createStore(reducer, applyMiddleware(socketIoMiddleware)); <add>store.dispatch({type : "server/hello", data : "Hello!"}); <add>``` <add> <add>**[tiberiuc/redux-react-firebase](https://github.com/tiberiuc/redux-react-firebase)** <add>Integration between Firebase, React, and Redux <add> <add> <add>#### Async Behavior <add> <add>**[rt2zz/redux-action-buffer](https://github.com/rt2zz/redux-action-buffer)** <add>Buffers all actions into a queue until a breaker condition is met, at which point the queue is released <add> <add>**[wyze/redux-debounce](https://github.com/wyze/redux-debounce)** <add>FSA-compliant middleware for Redux to debounce actions. <add> <add>**[mathieudutour/redux-queue-offline](https://github.com/mathieudutour/redux-queue-offline)** <add>Queue actions when offline and dispatch them when getting back online. <add> <add> <add>#### Analytics <add> <add>**[rangle/redux-beacon](https://github.com/rangle/redux-beacon)** <add>Integrates with any analytics services, can track while offline, and decouples analytics logic from app logic <add> <add>**[hyperlab/redux-insights](https://github.com/hyperlab/redux-insights)** <add>Analytics and tracking with an easy API for writing your own adapters <add> <add>**[markdalgleish/redux-analytics](https://github.com/markdalgleish/redux-analytics)** <add>Watches for Flux Standard Actions with meta analytics values and processes them <add> <add> <add>## Entities and Collections <add> <add>**[tommikaikkonen/redux-orm](https://github.com/tommikaikkonen/redux-orm)** <add>A simple immutable ORM to manage relational data in your Redux store. <add> <add>**[Versent/redux-crud](https://github.com/Versent/redux-crud)** <add>Convention-based actions and reducers for CRUD logic <add> <add>**[kwelch/entities-reducer](https://github.com/kwelch/entities-reducer)** <add>A higher-order reducer that handles data from Normalizr <add> <add>**[amplitude/redux-query](https://github.com/amplitude/redux-query)** <add>Declare colocated data dependencies with your components, run queries when components mount, perform optimistic updates, and trigger server changes with Redux actions. <add> <add>**[cantierecreativo/redux-bees](https://github.com/cantierecreativo/redux-bees)** <add>Declarative JSON-API interaction that normalizes data, with a React HOC that can run queries <add> <add>**[GetAmbassador/redux-clerk](https://github.com/GetAmbassador/redux-clerk)** <add>Async CRUD handling with normalization, optimistic updates, sync/async action creators, selectors, and an extendable reducer. <add> <add>**[shoutem/redux-io](https://github.com/shoutem/redux-io)** <add>JSON-API abstraction with async CRUD, normalization, optimistic updates, caching, data status, and error handling. <add> <add>**[jmeas/redux-resource](https://github.com/jmeas/redux-resource)** <add>A tiny but powerful system for managing 'resources': data that is persisted to remote servers. <add> <add> <add>## Component State and Encapsulation <add> <add>**[tonyhb/redux-ui](https://github.com/tonyhb/redux-ui)** <add>"Block-level scoping" for UI state. Decorated components declare data fields, which become props and can be updated by nested children. <add>```js <add>@ui({ <add> key: 'some-name', state: { uiVar1: '', uiVar2: (props, state) => state.someValue }, reducer : (state, action) => { } <add>}) <add>class YourComponent extends React.Component {} <add>``` <add> <add>**[threepointone/redux-react-local](https://github.com/threepointone/redux-react-local)** <add>Local component state in Redux, with handling for component actions <add>```js <add>@local({ <add> ident: 'counter', initial: 0, reducer : (state, action) => action.me ? state + 1 : state } <add>}) <add>class Counter extends React.Component { <add>``` <add> <add> <add>**[epeli/lean-redux](https://github.com/epeli/lean-redux)** <add>Makes component state in Redux as easy as setState <add>```js <add>const DynamicCounters = connectLean( <add> scope: "dynamicCounters", <add> getInitialState() => ({counterCount : 1}), <add> addCounter, removeCOunter <add>)(CounterList); <add>``` <add> <add>**[ioof-holdings/redux-subspace](https://github.com/ioof-holdings/redux-subspace)** <add>Creates isolated "sub-stores" for decoupled micro front-ends, with integration for React, sagas, and observables <add>```js <add>const reducer = combineReducers({ <add> subApp1: namespaced('subApp1')(counter), <add> subApp2: namespaced('subApp2')(counter) <add>}); <add> <add>const subApp1Store = subspace((state) => state.subApp1, 'subApp1')(store) <add>const subApp2Store = subspace((state) => state.subApp2, 'subApp2')(store) <add> <add>subApp1Store.dispatch({ type: 'INCREMENT' }) <add>console.log('store state:', store.getState()) // { "subApp1": { value: 2 }, "subApp2": { value: 1 } } <add>``` <add> <add> <add>**[DataDog/redux-doghouse](https://github.com/DataDog/redux-doghouse)** <add>Aims to make reusable components easier to build with Redux by scoping actions and reducers to a particular instance of a component. <add>```js <add>const scopeableActions = new ScopedActionFactory(actionCreators); <add>const actionCreatorsScopedToA = scopeableActions.scope('a'); <add>actionCreatorsScopedToA.foo('bar'); //{ type: SET_FOO, value: 'bar', scopeID: 'a' } <add> <add>const boundScopeableActions = bindScopedActionFactories(scopeableActions, store.dispatch); <add>const scopedReducers = scopeReducers(reducers); <add>``` <add> <add> <add>## Dev Tools <add> <add>#### Debuggers and Viewers <add> <add>**[gaearon/redux-devtools](https://github.com/gaearon/redux-devtools)** <add> <add>Dan Abramov's original Redux DevTools implementation, built for in-app display of state and time-travel debugging <add> <add>**[zalmoxisus/redux-devtools-extension](https://github.com/zalmoxisus/redux-devtools-extension)** <add> <add>Mihail Diordiev's browser extension, which bundles multiple state monitor views and adds integration with the browser's own dev tools <add> <add>**[infinitered/reactotron](https://github.com/infinitered/reactotron)** <add> <add>A cross-platform Electron app for inspecting React and React Native apps, including app state, API requests, perf, errors, sagas, and action dispatching. <add> <add>#### DevTools Monitors <add> <add>**[Log Monitor](https://github.com/gaearon/redux-devtools-log-monitor)** <add>The default monitor for Redux DevTools with a tree view <add> <add>**[Dock Monitor](https://github.com/gaearon/redux-devtools-dock-monitor)** <add>A resizable and movable dock for Redux DevTools monitors <add> <add>**[Slider Monitor](https://github.com/calesce/redux-slider-monitor)** <add>A custom monitor for Redux DevTools to replay recorded Redux actions <add> <add>**[Inspector](https://github.com/alexkuz/redux-devtools-inspector)** <add>A custom monitor for Redux DevTools that lets you filter actions, inspect diffs, and pin deep paths in the state to observe their changes <add> <add>**[Diff Monitor](https://github.com/whetstone/redux-devtools-diff-monitor)** <add>A monitor for Redux Devtools that diffs the Redux store mutations between actions <add> <add>**[Filterable Log Monitor](https://github.com/bvaughn/redux-devtools-filterable-log-monitor/)** <add>Filterable tree view monitor for Redux DevTools <add> <add>**[Chart Monitor](https://github.com/romseguy/redux-devtools-chart-monitor)** <add>A chart monitor for Redux DevTools <add> <add>**[Filter Actions](https://github.com/zalmoxisus/redux-devtools-filter-actions)** <add>Redux DevTools composable monitor with the ability to filter actions <add> <add> <add>#### Logging <add> <add>**[evgenyrodionov/redux-logger](https://github.com/evgenyrodionov/redux-logger)** <add>Logging middleware that shows actions, states, and diffs <add> <add>**[inakianduaga/redux-state-history](https://github.com/inakianduaga/redux-state-history)** <add>Enhancer that provides time-travel and efficient action recording capabilities, including import/export of action logs and action playback. <add> <add>**[joshwcomeau/redux-vcr](https://github.com/joshwcomeau/redux-vcr)** <add>Record and replay user sessions in real-time <add> <add>**[socialtables/redux-unhandled-action](https://github.com/socialtables/redux-unhandled-action)** <add>Warns about actions that produced no state changes in development <add> <add> <add>#### Mutation Detection <add> <add>**[leoasis/redux-immutable-state-invariant](https://github.com/leoasis/redux-immutable-state-invariant)** <add>Middleware that throws an error when you try to mutate your state either inside a dispatch or between dispatches. <add> <add>**[flexport/mutation-sentinel](https://github.com/flexport/mutation-sentinel)** <add>Helps you deeply detect mutations at runtime and enforce immutability in your codebase. <add> <add>**[mmahalwy/redux-pure-connect](https://github.com/mmahalwy/redux-pure-connect)** <add>Check and log whether react-redux's connect method is passed `mapState` functions that create impure props. <add> <add> <add> <add>## Testing <add> <add>**[arnaudbenard/redux-mock-store](https://github.com/arnaudbenard/redux-mock-store)** <add>A mock store that saves dispatched actions in an array for assertions <add> <add>**[Workable/redux-test-belt](https://github.com/Workable/redux-test-belt)** <add>Extends the store API to make it easier assert, isolate, and manipulate the store <add> <add>**[conorhastings/redux-test-recorder](https://github.com/conorhastings/redux-test-recorder)** <add>Middleware to automatically generate reducers tests based on actions in the app <add> <add>**[wix/redux-testkit](https://github.com/wix/redux-testkit)** <add>Complete and opinionated testkit for testing Redux projects (reducers, selectors, actions, thunks) <add> <add>**[jfairbank/redux-saga-test-plan](https://github.com/jfairbank/redux-saga-test-plan)** <add>Makes integration and unit testing of sagas a breeze <add> <add> <add>## Routing <add> <add>**[ReactTraining/react-router-redux](https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux)** <add>Keep your state in sync with your router <add> <add>**[FormidableLabs/redux-little-router](https://github.com/FormidableLabs/redux-little-router)** <add>A tiny router for Redux applications that lets the URL do the talking <add> <add>**[faceyspacey/redux-first-router](https://github.com/faceyspacey/redux-first-router)** <add>Seamless Redux-first routing. Think of your app in states, not routes, not components, while keeping the address bar in sync. Everything is state. Connect your components and just dispatch flux standard actions. <add> <add> <add>## Forms <add> <add>**[erikras/redux-form](https://github.com/erikras/redux-form)** <add>A full-featured library to enable a React HTML form to store its state in Redux. <add> <add>**[davidkpiano/react-redux-form](https://github.com/davidkpiano/react-redux-form)** <add>React Redux Form is a collection of reducer creators and action creators that make implementing even the most complex and custom forms with React and Redux simple and performant. <add> <add> <add>## Higher-Level Abstractions <add> <add>**[keajs/kea](https://github.com/keajs/kea)** <add>An abstraction over Redux, Redux-Saga and Reselect. Provides a framework for your app’s actions, reducers, selectors and sagas. It empowers Redux, making it as simple to use as setState. It reduces boilerplate and redundancy, while retaining composability. <add> <add>**[jumpsuit/jumpstate](https://github.com/jumpsuit/jumpstate)** <add>A simplified layer over Redux. No action creators or explicit dispatching, with a built-in simple side effects system. <add> <add>**[TheComfyChair/redux-scc](https://github.com/TheComfyChair/redux-scc)** <add>Takes a defined structure and uses 'behaviors' to create a set of actions, reducer responses and selectors. <add> <add>**[Bloomca/redux-tiles](https://github.com/Bloomca/redux-tiles)** <add>Provides minimal abstraction on top of Redux, to allow easy composability, easy async requests, and sane testability. <add> <add> <add>## Community Conventions <add> <add>**[Flux Standard Action](https://github.com/acdlite/flux-standard-action)** <add>A human-friendly standard for Flux action objects <add> <add>**[Canonical Reducer Composition](https://github.com/gajus/canonical-reducer-composition)** <add>An opinionated standard for nested reducer composition <add> <add>**[Ducks: Redux Reducer Bundles](https://github.com/erikras/ducks-modular-redux)** <add>A proposal for bundling reducers, action types and actions <add> <add> <add> <add> <ide><path>docs/introduction/LearningResources.md <add># Learning Resources <add> <add>The Redux docs are intended to teach the basic concepts of Redux, as well as explain key concepts for use in real-world applications. However, the docs can't cover everything. Happily, there's many other great resources available for learning Redux. We encourage you to check them out. Many of them cover topics that are beyond the scope of the docs, or describe the same topics in other ways that may work better for your learning style. <add> <add>This page includes our recommendations for some of the best external resources available to learn Redux. For an additional extensive list of tutorials, articles, and other resources on React, Redux, Javascript, and related topics, see the [React/Redux Links list](https://github.com/markerikson/react-redux-links). <add> <add> <add>## Basic Introductions <add> <add>*Tutorials that teach the basic concepts of Redux and how to use it* <add> <add>- **Getting Started with Redux - Video Series** <add> https://egghead.io/series/getting-started-with-redux <add> https://github.com/tayiorbeii/egghead.io_redux_course_notes <add> Dan Abramov, the creator of Redux, demonstrates various concepts in 30 short (2-5 minute) videos. The linked Github repo contains notes and transcriptions of the videos. <add> <add>- **Building React Applications with Idiomatic Redux - Video Series** <add> https://egghead.io/series/building-react-applications-with-idiomatic-redux <add> https://github.com/tayiorbeii/egghead.io_idiomatic_redux_course_notes <add> Dan Abramov's second video tutorial series, continuing directly after the first. Includes lessons on store initial state, using Redux with React Router, using "selector" functions, normalizing state, use of Redux middleware, async action creators, and more. The linked Github repo contains notes and transcriptions of the videos. <add> <add>- **Live React: Hot Reloading and Time Travel** <add> http://youtube.com/watch?v=xsSnOQynTHs <add> Dan Abramov's original conference talk that introduced Redux. See how constraints enforced by Redux make hot reloading with time travel easy <add> <add>- **A Cartoon Guide to Redux** <add> https://code-cartoons.com/a-cartoon-intro-to-redux-3afb775501a6 <add> A high-level description of Redux, with friendly cartoons to help illustrate the ideas. <add> <add>- **Leveling Up with React: Redux** <add> https://css-tricks.com/learning-react-redux/ <add> A very well-written introduction to Redux and its related concepts, with some nifty cartoon-ish diagrams. <add> <add>- **An Introduction to Redux** <add> https://www.smashingmagazine.com/2016/06/an-introduction-to-redux/ <add> An overview and intro to the basic concepts of Redux. Looks at the benefits of using Redux, how it differs from MVC or Flux, and its relation to functional programming. <add> <add>- **Redux Tutorial** <add> https://www.pshrmn.com/tutorials/react/redux/ <add> A short, clear tutorial that introduces basic Redux terms, shows how to split reducer functions, and describes the Redux store API. <add> <add> <add>- **Redux: From Twitter Hype to Production** <add> http://slides.com/jenyaterpil/redux-from-twitter-hype-to-production#/ <add> An extremely well-produced slideshow that visually steps through core Redux concepts, usage with React, project organization, and side effects with thunks and sagas. Has some absolutely _fantastic_ animated diagrams demonstrating how data flows through a React+Redux architecture. <add> <add>- **DevGuides: Introduction to Redux** <add> http://devguides.io/redux/ <add> A tutorial that covers several aspects of Redux, including actions, reducers, usage with React, and middleware. <add> <add> <add> <add>## Using Redux With React <add> <add>*Explanations of the React-Redux bindings and the `connect` function* <add> <add>- **Why Redux is Useful in React Apps** <add> https://www.fullstackreact.com/articles/redux-with-mark-erikson/ <add> An explanation of some of the benefits of using Redux with React, including sharing data between components and hot module reloading. <add> <add> <add>- **What Does Redux Do? (and when should you use it?)** <add> https://daveceddia.com/what-does-redux-do/ <add> An excellent summary of how Redux helps solve data flow problems in a React app. <add> <add>- **How Redux Works: A Counter-Example** <add> https://daveceddia.com/how-does-redux-work/ <add> A great follow-up to the previous article. It explains how to use Redux and React-Redux, by first showing a React component that stores a value in its internal state, and then refactoring it to use Redux instead. Along the way, the article explains important Redux terms and concepts, and how they all fit together to make the Redux data flow work properly. <add> <add>- **Redux and React: An Introduction** <add> http://jakesidsmith.com/blog/post/2017-11-18-redux-and-react-an-introduction/ <add> A great introduction to Redux's core concepts, with explanations of how to use the React-Redux package to use Redux with React. <add> <add>- **React Redux Tutorial** <add> https://www.pshrmn.com/tutorials/react/react-redux <add> A clear, easy-to-read explanation of how to use the React-Redux `connect` API. <add> <add> <add>## Project-Based Tutorials <add> <add>*Tutorials that teach Redux concepts by building projects, including larger "real-world"-type applications* <add> <add>- **Practical Redux** <add> http://blog.isquaredsoftware.com/2016/10/practical-redux-part-0-introduction/ <add> http://blog.isquaredsoftware.com/series/practical-redux/ <add> An ongoing series of posts intended to demonstrate a number of specific Redux techniques by building a sample application, based on the MekHQ application for managing Battletech campaigns. Written by Redux co-maintainer Mark Erikson. Covers topics like managing relational data, connecting multiple components and lists, complex reducer logic for features, handling forms, showing modal dialogs, and much more. <add> <add>- **Building a Simple CRUD App with React + Redux** <add> http://www.thegreatcodeadventure.com/building-a-simple-crud-app-with-react-redux-part-1/ <add> A nifty 8-part series that demonstrates building a CRUD app, including routing, AJAX calls, and the various CRUD aspects. Very well written, with some useful diagrams as well. <add> <add>- **The Soundcloud Client in React + Redux** <add> http://www.robinwieruch.de/the-soundcloud-client-in-react-redux/ <add> A detailed walkthrough demonstrating project setup, routing, authentication, fetching of remote data, and wrapping of a stateful library. <add> <add>- **Full-Stack Redux Tutorial** <add> http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html <add> A full-blown, in-depth tutorial that builds up a complete client-server application. <add> <add>- **Getting Started with React, Redux and Immutable: a Test-Driven Tutorial** <add> http://www.theodo.fr/blog/2016/03/getting-started-with-react-redux-and-immutable-a-test-driven-tutorial-part-1/ <add> http://www.theodo.fr/blog/2016/03/getting-started-with-react-redux-and-immutable-a-test-driven-tutorial-part-2/ <add> Another solid, in-depth tutorial, similar to the "Full-Stack" tutorial. Builds a client-only TodoMVC app, and demonstrates a good project setup (including a Mocha+JSDOM-based testing configuration). Well-written, covers many concepts, and very easy to follow. <add> <add>- **Redux Hero: An Intro to Redux and Reselect** <add> https://decembersoft.com/posts/redux-hero-part-1-a-hero-is-born-a-fun-introduction-to-redux-js/ <add> An introduction to Redux and related libraries through building a small RPG-style game <add> <add> <add>## Redux Implementation <add> <add>*Explanations of how Redux works internally, by writing miniature reimplementations* <add> <add>- **Build Yourself a Redux** <add> https://zapier.com/engineering/how-to-build-redux/ <add> An excellent in-depth "build a mini-Redux" article, which covers not only Redux's core, but also `connect` and middleware as well. <add> <add>- **Connect.js explained** <add> https://gist.github.com/gaearon/1d19088790e70ac32ea636c025ba424e <add> A very simplified version of React Redux's `connect()` function that illustrates the basic implementation <add> <add>- **Let's Write Redux!** <add> http://www.jamasoftware.com/blog/lets-write-redux/ <add> Walks through writing a miniature version of Redux step-by-step, to help explain the concepts and implementation. <add> <add> <add>## Reducers <add> <add>*Articles discussing ways to write reducer functions* <add> <add>- **Taking Advantage of `combineReducers`** <add> http://randycoulman.com/blog/2016/11/22/taking-advantage-of-combinereducers/ <add> Examples of using `combineReducers` multiple times to produce a state tree, and some thoughts on tradeoffs in various approaches to reducer logic. <add> <add>- **The Power of Higher-Order Reducers** <add> http://slides.com/omnidan/hor#/ <add> A slideshow from the author of redux-undo and other libraries, explaining the concept of higher-order reducers and how they can be used <add> <add>- **Reducer composition with Higher Order Reducers** <add> https://medium.com/@mange_vibration/reducer-composition-with-higher-order-reducers-35c3977ed08f <add> Some great examples of writing small functions that can be composed together to perform larger specific reducer tasks, such as providing initial state, filtering, updating specific keys, and more. <add> <add>- **Higher Order Reducers - It just sounds scary** <add> https://medium.com/@danielkagan/high-order-reducers-it-just-sounds-scary-2b9e5dbfc705 <add> Explains how reducers can be composed like Lego bricks to create reusable and testable reducer logic. <add> <add> <add>## Selectors <add> <add>*Explanations of how and why to use selector functions to read values from state* <add> <add>- **ReactCasts #8: Selectors in Redux** <add> https://www.youtube.com/watch?v=frT3to2ACCw <add> A great overview of why and how to use selector functions to retrieve data from the store, and derive additional data from store values <add> <add>- **Optimizing React Redux Application Development with Reselect** <add> https://codebrahma.com/reselect-tutorial-optimizing-react-redux-application-development-with-reselect/ <add> A good tutorial on Reselect. Covers the concept of "selector functions", how to use Reselect's API, and how to use memoized selectors to improve performance. <add> <add>- **Usage of Reselect in a React-Redux Application** <add> https://dashbouquet.com/blog/frontend-development/usage-of-reselect-in-a-react-redux-application <add> Discusses the importance of memoized selectors for performance, and good practices for using Reselect. <add> <add>- **React, Reselect, and Redux** <add> https://medium.com/@parkerdan/react-reselect-and-redux-b34017f8194c <add> An explanation of how Reselect's memoized selector functions are useful in Redux apps, and how to create unique selector instances for each component instance. <add> <add> <add>## Normalization <add> <add>*How to structure the Redux store like a database for best performance* <add> <add>- **Querying a Redux Store** <add> https://medium.com/@adamrackis/querying-a-redux-store-37db8c7f3b0f <add> A look at best practices for organizing and storing data in Redux, including normalizing data and use of selector functions. <add> <add>- **Normalizing Redux Stores for Maximum Code Reuse** <add> https://medium.com/@adamrackis/normalizing-redux-stores-for-maximum-code-reuse-ae6e3844ae95 <add> Thoughts on how normalized Redux stores enable some useful data handling approaches, with examples of using selector functions to denormalize hierarchical data. <add> <add>- **Redux Normalizr: Improve your State Management** <add> http://www.robinwieruch.de/the-soundcloud-client-in-react-redux-normalizr/ <add> A tutorial describing how to use Normalizr for improved data management of nested data in Redux <add> <add>- **Advanced Redux Entity Normalization** <add> https://medium.com/@dcousineau/advanced-redux-entity-normalization-f5f1fe2aefc5 <add> Describes a "keyWindow" concept for tracking subsets of entities in state, similar to an SQL "view". A useful extension to the idea of normalized data. <add> <add> <add> <add>## Middleware <add> <add>*Explanations and examples of how middleware work and how to write them* <add> <add>- **Exploring Redux Middlewares** <add> http://blog.krawaller.se/posts/exploring-redux-middleware/ <add> Understanding middlewares through a series of small experiments <add> <add>- **Redux Middleware Tutorial** <add> http://www.pshrmn.com/tutorials/react/redux-middleware/ <add> An overview of what middleware is, how `applyMiddleware` works, and how to write middleware. <add> <add>- **ReactCasts #6: Redux Middleware** <add> https://www.youtube.com/watch?v=T-qtHI1qHIg <add> A screencast that describes how middleware fit into Redux, their uses, and how to implement a custom middleware <add> <add>- **A Beginner's Guide to Redux Middleware** <add> https://www.codementor.io/reactjs/tutorial/beginner-s-guide-to-redux-middleware <add> A useful explanation of middleware use cases, with numerous examples <add> <add> <add>## Side Effects - Basics <add> <add>*Introductions to handling async behavior in Redux* <add> <add>- **Stack Overflow: Dispatching Redux Actions with a Timeout** <add> http://stackoverflow.com/questions/35411423/how-to-dispatch-a-redux-action-with-a-timeout/35415559#35415559 <add> Dan Abramov explains the basics of managing async behavior in Redux, walking through a progressive series of approaches (inline async calls, async action creators, thunk middleware). <add> <add>- **Stack Overflow: Why do we need middleware for async flow in Redux?** <add> http://stackoverflow.com/questions/34570758/why-do-we-need-middleware-for-async-flow-in-redux/34599594#34599594 <add> Dan Abramov gives reasons for using thunks and async middleware, and some useful patterns for using thunks. <add> <add>- **What the heck is a "thunk"?** <add> https://daveceddia.com/what-is-a-thunk/ <add> A quick explanation for what the word "thunk" means in general, and for Redux specifically. <add> <add>- **Thunks in Redux: The Basics** <add> https://medium.com/fullstack-academy/thunks-in-redux-the-basics-85e538a3fe60 <add> A detailed look at what thunks are, what they solve, and how to use them. <add> <add> <add> <add> <add>## Side Effects - Advanced <add> <add>*Advanced tools and techniques for managing async behavior* <add> <add>- **What is the right way to do asynchronous operations in Redux?** <add> https://decembersoft.com/posts/what-is-the-right-way-to-do-asynchronous-operations-in-redux/ <add> An excellent look at the most popular libraries for Redux side effects, with comparisons of how each one works. <add> <add>- **Redux 4 Ways** <add> https://medium.com/react-native-training/redux-4-ways-95a130da0cdc <add> Side-by-side comparisons of implementing some basic data fetching using thunks, sagas, observables, and a promise middleware <add> <add>- **Idiomatic Redux: Thoughts on Thunks, Sagas, Abstractions, and Reusability** <add> http://blog.isquaredsoftware.com/2017/01/idiomatic-redux-thoughts-on-thunks-sagas-abstraction-and-reusability/ <add> A response to several "thunks are bad" concerns, arguing that thunks (and sagas) are still a valid approach for managing complex sync logic and async side effects. <add> <add>- **Javascript Power Tools: Redux-Saga** <add> http://formidable.com/blog/2017/javascript-power-tools-redux-saga/ <add> http://formidable.com/blog/2017/composition-patterns-in-redux-saga/ <add> http://formidable.com/blog/2017/real-world-redux-saga-patterns/ <add> A fantastic series that teaches the concepts, implementation, and benefits behind Redux-Saga, including how ES6 generators are used to control function flow, how sagas can be composed together to accomplish concurrency, and practical use cases for sagas. <add> <add>- **Exploring Redux Sagas** <add> https://medium.com/onfido-tech/exploring-redux-sagas-cc1fca2015ee <add> An excellent article that explores how to use sagas to provide a glue layer to implement decoupled business logic in a Redux application. <add> <add>- **Taming Redux with Sagas** <add> https://objectpartners.com/2017/11/20/taming-redux-with-sagas/ <add> A good overview of Redux-Saga, including info on generator functions, use cases for sagas, using sagas to deal with promises, and testing sagas. <add> <add>- **Reactive Redux State with RxJS** <add> https://ivanjov.com/reactive-redux-state-with-rxjs/ <add> Describes the concept of "Reactive PRogramming" and the RxJS library, and shows how to use redux-observable to fetch data, along with examples of testing. <add> <add>- **Using redux-observable to handle asynchronous logic in Redux** <add> https://medium.com/dailyjs/using-redux-observable-to-handle-asynchronous-logic-in-redux-d49194742522 <add> An extended post that compares a thunk-based implementation of handling a line-drawing example vs an observable-based implementation. <add> <add> <add>## Thinking in Redux <add> <add>*Deeper looks at how Redux is meant to be used, and why it works the way it does* <add> <add>- **You Might Not Need Redux** <add> https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367 <add> Dan Abramov discusses the tradeoffs involved in using Redux. <add> <add>- **Idiomatic Redux: The Tao of Redux, Part 1 - Implementation and Intent** <add> http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/ <add> A deep dive into how Redux actually works, the constraints it asks you to follow, and the intent behind its design and usage. <add> <add>- **Idiomatic Redux: The Tao of Redux, Part 2 - Practice and Philosophy** <add> http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/ <add> A follow-up look at why common Redux usage patterns exist, other ways that Redux can be used, and thoughts on the pros and cons of those different patterns and approaches. <add> <add>- **What's So Great About Redux?** <add> https://medium.freecodecamp.org/whats-so-great-about-redux-ac16f1cc0f8b <add> https://storify.com/acemarke/redux-pros-cons-and-limitations <add> https://twitter.com/modernserf/status/886426115874717697 <add> Deep and fascinating analysis of how Redux compares to OOP and message-passing, how typical Redux usage can devolve towards Java-like "setter" functions with more boilerplate, and something of a plea for a higher-level "blessed" abstraction on top of Redux to make it easier to work with and learn for newbies. Very worth reading. The author originally wrote a tweetstorm, which is captured in the Storify link, and wrote the blog post to expand on those thoughts. Finally, he followed up with a few more thoughts on abstract vs concrete examples in another shorter tweet thread. <add> <add> <add>## Redux Architecture <add> <add>*Patterns and practices for structuring larger Redux applications* <add> <add>- **Avoiding Accidental Complexity When Structuring Your App State** <add> https://hackernoon.com/avoiding-accidental-complexity-when-structuring-your-app-state-6e6d22ad5e2a <add> An excellent set of guidelines for organizing your Redux store structure. <add> <add>- **Redux Step by Step: A Simple and Robust Workflow for Real Life Apps** <add> https://hackernoon.com/redux-step-by-step-a-simple-and-robust-workflow-for-real-life-apps-1fdf7df46092 <add> A follow-up to the "Accidental Complexity" article, discussing principle <add> <add>- **Things I Wish I Knew About Redux** <add> https://medium.com/horrible-hacks/things-i-wish-i-knew-about-redux-9924abf2f9e0 <add> https://www.reddit.com/r/javascript/comments/4taau2/things_i_wish_i_knew_about_redux/ <add> A number of excellent tips and lessons learned after building an app with Redux. Includes info on connecting components, selecting data, and app/project structure. Additional discussion on Reddit. <add> <add>- **React+Redux: Tips and Best Practices for Clean, Reliable, & Maintainable Code** <add> https://speakerdeck.com/goopscoop/react-plus-redux-tips-and-best-practices-for-clean-reliable-and-scalable-code <add> An excellent slideshow with a wide variety of tips and suggestions, including keeping action creators simple and data manipulation in reducers, abstracting away API calls, avoiding spreading props, and more. <add> <add>- **Redux for state management in large web apps** <add> https://www.mapbox.com/blog/redux-for-state-management-in-large-web-apps/ <add> Excellent discussion and examples of idiomatic Redux architecture, and how Mapbox applies those approaches to their Mapbox Studio application. <add> <add> <add>## Apps and Examples <add> <add>- **React-Redux RealWorld Example: TodoMVC for the Real World** <add> https://github.com/GoThinkster/redux-review <add> An example full-stack "real world" application built with Redux. Demos a Medium-like social blogging site that includes JWT authentication, CRUD, favoriting articles, following users, routing, and more. The RealWorld project also includes many other implementations of the front and back ends of the site, specifically intended to show how different server and client implementations of the same project and API spec compare with each other. <add> <add>- **Project Mini-Mek** <add> https://github.com/markerikson/project-minimek <add> A sample app to demonstrate various useful Redux techniques, accompanying the "Practical Redux" blog series at http://blog.isquaredsoftware.com/series/practical-redux <add> <add>- **react-redux-yelp-clone** <add> https://github.com/mohamed-ismat/react-redux-yelp-clone <add> An adaptation of the "Yelp Clone" app by FullStackReact. It extends the original by using Redux and Redux Saga instead of local state, as well as React Router v4, styled-components, and other modern standards. Based on the React-Boilerplate starter kit. <add> <add>- **WordPress-Calypso** <add> https://github.com/Automattic/wp-calypso <add> The new JavaScript- and API-powered WordPress.com <add> <add>- **Sound-Redux** <add> https://github.com/andrewngu/sound-redux <add> A Soundcloud client built with React / Redux <add> <add>- **Winamp2-js** <add> https://jordaneldredge.com/projects/winamp2-js/ <add> https://github.com/captbaritone/winamp2-js <add> An in-browser recreation of Winamp2, built with React and Redux. Actually plays MP3s, and lets you load in local MP3 files. <add> <add>- **Tello** <add> https://github.com/joshwcomeau/Tello <add> A simple and delightful way to track and manage TV shows <add> <add>- **io-808** <add> https://github.com/vincentriemer/io-808 <add> An attempt at a fully recreated web-based TR-808 drum machine <add> <add> <add> <add>## Redux Docs Translations <add> <add>- [中文文档](http://camsong.github.io/redux-in-chinese/) — Chinese <add>- [繁體中文文件](https://github.com/chentsulin/redux) — Traditional Chinese <add>- [Redux in Russian](https://github.com/rajdee/redux-in-russian) — Russian <add>- [Redux en Español](http://es.redux.js.org/) - Spanish <add> <add> <add>## Books <add> <add>- **Redux in Action** <add> https://www.manning.com/books/redux-in-action <add> A comprehensive book that covers many key aspects of using Redux, including the basics of reducers and actions and use with React, complex middlewares and side effects, application structure, performance, testing, and much more. Does a great job of explaining the pros, cons, and tradeoffs of many approaches to using Redux. Personally recommended by Redux co-maintainer Mark Erikson. <add> <add>- **The Complete Redux Book** <add> https://leanpub.com/redux-book <add> How do I manage a large state in production? Why do I need store enhancers? What is the best way to handle form validations? Get the answers to all these questions and many more using simple terms and sample code. Learn everything you need to use Redux to build complex and production-ready web applications. (Note: now permanently free!) <add> <add> <add> <add>## Courses <add> <add>- **Modern React with Redux, by Stephen Grider (paid)** <add> https://www.udemy.com/react-redux/ <add> Master the fundamentals of React and Redux with this tutorial as you develop apps with React Router, Webpack, and ES6. This course will get you up and running quickly, and teach you the core knowledge you need to deeply understand and build React components and structure applications with Redux. <add> <add>- **Redux, by Tyler McGinnis (paid)** <add> https://tylermcginnis.com/courses/redux/ <add> When learning Redux, you need to learn it in the context of an app big enough to see the benefits. That's why this course is huge. A better name might be 'Real World Redux. If you're sick of "todo list" Redux tutorials, you've come to the right place. In this course we'll talk all about what makes Redux special for managing state in your application. We'll build an actual "real world" application so you can see how Redux handles edge cases like optimistic updates and error handling. We'll also cover many other technologies that work well with Redux, Firebase, and CSS Modules. <add> <add>- **Learn Redux, by Wes Bos (free)** <add> https://learnredux.com/ <add> A video course that walks through building 'Reduxstagram' — a simple photo app that will simplify the core ideas behind Redux, React Router and React.js <add> <add> <add>## More Resources <add> <add>- [React-Redux Links](https://github.com/markerikson/react-redux-links) is a curated list of high-quality articles, tutorials, and related content for React, Redux, ES6, and more. <add>- [Redux Ecosystem Links](https://github.com/markerikson/redux-ecosystem-links) is a categorized collection of Redux-related libraries, addons, and utilities. <add>- [Awesome Redux](https://github.com/xgrommx/awesome-redux) is an extensive list of Redux-related repositories. <ide>\ No newline at end of file
3
Java
Java
update copyright year of changed file
5226a67161c99fc47098aa03da69846242819a9d
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java <ide> /* <del> * Copyright 2002-2020 the original author or authors. <add> * Copyright 2002-2021 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License.
1
Text
Text
add video to explain bootstrap
ee330a7ca7c33fdf831a0db24c8a3824a09b62b1
<ide><path>guide/english/bootstrap/index.md <ide> In addition, you can find both <a href='https://bootswatch.com/' target='_blank' <ide> themes that build on the Bootstrap framework to provide a more customized and stylish look. <ide> <ide> #### Bootstrap Resources: <add> <ide> - [Bootstrap's official blog](http://blog.getbootstrap.com/) <ide> - [Bootstrap site inspiration](http://expo.getbootstrap.com/) <ide> - [Showcase of sites built using Bootstrap](http://builtwithbootstrap.com/) <ide> - [HTML linter for projects using Bootstrap](https://github.com/twbs/bootlint) <ide> - [Design elements and code snippets for Bootstrap](https://bootsnipp.com/) <ide> - [Code, theme, and add-on resources for Bootstrap](http://expo.getbootstrap.com/resources/) <add>- [Video: Install and Use](https://www.youtube.com/watch?v=GU6EWzBGo64)
1
Python
Python
fix guardian import
30bf9df5d0dc983d180000e413ec2254d7946ff8
<ide><path>rest_framework/compat.py <ide> def value_from_object(field, obj): <ide> try: <ide> if 'guardian' in settings.INSTALLED_APPS: <ide> import guardian <del> import guardian.shortcuts # Fixes #1624 <ide> except ImportError: <ide> pass <ide> <ide><path>rest_framework/filters.py <ide> def __init__(self): <ide> perm_format = '%(app_label)s.view_%(model_name)s' <ide> <ide> def filter_queryset(self, request, queryset, view): <add> # We want to defer this import until run-time, rather than import-time. <add> # See https://github.com/tomchristie/django-rest-framework/issues/4608 <add> # (Also see #1624 for why we need to make this import explicitly) <add> from guardian.shortcuts import get_objects_for_user <add> <ide> extra = {} <ide> user = request.user <ide> model_cls = queryset.model <ide> def filter_queryset(self, request, queryset, view): <ide> extra = {'accept_global_perms': False} <ide> else: <ide> extra = {} <del> return guardian.shortcuts.get_objects_for_user(user, permission, queryset, **extra) <add> return get_objects_for_user(user, permission, queryset, **extra)
2
Javascript
Javascript
ignore properties in $error prototype chain
76df11657410a8246466ade36361fdf2b81d8570
<ide><path>src/Angular.js <ide> function forEach(obj, iterator, context) { <ide> obj.forEach(iterator, context, obj); <ide> } else { <ide> for (key in obj) { <del> if (hasOwnProperty.call(obj, key)) { <add> if (obj.hasOwnProperty(key)) { <ide> iterator.call(context, obj[key], key, obj); <ide> } <ide> } <ide><path>src/ng/directive/form.js <ide> function FormController(element, attrs, $scope, $animate, $interpolate) { <ide> var parentForm = form.$$parentForm = element.parent().controller('form') || nullFormCtrl; <ide> <ide> // init state <del> form.$error = createMap(); <del> form.$$success = createMap(); <add> form.$error = {}; <add> form.$$success = {}; <ide> form.$pending = undefined; <ide> form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope); <ide> form.$dirty = false; <ide><path>src/ng/directive/ngModel.js <ide> var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$ <ide> this.$dirty = false; <ide> this.$valid = true; <ide> this.$invalid = false; <del> this.$error = createMap(); // keep invalid keys here <del> this.$$success = createMap(); // keep valid keys here <add> this.$error = {}; // keep invalid keys here <add> this.$$success = {}; // keep valid keys here <ide> this.$pending = undefined; // keep pending keys here <ide> this.$name = $interpolate($attr.name || '', false)($scope); <ide> <ide><path>test/ng/directive/ngModelSpec.js <ide> describe('ngModel', function() { <ide> }); <ide> <ide> <del> it('should ignore items in prototype chain when determining validity', inject(function($compile) { <del> dealoc(element); <del> Object.prototype.someProp = true; <del> element = $compile('<form name="form"><input type="text" ng-model="value" name="value"></form>')(scope); <del> var input = element.children().eq(0); <del> ctrl = input.controller('ngModel'); <del> var form = element.controller('form'); <del> scope.$digest(); <del> expect(ctrl.$valid).toBe(true); <del> expect(element.children()).toBeValid(); <del> expect(form.$valid).toBe(true); <del> expect(element).toBeValid(); <del> delete Object.prototype.someProp; <del> })); <del> <del> <ide> describe('setValidity', function() { <ide> <ide> function expectOneError() {
4
Ruby
Ruby
fix activestorage intermittent test
29bc318e5f04f6d9cee6d6d120b2c52b4c4b8b47
<ide><path>activestorage/test/models/attached/many_test.rb <ide> def highlights <ide> @user.reload <ide> <ide> racecar_blob = fixture_file_upload("racecar.jpg") <add> attachment_id = town_blob.attachments.find_by!(record: @user).id <ide> @user.update( <ide> highlights: [racecar_blob], <del> highlights_attachments_attributes: [{ id: town_blob.id, _destroy: true }] <add> highlights_attachments_attributes: [{ id: attachment_id, _destroy: true }] <ide> ) <ide> <ide> assert @user.reload.highlights.attached?
1
PHP
PHP
improve exception message
34cc58b5603e8cd9279b67395c9aac454ad535c0
<ide><path>src/Utility/Security.php <ide> public static function constantEquals($original, $compare): bool <ide> public static function getSalt(): string <ide> { <ide> if (static::$_salt === null) { <del> throw new RuntimeException('Salt not set.'); <add> throw new RuntimeException('Salt not set. Use Security::setSalt() to set one, ideally in bootstrap.php.'); <ide> } <ide> <ide> return static::$_salt;
1
Java
Java
improve support for caching encoded resources
b472d192f43c5d827cfc49115c22c83acaebf2f0
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/CachingResourceResolver.java <ide> /* <del> * Copyright 2002-2016 the original author or authors. <add> * Copyright 2002-2018 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> package org.springframework.web.reactive.resource; <ide> <add>import java.util.Arrays; <ide> import java.util.List; <add>import java.util.stream.Collectors; <ide> <ide> import reactor.core.publisher.Mono; <ide> <ide> import org.springframework.core.io.Resource; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <add>import org.springframework.util.StringUtils; <ide> import org.springframework.web.server.ServerWebExchange; <ide> <ide> /** <ide> protected String computeKey(@Nullable ServerWebExchange exchange, String request <ide> StringBuilder key = new StringBuilder(RESOLVED_RESOURCE_CACHE_KEY_PREFIX); <ide> key.append(requestPath); <ide> if (exchange != null) { <del> String encoding = exchange.getRequest().getHeaders().getFirst("Accept-Encoding"); <del> if (encoding != null && encoding.contains("gzip")) { <del> key.append("+encoding=gzip"); <add> String codingKey = getContentCodingKey(exchange); <add> if (codingKey != null) { <add> key.append("+encoding=").append(codingKey); <ide> } <ide> } <ide> return key.toString(); <ide> } <ide> <add> @Nullable <add> private static String getContentCodingKey(ServerWebExchange exchange) { <add> String header = exchange.getRequest().getHeaders().getFirst("Accept-Encoding"); <add> if (!StringUtils.hasText(header)) { <add> return null; <add> } <add> return Arrays.stream(StringUtils.tokenizeToStringArray(header, ",")) <add> .map(token -> { <add> int index = token.indexOf(';'); <add> return (index >= 0 ? token.substring(0, index) : token).trim().toLowerCase(); <add> }) <add> .filter(coding -> !coding.equals("*")) <add> .filter(coding -> !coding.equals("identity")) <add> .sorted() <add> .collect(Collectors.joining(",")); <add> } <add> <ide> @Override <ide> protected Mono<String> resolveUrlPathInternal(String resourceUrlPath, <ide> List<? extends Resource> locations, ResourceResolverChain chain) { <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/EncodedResourceResolver.java <ide> public HttpHeaders getResponseHeaders() { <ide> headers = new HttpHeaders(); <ide> } <ide> headers.add(HttpHeaders.CONTENT_ENCODING, this.coding); <add> headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT_ENCODING); <ide> return headers; <ide> } <ide> } <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/GzipResourceResolver.java <ide> public HttpHeaders getResponseHeaders() { <ide> headers = new HttpHeaders(); <ide> } <ide> headers.add(HttpHeaders.CONTENT_ENCODING, "gzip"); <add> headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT_ENCODING); <ide> return headers; <ide> } <ide> } <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/resource/CachingResourceResolverTests.java <ide> import org.springframework.cache.concurrent.ConcurrentMapCache; <ide> import org.springframework.core.io.ClassPathResource; <ide> import org.springframework.core.io.Resource; <del>import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; <ide> import org.springframework.mock.web.test.server.MockServerWebExchange; <ide> <ide> import static org.junit.Assert.*; <add>import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.*; <ide> <ide> /** <ide> * Unit tests for {@link CachingResourceResolver}. <ide> public void setup() { <ide> @Test <ide> public void resolveResourceInternal() { <ide> Resource expected = new ClassPathResource("test/bar.css", getClass()); <del> MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("")); <add> MockServerWebExchange exchange = MockServerWebExchange.from(get("")); <ide> Resource actual = this.chain.resolveResource(exchange, "bar.css", this.locations).block(TIMEOUT); <ide> <ide> assertNotSame(expected, actual); <ide> public void resolveResourceInternal() { <ide> @Test <ide> public void resolveResourceInternalFromCache() { <ide> Resource expected = Mockito.mock(Resource.class); <del> this.cache.put(CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + "bar.css", expected); <add> this.cache.put(getCacheKey("bar.css"), expected); <ide> <del> MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("")); <add> MockServerWebExchange exchange = MockServerWebExchange.from(get("")); <ide> Resource actual = this.chain.resolveResource(exchange, "bar.css", this.locations).block(TIMEOUT); <ide> <ide> assertSame(expected, actual); <ide> } <ide> <ide> @Test <ide> public void resolveResourceInternalNoMatch() { <del> MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("")); <add> MockServerWebExchange exchange = MockServerWebExchange.from(get("")); <ide> assertNull(this.chain.resolveResource(exchange, "invalid.css", this.locations).block(TIMEOUT)); <ide> } <ide> <ide> public void resolverUrlPathNoMatch() { <ide> @Test <ide> public void resolveResourceAcceptEncodingInCacheKey() { <ide> String file = "bar.css"; <del> MockServerHttpRequest request = MockServerHttpRequest.get(file).header("Accept-Encoding", "gzip").build(); <del> MockServerWebExchange exchange = MockServerWebExchange.from(request); <add> MockServerWebExchange exchange = MockServerWebExchange.from(get(file) <add> .header("Accept-Encoding", "gzip ; a=b , deflate , brotli ; c=d ")); <ide> Resource expected = this.chain.resolveResource(exchange, file, this.locations).block(TIMEOUT); <ide> <del> String cacheKey = CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + file + "+encoding=gzip"; <add> String cacheKey = getCacheKey(file + "+encoding=brotli,deflate,gzip"); <ide> Object actual = this.cache.get(cacheKey).get(); <ide> <ide> assertSame(expected, actual); <ide> public void resolveResourceAcceptEncodingInCacheKey() { <ide> @Test <ide> public void resolveResourceNoAcceptEncoding() { <ide> String file = "bar.css"; <del> MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get(file)); <add> MockServerWebExchange exchange = MockServerWebExchange.from(get(file)); <ide> Resource expected = this.chain.resolveResource(exchange, file, this.locations).block(TIMEOUT); <ide> <del> String cacheKey = CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + file; <add> String cacheKey = getCacheKey(file); <ide> Object actual = this.cache.get(cacheKey).get(); <ide> <ide> assertEquals(expected, actual); <ide> public void resolveResourceNoAcceptEncoding() { <ide> public void resolveResourceMatchingEncoding() { <ide> Resource resource = Mockito.mock(Resource.class); <ide> Resource gzipped = Mockito.mock(Resource.class); <del> this.cache.put(CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + "bar.css", resource); <del> this.cache.put(CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + "bar.css+encoding=gzip", gzipped); <add> this.cache.put(getCacheKey("bar.css"), resource); <add> this.cache.put(getCacheKey("bar.css+encoding=gzip"), gzipped); <ide> <ide> String file = "bar.css"; <del> MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get(file)); <add> MockServerWebExchange exchange = MockServerWebExchange.from(get(file)); <ide> assertSame(resource, this.chain.resolveResource(exchange, file, this.locations).block(TIMEOUT)); <ide> <del> exchange = MockServerWebExchange.from(MockServerHttpRequest.get(file).header("Accept-Encoding", "gzip")); <add> exchange = MockServerWebExchange.from(get(file).header("Accept-Encoding", "gzip")); <ide> assertSame(gzipped, this.chain.resolveResource(exchange, file, this.locations).block(TIMEOUT)); <ide> } <ide> <add> private static String getCacheKey(String key) { <add> return CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + key; <add> } <add> <ide> } <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/resource/EncodedResourceResolverTests.java <ide> import org.springframework.core.io.ClassPathResource; <ide> import org.springframework.core.io.FileSystemResource; <ide> import org.springframework.core.io.Resource; <add>import org.springframework.http.HttpHeaders; <ide> import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; <ide> import org.springframework.mock.web.test.server.MockServerWebExchange; <ide> import org.springframework.util.FileCopyUtils; <ide> public void resolveGzipped() { <ide> <ide> assertEquals(getResource(file + ".gz").getDescription(), actual.getDescription()); <ide> assertEquals(getResource(file).getFilename(), actual.getFilename()); <add> <ide> assertTrue(actual instanceof HttpResource); <add> HttpHeaders headers = ((HttpResource) actual).getResponseHeaders(); <add> assertEquals("gzip", headers.getFirst(HttpHeaders.CONTENT_ENCODING)); <add> assertEquals("Accept-Encoding", headers.getFirst(HttpHeaders.VARY)); <ide> } <ide> <ide> @Test <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/CachingResourceResolver.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2018 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> package org.springframework.web.servlet.resource; <ide> <add>import java.util.Arrays; <ide> import java.util.List; <add>import java.util.stream.Collectors; <ide> import javax.servlet.http.HttpServletRequest; <ide> <ide> import org.springframework.cache.Cache; <ide> import org.springframework.cache.CacheManager; <ide> import org.springframework.core.io.Resource; <add>import org.springframework.http.HttpHeaders; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <add>import org.springframework.util.StringUtils; <ide> <ide> /** <ide> * A {@link org.springframework.web.servlet.resource.ResourceResolver} that <ide> protected String computeKey(@Nullable HttpServletRequest request, String request <ide> StringBuilder key = new StringBuilder(RESOLVED_RESOURCE_CACHE_KEY_PREFIX); <ide> key.append(requestPath); <ide> if (request != null) { <del> String encoding = request.getHeader("Accept-Encoding"); <del> if (encoding != null && encoding.contains("gzip")) { <del> key.append("+encoding=gzip"); <add> String codingKey = getContentCodingKey(request); <add> if (codingKey != null) { <add> key.append("+encoding=").append(codingKey); <ide> } <ide> } <ide> return key.toString(); <ide> } <ide> <add> @Nullable <add> private static String getContentCodingKey(HttpServletRequest request) { <add> String header = request.getHeader(HttpHeaders.ACCEPT_ENCODING); <add> if (!StringUtils.hasText(header)) { <add> return null; <add> } <add> return Arrays.stream(StringUtils.tokenizeToStringArray(header, ",")) <add> .map(token -> { <add> int index = token.indexOf(';'); <add> return (index >= 0 ? token.substring(0, index) : token).trim().toLowerCase(); <add> }) <add> .filter(coding -> !coding.equals("*")) <add> .filter(coding -> !coding.equals("identity")) <add> .sorted() <add> .collect(Collectors.joining(",")); <add> } <add> <ide> @Override <ide> protected String resolveUrlPathInternal(String resourceUrlPath, <ide> List<? extends Resource> locations, ResourceResolverChain chain) { <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/EncodedResourceResolver.java <ide> public HttpHeaders getResponseHeaders() { <ide> headers = new HttpHeaders(); <ide> } <ide> headers.add(HttpHeaders.CONTENT_ENCODING, this.coding); <add> headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT_ENCODING); <ide> return headers; <ide> } <ide> } <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/GzipResourceResolver.java <ide> public HttpHeaders getResponseHeaders() { <ide> headers = new HttpHeaders(); <ide> } <ide> headers.add(HttpHeaders.CONTENT_ENCODING, "gzip"); <add> headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT_ENCODING); <ide> return headers; <ide> } <ide> } <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/resource/CachingResourceResolverTests.java <ide> public void resolveResourceInternal() { <ide> @Test <ide> public void resolveResourceInternalFromCache() { <ide> Resource expected = Mockito.mock(Resource.class); <del> this.cache.put(CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + "bar.css", expected); <add> this.cache.put(getCacheKey("bar.css"), expected); <ide> Resource actual = this.chain.resolveResource(null, "bar.css", this.locations); <ide> <ide> assertSame(expected, actual); <ide> public void resolverUrlPathNoMatch() { <ide> public void resolveResourceAcceptEncodingInCacheKey() { <ide> String file = "bar.css"; <ide> MockHttpServletRequest request = new MockHttpServletRequest("GET", file); <del> request.addHeader("Accept-Encoding", "gzip"); <add> request.addHeader("Accept-Encoding", "gzip ; a=b , deflate , brotli ; c=d "); <ide> Resource expected = this.chain.resolveResource(request, file, this.locations); <ide> <del> String cacheKey = CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + file + "+encoding=gzip"; <add> String cacheKey = getCacheKey(file + "+encoding=brotli,deflate,gzip"); <ide> Object actual = this.cache.get(cacheKey).get(); <ide> <ide> assertSame(expected, actual); <ide> public void resolveResourceNoAcceptEncoding() { <ide> MockHttpServletRequest request = new MockHttpServletRequest("GET", file); <ide> Resource expected = this.chain.resolveResource(request, file, this.locations); <ide> <del> String cacheKey = CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + file; <add> String cacheKey = getCacheKey(file); <ide> Object actual = this.cache.get(cacheKey).get(); <ide> <ide> assertEquals(expected, actual); <ide> public void resolveResourceNoAcceptEncoding() { <ide> public void resolveResourceMatchingEncoding() { <ide> Resource resource = Mockito.mock(Resource.class); <ide> Resource gzipped = Mockito.mock(Resource.class); <del> this.cache.put(CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + "bar.css", resource); <del> this.cache.put(CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + "bar.css+encoding=gzip", gzipped); <add> this.cache.put(getCacheKey("bar.css"), resource); <add> this.cache.put(getCacheKey("bar.css+encoding=gzip"), gzipped); <ide> <ide> MockHttpServletRequest request = new MockHttpServletRequest("GET", "bar.css"); <ide> assertSame(resource, this.chain.resolveResource(request,"bar.css", this.locations)); <ide> public void resolveResourceMatchingEncoding() { <ide> assertSame(gzipped, this.chain.resolveResource(request, "bar.css", this.locations)); <ide> } <ide> <add> private static String getCacheKey(String key) { <add> return CachingResourceResolver.RESOLVED_RESOURCE_CACHE_KEY_PREFIX + key; <add> } <add> <ide> } <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/resource/EncodedResourceResolverTests.java <ide> import org.springframework.core.io.ClassPathResource; <ide> import org.springframework.core.io.FileSystemResource; <ide> import org.springframework.core.io.Resource; <add>import org.springframework.http.HttpHeaders; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <ide> import org.springframework.util.FileCopyUtils; <ide> <ide> public void resolveGzipped() { <ide> <ide> assertEquals(getResource(file + ".gz").getDescription(), actual.getDescription()); <ide> assertEquals(getResource(file).getFilename(), actual.getFilename()); <add> <ide> assertTrue(actual instanceof HttpResource); <add> HttpHeaders headers = ((HttpResource) actual).getResponseHeaders(); <add> assertEquals("gzip", headers.getFirst(HttpHeaders.CONTENT_ENCODING)); <add> assertEquals("Accept-Encoding", headers.getFirst(HttpHeaders.VARY)); <ide> } <ide> <ide> @Test
10
Python
Python
fix spancat for empty docs and zero suggestions
c9baf9d196cba07fe1b1c636bcab3c80c6b81b44
<ide><path>spacy/ml/extract_spans.py <ide> def forward( <ide> X, spans = source_spans <ide> assert spans.dataXd.ndim == 2 <ide> indices = _get_span_indices(ops, spans, X.lengths) <del> Y = Ragged(X.dataXd[indices], spans.dataXd[:, 1] - spans.dataXd[:, 0]) # type: ignore[arg-type, index] <add> if len(indices) > 0: <add> Y = Ragged(X.dataXd[indices], spans.dataXd[:, 1] - spans.dataXd[:, 0]) # type: ignore[arg-type, index] <add> else: <add> Y = Ragged( <add> ops.xp.zeros(X.dataXd.shape, dtype=X.dataXd.dtype), <add> ops.xp.zeros((len(X.lengths),), dtype="i"), <add> ) <ide> x_shape = X.dataXd.shape <ide> x_lengths = X.lengths <ide> <ide> def _get_span_indices(ops, spans: Ragged, lengths: Ints1d) -> Ints1d: <ide> for j in range(spans_i.shape[0]): <ide> indices.append(ops.xp.arange(spans_i[j, 0], spans_i[j, 1])) # type: ignore[call-overload, index] <ide> offset += length <del> return ops.flatten(indices) <add> return ops.flatten(indices, dtype="i", ndim_if_empty=1) <ide> <ide> <ide> def _ensure_cpu(spans: Ragged, lengths: Ints1d) -> Tuple[Ragged, Ints1d]: <ide><path>spacy/pipeline/spancat.py <ide> def ngram_suggester(docs: Iterable[Doc], *, ops: Optional[Ops] = None) -> Ragged <ide> if len(spans) > 0: <ide> output = Ragged(ops.xp.vstack(spans), lengths_array) <ide> else: <del> output = Ragged(ops.xp.zeros((0, 0)), lengths_array) <add> output = Ragged(ops.xp.zeros((0, 0), dtype="i"), lengths_array) <ide> <ide> assert output.dataXd.ndim == 2 <ide> return output <ide><path>spacy/tests/pipeline/test_spancat.py <ide> import pytest <ide> import numpy <ide> from numpy.testing import assert_array_equal, assert_almost_equal <del>from thinc.api import get_current_ops <add>from thinc.api import get_current_ops, Ragged <ide> <ide> from spacy import util <ide> from spacy.lang.en import English <ide> "I like London and Berlin", <ide> {"spans": {SPAN_KEY: [(7, 13, "LOC"), (18, 24, "LOC"), (7, 24, "DOUBLE_LOC")]}}, <ide> ), <add> ("", {"spans": {SPAN_KEY: []}}), <ide> ] <ide> <ide> <ide> def test_overfitting_IO_overlapping(): <ide> "London and Berlin", <ide> } <ide> assert set([span.label_ for span in spans2]) == {"LOC", "DOUBLE_LOC"} <add> <add> <add>def test_zero_suggestions(): <add> # Test with a suggester that returns 0 suggestions <add> <add> @registry.misc("test_zero_suggester") <add> def make_zero_suggester(): <add> def zero_suggester(docs, *, ops=None): <add> if ops is None: <add> ops = get_current_ops() <add> return Ragged( <add> ops.xp.zeros((0, 0), dtype="i"), ops.xp.zeros((len(docs),), dtype="i") <add> ) <add> <add> return zero_suggester <add> <add> fix_random_seed(0) <add> nlp = English() <add> spancat = nlp.add_pipe( <add> "spancat", <add> config={"suggester": {"@misc": "test_zero_suggester"}, "spans_key": SPAN_KEY}, <add> ) <add> train_examples = make_examples(nlp) <add> optimizer = nlp.initialize(get_examples=lambda: train_examples) <add> assert spancat.model.get_dim("nO") == 2 <add> assert set(spancat.labels) == {"LOC", "PERSON"} <add> <add> nlp.update(train_examples, sgd=optimizer)
3
Python
Python
use urls functions from django instead of compat
e5441d845e34f1e1bb2b7464d31aa3df7b02d0fe
<ide><path>tests/urls.py <ide> """ <ide> Blank URLConf just to keep the test suite happy <ide> """ <del>from rest_framework.compat import patterns <add>from django.conf.urls import patterns <ide> <ide> urlpatterns = patterns('')
1
Javascript
Javascript
reuse path variable
eedefb4183249eaf8c29d8ebb6dce78113bccc52
<ide><path>packages/ember-routing/lib/location/hash_location.js <ide> Ember.HashLocation = Ember.Object.extend({ <ide> <ide> set(self, 'lastSetURL', null); <ide> <del> callback(location.hash.substr(1)); <add> callback(path); <ide> }); <ide> }); <ide> },
1
PHP
PHP
fix 2 tests
637d17ce60082009e0740c02fbf1f8964cf1edb8
<ide><path>tests/Foundation/FoundationAuthorizesRequestsTraitTest.php <ide> public function update() <ide> return true; <ide> } <ide> <del> public function test_policy_method_may_be_guessed_passing_model_instance() <add> public function testPolicyMethodMayBeGuessedPassingModelInstance() <ide> { <ide> $_SERVER['_test.authorizes.trait.policy'] = true; <ide> <ide> return true; <ide> } <ide> <del> public function test_policy_method_may_be_guessed_passing_class_name() <add> public function testPolicyMethodMayBeGuessedPassingClassName() <ide> { <ide> $_SERVER['_test.authorizes.trait.policy'] = true; <ide>
1
Text
Text
add release notes for 1.7.2
c9a92fcad52477f93ddbee5091e76d8763cde0bd
<ide><path>CHANGELOG.md <add><a name="1.7.2"></a> <add># 1.7.2 extreme-compatiplication (2018-06-12) <add> <add>In the previous release, we removed a private, undocumented API that was no longer used by <add>AngularJS. It turned out that several popular UI libraries (such as <add>[AngularJS Material](https://material.angularjs.org/), <add>[UI Bootstrap](https://angular-ui.github.io/bootstrap/), <add>[ngDialog](http://likeastore.github.io/ngDialog/) and probably others) relied on that API. <add> <add>In order to avoid unnecessary pain for developers, this release reverts the removal of the private <add>API and restores compatibility of the aforementioned libraries with the latest AngularJS. <add> <add>## Reverts <add>- **$compile:** remove `preAssignBindingsEnabled` leftovers <add> ([2da495](https://github.com/angular/angular.js/commit/2da49504065e9e2b71a7a5622e45118d8abbe87e), <add> [#16580](https://github.com/angular/angular.js/pull/16580), <add> [a81232](https://github.com/angular/angular.js/commit/a812327acda8bc890a4c4e809f0debb761c29625), <add> [#16595](https://github.com/angular/angular.js/pull/16595)) <add> <add> <ide> <a name="1.7.1"></a> <ide> # 1.7.1 momentum-defiance (2018-06-08) <ide>
1
Ruby
Ruby
raise when no compatible compiler
4fdbb2d685d1c20e84d1d31bc50f638aa1a800e1
<ide><path>Library/Homebrew/build.rb <ide> def install f <ide> end <ide> <ide> if f.fails_with? ENV.compiler <del> ENV.send CompilerSelector.new(f, ENV.compiler).compiler <add> begin <add> ENV.send CompilerSelector.new(f, ENV.compiler).compiler <add> rescue CompilerSelectionError => e <add> raise e.message <add> end <ide> end <ide> <ide> f.brew do <ide><path>Library/Homebrew/compilers.rb <ide> def initialize(f, old_compiler) <ide> end <ide> end <ide> <add> # Attempts to select an appropriate alternate compiler, but <add> # if none can be found raises CompilerError instead <ide> def compiler <ide> begin <ide> cc = @compilers.pop <ide> end while @f.fails_with?(cc) <del> cc.nil? ? @old_compiler : cc.name <add> <add> if cc.nil? <add> raise CompilerSelectionError <add> else <add> cc.name <add> end <ide> end <ide> <ide> private <ide><path>Library/Homebrew/exceptions.rb <ide> def dump <ide> end <ide> end <ide> <add># raised by CompilerSelector if the formula fails with all of <add># the compilers available on the user's system <add>class CompilerSelectionError < StandardError <add> def message <add> if MacOS.version > :tiger then <<-EOS.undent <add> This formula cannot be built with any available compilers. <add> To install this formula, you may need to: <add> brew tap homebrew/dupes <add> brew install apple-gcc42 <add> EOS <add> # tigerbrew has a separate apple-gcc42 for Xcode 2.5 <add> else <<-EOS.undent <add> This formula cannot be built with any available compilers. <add> To install this formula, you need to: <add> brew install apple-gcc42 <add> EOS <add> end <add> end <add>end <add> <ide> # raised in CurlDownloadStrategy.fetch <ide> class CurlDownloadStrategyError < RuntimeError <ide> end <ide><path>Library/Homebrew/test/test_compiler_selector.rb <ide> def actual_cc <ide> <ide> def test_all_compiler_failures <ide> @f << :clang << :llvm << :gcc <del> assert_equal @cc, actual_cc <add> assert_raise(CompilerSelectionError) { actual_cc } <ide> end <ide> <ide> def test_no_compiler_failures <ide> def test_older_clang_precedence <ide> def test_missing_gcc <ide> MacOS.stubs(:gcc_build_version).returns(nil) <ide> @f << :clang << :llvm <del> assert_equal @cc, actual_cc <add> assert_raise(CompilerSelectionError) { actual_cc } <ide> end <ide> <ide> def test_missing_llvm_and_gcc <ide> MacOS.stubs(:gcc_build_version).returns(nil) <ide> MacOS.stubs(:llvm_build_version).returns(nil) <ide> @f << :clang <del> assert_equal @cc, actual_cc <add> assert_raise(CompilerSelectionError) { actual_cc } <ide> end <ide> end
4
Ruby
Ruby
fix tests on 1.9.2
8aa86babad2eddb5244ba79b4e3b5702e7e77217
<ide><path>actionpack/lib/action_controller/metal.rb <ide> def initialize(*) <ide> @_status = 200 <ide> @_request = nil <ide> @_response = nil <add> @_routes = nil <ide> super <ide> end <ide> <ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> class << self <ide> singleton_class.send(:define_method, :_routes) { routes } <ide> end <ide> <del> def initialize(*) <del> @_routes = nil <del> super <del> end <del> <ide> define_method(:_routes) { @_routes || routes } <ide> end <ide>
2
Ruby
Ruby
add require and move escape to private method
4247f02688e20af183f75b943b2444b66979198f
<ide><path>actionpack/lib/action_dispatch/middleware/cookies.rb <ide> require 'active_support/key_generator' <ide> require 'active_support/message_verifier' <ide> require 'active_support/json' <add>require 'rack/utils' <ide> <ide> module ActionDispatch <ide> class Request <ide> def update_cookies_from_jar <ide> end <ide> <ide> def to_header <del> @cookies.map { |k,v| "#{::Rack::Utils.escape(k)}=#{::Rack::Utils.escape(v)}" }.join ';' <add> @cookies.map { |k,v| "#{escape(k)}=#{escape(v)}" }.join ';' <ide> end <ide> <ide> def handle_options(options) #:nodoc: <ide> def write(headers) <ide> <ide> private <ide> <add> def escape(string) <add> ::Rack::Utils.escape(string) <add> end <add> <ide> def make_set_cookie_header(header) <ide> header = @set_cookies.inject(header) { |m, (k, v)| <ide> if write_cookie?(v)
1
Python
Python
add dtype to zeros and ones allocations
64e1320ca006a62f1188377a617bd3347dcfce7a
<ide><path>keras/engine/training.py <ide> def standardize_weights(y, sample_weight=None, class_weight=None, <ide> return weights <ide> else: <ide> if sample_weight_mode is None: <del> return np.ones((y.shape[0],)) <add> return np.ones((y.shape[0],), dtype=K.floatx()) <ide> else: <del> return np.ones((y.shape[0], y.shape[1])) <add> return np.ones((y.shape[0], y.shape[1]), dtype=K.floatx()) <ide> <ide> <ide> def generator_queue(generator, max_q_size=10, <ide> def _predict_loop(self, f, ins, batch_size=32, verbose=0): <ide> if batch_index == 0: <ide> for batch_out in batch_outs: <ide> shape = (nb_sample,) + batch_out.shape[1:] <del> outs.append(np.zeros(shape)) <add> outs.append(np.zeros(shape, dtype=K.floatx())) <ide> <ide> for i, batch_out in enumerate(batch_outs): <ide> outs[i][batch_start:batch_end] = batch_out <ide> def predict_generator(self, generator, val_samples, max_q_size=10, nb_worker=1, <ide> if len(all_outs) == 0: <ide> for out in outs: <ide> shape = (val_samples,) + out.shape[1:] <del> all_outs.append(np.zeros(shape)) <add> all_outs.append(np.zeros(shape, dtype=K.floatx())) <ide> <ide> for i, out in enumerate(outs): <ide> all_outs[i][processed_samples:(processed_samples + nb_samples)] = out
1
Javascript
Javascript
replace flag expose_internals to expose-internals
7534477786bfaa06be4210e35f07860cb6ac5b1c
<ide><path>test/parallel/test-child-process-bad-stdio.js <ide> 'use strict'; <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const cp = require('child_process'); <ide><path>test/parallel/test-child-process-exec-kill-throws.js <ide> 'use strict'; <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const cp = require('child_process'); <ide><path>test/parallel/test-child-process-http-socket-leak.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> 'use strict'; <ide> <ide><path>test/parallel/test-child-process-spawnsync-kill-signal.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-child-process-spawnsync-shell.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-child-process-validate-stdio.js <ide> 'use strict'; <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-child-process-windows-hide.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-constants.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> <ide> require('../common'); <ide><path>test/parallel/test-fs-open-flags.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> const common = require('../common'); <ide> <ide><path>test/parallel/test-http2-compat-socket.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> 'use strict'; <ide> <ide><path>test/parallel/test-http2-socket-proxy.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> 'use strict'; <ide> <ide><path>test/parallel/test-icu-stringwidth.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> const common = require('../common'); <ide> <ide><path>test/parallel/test-internal-util-decorate-error-stack.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> require('../common'); <ide> const fixtures = require('../common/fixtures'); <ide><path>test/parallel/test-os-checked-function.js <ide> 'use strict'; <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> require('../common'); <ide> const { internalBinding } = require('internal/test/binding'); <ide><path>test/parallel/test-readline-interface.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> const common = require('../common'); <ide> <ide><path>test/parallel/test-readline-tab-complete.js <ide> 'use strict'; <ide> <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> const readline = require('readline'); <ide><path>test/parallel/test-repl-history-perm.js <ide> <ide> // Verifies that the REPL history file is created with mode 0600 <ide> <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> const common = require('../common'); <ide> <ide><path>test/parallel/test-repl.js <ide> const errorTests = [ <ide> expect: '... ... ... undefined' <ide> }, <ide> // REPL should get a normal require() function, not one that allows <del> // access to internal modules without the --expose_internals flag. <add> // access to internal modules without the --expose-internals flag. <ide> { <ide> send: 'require("internal/repl")', <ide> expect: [ <ide><path>test/parallel/test-safe-get-env.js <ide> 'use strict'; <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-stream-buffer-list.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-stream2-readable-from-list.js <ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> 'use strict'; <ide> require('../common'); <ide> const assert = require('assert'); <ide><path>test/parallel/test-tls-parse-cert-string.js <ide> const { <ide> restoreStderr <ide> } = require('../common/hijackstdio'); <ide> const assert = require('assert'); <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> const internalTLS = require('internal/tls'); <ide> const tls = require('tls'); <ide> <ide><path>test/parallel/test-tls-wrap-timeout.js <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> 'use strict'; <ide> const common = require('../common'); <ide><path>test/parallel/test-util-internal.js <ide> 'use strict'; <del>// Flags: --expose_internals <add>// Flags: --expose-internals <ide> <ide> require('../common'); <ide> const assert = require('assert');
24
Text
Text
add table of contents to contributing doc
794e5e6098110d675d08058eacd35978b91887e9
<ide><path>CONTRIBUTING.md <ide> We'd love for you to contribute to our source code and to make AngularJS even better than it is <ide> today! Here are the guidelines we'd like you to follow: <ide> <del>## Code of Conduct <add> - [Code of Conduct](#coc) <add> - [Question or Problem?](#question) <add> - [Issues and Bugs](#issue) <add> - [Feature Requests](#feature) <add> - [Submission Guidelines](#submit) <add> - [Coding Rules](#rules) <add> - [Commit Message Guidelines](#commit) <add> - [Signing the CLA](#cla) <add> - [Further Info](#info) <add> <add>## <a name="coc"></a> Code of Conduct <ide> Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc]. <ide> <del>## Got a Question or Problem? <add>## <a name="question"></a> Got a Question or Problem? <ide> <ide> If you have questions about how to use AngularJS, please direct these to the [Google Group][groups] <ide> discussion list or [StackOverflow][stackoverflow]. We are also available on [IRC][irc]. <ide> <del>## Found an Issue? <add>## <a name="issue"></a> Found an Issue? <ide> If you find a bug in the source code or a mistake in the documentation, you can help us by <ide> submitting and issue to our [GitHub Repository][github]. Even better you can submit a Pull Request <ide> with a fix. <ide> approach is to submit a patch to the I18N project directly, instead of submittin <ide> <ide> **Please see the Submission Guidelines below**. <ide> <del>## Want a Feature? <add>## <a name="feature"></a> Want a Feature? <ide> You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you <ide> would like to implement a new feature then consider what kind of change it is: <ide> <ide> project. <ide> * **Small Changes** can be crafted and submitted to [GitHub Repository][github] as a Pull Request. <ide> <ide> <del>## Want a Doc Fix? <add>## <a name="docs"></a> Want a Doc Fix? <ide> If you want to help improve the docs, it's a good idea to let others know what you're working on to <ide> minimize duplication of effort. Before starting, check out the issue queue for [Milestone:Docs Only](https://github.com/angular/angular.js/issues?milestone=24&state=open). <ide> Comment on an issue to let others know what you're working on, or create a new issue if your work <ide> is labeled "docs:" and follows the **Git Commit Guidelines** outlined below. <ide> <ide> If you're just making a small change, don't worry about filing an issue first. Use the friendly blue "Improve this doc" button at the top right of the doc page to fork the repository in-place and make a quick change on the fly. <ide> <del>## Submission Guidelines <add>## <a name="submit"></a> Submission Guidelines <ide> <ide> ### Submitting an Issue <ide> Before you submit your issue search the archive, maybe your question was already answered. <ide> from the main (upstream) repository: <ide> git pull --ff upstream master <ide> ``` <ide> <del>## Coding Rules <add>## <a name="rules"></a> Coding Rules <ide> To ensure consistency throughout the source code, keep these rules in mind as you are working: <ide> <ide> * All features or bug fixes **must be tested** by one or more [specs][unit-testing]. <ide> To ensure consistency throughout the source code, keep these rules in mind as yo <ide> * We **don't go crazy with type annotations** for private internal APIs unless it's an internal API <ide> that is used throughout AngularJS. The best guidance is to do what makes the most sense. <ide> <del>## Git Commit Guidelines <add>## <a name="commit"></a> Git Commit Guidelines <ide> <ide> We have very precise rules over how our git commit messages can be formatted. This leads to **more <ide> readable messages** that are easy to follow when looking through the **project history**. But also, <ide> reference GitHub issues that this commit **Closes**. <ide> <ide> A detailed explanation can be found in this [document][commit-message-format]. <ide> <del>## Signing the CLA <add>## <a name="cla"></a> Signing the CLA <ide> <ide> Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code <ide> changes to be accepted, the CLA must be signed. It's a quick process, we promise! <ide> changes to be accepted, the CLA must be signed. It's a quick process, we promise <ide> * For corporations we'll need you to <ide> [print, sign and one of scan+email, fax or mail the form][corporate-cla]. <ide> <del>## Further Information <add>## <a name="info"></a> Further Information <ide> You can find out more detailed information about contributing in the <ide> [AngularJS documentation][contributing]. <ide>
1
PHP
PHP
fix failing tests for cookie encryption
dee7331c630b2bd39f8a3d8f83aea56eb5ff859d
<ide><path>tests/TestCase/TestSuite/CookieEncryptedUsingControllerTest.php <ide> public function setUp() <ide> <ide> Security::setSalt('abcdabcdabcdabcdabcdabcdabcdabcdabcd'); <ide> Router::connect('/:controller/:action/*', [], ['routeClass' => 'InflectedRoute']); <del> DispatcherFactory::clear(); <del> DispatcherFactory::add('Routing'); <del> DispatcherFactory::add('ControllerFactory'); <del> $this->useHttpServer(false); <add> $this->useHttpServer(true); <ide> } <ide> <ide> /** <ide><path>tests/test_app/TestApp/Controller/CookieComponentTestController.php <ide> public function view($key = null) <ide> if (isset($key)) { <ide> $this->Cookie->setConfig('key', $key); <ide> } <del> $this->set('ValueFromRequest', $this->request->cookie('NameOfCookie')); <add> $this->set('ValueFromRequest', $this->request->getCookie('NameOfCookie')); <ide> $this->set('ValueFromCookieComponent', $this->Cookie->read('NameOfCookie')); <ide> } <ide> <ide> public function view($key = null) <ide> */ <ide> public function set_cookie($key = null) <ide> { <del> $this->autoRender = false; <ide> if (isset($key)) { <ide> $this->Cookie->setConfig('key', $key); <ide> }
2
Ruby
Ruby
fix prerelease audit
27ffa4e6e02d1108393e50b728712af74cf6b7ef
<ide><path>Library/Homebrew/utils/shared_audits.rb <ide> def github_release(user, repo, tag, formula: nil, cask: nil) <ide> <ide> return "#{tag} is a GitHub pre-release." if release["prerelease"] && [version, "all"].exclude?(exception) <ide> <del> return "#{tag} is not a GitHub pre-release but '#{name}' is in the GitHub prerelease allowlist." if exception <add> if !release["prerelease"] && exception <add> return "#{tag} is not a GitHub pre-release but '#{name}' is in the GitHub prerelease allowlist." <add> end <ide> <ide> return "#{tag} is a GitHub draft." if release["draft"] <ide> end
1
PHP
PHP
add supporting test
43b08f8cb378133d9a047fda703ac90e27a66cbc
<ide><path>tests/Validation/ValidationUniqueRuleTest.php <ide> public function testItCorrectlyFormatsAStringVersionOfTheRule() <ide> $rule->where('foo', '"bar"'); <ide> $this->assertSame('unique:table,NULL,NULL,id,foo,"""bar"""', (string) $rule); <ide> } <add> <add> public function testItIgnoresSoftDeletes() <add> { <add> $rule = new Unique('table'); <add> $rule->withoutTrashed(); <add> $this->assertSame('unique:table,NULL,NULL,id,deleted_at,"NULL"', (string) $rule); <add> <add> $rule = new Unique('table'); <add> $rule->withoutTrashed('softdeleted_at'); <add> $this->assertSame('unique:table,NULL,NULL,id,softdeleted_at,"NULL"', (string) $rule); <add> } <ide> } <ide> <ide> class EloquentModelStub extends Model
1
Go
Go
remove dead code
c957d9c768a3c2e56b31db09399b49b8dc66c3c1
<ide><path>integration-cli/docker_utils.go <ide> type Daemon struct { <ide> userlandProxy bool <ide> } <ide> <del>func enableUserlandProxy() bool { <del> if env := os.Getenv("DOCKER_USERLANDPROXY"); env != "" { <del> if val, err := strconv.ParseBool(env); err != nil { <del> return val <del> } <del> } <del> return true <del>} <del> <ide> // NewDaemon returns a Daemon instance to be used for testing. <ide> // This will create a directory such as d123456789 in the folder specified by $DEST. <ide> // The daemon will not automatically start.
1
Javascript
Javascript
add a child domain explicitly
ee2291eb0d6baa9fb82ed0fef623a3895bc1fc0d
<ide><path>test/simple/test-domain-multi.js <ide> a.on('error', function(er) { <ide> <ide> var http = require('http'); <ide> var server = http.createServer(function (req, res) { <del> // child domain. <del> // implicitly added to a, because we're in a when <del> // it is created. <add> // child domain of a. <ide> var b = domain.create(); <add> a.add(b); <ide> <ide> // treat these EE objects as if they are a part of the b domain <ide> // so, an 'error' event on them propagates to the domain, rather
1
Javascript
Javascript
remove unused styles
ffd7195543d883c7447de61ebbd8afb494576f63
<ide><path>Libraries/Inspector/BoxInspector.js <ide> const styles = StyleSheet.create({ <ide> textAlign: 'left', <ide> top: -3, <ide> }, <del> buffer: { <del> fontSize: 10, <del> color: 'yellow', <del> flex: 1, <del> textAlign: 'center', <del> }, <ide> innerText: { <ide> color: 'yellow', <ide> fontSize: 12, <ide><path>Libraries/Inspector/StyleInspector.js <ide> const styles = StyleSheet.create({ <ide> container: { <ide> flexDirection: 'row', <ide> }, <del> row: { <del> flexDirection: 'row', <del> alignItems: 'center', <del> justifyContent: 'space-around', <del> }, <ide> attr: { <ide> fontSize: 10, <ide> color: '#ccc', <ide><path>RNTester/js/AssetScaledImageExample.js <ide> const styles = StyleSheet.create({ <ide> flexDirection: 'row', <ide> alignSelf: 'center', <ide> }, <del> textColumn: { <del> flex: 1, <del> flexDirection: 'column', <del> }, <ide> imageWide: { <ide> borderWidth: 1, <ide> borderColor: 'black', <ide><path>RNTester/js/CameraRollView.js <ide> const styles = StyleSheet.create({ <ide> flexDirection: 'row', <ide> flex: 1, <ide> }, <del> url: { <del> fontSize: 9, <del> marginBottom: 14, <del> }, <ide> image: { <ide> margin: 4, <ide> }, <del> info: { <del> flex: 1, <del> }, <ide> container: { <ide> flex: 1, <ide> }, <ide><path>RNTester/js/ImageCapInsetsExample.js <ide> const styles = StyleSheet.create({ <ide> justifyContent: 'center', <ide> alignItems: 'center', <ide> }, <del> horizontal: { <del> flexDirection: 'row', <del> }, <ide> storyBackground: { <ide> width: 250, <ide> height: 150, <ide> borderWidth: 1, <ide> }, <del> text: { <del> fontSize: 13.5, <del> }, <ide> }); <ide> <ide> module.exports = ImageCapInsetsExample; <ide><path>RNTester/js/LayoutAnimationExample.js <ide> const styles = StyleSheet.create({ <ide> padding: 10, <ide> marginBottom: 10, <ide> }, <del> buttonText: { <del> fontSize: 16, <del> }, <ide> viewContainer: { <ide> flex: 1, <ide> flexDirection: 'row', <ide><path>RNTester/js/LinkingExample.js <ide> class IntentAndroidExample extends React.Component { <ide> } <ide> <ide> const styles = StyleSheet.create({ <del> container: { <del> flex: 1, <del> backgroundColor: 'white', <del> padding: 10, <del> paddingTop: 30, <del> }, <ide> button: { <ide> padding: 10, <ide> backgroundColor: '#3B5998', <ide><path>RNTester/js/ListViewPagingExample.js <ide> const styles = StyleSheet.create({ <ide> color: 'white', <ide> paddingHorizontal: 8, <ide> }, <del> rowText: { <del> color: '#888888', <del> }, <del> thumbText: { <del> fontSize: 20, <del> color: '#888888', <del> }, <ide> buttonContents: { <ide> flexDirection: 'row', <ide> justifyContent: 'center', <ide><path>RNTester/js/PermissionsExampleAndroid.android.js <ide> const styles = StyleSheet.create({ <ide> flex: 1, <ide> backgroundColor: 'white', <ide> }, <del> singleLine: { <del> fontSize: 16, <del> padding: 4, <del> }, <ide> text: { <ide> margin: 10, <ide> }, <ide><path>RNTester/js/PointerEventsExample.js <ide> const styles = StyleSheet.create({ <ide> borderColor: '#f0f0f0', <ide> backgroundColor: '#f9f9f9', <ide> }, <del> bottomSpacer: { <del> marginBottom: 100, <del> }, <ide> }); <ide> <ide> exports.framework = 'React'; <ide><path>RNTester/js/RNTesterBlock.js <ide> const styles = StyleSheet.create({ <ide> descriptionText: { <ide> fontSize: 14, <ide> }, <del> disclosure: { <del> position: 'absolute', <del> top: 0, <del> right: 0, <del> padding: 10, <del> }, <del> disclosureIcon: { <del> width: 12, <del> height: 8, <del> }, <ide> children: { <ide> margin: 10, <ide> }, <ide><path>RNTester/js/SliderExample.js <ide> class SlidingCompleteExample extends React.Component< <ide> } <ide> <ide> const styles = StyleSheet.create({ <del> slider: { <del> height: 10, <del> margin: 10, <del> }, <ide> text: { <ide> fontSize: 14, <ide> textAlign: 'center', <ide><path>RNTester/js/StatusBarExample.js <ide> const styles = StyleSheet.create({ <ide> backgroundColor: '#eeeeee', <ide> padding: 10, <ide> }, <del> title: { <del> marginTop: 16, <del> marginBottom: 8, <del> fontWeight: 'bold', <del> }, <ide> modalButton: { <ide> marginTop: 10, <ide> }, <ide><path>RNTester/js/TextInputExample.ios.js <ide> class AutogrowingTextInputExample extends React.Component< <ide> } <ide> <ide> const styles = StyleSheet.create({ <del> page: { <del> paddingBottom: 300, <del> }, <ide> default: { <ide> borderWidth: StyleSheet.hairlineWidth, <ide> borderColor: '#0f0f0f', <ide> const styles = StyleSheet.create({ <ide> fontFamily: 'Cochin', <ide> height: 60, <ide> }, <del> multilineChild: { <del> width: 50, <del> height: 40, <del> position: 'absolute', <del> right: 5, <del> backgroundColor: 'red', <del> }, <ide> eventLabel: { <ide> margin: 3, <ide> fontSize: 12, <ide><path>RNTester/js/TouchableExample.js <ide> const styles = StyleSheet.create({ <ide> justifyContent: 'center', <ide> flexDirection: 'row', <ide> }, <del> icon: { <del> width: 24, <del> height: 24, <del> }, <ide> image: { <ide> width: 50, <ide> height: 50, <ide><path>RNTester/js/WebViewExample.js <ide> const styles = StyleSheet.create({ <ide> color: 'white', <ide> fontSize: 13, <ide> }, <del> spinner: { <del> width: 20, <del> marginRight: 6, <del> }, <ide> buttons: { <ide> flexDirection: 'row', <ide> height: 30, <ide><path>ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js <ide> const ClippableView = requireNativeComponent('ClippableView'); <ide> <ide> class ClippingSample1 extends React.Component { <ide> render() { <del> const styles = sample1Styles; <ide> return ( <ide> <View> <ide> <ClippableView <ide> clippableViewID="outer" <del> style={styles.outer} <add> style={sample1Styles.outer} <ide> removeClippedSubviews={true}> <ide> <ClippableView <ide> clippableViewID="inner1" <del> style={[styles.inner, styles.inner1]} <add> style={[sample1Styles.inner, sample1Styles.inner1]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner2" <del> style={[styles.inner, styles.inner2]} <add> style={[sample1Styles.inner, sample1Styles.inner2]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner3" <del> style={[styles.inner, styles.inner3]} <add> style={[sample1Styles.inner, sample1Styles.inner3]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner4" <del> style={[styles.inner, styles.inner4]} <add> style={[sample1Styles.inner, sample1Styles.inner4]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner5" <del> style={[styles.inner, styles.inner5]} <add> style={[sample1Styles.inner, sample1Styles.inner5]} <ide> /> <ide> </ClippableView> <ide> </View> <ide> const sample1Styles = StyleSheet.create({ <ide> <ide> class ClippingSample2 extends React.Component { <ide> render() { <del> const styles = sample2Styles; <ide> return ( <ide> <View> <ide> <ClippableView <ide> clippableViewID="outer" <del> style={styles.outer} <add> style={sample2Styles.outer} <ide> removeClippedSubviews={true}> <ide> <ClippableView <ide> clippableViewID="complexInner" <del> style={styles.complexInner} <add> style={sample2Styles.complexInner} <ide> removeClippedSubviews={true}> <ide> <ClippableView <ide> clippableViewID="inner1" <del> style={[styles.inner, styles.inner1]} <add> style={[sample2Styles.inner, sample2Styles.inner1]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner2" <del> style={[styles.inner, styles.inner2]} <add> style={[sample2Styles.inner, sample2Styles.inner2]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner3" <del> style={[styles.inner, styles.inner3]} <add> style={[sample2Styles.inner, sample2Styles.inner3]} <ide> /> <ide> <ClippableView <ide> clippableViewID="inner4" <del> style={[styles.inner, styles.inner4]} <add> style={[sample2Styles.inner, sample2Styles.inner4]} <ide> /> <ide> </ClippableView> <ide> </ClippableView> <ide> const sample2Styles = StyleSheet.create({ <ide> <ide> class UpdatingSample1 extends React.Component { <ide> render() { <del> const styles = updating1Styles; <ide> const inner1Styles = [ <del> styles.inner1, <add> updating1Styles.inner1, <ide> {height: this.props.update1 ? 200 : 100}, <ide> ]; <del> const inner2Styles = [styles.inner2, {top: this.props.update2 ? 200 : 50}]; <add> <add> const inner2Styles = [ <add> updating1Styles.inner2, <add> {top: this.props.update2 ? 200 : 50}, <add> ]; <add> <ide> return ( <ide> <View> <ide> <ClippableView <ide> clippableViewID="outer" <del> style={styles.outer} <add> style={updating1Styles.outer} <ide> removeClippedSubviews={true}> <ide> <ClippableView clippableViewID="inner1" style={inner1Styles} /> <ide> <ClippableView clippableViewID="inner2" style={inner2Styles} /> <ide> const updating1Styles = StyleSheet.create({ <ide> <ide> class UpdatingSample2 extends React.Component { <ide> render() { <del> const styles = updating2Styles; <del> const outerStyles = [styles.outer, {height: this.props.update ? 200 : 100}]; <add> const outerStyles = [ <add> updating2Styles.outer, <add> {height: this.props.update ? 200 : 100}, <add> ]; <add> <ide> return ( <ide> <View> <ide> <ClippableView <ide> clippableViewID="outer" <ide> style={outerStyles} <ide> removeClippedSubviews={true}> <del> <ClippableView clippableViewID="inner" style={styles.inner} /> <add> <ClippableView <add> clippableViewID="inner" <add> style={updating2Styles.inner} <add> /> <ide> </ClippableView> <ide> </View> <ide> ); <ide> const updating2Styles = StyleSheet.create({ <ide> <ide> class ScrollViewTest extends React.Component { <ide> render() { <del> const styles = scrollTestStyles; <ide> const children = []; <ide> for (let i = 0; i < 4; i++) { <ide> children[i] = ( <del> <ClippableView key={i} style={styles.row} clippableViewID={'' + i} /> <add> <ClippableView <add> key={i} <add> style={scrollTestStyles.row} <add> clippableViewID={'' + i} <add> /> <ide> ); <ide> } <ide> for (let i = 4; i < 6; i++) { <ide> const viewID = 'C' + (i - 4); <ide> children[i] = ( <ide> <ClippableView <ide> key={i} <del> style={styles.complex} <add> style={scrollTestStyles.complex} <ide> clippableViewID={viewID} <ide> removeClippedSubviews={true}> <del> <ClippableView style={styles.inner} clippableViewID={viewID + '.1'} /> <del> <ClippableView style={styles.inner} clippableViewID={viewID + '.2'} /> <add> <ClippableView <add> style={scrollTestStyles.inner} <add> clippableViewID={viewID + '.1'} <add> /> <add> <ClippableView <add> style={scrollTestStyles.inner} <add> clippableViewID={viewID + '.2'} <add> /> <ide> </ClippableView> <ide> ); <ide> } <ide> <ide> return ( <ide> <ScrollView <ide> removeClippedSubviews={true} <del> style={styles.scrollView} <add> style={scrollTestStyles.scrollView} <ide> testID="scroll_view"> <ide> {children} <ide> </ScrollView> <ide><path>ReactAndroid/src/androidTest/js/UIManagerTestModule.js <ide> const FlexTestAppStyles = StyleSheet.create({ <ide> child: { <ide> flex: 1, <ide> }, <del> absolute: { <del> position: 'absolute', <del> top: 15, <del> left: 10, <del> width: 50, <del> height: 60, <del> }, <ide> bgRed: { <ide> backgroundColor: '#ff0000', <ide> },
18
Python
Python
fix doc typo
b8aec1277c3bfd6d8fdcdd637f06ac6958a03871
<ide><path>rest_framework/response.py <ide> <ide> class Response(SimpleTemplateResponse): <ide> """ <del> An HttpResponse that allows it's data to be rendered into <add> An HttpResponse that allows its data to be rendered into <ide> arbitrary media types. <ide> """ <ide>
1
Javascript
Javascript
remove dead code and fix code style issues
52ee1ab5eb0f3197453b26c60a70239ac3fffea7
<ide><path>src/Angular.js <ide> <ide> //////////////////////////////////// <ide> <del>if (typeof document.getAttribute == $undefined) <add>if (typeof document.getAttribute == 'undefined') <ide> document.getAttribute = function() {}; <ide> <ide> /** <ide> if ('i' !== 'I'.toLowerCase()) { <ide> function fromCharCode(code) {return String.fromCharCode(code);} <ide> <ide> <del>var $boolean = 'boolean', <del> $console = 'console', <del> $length = 'length', <del> $name = 'name', <del> $object = 'object', <del> $string = 'string', <del> $undefined = 'undefined', <del> Error = window.Error, <add>var Error = window.Error, <ide> /** holds major version number for IE or NaN for real browsers */ <ide> msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]), <ide> jqLite, // delay binding since jQuery could be loaded after us. <ide> function forEach(obj, iterator, context) { <ide> if (obj) { <ide> if (isFunction(obj)){ <ide> for (key in obj) { <del> if (key != 'prototype' && key != $length && key != $name && obj.hasOwnProperty(key)) { <add> if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) { <ide> iterator.call(context, obj[key], key); <ide> } <ide> } <ide> function sortedKeys(obj) { <ide> } <ide> <ide> function forEachSorted(obj, iterator, context) { <del> var keys = sortedKeys(obj) <add> var keys = sortedKeys(obj); <ide> for ( var i = 0; i < keys.length; i++) { <ide> iterator.call(context, obj[keys[i]], keys[i]); <ide> } <ide> function valueFn(value) {return function() {return value;};} <ide> * @param {*} value Reference to check. <ide> * @returns {boolean} True if `value` is undefined. <ide> */ <del>function isUndefined(value){return typeof value == $undefined;} <add>function isUndefined(value){return typeof value == 'undefined';} <ide> <ide> <ide> /** <ide> function isUndefined(value){return typeof value == $undefined;} <ide> * @param {*} value Reference to check. <ide> * @returns {boolean} True if `value` is defined. <ide> */ <del>function isDefined(value){return typeof value != $undefined;} <add>function isDefined(value){return typeof value != 'undefined';} <ide> <ide> <ide> /** <ide> function isDefined(value){return typeof value != $undefined;} <ide> * @param {*} value Reference to check. <ide> * @returns {boolean} True if `value` is an `Object` but not `null`. <ide> */ <del>function isObject(value){return value!=null && typeof value == $object;} <add>function isObject(value){return value != null && typeof value == 'object';} <ide> <ide> <ide> /** <ide> function isObject(value){return value!=null && typeof value == $object;} <ide> * @param {*} value Reference to check. <ide> * @returns {boolean} True if `value` is a `String`. <ide> */ <del>function isString(value){return typeof value == $string;} <add>function isString(value){return typeof value == 'string';} <ide> <ide> <ide> /** <ide> function isFile(obj) { <ide> } <ide> <ide> <del>function isBoolean(value) {return typeof value == $boolean;} <del>function isTextNode(node) {return nodeName_(node) == '#text';} <add>function isBoolean(value) { <add> return typeof value == 'boolean'; <add>} <add> <ide> <ide> function trim(value) { <ide> return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; <ide> function makeMap(str){ <ide> } <ide> <ide> <del> <del>/** <del> * HTML class which is the only class which can be used in ngBind to inline HTML for security <del> * reasons. <del> * <del> * @constructor <del> * @param html raw (unsafe) html <del> * @param {string=} option If set to 'usafe', get method will return raw (unsafe/unsanitized) html <del> */ <del>function HTML(html, option) { <del> this.html = html; <del> this.get = lowercase(option) == 'unsafe' <del> ? valueFn(html) <del> : function htmlSanitize() { <del> var buf = []; <del> htmlParser(html, htmlSanitizeWriter(buf)); <del> return buf.join(''); <del> }; <del>} <del> <ide> if (msie < 9) { <ide> nodeName_ = function(element) { <ide> element = element.nodeName ? element : element[0]; <ide> if (msie < 9) { <ide> }; <ide> } <ide> <del>function isVisible(element) { <del> var rect = element[0].getBoundingClientRect(), <del> width = (rect.width || (rect.right||0 - rect.left||0)), <del> height = (rect.height || (rect.bottom||0 - rect.top||0)); <del> return width>0 && height>0; <del>} <ide> <ide> function map(obj, iterator, context) { <ide> var results = []; <ide> function equals(o1, o2) { <ide> return false; <ide> } <ide> <del>function setHtml(node, html) { <del> if (isLeafNode(node)) { <del> if (msie) { <del> node.innerText = html; <del> } else { <del> node.textContent = html; <del> } <del> } else { <del> node.innerHTML = html; <del> } <del>} <ide> <ide> function concat(array1, array2, index) { <ide> return array1.concat(slice.call(array2, index)); <ide> function toJsonReplacer(key, value) { <ide> } <ide> <ide> return val; <del>}; <add>} <ide> <ide> <ide> /** <ide> function startingTag(element) { <ide> // turns out IE does not let you set .html() on elements which <ide> // are not allowed to have children. So we just ignore it. <ide> element.html(''); <del> } catch(e) {}; <add> } catch(e) {} <ide> return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1]; <ide> } <ide> <ide> function angularInit(element, bootstrap) { <ide> forEach(element.querySelectorAll('.' + name), append); <ide> forEach(element.querySelectorAll('.' + name + '\\:'), append); <ide> forEach(element.querySelectorAll('[' + name + ']'), append); <del> }; <add> } <ide> }); <ide> <ide> forEach(elements, function(element) { <ide> function bindJQuery() { <ide> */ <ide> function assertArg(arg, name, reason) { <ide> if (!arg) { <del> var error = new Error("Argument '" + (name||'?') + "' is " + <del> (reason || "required")); <del> throw error; <add> throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required")); <ide> } <ide> return arg; <ide> } <ide><path>src/AngularPublic.js <ide> function publishExternalAPI(angular){ <ide> }); <ide> } <ide> ]); <del>}; <add>} <ide><path>src/angular-bootstrap.js <ide> <ide> var filename = /^(.*\/)angular-bootstrap.js(#.*)?$/, <ide> scripts = document.getElementsByTagName("SCRIPT"), <del> config, <ide> serverPath, <ide> match, <ide> globalVars = {}; <ide> document.write('<script type="text/javascript" src="' + serverPath + file + '" ' + <ide> 'onload="angularClobberTest(\'' + file + '\')"></script>'); <ide> } <del> } <add> }; <ide> <ide> function addCss(file) { <ide> document.write('<link rel="stylesheet" type="text/css" href="' + <ide><path>src/jqLite.js <ide> var jqCache = {}, <ide> function jqNextId() { return (jqId++); } <ide> <ide> <del>function getStyle(element) { <del> var current = {}, style = element[0].style, value, name, i; <del> if (typeof style.length == 'number') { <del> for(i = 0; i < style.length; i++) { <del> name = style[i]; <del> current[name] = style[name]; <del> } <del> } else { <del> for (name in style) { <del> value = style[name]; <del> if (1*name != name && name != 'cssText' && value && typeof value == 'string' && value !='false') <del> current[name] = value; <del> } <del> } <del> return current; <del>} <del> <del> <ide> var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; <ide> var MOZ_HACK_REGEXP = /^moz([A-Z])/; <ide> <ide> function createEventHandler(element) { <ide> }; <ide> eventHandler.fns = []; <ide> return eventHandler; <del>}; <add>} <ide> <ide> ////////////////////////////////////////// <ide> // Functions iterating traversal. <ide><path>src/ng/browser.js <ide> function Browser(window, document, body, $log, $sniffer) { <ide> * @returns {Object} Hash of all cookies (if called without any parameter) <ide> */ <ide> self.cookies = function(name, value) { <del> var cookieLength, cookieArray, cookie, i, keyValue, index; <add> var cookieLength, cookieArray, cookie, i, index; <ide> <ide> if (name) { <ide> if (value === undefined) { <ide><path>src/ng/compiler.js <ide> function $CompileProvider($provide) { <ide> if (isBooleanAttr(node, nName)) { <ide> attrs[nName] = true; // presence means true <ide> } <del> addAttrInterpolateDirective(node, directives, value, nName) <add> addAttrInterpolateDirective(node, directives, value, nName); <ide> addDirective(directives, nName, 'A', maxPriority); <ide> } <ide> } <ide><path>src/ng/directive/booleanAttrs.js <ide> forEach(BOOLEAN_ATTR, function(propName, attrName) { <ide> ngAttributeAliasDirectives[normalized] = function() { <ide> return { <ide> priority: 100, <del> compile: function(tpl, attr) { <add> compile: function() { <ide> return function(scope, element, attr) { <ide> attr.$$observers[attrName] = []; <ide> scope.$watch(attr[normalized], function(value) { <ide> forEach(['src', 'href'], function(attrName) { <ide> ngAttributeAliasDirectives[normalized] = function() { <ide> return { <ide> priority: 99, // it needs to run after the attributes are interpolated <del> compile: function(tpl, attr) { <add> compile: function() { <ide> return function(scope, element, attr) { <ide> var value = attr[normalized]; <ide> if (value == undefined) { <ide><path>src/ng/directive/directives.js <ide> function ngDirective(directive) { <ide> } <ide> directive.restrict = directive.restrict || 'AC'; <ide> return valueFn(directive); <del>}; <add>} <ide><path>src/ng/directive/form.js <ide> var nullFormCtrl = { <ide> $removeControl: noop, <ide> $setValidity: noop, <ide> $setDirty: noop <del>} <add>}; <ide> <ide> /** <ide> * @ngdoc object <ide><path>src/ng/directive/input.js <ide> function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { <ide> ctrl.$parsers.push(maxLengthValidator); <ide> ctrl.$formatters.push(maxLengthValidator); <ide> } <del>}; <add>} <ide> <ide> function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) { <ide> textInputType(scope, element, attr, ctrl, $sniffer, $browser); <ide> function radioInputType(scope, element, attr, ctrl) { <ide> scope.$apply(function() { <ide> ctrl.$setViewValue(attr.value); <ide> }); <del> }; <add> } <ide> }); <ide> <ide> ctrl.$render = function() { <ide> var NgModelController = ['$scope', '$exceptionHandler', '$attrs', 'ngModel', '$e <ide> this.$invalid = false; <ide> } <ide> } else { <del> toggleValidCss(false) <add> toggleValidCss(false); <ide> this.$invalid = true; <ide> this.$valid = false; <ide> invalidCount++; <ide><path>src/ng/directive/ngInclude.js <ide> var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' <ide> onloadExp = attr.onload || '', <ide> autoScrollExp = attr.autoscroll; <ide> <del> return function(scope, element, attr) { <add> return function(scope, element) { <ide> var changeCounter = 0, <ide> childScope; <ide> <ide><path>src/ng/directive/select.js <ide> var selectDirective = ['$compile', '$parse', function($compile, $parse) { <ide> while(optionGroupsCache.length > groupIndex) { <ide> optionGroupsCache.pop()[0].element.remove(); <ide> } <del> }; <add> } <ide> } <ide> } <ide> } <ide><path>src/ng/filter/filters.js <ide> function dateFilter($locale) { <ide> parts = [], <ide> fn, match; <ide> <del> format = format || 'mediumDate' <add> format = format || 'mediumDate'; <ide> format = $locale.DATETIME_FORMATS[format] || format; <ide> if (isString(date)) { <ide> if (NUMBER_STRING.test(date)) { <ide> function linkyFilter() { <ide> writer.chars(raw); <ide> return html.join(''); <ide> }; <del>}; <add>} <ide><path>src/ng/httpBackend.js <ide> function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, <ide> doneWrapper = function() { <ide> rawDocument.body.removeChild(script); <ide> if (done) done(); <del> } <add> }; <ide> <ide> script.type = 'text/javascript'; <ide> script.src = url; <ide> function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, <ide> } <ide> <ide> rawDocument.body.appendChild(script); <del> }; <add> } <ide> } <ide><path>src/ng/location.js <ide> function $LocationProvider(){ <ide> } else { <ide> return hashPrefix; <ide> } <del> } <add> }; <ide> <ide> /** <ide> * @ngdoc property <ide><path>src/ng/parse.js <ide> function lex(text){ <ide> <ide> //check if this is not a method invocation and if it is back out to last dot <ide> if (lastDot) { <del> peekIndex = index <add> peekIndex = index; <ide> while(peekIndex < text.length) { <ide> var ch = text.charAt(peekIndex); <ide> if (ch == '(') { <ide> function parser(text, json, $filter){ <ide> functionCall = _functionCall, <ide> fieldAccess = _fieldAccess, <ide> objectIndex = _objectIndex, <del> filterChain = _filterChain <add> filterChain = _filterChain; <add> <ide> if(json){ <ide> // The extra level of aliasing is here, just in case the lexer misses something, so that <ide> // we prevent any accidental execution in JSON. <ide> function parser(text, json, $filter){ <ide> }; <ide> } <ide> <del> function hasTokens () { <del> return tokens.length > 0; <del> } <del> <ide> function statements() { <ide> var statements = []; <ide> while(true) { <ide> function parser(text, json, $filter){ <ide> } <ide> } <ide> <del> function _functionIdent(fnScope) { <del> var token = expect(); <del> var element = token.text.split('.'); <del> var instance = fnScope; <del> var key; <del> for ( var i = 0; i < element.length; i++) { <del> key = element[i]; <del> if (instance) <del> instance = instance[key]; <del> } <del> if (!isFunction(instance)) { <del> throwError("should be a function", token); <del> } <del> return instance; <del> } <ide> <ide> function primary() { <ide> var primary; <ide><path>src/ng/rootScope.js <ide> function $RootScopeProvider(){ <ide> TTL = value; <ide> } <ide> return TTL; <del> } <add> }; <ide> <ide> this.$get = ['$injector', '$exceptionHandler', '$parse', <ide> function( $injector, $exceptionHandler, $parse) { <ide><path>src/ng/sanitize.js <ide> function $SanitizeProvider() { <ide> htmlParser(html, htmlSanitizeWriter(buf)); <ide> return buf.join(''); <ide> }); <del>}; <add>} <ide> <ide> // Regular Expressions for parsing tags and attributes <ide> var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, <ide><path>src/ngMock/angular-mocks.js <ide> angular.mock.$ExceptionHandlerProvider = function() { <ide> break; <ide> case 'log': <ide> var errors = []; <add> <ide> handler = function(e) { <ide> if (arguments.length == 1) { <ide> errors.push(e); <ide> } else { <ide> errors.push([].slice.call(arguments, 0)); <ide> } <del> } <add> }; <add> <ide> handler.errors = errors; <ide> break; <ide> default: <ide> angular.mock.$LogProvider = function() { <ide> if (angular.isString(timestamp)) { <ide> var tsStr = timestamp; <ide> <del> self.origDate = jsonStringToDate(timestamp) <add> self.origDate = jsonStringToDate(timestamp); <ide> <ide> timestamp = self.origDate.getTime(); <ide> if (isNaN(timestamp)) <ide> function createHttpBackendMock($delegate, $browser) { <ide> } <ide> }); <ide> } <del>}; <add>} <ide> <ide> function MockHttpExpectation(method, url, data, headers) { <ide> <ide> window.jasmine && (function(window) { <ide> */ <ide> window.module = angular.mock.module = function() { <ide> var moduleFns = Array.prototype.slice.call(arguments, 0); <del> var stack = new Error('Module Declaration Location:').stack; <ide> return isSpecRunning() ? workFn() : workFn; <ide> ///////////////////// <ide> function workFn() { <ide><path>src/ngScenario/ObjectModel.js <ide> angular.scenario.ObjectModel = function(runner) { <ide> self.emit('StepBegin', it, step); <ide> }); <ide> <del> runner.on('StepEnd', function(spec, step) { <add> runner.on('StepEnd', function(spec) { <ide> var it = self.getSpec(spec.id); <ide> var step = it.getLastStep(); <ide> if (step.name !== step.name) <ide><path>src/ngScenario/Scenario.js <ide> function asyncForEach(list, iterator, done) { <ide> * to a specific line length. <ide> * <ide> * @param {Object} error The exception to format, can be anything throwable <del> * @param {Number} maxStackLines Optional. max lines of the stack trace to include <add> * @param {Number=} [maxStackLines=5] max lines of the stack trace to include <ide> * default is 5. <ide> */ <ide> function formatException(error, maxStackLines) { <ide> function browserTrigger(element, type, keys) { <ide> pressed('shift'), pressed('meta'), 0, element); <ide> <ide> element.dispatchEvent(evnt); <del> finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault) <add> finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault); <ide> <ide> delete appWindow.angular['ff-684208-preventDefault']; <ide> <ide><path>src/ngScenario/dsl.js <ide> angular.scenario.dsl('browser', function() { <ide> return api; <ide> }; <ide> <del> return function(time) { <add> return function() { <ide> return chain; <ide> }; <ide> }); <ide><path>src/ngScenario/output/Html.js <ide> angular.scenario.output('html', function(context, runner, model) { <ide> '</div>' <ide> ); <ide> <del> runner.on('InteractivePause', function(spec, step) { <add> runner.on('InteractivePause', function(spec) { <ide> var ui = lastStepUiMap[spec.id]; <ide> ui.find('.test-title'). <ide> html('paused... <a href="javascript:resume()">resume</a> when ready.');
23
Python
Python
add tests for bengali
696215a3fb8b981a11114e0d276bd57553c3e8dd
<ide><path>spacy/tests/bn/__init__.py <add># coding: utf-8 <ide><path>spacy/tests/bn/test_tokenizer.py <add># encoding: utf8 <add>from __future__ import unicode_literals <add> <add>import pytest <add> <add>TESTCASES = [] <add> <add>PUNCTUATION_TESTS = [ <add> (u'আমি বাংলায় গান গাই!', [u'আমি', u'বাংলায়', u'গান', u'গাই', u'!']), <add> (u'আমি বাংলায় কথা কই।', [u'আমি', u'বাংলায়', u'কথা', u'কই', u'।']), <add> (u'বসুন্ধরা জনসম্মুখে দোষ স্বীকার করলো না?', [u'বসুন্ধরা', u'জনসম্মুখে', u'দোষ', u'স্বীকার', u'করলো', u'না', u'?']), <add> (u'টাকা থাকলে কি না হয়!', [u'টাকা', u'থাকলে', u'কি', u'না', u'হয়', u'!']), <add>] <add> <add>ABBREVIATIONS = [ <add> (u'ডঃ খালেদ বললেন ঢাকায় ৩৫ ডিগ্রি সে.।', [u'ডঃ', u'খালেদ', u'বললেন', u'ঢাকায়', u'৩৫', u'ডিগ্রি', u'সে.', u'।']) <add>] <add> <add>TESTCASES.extend(PUNCTUATION_TESTS) <add>TESTCASES.extend(ABBREVIATIONS) <add> <add> <add>@pytest.mark.parametrize('text,expected_tokens', TESTCASES) <add>def test_tokenizer_handles_testcases(bn_tokenizer, text, expected_tokens): <add> tokens = bn_tokenizer(text) <add> token_list = [token.text for token in tokens if not token.is_space] <add> assert expected_tokens == token_list <add> <add> <add>def test_tokenizer_handles_long_text(bn_tokenizer): <add> text = u"""নর্থ সাউথ বিশ্ববিদ্যালয়ে সারাবছর কোন না কোন বিষয়ে গবেষণা চলতেই থাকে। \ <add>অভিজ্ঞ ফ্যাকাল্টি মেম্বারগণ প্রায়ই শিক্ষার্থীদের নিয়ে বিভিন্ন গবেষণা প্রকল্পে কাজ করেন, \ <add>যার মধ্যে রয়েছে রোবট থেকে মেশিন লার্নিং সিস্টেম ও আর্টিফিশিয়াল ইন্টেলিজেন্স। \ <add>এসকল প্রকল্পে কাজ করার মাধ্যমে সংশ্লিষ্ট ক্ষেত্রে যথেষ্ঠ পরিমাণ স্পেশালাইজড হওয়া সম্ভব। \ <add>আর গবেষণার কাজ তোমার ক্যারিয়ারকে ঠেলে নিয়ে যাবে অনেকখানি! \ <add>কন্টেস্ট প্রোগ্রামার হও, গবেষক কিংবা ডেভেলপার - নর্থ সাউথ ইউনিভার্সিটিতে তোমার প্রতিভা বিকাশের সুযোগ রয়েছেই। \ <add>নর্থ সাউথের অসাধারণ কমিউনিটিতে তোমাকে সাদর আমন্ত্রণ।""" <add> <add> tokens = bn_tokenizer(text) <add> assert len(tokens) == 84 <ide><path>spacy/tests/conftest.py <ide> from ..sv import Swedish <ide> from ..hu import Hungarian <ide> from ..fi import Finnish <add>from ..bn import Bengali <ide> from ..tokens import Doc <ide> from ..strings import StringStore <ide> from ..lemmatizer import Lemmatizer <ide> <ide> <ide> LANGUAGES = [English, German, Spanish, Italian, French, Portuguese, Dutch, <del> Swedish, Hungarian, Finnish] <add> Swedish, Hungarian, Finnish, Bengali] <ide> <ide> <ide> @pytest.fixture(params=LANGUAGES) <ide> def sv_tokenizer(): <ide> return Swedish.Defaults.create_tokenizer() <ide> <ide> <add>@pytest.fixture <add>def bn_tokenizer(): <add> return Bengali.Defaults.create_tokenizer() <add> <add> <ide> @pytest.fixture <ide> def stringstore(): <ide> return StringStore() <ide><path>spacy/tests/tokenizer/test_tokenizer.py <ide> def test_tokenizer_handles_punct(tokenizer): <ide> <ide> <ide> def test_tokenizer_handles_digits(tokenizer): <del> exceptions = ["hu"] <add> exceptions = ["hu", "bn"] <ide> text = "Lorem ipsum: 1984." <ide> tokens = tokenizer(text) <ide>
4
Text
Text
add examples for whatwg url objects
0932e90e983c238383087d4c8969a7ce1ef00f82
<ide><path>doc/api/url.md <ide> const myURL = <ide> url.parse('https://user:[email protected]:8080/p/a/t/h?query=string#hash'); <ide> ``` <ide> <add>### Constructing a URL from component parts and getting the constructed string <add> <add>It is possible to construct a WHATWG URL from component parts using either the <add>property setters or a template literal string: <add> <add>```js <add>const myURL = new URL('https://example.org'); <add>myURL.pathname = '/a/b/c'; <add>myURL.search = '?d=e'; <add>myURL.hash = '#fgh'; <add>``` <add> <add>```js <add>const pathname = '/a/b/c'; <add>const search = '?d=e'; <add>const hash = '#fgh'; <add>const myURL = new URL(`https://example.org${pathname}${search}${hash}`); <add>``` <add> <add>To get the constructed URL string, use the `href` property accessor: <add> <add>```js <add>console.log(myURL.href); <add>``` <add> <ide> ## The WHATWG URL API <ide> <ide> ### Class: `URL`
1
Ruby
Ruby
cleanup some unneeded compexity
9e03c6aab3bda076453a3ed1e9c6abd43a5e7599
<ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> def length <ide> end <ide> <ide> private <del> def url_helper_name(name, only_path) <del> if only_path <del> :"#{name}_path" <del> else <del> :"#{name}_url" <del> end <del> end <ide> <ide> def define_named_route_methods(name, route) <del> [true, false].each do |only_path| <del> hash = route.defaults.merge(:use_route => name, :only_path => only_path) <del> define_url_helper route, name, hash <del> end <add> define_url_helper route, :"#{name}_path", <add> route.defaults.merge(:use_route => name, :only_path => true) <add> define_url_helper route, :"#{name}_url", <add> route.defaults.merge(:use_route => name, :only_path => false) <ide> end <ide> <ide> # Create a url helper allowing ordered parameters to be associated <ide> def define_named_route_methods(name, route) <ide> # foo_url(bar, baz, bang, :sort_by => 'baz') <ide> # <ide> def define_url_helper(route, name, options) <del> selector = url_helper_name(name, options[:only_path]) <del> <ide> @module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1 <del> remove_possible_method :#{selector} <del> def #{selector}(*args) <add> remove_possible_method :#{name} <add> def #{name}(*args) <ide> if #{optimize_helper?(route)} && args.size == #{route.required_parts.size} && !args.last.is_a?(Hash) && optimize_routes_generation? <ide> options = #{options.inspect} <ide> options.merge!(url_options) if respond_to?(:url_options) <ide> def #{selector}(*args) <ide> end <ide> END_EVAL <ide> <del> helpers << selector <add> helpers << name <ide> end <ide> <ide> # Clause check about when we need to generate an optimized helper.
1
Python
Python
support env argument in ccompiler.spawn
3842786bd5b7515c5f86fe4471ffa3fdb7f7c568
<ide><path>numpy/distutils/ccompiler.py <ide> class where more documentation can be found. <ide> <ide> <ide> # Using customized CCompiler.spawn. <del>def CCompiler_spawn(self, cmd, display=None): <add>def CCompiler_spawn(self, cmd, display=None, env=None): <ide> """ <ide> Execute a command in a sub-process. <ide> <ide> def CCompiler_spawn(self, cmd, display=None): <ide> display : str or sequence of str, optional <ide> The text to add to the log file kept by `numpy.distutils`. <ide> If not given, `display` is equal to `cmd`. <add> env: a dictionary for environment variables, optional <ide> <ide> Returns <ide> ------- <ide> def CCompiler_spawn(self, cmd, display=None): <ide> If the command failed, i.e. the exit status was not 0. <ide> <ide> """ <add> env = env if env is not None else dict(os.environ) <ide> if display is None: <ide> display = cmd <ide> if is_sequence(display): <ide> display = ' '.join(list(display)) <ide> log.info(display) <ide> try: <ide> if self.verbose: <del> subprocess.check_output(cmd) <add> subprocess.check_output(cmd, env=env) <ide> else: <del> subprocess.check_output(cmd, stderr=subprocess.STDOUT) <add> subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env) <ide> except subprocess.CalledProcessError as exc: <ide> o = exc.output <ide> s = exc.returncode
1
Javascript
Javascript
allow auto-bootstraping from inline script
0694af8fc4c856f5174545450091602e51f02a11
<ide><path>src/Angular.js <ide> function getNgAttribute(element, ngAttr) { <ide> } <ide> <ide> function allowAutoBootstrap(document) { <del> if (!document.currentScript) { <add> var script = document.currentScript; <add> var src = script && script.getAttribute('src'); <add> <add> if (!src) { <ide> return true; <ide> } <del> var src = document.currentScript.getAttribute('src'); <add> <ide> var link = document.createElement('a'); <ide> link.href = src; <add> <ide> if (document.location.origin === link.origin) { <ide> // Same-origin resources are always allowed, even for non-whitelisted schemes. <ide> return true; <ide><path>test/AngularSpec.js <ide> describe('angular', function() { <ide> }); <ide> <ide> it('should bootstrap from an extension into an extension document for same-origin documents only', function() { <del> if (msie) return; // IE does not support document.currentScript (nor extensions with protocol), so skip test. <add> // IE does not support `document.currentScript` (nor extensions with protocol), so skip test. <add> if (msie) return; <ide> <ide> // Extension URLs are browser-specific, so we must choose a scheme that is supported by the browser to make <ide> // sure that the URL is properly parsed. <ide> describe('angular', function() { <ide> expect(allowAutoBootstrap(fakeDoc)).toBe(false); <ide> }); <ide> <add> it('should bootstrap from a script with an empty or missing `src` attribute', function() { <add> // IE does not support `document.currentScript` (nor extensions with protocol), so skip test. <add> if (msie) return; <add> <add> // Fake a minimal document object (the actual document.currentScript is readonly). <add> var src; <add> var fakeDoc = { <add> createElement: document.createElement.bind(document), <add> currentScript: {getAttribute: function() { return src; }}, <add> location: {origin: 'some-value', protocol: 'http:'} <add> }; <add> <add> src = null; <add> expect(allowAutoBootstrap(fakeDoc)).toBe(true); <add> <add> src = ''; <add> expect(allowAutoBootstrap(fakeDoc)).toBe(true); <add> }); <add> <ide> it('should not bootstrap from an extension into a non-extension document', function() { <del> if (msie) return; // IE does not support document.currentScript (nor extensions with protocol), so skip test. <add> // IE does not support `document.currentScript` (nor extensions with protocol), so skip test. <add> if (msie) return; <ide> <ide> var src = 'resource://something'; <ide> // Fake a minimal document object (the actual document.currentScript is readonly).
2
Javascript
Javascript
simplify vector iterator
3e13a15af3525e24487f90f5a775ad0667fc79e8
<ide><path>dist/Immutable.dev.js <ide> var $VNode = VNode; <ide> return editable; <ide> }, <ide> iterate: function(level, offset, max, fn, reverse) { <add> var ii; <add> var array = this.array; <add> var maxII = array.length - 1; <ide> if (level === 0) { <del> if (reverse) { <del> for (var revRawIndex = this.array.length - 1; revRawIndex >= 0; revRawIndex--) { <del> if (this.array.hasOwnProperty(revRawIndex)) { <del> var index = revRawIndex + offset; <del> if (index >= 0 && index < max && fn(this.array[revRawIndex], index) === false) { <del> return false; <del> } <del> } <del> } <del> return true; <del> } else { <del> return this.array.every((function(value, rawIndex) { <add> for (ii = 0; ii <= maxII; ii++) { <add> var rawIndex = reverse ? maxII - ii : ii; <add> if (array.hasOwnProperty(rawIndex)) { <ide> var index = rawIndex + offset; <del> return index < 0 || index >= max || fn(value, index) !== false; <del> })); <del> } <del> } <del> var step = 1 << level; <del> var newLevel = level - SHIFT; <del> if (reverse) { <del> for (var revLevelIndex = this.array.length - 1; revLevelIndex >= 0; revLevelIndex--) { <del> var newOffset = offset + revLevelIndex * step; <del> if (newOffset < max && newOffset + step > 0 && this.array.hasOwnProperty(revLevelIndex) && !this.array[revLevelIndex].iterate(newLevel, newOffset, max, fn, reverse)) { <del> return false; <add> if (index >= 0 && index < max && fn(array[rawIndex], index) === false) { <add> return false; <add> } <ide> } <ide> } <del> return true; <ide> } else { <del> return this.array.every((function(newNode, levelIndex) { <add> var step = 1 << level; <add> var newLevel = level - SHIFT; <add> for (ii = 0; ii <= maxII; ii++) { <add> var levelIndex = reverse ? maxII - ii : ii; <ide> var newOffset = offset + levelIndex * step; <del> return newOffset >= max || newOffset + step <= 0 || newNode.iterate(newLevel, newOffset, max, fn, reverse); <del> })); <add> if (newOffset < max && newOffset + step > 0) { <add> var node = array[levelIndex]; <add> if (node && !node.iterate(newLevel, newOffset, max, fn, reverse)) { <add> return false; <add> } <add> } <add> } <ide> } <add> return true; <ide> } <ide> }, {}); <ide> var VectorIterator = function VectorIterator(vector, origin, size, level, root, tail) { <ide><path>dist/Immutable.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>function t(){function t(t,e,r,n){var i;if(n){var u=n.prototype;i=ne.create(u)}else i=t.prototype;return ne.keys(e).forEach(function(t){i[t]=e[t]}),ne.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return ne.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(){return Object.create(ae)}function i(t){var e=Object.create(ce);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function u(t,e,r,n){var i=t.get?t.get(e[n],ye):ye;return i===ye?r:++n===e.length?i:u(i,e,r,n)}function s(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function a(t,e){return 0>t?Math.max(0,e+t):e?Math.min(e,t):t}function h(t,e){return null==t?e:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function o(t){return t}function c(t,e){return[e,t]}function f(){return!0}function l(){return this}function _(t){return(t||0)+1}function v(t,e,r,n,i){var u=t.__makeSequence();return u.__iterateUncached=function(u,s,a){var h=0,o=t.__iterate(function(t,i,s){if(e.call(r,t,i,s)){if(u(t,n?i:h,s)===!1)return!1;h++}},s,a);return i?o:h},u}function g(t){return function(){return!t.apply(this,arguments)}}function p(t){return"string"==typeof t?JSON.stringify(t):t}function m(t,e){for(var r="";e;)1&e&&(r+=t),(e>>=1)&&(t+=t);return r}function y(t,e){return t>e?1:e>t?-1:0}function d(t){I(1/0!==t,"Cannot perform this action with an infinite sequence.")}function w(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof ue?t.equals(e):!1}function I(t,e){if(!t)throw Error(e)}function D(t,e,r){var n=t._rootData.updateIn(t._keyPath,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new _e(n,t._keyPath,t._onChange)}function O(){}function b(t){for(var e=t.length,r=Array(e),n=0;e>n;n++)r[n]=t[n];return r}function M(t){return Ae.value=t,Ae}function k(t,e,r){var n=Object.create(Ie);return n.length=t,n._root=e,n.__ownerID=r,n}function S(t,e,r){var n=M(),i=x(t._root,t.__ownerID,0,L(e),e,r,n),u=t.length+(n.value?r===ye?-1:1:0);return t.__ownerID?(t.length=u,t._root=i,t):i?i===t._root?t:k(u,i):de.empty() <del>}function x(t,e,r,n,i,u,s){return t?t.update(e,r,n,i,u,s):u===ye?t:(s&&(s.value=!0),new xe(e,n,[i,u]))}function E(t){return t.constructor===xe||t.constructor===ke}function C(t,e,r,n,i){if(t.hash===n)return new ke(e,n,[t.entry,i]);var u,s=t.hash>>>r&me,a=n>>>r&me,h=s===a?[C(t,e,r+ge,n,i)]:(u=new xe(e,n,i),a>s?[t,u]:[u,t]);return new De(e,1<<s|1<<a,h)}function A(t,e,r,n){for(var i=0,u=0,s=Array(r),a=0,h=1,o=e.length;o>a;a++,h<<=1){var c=e[a];null!=c&&a!==n&&(i|=h,s[u++]=c)}return new De(t,i,s)}function q(t,e,r,n,i){for(var u=0,s=Array(pe),a=0;0!==r;a++,r>>>=1)s[a]=1&r?e[u++]:null;return s[n]=i,new be(t,u+1,s)}function j(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(Array.isArray(u)?ue(u).fromEntries():ue(u))}return z(t,e,n)}function U(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function z(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,ye);t.set(n,i===ye?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function P(t,e,r,n){var i=e[n],u=t.get?t.get(i,ye):ye;return u===ye&&(u=de.empty()),I(t.set,"updateIn with invalid keyPath"),t.set(i,++n===e.length?r(u):P(u,e,r,n))}function R(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function W(t,e,r,n){var i=n?t:b(t);return i[e]=r,i}function J(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),s=0,a=0;i>a;a++)a===e?(u[a]=r,s=-1):u[a]=t[a+s];return u}function B(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,s=0;n>s;s++)s===e&&(u=1),i[s]=t[s+u];return i}function L(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&qe;t=""+t,e="string"}if("string"===e)return t.length>je?V(t):K(t);if(t.hashCode&&"function"==typeof t.hashCode)return t.hashCode();throw Error("Unable to hash: "+t)}function V(t){var e=Pe[t];return null==e&&(e=K(t),ze===Ue&&(ze=0,Pe={}),ze++,Pe[t]=e),e}function K(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)&qe; <del>return e}function N(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,__prev:i}}function F(t,e,r,n,i,u){var s=Object.create(Le);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s}function G(t,e){if(e>=X(t._size))return t._tail;if(1<<t._level+ge>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&me],n-=ge;return r}}function H(t,e,r){var n=t.__ownerID||new O,i=t._origin,u=t._size,s=i+e,a=null==r?u:0>r?u+r:i+r;if(s===i&&a===u)return t;if(s>=a)return t.clear();for(var h=t._level,o=t._root,c=0;0>s+c;)o=new Ve(o.array.length?[,o]:[],n),h+=ge,c+=1<<h;c&&(s+=c,i+=c,a+=c,u+=c);for(var f=X(u),l=X(a);l>=1<<h+ge;)o=new Ve(o.array.length?[o]:[],n),h+=ge;var _=t._tail,v=f>l?G(t,a-1):l>f?new Ve([],n):_;if(l>f&&u>s&&_.array.length){o=o.ensureOwner(n);for(var g=o,p=h;p>ge;p-=ge){var m=f>>>p&me;g=g.array[m]=g.array[m]?g.array[m].ensureOwner(n):new Ve([],n)}g.array[f>>>ge&me]=_}if(u>a&&(v=v.removeAfter(n,0,a)),s>=l)s-=l,a-=l,h=ge,o=Ge,v=v.removeBefore(n,0,s);else if(s>i||f>l){var y,d;c=0;do y=s>>>h&me,d=l-1>>>h&me,y===d&&(y&&(c+=(1<<h)*y),h-=ge,o=o&&o.array[y]);while(o&&y===d);o&&s>i&&(o=o.removeBefore(n,h,s-c)),o&&f>l&&(o=o.removeAfter(n,h,l-c)),c&&(s-=c,a-=c),o=o||Ge}return t.__ownerID?(t.length=a-s,t._origin=s,t._size=a,t._level=h,t._root=o,t._tail=v,t):F(s,a,h,o,v)}function Q(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(u.forEach?u:ue(u))}var s=Math.max.apply(null,n.map(function(t){return t.length||0}));return s>t.length&&(t=t.setLength(s)),z(t,e,n)}function T(t,e){return I(t>=0,"Index out of bounds"),t+e}function X(t){return pe>t?0:t-1>>>ge<<ge}function Y(t,e){var r=Object.create(Te);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function Z(t,e,r){var n=Object.create(Ye.prototype);return n.length=t?t.length:0,n._map=t,n._vector=e,n.__ownerID=r,n}function $(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function te(t,e){return e?ee(e,t,"",{"":t}):re(t)}function ee(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,ue(e).map(function(r,n){return ee(t,r,n,e) <del>})):e}function re(t){if(t){if(Array.isArray(t))return ue(t).map(re).toVector();if(t.constructor===Object)return ue(t).map(re).toMap()}return t}var ne=Object,ie={};ie.createClass=t,ie.superCall=e,ie.defaultSuperCall=r;var ue=function(t){return se.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},se=ue;ie.createClass(ue,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+p(t)},toJS:function(){return this.map(function(t){return t instanceof se?t.toJS():t}).__toJS()},toArray:function(){d(this.length);var t=Array(this.length||0);return this.values().forEach(function(e,r){t[r]=e}),t},toObject:function(){d(this.length);var t={};return this.forEach(function(e,r){t[r]=e}),t},toVector:function(){return d(this.length),Je.from(this)},toMap:function(){return d(this.length),de.from(this)},toOrderedMap:function(){return d(this.length),Ye.from(this)},toSet:function(){return d(this.length),He.from(this)},equals:function(t){if(this===t)return!0;if(!(t instanceof se))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entries().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return w(n,i[0])&&w(t,i[1])})},join:function(t){t=t||",";var e="",r=!0;return this.forEach(function(n){r?(r=!1,e+=n):e+=t+n}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(f)),this.length)},countBy:function(t){var e=this;return Ye.empty().withMutations(function(r){e.forEach(function(e,n,i){r.update(t(e,n,i),_)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t.map(function(t){return se(t)})),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e){for(var n,i=0,u=r.length-1,s=0;u>=s&&!n;s++){var a=r[e?u-s:s]; <del>i+=a.__iterate(function(e,r,i){return t(e,r,i)===!1?(n=!0,!1):void 0},e)}return i},n},reverse:function(){var t=this,e=t.__makeSequence();return e.length=t.length,e.__iterateUncached=function(e,r){return t.__iterate(e,!r)},e.reverse=function(){return t},e},keys:function(){return this.flip().values()},values:function(){var t=this,e=i(t);return e.length=t.length,e.values=l,e.__iterateUncached=function(e,r,n){if(n&&null==this.length)return this.cacheResult().__iterate(e,r,n);var i,u=0;return n?(u=this.length-1,i=function(t,r,n){return e(t,u--,n)!==!1}):i=function(t,r,n){return e(t,u++,n)!==!1},t.__iterate(i,r),n?this.length:u},e},entries:function(){var t=this;if(t._cache)return se(t._cache);var e=t.map(c).values();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n=e;return this.forEach(function(e,i,u){n=t.call(r,n,e,i,u)}),n},reduceRight:function(t,e,r){return this.reverse(!0).reduce(t,e,r)},every:function(t,e){var r=!0;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(g(t),e)},first:function(){return this.find(f)},last:function(){return this.findLast(f)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,ye)!==ye},get:function(t,e){return this.find(function(e,r){return w(r,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?u(this,t,e,0):this},contains:function(t){return this.find(function(e){return w(e,t)},null,ye)!==ye},find:function(t,e,r){var n=r;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.reverse(!0).find(t,e,r)},findLastKey:function(t,e){return this.reverse(!0).findKey(t,e)},flip:function(){var t=this,e=n();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,r){return t.__iterate(function(t,r,n){return e(r,t,n)!==!1 <del>},r)},e},map:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,u){return n(t.call(e,r,i,u),i,u)!==!1},i)},n},mapKeys:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,u){return n(r,t.call(e,i,r,u),u)!==!1},i)},n},filter:function(t,e){return v(this,t,e,!0,!1)},slice:function(t,e){if(s(t,e,this.length))return this;var r=a(t,this.length),n=h(e,this.length);if(r!==r||n!==n)return this.entries().slice(t,e).fromEntries();var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){var e=0,r=this.takeWhile(function(){return e++<t});return r.length=this.length&&Math.min(this.length,t),r},takeLast:function(t,e){return this.reverse(e).take(t).reverse(e)},takeWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,u){if(i)return this.cacheResult().__iterate(n,i,u);var s=0;return r.__iterate(function(r,i,u){return t.call(e,r,i,u)&&n(r,i,u)!==!1?void s++:!1},i,u),s},n},takeUntil:function(t,e,r){return this.takeWhile(g(t),e,r)},skip:function(t,e){if(0===t)return this;var r=0,n=this.skipWhile(function(){return r++<t},null,e);return n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t,e){return this.reverse(e).skip(t).reverse(e)},skipWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,u){if(i)return this.cacheResult().__iterate(n,i,u);var s=!0,a=0;return r.__iterate(function(r,i,u){if(!s||!(s=t.call(e,r,i,u))){if(n(r,i,u)===!1)return!1;a++}},i,u),a},n},skipUntil:function(t,e,r){return this.skipWhile(g(t),e,r)},groupBy:function(t){var e=this,r=Ye.empty().withMutations(function(r){e.forEach(function(e,n,i){var u=t(e,n,i),s=r.get(u,ye);s===ye&&(s=[],r.set(u,s)),s.push([n,e])})});return r.map(function(t){return se(t).fromEntries()})},sort:function(t,e){return this.sortBy(o,t,e)},sortBy:function(t,e){e=e||y;var r=this;return se(this.entries().entries().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0] <del>})).fromEntries().values().fromEntries()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(d(this.length),this._cache=this.entries().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e,r){if(!this._cache)return this.__iterateUncached(t,e,r);var n=this.length-1,i=this._cache,u=this;if(e)for(var s=i.length-1;s>=0;s--){var a=i[s];if(t(a[1],r?a[0]:n-a[0],u)===!1)break}else i.every(r?function(e){return t(e[1],n-e[0],u)!==!1}:function(e){return t(e[1],e[0],u)!==!1});return this.length},__makeSequence:function(){return n()}},{from:function(t){if(t instanceof se)return t;if(!Array.isArray(t)){if(t&&t.constructor===Object)return new fe(t);t=[t]}return new le(t)}});var ae=ue.prototype;ae.toJSON=ae.toJS,ae.__toJS=ae.toObject,ae.inspect=ae.toSource=function(){return""+this};var he=function(){ie.defaultSuperCall(this,oe.prototype,arguments)},oe=he;ie.createClass(he,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){d(this.length);var t=Array(this.length||0);return t.length=this.forEach(function(e,r){t[r]=e}),t},fromEntries:function(){var t=this,e=n();return e.length=t.length,e.entries=function(){return t},e.__iterateUncached=function(e,r,n){return t.__iterate(function(t,r,n){return e(t[1],t[0],n)},r,n)},e},join:function(t){t=t||",";var e="",r=0;return this.forEach(function(n,i){var u=i-r;r=i,e+=(1===u?t:m(t,u))+n}),this.length&&this.length-1>r&&(e+=m(t,this.length-1-r)),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t).map(function(t){return ue(t)}),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e,n){if(n&&!this.length)return this.cacheResult().__iterate(t,e,n);for(var i,u=0,s=n&&this.length-1,a=r.length-1,h=0;a>=h&&!i;h++){var o=r[e?a-h:h];o instanceof oe||(o=o.values()),u+=o.__iterate(function(e,r,a){return r+=u,t(e,n?s-r:r,a)===!1?(i=!0,!1):void 0},e)}return u},n},reverse:function(t){var e=this,r=e.__makeSequence(); <add>function t(){function t(t,e,r,n){var i;if(n){var u=n.prototype;i=ne.create(u)}else i=t.prototype;return ne.keys(e).forEach(function(t){i[t]=e[t]}),ne.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return ne.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(){return Object.create(ae)}function i(t){var e=Object.create(ce);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function u(t,e,r,n){var i=t.get?t.get(e[n],de):de;return i===de?r:++n===e.length?i:u(i,e,r,n)}function s(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function a(t,e){return 0>t?Math.max(0,e+t):e?Math.min(e,t):t}function h(t,e){return null==t?e:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function o(t){return t}function c(t,e){return[e,t]}function f(){return!0}function l(){return this}function _(t){return(t||0)+1}function v(t,e,r,n,i){var u=t.__makeSequence();return u.__iterateUncached=function(u,s,a){var h=0,o=t.__iterate(function(t,i,s){if(e.call(r,t,i,s)){if(u(t,n?i:h,s)===!1)return!1;h++}},s,a);return i?o:h},u}function g(t){return function(){return!t.apply(this,arguments)}}function p(t){return"string"==typeof t?JSON.stringify(t):t}function m(t,e){for(var r="";e;)1&e&&(r+=t),(e>>=1)&&(t+=t);return r}function d(t,e){return t>e?1:e>t?-1:0}function y(t){I(1/0!==t,"Cannot perform this action with an infinite sequence.")}function w(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof ue?t.equals(e):!1}function I(t,e){if(!t)throw Error(e)}function D(t,e,r){var n=t._rootData.updateIn(t._keyPath,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new _e(n,t._keyPath,t._onChange)}function O(){}function b(t){for(var e=t.length,r=Array(e),n=0;e>n;n++)r[n]=t[n];return r}function M(t){return Ae.value=t,Ae}function k(t,e,r){var n=Object.create(Ie);return n.length=t,n._root=e,n.__ownerID=r,n}function S(t,e,r){var n=M(),i=x(t._root,t.__ownerID,0,L(e),e,r,n),u=t.length+(n.value?r===de?-1:1:0);return t.__ownerID?(t.length=u,t._root=i,t):i?i===t._root?t:k(u,i):ye.empty() <add>}function x(t,e,r,n,i,u,s){return t?t.update(e,r,n,i,u,s):u===de?t:(s&&(s.value=!0),new xe(e,n,[i,u]))}function E(t){return t.constructor===xe||t.constructor===ke}function C(t,e,r,n,i){if(t.hash===n)return new ke(e,n,[t.entry,i]);var u,s=t.hash>>>r&me,a=n>>>r&me,h=s===a?[C(t,e,r+ge,n,i)]:(u=new xe(e,n,i),a>s?[t,u]:[u,t]);return new De(e,1<<s|1<<a,h)}function A(t,e,r,n){for(var i=0,u=0,s=Array(r),a=0,h=1,o=e.length;o>a;a++,h<<=1){var c=e[a];null!=c&&a!==n&&(i|=h,s[u++]=c)}return new De(t,i,s)}function q(t,e,r,n,i){for(var u=0,s=Array(pe),a=0;0!==r;a++,r>>>=1)s[a]=1&r?e[u++]:null;return s[n]=i,new be(t,u+1,s)}function j(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(Array.isArray(u)?ue(u).fromEntries():ue(u))}return z(t,e,n)}function U(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function z(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,de);t.set(n,i===de?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function R(t,e,r,n){var i=e[n],u=t.get?t.get(i,de):de;return u===de&&(u=ye.empty()),I(t.set,"updateIn with invalid keyPath"),t.set(i,++n===e.length?r(u):R(u,e,r,n))}function P(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function W(t,e,r,n){var i=n?t:b(t);return i[e]=r,i}function J(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),s=0,a=0;i>a;a++)a===e?(u[a]=r,s=-1):u[a]=t[a+s];return u}function B(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,s=0;n>s;s++)s===e&&(u=1),i[s]=t[s+u];return i}function L(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&qe;t=""+t,e="string"}if("string"===e)return t.length>je?V(t):K(t);if(t.hashCode&&"function"==typeof t.hashCode)return t.hashCode();throw Error("Unable to hash: "+t)}function V(t){var e=Re[t];return null==e&&(e=K(t),ze===Ue&&(ze=0,Re={}),ze++,Re[t]=e),e}function K(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)&qe; <add>return e}function N(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,__prev:i}}function F(t,e,r,n,i,u){var s=Object.create(Le);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s}function G(t,e){if(e>=X(t._size))return t._tail;if(1<<t._level+ge>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&me],n-=ge;return r}}function H(t,e,r){var n=t.__ownerID||new O,i=t._origin,u=t._size,s=i+e,a=null==r?u:0>r?u+r:i+r;if(s===i&&a===u)return t;if(s>=a)return t.clear();for(var h=t._level,o=t._root,c=0;0>s+c;)o=new Ve(o.array.length?[,o]:[],n),h+=ge,c+=1<<h;c&&(s+=c,i+=c,a+=c,u+=c);for(var f=X(u),l=X(a);l>=1<<h+ge;)o=new Ve(o.array.length?[o]:[],n),h+=ge;var _=t._tail,v=f>l?G(t,a-1):l>f?new Ve([],n):_;if(l>f&&u>s&&_.array.length){o=o.ensureOwner(n);for(var g=o,p=h;p>ge;p-=ge){var m=f>>>p&me;g=g.array[m]=g.array[m]?g.array[m].ensureOwner(n):new Ve([],n)}g.array[f>>>ge&me]=_}if(u>a&&(v=v.removeAfter(n,0,a)),s>=l)s-=l,a-=l,h=ge,o=Ge,v=v.removeBefore(n,0,s);else if(s>i||f>l){var d,y;c=0;do d=s>>>h&me,y=l-1>>>h&me,d===y&&(d&&(c+=(1<<h)*d),h-=ge,o=o&&o.array[d]);while(o&&d===y);o&&s>i&&(o=o.removeBefore(n,h,s-c)),o&&f>l&&(o=o.removeAfter(n,h,l-c)),c&&(s-=c,a-=c),o=o||Ge}return t.__ownerID?(t.length=a-s,t._origin=s,t._size=a,t._level=h,t._root=o,t._tail=v,t):F(s,a,h,o,v)}function Q(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(u.forEach?u:ue(u))}var s=Math.max.apply(null,n.map(function(t){return t.length||0}));return s>t.length&&(t=t.setLength(s)),z(t,e,n)}function T(t,e){return I(t>=0,"Index out of bounds"),t+e}function X(t){return pe>t?0:t-1>>>ge<<ge}function Y(t,e){var r=Object.create(Te);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function Z(t,e,r){var n=Object.create(Ye.prototype);return n.length=t?t.length:0,n._map=t,n._vector=e,n.__ownerID=r,n}function $(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function te(t,e){return e?ee(e,t,"",{"":t}):re(t)}function ee(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,ue(e).map(function(r,n){return ee(t,r,n,e) <add>})):e}function re(t){if(t){if(Array.isArray(t))return ue(t).map(re).toVector();if(t.constructor===Object)return ue(t).map(re).toMap()}return t}var ne=Object,ie={};ie.createClass=t,ie.superCall=e,ie.defaultSuperCall=r;var ue=function(t){return se.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},se=ue;ie.createClass(ue,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+p(t)},toJS:function(){return this.map(function(t){return t instanceof se?t.toJS():t}).__toJS()},toArray:function(){y(this.length);var t=Array(this.length||0);return this.values().forEach(function(e,r){t[r]=e}),t},toObject:function(){y(this.length);var t={};return this.forEach(function(e,r){t[r]=e}),t},toVector:function(){return y(this.length),Je.from(this)},toMap:function(){return y(this.length),ye.from(this)},toOrderedMap:function(){return y(this.length),Ye.from(this)},toSet:function(){return y(this.length),He.from(this)},equals:function(t){if(this===t)return!0;if(!(t instanceof se))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entries().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return w(n,i[0])&&w(t,i[1])})},join:function(t){t=t||",";var e="",r=!0;return this.forEach(function(n){r?(r=!1,e+=n):e+=t+n}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(f)),this.length)},countBy:function(t){var e=this;return Ye.empty().withMutations(function(r){e.forEach(function(e,n,i){r.update(t(e,n,i),_)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t.map(function(t){return se(t)})),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e){for(var n,i=0,u=r.length-1,s=0;u>=s&&!n;s++){var a=r[e?u-s:s]; <add>i+=a.__iterate(function(e,r,i){return t(e,r,i)===!1?(n=!0,!1):void 0},e)}return i},n},reverse:function(){var t=this,e=t.__makeSequence();return e.length=t.length,e.__iterateUncached=function(e,r){return t.__iterate(e,!r)},e.reverse=function(){return t},e},keys:function(){return this.flip().values()},values:function(){var t=this,e=i(t);return e.length=t.length,e.values=l,e.__iterateUncached=function(e,r,n){if(n&&null==this.length)return this.cacheResult().__iterate(e,r,n);var i,u=0;return n?(u=this.length-1,i=function(t,r,n){return e(t,u--,n)!==!1}):i=function(t,r,n){return e(t,u++,n)!==!1},t.__iterate(i,r),n?this.length:u},e},entries:function(){var t=this;if(t._cache)return se(t._cache);var e=t.map(c).values();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n=e;return this.forEach(function(e,i,u){n=t.call(r,n,e,i,u)}),n},reduceRight:function(t,e,r){return this.reverse(!0).reduce(t,e,r)},every:function(t,e){var r=!0;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(g(t),e)},first:function(){return this.find(f)},last:function(){return this.findLast(f)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,de)!==de},get:function(t,e){return this.find(function(e,r){return w(r,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?u(this,t,e,0):this},contains:function(t){return this.find(function(e){return w(e,t)},null,de)!==de},find:function(t,e,r){var n=r;return this.forEach(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.forEach(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.reverse(!0).find(t,e,r)},findLastKey:function(t,e){return this.reverse(!0).findKey(t,e)},flip:function(){var t=this,e=n();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,r){return t.__iterate(function(t,r,n){return e(r,t,n)!==!1 <add>},r)},e},map:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,u){return n(t.call(e,r,i,u),i,u)!==!1},i)},n},mapKeys:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,u){return n(r,t.call(e,i,r,u),u)!==!1},i)},n},filter:function(t,e){return v(this,t,e,!0,!1)},slice:function(t,e){if(s(t,e,this.length))return this;var r=a(t,this.length),n=h(e,this.length);if(r!==r||n!==n)return this.entries().slice(t,e).fromEntries();var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){var e=0,r=this.takeWhile(function(){return e++<t});return r.length=this.length&&Math.min(this.length,t),r},takeLast:function(t,e){return this.reverse(e).take(t).reverse(e)},takeWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,u){if(i)return this.cacheResult().__iterate(n,i,u);var s=0;return r.__iterate(function(r,i,u){return t.call(e,r,i,u)&&n(r,i,u)!==!1?void s++:!1},i,u),s},n},takeUntil:function(t,e,r){return this.takeWhile(g(t),e,r)},skip:function(t,e){if(0===t)return this;var r=0,n=this.skipWhile(function(){return r++<t},null,e);return n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t,e){return this.reverse(e).skip(t).reverse(e)},skipWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,u){if(i)return this.cacheResult().__iterate(n,i,u);var s=!0,a=0;return r.__iterate(function(r,i,u){if(!s||!(s=t.call(e,r,i,u))){if(n(r,i,u)===!1)return!1;a++}},i,u),a},n},skipUntil:function(t,e,r){return this.skipWhile(g(t),e,r)},groupBy:function(t){var e=this,r=Ye.empty().withMutations(function(r){e.forEach(function(e,n,i){var u=t(e,n,i),s=r.get(u,de);s===de&&(s=[],r.set(u,s)),s.push([n,e])})});return r.map(function(t){return se(t).fromEntries()})},sort:function(t,e){return this.sortBy(o,t,e)},sortBy:function(t,e){e=e||d;var r=this;return se(this.entries().entries().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0] <add>})).fromEntries().values().fromEntries()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(y(this.length),this._cache=this.entries().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e,r){if(!this._cache)return this.__iterateUncached(t,e,r);var n=this.length-1,i=this._cache,u=this;if(e)for(var s=i.length-1;s>=0;s--){var a=i[s];if(t(a[1],r?a[0]:n-a[0],u)===!1)break}else i.every(r?function(e){return t(e[1],n-e[0],u)!==!1}:function(e){return t(e[1],e[0],u)!==!1});return this.length},__makeSequence:function(){return n()}},{from:function(t){if(t instanceof se)return t;if(!Array.isArray(t)){if(t&&t.constructor===Object)return new fe(t);t=[t]}return new le(t)}});var ae=ue.prototype;ae.toJSON=ae.toJS,ae.__toJS=ae.toObject,ae.inspect=ae.toSource=function(){return""+this};var he=function(){ie.defaultSuperCall(this,oe.prototype,arguments)},oe=he;ie.createClass(he,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){y(this.length);var t=Array(this.length||0);return t.length=this.forEach(function(e,r){t[r]=e}),t},fromEntries:function(){var t=this,e=n();return e.length=t.length,e.entries=function(){return t},e.__iterateUncached=function(e,r,n){return t.__iterate(function(t,r,n){return e(t[1],t[0],n)},r,n)},e},join:function(t){t=t||",";var e="",r=0;return this.forEach(function(n,i){var u=i-r;r=i,e+=(1===u?t:m(t,u))+n}),this.length&&this.length-1>r&&(e+=m(t,this.length-1-r)),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t).map(function(t){return ue(t)}),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e,n){if(n&&!this.length)return this.cacheResult().__iterate(t,e,n);for(var i,u=0,s=n&&this.length-1,a=r.length-1,h=0;a>=h&&!i;h++){var o=r[e?a-h:h];o instanceof oe||(o=o.values()),u+=o.__iterate(function(e,r,a){return r+=u,t(e,n?s-r:r,a)===!1?(i=!0,!1):void 0},e)}return u},n},reverse:function(t){var e=this,r=e.__makeSequence(); <ide> return r.length=e.length,r.__reversedIndices=!!(t^e.__reversedIndices),r.__iterateUncached=function(r,n,i){return e.__iterate(r,!n,i^t)},r.reverse=function(r){return t===r?e:ce.reverse.call(this,r)},r},values:function(){var t=ie.superCall(this,oe.prototype,"values",[]);return t.length=void 0,t},filter:function(t,e,r){var n=v(this,t,e,r,r);return r&&(n.length=this.length),n},indexOf:function(t){return this.findIndex(function(e){return w(e,t)})},lastIndexOf:function(t){return this.reverse(!0).indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.reverse(!0).findIndex(t,e)},slice:function(t,e,r){var n=this;if(s(t,e,n.length))return n;var i=n.__makeSequence(),u=a(t,n.length),o=h(e,n.length);return i.length=n.length&&(r?n.length:o-u),i.__reversedIndices=n.__reversedIndices,i.__iterateUncached=function(i,s,c){if(s)return this.cacheResult().__iterate(i,s,c);var f=this.__reversedIndices^c;if(u!==u||o!==o||f&&null==n.length){var l=n.count();u=a(t,l),o=h(e,l)}var _=f?n.length-o:u,v=f?n.length-u:o,g=n.__iterate(function(t,e,n){return f?null!=v&&e>=v||e>=_&&i(t,r?e:e-_,n)!==!1:_>e||(null==v||v>e)&&i(t,r?e:e-_,n)!==!1},s,c);return null!=this.length?this.length:r?g:Math.max(0,g-_)},i},splice:function(t,e){for(var r=[],n=2;arguments.length>n;n++)r[n-2]=arguments[n];return 0===e&&0===r.length?this:this.slice(0,t).concat(r,this.slice(t+e))},takeWhile:function(t,e,r){var n=this,i=n.__makeSequence();return i.__iterateUncached=function(u,s,a){if(s)return this.cacheResult().__iterate(u,s,a);var h=0,o=!0,c=n.__iterate(function(r,n,i){return t.call(e,r,n,i)&&u(r,n,i)!==!1?void(h=n):(o=!1,!1)},s,a);return r?i.length:o?c:h+1},r&&(i.length=this.length),i},skipWhile:function(t,e,r){var n=this,i=n.__makeSequence();return r&&(i.length=this.length),i.__iterateUncached=function(i,u,s){if(u)return this.cacheResult().__iterate(i,u,s);var a=n.__reversedIndices^s,h=!0,o=0,c=n.__iterate(function(n,u,a){return h&&(h=t.call(e,n,u,a),h||(o=u)),h||i(n,s||r?u:u-o,a)!==!1},u,s);return r?c:a?o+1:c-o <del>},i},groupBy:function(t,e,r){var n=this,i=Ye.empty().withMutations(function(e){n.forEach(function(i,u,s){var a=t(i,u,s),h=e.get(a,ye);h===ye&&(h=Array(r?n.length:0),e.set(a,h)),r?h[u]=i:h.push(i)})});return i.map(function(t){return ue(t)})},sortBy:function(t,e,r){var n=ie.superCall(this,oe.prototype,"sortBy",[t,e]);return r||(n=n.values()),n.length=this.length,n},__makeSequence:function(){return i(this)}},{},ue);var ce=he.prototype;ce.__toJS=ce.toArray,ce.__toStringMapper=p;var fe=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};ie.createClass(fe,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var s=e?i-u:u;if(t(r[n[s]],n[s],r)===!1)break}return u}},{},ue);var le=function(t){this._array=t,this.length=t.length};ie.createClass(le,{toArray:function(){return this._array},__iterate:function(t,e,r){var n=this._array,i=n.length-1,u=-1;if(e){for(var s=i;s>=0;s--){if(n.hasOwnProperty(s)&&t(n[s],r?s:i-s,n)===!1)return u+1;u=s}return n.length}var a=n.every(function(e,s){return t(e,r?i-s:s,n)===!1?!1:(u=s,!0)});return a?n.length:u+1}},{},he),le.prototype.get=fe.prototype.get,le.prototype.has=fe.prototype.has;var _e=function(t,e,r){this._rootData=t,this._keyPath=e,this._onChange=r},ve=_e;ie.createClass(_e,{get:function(t,e){var r=this._rootData.getIn(this._keyPath,de.empty());return t?r.get(t,e):r},set:function(t,e){return D(this,function(r){return r.set(t,e)},t)},"delete":function(t){return D(this,function(e){return e.delete(t)},t)},update:function(t,e){var r;return"function"==typeof t?(r=t,t=void 0):r=function(r){return r.update(t,e)},D(this,r,t)},cursor:function(t){return t&&!Array.isArray(t)&&(t=[t]),t&&0!==t.length?new ve(this._rootData,this._keyPath?this._keyPath.concat(t):t,this._onChange):this}},{});var ge=5,pe=1<<ge,me=pe-1,ye={},de=function(t){var e=we.empty();return t?t.constructor===we?t:e.merge(t):e <del>},we=de;ie.createClass(de,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,L(t),t,e):e},set:function(t,e){return S(this,t,e)},"delete":function(t){return S(this,t,ye)},update:function(t,e){return this.set(t,e(this.get(t)))},clear:function(){return this.__ownerID?(this.length=0,this._root=null,this):we.empty()},merge:function(){return j(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return j(this,t,e)},mergeDeep:function(){return j(this,U(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return j(this,U(t),e)},updateIn:function(t,e){return t&&0!==t.length?P(this,t,e,0):e(this)},cursor:function(t,e){return e||"function"!=typeof t||(e=t,t=null),t&&!Array.isArray(t)&&(t=[t]),new _e(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.__ensureOwner(this.__ownerID)},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new O)},asImmutable:function(){return this.__ensureOwner()},__iterate:function(t,e){var r=this;if(!r._root)return 0;var n=0;return this._root.iterate(function(e){return t(e[1],e[0],r)===!1?!1:void n++},e),n},__deepEqual:function(t){var e=this;return t.every(function(t,r){return w(e.get(r,ye),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?k(this.length,this._root,t):(this.__ownerID=t,this)}},{empty:function(){return Ce||(Ce=k(0))}},ue);var Ie=de.prototype;de.from=de;var De=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},Oe=De;ie.createClass(De,{get:function(t,e,r,n){var i=1<<(e>>>t&me),u=this.bitmap;return 0===(u&i)?n:this.nodes[R(u&i-1)].get(t+ge,e,r,n)},update:function(t,e,r,n,i,u){var s=r>>>e&me,a=1<<s,h=this.bitmap,o=0!==(h&a);if(!o&&i===ye)return this;var c=R(h&a-1),f=this.nodes,l=o?f[c]:null,_=x(l,t,e+ge,r,n,i,u);if(_===l)return this;if(!o&&_&&f.length>=Re)return q(t,f,h,c,_);if(o&&!_&&2===f.length&&E(f[1^c]))return f[1^c];if(o&&_&&1===f.length&&E(_))return _;var v=t&&t===this.ownerID,g=o?_?h:h^a:h|a,p=o?_?W(f,c,_,v):B(f,c,v):J(f,c,_,v); <del>return v?(this.bitmap=g,this.nodes=p,this):new Oe(t,g,p)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++)if(r[e?i-n:n].iterate(t,e)===!1)return!1}},{});var be=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},Me=be;ie.createClass(be,{get:function(t,e,r,n){var i=e>>>t&me,u=this.nodes[i];return u?u.get(t+ge,e,r,n):n},update:function(t,e,r,n,i,u){var s=r>>>e&me,a=i===ye,h=this.nodes,o=h[s];if(a&&!o)return this;var c=x(o,t,e+ge,r,n,i,u);if(c===o)return this;var f=this.count;if(o){if(!c&&(f--,We>f))return A(t,h,f,s)}else f++;var l=t&&t===this.ownerID,_=W(h,s,c,l);return l?(this.count=f,this.nodes=_,this):new Me(t,f,_)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}}},{});var ke=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},Se=ke;ie.createClass(ke,{get:function(t,e,r,n){for(var i=this.entries,u=0,s=i.length;s>u;u++)if(w(r,i[u][0]))return i[u][1];return n},update:function(t,e,r,n,i,u){var s=i===ye;if(r!==this.hash)return s?this:(u&&(u.value=!0),C(this,t,e,r,[n,i]));for(var a=this.entries,h=0,o=a.length;o>h&&!w(n,a[h][0]);h++);var c=o>h;if(s&&!c)return this;if((s||!c)&&u&&(u.value=!0),s&&2===o)return new xe(t,this.hash,a[1^h]);var f=t&&t===this.ownerID,l=f?a:b(a);return c?s?h===o-1?l.pop():l[h]=l.pop():l[h]=[n,i]:l.push([n,i]),f?(this.entries=l,this):new Se(t,this.hash,l)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var xe=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Ee=xe;ie.createClass(xe,{get:function(t,e,r,n){return w(r,this.entry[0])?this.entry[1]:n},update:function(t,e,r,n,i,u){var s=w(n,this.entry[0]);return i===ye?(s&&u&&(u.value=!0),s?null:this):s?i===this.entry[1]?this:t&&t===this.ownerID?(this.entry[1]=i,this):new Ee(t,r,[n,i]):(u&&(u.value=!0),C(this,t,e,r,[n,i]))},iterate:function(t){return t(this.entry)}},{});var Ce,Ae={value:!1},qe=2147483647,je=16,Ue=255,ze=0,Pe={},Re=pe/2,We=pe/4,Je=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e]; <del>return Be.from(t)},Be=Je;ie.createClass(Je,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=T(t,this._origin),t>=this._size)return e;var r=G(this,t),n=t&me;return r&&(void 0===e||r.array.hasOwnProperty(n))?r.array[n]:e},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){var r=X(this._size);if(t>=this.length)return this.withMutations(function(r){return H(r,0,t+1).set(t,e)});if(this.get(t,ye)===e)return this;if(t=T(t,this._origin),t>=r){var n=this._tail.ensureOwner(this.__ownerID);n.array[t&me]=e;var i=t>=this._size?t+1:this._size;return this.__ownerID?(this.length=i-this._origin,this._size=i,this._tail=n,this):F(this._origin,i,this._level,this._root,n)}for(var u=this._root.ensureOwner(this.__ownerID),s=u,a=this._level;a>0;a-=ge){var h=t>>>a&me;s=s.array[h]=s.array[h]?s.array[h].ensureOwner(this.__ownerID):new Ve([],this.__ownerID)}return s.array[t&me]=e,this.__ownerID?(this._root=u,this):F(this._origin,this._size,this._level,u,this._tail)},"delete":function(t){if(!this.has(t))return this;var e=X(this._size);if(t=T(t,this._origin),t>=e){var r=this._tail.ensureOwner(this.__ownerID);return delete r.array[t&me],this.__ownerID?(this._tail=r,this):F(this._origin,this._size,this._level,this._root,r)}for(var n=this._root.ensureOwner(this.__ownerID),i=n,u=this._level;u>0;u-=ge){var s=t>>>u&me;i=i.array[s]=i.array[s].ensureOwner(this.__ownerID)}return delete i.array[t&me],this.__ownerID?(this._root=n,this):F(this._origin,this._size,this._level,n,this._tail)},clear:function(){return this.__ownerID?(this.length=this._origin=this._size=0,this._level=ge,this._root=this._tail=Ge,this):Be.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){H(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return H(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){H(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return H(this,1) <add>},i},groupBy:function(t,e,r){var n=this,i=Ye.empty().withMutations(function(e){n.forEach(function(i,u,s){var a=t(i,u,s),h=e.get(a,de);h===de&&(h=Array(r?n.length:0),e.set(a,h)),r?h[u]=i:h.push(i)})});return i.map(function(t){return ue(t)})},sortBy:function(t,e,r){var n=ie.superCall(this,oe.prototype,"sortBy",[t,e]);return r||(n=n.values()),n.length=this.length,n},__makeSequence:function(){return i(this)}},{},ue);var ce=he.prototype;ce.__toJS=ce.toArray,ce.__toStringMapper=p;var fe=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};ie.createClass(fe,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var s=e?i-u:u;if(t(r[n[s]],n[s],r)===!1)break}return u}},{},ue);var le=function(t){this._array=t,this.length=t.length};ie.createClass(le,{toArray:function(){return this._array},__iterate:function(t,e,r){var n=this._array,i=n.length-1,u=-1;if(e){for(var s=i;s>=0;s--){if(n.hasOwnProperty(s)&&t(n[s],r?s:i-s,n)===!1)return u+1;u=s}return n.length}var a=n.every(function(e,s){return t(e,r?i-s:s,n)===!1?!1:(u=s,!0)});return a?n.length:u+1}},{},he),le.prototype.get=fe.prototype.get,le.prototype.has=fe.prototype.has;var _e=function(t,e,r){this._rootData=t,this._keyPath=e,this._onChange=r},ve=_e;ie.createClass(_e,{get:function(t,e){var r=this._rootData.getIn(this._keyPath,ye.empty());return t?r.get(t,e):r},set:function(t,e){return D(this,function(r){return r.set(t,e)},t)},"delete":function(t){return D(this,function(e){return e.delete(t)},t)},update:function(t,e){var r;return"function"==typeof t?(r=t,t=void 0):r=function(r){return r.update(t,e)},D(this,r,t)},cursor:function(t){return t&&!Array.isArray(t)&&(t=[t]),t&&0!==t.length?new ve(this._rootData,this._keyPath?this._keyPath.concat(t):t,this._onChange):this}},{});var ge=5,pe=1<<ge,me=pe-1,de={},ye=function(t){var e=we.empty();return t?t.constructor===we?t:e.merge(t):e <add>},we=ye;ie.createClass(ye,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,L(t),t,e):e},set:function(t,e){return S(this,t,e)},"delete":function(t){return S(this,t,de)},update:function(t,e){return this.set(t,e(this.get(t)))},clear:function(){return this.__ownerID?(this.length=0,this._root=null,this):we.empty()},merge:function(){return j(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return j(this,t,e)},mergeDeep:function(){return j(this,U(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return j(this,U(t),e)},updateIn:function(t,e){return t&&0!==t.length?R(this,t,e,0):e(this)},cursor:function(t,e){return e||"function"!=typeof t||(e=t,t=null),t&&!Array.isArray(t)&&(t=[t]),new _e(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.__ensureOwner(this.__ownerID)},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new O)},asImmutable:function(){return this.__ensureOwner()},__iterate:function(t,e){var r=this;if(!r._root)return 0;var n=0;return this._root.iterate(function(e){return t(e[1],e[0],r)===!1?!1:void n++},e),n},__deepEqual:function(t){var e=this;return t.every(function(t,r){return w(e.get(r,de),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?k(this.length,this._root,t):(this.__ownerID=t,this)}},{empty:function(){return Ce||(Ce=k(0))}},ue);var Ie=ye.prototype;ye.from=ye;var De=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},Oe=De;ie.createClass(De,{get:function(t,e,r,n){var i=1<<(e>>>t&me),u=this.bitmap;return 0===(u&i)?n:this.nodes[P(u&i-1)].get(t+ge,e,r,n)},update:function(t,e,r,n,i,u){var s=r>>>e&me,a=1<<s,h=this.bitmap,o=0!==(h&a);if(!o&&i===de)return this;var c=P(h&a-1),f=this.nodes,l=o?f[c]:null,_=x(l,t,e+ge,r,n,i,u);if(_===l)return this;if(!o&&_&&f.length>=Pe)return q(t,f,h,c,_);if(o&&!_&&2===f.length&&E(f[1^c]))return f[1^c];if(o&&_&&1===f.length&&E(_))return _;var v=t&&t===this.ownerID,g=o?_?h:h^a:h|a,p=o?_?W(f,c,_,v):B(f,c,v):J(f,c,_,v); <add>return v?(this.bitmap=g,this.nodes=p,this):new Oe(t,g,p)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++)if(r[e?i-n:n].iterate(t,e)===!1)return!1}},{});var be=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},Me=be;ie.createClass(be,{get:function(t,e,r,n){var i=e>>>t&me,u=this.nodes[i];return u?u.get(t+ge,e,r,n):n},update:function(t,e,r,n,i,u){var s=r>>>e&me,a=i===de,h=this.nodes,o=h[s];if(a&&!o)return this;var c=x(o,t,e+ge,r,n,i,u);if(c===o)return this;var f=this.count;if(o){if(!c&&(f--,We>f))return A(t,h,f,s)}else f++;var l=t&&t===this.ownerID,_=W(h,s,c,l);return l?(this.count=f,this.nodes=_,this):new Me(t,f,_)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}}},{});var ke=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},Se=ke;ie.createClass(ke,{get:function(t,e,r,n){for(var i=this.entries,u=0,s=i.length;s>u;u++)if(w(r,i[u][0]))return i[u][1];return n},update:function(t,e,r,n,i,u){var s=i===de;if(r!==this.hash)return s?this:(u&&(u.value=!0),C(this,t,e,r,[n,i]));for(var a=this.entries,h=0,o=a.length;o>h&&!w(n,a[h][0]);h++);var c=o>h;if(s&&!c)return this;if((s||!c)&&u&&(u.value=!0),s&&2===o)return new xe(t,this.hash,a[1^h]);var f=t&&t===this.ownerID,l=f?a:b(a);return c?s?h===o-1?l.pop():l[h]=l.pop():l[h]=[n,i]:l.push([n,i]),f?(this.entries=l,this):new Se(t,this.hash,l)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var xe=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Ee=xe;ie.createClass(xe,{get:function(t,e,r,n){return w(r,this.entry[0])?this.entry[1]:n},update:function(t,e,r,n,i,u){var s=w(n,this.entry[0]);return i===de?(s&&u&&(u.value=!0),s?null:this):s?i===this.entry[1]?this:t&&t===this.ownerID?(this.entry[1]=i,this):new Ee(t,r,[n,i]):(u&&(u.value=!0),C(this,t,e,r,[n,i]))},iterate:function(t){return t(this.entry)}},{});var Ce,Ae={value:!1},qe=2147483647,je=16,Ue=255,ze=0,Re={},Pe=pe/2,We=pe/4,Je=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e]; <add>return Be.from(t)},Be=Je;ie.createClass(Je,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=T(t,this._origin),t>=this._size)return e;var r=G(this,t),n=t&me;return r&&(void 0===e||r.array.hasOwnProperty(n))?r.array[n]:e},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){var r=X(this._size);if(t>=this.length)return this.withMutations(function(r){return H(r,0,t+1).set(t,e)});if(this.get(t,de)===e)return this;if(t=T(t,this._origin),t>=r){var n=this._tail.ensureOwner(this.__ownerID);n.array[t&me]=e;var i=t>=this._size?t+1:this._size;return this.__ownerID?(this.length=i-this._origin,this._size=i,this._tail=n,this):F(this._origin,i,this._level,this._root,n)}for(var u=this._root.ensureOwner(this.__ownerID),s=u,a=this._level;a>0;a-=ge){var h=t>>>a&me;s=s.array[h]=s.array[h]?s.array[h].ensureOwner(this.__ownerID):new Ve([],this.__ownerID)}return s.array[t&me]=e,this.__ownerID?(this._root=u,this):F(this._origin,this._size,this._level,u,this._tail)},"delete":function(t){if(!this.has(t))return this;var e=X(this._size);if(t=T(t,this._origin),t>=e){var r=this._tail.ensureOwner(this.__ownerID);return delete r.array[t&me],this.__ownerID?(this._tail=r,this):F(this._origin,this._size,this._level,this._root,r)}for(var n=this._root.ensureOwner(this.__ownerID),i=n,u=this._level;u>0;u-=ge){var s=t>>>u&me;i=i.array[s]=i.array[s].ensureOwner(this.__ownerID)}return delete i.array[t&me],this.__ownerID?(this._root=n,this):F(this._origin,this._size,this._level,n,this._tail)},clear:function(){return this.__ownerID?(this.length=this._origin=this._size=0,this._level=ge,this._root=this._tail=Ge,this):Be.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){H(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return H(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){H(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return H(this,1) <ide> },merge:function(){return Q(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return Q(this,t,e)},mergeDeep:function(){return Q(this,U(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return Q(this,U(t),e)},setLength:function(t){return H(this,0,t)},slice:function(t,e,r){var n=ie.superCall(this,Be.prototype,"slice",[t,e,r]);if(!r&&n!==this){var i=this,u=i.length;n.toVector=function(){return H(i,0>t?Math.max(0,u+t):u?Math.min(u,t):t,null==e?u:0>e?Math.max(0,u+e):u?Math.min(u,e):e)}}return n},iterator:function(){return new Ne(this,this._origin,this._size,this._level,this._root,this._tail)},__iterate:function(t,e,r){var n=this,i=0,u=n.length-1;r^=e;var s,a=function(e,s){return t(e,r?u-s:s,n)===!1?!1:(i=s,!0)},h=X(this._size);return s=e?this._tail.iterate(0,h-this._origin,this._size-this._origin,a,e)&&this._root.iterate(this._level,-this._origin,h-this._origin,a,e):this._root.iterate(this._level,-this._origin,h-this._origin,a,e)&&this._tail.iterate(0,h-this._origin,this._size-this._origin,a,e),(s?u:e?u-i:i)+1},__deepEquals:function(t){var e=this.iterator();return t.every(function(t,r){var n=e.next().value;return n&&r===n[0]&&w(t,n[1])})},__ensureOwner:function(t){return t===this.__ownerID?this:t?F(this._origin,this._size,this._level,this._root,this._tail,t):(this.__ownerID=t,this)}},{empty:function(){return Fe||(Fe=F(0,0,ge,Ge,Ge))},from:function(t){if(!t||0===t.length)return Be.empty();if(t.constructor===Be)return t;var e=Array.isArray(t);return t.length>0&&pe>t.length?F(0,t.length,ge,Ge,new Ve(e?b(t):ue(t).toArray())):(e||(t=ue(t),t instanceof he||(t=t.values())),Be.empty().merge(t))}},he);var Le=Je.prototype;Le["@@iterator"]=Le.__iterator__,Le.update=Ie.update,Le.updateIn=Ie.updateIn,Le.cursor=Ie.cursor,Le.withMutations=Ie.withMutations,Le.asMutable=Ie.asMutable,Le.asImmutable=Ie.asImmutable;var Ve=function(t,e){this.array=t,this.ownerID=e},Ke=Ve;ie.createClass(Ve,{ensureOwner:function(t){return t&&t===this.ownerID?this:new Ke(this.array.slice(),t) <del>},removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&me;if(n>=this.array.length)return new Ke([],t);var i,u=0===n;if(e>0){var s=this.array[n];if(i=s&&s.removeBefore(t,e-ge,r),i===s&&u)return this}if(u&&!i)return this;var a=this.ensureOwner();if(!u)for(var h=0;n>h;h++)delete a.array[h];return i&&(a.array[n]=i),a},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&me;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var s=this.array[n];if(i=s&&s.removeAfter(t,e-ge,r),i===s&&u)return this}if(u&&!i)return this;var a=this.ensureOwner();return u||(a.array.length=n+1),i&&(a.array[n]=i),a},iterate:function(t,e,r,n,i){if(0===t){if(i){for(var u=this.array.length-1;u>=0;u--)if(this.array.hasOwnProperty(u)){var s=u+e;if(s>=0&&r>s&&n(this.array[u],s)===!1)return!1}return!0}return this.array.every(function(t,i){var u=i+e;return 0>u||u>=r||n(t,u)!==!1})}var a=1<<t,h=t-ge;if(i){for(var o=this.array.length-1;o>=0;o--){var c=e+o*a;if(r>c&&c+a>0&&this.array.hasOwnProperty(o)&&!this.array[o].iterate(h,c,r,n,i))return!1}return!0}return this.array.every(function(t,u){var s=e+u*a;return s>=r||0>=s+a||t.iterate(h,s,r,n,i)})}},{});var Ne=function(t,e,r,n,i,u){var s=X(r);this._stack=N(i.array,n,-e,s-e,N(u.array,0,s-e,r-e))};ie.createClass(Ne,{next:function(){var t=this._stack;t:for(;t;){if(0===t.level)for(t.rawIndex||(t.rawIndex=0);t.array.length>t.rawIndex;){var e=t.rawIndex+t.offset;if(e>=0&&t.max>e&&t.array.hasOwnProperty(t.rawIndex)){var r=t.array[t.rawIndex];return t.rawIndex++,{value:[e,r],done:!1}}t.rawIndex++}else{var n=1<<t.level;for(t.levelIndex||(t.levelIndex=0);t.array.length>t.levelIndex;){var i=t.offset+t.levelIndex*n;if(i+n>0&&t.max>i){var u=t.array[t.levelIndex];if(u){t.levelIndex++,t=this._stack=N(u.array,t.level-ge,i,t.max,t);continue t}}t.levelIndex++}}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}}},{});var Fe,Ge=new Ve([]),He=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Qe.from(t) <del>},Qe=He;ie.createClass(He,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map?this._map.has(t):!1},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map;return e||(e=de.empty().__ensureOwner(this.__ownerID)),e=e.set(t,null),this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:Y(e)},"delete":function(t){if(null==this._map)return this;var e=this._map.delete(t);return 0===e.length?this.clear():this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:Y(e)},clear:function(){return this.__ownerID?(this.length=0,this._map=null,this):Qe.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++){var n=t[r];n=n.forEach?n:ue(n),n.forEach(function(t){return e.add(t)})}})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return ue(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.delete(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return ue(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.delete(r)})})},isSubset:function(t){return t=ue(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=ue(t),t.every(function(t){return e.contains(t)})},__iterate:function(t,e){var r=this;return this._map?this._map.__iterate(function(e,n){return t(n,n,r)},e):0},__deepEquals:function(t){return!(this._map||t._map)||this._map.equals(t._map)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?Y(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Xe||(Xe=Y())},from:function(t){var e=Qe.empty();return t?t.constructor===Qe?t:e.union(t):e},fromKeys:function(t){return Qe.from(ue(t).flip()) <del>}},ue);var Te=He.prototype;Te.contains=Te.has,Te.withMutations=de.prototype.withMutations,Te.asMutable=de.prototype.asMutable,Te.asImmutable=de.prototype.asImmutable,Te.__toJS=he.prototype.__toJS,Te.__toStringMapper=he.prototype.__toStringMapper;var Xe,Ye=function(t){var e=Ze.empty();return t?t.constructor===Ze?t:e.merge(t):e},Ze=Ye;ie.createClass(Ye,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){if(null!=t&&this._map){var r=this._map.get(t);if(null!=r)return this._vector.get(r)[1]}return e},clear:function(){return this.__ownerID?(this.length=0,this._map=this._vector=null,this):Ze.empty()},set:function(t,e){if(null==t)return this;var r=this._map,n=this._vector;if(r){var i=r.get(t);null==i?(r=r.set(t,n.length),n=n.push([t,e])):n.get(i)[1]!==e&&(n=n.set(i,[t,e]))}else n=Je.empty().__ensureOwner(this.__ownerID).set(0,[t,e]),r=de.empty().__ensureOwner(this.__ownerID).set(t,0);return this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):n===this._vector?this:Z(r,n)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.get(t);if(null==e)return this;var r=this._map.delete(t),n=this._vector.delete(e);return 0===r.length?this.clear():this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):r===this._map?this:Z(r,n)},__iterate:function(t,e){return this._vector?this._vector.fromEntries().__iterate(t,e):0},__deepEqual:function(t){var e=this._vector.iterator();return t.every(function(t,r){var n=e.next().value;return n&&(n=n[1]),n&&w(r,n[0])&&w(t,n[1])})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t),r=this._vector&&this._vector.__ensureOwner(t);return t?Z(e,r,t):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return $e||($e=Z())}},de),Ye.from=Ye;var $e,tr=function(t,e){var r=function(t){this._map=de(t)};t=ue(t);var n=r.prototype=Object.create(rr);n.constructor=r,n._name=e,n._defaultValues=t;var i=Object.keys(t);return r.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e) <del>},set:function(t){I(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),r},er=tr;ie.createClass(tr,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return er._empty||(er._empty=$(this,de.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:$(this,r)},"delete":function(t){if(null==t||!this.has(t))return this;var e=this._map.delete(t);return this.__ownerID||e===this._map?this:$(this,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?$(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},ue);var rr=tr.prototype;rr.__deepEqual=Ie.__deepEqual,rr.merge=Ie.merge,rr.mergeWith=Ie.mergeWith,rr.mergeDeep=Ie.mergeDeep,rr.mergeDeepWith=Ie.mergeDeepWith,rr.update=Ie.update,rr.updateIn=Ie.updateIn,rr.cursor=Ie.cursor,rr.withMutations=Ie.withMutations,rr.asMutable=Ie.asMutable,rr.asImmutable=Ie.asImmutable;var nr=function(t,e,r){return this instanceof ir?(I(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&sr?sr:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new ir(t,e,r)},ir=nr;ie.createClass(nr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return I(t>=0,"Index out of bounds"),this.length>t},get:function(t,e){return I(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e) <del>},slice:function(t,e,r){return s(t,e,this.length)?this:r?ie.superCall(this,ir.prototype,"slice",[t,e,r]):(t=a(t,this.length),e=h(e,this.length),t>=e?sr:new ir(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t,e){return e?ie.superCall(this,ir.prototype,"skip",[t]):this.slice(t)},__iterate:function(t,e,r){for(var n=e^r,i=this.length-1,u=this._step,s=e?this._start+i*u:this._start,a=0;i>=a&&t(s,n?i-a:a,this)!==!1;a++)s+=e?-u:u;return n?this.length:a},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},he);var ur=nr.prototype;ur.__toJS=ur.toArray,ur.first=Le.first,ur.last=Le.last;var sr=nr(0,0),ar=function(t,e){return 0===e&&cr?cr:this instanceof hr?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new hr(t,e)},hr=ar;ie.createClass(ar,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return I(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._value:e},first:function(){return this._value},contains:function(t){return w(this._value,t)},slice:function(t,e,r){if(r)return ie.superCall(this,hr.prototype,"slice",[t,e,r]);var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new hr(this._value,e-t):cr},reverse:function(t){return t?ie.superCall(this,hr.prototype,"reverse",[t]):this},indexOf:function(t){return w(this._value,t)?0:-1},lastIndexOf:function(t){return w(this._value,t)?this.length:-1},__iterate:function(t,e,r){var n=e^r;I(!n||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,n?i-u:u,this)!==!1;u++);return n?this.length:u},__deepEquals:function(t){return w(this._value,t._value)}},{},he);var or=ar.prototype;or.last=or.first,or.has=ur.has,or.take=ur.take,or.skip=ur.skip,or.__toJS=ur.__toJS; <del>var cr=new ar(void 0,0),fr={Sequence:ue,Map:de,Vector:Je,Set:He,OrderedMap:Ye,Record:tr,Range:nr,Repeat:ar,is:w,fromJS:te};return fr}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide>\ No newline at end of file <add>},removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&me;if(n>=this.array.length)return new Ke([],t);var i,u=0===n;if(e>0){var s=this.array[n];if(i=s&&s.removeBefore(t,e-ge,r),i===s&&u)return this}if(u&&!i)return this;var a=this.ensureOwner();if(!u)for(var h=0;n>h;h++)delete a.array[h];return i&&(a.array[n]=i),a},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&me;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var s=this.array[n];if(i=s&&s.removeAfter(t,e-ge,r),i===s&&u)return this}if(u&&!i)return this;var a=this.ensureOwner();return u||(a.array.length=n+1),i&&(a.array[n]=i),a},iterate:function(t,e,r,n,i){var u,s=this.array,a=s.length-1;if(0===t)for(u=0;a>=u;u++){var h=i?a-u:u;if(s.hasOwnProperty(h)){var o=h+e;if(o>=0&&r>o&&n(s[h],o)===!1)return!1}}else{var c=1<<t,f=t-ge;for(u=0;a>=u;u++){var l=i?a-u:u,_=e+l*c;if(r>_&&_+c>0){var v=s[l];if(v&&!v.iterate(f,_,r,n,i))return!1}}}return!0}},{});var Ne=function(t,e,r,n,i,u){var s=X(r);this._stack=N(i.array,n,-e,s-e,N(u.array,0,s-e,r-e))};ie.createClass(Ne,{next:function(){var t=this._stack;t:for(;t;){if(0===t.level)for(t.rawIndex||(t.rawIndex=0);t.array.length>t.rawIndex;){var e=t.rawIndex+t.offset;if(e>=0&&t.max>e&&t.array.hasOwnProperty(t.rawIndex)){var r=t.array[t.rawIndex];return t.rawIndex++,{value:[e,r],done:!1}}t.rawIndex++}else{var n=1<<t.level;for(t.levelIndex||(t.levelIndex=0);t.array.length>t.levelIndex;){var i=t.offset+t.levelIndex*n;if(i+n>0&&t.max>i){var u=t.array[t.levelIndex];if(u){t.levelIndex++,t=this._stack=N(u.array,t.level-ge,i,t.max,t);continue t}}t.levelIndex++}}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}}},{});var Fe,Ge=new Ve([]),He=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Qe.from(t)},Qe=He;ie.createClass(He,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map?this._map.has(t):!1},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map; <add>return e||(e=ye.empty().__ensureOwner(this.__ownerID)),e=e.set(t,null),this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:Y(e)},"delete":function(t){if(null==this._map)return this;var e=this._map.delete(t);return 0===e.length?this.clear():this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:Y(e)},clear:function(){return this.__ownerID?(this.length=0,this._map=null,this):Qe.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++){var n=t[r];n=n.forEach?n:ue(n),n.forEach(function(t){return e.add(t)})}})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return ue(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.delete(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return ue(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.delete(r)})})},isSubset:function(t){return t=ue(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=ue(t),t.every(function(t){return e.contains(t)})},__iterate:function(t,e){var r=this;return this._map?this._map.__iterate(function(e,n){return t(n,n,r)},e):0},__deepEquals:function(t){return!(this._map||t._map)||this._map.equals(t._map)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?Y(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Xe||(Xe=Y())},from:function(t){var e=Qe.empty();return t?t.constructor===Qe?t:e.union(t):e},fromKeys:function(t){return Qe.from(ue(t).flip())}},ue);var Te=He.prototype;Te.contains=Te.has,Te.withMutations=ye.prototype.withMutations,Te.asMutable=ye.prototype.asMutable,Te.asImmutable=ye.prototype.asImmutable,Te.__toJS=he.prototype.__toJS,Te.__toStringMapper=he.prototype.__toStringMapper; <add>var Xe,Ye=function(t){var e=Ze.empty();return t?t.constructor===Ze?t:e.merge(t):e},Ze=Ye;ie.createClass(Ye,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){if(null!=t&&this._map){var r=this._map.get(t);if(null!=r)return this._vector.get(r)[1]}return e},clear:function(){return this.__ownerID?(this.length=0,this._map=this._vector=null,this):Ze.empty()},set:function(t,e){if(null==t)return this;var r=this._map,n=this._vector;if(r){var i=r.get(t);null==i?(r=r.set(t,n.length),n=n.push([t,e])):n.get(i)[1]!==e&&(n=n.set(i,[t,e]))}else n=Je.empty().__ensureOwner(this.__ownerID).set(0,[t,e]),r=ye.empty().__ensureOwner(this.__ownerID).set(t,0);return this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):n===this._vector?this:Z(r,n)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.get(t);if(null==e)return this;var r=this._map.delete(t),n=this._vector.delete(e);return 0===r.length?this.clear():this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):r===this._map?this:Z(r,n)},__iterate:function(t,e){return this._vector?this._vector.fromEntries().__iterate(t,e):0},__deepEqual:function(t){var e=this._vector.iterator();return t.every(function(t,r){var n=e.next().value;return n&&(n=n[1]),n&&w(r,n[0])&&w(t,n[1])})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t),r=this._vector&&this._vector.__ensureOwner(t);return t?Z(e,r,t):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return $e||($e=Z())}},ye),Ye.from=Ye;var $e,tr=function(t,e){var r=function(t){this._map=ye(t)};t=ue(t);var n=r.prototype=Object.create(rr);n.constructor=r,n._name=e,n._defaultValues=t;var i=Object.keys(t);return r.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){I(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),r},er=tr;ie.createClass(tr,{toString:function(){return this.__toString((this._name||"Record")+" {","}") <add>},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return er._empty||(er._empty=$(this,ye.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:$(this,r)},"delete":function(t){if(null==t||!this.has(t))return this;var e=this._map.delete(t);return this.__ownerID||e===this._map?this:$(this,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?$(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},ue);var rr=tr.prototype;rr.__deepEqual=Ie.__deepEqual,rr.merge=Ie.merge,rr.mergeWith=Ie.mergeWith,rr.mergeDeep=Ie.mergeDeep,rr.mergeDeepWith=Ie.mergeDeepWith,rr.update=Ie.update,rr.updateIn=Ie.updateIn,rr.cursor=Ie.cursor,rr.withMutations=Ie.withMutations,rr.asMutable=Ie.asMutable,rr.asImmutable=Ie.asImmutable;var nr=function(t,e,r){return this instanceof ir?(I(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&sr?sr:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new ir(t,e,r)},ir=nr;ie.createClass(nr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return I(t>=0,"Index out of bounds"),this.length>t},get:function(t,e){return I(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,r){return s(t,e,this.length)?this:r?ie.superCall(this,ir.prototype,"slice",[t,e,r]):(t=a(t,this.length),e=h(e,this.length),t>=e?sr:new ir(this.get(t,this._end),this.get(e,this._end),this._step)) <add>},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t,e){return e?ie.superCall(this,ir.prototype,"skip",[t]):this.slice(t)},__iterate:function(t,e,r){for(var n=e^r,i=this.length-1,u=this._step,s=e?this._start+i*u:this._start,a=0;i>=a&&t(s,n?i-a:a,this)!==!1;a++)s+=e?-u:u;return n?this.length:a},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},he);var ur=nr.prototype;ur.__toJS=ur.toArray,ur.first=Le.first,ur.last=Le.last;var sr=nr(0,0),ar=function(t,e){return 0===e&&cr?cr:this instanceof hr?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new hr(t,e)},hr=ar;ie.createClass(ar,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return I(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._value:e},first:function(){return this._value},contains:function(t){return w(this._value,t)},slice:function(t,e,r){if(r)return ie.superCall(this,hr.prototype,"slice",[t,e,r]);var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new hr(this._value,e-t):cr},reverse:function(t){return t?ie.superCall(this,hr.prototype,"reverse",[t]):this},indexOf:function(t){return w(this._value,t)?0:-1},lastIndexOf:function(t){return w(this._value,t)?this.length:-1},__iterate:function(t,e,r){var n=e^r;I(!n||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,u=0;i>=u&&t(this._value,n?i-u:u,this)!==!1;u++);return n?this.length:u},__deepEquals:function(t){return w(this._value,t._value)}},{},he);var or=ar.prototype;or.last=or.first,or.has=ur.has,or.take=ur.take,or.skip=ur.skip,or.__toJS=ur.__toJS;var cr=new ar(void 0,0),fr={Sequence:ue,Map:ye,Vector:Je,Set:He,OrderedMap:Ye,Record:tr,Range:nr,Repeat:ar,is:w,fromJS:te};return fr}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <ide><path>src/Vector.js <ide> class VNode { <ide> iterate(level, offset, max, fn, reverse) { <ide> // Note using every() gets us a speed-up of 2x on modern JS VMs, but means <ide> // we cannot support IE8 without polyfill. <add> var ii; <add> var array = this.array; <add> var maxII = array.length - 1; <ide> if (level === 0) { <del> if (reverse) { <del> for (var revRawIndex = this.array.length - 1; revRawIndex >= 0; revRawIndex--) { <del> if (this.array.hasOwnProperty(revRawIndex)) { <del> var index = revRawIndex + offset; <del> if (index >= 0 && index < max && fn(this.array[revRawIndex], index) === false) { <del> return false; <del> } <del> } <del> } <del> return true; <del> } else { <del> return this.array.every((value, rawIndex) => { <add> for (ii = 0; ii <= maxII; ii++) { <add> var rawIndex = reverse ? maxII - ii : ii; <add> if (array.hasOwnProperty(rawIndex)) { <ide> var index = rawIndex + offset; <del> return index < 0 || index >= max || fn(value, index) !== false; <del> }); <del> } <del> } <del> var step = 1 << level; <del> var newLevel = level - SHIFT; <del> if (reverse) { <del> for (var revLevelIndex = this.array.length - 1; revLevelIndex >= 0; revLevelIndex--) { <del> var newOffset = offset + revLevelIndex * step; <del> if (newOffset < max && newOffset + step > 0 && <del> this.array.hasOwnProperty(revLevelIndex) && <del> !this.array[revLevelIndex].iterate(newLevel, newOffset, max, fn, reverse)) { <del> return false; <add> if (index >= 0 && index < max && fn(array[rawIndex], index) === false) { <add> return false; <add> } <ide> } <ide> } <del> return true; <ide> } else { <del> return this.array.every((newNode, levelIndex) => { <add> var step = 1 << level; <add> var newLevel = level - SHIFT; <add> for (ii = 0; ii <= maxII; ii++) { <add> var levelIndex = reverse ? maxII - ii : ii; <ide> var newOffset = offset + levelIndex * step; <del> return newOffset >= max || newOffset + step <= 0 || newNode.iterate(newLevel, newOffset, max, fn, reverse); <del> }); <add> if (newOffset < max && newOffset + step > 0) { <add> var node = array[levelIndex]; <add> if (node && !node.iterate(newLevel, newOffset, max, fn, reverse)) { <add> return false; <add> } <add> } <add> } <ide> } <add> return true; <ide> } <ide> } <ide>
3
PHP
PHP
fix function definition check
63cd603fc34ea85de65dfdcdbec53bdcb4ace07d
<ide><path>src/Core/functions.php <ide> function deprecationWarning($message, $stackFrame = 2) <ide> } <ide> } <ide> <del>if (!function_exists('getVarType')) { <add>if (!function_exists('getTypeName')) { <ide> /** <ide> * Returns the objects class or var type of it's not an object <ide> *
1
Text
Text
change node alias from stable to lts
4ea2ad881b144cf266bf899a09b50e313a8f6b82
<ide><path>docs/devops.md <ide> Verify installed packages <ide> npm ls -g --depth=0 <ide> ``` <ide> <del>Alias `default` Node.js versions to the current `stable` <add>Alias the `default` Node.js version to the current LTS <ide> <ide> ```console <del>nvm alias default stable <add>nvm alias default lts/* <ide> ``` <ide> <ide>
1
Text
Text
update readme and add todo
3a97fe27d8f5a9bbcf4992cc9efe33880e73f274
<ide><path>pkg/libcontainer/README.md <ide> ## libcontainer - reference implementation for containers <ide> <del>#### playground <add>#### background <ide> <add>libcontainer specifies configuration options for what a container is. It provides a native Go implementation <add>for using linux namespaces with no external dependencies. libcontainer provides many convience functions for working with namespaces, networking, and management. <ide> <del>Use the cli package to test out functionality <del> <del>First setup a container configuration. You will need a root fs, better go the path to a <del>stopped docker container and use that. <ide> <add>#### container <add>A container is a self contained directory that is able to run one or more processes inside without <add>affecting the host system. The directory is usually a full system tree. Inside the directory <add>a `container.json` file just be placed with the runtime configuration for how the process <add>should be contained and run. Environment, networking, and different capabilities for the <add>process are specified in this file. <ide> <add>Sample `container.json` file: <ide> ```json <ide> { <del> "id": "koye", <del> "namespace_pid": 12265, <del> "command": { <del> "args": [ <del> "/bin/bash" <del> ], <del> "environment": [ <del> "HOME=/", <del> "PATH=PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin", <del> "container=docker", <del> "TERM=xterm" <del> ] <del> }, <del> "rootfs": "/root/development/gocode/src/github.com/docker/libcontainer/namespaces/ubuntu", <del> "network": null, <del> "user": "", <del> "working_dir": "", <add> "hostname": "koye", <add> "environment": [ <add> "HOME=/", <add> "PATH=PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin", <add> "container=docker", <add> "TERM=xterm-256color" <add> ], <ide> "namespaces": [ <del> "NEWNET", <ide> "NEWIPC", <ide> "NEWNS", <ide> "NEWPID", <del> "NEWUTS" <add> "NEWUTS", <add> "NEWNET" <ide> ], <ide> "capabilities": [ <ide> "SETPCAP", <ide> stopped docker container and use that. <ide> "AUDIT_CONTROL", <ide> "MAC_OVERRIDE", <ide> "MAC_ADMIN" <del> ] <add> ], <add> "network": { <add> "ip": "172.17.0.100/16", <add> "gateway": "172.17.42.1", <add> "bridge": "docker0", <add> "mtu": 1500 <add> } <ide> } <ide> ``` <ide> <del>After you have a json file and a rootfs path to use just run: <del>`./cli exec container.json` <add>Using this configuration and the current directory holding the rootfs for a process to live, one can se libcontainer to exec the container. Running the life of the namespace a `.nspid` file <add>is written to the current directory with the pid of the namespace'd process to the external word. A client can use this pid to wait, kill, or perform other operation with the container. If a user tries to run an new process inside an existing container with a live namespace with namespace will be joined by the new process. <add> <add> <add>#### nsinit <add> <add>`nsinit` is a cli application used as the reference implementation of libcontainer. It is able to <add>spawn or join new containers giving the current directory. To use `nsinit` cd into a linux <add>rootfs and copy a `container.json` file into the directory with your specified configuration. <add> <add>To execution `/bin/bash` in the current directory as a container just run: <add>```bash <add>nsinit exec /bin/bash <add>``` <ide> <add>If you wish to spawn another process inside the container while your current bash session is <add>running just run the exact same command again to get another bash shell or change the command. If the original process dies, PID 1, all other processes spawned inside the container will also be killed and the namespace will be removed. <ide> <del>If you want to attach to an existing namespace just use the same json <del>file with the container still running and do: <del>`./cli execin container.json` <add>You can identify if a process is running in a container by looking to see if `.nspid` is in the root of the directory. <ide><path>pkg/libcontainer/TODO.md <add>#### goals <add>* small and simple - line count is not everything but less code is better <add>* clean lines between what we do in the pkg <add>* provide primitives for working with namespaces not cater to every option <add>* extend via configuration not by features - host networking, no networking, veth network can be accomplished via adjusting the container.json, nothing to do with code <add> <add>#### tasks <add>* proper tty for a new process in an existing container <add>* use exec or raw syscalls for new process in existing container <add>* setup proper user in namespace if specified <add>* implement hook or clean interface for cgroups <add>* example configs for different setups (host networking, boot init) <add>* improve pkg documentation with comments <add>* testing - this is hard in a low level pkg but we could do some, maybe <add>* pivot root <add>* selinux <add>* apparmor
2
Python
Python
add module extensions to load_library search list
6c433aa3f089edda07fda4054fc13ddc8a294bad
<ide><path>numpy/ctypeslib.py <ide> def load_library(libname, loader_path): <ide> from numpy.distutils.misc_util import get_shared_lib_extension <ide> so_ext = get_shared_lib_extension() <ide> libname_ext = [libname + so_ext] <del> if sys.version[:3] >= '3.2': <del> # For Python >= 3.2 a tag may be added to lib extension <del> # (platform dependent). If we find such a tag, try both with <del> # and without it. <del> so_ext2 = get_shared_lib_extension(is_python_ext=True) <del> if not so_ext2 == so_ext: <del> libname_ext.insert(0, libname + so_ext2) <del> if sys.platform == 'win32': <del> libname_ext.insert(0, '%s.dll' % libname) <del> elif sys.platform == 'darwin': <del> libname_ext.insert(0, '%s.dylib' % libname) <add> # mac, windows and linux >= py3.2 shared library and loadable <add> # module have different extensions so try both <add> so_ext2 = get_shared_lib_extension(is_python_ext=True) <add> if not so_ext2 == so_ext: <add> libname_ext.insert(0, libname + so_ext2) <ide> else: <ide> libname_ext = [libname] <ide>
1
Ruby
Ruby
require time before monkey-patching it
e3d775f00a9cbe28e1647b39ed0fb41d5168c5e1
<ide><path>activesupport/lib/active_support/core_ext/object/json.rb <ide> # Hack to load json gem first so we can overwrite its to_json. <ide> require 'json' <ide> require 'bigdecimal' <add>require 'time' <ide> <ide> # The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting <ide> # their default behavior. That said, we need to define the basic to_json method in all of them, <ide><path>activesupport/lib/active_support/json/encoding.rb <ide> require 'active_support/core_ext/hash/except' <ide> require 'active_support/core_ext/hash/slice' <ide> require 'active_support/core_ext/object/instance_variables' <del>require 'time' <ide> require 'active_support/core_ext/time/conversions' <ide> require 'active_support/core_ext/date_time/conversions' <ide> require 'active_support/core_ext/date/conversions'
2
Text
Text
fix typos in 1.8.1/1.8.2 notes
2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f
<ide><path>CHANGELOG.md <ide> # 1.8.2 meteoric-mining (2020-10-21) <ide> <ide> ## Bug Fixes <del>- **$sceDelegate:** ensure that `resourceUrlWhitelist()` is identical `trustedResourceUrlList()` <add>- **$sceDelegate:** ensure that `resourceUrlWhitelist()` is identical to `trustedResourceUrlList()` <ide> ([e41f01](https://github.com/angular/angular.js/commit/e41f018959934bfbf982ba996cd654b1fce88d43), <ide> [#17090](https://github.com/angular/angular.js/issues/17090)) <del>- **$sanitize:** do not trigger CSP alert/report in Firefox and Chrome <del> ([2fab3d](https://github.com/angular/angular.js/commit/2fab3d4e00f4fe35bfa3cf255160cb97404baf24)) <ide> <ide> <ide> <a name="1.8.1"></a> <ide> ## Deprecation Notices <ide> <ide> - Deprecated ~~`$compileProvider.aHrefSanitizationWhitelist`~~. <del> It is now [aHrefSanitizationTrustedUrlList](https://docs.angularjs.org/api/ng/provider/$compileProvider#aHrefSanitizationTrustedUrlList)`. <add> It is now [`aHrefSanitizationTrustedUrlList`](https://docs.angularjs.org/api/ng/provider/$compileProvider#aHrefSanitizationTrustedUrlList). <ide> - Deprecated ~~`$compileProvider.imgSrcSanitizationWhitelist`~~. <del> It is now [imgSrcSanitizationTrustedUrlList](https://docs.angularjs.org/api/ng/provider/$compileProvider#imgSrcSanitizationTrustedUrlList). <add> It is now [`imgSrcSanitizationTrustedUrlList`](https://docs.angularjs.org/api/ng/provider/$compileProvider#imgSrcSanitizationTrustedUrlList). <ide> - Deprecated ~~`$httpProvider.xsrfWhitelistedOrigins`~~. <del> It is now [xsrfTrustedOrigins](https://docs.angularjs.org/api/ng/provider/$httpProvider#xsrfTrustedOrigins). <add> It is now [`xsrfTrustedOrigins`](https://docs.angularjs.org/api/ng/provider/$httpProvider#xsrfTrustedOrigins). <ide> - Deprecated ~~`$sceDelegateProvider.resourceUrlWhitelist`~~. <del> It is now [trustedResourceUrlList](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#trustedResourceUrlList). <add> It is now [`trustedResourceUrlList`](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#trustedResourceUrlList). <ide> - Deprecated ~~`$sceDelegateProvider.resourceUrlBlacklist`~~. <del> It is now [bannedResourceUrlList](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#bannedResourceUrlList). <add> It is now [`bannedResourceUrlList`](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#bannedResourceUrlList). <ide> <ide> For the purposes of backward compatibility, the previous symbols are aliased to their new symbol. <ide>
1
Java
Java
avoid jmsexception in listener execution
6560aed1c85eef68faeb0356c34e12035a2826bf
<ide><path>spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java <ide> protected void handleListenerException(Throwable ex) { <ide> * @param message the JMS {@code Message} <ide> * @return the content of the message, to be passed into the <ide> * listener method as argument <del> * @throws JMSException if thrown by JMS API methods <add> * @throws MessageConversionException if the message could not be unmarshaled <ide> */ <del> protected Object extractMessage(Message message) throws JMSException { <del> MessageConverter converter = getMessageConverter(); <del> if (converter != null) { <del> return converter.fromMessage(message); <add> protected Object extractMessage(Message message) { <add> try { <add> MessageConverter converter = getMessageConverter(); <add> if (converter != null) { <add> return converter.fromMessage(message); <add> } <add> return message; <add> } <add> catch (JMSException e) { <add> throw new MessageConversionException("Could not unmarshal message", e); <ide> } <del> return message; <ide> } <ide> <ide> /** <ide> protected Object extractMessage(Message message) throws JMSException { <ide> * @param result the result object to handle (never {@code null}) <ide> * @param request the original request message <ide> * @param session the JMS Session to operate on (may be {@code null}) <del> * @throws JMSException if thrown by JMS API methods <add> * @throws ReplyFailureException if the response message could not be sent <ide> * @see #buildMessage <ide> * @see #postProcessResponse <ide> * @see #getResponseDestination <ide> * @see #sendResponse <ide> */ <del> protected void handleResult(Object result, Message request, Session session) throws JMSException { <add> protected void handleResult(Object result, Message request, Session session) { <ide> if (session != null) { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug("Listener method returned result [" + result + <ide> "] - generating response message for it"); <ide> } <del> Message response = buildMessage(session, result); <del> postProcessResponse(request, response); <del> Destination destination = getResponseDestination(request, response, session); <del> sendResponse(session, destination, response); <add> try { <add> Message response = buildMessage(session, result); <add> postProcessResponse(request, response); <add> Destination destination = getResponseDestination(request, response, session); <add> sendResponse(session, destination, response); <add> } <add> catch (Exception e) { <add> throw new ReplyFailureException("Failed to send reply with payload '" + result + "'", e); <add> } <ide> } <ide> else { <ide> if (logger.isWarnEnabled()) { <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java <ide> public void setHandlerMethod(InvocableHandlerMethod handlerMethod) { <ide> <ide> @Override <ide> public void onMessage(javax.jms.Message jmsMessage, Session session) throws JMSException { <del> try { <del> Message<?> message = toMessagingMessage(jmsMessage); <del> if (logger.isDebugEnabled()) { <del> logger.debug("Processing [" + message + "]"); <del> } <del> Object result = handlerMethod.invoke(message, jmsMessage, session); <del> if (result != null) { <del> handleResult(result, jmsMessage, session); <del> } <del> else { <del> logger.trace("No result object given - no result to handle"); <del> } <add> Message<?> message = toMessagingMessage(jmsMessage); <add> if (logger.isDebugEnabled()) { <add> logger.debug("Processing [" + message + "]"); <ide> } <del> catch (MessagingException e) { <del> throw new ListenerExecutionFailedException(createMessagingErrorMessage("Listener method could not " + <del> "be invoked with the incoming message"), e); <add> Object result = invokeHandler(jmsMessage, session, message); <add> if (result != null) { <add> handleResult(result, jmsMessage, session); <ide> } <del> catch (Exception e) { <del> throw new ListenerExecutionFailedException("Listener method '" <del> + handlerMethod.getMethod().toGenericString() + "' threw exception", e); <add> else { <add> logger.trace("No result object given - no result to handle"); <ide> } <ide> } <ide> <ide> @SuppressWarnings("unchecked") <del> protected Message<?> toMessagingMessage(javax.jms.Message jmsMessage) throws JMSException { <add> protected Message<?> toMessagingMessage(javax.jms.Message jmsMessage) { <ide> Map<String, Object> mappedHeaders = getHeaderMapper().toHeaders(jmsMessage); <ide> Object convertedObject = extractMessage(jmsMessage); <ide> MessageBuilder<Object> builder = (convertedObject instanceof org.springframework.messaging.Message) ? <ide> protected Message<?> toMessagingMessage(javax.jms.Message jmsMessage) throws JMS <ide> return builder.copyHeadersIfAbsent(mappedHeaders).build(); <ide> } <ide> <add> /** <add> * Invoke the handler, wrapping any exception to a {@link ListenerExecutionFailedException} with <add> * a dedicated error message. <add> */ <add> private Object invokeHandler(javax.jms.Message jmsMessage, Session session, Message<?> message) { <add> try { <add> return handlerMethod.invoke(message, jmsMessage, session); <add> } <add> catch (MessagingException e) { <add> throw new ListenerExecutionFailedException(createMessagingErrorMessage("Listener method could not " + <add> "be invoked with the incoming message"), e); <add> } <add> catch (Exception e) { <add> throw new ListenerExecutionFailedException("Listener method '" <add> + handlerMethod.getMethod().toGenericString() + "' threw exception", e); <add> } <add> } <add> <ide> private String createMessagingErrorMessage(String description) { <ide> StringBuilder sb = new StringBuilder(description).append("\n") <ide> .append("Endpoint handler details:\n") <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/adapter/ReplyFailureException.java <add>/* <add> * Copyright 2002-2014 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.jms.listener.adapter; <add> <add>import org.springframework.jms.JmsException; <add> <add>/** <add> * Exception to be thrown when the reply of a message failed to be sent. <add> * <add> * @author Stephane Nicoll <add> * @since 4.1 <add> */ <add>@SuppressWarnings("serial") <add>public class ReplyFailureException extends JmsException { <add> <add> public ReplyFailureException(String msg, Throwable cause) { <add> super(msg, cause); <add> } <add>} <ide><path>spring-jms/src/test/java/org/springframework/jms/config/MethodJmsListenerEndpointTests.java <ide> import org.springframework.jms.listener.DefaultMessageListenerContainer; <ide> import org.springframework.jms.listener.MessageListenerContainer; <ide> import org.springframework.jms.listener.SimpleMessageListenerContainer; <add>import org.springframework.jms.listener.adapter.ReplyFailureException; <ide> import org.springframework.jms.listener.adapter.ListenerExecutionFailedException; <ide> import org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter; <ide> import org.springframework.jms.support.JmsMessageHeaderAccessor; <ide> public void emptySendTo() throws JMSException { <ide> Session session = mock(Session.class); <ide> given(session.createTextMessage("content")).willReturn(reply); <ide> <del> thrown.expect(ListenerExecutionFailedException.class); <add> thrown.expect(ReplyFailureException.class); <ide> thrown.expectCause(Matchers.isA(InvalidDestinationException.class)); <ide> listener.onMessage(createSimpleJmsTextMessage("content"), session); <ide> } <ide><path>spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapterTests.java <ide> protected Object extractMessage(Message message) { <ide> }; <ide> try { <ide> adapter.onMessage(sentTextMessage, session); <del> fail("expected InvalidDestinationException"); <del> } catch(InvalidDestinationException ex) { /* expected */ } <add> fail("expected CouldNotSendReplyException with InvalidDestinationException"); <add> } catch(ReplyFailureException ex) { <add> assertEquals(InvalidDestinationException.class, ex.getCause().getClass()); <add> } <ide> <ide> verify(responseTextMessage).setJMSCorrelationID(CORRELATION_ID); <ide> verify(delegate).handleMessage(sentTextMessage); <ide> protected Object extractMessage(Message message) { <ide> }; <ide> try { <ide> adapter.onMessage(sentTextMessage, session); <del> fail("expected JMSException"); <del> } catch(JMSException ex) { /* expected */ } <add> fail("expected CouldNotSendReplyException with JMSException"); <add> } catch(ReplyFailureException ex) { <add> assertEquals(JMSException.class, ex.getCause().getClass()); <add> } <ide> <ide> verify(responseTextMessage).setJMSCorrelationID(CORRELATION_ID); <ide> verify(messageProducer).close(); <ide> protected Object extractMessage(Message message) { <ide> adapter.setMessageConverter(null); <ide> try { <ide> adapter.onMessage(sentTextMessage, session); <del> fail("expected MessageConversionException"); <del> } catch(MessageConversionException ex) { /* expected */ } <add> fail("expected CouldNotSendReplyException with MessageConversionException"); <add> } catch(ReplyFailureException ex) { <add> assertEquals(MessageConversionException.class, ex.getCause().getClass()); <add> } <ide> } <ide> <ide> @Test <ide><path>spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapterTests.java <ide> import org.springframework.jms.config.DefaultJmsHandlerMethodFactory; <ide> import org.springframework.jms.support.converter.JmsHeaders; <ide> import org.springframework.messaging.Message; <add>import org.springframework.messaging.converter.MessageConversionException; <ide> import org.springframework.messaging.support.MessageBuilder; <ide> import org.springframework.util.ReflectionUtils; <ide> <ide> public void buildMessageWithStandardMessage() throws JMSException { <ide> <ide> Session session = mock(Session.class); <ide> given(session.createTextMessage("Response")).willReturn(new StubTextMessage("Response")); <del> javax.jms.Message replyMessage = getSimpleInstance().buildMessage(session, result); <add> MessagingMessageListenerAdapter listener = getSimpleInstance("echo", Message.class); <add> javax.jms.Message replyMessage = listener.buildMessage(session, result); <ide> <ide> verify(session).createTextMessage("Response"); <ide> assertNotNull("reply should never be null", replyMessage); <ide> public void buildMessageWithStandardMessage() throws JMSException { <ide> assertEquals("replyTo header not copied", replyTo, replyMessage.getJMSReplyTo()); <ide> } <ide> <del> protected MessagingMessageListenerAdapter getSimpleInstance() { <del> Method m = ReflectionUtils.findMethod(SampleBean.class, "echo", Message.class); <add> @Test <add> public void exceptionInListener() { <add> javax.jms.Message message = new StubTextMessage("foo"); <add> Session session = mock(Session.class); <add> MessagingMessageListenerAdapter listener = getSimpleInstance("fail", String.class); <add> <add> try { <add> listener.onMessage(message, session); <add> fail("Should have thrown an exception"); <add> } <add> catch (JMSException e) { <add> fail("Should not have thrown a JMS exception"); <add> } <add> catch (ListenerExecutionFailedException e) { <add> assertEquals(IllegalArgumentException.class, e.getCause().getClass()); <add> assertEquals("Expected test exception", e.getCause().getMessage()); <add> } <add> } <add> <add> @Test <add> public void exceptionInInvocation() { <add> javax.jms.Message message = new StubTextMessage("foo"); <add> Session session = mock(Session.class); <add> MessagingMessageListenerAdapter listener = getSimpleInstance("wrongParam", Integer.class); <add> <add> try { <add> listener.onMessage(message, session); <add> fail("Should have thrown an exception"); <add> } <add> catch (JMSException e) { <add> fail("Should not have thrown a JMS exception"); <add> } <add> catch (ListenerExecutionFailedException e) { <add> assertEquals(MessageConversionException.class, e.getCause().getClass()); <add> } <add> } <add> <add> protected MessagingMessageListenerAdapter getSimpleInstance(String methodName, Class... parameterTypes) { <add> Method m = ReflectionUtils.findMethod(SampleBean.class, methodName, parameterTypes); <ide> return createInstance(m); <ide> } <ide> <ide> public Message<String> echo(Message<String> input) { <ide> .setHeader(JmsHeaders.TYPE, "reply") <ide> .build(); <ide> } <add> <add> public void fail(String input) { <add> throw new IllegalArgumentException("Expected test exception"); <add> } <add> <add> public void wrongParam(Integer i) { <add> throw new IllegalArgumentException("Should not have been called"); <add> } <ide> } <ide> }
6
Ruby
Ruby
set correct ldflags for universal binaries
2e3585872b0e5856cce6c53b178744bc10a91c0b
<ide><path>Library/Homebrew/extend/ENV.rb <ide> def m32 <ide> def universal_binary <ide> append_to_cflags '-arch i386 -arch x86_64' <ide> ENV.O3 if self['CFLAGS'].include? '-O4' # O4 seems to cause the build to fail <add> ENV.append 'LDFLAGS', '-arch i386 -arch x86_64' <ide> end <ide> <ide> def prepend key, value, separator = ' '
1
Ruby
Ruby
allow brewing without an md5 hash
ec65bb48190aca260280ef4ce90225af3e4d2d13
<ide><path>Library/Homebrew/formula.rb <ide> def brew <ide> tgz=Pathname.new(fetch()).realpath <ide> begin <ide> md5=`md5 -q "#{tgz}"`.strip <del> raise "MD5 mismatch: #{md5}" unless @md5 and md5 == @md5.downcase <add> if @md5 and not @md5.empty? <add> raise "MD5 mismatch: #{md5}" unless md5 == @md5.downcase <add> else <add> ohai "Warning: Formula does not provide an MD5 hash." <add> end <ide> <ide> # we make an additional subdirectory so know exactly what we are <ide> # recursively deleting later
1
PHP
PHP
reset test variable
804c60cd8ad8de8c9ba32baa48ea51db38e3b295
<ide><path>tests/Container/ContainerTest.php <ide> public function testExtendInstancesArePreserved() <ide> <ide> public function testExtendIsLazyInitialized() <ide> { <add> ContainerLazyExtendStub::$initialized = false; <add> <ide> $container = new Container; <ide> $container->bind('ContainerLazyExtendStub'); <ide> $container->extend('ContainerLazyExtendStub', function ($obj, $container) {
1
Python
Python
detect all functions in complex.h
de681b72314d666cb014b2f11358de66a3aaa337
<ide><path>numpy/core/setup_common.py <ide> def check_api_version(apiversion, codegen_dir): <ide> OPTIONAL_VARIABLE_ATTRIBUTES = ["__thread", "__declspec(thread)"] <ide> <ide> # Subset of OPTIONAL_STDFUNCS which may alreay have HAVE_* defined by Python.h <del>OPTIONAL_STDFUNCS_MAYBE = ["expm1", "log1p", "acosh", "atanh", "asinh", "hypot", <del> "copysign", "ftello", "fseeko"] <add>OPTIONAL_STDFUNCS_MAYBE = [ <add> "expm1", "log1p", "acosh", "atanh", "asinh", "hypot", "copysign", <add> "ftello", "fseeko" <add> ] <ide> <ide> # C99 functions: float and long double versions <del>C99_FUNCS = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", <del> "ceil", "rint", "trunc", "sqrt", "log10", "log", "log1p", "exp", <del> "expm1", "asin", "acos", "atan", "asinh", "acosh", "atanh", <del> "hypot", "atan2", "pow", "fmod", "modf", 'frexp', 'ldexp', <del> "exp2", "log2", "copysign", "nextafter", "cbrt"] <del> <add>C99_FUNCS = [ <add> "sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs", "floor", "ceil", <add> "rint", "trunc", "sqrt", "log10", "log", "log1p", "exp", "expm1", <add> "asin", "acos", "atan", "asinh", "acosh", "atanh", "hypot", "atan2", <add> "pow", "fmod", "modf", 'frexp', 'ldexp', "exp2", "log2", "copysign", <add> "nextafter", "cbrt" <add> ] <ide> C99_FUNCS_SINGLE = [f + 'f' for f in C99_FUNCS] <ide> C99_FUNCS_EXTENDED = [f + 'l' for f in C99_FUNCS] <del> <del>C99_COMPLEX_TYPES = ['complex double', 'complex float', 'complex long double'] <del> <del>C99_COMPLEX_FUNCS = ['creal', 'cimag', 'cabs', 'carg', 'cexp', 'csqrt', 'clog', <del> 'ccos', 'csin', 'cpow'] <add>C99_COMPLEX_TYPES = [ <add> 'complex double', 'complex float', 'complex long double' <add> ] <add>C99_COMPLEX_FUNCS = [ <add> "cabs", "cacos", "cacosh", "carg", "casin", "casinh", "catan", <add> "catanh", "ccos", "ccosh", "cexp", "cimag", "clog", "conj", "cpow", <add> "cproj", "creal", "csin", "csinh", "csqrt", "ctan", "ctanh" <add> ] <ide> <ide> def fname2def(name): <ide> return "HAVE_%s" % name.upper()
1
Text
Text
expand the getting started
fd472650c011f6d73ad7570f99a2b793748f6179
<ide><path>README.md <ide> See the differences between version 1.x and 2.x in the wiki article [What's diff <ide> <ide> ## Getting started <ide> <add>### Setting up the dependency <add> <ide> The first step is to include RxJava 2 into your project, for example, as a Gradle compile dependency: <ide> <ide> ```groovy <ide> compile "io.reactivex.rxjava2:rxjava:2.x.y" <ide> ``` <ide> <add>(Please replace `x` and `y` with the latest version numbers: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava2/rxjava/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.reactivex.rxjava2/rxjava) <add>) <add> <add>### Hello World <add> <ide> The second is to write the **Hello World** program: <ide> <ide> ```java <ide> Flowable.just("Hello world") <ide> }); <ide> ``` <ide> <add>### Base classes <add> <ide> RxJava 2 features several base classes you can discover operators on: <ide> <ide> - [`io.reactivex.Flowable`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html): 0..N flows, supporting Reactive-Streams and backpressure <del> - [`io.reactivex.Observable`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html): 0..N flows, no backpressure <del> - [`io.reactivex.Single`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Single.html): a flow of exactly 1 item or an error <del> - [`io.reactivex.Completable`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Completable.html): a flow without items but only a completion or error signal <del> - [`io.reactivex.Maybe`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Maybe.html): a flow with no items, exactly one item or an error <add> - [`io.reactivex.Observable`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Observable.html): 0..N flows, no backpressure, <add> - [`io.reactivex.Single`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Single.html): a flow of exactly 1 item or an error, <add> - [`io.reactivex.Completable`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Completable.html): a flow without items but only a completion or error signal, <add> - [`io.reactivex.Maybe`](http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Maybe.html): a flow with no items, exactly one item or an error. <add> <add>### Some terminology <add> <add>#### Upstream, downstream <add> <add>The dataflows in RxJava consist of a source, zero or more intermediate steps followed by a data consumer or combinator step (where the step is responsible to consume the dataflow by some means): <add> <add>```java <add>source.operator1().operator2().operator3().subscribe(consumer); <add> <add>source.flatMap(value -> source.operator1().operator2().operator3()); <add>``` <add> <add>Here, if we imagine ourselves on `operator2`, looking to the left towards the source, is called the **upstream**. Looking to the right towards the subscriber/consumer, is called the **downstream**. This is often more apparent when each element is written on a separate line: <add> <add>```java <add>source <add> .operator1() <add> .operator2() <add> .operator3() <add> .subscribe(consumer) <add>``` <add> <add>#### Objects in motion <add> <add>In RxJava's documentation, **emission**, **emits**, **item**, **event**, **signal**, **data** and **message** are considered synonyms and represent the object traveling along the dataflow. <add> <add>#### Backpressure <add> <add>When the dataflow runs through asynchronous steps, each step may perform different things with different speed. To avoid overwhelming such steps, which usually would manifest itself as increased memory usage due to temporary buffering or the need for skipping/dropping data, a so-called backpressure is applied, which is a form of flow control where the steps can express how many items are they ready to process. This allows constraining the memory usage of the dataflows in situations where there is generally no way for a step to know how many items the upstream will send to it. <add> <add>In RxJava, the dedicated `Flowable` class is designated to support backpressure and `Observable` is dedicated for the non-backpressured operations (short sequences, GUI interactions, etc.). The other types, `Single`, `Maybe` and `Completable` don't support backpressure nor should they; there is always room to store one item temporarily. <add> <add>#### Assembly time <add> <add>The preparation of dataflows by applying various intermediate operators happens in the so-called **assembly time**: <add> <add>```java <add>Flowable<Integer> flow = Flowable.range(1, 5) <add>.map(v -> v* v) <add>.filter(v -> v % 3 == 0) <add>; <add>``` <add> <add>At this point, the data is not flowing yet and no side-effects are happening. <add> <add>#### Subscription time <add> <add>This is a temporary state when `subscribe()` is called on a flow that establishes the chain of processing steps internally: <add> <add>```java <add>flow.subscribe(System.out::println) <add>```` <add> <add>This is when the **subscription side-effects** are triggered (see `doOnSubscribe`). Some sources block or start emitting items right away in this state. <add> <add>#### Runtime <add> <add>This is the state when the flows are actively emitting items, errors or completion signals: <add> <add>```java <add> <add>Observable.create(emitter -> { <add> while (!emitter.isDisposed()) { <add> long time = System.currentTimeMillis(); <add> emitter.onNext(time); <add> if (time % 2 != 0) { <add> emitter.onError(new IllegalStateException("Odd millisecond!"); <add> break; <add> } <add> } <add>}) <add>.subscribe(System.out::println, Throwable::printStackTrace); <add>``` <add> <add>Practically, this is when the body of the given example above executes. <add> <add>### Simple background computation <ide> <ide> One of the common use cases for RxJava is to run some computation, network request on a background thread and show the results (or error) on the UI thread: <ide> <ide> Thread.sleep(2000); <ide> <ide> Typically, you can move computations or blocking IO to some other thread via `subscribeOn`. Once the data is ready, you can make sure they get processed on the foreground or GUI thread via `observeOn`. <ide> <del>RxJava operators don't work with `Thread`s or `ExecutorService`s directly but with so called `Scheduler`s that abstract away sources of concurrency behind an uniform API. RxJava 2 features several standard schedulers accessible via `Schedulers` utility class. These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXSchedulers.gui()`. <add>### Schedulers <add> <add>RxJava operators don't work with `Thread`s or `ExecutorService`s directly but with so called `Scheduler`s that abstract away sources of concurrency behind an uniform API. RxJava 2 features several standard schedulers accessible via `Schedulers` utility class. <add> <add>- `Schedulers.computation()`: Run computation intensive work on a fixed number of dedicated threads in the background. Most asynchronous operator use this as their default `Scheduler`. <add>- `Schedulers.io()`: Run I/O-like or blocking operations on a dynamically changing set of threads. <add>- `Schedulers.single()`: Run work on a single thread in a sequential and FIFO manner. <add>- `Schedulers.trampoline()`: Run work in a sequential and FIFO manner in one of the participating threads, usually for testing purposes. <add> <add>These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXSchedulers.gui()`. <add> <add>In addition, there is option to wrap an existing `Executor` (and its subtypes such as `ExecutorService`) into a `Scheduler` via `Schedulers.from(Executor)`. This can be used, for example, to have a larger but still fixed pool of threads (unlike `computation()` and `io()` respectively). <ide> <ide> The `Thread.sleep(2000);` at the end is no accident. In RxJava the default `Scheduler`s run on daemon threads, which means once the Java main thread exits, they all get stopped and background computations may never happen. Sleeping for some time in this example situations lets you see the output of the flow on the console with time to spare. <ide> <add>### Concurrency within a flow <add> <ide> Flows in RxJava are sequential in nature split into processing stages that may run **concurrently** with each other: <ide> <ide> ```java <ide> Flowable.range(1, 10) <ide> <ide> This example flow squares the numbers from 1 to 10 on the **computation** `Scheduler` and consumes the results on the "main" thread (more precisely, the caller thread of `blockingSubscribe`). However, the lambda `v -> v * v` doesn't run in parallel for this flow; it receives the values 1 to 10 on the same computation thread one after the other. <ide> <add>### Parallel processing <add> <ide> Processing the numbers 1 to 10 in parallel is a bit more involved: <ide> <ide> ```java <ide> Flowable.range(1, 10) <ide> <ide> Practically, paralellism in RxJava means running independent flows and merging their results back into a single flow. The operator `flatMap` does this by first mapping each number from 1 to 10 into its own individual `Flowable`, runs them and merges the computed squares. <ide> <del>Starting from 2.0.5, there is an *experimental* operator `parallel()` and type `ParallelFlowable` that helps achieve the same parallel processing pattern: <add>Note, however, that `flatMap` doesn't guarantee any order and the end result from the inner flows may end up interleaved. There are alternative operators: <add> <add> - `concatMap` that maps and runs one inner flow at a time and <add> - `concatMapEager` which runs all inner flows "at once" but the output flow will be in the order those inner flows were created. <add> <add>Alternatively, there is a [*beta*](#beta) operator `Flowable.parallel()` and type `ParallelFlowable` that helps achieve the same parallel processing pattern: <ide> <ide> ```java <ide> Flowable.range(1, 10) <ide> Flowable.range(1, 10) <ide> .blockingSubscribe(System.out::println); <ide> ``` <ide> <add>### Dependend sub-flows <add> <ide> `flatMap` is a powerful operator and helps in a lot of situations. For example, given a service that returns a `Flowable`, we'd like to call another service with values emitted by the first service: <ide> <ide> ```java <ide> inventorySource.flatMap(inventoryItem -> <ide> .subscribe(); <ide> ``` <ide> <del>Note, however, that `flatMap` doesn't guarantee any order and the end result from the inner flows may end up interleaved. There are alternative operators: <add>### Continuations <ide> <del> - `concatMap` that maps and runs one inner flow at a time and <del> - `concatMapEager` which runs all inner flows "at once" but the output flow will be in the order those inner flows were created. <add>Sometimes, when an item has become available, one would like to perform some dependent computations on it. This is sometimes called **continuations** and, depending on what should happen and what types are involed, may involve various operators to accomplish. <add> <add>#### Dependent <add> <add>The most typical scenario is to given a value, invoke another service, await and continue with its result: <add> <add>```java <add>service.apiCall() <add>.flatMap(value -> service.anotherApiCall(value)) <add>.flatMap(next -> service.finalCall(next)) <add>``` <add> <add>It is often the case also that later sequences would require values from earlier mappings. This can be achieved by moving the outer `flatMap` into the inner parts of the previous `flatMap` for example: <add> <add>```java <add>service.apiCall() <add>.flatMap(value -> <add> service.anotherApiCall(value) <add> .flatMap(next -> service.finalCallBoth(value, next)) <add>) <add>``` <add> <add>Here, the original `value` will be available inside the inner `flatMap`, courtesy of lambda variable capture. <add> <add>#### Non-dependent <add> <add>In other scenarios, the result(s) of the first source/dataflow is irrelevant and one would like to continue with a quasi independent another source. Here, `flatMap` works as well: <add> <add>```java <add>Observable continued = sourceObservable.flatMapSingle(ignored -> someSingleSource) <add>continued.map(v -> v.toString()) <add> .subscribe(System.out::println, Throwable::printStackTrace); <add>``` <add> <add>however, the continuation in this case stays `Observable` instead of the likely more appropriate `Single`. (This is understandable because <add>from the perspective of `flatMapSingle`, `sourceObservable` is a multi-valued source and thus the mapping may result in multiple values as well). <add> <add>Often though there is a way that is somewhat more expressive (and also lower overhead) by using `Completable` as the mediator and its operator `andThen` to resume with something else: <add> <add>```java <add>sourceObservable <add> .ignoreElements() // returns Completable <add> .andThen(someSingleSource) <add> .map(v -> v.toString()) <add>``` <add> <add>The only dependency between the `sourceObservable` and the `someSingleSource` is that the former should complete normally in order for the latter to be consumed. <add> <add>#### Deferred-dependent <add> <add>Sometimes, there is an implicit data dependency between the previous sequence and the new sequence that, for some reason, was not flowing through the "regular channels". One would be inclined to write such continuations as follows: <add> <add>```java <add>AtomicInteger count = new AtomicInteger(); <add> <add>Observable.range(1, 10) <add> .doOnNext(ingored -> count.incrementAndGet()) <add> .ignoreElements() <add> .andThen(Single.just(count.get())) <add> .subscribe(System.out::println); <add>``` <add> <add>Unfortunately, this prints `0` because `Single.just(count.get())` is evaluated at **assembly time** when the dataflow hasn't even run yet. We need something that defers the evaluation of this `Single` source until **runtime** when the main source completes: <add> <add>```java <add>AtomicInteger count = new AtomicInteger(); <add> <add>Observable.range(1, 10) <add> .doOnNext(ingored -> count.incrementAndGet()) <add> .ignoreElements() <add> .andThen(Single.defer(() -> Single.just(count.get()))) <add> .subscribe(System.out::println); <add>``` <add> <add>or <add> <add>```java <add>AtomicInteger count = new AtomicInteger(); <add> <add>Observable.range(1, 10) <add> .doOnNext(ingored -> count.incrementAndGet()) <add> .ignoreElements() <add> .andThen(Single.fromCallable(() -> count.get())) <add> .subscribe(System.out::println); <add>``` <add> <add> <add>### Type conversions <add> <add>Sometimes, a source or service returns a different type than the flow that is supposed to work with it. For example, in the inventory example above, `getDemandAsync` could return a `Single<DemandRecord>`. If the code example is left unchanged, this will result in a compile time error (however, often with misleading error message about lack of overload). <add> <add>In such situations, there are usually two options to fix the transformation: 1) convert to the desired type or 2) find and use an overload of the specific operator supporting the different type. <add> <add>#### Converting to the desired type <add> <add>Each reactive base class features operators that can perform such conversions, including the protocol conversions, to match some other type. The following matrix shows the available conversion options: <add> <add>| | Flowable | Observable | Single | Maybe | Completable | <add>|----------|----------|------------|--------|-------|-------------| <add>|**Flowable** | | `toObservable` | `first`, `firstOrError`, `single`, `singleOrError`, `last`, `lastOrError`<sup>1</sup> | `firstElement`, `singleElement`, `lastElement` | `ignoreElements` | <add>|**Observable**| `toFlowable`<sup>2</sup> | | `first`, `firstOrError`, `single`, `singleOrError`, `last`, `lastOrError`<sup>1</sup> | `firstElement`, `singleElement`, `lastElement` | `ignoreElements` | <add>|**Single** | `toFlowable`<sup>3</sup> | `toObservable` | | `toMaybe` | `toCompletable` | <add>|**Maybe** | `toFlowable`<sup>3</sup> | `toObservable` | `toSingle` | | `ignoreElement` | <add>|**Completable** | `toFlowable` | `toObservable` | `toSingle` | `toMaybe` | | <add> <add><sup>1</sup>: When turning a multi-valued source into a single valued source, one should decide which of the many source values should be considered as the result. <add> <add><sup>2</sup>: Turning an `Observable` into `Flowable` requires an additional decision: what to do with the potential unconstrained flow <add>of the source `Observable`? There are several strategies available (such as buffering, dropping, keeping the latest) via the `BackpressureStrategy` parameter or via standard `Flowable` operators such as `onBackpressureBuffer`, `onBackpressureDrop`, `onBackpressureLatest` which also <add>allow further customization of the backpressure behavior. <add> <add><sup>3</sup>: When there is only (at most) one source item, there is no problem with backpressure as it can be always stored until the downstream is ready to consume. <add> <add> <add>#### Using an overload with the desired type <add> <add>Many frequently used operator has overloads that can deal with the other types. These are usually named with the suffix of the target type: <add> <add>| Operator | Overloads | <add>| `flatMap` | `flatMapSingle`, `flatMapMaybe`, `flatMapCompletable`, `flatMapIterable` | <add>| `concatMap` | `concatMapSingle`, `concatMapMaybe`, `concatMapCompletable`, `concatMapIterable` | <add>| `switchMap` | `switchMapSingle`, `switchMapMaybe`, `switchMapCompletable`, `switchMapIterable` | <add> <add>The reason these operators have a suffix instead of simply having the same name with different signature is type erasure. Java doesn't consider signatures such as `operator(Function<T, Single<R>>)` and `operator(Function<T, Maybe<R>>)` different (unlike C#) and due to erasure, the two `operator`s would end up as duplicate methods with the same signature. <add> <add>### Operator naming conventions <add> <add>Naming in programming is one of the hardest things as names are expected to be not long, expressive, capturing and easily memorable. Unfortunately, the target language (and pre-existing conventions) may not give too much help in this regard (unusable keywords, type erasure, type ambiguities, etc.). <add> <add>#### Unusable keywords <add> <add>In the original Rx.NET, the operator that emits a single item and then completes is called `Return(T)`. Since the Java convention is to have a lowercase letter start a method name, this would have been `return(T)` which is a keyword in Java and thus not available. Therefore, RxJava chose to name this operator `just(T)`. The same limitation exists for the operator `Switch`, which had to be named `switchOnNext`. Yet another example is `Catch` which was named `onErrorResumeNext`. <add> <add>#### Type erasure <add> <add>Many operators that expect the user to provide some function returning a reactive type can't be overloaded because the type erasure around a `Function<T, X>` turns such method signatures into duplicates. RxJava chose to name such operators by appending the type as suffix as well: <add> <add>```java <add>Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper) <add> <add>Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSource<? extends R>> mapper) <add>``` <add> <add>#### Type ambiguities <add> <add>Even though certain operators have no problems from type erasure, their signature may turn up being ambiguous, especially if one uses Java 8 and lambdas. For example, there are several overloads of `concatWith` taking the various other reactive base types as arguments (for providing convenience and performance benefits in the underlying implementation): <add> <add>```java <add>Flowable<T> concatWith(Publisher<? extends T> other); <add> <add>Flowable<T> concatWith(SingleSource<? extends T> other); <add>``` <add> <add>Both `Publisher` and `SingleSource` appear as functional interfaces (types with one abstract method) and may encourage users to try to provide a lambda expression: <add> <add>```java <add>someSource.concatWith(s -> Single.just(2)) <add>.subscribe(System.out::println, Throwable::printStackTrace); <add>``` <add> <add>Unfortunately, this approach doesn't work and the example does not print `2` at all. In fact, since version 2.1.10, it doesn't <add>even compile because at least 4 `concatWith` overloads exist and the compiler finds the code above ambiguous. <add> <add>The user in such situations probably wanted to defer some computation until the `sameSource` has completed, thus the correct <add>unambiguous operator should have been `defer`: <add> <add>```java <add>someSource.concatWith(Single.defer(() -> Single.just(2))) <add>.subscribe(System.out::println, Throwable::printStackTrace); <add>``` <add> <add>Sometimes, a suffix is added to avoid logical ambiguities that may compile but produce the wrong type in a flow: <add> <add>```java <add>Flowable<T> merge(Publisher<? extends Publisher<? extends T>> sources); <add> <add>Flowable<T> mergeArray(Publisher<? extends T>... sources); <add>``` <add> <add>This can get also ambiguous when functional interface types get involved as the type argument `T`. <add> <add>#### Error handling <add> <add>Dataflows can fail, at which point the error is emitted to the consumer(s). Sometimes though, multiple sources may fail at which point there is a choice wether or not wait for all of them to complete or fail. To indicate this opportunity, many operator names are suffixed with the `DelayError` words (while others feature a `delayError` or `delayErrors` boolean flag in one of their overloads): <add> <add>```java <add>Flowable<T> concat(Publisher<? extends Publisher<? extends T>> sources); <add> <add>Flowable<T> concatDelayError(Publisher<? extends Publisher<? extends T>> sources); <add>``` <add> <add>Of course, suffixes of various kinds may appear together: <add> <add>```java <add>Flowable<T> concatArrayEagerDelayError(Publisher<? extends T>... sources); <add>``` <add> <add>#### Base class vs base type <add> <add>The base classes can be considered heavy due to the sheer number of static and instance methods on them. RxJava 2's design was heavily influenced by the [Reactive Streams](https://github.com/reactive-streams/reactive-streams-jvm#reactive-streams) specification, therefore, the library features a class and an interface per each reactive type: <add> <add>| Type | Class | Interface | Consumer | <add>|------|-------|-----------|----------| <add>| 0..N backpressured | `Flowable` | `Publisher`<sup>1</sup> | `Subscriber` | <add>| 0..N unbounded | `Observable` | `ObservableSource`<sup>2</sup> | `Observer` | <add>| 1 element or error | `Single` | `SingleSource` | `SingleObserver` | <add>| 0..1 element or error | `Maybe` | `MaybeSource` | `MaybeObserver` | <add>| 0 element or error | `Completable` | `CompletableSource` | `CompletableObserver` | <add> <add><sup>1</sup>The `org.reactivestreams.Publisher` is part of the external Reactive Streams library. It is the main type to interact with other reactive libraries through a standardized mechanism governed by the [Reactive Streams specification](https://github.com/reactive-streams/reactive-streams-jvm#specification). <add> <add><sup>2</sup>The naming convention of the interface was to append `Source` to the semi-traditional class name. There is no `FlowableSource` since `Publisher` is provided by the Reactive Streams library (and subtyping it wouldn't have helped with interoperation either). These interfaces are, however, not standard in the sense of the Reactive Streams specification and are currently RxJava specific only. <add> <add>### Further reading <ide> <ide> For further details, consult the [wiki](https://github.com/ReactiveX/RxJava/wiki). <ide>
1
Python
Python
refactor the network plugin
9c6c41a4a2b3c6536b7ee162aef2f7c9a3018550
<ide><path>glances/outputs/glances_curses.py <ide> def __init__(self, args=None): <ide> <ide> # Init args <ide> self.args = args <add> # By default, display bitrate instead of cumulative in the network plugin <add> self.args.network_stats_cumulative = False <ide> <ide> # Init windows positions <ide> self.term_w = 80 <ide> def __catchKey(self): <ide> self.network_stats_combined = not self.network_stats_combined <ide> elif self.pressedkey == ord('u'): <ide> # 'u' > View cumulative network IO <del> self.network_stats_cumulative = not self.network_stats_cumulative <add> self.args.network_stats_cumulative = not self.args.network_stats_cumulative <ide> elif self.pressedkey == ord('w'): <ide> # 'w' > Delete finished warning logs <ide> glances_logs.clean() <ide><path>glances/plugins/glances_load.py <ide> # <ide> # You should have received a copy of the GNU Lesser General Public License <ide> # along with this program. If not, see <http://www.gnu.org/licenses/>. <add>""" <add>Glances load plugin <add>""" <ide> <ide> # Import system libs <ide> from os import getloadavg <ide><path>glances/plugins/glances_mem.py <ide> # <ide> # You should have received a copy of the GNU Lesser General Public License <ide> # along with this program. If not, see <http://www.gnu.org/licenses/>. <add>""" <add>Glances virtual memory plugin <add>""" <ide> <ide> # Import system libs <ide> # Check for PSUtil already done in the glances_core script <ide><path>glances/plugins/glances_memswap.py <ide> # <ide> # You should have received a copy of the GNU Lesser General Public License <ide> # along with this program. If not, see <http://www.gnu.org/licenses/>. <add>""" <add>Glances swap memory plugin <add>""" <ide> <ide> # Import system libs <ide> # Check for PSUtil already done in the glances_core script <ide><path>glances/plugins/glances_network.py <ide> # <ide> # You should have received a copy of the GNU Lesser General Public License <ide> # along with this program. If not, see <http://www.gnu.org/licenses/>. <add>""" <add>Glances Network interface plugin <add>""" <ide> <ide> # Import system libs <del>try: <del> # psutil >= 1.0.0 <del> from psutil import net_io_counters <del>except: <del> # psutil < 1.0.0 <del> try: <del> from psutil import network_io_counters <del> except: <del> pass <add>from psutil import net_io_counters <ide> <ide> # Import Glances lib <del>from glances_plugin import GlancesPlugin <add>from glances.plugins.glances_plugin import GlancesPlugin <ide> from glances.core.glances_timer import getTimeSinceLastUpdate <ide> <ide> <ide> def __init__(self): <ide> # Enter -1 to diplay bottom <ide> self.line_curse = 2 <ide> <add> # Init stats <add> self.network_old = [] <add> <add> <ide> def update(self): <ide> """ <ide> Update network stats <add> Stats is a list of dict (one dict per interface) <ide> """ <del> network = [] <ide> <del> # psutil >= 1.0.0 <del> try: <del> get_net_io_counters = net_io_counters(pernic=True) <del> except IOError: <del> # psutil < 1.0.0 <del> try: <del> get_net_io_counters = network_io_counters(pernic=True) <del> except IOError: <del> pass <del> <del> # By storing time data we enable Rx/s and Tx/s calculations in the <del> # XML/RPC API, which would otherwise be overly difficult work <del> # for users of the API <del> time_since_update = getTimeSinceLastUpdate('net') <add> # Grab network interface stat using the PsUtil net_io_counter method <add> netiocounters = net_io_counters(pernic=True) <ide> <ide> # Previous network interface stats are stored in the network_old variable <del> if not hasattr(self, 'network_old'): <add> network = [] <add> if (self.network_old == []): <ide> # First call, we init the network_old var <ide> try: <del> self.network_old = get_net_io_counters <add> self.network_old = netiocounters <ide> except (IOError, UnboundLocalError): <ide> pass <ide> else: <del> network_new = get_net_io_counters <add> # By storing time data we enable Rx/s and Tx/s calculations in the <add> # XML/RPC API, which would otherwise be overly difficult work <add> # for users of the API <add> time_since_update = getTimeSinceLastUpdate('net') <add> <add> # Loop over interfaces <add> network_new = netiocounters <ide> for net in network_new: <ide> try: <ide> # Try necessary to manage dynamic network interface <ide> def update(self): <ide> netstat['cumulative_cx'] = (netstat['cumulative_rx'] + <ide> netstat['cumulative_tx']) <ide> netstat['cx'] = netstat['rx'] + netstat['tx'] <del> except Exception: <add> except KeyError: <ide> continue <ide> else: <ide> network.append(netstat) <ide> self.network_old = network_new <ide> <ide> self.stats = network <ide> <add> return self.stats <add> <ide> def msg_curse(self, args=None): <ide> """ <ide> Return the dict to display in the curse interface <ide> """ <add> <add> #!!! TODO: Add alert on network interface bitrate <add> #!!! TODO: Manage the hide tag to hide a list of net interface <add> <ide> # Init the return message <ide> ret = [] <ide> <ide> # Build the string message <ide> # Header <ide> msg = "{0:8}".format(_("NETWORK")) <ide> ret.append(self.curse_add_line(msg, "TITLE")) <del> msg = " {0:>6}".format(_("Rx/s")) <del> ret.append(self.curse_add_line(msg)) <del> msg = " {0:>6}".format(_("Tx/s")) <del> ret.append(self.curse_add_line(msg)) <add> if (args.network_stats_cumulative): <add> # Cumulative stats <add> msg = " {0:>6}".format(_("Rx")) <add> ret.append(self.curse_add_line(msg)) <add> msg = " {0:>6}".format(_("Tx")) <add> ret.append(self.curse_add_line(msg)) <add> else: <add> # Bitrate stats <add> msg = " {0:>6}".format(_("Rx/s")) <add> ret.append(self.curse_add_line(msg)) <add> msg = " {0:>6}".format(_("Tx/s")) <add> ret.append(self.curse_add_line(msg)) <ide> # Interface list (sorted by name) <ide> for i in sorted(self.stats, key=lambda network: network['interface_name']): <ide> # Format stats <ide> ifname = i['interface_name'].split(':')[0] <ide> if (args.byte): <del> rxps = self.auto_unit(int(i['rx'] // i['time_since_update'])) <del> txps = self.auto_unit(int(i['tx'] // i['time_since_update'])) <add> if (args.network_stats_cumulative): <add> rxps = self.auto_unit(int(i['cumulative_rx'])) <add> txps = self.auto_unit(int(i['cumulative_tx'])) <add> else: <add> rxps = self.auto_unit(int(i['rx'] // i['time_since_update'])) <add> txps = self.auto_unit(int(i['tx'] // i['time_since_update'])) <ide> else: <del> rxps = self.auto_unit(int(i['rx'] // i['time_since_update'] * 8)) + "b" <del> txps = self.auto_unit(int(i['tx'] // i['time_since_update'] * 8)) + "b" <del> # !!! TODO: manage the hide tag <add> if (args.network_stats_cumulative): <add> rxps = self.auto_unit(int(i['cumulative_rx'] * 8)) + "b" <add> txps = self.auto_unit(int(i['cumulative_tx'] * 8)) + "b" <add> else: <add> rxps = self.auto_unit(int(i['rx'] // i['time_since_update'] * 8)) + "b" <add> txps = self.auto_unit(int(i['tx'] // i['time_since_update'] * 8)) + "b" <ide> # New line <ide> ret.append(self.curse_new_line()) <ide> msg = "{0:8}".format(ifname)
5
Javascript
Javascript
fix error in watch mode
027967903e1f7014be1dbb4e7ff969f0840edd52
<ide><path>lib/AsyncDependenciesBlock.js <ide> AsyncDependenciesBlock.prototype.updateHash = function updateHash(hash) { <ide> }; <ide> <ide> AsyncDependenciesBlock.prototype.disconnect = function() { <del> this.chunk = null; <add> this.chunks = null; <ide> DependenciesBlock.prototype.disconnect.call(this); <del>}; <ide>\ No newline at end of file <add>};
1
Javascript
Javascript
make all methods on template static
16ee68b5f941f44711c9b2a10e75bce6f5a2fd8a
<ide><path>lib/ChunkTemplate.js <ide> <ide> const ConcatSource = require("webpack-sources").ConcatSource; <ide> const Template = require("./Template"); <add>const Tapable = require("tapable").Tapable; <ide> const SyncWaterfallHook = require("tapable").SyncWaterfallHook; <ide> const SyncHook = require("tapable").SyncHook; <ide> <del>module.exports = class ChunkTemplate extends Template { <add>module.exports = class ChunkTemplate extends Tapable { <ide> constructor(outputOptions) { <del> super(outputOptions); <add> super(); <add> this.outputOptions = outputOptions || {}; <ide> this.hooks = { <ide> modules: new SyncWaterfallHook(["source", "chunk", "moduleTemplate", "dependencyTemplates"]), <ide> render: new SyncWaterfallHook(["source", "chunk", "moduleTemplate", "dependencyTemplates"]), <ide> module.exports = class ChunkTemplate extends Template { <ide> } <ide> <ide> renderJavascript(chunk, moduleTemplate, dependencyTemplates) { <del> const moduleSources = this.renderChunkModules(chunk, m => true, moduleTemplate, dependencyTemplates); <add> const moduleSources = Template.renderChunkModules(chunk, m => true, moduleTemplate, dependencyTemplates); <ide> const core = this.hooks.modules.call(moduleSources, chunk, moduleTemplate, dependencyTemplates); <ide> let source = this.hooks.render.call(core, chunk, moduleTemplate, dependencyTemplates); <ide> if(chunk.hasEntryModule()) { <ide><path>lib/ExtendedAPIPlugin.js <ide> */ <ide> "use strict"; <ide> <add>const Template = require("./Template"); <ide> const ConstDependency = require("./dependencies/ConstDependency"); <ide> const ParserHelpers = require("./ParserHelpers"); <ide> const NullFactory = require("./NullFactory"); <ide> class ExtendedAPIPlugin { <ide> buf.push(""); <ide> buf.push("// __webpack_chunkname__"); <ide> buf.push(`${mainTemplate.requireFn}.cn = ${JSON.stringify(chunk.name)};`); <del> return mainTemplate.asString(buf); <add> return Template.asString(buf); <ide> }); <ide> mainTemplate.plugin("global-hash", () => true); <ide> <ide><path>lib/HotModuleReplacementPlugin.js <ide> module.exports = class HotModuleReplacementPlugin { <ide> buf.push(""); <ide> buf.push("// __webpack_hash__"); <ide> buf.push(mainTemplate.requireFn + ".h = function() { return hotCurrentHash; };"); <del> return mainTemplate.asString(buf); <add> return Template.asString(buf); <ide> }); <ide> <ide> mainTemplate.plugin("bootstrap", (source, chunk, hash) => { <ide> source = mainTemplate.hooks.hotBootstrap.call(source, chunk, hash); <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> hotInitCode <ide> module.exports = class HotModuleReplacementPlugin { <ide> }); <ide> <ide> mainTemplate.plugin("module-obj", (source, chunk, hash, varModuleId) => { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> `${source},`, <ide> `hot: hotCreateModule(${varModuleId}),`, <ide> "parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),", <ide><path>lib/HotUpdateChunkTemplate.js <ide> <ide> const Template = require("./Template"); <ide> const Chunk = require("./Chunk"); <add>const Tapable = require("tapable").Tapable; <ide> const SyncWaterfallHook = require("tapable").SyncWaterfallHook; <ide> const SyncHook = require("tapable").SyncHook; <ide> <del>module.exports = class HotUpdateChunkTemplate extends Template { <add>module.exports = class HotUpdateChunkTemplate extends Tapable { <ide> constructor(outputOptions) { <del> super(outputOptions); <add> super(); <add> this.outputOptions = outputOptions || {}; <ide> this.hooks = { <ide> modules: new SyncWaterfallHook(["source", "modules", "removedModules", "moduleTemplate", "dependencyTemplates"]), <ide> render: new SyncWaterfallHook(["source", "modules", "removedModules", "hash", "id", "moduleTemplate", "dependencyTemplates"]), <ide> module.exports = class HotUpdateChunkTemplate extends Template { <ide> hotUpdateChunk.id = id; <ide> hotUpdateChunk.setModules(modules); <ide> hotUpdateChunk.removedModules = removedModules; <del> const modulesSource = this.renderChunkModules(hotUpdateChunk, () => true, moduleTemplate, dependencyTemplates); <add> const modulesSource = Template.renderChunkModules(hotUpdateChunk, () => true, moduleTemplate, dependencyTemplates); <ide> const core = this.hooks.modules.call(modulesSource, modules, removedModules, moduleTemplate, dependencyTemplates); <ide> const source = this.hooks.render.call(core, modules, removedModules, hash, id, moduleTemplate, dependencyTemplates); <ide> return source; <ide><path>lib/MainTemplate.js <ide> const ConcatSource = require("webpack-sources").ConcatSource; <ide> const OriginalSource = require("webpack-sources").OriginalSource; <ide> const PrefixSource = require("webpack-sources").PrefixSource; <ide> const Template = require("./Template"); <add>const Tapable = require("tapable").Tapable; <ide> const SyncWaterfallHook = require("tapable").SyncWaterfallHook; <ide> const SyncHook = require("tapable").SyncHook; <ide> const SyncBailHook = require("tapable").SyncBailHook; <ide> const SyncBailHook = require("tapable").SyncBailHook; <ide> // __webpack_require__.oe = the uncatched error handler for the webpack runtime <ide> // __webpack_require__.nc = the script nonce <ide> <del>module.exports = class MainTemplate extends Template { <add>module.exports = class MainTemplate extends Tapable { <ide> constructor(outputOptions) { <del> super(outputOptions); <add> super(); <add> this.outputOptions = outputOptions || {}; <ide> this.hooks = { <ide> modules: new SyncWaterfallHook(["modules", "chunk", "hash", "moduleTemplate", "dependencyTemplates"]), <ide> moduleObj: new SyncWaterfallHook(["source", "chunk", "hash", "moduleIdExpression"]), <ide> module.exports = class MainTemplate extends Template { <ide> buf.push("// Load entry module and return exports"); <ide> buf.push(`return ${this.renderRequireFunctionForModule(hash, chunk, JSON.stringify(chunk.entryModule.id))}(${this.requireFn}.s = ${JSON.stringify(chunk.entryModule.id)});`); <ide> } <del> return this.asString(buf); <add> return Template.asString(buf); <ide> }); <ide> this.plugin("render", (bootstrapSource, chunk, hash, moduleTemplate, dependencyTemplates) => { <ide> const source = new ConcatSource(); <ide> module.exports = class MainTemplate extends Template { <ide> source.add("/******/ })\n"); <ide> source.add("/************************************************************************/\n"); <ide> source.add("/******/ ("); <del> const modules = this.renderChunkModules(chunk, () => true, moduleTemplate, dependencyTemplates, "/******/ "); <add> const modules = Template.renderChunkModules(chunk, () => true, moduleTemplate, dependencyTemplates, "/******/ "); <ide> source.add(this.hooks.modules.call(modules, chunk, hash, moduleTemplate, dependencyTemplates)); <ide> source.add(")"); <ide> return source; <ide> }); <ide> this.plugin("local-vars", (source, chunk, hash) => { <del> return this.asString([ <add> return Template.asString([ <ide> source, <ide> "// The module cache", <ide> "var installedModules = {};" <ide> ]); <ide> }); <ide> this.plugin("require", (source, chunk, hash) => { <del> return this.asString([ <add> return Template.asString([ <ide> source, <ide> "// Check if module is in cache", <ide> "if(installedModules[moduleId]) {", <del> this.indent("return installedModules[moduleId].exports;"), <add> Template.indent("return installedModules[moduleId].exports;"), <ide> "}", <ide> "// Create a new module (and put it into the cache)", <ide> "var module = installedModules[moduleId] = {", <del> this.indent(this.hooks.moduleObj.call("", chunk, hash, "moduleId")), <add> Template.indent(this.hooks.moduleObj.call("", chunk, hash, "moduleId")), <ide> "};", <ide> "", <del> this.asString(outputOptions.strictModuleExceptionHandling ? [ <add> Template.asString(outputOptions.strictModuleExceptionHandling ? [ <ide> "// Execute the module function", <ide> "var threw = true;", <ide> "try {", <del> this.indent([ <add> Template.indent([ <ide> `modules[moduleId].call(module.exports, module, module.exports, ${this.renderRequireFunctionForModule(hash, chunk, "moduleId")});`, <ide> "threw = false;" <ide> ]), <ide> "} finally {", <del> this.indent([ <add> Template.indent([ <ide> "if(threw) delete installedModules[moduleId];" <ide> ]), <ide> "}" <ide> module.exports = class MainTemplate extends Template { <ide> ]); <ide> }); <ide> this.plugin("module-obj", (source, chunk, hash, varModuleId) => { <del> return this.asString([ <add> return Template.asString([ <ide> "i: moduleId,", <ide> "l: false,", <ide> "exports: {}" <ide> module.exports = class MainTemplate extends Template { <ide> buf.push("// This file contains only the entry chunk."); <ide> buf.push("// The chunk loading function for additional chunks"); <ide> buf.push(`${this.requireFn}.e = function requireEnsure(chunkId) {`); <del> buf.push(this.indent("var promises = [];")); <del> buf.push(this.indent(this.hooks.requireEnsure.call("", chunk, hash, "chunkId"))); <del> buf.push(this.indent("return Promise.all(promises);")); <add> buf.push(Template.indent("var promises = [];")); <add> buf.push(Template.indent(this.hooks.requireEnsure.call("", chunk, hash, "chunkId"))); <add> buf.push(Template.indent("return Promise.all(promises);")); <ide> buf.push("};"); <ide> } <ide> buf.push(""); <ide> module.exports = class MainTemplate extends Template { <ide> buf.push(""); <ide> buf.push("// define getter function for harmony exports"); <ide> buf.push(`${this.requireFn}.d = function(exports, name, getter) {`); <del> buf.push(this.indent([ <add> buf.push(Template.indent([ <ide> `if(!${this.requireFn}.o(exports, name)) {`, <del> this.indent([ <add> Template.indent([ <ide> "Object.defineProperty(exports, name, {", <del> this.indent([ <add> Template.indent([ <ide> "configurable: false,", <ide> "enumerable: true,", <ide> "get: getter" <ide> module.exports = class MainTemplate extends Template { <ide> buf.push(""); <ide> buf.push("// define __esModule on exports"); <ide> buf.push(`${this.requireFn}.r = function(exports) {`); <del> buf.push(this.indent([ <add> buf.push(Template.indent([ <ide> "Object.defineProperty(exports, '__esModule', { value: true });" <ide> ])); <ide> buf.push("};"); <ide> <ide> buf.push(""); <ide> buf.push("// getDefaultExport function for compatibility with non-harmony modules"); <ide> buf.push(this.requireFn + ".n = function(module) {"); <del> buf.push(this.indent([ <add> buf.push(Template.indent([ <ide> "var getter = module && module.__esModule ?", <del> this.indent([ <add> Template.indent([ <ide> "function getDefault() { return module['default']; } :", <ide> "function getModuleExports() { return module; };" <ide> ]), <ide> module.exports = class MainTemplate extends Template { <ide> buf.push(""); <ide> buf.push("// __webpack_public_path__"); <ide> buf.push(`${this.requireFn}.p = ${JSON.stringify(publicPath)};`); <del> return this.asString(buf); <add> return Template.asString(buf); <ide> }); <ide> <ide> this.requireFn = "__webpack_require__"; <ide> module.exports = class MainTemplate extends Template { <ide> buf.push(""); <ide> buf.push("// The require function"); <ide> buf.push(`function ${this.requireFn}(moduleId) {`); <del> buf.push(this.indent(this.hooks.require.call("", chunk, hash))); <add> buf.push(Template.indent(this.hooks.require.call("", chunk, hash))); <ide> buf.push("}"); <ide> buf.push(""); <del> buf.push(this.asString(this.hooks.requireExtensions.call("", chunk, hash))); <add> buf.push(Template.asString(this.hooks.requireExtensions.call("", chunk, hash))); <ide> buf.push(""); <del> buf.push(this.asString(this.hooks.startup.call("", chunk, hash))); <del> let source = this.hooks.render.call(new OriginalSource(this.prefix(buf, " \t") + "\n", `webpack/bootstrap ${hash}`), chunk, hash, moduleTemplate, dependencyTemplates); <add> buf.push(Template.asString(this.hooks.startup.call("", chunk, hash))); <add> let source = this.hooks.render.call(new OriginalSource(Template.prefix(buf, " \t") + "\n", `webpack/bootstrap ${hash}`), chunk, hash, moduleTemplate, dependencyTemplates); <ide> if(chunk.hasEntryModule()) { <ide> source = this.hooks.renderWithEntry.call(source, chunk, hash); <ide> } <ide><path>lib/ModuleTemplate.js <ide> */ <ide> "use strict"; <ide> <del>const Template = require("./Template"); <add>const Tapable = require("tapable").Tapable; <ide> const SyncWaterfallHook = require("tapable").SyncWaterfallHook; <ide> const SyncHook = require("tapable").SyncHook; <ide> <del>module.exports = class ModuleTemplate extends Template { <add>module.exports = class ModuleTemplate extends Tapable { <ide> constructor(outputOptions, requestShortener) { <del> super(outputOptions); <add> super(); <add> this.outputOptions = outputOptions || {}; <ide> this.requestShortener = requestShortener; <ide> this.hooks = { <ide> content: new SyncWaterfallHook(["source", "module", "options", "dependencyTemplates"]), <ide><path>lib/Template.js <ide> */ <ide> "use strict"; <ide> <del>const Tapable = require("tapable").Tapable; <ide> const ConcatSource = require("webpack-sources").ConcatSource; <ide> <ide> const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0); <ide> const moduleIdIsNumber = module => { <ide> return typeof module.id === "number"; <ide> }; <ide> <del>module.exports = class Template extends Tapable { <del> constructor(outputOptions) { <del> super(); <del> this.outputOptions = outputOptions || {}; <del> } <del> <add>module.exports = class Template { <ide> static getFunctionContent(fn) { <ide> return fn.toString().replace(FUNCTION_CONTENT_REGEX, "").replace(INDENT_MULTILINE_REGEX, "").replace(LINE_SEPARATOR_REGEX, "\n"); <ide> } <ide> module.exports = class Template extends Tapable { <ide> return Template.numberToIdentifer(n % (2 * DELTA_A_TO_Z)) + Template.numberToIdentifer(Math.floor(n / (2 * DELTA_A_TO_Z))); <ide> } <ide> <del> indent(str) { <add> static indent(str) { <ide> if(Array.isArray(str)) { <del> return str.map(this.indent.bind(this)).join("\n"); <add> return str.map(Template.indent).join("\n"); <ide> } else { <ide> str = str.trimRight(); <ide> if(!str) return ""; <ide> module.exports = class Template extends Tapable { <ide> } <ide> } <ide> <del> prefix(str, prefix) { <add> static prefix(str, prefix) { <ide> if(Array.isArray(str)) { <ide> str = str.join("\n"); <ide> } <ide> module.exports = class Template extends Tapable { <ide> return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); <ide> } <ide> <del> asString(str) { <add> static asString(str) { <ide> if(Array.isArray(str)) { <ide> return str.join("\n"); <ide> } <ide> return str; <ide> } <ide> <del> getModulesArrayBounds(modules) { <add> static getModulesArrayBounds(modules) { <ide> if(!modules.every(moduleIdIsNumber)) <ide> return false; <ide> var maxId = -Infinity; <ide> module.exports = class Template extends Tapable { <ide> return arrayOverhead < objectOverhead ? [minId, maxId] : false; <ide> } <ide> <del> renderChunkModules(chunk, filterFn, moduleTemplate, dependencyTemplates, prefix) { <add> static renderChunkModules(chunk, filterFn, moduleTemplate, dependencyTemplates, prefix) { <ide> if(!prefix) prefix = ""; <ide> var source = new ConcatSource(); <ide> const modules = chunk.getModules().filter(filterFn); <ide> module.exports = class Template extends Tapable { <ide> }); <ide> }); <ide> } <del> var bounds = this.getModulesArrayBounds(allModules); <add> var bounds = Template.getModulesArrayBounds(allModules); <ide> <ide> if(bounds) { <ide> // Render a spare array <ide><path>lib/node/NodeMainTemplatePlugin.js <ide> module.exports = class NodeMainTemplatePlugin { <ide> const asyncChunkLoading = this.asyncChunkLoading; <ide> mainTemplate.plugin("local-vars", (source, chunk) => { <ide> if(chunk.getNumberOfChunks() > 0) { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object to store loaded chunks", <ide> "// \"0\" means \"already loaded\"", <ide> "var installedChunks = {", <del> mainTemplate.indent(chunk.ids.map((id) => `${id}: 0`).join(",\n")), <add> Template.indent(chunk.ids.map((id) => `${id}: 0`).join(",\n")), <ide> "};" <ide> ]); <ide> } <ide> return source; <ide> }); <ide> mainTemplate.plugin("require-extensions", (source, chunk) => { <ide> if(chunk.getNumberOfChunks() > 0) { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// uncatched error handler for webpack runtime", <ide> `${mainTemplate.requireFn}.oe = function(err) {`, <del> mainTemplate.indent([ <add> Template.indent([ <ide> "process.nextTick(function() {", <del> mainTemplate.indent("throw err; // catch this error by using System.import().catch()"), <add> Template.indent("throw err; // catch this error by using System.import().catch()"), <ide> "});" <ide> ]), <ide> "};" <ide> module.exports = class NodeMainTemplatePlugin { <ide> const insertMoreModules = [ <ide> "var moreModules = chunk.modules, chunkIds = chunk.ids;", <ide> "for(var moduleId in moreModules) {", <del> mainTemplate.indent(mainTemplate.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")), <add> Template.indent(mainTemplate.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")), <ide> "}" <ide> ]; <ide> if(asyncChunkLoading) { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// ReadFile + VM.run chunk loading for javascript", <ide> "", <ide> "var installedChunkData = installedChunks[chunkId];", <ide> "if(installedChunkData !== 0) { // 0 means \"already installed\".", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "// array of [resolve, reject, promise] means \"currently loading\"", <ide> "if(installedChunkData) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "promises.push(installedChunkData[2]);" <ide> ]), <ide> "} else {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "// load the chunk and return promise to it", <ide> "var promise = new Promise(function(resolve, reject) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "installedChunkData = installedChunks[chunkId] = [resolve, reject];", <ide> "var filename = __dirname + " + mainTemplate.getAssetPath(JSON.stringify(`/${chunkFilename}`), { <ide> hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, <ide> module.exports = class NodeMainTemplatePlugin { <ide> } <ide> }) + ";", <ide> "require('fs').readFile(filename, 'utf-8', function(err, content) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "if(err) return reject(err);", <ide> "var chunk = {};", <ide> "require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" + <ide> "(chunk, require, require('path').dirname(filename), filename);" <ide> ].concat(insertMoreModules).concat([ <ide> "var callbacks = [];", <ide> "for(var i = 0; i < chunkIds.length; i++) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "if(installedChunks[chunkIds[i]])", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "callbacks = callbacks.concat(installedChunks[chunkIds[i]][0]);" <ide> ]), <ide> "installedChunks[chunkIds[i]] = 0;" <ide> ]), <ide> "}", <ide> "for(i = 0; i < callbacks.length; i++)", <del> mainTemplate.indent("callbacks[i]();") <add> Template.indent("callbacks[i]();") <ide> ])), <ide> "});" <ide> ]), <ide> module.exports = class NodeMainTemplatePlugin { <ide> name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "` <ide> } <ide> }); <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// require() chunk loading for javascript", <ide> "", <ide> "// \"0\" is the signal for \"already loaded\"", <ide> "if(installedChunks[chunkId] !== 0) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> `var chunk = require(${request});` <ide> ].concat(insertMoreModules).concat([ <ide> "for(var i = 0; i < chunkIds.length; i++)", <del> mainTemplate.indent("installedChunks[chunkIds[i]] = 0;") <add> Template.indent("installedChunks[chunkIds[i]] = 0;") <ide> ])), <ide> "}", <ide> ]); <ide><path>lib/node/ReadFileCompileWasmMainTemplatePlugin.js <ide> */ <ide> "use strict"; <ide> <add>const Template = require("../Template"); <add> <ide> class ReadFileCompileWasmMainTemplatePlugin { <ide> <ide> apply(mainTemplate) { <ide> mainTemplate.plugin("local-vars", (source, chunk) => { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object to store loaded and loading wasm modules", <ide> class ReadFileCompileWasmMainTemplatePlugin { <ide> } <ide> } <ide> }); <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// ReadFile + compile chunk loading for webassembly", <ide> "", <ide> `var wasmModules = ${JSON.stringify(chunkModuleMaps.id)}[chunkId] || [];`, <ide> "", <ide> "wasmModules.forEach(function(wasmModuleId) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "var installedWasmModuleData = installedWasmModules[wasmModuleId];", <ide> "", <ide> "// a Promise means \"currently loading\" or \"already loaded\".", <ide> "promises.push(installedWasmModuleData ||", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "(installedWasmModules[wasmModuleId] = new Promise(function(resolve, reject) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> `require('fs').readFile(require('path').resolve(__dirname, ${wasmModuleSrcPath}), function(err, buffer) {`, <del> mainTemplate.indent([ <add> Template.indent([ <ide> "if(err) return reject(err);", <ide> "resolve(WebAssembly.compile(buffer));" <ide> ]), <ide> class ReadFileCompileWasmMainTemplatePlugin { <ide> ]); <ide> }); <ide> mainTemplate.plugin("require-extensions", (source, chunk) => { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object with all compiled WebAssmbly.Modules", <ide><path>lib/web/FetchCompileWasmMainTemplatePlugin.js <ide> */ <ide> "use strict"; <ide> <add>const Template = require("../Template"); <add> <ide> class FetchCompileWasmMainTemplatePlugin { <ide> <ide> apply(mainTemplate) { <ide> mainTemplate.plugin("local-vars", (source, chunk) => { <ide> if(!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) <ide> return source; <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object to store loaded and loading wasm modules", <ide> class FetchCompileWasmMainTemplatePlugin { <ide> } <ide> } <ide> }); <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// Fetch + compile chunk loading for webassembly", <ide> "", <ide> `var wasmModules = ${JSON.stringify(chunkModuleMaps.id)}[chunkId] || [];`, <ide> "", <ide> "wasmModules.forEach(function(wasmModuleId) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "var installedWasmModuleData = installedWasmModules[wasmModuleId];", <ide> "", <ide> "// a Promise means \"currently loading\" or \"already loaded\".", <ide> "promises.push(installedWasmModuleData ||", <del> mainTemplate.indent([ <add> Template.indent([ <ide> `(installedWasmModules[wasmModuleId] = fetch(${mainTemplate.requireFn}.p + ${wasmModuleSrcPath}).then(function(response) {`, <del> mainTemplate.indent([ <add> Template.indent([ <ide> "if(WebAssembly.compileStreaming) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "return WebAssembly.compileStreaming(response);" <ide> ]), <ide> "} else {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "return response.arrayBuffer().then(function(bytes) { return WebAssembly.compile(bytes); });", <ide> ]), <ide> "}" <ide> class FetchCompileWasmMainTemplatePlugin { <ide> mainTemplate.plugin("require-extensions", (source, chunk) => { <ide> if(!chunk.hasModuleInGraph(m => m.type.startsWith("webassembly"))) <ide> return source; <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object with all compiled WebAssmbly.Modules", <ide><path>lib/web/JsonpMainTemplatePlugin.js <ide> class JsonpMainTemplatePlugin { <ide> mainTemplate.hooks.jsonpScript = new SyncWaterfallHook(["source", "chunk", "hash"]); <ide> mainTemplate.plugin("local-vars", (source, chunk) => { <ide> if(needChunkLoadingCode(chunk)) { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object to store loaded and loading chunks", <ide> "var installedChunks = {", <del> mainTemplate.indent( <add> Template.indent( <ide> chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n") <ide> ), <ide> "};", <ide> class JsonpMainTemplatePlugin { <ide> name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "` <ide> } <ide> }); <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> "var script = document.createElement('script');", <ide> "script.charset = 'utf-8';", <ide> `script.timeout = ${chunkLoadTimeout};`, <ide> crossOriginLoading ? `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};` : "", <ide> `if (${mainTemplate.requireFn}.nc) {`, <del> mainTemplate.indent(`script.setAttribute("nonce", ${mainTemplate.requireFn}.nc);`), <add> Template.indent(`script.setAttribute("nonce", ${mainTemplate.requireFn}.nc);`), <ide> "}", <ide> `script.src = ${mainTemplate.requireFn}.p + ${scriptSrcPath};`, <ide> "var timeout = setTimeout(function(){", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "onScriptComplete({ type: 'timeout', target: script });", <ide> ]), <ide> `}, ${chunkLoadTimeout});`, <ide> "script.onerror = script.onload = onScriptComplete;", <ide> "function onScriptComplete(event) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "// avoid mem leaks in IE.", <ide> "script.onerror = script.onload = null;", <ide> "clearTimeout(timeout);", <ide> "var chunk = installedChunks[chunkId];", <ide> "if(chunk !== 0) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "if(chunk) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "var errorType = event && (event.type === 'load' ? 'missing' : event.type);", <ide> "var realSrc = event && event.target && event.target.src;", <ide> "var error = new Error('Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')');", <ide> class JsonpMainTemplatePlugin { <ide> ]); <ide> }); <ide> mainTemplate.plugin("require-ensure", (source, chunk, hash) => { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// JSONP chunk loading for javascript", <ide> "", <ide> "var installedChunkData = installedChunks[chunkId];", <ide> "if(installedChunkData !== 0) { // 0 means \"already installed\".", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "", <ide> "// a Promise means \"currently loading\".", <ide> "if(installedChunkData) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "promises.push(installedChunkData[2]);" <ide> ]), <ide> "} else {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "// setup Promise in chunk cache", <ide> "var promise = new Promise(function(resolve, reject) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "installedChunkData = installedChunks[chunkId] = [resolve, reject];" <ide> ]), <ide> "});", <ide> class JsonpMainTemplatePlugin { <ide> mainTemplate.plugin("require-extensions", (source, chunk) => { <ide> if(chunk.getNumberOfChunks() === 0) return source; <ide> <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// on error function for async loading", <ide> class JsonpMainTemplatePlugin { <ide> }); <ide> mainTemplate.plugin("bootstrap", (source, chunk, hash) => { <ide> if(needChunkLoadingCode(chunk)) { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// install a JSONP callback for chunk loading", <ide> "function webpackJsonpCallback(data) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "var chunkIds = data[0], moreModules = data[1], executeModules = data[2];", <ide> "// add \"moreModules\" to the modules object,", <ide> "// then flag all \"chunkIds\" as loaded and fire callback", <ide> "var moduleId, chunkId, i = 0, resolves = [], result;", <ide> "for(;i < chunkIds.length; i++) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "chunkId = chunkIds[i];", <ide> "if(installedChunks[chunkId]) {", <del> mainTemplate.indent("resolves.push(installedChunks[chunkId][0]);"), <add> Template.indent("resolves.push(installedChunks[chunkId][0]);"), <ide> "}", <ide> "installedChunks[chunkId] = 0;" <ide> ]), <ide> "}", <ide> "for(moduleId in moreModules) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {", <del> mainTemplate.indent(mainTemplate.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")), <add> Template.indent(mainTemplate.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")), <ide> "}" <ide> ]), <ide> "}", <ide> "if(parentJsonpFunction) parentJsonpFunction(data);", <ide> "while(resolves.length) {", <del> mainTemplate.indent("resolves.shift()();"), <add> Template.indent("resolves.shift()();"), <ide> "}", <ide> mainTemplate.entryPointInChildren(chunk) ? [ <ide> "scheduledModules.push.apply(scheduledModules, executeModules || []);", <ide> "", <ide> "for(i = 0; i < scheduledModules.length; i++) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "var scheduledModule = scheduledModules[i];", <ide> "var fullfilled = true;", <ide> "for(var j = 1; j < scheduledModule.length; j++) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "var depId = scheduledModule[j];", <ide> "if(installedChunks[depId] !== 0) fullfilled = false;" <ide> ]), <ide> "}", <ide> "if(fullfilled) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "scheduledModules.splice(i--, 1);", <ide> "result = " + mainTemplate.requireFn + "(" + mainTemplate.requireFn + ".s = scheduledModule[0]);", <ide> ]), <ide> class JsonpMainTemplatePlugin { <ide> mainTemplate.plugin("startup", (source, chunk, hash) => { <ide> if(needChunkLoadingCode(chunk)) { <ide> var jsonpFunction = mainTemplate.outputOptions.jsonpFunction; <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> `var jsonpArray = window[${JSON.stringify(jsonpFunction)}] = window[${JSON.stringify(jsonpFunction)}] || [];`, <ide> "var parentJsonpFunction = jsonpArray.push.bind(jsonpArray);", <ide> "jsonpArray.push = webpackJsonpCallback;", <ide><path>lib/webworker/WebWorkerMainTemplatePlugin.js <ide> class WebWorkerMainTemplatePlugin { <ide> apply(mainTemplate) { <ide> mainTemplate.plugin("local-vars", (source, chunk) => { <ide> if(chunk.getNumberOfChunks() > 0) { <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> "", <ide> "// object to store loaded chunks", <ide> "// \"1\" means \"already loaded\"", <ide> "var installedChunks = {", <del> mainTemplate.indent( <add> Template.indent( <ide> chunk.ids.map((id) => `${id}: 1`).join(",\n") <ide> ), <ide> "};" <ide> class WebWorkerMainTemplatePlugin { <ide> }); <ide> mainTemplate.plugin("require-ensure", (_, chunk, hash) => { <ide> const chunkFilename = mainTemplate.outputOptions.chunkFilename; <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> "promises.push(Promise.resolve().then(function() {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "// \"1\" is the signal for \"already loaded\"", <ide> "if(!installedChunks[chunkId]) {", <del> mainTemplate.indent([ <add> Template.indent([ <ide> "importScripts(" + <ide> mainTemplate.getAssetPath(JSON.stringify(chunkFilename), { <ide> hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, <ide> class WebWorkerMainTemplatePlugin { <ide> mainTemplate.plugin("bootstrap", (source, chunk, hash) => { <ide> if(chunk.getNumberOfChunks() > 0) { <ide> const chunkCallbackName = mainTemplate.outputOptions.chunkCallbackName || Template.toIdentifier("webpackChunk" + (mainTemplate.outputOptions.library || "")); <del> return mainTemplate.asString([ <add> return Template.asString([ <ide> source, <ide> `self[${JSON.stringify(chunkCallbackName)}] = function webpackChunkCallback(chunkIds, moreModules) {`, <del> mainTemplate.indent([ <add> Template.indent([ <ide> "for(var moduleId in moreModules) {", <del> mainTemplate.indent(mainTemplate.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")), <add> Template.indent(mainTemplate.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")), <ide> "}", <ide> "while(chunkIds.length)", <del> mainTemplate.indent("installedChunks[chunkIds.pop()] = 1;") <add> Template.indent("installedChunks[chunkIds.pop()] = 1;") <ide> ]), <ide> "};" <ide> ]);
12
Javascript
Javascript
remove fragment from main component
758ad9ce84c98470b71698639f8e4e92842a2434
<ide><path>server/document.js <ide> export class Main extends Component { <ide> render () { <ide> const { html } = this.context._documentProps <ide> return ( <del> <Fragment> <del> <div id='__next' dangerouslySetInnerHTML={{ __html: html }} /> <del> </Fragment> <add> <div id='__next' dangerouslySetInnerHTML={{ __html: html }} /> <ide> ) <ide> } <ide> }
1
PHP
PHP
add additional test coverage for optional columns
e0501ddb2732df4a070140d11a5cc1f651ec3f52
<ide><path>tests/TestCase/Database/Schema/MysqlSchemaTest.php <ide> public static function columnSqlProvider() <ide> ['type' => 'boolean', 'default' => false], <ide> '`checked` BOOLEAN DEFAULT FALSE' <ide> ], <add> [ <add> 'checked', <add> ['type' => 'boolean', 'default' => false, 'null' => false], <add> '`checked` BOOLEAN NOT NULL DEFAULT FALSE' <add> ], <ide> [ <ide> 'checked', <ide> ['type' => 'boolean', 'default' => true, 'null' => false], <ide> '`checked` BOOLEAN NOT NULL DEFAULT TRUE' <ide> ], <add> [ <add> 'checked', <add> ['type' => 'boolean', 'default' => false, 'null' => true], <add> '`checked` BOOLEAN DEFAULT FALSE' <add> ], <ide> // datetimes <ide> [ <ide> 'created', <ide><path>tests/TestCase/Database/Schema/SqliteSchemaTest.php <ide> public static function columnSqlProvider() <ide> // Boolean <ide> [ <ide> 'checked', <del> ['type' => 'boolean', 'default' => false], <add> ['type' => 'boolean', 'null' => true, 'default' => false], <ide> '"checked" BOOLEAN DEFAULT FALSE' <ide> ], <ide> [
2
Java
Java
reset java state in jni reset method
d8e77f0c7679b008c61bce6b008521c3fa298d7e
<ide><path>ReactAndroid/src/main/java/com/facebook/csslayout/CSSNode.java <ide> public void reset() { <ide> mHasSetMargin = false; <ide> mHasSetBorder = false; <ide> mHasSetPosition = false; <add> <add> mMeasureFunction = null; <add> mData = null; <add> <ide> jni_CSSNodeReset(mNativePointer); <ide> } <ide>
1
PHP
PHP
documentif the mapreduce class
7b161df770ebaedda420574d2708cda7ec0a5031
<ide><path>lib/Cake/ORM/MapReduce.php <ide> use \IteratorAggregate; <ide> use \ArrayIterator; <ide> <add>/** <add> * Implements a simplistic version of the popular Map-Reduce algorithm. Acts <add> * like an iterator for the original passed data after each result has been <add> * processed, thus offering a transparent wrapper for results coming from any <add> * source. <add> */ <ide> class MapReduce implements IteratorAggregate { <ide> <add>/** <add> * Holds the shuffled results that were emitted from the map <add> * phase <add> * <add> * @var array <add> */ <ide> protected $_intermediate = []; <ide> <add>/** <add> * Holds the results as emitted during the reduce phase <add> * <add> * @var array <add> */ <ide> protected $_result = []; <ide> <add>/** <add> * Whether the Map-Reduce routine has been executed already on the data <add> * <add> * @var boolean <add> */ <ide> protected $_executed = false; <ide> <add>/** <add> * Holds the original data that needs to be processed <add> * <add> * @return \Traversable <add> */ <ide> protected $_data; <ide> <add>/** <add> * A callable that will be executed for each record in the original data <add> * <add> * @var callable <add> */ <ide> protected $_mapper; <ide> <add>/** <add> * A callable that will be executed for each intermediate record emitted during <add> * the Map phase <add> * <add> * @var callable <add> */ <ide> protected $_reducer; <ide> <add>/** <add> * Count of elements emitted during the Reduce phase <add> * <add> * @var string <add> */ <ide> protected $_counter = 0; <ide> <del> public function __construct($data, array $routines) { <add>/** <add> * Constructor <add> * <add> * @param \Traversable $data the original data to be processed <add> * @param array $routines containing the keys `mapper` and `reducer` <add> * and callables as values <add> * @return void <add> */ <add> public function __construct(\Traversable $data, array $routines) { <ide> $this->_data = $data; <ide> $this->_mapper = $routines['mapper']; <ide> $this->_reducer = isset($routines['reducer']) ? $routines['reducer'] : null; <ide> } <ide> <add>/** <add> * Returns an iterator with the end result of running the Map and Reduce <add> * phases on the original data <add> * <add> * @return \ArrayIterator <add> */ <ide> public function getIterator() { <ide> if (!$this->_executed) { <ide> $this->_execute(); <ide> } <ide> return new ArrayIterator($this->_result); <ide> } <ide> <del> public function emitIntermediate($key, $value) { <del> $this->_intermediate[$key][] = $value; <add>/** <add> * Appends a new record to the bucket labelled with $key, usually as a result <add> * of mapping a single record from the original data. <add> * <add> * @param string $bucket the name of the bucket where to put the record <add> * @param mixed $value the record itself to store in the bucket <add> * @return void <add> */ <add> public function emitIntermediate($bucket, $value) { <add> $this->_intermediate[$bucket][] = $value; <ide> } <ide> <del> public function emit($value, $slot = null) { <del> $this->_result[$slot === null ? $this->_counter : $slot] = $value; <add>/** <add> * Appends a new record to the final list of results an optionally assign a key <add> * for this record. <add> * <add> * @param mixed $value The value to be appended to the final list of results <add> * @param string $key and optional key to assign to the value <add> * @return void <add> */ <add> public function emit($value, $key = null) { <add> $this->_result[$key === null ? $this->_counter : $key] = $value; <ide> $this->_counter++; <ide> } <ide> <add>/** <add> * Runs the actual Map-Reduce algorithm. This is iterate the original data <add> * and call the mapper function for each , then for each intermediate <add> * bucket created during the Map phase call the reduce function. <add> * <add> * @return void <add> */ <ide> protected function _execute() { <ide> foreach ($this->_data as $key => $value) { <ide> $this->_mapper->__invoke($key, $value, $this); <ide> } <add> $this->_data = null; <ide> <ide> foreach ($this->_intermediate as $key => $list) { <ide> $this->_reducer->__invoke($key, $list, $this);
1
Python
Python
set version to v2.2.0
2fb05482ddb2515d1f8904572dc5cbabc244ce67
<ide><path>spacy/about.py <ide> # fmt: off <ide> __title__ = "spacy" <del>__version__ = "2.2.0.dev17" <add>__version__ = "2.2.0" <ide> __release__ = True <ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download" <ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
1
Ruby
Ruby
fix typo in benchmarker usage string
98068a71dfc8970d68ad8d31053faf387aa67c9d
<ide><path>railties/lib/commands/performance/benchmarker.rb <ide> if ARGV.empty? <del> puts "Usage: ./script/perform benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..." <add> puts "Usage: ./script/performance/benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..." <ide> exit 1 <ide> end <ide>
1
Go
Go
add failing test for odd kernel version
fc30346086a890687d145c33aa8fb3d0ad6a4b7e
<ide><path>utils/utils_test.go <ide> func TestParseRelease(t *testing.T) { <ide> assertParseRelease(t, "3.4.54.longterm-1", &KernelVersionInfo{Kernel: 3, Major: 4, Minor: 54}, 0) <ide> assertParseRelease(t, "3.4.54.longterm-1", &KernelVersionInfo{Kernel: 3, Major: 4, Minor: 54, Flavor: "1"}, 0) <ide> assertParseRelease(t, "3.8.0-19-generic", &KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0, Flavor: "19-generic"}, 0) <add> assertParseRelease(t, "3.12.8tag", &KernelVersionInfo{Kernel: 3, Major: 12, Minor: 8, Flavor: "tag"}, 0) <ide> } <ide> <ide> func TestParsePortMapping(t *testing.T) {
1
Javascript
Javascript
update precompiler for new format
b6c816ed9ca8fe9df5d83d344f1be7d0cf3eab28
<ide><path>lib/broccoli-ember-inline-template-precompiler.js <ide> EmberInlineTemplatePrecompiler.prototype.processFile = function (srcDir, destDir <ide> <ide> while (nextIndex > -1) { <ide> var match = inputString.match(self.inlineTemplateRegExp); <del> var template = "Ember.Handlebars.template(" + compiler.precompile(match[1]).toString() + ")"; <add> var template = "Ember.Handlebars.template(" + compiler.precompile(match[1], false) + ")"; <ide> <ide> inputString = inputString.replace(match[0], template); <ide> <ide><path>packages/ember-handlebars-compiler/tests/precompile_type_test.js <ide> var result; <ide> <ide> QUnit.module("Ember.Handlebars.precompileType"); <ide> <del>test("precompile creates a function when asObject isn't defined", function(){ <add>test("precompile creates an object when asObject isn't defined", function(){ <ide> result = precompile(template); <del> equal(typeof(result), "function"); <add> equal(typeof(result), "object"); <ide> }); <ide> <del>test("precompile creates a function when asObject is true", function(){ <add>test("precompile creates an object when asObject is true", function(){ <ide> result = precompile(template, true); <del> equal(typeof(result), "function"); <add> equal(typeof(result), "object"); <ide> }); <ide> <ide> test("precompile creates a string when asObject is false", function(){ <ide> result = precompile(template, false); <ide> equal(typeof(result), "string"); <ide> }); <ide> <del>test("precompile creates a function when passed an AST", function(){ <add>test("precompile creates an object when passed an AST", function(){ <ide> var ast = parse(template); <ide> result = precompile(ast); <del> equal(typeof(result), "function"); <add> equal(typeof(result), "object"); <ide> });
2
Go
Go
fix possible panic on killing container
e995670935118ad7ff485aee7fd3d4767e4c3e29
<ide><path>daemon/execdriver/native/driver.go <ide> package native <ide> <ide> import ( <ide> "encoding/json" <add> "errors" <ide> "fmt" <ide> "io" <ide> "io/ioutil" <ide> func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <ide> } <ide> <ide> func (d *driver) Kill(p *execdriver.Command, sig int) error { <add> if p.ProcessConfig.Process == nil { <add> return errors.New("exec: not started") <add> } <ide> return syscall.Kill(p.ProcessConfig.Process.Pid, syscall.Signal(sig)) <ide> } <ide>
1
Go
Go
make sockrequestraw return reader, not []byte
8232cc777e329a47e123dbdc42411dae65288a80
<ide><path>integration-cli/docker_api_containers_test.go <ide> func TestBuildApiDockerfilePath(t *testing.T) { <ide> t.Fatalf("failed to close tar archive: %v", err) <ide> } <ide> <del> _, out, err := sockRequestRaw("POST", "/build?dockerfile=../Dockerfile", buffer, "application/x-tar") <add> _, body, err := sockRequestRaw("POST", "/build?dockerfile=../Dockerfile", buffer, "application/x-tar") <ide> if err == nil { <add> out, _ := readBody(body) <ide> t.Fatalf("Build was supposed to fail: %s", out) <ide> } <add> out, err := readBody(body) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <ide> if !strings.Contains(string(out), "must be within the build context") { <ide> t.Fatalf("Didn't complain about leaving build context: %s", out) <ide> RUN find /tmp/`, <ide> } <ide> defer server.Close() <ide> <del> _, buf, err := sockRequestRaw("POST", "/build?dockerfile=baz&remote="+server.URL()+"/testD", nil, "application/json") <add> _, body, err := sockRequestRaw("POST", "/build?dockerfile=baz&remote="+server.URL()+"/testD", nil, "application/json") <ide> if err != nil { <ide> t.Fatalf("Build failed: %s", err) <ide> } <add> buf, err := readBody(body) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <ide> // Make sure Dockerfile exists. <ide> // Make sure 'baz' doesn't exist ANYWHERE despite being mentioned in the URL <ide> RUN echo from dockerfile`, <ide> } <ide> defer git.Close() <ide> <del> _, buf, err := sockRequestRaw("POST", "/build?remote="+git.RepoURL, nil, "application/json") <add> _, body, err := sockRequestRaw("POST", "/build?remote="+git.RepoURL, nil, "application/json") <ide> if err != nil { <add> buf, _ := readBody(body) <ide> t.Fatalf("Build failed: %s\n%q", err, buf) <ide> } <add> buf, err := readBody(body) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <ide> out := string(buf) <ide> if !strings.Contains(out, "from dockerfile") { <ide> RUN echo from Dockerfile`, <ide> defer git.Close() <ide> <ide> // Make sure it tries to 'dockerfile' query param value <del> _, buf, err := sockRequestRaw("POST", "/build?dockerfile=baz&remote="+git.RepoURL, nil, "application/json") <add> _, body, err := sockRequestRaw("POST", "/build?dockerfile=baz&remote="+git.RepoURL, nil, "application/json") <ide> if err != nil { <add> buf, _ := readBody(body) <ide> t.Fatalf("Build failed: %s\n%q", err, buf) <ide> } <add> buf, err := readBody(body) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <ide> out := string(buf) <ide> if !strings.Contains(out, "from baz") { <ide> RUN echo from dockerfile`, <ide> defer git.Close() <ide> <ide> // Make sure it tries to 'dockerfile' query param value <del> _, buf, err := sockRequestRaw("POST", "/build?remote="+git.RepoURL, nil, "application/json") <add> _, body, err := sockRequestRaw("POST", "/build?remote="+git.RepoURL, nil, "application/json") <ide> if err != nil { <ide> t.Fatalf("Build failed: %s", err) <ide> } <add> buf, err := readBody(body) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <ide> out := string(buf) <ide> if !strings.Contains(out, "from Dockerfile") { <ide> func TestBuildApiDockerfileSymlink(t *testing.T) { <ide> t.Fatalf("failed to close tar archive: %v", err) <ide> } <ide> <del> _, out, err := sockRequestRaw("POST", "/build", buffer, "application/x-tar") <add> _, body, err := sockRequestRaw("POST", "/build", buffer, "application/x-tar") <ide> if err == nil { <add> out, _ := readBody(body) <ide> t.Fatalf("Build was supposed to fail: %s", out) <ide> } <add> out, err := readBody(body) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <ide> // The reason the error is "Cannot locate specified Dockerfile" is because <ide> // in the builder, the symlink is resolved within the context, therefore <ide><path>integration-cli/docker_utils.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api" <add> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/stringutils" <ide> ) <ide> <ide> func sockRequest(method, endpoint string, data interface{}) (int, []byte, error) <ide> return -1, nil, err <ide> } <ide> <del> return sockRequestRaw(method, endpoint, jsonData, "application/json") <add> status, body, err := sockRequestRaw(method, endpoint, jsonData, "application/json") <add> if err != nil { <add> b, _ := ioutil.ReadAll(body) <add> return status, b, err <add> } <add> var b []byte <add> b, err = readBody(body) <add> return status, b, err <ide> } <ide> <del>func sockRequestRaw(method, endpoint string, data io.Reader, ct string) (int, []byte, error) { <add>func sockRequestRaw(method, endpoint string, data io.Reader, ct string) (int, io.ReadCloser, error) { <ide> c, err := sockConn(time.Duration(10 * time.Second)) <ide> if err != nil { <ide> return -1, nil, fmt.Errorf("could not dial docker daemon: %v", err) <ide> } <ide> <ide> client := httputil.NewClientConn(c, nil) <del> defer client.Close() <ide> <ide> req, err := http.NewRequest(method, endpoint, data) <ide> if err != nil { <add> client.Close() <ide> return -1, nil, fmt.Errorf("could not create new request: %v", err) <ide> } <ide> <ide> func sockRequestRaw(method, endpoint string, data io.Reader, ct string) (int, [] <ide> <ide> resp, err := client.Do(req) <ide> if err != nil { <add> client.Close() <ide> return -1, nil, fmt.Errorf("could not perform request: %v", err) <ide> } <del> defer resp.Body.Close() <add> body := ioutils.NewReadCloserWrapper(resp.Body, func() error { <add> defer client.Close() <add> return resp.Body.Close() <add> }) <ide> if resp.StatusCode != http.StatusOK { <del> body, _ := ioutil.ReadAll(resp.Body) <ide> return resp.StatusCode, body, fmt.Errorf("received status != 200 OK: %s", resp.Status) <ide> } <ide> <del> b, err := ioutil.ReadAll(resp.Body) <add> return resp.StatusCode, body, err <add>} <ide> <del> return resp.StatusCode, b, err <add>func readBody(b io.ReadCloser) ([]byte, error) { <add> defer b.Close() <add> return ioutil.ReadAll(b) <ide> } <ide> <ide> func deleteContainer(container string) error {
2
Javascript
Javascript
use es5 for transpile script, too much meta
257791d05879f5a6434836641874c5b229d98876
<ide><path>tasks/transpile.js <ide> module.exports = function (grunt) { <ide> path.resolve('src/moment'), <ide> path.resolve('build/tmp/moment') <ide> ]; <del> bundleOpts.globals = { <del> [path.resolve('src/moment')]: 'moment', <del> [path.resolve('build/tmp/moment')]: 'moment' <del> }; <add> bundleOpts.globals = {}; <add> bundleOpts.globals[path.resolve('src/moment')] = 'moment'; <add> bundleOpts.globals[path.resolve('build/tmp/moment')] = 'moment'; <ide> } <ide> <ide> return rollup(rollupOpts).then(function (bundle) {
1
Text
Text
move changelog entry to the top [ci skip]
4cf805a6d98f372148755b36153d4267889aa67f
<ide><path>railties/CHANGELOG.md <add>* Changed stylesheet load order in the stylesheet manifest generator. <add> Fixes #11639. <add> <add> *Pawel Janiak* <add> <ide> * Added generated unit test for generator generator using new <ide> `test:generators` rake task. <ide> <ide> <ide> *John Wang* <ide> <del>* Clearing autoloaded constants triggers routes reloading [Fixes #10685]. <add>* Clearing autoloaded constants triggers routes reloading. <add> Fixes #10685. <ide> <ide> *Xavier Noria* <ide> <ide> <ide> *Sıtkı Bağdat* <ide> <del>* Changed stylesheet load order in the stylesheet manifest generator. [Fixes #11639] <del> <del> *Pawel Janiak* <del> <ide> Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/railties/CHANGELOG.md) for previous changes.
1
Ruby
Ruby
move object test files under object
a45d1f6dfdb22a9d3e61397030b98a5d4d0c5114
<ide><path>activesupport/test/core_ext/object/acts_like_test.rb <add>require 'abstract_unit' <add>require 'active_support/core_ext/object' <add> <add>class ObjectTests < ActiveSupport::TestCase <add> class DuckTime <add> def acts_like_time? <add> true <add> end <add> end <add> <add> def test_duck_typing <add> object = Object.new <add> time = Time.now <add> date = Date.today <add> dt = DateTime.new <add> duck = DuckTime.new <add> <add> assert !object.acts_like?(:time) <add> assert !object.acts_like?(:date) <add> <add> assert time.acts_like?(:time) <add> assert !time.acts_like?(:date) <add> <add> assert !date.acts_like?(:time) <add> assert date.acts_like?(:date) <add> <add> assert dt.acts_like?(:time) <add> assert dt.acts_like?(:date) <add> <add> assert duck.acts_like?(:time) <add> assert !duck.acts_like?(:date) <add> end <add>end <ide><path>activesupport/test/core_ext/object/instance_variables_test.rb <add>require 'abstract_unit' <add>require 'active_support/core_ext/object' <add> <add>class ObjectInstanceVariableTest < ActiveSupport::TestCase <add> def setup <add> @source, @dest = Object.new, Object.new <add> @source.instance_variable_set(:@bar, 'bar') <add> @source.instance_variable_set(:@baz, 'baz') <add> end <add> <add> def test_instance_variable_names <add> assert_equal %w(@bar @baz), @source.instance_variable_names.sort <add> end <add> <add> def test_instance_values <add> assert_equal({'bar' => 'bar', 'baz' => 'baz'}, @source.instance_values) <add> end <add> <add> def test_instance_exec_passes_arguments_to_block <add> assert_equal %w(hello goodbye), 'hello'.instance_exec('goodbye') { |v| [self, v] } <add> end <add> <add> def test_instance_exec_with_frozen_obj <add> assert_equal %w(olleh goodbye), 'hello'.freeze.instance_exec('goodbye') { |v| [reverse, v] } <add> end <add> <add> def test_instance_exec_nested <add> assert_equal %w(goodbye olleh bar), 'hello'.instance_exec('goodbye') { |arg| <add> [arg] + instance_exec('bar') { |v| [reverse, v] } } <add> end <add>end <add><path>activesupport/test/core_ext/object/try_test.rb <del><path>activesupport/test/core_ext/object_and_class_ext_test.rb <ide> require 'abstract_unit' <del>require 'active_support/time' <ide> require 'active_support/core_ext/object' <ide> <del>class ObjectTests < ActiveSupport::TestCase <del> class DuckTime <del> def acts_like_time? <del> true <del> end <del> end <del> <del> def test_duck_typing <del> object = Object.new <del> time = Time.now <del> date = Date.today <del> dt = DateTime.new <del> duck = DuckTime.new <del> <del> assert !object.acts_like?(:time) <del> assert !object.acts_like?(:date) <del> <del> assert time.acts_like?(:time) <del> assert !time.acts_like?(:date) <del> <del> assert !date.acts_like?(:time) <del> assert date.acts_like?(:date) <del> <del> assert dt.acts_like?(:time) <del> assert dt.acts_like?(:date) <del> <del> assert duck.acts_like?(:time) <del> assert !duck.acts_like?(:date) <del> end <del>end <del> <del>class ObjectInstanceVariableTest < ActiveSupport::TestCase <del> def setup <del> @source, @dest = Object.new, Object.new <del> @source.instance_variable_set(:@bar, 'bar') <del> @source.instance_variable_set(:@baz, 'baz') <del> end <del> <del> def test_instance_variable_names <del> assert_equal %w(@bar @baz), @source.instance_variable_names.sort <del> end <del> <del> def test_instance_values <del> object = Object.new <del> object.instance_variable_set :@a, 1 <del> object.instance_variable_set :@b, 2 <del> assert_equal({'a' => 1, 'b' => 2}, object.instance_values) <del> end <del> <del> def test_instance_exec_passes_arguments_to_block <del> assert_equal %w(hello goodbye), 'hello'.instance_exec('goodbye') { |v| [self, v] } <del> end <del> <del> def test_instance_exec_with_frozen_obj <del> assert_equal %w(olleh goodbye), 'hello'.freeze.instance_exec('goodbye') { |v| [reverse, v] } <del> end <del> <del> def test_instance_exec_nested <del> assert_equal %w(goodbye olleh bar), 'hello'.instance_exec('goodbye') { |arg| <del> [arg] + instance_exec('bar') { |v| [reverse, v] } } <del> end <del>end <del> <ide> class ObjectTryTest < ActiveSupport::TestCase <ide> def setup <ide> @string = "Hello" <ide> def private_method <ide> <ide> assert_raise(NoMethodError) { klass.new.try!(:private_method) } <ide> end <del> <add> <ide> def test_try_with_private_method <ide> klass = Class.new do <ide> private
3
Python
Python
add a get_config implementation
611abda1083f72a2d9ff07c715a6d762b16d4148
<ide><path>official/projects/vit/modeling/vit.py <ide> def call(self, inputs, training=None): <ide> x = encoder_layer(x, training=training) <ide> x = self._norm(x) <ide> return x <add> def get_config(self): <add> config = { <add> 'num_layers': self._num_layers, <add> 'mlp_dim': self._mlp_dim, <add> 'num_heads': self._num_heads, <add> 'dropout_rate': self._dropout_rate, <add> 'attention_dropout_rate': self._attention_dropout_rate, <add> 'kernel_regularizer': self._kernel_regularizer, <add> 'inputs_positions': self._inputs_positions, <add> 'init_stochastic_depth_rate': self._init_stochastic_depth_rate, <add> 'kernel_initializer': self._kernel_initializer, <add> 'add_pos_embed': self._add_pos_embed, <add> } <add> base_config = super().get_config() <add> return dict(list(base_config.items()) + list(config.items())) <add> <ide> <ide> <ide> class VisionTransformer(tf.keras.Model):
1
Python
Python
add test for script deployment
750b38d9700eb26d516e53d21661cc9c4fcc11fd
<ide><path>test/compute/test_deployment.py <ide> import unittest <ide> <ide> from libcloud.compute.deployment import MultiStepDeployment, Deployment <del>from libcloud.compute.deployment import SSHKeyDeployment <add>from libcloud.compute.deployment import SSHKeyDeployment, ScriptDeployment <ide> from libcloud.compute.base import Node <ide> from libcloud.compute.types import NodeState <ide> from libcloud.compute.ssh import BaseSSHClient <ide> def run(self, node, client): <ide> return node <ide> <ide> class MockClient(BaseSSHClient): <del> def put(self, file, contents): <add> def __init__(self, *args, **kwargs): <add> self.stdout = '' <add> self.stderr = '' <add> self.exit_status = 0 <add> <add> def put(self, path, contents, chmod=755): <ide> return contents <ide> <add> def run(self, name): <add> return self.stdout, self.stderr, self.exit_status <add> <add> def delete(self, name): <add> return True <add> <ide> class DeploymentTests(unittest.TestCase): <ide> <ide> def setUp(self): <ide> def test_ssh_key_deployment(self): <ide> self.assertEqual(self.node, sshd.run(node=self.node, <ide> client=MockClient(hostname='localhost'))) <ide> <add> def test_script_deployment(self): <add> sd = ScriptDeployment(script='foobar', delete=True) <add> <add> self.assertEqual(self.node, sd.run(node=self.node, <add> client=MockClient(hostname='localhost'))) <add> <ide> if __name__ == '__main__': <ide> sys.exit(unittest.main())
1
PHP
PHP
remove comment bloat from route\loader class
c1e2f3cf909edd6070990715d4e9753acddd5e9a
<ide><path>system/route/loader.php <ide> class Loader { <ide> */ <ide> public static function load($uri) <ide> { <del> // -------------------------------------------------------------- <del> // If a single route file is being used, return it. <del> // -------------------------------------------------------------- <ide> if ( ! is_dir(APP_PATH.'routes')) <ide> { <ide> return require APP_PATH.'routes'.EXT; <ide> public static function load($uri) <ide> throw new \Exception("A [home] route file is required when using a route directory."); <ide> } <ide> <del> // -------------------------------------------------------------- <del> // If the request is to the root, load the "home" routes file. <del> // <del> // Otherwise, load the route file matching the first segment of <del> // the URI as well as the "home" routes file. <del> // -------------------------------------------------------------- <ide> if ($uri == '/') <ide> { <ide> return require APP_PATH.'routes/home'.EXT; <ide> public static function load($uri) <ide> { <ide> $segments = explode('/', trim($uri, '/')); <ide> <del> // -------------------------------------------------------------- <del> // If the file doesn't exist, we'll just return the "home" file. <del> // -------------------------------------------------------------- <ide> if ( ! file_exists(APP_PATH.'routes/'.$segments[0].EXT)) <ide> { <ide> return require APP_PATH.'routes/home'.EXT;
1
Javascript
Javascript
ignore node_modules when linting
1eda6eb6377e86b09d4e88c6ce44ba0e3978b89c
<ide><path>tools/lint-js.js <ide> if (cluster.isMaster) { <ide> let curPath = 'Starting ...'; <ide> let showProgress = true; <ide> const globOptions = { <del> nodir: true <add> nodir: true, <add> ignore: '**/node_modules/**/*' <ide> }; <ide> const workerConfig = {}; <ide> let startTime;
1
Javascript
Javascript
replace "magic" numbers by constants
2f743261814d428b935136b64b416a2879c29364
<ide><path>lib/internal/constants.js <ide> module.exports = { <ide> CHAR_DOT: 46, /* . */ <ide> CHAR_FORWARD_SLASH: 47, /* / */ <ide> CHAR_BACKWARD_SLASH: 92, /* \ */ <add> CHAR_VERTICAL_LINE: 124, /* | */ <ide> CHAR_COLON: 58, /* : */ <ide> CHAR_QUESTION_MARK: 63, /* ? */ <ide> CHAR_UNDERSCORE: 95, /* _ */ <ide> CHAR_LINE_FEED: 10, /* \n */ <ide> CHAR_CARRIAGE_RETURN: 13, /* \r */ <add> CHAR_TAB: 9, /* \t */ <add> CHAR_FORM_FEED: 12, /* \f */ <ide> CHAR_EXCLAMATION_MARK: 33, /* ! */ <ide> CHAR_HASH: 35, /* # */ <add> CHAR_SPACE: 32, /* */ <add> CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ <add> CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ <add> CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ <add> CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ <add> CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ <add> CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ <add> CHAR_LEFT_CURLY_BRACKET: 123, /* { */ <add> CHAR_RIGHT_CURLY_BRACKET: 125, /* } */ <add> CHAR_HYPHEN_MINUS: 45, /* - */ <add> CHAR_PLUS: 43, /* + */ <add> CHAR_DOUBLE_QUOTE: 34, /* " */ <add> CHAR_SINGLE_QUOTE: 39, /* ' */ <add> CHAR_PERCENT: 37, /* % */ <add> CHAR_SEMICOLON: 59, /* ; */ <add> CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ <add> CHAR_GRAVE_ACCENT: 96, /* ` */ <add> CHAR_AT: 64, /* @ */ <ide> <ide> // Digits <ide> CHAR_0: 48, /* 0 */ <ide><path>lib/url.js <ide> const slashedProtocol = { <ide> 'file:': true <ide> }; <ide> const querystring = require('querystring'); <add>const { <add> CHAR_SPACE, <add> CHAR_TAB, <add> CHAR_CARRIAGE_RETURN, <add> CHAR_LINE_FEED, <add> CHAR_FORM_FEED, <add> CHAR_NO_BREAK_SPACE, <add> CHAR_ZERO_WIDTH_NOBREAK_SPACE, <add> CHAR_HASH, <add> CHAR_FORWARD_SLASH, <add> CHAR_LEFT_SQUARE_BRACKET, <add> CHAR_RIGHT_SQUARE_BRACKET, <add> CHAR_LEFT_ANGLE_BRACKET, <add> CHAR_RIGHT_ANGLE_BRACKET, <add> CHAR_LEFT_CURLY_BRACKET, <add> CHAR_RIGHT_CURLY_BRACKET, <add> CHAR_QUESTION_MARK, <add> CHAR_LOWERCASE_A, <add> CHAR_LOWERCASE_Z, <add> CHAR_UPPERCASE_A, <add> CHAR_UPPERCASE_Z, <add> CHAR_DOT, <add> CHAR_0, <add> CHAR_9, <add> CHAR_HYPHEN_MINUS, <add> CHAR_PLUS, <add> CHAR_UNDERSCORE, <add> CHAR_DOUBLE_QUOTE, <add> CHAR_SINGLE_QUOTE, <add> CHAR_PERCENT, <add> CHAR_SEMICOLON, <add> CHAR_BACKWARD_SLASH, <add> CHAR_CIRCUMFLEX_ACCENT, <add> CHAR_GRAVE_ACCENT, <add> CHAR_VERTICAL_LINE, <add> CHAR_AT, <add>} = require('internal/constants'); <ide> <ide> function urlParse(url, parseQueryString, slashesDenoteHost) { <ide> if (url instanceof Url) return url; <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> const code = url.charCodeAt(i); <ide> <ide> // Find first and last non-whitespace characters for trimming <del> const isWs = code === 32/* */ || <del> code === 9/*\t*/ || <del> code === 13/*\r*/ || <del> code === 10/*\n*/ || <del> code === 12/*\f*/ || <del> code === 160/*\u00A0*/ || <del> code === 65279/*\uFEFF*/; <add> const isWs = code === CHAR_SPACE || <add> code === CHAR_TAB || <add> code === CHAR_CARRIAGE_RETURN || <add> code === CHAR_LINE_FEED || <add> code === CHAR_FORM_FEED || <add> code === CHAR_NO_BREAK_SPACE || <add> code === CHAR_ZERO_WIDTH_NOBREAK_SPACE; <ide> if (start === -1) { <ide> if (isWs) <ide> continue; <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> // Only convert backslashes while we haven't seen a split character <ide> if (!split) { <ide> switch (code) { <del> case 35: // '#' <add> case CHAR_HASH: <ide> hasHash = true; <ide> // Fall through <del> case 63: // '?' <add> case CHAR_QUESTION_MARK: <ide> split = true; <ide> break; <del> case 92: // '\\' <add> case CHAR_BACKWARD_SLASH: <ide> if (i - lastPos > 0) <ide> rest += url.slice(lastPos, i); <ide> rest += '/'; <ide> lastPos = i + 1; <ide> break; <ide> } <del> } else if (!hasHash && code === 35/*#*/) { <add> } else if (!hasHash && code === CHAR_HASH) { <ide> hasHash = true; <ide> } <ide> } <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> // resolution will treat //foo/bar as host=foo,path=bar because that's <ide> // how the browser resolves relative URLs. <ide> if (slashesDenoteHost || proto || hostPattern.test(rest)) { <del> var slashes = rest.charCodeAt(0) === 47/*/*/ && <del> rest.charCodeAt(1) === 47/*/*/; <add> var slashes = rest.charCodeAt(0) === CHAR_FORWARD_SLASH && <add> rest.charCodeAt(1) === CHAR_FORWARD_SLASH; <ide> if (slashes && !(proto && hostlessProtocol[proto])) { <ide> rest = rest.slice(2); <ide> this.slashes = true; <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> var nonHost = -1; <ide> for (i = 0; i < rest.length; ++i) { <ide> switch (rest.charCodeAt(i)) { <del> case 9: // '\t' <del> case 10: // '\n' <del> case 13: // '\r' <del> case 32: // ' ' <del> case 34: // '"' <del> case 37: // '%' <del> case 39: // '\'' <del> case 59: // ';' <del> case 60: // '<' <del> case 62: // '>' <del> case 92: // '\\' <del> case 94: // '^' <del> case 96: // '`' <del> case 123: // '{' <del> case 124: // '|' <del> case 125: // '}' <add> case CHAR_TAB: <add> case CHAR_LINE_FEED: <add> case CHAR_CARRIAGE_RETURN: <add> case CHAR_SPACE: <add> case CHAR_DOUBLE_QUOTE: <add> case CHAR_PERCENT: <add> case CHAR_SINGLE_QUOTE: <add> case CHAR_SEMICOLON: <add> case CHAR_LEFT_ANGLE_BRACKET: <add> case CHAR_RIGHT_ANGLE_BRACKET: <add> case CHAR_BACKWARD_SLASH: <add> case CHAR_CIRCUMFLEX_ACCENT: <add> case CHAR_GRAVE_ACCENT: <add> case CHAR_LEFT_CURLY_BRACKET: <add> case CHAR_VERTICAL_LINE: <add> case CHAR_RIGHT_CURLY_BRACKET: <ide> // Characters that are never ever allowed in a hostname from RFC 2396 <ide> if (nonHost === -1) <ide> nonHost = i; <ide> break; <del> case 35: // '#' <del> case 47: // '/' <del> case 63: // '?' <add> case CHAR_HASH: <add> case CHAR_FORWARD_SLASH: <add> case CHAR_QUESTION_MARK: <ide> // Find the first instance of any host-ending characters <ide> if (nonHost === -1) <ide> nonHost = i; <ide> hostEnd = i; <ide> break; <del> case 64: // '@' <add> case CHAR_AT: <ide> // At this point, either we have an explicit point where the <ide> // auth portion cannot go past, or the last @ char is the decider. <ide> atSign = i; <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> <ide> // if hostname begins with [ and ends with ] <ide> // assume that it's an IPv6 address. <del> var ipv6Hostname = hostname.charCodeAt(0) === 91/*[*/ && <del> hostname.charCodeAt(hostname.length - 1) === 93/*]*/; <add> var ipv6Hostname = hostname.charCodeAt(0) === CHAR_LEFT_SQUARE_BRACKET && <add> hostname.charCodeAt(hostname.length - 1) === CHAR_RIGHT_SQUARE_BRACKET; <ide> <ide> // validate a little. <ide> if (!ipv6Hostname) { <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> var hashIdx = -1; <ide> for (i = 0; i < rest.length; ++i) { <ide> const code = rest.charCodeAt(i); <del> if (code === 35/*#*/) { <add> if (code === CHAR_HASH) { <ide> this.hash = rest.slice(i); <ide> hashIdx = i; <ide> break; <del> } else if (code === 63/*?*/ && questionIdx === -1) { <add> } else if (code === CHAR_QUESTION_MARK && questionIdx === -1) { <ide> questionIdx = i; <ide> } <ide> } <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> function validateHostname(self, rest, hostname) { <ide> for (var i = 0; i < hostname.length; ++i) { <ide> const code = hostname.charCodeAt(i); <del> const isValid = (code >= 97/*a*/ && code <= 122/*z*/) || <del> code === 46/*.*/ || <del> (code >= 65/*A*/ && code <= 90/*Z*/) || <del> (code >= 48/*0*/ && code <= 57/*9*/) || <del> code === 45/*-*/ || <del> code === 43/*+*/ || <del> code === 95/*_*/ || <add> const isValid = (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) || <add> code === CHAR_DOT || <add> (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) || <add> (code >= CHAR_0 && code <= CHAR_9) || <add> code === CHAR_HYPHEN_MINUS || <add> code === CHAR_PLUS || <add> code === CHAR_UNDERSCORE || <ide> code > 127; <ide> <ide> // Invalid host character <ide> Url.prototype.format = function format() { <ide> var lastPos = 0; <ide> for (var i = 0; i < pathname.length; ++i) { <ide> switch (pathname.charCodeAt(i)) { <del> case 35: // '#' <add> case CHAR_HASH: <ide> if (i - lastPos > 0) <ide> newPathname += pathname.slice(lastPos, i); <ide> newPathname += '%23'; <ide> lastPos = i + 1; <ide> break; <del> case 63: // '?' <add> case CHAR_QUESTION_MARK: <ide> if (i - lastPos > 0) <ide> newPathname += pathname.slice(lastPos, i); <ide> newPathname += '%3F'; <ide> Url.prototype.format = function format() { <ide> // unless they had them to begin with. <ide> if (this.slashes || slashedProtocol[protocol]) { <ide> if (this.slashes || host) { <del> if (pathname && pathname.charCodeAt(0) !== 47/*/*/) <add> if (pathname && pathname.charCodeAt(0) !== CHAR_FORWARD_SLASH) <ide> pathname = '/' + pathname; <ide> host = '//' + host; <ide> } else if (protocol.length >= 4 && <ide> Url.prototype.format = function format() { <ide> <ide> search = search.replace(/#/g, '%23'); <ide> <del> if (hash && hash.charCodeAt(0) !== 35/*#*/) hash = '#' + hash; <del> if (search && search.charCodeAt(0) !== 63/*?*/) search = '?' + search; <add> if (hash && hash.charCodeAt(0) !== CHAR_HASH) <add> hash = '#' + hash; <add> if (search && search.charCodeAt(0) !== CHAR_QUESTION_MARK) <add> search = '?' + search; <ide> <ide> return protocol + host + pathname + search + hash; <ide> };
2
Text
Text
add link to official arraylist documentation
39fa46348ef33cf842a4f851f57e30d56e26324d
<ide><path>guide/english/java/arraylist/index.md <ide> Since ArrayList implements *List*, an ArrayList can be created using the followi <ide> An ArrayList allows us to randomly access elements. ArrayList is similar to *Vector* in a lot of ways. But it is faster than Vectors. The main thing to note is that - Vectors are faster than arrays but ArrayLists are not. <ide> <ide> So when it comes down to choosing between the two - if speed is critical then Vectors should be considered, otherwise ArrayLists are better when it comes to storing large number of elements and accessing them efficiently. <add> <add>## More Information <add>- [ArrayList Documentation](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html)
1
Python
Python
add some missing docstring annotations
66d9e18e80c9d45b10b4893e5c19b606f09df853
<ide><path>libcloud/common/base.py <ide> class Response(object): <ide> parse_zero_length_body = False <ide> <ide> def __init__(self, response, connection): <add> """ <add> :param response: HTTP response object. (optional) <add> :type response: :class:`httplib.HTTPResponse` <add> <add> :param connection: Parent connection object. <add> :type connection: :class:`.Connection` <add> """ <ide> self.body = self._decompress_response(response=response) <ide> <ide> if PY3: <ide> def parse_body(self): <ide> Override in a provider's subclass. <ide> <ide> :return: Parsed body. <add> :rtype: ``str`` <ide> """ <ide> return self.body <ide> <ide> def parse_error(self): <ide> Override in a provider's subclass. <ide> <ide> :return: Parsed error. <add> :rtype: ``str`` <ide> """ <ide> return self.body <ide> <ide> def _decompress_response(self, response): <ide> Decompress a response body if it is using deflate or gzip encoding. <ide> <ide> :return: Decompressed response <add> :rtype: ``str`` <ide> """ <ide> headers = lowercase_keys(dict(response.getheaders())) <ide> encoding = headers.get('content-encoding', None) <ide> def parse_body(self): <ide> body = json.loads(self.body) <ide> except: <ide> raise MalformedResponseError( <del> "Failed to parse JSON", <add> 'Failed to parse JSON', <ide> body=self.body, <ide> driver=self.connection.driver) <ide> return body <ide> def parse_body(self): <ide> class RawResponse(Response): <ide> <ide> def __init__(self, connection): <add> """ <add> :param connection: Parent connection object. <add> :type connection: :class:`.Connection` <add> """ <ide> self._status = None <ide> self._response = None <ide> self._headers = {}
1
Javascript
Javascript
fix typo in a spec comment
615841a5d3cb6dae8329411c27fd938e9b413f4c
<ide><path>test/widgetsSpec.js <ide> describe("widget", function() { <ide> $location.path('/bar'); <ide> $browser.xhr.expectGET('myUrl2').respond('<div>{{1+1}}</div>'); <ide> rootScope.$digest(); <del> $browser.xhr.flush(); // no that we have to requests pending, flush! <add> $browser.xhr.flush(); // now that we have to requests pending, flush! <ide> <ide> expect(rootScope.$element.text()).toEqual('2'); <ide> });
1
Javascript
Javascript
move test helpers inside of closure
83d1229c87d41954a5446073fbae1c779439f262
<ide><path>test/ngAria/ariaSpec.js <ide> describe('$aria', function() { <ide> dealoc(element); <ide> }); <ide> <del> function injectScopeAndCompiler() { <del> return inject(function(_$compile_, _$rootScope_) { <del> $compile = _$compile_; <del> scope = _$rootScope_; <del> }); <del> } <del> <del> function compileElement(inputHtml) { <del> element = $compile(inputHtml)(scope); <del> scope.$digest(); <del> } <del> <ide> describe('aria-hidden', function() { <ide> beforeEach(injectScopeAndCompiler); <ide> <ide> describe('$aria', function() { <ide> expect(element.attr('tabindex')).toBe('0'); <ide> }); <ide> }); <del>}); <ide> <del>function expectAriaAttrOnEachElement(elem, ariaAttr, expected) { <del> angular.forEach(elem, function(val) { <del> expect(angular.element(val).attr(ariaAttr)).toBe(expected); <del> }); <del>} <add> // Helpers <add> function compileElement(inputHtml) { <add> element = $compile(inputHtml)(scope); <add> scope.$digest(); <add> } <add> <add> function configAriaProvider(config) { <add> return function() { <add> module(function($ariaProvider) { <add> $ariaProvider.config(config); <add> }); <add> }; <add> } <ide> <del>function configAriaProvider(config) { <del> return function() { <del> angular.module('ariaTest', ['ngAria']).config(function($ariaProvider) { <del> $ariaProvider.config(config); <add> function expectAriaAttrOnEachElement(elem, ariaAttr, expected) { <add> angular.forEach(elem, function(val) { <add> expect(angular.element(val).attr(ariaAttr)).toBe(expected); <ide> }); <del> module('ariaTest'); <del> }; <del>} <add> } <add> <add> function injectScopeAndCompiler() { <add> return inject(function(_$compile_, _$rootScope_) { <add> $compile = _$compile_; <add> scope = _$rootScope_; <add> }); <add> } <add>});
1
Javascript
Javascript
add controlleras example
726ffdc50ff3133c0cbaf5f3e0e23f77a68180d2
<ide><path>src/ng/compile.js <ide> * restrict: 'A', <ide> * scope: false, <ide> * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, <add> * controllerAs: 'stringAlias', <ide> * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], <ide> * compile: function compile(tElement, tAttrs, transclude) { <ide> * return {
1
Go
Go
reset agentinitdone channel when leaving a cluster
3eff69860d9258fd0ce0646620ef2d39b299f338
<ide><path>libnetwork/controller.go <ide> func (c *controller) clusterAgentInit() { <ide> } <ide> } <ide> } else { <add> c.agentInitDone = make(chan struct{}) <ide> c.agentClose() <ide> } <ide> }
1
Python
Python
add path2str compat function
311704674da83f50fef0b968062a3481330026f4
<ide><path>spacy/compat.py <ide> basestring_ = basestring <ide> input_ = raw_input <ide> json_dumps = lambda data: ujson.dumps(data, indent=2).decode('utf8') <add> path2str = lambda path: str(path).decode('utf8') <ide> <ide> elif is_python3: <ide> bytes_ = bytes <ide> unicode_ = str <ide> basestring_ = str <ide> input_ = input <ide> json_dumps = lambda data: ujson.dumps(data, indent=2) <add> path2str = lambda path: str(path) <ide> <ide> <ide> def symlink_to(orig, dest): <ide> if is_python2 and is_windows: <ide> import subprocess <del> subprocess.call(['mklink', '/d', unicode(orig), unicode(dest)], shell=True) <add> subprocess.call(['mklink', '/d', path2str(orig), path2str(dest)], shell=True) <ide> else: <ide> orig.symlink_to(dest) <ide>
1
Ruby
Ruby
add a null node at the top of the stack
8e014f28ccd380328f49075b62f23322c49033c2
<ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> def nested_options #:nodoc: <ide> end <ide> <ide> def shallow_nesting_depth #:nodoc: <del> @scope.find_all { |frame| <del> frame[:scope_level_resource] <del> }.count { |frame| frame[:scope_level_resource].shallow? } <add> @scope.find_all { |node| <add> node.frame[:scope_level_resource] <add> }.count { |node| node.frame[:scope_level_resource].shallow? } <ide> end <ide> <ide> def param_constraint? #:nodoc: <ide> def new(hash) <ide> self.class.new hash, self, scope_level <ide> end <ide> <add> EMPTY_HASH = {}.freeze <ide> def new_level(level) <del> self.class.new(self, self, level) <del> end <del> <del> def fetch(key, &block) <del> @hash.fetch(key, &block) <add> self.class.new(EMPTY_HASH, self, level) <ide> end <ide> <ide> def [](key) <del> @hash.fetch(key) { @parent[key] } <add> scope = find { |node| node.frame.key? key } <add> scope && scope.frame[key] <ide> end <ide> <ide> include Enumerable <ide> def each <ide> node = self <ide> loop do <ide> break if node.equal? NULL <del> yield node.frame <add> yield node <ide> node = node.parent <ide> end <ide> end <ide> <del> protected <del> <ide> def frame; @hash; end <ide> <del> NULL = Scope.new({}.freeze, {}.freeze) <add> NULL = Scope.new(nil, nil) <ide> end <ide> <ide> def initialize(set) #:nodoc:
1
Python
Python
fix flake8 errors
65b5158a578d93b50c18191e90a7f640ebb4453e
<ide><path>libcloud/compute/drivers/packet.py <ide> from libcloud.common.base import ConnectionKey, JsonResponse <ide> from libcloud.compute.types import Provider, NodeState, InvalidCredsError <ide> from libcloud.compute.base import NodeDriver, Node <del>from libcloud.compute.providers import get_driver <ide> from libcloud.compute.base import NodeImage, NodeSize, NodeLocation <ide> from libcloud.compute.base import KeyPair <ide> <ide> def list_nodes(self, ex_project_id=None): <ide> ex_project_id=self.project_id) <ide> <ide> # In case of Python2 perform requests serially <del> if asyncio == None: <add> if asyncio is None: <ide> nodes = [] <ide> for project in self.projects: <ide> nodes.extend( <ide> def _list_nodes(driver): <ide> for future in futures: <ide> result = yield from future <ide> nodes.extend(result) <del> return nodes""", glob , loc) <add> return nodes""", glob, loc) <ide> loop = asyncio.get_event_loop() <ide> nodes = loop.run_until_complete(loc['_list_nodes'](loc['self'])) <ide> return nodes <ide> def ex_list_events_for_project(self, project, include=None, page=1, <ide> } <ide> return self.connection.request(path, params=params).object <ide> <del> <ide> class Project(object): <ide> def __init__(self, project): <ide> self.id = project.get('id')
1
PHP
PHP
use methods from contract
603aad0f53efcffcc609e8f010fd5f3022e61711
<ide><path>src/Illuminate/Foundation/Bootstrap/RegisterFacades.php <ide> public function bootstrap(Application $app) <ide> <ide> Facade::setFacadeApplication($app); <ide> <del> AliasLoader::getInstance($app['config']['app.aliases'])->register(); <add> AliasLoader::getInstance($app->make('config')->get('app.aliases'))->register(); <ide> } <ide> } <ide><path>src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php <ide> class SetRequestForConsole <ide> */ <ide> public function bootstrap(Application $app) <ide> { <del> $url = $app['config']->get('app.url', 'http://localhost'); <add> $url = $app->make('config')->get('app.url', 'http://localhost'); <ide> <ide> $app->instance('request', Request::create($url, 'GET', [], [], [], $_SERVER)); <ide> }
2
PHP
PHP
fix nested name attributes for submit()
07462f0bef316983d8a888b6e4243a40fa42fee4
<ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php <ide> public function testSecurityButtonNestedNamed() { <ide> $this->assertEquals(array('Address.button'), $result); <ide> } <ide> <add> <add>/** <add> * Test that submit inputs created with foo[bar] name attributes are unlocked correctly. <add> * <add> * @return void <add> */ <add> public function testSecuritySubmitNestedNamed() { <add> $key = 'testKey'; <add> $this->Form->request['_Token'] = array('key' => $key); <add> <add> $this->Form->create('Addresses'); <add> $this->Form->submit('Test', array('type' => 'submit', 'name' => 'Address[button]')); <add> $result = $this->Form->unlockField(); <add> $this->assertEquals(array('Address.button'), $result); <add> } <ide> /** <ide> * Test that the correct fields are unlocked for image submits with no names. <ide> * <ide><path>lib/Cake/View/Helper/FormHelper.php <ide> public function submit($caption = null, $options = array()) { <ide> } <ide> <ide> if (isset($options['name'])) { <del> $this->_secure($options['secure'], $options['name']); <add> $name = str_replace(array('[', ']'), array('.', ''), $options['name']); <add> $this->_secure($options['secure'], $name); <ide> } <ide> unset($options['secure']); <ide>
2
Ruby
Ruby
remove remnants from editor command helper module
943fca0de89caf6c9873afc502a12a98bcbde643
<ide><path>railties/lib/rails/command/base.rb <ide> def namespaced_commands <ide> <ide> no_commands do <ide> delegate :executable, to: :class <add> attr_reader :current_subcommand <add> <add> def invoke_command(command, *) # :nodoc: <add> original_subcommand, @current_subcommand = @current_subcommand, command.name <add> super <add> ensure <add> @current_subcommand = original_subcommand <add> end <ide> end <ide> <ide> def help <ide><path>railties/lib/rails/command/helpers/editor.rb <ide> module Command <ide> module Helpers <ide> module Editor <ide> private <del> def ensure_editor_available(command:) <add> def display_hint_if_system_editor_not_specified <ide> if ENV["EDITOR"].to_s.empty? <ide> say "No $EDITOR to open file in. Assign one like this:" <ide> say "" <del> say %(EDITOR="mate --wait" #{command}) <add> say %(EDITOR="mate --wait" #{executable(current_subcommand)}) <ide> say "" <del> say "For editors that fork and exit immediately, it's important to pass a wait flag," <del> say "otherwise the credentials will be saved immediately with no chance to edit." <add> say "For editors that fork and exit immediately, it's important to pass a wait flag;" <add> say "otherwise, the file will be saved immediately with no chance to edit." <ide> <del> false <del> else <ide> true <ide> end <ide> end <ide> def system_editor(file_path) <ide> system(*Shellwords.split(ENV["EDITOR"]), file_path.to_s) <ide> end <ide> <del> def catch_editing_exceptions <del> yield <add> def using_system_editor <add> display_hint_if_system_editor_not_specified || yield <ide> rescue Interrupt <ide> say "Aborted changing file: nothing saved." <del> rescue ActiveSupport::EncryptedFile::MissingKeyError => error <del> say error.message <ide> end <ide> end <ide> end <ide><path>railties/lib/rails/commands/credentials/credentials_command.rb <ide> def edit <ide> require_application! <ide> load_generators <ide> <del> ensure_editor_available(command: executable(:edit)) || (return) <del> <ide> ensure_encryption_key_has_been_added <ide> ensure_credentials_have_been_added <ide> ensure_diffing_driver_is_configured <ide> def ensure_credentials_have_been_added <ide> end <ide> <ide> def change_credentials_in_system_editor <del> catch_editing_exceptions do <add> using_system_editor do <ide> credentials.change { |tmp_path| system_editor(tmp_path) } <ide> say "File encrypted and saved." <ide> warn_if_credentials_are_invalid <ide> end <add> rescue ActiveSupport::EncryptedFile::MissingKeyError => error <add> say error.message <ide> rescue ActiveSupport::MessageEncryptor::InvalidMessage <ide> say "Couldn't decrypt #{content_path}. Perhaps you passed the wrong key?" <ide> end <ide><path>railties/lib/rails/commands/encrypted/encrypted_command.rb <ide> def help <ide> def edit(*) <ide> require_application! <ide> <del> ensure_editor_available(command: executable(:edit)) || (return) <ide> ensure_encryption_key_has_been_added <ide> ensure_encrypted_configuration_has_been_added <ide> <ide> def ensure_encrypted_configuration_has_been_added <ide> end <ide> <ide> def change_encrypted_configuration_in_system_editor <del> catch_editing_exceptions do <add> using_system_editor do <ide> encrypted_configuration.change { |tmp_path| system_editor(tmp_path) } <ide> say "File encrypted and saved." <ide> warn_if_encrypted_configuration_is_invalid <ide> end <add> rescue ActiveSupport::EncryptedFile::MissingKeyError => error <add> say error.message <ide> rescue ActiveSupport::MessageEncryptor::InvalidMessage <ide> say "Couldn't decrypt #{content_path}. Perhaps you passed the wrong key?" <ide> end <ide><path>railties/lib/rails/commands/secrets/secrets_command.rb <ide> <ide> require "active_support" <ide> require "rails/secrets" <add>require "rails/command/helpers/editor" <ide> <ide> module Rails <ide> module Command <ide> class SecretsCommand < Rails::Command::Base # :nodoc: <add> include Helpers::Editor <add> <ide> no_commands do <ide> def help <ide> say "Usage:\n #{self.class.banner}" <ide> def setup <ide> end <ide> <ide> def edit <del> if ENV["EDITOR"].to_s.empty? <del> say "No $EDITOR to open decrypted secrets in. Assign one like this:" <del> say "" <del> say %(EDITOR="mate --wait" #{executable(:edit)}) <del> say "" <del> say "For editors that fork and exit immediately, it's important to pass a wait flag," <del> say "otherwise the secrets will be saved immediately with no chance to edit." <del> <del> return <del> end <del> <ide> require_application_and_environment! <ide> <del> Rails::Secrets.read_for_editing do |tmp_path| <del> system("#{ENV["EDITOR"]} #{tmp_path}") <add> using_system_editor do <add> Rails::Secrets.read_for_editing { |tmp_path| system_editor(tmp_path) } <add> say "File encrypted and saved." <ide> end <del> <del> say "New secrets encrypted and saved." <del> rescue Interrupt <del> say "Aborted changing encrypted secrets: nothing saved." <ide> rescue Rails::Secrets::MissingKeyError => error <ide> say error.message <ide> rescue Errno::ENOENT => error <ide><path>railties/test/command/base_test.rb <ide> class Rails::Command::CustomBinCommand < Rails::Command::Base <ide> assert_equal "FOO custom_bin", Rails::Command::CustomBinCommand.executable <ide> end <ide> <add> test "#current_subcommand reflects current subcommand" do <add> class Rails::Command::LastSubcommandCommand < Rails::Command::Base <add> singleton_class.attr_accessor :last_subcommand <add> <add> def set_last_subcommand <add> self.class.last_subcommand = current_subcommand <add> end <add> <add> alias :foo :set_last_subcommand <add> alias :bar :set_last_subcommand <add> end <add> <add> Rails::Command.invoke("last_subcommand:foo") <add> assert_equal "foo", Rails::Command::LastSubcommandCommand.last_subcommand <add> <add> Rails::Command.invoke("last_subcommand:bar") <add> assert_equal "bar", Rails::Command::LastSubcommandCommand.last_subcommand <add> end <add> <ide> test "ARGV is populated" do <ide> class Rails::Command::ArgvCommand < Rails::Command::Base <ide> def check_populated(*args) <ide><path>railties/test/commands/secrets_test.rb <ide> class Rails::Command::SecretsCommandTest < ActiveSupport::TestCase <ide> teardown :teardown_app <ide> <ide> test "edit without editor gives hint" do <del> assert_match "No $EDITOR to open decrypted secrets in", run_edit_command(editor: "") <add> assert_match "No $EDITOR to open file in", run_edit_command(editor: "") <ide> end <ide> <ide> test "encrypted secrets are deprecated when using credentials" do
7
Python
Python
remove redundant logging in sftp hook
81be82bfb73f263ecd3b2d5f664e9c1ea751408a
<ide><path>airflow/providers/sftp/hooks/sftp.py <ide> def retrieve_file(self, remote_full_path: str, local_full_path: str) -> None: <ide> :type local_full_path: str <ide> """ <ide> conn = self.get_conn() <del> self.log.info('Retrieving file from FTP: %s', remote_full_path) <ide> conn.get(remote_full_path, local_full_path) <del> self.log.info('Finished retrieving file from FTP: %s', remote_full_path) <ide> <ide> def store_file(self, remote_full_path: str, local_full_path: str) -> None: <ide> """
1
Python
Python
remove double brackets
b2c863a3196150850d17548f25ee0575bccb8224
<ide><path>src/transformers/pipelines/audio_classification.py <ide> class AudioClassificationPipeline(Pipeline): <ide> [{'score': 0.997, 'label': '_unknown_'}, {'score': 0.002, 'label': 'left'}, {'score': 0.0, 'label': 'yes'}, {'score': 0.0, 'label': 'down'}, {'score': 0.0, 'label': 'stop'}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> <ide> This pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide><path>src/transformers/pipelines/automatic_speech_recognition.py <ide> class AutomaticSpeechRecognitionPipeline(ChunkPipeline): <ide> {'text': ' He hoped there would be stew for dinner, turnips and carrots and bruised potatoes and fat mutton pieces to be ladled out in thick, peppered flour fat and sauce.'} <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> Arguments: <ide> model ([`PreTrainedModel`] or [`TFPreTrainedModel`]): <ide><path>src/transformers/pipelines/conversational.py <ide> class ConversationalPipeline(Pipeline): <ide> "It's a comedy." <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This conversational pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"conversational"`. <ide><path>src/transformers/pipelines/depth_estimation.py <ide> class DepthEstimationPipeline(Pipeline): <ide> torch.Size([1, 384, 384]) <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> <ide> This depth estimation pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide><path>src/transformers/pipelines/document_question_answering.py <ide> class DocumentQuestionAnsweringPipeline(ChunkPipeline): <ide> [{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This document question answering pipeline can currently be loaded from [`pipeline`] using the following task <ide> identifier: `"document-question-answering"`. <ide><path>src/transformers/pipelines/feature_extraction.py <ide> class FeatureExtractionPipeline(Pipeline): <ide> torch.Size([1, 8, 768]) <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This feature extraction pipeline can currently be loaded from [`pipeline`] using the task identifier: <ide> `"feature-extraction"`. <ide><path>src/transformers/pipelines/fill_mask.py <ide> class FillMaskPipeline(Pipeline): <ide> [{'score': 0.042, 'token': 3291, 'token_str': 'problem', 'sequence': 'this is a simple problem.'}, {'score': 0.031, 'token': 3160, 'token_str': 'question', 'sequence': 'this is a simple question.'}, {'score': 0.03, 'token': 8522, 'token_str': 'equation', 'sequence': 'this is a simple equation.'}, {'score': 0.027, 'token': 2028, 'token_str': 'one', 'sequence': 'this is a simple one.'}, {'score': 0.024, 'token': 3627, 'token_str': 'rule', 'sequence': 'this is a simple rule.'}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This mask filling pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"fill-mask"`. <ide><path>src/transformers/pipelines/image_classification.py <ide> class ImageClassificationPipeline(Pipeline): <ide> [{'score': 0.442, 'label': 'macaw'}, {'score': 0.088, 'label': 'popinjay'}, {'score': 0.075, 'label': 'parrot'}, {'score': 0.073, 'label': 'parodist, lampooner'}, {'score': 0.046, 'label': 'poll, poll_parrot'}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This image classification pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"image-classification"`. <ide><path>src/transformers/pipelines/image_to_text.py <ide> class ImageToTextPipeline(Pipeline): <ide> [{'generated_text': 'two birds are standing next to each other '}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This image to text pipeline can currently be loaded from pipeline() using the following task identifier: <ide> "image-to-text". <ide><path>src/transformers/pipelines/object_detection.py <ide> class ObjectDetectionPipeline(Pipeline): <ide> >>> # x, y are expressed relative to the top left hand corner. <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This object detection pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"object-detection"`. <ide><path>src/transformers/pipelines/question_answering.py <ide> class QuestionAnsweringPipeline(ChunkPipeline): <ide> {'score': 0.9191, 'start': 34, 'end': 40, 'answer': 'Berlin'} <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This question answering pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"question-answering"`. <ide><path>src/transformers/pipelines/table_question_answering.py <ide> class TableQuestionAnsweringPipeline(Pipeline): <ide> {'answer': 'AVERAGE > 36542', 'coordinates': [(0, 1)], 'cells': ['36542'], 'aggregator': 'AVERAGE'} <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This tabular question answering pipeline can currently be loaded from [`pipeline`] using the following task <ide> identifier: `"table-question-answering"`. <ide><path>src/transformers/pipelines/text2text_generation.py <ide> class Text2TextGenerationPipeline(Pipeline): <ide> [{'generated_text': 'question: Who created the RuPERTa-base?'}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> <ide> This Text2TextGenerationPipeline pipeline can currently be loaded from [`pipeline`] using the following task <ide><path>src/transformers/pipelines/text_classification.py <ide> class TextClassificationPipeline(Pipeline): <ide> [{'label': 'NEGATIVE', 'score': 0.996}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This text classification pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"sentiment-analysis"` (for classifying sequences according to positive or negative sentiments). <ide><path>src/transformers/pipelines/text_generation.py <ide> class TextGenerationPipeline(Pipeline): <ide> >>> outputs = generator("My tart needs some", num_return_sequences=4, return_full_text=False) <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This language generation pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"text-generation"`. <ide><path>src/transformers/pipelines/token_classification.py <ide> class TokenClassificationPipeline(Pipeline): <ide> [{'entity_group': 'PRON', 'score': 0.999, 'word': 'my', 'start': 0, 'end': 2}, {'entity_group': 'NOUN', 'score': 0.997, 'word': 'name', 'start': 3, 'end': 7}, {'entity_group': 'AUX', 'score': 0.994, 'word': 'is', 'start': 8, 'end': 10}, {'entity_group': 'PROPN', 'score': 0.999, 'word': 'sarah', 'start': 11, 'end': 16}, {'entity_group': 'CCONJ', 'score': 0.999, 'word': 'and', 'start': 17, 'end': 20}, {'entity_group': 'PRON', 'score': 0.999, 'word': 'i', 'start': 21, 'end': 22}, {'entity_group': 'VERB', 'score': 0.998, 'word': 'live', 'start': 23, 'end': 27}, {'entity_group': 'ADP', 'score': 0.999, 'word': 'in', 'start': 28, 'end': 30}, {'entity_group': 'PROPN', 'score': 0.999, 'word': 'london', 'start': 31, 'end': 37}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This token recognition pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"ner"` (for predicting the classes of tokens in a sequence: person, organisation, location or miscellaneous). <ide><path>src/transformers/pipelines/visual_question_answering.py <ide> class VisualQuestionAnsweringPipeline(Pipeline): <ide> [{'score': 0.996, 'answer': 'no'}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This visual question answering pipeline can currently be loaded from [`pipeline`] using the following task <ide> identifiers: `"visual-question-answering", "vqa"`. <ide><path>src/transformers/pipelines/zero_shot_classification.py <ide> class ZeroShotClassificationPipeline(ChunkPipeline): <ide> {'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['english', 'german'], 'scores': [0.814, 0.186]} <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This NLI pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"zero-shot-classification"`. <ide><path>src/transformers/pipelines/zero_shot_image_classification.py <ide> class ZeroShotImageClassificationPipeline(ChunkPipeline): <ide> [{'score': 0.996, 'label': 'black and white'}, {'score': 0.003, 'label': 'photorealist'}, {'score': 0.0, 'label': 'painting'}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This image classification pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"zero-shot-image-classification"`. <ide><path>src/transformers/pipelines/zero_shot_object_detection.py <ide> class ZeroShotObjectDetectionPipeline(ChunkPipeline): <ide> [{'score': 0.119, 'label': 'bird', 'box': {'xmin': 71, 'ymin': 170, 'xmax': 410, 'ymax': 508}}] <ide> ``` <ide> <del> [Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial) <add> Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial) <ide> <ide> This object detection pipeline can currently be loaded from [`pipeline`] using the following task identifier: <ide> `"zero-shot-object-detection"`.
20
Javascript
Javascript
remove references to deletion flag
11a983fc76192037798d2f93dedf09af97f99884
<ide><path>packages/react-reconciler/src/ReactChildFiber.new.js <ide> import type {Fiber} from './ReactInternalTypes'; <ide> import type {Lanes} from './ReactFiberLane.new'; <ide> <ide> import getComponentName from 'shared/getComponentName'; <del>import { <del> Deletion, <del> ChildDeletion, <del> Placement, <del> StaticMask, <del>} from './ReactFiberFlags'; <add>import {Placement, ChildDeletion} from './ReactFiberFlags'; <ide> import { <ide> getIteratorFn, <ide> REACT_ELEMENT_TYPE, <ide> function ChildReconciler(shouldTrackSideEffects) { <ide> returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; <ide> } <ide> childToDelete.nextEffect = null; <del> childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion; <ide> <ide> const deletions = returnFiber.deletions; <ide> if (deletions === null) { <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.new.js <ide> import { <ide> DidCapture, <ide> Update, <ide> Ref, <del> Deletion, <ide> ChildDeletion, <ide> ForceUpdateForLegacySuspense, <ide> StaticMask, <ide> function updateSuspensePrimaryChildren( <ide> if (currentFallbackChildFragment !== null) { <ide> // Delete the fallback child fragment <ide> currentFallbackChildFragment.nextEffect = null; <del> currentFallbackChildFragment.flags = <del> (currentFallbackChildFragment.flags & StaticMask) | Deletion; <ide> workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; <ide> const deletions = workInProgress.deletions; <ide> if (deletions === null) { <ide> function remountFiber( <ide> returnFiber.firstEffect = returnFiber.lastEffect = current; <ide> } <ide> current.nextEffect = null; <del> current.flags = (current.flags & StaticMask) | Deletion; <ide> <ide> const deletions = returnFiber.deletions; <ide> if (deletions === null) { <ide><path>packages/react-reconciler/src/ReactFiberHydrationContext.new.js <ide> import { <ide> HostRoot, <ide> SuspenseComponent, <ide> } from './ReactWorkTags'; <del>import { <del> Deletion, <del> ChildDeletion, <del> Placement, <del> Hydrating, <del> StaticMask, <del>} from './ReactFiberFlags'; <add>import {ChildDeletion, Placement, Hydrating} from './ReactFiberFlags'; <ide> import invariant from 'shared/invariant'; <ide> <ide> import { <ide> function deleteHydratableInstance( <ide> const childToDelete = createFiberFromHostInstanceForDeletion(); <ide> childToDelete.stateNode = instance; <ide> childToDelete.return = returnFiber; <del> childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion; <ide> <ide> // This might seem like it belongs on progressedFirstDeletion. However, <ide> // these children are not part of the reconciliation list of children.
3
Javascript
Javascript
adjust rendering of large numbers
15cbc61a6e97162b93dadd680f7a2a5c2d7c7be0
<ide><path>website/assets/js/util.js <ide> export const convertNumber = (num = 0, separator = ',') => <ide> * @param {number|string} num - The number to convert. <ide> * @param {number} fixed - Number of decimals. <ide> */ <del>export const abbrNumber = (num = 0, fixed = 2) => { <add>export const abbrNumber = (num = 0, fixed = 1) => { <ide> const suffixes = ['', 'k', 'm', 'b', 't']; <ide> if (num === null || num === 0) return 0; <ide> const b = num.toPrecision(2).split('e'); <ide> const k = (b.length === 1) ? 0 : Math.floor(Math.min(b[1].slice(1), 14) / 3); <del> const c = (k < 1) ? num.toFixed(fixed) : (num / Math.pow(10, k * 3)).toFixed(fixed + 1); <add> const n = (k < 1) ? num : num / Math.pow(10, k * 3); <add> const c = (k >= 1 && n >= 100 ) ? Math.round(n) : n.toFixed(fixed); <ide> return (c < 0 ? c : Math.abs(c)) + suffixes[k]; <ide> }
1
Go
Go
remove unused reflink files
055bfb699bb232c7e490c38d3a71c81870781c74
<ide><path>reflink_copy_linux.go <del>// +build amd64 <del> <del>package docker <del> <del>// FIXME: This could be easily rewritten in pure Go <del> <del>/* <del>#include <sys/ioctl.h> <del>#include <linux/fs.h> <del>#include <errno.h> <del> <del>// See linux.git/fs/btrfs/ioctl.h <del>#define BTRFS_IOCTL_MAGIC 0x94 <del>#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int) <del> <del>int <del>btrfs_reflink(int fd_out, int fd_in) <del>{ <del> int res; <del> res = ioctl(fd_out, BTRFS_IOC_CLONE, fd_in); <del> if (res < 0) <del> return errno; <del> return 0; <del>} <del> <del>*/ <del>import "C" <del> <del>import ( <del> "io" <del> "os" <del> "syscall" <del>) <del> <del>// FIXME: Move this to btrfs package? <del> <del>func BtrfsReflink(fd_out, fd_in uintptr) error { <del> res := C.btrfs_reflink(C.int(fd_out), C.int(fd_in)) <del> if res != 0 { <del> return syscall.Errno(res) <del> } <del> return nil <del>} <del> <del>func CopyFile(dstFile, srcFile *os.File) error { <del> err := BtrfsReflink(dstFile.Fd(), srcFile.Fd()) <del> if err == nil { <del> return nil <del> } <del> <del> // Fall back to normal copy <del> // FIXME: Check the return of Copy and compare with dstFile.Stat().Size <del> _, err = io.Copy(dstFile, srcFile) <del> return err <del>} <ide><path>reflink_copy_unsupported.go <del>// +build !linux !amd64 <del> <del>package docker <del> <del>import ( <del> "io" <del> "os" <del>) <del> <del>func CopyFile(dstFile, srcFile *os.File) error { <del> // No BTRFS reflink suppport, Fall back to normal copy <del> <del> // FIXME: Check the return of Copy and compare with dstFile.Stat().Size <del> _, err := io.Copy(dstFile, srcFile) <del> return err <del>}
2
Python
Python
add tests for new randint functionality
5aca879e18541eff3daf506786b07a950a075b37
<ide><path>numpy/random/tests/test_random.py <ide> def test_negative_binomial(self): <ide> # arguments without truncation. <ide> self.prng.negative_binomial(0.5, 0.5) <ide> <add>class TestRandint(TestCase): <add> <add> rfunc = np.random.randint <add> <add> # valid integer/boolean types <add> itype = [np.bool, np.int8, np.uint8, np.int16, np.uint16, <add> np.int32, np.uint32, np.int64, np.uint64] <add> <add> def test_unsupported_type(self): <add> assert_raises(TypeError, self.rfunc, 1, dtype=np.float) <add> <add> def test_bounds_checking(self): <add> for dt in self.itype: <add> lbnd = 0 if dt is np.bool else np.iinfo(dt).min <add> ubnd = 2 if dt is np.bool else np.iinfo(dt).max + 1 <add> assert_raises(ValueError, self.rfunc, lbnd - 1 , ubnd, dtype=dt) <add> assert_raises(ValueError, self.rfunc, lbnd , ubnd + 1, dtype=dt) <add> assert_raises(ValueError, self.rfunc, ubnd , lbnd, dtype=dt) <add> assert_raises(ValueError, self.rfunc, 1 , 0, dtype=dt) <add> <add> def test_rng_zero_and_extremes(self): <add> for dt in self.itype: <add> lbnd = 0 if dt is np.bool else np.iinfo(dt).min <add> ubnd = 2 if dt is np.bool else np.iinfo(dt).max + 1 <add> tgt = ubnd - 1 <add> assert_equal(self.rfunc(tgt, tgt + 1, size=1000, dtype=dt), tgt) <add> tgt = lbnd <add> assert_equal(self.rfunc(tgt, tgt + 1, size=1000, dtype=dt), tgt) <add> tgt = (lbnd + ubnd)//2 <add> assert_equal(self.rfunc(tgt, tgt + 1, size=1000, dtype=dt), tgt) <add> <add> def test_in_bounds_fuzz(self): <add> # Don't use fixed seed <add> np.random.seed() <add> for dt in self.itype[1:]: <add> for ubnd in [4, 8, 16]: <add> vals = self.rfunc(2, ubnd, size=2**16, dtype=dt) <add> assert_(vals.max() < ubnd) <add> assert_(vals.min() >= 2) <add> vals = self.rfunc(0, 2, size=2**16, dtype=np.bool) <add> assert_(vals.max() < 2) <add> assert_(vals.min() >= 0) <add> <add> def test_repeatability(self): <add> import hashlib <add> # We use a md5 hash of generated sequences of 1000 samples <add> # in the range [0, 6) for all but np.bool, where the range <add> # is [0, 2). Hashes are for little endian numbers. <add> tgt = {'bool': '7dd3170d7aa461d201a65f8bcf3944b0', <add> 'int16': '1b7741b80964bb190c50d541dca1cac1', <add> 'int32': '4dc9fcc2b395577ebb51793e58ed1a05', <add> 'int64': '17db902806f448331b5a758d7d2ee672', <add> 'int8': '27dd30c4e08a797063dffac2490b0be6', <add> 'uint16': '1b7741b80964bb190c50d541dca1cac1', <add> 'uint32': '4dc9fcc2b395577ebb51793e58ed1a05', <add> 'uint64': '17db902806f448331b5a758d7d2ee672', <add> 'uint8': '27dd30c4e08a797063dffac2490b0be6'} <add> <add> for dt in self.itype[1:]: <add> np.random.seed(1234) <add> <add> # view as little endian for hash <add> if sys.byteorder == 'little': <add> val = self.rfunc(0, 6, size=1000, dtype=dt) <add> else: <add> val = self.rfunc(0, 6, size=1000, dtype=dt).byteswap() <add> <add> res = hashlib.md5(val.view(np.int8)).hexdigest() <add> assert_(tgt[np.dtype(dt).name] == res) <add> <add> # bools do not depend on endianess <add> np.random.seed(1234) <add> val = self.rfunc(0, 2, size=1000, dtype=np.bool).view(np.int8) <add> res = hashlib.md5(val).hexdigest() <add> assert_(tgt[np.dtype(np.bool).name] == res) <add> <add> <ide> class TestRandomDist(TestCase): <ide> # Make sure the random distribution returns the correct value for a <ide> # given seed
1
PHP
PHP
add tuple comparison integration tests
b2619615509509b6da95dcf00c5212a0a4fb41e2
<ide><path>tests/TestCase/Database/QueryTests/TupleComparisonQueryTest.php <ide> <ide> namespace Cake\Test\TestCase\Database\QueryTests; <ide> <add>use Cake\Database\Driver\Mysql; <add>use Cake\Database\Driver\Postgres; <ide> use Cake\Database\Driver\Sqlite; <ide> use Cake\Database\Driver\Sqlserver; <ide> use Cake\Database\Expression\TupleComparison; <ide> use Cake\TestSuite\TestCase; <add>use PDOException; <ide> use RuntimeException; <ide> <ide> /** <ide> public function testTransformWithInvalidOperator(): void <ide> ->disableHydration() <ide> ->toArray(); <ide> } <add> <add> public function testInWithMultiResultSubquery(): void <add> { <add> $articles = $this->getTableLocator()->get('Articles'); <add> <add> $query = $articles <add> ->find() <add> ->select(['Articles.id', 'Articles.author_id']) <add> ->where([ <add> new TupleComparison( <add> ['Articles.id', 'Articles.author_id'], <add> $articles <add> ->subquery() <add> ->select(['ArticlesAlias.id', 'ArticlesAlias.author_id']) <add> ->from(['ArticlesAlias' => $articles->getTable()]) <add> ->where(['ArticlesAlias.author_id' => 1]), <add> [], <add> 'IN' <add> ), <add> ]) <add> ->orderAsc('Articles.id') <add> ->disableHydration(); <add> <add> $expected = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> ], <add> [ <add> 'id' => 3, <add> 'author_id' => 1, <add> ], <add> ]; <add> $this->assertSame($expected, $query->toArray()); <add> } <add> <add> public function testInWithSingleResultSubquery(): void <add> { <add> $articles = $this->getTableLocator()->get('Articles'); <add> <add> $query = $articles <add> ->find() <add> ->select(['Articles.id', 'Articles.author_id']) <add> ->where([ <add> new TupleComparison( <add> ['Articles.id', 'Articles.author_id'], <add> $articles <add> ->subquery() <add> ->select(['ArticlesAlias.id', 'ArticlesAlias.author_id']) <add> ->from(['ArticlesAlias' => $articles->getTable()]) <add> ->where(['ArticlesAlias.id' => 1]), <add> [], <add> 'IN' <add> ), <add> ]) <add> ->disableHydration(); <add> <add> $expected = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> ], <add> ]; <add> $this->assertSame($expected, $query->toArray()); <add> } <add> <add> public function testInWithMultiArrayValues(): void <add> { <add> $articles = $this->getTableLocator()->get('Articles'); <add> <add> $query = $articles <add> ->find() <add> ->select(['Articles.id', 'Articles.author_id']) <add> ->where([ <add> new TupleComparison( <add> ['Articles.id', 'Articles.author_id'], <add> [[1, 1], [3, 1]], <add> ['integer', 'integer'], <add> 'IN' <add> ), <add> ]) <add> ->orderAsc('Articles.id') <add> ->disableHydration(); <add> <add> $expected = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> ], <add> [ <add> 'id' => 3, <add> 'author_id' => 1, <add> ], <add> ]; <add> $this->assertSame($expected, $query->toArray()); <add> } <add> <add> public function testEqualWithMultiResultSubquery(): void <add> { <add> $articles = $this->getTableLocator()->get('Articles'); <add> <add> $driver = $articles->getConnection()->getDriver(); <add> if ( <add> $driver instanceof Mysql || <add> $driver instanceof Postgres <add> ) { <add> $this->expectException(PDOException::class); <add> $this->expectExceptionMessageMatches('/cardinality violation/i'); <add> } else { <add> // Due to the way tuple comparisons are being translated, the DBMS will <add> // not run into a cardinality violation scenario. <add> $this->markTestSkipped( <add> 'Sqlite and Sqlserver currently do not fail with subqueries returning incompatible results.' <add> ); <add> } <add> <add> $articles <add> ->find() <add> ->select(['Articles.id', 'Articles.author_id']) <add> ->where([ <add> new TupleComparison( <add> ['Articles.id', 'Articles.author_id'], <add> $articles <add> ->subquery() <add> ->select(['ArticlesAlias.id', 'ArticlesAlias.author_id']) <add> ->from(['ArticlesAlias' => $articles->getTable()]) <add> ->where(['ArticlesAlias.author_id' => 1]), <add> [], <add> '=' <add> ), <add> ]) <add> ->orderAsc('Articles.id') <add> ->disableHydration() <add> ->toArray(); <add> } <add> <add> public function testEqualWithSingleResultSubquery(): void <add> { <add> $articles = $this->getTableLocator()->get('Articles'); <add> <add> $query = $articles <add> ->find() <add> ->select(['Articles.id', 'Articles.author_id']) <add> ->where([ <add> new TupleComparison( <add> ['Articles.id', 'Articles.author_id'], <add> $articles <add> ->subquery() <add> ->select(['ArticlesAlias.id', 'ArticlesAlias.author_id']) <add> ->from(['ArticlesAlias' => $articles->getTable()]) <add> ->where(['ArticlesAlias.id' => 1]), <add> [], <add> '=' <add> ), <add> ]) <add> ->disableHydration(); <add> <add> $expected = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> ], <add> ]; <add> $this->assertSame($expected, $query->toArray()); <add> } <add> <add> public function testEqualWithSingleArrayValue(): void <add> { <add> $articles = $this->getTableLocator()->get('Articles'); <add> <add> $query = $articles <add> ->find() <add> ->select(['Articles.id', 'Articles.author_id']) <add> ->where([ <add> new TupleComparison( <add> ['Articles.id', 'Articles.author_id'], <add> [1, 1], <add> ['integer', 'integer'], <add> '=' <add> ), <add> ]) <add> ->orderAsc('Articles.id') <add> ->disableHydration(); <add> <add> $expected = [ <add> [ <add> 'id' => 1, <add> 'author_id' => 1, <add> ], <add> ]; <add> $this->assertSame($expected, $query->toArray()); <add> } <ide> } <ide><path>tests/TestCase/ORM/QueryRegressionTest.php <ide> use Cake\Database\Driver\Sqlserver; <ide> use Cake\Database\Expression\ComparisonExpression; <ide> use Cake\Database\Expression\QueryExpression; <del>use Cake\Database\Expression\TupleComparison; <ide> use Cake\Datasource\EntityInterface; <ide> use Cake\Event\EventInterface; <ide> use Cake\I18n\FrozenTime; <ide> public function testTranspiledFunctionExpressionWithCorrelatedSubquery(): void <ide> $result = $query->first()->get('value'); <ide> $this->assertSame('mariano appended', $result); <ide> } <del> <del> /** <del> * Tests that tuple comparisons can use multiple fields and subqueries <del> * for an `IN` lookup of multiple results. <del> * <del> * This test is specifically relevant in the context of Sqlite and <del> * Sqlserver, for which the tuple comparison will be transformed when <del> * composite keys are used. <del> * <del> * @see \Cake\Database\Driver\TupleComparisonTranslatorTrait::_transformTupleComparison() <del> */ <del> public function testTupleComparisonWithCompositeKeysAndSubqueries(): void <del> { <del> $articles = $this->getTableLocator()->get('Articles'); <del> <del> $query = $articles <del> ->find() <del> ->select(['id', 'author_id']) <del> ->where( <del> new TupleComparison( <del> ['Articles.id', 'Articles.author_id'], <del> $articles <del> ->subquery() <del> ->select(['ArticlesAlias.id', 'ArticlesAlias.author_id']) <del> ->from(['ArticlesAlias' => $articles->getTable()]) <del> ->where(['ArticlesAlias.author_id' => 1]), <del> [], <del> 'IN' <del> ) <del> ) <del> ->orderAsc('id') <del> ->disableHydration(); <del> <del> $expected = [ <del> [ <del> 'id' => 1, <del> 'author_id' => 1, <del> ], <del> [ <del> 'id' => 3, <del> 'author_id' => 1, <del> ], <del> ]; <del> $this->assertSame($expected, $query->toArray()); <del> } <ide> }
2
Text
Text
fix typo in docker links chapter of user guide
932cc230814ba642c493c77d05932f63c0ef3e7f
<ide><path>docs/sources/userguide/dockerlinks.md <ide> port. Where `<name>` is the alias name specified in the `--link` parameter <ide> is either `TCP` or `UDP`. The format of the URL will be: <ide> `<protocol>://<container_ip_address>:<port>` <ide> (e.g. `tcp://172.17.0.82:8080`). This URL will then be <del>split into the following 3 environment variables for convinience: <add>split into the following 3 environment variables for convenience: <ide> * `<name>_PORT_<port>_<protocol>_ADDR` will contain just the IP address <ide> from the URL (e.g. `WEBDB_PORT_8080_TCP_ADDR=172.17.0.82`). <ide> * `<name>_PORT_<port>_<protocol>_PORT` will contain just the port number
1
Javascript
Javascript
fix typo when running an unknown simulator
145692a94053c8a3f4dda2ff6d337062ad1d9dde
<ide><path>local-cli/runIOS/runIOS.js <ide> function runOnSimulator(xcodeProject, args, inferredSchemeName, scheme){ <ide> <ide> const selectedSimulator = findMatchingSimulator(simulators, args.simulator); <ide> if (!selectedSimulator) { <del> throw new Error(`Cound't find ${args.simulator} simulator`); <add> throw new Error(`Could not find ${args.simulator} simulator`); <ide> } <ide> <ide> const simulatorFullName = formattedDeviceName(selectedSimulator);
1
Python
Python
fix lint errors
2fd16716336d4168d52f84ffb0fff7ee5ab2e730
<ide><path>official/resnet/keras/keras_common.py <ide> def get_strategy_scope(strategy): <ide> if strategy: <ide> strategy_scope = strategy.scope() <ide> else: <del> strategy_scope = keras_common.DummyContextManager() <add> strategy_scope = DummyContextManager() <ide> <ide> return strategy_scope <ide> <ide> <ide> class DummyContextManager(object): <add> <ide> def __enter__(self): <ide> pass <ide>
1
Java
Java
refine uritemplate match pattern
c60313de3f0797f987bc7a392d75aebd17020158
<ide><path>spring-web/src/main/java/org/springframework/web/util/UriTemplate.java <ide> else if (c == '}') { <ide> String variable = builder.toString(); <ide> int idx = variable.indexOf(':'); <ide> if (idx == -1) { <del> pattern.append("(.*)"); <add> pattern.append("([^/]*)"); <ide> variableNames.add(variable); <ide> } <ide> else { <ide><path>spring-web/src/test/java/org/springframework/web/util/UriTemplateTests.java <ide> public void matchCustomRegex() throws Exception { <ide> assertEquals("Invalid match", expected, result); <ide> } <ide> <del> // SPR-13627 <del> <del> @Test <add> @Test // SPR-13627 <ide> public void matchCustomRegexWithNestedCurlyBraces() throws Exception { <ide> UriTemplate template = new UriTemplate("/site.{domain:co.[a-z]{2}}"); <ide> Map<String, String> result = template.match("/site.co.eu"); <ide> public void matchMultipleInOneSegment() throws Exception { <ide> assertEquals("Invalid match", expected, result); <ide> } <ide> <add> @Test // SPR-16169 <add> public void matchWithMultipleSegmentsAtTheEnd() { <add> UriTemplate template = new UriTemplate("/account/{accountId}"); <add> assertFalse(template.matches("/account/15/alias/5")); <add> } <add> <ide> @Test <ide> public void queryVariables() throws Exception { <ide> UriTemplate template = new UriTemplate("/search?q={query}"); <ide> public void fragments() throws Exception { <ide> assertTrue(template.matches("/search?query=foo#bar")); <ide> } <ide> <del> // SPR-13705 <del> <del> @Test <add> @Test // SPR-13705 <ide> public void matchesWithSlashAtTheEnd() { <ide> UriTemplate uriTemplate = new UriTemplate("/test/"); <ide> assertTrue(uriTemplate.matches("/test/"));
2
Javascript
Javascript
add signal check to test-esm-cjs-main
dbdfc5d656dc05d23a48aeb656454040c20217d8
<ide><path>test/es-module/test-esm-cjs-main.js <ide> child.stdout.on('data', (data) => { <ide> assert.strictEqual(data.toString(), 'executed\n'); <ide> validatedExecution = true; <ide> }); <del>child.on('close', common.mustCall((code, stdout) => { <add>child.on('close', common.mustCall((code, signal) => { <ide> assert.strictEqual(validatedExecution, true); <ide> assert.strictEqual(code, 0); <add> assert.strictEqual(signal, null); <ide> }));
1
Java
Java
delete unused imports
31a93792b27be268255cb4aba3c8ab6e4e4db7ff
<ide><path>spring-test/src/test/java/org/springframework/test/web/client/MockRestServiceServerTests.java <ide> */ <ide> package org.springframework.test.web.client; <ide> <del>import org.hamcrest.Matchers; <ide> import org.junit.Test; <ide> <ide> import org.springframework.test.web.client.MockRestServiceServer.MockRestServiceServerBuilder; <ide> import org.springframework.web.client.RestTemplate; <ide> <del>import static org.junit.Assert.assertTrue; <del>import static org.junit.Assert.fail; <ide> import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; <ide> import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; <ide>
1
Javascript
Javascript
ignore code section in generator
3ade8a0a6fb2e7c6f2a2b1887be91a21c4880b98
<ide><path>lib/wasm/WebAssemblyGenerator.js <ide> class WebAssemblyGenerator extends Generator { <ide> generate(module) { <ide> const bin = module.originalSource().source(); <ide> <add> // FIXME(sven): this module is parsed twice, we could preserve the AST <add> // from wasm/WebAssemblyParser.js <ide> const ast = decode(bin, { <del> ignoreDataSection: true <add> ignoreDataSection: true, <add> ignoreCodeSection: true <ide> }); <ide> <ide> const importedGlobals = getImportedGlobals(ast);
1
Text
Text
improve upgrade instructions for bootsnap
0d92cb663215cd8f2131cffe59a1d1bc979e5025
<ide><path>guides/source/upgrading_ruby_on_rails.md <ide> For more information on changes made to Rails 5.2 please see the [release notes] <ide> ### Bootsnap <ide> <ide> Rails 5.2 adds bootsnap gem in the [newly generated app's Gemfile](https://github.com/rails/rails/pull/29313). <del>The `app:update` command sets it up in `boot.rb`. If you want to use it, then add it in the Gemfile, <del>otherwise change the `boot.rb` to not use bootsnap. <add>The `app:update` command sets it up in `boot.rb`. If you want to use it, then add it in the Gemfile: <add> <add>```ruby <add># Reduces boot times through caching; required in config/boot.rb <add>gem 'bootsnap', require: false <add>``` <add> <add>Otherwise change the `boot.rb` to not use bootsnap. <ide> <ide> ### Expiry in signed or encrypted cookie is now embedded in the cookies values <ide>
1