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
|
fix misspelling in mailer fake implementation
|
3543314ce05a09d40a71bd43c89080084d3a1620
|
<ide><path>src/Illuminate/Support/Testing/Fakes/MailFake.php
<ide> public function bcc($users)
<ide> }
<ide>
<ide> /**
<del> * Send a new message when only a raw text part.
<add> * Send a new message with only a raw text part.
<ide> *
<ide> * @param string $text
<ide> * @param \Closure|string $callback
| 1
|
PHP
|
PHP
|
allow schema path on fresh
|
6b14a77eec4f70ae86fbf3570c5318c296caa8dc
|
<ide><path>src/Illuminate/Database/Console/Migrations/FreshCommand.php
<ide> public function handle()
<ide> '--database' => $database,
<ide> '--path' => $this->input->getOption('path'),
<ide> '--realpath' => $this->input->getOption('realpath'),
<add> '--schema-path' => $this->input->getOption('schema-path'),
<ide> '--force' => true,
<ide> '--step' => $this->option('step'),
<ide> ]));
<ide> protected function getOptions()
<ide> ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
<ide> ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'],
<ide> ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'],
<add> ['schema-path', null, InputOption::VALUE_OPTIONAL, 'The path to a schema dump file'],
<ide> ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'],
<ide> ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'],
<ide> ['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'],
| 1
|
Javascript
|
Javascript
|
fix bogus errno reporting
|
5d97d727536b33dfca6fc582033aed64f921f65f
|
<ide><path>lib/net.js
<ide> Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
<ide> r = self._handle.listen(backlog || 511);
<ide>
<ide> if (r) {
<add> var ex = errnoException(errno, 'listen');
<ide> self._handle.close();
<ide> self._handle = null;
<ide> process.nextTick(function() {
<del> self.emit('error', errnoException(errno, 'listen'));
<add> self.emit('error', ex);
<ide> });
<ide> return;
<ide> }
| 1
|
Python
|
Python
|
improve documentation formatting
|
0307f89d48368a39ed97a252f9faed3c7bf64446
|
<ide><path>numpy/lib/function_base.py
<ide> def copy(a, order='K', subok=False):
<ide> >>> b[0] = 3
<ide> >>> b
<ide> array([3, 2, 3])
<del>
<add>
<ide> Note that np.copy is a shallow copy and will not copy object
<ide> elements within arrays. This is mainly important for arrays
<ide> containing Python objects. The new array will contain the
<ide> def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue, *,
<ide> relationship between the correlation coefficient matrix, `R`, and the
<ide> covariance matrix, `C`, is
<ide>
<del> .. math:: R_{ij} = \\frac{ C_{ij} } { \\sqrt{ C_{ii} * C_{jj} } }
<add> .. math:: R_{ij} = \\frac{ C_{ij} } { \\sqrt{ C_{ii} C_{jj} } }
<ide>
<ide> The values of `R` are between -1 and 1, inclusive.
<ide>
<ide> def percentile(a,
<ide> inverted_cdf:
<ide> method 1 of H&F [1]_.
<ide> This method gives discontinuous results:
<add>
<ide> * if g > 0 ; then take j
<ide> * if g = 0 ; then take i
<ide>
<ide> averaged_inverted_cdf:
<ide> method 2 of H&F [1]_.
<ide> This method give discontinuous results:
<add>
<ide> * if g > 0 ; then take j
<ide> * if g = 0 ; then average between bounds
<ide>
<ide> closest_observation:
<ide> method 3 of H&F [1]_.
<ide> This method give discontinuous results:
<add>
<ide> * if g > 0 ; then take j
<ide> * if g = 0 and index is odd ; then take j
<ide> * if g = 0 and index is even ; then take i
<ide>
<ide> interpolated_inverted_cdf:
<ide> method 4 of H&F [1]_.
<ide> This method give continuous results using:
<add>
<ide> * alpha = 0
<ide> * beta = 1
<ide>
<ide> hazen:
<ide> method 5 of H&F [1]_.
<ide> This method give continuous results using:
<add>
<ide> * alpha = 1/2
<ide> * beta = 1/2
<ide>
<ide> weibull:
<ide> method 6 of H&F [1]_.
<ide> This method give continuous results using:
<add>
<ide> * alpha = 0
<ide> * beta = 0
<ide>
<ide> linear:
<ide> method 7 of H&F [1]_.
<ide> This method give continuous results using:
<add>
<ide> * alpha = 1
<ide> * beta = 1
<ide>
<ide> def percentile(a,
<ide> This method is probably the best method if the sample
<ide> distribution function is unknown (see reference).
<ide> This method give continuous results using:
<add>
<ide> * alpha = 1/3
<ide> * beta = 1/3
<ide>
<ide> def percentile(a,
<ide> This method is probably the best method if the sample
<ide> distribution function is known to be normal.
<ide> This method give continuous results using:
<add>
<ide> * alpha = 3/8
<ide> * beta = 3/8
<ide>
<ide> def quantile(a,
<ide> inverted_cdf:
<ide> method 1 of H&F [1]_.
<ide> This method gives discontinuous results:
<add>
<ide> * if g > 0 ; then take j
<ide> * if g = 0 ; then take i
<ide>
<ide> averaged_inverted_cdf:
<ide> method 2 of H&F [1]_.
<ide> This method gives discontinuous results:
<add>
<ide> * if g > 0 ; then take j
<ide> * if g = 0 ; then average between bounds
<ide>
<ide> closest_observation:
<ide> method 3 of H&F [1]_.
<ide> This method gives discontinuous results:
<add>
<ide> * if g > 0 ; then take j
<ide> * if g = 0 and index is odd ; then take j
<ide> * if g = 0 and index is even ; then take i
<ide>
<ide> interpolated_inverted_cdf:
<ide> method 4 of H&F [1]_.
<ide> This method gives continuous results using:
<add>
<ide> * alpha = 0
<ide> * beta = 1
<ide>
<ide> hazen:
<ide> method 5 of H&F [1]_.
<ide> This method gives continuous results using:
<add>
<ide> * alpha = 1/2
<ide> * beta = 1/2
<ide>
<ide> weibull:
<ide> method 6 of H&F [1]_.
<ide> This method gives continuous results using:
<add>
<ide> * alpha = 0
<ide> * beta = 0
<ide>
<ide> linear:
<ide> method 7 of H&F [1]_.
<ide> This method gives continuous results using:
<add>
<ide> * alpha = 1
<ide> * beta = 1
<ide>
<ide> def quantile(a,
<ide> This method is probably the best method if the sample
<ide> distribution function is unknown (see reference).
<ide> This method gives continuous results using:
<add>
<ide> * alpha = 1/3
<ide> * beta = 1/3
<ide>
<ide> def quantile(a,
<ide> This method is probably the best method if the sample
<ide> distribution function is known to be normal.
<ide> This method gives continuous results using:
<add>
<ide> * alpha = 3/8
<ide> * beta = 3/8
<ide>
<ide><path>numpy/lib/histograms.py
<ide> def histogram_bin_edges(a, bins=10, range=None, weights=None):
<ide> below, :math:`h` is the binwidth and :math:`n_h` is the number of
<ide> bins. All estimators that compute bin counts are recast to bin width
<ide> using the `ptp` of the data. The final bin count is obtained from
<del> ``np.round(np.ceil(range / h))``. The final bin width is often less
<add> ``np.round(np.ceil(range / h))``. The final bin width is often less
<ide> than what is returned by the estimators below.
<ide>
<ide> 'auto' (maximum of the 'sturges' and 'fd' estimators)
<ide> def histogram_bin_edges(a, bins=10, range=None, weights=None):
<ide> datasets. The IQR is very robust to outliers.
<ide>
<ide> 'scott'
<del> .. math:: h = \sigma \sqrt[3]{\frac{24 * \sqrt{\pi}}{n}}
<add> .. math:: h = \sigma \sqrt[3]{\frac{24 \sqrt{\pi}}{n}}
<ide>
<ide> The binwidth is proportional to the standard deviation of the
<ide> data and inversely proportional to cube root of ``x.size``. Can
<ide> def histogram_bin_edges(a, bins=10, range=None, weights=None):
<ide> does not take into account data variability.
<ide>
<ide> 'sturges'
<del> .. math:: n_h = \log _{2}n+1
<add> .. math:: n_h = \log _{2}(n) + 1
<ide>
<ide> The number of bins is the base 2 log of ``a.size``. This
<ide> estimator assumes normality of data and is too conservative for
<ide> def histogram_bin_edges(a, bins=10, range=None, weights=None):
<ide>
<ide> 'doane'
<ide> .. math:: n_h = 1 + \log_{2}(n) +
<del> \log_{2}(1 + \frac{|g_1|}{\sigma_{g_1}})
<add> \log_{2}\left(1 + \frac{|g_1|}{\sigma_{g_1}}\right)
<ide>
<del> g_1 = mean[(\frac{x - \mu}{\sigma})^3]
<add> g_1 = mean\left[\left(\frac{x - \mu}{\sigma}\right)^3\right]
<ide>
<ide> \sigma_{g_1} = \sqrt{\frac{6(n - 2)}{(n + 1)(n + 3)}}
<ide>
<ide> def histogramdd(sample, bins=10, range=None, normed=None, weights=None,
<ide> smin, smax = _get_outer_edges(sample[:,i], range[i])
<ide> try:
<ide> n = operator.index(bins[i])
<del>
<add>
<ide> except TypeError as e:
<ide> raise TypeError(
<ide> "`bins[{}]` must be an integer, when a scalar".format(i)
<ide> ) from e
<del>
<del> edges[i] = np.linspace(smin, smax, n + 1)
<add>
<add> edges[i] = np.linspace(smin, smax, n + 1)
<ide> elif np.ndim(bins[i]) == 1:
<ide> edges[i] = np.asarray(bins[i])
<ide> if np.any(edges[i][:-1] > edges[i][1:]):
| 2
|
Python
|
Python
|
add missing parameter dtype
|
91ad52244a7d4670b9569f46c857020eda1d0dc7
|
<ide><path>keras/backend/cntk_backend.py
<ide> def truncated_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
<ide> stddev, seed=seed), dtype=dtype)
<ide>
<ide>
<del>def zeros_like(x, dtype=None, name=None):
<del> return x * 0
<del>
<del>
<ide> def dtype(x):
<ide> return _convert_dtype_string(x.dtype)
<ide>
<ide> def eye(size, dtype=None, name=None):
<ide> return variable(np.eye(size), dtype, name)
<ide>
<ide>
<del>def ones_like(x, name=None):
<add>def zeros_like(x, dtype=None, name=None):
<add> return x * 0
<add>
<add>
<add>def ones_like(x, dtype=None, name=None):
<ide> return zeros_like(x) + 1
<ide>
<ide>
| 1
|
PHP
|
PHP
|
fix variable typo in collection
|
11ed2b19166c20e15866492a7c61fb6951447707
|
<ide><path>src/Illuminate/Support/Collection.php
<ide> private function getArrayableItems($items)
<ide> }
<ide> elseif ($items instanceof ArrayableInterface)
<ide> {
<del> $tiems = $items->toArray();
<add> $items = $items->toArray();
<ide> }
<ide>
<ide> return $items;
| 1
|
Python
|
Python
|
add note and examples to `isrealobj` docstring
|
c00091e4265f5eaabc943c6990c65903522c6e45
|
<ide><path>numpy/lib/type_check.py
<ide> def isrealobj(x):
<ide> --------
<ide> iscomplexobj, isreal
<ide>
<add> Notes
<add> -----
<add> The function is only meant for arrays with numerical values but it
<add> accepts all other objects. Since it assumes array input, the return
<add> value of other objects may be True.
<add>
<add> >>> np.isrealobj('A string')
<add> True
<add> >>> np.isrealobj(False)
<add> True
<add> >>> np.isrealobj(None)
<add> True
<add>
<ide> Examples
<ide> --------
<ide> >>> np.isrealobj(1)
| 1
|
Python
|
Python
|
make test for more precise
|
fd9fd275c5209b64d163943da33cadeea01b247c
|
<ide><path>spacy/tests/regression/test_issue1945.py
<del>'''Test regression in PhraseMatcher introduced in v2.0.6.'''
<add>'''Test regression in Matcher introduced in v2.0.6.'''
<ide> from __future__ import unicode_literals
<ide> import pytest
<ide>
<del>from ...lang.en import English
<del>from ...matcher import PhraseMatcher
<add>from ...vocab import Vocab
<add>from ...tokens import Doc
<add>from ...matcher import Matcher
<ide>
<ide> @pytest.mark.xfail
<ide> def test_issue1945():
<del> text = "deep machine learning"
<del> mw_list = ["machine learning", "deep blue", "planing machine"]
<del>
<del> nlp = English()
<del> matcher = PhraseMatcher(nlp.vocab)
<del> matcher.add("MWE", None, *[nlp.tokenizer(item) for item in mw_list])
<del>
<del> assert len(matcher(nlp(text))) == 1
<add> text = "a a a"
<add> matcher = Matcher(Vocab())
<add> matcher.add('MWE', None, [{'orth': 'a'}, {'orth': 'a'}])
<add> doc = Doc(matcher.vocab, words=['a', 'a', 'a'])
<add> matches = matcher(doc)
<add> # We should see two overlapping matches here
<add> assert len(matches) == 2
<add> assert matches[0][1:] == (0, 2)
<add> assert matches[1][1:] == (1, 3)
| 1
|
Java
|
Java
|
implement equality for readablenativemap
|
f4536422d64f94938ddf5e83e1bb1c2d1d7aefa8
|
<ide><path>ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJSToJavaParametersTestCase.java
<ide> import com.facebook.react.bridge.ReadableType;
<ide> import com.facebook.react.bridge.UiThreadUtil;
<ide> import com.facebook.react.bridge.UnexpectedNativeTypeException;
<add>import com.facebook.react.bridge.WritableArray;
<ide> import com.facebook.react.bridge.WritableMap;
<add>import com.facebook.react.bridge.WritableNativeArray;
<ide> import com.facebook.react.bridge.WritableNativeMap;
<ide> import com.facebook.react.modules.appstate.AppStateModule;
<ide> import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
<ide> public void testMapMerging() {
<ide> assertEquals("newvalue", dest.getString("newkey"));
<ide> }
<ide>
<add> public void testEqualityMapAfterMerge() {
<add> mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnMapForMerge1();
<add> waitForBridgeAndUIIdle();
<add>
<add> List<ReadableMap> maps = mRecordingTestModule.getMapCalls();
<add> assertEquals(1, maps.size());
<add>
<add> WritableMap map1 = new WritableNativeMap();
<add> map1.merge(maps.get(0));
<add> WritableMap map2 = new WritableNativeMap();
<add> map2.merge(maps.get(0));
<add>
<add> assertTrue(map1.equals(map2));
<add> }
<add>
<add> public void testWritableNativeMapEquals() {
<add> WritableMap map1 = new WritableNativeMap();
<add> WritableMap map2 = new WritableNativeMap();
<add>
<add> map1.putInt("key1", 123);
<add> map2.putInt("key1", 123);
<add> map1.putString("key2", "value");
<add> map2.putString("key2", "value");
<add>
<add> assertTrue(map1.equals(map2));
<add> }
<add>
<add> public void testWritableNativeMapArraysEquals() {
<add> WritableMap map1 = new WritableNativeMap();
<add> WritableMap map2 = new WritableNativeMap();
<add>
<add> map1.putInt("key1", 123);
<add> map2.putInt("key1", 123);
<add> map1.putString("key2", "value");
<add> map2.putString("key2", "value");
<add> WritableArray array1 = new WritableNativeArray();
<add> array1.pushInt(321);
<add> array1.pushNull();
<add> array1.pushString("test");
<add> map1.putArray("key3", array1);
<add>
<add> WritableArray array2 = new WritableNativeArray();
<add> array1.pushInt(321);
<add> array1.pushNull();
<add> array1.pushString("test");
<add> map2.putArray("key3", array2);
<add>
<add> assertTrue(map1.equals(map2));
<add> }
<add>
<add> public void testWritableNativeMapArraysNonEquals() {
<add> WritableMap map1 = new WritableNativeMap();
<add> WritableMap map2 = new WritableNativeMap();
<add>
<add> map1.putInt("key1", 123);
<add> map2.putInt("key1", 123);
<add> map1.putString("key2", "value");
<add> map2.putString("key2", "value");
<add> WritableArray array1 = new WritableNativeArray();
<add> array1.pushInt(321);
<add> array1.pushNull();
<add> array1.pushString("test");
<add> map1.putArray("key3", array1);
<add>
<add> WritableArray array2 = new WritableNativeArray();
<add> array1.pushNull();
<add> array1.pushString("test");
<add> map2.putArray("key3", array2);
<add>
<add> assertTrue(map1.equals(map2));
<add> }
<add>
<ide> public void testMapAccessibleAfterMerge() {
<ide> mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnMapForMerge1();
<ide> mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnMapForMerge2();
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java
<ide> public int getInt(@Nonnull String name) {
<ide> return new ReadableNativeMapKeySetIterator(this);
<ide> }
<ide>
<add> @Override
<add> public int hashCode() {
<add> return getLocalMap().hashCode();
<add> }
<add>
<add> @Override
<add> public boolean equals(Object obj) {
<add> if (!(obj instanceof ReadableNativeMap)) {
<add> return false;
<add> }
<add> ReadableNativeMap other = (ReadableNativeMap) obj;
<add> return getLocalMap().equals(other.getLocalMap());
<add> }
<add>
<ide> @Override
<ide> public @Nonnull HashMap<String, Object> toHashMap() {
<ide> if (ReactFeatureFlags.useMapNativeAccessor) {
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java
<ide> public void updateLocalData(int reactTag, ReadableMap newLocalData) {
<ide> && newLocalData.hasKey("hash")
<ide> && viewState.mCurrentLocalData.getDouble("hash") == newLocalData.getDouble("hash")
<ide> && viewState.mCurrentLocalData.toString().equals(newLocalData.toString())) {
<del> // TODO: T31905686 implement a proper equality method
<add> // TODO: T31905686 implement a proper equality method
<ide> return;
<ide> }
<ide> viewState.mCurrentLocalData = newLocalData;
| 3
|
PHP
|
PHP
|
clear the facaded request on calls to kernel
|
7861640f4d5c55b066f0ac5f017006d972e20b14
|
<ide><path>src/Illuminate/Foundation/Http/Kernel.php
<ide> use Exception;
<ide> use Illuminate\Routing\Router;
<ide> use Illuminate\Pipeline\Pipeline;
<add>use Illuminate\Support\Facades\Facade;
<ide> use Illuminate\Contracts\Foundation\Application;
<ide> use Illuminate\Contracts\Routing\TerminableMiddleware;
<ide> use Illuminate\Contracts\Http\Kernel as KernelContract;
<ide> protected function sendRequestThroughRouter($request)
<ide> {
<ide> $this->app->instance('request', $request);
<ide>
<add> Facade::clearResolvedInstance('request');
<add>
<ide> $this->bootstrap();
<ide>
<ide> return (new Pipeline($this->app))
| 1
|
Java
|
Java
|
fix typo in javadoc
|
9656015d269d812928ac6c4ea6c45d16534b656e
|
<ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java
<ide> public int hashCode() {
<ide> /**
<ide> * Return an identifying description for this cache operation.
<ide> * <p>Returned value is produced by calling {@link Builder#getOperationDescription()}
<del> * during object construction. This method is used in {#hashCode} and {#equals}.
<add> * during object construction. This method is used in {@link #hashCode} and {@link #equals}.
<ide> * @see Builder#getOperationDescription()
<ide> */
<ide> @Override
<ide><path>spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointManager.java
<ide> public ActivationSpec getActivationSpec() {
<ide> * Set whether to auto-start the endpoint activation after this endpoint
<ide> * manager has been initialized and the context has been refreshed.
<ide> * <p>Default is "true". Turn this flag off to defer the endpoint
<del> * activation until an explicit {#start()} call.
<add> * activation until an explicit {@link #start()} call.
<ide> */
<ide> public void setAutoStartup(boolean autoStartup) {
<ide> this.autoStartup = autoStartup;
| 2
|
Javascript
|
Javascript
|
allow omitting constant primitive deps
|
0b8efb229c0b8e4b0919d855e926c7528e2246f0
|
<ide><path>packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> });
<ide> const tests = {
<ide> code: `
<ide> function MyComponent() {
<ide> useEffect(() => {
<del> const local = 42;
<add> const local = {};
<ide> console.log(local);
<ide> }, []);
<ide> }
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local]);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> function MyNestedComponent() {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> console.log(local);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [,,,local,,,]);
<ide> const tests = {
<ide> // TODO: we might want to forbid dot-access in deps.
<ide> code: `
<ide> function MyComponent(props) {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(props.foo);
<ide> console.log(props.bar);
<ide> const tests = {
<ide> // is extraneous because we already have "props".
<ide> code: `
<ide> function MyComponent(props) {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(props.foo);
<ide> console.log(props.bar);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> // Valid because we don't care about hooks outside of components.
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, []);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> // Valid because we don't care about hooks outside of components.
<del> const local1 = 42;
<add> const local1 = {};
<ide> {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> const myRef = useRef();
<ide> useEffect(() => {
<ide> const handleMove = () => {};
<del> myRef.current = 42;
<add> myRef.current = {};
<ide> return () => {
<ide> console.log(myRef.current.toString())
<ide> };
<ide> const tests = {
<ide> function useMyThing(myRef) {
<ide> useEffect(() => {
<ide> const handleMove = () => {};
<del> myRef.current = 42;
<add> myRef.current = {};
<ide> return () => {
<ide> console.log(myRef.current.toString())
<ide> };
<ide> const tests = {
<ide> }
<ide> `,
<ide> },
<add> {
<add> // Valid because it's a primitive constant
<add> code: `
<add> function MyComponent() {
<add> const local1 = 42;
<add> const local2 = '42';
<add> const local3 = null;
<add> useEffect(() => {
<add> console.log(local1);
<add> console.log(local2);
<add> console.log(local3);
<add> }, []);
<add> }
<add> `,
<add> },
<add> {
<add> // It's not a mistake to specify constant values though.
<add> code: `
<add> function MyComponent() {
<add> const local1 = 42;
<add> const local2 = '42';
<add> const local3 = null;
<add> useEffect(() => {
<add> console.log(local1);
<add> console.log(local2);
<add> console.log(local3);
<add> }, [local1, local2, local3]);
<add> }
<add> `,
<add> },
<ide> ],
<ide> invalid: [
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, []);
<ide> }
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<add> useEffect(() => {
<add> console.log(local);
<add> }, [local]);
<add> }
<add> `,
<add> errors: [
<add> "React Hook useEffect has a missing dependency: 'local'. " +
<add> 'Either include it or remove the dependency array.',
<add> ],
<add> },
<add> {
<add> // Note: we *could* detect it's a primitive and never assigned
<add> // even though it's not a constant -- but we currently don't.
<add> // So this is an error.
<add> code: `
<add> function MyComponent() {
<add> let local = 42;
<add> useEffect(() => {
<add> console.log(local);
<add> }, []);
<add> }
<add> `,
<add> output: `
<add> function MyComponent() {
<add> let local = 42;
<add> useEffect(() => {
<add> console.log(local);
<add> }, [local]);
<add> }
<add> `,
<add> errors: [
<add> "React Hook useEffect has a missing dependency: 'local'. " +
<add> 'Either include it or remove the dependency array.',
<add> ],
<add> },
<add> {
<add> // Regexes are literals but potentially stateful.
<add> code: `
<add> function MyComponent() {
<add> const local = /foo/;
<add> useEffect(() => {
<add> console.log(local);
<add> }, []);
<add> }
<add> `,
<add> output: `
<add> function MyComponent() {
<add> const local = /foo/;
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local]);
<ide> const tests = {
<ide> code: `
<ide> // Regression test
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> if (true) {
<ide> console.log(local);
<ide> const tests = {
<ide> output: `
<ide> // Regression test
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> if (true) {
<ide> console.log(local);
<ide> const tests = {
<ide> code: `
<ide> // Regression test
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> try {
<ide> console.log(local);
<ide> const tests = {
<ide> output: `
<ide> // Regression test
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> try {
<ide> console.log(local);
<ide> const tests = {
<ide> code: `
<ide> // Regression test
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> function inner() {
<ide> console.log(local);
<ide> const tests = {
<ide> output: `
<ide> // Regression test
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> function inner() {
<ide> console.log(local);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<del> const local2 = 42;
<add> const local1 = {};
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local1 = 42;
<del> const local2 = 42;
<add> const local1 = {};
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<del> const local2 = 42;
<add> const local1 = {};
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> }, [local1, local2]);
<ide> }
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local1 = 42;
<del> const local2 = 42;
<add> const local1 = {};
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> }, [local1]);
<ide> const tests = {
<ide> // Maybe it should not consider local1 unused despite component nesting?
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> function MyNestedComponent() {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> function MyNestedComponent() {
<del> const local2 = 42;
<add> const local2 = {};
<ide> useEffect(() => {
<ide> console.log(local1);
<ide> console.log(local2);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> console.log(local);
<ide> const tests = {
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> console.log(local);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> console.log(local);
<ide> const tests = {
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> console.log(local);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> const dependencies = [local];
<ide> useEffect(() => {
<ide> console.log(local);
<ide> const tests = {
<ide> // TODO: should this autofix or bail out?
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> const dependencies = [local];
<ide> useEffect(() => {
<ide> console.log(local);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> const dependencies = [local];
<ide> useEffect(() => {
<ide> console.log(local);
<ide> const tests = {
<ide> // TODO: should this autofix or bail out?
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> const dependencies = [local];
<ide> useEffect(() => {
<ide> console.log(local);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local, ...dependencies]);
<ide> }
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local, ...dependencies]);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [computeCacheKey(local)]);
<ide> const tests = {
<ide> // Maybe bail out?
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local]);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local, local]);
<ide> }
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local]);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> useEffect(() => {
<del> const local1 = 42;
<add> const local1 = {};
<ide> console.log(local1);
<ide> }, [local1]);
<ide> }
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> useEffect(() => {
<del> const local1 = 42;
<add> const local1 = {};
<ide> console.log(local1);
<ide> }, []);
<ide> }
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> useEffect(() => {}, [local1]);
<ide> }
<ide> `,
<ide> output: `
<ide> function MyComponent() {
<del> const local1 = 42;
<add> const local1 = {};
<ide> useEffect(() => {}, []);
<ide> }
<ide> `,
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent(props) {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(props.foo);
<ide> console.log(props.bar);
<ide> const tests = {
<ide> // Should it capture by default?
<ide> output: `
<ide> function MyComponent(props) {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(props.foo);
<ide> console.log(props.bar);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent(props) {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(props.foo);
<ide> console.log(props.bar);
<ide> const tests = {
<ide> `,
<ide> output: `
<ide> function MyComponent(props) {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(props.foo);
<ide> console.log(props.bar);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [a ? local : b]);
<ide> const tests = {
<ide> // TODO: should we bail out instead?
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local]);
<ide> const tests = {
<ide> {
<ide> code: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [a && local]);
<ide> const tests = {
<ide> // TODO: should we bail out instead?
<ide> output: `
<ide> function MyComponent() {
<del> const local = 42;
<add> const local = {};
<ide> useEffect(() => {
<ide> console.log(local);
<ide> }, [local]);
<ide> const tests = {
<ide> const ref = useRef();
<ide> const [state, setState] = useState();
<ide> useEffect(() => {
<del> ref.current = 42;
<add> ref.current = {};
<ide> setState(state + 1);
<ide> }, []);
<ide> }
<ide> const tests = {
<ide> const ref = useRef();
<ide> const [state, setState] = useState();
<ide> useEffect(() => {
<del> ref.current = 42;
<add> ref.current = {};
<ide> setState(state + 1);
<ide> }, [state]);
<ide> }
<ide> const tests = {
<ide> const ref = useRef();
<ide> const [state, setState] = useState();
<ide> useEffect(() => {
<del> ref.current = 42;
<add> ref.current = {};
<ide> setState(state + 1);
<ide> }, [ref]);
<ide> }
<ide> const tests = {
<ide> const ref = useRef();
<ide> const [state, setState] = useState();
<ide> useEffect(() => {
<del> ref.current = 42;
<add> ref.current = {};
<ide> setState(state + 1);
<ide> }, [ref, state]);
<ide> }
<ide> const tests = {
<ide> let value3;
<ide> let asyncValue;
<ide> useEffect(() => {
<del> value = 42;
<add> value = {};
<ide> value2 = 100;
<ide> value = 43;
<ide> console.log(value2);
<ide> const tests = {
<ide> let value3;
<ide> let asyncValue;
<ide> useEffect(() => {
<del> value = 42;
<add> value = {};
<ide> value2 = 100;
<ide> value = 43;
<ide> console.log(value2);
<ide> const tests = {
<ide> let value3;
<ide> let asyncValue;
<ide> useEffect(() => {
<del> value = 42;
<add> value = {};
<ide> value2 = 100;
<ide> value = 43;
<ide> console.log(value2);
<ide> const tests = {
<ide> let value3;
<ide> let asyncValue;
<ide> useEffect(() => {
<del> value = 42;
<add> value = {};
<ide> value2 = 100;
<ide> value = 43;
<ide> console.log(value2);
<ide> const tests = {
<ide> `the effect itself and refer to that variable from the cleanup function.`,
<ide> ],
<ide> },
<add> {
<add> // Autofix ignores constant primitives (leaving the ones that are there).
<add> code: `
<add> function MyComponent() {
<add> const local1 = 42;
<add> const local2 = '42';
<add> const local3 = null;
<add> const local4 = {};
<add> useEffect(() => {
<add> console.log(local1);
<add> console.log(local2);
<add> console.log(local3);
<add> console.log(local4);
<add> }, [local1, local3]);
<add> }
<add> `,
<add> output: `
<add> function MyComponent() {
<add> const local1 = 42;
<add> const local2 = '42';
<add> const local3 = null;
<add> const local4 = {};
<add> useEffect(() => {
<add> console.log(local1);
<add> console.log(local2);
<add> console.log(local3);
<add> console.log(local4);
<add> }, [local1, local3, local4]);
<add> }
<add> `,
<add> errors: [
<add> "React Hook useEffect has a missing dependency: 'local4'. " +
<add> 'Either include it or remove the dependency array.',
<add> ],
<add> },
<ide> ],
<ide> };
<ide>
<ide><path>packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
<ide> function isDefinitelyStaticDependency(reference) {
<ide> return false;
<ide> }
<ide> const def = resolved.defs[0];
<del> if (def == null || def.node.init == null) {
<add> if (def == null) {
<add> return false;
<add> }
<add> // Look for `let stuff = ...`
<add> if (def.node.type !== 'VariableDeclarator') {
<ide> return false;
<ide> }
<del> // Look for `let stuff = SomeHook();`
<ide> const init = def.node.init;
<del> if (init.callee == null) {
<add> if (init == null) {
<add> return false;
<add> }
<add> // Detect primitive constants
<add> // const foo = 42
<add> const declaration = def.node.parent;
<add> if (
<add> declaration.kind === 'const' &&
<add> init.type === 'Literal' &&
<add> (typeof init.value === 'string' ||
<add> typeof init.value === 'number' ||
<add> init.value === null)
<add> ) {
<add> // Definitely static
<add> return true;
<add> }
<add> // Detect known Hook calls
<add> // const [_, setState] = useState()
<add> if (init.type !== 'CallExpression') {
<ide> return false;
<ide> }
<ide> let callee = init.callee;
| 2
|
Python
|
Python
|
add initial epoch argument to fit functions
|
06cc6d7fea7527e99e36c9fc766390c51e73ebba
|
<ide><path>keras/engine/training.py
<ide> def _make_predict_function(self):
<ide> def _fit_loop(self, f, ins, out_labels=[], batch_size=32,
<ide> nb_epoch=100, verbose=1, callbacks=[],
<ide> val_f=None, val_ins=None, shuffle=True,
<del> callback_metrics=[]):
<add> callback_metrics=[], initial_epoch=0):
<ide> '''Abstract fit function for f(ins).
<ide> Assume that f returns a list, labeled by out_labels.
<ide>
<ide> def _fit_loop(self, f, ins, out_labels=[], batch_size=32,
<ide> passed to the callbacks. They should be the
<ide> concatenation of list the display names of the outputs of
<ide> `f` and the list of display names of the outputs of `f_val`.
<add> initial_epoch: epoch at which to start training
<add> (useful for resuming a previous training run)
<ide>
<ide> # Returns
<ide> `History` object.
<ide> def _fit_loop(self, f, ins, out_labels=[], batch_size=32,
<ide> callback_model.stop_training = False
<ide> self.validation_data = val_ins
<ide>
<del> for epoch in range(nb_epoch):
<add> for epoch in range(initial_epoch, nb_epoch):
<ide> callbacks.on_epoch_begin(epoch)
<ide> if shuffle == 'batch':
<ide> index_array = batch_shuffle(index_array, batch_size)
<ide> def _standardize_user_data(self, x, y,
<ide>
<ide> def fit(self, x, y, batch_size=32, nb_epoch=10, verbose=1, callbacks=[],
<ide> validation_split=0., validation_data=None, shuffle=True,
<del> class_weight=None, sample_weight=None):
<add> class_weight=None, sample_weight=None, initial_epoch=0):
<ide> '''Trains the model for a fixed number of epochs (iterations on a dataset).
<ide>
<ide> # Arguments
<ide> def fit(self, x, y, batch_size=32, nb_epoch=10, verbose=1, callbacks=[],
<ide> with shape (samples, sequence_length),
<ide> to apply a different weight to every timestep of every sample.
<ide> In this case you should make sure to specify sample_weight_mode="temporal" in compile().
<add> initial_epoch: epoch at which to start training
<add> (useful for resuming a previous training run)
<ide>
<ide>
<ide> # Returns
<ide> def fit(self, x, y, batch_size=32, nb_epoch=10, verbose=1, callbacks=[],
<ide> batch_size=batch_size, nb_epoch=nb_epoch,
<ide> verbose=verbose, callbacks=callbacks,
<ide> val_f=val_f, val_ins=val_ins, shuffle=shuffle,
<del> callback_metrics=callback_metrics)
<add> callback_metrics=callback_metrics,
<add> initial_epoch=initial_epoch)
<ide>
<ide> def evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None):
<ide> '''Returns the loss value and metrics values for the model
<ide> def predict_on_batch(self, x):
<ide> def fit_generator(self, generator, samples_per_epoch, nb_epoch,
<ide> verbose=1, callbacks=[],
<ide> validation_data=None, nb_val_samples=None,
<del> class_weight={}, max_q_size=10, nb_worker=1, pickle_safe=False):
<add> class_weight={}, max_q_size=10, nb_worker=1, pickle_safe=False,
<add> initial_epoch=0):
<ide> '''Fits the model on data generated batch-by-batch by
<ide> a Python generator.
<ide> The generator is run in parallel to the model, for efficiency.
<ide> def fit_generator(self, generator, samples_per_epoch, nb_epoch,
<ide> this implementation relies on multiprocessing, you should not pass
<ide> non picklable arguments to the generator as they can't be passed
<ide> easily to children processes.
<add> initial_epoch: epoch at which to start training
<add> (useful for resuming a previous training run)
<ide>
<ide> # Returns
<ide> A `History` object.
<ide> def generate_arrays_from_file(path):
<ide> ```
<ide> '''
<ide> wait_time = 0.01 # in seconds
<del> epoch = 0
<add> epoch = initial_epoch
<ide>
<ide> do_validation = bool(validation_data)
<ide> self._make_train_function()
<ide><path>tests/keras/engine/test_training.py
<ide> from keras.models import Sequential
<ide> from keras import backend as K
<ide> from keras.utils.test_utils import keras_test
<add>from keras.callbacks import LambdaCallback
<ide>
<ide>
<ide> @keras_test
<ide> def test_model_methods():
<ide> [output_a_np, output_b_np])
<ide> assert len(out) == 4
<ide>
<add> # test starting from non-zero initial epoch
<add> trained_epochs = []
<add>
<add> def on_epoch_begin(epoch, logs):
<add> trained_epochs.append(epoch)
<add> tracker_cb = LambdaCallback(on_epoch_begin=on_epoch_begin)
<add> out = model.fit([input_a_np, input_b_np],
<add> [output_a_np, output_b_np], nb_epoch=5, batch_size=4,
<add> initial_epoch=2, callbacks=[tracker_cb])
<add> assert trained_epochs == [2, 3, 4]
<add>
<add> # test starting from non-zero initial epoch for generator too
<add> trained_epochs = []
<add>
<add> def gen_data(batch_sz):
<add> while True:
<add> yield ([np.random.random((batch_sz, 3)), np.random.random((batch_sz, 3))],
<add> [np.random.random((batch_sz, 4)), np.random.random((batch_sz, 3))])
<add> out = model.fit_generator(gen_data(4), samples_per_epoch=10, nb_epoch=5,
<add> initial_epoch=2, callbacks=[tracker_cb])
<add> assert trained_epochs == [2, 3, 4]
<add>
<ide> # test with a custom metric function
<ide> mse = lambda y_true, y_pred: K.mean(K.pow(y_true - y_pred, 2))
<ide>
| 2
|
Text
|
Text
|
add guide to maintaining npm
|
f2eaf874ed6b8d701e9eac144cd6067ec9874d86
|
<ide><path>doc/guides/maintaining-npm.md
<add># Maintaining npm in Node.js
<add>
<add>## Step 1: Clone npm
<add>
<add>```console
<add>$ git clone https://github.com/npm/npm.git
<add>$ cd npm
<add>```
<add>
<add>or if you already have npm cloned make sure the repo is up to date
<add>
<add>```console
<add>$ git remote update -p
<add>$ git reset --hard origin latest
<add>```
<add>
<add>## Step 2: Build release
<add>
<add>```console
<add>$ git checkout vX.Y.Z
<add>$ make release
<add>```
<add>
<add>Note: please run `npm dist-tag ls npm` and make sure this is the `latest` **dist-tag**. `latest` on git is usually released as `next` when it's time to downstream
<add>
<add>## Step 3: Remove old npm
<add>
<add>```console
<add>$ cd /path/to/node
<add>$ git remote update -p
<add>$ git checkout -b npm-x.y.z origin/master
<add>$ cd deps
<add>$ rm -rf npm
<add>```
<add>
<add>## Step 4: Extract and commit new npm
<add>
<add>```console
<add>$ tar zxf /path/to/npm/release/npm-x.y.z.tgz
<add>$ git add -A npm
<add>$ git commit -m "deps: upgrade npm to x.y.z"
<add>$ cd ..
<add>```
<add>
<add>## Step 5: Update licenses
<add>
<add>```console
<add>$ ./configure
<add>$ make -j4
<add>$ ./tools/license-builder.sh
<add># The following commands are only necessary if there are changes
<add>$ git add .
<add>$ git commit -m "doc: update npm LICENSE using license-builder.sh"
<add>```
<add>
<add>Note: please ensure you are only making the updates that are changed by npm.
<add>
<add>## Step 6: Apply Whitespace fix
<add>
<add>```console
<add>$ git rebase --whitespace=fix master
<add>```
<add>
<add>## Step 7: Test the build
<add>
<add>```console
<add>$ make test-npm
<add>```
| 1
|
Javascript
|
Javascript
|
remove unused variables
|
92f0693914f3202a37aef1699d7cae7f01031dc5
|
<ide><path>examples/jsm/csm/CSM.js
<ide> import {
<ide> DirectionalLight,
<ide> MathUtils,
<ide> ShaderChunk,
<del> LineBasicMaterial,
<del> Object3D,
<del> BufferGeometry,
<del> BufferAttribute,
<del> Line,
<ide> Matrix4,
<ide> Box3
<ide> } from '../../../build/three.module.js';
<ide> import Shader from './Shader.js';
<ide>
<ide> const _cameraToLightMatrix = new Matrix4();
<ide> const _lightSpaceFrustum = new Frustum();
<del>const _frustum = new Frustum();
<ide> const _center = new Vector3();
<del>const _size = new Vector3();
<ide> const _bbox = new Box3();
<ide> const _uniformArray = [];
<ide> const _logArray = [];
| 1
|
Python
|
Python
|
add __eq__/__ne__ and __repr__
|
769bc1336fd5d6a7fcf10d8be3b374c3e7a21bb3
|
<ide><path>rest_framework/exceptions.py
<ide> from django.utils.translation import ungettext
<ide>
<ide> from rest_framework import status
<add>from rest_framework.compat import unicode_to_repr
<ide> from rest_framework.utils.serializer_helpers import ReturnDict, ReturnList
<ide>
<ide>
<ide> def __new__(cls, string, code=None):
<ide> self.code = code
<ide> return self
<ide>
<add> def __eq__(self, other):
<add> r = super(ErrorDetail, self).__eq__(other)
<add> try:
<add> return r and self.code == other.code
<add> except AttributeError:
<add> return r
<add>
<add> def __ne__(self, other):
<add> return not self.__eq__(other)
<add>
<add> def __repr__(self):
<add> return unicode_to_repr('ErrorDetail(string=%r, code=%r)' % (
<add> six.text_type(self),
<add> self.code,
<add> ))
<add>
<ide>
<ide> class APIException(Exception):
<ide> """
<ide><path>tests/test_exceptions.py
<ide> def test_get_full_details_with_throttling(self):
<ide> 'code': 'throttled'}
<ide>
<ide>
<add>class ErrorDetailTests(TestCase):
<add>
<add> def test_eq(self):
<add> assert ErrorDetail('msg') == ErrorDetail('msg')
<add> assert ErrorDetail('msg', 'code') == ErrorDetail('msg', code='code')
<add>
<add> assert ErrorDetail('msg') == 'msg'
<add> assert ErrorDetail('msg', 'code') == 'msg'
<add>
<add> def test_ne(self):
<add> assert ErrorDetail('msg1') != ErrorDetail('msg2')
<add> assert ErrorDetail('msg') != ErrorDetail('msg', code='invalid')
<add>
<add> assert ErrorDetail('msg1') != 'msg2'
<add> assert ErrorDetail('msg1', 'code') != 'msg2'
<add>
<add> def test_repr(self):
<add> assert repr(ErrorDetail('msg1')) == \
<add> 'ErrorDetail(string={!r}, code=None)'.format('msg1')
<add> assert repr(ErrorDetail('msg1', 'code')) == \
<add> 'ErrorDetail(string={!r}, code={!r})'.format('msg1', 'code')
<add>
<add> def test_str(self):
<add> assert str(ErrorDetail('msg1')) == 'msg1'
<add> assert str(ErrorDetail('msg1', 'code')) == 'msg1'
<add>
<add>
<ide> class TranslationTests(TestCase):
<ide>
<ide> @translation.override('fr')
| 2
|
PHP
|
PHP
|
add better comments in laravel file
|
72aaf60241be68840ab94a6e5e20e9672bb4efcc
|
<ide><path>laravel/laravel.php
<ide> <?php namespace Laravel;
<ide>
<del>// --------------------------------------------------------------
<del>// Bootstrap the core framework components.
<del>// --------------------------------------------------------------
<add>/**
<add> * Bootstrap the core framework components like the IoC container, configuration
<add> * class, and the class auto-loader. Once this file has run, the framework is
<add> * essentially ready for use.
<add> */
<ide> require 'bootstrap/core.php';
<ide>
<del>// --------------------------------------------------------------
<del>// Register the framework error handlers.
<del>// --------------------------------------------------------------
<add>/**
<add> * Register the framework error handling methods and set the error_reporting levels.
<add> * This file will register handlers for exceptions, errors, and shutdown.
<add> */
<ide> require SYS_PATH.'bootstrap/errors'.EXT;
<ide>
<del>// --------------------------------------------------------------
<del>// Set the default timezone.
<del>// --------------------------------------------------------------
<add>/**
<add> * Set the application's default timezone.
<add> */
<ide> date_default_timezone_set(Config::get('application.timezone'));
<ide>
<del>// --------------------------------------------------------------
<del>// Load the session and session manager.
<del>// --------------------------------------------------------------
<add>/**
<add> * Load the session and session manager instance. The session payload will be
<add> * registered in the IoC container as an instance so it can be retrieved easily
<add> * throughout the application.
<add> */
<ide> if (Config::get('session.driver') !== '')
<ide> {
<ide> $session = $container->resolve('laravel.session.manager');
<ide>
<ide> $container->instance('laravel.session', $session->payload(Config::get('session')));
<ide> }
<ide>
<del>// --------------------------------------------------------------
<del>// Route the request and get the response from the route.
<del>// --------------------------------------------------------------
<add>/**
<add> * Resolve the incoming request instance from the IoC container and route the
<add> * request to the proper route in the application. If a route is found, the route
<add> * will be called with the current requst instance. If no route is found, the 404
<add> * response will be returned to the browser.
<add> */
<ide> $request = $container->resolve('laravel.request');
<ide>
<ide> list($method, $uri) = array($request->method(), $request->uri());
<ide> $response = Response::error('404');
<ide> }
<ide>
<del>// --------------------------------------------------------------
<del>// Stringify the response.
<del>// --------------------------------------------------------------
<add>/**
<add> * Stringify the response. We need to force the response to be stringed before
<add> * closing the session, since the developer may be using the session within their
<add> * views, so we cannot age the session data until the view is rendered.
<add> */
<ide> $response->content = $response->render();
<ide>
<del>// --------------------------------------------------------------
<del>// Close the session and write the session cookie.
<del>// --------------------------------------------------------------
<add>/**
<add> * Close the session and write the active payload to persistent storage. The input
<add> * for the current request is also flashed to the session so it will be available
<add> * for the next request via the Input::old method.
<add> */
<ide> if (isset($session))
<ide> {
<ide> $flash = array(Input::old_input => $container->resolve('laravel.input')->get());
<ide>
<ide> $session->close($container->resolve('laravel.session'), Config::get('session'), $flash);
<ide> }
<ide>
<del>// --------------------------------------------------------------
<del>// Send the response to the browser.
<del>// --------------------------------------------------------------
<add>/**
<add> * Finally, we can send the response to the browser.
<add> */
<ide> $response->send();
<ide>\ No newline at end of file
| 1
|
Ruby
|
Ruby
|
change mailer subjects lookup
|
4a1f43878105d701fd2dd769ec3cf7e81d133c09
|
<ide><path>actionmailer/lib/action_mailer/base.rb
<ide> def create!(method_name, *parameters) #:nodoc:
<ide> create_parts
<ide>
<ide> # Set the subject if not set yet
<del> @subject ||= I18n.t(method_name, :scope => [:actionmailer, :subjects, mailer_name],
<del> :default => method_name.humanize)
<add> @subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name],
<add> :default => method_name.humanize)
<ide>
<ide> # build the mail object itself
<ide> @mail = create_mail
<ide><path>actionmailer/test/mail_service_test.rb
<ide> def test_subject_with_i18n
<ide> assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) }
<ide> assert_equal "Subject with i18n", ActionMailer::Base.deliveries.first.subject
<ide>
<del> I18n.backend.store_translations('en', :actionmailer => {:subjects => {:test_mailer => {:subject_with_i18n => "New Subject!"}}})
<add> I18n.backend.store_translations('en', :actionmailer => {:test_mailer => {:subject_with_i18n => {:subject => "New Subject!"}}})
<ide> assert_nothing_raised { TestMailer.deliver_subject_with_i18n(@recipient) }
<ide> assert_equal "New Subject!", ActionMailer::Base.deliveries.last.subject
<ide> end
| 2
|
Javascript
|
Javascript
|
remove navigationexperimental examples
|
da04a6b1f3d7651da52ef4b9c0a0f210a1e39289
|
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationCardStack-NavigationHeader-Tabs-example.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del>*/
<del>'use strict';
<del>
<del>const NavigationExampleRow = require('./NavigationExampleRow');
<del>const React = require('react');
<del>const ReactNative = require('react-native');
<del>
<del>/**
<del> * Basic example that shows how to use <NavigationCardStack /> to build
<del> * an app with composite navigation system.
<del> * @providesModule NavigationCardStack-NavigationHeader-Tabs-example
<del> */
<del>
<del>const {
<del> Component,
<del> PropTypes,
<del>} = React;
<del>
<del>const {
<del> NavigationExperimental,
<del> ScrollView,
<del> StyleSheet,
<del> Text,
<del> TouchableOpacity,
<del> View,
<del>} = ReactNative;
<del>
<del>const {
<del> CardStack: NavigationCardStack,
<del> Header: NavigationHeader,
<del> PropTypes: NavigationPropTypes,
<del> StateUtils: NavigationStateUtils,
<del>} = NavigationExperimental;
<del>
<del>// First Step.
<del>// Define what app navigation state will look like.
<del>function createAppNavigationState(): Object {
<del> return {
<del> // Three tabs.
<del> tabs: {
<del> index: 0,
<del> routes: [
<del> {key: 'apple'},
<del> {key: 'banana'},
<del> {key: 'orange'},
<del> ],
<del> },
<del> // Scenes for the `apple` tab.
<del> apple: {
<del> index: 0,
<del> routes: [{key: 'Apple Home'}],
<del> },
<del> // Scenes for the `banana` tab.
<del> banana: {
<del> index: 0,
<del> routes: [{key: 'Banana Home'}],
<del> },
<del> // Scenes for the `orange` tab.
<del> orange: {
<del> index: 0,
<del> routes: [{key: 'Orange Home'}],
<del> },
<del> };
<del>}
<del>
<del>// Next step.
<del>// Define what app navigation state shall be updated.
<del>function updateAppNavigationState(
<del> state: Object,
<del> action: Object,
<del>): Object {
<del> let {type} = action;
<del> if (type === 'BackAction') {
<del> type = 'pop';
<del> }
<del>
<del> switch (type) {
<del> case 'push': {
<del> // Push a route into the scenes stack.
<del> const route: Object = action.route;
<del> const {tabs} = state;
<del> const tabKey = tabs.routes[tabs.index].key;
<del> const scenes = state[tabKey];
<del> const nextScenes = NavigationStateUtils.push(scenes, route);
<del> if (scenes !== nextScenes) {
<del> return {
<del> ...state,
<del> [tabKey]: nextScenes,
<del> };
<del> }
<del> break;
<del> }
<del>
<del> case 'pop': {
<del> // Pops a route from the scenes stack.
<del> const {tabs} = state;
<del> const tabKey = tabs.routes[tabs.index].key;
<del> const scenes = state[tabKey];
<del> const nextScenes = NavigationStateUtils.pop(scenes);
<del> if (scenes !== nextScenes) {
<del> return {
<del> ...state,
<del> [tabKey]: nextScenes,
<del> };
<del> }
<del> break;
<del> }
<del>
<del> case 'selectTab': {
<del> // Switches the tab.
<del> const tabKey: string = action.tabKey;
<del> const tabs = NavigationStateUtils.jumpTo(state.tabs, tabKey);
<del> if (tabs !== state.tabs) {
<del> return {
<del> ...state,
<del> tabs,
<del> };
<del> }
<del> }
<del> }
<del> return state;
<del>}
<del>
<del>// Next step.
<del>// Defines a helper function that creates a HOC (higher-order-component)
<del>// which provides a function `navigate` through component props. The
<del>// `navigate` function will be used to invoke navigation changes.
<del>// This serves a convenient way for a component to navigate.
<del>function createAppNavigationContainer(ComponentClass) {
<del> const key = '_yourAppNavigationContainerNavigateCall';
<del>
<del> class Container extends Component {
<del> static contextTypes = {
<del> [key]: PropTypes.func,
<del> };
<del>
<del> static childContextTypes = {
<del> [key]: PropTypes.func.isRequired,
<del> };
<del>
<del> static propTypes = {
<del> navigate: PropTypes.func,
<del> };
<del>
<del> getChildContext(): Object {
<del> return {
<del> [key]: this.context[key] || this.props.navigate,
<del> };
<del> }
<del>
<del> render(): React.Element {
<del> const navigate = this.context[key] || this.props.navigate;
<del> return <ComponentClass {...this.props} navigate={navigate} />;
<del> }
<del> }
<del>
<del> return Container;
<del>}
<del>
<del>// Next step.
<del>// Define a component for your application that owns the navigation state.
<del>class YourApplication extends Component {
<del>
<del> static propTypes = {
<del> onExampleExit: PropTypes.func,
<del> };
<del>
<del> // This sets up the initial navigation state.
<del> constructor(props, context) {
<del> super(props, context);
<del> // This sets up the initial navigation state.
<del> this.state = createAppNavigationState();
<del> this._navigate = this._navigate.bind(this);
<del> }
<del>
<del> render(): React.Element {
<del> // User your own navigator (see next step).
<del> return (
<del> <YourNavigator
<del> appNavigationState={this.state}
<del> navigate={this._navigate}
<del> />
<del> );
<del> }
<del>
<del> // This public method is optional. If exists, the UI explorer will call it
<del> // the "back button" is pressed. Normally this is the cases for Android only.
<del> handleBackAction(): boolean {
<del> return this._navigate({type: 'pop'});
<del> }
<del>
<del> // This handles the navigation state changes. You're free and responsible
<del> // to define the API that changes that navigation state. In this exmaple,
<del> // we'd simply use a `updateAppNavigationState` to update the navigation
<del> // state.
<del> _navigate(action: Object): void {
<del> if (action.type === 'exit') {
<del> // Exits the example. `this.props.onExampleExit` is provided
<del> // by the UI Explorer.
<del> this.props.onExampleExit && this.props.onExampleExit();
<del> return;
<del> }
<del>
<del> const state = updateAppNavigationState(
<del> this.state,
<del> action,
<del> );
<del>
<del> // `updateAppNavigationState` (which uses NavigationStateUtils) gives you
<del> // back the same `state` if nothing has changed. You could use
<del> // that to avoid redundant re-rendering.
<del> if (this.state !== state) {
<del> this.setState(state);
<del> }
<del> }
<del>}
<del>
<del>// Next step.
<del>// Define your own controlled navigator.
<del>const YourNavigator = createAppNavigationContainer(class extends Component {
<del> static propTypes = {
<del> appNavigationState: PropTypes.shape({
<del> apple: NavigationPropTypes.navigationState.isRequired,
<del> banana: NavigationPropTypes.navigationState.isRequired,
<del> orange: NavigationPropTypes.navigationState.isRequired,
<del> tabs: NavigationPropTypes.navigationState.isRequired,
<del> }),
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> // This sets up the methods (e.g. Pop, Push) for navigation.
<del> constructor(props: any, context: any) {
<del> super(props, context);
<del> this._back = this._back.bind(this);
<del> this._renderHeader = this._renderHeader.bind(this);
<del> this._renderScene = this._renderScene.bind(this);
<del> }
<del>
<del> // Now use the `NavigationCardStack` to render the scenes.
<del> render(): React.Element {
<del> const {appNavigationState} = this.props;
<del> const {tabs} = appNavigationState;
<del> const tabKey = tabs.routes[tabs.index].key;
<del> const scenes = appNavigationState[tabKey];
<del>
<del> return (
<del> <View style={styles.navigator}>
<del> <NavigationCardStack
<del> key={'stack_' + tabKey}
<del> onNavigateBack={this._back}
<del> navigationState={scenes}
<del> renderHeader={this._renderHeader}
<del> renderScene={this._renderScene}
<del> style={styles.navigatorCardStack}
<del> />
<del> <YourTabs
<del> navigationState={tabs}
<del> />
<del> </View>
<del> );
<del> }
<del>
<del> // Render the header.
<del> // The detailed spec of `sceneProps` is defined at `NavigationTypeDefinition`
<del> // as type `NavigationSceneRendererProps`.
<del> _renderHeader(sceneProps: Object): React.Element {
<del> return (
<del> <YourHeader
<del> {...sceneProps}
<del> />
<del> );
<del> }
<del>
<del> // Render a scene for route.
<del> // The detailed spec of `sceneProps` is defined at `NavigationTypeDefinition`
<del> // as type `NavigationSceneRendererProps`.
<del> _renderScene(sceneProps: Object): React.Element {
<del> return (
<del> <YourScene
<del> {...sceneProps}
<del> />
<del> );
<del> }
<del>
<del> _back() {
<del> this.props.navigate({type: 'pop'});
<del> }
<del>});
<del>
<del>// Next step.
<del>// Define your own header.
<del>const YourHeader = createAppNavigationContainer(class extends Component {
<del> static propTypes = {
<del> ...NavigationPropTypes.SceneRendererProps,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> constructor(props: Object, context: any) {
<del> super(props, context);
<del> this._back = this._back.bind(this);
<del> this._renderTitleComponent = this._renderTitleComponent.bind(this);
<del> }
<del>
<del> render(): React.Element {
<del> return (
<del> <NavigationHeader
<del> {...this.props}
<del> renderTitleComponent={this._renderTitleComponent}
<del> onNavigateBack={this._back}
<del> />
<del> );
<del> }
<del>
<del> _back(): void {
<del> this.props.navigate({type: 'pop'});
<del> }
<del>
<del> _renderTitleComponent(props: Object): React.Element {
<del> return (
<del> <NavigationHeader.Title>
<del> {props.scene.route.key}
<del> </NavigationHeader.Title>
<del> );
<del> }
<del>});
<del>
<del>// Next step.
<del>// Define your own scene.
<del>const YourScene = createAppNavigationContainer(class extends Component {
<del> static propTypes = {
<del> ...NavigationPropTypes.SceneRendererProps,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> constructor(props: Object, context: any) {
<del> super(props, context);
<del> this._exit = this._exit.bind(this);
<del> this._popRoute = this._popRoute.bind(this);
<del> this._pushRoute = this._pushRoute.bind(this);
<del> }
<del>
<del> render(): React.Element {
<del> return (
<del> <ScrollView>
<del> <NavigationExampleRow
<del> text="Push Route"
<del> onPress={this._pushRoute}
<del> />
<del> <NavigationExampleRow
<del> text="Pop Route"
<del> onPress={this._popRoute}
<del> />
<del> <NavigationExampleRow
<del> text="Exit Header + Scenes + Tabs Example"
<del> onPress={this._exit}
<del> />
<del> </ScrollView>
<del> );
<del> }
<del>
<del> _pushRoute(): void {
<del> // Just push a route with a new unique key.
<del> const route = {key: '[' + this.props.scenes.length + ']-' + Date.now()};
<del> this.props.navigate({type: 'push', route});
<del> }
<del>
<del> _popRoute(): void {
<del> this.props.navigate({type: 'pop'});
<del> }
<del>
<del> _exit(): void {
<del> this.props.navigate({type: 'exit'});
<del> }
<del>});
<del>
<del>// Next step.
<del>// Define your own tabs.
<del>const YourTabs = createAppNavigationContainer(class extends Component {
<del> static propTypes = {
<del> navigationState: NavigationPropTypes.navigationState.isRequired,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> constructor(props: Object, context: any) {
<del> super(props, context);
<del> }
<del>
<del> render(): React.Element {
<del> return (
<del> <View style={styles.tabs}>
<del> {this.props.navigationState.routes.map(this._renderTab, this)}
<del> </View>
<del> );
<del> }
<del>
<del> _renderTab(route: Object, index: number): React.Element {
<del> return (
<del> <YourTab
<del> key={route.key}
<del> route={route}
<del> selected={this.props.navigationState.index === index}
<del> />
<del> );
<del> }
<del>});
<del>
<del>// Next step.
<del>// Define your own Tab
<del>const YourTab = createAppNavigationContainer(class extends Component {
<del>
<del> static propTypes = {
<del> navigate: PropTypes.func.isRequired,
<del> route: NavigationPropTypes.navigationRoute.isRequired,
<del> selected: PropTypes.bool.isRequired,
<del> };
<del>
<del> constructor(props: Object, context: any) {
<del> super(props, context);
<del> this._onPress = this._onPress.bind(this);
<del> }
<del>
<del> render(): React.Element {
<del> const style = [styles.tabText];
<del> if (this.props.selected) {
<del> style.push(styles.tabSelected);
<del> }
<del> return (
<del> <TouchableOpacity style={styles.tab} onPress={this._onPress}>
<del> <Text style={style}>
<del> {this.props.route.key}
<del> </Text>
<del> </TouchableOpacity>
<del> );
<del> }
<del>
<del> _onPress() {
<del> this.props.navigate({type: 'selectTab', tabKey: this.props.route.key});
<del> }
<del>});
<del>
<del>const styles = StyleSheet.create({
<del> navigator: {
<del> flex: 1,
<del> },
<del> navigatorCardStack: {
<del> flex: 20,
<del> },
<del> tabs: {
<del> flex: 1,
<del> flexDirection: 'row',
<del> },
<del> tab: {
<del> alignItems: 'center',
<del> backgroundColor: '#fff',
<del> flex: 1,
<del> justifyContent: 'center',
<del> },
<del> tabText: {
<del> color: '#222',
<del> fontWeight: '500',
<del> },
<del> tabSelected: {
<del> color: 'blue',
<del> },
<del>});
<del>
<del>module.exports = YourApplication;
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationCardStack-NoGesture-example.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del> *
<del> * @providesModule NavigationCardStack-NoGesture-example
<del> */
<del>'use strict';
<del>
<del>const NavigationExampleRow = require('./NavigationExampleRow');
<del>const React = require('react');
<del>const ReactNative = require('react-native');
<del>
<del>/**
<del> * Basic example that shows how to use <NavigationCardStack /> to build
<del> * an app with controlled navigation system but without gestures.
<del> */
<del>const {
<del> NavigationExperimental,
<del> ScrollView,
<del> StyleSheet,
<del>} = ReactNative;
<del>
<del>const {
<del> CardStack: NavigationCardStack,
<del> StateUtils: NavigationStateUtils,
<del>} = NavigationExperimental;
<del>
<del>// Step 1:
<del>// Define a component for your application.
<del>class YourApplication extends React.Component {
<del>
<del> // This sets up the initial navigation state.
<del> constructor(props, context) {
<del> super(props, context);
<del>
<del> this.state = {
<del> // This defines the initial navigation state.
<del> navigationState: {
<del> index: 0, // starts with first route focused.
<del> routes: [{key: 'Welcome'}], // starts with only one route.
<del> },
<del> };
<del>
<del> this._exit = this._exit.bind(this);
<del> this._onNavigationChange = this._onNavigationChange.bind(this);
<del> }
<del>
<del> // User your own navigator (see Step 2).
<del> render(): React.Element {
<del> return (
<del> <YourNavigator
<del> navigationState={this.state.navigationState}
<del> onNavigationChange={this._onNavigationChange}
<del> onExit={this._exit}
<del> />
<del> );
<del> }
<del>
<del> // This handles the navigation state changes. You're free and responsible
<del> // to define the API that changes that navigation state. In this exmaple,
<del> // we'd simply use a `function(type: string)` to update the navigation state.
<del> _onNavigationChange(type: string): void {
<del> let {navigationState} = this.state;
<del> switch (type) {
<del> case 'push':
<del> // push a new route.
<del> const route = {key: 'route-' + Date.now()};
<del> navigationState = NavigationStateUtils.push(navigationState, route);
<del> break;
<del>
<del> case 'pop':
<del> navigationState = NavigationStateUtils.pop(navigationState);
<del> break;
<del> }
<del>
<del> // NavigationStateUtils gives you back the same `navigationState` if nothing
<del> // has changed. You could use that to avoid redundant re-rendering.
<del> if (this.state.navigationState !== navigationState) {
<del> this.setState({navigationState});
<del> }
<del> }
<del>
<del> // Exits the example. `this.props.onExampleExit` is provided
<del> // by the UI Explorer.
<del> _exit(): void {
<del> this.props.onExampleExit && this.props.onExampleExit();
<del> }
<del>
<del> // This public method is optional. If exists, the UI explorer will call it
<del> // the "back button" is pressed. Normally this is the cases for Android only.
<del> handleBackAction(): boolean {
<del> return this._onNavigationChange('pop');
<del> }
<del>}
<del>
<del>// Step 2:
<del>// Define your own controlled navigator.
<del>//
<del>// +------------+
<del>// +-+ |
<del>// +-+ | |
<del>// | | | |
<del>// | | | Active |
<del>// | | | Scene |
<del>// | | | |
<del>// +-+ | |
<del>// +-+ |
<del>// +------------+
<del>//
<del>class YourNavigator extends React.Component {
<del>
<del> // This sets up the methods (e.g. Pop, Push) for navigation.
<del> constructor(props: any, context: any) {
<del> super(props, context);
<del>
<del> this._onPushRoute = this.props.onNavigationChange.bind(null, 'push');
<del> this._onPopRoute = this.props.onNavigationChange.bind(null, 'pop');
<del>
<del> this._renderScene = this._renderScene.bind(this);
<del> }
<del>
<del> // Now use the `NavigationCardStack` to render the scenes.
<del> render(): React.Element {
<del> return (
<del> <NavigationCardStack
<del> onNavigateBack={this._onPopRoute}
<del> navigationState={this.props.navigationState}
<del> renderScene={this._renderScene}
<del> style={styles.navigator}
<del> enableGestures={false}
<del> />
<del> );
<del> }
<del>
<del> // Render a scene for route.
<del> // The detailed spec of `sceneProps` is defined at `NavigationTypeDefinition`
<del> // as type `NavigationSceneRendererProps`.
<del> _renderScene(sceneProps: Object): React.Element {
<del> return (
<del> <YourScene
<del> route={sceneProps.scene.route}
<del> onPushRoute={this._onPushRoute}
<del> onPopRoute={this._onPopRoute}
<del> onExit={this.props.onExit}
<del> />
<del> );
<del> }
<del>}
<del>
<del>// Step 3:
<del>// Define your own scene.
<del>class YourScene extends React.Component {
<del> render() {
<del> return (
<del> <ScrollView>
<del> <NavigationExampleRow
<del> text={'route = ' + this.props.route.key}
<del> />
<del> <NavigationExampleRow
<del> text="Push Route"
<del> onPress={this.props.onPushRoute}
<del> />
<del> <NavigationExampleRow
<del> text="Pop Route"
<del> onPress={this.props.onPopRoute}
<del> />
<del> <NavigationExampleRow
<del> text="Exit Card Stack Example"
<del> onPress={this.props.onExit}
<del> />
<del> </ScrollView>
<del> );
<del> }
<del>}
<del>
<del>const styles = StyleSheet.create({
<del> navigator: {
<del> flex: 1,
<del> },
<del>});
<del>
<del>module.exports = YourApplication;
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationCardStack-example.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del> * @providesModule NavigationCardStack-example
<del> */
<del>'use strict';
<del>
<del>const NavigationExampleRow = require('./NavigationExampleRow');
<del>const React = require('react');
<del>const ReactNative = require('react-native');
<del>
<del>/**
<del> * Basic example that shows how to use <NavigationCardStack /> to build
<del> * an app with controlled navigation system.
<del> */
<del>const {
<del> NavigationExperimental,
<del> ScrollView,
<del> StyleSheet,
<del>} = ReactNative;
<del>
<del>const {
<del> CardStack: NavigationCardStack,
<del> StateUtils: NavigationStateUtils,
<del>} = NavigationExperimental;
<del>
<del>// Step 1:
<del>// Define a component for your application.
<del>class YourApplication extends React.Component {
<del>
<del> // This sets up the initial navigation state.
<del> constructor(props, context) {
<del> super(props, context);
<del>
<del> this.state = {
<del> // This defines the initial navigation state.
<del> navigationState: {
<del> index: 0, // starts with first route focused.
<del> routes: [{key: 'Welcome'}], // starts with only one route.
<del> },
<del> };
<del>
<del> this._exit = this._exit.bind(this);
<del> this._onNavigationChange = this._onNavigationChange.bind(this);
<del> }
<del>
<del> // User your own navigator (see Step 2).
<del> render(): React.Element {
<del> return (
<del> <YourNavigator
<del> navigationState={this.state.navigationState}
<del> onNavigationChange={this._onNavigationChange}
<del> onExit={this._exit}
<del> />
<del> );
<del> }
<del>
<del> // This handles the navigation state changes. You're free and responsible
<del> // to define the API that changes that navigation state. In this exmaple,
<del> // we'd simply use a `function(type: string)` to update the navigation state.
<del> _onNavigationChange(type: string): void {
<del> let {navigationState} = this.state;
<del> switch (type) {
<del> case 'push':
<del> // push a new route.
<del> const route = {key: 'route-' + Date.now()};
<del> navigationState = NavigationStateUtils.push(navigationState, route);
<del> break;
<del>
<del> case 'pop':
<del> navigationState = NavigationStateUtils.pop(navigationState);
<del> break;
<del> }
<del>
<del> // NavigationStateUtils gives you back the same `navigationState` if nothing
<del> // has changed. You could use that to avoid redundant re-rendering.
<del> if (this.state.navigationState !== navigationState) {
<del> this.setState({navigationState});
<del> }
<del> }
<del>
<del> // Exits the example. `this.props.onExampleExit` is provided
<del> // by the UI Explorer.
<del> _exit(): void {
<del> this.props.onExampleExit && this.props.onExampleExit();
<del> }
<del>
<del> // This public method is optional. If exists, the UI explorer will call it
<del> // the "back button" is pressed. Normally this is the cases for Android only.
<del> handleBackAction(): boolean {
<del> return this._onNavigationChange('pop');
<del> }
<del>}
<del>
<del>// Step 2:
<del>// Define your own controlled navigator.
<del>//
<del>// +------------+
<del>// +-+ |
<del>// +-+ | |
<del>// | | | |
<del>// | | | Active |
<del>// | | | Scene |
<del>// | | | |
<del>// +-+ | |
<del>// +-+ |
<del>// +------------+
<del>//
<del>class YourNavigator extends React.Component {
<del>
<del> // This sets up the methods (e.g. Pop, Push) for navigation.
<del> constructor(props: any, context: any) {
<del> super(props, context);
<del>
<del> this._onPushRoute = this.props.onNavigationChange.bind(null, 'push');
<del> this._onPopRoute = this.props.onNavigationChange.bind(null, 'pop');
<del>
<del> this._renderScene = this._renderScene.bind(this);
<del> }
<del>
<del> // Now use the `NavigationCardStack` to render the scenes.
<del> render(): React.Element {
<del> return (
<del> <NavigationCardStack
<del> onNavigateBack={this._onPopRoute}
<del> navigationState={this.props.navigationState}
<del> renderScene={this._renderScene}
<del> style={styles.navigator}
<del> />
<del> );
<del> }
<del>
<del> // Render a scene for route.
<del> // The detailed spec of `sceneProps` is defined at `NavigationTypeDefinition`
<del> // as type `NavigationSceneRendererProps`.
<del> _renderScene(sceneProps: Object): React.Element {
<del> return (
<del> <YourScene
<del> route={sceneProps.scene.route}
<del> onPushRoute={this._onPushRoute}
<del> onPopRoute={this._onPopRoute}
<del> onExit={this.props.onExit}
<del> />
<del> );
<del> }
<del>}
<del>
<del>// Step 3:
<del>// Define your own scene.
<del>class YourScene extends React.Component {
<del> render() {
<del> return (
<del> <ScrollView>
<del> <NavigationExampleRow
<del> text={'route = ' + this.props.route.key}
<del> />
<del> <NavigationExampleRow
<del> text="Push Route"
<del> onPress={this.props.onPushRoute}
<del> />
<del> <NavigationExampleRow
<del> text="Pop Route"
<del> onPress={this.props.onPopRoute}
<del> />
<del> <NavigationExampleRow
<del> text="Exit Card Stack Example"
<del> onPress={this.props.onExit}
<del> />
<del> </ScrollView>
<del> );
<del> }
<del>}
<del>
<del>const styles = StyleSheet.create({
<del> navigator: {
<del> flex: 1,
<del> },
<del>});
<del>
<del>module.exports = YourApplication;
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationExampleRow.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del> * @providesModule NavigationExampleRow
<del> */
<del>'use strict';
<del>
<del>var React = require('react');
<del>var ReactNative = require('react-native');
<del>var {
<del> Text,
<del> PixelRatio,
<del> StyleSheet,
<del> View,
<del> TouchableHighlight,
<del>} = ReactNative;
<del>
<del>class NavigationExampleRow extends React.Component {
<del> render() {
<del> if (this.props.onPress) {
<del> return (
<del> <TouchableHighlight
<del> style={styles.row}
<del> underlayColor="#D0D0D0"
<del> onPress={this.props.onPress}>
<del> <Text style={styles.buttonText}>
<del> {this.props.text}
<del> </Text>
<del> </TouchableHighlight>
<del> );
<del> }
<del> return (
<del> <View style={styles.row}>
<del> <Text style={styles.rowText}>
<del> {this.props.text}
<del> </Text>
<del> </View>
<del> );
<del> }
<del>}
<del>
<del>const styles = StyleSheet.create({
<del> row: {
<del> padding: 15,
<del> backgroundColor: 'white',
<del> borderBottomWidth: 1 / PixelRatio.get(),
<del> borderBottomColor: '#CDCDCD',
<del> },
<del> rowText: {
<del> fontSize: 17,
<del> },
<del> buttonText: {
<del> fontSize: 17,
<del> fontWeight: '500',
<del> },
<del>});
<del>
<del>module.exports = NavigationExampleRow;
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationExperimentalExample.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del> * @providesModule NavigationExperimentalExample
<del> */
<del>'use strict';
<del>
<del>const AsyncStorage = require('AsyncStorage');
<del>const NavigationExampleRow = require('./NavigationExampleRow');
<del>const React = require('react');
<del>const ScrollView = require('ScrollView');
<del>const StyleSheet = require('StyleSheet');
<del>const View = require('View');
<del>
<del>/*
<del> * Heads up! This file is not the real navigation example- only a utility to switch between them.
<del> *
<del> * To learn how to use the Navigation API, take a look at the following example files:
<del> */
<del>const EXAMPLES = {
<del> 'CardStack + Header + Tabs Example': require('./NavigationCardStack-NavigationHeader-Tabs-example'),
<del> 'CardStack Example': require('./NavigationCardStack-example'),
<del> 'CardStack Without Gestures Example': require('./NavigationCardStack-NoGesture-example'),
<del> 'Transitioner + Animated View Example': require('./NavigationTransitioner-AnimatedView-example'),
<del> 'Transitioner + Animated View Pager Example': require('./NavigationTransitioner-AnimatedView-pager-example'),
<del>};
<del>
<del>const EXAMPLE_STORAGE_KEY = 'NavigationExperimentalExample';
<del>
<del>class NavigationExperimentalExample extends React.Component {
<del> static title = 'Navigation (Experimental)';
<del> static description = 'Upcoming navigation APIs and animated navigation views';
<del> static external = true;
<del>
<del> state = {
<del> example: null,
<del> };
<del>
<del> componentDidMount() {
<del> AsyncStorage.getItem(EXAMPLE_STORAGE_KEY, (err, example) => {
<del> if (err || !example || !EXAMPLES[example]) {
<del> this.setState({
<del> example: 'menu',
<del> });
<del> return;
<del> }
<del> this.setState({
<del> example,
<del> });
<del> });
<del> }
<del>
<del> setExample = (example) => {
<del> this.setState({
<del> example,
<del> });
<del> AsyncStorage.setItem(EXAMPLE_STORAGE_KEY, example);
<del> };
<del>
<del> _renderMenu = () => {
<del> let exitRow = null;
<del> if (this.props.onExampleExit) {
<del> exitRow = (
<del> <NavigationExampleRow
<del> text="Exit Navigation Examples"
<del> onPress={this.props.onExampleExit}
<del> />
<del> );
<del> }
<del> return (
<del> <View style={styles.menu}>
<del> <ScrollView>
<del> {this._renderExampleList()}
<del> {exitRow}
<del> </ScrollView>
<del> </View>
<del> );
<del> };
<del>
<del> _renderExampleList = () => {
<del> return Object.keys(EXAMPLES).map(exampleName => (
<del> <NavigationExampleRow
<del> key={exampleName}
<del> text={exampleName}
<del> onPress={() => {
<del> this.setExample(exampleName);
<del> }}
<del> />
<del> ));
<del> };
<del>
<del> _exitInnerExample = () => {
<del> this.setExample('menu');
<del> };
<del>
<del> handleBackAction = () => {
<del> const wasHandledByExample = (
<del> this.exampleRef &&
<del> this.exampleRef.handleBackAction &&
<del> this.exampleRef.handleBackAction()
<del> );
<del> if (wasHandledByExample) {
<del> return true;
<del> }
<del> if (this.state.example && this.state.example !== 'menu') {
<del> this._exitInnerExample();
<del> return true;
<del> }
<del> return false;
<del> };
<del>
<del> render() {
<del> if (this.state.example === 'menu') {
<del> return this._renderMenu();
<del> }
<del> if (EXAMPLES[this.state.example]) {
<del> const Component = EXAMPLES[this.state.example];
<del> return (
<del> <Component
<del> onExampleExit={this._exitInnerExample}
<del> ref={exampleRef => { this.exampleRef = exampleRef; }}
<del> />
<del> );
<del> }
<del> return null;
<del> }
<del>}
<del>
<del>const styles = StyleSheet.create({
<del> menu: {
<del> backgroundColor: '#E9E9EF',
<del> flex: 1,
<del> marginTop: 20,
<del> },
<del>});
<del>
<del>module.exports = NavigationExperimentalExample;
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationTransitioner-AnimatedView-example.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del> *
<del> * @flow
<del> * @providesModule NavigationTransitioner-AnimatedView-example
<del> */
<del>'use strict';
<del>
<del>const NavigationExampleRow = require('./NavigationExampleRow');
<del>const React = require('react');
<del>const ReactNative = require('react-native');
<del>
<del>/**
<del> * Basic example that shows how to use <NavigationTransitioner /> and
<del> * <Animated.View /> to build a stack of animated scenes that render the
<del> * navigation state.
<del> */
<del>
<del>
<del>import type {
<del> NavigationSceneRendererProps,
<del> NavigationState,
<del> NavigationTransitionProps,
<del> NavigationTransitionSpec,
<del>} from 'NavigationTypeDefinition';
<del>
<del>const {
<del> Component,
<del> PropTypes,
<del>} = React;
<del>
<del>const {
<del> Animated,
<del> Easing,
<del> NavigationExperimental,
<del> ScrollView,
<del> StyleSheet,
<del>} = ReactNative;
<del>
<del>const {
<del> PropTypes: NavigationPropTypes,
<del> StateUtils: NavigationStateUtils,
<del> Transitioner: NavigationTransitioner,
<del>} = NavigationExperimental;
<del>
<del>function reducer(state: ?NavigationState, action: any): NavigationState {
<del> if (!state) {
<del> return {
<del> index: 0,
<del> routes: [{key: 'route-1'}],
<del> };
<del> }
<del>
<del> switch (action) {
<del> case 'push':
<del> const route = {key: 'route-' + (state.routes.length + 1)};
<del> return NavigationStateUtils.push(state, route);
<del> case 'pop':
<del> return NavigationStateUtils.pop(state);
<del> }
<del> return state;
<del>}
<del>
<del>class Example extends Component {
<del> state: NavigationState;
<del> constructor(props: any, context: any) {
<del> super(props, context);
<del> this.state = reducer();
<del> }
<del>
<del> render(): React.Element<any> {
<del> return (
<del> <ExampleNavigator
<del> navigationState={this.state}
<del> navigate={action => this._navigate(action)}
<del> />
<del> );
<del> }
<del>
<del> _navigate(action: any): boolean {
<del> if (action === 'exit') {
<del> // Exits the example. `this.props.onExampleExit` is provided
<del> // by the UI Explorer.
<del> this.props.onExampleExit && this.props.onExampleExit();
<del> return false;
<del> }
<del>
<del> const state = reducer(this.state, action);
<del> if (state === this.state) {
<del> return false;
<del> }
<del>
<del> this.setState(state);
<del> return true;
<del> }
<del>
<del> // This public method is optional. If exists, the UI explorer will call it
<del> // the "back button" is pressed. Normally this is the cases for Android only.
<del> handleBackAction(): boolean {
<del> return this._navigate('pop');
<del> }
<del>}
<del>
<del>class ExampleNavigator extends Component {
<del> props: {
<del> navigate: Function,
<del> navigationState: NavigationState,
<del> };
<del>
<del> static propTypes: {
<del> navigationState: NavigationPropTypes.navigationState.isRequired,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> render(): React.Element<any> {
<del> return (
<del> <NavigationTransitioner
<del> navigationState={this.props.navigationState}
<del> render={(transitionProps) => this._render(transitionProps)}
<del> configureTransition={this._configureTransition}
<del> />
<del> );
<del> }
<del>
<del> _render(
<del> transitionProps: NavigationTransitionProps,
<del> ): Array<React.Element<any>> {
<del> return transitionProps.scenes.map((scene) => {
<del> const sceneProps = {
<del> ...transitionProps,
<del> scene,
<del> };
<del> return this._renderScene(sceneProps);
<del> });
<del> }
<del>
<del> _renderScene(
<del> sceneProps: NavigationSceneRendererProps,
<del> ): React.Element<any> {
<del> return (
<del> <ExampleScene
<del> {...sceneProps}
<del> key={sceneProps.scene.key}
<del> navigate={this.props.navigate}
<del> />
<del> );
<del> }
<del>
<del> _configureTransition(): NavigationTransitionSpec {
<del> const easing: any = Easing.inOut(Easing.ease);
<del> return {
<del> duration: 500,
<del> easing,
<del> };
<del> }
<del>}
<del>
<del>class ExampleScene extends Component {
<del> props: NavigationSceneRendererProps & {
<del> navigate: Function,
<del> };
<del>
<del> static propTypes = {
<del> ...NavigationPropTypes.SceneRendererProps,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> render(): React.Element<any> {
<del> const {scene, navigate} = this.props;
<del> return (
<del> <Animated.View
<del> style={[styles.scene, this._getAnimatedStyle()]}>
<del> <ScrollView style={styles.scrollView}>
<del> <NavigationExampleRow
<del> text={scene.route.key}
<del> />
<del> <NavigationExampleRow
<del> text="Push Route"
<del> onPress={() => navigate('push')}
<del> />
<del> <NavigationExampleRow
<del> text="Pop Route"
<del> onPress={() => navigate('pop')}
<del> />
<del> <NavigationExampleRow
<del> text="Exit NavigationTransitioner Example"
<del> onPress={() => navigate('exit')}
<del> />
<del> </ScrollView>
<del> </Animated.View>
<del> );
<del> }
<del>
<del> _getAnimatedStyle(): Object {
<del> const {
<del> layout,
<del> position,
<del> scene,
<del> } = this.props;
<del>
<del> const {
<del> index,
<del> } = scene;
<del>
<del> const inputRange = [index - 1, index, index + 1];
<del> const width = layout.initWidth;
<del> const translateX = position.interpolate({
<del> inputRange,
<del> outputRange: ([width, 0, -10]: Array<number>),
<del> });
<del>
<del> return {
<del> transform: [
<del> { translateX },
<del> ],
<del> };
<del> }
<del>}
<del>
<del>const styles = StyleSheet.create({
<del> scene: {
<del> backgroundColor: '#E9E9EF',
<del> bottom: 0,
<del> flex: 1,
<del> left: 0,
<del> position: 'absolute',
<del> right: 0,
<del> shadowColor: 'black',
<del> shadowOffset: {width: 0, height: 0},
<del> shadowOpacity: 0.4,
<del> shadowRadius: 10,
<del> top: 0,
<del> },
<del> scrollView: {
<del> flex: 1,
<del> },
<del>});
<del>
<del>module.exports = Example;
<ide><path>Examples/UIExplorer/js/NavigationExperimental/NavigationTransitioner-AnimatedView-pager-example.js
<del>/**
<del> * Copyright (c) 2013-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> *
<del> * The examples provided by Facebook are for non-commercial testing and
<del> * evaluation purposes only.
<del> *
<del> * Facebook reserves all rights not expressly granted.
<del> *
<del> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
<del> * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
<del> * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
<del> * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
<del> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<del> *
<del> * @flow
<del> * @providesModule NavigationTransitioner-AnimatedView-pager-example
<del> */
<del>'use strict';
<del>
<del>const NavigationExampleRow = require('./NavigationExampleRow');
<del>const React = require('react');
<del>const ReactNative = require('react-native');
<del>
<del>/**
<del> * Basic example that shows how to use <NavigationTransitioner /> and
<del> * <Animated.View /> to build a list of animated scenes that render the
<del> * navigation state.
<del> */
<del>
<del>import type {
<del> NavigationSceneRendererProps,
<del> NavigationState,
<del> NavigationTransitionProps,
<del>} from 'NavigationTypeDefinition';
<del>
<del>const {
<del> Component,
<del> PropTypes,
<del>} = React;
<del>
<del>const {
<del> Animated,
<del> NavigationExperimental,
<del> StyleSheet,
<del> Text,
<del> View,
<del>} = ReactNative;
<del>
<del>const {
<del> PropTypes: NavigationPropTypes,
<del> StateUtils: NavigationStateUtils,
<del> Transitioner: NavigationTransitioner,
<del> Card: NavigationCard,
<del>} = NavigationExperimental;
<del>
<del>const {
<del> PagerPanResponder: NavigationPagerPanResponder,
<del> PagerStyleInterpolator: NavigationPagerStyleInterpolator,
<del>} = NavigationCard;
<del>
<del>function reducer(state: ?NavigationState, action: any): NavigationState {
<del> if (!state) {
<del> return {
<del> index: 0,
<del> routes: [
<del> {key: 'Step 1', color: '#ff0000'},
<del> {key: 'Step 2', color: '#ff7f00'},
<del> {key: 'Step 3', color: '#ffff00'},
<del> {key: 'Step 4', color: '#00ff00'},
<del> {key: 'Step 5', color: '#0000ff'},
<del> {key: 'Step 6', color: '#4b0082'},
<del> {key: 'Step 7', color: '#8f00ff'},
<del> ],
<del> };
<del> }
<del>
<del> switch (action) {
<del> case 'back':
<del> return NavigationStateUtils.back(state);
<del> case 'forward':
<del> return NavigationStateUtils.forward(state);
<del> }
<del> return state;
<del>}
<del>
<del>class Example extends Component {
<del> state: NavigationState;
<del> constructor(props: any, context: any) {
<del> super(props, context);
<del> this.state = reducer();
<del> }
<del>
<del> render(): React.Element<any> {
<del> return (
<del> <View style={styles.example}>
<del> <ExampleNavigator
<del> navigationState={this.state}
<del> navigate={action => this._navigate(action)}
<del> />
<del> <NavigationExampleRow
<del> text="Exit"
<del> onPress={() => this._navigate('exit')}
<del> />
<del> </View>
<del> );
<del> }
<del>
<del> _navigate(action: string): boolean {
<del> if (action === 'exit') {
<del> // Exits the example. `this.props.onExampleExit` is provided
<del> // by the UI Explorer.
<del> this.props.onExampleExit && this.props.onExampleExit();
<del> return false;
<del> }
<del>
<del> const state = reducer(this.state, action);
<del> if (state === this.state) {
<del> return false;
<del> }
<del>
<del> this.setState(state);
<del> return true;
<del> }
<del>
<del> // This public method is optional. If exists, the UI explorer will call it
<del> // the "back button" is pressed. Normally this is the cases for Android only.
<del> handleBackAction(): boolean {
<del> return this._navigate('back');
<del> }
<del>}
<del>
<del>class ExampleNavigator extends Component {
<del> _render: Function;
<del> _renderScene: Function;
<del>
<del> props: {
<del> navigate: Function,
<del> navigationState: NavigationState,
<del> };
<del>
<del> static propTypes: {
<del> navigationState: NavigationPropTypes.navigationState.isRequired,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> constructor(props, context) {
<del> super(props, context);
<del> this._render = this._render.bind(this);
<del> this._renderScene = this._renderScene.bind(this);
<del> }
<del>
<del> render(): React.Element<any> {
<del> return (
<del> <NavigationTransitioner
<del> navigationState={this.props.navigationState}
<del> render={this._render}
<del> />
<del> );
<del> }
<del>
<del> _render(
<del> transitionProps: NavigationTransitionProps,
<del> ): React.Element<any> {
<del> const scenes = transitionProps.scenes.map((scene) => {
<del> const sceneProps = {
<del> ...transitionProps,
<del> scene,
<del> };
<del> return this._renderScene(sceneProps);
<del> });
<del> return (
<del> <View style={styles.navigator}>
<del> {scenes}
<del> </View>
<del> );
<del> }
<del>
<del> _renderScene(
<del> sceneProps: NavigationSceneRendererProps,
<del> ): React.Element<any> {
<del> return (
<del> <ExampleScene
<del> {...sceneProps}
<del> key={sceneProps.scene.key + 'scene'}
<del> navigate={this.props.navigate}
<del> />
<del> );
<del> }
<del>}
<del>
<del>class ExampleScene extends Component {
<del> props: NavigationSceneRendererProps & {
<del> navigate: Function,
<del> };
<del>
<del> static propTypes = {
<del> ...NavigationPropTypes.SceneRendererProps,
<del> navigate: PropTypes.func.isRequired,
<del> };
<del>
<del> render(): React.Element<any> {
<del> const {scene, navigate} = this.props;
<del>
<del> const panHandlers = NavigationPagerPanResponder.forHorizontal({
<del> ...this.props,
<del> onNavigateBack: () => navigate('back'),
<del> onNavigateForward: () => navigate('forward'),
<del> });
<del>
<del> const route: any = scene.route;
<del> const style = [
<del> styles.scene,
<del> {backgroundColor: route.color},
<del> NavigationPagerStyleInterpolator.forHorizontal(this.props),
<del> ];
<del>
<del> return (
<del> <Animated.View
<del> {...panHandlers}
<del> style={style}>
<del> <View style={styles.heading}>
<del> <Text style={styles.headingText}>
<del> {scene.route.key}
<del> </Text>
<del> </View>
<del> </Animated.View>
<del> );
<del> }
<del>}
<del>
<del>const styles = StyleSheet.create({
<del> example: {
<del> flex: 1,
<del> },
<del> navigator: {
<del> flex: 1,
<del> },
<del> scene: {
<del> backgroundColor: '#000',
<del> bottom: 0,
<del> flex: 1,
<del> left: 0,
<del> position: 'absolute',
<del> right: 0,
<del> top: 0,
<del> },
<del> heading: {
<del> alignItems : 'center',
<del> flex: 1,
<del> justifyContent: 'center',
<del> },
<del> headingText: {
<del> color: '#222',
<del> fontSize: 24,
<del> fontWeight: 'bold',
<del> },
<del>});
<del>
<del>module.exports = Example;
<ide><path>Examples/UIExplorer/js/UIExplorerList.android.js
<ide> const APIExamples: Array<UIExplorerExample> = [
<ide> key: 'NativeAnimationsExample',
<ide> module: require('./NativeAnimationsExample'),
<ide> },
<del> {
<del> key: 'NavigationExperimentalExample',
<del> module: require('./NavigationExperimental/NavigationExperimentalExample'),
<del> },
<ide> {
<ide> key: 'NetInfoExample',
<ide> module: require('./NetInfoExample'),
<ide><path>Examples/UIExplorer/js/UIExplorerList.ios.js
<ide> const APIExamples: Array<UIExplorerExample> = [
<ide> module: require('./NativeAnimationsExample'),
<ide> supportsTVOS: true,
<ide> },
<del> {
<del> key: 'NavigationExperimentalExample',
<del> module: require('./NavigationExperimental/NavigationExperimentalExample'),
<del> supportsTVOS: true,
<del> },
<ide> {
<ide> key: 'NetInfoExample',
<ide> module: require('./NetInfoExample'),
| 9
|
Python
|
Python
|
add check_type functionality to numpy.distutils
|
8a36ae9ed4459e1a45a2656afeb862b5c96ce3f6
|
<ide><path>numpy/distutils/command/config.py
<ide> def check_decl(self, symbol,
<ide>
<ide> return self.try_compile(body, headers, include_dirs)
<ide>
<add> def check_type(self, type_name, headers=None, include_dirs=None,
<add> library_dirs=None):
<add> """Check type availability. Return True if the type can be compiled,
<add> False otherwise"""
<add> self._check_compiler()
<add>
<add> # First check the type can be compiled
<add> body = r"""
<add>int main() {
<add> if ((%(name)s *) 0)
<add> return 0;
<add> if (sizeof (%(name)s))
<add> return 0;
<add>}
<add>""" % {'name': type_name}
<add>
<add> st = False
<add> try:
<add> try:
<add> self._compile(body % {'type': type_name},
<add> headers, include_dirs, 'c')
<add> st = True
<add> except distutils.errors.CompileError, e:
<add> st = False
<add> finally:
<add> self._clean()
<add>
<add> return st
<add>
<ide> def check_type_size(self, type_name, headers=None, include_dirs=None, library_dirs=None, expected=None):
<ide> """Check size of a given type."""
<ide> self._check_compiler()
| 1
|
Text
|
Text
|
use sentence case for web crypto headers
|
98659c04d5ca5664fa03857beed23c4e43d98c92
|
<ide><path>doc/api/webcrypto.md
<ide> async function digest(data, algorithm = 'SHA-512') {
<ide> }
<ide> ```
<ide>
<del>## Algorithm Matrix
<add>## Algorithm matrix
<ide>
<ide> The table details the algorithms supported by the Node.js Web Crypto API
<ide> implementation and the APIs supported for each:
<ide> The wrapping algorithms currently supported include:
<ide> * `'AES-GCM'`
<ide> * `'AES-KW'`
<ide>
<del>## Algorithm Parameters
<add>## Algorithm parameters
<ide>
<ide> The algorithm parameter objects define the methods and parameters used by
<ide> the various {SubtleCrypto} methods. While described here as "classes", they
| 1
|
PHP
|
PHP
|
track the exit code of scheduled event commands
|
dc8e71e174952f6810a9846a208395a17eee7569
|
<ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> class Event
<ide> */
<ide> public $mutex;
<ide>
<add> /**
<add> * The command exit status code.
<add> *
<add> * @var int
<add> */
<add> public $exitCode;
<add>
<ide> /**
<ide> * Create a new event instance.
<ide> *
<ide> protected function runCommandInForeground(Container $container)
<ide> {
<ide> $this->callBeforeCallbacks($container);
<ide>
<del> Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();
<add> $this->exitCode = Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();
<ide>
<ide> $this->callAfterCallbacks($container);
<ide> }
| 1
|
Text
|
Text
|
update sync instructions
|
3345f603ac63549df01d2f12e3fb96bb6e84f11d
|
<ide><path>docs/how-to-setup-freecodecamp-locally.md
<ide> Start by installing these prerequisite software.
<ide> | Prerequisite | Version | Notes |
<ide> | ------------------------------------------- | ------- | ----- |
<ide> | [MongoDB Community Server](https://docs.mongodb.com/manual/administration/install-community/) | `3.6` | [Release Notes](https://docs.mongodb.com/manual/release-notes/), Note: We currently on `3.6`, an [upgrade is planned](https://github.com/freeCodeCamp/freeCodeCamp/issues/18275).
<del>| [Node.js](http://nodejs.org) | `8.x` | [LTS Schedule](https://github.com/nodejs/Release#release-schedule) |
<add>| [Node.js](http://nodejs.org) | `8.x` | [LTS Schedule](https://github.com/nodejs/Release#release-schedule), Note: We currently on `8.x`, an upgrade is planned to 10.x |
<ide> | npm (comes bundled with Node) | `6.x` | Does not have LTS releases, we use the version bundled with Node LTS |
<ide>
<ide> **Important:**
<ide> Follow these steps:
<ide> git checkout master
<ide> ```
<ide>
<del>2. Next, you would want to `rebase` from the `upstream`.
<add>2. Next, you would want to **sync the lastest changes for `master` branch** from the main repository of freeCodeCamp.
<ide>
<del> This step **will sync the lastest changes** from the main repository of freeCodeCamp. Its important that you rebase as often as possible, to avoid conflicts later.
<add> **Note:** If you have any outstanding pull-request that you made from the `master` branch of your fork previously, you will lose them. You should get it merged by a moderator, prior following this. To avoid this, you should always work on a branch.
<add>
<add> Its recommended that you do this as often as possible, to avoid conflicts later:
<add>
<add> ```shell
<add> git fetch upstream
<add> ```
<add>
<add> Now, you want to do a hard reset with the copy on the freeCodeCamp master:
<ide>
<ide> ```shell
<del> git pull --rebase upstream master
<add> git reset --hard upstream/master
<ide> ```
<ide>
<del> You can optionally push this branch back to your origin, to have a clean history on your fork on GitHub.
<add> Push this branch back to your origin, to have a clean history on your fork on GitHub:
<ide>
<ide> ```shell
<ide> git push origin master --force
<ide> Follow these steps:
<ide>
<ide> You can learn more about why you should use conventional commits [here](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#why-use-conventional-commits).
<ide>
<del>9. If you realise that you need to edit a file or, update the commit message after making a commit you can do so after editing the files with:
<add>9. If you realise that you need to edit a file or update the commit message after making a commit you can do so after editing the files with:
<ide>
<ide> ```shell
<ide> git commit --amend
<ide> Follow these steps:
<ide>
<ide> This is very important when you are making changes that are not copy editing markdown files. For example, changes to CSS or JavaScript code, etc.
<ide>
<del>## Get your PR accepted
<del>
<del>
<del>
<ide> ## Getting Help
<ide>
<ide> If you are stuck, and need help, let us know by asking in the ['Contributors' category on our forum](https://www.freecodecamp.org/forum/c/contributors) or the [Contributors chat room](https://gitter.im/FreeCodeCamp/Contributors) on Gitter.
| 1
|
Python
|
Python
|
avoid deprecated non-tuple indexing
|
7bf34020951f2c99d390870b085843835057e4a7
|
<ide><path>numpy/lib/index_tricks.py
<ide> def __getitem__(self, key):
<ide> slobj = [_nx.newaxis]*len(size)
<ide> for k in range(len(size)):
<ide> slobj[k] = slice(None, None)
<del> nn[k] = nn[k][slobj]
<add> nn[k] = nn[k][tuple(slobj)]
<ide> slobj[k] = _nx.newaxis
<ide> return nn
<ide> except (IndexError, TypeError):
<ide><path>numpy/lib/tests/test_index_tricks.py
<ide> assert_array_almost_equal, assert_raises, assert_raises_regex
<ide> )
<ide> from numpy.lib.index_tricks import (
<del> mgrid, ndenumerate, fill_diagonal, diag_indices, diag_indices_from,
<add> mgrid, ogrid, ndenumerate, fill_diagonal, diag_indices, diag_indices_from,
<ide> index_exp, ndindex, r_, s_, ix_
<ide> )
<ide>
<ide> def test_nd(self):
<ide> assert_array_almost_equal(d[1, :, 1] - d[1, :, 0],
<ide> 0.2*np.ones(20, 'd'), 11)
<ide>
<add> def test_sparse(self):
<add> grid_full = mgrid[-1:1:10j, -2:2:10j]
<add> grid_sparse = ogrid[-1:1:10j, -2:2:10j]
<add>
<add> # sparse grids can be made dense by broadcasting
<add> grid_broadcast = np.broadcast_arrays(*grid_sparse)
<add> for f, b in zip(grid_full, grid_broadcast):
<add> assert_equal(f, b)
<add>
<ide>
<ide> class TestConcatenator(object):
<ide> def test_1d(self):
| 2
|
Python
|
Python
|
fix various lossscaleoptimizer issues
|
c98ea36b96f6036b1dec569e5e496aee06a44b29
|
<ide><path>keras/engine/training_v1.py
<ide> def _set_optimizer(self, optimizer):
<ide> if not isinstance(self.optimizer, optimizer_v2.OptimizerV2):
<ide> raise ValueError(
<ide> '"optimizer" must be an instance of '
<del> "tf.keras.optimizers.Optimizer when a dype policy "
<del> "with a loss scale used, but got: %s. Using policy: "
<add> "tf.keras.optimizers.legacy.Optimizer when a dype policy "
<add> "with a loss scale is used, but got: %s. Using policy: "
<ide> "%s" % (self.optimizer, self._dtype_policy)
<ide> )
<ide> self.optimizer = loss_scale_optimizer.LossScaleOptimizer(
<ide><path>keras/mixed_precision/loss_scale_optimizer.py
<ide> def from_config(cls, config, custom_objects=None):
<ide> "longer be deserialized"
<ide> )
<ide> config["inner_optimizer"] = config.pop("optimizer")
<del> inner_optimizer = optimizers.deserialize(
<del> config["inner_optimizer"],
<del> custom_objects=custom_objects,
<del> use_legacy_optimizer=True,
<del> )
<add> if isinstance(config["inner_optimizer"], optimizer_v2.OptimizerV2):
<add> inner_optimizer = config["inner_optimizer"]
<add> else:
<add> inner_optimizer = optimizers.deserialize(
<add> config["inner_optimizer"],
<add> custom_objects=custom_objects,
<add> use_legacy_optimizer=True,
<add> )
<ide> del config["inner_optimizer"]
<ide> return cls(inner_optimizer, **config)
<ide>
<ide> def get_config(self):
<ide> @classmethod
<ide> def from_config(cls, config, custom_objects=None):
<ide> config = config.copy() # Make a copy, since we mutate config
<del> inner_optimizer = optimizers.deserialize(
<del> config["inner_optimizer"],
<del> custom_objects=custom_objects,
<del> use_legacy_optimizer=False,
<del> )
<add> if isinstance(config["inner_optimizer"], optimizer.Optimizer):
<add> inner_optimizer = config["inner_optimizer"]
<add> else:
<add> inner_optimizer = optimizers.deserialize(
<add> config["inner_optimizer"],
<add> custom_objects=custom_objects,
<add> use_legacy_optimizer=False,
<add> )
<ide> del config["inner_optimizer"]
<ide> return cls(inner_optimizer, **config)
<ide>
<ide> def iterations(self):
<ide> def iterations(self, variable):
<ide> self._optimizer.iterations = variable
<ide>
<add> @property
<add> def variables(self):
<add> return self._optimizer.variables
<add>
<add> def build(self, var_list):
<add> return self._optimizer.build(var_list)
<add>
<ide> @property
<ide> def learning_rate(self):
<ide> return self._optimizer.learning_rate
<ide><path>keras/mixed_precision/loss_scale_optimizer_test.py
<ide> from keras.optimizers.legacy import adam
<ide> from keras.optimizers.legacy import gradient_descent
<ide> from keras.optimizers.legacy import optimizer_v2
<add>from keras.optimizers.schedules import learning_rate_schedule
<ide> from keras.testing_infra import test_combinations
<add>from keras.testing_infra import test_utils
<ide>
<ide> # isort: off
<ide> from tensorflow.python.framework import (
<ide> def __init__(self, *args, **kwargs):
<ide> self.assertEqual(opt.dynamic_growth_steps, 3.0)
<ide> self.assertEqual(opt.inner_optimizer.my_attribute, 123)
<ide>
<add> @test_utils.run_v2_only
<add> def testConvertToLegacyOptimizer(self):
<add> opt = sgd_experimental.SGD(1.0)
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(opt)
<add> converted_opt = optimizers.convert_to_legacy_optimizer(opt)
<add> self.assertEqual(
<add> type(converted_opt), loss_scale_optimizer.LossScaleOptimizer
<add> )
<add>
<add> reference_opt = gradient_descent.SGD(1.0)
<add> reference_opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<add> reference_opt
<add> )
<add> self.assertEqual(converted_opt.get_config(), reference_opt.get_config())
<add>
<add> # Test with a custom learning rate schedule
<add> class CustomLRSchedule(learning_rate_schedule.LearningRateSchedule):
<add> def __init__(self, initial_learning_rate):
<add> self.initial_learning_rate = initial_learning_rate
<add>
<add> def __call__(self, step):
<add> step = tf.cast(step, tf.float32)
<add> return self.initial_learning_rate / (step + 1)
<add>
<add> def get_config(self):
<add> return {"initial_learning_rate": self.initial_learning_rate}
<add>
<add> opt = sgd_experimental.SGD(CustomLRSchedule(1.0))
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(opt)
<add> converted_opt = optimizers.convert_to_legacy_optimizer(opt)
<add> self.assertEqual(
<add> type(converted_opt), loss_scale_optimizer.LossScaleOptimizer
<add> )
<add>
<add> reference_opt = gradient_descent.SGD(CustomLRSchedule(1.0))
<add> reference_opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<add> reference_opt
<add> )
<add> self.assertEqual(converted_opt.get_config(), reference_opt.get_config())
<add>
<ide> @test_combinations.generate(opt_combinations_only())
<ide> def testUnsupportedStrategy(self, opt_cls):
<ide> strategy = tf.distribute.experimental.CentralStorageStrategy()
<ide><path>keras/mixed_precision/model_test.py
<ide> from keras.mixed_precision import policy
<ide> from keras.mixed_precision import test_util as mp_test_util
<ide> from keras.optimizers import optimizer_v1
<add>from keras.optimizers import sgd
<ide> from keras.optimizers.legacy import gradient_descent
<ide> from keras.saving import object_registration
<ide> from keras.saving.legacy import save
<ide> def _skip_if_save_format_unsupported(self, save_format):
<ide> "save_format": "tf",
<ide> "use_regularizer": True,
<ide> },
<add> {
<add> "testcase_name": "saved_model_legacy_distribute",
<add> "strategy_fn": create_mirrored_strategy,
<add> "save_format": "tf",
<add> "use_regularizer": True,
<add> "use_legacy_optimizer": True,
<add> },
<ide> {
<ide> "testcase_name": "saved_model_input_spec_distribute",
<ide> "strategy_fn": create_mirrored_strategy,
<ide> def _skip_if_save_format_unsupported(self, save_format):
<ide> "save_format": "h5",
<ide> "use_regularizer": True,
<ide> },
<add> {
<add> "testcase_name": "h5_legacy_distribute",
<add> "strategy_fn": create_mirrored_strategy,
<add> "save_format": "h5",
<add> "use_regularizer": True,
<add> "use_legacy_optimizer": True,
<add> },
<ide> )
<ide> def test_model(
<ide> self,
<ide> def test_model(
<ide> get_config=False,
<ide> save_format=None,
<ide> use_input_spec=False,
<add> use_legacy_optimizer=False,
<ide> ):
<ide> self._skip_if_strategy_unsupported(strategy_fn)
<ide> self._skip_if_save_format_unsupported(save_format)
<add> if not tf.__internal__.tf2.enabled():
<add> # The non-legacy optimizer is only supported in TF2
<add> use_legacy_optimizer = True
<ide> if use_regularizer:
<ide> weight_regularizer = mp_test_util.IdentityRegularizer()
<ide> activity_regularizer = mp_test_util.ReduceSumRegularizer()
<ide> def loss_fn(y_true, y_pred):
<ide> # variable, the variable will not change. So this tests the
<ide> # learning rate not applied to a float16 value, but instead the
<ide> # float32 variable.
<del> opt = gradient_descent.SGD(2**-14)
<add> learning_rate = 2**-14
<add> if use_legacy_optimizer:
<add> opt = gradient_descent.SGD(learning_rate)
<add> else:
<add> opt = sgd.SGD(learning_rate)
<ide> # Use a fixed loss scale, as this test will fail if gradients
<ide> # are skipped for a step due to dynamic loss scaling.
<del> opt = loss_scale_optimizer.LossScaleOptimizer(
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<ide> opt, dynamic=False, initial_scale=8
<ide> )
<ide> model.compile(
<ide> def _test_saving(self, model, dataset, save_format, use_regularizer):
<ide> },
<ide> )
<ide> def test_fixed_loss_scaling(self, strategy_fn):
<add> # The non-legacy optimizer is only supported in TF2
<add> use_legacy_optimizer = not tf.__internal__.tf2.enabled()
<ide> # Note: We do not test mixed precision in this method, only loss
<ide> # scaling.
<ide> loss_scale = 8.0
<ide> def loss_fn(y_true, y_pred):
<ide> del y_true
<ide> return tf.reduce_mean(y_pred)
<ide>
<del> opt = gradient_descent.SGD(1.0)
<del> opt = loss_scale_optimizer.LossScaleOptimizer(
<add> if use_legacy_optimizer:
<add> opt = gradient_descent.SGD(1.0)
<add> else:
<add> opt = sgd.SGD(1.0)
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<ide> opt, dynamic=False, initial_scale=loss_scale
<ide> )
<ide> model.compile(
<ide> def test_advanced_model(self, strategy_fn, use_loss_scaling=False):
<ide> if use_loss_scaling:
<ide> loss_scale = 8.0
<ide> learning_rate = 2**-14
<add> # The non-legacy optimizer is only supported in TF2
<add> use_legacy_optimizer = not tf.__internal__.tf2.enabled()
<ide>
<ide> with strategy.scope():
<ide> with policy.policy_scope(policy.Policy("mixed_float16")):
<ide> def loss_fn(y_true, y_pred):
<ide> del y_true
<ide> return tf.reduce_mean(y_pred)
<ide>
<del> opt = gradient_descent.SGD(learning_rate)
<add> if use_legacy_optimizer:
<add> opt = gradient_descent.SGD(learning_rate)
<add> else:
<add> opt = sgd.SGD(learning_rate)
<ide> if use_loss_scaling:
<del> opt = loss_scale_optimizer.LossScaleOptimizer(
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<ide> opt, dynamic=False, initial_scale=loss_scale
<ide> )
<ide> model.compile(
<ide> def test_dynamic_loss_scaling(self, strategy_fn, get_config=False):
<ide> # gradients
<ide> have_nan_gradients = backend.variable(False, dtype=tf.bool)
<ide> with strategy.scope():
<del> opt = gradient_descent.SGD(1.0)
<del> opt = loss_scale_optimizer.LossScaleOptimizer(
<add> opt = sgd.SGD(1.0)
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<ide> opt, initial_scale=initial_loss_scale, dynamic_growth_steps=2
<ide> )
<ide> with policy.policy_scope("mixed_float16"):
<ide> def test_compile_wraps_with_loss_scale_optimizer(self):
<ide> x = layers.Input(shape=(1,))
<ide> y = mp_test_util.MultiplyLayer()(x)
<ide>
<add> # The non-legacy optimizer is only supported in TF2
<add> use_legacy_optimizer = (
<add> not tf.__internal__.tf2.enabled() or not tf.executing_eagerly()
<add> )
<add>
<ide> with policy.policy_scope("mixed_float16"):
<ide> # Test optimizer is automatically wrapped with LSO
<ide> model = models.Model(x, y)
<del> model.compile(gradient_descent.SGD(1.0), "mse")
<add> if use_legacy_optimizer:
<add> optimizer = gradient_descent.SGD(1.0)
<add> else:
<add> optimizer = sgd.SGD(1.0)
<add> model.compile(optimizer, "mse")
<ide> self.assertIsInstance(
<del> model.optimizer, loss_scale_optimizer.LossScaleOptimizer
<add> model.optimizer, loss_scale_optimizer.BaseLossScaleOptimizer
<ide> )
<ide> self.assertEqual(
<ide> backend.get_value(model.optimizer.learning_rate), 1.0
<ide> def test_compile_wraps_with_loss_scale_optimizer(self):
<ide> model = models.Model(x, y)
<ide> model.compile("sgd", "mse")
<ide> self.assertIsInstance(
<del> model.optimizer,
<del> (
<del> loss_scale_optimizer.LossScaleOptimizer,
<del> loss_scale_optimizer.LossScaleOptimizerV3,
<del> ),
<add> model.optimizer, loss_scale_optimizer.BaseLossScaleOptimizer
<ide> )
<ide>
<ide> # Test if an LSO is passed, optimizer is not automatically wrapped
<ide> # with another LSO
<ide> model = models.Model(x, y)
<del> optimizer = loss_scale_optimizer.LossScaleOptimizer(
<del> gradient_descent.SGD(1.0), dynamic_growth_steps=2
<add> if use_legacy_optimizer:
<add> optimizer = gradient_descent.SGD(1.0)
<add> else:
<add> optimizer = sgd.SGD(1.0)
<add> optimizer = loss_scale_optimizer.BaseLossScaleOptimizer(
<add> optimizer, dynamic_growth_steps=2
<ide> )
<ide> model.compile(optimizer, "mse")
<ide> self.assertIsInstance(
<del> model.optimizer, loss_scale_optimizer.LossScaleOptimizer
<add> model.optimizer, loss_scale_optimizer.BaseLossScaleOptimizer
<ide> )
<ide> self.assertEqual(model.optimizer.dynamic_growth_steps, 2)
<ide>
<ide> with policy.policy_scope("mixed_bfloat16"):
<ide> # Test mixed_bfloat16 models are not automatically wrapped with LSO
<ide> model = models.Model(x, y)
<del> model.compile(gradient_descent.SGD(1.0), "mse")
<add> if use_legacy_optimizer:
<add> optimizer = gradient_descent.SGD(1.0)
<add> else:
<add> optimizer = sgd.SGD(1.0)
<add> model.compile(optimizer, "mse")
<ide> self.assertNotIsInstance(
<del> model.optimizer, loss_scale_optimizer.LossScaleOptimizer
<add> model.optimizer, loss_scale_optimizer.BaseLossScaleOptimizer
<add> )
<add> self.assertIsInstance(
<add> model.optimizer,
<add> gradient_descent.SGD if use_legacy_optimizer else sgd.SGD,
<ide> )
<del> self.assertIsInstance(model.optimizer, gradient_descent.SGD)
<ide>
<ide> @test_combinations.generate(
<ide> test_combinations.combine(mode=["graph", "eager"])
<ide> def test_save_weights_with_autocast_vars(self, strategy_fn, h5=False):
<ide> "testcase_name": "distribute",
<ide> "strategy_fn": create_mirrored_strategy,
<ide> },
<add> {
<add> "testcase_name": "distribute_legacy",
<add> "strategy_fn": create_mirrored_strategy,
<add> "use_legacy_optimizer": True,
<add> },
<ide> {
<ide> "testcase_name": "different_var_name",
<ide> "strategy_fn": default_strategy_fn,
<ide> def test_save_weights_with_autocast_vars(self, strategy_fn, h5=False):
<ide> },
<ide> )
<ide> def test_save_slot_variables_with_autocast_vars(
<del> self, strategy_fn, var_name="v"
<add> self, strategy_fn, var_name="v", use_legacy_optimizer=False
<ide> ):
<add> if not tf.__internal__.tf2.enabled():
<add> # The non-legacy optimizer is only supported in TF2
<add> use_legacy_optimizer = True
<ide> p = policy.Policy("mixed_float16")
<ide> with strategy_fn().scope(), policy.policy_scope(p):
<ide> x = layers.Input(shape=(2,), batch_size=2)
<ide> def test_save_slot_variables_with_autocast_vars(
<ide> )
<ide> y = layer(x)
<ide> model = models.Model(inputs=x, outputs=y)
<del> opt = gradient_descent.SGD(1.0, 1.0)
<del> opt = loss_scale_optimizer.LossScaleOptimizer(
<add> if use_legacy_optimizer:
<add> opt = gradient_descent.SGD(1.0, 1.0)
<add> else:
<add> opt = sgd.SGD(1.0, 1.0)
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<ide> opt, dynamic=False, initial_scale=1
<ide> )
<ide> model.compile(
<ide> def test_save_slot_variables_with_autocast_vars(
<ide> run_eagerly=test_utils.should_run_eagerly(),
<ide> )
<ide>
<add> def get_momentum_slot():
<add> if use_legacy_optimizer:
<add> return opt.get_slot(layer.v, "momentum")
<add> else:
<add> return opt.inner_optimizer.momentums[0]
<add>
<ide> model.fit(np.ones((2, 2)), np.zeros((2, 2)), batch_size=2)
<ide> weights_file = os.path.join(self.get_temp_dir(), "weights")
<ide> model.save_weights(weights_file)
<del> saved_slot = backend.get_value(opt.get_slot(layer.v, "momentum"))
<add> saved_slot = backend.get_value(get_momentum_slot())
<ide>
<ide> model.fit(np.ones((2, 2)), np.zeros((2, 2)), batch_size=2)
<del> new_slot = backend.get_value(opt.get_slot(layer.v, "momentum"))
<add> new_slot = backend.get_value(get_momentum_slot())
<ide> self.assertNotEqual(new_slot, saved_slot)
<ide>
<ide> model.load_weights(weights_file)
<del> restored_slot = backend.get_value(opt.get_slot(layer.v, "momentum"))
<add> restored_slot = backend.get_value(get_momentum_slot())
<ide> self.assertEqual(restored_slot, saved_slot)
<ide>
<ide> @test_combinations.run_all_keras_modes
<ide> def test_save_weights_with_dynamic_loss_scaling(self, strategy_fn):
<ide> # TODO(b/121381184): Enable running the test in this case.
<ide> return
<ide>
<add> # The non-legacy optimizer is only supported in TF2
<add> use_legacy_optimizer = not tf.__internal__.tf2.enabled()
<add>
<ide> # Create and run model.
<ide> with strategy.scope():
<ide> x = layers.Input(shape=(2,), batch_size=2, dtype=tf.float32)
<ide> y = mp_test_util.MultiplyLayer(assert_type=tf.float32)(x)
<ide> model = models.Model(inputs=x, outputs=y)
<ide>
<del> opt = gradient_descent.SGD(1.0)
<del> opt = loss_scale_optimizer.LossScaleOptimizer(
<add> if use_legacy_optimizer:
<add> opt = gradient_descent.SGD(1.0)
<add> else:
<add> opt = sgd.SGD(1.0)
<add> opt = loss_scale_optimizer.BaseLossScaleOptimizer(
<ide> opt, initial_scale=1.0, dynamic_growth_steps=2.0
<ide> )
<ide> model.compile(
<ide> def test_save_weights_with_dynamic_loss_scaling(self, strategy_fn):
<ide> def test_restore_old_loss_scale_checkpoint(self):
<ide> # Ensure a checkpoint from TF 2.2 can be loaded. The checkpoint format
<ide> # of LossScaleOptimizer changed, but old checkpoints can still be loaded
<add> # into the legacy optimizers.
<ide> opt = gradient_descent.SGD(0.1, momentum=0.1)
<ide> opt = loss_scale_optimizer.LossScaleOptimizer(opt)
<ide> model = sequential.Sequential(
<ide> def test_save_model_with_dynamic_loss_scaling(self, strategy_fn, h5=False):
<ide> y = mp_test_util.MultiplyLayer()(x)
<ide> model = models.Model(inputs=x, outputs=y)
<ide>
<add> # Only test the legacy optimizer. The new optimizer does not
<add> # support saving optimizer weights.
<ide> opt = gradient_descent.SGD(1.0)
<ide> opt = loss_scale_optimizer.LossScaleOptimizer(
<ide> opt, initial_scale=1.0, dynamic_growth_steps=2.0
<ide><path>keras/optimizers/__init__.py
<ide> def convert_to_legacy_optimizer(optimizer):
<ide> Args:
<ide> optimizer: An instance of `tf.keras.optimizers.experimental.Optimizer`.
<ide> """
<add> # loss_scale_optimizer has a direct dependency of optimizer, import here
<add> # rather than top to avoid the cyclic dependency.
<add> from keras.mixed_precision import (
<add> loss_scale_optimizer,
<add> )
<add>
<ide> if not isinstance(optimizer, base_optimizer.Optimizer):
<ide> raise ValueError(
<ide> "`convert_to_legacy_optimizer` should only be called "
<ide> def convert_to_legacy_optimizer(optimizer):
<ide> ]
<ide> for key in keys_to_remove:
<ide> config.pop(key, None)
<add>
<add> if isinstance(optimizer, loss_scale_optimizer.LossScaleOptimizerV3):
<add> # For LossScaleOptimizers, recursively convert the inner optimizer
<add> config["inner_optimizer"] = convert_to_legacy_optimizer(
<add> optimizer.inner_optimizer
<add> )
<add> if optimizer_name == "lossscaleoptimizerv3":
<add> optimizer_name = "lossscaleoptimizer"
<add>
<ide> # Learning rate can be a custom LearningRateSchedule, which is stored as
<ide> # a dict in config, and cannot be deserialized.
<del> if isinstance(
<add> if hasattr(optimizer, "_learning_rate") and isinstance(
<ide> optimizer._learning_rate, learning_rate_schedule.LearningRateSchedule
<ide> ):
<ide> config["learning_rate"] = optimizer._learning_rate
| 5
|
Go
|
Go
|
simplify udev log, and update link
|
a5ebd28797c8e757e08e2d5bf09f447793eadc72
|
<ide><path>daemon/graphdriver/devmapper/deviceset.go
<ide> import (
<ide> "time"
<ide>
<ide> "github.com/docker/docker/daemon/graphdriver"
<del> "github.com/docker/docker/dockerversion"
<ide> "github.com/docker/docker/pkg/devicemapper"
<ide> "github.com/docker/docker/pkg/dmesg"
<ide> "github.com/docker/docker/pkg/idtools"
<ide> func (devices *DeviceSet) initDevmapper(doInit bool) (retErr error) {
<ide>
<ide> // https://github.com/docker/docker/issues/4036
<ide> if supported := devicemapper.UdevSetSyncSupport(true); !supported {
<del> if dockerversion.IAmStatic == "true" {
<del> logger.Error("Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a dynamic binary to use devicemapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/dockerd/#storage-driver-options")
<del> } else {
<del> logger.Error("Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a more recent version of libdevmapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/dockerd/#storage-driver-options")
<del> }
<del>
<add> logger.Error("Udev sync is not supported, which will lead to data loss and unexpected behavior. Make sure you have a recent version of libdevmapper installed and are running a dynamic binary, or select a different storage driver. For more information, see https://docs.docker.com/go/storage-driver/")
<ide> if !devices.overrideUdevSyncCheck {
<ide> return graphdriver.ErrNotSupported
<ide> }
| 1
|
PHP
|
PHP
|
fix bug with force create
|
1a4fe3e5518b87302ccc1ec82ba8e9a13a3a52a1
|
<ide><path>src/Illuminate/Database/Eloquent/Builder.php
<ide> public function create(array $attributes = [])
<ide> */
<ide> public function forceCreate(array $attributes)
<ide> {
<del> $instance = $this->model->newInstance($attributes)->setConnection(
<add> $instance = $this->model->newInstance()->setConnection(
<ide> $this->query->getConnection()->getName()
<ide> );
<ide>
| 1
|
Java
|
Java
|
log unresolved exceptions at error level
|
324c310cbd3a95da73d36a6f868a538742a10c4f
|
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ReactorHttpHandlerAdapter.java
<ide> public Mono<Void> apply(HttpChannel channel) {
<ide>
<ide> return this.delegate.handle(adaptedRequest, adaptedResponse)
<ide> .otherwise(ex -> {
<del> logger.debug("Could not complete request", ex);
<add> logger.error("Could not complete request", ex);
<ide> channel.status(HttpResponseStatus.INTERNAL_SERVER_ERROR);
<ide> return Mono.empty();
<ide> })
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java
<ide> public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerRes
<ide>
<ide> Publisher<Void> result = this.delegate.handle(adaptedRequest, adaptedResponse)
<ide> .otherwise(ex -> {
<del> logger.debug("Could not complete request", ex);
<add> logger.error("Could not complete request", ex);
<ide> response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
<ide> return Mono.empty();
<ide> })
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java
<ide> public void onNext(Void aVoid) {
<ide>
<ide> @Override
<ide> public void onError(Throwable ex) {
<del> logger.debug("Could not complete request", ex);
<add> logger.error("Could not complete request", ex);
<ide> HttpServletResponse response = (HttpServletResponse) this.asyncContext.getResponse();
<ide> response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
<ide> this.asyncContext.complete();
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/UndertowHttpHandlerAdapter.java
<ide> public void onNext(Void aVoid) {
<ide> }
<ide> @Override
<ide> public void onError(Throwable ex) {
<del> logger.debug("Could not complete request", ex);
<add> logger.error("Could not complete request", ex);
<ide> if (!exchange.isResponseStarted() && exchange.getStatusCode() <= 500) {
<ide> exchange.setStatusCode(500);
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/web/server/adapter/WebHttpHandlerBuilder.java
<ide> public HttpHandler build() {
<ide> WebFilter[] array = new WebFilter[this.filters.size()];
<ide> webHandler = new FilteringWebHandler(webHandler, this.filters.toArray(array));
<ide> }
<del> if (!this.exceptionHandlers.isEmpty()) {
<del> WebExceptionHandler[] array = new WebExceptionHandler[this.exceptionHandlers.size()];
<del> webHandler = new ExceptionHandlingWebHandler(webHandler, this.exceptionHandlers.toArray(array));
<del> }
<add> WebExceptionHandler[] array = new WebExceptionHandler[this.exceptionHandlers.size()];
<add> webHandler = new ExceptionHandlingWebHandler(webHandler, this.exceptionHandlers.toArray(array));
<ide> HttpWebHandlerAdapter httpHandler = new HttpWebHandlerAdapter(webHandler);
<ide> if (this.sessionManager != null) {
<ide> httpHandler.setSessionManager(this.sessionManager);
<ide><path>spring-web/src/main/java/org/springframework/web/server/handler/ExceptionHandlingWebHandler.java
<ide> else if (disconnectedClientLogger.isDebugEnabled()) {
<ide> }
<ide> }
<ide> else {
<del> logger.debug("Could not complete request", ex);
<add> logger.error("Could not complete request", ex);
<ide> }
<ide> }
<ide>
| 6
|
Ruby
|
Ruby
|
remove redundant check for `sorbet-runtime`
|
117ae2c068e5795b08c15027ed89e7d1ddd004eb
|
<ide><path>Library/Homebrew/utils/sorbet.rb
<ide> Homebrew.install_bundler_gems!
<ide> require "sorbet-runtime"
<ide> else
<del> begin
<del> gem "sorbet-runtime"
<del> raise "Loaded `sorbet-runtime` instead of `sorbet-runtime-stub`."
<del> rescue Gem::LoadError
<del> nil
<del> end
<del>
<ide> require "sorbet-runtime-stub"
<ide> end
| 1
|
Ruby
|
Ruby
|
add homebrew to tex requirement
|
68f27922bca5888d1003dcd736621657316d8a9e
|
<ide><path>Library/Homebrew/requirements.rb
<ide> def message;
<ide> end
<ide>
<ide> <<-EOS.undent
<del> A LaTeX distribution is required to install.
<add> A LaTeX distribution is required for Homebrew to install this formula.
<ide>
<ide> You can install MacTeX distribution from:
<ide> http://www.tug.org/mactex/
| 1
|
Javascript
|
Javascript
|
throw exception when recursive $apply
|
0bf611087b2773fd36cf95c938d1cda8e65ffb2b
|
<ide><path>src/service/scope.js
<ide> */
<ide> function $RootScopeProvider(){
<ide> this.$get = ['$injector', '$exceptionHandler', '$parse',
<del> function( $injector, $exceptionHandler, $parse){
<add> function( $injector, $exceptionHandler, $parse) {
<add>
<ide> /**
<ide> * @ngdoc function
<ide> * @name angular.module.ng.$rootScope.Scope
<ide> function $RootScopeProvider(){
<ide> child.$parent = this;
<ide> child.$id = nextUid();
<ide> child.$$asyncQueue = [];
<del> child.$$phase = child.$$watchers =
<del> child.$$nextSibling = child.$$childHead = child.$$childTail = null;
<add> child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
<ide> child.$$prevSibling = this.$$childTail;
<ide> if (this.$$childHead) {
<ide> this.$$childTail.$$nextSibling = child;
<ide> function $RootScopeProvider(){
<ide> watchLog = [],
<ide> logIdx, logMsg;
<ide>
<del> if (target.$$phase) {
<del> throw Error(target.$$phase + ' already in progress');
<del> }
<del> do {
<add> flagPhase(target, '$digest');
<ide>
<add> do {
<ide> dirty = false;
<ide> current = target;
<ide> do {
<del> current.$$phase = '$digest';
<ide> asyncQueue = current.$$asyncQueue;
<ide> while(asyncQueue.length) {
<ide> try {
<ide> function $RootScopeProvider(){
<ide> watch.last = copy(value);
<ide> watch.fn(current, value, ((last === initWatchVal) ? value : last));
<ide> if (ttl < 5) {
<del> logIdx = 4-ttl;
<add> logIdx = 4 - ttl;
<ide> if (!watchLog[logIdx]) watchLog[logIdx] = [];
<ide> logMsg = (isFunction(watch.exp))
<ide> ? 'fn: ' + (watch.exp.name || watch.exp.toString())
<ide> function $RootScopeProvider(){
<ide> }
<ide> }
<ide>
<del> current.$$phase = null;
<del>
<ide> // Insanity Warning: scope depth-first traversal
<ide> // yes, this code is a bit crazy, but it works and we have tests to prove it!
<ide> // this piece should be kept in sync with the traversal in $broadcast
<ide> function $RootScopeProvider(){
<ide> 'Watchers fired in the last 5 iterations: ' + toJson(watchLog));
<ide> }
<ide> } while (dirty || asyncQueue.length);
<add>
<add> this.$root.$$phase = null;
<ide> },
<ide>
<ide> /**
<ide> function $RootScopeProvider(){
<ide> */
<ide> $apply: function(expr) {
<ide> try {
<add> flagPhase(this, '$apply');
<ide> return this.$eval(expr);
<ide> } catch (e) {
<ide> $exceptionHandler(e);
<ide> } finally {
<add> this.$root.$$phase = null;
<ide> this.$root.$digest();
<ide> }
<ide> },
<ide> function $RootScopeProvider(){
<ide> }
<ide> };
<ide>
<add>
<add> function flagPhase(scope, phase) {
<add> var root = scope.$root;
<add>
<add> if (root.$$phase) {
<add> throw Error(root.$$phase + ' already in progress');
<add> }
<add>
<add> root.$$phase = phase;
<add> }
<add>
<ide> return new Scope();
<ide>
<ide> function compileToFn(exp, name) {
<ide><path>test/service/scopeSpec.js
<ide>
<ide> describe('Scope', function() {
<ide>
<del> beforeEach(inject(function($exceptionHandlerProvider) {
<del> $exceptionHandlerProvider.mode('log');
<del> }));
<del>
<del>
<ide> describe('$root', function() {
<ide> it('should point to itself', inject(function($rootScope) {
<ide> expect($rootScope.$root).toEqual($rootScope);
<ide> describe('Scope', function() {
<ide> }));
<ide>
<ide>
<del> it('should delegate exceptions', inject(function($rootScope, $exceptionHandler, $log) {
<add> it('should delegate exceptions', inject(function($exceptionHandlerProvider) {
<add> $exceptionHandlerProvider.mode('log');
<add> }, function($rootScope, $exceptionHandler, $log) {
<ide> $rootScope.$watch('a', function() {throw new Error('abc');});
<ide> $rootScope.a = 1;
<ide> $rootScope.$digest();
<ide> describe('Scope', function() {
<ide> }));
<ide>
<ide>
<del> it('should prevent infinite recurcion and print print watcher function name or body',
<add> it('should prevent infinite recursion and print print watcher function name or body',
<ide> inject(function($rootScope) {
<ide> $rootScope.$watch(function watcherA() {return $rootScope.a;}, function(self) {self.b++;});
<ide> $rootScope.$watch(function() {return $rootScope.b;}, function(self) {self.a++;});
<ide> describe('Scope', function() {
<ide> }));
<ide>
<ide>
<del> it('should prevent recursion', inject(function($rootScope) {
<add> it('should prevent $digest recursion', inject(function($rootScope) {
<ide> var callCount = 0;
<ide> $rootScope.$watch('name', function() {
<ide> expect(function() {
<ide> describe('Scope', function() {
<ide> }));
<ide>
<ide>
<del> it('should catch exceptions', inject(function($rootScope, $exceptionHandler, $log) {
<add> it('should catch exceptions', inject(function($exceptionHandlerProvider) {
<add> $exceptionHandlerProvider.mode('log');
<add> }, function($rootScope, $exceptionHandler, $log) {
<ide> var log = '';
<ide> var child = $rootScope.$new();
<ide> $rootScope.$watch('a', function(scope, a) { log += '1'; });
<ide> describe('Scope', function() {
<ide>
<ide> describe('exceptions', function() {
<ide> var log;
<del> beforeEach(inject(function($rootScope) {
<add> beforeEach(inject(function($exceptionHandlerProvider) {
<add> $exceptionHandlerProvider.mode('log');
<add> }, function($rootScope) {
<ide> log = '';
<ide> $rootScope.$watch(function() { log += '$digest;'; });
<ide> $rootScope.$digest();
<ide> describe('Scope', function() {
<ide> expect($exceptionHandler.errors).toEqual([error]);
<ide> }));
<ide> });
<add>
<add>
<add> describe('recursive $apply protection', function() {
<add> it('should throw an exception if $apply is called while an $apply is in progress', inject(
<add> function($rootScope) {
<add> expect(function() {
<add> $rootScope.$apply(function() {
<add> $rootScope.$apply();
<add> });
<add> }).toThrow('$apply already in progress');
<add> }));
<add>
<add>
<add> it('should throw an exception if $apply is called while flushing evalAsync queue', inject(
<add> function($rootScope) {
<add> expect(function() {
<add> $rootScope.$apply(function() {
<add> $rootScope.$evalAsync(function() {
<add> $rootScope.$apply();
<add> });
<add> });
<add> }).toThrow('$digest already in progress');
<add> }));
<add>
<add>
<add> it('should throw an exception if $apply is called while a watch is being initialized', inject(
<add> function($rootScope) {
<add> var childScope1 = $rootScope.$new();
<add> childScope1.$watch('x', function() {
<add> childScope1.$apply();
<add> });
<add> expect(function() { childScope1.$apply(); }).toThrow('$digest already in progress');
<add> }));
<add>
<add>
<add> it('should thrown an exception if $apply in called from a watch fn (after init)', inject(
<add> function($rootScope) {
<add> var childScope2 = $rootScope.$new();
<add> childScope2.$apply(function() {
<add> childScope2.$watch('x', function(scope, newVal, oldVal) {
<add> if (newVal !== oldVal) {
<add> childScope2.$apply();
<add> }
<add> });
<add> });
<add>
<add> expect(function() { childScope2.$apply(function() {
<add> childScope2.x = 'something';
<add> }); }).toThrow('$digest already in progress');
<add> }));
<add> });
<ide> });
<ide>
<ide>
<ide> describe('Scope', function() {
<ide> log += event.currentScope.id + '>';
<ide> }
<ide>
<del> beforeEach(inject(function($rootScope) {
<add> beforeEach(inject(
<add> function($exceptionHandlerProvider) {
<add> $exceptionHandlerProvider.mode('log');
<add> }, function($rootScope) {
<ide> log = '';
<ide> child = $rootScope.$new();
<ide> grandChild = child.$new();
| 2
|
Java
|
Java
|
fix modal size on android tablet
|
12a97e1ecd6895f8562d900904f5d1a4e182b838
|
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostHelper.java
<ide> import android.content.Context;
<ide> import android.graphics.Point;
<ide> import android.view.Display;
<del>import android.view.Surface;
<ide> import android.view.WindowManager;
<ide>
<ide> import com.facebook.infer.annotation.Assertions;
<ide>
<ide> private static final Point MIN_POINT = new Point();
<ide> private static final Point MAX_POINT = new Point();
<add> private static final Point SIZE_POINT = new Point();
<ide>
<ide> /**
<ide> * To get the size of the screen, we use information from the WindowManager and
<ide> * default Display. We don't use DisplayMetricsHolder, or Display#getSize() because
<ide> * they return values that include the status bar. We only want the values of what
<ide> * will actually be shown on screen.
<add> * We use Display#getSize() to determine if the screen is in portrait or landscape.
<add> * We don't use getRotation because the 'natural' rotation will be portrait on phones
<add> * and landscape on tablets.
<ide> * This should only be called on the native modules/shadow nodes thread.
<ide> */
<ide> @TargetApi(16)
<ide> public static Point getModalHostSize(Context context) {
<ide> Display display = Assertions.assertNotNull(wm).getDefaultDisplay();
<ide> // getCurrentSizeRange will return the min and max width and height that the window can be
<ide> display.getCurrentSizeRange(MIN_POINT, MAX_POINT);
<add> // getSize will return the dimensions of the screen in its current orientation
<add> display.getSize(SIZE_POINT);
<ide>
<del> final int rotation = display.getRotation();
<del> if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
<add> if (SIZE_POINT.x < SIZE_POINT.y) {
<ide> // If we are vertical the width value comes from min width and height comes from max height
<ide> return new Point(MIN_POINT.x, MAX_POINT.y);
<ide> } else {
| 1
|
Text
|
Text
|
fix a small typo
|
993162cc74e01795c5b9b5528a7ea0be39d4592f
|
<ide><path>README.md
<ide> export default function counterStore(state = initialState, action) {
<ide> default:
<ide> return state;
<ide> }
<del>
<add>
<ide> // BUT THAT'S A SWITCH STATEMENT!
<ide> // Right. If you hate 'em, see the FAQ below.
<ide> }
<ide> Redux has no opinion on how you do this in your project.
<ide>
<ide> I wrote a lot of vanilla Flux code, and my only use case for it was avoiding emitting a change before a related Store consumes the action. In Redux this doesn't matter because the change is only emitted after *all* Stores have consumed the action.
<ide>
<del>If several of your Stores want to read data from each other and depend on each other, it's a sign they should'be been a single Store instead.
<add>If several of your Stores want to read data from each other and depend on each other, it's a sign they should've been a single Store instead.
| 1
|
Text
|
Text
|
add a readme for resnet keras
|
f5bb2af2c2f00714723cc486726e534291206925
|
<ide><path>official/resnet/keras/README.md
<add>This folder contains the Keras implementation of the ResNet models. For more
<add>information about the models, please refer to this [README file](../README.md).
<add>
<add>Similar to the [estimator implementation](/official/resnet), the Keras
<add>implementation has code for both CIFAR-10 data and ImageNet data. The CIFAR-10
<add>version uses a ResNet56 model implemented in
<add>[`resnet_cifar_model.py`](./resnet_cifar_model.py), and the ImageNet version
<add>uses a ResNet50 model implemented in [`resnet_model.py`](./resnet_model.py).
<add>
<add>To use
<add>either dataset, make sure that you have the latest version of TensorFlow
<add>installed and
<add>[add the models folder to your Python path](/official/#running-the-models),
<add>otherwise you may encounter an error like `ImportError: No module named
<add>official.resnet`.
<add>
<add>## CIFAR-10
<add>
<add>Download and extract the CIFAR-10 data. You can use the following script:
<add>```bash
<add>python cifar10_download_and_extract.py
<add>```
<add>
<add>After you download the data, you can run the program by:
<add>
<add>```bash
<add>python keras_cifar_main.py
<add>```
<add>
<add>If you did not use the default directory to download the data, specify the
<add>location with the `--data_dir` flag, like:
<add>
<add>```bash
<add>python keras_cifar_main.py --data_dir=/path/to/cifar
<add>```
<add>
<add>## ImageNet
<add>
<add>Download the ImageNet dataset and convert it to TFRecord format.
<add>The following [script](https://github.com/tensorflow/tpu/blob/master/tools/datasets/imagenet_to_gcs.py)
<add>and [README](https://github.com/tensorflow/tpu/tree/master/tools/datasets#imagenet_to_gcspy)
<add>provide a few options.
<add>
<add>Once your dataset is ready, you can begin training the model as follows:
<add>
<add>```bash
<add>python keras_imagenet_main.py
<add>```
<add>
<add>Again, if you did not download the data to the default directory, specify the
<add>location with the `--data_dir` flag:
<add>
<add>```bash
<add>python keras_imagenet_main.py --data_dir=/path/to/imagenet
<add>```
<add>
<add>There are more flag options you can specify. Here are some examples:
<add>
<add>- `--use_synthetic_data`: when set to true, synthetic data, rather than real
<add>data, are used;
<add>- `--batch_size`: the batch size used for the model;
<add>- `--model_dir`: the directory to save the model checkpoint;
<add>- `--train_epochs`: number of epoches to run for training the model;
<add>- `--train_steps`: number of steps to run for training the model. We now only
<add>support a number that is smaller than the number of batches in an epoch.
<add>- `--skip_eval`: when set to true, evaluation as well as validation during
<add>training is skipped
<add>
<add>For example, this is a typical command line to run with ImageNet data with
<add>batch size 128 per GPU:
<add>
<add>```bash
<add>python -m keras_imagenet_main \
<add>--model_dir=/tmp/model_dir/something \
<add>--num_gpus=2 \
<add>--batch_size=128 \
<add>--train_epochs=90 \
<add>--train_steps=10 \
<add>--use_synthetic_data=false
<add>```
<add>
<add>See [`keras_common.py`](keras_common.py) for full list of options.
<add>
<add>## Using multiple GPUs
<add>You can train these models on multiple GPUs using `tf.distribute.Strategy` API.
<add>You can read more about them in this
<add>[guide](https://www.tensorflow.org/guide/distribute_strategy).
<add>
<add>In this example, we have made it easier to use is with just a command line flag
<add>`--num_gpus`. By default this flag is 1 if TensorFlow is compiled with CUDA,
<add>and 0 otherwise.
<add>
<add>- --num_gpus=0: Uses tf.distribute.OneDeviceStrategy with CPU as the device.
<add>- --num_gpus=1: Uses tf.distribute.OneDeviceStrategy with GPU as the device.
<add>- --num_gpus=2+: Uses tf.distribute.MirroredStrategy to run synchronous
<add>distributed training across the GPUs.
<add>
<add>If you wish to run without `tf.distribute.Strategy`, you can do so by setting
<add>`--distribution_strategy=off`.
<add>
| 1
|
Ruby
|
Ruby
|
add join conditions to join clause, not where
|
8d270a2abbc1601777f4918bd1968c18f7864ae5
|
<ide><path>activerecord/lib/active_record/associations/join_dependency/join_association.rb
<ide> def join_to(relation)
<ide>
<ide> constraint = build_constraint(reflection, table, key, foreign_table, foreign_key)
<ide>
<del> relation.from(join(table, constraint))
<del>
<ide> unless conditions[i].empty?
<del> relation.where(sanitize(conditions[i], table))
<add> constraint = constraint.and(sanitize(conditions[i], table))
<ide> end
<ide>
<add> relation.from(join(table, constraint))
<add>
<ide> # The current table in this iteration becomes the foreign table in the next
<ide> foreign_table = table
<ide> end
<ide><path>activerecord/test/cases/associations/inner_join_association_test.rb
<ide> def test_construct_finder_sql_ignores_empty_joins_array
<ide> assert_no_match(/JOIN/i, sql)
<ide> end
<ide>
<add> def test_join_conditions_added_to_join_clause
<add> sql = Author.joins(:essays).to_sql
<add> assert_match(/writer_type.*?=.*?Author/i, sql)
<add> assert_no_match(/WHERE/i, sql)
<add> end
<add>
<ide> def test_find_with_implicit_inner_joins_honors_readonly_without_select
<ide> authors = Author.joins(:posts).to_a
<ide> assert !authors.empty?, "expected authors to be non-empty"
| 2
|
Javascript
|
Javascript
|
remove excess colon
|
951e67cd17f3b2591329ae500173da5425706253
|
<ide><path>src/math/Matrix3.js
<ide> Object.assign( Matrix3.prototype, {
<ide>
<ide> if ( det === 0 ) {
<ide>
<del> var msg = "THREE.Matrix3: .getInverse(): can't invert matrix, determinant is 0";
<add> var msg = "THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";
<ide>
<ide> if ( throwOnDegenerate === true ) {
<ide>
<ide><path>src/math/Matrix4.js
<ide> Object.assign( Matrix4.prototype, {
<ide>
<ide> if ( det === 0 ) {
<ide>
<del> var msg = "THREE.Matrix4: .getInverse(): can't invert matrix, determinant is 0";
<add> var msg = "THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";
<ide>
<ide> if ( throwOnDegenerate === true ) {
<ide>
| 2
|
Ruby
|
Ruby
|
fix a typo
|
dc69220e28e319fb557f87b92766f88d240a3327
|
<ide><path>actionpack/lib/action_dispatch/testing/integration.rb
<ide> module RequestHelpers
<ide> # - +headers+: Additional headers to pass, as a Hash. The headers will be
<ide> # merged into the Rack env hash.
<ide> #
<del> # This method returns an Response object, which one can use to
<add> # This method returns a Response object, which one can use to
<ide> # inspect the details of the response. Furthermore, if this method was
<ide> # called from an ActionDispatch::IntegrationTest object, then that
<ide> # object's <tt>@response</tt> instance variable will point to the same
| 1
|
PHP
|
PHP
|
improve api docs
|
bc64e1f7e08af1c2e1b87a3c0d892040b46e56c0
|
<ide><path>src/ORM/Association.php
<ide> public function conditions($conditions = null)
<ide> * Sets the name of the field representing the binding field with the target table.
<ide> * When not manually specified the primary key of the owning side table is used.
<ide> *
<del> * @param string $key the table field to be used to link both tables together
<add> * @param string|array $key the table field or fields to be used to link both tables together
<ide> * @return $this
<ide> */
<ide> public function setBindingKey($key)
<ide> public function getForeignKey()
<ide> /**
<ide> * Sets the name of the field representing the foreign key to the target table.
<ide> *
<del> * @param string $key the key to be used to link both tables together
<add> * @param string|array $key the key or keys to be used to link both tables together
<ide> * @return $this
<ide> */
<ide> public function setForeignKey($key)
| 1
|
Javascript
|
Javascript
|
fix markdown formatting
|
4836dacae68106523ebc2295f515002780d4e0c3
|
<ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> * To add or overwrite these defaults, simply add or remove a property from these configuration
<ide> * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
<ide> * with the lowercased HTTP method name as the key, e.g.
<del> * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.
<add> * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.
<ide> *
<ide> * The defaults can also be set at runtime via the `$http.defaults` object in the same
<ide> * fashion. For example:
| 1
|
Text
|
Text
|
clarify test text for react challenge
|
6c8df573c3f1e88f90499d5c08b9577b256569f9
|
<ide><path>curriculum/challenges/english/03-front-end-libraries/react/render-state-in-the-user-interface.md
<ide> assert(
<ide> );
<ide> ```
<ide>
<del>The rendered `h1` header should contain text rendered from the component's state.
<add>The rendered `h1` header should only contain text rendered from the component's state.
<ide>
<ide> ```js
<ide> async () => {
| 1
|
Ruby
|
Ruby
|
reverse universal_archs entries
|
91dd4d56d426ed47c4e042f7b17d6560245fd60f
|
<ide><path>Library/Homebrew/os/mac/hardware.rb
<ide> def universal_archs
<ide> if MacOS.version <= :leopard && !MacOS.prefer_64_bit?
<ide> [arch_32_bit].extend ArchitectureListExtension
<ide> else
<del> [arch_32_bit, arch_64_bit].extend ArchitectureListExtension
<add> # Amazingly, this order (64, then 32) matters. It shouldn't, but it
<add> # does. GCC (some versions? some systems?) can blow up if the other
<add> # order is used.
<add> # http://superuser.com/questions/740563/gcc-4-8-on-macos-fails-depending-on-arch-order
<add> [arch_64_bit, arch_32_bit].extend ArchitectureListExtension
<ide> end
<ide> end
<ide>
| 1
|
Ruby
|
Ruby
|
add more explanation to collectionassociation docs
|
c0c0ef59921a4a8795cd20348afc243cccc4821e
|
<ide><path>activerecord/lib/active_record/associations/collection_association.rb
<ide> module Associations
<ide> # HasManyAssociation => has_many
<ide> # HasManyThroughAssociation + ThroughAssociation => has_many :through
<ide> #
<add> # CollectionAssociation class provides common methods to the collections
<add> # defined by +has_and_belongs_to_many+, +has_many+ and +has_many+ with
<add> # +:through+ association option.
<add> #
<ide> # You need to be careful with assumptions regarding the target: The proxy
<ide> # does not fetch records from the database until it needs them, but new
<ide> # ones created with +build+ are added to the target. So, the target may be
| 1
|
PHP
|
PHP
|
rename a few things to make more sense
|
96fa470718120eb8569cc6068b265776fd7ebb46
|
<ide><path>src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php
<ide> public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', C
<ide> // optimize the subquery to only run a "where exists" clause instead of
<ide> // the full "count" clause. This will make the query run much faster.
<ide> $queryType = $this->shouldRunExistsQuery($operator, $count)
<del> ? 'getRelationQuery' : 'getRelationCountQuery';
<add> ? 'getRelationExistenceQuery' : 'getRelationExistenceCountQuery';
<ide>
<ide> $query = $relation->{$queryType}($relation->getRelated()->newQuery(), $this);
<ide>
<ide> public function withCount($relations)
<ide> // Here we will get the relationship count query and prepare to add it to the main query
<ide> // as a sub-select. First, we'll get the "has" query and use that to get the relation
<ide> // count query. We will normalize the relation name then append _count as the name.
<del> $query = $relation->getRelationCountQuery(
<add> $query = $relation->getRelationExistenceCountQuery(
<ide> $relation->getRelated()->newQuery(), $this
<ide> );
<ide>
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsTo.php
<ide> public function addConstraints()
<ide> * Add the constraints for a relationship query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> if ($parent->getQuery()->from == $query->getQuery()->from) {
<del> return $this->getRelationQueryForSelfRelation($query, $parent, $columns);
<add> if ($parentQuery->getQuery()->from == $query->getQuery()->from) {
<add> return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns);
<ide> }
<ide>
<ide> $query->select($columns);
<ide>
<del> $otherKey = $this->wrap($query->getModel()->getTable().'.'.$this->otherKey);
<add> $otherKey = $query->getModel()->getTable().'.'.$this->otherKey;
<ide>
<del> return $query->where($this->getQualifiedForeignKey(), '=', new Expression($otherKey));
<add> return $query->whereColumn($this->getQualifiedForeignKey(), '=', $otherKey);
<ide> }
<ide>
<ide> /**
<ide> * Add the constraints for a relationship query on the same table.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQueryForSelfRelation(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<ide> $query->select($columns);
<ide>
<ide> $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash());
<ide>
<ide> $query->getModel()->setTable($hash);
<ide>
<del> $key = $this->wrap($this->getQualifiedForeignKey());
<del>
<del> return $query->where($hash.'.'.$query->getModel()->getKeyName(), '=', new Expression($key));
<add> return $query->whereColumn(
<add> $hash.'.'.$query->getModel()->getKeyName(), '=', $this->getQualifiedForeignKey()
<add> );
<ide> }
<ide>
<ide> /**
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
<ide> public function addConstraints()
<ide> * Add the constraints for a relationship query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> if ($parent->getQuery()->from == $query->getQuery()->from) {
<del> return $this->getRelationQueryForSelfJoin($query, $parent, $columns);
<add> if ($parentQuery->getQuery()->from == $query->getQuery()->from) {
<add> return $this->getRelationExistenceQueryForSelfJoin($query, $parentQuery, $columns);
<ide> }
<ide>
<ide> $this->setJoin($query);
<ide>
<del> return parent::getRelationQuery($query, $parent, $columns);
<add> return parent::getRelationExistenceQuery($query, $parentQuery, $columns);
<ide> }
<ide>
<ide> /**
<ide> * Add the constraints for a relationship query on the same table.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQueryForSelfJoin(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQueryForSelfJoin(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<ide> $query->select($columns);
<ide>
<ide> public function getRelationQueryForSelfJoin(Builder $query, Builder $parent, $co
<ide>
<ide> $this->setJoin($query);
<ide>
<del> return parent::getRelationQuery($query, $parent, $columns);
<add> return parent::getRelationExistenceQuery($query, $parentQuery, $columns);
<ide> }
<ide>
<ide> /**
<ide> public function getRelatedFreshUpdate()
<ide> *
<ide> * @return string
<ide> */
<del> public function getHasCompareKey()
<add> public function getExistenceCompareKey()
<ide> {
<ide> return $this->getForeignKey();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
<ide> public function addConstraints()
<ide> * Add the constraints for a relationship query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<ide> $parentTable = $this->parent->getTable();
<ide>
<ide> $this->setJoin($query);
<ide>
<ide> $query->select($columns);
<ide>
<del> $key = $this->wrap($parentTable.'.'.$this->firstKey);
<del>
<del> return $query->where($this->getHasCompareKey(), '=', new Expression($key));
<add> return $query->whereColumn(
<add> $this->getExistenceCompareKey(), '=', $parentTable.'.'.$this->firstKey
<add> );
<ide> }
<ide>
<ide> /**
<ide> public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'p
<ide> *
<ide> * @return string
<ide> */
<del> public function getHasCompareKey()
<add> public function getExistenceCompareKey()
<ide> {
<ide> return $this->farParent->getQualifiedKeyName();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
<ide> public function update(array $attributes)
<ide> * Add the constraints for a relationship query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> if ($parent->getQuery()->from == $query->getQuery()->from) {
<del> return $this->getRelationQueryForSelfRelation($query, $parent, $columns);
<add> if ($query->getQuery()->from == $parentQuery->getQuery()->from) {
<add> return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns);
<ide> }
<ide>
<del> return parent::getRelationQuery($query, $parent, $columns);
<add> return parent::getRelationExistenceQuery($query, $parentQuery, $columns);
<ide> }
<ide>
<ide> /**
<ide> * Add the constraints for a relationship query on the same table.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQueryForSelfRelation(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> $query->select($columns);
<del>
<ide> $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash());
<ide>
<ide> $query->getModel()->setTable($hash);
<ide>
<del> $key = $this->wrap($this->getQualifiedParentKeyName());
<del>
<del> return $query->where($hash.'.'.$this->getForeignKeyName(), '=', new Expression($key));
<add> return $query->select($columns)->whereColumn(
<add> $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->getForeignKeyName()
<add> );
<ide> }
<ide>
<ide> /**
<ide> public function getRelationCountHash()
<ide> *
<ide> * @return string
<ide> */
<del> public function getHasCompareKey()
<add> public function getExistenceCompareKey()
<ide> {
<ide> return $this->getQualifiedForeignKeyName();
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php
<ide> public function addConstraints()
<ide> * Get the relationship query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> $query = parent::getRelationQuery($query, $parent, $columns);
<add> $query = parent::getRelationExistenceQuery($query, $parentQuery, $columns);
<ide>
<ide> return $query->where($this->morphType, $this->morphClass);
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
<ide> protected function setWhere()
<ide> * Add the constraints for a relationship count query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> $query = parent::getRelationQuery($query, $parent, $columns);
<add> $query = parent::getRelationExistenceQuery($query, $parentQuery, $columns);
<ide>
<ide> return $query->where($this->table.'.'.$this->morphType, $this->morphClass);
<ide> }
<ide><path>src/Illuminate/Database/Eloquent/Relations/Relation.php
<ide> public function rawUpdate(array $attributes = [])
<ide> * Add the constraints for a relationship count query.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationCountQuery(Builder $query, Builder $parent)
<add> public function getRelationExistenceCountQuery(Builder $query, Builder $parentQuery)
<ide> {
<del> return $this->getRelationQuery($query, $parent, new Expression('count(*)'));
<add> return $this->getRelationExistenceQuery(
<add> $query, $parentQuery, new Expression('count(*)')
<add> );
<ide> }
<ide>
<ide> /**
<del> * Add the constraints for a relationship query.
<add> * Add the constraints for an internal relationship existence query.
<add> *
<add> * Essentially, these queries compare on column names like whereColumn.
<ide> *
<ide> * @param \Illuminate\Database\Eloquent\Builder $query
<del> * @param \Illuminate\Database\Eloquent\Builder $parent
<add> * @param \Illuminate\Database\Eloquent\Builder $parentQuery
<ide> * @param array|mixed $columns
<ide> * @return \Illuminate\Database\Eloquent\Builder
<ide> */
<del> public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*'])
<add> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
<ide> {
<del> return $query->select($columns)->where(
<del> $this->getHasCompareKey(), '=',
<del> new Expression($this->wrap($this->getQualifiedParentKeyName()))
<add> return $query->select($columns)->whereColumn(
<add> $this->getQualifiedParentKeyName(), '=', $this->getExistenceCompareKey()
<ide> );
<ide> }
<ide>
<ide> public function relatedUpdatedAt()
<ide> return $this->related->getUpdatedAtColumn();
<ide> }
<ide>
<del> /**
<del> * Wrap the given value with the parent query's grammar.
<del> *
<del> * @param string $value
<del> * @return string
<del> */
<del> public function wrap($value)
<del> {
<del> return $this->parent->newQueryWithoutScopes()
<del> ->getQuery()->getGrammar()->wrap($value);
<del> }
<del>
<ide> /**
<ide> * Set or get the morph map for polymorphic relations.
<ide> *
<ide><path>tests/Database/DatabaseEloquentBuilderTest.php
<ide> public function testSelfHasNestedUsesAlias()
<ide>
<ide> $sql = preg_replace($aliasRegex, $alias, $sql);
<ide>
<del> $this->assertContains('"self_related_stubs"."parent_id" = "self_alias_hash"."id"', $sql);
<add> $this->assertContains('"self_alias_hash"."id" = "self_related_stubs"."parent_id"', $sql);
<ide> }
<ide>
<ide> protected function mockConnectionForModel($model, $database)
<ide><path>tests/Database/DatabaseEloquentGlobalScopesTest.php
<ide> public function testHasQueryWhereBothModelsHaveGlobalScopes()
<ide> {
<ide> $query = EloquentGlobalScopesWithRelationModel::has('related')->where('bar', 'baz');
<ide>
<del> $subQuery = 'select * from "table" where "table"."related_id" = "table2"."id" and "foo" = ? and "active" = ?';
<add> $subQuery = 'select * from "table" where "table2"."id" = "table"."related_id" and "foo" = ? and "active" = ?';
<ide> $mainQuery = 'select * from "table2" where exists ('.$subQuery.') and "bar" = ? and "active" = ? order by "name" asc';
<ide>
<ide> $this->assertEquals($mainQuery, $query->toSql());
<ide><path>tests/Database/DatabaseEloquentHasOneTest.php
<ide> public function testRelationCountQueryCanBeBuilt()
<ide>
<ide> $builder->shouldReceive('select')->once()->with(m::type('Illuminate\Database\Query\Expression'))->andReturnSelf();
<ide> $relation->getParent()->shouldReceive('getTable')->andReturn('table');
<del> $builder->shouldReceive('where')->once()->with('table.foreign_key', '=', m::type('Illuminate\Database\Query\Expression'));
<del> $relation->getQuery()->shouldReceive('getQuery')->andReturn($parentQuery = m::mock('StdClass'));
<del> $parentQuery->shouldReceive('getGrammar')->once()->andReturn($grammar = m::mock('StdClass'));
<del> $grammar->shouldReceive('wrap')->once()->with('table.id');
<add> $builder->shouldReceive('whereColumn')->once()->with('table.id', '=', 'table.foreign_key');
<ide>
<del> $relation->getRelationCountQuery($builder, $builder);
<add> $relation->getRelationExistenceCountQuery($builder, $builder);
<ide> }
<ide>
<ide> protected function getRelation()
<ide><path>tests/Database/DatabaseEloquentRelationTest.php
<ide> public function testSettingMorphMapWithNumericKeys()
<ide>
<ide> Relation::morphMap([], false);
<ide> }
<del>
<del> /**
<del> * Testing to ensure loop does not occur during relational queries in global scopes.
<del> *
<del> * Executing parent model's global scopes could result in an infinite loop when the
<del> * parent model's global scope utilizes a relation in a query like has or whereHas
<del> */
<del> public function testDonNotRunParentModelGlobalScopes()
<del> {
<del> /* @var Mockery\MockInterface $parent */
<del> $eloquentBuilder = m::mock(Builder::class);
<del> $queryBuilder = m::mock(QueryBuilder::class);
<del> $parent = m::mock(EloquentRelationResetModelStub::class)->makePartial();
<del> $grammar = m::mock(Grammar::class);
<del>
<del> $eloquentBuilder->shouldReceive('getModel')->andReturn($related = m::mock(StdClass::class));
<del> $eloquentBuilder->shouldReceive('getQuery')->andReturn($queryBuilder);
<del> $queryBuilder->shouldReceive('getGrammar')->andReturn($grammar);
<del> $grammar->shouldReceive('wrap');
<del> $parent->shouldReceive('newQueryWithoutScopes')->andReturn($eloquentBuilder);
<del>
<del> $relation = new EloquentRelationStub($eloquentBuilder, $parent);
<del> $relation->wrap('test');
<del> }
<ide> }
<ide>
<ide> class EloquentRelationResetModelStub extends Model
| 12
|
Go
|
Go
|
add helper function to make prctl system call
|
65567e125d9bd4d4ede25dd03bda11ebf1ef7321
|
<ide><path>pkg/system/calls_linux.go
<ide> func Mknod(path string, mode uint32, dev int) error {
<ide> return syscall.Mknod(path, mode, dev)
<ide> }
<ide>
<add>func Prctl(option int, arg2, arg3, arg4, arg5 uintptr) error {
<add> if _, _, err := syscall.Syscall6(syscall.SYS_PRCTL, uintptr(option), arg2, arg3, arg4, arg5, 0); err != 0 {
<add> return err
<add> }
<add> return nil
<add>}
<add>
<ide> func ParentDeathSignal(sig uintptr) error {
<ide> if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, sig, 0); err != 0 {
<ide> return err
| 1
|
PHP
|
PHP
|
bring the pluralization rules back
|
bb414d3ad37861a660173221beeea980294b9789
|
<ide><path>src/Illuminate/Translation/MessageSelector.php
<ide> class MessageSelector
<ide> *
<ide> * @param string $line
<ide> * @param int $number
<add> * @param string $locale
<ide> * @return mixed
<ide> */
<del> public function choose($line, $number)
<add> public function choose($line, $number, $locale)
<ide> {
<ide> $segments = explode('|', $line);
<ide>
<ide> public function choose($line, $number)
<ide>
<ide> $segments = $this->stripConditions($segments);
<ide>
<del> return count($segments) == 1 || $number == 1
<del> ? $segments[0] : $segments[1];
<add> $pluralIndex = $this->getPluralIndex($locale, $number);
<add>
<add> if (count($segments) == 1 || ! isset($segments[$pluralIndex])) {
<add> return $segments[0];
<add> }
<add>
<add> return $segments[$pluralIndex];
<ide> }
<ide>
<ide> /**
<ide> private function stripConditions($segments)
<ide> return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part);
<ide> })->all();
<ide> }
<add>
<add> /**
<add> * Get the index to use for pluralization.
<add> *
<add> * The plural rules are derived from code of the Zend Framework (2010-09-25), which
<add> * is subject to the new BSD license (http://framework.zend.com/license/new-bsd).
<add> * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
<add> *
<add> * @param string $locale
<add> * @param int $number
<add> *
<add> * @return int
<add> */
<add> public function getPluralIndex($locale, $number){
<add> switch ($locale) {
<add> case 'az':
<add> case 'bo':
<add> case 'dz':
<add> case 'id':
<add> case 'ja':
<add> case 'jv':
<add> case 'ka':
<add> case 'km':
<add> case 'kn':
<add> case 'ko':
<add> case 'ms':
<add> case 'th':
<add> case 'tr':
<add> case 'vi':
<add> case 'zh':
<add> return 0;
<add> break;
<add> case 'af':
<add> case 'bn':
<add> case 'bg':
<add> case 'ca':
<add> case 'da':
<add> case 'de':
<add> case 'el':
<add> case 'en':
<add> case 'eo':
<add> case 'es':
<add> case 'et':
<add> case 'eu':
<add> case 'fa':
<add> case 'fi':
<add> case 'fo':
<add> case 'fur':
<add> case 'fy':
<add> case 'gl':
<add> case 'gu':
<add> case 'ha':
<add> case 'he':
<add> case 'hu':
<add> case 'is':
<add> case 'it':
<add> case 'ku':
<add> case 'lb':
<add> case 'ml':
<add> case 'mn':
<add> case 'mr':
<add> case 'nah':
<add> case 'nb':
<add> case 'ne':
<add> case 'nl':
<add> case 'nn':
<add> case 'no':
<add> case 'om':
<add> case 'or':
<add> case 'pa':
<add> case 'pap':
<add> case 'ps':
<add> case 'pt':
<add> case 'so':
<add> case 'sq':
<add> case 'sv':
<add> case 'sw':
<add> case 'ta':
<add> case 'te':
<add> case 'tk':
<add> case 'ur':
<add> case 'zu':
<add> return ($number == 1) ? 0 : 1;
<add> case 'am':
<add> case 'bh':
<add> case 'fil':
<add> case 'fr':
<add> case 'gun':
<add> case 'hi':
<add> case 'hy':
<add> case 'ln':
<add> case 'mg':
<add> case 'nso':
<add> case 'xbr':
<add> case 'ti':
<add> case 'wa':
<add> return (($number == 0) || ($number == 1)) ? 0 : 1;
<add> case 'be':
<add> case 'bs':
<add> case 'hr':
<add> case 'ru':
<add> case 'sr':
<add> case 'uk':
<add> return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
<add> case 'cs':
<add> case 'sk':
<add> return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2);
<add> case 'ga':
<add> return ($number == 1) ? 0 : (($number == 2) ? 1 : 2);
<add> case 'lt':
<add> return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
<add> case 'sl':
<add> return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3));
<add> case 'mk':
<add> return ($number % 10 == 1) ? 0 : 1;
<add> case 'mt':
<add> return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3));
<add> case 'lv':
<add> return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2);
<add> case 'pl':
<add> return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2);
<add> case 'cy':
<add> return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3));
<add> case 'ro':
<add> return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2);
<add> case 'ar':
<add> return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5))));
<add> default:
<add> return 0;
<add> }
<add> }
<ide> }
<ide><path>src/Illuminate/Translation/Translator.php
<ide> public function choice($key, $number, array $replace = [], $locale = null)
<ide> $replace['count'] = $number;
<ide>
<ide> return $this->makeReplacements(
<del> $this->getSelector()->choose($line, $number), $replace
<add> $this->getSelector()->choose($line, $number, $locale), $replace
<ide> );
<ide> }
<ide>
<ide><path>tests/Translation/TranslationMessageSelectorTest.php
<ide> public function testChoose($expected, $id, $number)
<ide> {
<ide> $selector = new MessageSelector();
<ide>
<del> $this->assertEquals($expected, $selector->choose($id, $number));
<add> $this->assertEquals($expected, $selector->choose($id, $number, 'en'));
<ide> }
<ide>
<ide> public function chooseTestData()
<ide><path>tests/Translation/TranslationTranslatorTest.php
<ide> public function testChoiceMethodProperlyLoadsAndRetrievesItem()
<ide> $t = $this->getMockBuilder('Illuminate\Translation\Translator')->setMethods(['get'])->setConstructorArgs([$this->getLoader(), 'en'])->getMock();
<ide> $t->expects($this->once())->method('get')->with($this->equalTo('foo'), $this->equalTo(['replace']), $this->equalTo('en'))->will($this->returnValue('line'));
<ide> $t->setSelector($selector = m::mock('Illuminate\Translation\MessageSelector'));
<del> $selector->shouldReceive('choose')->once()->with('line', 10)->andReturn('choiced');
<add> $selector->shouldReceive('choose')->once()->with('line', 10, 'en')->andReturn('choiced');
<ide>
<ide> $t->choice('foo', 10, ['replace']);
<ide> }
<ide> public function testChoiceMethodProperlyCountsCollectionsAndLoadsAndRetrievesIte
<ide> $t = $this->getMockBuilder('Illuminate\Translation\Translator')->setMethods(['get'])->setConstructorArgs([$this->getLoader(), 'en'])->getMock();
<ide> $t->expects($this->exactly(2))->method('get')->with($this->equalTo('foo'), $this->equalTo(['replace']), $this->equalTo('en'))->will($this->returnValue('line'));
<ide> $t->setSelector($selector = m::mock('Illuminate\Translation\MessageSelector'));
<del> $selector->shouldReceive('choose')->twice()->with('line', 3)->andReturn('choiced');
<add> $selector->shouldReceive('choose')->twice()->with('line', 3, 'en')->andReturn('choiced');
<ide>
<ide> $values = ['foo', 'bar', 'baz'];
<ide> $t->choice('foo', $values, ['replace']);
| 4
|
Text
|
Text
|
clarify recommendations in stream.md
|
b71779517dfb4e4b34c9fc04ee8b6678256b5ddd
|
<ide><path>doc/api/stream.md
<ide> The `writable.uncork()` method flushes all data buffered since
<ide> [`stream.cork()`][] was called.
<ide>
<ide> When using [`writable.cork()`][] and `writable.uncork()` to manage the buffering
<del>of writes to a stream, it is recommended that calls to `writable.uncork()` be
<del>deferred using `process.nextTick()`. Doing so allows batching of all
<add>of writes to a stream, defer calls to `writable.uncork()` using
<add>`process.nextTick()`. Doing so allows batching of all
<ide> `writable.write()` calls that occur within a given Node.js event loop phase.
<ide>
<ide> ```js
<ide> stop until the [`'drain'`][] event is emitted.
<ide> While a stream is not draining, calls to `write()` will buffer `chunk`, and
<ide> return false. Once all currently buffered chunks are drained (accepted for
<ide> delivery by the operating system), the `'drain'` event will be emitted.
<del>It is recommended that once `write()` returns false, no more chunks be written
<add>Once `write()` returns false, do not write more chunks
<ide> until the `'drain'` event is emitted. While calling `write()` on a stream that
<ide> is not draining is allowed, Node.js will buffer all written chunks until
<ide> maximum memory usage occurs, at which point it will abort unconditionally.
<ide> to consume data from a single stream. Specifically, using a combination
<ide> of `on('data')`, `on('readable')`, `pipe()`, or async iterators could
<ide> lead to unintuitive behavior.
<ide>
<del>Use of the `readable.pipe()` method is recommended for most users as it has been
<del>implemented to provide the easiest way of consuming stream data. Developers that
<del>require more fine-grained control over the transfer and generation of data can
<del>use the [`EventEmitter`][] and `readable.on('readable')`/`readable.read()`
<add>`readable.pipe()` provides the easiest way to consume stream data. Developers
<add>that require more fine-grained control over the transfer and generation of data
<add>can use the [`EventEmitter`][] and `readable.on('readable')`/`readable.read()`
<ide> or the `readable.pause()`/`readable.resume()` APIs.
<ide>
<ide> #### Class: `stream.Readable`
| 1
|
PHP
|
PHP
|
shorten exception message
|
2c2344c39f3237d2c84d2228569210a0dee2b4ea
|
<ide><path>laravel/input.php
<ide> public static function old($key = null, $default = null)
<ide> {
<ide> if (Config::get('session.driver') == '')
<ide> {
<del> throw new \UnexpectedValueException('A session driver must be specified in order to access old input.');
<add> throw new \UnexpectedValueException('A session driver must be specified to access old input.');
<ide> }
<ide>
<ide> $old = IoC::core('session')->get(Input::old_input, array());
| 1
|
Text
|
Text
|
prevent object mutation; fix minor typos
|
0af7ebad6dbd2fcccaccd8db7a25bf596453fb74
|
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.english.md
<ide> Once the object is frozen, you can no longer add, update, or delete properties f
<ide>
<ide> ## Instructions
<ide> <section id='instructions'>
<del>In this challenge you are going to use <code>Object.freeze</code> to prevent mathematical constants from changing. You need to freeze the <code>MATH_CONSTANTS</code> object so that no one is able alter the value of <code>PI</code>, add, or delete properties .
<add>In this challenge you are going to use <code>Object.freeze</code> to prevent mathematical constants from changing. You need to freeze the <code>MATH_CONSTANTS</code> object so that no one is able to alter the value of <code>PI</code>, add, or delete properties.
<ide> </section>
<ide>
<ide> ## Tests
| 1
|
Javascript
|
Javascript
|
simplify cluster layout
|
60b6a3d2e5c196d3fa09229f32bf3f5c72046583
|
<ide><path>d3.layout.js
<ide> function d3_layout_hierarchySort(a, b) {
<ide> // Implements a hierarchical layout using the cluster (or dendogram) algorithm.
<ide> d3.layout.cluster = function() {
<ide> var hierarchy = d3.layout.hierarchy(),
<del> group = 0;
<add> separation = d3_layout_treeSeparation,
<add> size = [1, 1]; // width, height
<ide>
<ide> function cluster(d, i) {
<ide> var nodes = hierarchy.call(this, d, i),
<ide> root = nodes[0],
<del> leafCount = 0,
<del> leafIndex = .5 - group / 2;
<del>
<del> /* Count the leaf nodes and compute the depth of descendants. */
<del> var p = undefined;
<del> d3_layout_clusterVisitAfter(root, function(n) {
<del> if (n.children) {
<del> n.depth = 1 + d3.max(n.children, function(n) { return n.depth; });
<del> } else {
<del> if (group && (p != n.parent)) {
<del> p = n.parent;
<del> leafCount += group;
<del> }
<del> leafCount++;
<del> n.depth = 0;
<del> }
<del> });
<del> var breadth = 1 / leafCount;
<del> var depth = 1 / root.depth;
<del>
<del> /* Compute the unit breadth and depth of each node. */
<del> var p = undefined;
<del> d3_layout_clusterVisitAfter(root, function(n) {
<del> if (n.children) {
<del> n.breadth = d3_layout_clusterMean(n.children, function(n) { return n.breadth; });
<add> previousNode,
<add> x = 0,
<add> kx,
<add> ky;
<add>
<add> // First walk, computing the initial x & y values.
<add> d3_layout_treeVisitAfter(root, function(node) {
<add> if (node.children) {
<add> node.x = d3_layout_clusterX(node.children);
<add> node.y = d3_layout_clusterY(node.children);
<ide> } else {
<del> if (group && (p != n.parent)) {
<del> p = n.parent;
<del> leafIndex += group;
<del> }
<del> n.breadth = breadth * leafIndex++;
<add> node.x = previousNode ? x += separation(node, previousNode) : 0;
<add> node.y = 0;
<add> previousNode = node;
<ide> }
<del> n.depth = 1 - n.depth * depth;
<ide> });
<ide>
<del> /* Compute breadth and depth ranges for space-filling layouts. */
<del> d3_layout_clusterVisitAfter(root, function(n) {
<del> n.minBreadth = n.children
<del> ? n.children[0].minBreadth
<del> : (n.breadth - breadth / 2);
<del> n.maxBreadth = n.children
<del> ? n.children[n.children.length - 1].maxBreadth
<del> : (n.breadth + breadth / 2);
<del> });
<del> d3_layout_clusterVisitBefore(root, function(n) {
<del> n.minDepth = n.parent
<del> ? n.parent.maxDepth
<del> : 0;
<del> n.maxDepth = n.parent
<del> ? (n.depth + root.depth)
<del> : (n.minDepth + 2 * root.depth);
<add> // Compute the left-most, right-most, and depth-most nodes for extents.
<add> var left = d3_layout_clusterLeft(root),
<add> right = d3_layout_clusterRight(root),
<add> x0 = left.x - separation(left, right) / 2,
<add> x1 = right.x + separation(right, left) / 2;
<add>
<add> // Second walk, normalizing x & y to the desired size.
<add> d3_layout_treeVisitAfter(root, function(node) {
<add> node.x = (node.x - x0) / (x1 - x0) * size[0];
<add> node.y = (1 - node.y / root.y) * size[1];
<ide> });
<del> root.minDepth = -depth;
<ide>
<ide> return nodes;
<ide> }
<ide> d3.layout.cluster = function() {
<ide> cluster.children = d3.rebind(cluster, hierarchy.children);
<ide> cluster.value = d3.rebind(cluster, hierarchy.value);
<ide>
<del> cluster.group = function(x) {
<del> if (!arguments.length) return group;
<del> group = x;
<add> cluster.separation = function(x) {
<add> if (!arguments.length) return separation;
<add> separation = x;
<add> return cluster;
<add> };
<add>
<add> cluster.size = function(x) {
<add> if (!arguments.length) return size;
<add> size = x;
<ide> return cluster;
<ide> };
<ide>
<ide> return cluster;
<ide> };
<ide>
<del>d3_layout_clusterVisitAfter = d3_layout_treeVisitAfter;
<add>function d3_layout_clusterY(children) {
<add> return 1 + d3.max(children, function(child) {
<add> return child.y;
<add> });
<add>}
<ide>
<del>function d3_layout_clusterVisitBefore(node, callback) {
<del> function visit(node, previousSibling) {
<del> callback(node, previousSibling);
<del> var children = node.children;
<del> if (children) {
<del> var child,
<del> previousChild = null,
<del> i = -1,
<del> n = children.length;
<del> while (++i < n) {
<del> child = children[i];
<del> visit(child, previousChild);
<del> previousChild = child;
<del> }
<del> }
<del> }
<del> visit(node, null);
<add>function d3_layout_clusterX(children) {
<add> return children.reduce(function(x, child) {
<add> return x + child.x;
<add> }, 0) / children.length;
<ide> }
<ide>
<del>function d3_layout_clusterSum(array, f) {
<del> var o = {};
<del> return array.reduce(f
<del> ? function(p, d, i) { o.index = i; return p + f.call(o, d); }
<del> : function(p, d) { return p + d; }, 0);
<add>function d3_layout_clusterLeft(node) {
<add> var children = node.children;
<add> return children ? d3_layout_clusterLeft(children[0]) : node;
<ide> }
<ide>
<del>function d3_layout_clusterMean(array, f) {
<del> return d3_layout_clusterSum(array, f) / array.length;
<add>function d3_layout_clusterRight(node) {
<add> var children = node.children;
<add> return children ? d3_layout_clusterRight(children[children.length - 1]) : node;
<ide> }
<ide> // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
<ide> d3.layout.tree = function() {
<ide><path>d3.layout.min.js
<del>(function(){function w(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function v(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function u(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function t(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function s(a,b){return a.depth-b.depth}function r(a,b){return b.x-a.x}function q(a,b){return a.x-b.x}function p(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=p(c[f],b),a)>0&&(a=d)}return a}function o(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function n(a){return a.children?a.children[0]:a._tree.thread}function m(a,b){return a.parent==b.parent?1:2}function l(a,b){return k(a,b)/a.length}function k(a,b){var c={};return a.reduce(b?function(a,d,e){c.index=e;return a+b.call(c,d)}:function(a,b){return a+b},0)}function j(a,b){function c(a,d){b(a,d);var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}}c(a,null)}function i(a,b){return b.value-a.value}function h(a){return a.value}function g(a){return a.children}function f(a,b){return a+b.y}function e(a){var b=1,c=0,d=a[0].y,e,f=a.length;for(;b<f;++b)(e=a[b].y)>d&&(c=b,d=e);return c}function c(a){return a.reduce(f,0)}d3.layout={},d3.layout.chord=function(){function k(){b.sort(function(a,b){a=Math.min(a.source.value,a.target.value),b=Math.min(b.source.value,b.target.value);return i(a,b)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push({source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function j(){var a=i.length,c,f,g,h,j,k,l;for(c=0;c<a;++c){f=i[c],g=f.source,h=f.target,k=h.x-g.x,l=h.y-g.y;if(j=Math.sqrt(k*k+l*l))j=d/(f.distance*f.distance)*(j-e*f.distance)/j,k*=j,l*=j,h.fixed||(h.x-=k,h.y-=l),g.fixed||(g.x+=k,g.y+=l)}b.tick.dispatch({type:"tick"});return(d*=.99)<.005}var a={},b=d3.dispatch("tick"),c=[1,1],d=.5,e=30,f,g,h,i;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return g;g=b;return a},a.links=function(b){if(!arguments.length)return h;h=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.distance=function(b){if(!arguments.length)return e;e=b;return a},a.start=function(){var b,d,e,f=g.length,k=h.length,l=c[0],m=c[1],n,o=[];for(b=0;b<f;++b){n=g[b],n.x=n.x||Math.random()*l,n.y=n.y||Math.random()*m,n.fixed=0,o[b]=[];for(d=0;d<f;++d)o[b][d]=Infinity;o[b][b]=0}for(b=0;b<k;++b)n=h[b],o[n.source][n.target]=1,o[n.target][n.source]=1,n.source=g[n.source],n.target=g[n.target];for(e=0;e<f;++e)for(b=0;b<f;++b)for(d=0;d<f;++d)o[b][d]=Math.min(o[b][d],o[b][e]+o[e][d]);i=[];for(b=0;b<f;++b)for(d=b+1;d<f;++d)i.push({source:g[b],target:g[d],distance:o[b][d]*o[b][d]});i.sort(function(a,b){return a.distance-b.distance}),d3.timer(j);return a},a.resume=function(){d=.1,d3.timer(j);return a},a.stop=function(){d=0;return a},a.drag=function(){function f(){!b||(e(),b.fixed=!1,b=c=null)}function e(){if(!!b){var d=d3.svg.mouse(c);b.x=d[0],b.y=d[1],a.resume()}}function d(a){(b=a).fixed=!0,c=this,d3.event.preventDefault()}var b,c;this.on("mouseover",function(a){a.fixed=!0}).on("mouseout",function(a){a!=b&&(a.fixed=!1)}).on("mousedown",d),d3.select(window).on("mousemove",e).on("mouseup",f);return a};return a},d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.sort=d3.rebind(e,a.sort),e.children=d3.rebind(e,a.children),e.value=d3.rebind(e,a.value),e.size=function(a){if(!arguments.length)return b;b=a;return e};return e},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function e(e){var f=e.length,g=e[0].length,h,i,j,k=a[c](e);b[d](e,k);for(i=0;i<g;++i)for(h=1,j=e[k[0]][i].y0;h<f;++h)e[k[h]][i].y0=j+=e[k[h-1]][i].y;return e}var c="default",d="zero";e.order=function(a){if(!arguments.length)return c;c=a;return e},e.offset=function(a){if(!arguments.length)return d;d=a;return e};return e};var a={"inside-out":function(a){var b=a.length,d,f,g=a.map(e),h=a.map(c),i=d3.range(b).sort(function(a,b){return g[a]-g[b]}),j=0,k=0,l=[],m=[];for(d=0;d<b;d++)f=i[d],j<k?(j+=h[f],l.push(f)):(k+=h[f],m.push(f));return m.reverse().concat(l)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},b={silhouette:function(a,b){var c=a.length,d=a[0].length,e=[],f=0,g,h,i;for(h=0;h<d;++h){for(g=0,i=0;g<c;g++)i+=a[g][h].y;i>f&&(f=i),e.push(i)}for(h=0,g=b[0];h<d;++h)a[g][h].y0=(f-e[h])/2},wiggle:function(a,b){var c=a.length,d=a[0],e=d.length,f=0,g,h,i,j,k,l=b[0],m,n,o,p,q,r;a[l][0].y0=q=r=0;for(h=1;h<e;++h){for(g=0,m=0;g<c;++g)m+=a[g][h].y;for(g=0,n=0,p=d[h].x-d[h-1].x;g<c;++g){for(i=0,j=b[g],o=(a[j][h].y-a[j][h-1].y)/(2*p);i<g;++i)o+=(a[k=b[i]][h].y-a[k][h-1].y)/p;n+=o*a[j][h].y}a[l][h].y0=q-=m?n/m*p:0,q<r&&(r=q)}for(h=0;h<e;++h)a[l][h].y0-=r},zero:function(a,b){var c=0,d=a[0].length,e=b[0];for(;c<d;++c)a[e][c].y0=0}};d3.layout.hierarchy=function(){function j(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var g=-1,h=d.length,i=b+1;while(++g<h)e+=f(d[g],i)}else e=c.call(j,a.data,b);return a.value=e}function e(f,g,h){var i=b.call(j,f,g),k={depth:g,data:f};h.push(k);if(i){var l=-1,m=i.length,n=k.children=[],o=0,p=g+1;while(++l<m)d=e(i[l],p,h),d.value>0&&(n.push(d),o+=d.value,d.parent=k);a&&n.sort(a),k.value=o}else k.value=c.call(j,f,g);return k}var a=i,b=g,c=h;j.sort=function(b){if(!arguments.length)return a;a=b;return j},j.children=function(a){if(!arguments.length)return b;b=a;return j},j.value=function(a){if(!arguments.length)return c;c=a;return j},j.revalue=function(a){f(a,0);return a};return j},d3.layout.cluster=function(){function c(c,d){var e=a.call(this,c,d),f=e[0],g=0,h=.5-b/2,i=undefined;d3_layout_clusterVisitAfter(f,function(a){a.children?a.depth=1+d3.max(a.children,function(a){return a.depth}):(b&&i!=a.parent&&(i=a.parent,g+=b),g++,a.depth=0)});var k=1/g,m=1/f.depth,i=undefined;d3_layout_clusterVisitAfter(f,function(a){a.children?a.breadth=l(a.children,function(a){return a.breadth}):(b&&i!=a.parent&&(i=a.parent,h+=b),a.breadth=k*h++),a.depth=1-a.depth*m}),d3_layout_clusterVisitAfter(f,function(a){a.minBreadth=a.children?a.children[0].minBreadth:a.breadth-k/2,a.maxBreadth=a.children?a.children[a.children.length-1].maxBreadth:a.breadth+k/2}),j(f,function(a){a.minDepth=a.parent?a.parent.maxDepth:0,a.maxDepth=a.parent?a.depth+f.depth:a.minDepth+2*f.depth}),f.minDepth=-m;return e}var a=d3.layout.hierarchy(),b=0;c.sort=d3.rebind(c,a.sort),c.children=d3.rebind(c,a.children),c.value=d3.rebind(c,a.value),c.group=function(a){if(!arguments.length)return b;b=a;return c};return c},d3_layout_clusterVisitAfter=t,d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=o(g),e=n(e),g&&e)h=n(h),f=o(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(v(w(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!o(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!n(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;u(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];t(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=p(g,r),l=p(g,q),m=p(g,s),x=k.x-b(k,l)/2,y=l.x+b(l,k)/2,z=m.depth;t(g,function(a){a.x=(a.x-x)/(y-x)*c[0],a.y=a.depth/z*c[1],delete a._tree});return f}var a=d3.layout.hierarchy(),b=m,c=[1,1];d.sort=d3.rebind(d,a.sort),d.children=d3.rebind(d,a.children),d.value=d3.rebind(d,a.value),d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.layout.treemap=function(){function k(b){var i=e||a(b),j=i[0];j.x=0,j.y=0,j.dx=c[0],j.dy=c[1],e&&a.revalue(j),f(j,c[0]*c[1]/j.value),(e?h:g)(j),d&&(e=i);return i}function j(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=b(k.area/j);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=b(k.area/j);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function i(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,h=a.length;while(++g<h)d=a[g].area,d<f&&(f=d),d>e&&(e=d);c*=c,b*=b;return Math.max(b*e/c,c/(b*f))}function h(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=a.children.slice(),d,e=[];e.area=0;while(d=c.pop())e.push(d),e.area+=d.area,d.z!=null&&(j(e,d.z?b.dx:b.dy,b,!c.length),e.length=e.area=0);a.children.forEach(h)}}function g(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=[],d=a.children.slice(),e,f=Infinity,h,k=Math.min(b.dx,b.dy),l;c.area=0;while((l=d.length)>0)c.push(e=d[l-1]),c.area+=e.area,(h=i(c,k))<=f?(d.pop(),f=h):(c.area-=c.pop().area,j(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,f=Infinity);c.length&&(j(c,k,b,!0),c.length=c.area=0),a.children.forEach(g)}}function f(a,b){var c=a.children;a.area=a.value*b;if(c){var d=-1,e=c.length;while(++d<e)f(c[d],b)}}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=!1,e;k.sort=d3.rebind(k,a.sort),k.children=d3.rebind(k,a.children),k.value=d3.rebind(k,a.value),k.size=function(a){if(!arguments.length)return c;c=a;return k},k.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return k},k.sticky=function(a){if(!arguments.length)return d;d=a,e=null;return k};return k}})()
<ide>\ No newline at end of file
<add>(function(){function x(a,b,c){return a._tree.ancestor.parent==b.parent?a._tree.ancestor:c}function w(a,b,c){a=a._tree,b=b._tree;var d=c/(b.number-a.number);a.change+=d,b.change-=d,b.shift+=c,b.prelim+=c,b.mod+=c}function v(a){var b=0,c=0,d=a.children,e=d.length,f;while(--e>=0)f=d[e]._tree,f.prelim+=b,f.mod+=b,b+=f.shift+(c+=f.change)}function u(a,b){function c(a,d){var e=a.children;if(e){var f,g=null,h=-1,i=e.length;while(++h<i)f=e[h],c(f,g),g=f}b(a,d)}c(a,null)}function t(a,b){return a.depth-b.depth}function s(a,b){return b.x-a.x}function r(a,b){return a.x-b.x}function q(a,b){var c=a.children;if(c){var d,e=c.length,f=-1;while(++f<e)b(d=q(c[f],b),a)>0&&(a=d)}return a}function p(a){return a.children?a.children[a.children.length-1]:a._tree.thread}function o(a){return a.children?a.children[0]:a._tree.thread}function n(a,b){return a.parent==b.parent?1:2}function m(a){var b=a.children;return b?m(b[b.length-1]):a}function l(a){var b=a.children;return b?l(b[0]):a}function k(a){return a.reduce(function(a,b){return a+b.x},0)/a.length}function j(a){return 1+d3.max(a,function(a){return a.y})}function i(a,b){return b.value-a.value}function h(a){return a.value}function g(a){return a.children}function f(a,b){return a+b.y}function e(a){var b=1,c=0,d=a[0].y,e,f=a.length;for(;b<f;++b)(e=a[b].y)>d&&(c=b,d=e);return c}function c(a){return a.reduce(f,0)}d3.layout={},d3.layout.chord=function(){function k(){b.sort(function(a,b){a=Math.min(a.source.value,a.target.value),b=Math.min(b.source.value,b.target.value);return i(a,b)})}function j(){var a={},j=[],l=d3.range(e),m=[],n,o,p,q,r;b=[],c=[],n=0,q=-1;while(++q<e){o=0,r=-1;while(++r<e)o+=d[q][r];j.push(o),m.push(d3.range(e)),n+=o}g&&l.sort(function(a,b){return g(j[a],j[b])}),h&&m.forEach(function(a,b){a.sort(function(a,c){return h(d[b][a],d[b][c])})}),n=(2*Math.PI-f*e)/n,o=0,q=-1;while(++q<e){p=o,r=-1;while(++r<e){var s=l[q],t=m[q][r],u=d[s][t];a[s+"-"+t]={index:s,subindex:t,startAngle:o,endAngle:o+=u*n,value:u}}c.push({index:s,startAngle:p,endAngle:o,value:(o-p)/n}),o+=f}q=-1;while(++q<e){r=q-1;while(++r<e){var v=a[q+"-"+r],w=a[r+"-"+q];(v.value||w.value)&&b.push({source:v,target:w})}}i&&k()}var a={},b,c,d,e,f=0,g,h,i;a.matrix=function(f){if(!arguments.length)return d;e=(d=f)&&d.length,b=c=null;return a},a.padding=function(d){if(!arguments.length)return f;f=d,b=c=null;return a},a.sortGroups=function(d){if(!arguments.length)return g;g=d,b=c=null;return a},a.sortSubgroups=function(c){if(!arguments.length)return h;h=c,b=null;return a},a.sortChords=function(c){if(!arguments.length)return i;i=c,b&&k();return a},a.chords=function(){b||j();return b},a.groups=function(){c||j();return c};return a},d3.layout.force=function(){function j(){var a=i.length,c,f,g,h,j,k,l;for(c=0;c<a;++c){f=i[c],g=f.source,h=f.target,k=h.x-g.x,l=h.y-g.y;if(j=Math.sqrt(k*k+l*l))j=d/(f.distance*f.distance)*(j-e*f.distance)/j,k*=j,l*=j,h.fixed||(h.x-=k,h.y-=l),g.fixed||(g.x+=k,g.y+=l)}b.tick.dispatch({type:"tick"});return(d*=.99)<.005}var a={},b=d3.dispatch("tick"),c=[1,1],d=.5,e=30,f,g,h,i;a.on=function(c,d){b[c].add(d);return a},a.nodes=function(b){if(!arguments.length)return g;g=b;return a},a.links=function(b){if(!arguments.length)return h;h=b;return a},a.size=function(b){if(!arguments.length)return c;c=b;return a},a.distance=function(b){if(!arguments.length)return e;e=b;return a},a.start=function(){var b,d,e,f=g.length,k=h.length,l=c[0],m=c[1],n,o=[];for(b=0;b<f;++b){n=g[b],n.x=n.x||Math.random()*l,n.y=n.y||Math.random()*m,n.fixed=0,o[b]=[];for(d=0;d<f;++d)o[b][d]=Infinity;o[b][b]=0}for(b=0;b<k;++b)n=h[b],o[n.source][n.target]=1,o[n.target][n.source]=1,n.source=g[n.source],n.target=g[n.target];for(e=0;e<f;++e)for(b=0;b<f;++b)for(d=0;d<f;++d)o[b][d]=Math.min(o[b][d],o[b][e]+o[e][d]);i=[];for(b=0;b<f;++b)for(d=b+1;d<f;++d)i.push({source:g[b],target:g[d],distance:o[b][d]*o[b][d]});i.sort(function(a,b){return a.distance-b.distance}),d3.timer(j);return a},a.resume=function(){d=.1,d3.timer(j);return a},a.stop=function(){d=0;return a},a.drag=function(){function f(){!b||(e(),b.fixed=!1,b=c=null)}function e(){if(!!b){var d=d3.svg.mouse(c);b.x=d[0],b.y=d[1],a.resume()}}function d(a){(b=a).fixed=!0,c=this,d3.event.preventDefault()}var b,c;this.on("mouseover",function(a){a.fixed=!0}).on("mouseout",function(a){a!=b&&(a.fixed=!1)}).on("mousedown",d),d3.select(window).on("mousemove",e).on("mouseup",f);return a};return a},d3.layout.partition=function(){function e(e,f){var g=a.call(this,e,f);c(g[0],0,b[0],b[1]/d(g[0]));return g}function d(a){var b=a.children,c=0;if(b){var e=-1,f=b.length;while(++e<f)c=Math.max(c,d(b[e]))}return 1+c}function c(a,b,d,e){var f=a.children;a.x=b,a.y=a.depth*e,a.dx=d,a.dy=e;if(f){var g=-1,h=f.length,i,j;d/=a.value;while(++g<h)c(i=f[g],b,j=i.value*d,e),b+=j}}var a=d3.layout.hierarchy(),b=[1,1];e.sort=d3.rebind(e,a.sort),e.children=d3.rebind(e,a.children),e.value=d3.rebind(e,a.value),e.size=function(a){if(!arguments.length)return b;b=a;return e};return e},d3.layout.pie=function(){function f(f,g){var h=+(typeof c=="function"?c.apply(this,arguments):c),i=(typeof e=="function"?e.apply(this,arguments):e)-c,j=d3.range(f.length);b!=null&&j.sort(function(a,c){return b(f[a],f[c])});var k=f.map(a);i/=k.reduce(function(a,b){return a+b},0);var l=j.map(function(a){return{value:d=k[a],startAngle:h,endAngle:h+=d*i}});return f.map(function(a,b){return l[j[b]]})}var a=Number,b=null,c=0,e=2*Math.PI;f.value=function(b){if(!arguments.length)return a;a=b;return f},f.sort=function(a){if(!arguments.length)return b;b=a;return f},f.startAngle=function(a){if(!arguments.length)return c;c=a;return f},f.endAngle=function(a){if(!arguments.length)return e;e=a;return f};return f},d3.layout.stack=function(){function e(e){var f=e.length,g=e[0].length,h,i,j,k=a[c](e);b[d](e,k);for(i=0;i<g;++i)for(h=1,j=e[k[0]][i].y0;h<f;++h)e[k[h]][i].y0=j+=e[k[h-1]][i].y;return e}var c="default",d="zero";e.order=function(a){if(!arguments.length)return c;c=a;return e},e.offset=function(a){if(!arguments.length)return d;d=a;return e};return e};var a={"inside-out":function(a){var b=a.length,d,f,g=a.map(e),h=a.map(c),i=d3.range(b).sort(function(a,b){return g[a]-g[b]}),j=0,k=0,l=[],m=[];for(d=0;d<b;d++)f=i[d],j<k?(j+=h[f],l.push(f)):(k+=h[f],m.push(f));return m.reverse().concat(l)},reverse:function(a){return d3.range(a.length).reverse()},"default":function(a){return d3.range(a.length)}},b={silhouette:function(a,b){var c=a.length,d=a[0].length,e=[],f=0,g,h,i;for(h=0;h<d;++h){for(g=0,i=0;g<c;g++)i+=a[g][h].y;i>f&&(f=i),e.push(i)}for(h=0,g=b[0];h<d;++h)a[g][h].y0=(f-e[h])/2},wiggle:function(a,b){var c=a.length,d=a[0],e=d.length,f=0,g,h,i,j,k,l=b[0],m,n,o,p,q,r;a[l][0].y0=q=r=0;for(h=1;h<e;++h){for(g=0,m=0;g<c;++g)m+=a[g][h].y;for(g=0,n=0,p=d[h].x-d[h-1].x;g<c;++g){for(i=0,j=b[g],o=(a[j][h].y-a[j][h-1].y)/(2*p);i<g;++i)o+=(a[k=b[i]][h].y-a[k][h-1].y)/p;n+=o*a[j][h].y}a[l][h].y0=q-=m?n/m*p:0,q<r&&(r=q)}for(h=0;h<e;++h)a[l][h].y0-=r},zero:function(a,b){var c=0,d=a[0].length,e=b[0];for(;c<d;++c)a[e][c].y0=0}};d3.layout.hierarchy=function(){function j(a){var b=[];e(a,0,b);return b}function f(a,b){var d=a.children,e=0;if(d){var g=-1,h=d.length,i=b+1;while(++g<h)e+=f(d[g],i)}else e=c.call(j,a.data,b);return a.value=e}function e(f,g,h){var i=b.call(j,f,g),k={depth:g,data:f};h.push(k);if(i){var l=-1,m=i.length,n=k.children=[],o=0,p=g+1;while(++l<m)d=e(i[l],p,h),d.value>0&&(n.push(d),o+=d.value,d.parent=k);a&&n.sort(a),k.value=o}else k.value=c.call(j,f,g);return k}var a=i,b=g,c=h;j.sort=function(b){if(!arguments.length)return a;a=b;return j},j.children=function(a){if(!arguments.length)return b;b=a;return j},j.value=function(a){if(!arguments.length)return c;c=a;return j},j.revalue=function(a){f(a,0);return a};return j},d3.layout.cluster=function(){function d(d,e){var f=a.call(this,d,e),g=f[0],h,i=0,n,o;u(g,function(a){a.children?(a.x=k(a.children),a.y=j(a.children)):(a.x=h?i+=b(a,h):0,a.y=0,h=a)});var p=l(g),q=m(g),r=p.x-b(p,q)/2,s=q.x+b(q,p)/2;u(g,function(a){a.x=(a.x-r)/(s-r)*c[0],a.y=(1-a.y/g.y)*c[1]});return f}var a=d3.layout.hierarchy(),b=n,c=[1,1];d.sort=d3.rebind(d,a.sort),d.children=d3.rebind(d,a.children),d.value=d3.rebind(d,a.value),d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.layout.tree=function(){function d(d,e){function j(a,c,d){if(c){var e=a,f=a,g=c,h=a.parent.children[0],i=e._tree.mod,j=f._tree.mod,k=g._tree.mod,l=h._tree.mod,m;while(g=p(g),e=o(e),g&&e)h=o(h),f=p(f),f._tree.ancestor=a,m=g._tree.prelim+k-e._tree.prelim-i+b(g,e),m>0&&(w(x(g,a,d),a,m),i+=m,j+=m),k+=g._tree.mod,i+=e._tree.mod,l+=h._tree.mod,j+=f._tree.mod;g&&!p(f)&&(f._tree.thread=g,f._tree.mod+=k-j),e&&!o(h)&&(h._tree.thread=e,h._tree.mod+=i-l,d=a)}return d}function i(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c){var d=-1,e=c.length;b+=a._tree.mod;while(++d<e)i(c[d],b)}}function h(a,c){var d=a.children,e=a._tree;if(d){var f=d.length,g=d[0],i,k=g,l,m=-1;while(++m<f)l=d[m],h(l,i),k=j(l,i,k),i=l;v(a);var n=.5*(g._tree.prelim+l._tree.prelim);c?(e.prelim=c._tree.prelim+b(a,c),e.mod=e.prelim-n):e.prelim=n}else c&&(e.prelim=c._tree.prelim+b(a,c))}var f=a.call(this,d,e),g=f[0];u(g,function(a,b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}}),h(g),i(g,-g._tree.prelim);var k=q(g,s),l=q(g,r),m=q(g,t),n=k.x-b(k,l)/2,y=l.x+b(l,k)/2,z=m.depth;u(g,function(a){a.x=(a.x-n)/(y-n)*c[0],a.y=a.depth/z*c[1],delete a._tree});return f}var a=d3.layout.hierarchy(),b=n,c=[1,1];d.sort=d3.rebind(d,a.sort),d.children=d3.rebind(d,a.children),d.value=d3.rebind(d,a.value),d.separation=function(a){if(!arguments.length)return b;b=a;return d},d.size=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.layout.treemap=function(){function k(b){var i=e||a(b),j=i[0];j.x=0,j.y=0,j.dx=c[0],j.dy=c[1],e&&a.revalue(j),f(j,c[0]*c[1]/j.value),(e?h:g)(j),d&&(e=i);return i}function j(a,c,d,e){var f=-1,g=a.length,h=d.x,i=d.y,j=c?b(a.area/c):0,k;if(c==d.dx){if(e||j>d.dy)j=d.dy;while(++f<g)k=a[f],k.x=h,k.y=i,k.dy=j,h+=k.dx=b(k.area/j);k.z=!0,k.dx+=d.x+d.dx-h,d.y+=j,d.dy-=j}else{if(e||j>d.dx)j=d.dx;while(++f<g)k=a[f],k.x=h,k.y=i,k.dx=j,i+=k.dy=b(k.area/j);k.z=!1,k.dy+=d.y+d.dy-i,d.x+=j,d.dx-=j}}function i(a,b){var c=a.area,d,e=0,f=Infinity,g=-1,h=a.length;while(++g<h)d=a[g].area,d<f&&(f=d),d>e&&(e=d);c*=c,b*=b;return Math.max(b*e/c,c/(b*f))}function h(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=a.children.slice(),d,e=[];e.area=0;while(d=c.pop())e.push(d),e.area+=d.area,d.z!=null&&(j(e,d.z?b.dx:b.dy,b,!c.length),e.length=e.area=0);a.children.forEach(h)}}function g(a){if(!!a.children){var b={x:a.x,y:a.y,dx:a.dx,dy:a.dy},c=[],d=a.children.slice(),e,f=Infinity,h,k=Math.min(b.dx,b.dy),l;c.area=0;while((l=d.length)>0)c.push(e=d[l-1]),c.area+=e.area,(h=i(c,k))<=f?(d.pop(),f=h):(c.area-=c.pop().area,j(c,k,b,!1),k=Math.min(b.dx,b.dy),c.length=c.area=0,f=Infinity);c.length&&(j(c,k,b,!0),c.length=c.area=0),a.children.forEach(g)}}function f(a,b){var c=a.children;a.area=a.value*b;if(c){var d=-1,e=c.length;while(++d<e)f(c[d],b)}}var a=d3.layout.hierarchy(),b=Math.round,c=[1,1],d=!1,e;k.sort=d3.rebind(k,a.sort),k.children=d3.rebind(k,a.children),k.value=d3.rebind(k,a.value),k.size=function(a){if(!arguments.length)return c;c=a;return k},k.round=function(a){if(!arguments.length)return b!=Number;b=a?Math.round:Number;return k},k.sticky=function(a){if(!arguments.length)return d;d=a,e=null;return k};return k}})()
<ide>\ No newline at end of file
<ide><path>examples/cluster/cluster-radial.js
<del>var w = 800,
<del> h = 800,
<del> m = 120;
<add>var r = 960 / 2;
<ide>
<ide> var cluster = d3.layout.cluster()
<add> .size([360, r - 120])
<ide> .sort(null)
<del> .group(true)
<ide> .children(function(d) { return isNaN(d.value) ? d3.entries(d.value) : null; });
<ide>
<ide> var vis = d3.select("#chart").append("svg:svg")
<del> .attr("width", w + 2 * m)
<del> .attr("height", h + 2 * m)
<add> .attr("width", r * 2)
<add> .attr("height", r * 2)
<ide> .append("svg:g")
<del> .attr("transform", "translate(" + (w / 2 + m) + "," + (h / 2 + m) +")");
<add> .attr("transform", "translate(" + r + "," + r + ")");
<ide>
<ide> d3.json("flare.json", function(json) {
<ide> var nodes = cluster(d3.entries(json)[0]);
<ide>
<ide> var link = vis.selectAll("g.link")
<ide> .data(nodes)
<ide> .enter().append("svg:g")
<del> .attr("class", "link")
<del> .selectAll("line")
<del> .data(children)
<del> .enter();
<add> .attr("class", "link");
<ide>
<del> link.append("svg:path")
<add> link.selectAll("path")
<add> .data(children)
<add> .enter().append("svg:path")
<ide> .attr("d", path);
<ide>
<ide> var node = vis.selectAll("g.node")
<ide> .data(nodes)
<ide> .enter().append("svg:g")
<ide> .attr("class", "node")
<del> .attr("transform", function(d) { return "translate(" + x(d) + "," + y(d) + ")rotate(" + (a(d)-90) + ")"; })
<add> .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; })
<ide>
<ide> node.append("svg:circle")
<ide> .attr("r", 4.5);
<ide>
<ide> node.append("svg:text")
<del> .attr("dx", function(d) { return a(d) < 180 ? 8 : -8; })
<add> .attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
<ide> .attr("dy", ".31em")
<del> .attr("text-anchor", function(d) { return a(d) < 180 ? "start" : "end"; })
<del> .attr("transform", function(d) { return a(d) < 180 ? null : "rotate(180)"; })
<del> //.attr("transform", function(d) { return "rotate(" + (a(d.breadth) - 90) + ")"; })
<add> .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
<add> .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
<ide> .text(function(d) { return d.data.key; });
<ide>
<ide> // Returns parent+child objects for any children of `d`.
<ide> d3.json("flare.json", function(json) {
<ide>
<ide> // Computes a pretty Bézier curve from parent to child. TODO reusable helper?
<ide> function path(d) {
<del> var depth = (d.parent.depth + d.child.depth) / 2,
<add> var y0 = (d.parent.y + d.child.y) / 2,
<ide> p0 = d.parent,
<ide> p3 = d.child,
<del> p1 = {breadth: p0.breadth, depth: depth},
<del> p2 = {breadth: p3.breadth, depth: depth};
<add> p1 = {x: p0.x, y: y0},
<add> p2 = {x: p3.x, y: y0};
<ide> return "M" + x(p0) + "," + y(p0)
<ide> + "C" + x(p1) + "," + y(p1)
<ide> + " " + x(p2) + "," + y(p2)
<ide> + " " + x(p3) + "," + y(p3);
<ide> }
<ide>
<ide> // Radial scales for x and y.
<del> function a(d) { return d.breadth * 360; }
<del> function r(d) { return d.depth * w / 2; }
<del> function x(d) { return r(d) * Math.cos((a(d) - 90) / 180 * Math.PI); }
<del> function y(d) { return r(d) * Math.sin((a(d) - 90) / 180 * Math.PI); }
<add> function x(d) { return d.y * Math.cos((d.x - 90) / 180 * Math.PI); }
<add> function y(d) { return d.y * Math.sin((d.x - 90) / 180 * Math.PI); }
<ide> });
<ide><path>examples/cluster/cluster.js
<del>var w = 200,
<del> h = 2200,
<del> x = d3.scale.linear().range([0, w]),
<del> y = d3.scale.linear().range([0, h]);
<add>var w = 960,
<add> h = 2200;
<ide>
<ide> var cluster = d3.layout.cluster()
<add> .size([h, w - 160])
<ide> .sort(null)
<del> .group(true)
<ide> .children(function(d) { return isNaN(d.value) ? d3.entries(d.value) : null; });
<ide>
<ide> var vis = d3.select("#chart").append("svg:svg")
<del> .attr("width", w + 40 + 120)
<add> .attr("width", w)
<ide> .attr("height", h)
<ide> .append("svg:g")
<ide> .attr("transform", "translate(40, 0)");
<ide> d3.json("flare.json", function(json) {
<ide> var link = vis.selectAll("g.link")
<ide> .data(nodes)
<ide> .enter().append("svg:g")
<del> .attr("class", "link")
<del> .selectAll("line")
<add> .attr("class", "link");
<add>
<add> link.selectAll("path")
<ide> .data(children)
<del> .enter();
<del>
<del> link.append("svg:line")
<del> .attr("x1", function(d) { return x(d.parent.depth); })
<del> .attr("y1", function(d) { return y(d.parent.breadth); })
<del> .attr("x2", function(d) { return x(d.parent.depth); })
<del> .attr("y2", function(d) { return y(d.child.breadth); });
<del> link.append("svg:line")
<del> .attr("x1", function(d) { return x(d.parent.depth); })
<del> .attr("y1", function(d) { return y(d.child.breadth); })
<del> .attr("x2", function(d) { return x(d.child.depth); })
<del> .attr("y2", function(d) { return y(d.child.breadth); });
<add> .enter().append("svg:path")
<add> .attr("d", path);
<ide>
<ide> var node = vis.selectAll("g.node")
<ide> .data(nodes)
<ide> .enter().append("svg:g")
<ide> .attr("class", "node")
<del> .attr("transform", function(d) { return "translate(" + x(d.depth) + "," + y(d.breadth) + ")"; })
<add> .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; })
<ide>
<ide> node.append("svg:circle")
<ide> .attr("r", 4.5);
<ide> d3.json("flare.json", function(json) {
<ide> };
<ide> });
<ide> }
<add>
<add> // Computes a pretty Bézier curve from parent to child. TODO reusable helper?
<add> function path(d) {
<add> var y = (d.parent.y + d.child.y) / 2,
<add> p0 = d.parent,
<add> p3 = d.child,
<add> p1 = {x: p0.x, y: y},
<add> p2 = {x: p3.x, y: y};
<add> return "M" + p0.y + "," + p0.x
<add> + "C" + p1.y + "," + p1.x
<add> + " " + p2.y + "," + p2.x
<add> + " " + p3.y + "," + p3.x;
<add> }
<ide> });
<ide><path>examples/tree/tree-radial.js
<ide> d3.json("flare.json", function(json) {
<ide> .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; })
<ide>
<ide> node.append("svg:circle")
<del> .attr("r", 5);
<add> .attr("r", 4.5);
<ide>
<ide> node.append("svg:text")
<ide> .attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
<ide> .attr("dy", ".31em")
<ide> .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
<del> .attr("transform", function(d) { return (d.x < 180) ^ (d.children) ? null : "rotate(180)"; })
<add> .attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
<ide> .text(function(d) { return d.data.key; });
<ide>
<ide> // Returns parent+child objects for any children of `d`.
<ide><path>examples/tree/tree.js
<ide> d3.json("flare.json", function(json) {
<ide> .enter().append("svg:g")
<ide> .attr("class", "link");
<ide>
<del> link.selectAll("line")
<add> link.selectAll("path")
<ide> .data(children)
<del> .enter().append("svg:line")
<del> .attr("x1", function(d) { return d.parent.y; })
<del> .attr("y1", function(d) { return d.parent.x; })
<del> .attr("x2", function(d) { return d.child.y; })
<del> .attr("y2", function(d) { return d.child.x; });
<add> .enter().append("svg:path")
<add> .attr("d", path);
<ide>
<ide> var node = vis.selectAll("g.node")
<ide> .data(nodes)
<ide> d3.json("flare.json", function(json) {
<ide> .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; })
<ide>
<ide> node.append("svg:circle")
<del> .attr("r", 5);
<add> .attr("r", 4.5);
<ide>
<ide> node.append("svg:text")
<ide> .attr("dx", function(d) { return d.children ? -8 : 8; })
<ide> d3.json("flare.json", function(json) {
<ide> };
<ide> });
<ide> }
<add>
<add> // Computes a pretty Bézier curve from parent to child. TODO reusable helper?
<add> function path(d) {
<add> var y = (d.parent.y + d.child.y) / 2,
<add> p0 = d.parent,
<add> p3 = d.child,
<add> p1 = {x: p0.x, y: y},
<add> p2 = {x: p3.x, y: y};
<add> return "M" + p0.y + "," + p0.x
<add> + "C" + p1.y + "," + p1.x
<add> + " " + p2.y + "," + p2.x
<add> + " " + p3.y + "," + p3.x;
<add> }
<ide> });
<ide><path>src/layout/cluster.js
<ide> // Implements a hierarchical layout using the cluster (or dendogram) algorithm.
<ide> d3.layout.cluster = function() {
<ide> var hierarchy = d3.layout.hierarchy(),
<del> group = 0;
<add> separation = d3_layout_treeSeparation,
<add> size = [1, 1]; // width, height
<ide>
<ide> function cluster(d, i) {
<ide> var nodes = hierarchy.call(this, d, i),
<ide> root = nodes[0],
<del> leafCount = 0,
<del> leafIndex = .5 - group / 2;
<add> previousNode,
<add> x = 0,
<add> kx,
<add> ky;
<ide>
<del> /* Count the leaf nodes and compute the depth of descendants. */
<del> var p = undefined;
<del> d3_layout_clusterVisitAfter(root, function(n) {
<del> if (n.children) {
<del> n.depth = 1 + d3.max(n.children, function(n) { return n.depth; });
<add> // First walk, computing the initial x & y values.
<add> d3_layout_treeVisitAfter(root, function(node) {
<add> if (node.children) {
<add> node.x = d3_layout_clusterX(node.children);
<add> node.y = d3_layout_clusterY(node.children);
<ide> } else {
<del> if (group && (p != n.parent)) {
<del> p = n.parent;
<del> leafCount += group;
<del> }
<del> leafCount++;
<del> n.depth = 0;
<add> node.x = previousNode ? x += separation(node, previousNode) : 0;
<add> node.y = 0;
<add> previousNode = node;
<ide> }
<ide> });
<del> var breadth = 1 / leafCount;
<del> var depth = 1 / root.depth;
<ide>
<del> /* Compute the unit breadth and depth of each node. */
<del> var p = undefined;
<del> d3_layout_clusterVisitAfter(root, function(n) {
<del> if (n.children) {
<del> n.breadth = d3_layout_clusterMean(n.children, function(n) { return n.breadth; });
<del> } else {
<del> if (group && (p != n.parent)) {
<del> p = n.parent;
<del> leafIndex += group;
<del> }
<del> n.breadth = breadth * leafIndex++;
<del> }
<del> n.depth = 1 - n.depth * depth;
<del> });
<add> // Compute the left-most, right-most, and depth-most nodes for extents.
<add> var left = d3_layout_clusterLeft(root),
<add> right = d3_layout_clusterRight(root),
<add> x0 = left.x - separation(left, right) / 2,
<add> x1 = right.x + separation(right, left) / 2;
<ide>
<del> /* Compute breadth and depth ranges for space-filling layouts. */
<del> d3_layout_clusterVisitAfter(root, function(n) {
<del> n.minBreadth = n.children
<del> ? n.children[0].minBreadth
<del> : (n.breadth - breadth / 2);
<del> n.maxBreadth = n.children
<del> ? n.children[n.children.length - 1].maxBreadth
<del> : (n.breadth + breadth / 2);
<add> // Second walk, normalizing x & y to the desired size.
<add> d3_layout_treeVisitAfter(root, function(node) {
<add> node.x = (node.x - x0) / (x1 - x0) * size[0];
<add> node.y = (1 - node.y / root.y) * size[1];
<ide> });
<del> d3_layout_clusterVisitBefore(root, function(n) {
<del> n.minDepth = n.parent
<del> ? n.parent.maxDepth
<del> : 0;
<del> n.maxDepth = n.parent
<del> ? (n.depth + root.depth)
<del> : (n.minDepth + 2 * root.depth);
<del> });
<del> root.minDepth = -depth;
<ide>
<ide> return nodes;
<ide> }
<ide> d3.layout.cluster = function() {
<ide> cluster.children = d3.rebind(cluster, hierarchy.children);
<ide> cluster.value = d3.rebind(cluster, hierarchy.value);
<ide>
<del> cluster.group = function(x) {
<del> if (!arguments.length) return group;
<del> group = x;
<add> cluster.separation = function(x) {
<add> if (!arguments.length) return separation;
<add> separation = x;
<add> return cluster;
<add> };
<add>
<add> cluster.size = function(x) {
<add> if (!arguments.length) return size;
<add> size = x;
<ide> return cluster;
<ide> };
<ide>
<ide> return cluster;
<ide> };
<ide>
<del>d3_layout_clusterVisitAfter = d3_layout_treeVisitAfter;
<add>function d3_layout_clusterY(children) {
<add> return 1 + d3.max(children, function(child) {
<add> return child.y;
<add> });
<add>}
<ide>
<del>function d3_layout_clusterVisitBefore(node, callback) {
<del> function visit(node, previousSibling) {
<del> callback(node, previousSibling);
<del> var children = node.children;
<del> if (children) {
<del> var child,
<del> previousChild = null,
<del> i = -1,
<del> n = children.length;
<del> while (++i < n) {
<del> child = children[i];
<del> visit(child, previousChild);
<del> previousChild = child;
<del> }
<del> }
<del> }
<del> visit(node, null);
<add>function d3_layout_clusterX(children) {
<add> return children.reduce(function(x, child) {
<add> return x + child.x;
<add> }, 0) / children.length;
<ide> }
<ide>
<del>function d3_layout_clusterSum(array, f) {
<del> var o = {};
<del> return array.reduce(f
<del> ? function(p, d, i) { o.index = i; return p + f.call(o, d); }
<del> : function(p, d) { return p + d; }, 0);
<add>function d3_layout_clusterLeft(node) {
<add> var children = node.children;
<add> return children ? d3_layout_clusterLeft(children[0]) : node;
<ide> }
<ide>
<del>function d3_layout_clusterMean(array, f) {
<del> return d3_layout_clusterSum(array, f) / array.length;
<add>function d3_layout_clusterRight(node) {
<add> var children = node.children;
<add> return children ? d3_layout_clusterRight(children[children.length - 1]) : node;
<ide> }
| 7
|
Javascript
|
Javascript
|
fix domain with abort-on-uncaught on ppc
|
f45c31576358cf587f2551f9fbd492d9e1b55983
|
<ide><path>test/parallel/test-domain-with-abort-on-uncaught-exception.js
<ide> if (process.argv[2] === 'child') {
<ide> // --abort_on_uncaught_exception is passed on the command line,
<ide> // the process must abort.
<ide> //
<del> // We use an array of values since the actual exit code can differ
<del> // across compilers.
<ide> // Depending on the compiler used, node will exit with either
<del> // exit code 132 (SIGILL) or 134 (SIGABRT).
<del> expectedExitCodes = [132, 134];
<del>
<del> // On platforms using a non-GNU compiler, base::OS::Abort raises
<del> // an illegal instruction signal.
<del> // On platforms using a GNU compiler but with KSH being the
<del> // default shell (like SmartOS), when a process aborts, KSH exits
<del> // with an exit code that is greater than 256, and thus the exit
<del> // code emitted with the 'exit' event is null and the signal is
<del> // set to either SIGABRT or SIGILL.
<del> expectedSignals = ['SIGABRT', 'SIGILL'];
<add> // exit code 132 (SIGILL), 133 (SIGTRAP) or 134 (SIGABRT).
<add> expectedExitCodes = [132, 133, 134];
<add>
<add> // On platforms using KSH as the default shell (like SmartOS),
<add> // when a process aborts, KSH exits with an exit code that is
<add> // greater than 256, and thus the exit code emitted with the 'exit'
<add> // event is null and the signal is set to either SIGILL, SIGTRAP,
<add> // or SIGABRT (depending on the compiler).
<add> expectedSignals = ['SIGILL', 'SIGTRAP', 'SIGABRT'];
<ide>
<ide> // On Windows, v8's base::OS::Abort triggers an access violation,
<ide> // which corresponds to exit code 3221225477 (0xC0000005)
| 1
|
Text
|
Text
|
add v4.6.0-beta.2 to changelog
|
9741caacedb3fec9e82a4752c88345380594571d
|
<ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v4.6.0-beta.2 (June 27, 2022)
<add>
<add>- [#20125](https://github.com/emberjs/ember.js/pull/20125) [BUGFIX] Replace deprecated substr() method with substring() method.
<add>- [#20120](https://github.com/emberjs/ember.js/pull/20120) [BUGFIX] Adjust uniqueId() implementation to only generate valid selectors.
<add>
<ide> ### v4.6.0-beta.1 (June 13, 2022)
<ide>
<ide> No new external changes.
| 1
|
Java
|
Java
|
fix generics and serialization warnings
|
f30b7e3125105e75a0c10a75a27949a2a6937f86
|
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2010 the original author or authors.
<add> * Copyright 2002-2011 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
<ide>
<ide> private ConfigurableListableBeanFactory beanFactory;
<ide>
<del> private final Map<Class<?>, Constructor[]> candidateConstructorsCache =
<del> new ConcurrentHashMap<Class<?>, Constructor[]>();
<add> private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache =
<add> new ConcurrentHashMap<Class<?>, Constructor<?>[]>();
<ide>
<ide> private final Map<Class<?>, InjectionMetadata> injectionMetadataCache =
<ide> new ConcurrentHashMap<Class<?>, InjectionMetadata>();
<ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
<ide> }
<ide>
<ide>
<del> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) {
<add> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
<ide> if (beanType != null) {
<ide> InjectionMetadata metadata = findAutowiringMetadata(beanType);
<ide> metadata.checkConfigMembers(beanDefinition);
<ide> }
<ide> }
<ide>
<ide> @Override
<del> public Constructor[] determineCandidateConstructors(Class beanClass, String beanName) throws BeansException {
<add> public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException {
<ide> // Quick check on the concurrent map first, with minimal locking.
<del> Constructor[] candidateConstructors = this.candidateConstructorsCache.get(beanClass);
<add> Constructor<?>[] candidateConstructors = this.candidateConstructorsCache.get(beanClass);
<ide> if (candidateConstructors == null) {
<ide> synchronized (this.candidateConstructorsCache) {
<ide> candidateConstructors = this.candidateConstructorsCache.get(beanClass);
<ide> if (candidateConstructors == null) {
<del> Constructor[] rawCandidates = beanClass.getDeclaredConstructors();
<del> List<Constructor> candidates = new ArrayList<Constructor>(rawCandidates.length);
<del> Constructor requiredConstructor = null;
<del> Constructor defaultConstructor = null;
<add> Constructor<?>[] rawCandidates = beanClass.getDeclaredConstructors();
<add> List<Constructor<?>> candidates = new ArrayList<Constructor<?>>(rawCandidates.length);
<add> Constructor<?> requiredConstructor = null;
<add> Constructor<?> defaultConstructor = null;
<ide> for (Constructor<?> candidate : rawCandidates) {
<ide> Annotation annotation = findAutowiredAnnotation(candidate);
<ide> if (annotation != null) {
<ide> public void processInjection(Object bean) throws BeansException {
<ide> }
<ide>
<ide>
<del> private InjectionMetadata findAutowiringMetadata(Class clazz) {
<add> private InjectionMetadata findAutowiringMetadata(Class<?> clazz) {
<ide> // Quick check on the concurrent map first, with minimal locking.
<ide> InjectionMetadata metadata = this.injectionMetadataCache.get(clazz);
<ide> if (metadata == null) {
<ide> private InjectionMetadata findAutowiringMetadata(Class clazz) {
<ide> return metadata;
<ide> }
<ide>
<del> private InjectionMetadata buildAutowiringMetadata(Class clazz) {
<add> private InjectionMetadata buildAutowiringMetadata(Class<?> clazz) {
<ide> LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<InjectionMetadata.InjectedElement>();
<ide> Class<?> targetClass = clazz;
<ide>
<ide> protected void inject(Object bean, String beanName, PropertyValues pvs) throws T
<ide> arguments = resolveCachedArguments(beanName);
<ide> }
<ide> else {
<del> Class[] paramTypes = method.getParameterTypes();
<add> Class<?>[] paramTypes = method.getParameterTypes();
<ide> arguments = new Object[paramTypes.length];
<ide> DependencyDescriptor[] descriptors = new DependencyDescriptor[paramTypes.length];
<ide> Set<String> autowiredBeanNames = new LinkedHashSet<String>(paramTypes.length);
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2011 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> * @see #setInitAnnotationType
<ide> * @see #setDestroyAnnotationType
<ide> */
<add>@SuppressWarnings("serial")
<ide> public class InitDestroyAnnotationBeanPostProcessor
<ide> implements DestructionAwareBeanPostProcessor, MergedBeanDefinitionPostProcessor, PriorityOrdered, Serializable {
<ide>
<ide> public int getOrder() {
<ide> }
<ide>
<ide>
<del> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) {
<add> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
<ide> if (beanType != null) {
<ide> LifecycleMetadata metadata = findLifecycleMetadata(beanType);
<ide> metadata.checkConfigMembers(beanDefinition);
<ide> public void postProcessBeforeDestruction(Object bean, String beanName) throws Be
<ide> }
<ide>
<ide>
<del> private LifecycleMetadata findLifecycleMetadata(Class clazz) {
<add> private LifecycleMetadata findLifecycleMetadata(Class<?> clazz) {
<ide> if (this.lifecycleMetadataCache == null) {
<ide> // Happens after deserialization, during destruction...
<ide> return buildLifecycleMetadata(clazz);
<ide> private LifecycleMetadata findLifecycleMetadata(Class clazz) {
<ide> return metadata;
<ide> }
<ide>
<del> private LifecycleMetadata buildLifecycleMetadata(Class clazz) {
<add> private LifecycleMetadata buildLifecycleMetadata(Class<?> clazz) {
<ide> final boolean debug = logger.isDebugEnabled();
<ide> LinkedList<LifecycleElement> initMethods = new LinkedList<LifecycleElement>();
<ide> LinkedList<LifecycleElement> destroyMethods = new LinkedList<LifecycleElement>();
<ide> private class LifecycleMetadata {
<ide>
<ide> private final Set<LifecycleElement> destroyMethods;
<ide>
<del> public LifecycleMetadata(Class targetClass, Collection<LifecycleElement> initMethods,
<add> public LifecycleMetadata(Class<?> targetClass, Collection<LifecycleElement> initMethods,
<ide> Collection<LifecycleElement> destroyMethods) {
<ide>
<ide> this.initMethods = new LinkedHashSet<LifecycleElement>();
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2011 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public int getOrder() {
<ide> }
<ide>
<ide>
<del> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) {
<add> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
<ide> }
<ide>
<ide> @Override
<ide><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2008 the original author or authors.
<add> * Copyright 2002-2011 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><path>org.springframework.beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessorAdapter.java
<ide> public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
<ide> return null;
<ide> }
<ide>
<del> public Constructor<?>[] determineCandidateConstructors(Class beanClass, String beanName) throws BeansException {
<add> public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException {
<ide> return null;
<ide> }
<ide>
<ide> public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
<ide> return bean;
<ide> }
<ide>
<del> public Object postProcessBeforeInstantiation(Class beanClass, String beanName) throws BeansException {
<add> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
<ide> return null;
<ide> }
<ide>
<ide><path>org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2011 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> * @see org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor
<ide> * @see org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
<ide> */
<add>@SuppressWarnings("serial")
<ide> public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBeanPostProcessor
<ide> implements InstantiationAwareBeanPostProcessor, BeanFactoryAware, Serializable {
<ide>
<ide> public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
<ide> static {
<ide> ClassLoader cl = CommonAnnotationBeanPostProcessor.class.getClassLoader();
<ide> try {
<del> webServiceRefClass = (Class) cl.loadClass("javax.xml.ws.WebServiceRef");
<add> @SuppressWarnings("unchecked")
<add> Class<? extends Annotation> clazz = (Class<? extends Annotation>) cl.loadClass("javax.xml.ws.WebServiceRef");
<add> webServiceRefClass = clazz;
<ide> }
<ide> catch (ClassNotFoundException ex) {
<ide> webServiceRefClass = null;
<ide> }
<ide> try {
<del> ejbRefClass = (Class) cl.loadClass("javax.ejb.EJB");
<add> @SuppressWarnings("unchecked")
<add> Class<? extends Annotation> clazz = (Class<? extends Annotation>) cl.loadClass("javax.ejb.EJB");
<add> ejbRefClass = clazz;
<ide> }
<ide> catch (ClassNotFoundException ex) {
<ide> ejbRefClass = null;
<ide> public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
<ide>
<ide>
<ide> @Override
<del> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) {
<add> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
<ide> super.postProcessMergedBeanDefinition(beanDefinition, beanType, beanName);
<ide> if (beanType != null) {
<ide> InjectionMetadata metadata = findResourceMetadata(beanType);
<ide> metadata.checkConfigMembers(beanDefinition);
<ide> }
<ide> }
<ide>
<del> public Object postProcessBeforeInstantiation(Class beanClass, String beanName) throws BeansException {
<add> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
<ide> return null;
<ide> }
<ide>
<ide> public PropertyValues postProcessPropertyValues(
<ide> }
<ide>
<ide>
<del> private InjectionMetadata findResourceMetadata(final Class clazz) {
<add> private InjectionMetadata findResourceMetadata(final Class<?> clazz) {
<ide> // Quick check on the concurrent map first, with minimal locking.
<ide> InjectionMetadata metadata = this.injectionMetadataCache.get(clazz);
<ide> if (metadata == null) {
<ide> else if (method.isAnnotationPresent(Resource.class) &&
<ide> if (Modifier.isStatic(method.getModifiers())) {
<ide> throw new IllegalStateException("@Resource annotation is not supported on static methods");
<ide> }
<del> Class[] paramTypes = method.getParameterTypes();
<add> Class<?>[] paramTypes = method.getParameterTypes();
<ide> if (paramTypes.length != 1) {
<ide> throw new IllegalStateException("@Resource annotation requires a single-arg method: " + method);
<ide> }
<ide> public final DependencyDescriptor getDependencyDescriptor() {
<ide> */
<ide> private class ResourceElement extends LookupElement {
<ide>
<add> @SuppressWarnings("unused")
<ide> protected boolean shareable = true;
<ide>
<ide> public ResourceElement(Member member, PropertyDescriptor pd) {
<ide> public ResourceElement(Member member, PropertyDescriptor pd) {
<ide> protected void initAnnotation(AnnotatedElement ae) {
<ide> Resource resource = ae.getAnnotation(Resource.class);
<ide> String resourceName = resource.name();
<del> Class resourceType = resource.type();
<add> Class<?> resourceType = resource.type();
<ide> this.isDefaultName = !StringUtils.hasLength(resourceName);
<ide> if (this.isDefaultName) {
<ide> resourceName = this.member.getName();
<ide> protected Object getResourceToInject(Object target, String requestingBeanName) {
<ide> */
<ide> private class WebServiceRefElement extends LookupElement {
<ide>
<del> private Class elementType;
<add> private Class<?> elementType;
<ide>
<ide> private String wsdlLocation;
<ide>
<ide> public WebServiceRefElement(Member member, PropertyDescriptor pd) {
<ide> protected void initAnnotation(AnnotatedElement ae) {
<ide> WebServiceRef resource = ae.getAnnotation(WebServiceRef.class);
<ide> String resourceName = resource.name();
<del> Class resourceType = resource.type();
<add> Class<?> resourceType = resource.type();
<ide> this.isDefaultName = !StringUtils.hasLength(resourceName);
<ide> if (this.isDefaultName) {
<ide> resourceName = this.member.getName();
<ide> protected Object getResourceToInject(Object target, String requestingBeanName) {
<ide> }
<ide> if (StringUtils.hasLength(this.wsdlLocation)) {
<ide> try {
<del> Constructor ctor = this.lookupType.getConstructor(new Class[] {URL.class, QName.class});
<add> Constructor<?> ctor = this.lookupType.getConstructor(new Class[] {URL.class, QName.class});
<ide> WebServiceClient clientAnn = this.lookupType.getAnnotation(WebServiceClient.class);
<ide> if (clientAnn == null) {
<ide> throw new IllegalStateException("JAX-WS Service class [" + this.lookupType.getName() +
<ide> protected void initAnnotation(AnnotatedElement ae) {
<ide> resourceName = Introspector.decapitalize(resourceName.substring(3));
<ide> }
<ide> }
<del> Class resourceType = resource.beanInterface();
<add> Class<?> resourceType = resource.beanInterface();
<ide> if (resourceType != null && !Object.class.equals(resourceType)) {
<ide> checkResourceType(resourceType);
<ide> }
<ide> else if (this.isDefaultName && !StringUtils.hasLength(this.mappedName)) {
<ide> */
<ide> private static class LookupDependencyDescriptor extends DependencyDescriptor {
<ide>
<del> private final Class lookupType;
<add> private final Class<?> lookupType;
<ide>
<del> public LookupDependencyDescriptor(Field field, Class lookupType) {
<add> public LookupDependencyDescriptor(Field field, Class<?> lookupType) {
<ide> super(field, true);
<ide> this.lookupType = lookupType;
<ide> }
<ide>
<del> public LookupDependencyDescriptor(Method method, Class lookupType) {
<add> public LookupDependencyDescriptor(Method method, Class<?> lookupType) {
<ide> super(new MethodParameter(method, 0), true);
<ide> this.lookupType = lookupType;
<ide> }
<ide>
<ide> @Override
<del> public Class getDependencyType() {
<add> public Class<?> getDependencyType() {
<ide> return this.lookupType;
<ide> }
<ide> }
<ide><path>org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2010 the original author or authors.
<add> * Copyright 2002-2011 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> * @see Async
<ide> * @see AsyncAnnotationAdvisor
<ide> */
<add>@SuppressWarnings("serial")
<ide> public class AsyncAnnotationBeanPostProcessor extends ProxyConfig
<ide> implements BeanPostProcessor, BeanClassLoaderAware, InitializingBean, Ordered {
<ide>
<ide><path>org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
<ide> public abstract class AnnotationUtils {
<ide> /** The attribute name for annotations with a single element */
<ide> static final String VALUE = "value";
<ide>
<del> private static final Map<Class, Boolean> annotatedInterfaceCache = new WeakHashMap<Class, Boolean>();
<add> private static final Map<Class<?>, Boolean> annotatedInterfaceCache = new WeakHashMap<Class<?>, Boolean>();
<ide>
<ide>
<ide> /**
<ide> public static <A extends Annotation> A findAnnotation(Method method, Class<A> an
<ide> return annotation;
<ide> }
<ide>
<del> private static <A extends Annotation> A searchOnInterfaces(Method method, Class<A> annotationType, Class[] ifcs) {
<add> private static <A extends Annotation> A searchOnInterfaces(Method method, Class<A> annotationType, Class<?>[] ifcs) {
<ide> A annotation = null;
<ide> for (Class<?> iface : ifcs) {
<ide> if (isInterfaceWithAnnotatedMethods(iface)) {
<ide> public static Map<String, Object> getAnnotationAttributes(Annotation annotation,
<ide> Object value = method.invoke(annotation);
<ide> if (classValuesAsString) {
<ide> if (value instanceof Class) {
<del> value = ((Class) value).getName();
<add> value = ((Class<?>) value).getName();
<ide> }
<ide> else if (value instanceof Class[]) {
<del> Class[] clazzArray = (Class[]) value;
<add> Class<?>[] clazzArray = (Class[]) value;
<ide> String[] newValue = new String[clazzArray.length];
<ide> for (int i = 0; i < clazzArray.length; i++) {
<ide> newValue[i] = clazzArray[i].getName();
<ide><path>org.springframework.orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java
<ide> /*
<del> * Copyright 2002-2010 the original author or authors.
<add> * Copyright 2002-2011 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import java.util.Map;
<ide> import java.util.Properties;
<ide> import java.util.concurrent.ConcurrentHashMap;
<add>
<ide> import javax.persistence.EntityManager;
<ide> import javax.persistence.EntityManagerFactory;
<ide> import javax.persistence.PersistenceContext;
<ide> * @see javax.persistence.PersistenceUnit
<ide> * @see javax.persistence.PersistenceContext
<ide> */
<add>@SuppressWarnings("serial")
<ide> public class PersistenceAnnotationBeanPostProcessor
<ide> implements InstantiationAwareBeanPostProcessor, DestructionAwareBeanPostProcessor,
<ide> MergedBeanDefinitionPostProcessor, PriorityOrdered, BeanFactoryAware, Serializable {
<ide> public void setBeanFactory(BeanFactory beanFactory) {
<ide> }
<ide>
<ide>
<del> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) {
<add> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
<ide> if (beanType != null) {
<ide> InjectionMetadata metadata = findPersistenceMetadata(beanType);
<ide> metadata.checkConfigMembers(beanDefinition);
<ide> }
<ide> }
<ide>
<del> public Object postProcessBeforeInstantiation(Class beanClass, String beanName) throws BeansException {
<add> public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
<ide> return null;
<ide> }
<ide>
<ide> public void postProcessBeforeDestruction(Object bean, String beanName) throws Be
<ide> }
<ide>
<ide>
<del> private InjectionMetadata findPersistenceMetadata(final Class clazz) {
<add> private InjectionMetadata findPersistenceMetadata(final Class<?> clazz) {
<ide> // Quick check on the concurrent map first, with minimal locking.
<ide> InjectionMetadata metadata = this.injectionMetadataCache.get(clazz);
<ide> if (metadata == null) {
<ide> public PersistenceElement(Member member, PropertyDescriptor pd) {
<ide> AnnotatedElement ae = (AnnotatedElement) member;
<ide> PersistenceContext pc = ae.getAnnotation(PersistenceContext.class);
<ide> PersistenceUnit pu = ae.getAnnotation(PersistenceUnit.class);
<del> Class resourceType = EntityManager.class;
<add> Class<?> resourceType = EntityManager.class;
<ide> if (pc != null) {
<ide> if (pu != null) {
<ide> throw new IllegalStateException("Member may only be annotated with either " +
| 9
|
Ruby
|
Ruby
|
instruct users to run git fetch unshallow
|
9cfef076821e03a2c3e5988cc9a69eb6017f64c7
|
<ide><path>Library/Homebrew/dev-cmd/extract.rb
<ide> def extract
<ide> loop do
<ide> rev = rev.nil? ? "HEAD" : "#{rev}~1"
<ide> rev, (path,) = Git.last_revision_commit_of_files(repo, pattern, before_commit: rev)
<del> odie "Could not find #{name}! The formula or version may not have existed." if rev.nil?
<add> if rev.nil? && source_tap.shallow?
<add> odie <<~EOS
<add> Could not find #{name} but #{source_tap} is a shallow clone!
<add> Try again after running:
<add> git -C "#{source_tap.path}" fetch --unshallow
<add> EOS
<add> elsif rev.nil?
<add> odie "Could not find #{name}! The formula or version may not have existed."
<add> end
<ide>
<ide> file = repo/path
<ide> result = Git.last_revision_of_file(repo, file, before_commit: rev)
| 1
|
Mixed
|
Java
|
move observable unittests
|
8cb026af3efc1621ccbe5587ff3b66c2d2714543
|
<ide><path>rxjava-core/src/main/java/rx/Observable.java
<ide> import java.util.Collection;
<ide> import java.util.List;
<ide> import java.util.Map;
<del>import java.util.concurrent.CountDownLatch;
<ide> import java.util.concurrent.Future;
<ide> import java.util.concurrent.TimeUnit;
<del>import java.util.concurrent.atomic.AtomicInteger;
<del>import java.util.concurrent.atomic.AtomicReference;
<ide>
<del>import org.junit.Before;
<del>import org.junit.Test;
<del>import org.mockito.Mock;
<del>import org.mockito.Mockito;
<del>import org.mockito.MockitoAnnotations;
<ide>
<ide> import rx.concurrency.Schedulers;
<ide> import rx.observables.BlockingObservable;
<ide> import rx.subjects.PublishSubject;
<ide> import rx.subjects.ReplaySubject;
<ide> import rx.subjects.Subject;
<del>import rx.subscriptions.BooleanSubscription;
<ide> import rx.subscriptions.Subscriptions;
<ide> import rx.util.BufferClosing;
<ide> import rx.util.BufferOpening;
<ide> private boolean isInternalImplementation(Object o) {
<ide> return p != null && p.getName().startsWith("rx.operators");
<ide> }
<ide>
<del> public static class UnitTest {
<del>
<del> @Mock
<del> Observer<Integer> w;
<del>
<del> @Before
<del> public void before() {
<del> MockitoAnnotations.initMocks(this);
<del> }
<del>
<del> @Test
<del> public void testCreate() {
<del>
<del> Observable<String> observable = create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(Observer<String> Observer) {
<del> Observer.onNext("one");
<del> Observer.onNext("two");
<del> Observer.onNext("three");
<del> Observer.onCompleted();
<del> return Subscriptions.empty();
<del> }
<del>
<del> });
<del>
<del> @SuppressWarnings("unchecked")
<del> Observer<String> aObserver = mock(Observer.class);
<del> observable.subscribe(aObserver);
<del> verify(aObserver, times(1)).onNext("one");
<del> verify(aObserver, times(1)).onNext("two");
<del> verify(aObserver, times(1)).onNext("three");
<del> verify(aObserver, Mockito.never()).onError(any(Throwable.class));
<del> verify(aObserver, times(1)).onCompleted();
<del> }
<del>
<del> @Test
<del> public void testReduce() {
<del> Observable<Integer> observable = from(1, 2, 3, 4);
<del> observable.reduce(new Func2<Integer, Integer, Integer>() {
<del>
<del> @Override
<del> public Integer call(Integer t1, Integer t2) {
<del> return t1 + t2;
<del> }
<del>
<del> }).subscribe(w);
<del> // we should be called only once
<del> verify(w, times(1)).onNext(anyInt());
<del> verify(w).onNext(10);
<del> }
<del>
<del> @Test
<del> public void testReduceWithInitialValue() {
<del> Observable<Integer> observable = from(1, 2, 3, 4);
<del> observable.reduce(50, new Func2<Integer, Integer, Integer>() {
<del>
<del> @Override
<del> public Integer call(Integer t1, Integer t2) {
<del> return t1 + t2;
<del> }
<del>
<del> }).subscribe(w);
<del> // we should be called only once
<del> verify(w, times(1)).onNext(anyInt());
<del> verify(w).onNext(60);
<del> }
<del>
<del> @Test
<del> public void testSequenceEqual() {
<del> Observable<Integer> first = from(1, 2, 3);
<del> Observable<Integer> second = from(1, 2, 4);
<del> @SuppressWarnings("unchecked")
<del> Observer<Boolean> result = mock(Observer.class);
<del> sequenceEqual(first, second).subscribe(result);
<del> verify(result, times(2)).onNext(true);
<del> verify(result, times(1)).onNext(false);
<del> }
<del>
<del> @Test
<del> public void testOnSubscribeFails() {
<del> @SuppressWarnings("unchecked")
<del> Observer<String> observer = mock(Observer.class);
<del> final RuntimeException re = new RuntimeException("bad impl");
<del> Observable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(Observer<String> t1) {
<del> throw re;
<del> }
<del>
<del> });
<del> o.subscribe(observer);
<del> verify(observer, times(0)).onNext(anyString());
<del> verify(observer, times(0)).onCompleted();
<del> verify(observer, times(1)).onError(re);
<del> }
<del>
<del> @Test
<del> public void testMaterializeDematerializeChaining() {
<del> Observable<Integer> obs = Observable.just(1);
<del> Observable<Integer> chained = obs.materialize().dematerialize();
<del>
<del> @SuppressWarnings("unchecked")
<del> Observer<Integer> observer = mock(Observer.class);
<del> chained.subscribe(observer);
<del>
<del> verify(observer, times(1)).onNext(1);
<del> verify(observer, times(1)).onCompleted();
<del> verify(observer, times(0)).onError(any(Throwable.class));
<del> }
<del>
<del> /**
<del> * The error from the user provided Observer is not handled by the subscribe method try/catch.
<del> *
<del> * It is handled by the AtomicObserver that wraps the provided Observer.
<del> *
<del> * Result: Passes (if AtomicObserver functionality exists)
<del> */
<del> @Test
<del> public void testCustomObservableWithErrorInObserverAsynchronous() throws InterruptedException {
<del> final CountDownLatch latch = new CountDownLatch(1);
<del> final AtomicInteger count = new AtomicInteger();
<del> final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
<del> Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(final Observer<String> observer) {
<del> final BooleanSubscription s = new BooleanSubscription();
<del> new Thread(new Runnable() {
<del>
<del> @Override
<del> public void run() {
<del> try {
<del> if (!s.isUnsubscribed()) {
<del> observer.onNext("1");
<del> observer.onNext("2");
<del> observer.onNext("three");
<del> observer.onNext("4");
<del> observer.onCompleted();
<del> }
<del> } finally {
<del> latch.countDown();
<del> }
<del> }
<del> }).start();
<del> return s;
<del> }
<del> }).subscribe(new Observer<String>() {
<del> @Override
<del> public void onCompleted() {
<del> System.out.println("completed");
<del> }
<del>
<del> @Override
<del> public void onError(Throwable e) {
<del> error.set(e);
<del> System.out.println("error");
<del> e.printStackTrace();
<del> }
<del>
<del> @Override
<del> public void onNext(String v) {
<del> int num = Integer.parseInt(v);
<del> System.out.println(num);
<del> // doSomething(num);
<del> count.incrementAndGet();
<del> }
<del>
<del> });
<del>
<del> // wait for async sequence to complete
<del> latch.await();
<del>
<del> assertEquals(2, count.get());
<del> assertNotNull(error.get());
<del> if (!(error.get() instanceof NumberFormatException)) {
<del> fail("It should be a NumberFormatException");
<del> }
<del> }
<del>
<del> /**
<del> * The error from the user provided Observer is handled by the subscribe try/catch because this is synchronous
<del> *
<del> * Result: Passes
<del> */
<del> @Test
<del> public void testCustomObservableWithErrorInObserverSynchronous() {
<del> final AtomicInteger count = new AtomicInteger();
<del> final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
<del> Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(Observer<String> observer) {
<del> observer.onNext("1");
<del> observer.onNext("2");
<del> observer.onNext("three");
<del> observer.onNext("4");
<del> observer.onCompleted();
<del> return Subscriptions.empty();
<del> }
<del> }).subscribe(new Observer<String>() {
<del>
<del> @Override
<del> public void onCompleted() {
<del> System.out.println("completed");
<del> }
<del>
<del> @Override
<del> public void onError(Throwable e) {
<del> error.set(e);
<del> System.out.println("error");
<del> e.printStackTrace();
<del> }
<del>
<del> @Override
<del> public void onNext(String v) {
<del> int num = Integer.parseInt(v);
<del> System.out.println(num);
<del> // doSomething(num);
<del> count.incrementAndGet();
<del> }
<del>
<del> });
<del> assertEquals(2, count.get());
<del> assertNotNull(error.get());
<del> if (!(error.get() instanceof NumberFormatException)) {
<del> fail("It should be a NumberFormatException");
<del> }
<del> }
<del>
<del> /**
<del> * The error from the user provided Observable is handled by the subscribe try/catch because this is synchronous
<del> *
<del> *
<del> * Result: Passes
<del> */
<del> @Test
<del> public void testCustomObservableWithErrorInObservableSynchronous() {
<del> final AtomicInteger count = new AtomicInteger();
<del> final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
<del> Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(Observer<String> observer) {
<del> observer.onNext("1");
<del> observer.onNext("2");
<del> throw new NumberFormatException();
<del> }
<del> }).subscribe(new Observer<String>() {
<del>
<del> @Override
<del> public void onCompleted() {
<del> System.out.println("completed");
<del> }
<del>
<del> @Override
<del> public void onError(Throwable e) {
<del> error.set(e);
<del> System.out.println("error");
<del> e.printStackTrace();
<del> }
<del>
<del> @Override
<del> public void onNext(String v) {
<del> System.out.println(v);
<del> count.incrementAndGet();
<del> }
<del>
<del> });
<del> assertEquals(2, count.get());
<del> assertNotNull(error.get());
<del> if (!(error.get() instanceof NumberFormatException)) {
<del> fail("It should be a NumberFormatException");
<del> }
<del> }
<del>
<del> @Test
<del> public void testPublish() throws InterruptedException {
<del> final AtomicInteger counter = new AtomicInteger();
<del> ConnectableObservable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(final Observer<String> observer) {
<del> final BooleanSubscription subscription = new BooleanSubscription();
<del> new Thread(new Runnable() {
<del>
<del> @Override
<del> public void run() {
<del> counter.incrementAndGet();
<del> observer.onNext("one");
<del> observer.onCompleted();
<del> }
<del> }).start();
<del> return subscription;
<del> }
<del> }).publish();
<del>
<del> final CountDownLatch latch = new CountDownLatch(2);
<del>
<del> // subscribe once
<del> o.subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String v) {
<del> assertEquals("one", v);
<del> latch.countDown();
<del> }
<del> });
<del>
<del> // subscribe again
<del> o.subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String v) {
<del> assertEquals("one", v);
<del> latch.countDown();
<del> }
<del> });
<del>
<del> Subscription s = o.connect();
<del> try {
<del> if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
<del> fail("subscriptions did not receive values");
<del> }
<del> assertEquals(1, counter.get());
<del> } finally {
<del> s.unsubscribe();
<del> }
<del> }
<del>
<del> @Test
<del> public void testReplay() throws InterruptedException {
<del> final AtomicInteger counter = new AtomicInteger();
<del> ConnectableObservable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(final Observer<String> observer) {
<del> final BooleanSubscription subscription = new BooleanSubscription();
<del> new Thread(new Runnable() {
<del>
<del> @Override
<del> public void run() {
<del> counter.incrementAndGet();
<del> observer.onNext("one");
<del> observer.onCompleted();
<del> }
<del> }).start();
<del> return subscription;
<del> }
<del> }).replay();
<del>
<del> // we connect immediately and it will emit the value
<del> Subscription s = o.connect();
<del> try {
<del>
<del> // we then expect the following 2 subscriptions to get that same value
<del> final CountDownLatch latch = new CountDownLatch(2);
<del>
<del> // subscribe once
<del> o.subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String v) {
<del> assertEquals("one", v);
<del> latch.countDown();
<del> }
<del> });
<del>
<del> // subscribe again
<del> o.subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String v) {
<del> assertEquals("one", v);
<del> latch.countDown();
<del> }
<del> });
<del>
<del> if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
<del> fail("subscriptions did not receive values");
<del> }
<del> assertEquals(1, counter.get());
<del> } finally {
<del> s.unsubscribe();
<del> }
<del> }
<del>
<del> @Test
<del> public void testCache() throws InterruptedException {
<del> final AtomicInteger counter = new AtomicInteger();
<del> Observable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(final Observer<String> observer) {
<del> final BooleanSubscription subscription = new BooleanSubscription();
<del> new Thread(new Runnable() {
<del>
<del> @Override
<del> public void run() {
<del> counter.incrementAndGet();
<del> observer.onNext("one");
<del> observer.onCompleted();
<del> }
<del> }).start();
<del> return subscription;
<del> }
<del> }).cache();
<del>
<del> // we then expect the following 2 subscriptions to get that same value
<del> final CountDownLatch latch = new CountDownLatch(2);
<del>
<del> // subscribe once
<del> o.subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String v) {
<del> assertEquals("one", v);
<del> latch.countDown();
<del> }
<del> });
<del>
<del> // subscribe again
<del> o.subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String v) {
<del> assertEquals("one", v);
<del> latch.countDown();
<del> }
<del> });
<del>
<del> if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
<del> fail("subscriptions did not receive values");
<del> }
<del> assertEquals(1, counter.get());
<del> }
<del>
<del> /**
<del> * https://github.com/Netflix/RxJava/issues/198
<del> *
<del> * Rx Design Guidelines 5.2
<del> *
<del> * "when calling the Subscribe method that only has an onNext argument, the OnError behavior will be
<del> * to rethrow the exception on the thread that the message comes out from the Observable.
<del> * The OnCompleted behavior in this case is to do nothing."
<del> */
<del> @Test
<del> public void testErrorThrownWithoutErrorHandlerSynchronous() {
<del> try {
<del> error(new RuntimeException("failure")).subscribe(new Action1<Object>() {
<del>
<del> @Override
<del> public void call(Object t1) {
<del> // won't get anything
<del> }
<del>
<del> });
<del> fail("expected exception");
<del> } catch (Throwable e) {
<del> assertEquals("failure", e.getMessage());
<del> }
<del> }
<del>
<del> /**
<del> * https://github.com/Netflix/RxJava/issues/198
<del> *
<del> * Rx Design Guidelines 5.2
<del> *
<del> * "when calling the Subscribe method that only has an onNext argument, the OnError behavior will be
<del> * to rethrow the exception on the thread that the message comes out from the Observable.
<del> * The OnCompleted behavior in this case is to do nothing."
<del> *
<del> * @throws InterruptedException
<del> */
<del> @Test
<del> public void testErrorThrownWithoutErrorHandlerAsynchronous() throws InterruptedException {
<del> final CountDownLatch latch = new CountDownLatch(1);
<del> final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
<del> Observable.create(new Func1<Observer<String>, Subscription>() {
<del>
<del> @Override
<del> public Subscription call(final Observer<String> observer) {
<del> new Thread(new Runnable() {
<del>
<del> @Override
<del> public void run() {
<del> try {
<del> observer.onError(new Error("failure"));
<del> } catch (Throwable e) {
<del> // without an onError handler it has to just throw on whatever thread invokes it
<del> exception.set(e);
<del> }
<del> latch.countDown();
<del> }
<del> }).start();
<del> return Subscriptions.empty();
<del> }
<del> }).subscribe(new Action1<String>() {
<del>
<del> @Override
<del> public void call(String t1) {
<del>
<del> }
<del>
<del> });
<del> // wait for exception
<del> latch.await(3000, TimeUnit.MILLISECONDS);
<del> assertNotNull(exception.get());
<del> assertEquals("failure", exception.get().getMessage());
<del> }
<del> }
<del>
<ide> }
<ide><path>rxjava-core/src/test/java/README.md
<del>This test folder only contains performance and functional/integration style tests.
<del>
<del>The unit tests themselves are embedded as inner classes of the Java code (such as here: [rxjava-core/src/main/java/rx/operators](https://github.com/Netflix/RxJava/tree/master/rxjava-core/src/main/java/rx/operators)).
<add>Not all unit tests are here, many are also embedded as inner classes of the main code (such as here: [rxjava-core/src/main/java/rx/operators](https://github.com/Netflix/RxJava/tree/master/rxjava-core/src/main/java/rx/operators)).
<ide>
<ide> * For an explanation of this design choice see
<ide> Ben J. Christensen's [JUnit Tests as Inner Classes](http://benjchristensen.com/2011/10/23/junit-tests-as-inner-classes/).
<ide><path>rxjava-core/src/test/java/rx/ObservableTests.java
<add>package rx;
<add>
<add>import static org.junit.Assert.*;
<add>import static org.mockito.Matchers.*;
<add>import static org.mockito.Mockito.*;
<add>
<add>import java.util.concurrent.CountDownLatch;
<add>import java.util.concurrent.TimeUnit;
<add>import java.util.concurrent.atomic.AtomicInteger;
<add>import java.util.concurrent.atomic.AtomicReference;
<add>
<add>import org.junit.Before;
<add>import org.junit.Test;
<add>import org.mockito.Mock;
<add>import org.mockito.Mockito;
<add>import org.mockito.MockitoAnnotations;
<add>
<add>import rx.observables.ConnectableObservable;
<add>import rx.subscriptions.BooleanSubscription;
<add>import rx.subscriptions.Subscriptions;
<add>import rx.util.functions.Action1;
<add>import rx.util.functions.Func1;
<add>import rx.util.functions.Func2;
<add>
<add>public class ObservableTests {
<add>
<add> @Mock
<add> Observer<Integer> w;
<add>
<add> @Before
<add> public void before() {
<add> MockitoAnnotations.initMocks(this);
<add> }
<add>
<add> @Test
<add> public void testCreate() {
<add>
<add> Observable<String> observable = Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(Observer<String> Observer) {
<add> Observer.onNext("one");
<add> Observer.onNext("two");
<add> Observer.onNext("three");
<add> Observer.onCompleted();
<add> return Subscriptions.empty();
<add> }
<add>
<add> });
<add>
<add> @SuppressWarnings("unchecked")
<add> Observer<String> aObserver = mock(Observer.class);
<add> observable.subscribe(aObserver);
<add> verify(aObserver, times(1)).onNext("one");
<add> verify(aObserver, times(1)).onNext("two");
<add> verify(aObserver, times(1)).onNext("three");
<add> verify(aObserver, Mockito.never()).onError(any(Throwable.class));
<add> verify(aObserver, times(1)).onCompleted();
<add> }
<add>
<add> @Test
<add> public void testReduce() {
<add> Observable<Integer> observable = Observable.from(1, 2, 3, 4);
<add> observable.reduce(new Func2<Integer, Integer, Integer>() {
<add>
<add> @Override
<add> public Integer call(Integer t1, Integer t2) {
<add> return t1 + t2;
<add> }
<add>
<add> }).subscribe(w);
<add> // we should be called only once
<add> verify(w, times(1)).onNext(anyInt());
<add> verify(w).onNext(10);
<add> }
<add>
<add> @Test
<add> public void testReduceWithInitialValue() {
<add> Observable<Integer> observable = Observable.from(1, 2, 3, 4);
<add> observable.reduce(50, new Func2<Integer, Integer, Integer>() {
<add>
<add> @Override
<add> public Integer call(Integer t1, Integer t2) {
<add> return t1 + t2;
<add> }
<add>
<add> }).subscribe(w);
<add> // we should be called only once
<add> verify(w, times(1)).onNext(anyInt());
<add> verify(w).onNext(60);
<add> }
<add>
<add> @Test
<add> public void testSequenceEqual() {
<add> Observable<Integer> first = Observable.from(1, 2, 3);
<add> Observable<Integer> second = Observable.from(1, 2, 4);
<add> @SuppressWarnings("unchecked")
<add> Observer<Boolean> result = mock(Observer.class);
<add> Observable.sequenceEqual(first, second).subscribe(result);
<add> verify(result, times(2)).onNext(true);
<add> verify(result, times(1)).onNext(false);
<add> }
<add>
<add> @Test
<add> public void testOnSubscribeFails() {
<add> @SuppressWarnings("unchecked")
<add> Observer<String> observer = mock(Observer.class);
<add> final RuntimeException re = new RuntimeException("bad impl");
<add> Observable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(Observer<String> t1) {
<add> throw re;
<add> }
<add>
<add> });
<add> o.subscribe(observer);
<add> verify(observer, times(0)).onNext(anyString());
<add> verify(observer, times(0)).onCompleted();
<add> verify(observer, times(1)).onError(re);
<add> }
<add>
<add> @Test
<add> public void testMaterializeDematerializeChaining() {
<add> Observable<Integer> obs = Observable.just(1);
<add> Observable<Integer> chained = obs.materialize().dematerialize();
<add>
<add> @SuppressWarnings("unchecked")
<add> Observer<Integer> observer = mock(Observer.class);
<add> chained.subscribe(observer);
<add>
<add> verify(observer, times(1)).onNext(1);
<add> verify(observer, times(1)).onCompleted();
<add> verify(observer, times(0)).onError(any(Throwable.class));
<add> }
<add>
<add> /**
<add> * The error from the user provided Observer is not handled by the subscribe method try/catch.
<add> *
<add> * It is handled by the AtomicObserver that wraps the provided Observer.
<add> *
<add> * Result: Passes (if AtomicObserver functionality exists)
<add> */
<add> @Test
<add> public void testCustomObservableWithErrorInObserverAsynchronous() throws InterruptedException {
<add> final CountDownLatch latch = new CountDownLatch(1);
<add> final AtomicInteger count = new AtomicInteger();
<add> final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
<add> Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(final Observer<String> observer) {
<add> final BooleanSubscription s = new BooleanSubscription();
<add> new Thread(new Runnable() {
<add>
<add> @Override
<add> public void run() {
<add> try {
<add> if (!s.isUnsubscribed()) {
<add> observer.onNext("1");
<add> observer.onNext("2");
<add> observer.onNext("three");
<add> observer.onNext("4");
<add> observer.onCompleted();
<add> }
<add> } finally {
<add> latch.countDown();
<add> }
<add> }
<add> }).start();
<add> return s;
<add> }
<add> }).subscribe(new Observer<String>() {
<add> @Override
<add> public void onCompleted() {
<add> System.out.println("completed");
<add> }
<add>
<add> @Override
<add> public void onError(Throwable e) {
<add> error.set(e);
<add> System.out.println("error");
<add> e.printStackTrace();
<add> }
<add>
<add> @Override
<add> public void onNext(String v) {
<add> int num = Integer.parseInt(v);
<add> System.out.println(num);
<add> // doSomething(num);
<add> count.incrementAndGet();
<add> }
<add>
<add> });
<add>
<add> // wait for async sequence to complete
<add> latch.await();
<add>
<add> assertEquals(2, count.get());
<add> assertNotNull(error.get());
<add> if (!(error.get() instanceof NumberFormatException)) {
<add> fail("It should be a NumberFormatException");
<add> }
<add> }
<add>
<add> /**
<add> * The error from the user provided Observer is handled by the subscribe try/catch because this is synchronous
<add> *
<add> * Result: Passes
<add> */
<add> @Test
<add> public void testCustomObservableWithErrorInObserverSynchronous() {
<add> final AtomicInteger count = new AtomicInteger();
<add> final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
<add> Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(Observer<String> observer) {
<add> observer.onNext("1");
<add> observer.onNext("2");
<add> observer.onNext("three");
<add> observer.onNext("4");
<add> observer.onCompleted();
<add> return Subscriptions.empty();
<add> }
<add> }).subscribe(new Observer<String>() {
<add>
<add> @Override
<add> public void onCompleted() {
<add> System.out.println("completed");
<add> }
<add>
<add> @Override
<add> public void onError(Throwable e) {
<add> error.set(e);
<add> System.out.println("error");
<add> e.printStackTrace();
<add> }
<add>
<add> @Override
<add> public void onNext(String v) {
<add> int num = Integer.parseInt(v);
<add> System.out.println(num);
<add> // doSomething(num);
<add> count.incrementAndGet();
<add> }
<add>
<add> });
<add> assertEquals(2, count.get());
<add> assertNotNull(error.get());
<add> if (!(error.get() instanceof NumberFormatException)) {
<add> fail("It should be a NumberFormatException");
<add> }
<add> }
<add>
<add> /**
<add> * The error from the user provided Observable is handled by the subscribe try/catch because this is synchronous
<add> *
<add> *
<add> * Result: Passes
<add> */
<add> @Test
<add> public void testCustomObservableWithErrorInObservableSynchronous() {
<add> final AtomicInteger count = new AtomicInteger();
<add> final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
<add> Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(Observer<String> observer) {
<add> observer.onNext("1");
<add> observer.onNext("2");
<add> throw new NumberFormatException();
<add> }
<add> }).subscribe(new Observer<String>() {
<add>
<add> @Override
<add> public void onCompleted() {
<add> System.out.println("completed");
<add> }
<add>
<add> @Override
<add> public void onError(Throwable e) {
<add> error.set(e);
<add> System.out.println("error");
<add> e.printStackTrace();
<add> }
<add>
<add> @Override
<add> public void onNext(String v) {
<add> System.out.println(v);
<add> count.incrementAndGet();
<add> }
<add>
<add> });
<add> assertEquals(2, count.get());
<add> assertNotNull(error.get());
<add> if (!(error.get() instanceof NumberFormatException)) {
<add> fail("It should be a NumberFormatException");
<add> }
<add> }
<add>
<add> @Test
<add> public void testPublish() throws InterruptedException {
<add> final AtomicInteger counter = new AtomicInteger();
<add> ConnectableObservable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(final Observer<String> observer) {
<add> final BooleanSubscription subscription = new BooleanSubscription();
<add> new Thread(new Runnable() {
<add>
<add> @Override
<add> public void run() {
<add> counter.incrementAndGet();
<add> observer.onNext("one");
<add> observer.onCompleted();
<add> }
<add> }).start();
<add> return subscription;
<add> }
<add> }).publish();
<add>
<add> final CountDownLatch latch = new CountDownLatch(2);
<add>
<add> // subscribe once
<add> o.subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String v) {
<add> assertEquals("one", v);
<add> latch.countDown();
<add> }
<add> });
<add>
<add> // subscribe again
<add> o.subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String v) {
<add> assertEquals("one", v);
<add> latch.countDown();
<add> }
<add> });
<add>
<add> Subscription s = o.connect();
<add> try {
<add> if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
<add> fail("subscriptions did not receive values");
<add> }
<add> assertEquals(1, counter.get());
<add> } finally {
<add> s.unsubscribe();
<add> }
<add> }
<add>
<add> @Test
<add> public void testReplay() throws InterruptedException {
<add> final AtomicInteger counter = new AtomicInteger();
<add> ConnectableObservable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(final Observer<String> observer) {
<add> final BooleanSubscription subscription = new BooleanSubscription();
<add> new Thread(new Runnable() {
<add>
<add> @Override
<add> public void run() {
<add> counter.incrementAndGet();
<add> observer.onNext("one");
<add> observer.onCompleted();
<add> }
<add> }).start();
<add> return subscription;
<add> }
<add> }).replay();
<add>
<add> // we connect immediately and it will emit the value
<add> Subscription s = o.connect();
<add> try {
<add>
<add> // we then expect the following 2 subscriptions to get that same value
<add> final CountDownLatch latch = new CountDownLatch(2);
<add>
<add> // subscribe once
<add> o.subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String v) {
<add> assertEquals("one", v);
<add> latch.countDown();
<add> }
<add> });
<add>
<add> // subscribe again
<add> o.subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String v) {
<add> assertEquals("one", v);
<add> latch.countDown();
<add> }
<add> });
<add>
<add> if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
<add> fail("subscriptions did not receive values");
<add> }
<add> assertEquals(1, counter.get());
<add> } finally {
<add> s.unsubscribe();
<add> }
<add> }
<add>
<add> @Test
<add> public void testCache() throws InterruptedException {
<add> final AtomicInteger counter = new AtomicInteger();
<add> Observable<String> o = Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(final Observer<String> observer) {
<add> final BooleanSubscription subscription = new BooleanSubscription();
<add> new Thread(new Runnable() {
<add>
<add> @Override
<add> public void run() {
<add> counter.incrementAndGet();
<add> observer.onNext("one");
<add> observer.onCompleted();
<add> }
<add> }).start();
<add> return subscription;
<add> }
<add> }).cache();
<add>
<add> // we then expect the following 2 subscriptions to get that same value
<add> final CountDownLatch latch = new CountDownLatch(2);
<add>
<add> // subscribe once
<add> o.subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String v) {
<add> assertEquals("one", v);
<add> latch.countDown();
<add> }
<add> });
<add>
<add> // subscribe again
<add> o.subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String v) {
<add> assertEquals("one", v);
<add> latch.countDown();
<add> }
<add> });
<add>
<add> if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
<add> fail("subscriptions did not receive values");
<add> }
<add> assertEquals(1, counter.get());
<add> }
<add>
<add> /**
<add> * https://github.com/Netflix/RxJava/issues/198
<add> *
<add> * Rx Design Guidelines 5.2
<add> *
<add> * "when calling the Subscribe method that only has an onNext argument, the OnError behavior will be
<add> * to rethrow the exception on the thread that the message comes out from the Observable.
<add> * The OnCompleted behavior in this case is to do nothing."
<add> */
<add> @Test
<add> public void testErrorThrownWithoutErrorHandlerSynchronous() {
<add> try {
<add> Observable.error(new RuntimeException("failure")).subscribe(new Action1<Object>() {
<add>
<add> @Override
<add> public void call(Object t1) {
<add> // won't get anything
<add> }
<add>
<add> });
<add> fail("expected exception");
<add> } catch (Throwable e) {
<add> assertEquals("failure", e.getMessage());
<add> }
<add> }
<add>
<add> /**
<add> * https://github.com/Netflix/RxJava/issues/198
<add> *
<add> * Rx Design Guidelines 5.2
<add> *
<add> * "when calling the Subscribe method that only has an onNext argument, the OnError behavior will be
<add> * to rethrow the exception on the thread that the message comes out from the Observable.
<add> * The OnCompleted behavior in this case is to do nothing."
<add> *
<add> * @throws InterruptedException
<add> */
<add> @Test
<add> public void testErrorThrownWithoutErrorHandlerAsynchronous() throws InterruptedException {
<add> final CountDownLatch latch = new CountDownLatch(1);
<add> final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
<add> Observable.create(new Func1<Observer<String>, Subscription>() {
<add>
<add> @Override
<add> public Subscription call(final Observer<String> observer) {
<add> new Thread(new Runnable() {
<add>
<add> @Override
<add> public void run() {
<add> try {
<add> observer.onError(new Error("failure"));
<add> } catch (Throwable e) {
<add> // without an onError handler it has to just throw on whatever thread invokes it
<add> exception.set(e);
<add> }
<add> latch.countDown();
<add> }
<add> }).start();
<add> return Subscriptions.empty();
<add> }
<add> }).subscribe(new Action1<String>() {
<add>
<add> @Override
<add> public void call(String t1) {
<add>
<add> }
<add>
<add> });
<add> // wait for exception
<add> latch.await(3000, TimeUnit.MILLISECONDS);
<add> assertNotNull(exception.get());
<add> assertEquals("failure", exception.get().getMessage());
<add> }
<add>}
<ide>\ No newline at end of file
| 3
|
Text
|
Text
|
improve ar/changelog [ci skip]
|
0aaf87c1e17125af47b88db9d70bd6d9cc0b96ec
|
<ide><path>activerecord/CHANGELOG.md
<ide> self.primary_key = :title
<ide> end
<ide>
<del> Post.find_in_batches(:start => 'My First Post') do |batch|
<add> Post.find_in_batches(start: 'My First Post') do |batch|
<ide> batch.each { |post| post.author.greeting }
<ide> end
<ide>
<ide>
<ide> *Matt Jones*
<ide>
<del>* Accept belongs_to (including polymorphic) association keys in queries
<add>* Accept belongs_to (including polymorphic) association keys in queries.
<ide>
<ide> The following queries are now equivalent:
<ide>
<del> Post.where(:author => author)
<del> Post.where(:author_id => author)
<add> Post.where(author: author)
<add> Post.where(author_id: author)
<ide>
<del> PriceEstimate.where(:estimate_of => treasure)
<del> PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure)
<add> PriceEstimate.where(estimate_of: treasure)
<add> PriceEstimate.where(estimate_of_type: 'Treasure', estimate_of_id: treasure)
<ide>
<ide> *Peter Brown*
<ide>
<ide> *kennyj*
<ide>
<ide> * PostgreSQL inet and cidr types are converted to `IPAddr` objects.
<add>
<ide> *Dan McClain*
<ide>
<ide> * PostgreSQL array type support. Any datatype can be used to create an
<ide> To declare an array column, use the following syntax:
<ide>
<ide> create_table :table_with_arrays do |t|
<del> t.integer :int_array, :array => true
<add> t.integer :int_array, array: true
<ide> # integer[]
<del> t.integer :int_array, :array => true, :length => 2
<add> t.integer :int_array, array: true, :length => 2
<ide> # smallint[]
<del> t.string :string_array, :array => true, :length => 30
<add> t.string :string_array, array: true, length: 30
<ide> # char varying(30)[]
<del> end
<add> end
<ide>
<del> This respects any other migraion detail (limits, defaults, etc).
<add> This respects any other migration detail (limits, defaults, etc).
<ide> ActiveRecord will serialize and deserialize the array columns on
<ide> their way to and from the database.
<ide>
<ide> must have the same number of elements as its siblings).
<ide>
<ide> If the `pg_array_parser` gem is available, it will be used when
<del> parsing PostgreSQL's array representation
<add> parsing PostgreSQL's array representation.
<ide>
<ide> *Dan McClain*
<ide>
<ide> * Attribute predicate methods, such as `article.title?`, will now raise
<ide> `ActiveModel::MissingAttributeError` if the attribute being queried for
<del> truthiness was not read from the database, instead of just returning false.
<add> truthiness was not read from the database, instead of just returning `false`.
<ide>
<ide> *Ernie Miller*
<ide>
<ide>
<ide> *Konstantin Shabanov*
<ide>
<del>* Map interval with precision to string datatype in PostgreSQL. Fixes #7518. *Yves Senn*
<add>* Map interval with precision to string datatype in PostgreSQL. Fixes #7518.
<add>
<add> *Yves Senn*
<ide>
<del>* Fix eagerly loading associations without primary keys. Fixes #4976. *Kelley Reynolds*
<add>* Fix eagerly loading associations without primary keys. Fixes #4976.
<add>
<add> *Kelley Reynolds*
<ide>
<ide> * Rails now raise an exception when you're trying to run a migration that has an invalid
<ide> file name. Only lower case letters, numbers, and '_' are allowed in migration's file name.
<ide>
<ide> *Dickson S. Guedes*
<ide>
<del>* Fix time column type casting for invalid time string values to correctly return nil.
<add>* Fix time column type casting for invalid time string values to correctly return `nil`.
<ide>
<ide> *Adam Meehan*
<ide>
<del>* Allow to pass Symbol or Proc into :limit option of #accepts_nested_attributes_for.
<add>* Allow to pass Symbol or Proc into `:limit` option of #accepts_nested_attributes_for.
<ide>
<ide> *Mikhail Dieterle*
<ide>
<ide> * ActiveRecord::SessionStore has been extracted from Active Record as `activerecord-session_store`
<del> gem. Please read the `README.md` file on the gem for the usage. *Prem Sichanugrist*
<add> gem. Please read the `README.md` file on the gem for the usage.
<add>
<add> *Prem Sichanugrist*
<ide>
<ide> * Fix `reset_counters` when there are multiple `belongs_to` association with the
<ide> same foreign key and one of them have a counter cache.
<ide>
<ide> * Add `add_reference` and `remove_reference` schema statements. Aliases, `add_belongs_to`
<ide> and `remove_belongs_to` are acceptable. References are reversible.
<add>
<ide> Examples:
<ide>
<ide> # Create a user_id column
<ide> * `ActiveRecord::Relation#inspect` now makes it clear that you are
<ide> dealing with a `Relation` object rather than an array:.
<ide>
<del> User.where(:age => 30).inspect
<add> User.where(age: 30).inspect
<ide> # => <ActiveRecord::Relation [#<User ...>, #<User ...>, ...]>
<ide>
<del> User.where(:age => 30).to_a.inspect
<add> User.where(age: 30).to_a.inspect
<ide> # => [#<User ...>, #<User ...>]
<ide>
<ide> The number of records displayed will be limited to 10.
<ide>
<ide> *kennyj*
<ide>
<del>* Add uuid datatype support to PostgreSQL adapter. *Konstantin Shabanov*
<add>* Add uuid datatype support to PostgreSQL adapter.
<add>
<add> *Konstantin Shabanov*
<ide>
<ide> * Added `ActiveRecord::Migration.check_pending!` that raises an error if
<del> migrations are pending. *Richard Schneeman*
<add> migrations are pending.
<add>
<add> *Richard Schneeman*
<ide>
<ide> * Added `#destroy!` which acts like `#destroy` but will raise an
<ide> `ActiveRecord::RecordNotDestroyed` exception instead of returning `false`.
<ide> methods which previously accepted "finder options" no longer do. For
<ide> example this:
<ide>
<del> Post.find(:all, :conditions => { :comments_count => 10 }, :limit => 5)
<add> Post.find(:all, conditions: { comments_count: 10 }, limit: 5)
<ide>
<ide> Should be rewritten in the new style which has existed since Rails 3:
<ide>
<ide> Post.where(comments_count: 10).limit(5)
<ide>
<ide> Note that as an interim step, it is possible to rewrite the above as:
<ide>
<del> Post.all.merge(:where => { :comments_count => 10 }, :limit => 5)
<add> Post.all.merge(where: { comments_count: 10 }, limit: 5)
<ide>
<ide> This could save you a lot of work if there is a lot of old-style
<ide> finder usage in your application.
<ide> finder method. These are mostly identical to the old-style finder
<ide> option names, except in the following cases:
<ide>
<del> * `:conditions` becomes `:where`
<del> * `:include` becomes `:includes`
<del> * `:extend` becomes `:extending`
<add> * `:conditions` becomes `:where`.
<add> * `:include` becomes `:includes`.
<add> * `:extend` becomes `:extending`.
<ide>
<ide> The code to implement the deprecated features has been moved out to
<ide> the `activerecord-deprecated_finders` gem. This gem is a dependency
<ide>
<ide> *Johannes Barre*
<ide>
<del>* Added ability to ActiveRecord::Relation#from to accept other ActiveRecord::Relation objects
<add>* Added ability to ActiveRecord::Relation#from to accept other ActiveRecord::Relation objects.
<ide>
<ide> Record.from(subquery)
<ide> Record.from(subquery, :a)
<ide>
<ide> *Marcelo Silveira*
<ide>
<del>* Added an :index option to automatically create indexes for references
<add>* Added an `:index` option to automatically create indexes for references
<ide> and belongs_to statements in migrations.
<ide>
<ide> The `references` and `belongs_to` methods now support an `index`
<ide> option that receives either a boolean value or an options hash
<ide> that is identical to options available to the add_index method:
<ide>
<ide> create_table :messages do |t|
<del> t.references :person, :index => true
<add> t.references :person, index: true
<ide> end
<ide>
<ide> Is the same as:
<ide>
<ide> Generators have also been updated to use the new syntax.
<ide>
<del> [Joshua Wood]
<add> *Joshua Wood*
<ide>
<ide> * Added bang methods for mutating `ActiveRecord::Relation` objects.
<ide> For example, while `foo.where(:bar)` will return a new object
<ide>
<ide> *kennyj*
<ide>
<del>* Added support for partial indices to PostgreSQL adapter
<add>* Added support for partial indices to PostgreSQL adapter.
<ide>
<ide> The `add_index` method now supports a `where` option that receives a
<ide> string with the partial index criteria.
<ide>
<del> add_index(:accounts, :code, :where => "active")
<add> add_index(:accounts, :code, where: 'active')
<ide>
<ide> Generates
<ide>
<ide> CREATE INDEX index_accounts_on_code ON accounts(code) WHERE active
<ide>
<ide> *Marcelo Silveira*
<ide>
<del>* Implemented ActiveRecord::Relation#none method
<add>* Implemented ActiveRecord::Relation#none method.
<ide>
<ide> The `none` method returns a chainable relation with zero records
<ide> (an instance of the NullRelation class).
<ide> *Juanjo Bazán*
<ide>
<ide> * Added the `ActiveRecord::NullRelation` class implementing the null
<del> object pattern for the Relation class. *Juanjo Bazán*
<add> object pattern for the Relation class.
<ide>
<del>* Added new `:dependent => :restrict_with_error` option. This will add
<add> *Juanjo Bazán*
<add>
<add>* Added new `dependent: :restrict_with_error` option. This will add
<ide> an error to the model, rather than raising an exception.
<ide>
<ide> The `:restrict` option is renamed to `:restrict_with_exception` to
<ide> make this distinction explicit.
<ide>
<ide> *Manoj Kumar & Jon Leighton*
<ide>
<del>* Added `create_join_table` migration helper to create HABTM join tables
<add>* Added `create_join_table` migration helper to create HABTM join tables.
<ide>
<ide> create_join_table :products, :categories
<ide> # =>
<del> # create_table :categories_products, :id => false do |td|
<del> # td.integer :product_id, :null => false
<del> # td.integer :category_id, :null => false
<add> # create_table :categories_products, id: false do |td|
<add> # td.integer :product_id, null: false
<add> # td.integer :category_id, null: false
<ide> # end
<ide>
<ide> *Rafael Mendonça França*
<ide>
<del>* The primary key is always initialized in the @attributes hash to nil (unless
<add>* The primary key is always initialized in the @attributes hash to `nil` (unless
<ide> another value has been specified).
<ide>
<add> *Aaron Paterson*
<add>
<ide> * In previous releases, the following would generate a single query with
<ide> an `OUTER JOIN comments`, rather than two separate queries:
<ide>
<ide> loading. Basically, don't worry unless you see a deprecation warning
<ide> or (in future releases) an SQL error due to a missing JOIN.
<ide>
<del> [Jon Leighton]
<add> *Jon Leighton*
<ide>
<del>* Support for the `schema_info` table has been dropped. Please
<add>* Support for the `schema_info` table has been dropped. Please
<ide> switch to `schema_migrations`.
<ide>
<del>* Connections *must* be closed at the end of a thread. If not, your
<add> *Aaron Patterson*
<add>
<add>* Connections *must* be closed at the end of a thread. If not, your
<ide> connection pool can fill and an exception will be raised.
<ide>
<add> *Aaron Patterson*
<add>
<ide> * Added the `ActiveRecord::Model` module which can be included in a
<ide> class as an alternative to inheriting from `ActiveRecord::Base`:
<ide>
<ide>
<ide> * PostgreSQL hstore records can be created.
<ide>
<add> *Aaron Patterson*
<add>
<ide> * PostgreSQL hstore types are automatically deserialized from the database.
<ide>
<add> *Aaron Patterson*
<add>
<ide> Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/activerecord/CHANGELOG.md) for previous changes.
| 1
|
Javascript
|
Javascript
|
provide defaults for unmapped uv errors
|
c246f813f8b1bbc8f0e13ab77452da4dff437635
|
<ide><path>lib/internal/errors.js
<ide> function lazyUv() {
<ide> return uvBinding;
<ide> }
<ide>
<add>const uvUnmappedError = ['UNKNOWN', 'unknown error'];
<add>
<ide> function uvErrmapGet(name) {
<ide> uvBinding = lazyUv();
<ide> if (!uvBinding.errmap) {
<ide> function uvErrmapGet(name) {
<ide> * @returns {Error}
<ide> */
<ide> function uvException(ctx) {
<del> const [ code, uvmsg ] = uvErrmapGet(ctx.errno);
<add> const [ code, uvmsg ] = uvErrmapGet(ctx.errno) || uvUnmappedError;
<ide> let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`;
<ide>
<ide> let path;
<ide> function uvException(ctx) {
<ide> * @returns {Error}
<ide> */
<ide> function uvExceptionWithHostPort(err, syscall, address, port) {
<del> const [ code, uvmsg ] = uvErrmapGet(err);
<add> const [ code, uvmsg ] = uvErrmapGet(err) || uvUnmappedError;
<ide> const message = `${syscall} ${code}: ${uvmsg}`;
<ide> let details = '';
<ide>
<ide><path>test/parallel/test-uv-unmapped-exception.js
<add>// Flags: --expose-internals
<add>'use strict';
<add>require('../common');
<add>const assert = require('assert');
<add>const { uvException, uvExceptionWithHostPort } = require('internal/errors');
<add>
<add>{
<add> const exception = uvException({ errno: 100, syscall: 'open' });
<add>
<add> assert.strictEqual(exception.message, 'UNKNOWN: unknown error, open');
<add> assert.strictEqual(exception.errno, 100);
<add> assert.strictEqual(exception.syscall, 'open');
<add> assert.strictEqual(exception.code, 'UNKNOWN');
<add>}
<add>
<add>{
<add> const exception = uvExceptionWithHostPort(100, 'listen', '127.0.0.1', 80);
<add>
<add> assert.strictEqual(exception.message,
<add> 'listen UNKNOWN: unknown error 127.0.0.1:80');
<add> assert.strictEqual(exception.code, 'UNKNOWN');
<add> assert.strictEqual(exception.errno, 100);
<add> assert.strictEqual(exception.syscall, 'listen');
<add> assert.strictEqual(exception.address, '127.0.0.1');
<add> assert.strictEqual(exception.port, 80);
<add>}
| 2
|
Python
|
Python
|
fix building docs in `main` builds
|
16a17f731c25a079522ffa9a8ea6ebaa62bdd7b2
|
<ide><path>docs/build_docs.py
<ide> 'failed to reach any of the inventories with the following issues',
<ide> 'undefined label:',
<ide> 'unknown document:',
<add> 'Error loading airflow.providers',
<ide> ]
<ide>
<ide> ON_GITHUB_ACTIONS = os.environ.get('GITHUB_ACTIONS', 'false') == "true"
| 1
|
Python
|
Python
|
fix backend utf-8 encoding in s3 backend
|
42c866ff516c8f5589fcb7aa97781e2be466d36b
|
<ide><path>celery/backends/s3.py
<ide> def get(self, key):
<ide> s3_object = self._get_s3_object(key)
<ide> try:
<ide> s3_object.load()
<del> return s3_object.get()['Body'].read().decode('utf-8')
<add> data = s3_object.get()['Body'].read()
<add> return data if self.content_encoding == 'binary' else data.decode('utf-8')
<ide> except botocore.exceptions.ClientError as error:
<ide> if error.response['Error']['Code'] == "404":
<ide> return None
<ide><path>t/unit/backends/test_s3.py
<ide> def test_set_and_get_a_key(self, key):
<ide>
<ide> assert s3_backend.get(key) == 'another_status'
<ide>
<add> @mock_s3
<add> def test_set_and_get_a_result(self):
<add> self._mock_s3_resource()
<add>
<add> self.app.conf.result_serializer = 'pickle'
<add> self.app.conf.s3_access_key_id = 'somekeyid'
<add> self.app.conf.s3_secret_access_key = 'somesecret'
<add> self.app.conf.s3_bucket = 'bucket'
<add>
<add> s3_backend = S3Backend(app=self.app)
<add> s3_backend.store_result('foo', 'baar', 'STARTED')
<add> value = s3_backend.get_result('foo')
<add> assert value == 'baar'
<add>
<ide> @mock_s3
<ide> def test_get_a_missing_key(self):
<ide> self._mock_s3_resource()
| 2
|
Python
|
Python
|
update basic_binary_tree.py (#725)
|
2c67f6161ca4385d9728951f71c4d11fda2ef7df
|
<ide><path>binary_tree/basic_binary_tree.py
<del>class Node:
<add>class Node: # This is the Class Node with constructor that contains data variable to type data and left,right pointers.
<ide> def __init__(self, data):
<ide> self.data = data
<ide> self.left = None
<ide> self.right = None
<ide>
<ide>
<del>def depth_of_tree(tree):
<add>def depth_of_tree(tree): #This is the recursive function to find the depth of binary tree.
<ide> if tree is None:
<ide> return 0
<ide> else:
<ide> def depth_of_tree(tree):
<ide> return 1 + depth_r_tree
<ide>
<ide>
<del>def is_full_binary_tree(tree):
<add>def is_full_binary_tree(tree): # This functions returns that is it full binary tree or not?
<ide> if tree is None:
<ide> return True
<ide> if (tree.left is None) and (tree.right is None):
<ide> def is_full_binary_tree(tree):
<ide> return False
<ide>
<ide>
<del>def main():
<add>def main(): # Main func for testing.
<ide> tree = Node(1)
<ide> tree.left = Node(2)
<ide> tree.right = Node(3)
| 1
|
PHP
|
PHP
|
fix failing tests
|
3d0920a40581f397ae6c6640f79c596e4753bf94
|
<ide><path>lib/Cake/Test/Case/Error/ErrorHandlerTest.php
<ide> public function testLoadPluginHandler() {
<ide> /**
<ide> * test handleFatalError generating a page.
<ide> *
<add> * These tests start two buffers as handleFatalError blows the outer one up.
<add> *
<ide> * @return void
<ide> */
<ide> public function testHandleFatalErrorPage() {
<ide> $this->skipIf(file_exists(APP . 'app_error.php'), 'App error exists cannot run.');
<ide>
<del> $originalDebugLevel = Configure::read('debug');
<ide> $line = __LINE__;
<ide>
<add> ob_start();
<ide> ob_start();
<ide> Configure::write('debug', 1);
<ide> ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, $line);
<ide> public function testHandleFatalErrorPage() {
<ide> $this->assertContains(__FILE__, $result, 'filename missing.');
<ide> $this->assertContains((string)$line, $result, 'line missing.');
<ide>
<add> ob_start();
<ide> ob_start();
<ide> Configure::write('debug', 0);
<ide> ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, $line);
<ide> $result = ob_get_clean();
<ide> $this->assertNotContains('Something wrong', $result, 'message must not appear.');
<ide> $this->assertNotContains(__FILE__, $result, 'filename must not appear.');
<ide> $this->assertContains('An Internal Error Has Occurred', $result);
<del>
<del> Configure::write('debug', $originalDebugLevel);
<ide> }
<ide>
<ide> /**
| 1
|
Ruby
|
Ruby
|
use literal values in assertions
|
d2890f76d49542ab853bfcbe5f1c4c6924231591
|
<ide><path>activesupport/test/json/encoding_test.rb
<ide> def test_exception_to_json
<ide>
<ide> class InfiniteNumber
<ide> def as_json(options = nil)
<del> { "number" => 1.0 / 0 }
<add> { "number" => Float::INFINITY }
<ide> end
<ide> end
<ide>
<ide> def test_to_json_works_when_as_json_returns_infinite_number
<del> expected = { number: nil }.to_json
<del> assert_equal expected, InfiniteNumber.new.to_json
<add> assert_equal '{"number":null}', InfiniteNumber.new.to_json
<ide> end
<ide>
<ide> class NaNNumber
<ide> def as_json(options = nil)
<del> { "number" => 0.0 / 0 }
<add> { "number" => Float::INFINITY }
<ide> end
<ide> end
<ide>
<ide> def test_to_json_works_when_as_json_returns_NaN_number
<del> expected = { number: nil }.to_json
<del> assert_equal expected, NaNNumber.new.to_json
<add> assert_equal '{"number":null}', NaNNumber.new.to_json
<ide> end
<ide>
<ide> protected
| 1
|
Go
|
Go
|
remove deprecated test helpers
|
da514223d1e441e2bab82bf3b30e1a1e0e222ac6
|
<ide><path>graphdriver/devmapper/devmapper.go
<ide> var (
<ide> ErrTaskAddTarget = errors.New("dm_task_add_target failed")
<ide> ErrTaskSetSector = errors.New("dm_task_set_sector failed")
<ide> ErrTaskGetInfo = errors.New("dm_task_get_info failed")
<del> ErrTaskGetDriverVersion = errors.New("dm_task_get_driver_version failed")
<ide> ErrTaskSetCookie = errors.New("dm_task_set_cookie failed")
<ide> ErrNilCookie = errors.New("cookie ptr can't be nil")
<ide> ErrAttachLoopbackDevice = errors.New("loopback mounting failed")
<ide><path>graphdriver/devmapper/devmapper_test.go
<ide> func dmTaskAddTargetFail(task *CDmTask,
<ide> return -1
<ide> }
<ide>
<del>func dmTaskGetDriverVersionFail(task *CDmTask, version *string) int {
<del> return -1
<del>}
<del>
<ide> func dmTaskGetInfoFail(task *CDmTask, info *Info) int {
<ide> return -1
<ide> }
<ide> func sysGetBlockSizeFail(fd uintptr, size *uint64) sysErrno {
<ide> return 1
<ide> }
<ide>
<del>func dmGetBlockSizeFail(fd uintptr) int64 {
<del> return -1
<del>}
<del>
<ide> func dmUdevWaitFail(cookie uint) int {
<ide> return -1
<ide> }
| 2
|
Text
|
Text
|
add react amsterdam 2017
|
ccf6f5922ed1b12ce5409180bf4adc0b056e0de9
|
<ide><path>docs/community/conferences.md
<ide> May 18th & 19th in Paris, France
<ide>
<ide> [Website](http://www.react-europe.org/) - [Schedule](http://www.react-europe.org/#schedule)
<ide>
<add>### React Amsterdam 2017
<add>April 21st in Amsterdam, The Netherlands
<add>
<add>[Website](https://react.amsterdam) - [Twitter](https://twitter.com/reactamsterdam)
<add>
<ide> ### Chain React 2017
<ide> Summer 2017, Portland, Oregon USA
<ide>
<ide> February 22 & 23 in San Francisco, CA
<ide> ### React Amsterdam 2016
<ide> April 16 in Amsterdam, The Netherlands
<ide>
<del>[Website](http://react.amsterdam) - [Videos](https://youtu.be/sXDZBxbRRag?list=PLNBNS7NRGKMG3uLrm5fgY02hJ87Wzb4IU)
<add>[Website](https://react.amsterdam/2016) - [Videos](https://youtu.be/sXDZBxbRRag?list=PLNBNS7NRGKMG3uLrm5fgY02hJ87Wzb4IU)
<ide>
<ide> ### ReactEurope 2016
<ide> June 2 & 3 in Paris, France
| 1
|
Javascript
|
Javascript
|
add default require directives for jquery
|
9333ca74b37c6c24262783daf118984621ace69e
|
<ide><path>railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js
<ide> // Place your application-specific JavaScript functions and classes here
<ide> // FIXME: Tell people how Sprockets and Coffe works
<add>//
<add>//= require jquery
<add>//= require jquery_ujs
<add>//= require_tree .
| 1
|
Ruby
|
Ruby
|
add methods in formulacop to find block nodes
|
134da5b8c266d0e5f07a1f79bff233f372c7ef30
|
<ide><path>Library/Homebrew/rubocops/extend/formula_cop.rb
<ide> def find_block(node, block_name)
<ide> nil
<ide> end
<ide>
<del> # Returns an array of block nodes named block_name inside node
<add> # Returns an array of block nodes of depth first order named block_name below node
<ide> def find_blocks(node, block_name)
<ide> return if node.nil?
<ide> node.each_child_node(:block).select { |block_node| block_name == block_node.method_name }
<ide> end
<ide>
<add> # Returns an array of block nodes of any depth below node in AST
<add> def find_all_blocks(node, block_name)
<add> return if node.nil?
<add> node.each_descendant(:block).select { |block_node| block_name == block_node.method_name}
<add> end
<add>
<ide> # Returns a method definition node with method_name
<ide> def find_method_def(node, method_name)
<ide> return if node.nil?
<ide> def caveats_strings
<ide>
<ide> # Returns the array of arguments of the method_node
<ide> def parameters(method_node)
<del> return unless method_node.send_type?
<add> return unless method_node.send_type? || method_node.block_type?
<ide> method_node.method_args
<ide> end
<ide>
| 1
|
Javascript
|
Javascript
|
fix negative index cases for range and take/skip
|
c1ce0735538bf8db04792ea78accaf16c2a6d343
|
<ide><path>dist/Immutable.js
<ide> var $IndexedSequence = IndexedSequence;
<ide> if (skipSeq !== seq) {
<ide> skipSeq.get = function(index, notSetValue) {
<ide> index = wrapIndex(this, index);
<del> return index < 0 ? notSetValue : seq.get(index + amount, notSetValue);
<add> return index >= 0 ? seq.get(index + amount, notSetValue) : notSetValue;
<ide> };
<ide> }
<ide> return skipSeq;
<ide> var $IndexedSequence = IndexedSequence;
<ide> if (takeSeq !== seq) {
<ide> takeSeq.get = function(index, notSetValue) {
<ide> index = wrapIndex(this, index);
<del> return index < amount ? seq.get(index, notSetValue) : notSetValue;
<add> return index >= 0 && index < amount ? seq.get(index, notSetValue) : notSetValue;
<ide> };
<ide> }
<ide> return takeSeq;
<ide> var $Range = Range;
<ide> return 'Range [ ' + this._start + '...' + this._end + (this._step > 1 ? ' by ' + this._step : '') + ' ]';
<ide> },
<ide> get: function(index, notSetValue) {
<del> index = wrapIndex(this, index);
<del> return this.has(index) ? this._start + index * this._step : notSetValue;
<add> return this.has(index) ? this._start + wrapIndex(this, index) * this._step : notSetValue;
<ide> },
<ide> contains: function(searchValue) {
<ide> var possibleIndex = (searchValue - this._start) / this._step;
<ide><path>dist/Immutable.min.js
<ide> if(i)return this.cacheResult().__iterator(n,i);var a=t.__iterator(Ye,i),s=!0;ret
<ide> return t.__ownerID?(t.length=o.length,t._map=o,t._vector=h,t.__hash=void 0,t):xe(o,h)}function De(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Me(t,e){return e?Oe(e,t,"",{"":t}):Ce(t)}function Oe(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,rr(e).map(function(r,n){return Oe(t,r,n,e)})):e}function Ce(t){if(t){if(Array.isArray(t))return rr(t).map(Ce).toVector();if(t.constructor===Object)return rr(t).map(Ce).toMap()}return t}var Ae=Object,Ee={};Ee.createClass=t,Ee.superCall=e,Ee.defaultSuperCall=r;var je="delete",Re=5,Ue=1<<Re,Pe=Ue-1,We={},Ke={value:!1},ze={value:!1},Je=Object.prototype.propertyIsEnumerable,Be=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),Le=2147483647,Ve=0,Ne="__immutablehash__";"undefined"!=typeof Symbol&&(Ne=Symbol(Ne));var Te=16,Fe=255,Ge=0,He={},Qe=0,Xe=1,Ye=2,Ze="@@iterator",$e="undefined"!=typeof Symbol?Symbol.iterator:Ze,tr=function(t){this.next=t};Ee.createClass(tr,{toString:function(){return"[Iterator]"}},{});var er=tr.prototype;er.inspect=er.toSource=function(){return""+this},er[$e]=function(){return this};var rr=function(t){return nr.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},nr=rr;Ee.createClass(rr,{toArray:function(){A(this.length);var t=Array(this.length||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toJS:function(){return this.map(function(t){return t instanceof nr?t.toJS():t}).__toJS()},toMap:function(){return A(this.length),pr.from(this)},toObject:function(){A(this.length);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return A(this.length),Fr.from(this)},toSet:function(){return A(this.length),Lr.from(this)},toVector:function(){return A(this.length),Ar.from(this)},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+": "+M(t)},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];
<ide> return V(this,t,!0)},contains:function(t){return this.find(function(e){return Q(e,t)},null,We)!==We},entries:function(){return this.__iterator(Ye)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},filter:function(t,e){return W(this,t,e,!0)},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!=n?n:""}),e},keys:function(){return this.__iterator(Qe)},map:function(t,e){return U(this,t,e)},reduce:function(t,e,r){var n,i;return 2>arguments.length?i=!0:n=e,this.__iterate(function(e,u,a){i?(i=!1,n=e):n=t.call(r,n,e,u,a)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},reverse:function(){return P(this)},slice:function(t,e){if(w(t,e,this.length))return this;var r=S(t,this.length),n=I(e,this.length);if(r!==r||n!==n)return this.cacheResult().slice(t,e);var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},some:function(t,e){return!this.every(D(t),e)},sort:function(t){return this.sortBy(q,t)},values:function(){return this.__iterator(Xe)},butLast:function(){return this.slice(0,-1)},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.__iterate(k)),this.length)},countBy:function(t,e){var r=this,n={},i=[];return this.__iterate(function(u,a){var s=t.call(e,u,a,r),h=o(s);n.hasOwnProperty(h)?i[n[h]][1]++:(n[h]=i.length,i.push([s,1]))}),nr(i).fromEntrySeq()},equals:function(t){if(this===t)return!0;if(!(t instanceof nr))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 null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,r){var n=e.next().value;return n&&Q(n[0],r)&&Q(n[1],t)
<ide> })&&e.next().done},entrySeq:function(){var t=this;if(t._cache)return nr(t._cache);var e=t.toKeyedSeq().map(x).valueSeq();return e.fromEntries=function(){return t},e},findKey:function(t,e){var r;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(k)},flatMap:function(t,e){return this.map(t,e).flatten()},flatten:function(){return N(this,!0)},flip:function(){return R(this)},get:function(t,e){return this.find(function(e,r){return Q(r,t)},null,e)},getIn:function(t,e){var r=this;if(t)for(var n=0;t.length>n;n++)if(r=r&&r.get?r.get(t[n],We):We,r===We)return e;return r},groupBy:function(t,e){return K(this,t,e,!0)},has:function(t){return this.get(t,We)!==We},keySeq:function(){return this.flip().valueSeq()},last:function(){return this.findLast(k)},mapEntries:function(t,e){var r=this;return this.entrySeq().map(function(n,i){return t.call(e,n,i,r)}).fromEntrySeq()},mapKeys:function(t,e){var r=this;return this.flip().map(function(n,i){return t.call(e,n,i,r)}).flip()},rest:function(){return this.slice(1)},skip:function(t){return B(this,t,!0)},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){return L(this,t,e,!0)},skipUntil:function(t,e){return this.skipWhile(D(t),e)},sortBy:function(t,e){e=e||O;var r=this;return nr(this.entrySeq().entrySeq().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]})).fromEntrySeq().valueSeq().fromEntrySeq()},take:function(t){return z(this,t)},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){return J(this,t,e)},takeUntil:function(t,e){return this.takeWhile(D(t),e)},toKeyedSeq:function(){return this},valueSeq:function(){return new _r(this)},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(A(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this
<del>},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(o(e)^(e===r?0:o(r)))&Le},0))},__makeSequence:function(){return Object.create(ir)},__iterate:function(t,e){return E(this,t,e,!0)},__iterator:function(t,e){return j(this,t,e,!0)}},{from:function(t){if(t instanceof nr)return t;if(!Array.isArray(t)){if(p(t))return new or(t);if(g(t))return new hr(t);if(t&&t.constructor===Object)return new cr(t);t=[t]}return new fr(t)}});var ir=rr.prototype;ir[$e]=ir.entries,ir.toJSON=ir.toJS,ir.__toJS=ir.toObject,ir.inspect=ir.toSource=function(){return""+this},ir.chain=ir.flatMap;var ur=function(){Ee.defaultSuperCall(this,ar.prototype,arguments)},ar=ur;Ee.createClass(ur,{toString:function(){return this.__toString("Seq [","]")},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return V(this,t,!1)},filter:function(t,e){return W(this,t,e,!1)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},indexOf:function(t){return this.findIndex(function(e){return Q(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=S(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(a(arguments,2),this.slice(t+e))},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},first:function(){return this.get(0)},flatten:function(){return N(this,!1)},flip:function(){return R(this.toKeyedSeq())},fromEntrySeq:function(){return new vr(this)},get:function(t,e){return t=C(this,t),0>t||1/0===this.length||null!=this.length&&t>this.length?e:this.find(function(e,r){return r===t},null,e)},groupBy:function(t,e){return K(this,t,e,!1)},has:function(t){return t=C(this,t),t>=0&&(null!=this.length?1/0===this.length||this.length>t:-1!==this.indexOf(t))},interpose:function(t){return T(this,t)},last:function(){return this.get(this.length?this.length-1:0)},skip:function(t){var e=this,r=B(e,t,!1);return r!==e&&(r.get=function(r,n){return r=C(this,r),0>r?n:e.get(r+t,n)
<del>}),r},skipWhile:function(t,e){return L(this,t,e,!1)},sortBy:function(t,e){e=e||O;var r=this;return rr(this.entrySeq().toArray().sort(function(n,i){return e(t(n[1],n[0],r),t(i[1],i[0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq()},take:function(t){var e=this,r=z(e,t);return r!==e&&(r.get=function(r,n){return r=C(this,r),t>r?e.get(r,n):n}),r},toKeyedSeq:function(){return new lr(this)},valueSeq:function(){return this},__makeSequence:function(){return Object.create(sr)},__iterate:function(t,e){return E(this,t,e,!1)},__iterator:function(t,e){return j(this,t,e,!1)}},{},rr);var sr=ur.prototype;sr[$e]=sr.values,sr.__toJS=sr.toArray,sr.__toStringMapper=M;var or=function(t){this._iterator=t,this._iteratorCache=[]};Ee.createClass(or,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var a=u.value;if(n[i]=a,t(a,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new tr(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return l(t,i,n[i++])})}},{},ur);var hr=function(t){this._iterable=t,this.length=t.length||t.size};Ee.createClass(hr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=m(r),i=0;if(p(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=m(r);if(!p(n))return new tr(function(){return v()});var i=0;return new tr(function(){var e=n.next();return e.done?e:l(t,i++,e.value)})}},{},ur);var cr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};Ee.createClass(cr,{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 a=n[e?i-u:u];
<add>},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(o(e)^(e===r?0:o(r)))&Le},0))},__makeSequence:function(){return Object.create(ir)},__iterate:function(t,e){return E(this,t,e,!0)},__iterator:function(t,e){return j(this,t,e,!0)}},{from:function(t){if(t instanceof nr)return t;if(!Array.isArray(t)){if(p(t))return new or(t);if(g(t))return new hr(t);if(t&&t.constructor===Object)return new cr(t);t=[t]}return new fr(t)}});var ir=rr.prototype;ir[$e]=ir.entries,ir.toJSON=ir.toJS,ir.__toJS=ir.toObject,ir.inspect=ir.toSource=function(){return""+this},ir.chain=ir.flatMap;var ur=function(){Ee.defaultSuperCall(this,ar.prototype,arguments)},ar=ur;Ee.createClass(ur,{toString:function(){return this.__toString("Seq [","]")},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return V(this,t,!1)},filter:function(t,e){return W(this,t,e,!1)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},indexOf:function(t){return this.findIndex(function(e){return Q(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=S(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(a(arguments,2),this.slice(t+e))},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},first:function(){return this.get(0)},flatten:function(){return N(this,!1)},flip:function(){return R(this.toKeyedSeq())},fromEntrySeq:function(){return new vr(this)},get:function(t,e){return t=C(this,t),0>t||1/0===this.length||null!=this.length&&t>this.length?e:this.find(function(e,r){return r===t},null,e)},groupBy:function(t,e){return K(this,t,e,!1)},has:function(t){return t=C(this,t),t>=0&&(null!=this.length?1/0===this.length||this.length>t:-1!==this.indexOf(t))},interpose:function(t){return T(this,t)},last:function(){return this.get(this.length?this.length-1:0)},skip:function(t){var e=this,r=B(e,t,!1);return r!==e&&(r.get=function(r,n){return r=C(this,r),r>=0?e.get(r+t,n):n
<add>}),r},skipWhile:function(t,e){return L(this,t,e,!1)},sortBy:function(t,e){e=e||O;var r=this;return rr(this.entrySeq().toArray().sort(function(n,i){return e(t(n[1],n[0],r),t(i[1],i[0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq()},take:function(t){var e=this,r=z(e,t);return r!==e&&(r.get=function(r,n){return r=C(this,r),r>=0&&t>r?e.get(r,n):n}),r},toKeyedSeq:function(){return new lr(this)},valueSeq:function(){return this},__makeSequence:function(){return Object.create(sr)},__iterate:function(t,e){return E(this,t,e,!1)},__iterator:function(t,e){return j(this,t,e,!1)}},{},rr);var sr=ur.prototype;sr[$e]=sr.values,sr.__toJS=sr.toArray,sr.__toStringMapper=M;var or=function(t){this._iterator=t,this._iteratorCache=[]};Ee.createClass(or,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var a=u.value;if(n[i]=a,t(a,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new tr(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return l(t,i,n[i++])})}},{},ur);var hr=function(t){this._iterable=t,this.length=t.length||t.size};Ee.createClass(hr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=m(r),i=0;if(p(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=m(r);if(!p(n))return new tr(function(){return v()});var i=0;return new tr(function(){var e=n.next();return e.done?e:l(t,i++,e.value)})}},{},ur);var cr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};Ee.createClass(cr,{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 a=n[e?i-u:u];
<ide> if(t(r[a],a,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new tr(function(){var a=n[e?i-u:u];return u++>i?v():l(t,a,r[a])})}},{},rr);var fr=function(t){this._array=t,this.length=t.length};Ee.createClass(fr,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[C(this,t)]:e},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new tr(function(){return i>n?v():l(t,i,r[e?n-i++:i++])})}},{},ur);var _r=function(t){this._seq=t,this.length=t.length};Ee.createClass(_r,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=0;return this._seq.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(Xe,e),n=0;return new tr(function(){var e=r.next();return e.done?e:l(t,n++,e.value,e)})}},{},ur);var lr=function(t){this._seq=t,this.length=t.length};Ee.createClass(lr,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},valueSeq:function(){return this._seq},reverse:function(){var t=this,e=P(this);return e.valueSeq=function(){return t._seq.reverse()},e},map:function(t,e){var r=this,n=U(this,t,e);return n.valueSeq=function(){return r._seq.map(t,e)},n},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=e?y(this):0;return this._seq.__iterate(function(i){return t(i,e?--n:n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(Xe,e),n=e?y(this):0;return new tr(function(){var i=r.next();return i.done?i:l(t,e?--n:n++,i.value,i)})}},{},rr);var vr=function(t){this._seq=t,this.length=t.length};Ee.createClass(vr,{entrySeq:function(){return this._seq},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this
<ide> },__iterate:function(t,e){var r=this;return this._seq.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(Xe,e);return new tr(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return t===Ye?e:l(t,n[0],n[1],e)}})}},{},rr);var gr=function(t,e,r,n){n=n?n:t.getIn(e),this.length=n instanceof rr?n.length:null,this._rootData=t,this._keyPath=e,this._onChange=r};Ee.createClass(gr,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var r=this._rootData.getIn(this._keyPath.concat(t),We);return r===We?e:F(this,t,r)},set:function(t,e){return H(this,function(r){return r.set(t,e)},t)},remove:function(t){return H(this,function(e){return e.remove(t)},t)},clear:function(){return H(this,function(t){return t.clear()})},update:function(t,e,r){return 1===arguments.length?H(this,t):H(this,function(n){return n.update(t,e,r)},t)},withMutations:function(t){return H(this,function(e){return(e||pr.empty()).withMutations(t)})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:G(this,t)},__iterate:function(t,e){var r=this,n=this.deref();return n&&n.__iterate?n.__iterate(function(e,n){return t(F(r,n,e),n,r)},e):0},__iterator:function(t,e){var r=this,n=this.deref(),i=n&&n.__iterator&&n.__iterator(Ye,e);return new tr(function(){if(!i)return v();var e=i.next();if(e.done)return e;var n=e.value,u=n[0],a=n[1];return l(t,u,F(r,u,a),e)})}},{},rr),gr.prototype[je]=gr.prototype.remove,gr.prototype.getIn=gr.prototype.get;var pr=function(t){var e=mr.empty();return t?t.constructor===mr?t:e.merge(t):e},mr=pr;Ee.createClass(pr,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,o(t),t,e):e},set:function(t,e){return $(this,t,e)},remove:function(t){return $(this,t,We)},update:function(t,e,r){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,r)},updateIn:function(t,e,r){var n;return r||(n=[e,r],r=n[0],e=n[1],n),oe(this,t,e,r,0)
<ide> },clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):mr.empty()},merge:function(){return ue(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ue(this,t,e)},mergeDeep:function(){return ue(this,ae(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ue(this,ae(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new gr(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new Dr(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?Z(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return Mr||(Mr=Z(0))}},rr);var dr=pr.prototype;dr[je]=dr.remove,pr.from=pr;var yr=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},wr=yr;Ee.createClass(yr,{get:function(t,e,r,n){var i=1<<((0===t?e:e>>>t)&Pe),u=this.bitmap;return 0===(u&i)?n:this.nodes[he(u&i-1)].get(t+Re,e,r,n)},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Pe,o=1<<s,h=this.bitmap,c=0!==(h&o);if(!c&&i===We)return this;var f=he(h&o-1),_=this.nodes,l=c?_[f]:null,v=te(l,t,e+Re,r,n,i,u,a);if(v===l)return this;if(!c&&v&&_.length>=Or)return ie(t,_,h,s,v);if(c&&!v&&2===_.length&&ee(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&ee(v))return v;var g=t&&t===this.ownerID,p=c?v?h:h^o:h|o,m=c?v?ce(_,f,v,g):_e(_,f,g):fe(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new wr(t,p,m)},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
<ide> if(t(r[a],a,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this.
<ide> }else t=this._stack=this._stack.__prev}return v()}},{},tr);var Wr,Kr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return zr.from(t)},zr=Kr;Ee.createClass(Kr,{toString:function(){return this.__toString("Stack [","]")},get:function(t,e){for(var r=this._head;r&&t--;)r=r.next;return r?r.value:e},peek:function(){return this._head&&this._head.value},unshift:function(){if(0===arguments.length)return this;for(var t=this.length+arguments.length,e=this._head,r=arguments.length-1;r>=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.length=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):be(t,e)},unshiftAll:function(t){if(t=rr(t),0===t.length)return this;var e=this.length,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.length=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):be(e,r)},shift:function(){return this.slice(1)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):zr.empty()},slice:function(t,e){if(w(t,e,this.length))return this;var r=S(t,this.length),n=I(e,this.length);if(n!==this.length)return Ee.superCall(this,zr.prototype,"slice",[t,e]);for(var i=this.length-r,u=this._head;r--;)u=u.next;return this.__ownerID?(this.length=i,this._head=u,this.__hash=void 0,this.__altered=!0,this):be(i,u)},__ensureOwner:function(t){return t===this.__ownerID?this:t?be(this.length,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=0,n=this._head;return new tr(function(){if(n){var e=n.value;return n=n.next,l(t,r++,e)}return v()})}},{empty:function(){return Br||(Br=be(0))},from:function(t){var e=zr.empty();return t?t.constructor===zr?t:e.unshiftAll(t):e}},ur);var Jr=Kr.prototype;Jr.push=Jr.unshift,Jr.pop=Jr.shift,Jr.withMutations=dr.withMutations,Jr.asMutable=dr.asMutable,Jr.asImmutable=dr.asImmutable,Jr.wasAltered=dr.wasAltered;
<ide> var Br,Lr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Vr.from(t)},Vr=Lr;Ee.createClass(Lr,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:qe(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?Vr.empty():qe(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):Vr.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++)rr(t[r]).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 rr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(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 rr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},isSubset:function(t){return t=rr(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=rr(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?qe(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Tr||(Tr=qe(pr.empty()))},from:function(t){var e=Vr.empty();
<ide> return t?t.constructor===Vr?t:e.union(t):e},fromKeys:function(t){return Vr.from(rr(t).flip())}},rr);var Nr=Lr.prototype;Nr[je]=Nr.remove,Nr[$e]=Nr.values,Nr.contains=Nr.has,Nr.mergeDeep=Nr.merge=Nr.union,Nr.mergeDeepWith=Nr.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.merge.apply(this,t)},Nr.withMutations=dr.withMutations,Nr.asMutable=dr.asMutable,Nr.asImmutable=dr.asImmutable,Nr.__toJS=sr.__toJS,Nr.__toStringMapper=sr.__toStringMapper;var Tr,Fr=function(t){var e=Gr.empty();return t?t.constructor===Gr?t:e.merge(t):e},Gr=Fr;Ee.createClass(Fr,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var r=this._map.get(t);return null!=r?this._vector.get(r)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):Gr.empty()},set:function(t,e){return ke(this,t,e)},remove:function(t){return ke(this,t,We)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},__iterate:function(t,e){var r=this;return this._vector.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){return this._vector.fromEntrySeq().__iterator(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._vector.__ensureOwner(t);return t?xe(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return Hr||(Hr=xe(pr.empty(),Ar.empty()))}},pr),Fr.from=Fr,Fr.prototype[je]=Fr.prototype.remove;var Hr,Qr=function(t,e){var r=function(t){return this instanceof r?void(this._map=pr(t)):new r(t)},n=Object.keys(t),i=r.prototype=Object.create(Yr);i.constructor=r,e&&(i._name=e),i._defaultValues=t,i._keys=n,i.length=n.length;try{rr(t).forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){s(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})})}catch(u){}return r},Xr=Qr;Ee.createClass(Qr,{toString:function(){return this.__toString(this._name+" {","}")
<del>},has:function(t){return this._defaultValues.hasOwnProperty(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues[t]):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return Xr._empty||(Xr._empty=De(this,pr.empty()))},set:function(t,e){if(!this.has(t))throw Error('Cannot set unknown key "'+t+'" on '+this._name);var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:De(this,r)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:De(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){return this._map.__iterator(t,e)},__iterate:function(t,e){var r=this;return rr(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?De(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},rr);var Yr=Qr.prototype;Yr._name="Record",Yr[je]=Yr.remove,Yr.merge=dr.merge,Yr.mergeWith=dr.mergeWith,Yr.mergeDeep=dr.mergeDeep,Yr.mergeDeepWith=dr.mergeDeepWith,Yr.update=dr.update,Yr.updateIn=dr.updateIn,Yr.cursor=dr.cursor,Yr.withMutations=dr.withMutations,Yr.asMutable=dr.asMutable,Yr.asImmutable=dr.asImmutable;var Zr=function(t,e,r){return this instanceof $r?(s(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&en?en:(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 $r(t,e,r)},$r=Zr;Ee.createClass(Zr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return t=C(this,t),this.has(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)
<add>},has:function(t){return this._defaultValues.hasOwnProperty(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues[t]):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return Xr._empty||(Xr._empty=De(this,pr.empty()))},set:function(t,e){if(!this.has(t))throw Error('Cannot set unknown key "'+t+'" on '+this._name);var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:De(this,r)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:De(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){return this._map.__iterator(t,e)},__iterate:function(t,e){var r=this;return rr(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?De(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},rr);var Yr=Qr.prototype;Yr._name="Record",Yr[je]=Yr.remove,Yr.merge=dr.merge,Yr.mergeWith=dr.mergeWith,Yr.mergeDeep=dr.mergeDeep,Yr.mergeDeepWith=dr.mergeDeepWith,Yr.update=dr.update,Yr.updateIn=dr.updateIn,Yr.cursor=dr.cursor,Yr.withMutations=dr.withMutations,Yr.asMutable=dr.asMutable,Yr.asImmutable=dr.asImmutable;var Zr=function(t,e,r){return this instanceof $r?(s(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&en?en:(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 $r(t,e,r)},$r=Zr;Ee.createClass(Zr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return this.has(t)?this._start+C(this,t)*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)
<ide> },slice:function(t,e){return w(t,e,this.length)?this:(t=S(t,this.length),e=I(e,this.length),t>=e?en:new $r(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,Math.max(0,t))},skip:function(t){return this.slice(Math.max(0,t))},__iterate:function(t,e){for(var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new tr(function(){var a=i;return i+=e?-n:n,u>r?v():l(t,u++,a)})},__deepEquals:function(t){return t instanceof $r?this._start===t._start&&this._end===t._end&&this._step===t._step:Ee.superCall(this,$r.prototype,"__deepEquals",[t])}},{},ur);var tn=Zr.prototype;tn.__toJS=tn.toArray,tn.first=jr.first,tn.last=jr.last;var en=Zr(0,0),rn=function(t,e){return 0===e&&an?an:this instanceof nn?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new nn(t,e)},nn=rn;Ee.createClass(rn,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return Q(this._value,t)},slice:function(t,e){var r=this.length;return t=0>t?Math.max(0,r+t):Math.min(r,t),e=null==e?r:e>0?Math.min(r,e):Math.max(0,r+e),e>t?new nn(this._value,e-t):an},reverse:function(){return this},indexOf:function(t){return Q(this._value,t)?0:-1},lastIndexOf:function(t){return Q(this._value,t)?this.length:-1},__iterate:function(t){for(var e=0;this.length>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new tr(function(){return e.length>r?l(t,r++,e._value):v()})},__deepEquals:function(t){return t instanceof nn?Q(this._value,t._value):Ee.superCall(this,nn.prototype,"__deepEquals",[t])}},{},ur);var un=rn.prototype;
<ide> un.last=un.first,un.has=tn.has,un.take=tn.take,un.skip=tn.skip,un.__toJS=tn.__toJS;var an=new rn(void 0,0),sn={Sequence:rr,Map:pr,Vector:Ar,Stack:Kr,Set:Lr,OrderedMap:Fr,Record:Qr,Range:Zr,Repeat:rn,is:Q,fromJS:Me};return sn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
<ide>\ No newline at end of file
<ide><path>src/Range.js
<ide> class Range extends IndexedSequence {
<ide> }
<ide>
<ide> get(index, notSetValue) {
<del> index = wrapIndex(this, index);
<ide> return this.has(index) ?
<del> this._start + index * this._step :
<add> this._start + wrapIndex(this, index) * this._step :
<ide> notSetValue;
<ide> }
<ide>
<ide><path>src/Sequence.js
<ide> class IndexedSequence extends Sequence {
<ide> if (skipSeq !== seq) {
<ide> skipSeq.get = function (index, notSetValue) {
<ide> index = wrapIndex(this, index);
<del> return index < 0 ? notSetValue :
<del> seq.get(index + amount, notSetValue);
<add> return index >= 0 ? seq.get(index + amount, notSetValue) : notSetValue;
<ide> }
<ide> }
<ide> return skipSeq;
<ide> class IndexedSequence extends Sequence {
<ide> if (takeSeq !== seq) {
<ide> takeSeq.get = function (index, notSetValue) {
<ide> index = wrapIndex(this, index);
<del> return index < amount ? seq.get(index, notSetValue) : notSetValue;
<add> return index >= 0 && index < amount ? seq.get(index, notSetValue) : notSetValue;
<ide> }
<ide> }
<ide> return takeSeq;
| 4
|
PHP
|
PHP
|
fix dispatcher tests
|
7fd727b6dfe62f47ac98c7bb6d140718a6c042cd
|
<ide><path>lib/Cake/Test/TestCase/Routing/DispatcherTest.php
<ide> public function testDispatchBasic() {
<ide>
<ide> $url = new Request('test_dispatch_pages/camelCased/something. .');
<ide> $Dispatcher->dispatch($url, $response, array('return' => 1));
<del> $this->assertEquals('something. .', $url->params['pass'][0], 'Period was chopped off. %s');
<add> $this->assertEquals(
<add> 'something. .',
<add> $url->params['pass'][0],
<add> 'Period was chopped off. %s'
<add> );
<ide> }
<ide>
<ide> /**
<ide> public function testPluginShortCutUrlsWithControllerThatNeedsToBeLoaded() {
<ide> $this->skipIf($loaded, 'TestPluginController already loaded.');
<ide>
<ide> Router::reload();
<del> App::build(array(
<del> 'Plugin' => array(CAKE . 'Test/TestApp/Plugin/')
<del> ), App::RESET);
<del> Plugin::load(array('TestPlugin', 'TestPluginTwo'));
<add> App::build([
<add> 'Plugin' => [CAKE . 'Test/TestApp/Plugin/']
<add> ], App::RESET);
<add> Plugin::load(['TestPlugin', 'TestPluginTwo']);
<ide>
<ide> $Dispatcher = new TestDispatcher();
<ide> $Dispatcher->base = false;
| 1
|
Javascript
|
Javascript
|
add comments for finding registry hook calls
|
37080c9a8db7b4ff94bebcee3df990127d8d263a
|
<ide><path>src/core/core.registry.js
<ide> export class Registry {
<ide> */
<ide> _exec(method, registry, component) {
<ide> const camelMethod = _capitalize(method);
<del> call(component['before' + camelMethod], [], component);
<add> call(component['before' + camelMethod], [], component); // beforeRegister / beforeUnregister
<ide> registry[method](component);
<del> call(component['after' + camelMethod], [], component);
<add> call(component['after' + camelMethod], [], component); // afterRegister / afterUnregister
<ide> }
<ide>
<ide> /**
| 1
|
Javascript
|
Javascript
|
delay updating aspath for auto exported pages
|
a5ebe41a9a6e63827a5aaa28b2dec3fa095eb249
|
<ide><path>packages/next/client/index.js
<ide> export default async ({ webpackHMR: passedWebpackHMR } = {}) => {
<ide> await window.__NEXT_PRELOADREADY(dynamicIds)
<ide> }
<ide>
<del> router = createRouter(page, query, asPath, {
<add> // if auto prerendered and dynamic route wait to update asPath
<add> // until after mount to prevent hydration mismatch
<add> const initialAsPath = isDynamicRoute(page) && data.nextExport ? page : asPath
<add>
<add> router = createRouter(page, query, initialAsPath, {
<ide> initialProps: props,
<ide> pageLoader,
<ide> App,
<ide><path>test/integration/auto-export/test/index.test.js
<ide> describe('Auto Export', () => {
<ide>
<ide> runTests()
<ide>
<del> it('should show hydration warning from mismatching asPath', async () => {
<add> it('should not show hydration warning from mismatching asPath', async () => {
<ide> const browser = await webdriver(appPort, '/zeit/cmnt-1')
<ide> await waitFor(500)
<ide>
<ide> const numCaught = await browser.eval(`window.caughtWarns.length`)
<del> expect(numCaught).toBe(1)
<add> expect(numCaught).toBe(0)
<add> })
<add>
<add> it('should update asPath after mount', async () => {
<add> const browser = await webdriver(appPort, '/zeit/cmnt-2')
<add> await waitFor(500)
<add> const html = await browser.eval(`document.documentElement.innerHTML`)
<add> expect(html).toMatch(/\/zeit\/cmnt-2/)
<ide> })
<ide> })
<ide> })
| 2
|
Javascript
|
Javascript
|
use new function instead of eval()
|
7903f4d9407b0ffe478341f9f88779f34efb218e
|
<ide><path>src/Scope.js
<ide> function getterFn(path){
<ide> var fn = getterFnCache[path];
<ide> if (fn) return fn;
<ide>
<del> var code = 'function (s){\n';
<del> code += ' var l, fn, t;\n';
<add> var code = 'var l, fn, t;\n';
<ide> foreach(path.split('.'), function(key) {
<ide> key = (JS_KEYWORDS[key]) ? '["' + key + '"]' : '.' + key;
<del> code += ' if(!s) return s;\n';
<del> code += ' l = s;\n';
<del> code += ' s = s' + key + ';\n';
<del> code += ' if(typeof s == "'+$function+'") \n';
<del> code += ' s = function(){ return l'+key+'.apply(l, arguments); };\n';
<add> code += 'if(!s) return s;\n' +
<add> 'l=s;\n' +
<add> 's=s' + key + ';\n' +
<add> 'if(typeof s=="function") s = function(){ return l'+key+'.apply(l, arguments); };\n';
<ide> if (key.charAt(1) == '$') {
<ide> // special code for super-imposed functions
<ide> var name = key.substr(2);
<del> code += ' if(!s) {\n';
<del> code += ' t = angular.Global.typeOf(l);\n';
<del> code += ' fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["' + name + '"];\n';
<del> code += ' if (fn)\n';
<del> code += ' s = function(){ return fn.apply(l, [l].concat(Array.prototype.slice.call(arguments, 0, arguments.length))); };\n';
<del> code += ' }\n';
<add> code += 'if(!s) {\n' +
<add> ' t = angular.Global.typeOf(l);\n' +
<add> ' fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["' + name + '"];\n' +
<add> ' if (fn) s = function(){ return fn.apply(l, [l].concat(Array.prototype.slice.call(arguments, 0, arguments.length))); };\n' +
<add> '}\n';
<ide> }
<ide> });
<del> code += ' return s;\n}';
<del> fn = eval('fn = ' + code);
<add> code += 'return s;';
<add> fn = Function('s', code);
<ide> fn["toString"] = function(){ return code; };
<ide>
<ide> return getterFnCache[path] = fn;
| 1
|
Text
|
Text
|
fix typo on routing page's toc
|
3ccc37bd8fd481d9eee38caa665b851d96736136
|
<ide><path>laravel/documentation/routing.md
<ide>
<ide> - [The Basics](#the-basics)
<ide> - [Wildcards](#wildcards)
<del>- [The 404 Events](#the-404-event)
<add>- [The 404 Event](#the-404-event)
<ide> - [Filters](#filters)
<ide> - [Pattern Filters](#pattern-filters)
<ide> - [Global Filters](#global-filters)
| 1
|
Javascript
|
Javascript
|
hide conditional lines by default
|
5bfe1047ff1d3e06d98bc86e6fee5942e7ace23c
|
<ide><path>examples/js/loaders/LDrawLoader.js
<ide> THREE.LDrawLoader = ( function () {
<ide>
<ide> var lines = createObject( parseScope.conditionalSegments, 2 );
<ide> lines.isConditionalLine = true;
<add> lines.visible = false;
<ide> objGroup.add( lines );
<ide>
<ide> }
<ide>
<ide> if ( parentParseScope.groupObject ) {
<ide>
<ide> objGroup.name = parseScope.fileName;
<del> objGroup.matrix.copy( parseScope.matrix );
<ide> objGroup.matrix.decompose( objGroup.position, objGroup.quaternion, objGroup.scale );
<del> objGroup.matrixAutoUpdate = false;
<add> objGroup.userData.category = parseScope.category;
<add> objGroup.userData.keywords = parseScope.keywords;
<ide>
<ide> parentParseScope.groupObject.add( objGroup );
<ide>
<ide> THREE.LDrawLoader = ( function () {
<ide> numSubobjects: 0,
<ide> subobjectIndex: 0,
<ide> inverted: false,
<add> category: null,
<add> keywords: null,
<ide>
<ide> // Current subobject
<ide> currentFileName: null,
| 1
|
Javascript
|
Javascript
|
terminate worker of previous doc
|
151cd6dee8118dc14adef60a07001b11292dd765
|
<ide><path>web/viewer.js
<ide> var PDFView = {
<ide> }
<ide> }
<ide>
<add> // Terminate worker of the previous document if any.
<add> if (this.pdfDocument) {
<add> this.pdfDocument.destroy();
<add> }
<ide> this.pdfDocument = null;
<ide> var self = this;
<ide> self.loading = true;
| 1
|
Python
|
Python
|
add a test case for gandi live dns driver
|
9d3ad46951af5252f74b31cca26b9e3c888034a3
|
<ide><path>libcloud/test/dns/test_gandi_live.py
<ide> def test_create_record(self):
<ide> self.assertEqual(record.type, RecordType.AAAA)
<ide> self.assertEqual(record.data, '::1')
<ide>
<add> def test_create_record_doesnt_throw_if_ttl_is_not_provided(self):
<add> record = self.driver.create_record('alice', self.test_zone, 'AAAA',
<add> '::1')
<add> self.assertEqual(record.id, 'AAAA:alice')
<add> self.assertEqual(record.name, 'alice')
<add> self.assertEqual(record.type, RecordType.AAAA)
<add> self.assertEqual(record.data, '::1')
<add>
<ide> def test_bad_record_validation(self):
<ide> with self.assertRaises(RecordError) as ctx:
<ide> self.driver.create_record('alice', self.test_zone, 'AAAA',
| 1
|
Java
|
Java
|
add pathprefix predicate
|
1d589eb6396531674d36cc80a62c912b5e004cb3
|
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java
<ide> public static RequestPredicate method(HttpMethod httpMethod) {
<ide> }
<ide>
<ide> /**
<del> * Return a {@code RequestPredicate} that tests against the given path pattern.
<add> * Return a {@code RequestPredicate} that tests the request path against the given path pattern.
<ide> *
<ide> * @param pattern the pattern to match to
<ide> * @return a predicate that tests against the given path pattern
<ide> public static RequestPredicate pathExtension(Predicate<String> extensionPredicat
<ide> };
<ide> }
<ide>
<add> /**
<add> * Return a {@code RequestPredicate} that tests the beginning of the request path against the
<add> * given path pattern. This predicate is effectively identical to a
<add> * {@linkplain #path(String) standard path predicate} with path {@code pathPrefixPattern + "/**"}.
<add> * @param pathPrefixPattern the pattern to match against the start of the request path
<add> * @return a predicate that matches if the given predicate matches against the beginning of
<add> * the request's path
<add> */
<add> public static RequestPredicate pathPrefix(String pathPrefixPattern) {
<add> Assert.notNull(pathPrefixPattern, "'pathPrefixPattern' must not be null");
<add>
<add> if (!pathPrefixPattern.endsWith("/**")) {
<add> pathPrefixPattern += "/**";
<add> }
<add> return path(pathPrefixPattern);
<add> }
<add>
<ide> /**
<ide> * Return a {@code RequestPredicate} that tests the request's query parameter of the given name
<ide> * against the given predicate.
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RequestPredicatesTests.java
<ide> public void pathExtension() throws Exception {
<ide> uri = URI.create("http://localhost/file.foo");
<ide> request = MockServerRequest.builder().uri(uri).build();
<ide> assertFalse(predicate.test(request));
<add> }
<add>
<add> @Test
<add> public void pathPrefix() throws Exception {
<add> RequestPredicate predicate = RequestPredicates.pathPrefix("/foo");
<add>
<add> URI uri = URI.create("http://localhost/foo/bar");
<add> MockServerRequest request = MockServerRequest.builder().uri(uri).build();
<add> assertTrue(predicate.test(request));
<ide>
<add> uri = URI.create("http://localhost/foo");
<add> request = MockServerRequest.builder().uri(uri).build();
<add> assertTrue(predicate.test(request));
<add>
<add> uri = URI.create("http://localhost/bar");
<add> request = MockServerRequest.builder().uri(uri).build();
<add> assertFalse(predicate.test(request));
<ide> }
<ide>
<ide> @Test
| 2
|
Text
|
Text
|
improve the wording of a challenge
|
8072041012a60ab0e72af6a3361b5e03c2ea6bad
|
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614206033d366c090ca7dd42.md
<ide> dashedName: step-17
<ide>
<ide> Typeface plays an important role in the accessibility of a page. Some fonts are easier to read than others, and this is especially true on low-resolution screens.
<ide>
<del>Change the font for both the `h1` and `h2` elements to `Verdana`, and use another sans-serif _web safe_ font as a fallback.
<add>Change the font for both the `h1` and `h2` elements to `Verdana`, and use another web-safe font in the sans-serif family as a fallback.
<ide>
<ide> Also, add a `border-bottom` of `4px solid #dfdfe2` to `h2` elements to make the sections distinct.
<ide>
| 1
|
Ruby
|
Ruby
|
add only_numeric option to numericality validator
|
318d6905e29483dc1281da045caa8c1240239566
|
<ide><path>activemodel/lib/active_model/validations/numericality.rb
<ide> class NumericalityValidator < EachValidator # :nodoc:
<ide> RANGE_CHECKS = { in: :in? }
<ide> NUMBER_CHECKS = { odd: :odd?, even: :even? }
<ide>
<del> RESERVED_OPTIONS = COMPARE_CHECKS.keys + NUMBER_CHECKS.keys + RANGE_CHECKS.keys + [:only_integer]
<add> RESERVED_OPTIONS = COMPARE_CHECKS.keys + NUMBER_CHECKS.keys + RANGE_CHECKS.keys + [:only_integer, :only_numeric]
<ide>
<ide> INTEGER_REGEX = /\A[+-]?\d+\z/
<ide>
<ide> def round(raw_value, scale)
<ide> end
<ide>
<ide> def is_number?(raw_value, precision, scale)
<add> if options[:only_numeric] && !raw_value.is_a?(Numeric)
<add> return false
<add> end
<add>
<ide> !parse_as_number(raw_value, precision, scale).nil?
<ide> rescue ArgumentError, TypeError
<ide> false
<ide> module HelperMethods
<ide> # * <tt>:message</tt> - A custom error message (default is: "is not a number").
<ide> # * <tt>:only_integer</tt> - Specifies whether the value has to be an
<ide> # integer (default is +false+).
<add> # * <tt>:only_numeric</tt> - Specifies whether the value has to be an
<add> # instance of Numeric (default is +false+). The default behavior is to
<add> # attempt parsing the value if it is a String.
<ide> # * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+ (default is
<ide> # +false+). Notice that for Integer and Float columns empty strings are
<ide> # converted to +nil+.
<ide><path>activemodel/test/cases/validations/numericality_validation_test.rb
<ide> def teardown
<ide> BIGDECIMAL_STRINGS = %w(12345678901234567890.1234567890) # 30 significant digits
<ide> FLOAT_STRINGS = %w(0.0 +0.0 -0.0 10.0 10.5 -10.5 -0.0001 -090.1 90.1e1 -90.1e5 -90.1e-5 90e-5)
<ide> INTEGER_STRINGS = %w(0 +0 -0 10 +10 -10 0090 -090)
<del> FLOATS = [0.0, 10.0, 10.5, -10.5, -0.0001] + FLOAT_STRINGS
<del> INTEGERS = [0, 10, -10] + INTEGER_STRINGS
<add> NUMERIC_FLOATS = [0.0, 10.0, 10.5, -10.5, -0.0001]
<add> NUMERIC_INTEGERS = [0, 10, -10]
<add> FLOATS = NUMERIC_FLOATS + FLOAT_STRINGS
<add> INTEGERS = NUMERIC_INTEGERS + INTEGER_STRINGS
<ide> BIGDECIMAL = BIGDECIMAL_STRINGS.collect! { |bd| BigDecimal(bd) }
<ide> JUNK = ["not a number", "42 not a number", "0xdeadbeef", "-0xdeadbeef", "+0xdeadbeef", "0xinvalidhex", "0Xdeadbeef", "00-1", "--3", "+-3", "+3-1", "-+019.0", "12.12.13.12", "123\nnot a number"]
<ide> INFINITY = [1.0 / 0.0]
<ide> def test_validates_numericality_of_with_integer_only_and_proc_as_value
<ide> assert_valid_values(FLOATS + INTEGERS + BIGDECIMAL + INFINITY)
<ide> end
<ide>
<add> def test_validates_numericality_of_with_numeric_only
<add> Topic.validates_numericality_of :approved, only_numeric: true
<add>
<add> assert_invalid_values(NIL + BLANK + JUNK + FLOAT_STRINGS + INTEGER_STRINGS)
<add> assert_valid_values(NUMERIC_FLOATS + NUMERIC_INTEGERS + BIGDECIMAL + INFINITY)
<add> end
<add>
<add> def test_validates_numericality_of_with_numeric_only_and_nil_allowed
<add> Topic.validates_numericality_of :approved, only_numeric: true, allow_nil: true
<add>
<add> assert_invalid_values(JUNK + BLANK + FLOAT_STRINGS + INTEGER_STRINGS)
<add> assert_valid_values(NIL + NUMERIC_FLOATS + NUMERIC_INTEGERS + BIGDECIMAL + INFINITY)
<add> end
<add>
<ide> def test_validates_numericality_with_greater_than
<ide> Topic.validates_numericality_of :approved, greater_than: 10
<ide>
| 2
|
Java
|
Java
|
add contenttyperesolver strategy
|
641c6428e88bbdd30fac591bf33b0e94f5751d6a
|
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/accept/ContentTypeResolver.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>package org.springframework.web.reactive.accept;
<add>
<add>import java.util.List;
<add>
<add>import org.springframework.http.MediaType;
<add>import org.springframework.web.HttpMediaTypeNotAcceptableException;
<add>import org.springframework.web.server.ServerWebExchange;
<add>
<add>/**
<add> *
<add> * @author Rossen Stoyanchev
<add> */
<add>public interface ContentTypeResolver {
<add>
<add> /**
<add> * Resolve the given request to a list of requested media types. The returned
<add> * list is ordered by specificity first and by quality parameter second.
<add> *
<add> * @param exchange the current exchange
<add> * @return the requested media types or an empty list
<add> *
<add> * @throws HttpMediaTypeNotAcceptableException if the requested media
<add> * types cannot be parsed
<add> */
<add> List<MediaType> resolveMediaTypes(ServerWebExchange exchange) throws HttpMediaTypeNotAcceptableException;
<add>
<add>}
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/accept/FileExtensionContentTypeResolver.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.web.reactive.accept;
<add>
<add>import java.util.List;
<add>
<add>import org.springframework.http.MediaType;
<add>
<add>/**
<add> * An extension of {@link ContentTypeResolver} for a resolver that uses file
<add> * extensions and can expose file extension mappings.
<add> *
<add> * @author Rossen Stoyanchev
<add> */
<add>public interface FileExtensionContentTypeResolver extends ContentTypeResolver {
<add>
<add> /**
<add> * Resolve the given media type to a list of path extensions.
<add> *
<add> * @param mediaType the media type to resolve
<add> * @return a list of extensions or an empty list, never {@code null}
<add> */
<add> List<String> getFileExtensions(MediaType mediaType);
<add>
<add> /**
<add> * Return all registered file extensions.
<add> * @return a list of extensions or an empty list, never {@code null}
<add> */
<add> List<String> getAllFileExtensions();
<add>
<add>}
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/accept/HeaderContentTypeResolver.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>package org.springframework.web.reactive.accept;
<add>
<add>import java.util.List;
<add>
<add>import org.springframework.http.InvalidMediaTypeException;
<add>import org.springframework.http.MediaType;
<add>import org.springframework.web.HttpMediaTypeNotAcceptableException;
<add>import org.springframework.web.server.ServerWebExchange;
<add>
<add>/**
<add> * A {@link ContentTypeResolver} that checks the 'Accept' request header.
<add> *
<add> * @author Rossen Stoyanchev
<add> */
<add>public class HeaderContentTypeResolver implements ContentTypeResolver {
<add>
<add> @Override
<add> public List<MediaType> resolveMediaTypes(ServerWebExchange exchange)
<add> throws HttpMediaTypeNotAcceptableException {
<add>
<add> try {
<add> List<MediaType> mediaTypes = exchange.getRequest().getHeaders().getAccept();
<add> MediaType.sortBySpecificityAndQuality(mediaTypes);
<add> return mediaTypes;
<add> }
<add> catch (InvalidMediaTypeException ex) {
<add> String value = exchange.getRequest().getHeaders().getFirst("Accept");
<add> throw new HttpMediaTypeNotAcceptableException(
<add> "Could not parse 'Accept' header [" + value + "]: " + ex.getMessage());
<add> }
<add> }
<add>}
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/accept/package-info.java
<add>/**
<add> * This package provides support for various strategies to resolve the requested
<add> * content type for a given request.
<add> */
<add>package org.springframework.web.reactive.accept;
<ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/accept/HeaderContentTypeResolverTests.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>package org.springframework.web.reactive.accept;
<add>
<add>import java.net.URI;
<add>import java.net.URISyntaxException;
<add>import java.util.List;
<add>
<add>import org.junit.Before;
<add>import org.junit.Test;
<add>
<add>import org.springframework.http.HttpMethod;
<add>import org.springframework.http.MediaType;
<add>import org.springframework.http.server.reactive.MockServerHttpRequest;
<add>import org.springframework.http.server.reactive.MockServerHttpResponse;
<add>import org.springframework.http.server.reactive.ServerHttpRequest;
<add>import org.springframework.web.HttpMediaTypeNotAcceptableException;
<add>import org.springframework.web.server.ServerWebExchange;
<add>import org.springframework.web.server.adapter.DefaultServerWebExchange;
<add>import org.springframework.web.server.session.WebSessionManager;
<add>
<add>import static org.junit.Assert.assertEquals;
<add>import static org.mockito.Mockito.mock;
<add>
<add>/**
<add> * Unit tests for {@link HeaderContentTypeResolver}.
<add> *
<add> * @author Rossen Stoyanchev
<add> */
<add>public class HeaderContentTypeResolverTests {
<add>
<add> private HeaderContentTypeResolver resolver;
<add>
<add>
<add> @Before
<add> public void setup() {
<add> this.resolver = new HeaderContentTypeResolver();
<add> }
<add>
<add>
<add> @Test
<add> public void resolveMediaTypes() throws Exception {
<add> ServerWebExchange exchange = createExchange("text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c");
<add> List<MediaType> mediaTypes = this.resolver.resolveMediaTypes(exchange);
<add>
<add> assertEquals(4, mediaTypes.size());
<add> assertEquals("text/html", mediaTypes.get(0).toString());
<add> assertEquals("text/x-c", mediaTypes.get(1).toString());
<add> assertEquals("text/x-dvi;q=0.8", mediaTypes.get(2).toString());
<add> assertEquals("text/plain;q=0.5", mediaTypes.get(3).toString());
<add> }
<add>
<add> @Test(expected=HttpMediaTypeNotAcceptableException.class)
<add> public void resolveMediaTypesParseError() throws Exception {
<add> ServerWebExchange exchange = createExchange("textplain; q=0.5");
<add> this.resolver.resolveMediaTypes(exchange);
<add> }
<add>
<add>
<add> private ServerWebExchange createExchange(String accept) throws URISyntaxException {
<add> ServerHttpRequest request = new MockServerHttpRequest(HttpMethod.GET, new URI("/"));
<add> if (accept != null) {
<add> request.getHeaders().add("Accept", accept);
<add> }
<add> WebSessionManager sessionManager = mock(WebSessionManager.class);
<add> return new DefaultServerWebExchange(request, new MockServerHttpResponse(), sessionManager);
<add> }
<add>
<add>}
| 5
|
Java
|
Java
|
improve the javadoc of the other lift() operators
|
8068404179b0d2e07da6f0e10ea95110d98e118d
|
<ide><path>src/main/java/io/reactivex/Completable.java
<ide> public final Completable doFinally(Action onFinally) {
<ide> }
<ide>
<ide> /**
<del> * <strong>Advanced use without safeguards:</strong> lifts a CompletableOperator
<del> * transformation into the chain of Completables.
<add> * <strong>This method requires advanced knowledge about building operators, please consider
<add> * other standard composition methods first;</strong>
<add> * Returns a {@code Completable} which, when subscribed to, invokes the {@link CompletableOperator#apply(CompletableObserver) apply(CompletableObserver)} method
<add> * of the provided {@link CompletableOperator} for each individual downstream {@link Completable} and allows the
<add> * insertion of a custom operator by accessing the downstream's {@link CompletableObserver} during this subscription phase
<add> * and providing a new {@code CompletableObserver}, containing the custom operator's intended business logic, that will be
<add> * used in the subscription process going further upstream.
<add> * <p>
<add> * Generally, such a new {@code CompletableObserver} will wrap the downstream's {@code CompletableObserver} and forwards the
<add> * {@code onError} and {@code onComplete} events from the upstream directly or according to the
<add> * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the
<add> * flow control calls of {@code dispose} and {@code isDisposed} that would have traveled upstream and perform
<add> * additional actions depending on the same business logic requirements.
<add> * <p>
<add> * Example:
<add> * <pre><code>
<add> * // Step 1: Create the consumer type that will be returned by the CompletableOperator.apply():
<add> *
<add> * public final class CustomCompletableObserver implements CompletableObserver, Disposable {
<add> *
<add> * // The donstream's CompletableObserver that will receive the onXXX events
<add> * final CompletableObserver downstream;
<add> *
<add> * // The connection to the upstream source that will call this class' onXXX methods
<add> * Disposable upstream;
<add> *
<add> * // The constructor takes the downstream subscriber and usually any other parameters
<add> * public CustomCompletableObserver(CompletableObserver downstream) {
<add> * this.downstream = downstream;
<add> * }
<add> *
<add> * // In the subscription phase, the upstream sends a Disposable to this class
<add> * // and subsequently this class has to send a Disposable to the downstream.
<add> * // Note that relaying the upstream's Disposable directly is not allowed in RxJava
<add> * @Override
<add> * public void onSubscribe(Disposable s) {
<add> * if (upstream != null) {
<add> * s.cancel();
<add> * } else {
<add> * upstream = s;
<add> * downstream.onSubscribe(this);
<add> * }
<add> * }
<add> *
<add> * // Some operators may handle the upstream's error while others
<add> * // could just forward it to the downstream.
<add> * @Override
<add> * public void onError(Throwable throwable) {
<add> * downstream.onError(throwable);
<add> * }
<add> *
<add> * // When the upstream completes, usually the downstream should complete as well.
<add> * // In completable, this could also mean doing some side-effects
<add> * @Override
<add> * public void onComplete() {
<add> * System.out.println("Sequence completed");
<add> * downstream.onComplete();
<add> * }
<add> *
<add> * // Some operators may use their own resources which should be cleaned up if
<add> * // the downstream disposes the flow before it completed. Operators without
<add> * // resources can simply forward the dispose to the upstream.
<add> * // In some cases, a disposed flag may be set by this method so that other parts
<add> * // of this class may detect the dispose and stop sending events
<add> * // to the downstream.
<add> * @Override
<add> * public void dispose() {
<add> * upstream.dispose();
<add> * }
<add> *
<add> * // Some operators may simply forward the call to the upstream while others
<add> * // can return the disposed flag set in dispose().
<add> * @Override
<add> * public boolean isDisposed() {
<add> * return upstream.isDisposed();
<add> * }
<add> * }
<add> *
<add> * // Step 2: Create a class that implements the CompletableOperator interface and
<add> * // returns the custom consumer type from above in its apply() method.
<add> * // Such class may define additional parameters to be submitted to
<add> * // the custom consumer type.
<add> *
<add> * final class CustomCompletableOperator implements CompletableOperator {
<add> * @Override
<add> * public CompletableObserver apply(CompletableObserver upstream) {
<add> * return new CustomCompletableObserver(upstream);
<add> * }
<add> * }
<add> *
<add> * // Step 3: Apply the custom operator via lift() in a flow by creating an instance of it
<add> * // or reusing an existing one.
<add> *
<add> * Completable.complete()
<add> * .lift(new CustomCompletableOperator())
<add> * .test()
<add> * .assertResult();
<add> * </code></pre>
<add> * <p>
<add> * Creating custom operators can be complicated and it is recommended one consults the
<add> * <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a> page about
<add> * the tools, requirements, rules, considerations and pitfalls of implementing them.
<add> * <p>
<add> * Note that implementing custom operators via this {@code lift()} method adds slightly more overhead by requiring
<add> * an additional allocation and indirection per assembled flows. Instead, extending the abstract {@code Completable}
<add> * class and creating a {@link CompletableTransformer} with it is recommended.
<add> * <p>
<add> * Note also that it is not possible to stop the subscription phase in {@code lift()} as the {@code apply()} method
<add> * requires a non-null {@code CompletableObserver} instance to be returned, which is then unconditionally subscribed to
<add> * the upstream {@code Completable}. For example, if the operator decided there is no reason to subscribe to the
<add> * upstream source because of some optimization possibility or a failure to prepare the operator, it still has to
<add> * return a {@code CompletableObserver} that should immediately dispose the upstream's {@code Disposable} in its
<add> * {@code onSubscribe} method. Again, using a {@code CompletableTransformer} and extending the {@code Completable} is
<add> * a better option as {@link #subscribeActual} can decide to not subscribe to its upstream after all.
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<del> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}.</dd>
<add> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}, however, the
<add> * {@link CompletableOperator} may use a {@code Scheduler} to support its own asynchronous behavior.</dd>
<ide> * </dl>
<del> * @param onLift the lifting function that transforms the child subscriber with a parent subscriber.
<add> *
<add> * @param onLift the {@link CompletableOperator} that receives the downstream's {@code CompletableObserver} and should return
<add> * a {@code CompletableObserver} with custom behavior to be used as the consumer for the current
<add> * {@code Completable}.
<ide> * @return the new Completable instance
<del> * @throws NullPointerException if onLift is null
<add> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a>
<add> * @see #compose(CompletableTransformer)
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide><path>src/main/java/io/reactivex/Flowable.java
<ide> public final Single<T> lastOrError() {
<ide> * Returns a {@code Flowable} which, when subscribed to, invokes the {@link FlowableOperator#apply(Subscriber) apply(Subscriber)} method
<ide> * of the provided {@link FlowableOperator} for each individual downstream {@link Subscriber} and allows the
<ide> * insertion of a custom operator by accessing the downstream's {@link Subscriber} during this subscription phase
<del> * and providing a new {@code Subscriber}, containing the custom operator's intended business logic, that will be
<add> * and providing a new {@code Subscriber}, containing the custom operator's intended business logic, that will be
<ide> * used in the subscription process going further upstream.
<ide> * <p>
<ide> * Generally, such a new {@code Subscriber} will wrap the downstream's {@code Subscriber} and forwards the
<ide> * {@code onNext}, {@code onError} and {@code onComplete} events from the upstream directly or according to the
<del> * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the
<del> * flow control calls of {@code cancel} and {@code request} that would have travelled upstream and perform
<add> * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the
<add> * flow control calls of {@code cancel} and {@code request} that would have traveled upstream and perform
<ide> * additional actions depending on the same business logic requirements.
<ide> * <p>
<ide> * Example:
<ide> public final Single<T> lastOrError() {
<ide> * a better option as {@link #subscribeActual} can decide to not subscribe to its upstream after all.
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<del> * <dd>The {@code Subscriber} instance returned by the {@link FlowableOperator} is responsible to be
<add> * <dd>The {@code Subscriber} instance returned by the {@link FlowableOperator} is responsible to be
<ide> * backpressure-aware or document the fact that the consumer of the returned {@code Publisher} has to apply one of
<ide> * the {@code onBackpressureXXX} operators.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide><path>src/main/java/io/reactivex/Maybe.java
<ide> public final Single<Boolean> isEmpty() {
<ide> }
<ide>
<ide> /**
<del> * Lifts a function to the current Maybe and returns a new Maybe that when subscribed to will pass the
<del> * values of the current Maybe through the MaybeOperator function.
<add> * <strong>This method requires advanced knowledge about building operators, please consider
<add> * other standard composition methods first;</strong>
<add> * Returns a {@code Maybe} which, when subscribed to, invokes the {@link MaybeOperator#apply(MaybeObserver) apply(MaybeObserver)} method
<add> * of the provided {@link MaybeOperator} for each individual downstream {@link Maybe} and allows the
<add> * insertion of a custom operator by accessing the downstream's {@link MaybeObserver} during this subscription phase
<add> * and providing a new {@code MaybeObserver}, containing the custom operator's intended business logic, that will be
<add> * used in the subscription process going further upstream.
<add> * <p>
<add> * Generally, such a new {@code MaybeObserver} will wrap the downstream's {@code MaybeObserver} and forwards the
<add> * {@code onSuccess}, {@code onError} and {@code onComplete} events from the upstream directly or according to the
<add> * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the
<add> * flow control calls of {@code dispose} and {@code isDisposed} that would have traveled upstream and perform
<add> * additional actions depending on the same business logic requirements.
<ide> * <p>
<del> * In other words, this allows chaining TaskExecutors together on a Maybe for acting on the values within
<del> * the Maybe.
<add> * Example:
<add> * <pre><code>
<add> * // Step 1: Create the consumer type that will be returned by the MaybeOperator.apply():
<add> *
<add> * public final class CustomMaybeObserver<T> implements MaybeObserver<T>, Disposable {
<add> *
<add> * // The donstream's MaybeObserver that will receive the onXXX events
<add> * final MaybeObserver<? super String> downstream;
<add> *
<add> * // The connection to the upstream source that will call this class' onXXX methods
<add> * Disposable upstream;
<add> *
<add> * // The constructor takes the downstream subscriber and usually any other parameters
<add> * public CustomMaybeObserver(MaybeObserver<? super String> downstream) {
<add> * this.downstream = downstream;
<add> * }
<add> *
<add> * // In the subscription phase, the upstream sends a Disposable to this class
<add> * // and subsequently this class has to send a Disposable to the downstream.
<add> * // Note that relaying the upstream's Disposable directly is not allowed in RxJava
<add> * @Override
<add> * public void onSubscribe(Disposable s) {
<add> * if (upstream != null) {
<add> * s.cancel();
<add> * } else {
<add> * upstream = s;
<add> * downstream.onSubscribe(this);
<add> * }
<add> * }
<add> *
<add> * // The upstream calls this with the next item and the implementation's
<add> * // responsibility is to emit an item to the downstream based on the intended
<add> * // business logic, or if it can't do so for the particular item,
<add> * // request more from the upstream
<add> * @Override
<add> * public void onSuccess(T item) {
<add> * String str = item.toString();
<add> * if (str.length() < 2) {
<add> * downstream.onSuccess(str);
<add> * } else {
<add> * // Maybe is usually expected to produce one of the onXXX events
<add> * downstream.onComplete();
<add> * }
<add> * }
<add> *
<add> * // Some operators may handle the upstream's error while others
<add> * // could just forward it to the downstream.
<add> * @Override
<add> * public void onError(Throwable throwable) {
<add> * downstream.onError(throwable);
<add> * }
<add> *
<add> * // When the upstream completes, usually the downstream should complete as well.
<add> * @Override
<add> * public void onComplete() {
<add> * downstream.onComplete();
<add> * }
<add> *
<add> * // Some operators may use their own resources which should be cleaned up if
<add> * // the downstream disposes the flow before it completed. Operators without
<add> * // resources can simply forward the dispose to the upstream.
<add> * // In some cases, a disposed flag may be set by this method so that other parts
<add> * // of this class may detect the dispose and stop sending events
<add> * // to the downstream.
<add> * @Override
<add> * public void dispose() {
<add> * upstream.dispose();
<add> * }
<add> *
<add> * // Some operators may simply forward the call to the upstream while others
<add> * // can return the disposed flag set in dispose().
<add> * @Override
<add> * public boolean isDisposed() {
<add> * return upstream.isDisposed();
<add> * }
<add> * }
<add> *
<add> * // Step 2: Create a class that implements the MaybeOperator interface and
<add> * // returns the custom consumer type from above in its apply() method.
<add> * // Such class may define additional parameters to be submitted to
<add> * // the custom consumer type.
<add> *
<add> * final class CustomMaybeOperator<T> implements MaybeOperator<String> {
<add> * @Override
<add> * public MaybeObserver<? super String> apply(MaybeObserver<? super T> upstream) {
<add> * return new CustomMaybeObserver<T>(upstream);
<add> * }
<add> * }
<add> *
<add> * // Step 3: Apply the custom operator via lift() in a flow by creating an instance of it
<add> * // or reusing an existing one.
<add> *
<add> * Maybe.just(5)
<add> * .lift(new CustomMaybeOperator<Integer>())
<add> * .test()
<add> * .assertResult("5");
<add> *
<add> * Maybe.just(15)
<add> * .lift(new CustomMaybeOperator<Integer>())
<add> * .test()
<add> * .assertResult();
<add> * </code></pre>
<add> * <p>
<add> * Creating custom operators can be complicated and it is recommended one consults the
<add> * <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a> page about
<add> * the tools, requirements, rules, considerations and pitfalls of implementing them.
<ide> * <p>
<del> * {@code task.map(...).filter(...).lift(new OperatorA()).lift(new OperatorB(...)).subscribe() }
<add> * Note that implementing custom operators via this {@code lift()} method adds slightly more overhead by requiring
<add> * an additional allocation and indirection per assembled flows. Instead, extending the abstract {@code Maybe}
<add> * class and creating a {@link MaybeTransformer} with it is recommended.
<ide> * <p>
<del> * If the operator you are creating is designed to act on the item emitted by a source Maybe, use
<del> * {@code lift}. If your operator is designed to transform the source Maybe as a whole (for instance, by
<del> * applying a particular set of existing RxJava operators to it) use {@link #compose}.
<add> * Note also that it is not possible to stop the subscription phase in {@code lift()} as the {@code apply()} method
<add> * requires a non-null {@code MaybeObserver} instance to be returned, which is then unconditionally subscribed to
<add> * the upstream {@code Maybe}. For example, if the operator decided there is no reason to subscribe to the
<add> * upstream source because of some optimization possibility or a failure to prepare the operator, it still has to
<add> * return a {@code MaybeObserver} that should immediately dispose the upstream's {@code Disposable} in its
<add> * {@code onSubscribe} method. Again, using a {@code MaybeTransformer} and extending the {@code Maybe} is
<add> * a better option as {@link #subscribeActual} can decide to not subscribe to its upstream after all.
<ide> * <dl>
<del> * <dt><b>Scheduler:</b></dt>
<del> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}.</dd>
<add> * <dt><b>Scheduler:</b></dt>
<add> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}, however, the
<add> * {@link MaybeOperator} may use a {@code Scheduler} to support its own asynchronous behavior.</dd>
<ide> * </dl>
<ide> *
<del> * @param <R> the downstream's value type (output)
<del> * @param lift
<del> * the MaybeOperator that implements the Maybe-operating function to be applied to the source Maybe
<del> * @return a Maybe that is the result of applying the lifted Operator to the source Maybe
<del> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Implementing-Your-Own-Operators">RxJava wiki: Implementing Your Own Operators</a>
<add> * @param <R> the output value type
<add> * @param lift the {@link MaybeOperator} that receives the downstream's {@code MaybeObserver} and should return
<add> * a {@code MaybeObserver} with custom behavior to be used as the consumer for the current
<add> * {@code Maybe}.
<add> * @return the new Maybe instance
<add> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a>
<add> * @see #compose(MaybeTransformer)
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide><path>src/main/java/io/reactivex/Observable.java
<ide> public final Single<T> lastOrError() {
<ide> }
<ide>
<ide> /**
<del> * <strong>This method requires advanced knowledge about building operators; please consider
<add> * <strong>This method requires advanced knowledge about building operators, please consider
<ide> * other standard composition methods first;</strong>
<del> * Lifts a function to the current ObservableSource and returns a new ObservableSource that when subscribed to will pass
<del> * the values of the current ObservableSource through the Operator function.
<add> * Returns an {@code Observable} which, when subscribed to, invokes the {@link ObservableOperator#apply(Observer) apply(Observer)} method
<add> * of the provided {@link ObservableOperator} for each individual downstream {@link Observer} and allows the
<add> * insertion of a custom operator by accessing the downstream's {@link Observer} during this subscription phase
<add> * and providing a new {@code Observer}, containing the custom operator's intended business logic, that will be
<add> * used in the subscription process going further upstream.
<add> * <p>
<add> * Generally, such a new {@code Observer} will wrap the downstream's {@code Observer} and forwards the
<add> * {@code onNext}, {@code onError} and {@code onComplete} events from the upstream directly or according to the
<add> * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the
<add> * flow control calls of {@code dispose} and {@code isDisposed} that would have traveled upstream and perform
<add> * additional actions depending on the same business logic requirements.
<ide> * <p>
<del> * In other words, this allows chaining Observers together on an ObservableSource for acting on the values within
<del> * the ObservableSource.
<del> * <p> {@code
<del> * ObservableSource.map(...).filter(...).take(5).lift(new OperatorA()).lift(new OperatorB(...)).subscribe()
<add> * Example:
<add> * <pre><code>
<add> * // Step 1: Create the consumer type that will be returned by the ObservableOperator.apply():
<add> *
<add> * public final class CustomObserver<T> implements Observer<T>, Disposable {
<add> *
<add> * // The donstream's Observer that will receive the onXXX events
<add> * final Observer<? super String> downstream;
<add> *
<add> * // The connection to the upstream source that will call this class' onXXX methods
<add> * Disposable upstream;
<add> *
<add> * // The constructor takes the downstream subscriber and usually any other parameters
<add> * public CustomObserver(Observer<? super String> downstream) {
<add> * this.downstream = downstream;
<add> * }
<add> *
<add> * // In the subscription phase, the upstream sends a Disposable to this class
<add> * // and subsequently this class has to send a Disposable to the downstream.
<add> * // Note that relaying the upstream's Disposable directly is not allowed in RxJava
<add> * @Override
<add> * public void onSubscribe(Disposable s) {
<add> * if (upstream != null) {
<add> * s.cancel();
<add> * } else {
<add> * upstream = s;
<add> * downstream.onSubscribe(this);
<add> * }
<add> * }
<add> *
<add> * // The upstream calls this with the next item and the implementation's
<add> * // responsibility is to emit an item to the downstream based on the intended
<add> * // business logic, or if it can't do so for the particular item,
<add> * // request more from the upstream
<add> * @Override
<add> * public void onNext(T item) {
<add> * String str = item.toString();
<add> * if (str.length() < 2) {
<add> * downstream.onNext(str);
<add> * }
<add> * // Observable doesn't support backpressure, therefore, there is no
<add> * // need or opportunity to call upstream.request(1) if an item
<add> * // is not produced to the downstream
<add> * }
<add> *
<add> * // Some operators may handle the upstream's error while others
<add> * // could just forward it to the downstream.
<add> * @Override
<add> * public void onError(Throwable throwable) {
<add> * downstream.onError(throwable);
<add> * }
<add> *
<add> * // When the upstream completes, usually the downstream should complete as well.
<add> * @Override
<add> * public void onComplete() {
<add> * downstream.onComplete();
<add> * }
<add> *
<add> * // Some operators may use their own resources which should be cleaned up if
<add> * // the downstream disposes the flow before it completed. Operators without
<add> * // resources can simply forward the dispose to the upstream.
<add> * // In some cases, a disposed flag may be set by this method so that other parts
<add> * // of this class may detect the dispose and stop sending events
<add> * // to the downstream.
<add> * @Override
<add> * public void dispose() {
<add> * upstream.dispose();
<add> * }
<add> *
<add> * // Some operators may simply forward the call to the upstream while others
<add> * // can return the disposed flag set in dispose().
<add> * @Override
<add> * public boolean isDisposed() {
<add> * return upstream.isDisposed();
<add> * }
<ide> * }
<add> *
<add> * // Step 2: Create a class that implements the ObservableOperator interface and
<add> * // returns the custom consumer type from above in its apply() method.
<add> * // Such class may define additional parameters to be submitted to
<add> * // the custom consumer type.
<add> *
<add> * final class CustomOperator<T> implements ObservableOperator<String> {
<add> * @Override
<add> * public Observer<? super String> apply(Observer<? super T> upstream) {
<add> * return new CustomObserver<T>(upstream);
<add> * }
<add> * }
<add> *
<add> * // Step 3: Apply the custom operator via lift() in a flow by creating an instance of it
<add> * // or reusing an existing one.
<add> *
<add> * Observable.range(5, 10)
<add> * .lift(new CustomOperator<Integer>())
<add> * .test()
<add> * .assertResult("5", "6", "7", "8", "9");
<add> * </code></pre>
<ide> * <p>
<del> * If the operator you are creating is designed to act on the individual items emitted by a source
<del> * ObservableSource, use {@code lift}. If your operator is designed to transform the source ObservableSource as a whole
<del> * (for instance, by applying a particular set of existing RxJava operators to it) use {@link #compose}.
<add> * Creating custom operators can be complicated and it is recommended one consults the
<add> * <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a> page about
<add> * the tools, requirements, rules, considerations and pitfalls of implementing them.
<add> * <p>
<add> * Note that implementing custom operators via this {@code lift()} method adds slightly more overhead by requiring
<add> * an additional allocation and indirection per assembled flows. Instead, extending the abstract {@code Observable}
<add> * class and creating an {@link ObservableTransformer} with it is recommended.
<add> * <p>
<add> * Note also that it is not possible to stop the subscription phase in {@code lift()} as the {@code apply()} method
<add> * requires a non-null {@code Observer} instance to be returned, which is then unconditionally subscribed to
<add> * the upstream {@code Observable}. For example, if the operator decided there is no reason to subscribe to the
<add> * upstream source because of some optimization possibility or a failure to prepare the operator, it still has to
<add> * return an {@code Observer} that should immediately dispose the upstream's {@code Disposable} in its
<add> * {@code onSubscribe} method. Again, using an {@code ObservableTransformer} and extending the {@code Observable} is
<add> * a better option as {@link #subscribeActual} can decide to not subscribe to its upstream after all.
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<del> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}.</dd>
<add> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}, however, the
<add> * {@link ObservableOperator} may use a {@code Scheduler} to support its own asynchronous behavior.</dd>
<ide> * </dl>
<ide> *
<ide> * @param <R> the output value type
<del> * @param lifter the Operator that implements the ObservableSource-operating function to be applied to the source
<del> * ObservableSource
<del> * @return an Observable that is the result of applying the lifted Operator to the source ObservableSource
<del> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Implementing-Your-Own-Operators">RxJava wiki: Implementing Your Own Operators</a>
<add> * @param lifter the {@link ObservableOperator} that receives the downstream's {@code Observer} and should return
<add> * an {@code Observer} with custom behavior to be used as the consumer for the current
<add> * {@code Observable}.
<add> * @return the new Observable instance
<add> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a>
<add> * @see #compose(ObservableTransformer)
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
<ide><path>src/main/java/io/reactivex/Single.java
<ide> public final T blockingGet() {
<ide> }
<ide>
<ide> /**
<del> * Lifts a function to the current Single and returns a new Single that when subscribed to will pass the
<del> * values of the current Single through the Operator function.
<add> * <strong>This method requires advanced knowledge about building operators, please consider
<add> * other standard composition methods first;</strong>
<add> * Returns a {@code Single} which, when subscribed to, invokes the {@link SingleOperator#apply(SingleObserver) apply(SingleObserver)} method
<add> * of the provided {@link SingleOperator} for each individual downstream {@link Single} and allows the
<add> * insertion of a custom operator by accessing the downstream's {@link SingleObserver} during this subscription phase
<add> * and providing a new {@code SingleObserver}, containing the custom operator's intended business logic, that will be
<add> * used in the subscription process going further upstream.
<add> * <p>
<add> * Generally, such a new {@code SingleObserver} will wrap the downstream's {@code SingleObserver} and forwards the
<add> * {@code onSuccess} and {@code onError} events from the upstream directly or according to the
<add> * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the
<add> * flow control calls of {@code dispose} and {@code isDisposed} that would have traveled upstream and perform
<add> * additional actions depending on the same business logic requirements.
<ide> * <p>
<del> * In other words, this allows chaining TaskExecutors together on a Single for acting on the values within
<del> * the Single.
<add> * Example:
<add> * <pre><code>
<add> * // Step 1: Create the consumer type that will be returned by the SingleOperator.apply():
<add> *
<add> * public final class CustomSingleObserver<T> implements SingleObserver<T>, Disposable {
<add> *
<add> * // The donstream's SingleObserver that will receive the onXXX events
<add> * final SingleObserver<? super String> downstream;
<add> *
<add> * // The connection to the upstream source that will call this class' onXXX methods
<add> * Disposable upstream;
<add> *
<add> * // The constructor takes the downstream subscriber and usually any other parameters
<add> * public CustomSingleObserver(SingleObserver<? super String> downstream) {
<add> * this.downstream = downstream;
<add> * }
<add> *
<add> * // In the subscription phase, the upstream sends a Disposable to this class
<add> * // and subsequently this class has to send a Disposable to the downstream.
<add> * // Note that relaying the upstream's Disposable directly is not allowed in RxJava
<add> * @Override
<add> * public void onSubscribe(Disposable s) {
<add> * if (upstream != null) {
<add> * s.cancel();
<add> * } else {
<add> * upstream = s;
<add> * downstream.onSubscribe(this);
<add> * }
<add> * }
<add> *
<add> * // The upstream calls this with the next item and the implementation's
<add> * // responsibility is to emit an item to the downstream based on the intended
<add> * // business logic, or if it can't do so for the particular item,
<add> * // request more from the upstream
<add> * @Override
<add> * public void onSuccess(T item) {
<add> * String str = item.toString();
<add> * if (str.length() < 2) {
<add> * downstream.onSuccess(str);
<add> * } else {
<add> * // Single is usually expected to produce one of the onXXX events
<add> * downstream.onError(new NoSuchElementException());
<add> * }
<add> * }
<add> *
<add> * // Some operators may handle the upstream's error while others
<add> * // could just forward it to the downstream.
<add> * @Override
<add> * public void onError(Throwable throwable) {
<add> * downstream.onError(throwable);
<add> * }
<add> *
<add> * // Some operators may use their own resources which should be cleaned up if
<add> * // the downstream disposes the flow before it completed. Operators without
<add> * // resources can simply forward the dispose to the upstream.
<add> * // In some cases, a disposed flag may be set by this method so that other parts
<add> * // of this class may detect the dispose and stop sending events
<add> * // to the downstream.
<add> * @Override
<add> * public void dispose() {
<add> * upstream.dispose();
<add> * }
<add> *
<add> * // Some operators may simply forward the call to the upstream while others
<add> * // can return the disposed flag set in dispose().
<add> * @Override
<add> * public boolean isDisposed() {
<add> * return upstream.isDisposed();
<add> * }
<add> * }
<add> *
<add> * // Step 2: Create a class that implements the SingleOperator interface and
<add> * // returns the custom consumer type from above in its apply() method.
<add> * // Such class may define additional parameters to be submitted to
<add> * // the custom consumer type.
<add> *
<add> * final class CustomSingleOperator<T> implements SingleOperator<String> {
<add> * @Override
<add> * public SingleObserver<? super String> apply(SingleObserver<? super T> upstream) {
<add> * return new CustomSingleObserver<T>(upstream);
<add> * }
<add> * }
<add> *
<add> * // Step 3: Apply the custom operator via lift() in a flow by creating an instance of it
<add> * // or reusing an existing one.
<add> *
<add> * Single.just(5)
<add> * .lift(new CustomSingleOperator<Integer>())
<add> * .test()
<add> * .assertResult("5");
<add> *
<add> * Single.just(15)
<add> * .lift(new CustomSingleOperator<Integer>())
<add> * .test()
<add> * .assertFailure(NoSuchElementException.class);
<add> * </code></pre>
<ide> * <p>
<del> * {@code task.map(...).filter(...).lift(new OperatorA()).lift(new OperatorB(...)).subscribe() }
<add> * Creating custom operators can be complicated and it is recommended one consults the
<add> * <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a> page about
<add> * the tools, requirements, rules, considerations and pitfalls of implementing them.
<ide> * <p>
<del> * If the operator you are creating is designed to act on the item emitted by a source Single, use
<del> * {@code lift}. If your operator is designed to transform the source Single as a whole (for instance, by
<del> * applying a particular set of existing RxJava operators to it) use {@link #compose}.
<add> * Note that implementing custom operators via this {@code lift()} method adds slightly more overhead by requiring
<add> * an additional allocation and indirection per assembled flows. Instead, extending the abstract {@code Single}
<add> * class and creating a {@link SingleTransformer} with it is recommended.
<add> * <p>
<add> * Note also that it is not possible to stop the subscription phase in {@code lift()} as the {@code apply()} method
<add> * requires a non-null {@code SingleObserver} instance to be returned, which is then unconditionally subscribed to
<add> * the upstream {@code Single}. For example, if the operator decided there is no reason to subscribe to the
<add> * upstream source because of some optimization possibility or a failure to prepare the operator, it still has to
<add> * return a {@code SingleObserver} that should immediately dispose the upstream's {@code Disposable} in its
<add> * {@code onSubscribe} method. Again, using a {@code SingleTransformer} and extending the {@code Single} is
<add> * a better option as {@link #subscribeActual} can decide to not subscribe to its upstream after all.
<ide> * <dl>
<del> * <dt><b>Scheduler:</b></dt>
<del> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}.</dd>
<add> * <dt><b>Scheduler:</b></dt>
<add> * <dd>{@code lift} does not operate by default on a particular {@link Scheduler}, however, the
<add> * {@link SingleOperator} may use a {@code Scheduler} to support its own asynchronous behavior.</dd>
<ide> * </dl>
<ide> *
<del> * @param <R> the downstream's value type (output)
<del> * @param lift
<del> * the Operator that implements the Single-operating function to be applied to the source Single
<del> * @return a Single that is the result of applying the lifted Operator to the source Single
<del> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Implementing-Your-Own-Operators">RxJava wiki: Implementing Your Own Operators</a>
<add> * @param <R> the output value type
<add> * @param lift the {@link SingleOperator} that receives the downstream's {@code SingleObserver} and should return
<add> * a {@code SingleObserver} with custom behavior to be used as the consumer for the current
<add> * {@code Single}.
<add> * @return the new Single instance
<add> * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Writing-operators-for-2.0">RxJava wiki: Writing operators</a>
<add> * @see #compose(SingleTransformer)
<ide> */
<ide> @CheckReturnValue
<ide> @SchedulerSupport(SchedulerSupport.NONE)
| 5
|
Text
|
Text
|
add doi badge to readme
|
2582e59a57154ec5a71321eda24019dd94824e71
|
<ide><path>README.md
<ide> limitations under the License.
<ide> <a href="https://github.com/huggingface/transformers/blob/master/CODE_OF_CONDUCT.md">
<ide> <img alt="Contributor Covenant" src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg">
<ide> </a>
<add> <a href="https://zenodo.org/badge/latestdoi/155220641"><img src="https://zenodo.org/badge/155220641.svg" alt="DOI"></a>
<ide> </p>
<ide>
<ide> <h3 align="center">
| 1
|
Text
|
Text
|
remove guide contribution references
|
7065ace345f61f1ec628889ec155bc89e29f1a52
|
<ide><path>CONTRIBUTING.md
<ide> We have a huge open source codebase consisting of thousands of [coding challenge
<ide>
<ide> You can help us to:
<ide>
<del>- [📝 Research, Write and Update our guide articles](#research-write-and-update-our-guide-articles)
<del>
<ide> - [💻 Create, Update and Fix Bugs in our coding challenges](#create-update-and-fix-bugs-in-our-coding-challenges)
<ide>
<del>- [🌐 Translate guide articles](#translate-guide-articles)
<del>
<ide> - [🛠 Fix bugs in freeCodeCamp.org's learning platform](#help-us-fix-bugs-in-freecodecamporgs-learning-platform)
<ide>
<del>### Research, Write and Update our guide articles
<del>
<del>**What are guide articles?**
<del>
<del>Guide articles help you get a quick understanding of a technology concept. These are short, plain English explanations that you can read before going on to more in-depth resources.
<del>
<del>You can find an [example article about HTML Anchor Elements here](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/guide/english/html/elements/a-tag/index.md).
<del>
<del>**What can I write an article about?**
<del>
<del>We welcome your help in writing these articles. You don't have to be an expert on a topic to write about it. This entire Guide is open source, so even if you make a mistake, another contributor will eventually correct it.
<del>
<del>To help, find a `stub article` on our [Guide website](https://guide.freecodecamp.org), write the article, then open a pull request to replace the stub with your article. A [pull request](https://help.github.com/articles/about-pull-requests/) is how you'll suggest changes. It lets others know about, review, and eventually adopt your changes.
<del>
<del>If you can't find a stub about the topic you'd like to write about, you can open a PR that creates the stub and includes your draft article.
<del>
<del>**If you would like to help improve guide articles, here's [how to work on guide articles](/docs/how-to-work-on-guide-articles.md).**
<del>
<ide> ### Create, Update and Fix Bugs in our coding challenges
<ide>
<ide> All our coding challenges are curated by the community, bringing in expert knowledge from volunteers like you.
<ide> You can help expand them and make their wording clearer. You can update the user
<ide>
<ide> If you're interested in improving these coding challenges, here's [how to work on coding challenges](/docs/how-to-work-on-coding-challenges.md).
<ide>
<del>### Translate guide articles
<del>
<del>You can help us translate our Guide articles for a language that you speak. Currently, we have translated versions in:
<del>
<del>- [Arabic (عربي)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/arabic)
<del>- [Chinese (中文)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/chinese)
<del>- [Portuguese (Português)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/portuguese)
<del>- [Russian (русский)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/russian)
<del>- [Spanish (Español)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/spanish)
<del>
<del>
<del>We would love your help in improving the quality of these translations. Millions of people use the English language version of freeCodeCamp.org, and we expect millions more to use these translated versions as well.
<del>
<del>Note that once we have finished [Version 7.0 of the freeCodeCamp curriculum](https://www.freecodecamp.org/forum/t/help-us-build-version-7-0-of-the-freecodecamp-curriculum/263546) we plan to translate it as well.
<del>
<ide> ### Help us fix bugs in freeCodeCamp.org's learning platform
<ide>
<ide> Our learning platform runs on a modern JavaScript stack. It has various components, tools, and libraries, including but not limited to, Node.js, MongoDB, LoopBack, OAuth 2.0, React, Gatsby, Webpack, and more.
| 1
|
Ruby
|
Ruby
|
bring layouts with proc back alive
|
e274eb1df1dcf526febb7c3a1a8dc2c02325d68c
|
<ide><path>actionpack/lib/abstract_controller/layouts.rb
<ide> def _layout(details)
<ide> end
<ide> end
<ide> ruby_eval
<add> when Proc
<add> define_method :_layout_from_proc, &@_layout
<add> self.class_eval %{def _layout(details) _layout_from_proc(self) end}
<ide> when false
<ide> self.class_eval %{def _layout(details) end}
<ide> when true
<ide><path>actionpack/test/abstract/layouts_test.rb
<ide> class WithStringImpliedChild < WithString
<ide>
<ide> class WithChildOfImplied < WithStringImpliedChild
<ide> end
<del>
<add>
<add> class WithProc < Base
<add> layout proc { |c| "omg" }
<add>
<add> def index
<add> render :_template => ActionView::Template::Text.new("Hello proc!")
<add> end
<add> end
<add>
<ide> class WithSymbol < Base
<ide> layout :hello
<ide>
<ide> class TestBase < ActiveSupport::TestCase
<ide> controller.process(:index)
<ide> assert_equal "Hello nil!", controller.response_body
<ide> end
<add>
<add> test "when layout is specified as a proc, call it and use the layout returned" do
<add> controller = WithProc.new
<add> controller.process(:index)
<add> assert_equal "OMGHI2U Hello proc!", controller.response_body
<add> end
<ide>
<ide> test "when layout is specified as a symbol, call the requested method and use the layout returned" do
<ide> controller = WithSymbol.new
| 2
|
Python
|
Python
|
fix docs for decoder_input_ids
|
8d43c71a1ca3ad322cc45008eb66a5611f1e017e
|
<ide><path>src/transformers/models/bart/modeling_bart.py
<ide> def __init_subclass__(self):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Bart uses the :obj:`eos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/bart/modeling_tf_bart.py
<ide> def serving(self, inputs):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Bart uses the :obj:`eos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/blenderbot/modeling_blenderbot.py
<ide> def dummy_inputs(self):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Blenderbot uses the :obj:`bos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/blenderbot/modeling_tf_blenderbot.py
<ide> def serving(self, inputs):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Blenderbot uses the :obj:`bos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/blenderbot_small/modeling_blenderbot_small.py
<ide> def dummy_inputs(self):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> BlenderbotSmall uses the :obj:`bos_token_id` as the starting token for :obj:`decoder_input_ids` generation.
<ide> If :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/blenderbot_small/modeling_tf_blenderbot_small.py
<ide> def serving(self, inputs):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> BlenderbotSmall uses the :obj:`bos_token_id` as the starting token for :obj:`decoder_input_ids` generation.
<ide> If :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/fsmt/modeling_fsmt.py
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> FSMT uses the :obj:`eos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/m2m_100/modeling_m2m_100.py
<ide> def _init_weights(self, module):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> M2M100 uses the :obj:`eos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/marian/modeling_marian.py
<ide> def dummy_inputs(self):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Marian uses the :obj:`pad_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/marian/modeling_tf_marian.py
<ide> def serving(self, inputs):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Marian uses the :obj:`pad_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/mbart/modeling_mbart.py
<ide> def dummy_inputs(self):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> MBart uses a specific language id token as the starting token for :obj:`decoder_input_ids` generation that
<ide> varies according to source and target language, *e.g.* 25004 for `en_XX`, and 25003 for `de_DE`. If
<ide><path>src/transformers/models/mbart/modeling_tf_mbart.py
<ide> def serving(self, inputs):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> MBart uses a specific language id token as the starting token for :obj:`decoder_input_ids` generation that
<ide> varies according to source and target language, *e.g.* 25004 for `en_XX`, and 25003 for `de_DE`. If
<ide><path>src/transformers/models/pegasus/modeling_pegasus.py
<ide> def dummy_inputs(self):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Pegasus uses the :obj:`pad_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/pegasus/modeling_tf_pegasus.py
<ide> def serving(self, inputs):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> Pegasus uses the :obj:`pad_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/prophetnet/modeling_prophetnet.py
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> ProphetNet uses the :obj:`eos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/speech_to_text/modeling_speech_to_text.py
<ide> def _get_subsampled_encoder_attn_mask(self, attention_mask):
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> SpeechToText uses the :obj:`eos_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
<ide><path>src/transformers/models/t5/modeling_t5.py
<ide> def forward(
<ide> :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for
<ide> details.
<ide>
<del> `What are input IDs? <../glossary.html#input-ids>`__
<add> `What are decoder input IDs? <../glossary.html#decoder-input-ids>`__
<ide>
<ide> T5 uses the :obj:`pad_token_id` as the starting token for :obj:`decoder_input_ids` generation. If
<ide> :obj:`past_key_values` is used, optionally only the last :obj:`decoder_input_ids` have to be input (see
| 17
|
PHP
|
PHP
|
remove incorrect example
|
a6b0480ccc3075083f7f1efdf618707f19fd3bbc
|
<ide><path>src/Database/Query.php
<ide> public function traverseExpressions(callable $callback)
<ide> /**
<ide> * Associates a query placeholder to a value and a type.
<ide> *
<del> * If type is expressed as "atype[]" (note braces) then it will cause the
<del> * placeholder to be re-written dynamically so if the value is an array, it
<del> * will create as many placeholders as values are in it. For example:
<del> *
<ide> * ```
<del> * $query->bind(':id', [1, 2, 3], 'int[]');
<add> * $query->bind(':id', 1, 'integer');
<ide> * ```
<ide> *
<del> * Will create 3 int placeholders. When using named placeholders, this method
<del> * requires that the placeholders include `:` e.g. `:value`.
<del> *
<ide> * @param string|int $param placeholder to be replaced with quoted version
<ide> * of $value
<ide> * @param mixed $value The value to be bound
| 1
|
PHP
|
PHP
|
make existsin rule work with nullable columns
|
49465ec929ae034a1a23fd223682f166036f1b0f
|
<ide><path>src/ORM/Rule/ExistsIn.php
<ide> public function __invoke(EntityInterface $entity, array $options)
<ide> return true;
<ide> }
<ide>
<add> $nulls = 0;
<add> $schema = $this->_repository->schema();
<add> foreach ($this->_fields as $field) {
<add> if ($schema->isNullable($field) && $entity->get($field) === null) {
<add> $nulls++;
<add> }
<add> }
<add> if ($nulls === count($this->_fields)) {
<add> return true;
<add> }
<add>
<ide> $conditions = array_combine(
<ide> (array)$this->_repository->primaryKey(),
<ide> $entity->extract($this->_fields)
<ide><path>tests/TestCase/ORM/RulesCheckerIntegrationTest.php
<ide> public function testExistsInDomainRuleWithObject()
<ide> $this->assertEquals(['_existsIn' => 'Nope'], $entity->errors('author_id'));
<ide> }
<ide>
<add> /**
<add> * ExistsIn uses the schema to verify that nullable fields are ok.
<add> *
<add> * @return
<add> */
<add> public function testExistsInNullValue()
<add> {
<add> $entity = new Entity([
<add> 'title' => 'An Article',
<add> 'author_id' => null
<add> ]);
<add>
<add> $table = TableRegistry::get('Articles');
<add> $table->belongsTo('Authors');
<add> $rules = $table->rulesChecker();
<add> $rules->add($rules->existsIn('author_id', 'Authors'));
<add>
<add> $this->assertEquals($entity, $table->save($entity));
<add> $this->assertEquals([], $entity->errors('author_id'));
<add> }
<add>
<ide> /**
<ide> * Tests the checkRules save option
<ide> *
| 2
|
Python
|
Python
|
add missing spaces
|
4c95508f0f590f4f5900cf7c5a0df698edb77492
|
<ide><path>airflow/bin/cli.py
<ide> def kerberos(args):
<ide> def get_parser():
<ide> parser = argparse.ArgumentParser()
<ide> subparsers = parser.add_subparsers(help='sub-command help', dest='subcommand')
<del> subparsers.required=True
<add> subparsers.required = True
<ide>
<ide> ht = "Run subsections of a DAG for a specified date range"
<ide> parser_backfill = subparsers.add_parser('backfill', help=ht)
| 1
|
Text
|
Text
|
update the changelog
|
548a7a4e2190aba01883bd43704ff0dee229a67d
|
<ide><path>CHANGELOG.md
<ide> * **challenges:** improve template literal challenge instructions ([99f4b9f](https://github.com/freeCodeCamp/curriculum/commit/99f4b9f))
<ide> * **challenges:** inline style semicolon consistency ([3557016](https://github.com/freeCodeCamp/curriculum/commit/3557016)), closes [#17909](https://github.com/freeCodeCamp/curriculum/issues/17909)
<ide> * **challenges:** minor css grid typo ([f147430](https://github.com/freeCodeCamp/curriculum/commit/f147430))
<del>* **challenges:** moved the <em> tag inside the <p> tag ([128794d](https://github.com/freeCodeCamp/curriculum/commit/128794d))
<add>* **challenges:** moved the `<em>` tag inside the `<p>` tag ([128794d](https://github.com/freeCodeCamp/curriculum/commit/128794d))
<ide> * **challenges:** remove obsolete mention of beta and update link [#144](https://github.com/freeCodeCamp/curriculum/issues/144) ([59d98b8](https://github.com/freeCodeCamp/curriculum/commit/59d98b8))
<ide> * **challenges:** replace assertions in authentication with socket.io ([20e3617](https://github.com/freeCodeCamp/curriculum/commit/20e3617)), closes [#82](https://github.com/freeCodeCamp/curriculum/issues/82)
<ide> * **challenges:** typo and grammatical error ([c1160c5](https://github.com/freeCodeCamp/curriculum/commit/c1160c5))
<ide> * **challenges:** Typo errors ([#39](https://github.com/freeCodeCamp/curriculum/issues/39)) ([0c0702d](https://github.com/freeCodeCamp/curriculum/commit/0c0702d))
<ide> * **challenges:** update regular expression that fails ([#56](https://github.com/freeCodeCamp/curriculum/issues/56)) ([9fa5907](https://github.com/freeCodeCamp/curriculum/commit/9fa5907)), closes [#55](https://github.com/freeCodeCamp/curriculum/issues/55)
<ide>
<del>
<del>### BREAKING CHANGES
<del>
<del>* **challenges:** None
<del>
<ide> # [2.0.0](https://github.com/freeCodeCamp/curriculum/compare/v1.2.1...v2.0.0) (2018-06-24)
<ide>
<ide>
<ide>
<ide> * **interview-prep:** Porting Rosetta problems ([#17537](https://github.com/freeCodeCamp/curriculum/issues/17537)) ([21930a8](https://github.com/freeCodeCamp/curriculum/commit/21930a8))
<ide>
<del>
<del>### BREAKING CHANGES
<del>
<del>* **challenges:** none
<del>
<ide> ## [1.2.1](https://github.com/freeCodeCamp/curriculum/compare/v1.2.0...v1.2.1) (2018-06-21)
<ide>
<del>
<ide> ### Bug Fixes
<ide>
<ide> * changes text to bold in the JS Algo and DS ([#20](https://github.com/freeCodeCamp/curriculum/issues/20)) ([999c6af](https://github.com/freeCodeCamp/curriculum/commit/999c6af))
| 1
|
Javascript
|
Javascript
|
use more `for...of` loops in the viewer
|
7e57469683d51c1fffbdc9e9a736f6f176294a3b
|
<ide><path>web/base_viewer.js
<ide> class BaseViewer {
<ide> }
<ide>
<ide> cleanup() {
<del> for (let i = 0, ii = this._pages.length; i < ii; i++) {
<del> if (
<del> this._pages[i] &&
<del> this._pages[i].renderingState !== RenderingStates.FINISHED
<del> ) {
<del> this._pages[i].reset();
<add> for (const pageView of this._pages) {
<add> if (pageView.renderingState !== RenderingStates.FINISHED) {
<add> pageView.reset();
<ide> }
<ide> }
<ide> }
<ide> class BaseViewer {
<ide> * @private
<ide> */
<ide> _cancelRendering() {
<del> for (let i = 0, ii = this._pages.length; i < ii; i++) {
<del> if (this._pages[i]) {
<del> this._pages[i].cancelRendering();
<del> }
<add> for (const pageView of this._pages) {
<add> pageView.cancelRendering();
<ide> }
<ide> }
<ide>
<ide> class BaseViewer {
<ide> viewer.textContent = "";
<ide>
<ide> if (this._spreadMode === SpreadMode.NONE) {
<del> for (let i = 0, ii = pages.length; i < ii; ++i) {
<del> viewer.appendChild(pages[i].div);
<add> for (const pageView of this._pages) {
<add> viewer.appendChild(pageView.div);
<ide> }
<ide> } else {
<ide> const parity = this._spreadMode - 1;
<ide><path>web/pdf_thumbnail_viewer.js
<ide> class PDFThumbnailViewer {
<ide> }
<ide>
<ide> cleanup() {
<del> for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
<del> if (
<del> this._thumbnails[i] &&
<del> this._thumbnails[i].renderingState !== RenderingStates.FINISHED
<del> ) {
<del> this._thumbnails[i].reset();
<add> for (const thumbnail of this._thumbnails) {
<add> if (thumbnail.renderingState !== RenderingStates.FINISHED) {
<add> thumbnail.reset();
<ide> }
<ide> }
<ide> TempImageFactory.destroyCanvas();
<ide> class PDFThumbnailViewer {
<ide> * @private
<ide> */
<ide> _cancelRendering() {
<del> for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
<del> if (this._thumbnails[i]) {
<del> this._thumbnails[i].cancelRendering();
<del> }
<add> for (const thumbnail of this._thumbnails) {
<add> thumbnail.cancelRendering();
<ide> }
<ide> }
<ide>
| 2
|
Ruby
|
Ruby
|
fix rsync for bottles with a revision number
|
8c5a49067ef6ddf96c30cdc4e2e29390b25a1ac7
|
<ide><path>Library/Contributions/cmd/brew-test-bot.rb
<ide> def run
<ide> path = "/home/frs/project/m/ma/machomebrew/Bottles/"
<ide> url = "BrewTestBot,machomebrew@frs.sourceforge.net:#{path}"
<ide> options = "--partial --progress --human-readable --compress"
<del> safe_system "rsync #{options} *.bottle.tar.gz #{url}"
<add> safe_system "rsync #{options} *.bottle*.tar.gz #{url}"
<ide> safe_system "git tag --force #{tag}"
<ide> safe_system "git push --force #{remote} refs/tags/#{tag}"
<ide> exit
| 1
|
PHP
|
PHP
|
add withuseragent to http client
|
adbaf16c2ecea1ed7be657e3f1c4c9f8d77849ca
|
<ide><path>src/Illuminate/Http/Client/PendingRequest.php
<ide> public function withoutRedirecting()
<ide> });
<ide> }
<ide>
<add> /**
<add> * Specify the user agent for the request.
<add> *
<add> * @param string $userAgent
<add> * @return $this
<add> */
<add> public function withUserAgent($userAgent)
<add> {
<add> return $this->withHeaders(['User-Agent' => $userAgent]);
<add> }
<add>
<ide> /**
<ide> * Indicate that TLS certificates should not be verified.
<ide> *
<ide><path>tests/Http/HttpClientTest.php
<ide> public function testItCanSendToken()
<ide> });
<ide> }
<ide>
<add> public function testItCanSendUserAgent()
<add> {
<add> $this->factory->fake();
<add>
<add> $this->factory->withUserAgent('Laravel')->post('http://foo.com/json');
<add>
<add> $this->factory->assertSent(function (Request $request) {
<add> return $request->url() === 'http://foo.com/json' &&
<add> $request->hasHeader('User-Agent', 'Laravel');
<add> });
<add> }
<add>
<ide> public function testSequenceBuilder()
<ide> {
<ide> $this->factory->fake([
| 2
|
Go
|
Go
|
add more tests
|
02f1eb89a42b4a9e91a8c80c213f7dc3193c75b9
|
<ide><path>integration/container/copy_test.go
<ide> func TestCopyToContainerPathIsNotDir(t *testing.T) {
<ide> assert.Assert(t, is.ErrorContains(err, "not a directory"))
<ide> }
<ide>
<del>func TestCopyFromContainerRoot(t *testing.T) {
<add>func TestCopyFromContainer(t *testing.T) {
<ide> skip.If(t, testEnv.DaemonInfo.OSType == "windows")
<ide> defer setupTest(t)()
<ide>
<ide> func TestCopyFromContainerRoot(t *testing.T) {
<ide> defer os.RemoveAll(dir)
<ide>
<ide> buildCtx := fakecontext.New(t, dir, fakecontext.WithFile("foo", "hello"), fakecontext.WithFile("baz", "world"), fakecontext.WithDockerfile(`
<del> FROM scratch
<add> FROM busybox
<ide> COPY foo /foo
<del> COPY baz /bar/baz
<add> COPY baz /bar/quux/baz
<add> RUN ln -s notexist /bar/notarget && ln -s quux/baz /bar/filesymlink && ln -s quux /bar/dirsymlink && ln -s / /bar/root
<ide> CMD /fake
<ide> `))
<ide> defer buildCtx.Close()
<ide> func TestCopyFromContainerRoot(t *testing.T) {
<ide>
<ide> cid := container.Create(ctx, t, apiClient, container.WithImage(imageID))
<ide>
<del> rdr, _, err := apiClient.CopyFromContainer(ctx, cid, "/")
<del> assert.NilError(t, err)
<del> defer rdr.Close()
<del>
<del> tr := tar.NewReader(rdr)
<del> expect := map[string]string{
<del> "/foo": "hello",
<del> "/bar/baz": "world",
<add> for _, x := range []struct {
<add> src string
<add> expect map[string]string
<add> }{
<add> {"/", map[string]string{"/": "", "/foo": "hello", "/bar/quux/baz": "world", "/bar/filesymlink": "", "/bar/dirsymlink": "", "/bar/notarget": ""}},
<add> {"/bar/root", map[string]string{"root": ""}},
<add> {"/bar/root/", map[string]string{"root/": "", "root/foo": "hello", "root/bar/quux/baz": "world", "root/bar/filesymlink": "", "root/bar/dirsymlink": "", "root/bar/notarget": ""}},
<add>
<add> {"bar/quux", map[string]string{"quux/": "", "quux/baz": "world"}},
<add> {"bar/quux/", map[string]string{"quux/": "", "quux/baz": "world"}},
<add> {"bar/quux/baz", map[string]string{"baz": "world"}},
<add>
<add> {"bar/filesymlink", map[string]string{"filesymlink": ""}},
<add> {"bar/dirsymlink", map[string]string{"dirsymlink": ""}},
<add> {"bar/dirsymlink/", map[string]string{"dirsymlink/": "", "dirsymlink/baz": "world"}},
<add> {"bar/notarget", map[string]string{"notarget": ""}},
<add> } {
<add> t.Run(x.src, func(t *testing.T) {
<add> rdr, _, err := apiClient.CopyFromContainer(ctx, cid, x.src)
<add> assert.NilError(t, err)
<add> defer rdr.Close()
<add>
<add> found := make(map[string]bool, len(x.expect))
<add> var numFound int
<add> tr := tar.NewReader(rdr)
<add> for numFound < len(x.expect) {
<add> h, err := tr.Next()
<add> if err == io.EOF {
<add> break
<add> }
<add> assert.NilError(t, err)
<add>
<add> expected, exists := x.expect[h.Name]
<add> if !exists {
<add> // this archive will have extra stuff in it since we are copying from root
<add> // and docker adds a bunch of stuff
<add> continue
<add> }
<add>
<add> numFound++
<add> found[h.Name] = true
<add>
<add> buf, err := ioutil.ReadAll(tr)
<add> if err == nil {
<add> assert.Check(t, is.Equal(string(buf), expected))
<add> }
<add> }
<add>
<add> for f := range x.expect {
<add> assert.Check(t, found[f], f+" not found in archive")
<add> }
<add> })
<ide> }
<del> found := make(map[string]bool, 2)
<del> var numFound int
<del> for {
<del> h, err := tr.Next()
<del> if err == io.EOF {
<del> break
<del> }
<del> assert.NilError(t, err)
<del>
<del> expected, exists := expect[h.Name]
<del> if !exists {
<del> // this archive will have extra stuff in it since we are copying from root
<del> // and docker adds a bunch of stuff
<del> continue
<del> }
<del>
<del> numFound++
<del> found[h.Name] = true
<del>
<del> buf, err := ioutil.ReadAll(tr)
<del> assert.NilError(t, err)
<del> assert.Check(t, is.Equal(string(buf), expected))
<del>
<del> if numFound == len(expect) {
<del> break
<del> }
<del> }
<del>
<del> assert.Check(t, found["/foo"], "/foo file not found in archive")
<del> assert.Check(t, found["/bar/baz"], "/bar/baz file not found in archive")
<ide> }
| 1
|
Python
|
Python
|
remove references to missing files from install
|
42aa77ff622fbcf7604a7842babb2c3a9961209a
|
<ide><path>numpy/f2py/setup.py
<ide> def configuration(parent_package='',top_path=None):
<ide> config = Configuration('f2py', parent_package, top_path)
<ide>
<del> config.add_data_dir('docs')
<ide> config.add_data_dir('tests')
<ide>
<ide> config.add_data_files('src/fortranobject.c',
<ide> 'src/fortranobject.h',
<del> 'f2py.1'
<ide> )
<ide>
<ide> config.make_svn_version_py()
<ide><path>numpy/lib/setup.py
<ide> def configuration(parent_package='',top_path=None):
<ide> sources=[join('src', '_compiled_base.c')]
<ide> )
<ide>
<del> config.add_data_dir('benchmarks')
<ide> config.add_data_dir('tests')
<ide>
<ide> return config
| 2
|
Ruby
|
Ruby
|
fix variable name
|
b42259f628eb6c7452b3d54b54b1fbd699c8c794
|
<ide><path>Library/Homebrew/cmd/test.rb
<ide> def test
<ide> if Sandbox.available? && ARGV.sandbox?
<ide> sandbox = Sandbox.new
<ide> formula.logs.mkpath
<del> sandbox.record_log(formula.logs/"sandbox.test.log")
<add> sandbox.record_log(f.logs/"sandbox.test.log")
<ide> sandbox.allow_write_temp_and_cache
<ide> sandbox.allow_write_log(f)
<ide> sandbox.exec(*args)
| 1
|
PHP
|
PHP
|
make underscore and dasherize consistent
|
11c03e0aa0e3c343d2fd5fcac5cc0818c4cdd0e6
|
<ide><path>src/Utility/Inflector.php
<ide> public static function camelize($string, $replacement = '_')
<ide> */
<ide> public static function underscore($string)
<ide> {
<del> return static::normalize($string, '_');
<add> return static::delimit(str_replace('-', '_', $string), '_');
<ide> }
<ide>
<ide> /**
<ide> public static function underscore($string)
<ide> */
<ide> public static function dasherize($string)
<ide> {
<del> return static::normalize($string, '-');
<add> return static::delimit(str_replace('_', '-', $string), '-');
<ide> }
<ide>
<ide> /**
<ide> public static function humanize($string, $replacement = '_')
<ide> }
<ide>
<ide> /**
<del> * Takes the input string, and based on the replacement character converts to a normalized string
<add> * Takes the input string, and based on the replacement character converts to a delimited string
<ide> *
<del> * @param string $string String to normalize
<add> * @param string $string String to delimit
<ide> * @param string $replacement the character to use as a delimiter
<del> * @return string normalized string
<add> * @return string delimited string
<ide> */
<del> public static function normalize($string, $replacement = '_')
<add> public static function delimit($string, $replacement = '_')
<ide> {
<ide> $cacheKey = __FUNCTION__ . $replacement;
<ide>
<ide><path>tests/TestCase/Utility/InflectorTest.php
<ide> public function testInflectorUnderscore()
<ide> $this->assertSame('test_thing', Inflector::underscore('testThing'));
<ide> $this->assertSame('test_thing_extra', Inflector::underscore('TestThingExtra'));
<ide> $this->assertSame('test_thing_extra', Inflector::underscore('testThingExtra'));
<add> $this->assertSame('test_this_thing', Inflector::underscore('test-this-thing'));
<ide>
<ide> // Identical checks test the cache code path.
<ide> $this->assertSame('test_thing', Inflector::underscore('TestThing'));
<ide> public function testDasherized()
<ide> $this->assertSame('test-thing', Inflector::dasherize('testThing'));
<ide> $this->assertSame('test-thing-extra', Inflector::dasherize('TestThingExtra'));
<ide> $this->assertSame('test-thing-extra', Inflector::dasherize('testThingExtra'));
<del> $this->assertSame('test_this_thing', Inflector::dasherize('test_this_thing'), 'Should be unchanged');
<add> $this->assertSame('test-this-thing', Inflector::dasherize('test_this_thing'));
<ide>
<ide> // Test stupid values
<ide> $this->assertSame('', Inflector::dasherize(null));
| 2
|
Javascript
|
Javascript
|
add tests for d3.locale
|
8b1e0ea9fec70b0c68498f12a797f69d8baeb884
|
<ide><path>src/locale/ru-RU.js
<ide> import "locale";
<ide>
<del>var d3_locale_ruRU = d3.locale({
<add>d3.locale.ru_RU = d3.locale({
<ide> decimal: ",",
<ide> thousands: " ",
<ide> grouping: [3, 3],
<ide><path>test/locale/locale-test.js
<add>var vows = require("vows"),
<add> load = require("../load"),
<add> assert = require("../assert"),
<add> time = require("../time/time"),
<add> local = time.local;
<add>
<add>var suite = vows.describe("d3.locale");
<add>
<add>suite.addBatch({
<add> "locale": {
<add> topic: load("locale/ru-RU").expression("d3.locale.ru_RU"),
<add>
<add> "numberFormat": {
<add> topic: function(locale) {
<add> return locale.numberFormat;
<add> },
<add> "formats numbers": function(format) {
<add> var f = format(",.2f");
<add> assert.equal(f(12345.67), "12 345,67");
<add> },
<add> "formats currencies": function(format) {
<add> var f = format("$,.2f");
<add> assert.equal(f(12345.67), "12 345,67 руб.");
<add> }
<add> },
<add>
<add> "timeFormat": {
<add> topic: function(locale) {
<add> return locale.timeFormat;
<add> },
<add>
<add> "format": {
<add> "formats locale date and time": function(format) {
<add> var f = format("%c");
<add> assert.equal(f(local(1990, 0, 1)), "понедельник, 1 января 1990 г. 00:00:00");
<add> },
<add> "formats locale date": function(format) {
<add> var f = format("%x");
<add> assert.equal(f(local(1990, 0, 1)), "01.01.1990");
<add> },
<add> "formats locale time": function(format) {
<add> var f = format("%X");
<add> assert.equal(f(local(1990, 0, 1)), "00:00:00");
<add> },
<add> "formats abbreviated weekday": function(format) {
<add> var f = format("%a");
<add> assert.equal(f(local(1990, 0, 1)), "пн");
<add> assert.equal(f(local(1990, 0, 2)), "вт");
<add> assert.equal(f(local(1990, 0, 3)), "ср");
<add> assert.equal(f(local(1990, 0, 4)), "чт");
<add> assert.equal(f(local(1990, 0, 5)), "пт");
<add> assert.equal(f(local(1990, 0, 6)), "сб");
<add> assert.equal(f(local(1990, 0, 7)), "вс");
<add> },
<add> "formats weekday": function(format) {
<add> var f = format("%A");
<add> assert.equal(f(local(1990, 0, 1)), "понедельник");
<add> assert.equal(f(local(1990, 0, 2)), "вторник");
<add> assert.equal(f(local(1990, 0, 3)), "среда");
<add> assert.equal(f(local(1990, 0, 4)), "четверг");
<add> assert.equal(f(local(1990, 0, 5)), "пятница");
<add> assert.equal(f(local(1990, 0, 6)), "суббота");
<add> assert.equal(f(local(1990, 0, 7)), "воскресенье");
<add> },
<add> "formats abbreviated month": function(format) {
<add> var f = format("%b");
<add> assert.equal(f(local(1990, 0, 1)), "янв");
<add> assert.equal(f(local(1990, 1, 1)), "фев");
<add> assert.equal(f(local(1990, 2, 1)), "мар");
<add> assert.equal(f(local(1990, 3, 1)), "апр");
<add> assert.equal(f(local(1990, 4, 1)), "май");
<add> assert.equal(f(local(1990, 5, 1)), "июн");
<add> assert.equal(f(local(1990, 6, 1)), "июл");
<add> assert.equal(f(local(1990, 7, 1)), "авг");
<add> assert.equal(f(local(1990, 8, 1)), "сен");
<add> assert.equal(f(local(1990, 9, 1)), "окт");
<add> assert.equal(f(local(1990, 10, 1)), "ноя");
<add> assert.equal(f(local(1990, 11, 1)), "дек");
<add> },
<add> "formats month": function(format) {
<add> var f = format("%B");
<add> assert.equal(f(local(1990, 0, 1)), "января");
<add> assert.equal(f(local(1990, 1, 1)), "февраля");
<add> assert.equal(f(local(1990, 2, 1)), "марта");
<add> assert.equal(f(local(1990, 3, 1)), "апреля");
<add> assert.equal(f(local(1990, 4, 1)), "мая");
<add> assert.equal(f(local(1990, 5, 1)), "июня");
<add> assert.equal(f(local(1990, 6, 1)), "июля");
<add> assert.equal(f(local(1990, 7, 1)), "августа");
<add> assert.equal(f(local(1990, 8, 1)), "сентября");
<add> assert.equal(f(local(1990, 9, 1)), "октября");
<add> assert.equal(f(local(1990, 10, 1)), "ноября");
<add> assert.equal(f(local(1990, 11, 1)), "декабря");
<add> },
<add> "formats AM or PM": function(format) {
<add> var f = format("%p");
<add> assert.equal(f(local(1990, 0, 1, 0)), "AM");
<add> assert.equal(f(local(1990, 0, 1, 13)), "PM");
<add> }
<add> },
<add>
<add> "parse": {
<add> "parses locale date and time": function(format) {
<add> var p = format("%c").parse;
<add> assert.deepEqual(p("понедельник, 1 января 1990 г. 00:00:00"), local(1990, 0, 1));
<add> },
<add> "parses locale date": function(format) {
<add> var p = format("%x").parse;
<add> assert.deepEqual(p("01.01.1990"), local(1990, 0, 1));
<add> }
<add> }
<add> }
<add> }
<add>});
<add>
<add>suite.export(module);
<ide><path>test/time/format-test.js
<ide> suite.addBatch({
<ide> assert.equal(f(local(1990, 10, 1)), "Nov");
<ide> assert.equal(f(local(1990, 11, 1)), "Dec");
<ide> },
<add> "formats month": function(format) {
<add> var f = format("%B");
<add> assert.equal(f(local(1990, 0, 1)), "January");
<add> assert.equal(f(local(1990, 1, 1)), "February");
<add> assert.equal(f(local(1990, 2, 1)), "March");
<add> assert.equal(f(local(1990, 3, 1)), "April");
<add> assert.equal(f(local(1990, 4, 1)), "May");
<add> assert.equal(f(local(1990, 5, 1)), "June");
<add> assert.equal(f(local(1990, 6, 1)), "July");
<add> assert.equal(f(local(1990, 7, 1)), "August");
<add> assert.equal(f(local(1990, 8, 1)), "September");
<add> assert.equal(f(local(1990, 9, 1)), "October");
<add> assert.equal(f(local(1990, 10, 1)), "November");
<add> assert.equal(f(local(1990, 11, 1)), "December");
<add> },
<ide> "formats locale date and time": function(format) {
<ide> var f = format("%c");
<ide> assert.equal(f(local(1990, 0, 1)), "Mon Jan 1 00:00:00 1990");
| 3
|
Javascript
|
Javascript
|
convert vars into let/const
|
2a1b1f3094e524338b3eb3de51b23921576f02f5
|
<ide><path>packages/react-test-renderer/index.js
<ide>
<ide> 'use strict';
<ide>
<del>var ReactTestRenderer = require('./src/ReactTestRenderer');
<add>const ReactTestRenderer = require('./src/ReactTestRenderer');
<ide>
<ide> // TODO: decide on the top-level export form.
<ide> // This is hacky but makes it work with both Rollup and Jest.
<ide><path>packages/react-test-renderer/shallow.js
<ide>
<ide> 'use strict';
<ide>
<del>var ReactShallowRenderer = require('./src/ReactShallowRenderer');
<add>const ReactShallowRenderer = require('./src/ReactShallowRenderer');
<ide>
<ide> // TODO: decide on the top-level export form.
<ide> // This is hacky but makes it work with both Rollup and Jest.
<ide><path>packages/react-test-renderer/src/ReactShallowRenderer.js
<ide> class Updater {
<ide> }
<ide> }
<ide>
<del>var currentlyValidatingElement = null;
<add>let currentlyValidatingElement = null;
<ide>
<ide> function getDisplayName(element) {
<ide> if (element == null) {
<ide> function getDisplayName(element) {
<ide> }
<ide>
<ide> function getStackAddendum() {
<del> var stack = '';
<add> let stack = '';
<ide> if (currentlyValidatingElement) {
<del> var name = getDisplayName(currentlyValidatingElement);
<del> var owner = currentlyValidatingElement._owner;
<add> const name = getDisplayName(currentlyValidatingElement);
<add> const owner = currentlyValidatingElement._owner;
<ide> stack += describeComponentFrame(
<ide> name,
<ide> currentlyValidatingElement._source,
<ide> function getStackAddendum() {
<ide> }
<ide>
<ide> function getName(type, instance) {
<del> var constructor = instance && instance.constructor;
<add> const constructor = instance && instance.constructor;
<ide> return (
<ide> type.displayName ||
<ide> (constructor && constructor.displayName) ||
<ide><path>packages/react-test-renderer/src/ReactTestRenderer.js
<ide> function removeChild(
<ide> parentInstance.children.splice(index, 1);
<ide> }
<ide>
<del>var TestRenderer = ReactFiberReconciler({
<add>const TestRenderer = ReactFiberReconciler({
<ide> getRootHostContext() {
<ide> return emptyObject;
<ide> },
<ide> var TestRenderer = ReactFiberReconciler({
<ide> },
<ide> });
<ide>
<del>var defaultTestOptions = {
<add>const defaultTestOptions = {
<ide> createNodeMock: function() {
<ide> return null;
<ide> },
<ide> function toJSON(inst: Instance | TextInstance): ReactTestRendererNode {
<ide> }
<ide>
<ide> function nodeAndSiblingsTrees(nodeWithSibling: ?Fiber) {
<del> var array = [];
<del> var node = nodeWithSibling;
<add> const array = [];
<add> let node = nodeWithSibling;
<ide> while (node != null) {
<ide> array.push(node);
<ide> node = node.sibling;
<ide> function propsMatch(props: Object, filter: Object): boolean {
<ide> return true;
<ide> }
<ide>
<del>var ReactTestRendererFiber = {
<add>const ReactTestRendererFiber = {
<ide> create(element: React$Element<any>, options: TestRendererOptions) {
<del> var createNodeMock = defaultTestOptions.createNodeMock;
<add> let createNodeMock = defaultTestOptions.createNodeMock;
<ide> if (options && typeof options.createNodeMock === 'function') {
<ide> createNodeMock = options.createNodeMock;
<ide> }
<del> var container = {
<add> let container = {
<ide> children: [],
<ide> createNodeMock,
<ide> tag: 'CONTAINER',
<ide> };
<del> var root: FiberRoot | null = TestRenderer.createContainer(container, false);
<add> let root: FiberRoot | null = TestRenderer.createContainer(container, false);
<ide> invariant(root != null, 'something went wrong');
<ide> TestRenderer.updateContainer(element, root, null, null);
<ide>
<del> var entry = {
<add> const entry = {
<ide> root: undefined, // makes flow happy
<ide> // we define a 'getter' for 'root' below using 'Object.defineProperty'
<ide> toJSON() {
<ide><path>packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js
<ide> describe('ReactShallowRenderer', () => {
<ide> spyOnDev(console, 'error');
<ide> const shallowRenderer = createRenderer();
<ide>
<del> var Undef = undefined;
<add> const Undef = undefined;
<ide> expect(() => shallowRenderer.render(<Undef />)).toThrowError(
<ide> 'ReactShallowRenderer render(): Shallow rendering works only with custom ' +
<ide> 'components, but the provided element type was `undefined`.',
<ide> );
<ide>
<del> var Null = null;
<add> const Null = null;
<ide> expect(() => shallowRenderer.render(<Null />)).toThrowError(
<ide> 'ReactShallowRenderer render(): Shallow rendering works only with custom ' +
<ide> 'components, but the provided element type was `null`.',
<ide> );
<ide>
<del> var Arr = [];
<add> const Arr = [];
<ide> expect(() => shallowRenderer.render(<Arr />)).toThrowError(
<ide> 'ReactShallowRenderer render(): Shallow rendering works only with custom ' +
<ide> 'components, but the provided element type was `array`.',
<ide> );
<ide>
<del> var Obj = {};
<add> const Obj = {};
<ide> expect(() => shallowRenderer.render(<Obj />)).toThrowError(
<ide> 'ReactShallowRenderer render(): Shallow rendering works only with custom ' +
<ide> 'components, but the provided element type was `object`.',
<ide><path>packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js
<ide>
<ide> 'use strict';
<ide>
<del>var React = require('react');
<del>var ReactTestRenderer = require('react-test-renderer');
<del>var prettyFormat = require('pretty-format');
<add>const React = require('react');
<add>const ReactTestRenderer = require('react-test-renderer');
<add>const prettyFormat = require('pretty-format');
<ide>
<ide> // Kind of hacky, but we nullify all the instances to test the tree structure
<ide> // with jasmine's deep equality function, and test the instances separate. We
<ide> function cleanNodeOrArray(node) {
<ide> }
<ide> if (node && node.props && node.props.children) {
<ide> // eslint-disable-next-line no-unused-vars
<del> var {children, ...props} = node.props;
<add> const {children, ...props} = node.props;
<ide> node.props = props;
<ide> }
<ide> if (Array.isArray(node.rendered)) {
<ide> describe('ReactTestRenderer', () => {
<ide> function Link() {
<ide> return <a role="link" />;
<ide> }
<del> var renderer = ReactTestRenderer.create(<Link />);
<add> const renderer = ReactTestRenderer.create(<Link />);
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'a',
<ide> props: {role: 'link'},
<ide> describe('ReactTestRenderer', () => {
<ide> function Empty() {
<ide> return null;
<ide> }
<del> var renderer = ReactTestRenderer.create(<Empty />);
<add> const renderer = ReactTestRenderer.create(<Empty />);
<ide> expect(renderer.toJSON()).toEqual(null);
<ide> });
<ide>
<ide> it('exposes a type flag', () => {
<ide> function Link() {
<ide> return <a role="link" />;
<ide> }
<del> var renderer = ReactTestRenderer.create(<Link />);
<del> var object = renderer.toJSON();
<add> const renderer = ReactTestRenderer.create(<Link />);
<add> const object = renderer.toJSON();
<ide> expect(object.$$typeof).toBe(Symbol.for('react.test.json'));
<ide>
<ide> // $$typeof should not be enumerable.
<del> for (var key in object) {
<add> for (const key in object) {
<ide> if (object.hasOwnProperty(key)) {
<ide> expect(key).not.toBe('$$typeof');
<ide> }
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var Child = () => {
<add> const Child = () => {
<ide> return <moo />;
<ide> };
<ide>
<del> var renderer = ReactTestRenderer.create(<Component />);
<add> const renderer = ReactTestRenderer.create(<Component />);
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> props: {className: 'purple'},
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('renders some basics with an update', () => {
<del> var renders = 0;
<add> let renders = 0;
<ide>
<ide> class Component extends React.Component {
<ide> state = {x: 3};
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var Child = () => {
<add> const Child = () => {
<ide> renders++;
<ide> return <moo />;
<ide> };
<ide>
<del> var Null = () => {
<add> const Null = () => {
<ide> renders++;
<ide> return null;
<ide> };
<ide>
<del> var renderer = ReactTestRenderer.create(<Component />);
<add> const renderer = ReactTestRenderer.create(<Component />);
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> props: {className: 'purple'},
<ide> describe('ReactTestRenderer', () => {
<ide> return <div>{this.state.mouse}</div>;
<ide> }
<ide> }
<del> var renderer = ReactTestRenderer.create(<Mouse />);
<add> const renderer = ReactTestRenderer.create(<Mouse />);
<ide>
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> props: {},
<ide> children: ['mouse'],
<ide> });
<ide>
<del> var mouse = renderer.getInstance();
<add> const mouse = renderer.getInstance();
<ide> mouse.handleMoose();
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('updates types', () => {
<del> var renderer = ReactTestRenderer.create(<div>mouse</div>);
<add> const renderer = ReactTestRenderer.create(<div>mouse</div>);
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> props: {},
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('updates children', () => {
<del> var renderer = ReactTestRenderer.create(
<add> const renderer = ReactTestRenderer.create(
<ide> <div>
<ide> <span key="a">A</span>
<ide> <span key="b">B</span>
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('does the full lifecycle', () => {
<del> var log = [];
<add> const log = [];
<ide> class Log extends React.Component {
<ide> render() {
<ide> log.push('render ' + this.props.name);
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var renderer = ReactTestRenderer.create(<Log key="foo" name="Foo" />);
<add> const renderer = ReactTestRenderer.create(<Log key="foo" name="Foo" />);
<ide> renderer.update(<Log key="bar" name="Bar" />);
<ide> renderer.unmount();
<ide>
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('gives a ref to native components', () => {
<del> var log = [];
<add> const log = [];
<ide> ReactTestRenderer.create(<div ref={r => log.push(r)} />);
<ide> expect(log).toEqual([null]);
<ide> });
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('allows an optional createNodeMock function', () => {
<del> var mockDivInstance = {appendChild: () => {}};
<del> var mockInputInstance = {focus: () => {}};
<del> var mockListItemInstance = {click: () => {}};
<del> var mockAnchorInstance = {hover: () => {}};
<del> var log = [];
<add> const mockDivInstance = {appendChild: () => {}};
<add> const mockInputInstance = {focus: () => {}};
<add> const mockListItemInstance = {click: () => {}};
<add> const mockAnchorInstance = {hover: () => {}};
<add> const log = [];
<ide> class Foo extends React.Component {
<ide> componentDidMount() {
<ide> log.push(this.refs.bar);
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('supports error boundaries', () => {
<del> var log = [];
<add> const log = [];
<ide> class Angry extends React.Component {
<ide> render() {
<ide> log.push('Angry render');
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var renderer = ReactTestRenderer.create(<Boundary />);
<add> const renderer = ReactTestRenderer.create(<Boundary />);
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> props: {},
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var renderer = ReactTestRenderer.create(<Component>Hi</Component>);
<add> const renderer = ReactTestRenderer.create(<Component>Hi</Component>);
<ide> expect(renderer.toJSON()).toEqual({
<ide> type: 'div',
<ide> children: ['Hi'],
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('toTree() renders simple components returning host components', () => {
<del> var Qoo = () => <span className="Qoo">Hello World!</span>;
<add> const Qoo = () => <span className="Qoo">Hello World!</span>;
<ide>
<del> var renderer = ReactTestRenderer.create(<Qoo />);
<del> var tree = renderer.toTree();
<add> const renderer = ReactTestRenderer.create(<Qoo />);
<add> const tree = renderer.toTree();
<ide>
<ide> cleanNodeOrArray(tree);
<ide>
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var renderer = ReactTestRenderer.create(<Foo />);
<del> var tree = renderer.toTree();
<add> const renderer = ReactTestRenderer.create(<Foo />);
<add> const tree = renderer.toTree();
<ide>
<ide> expect(tree.instance).toBeInstanceOf(Foo);
<ide>
<ide> describe('ReactTestRenderer', () => {
<ide> </Foo>,
<ide> );
<ide>
<del> var tree = renderer.toTree();
<add> const tree = renderer.toTree();
<ide>
<ide> cleanNodeOrArray(tree);
<ide>
<ide> describe('ReactTestRenderer', () => {
<ide> </div>,
<ide> );
<ide>
<del> var tree = renderer.toTree();
<add> const tree = renderer.toTree();
<ide>
<ide> cleanNodeOrArray(tree);
<ide>
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('root instance and createNodeMock ref return the same value', () => {
<del> var createNodeMock = ref => ({node: ref});
<del> var refInst = null;
<del> var renderer = ReactTestRenderer.create(
<add> const createNodeMock = ref => ({node: ref});
<add> let refInst = null;
<add> const renderer = ReactTestRenderer.create(
<ide> <div ref={ref => (refInst = ref)} />,
<ide> {createNodeMock},
<ide> );
<del> var root = renderer.getInstance();
<add> const root = renderer.getInstance();
<ide> expect(root).toEqual(refInst);
<ide> });
<ide>
<ide> it('toTree() renders complicated trees of composites and hosts', () => {
<ide> // SFC returning host. no children props.
<del> var Qoo = () => <span className="Qoo">Hello World!</span>;
<add> const Qoo = () => <span className="Qoo">Hello World!</span>;
<ide>
<ide> // SFC returning host. passes through children.
<del> var Foo = ({className, children}) => (
<add> const Foo = ({className, children}) => (
<ide> <div className={'Foo ' + className}>
<ide> <span className="Foo2">Literal</span>
<ide> {children}
<ide> describe('ReactTestRenderer', () => {
<ide> }
<ide> }
<ide>
<del> var renderer = ReactTestRenderer.create(<Bam />);
<del> var tree = renderer.toTree();
<add> const renderer = ReactTestRenderer.create(<Bam />);
<add> const tree = renderer.toTree();
<ide>
<ide> // we test for the presence of instances before nulling them out
<ide> expect(tree.instance).toBeInstanceOf(Bam);
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('can update text nodes when rendered as root', () => {
<del> var renderer = ReactTestRenderer.create(['Hello', 'world']);
<add> const renderer = ReactTestRenderer.create(['Hello', 'world']);
<ide> expect(renderer.toJSON()).toEqual(['Hello', 'world']);
<ide> renderer.update(42);
<ide> expect(renderer.toJSON()).toEqual('42');
<ide> describe('ReactTestRenderer', () => {
<ide> });
<ide>
<ide> it('can render and update root fragments', () => {
<del> var Component = props => props.children;
<add> const Component = props => props.children;
<ide>
<del> var renderer = ReactTestRenderer.create([
<add> const renderer = ReactTestRenderer.create([
<ide> <Component key="a">Hi</Component>,
<ide> <Component key="b">Bye</Component>,
<ide> ]);
| 6
|
Python
|
Python
|
address a few legacy issues in the test
|
b6780b59c39a32a5acb890a5e75475935b389343
|
<ide><path>official/nlp/modeling/layers/tn_expand_condense_test.py
<ide> from absl.testing import parameterized
<ide> import numpy as np
<ide> import tensorflow as tf
<del># pylint: disable=g-direct-tensorflow-import
<del>from tensorflow.python.keras.testing_utils import layer_test
<ide> from official.nlp.modeling.layers.tn_expand_condense import TNExpandCondense
<ide>
<ide>
<ide> def _build_model(self, data, proj_multiple=2):
<ide>
<ide> @parameterized.parameters((768, 6), (1024, 2))
<ide> def test_keras_layer(self, input_dim, proj_multiple):
<del> self.skipTest('Disable the test for now since it imports '
<del> 'keras.testing_utils, will reenable this test after we '
<del> 'fix the b/184578869')
<del> # TODO(scottzhu): Reenable after fix b/184578869
<ide> data = np.random.normal(size=(100, input_dim))
<ide> data = data.astype(np.float32)
<del> layer_test(
<add> tf.keras.__internal__.utils.layer_test(
<ide> TNExpandCondense,
<ide> kwargs={
<ide> 'proj_multiplier': proj_multiple,
<ide> def test_keras_layer(self, input_dim, proj_multiple):
<ide>
<ide> @parameterized.parameters((768, 6), (1024, 2))
<ide> def test_train(self, input_dim, proj_multiple):
<add> tf.keras.utils.set_random_seed(0)
<ide> data = np.random.randint(10, size=(100, input_dim))
<ide> model = self._build_model(data, proj_multiple)
<del> tf.keras.utils.set_random_seed(0)
<ide>
<ide> model.compile(
<ide> optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
| 1
|
Ruby
|
Ruby
|
remove old call to sprockets context
|
59baf2fc9c5e7aaf56cf36fdd70d9ecbc7a4a336
|
<ide><path>actionpack/lib/sprockets/railtie.rb
<ide> def self.using_scss?
<ide> app.assets = asset_environment(app)
<ide>
<ide> ActiveSupport.on_load(:action_view) do
<del> if app.assets.respond_to?(:context_class)
<del> context = app.assets.context_class
<del>
<del> # TODO: Remove this condition when Sprockets 2.0.beta.3 is released
<del> else
<del> context = app.assets.context
<del> end
<del>
<del> context.instance_eval do
<add> app.assets.context_class.instance_eval do
<ide> include ::ActionView::Helpers::SprocketsHelper
<ide> end
<ide> end
| 1
|
PHP
|
PHP
|
update example test
|
a536402228108da9423a0db1e0cf492f3f51c8b8
|
<ide><path>tests/Feature/ExampleTest.php
<ide> namespace Tests\Feature;
<ide>
<ide> use Tests\TestCase;
<del>use Illuminate\Foundation\Testing\WithoutMiddleware;
<del>use Illuminate\Foundation\Testing\DatabaseMigrations;
<del>use Illuminate\Foundation\Testing\DatabaseTransactions;
<add>use Illuminate\Foundation\Testing\FreshDatabase;
<ide>
<ide> class ExampleTest extends TestCase
<ide> {
<add> use FreshDatabase;
<add>
<ide> /**
<ide> * A basic test example.
<ide> *
| 1
|
Java
|
Java
|
remove unused code
|
f5f03929792c03b02ad5b7294eaaed18ce6021bc
|
<ide><path>src/main/java/rx/internal/util/MpscPaddedQueue.java
<del>/**
<del> * Copyright 2014 Netflix, Inc.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License"); you may not
<del> * use this file except in compliance with the License. You may obtain a copy of
<del> * the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
<del> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
<del> * License for the specific language governing permissions and limitations under
<del> * the License.
<del> */
<del>package rx.internal.util;
<del>
<del>import static java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater;
<del>
<del>import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
<del>
<del>import rx.internal.util.MpscPaddedQueue.Node;
<del>
<del>abstract class MpscLinkedQueuePad0<E> {
<del> long p00, p01, p02, p03, p04, p05, p06, p07;
<del> long p30, p31, p32, p33, p34, p35, p36, p37;
<del>}
<del>
<del>abstract class MpscLinkedQueueHeadRef<E> extends MpscLinkedQueuePad0<E> {
<del> @SuppressWarnings("rawtypes")
<del> private static final AtomicReferenceFieldUpdater<MpscLinkedQueueHeadRef, Node> UPDATER =
<del> newUpdater(MpscLinkedQueueHeadRef.class, Node.class, "headRef");
<del> private volatile Node<E> headRef;
<del>
<del> protected final Node<E> headRef() {
<del> return headRef;
<del> }
<del> protected final void headRef(Node<E> val) {
<del> headRef = val;
<del> }
<del> protected final void lazySetHeadRef(Node<E> newVal) {
<del> UPDATER.lazySet(this, newVal);
<del> }
<del>}
<del>
<del>abstract class MpscLinkedQueuePad1<E> extends MpscLinkedQueueHeadRef<E> {
<del> long p00, p01, p02, p03, p04, p05, p06, p07;
<del> long p30, p31, p32, p33, p34, p35, p36, p37;
<del>}
<del>
<del>abstract class MpscLinkedQueueTailRef<E> extends MpscLinkedQueuePad1<E> {
<del> @SuppressWarnings("rawtypes")
<del> private static final AtomicReferenceFieldUpdater<MpscLinkedQueueTailRef, Node> UPDATER =
<del> newUpdater(MpscLinkedQueueTailRef.class, Node.class, "tailRef");
<del> private volatile Node<E> tailRef;
<del> protected final Node<E> tailRef() {
<del> return tailRef;
<del> }
<del> protected final void tailRef(Node<E> val) {
<del> tailRef = val;
<del> }
<del> @SuppressWarnings("unchecked")
<del> protected final Node<E> getAndSetTailRef(Node<E> newVal) {
<del> return (Node<E>) UPDATER.getAndSet(this, newVal);
<del> }
<del>}
<del>/**
<del> * A multiple-producer single consumer queue implementation with padded reference to tail to avoid cache-line
<del> * thrashing. Based on Netty's <a href='https://github.com/netty/netty/blob/master/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java'>MpscQueue implementation</a>
<del> * but using {@code AtomicReferenceFieldUpdater} instead of {@code Unsafe}.<br>
<del> * Original algorithm presented <a
<del> * href="http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue"> on 1024
<del> * Cores</a> by D. Vyukov.<br>
<del> * Data structure modified to avoid false sharing between head and tail references as per implementation of
<del> * MpscLinkedQueue on <a href="https://github.com/JCTools/JCTools">JCTools project</a>.
<del> *
<del> * @param <E> the element type
<del> */
<del>public final class MpscPaddedQueue<E> extends MpscLinkedQueueTailRef<E> {
<del> long p00, p01, p02, p03, p04, p05, p06, p07;
<del> long p30, p31, p32, p33, p34, p35, p36, p37;
<del> /**
<del> * Initializes the empty queue.
<del> */
<del> public MpscPaddedQueue() {
<del> Node<E> stub = new Node<E>(null);
<del> headRef(stub);
<del> tailRef(stub);
<del> }
<del>
<del> /**
<del> * Offer a new value.
<del> *
<del> * @param v the value to offer
<del> */
<del> public void offer(E v) {
<del> Node<E> n = new Node<E>(v);
<del> getAndSetTailRef(n).next(n);
<del> }
<del>
<del> /**
<del> * @warn method description missing
<del> * @return Poll a value from the head of the queue or return null if the queue is empty.
<del> */
<del> public E poll() {
<del> Node<E> n = peekNode();
<del> if (n == null) {
<del> return null;
<del> }
<del> E v = n.value;
<del> n.value = null; // do not retain this value as the node still stays in the queue
<del> lazySetHeadRef(n);
<del> return v;
<del> }
<del>
<del> /**
<del> * Check if there is a node available without changing anything.
<del> * @return
<del> */
<del> private Node<E> peekNode() {
<del> for (;;) {
<del> Node<E> t = headRef();
<del> Node<E> n = t.next();
<del> if (n != null || headRef() == t) {
<del> return n;
<del> }
<del> }
<del> }
<del> /**
<del> * Clears the queue.
<del> */
<del> public void clear() {
<del> for (;;) {
<del> if (poll() == null) {
<del> break;
<del> }
<del> }
<del> }
<del>
<del> /**
<del> * Regular node with value and reference to the next node.
<del> */
<del> static final class Node<E> {
<del> E value;
<del> @SuppressWarnings(value = "rawtypes")
<del> static final AtomicReferenceFieldUpdater<Node, Node> TAIL_UPDATER = AtomicReferenceFieldUpdater.newUpdater(Node.class, Node.class, "next");
<del> private volatile Node<E> next;
<del>
<del> Node(E value) {
<del> this.value = value;
<del> }
<del>
<del> void next(Node<E> newNext) {
<del> TAIL_UPDATER.lazySet(this, newNext);
<del> }
<del>
<del> Node<E> next() {
<del> return next;
<del> }
<del> }
<del>
<del>}
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.