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
Text
Text
update docs about exposing env vars to the browser
501bfe69695b0e563e88af689105882513c2b370
<ide><path>docs/basic-features/environment-variables.md <ide> export async function getStaticProps() { <ide> <ide> ## Exposing Environment Variables to the Browser <ide> <del>By default all environment variables loaded through `.env.local` are only available in the Node.js environment, meaning they won't be exposed to the browser. <add>By default environment variables are only available in the Node.js environment, meaning they won't be exposed to the browser. <ide> <ide> In order to expose a variable to the browser you have to prefix the variable with `NEXT_PUBLIC_`. For example: <ide>
1
Javascript
Javascript
use _writev in internal communication
d2a6f06dce724d24b0aa3c7a2821e4757002bffc
<ide><path>lib/internal/main/worker_thread.js <ide> port.on('message', (message) => { <ide> CJSLoader.Module.runMain(filename); <ide> } <ide> } else if (message.type === STDIO_PAYLOAD) { <del> const { stream, chunk, encoding } = message; <del> process[stream].push(chunk, encoding); <add> const { stream, chunks } = message; <add> for (const { chunk, encoding } of chunks) <add> process[stream].push(chunk, encoding); <ide> } else { <ide> assert( <ide> message.type === STDIO_WANTS_MORE_DATA, <ide><path>lib/internal/worker.js <ide> class Worker extends EventEmitter { <ide> return this[kOnErrorMessage](message.error); <ide> case messageTypes.STDIO_PAYLOAD: <ide> { <del> const { stream, chunk, encoding } = message; <del> return this[kParentSideStdio][stream].push(chunk, encoding); <add> const { stream, chunks } = message; <add> const readable = this[kParentSideStdio][stream]; <add> for (const { chunk, encoding } of chunks) <add> readable.push(chunk, encoding); <add> return; <ide> } <ide> case messageTypes.STDIO_WANTS_MORE_DATA: <ide> { <ide><path>lib/internal/worker/io.js <ide> class WritableWorkerStdio extends Writable { <ide> this[kWritableCallbacks] = []; <ide> } <ide> <del> _write(chunk, encoding, cb) { <add> _writev(chunks, cb) { <ide> this[kPort].postMessage({ <ide> type: messageTypes.STDIO_PAYLOAD, <ide> stream: this[kName], <del> chunk, <del> encoding <add> chunks: chunks.map(({ chunk, encoding }) => ({ chunk, encoding })) <ide> }); <ide> this[kWritableCallbacks].push(cb); <ide> if (this[kPort][kWaitingStreams]++ === 0) <ide> class WritableWorkerStdio extends Writable { <ide> this[kPort].postMessage({ <ide> type: messageTypes.STDIO_PAYLOAD, <ide> stream: this[kName], <del> chunk: null <add> chunks: [ { chunk: null, encoding: '' } ] <ide> }); <ide> cb(); <ide> }
3
PHP
PHP
implement new primary key syntax
2e2be97c2686bf919f06a47849902b80586cfa6c
<ide><path>database/migrations/2014_10_12_000000_create_users_table.php <ide> class CreateUsersTable extends Migration <ide> public function up() <ide> { <ide> Schema::create('users', function (Blueprint $table) { <del> $table->bigIncrements('id'); <add> $table->id(); <ide> $table->string('name'); <ide> $table->string('email')->unique(); <ide> $table->timestamp('email_verified_at')->nullable(); <ide><path>database/migrations/2019_08_19_000000_create_failed_jobs_table.php <ide> class CreateFailedJobsTable extends Migration <ide> public function up() <ide> { <ide> Schema::create('failed_jobs', function (Blueprint $table) { <del> $table->bigIncrements('id'); <add> $table->id(); <ide> $table->text('connection'); <ide> $table->text('queue'); <ide> $table->longText('payload');
2
Text
Text
create reusable css with mixins"
c03beb3ca68e91759c92f41131259cc96d0de011
<ide><path>curriculum/challenges/english/03-front-end-libraries/sass/create-reusable-css-with-mixins.md <ide> tests: <ide> - text: Your code should declare a mixin named <code>border-radius</code> which has a parameter named <code>$radius</code>. <ide> testString: assert(code.match(/@mixin\s+?border-radius\s*?\(\s*?\$radius\s*?\)\s*?{/gi)); <ide> - text: Your code should include the <code>-webkit-border-radius</code> vendor prefix that uses the <code>$radius</code> parameter. <del> testString: assert(code.match(/-webkit-border-radius:\s*?\$radius;/gi)); <add> testString: assert(__helpers.removeWhiteSpace(code).match(/-webkit-border-radius:\$radius;/gi)); <ide> - text: Your code should include the <code>-moz-border-radius</code> vendor prefix that uses the <code>$radius</code> parameter. <del> testString: assert(code.match(/-moz-border-radius:\s*?\$radius;/gi)); <add> testString: assert(__helpers.removeWhiteSpace(code).match(/-moz-border-radius:\$radius;/gi)); <ide> - text: Your code should include the <code>-ms-border-radius</code> vendor prefix that uses the <code>$radius</code> parameter. <del> testString: assert(code.match(/-ms-border-radius:\s*?\$radius;/gi)); <add> testString: assert(__helpers.removeWhiteSpace(code).match(/-ms-border-radius:\$radius;/gi)); <ide> - text: Your code should include the general <code>border-radius</code> rule that uses the <code>$radius</code> parameter. <del> testString: assert(code.match(/border-radius:\s*?\$radius;/gi).length == 4); <add> testString: assert(__helpers.removeWhiteSpace(code).match(/border-radius:\$radius;/gi).length == 4); <ide> - text: Your code should call the <code>border-radius mixin</code> using the <code>@include</code> keyword, setting it to 15px. <del> testString: assert(code.match(/@include\s+?border-radius\(\s*?15px\s*?\);/gi)); <add> testString: assert(code.match(/@include\s+?border-radius\(\s*?15px\s*?\)\s*;/gi)); <ide> <ide> ``` <ide>
1
Text
Text
add blanks around code fences
9ab1e07774b0c38a66e29f4b0b257ded8ee04d08
<ide><path>BUILDING.md <ide> during configuration if the ICU version is too old. <ide> #### Unix/macOS <ide> <ide> From an already-unpacked ICU: <add> <ide> ```console <ide> $ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu <ide> ``` <ide> <ide> From a local ICU tarball: <add> <ide> ```console <ide> $ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz <ide> ``` <ide> <ide> From a tarball URL: <add> <ide> ```console <ide> $ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz <ide> ``` <ide><path>CPP_STYLE_GUIDE.md <ide> class FancyContainer { <ide> ... <ide> } <ide> ``` <add> <ide> ## Memory Management <ide> <ide> ### Memory allocation <ide><path>doc/api/child_process.md <ide> generated output. The `command` string passed to the exec function is processed <ide> directly by the shell and special characters (vary based on <ide> [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) <ide> need to be dealt with accordingly: <add> <ide> ```js <ide> exec('"/path/to/test file/test.sh" arg1 arg2'); <ide> // Double quotes are used so that the space in the path is not interpreted as <ide><path>doc/api/cli.md <ide> added: v10.12.0 <ide> --> <ide> <ide> Print source-able bash completion script for Node.js. <add> <ide> ```console <ide> $ node --completion-bash > node_bash_completion <ide> $ source node_bash_completion <ide><path>doc/api/console.md <ide> This method does not display anything unless used in the inspector. The <ide> `console.profile()` method starts a JavaScript CPU profile with an optional <ide> label until [`console.profileEnd()`][] is called. The profile is then added to <ide> the **Profile** panel of the inspector. <add> <ide> ```js <ide> console.profile('MyLabel'); <ide> // Some code <ide><path>doc/api/crypto.md <ide> const dh = crypto.createDiffieHellmanGroup(name); <ide> ``` <ide> <ide> `name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]: <add> <ide> ```console <ide> $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h <ide> modp1 # 768 bits <ide><path>doc/api/dgram.md <ide> socket.bind(1234, () => { <ide> <ide> #### Example: IPv4 Outgoing Multicast Interface <ide> All systems use an IP of the host on the desired physical interface: <add> <ide> ```js <ide> const socket = dgram.createSocket('udp4'); <ide> <ide><path>doc/api/errors.md <ide> Errors that occur within _Asynchronous APIs_ may be reported in multiple ways: <ide> // Otherwise handle the data <ide> }); <ide> ``` <add> <ide> - When an asynchronous method is called on an object that is an <ide> [`EventEmitter`][], errors can be routed to that object's `'error'` event. <ide> <ide><path>doc/api/esm.md <ide> module via `import`. <ide> "main": "./src/index.js" <ide> } <ide> ``` <add> <ide> ```js <ide> // ./my-app.mjs <ide> <ide><path>doc/api/fs.md <ide> fs.readFileSync(new URL('file:///p/a/t/h/%2f')); <ide> /* TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must not include encoded <ide> / characters */ <ide> ``` <add> <ide> On Windows, `file:` URLs having encoded backslash will result in a throw: <ide> <ide> ```js <ide> recommended. <ide> <ide> When `file` is a file descriptor, the behavior is almost identical to directly <ide> calling `fs.write()` like: <add> <ide> ```javascript <ide> fs.write(fd, Buffer.from(data, options.encoding), callback); <ide> ``` <ide><path>doc/api/http2.md <ide> The `CONNECT` method is used to allow an HTTP/2 server to be used as a proxy <ide> for TCP/IP connections. <ide> <ide> A simple TCP Server: <add> <ide> ```js <ide> const net = require('net'); <ide> <ide><path>doc/api/https.md <ide> req.on('error', (e) => { <ide> }); <ide> req.end(); <ide> ``` <add> <ide> Example using options from [`tls.connect()`][]: <ide> <ide> ```js <ide><path>doc/api/n-api.md <ide> not, and any external libraries used from the addon may not. In particular, <ide> none of the following APIs provide an ABI stability guarantee across major <ide> versions: <ide> * the Node.js C++ APIs available via any of <add> <ide> ```C++ <ide> #include <node.h> <ide> #include <node_buffer.h> <ide> #include <node_version.h> <ide> #include <node_object_wrap.h> <ide> ``` <add> <ide> * the libuv APIs which are also included with Node.js and available via <add> <ide> ```C++ <ide> #include <uv.h> <ide> ``` <add> <ide> * the V8 API available via <add> <ide> ```C++ <ide> #include <v8.h> <ide> ``` <ide> <ide> Thus, for an addon to remain ABI-compatible across Node.js major versions, it <ide> must make use exclusively of N-API by restricting itself to using <add> <ide> ```C <ide> #include <node_api.h> <ide> ``` <add> <ide> and by checking, for all external libraries that it uses, that the external <ide> library makes ABI stability guarantees similar to N-API. <ide> <ide> napiVersion: 1 <ide> --> <ide> Integral status code indicating the success or failure of a N-API call. <ide> Currently, the following status codes are supported. <add> <ide> ```C <ide> typedef enum { <ide> napi_ok, <ide> typedef enum { <ide> napi_date_expected, <ide> } napi_status; <ide> ``` <add> <ide> If additional information is required upon an API returning a failed status, <ide> it can be obtained by calling `napi_get_last_error_info`. <ide> <ide> it can be obtained by calling `napi_get_last_error_info`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> typedef struct { <ide> const char* error_message; <ide> A value to be given to `napi_release_threadsafe_function()` to indicate whether <ide> the thread-safe function is to be closed immediately (`napi_tsfn_abort`) or <ide> merely released (`napi_tsfn_release`) and thus available for subsequent use via <ide> `napi_acquire_threadsafe_function()` and `napi_call_threadsafe_function()`. <add> <ide> ```C <ide> typedef enum { <ide> napi_tsfn_release, <ide> napiVersion: 4 <ide> A value to be given to `napi_call_threadsafe_function()` to indicate whether <ide> the call should block whenever the queue associated with the thread-safe <ide> function is full. <add> <ide> ```C <ide> typedef enum { <ide> napi_tsfn_nonblocking, <ide> napiVersion: 1 <ide> Function pointer type for user-provided native functions which are to be <ide> exposed to JavaScript via N-API. Callback functions should satisfy the <ide> following signature: <add> <ide> ```C <ide> typedef napi_value (*napi_callback)(napi_env, napi_callback_info); <ide> ``` <ide> sufficient to call the JavaScript function via `napi_call_function` rather than <ide> via `napi_make_callback`. <ide> <ide> Callback functions must satisfy the following signature: <add> <ide> ```C <ide> typedef void (*napi_threadsafe_function_call_js)(napi_env env, <ide> napi_value js_callback, <ide> void* context, <ide> void* data); <ide> ``` <add> <ide> - `[in] env`: The environment to use for API calls, or `NULL` if the thread-safe <ide> function is being torn down and `data` may need to be freed. <ide> - `[in] js_callback`: The JavaScript function to call, or `NULL` if the <ide> The format of the `napi_extended_error_info` structure is as follows: <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> typedef struct napi_extended_error_info { <ide> const char* error_message; <ide> typedef struct napi_extended_error_info { <ide> napi_status error_code; <ide> }; <ide> ``` <add> <ide> - `error_message`: Textual representation of the error that occurred. <ide> - `engine_reserved`: Opaque handle reserved for engine use only. <ide> - `engine_error_code`: VM specific error code. <ide> logging purposes. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status <ide> napi_get_last_error_info(napi_env env, <ide> const napi_extended_error_info** result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[out] result`: The `napi_extended_error_info` structure with more <ide> information about the error. <ide> TypeError [ERR_ERROR_1] <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_throw(napi_env env, napi_value error); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] error`: The JavaScript value to be thrown. <ide> <ide> This API throws the JavaScript value provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_throw_error(napi_env env, <ide> const char* code, <ide> const char* msg); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] code`: Optional error code to be set on the error. <ide> - `[in] msg`: C string representing the text to be associated with <ide> This API throws a JavaScript `Error` with the text provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_throw_type_error(napi_env env, <ide> const char* code, <ide> const char* msg); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] code`: Optional error code to be set on the error. <ide> - `[in] msg`: C string representing the text to be associated with <ide> This API throws a JavaScript `TypeError` with the text provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_throw_range_error(napi_env env, <ide> const char* code, <ide> const char* msg); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] code`: Optional error code to be set on the error. <ide> - `[in] msg`: C string representing the text to be associated with <ide> This API throws a JavaScript `RangeError` with the text provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_is_error(napi_env env, <ide> napi_value value, <ide> bool* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] value`: The `napi_value` to be checked. <ide> - `[out] result`: Boolean value that is set to true if `napi_value` represents <ide> This API queries a `napi_value` to check if it represents an error object. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_create_error(napi_env env, <ide> napi_value code, <ide> napi_value msg, <ide> napi_value* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] code`: Optional `napi_value` with the string for the error code to <ide> be associated with the error. <ide> This API returns a JavaScript `Error` with the text provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_create_type_error(napi_env env, <ide> napi_value code, <ide> napi_value msg, <ide> napi_value* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] code`: Optional `napi_value` with the string for the error code to <ide> be associated with the error. <ide> This API returns a JavaScript `TypeError` with the text provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_create_range_error(napi_env env, <ide> napi_value code, <ide> napi_value msg, <ide> napi_value* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] code`: Optional `napi_value` with the string for the error code to <ide> be associated with the error. <ide> This API returns a JavaScript `RangeError` with the text provided. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_and_clear_last_exception(napi_env env, <ide> napi_value* result); <ide> This API can be called even if there is a pending JavaScript exception. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_exception_pending(napi_env env, bool* result); <ide> ``` <ide> thrown to immediately terminate the process. <ide> added: v8.2.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_NO_RETURN void napi_fatal_error(const char* location, <ide> size_t location_len, <ide> can only be called once. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_open_handle_scope(napi_env env, <ide> napi_handle_scope* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[out] result`: `napi_value` representing the new scope. <ide> <ide> This API open a new scope. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_close_handle_scope(napi_env env, <ide> napi_handle_scope scope); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] scope`: `napi_value` representing the scope to be closed. <ide> <ide> This API can be called even if there is a pending JavaScript exception. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_open_escapable_handle_scope(napi_env env, <ide> napi_handle_scope* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[out] result`: `napi_value` representing the new scope. <ide> <ide> to the outer scope. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_close_escapable_handle_scope(napi_env env, <ide> napi_handle_scope scope); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] scope`: `napi_value` representing the scope to be closed. <ide> <ide> This API can be called even if there is a pending JavaScript exception. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_escape_handle(napi_env env, <ide> napi_escapable_handle_scope scope, <ide> individual count. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_create_reference(napi_env env, <ide> napi_value value, <ide> to the `Object` passed in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_delete_reference(napi_env env, napi_ref ref); <ide> ``` <ide> This API can be called even if there is a pending JavaScript exception. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_reference_ref(napi_env env, <ide> napi_ref ref, <ide> int* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] ref`: `napi_ref` for which the reference count will be incremented. <ide> - `[out] result`: The new reference count. <ide> passed in and returns the resulting reference count. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_reference_unref(napi_env env, <ide> napi_ref ref, <ide> int* result); <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] ref`: `napi_ref` for which the reference count will be decremented. <ide> - `[out] result`: The new reference count. <ide> passed in and returns the resulting reference count. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_get_reference_value(napi_env env, <ide> napi_ref ref, <ide> the `napi_value` in question is of the JavaScript type expected by the API. <ide> <ide> ### Enum types <ide> #### napi_valuetype <add> <ide> ```C <ide> typedef enum { <ide> // ES6 types (corresponds to typeof) <ide> A JavaScript value of type `napi_external` appears in JavaScript as a plain <ide> object such that no properties can be set on it, and no prototype. <ide> <ide> #### napi_typedarray_type <add> <ide> ```C <ide> typedef enum { <ide> napi_int8_array, <ide> Elements of this enum correspond to <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_array(napi_env env, napi_value* result) <ide> ``` <ide> JavaScript arrays are described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_array_with_length(napi_env env, <ide> size_t length, <ide> JavaScript arrays are described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_arraybuffer(napi_env env, <ide> size_t byte_length, <ide> JavaScript `ArrayBuffer` objects are described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_buffer(napi_env env, <ide> size_t size, <ide> fully-supported data structure, in most cases using a `TypedArray` will suffice. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_buffer_copy(napi_env env, <ide> size_t length, <ide> JavaScript `Date` objects are described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_external(napi_env env, <ide> void* data, <ide> an external value yields `napi_external`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status <ide> napi_create_external_arraybuffer(napi_env env, <ide> JavaScript `ArrayBuffer`s are described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_external_buffer(napi_env env, <ide> size_t length, <ide> For Node.js >=4 `Buffers` are `Uint8Array`s. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_object(napi_env env, napi_value* result) <ide> ``` <ide> ECMAScript Language Specification. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_symbol(napi_env env, <ide> napi_value description, <ide> of the ECMAScript Language Specification. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_typedarray(napi_env env, <ide> napi_typedarray_type type, <ide> JavaScript `DataView` objects are described in <ide> added: v8.4.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_int32(napi_env env, int32_t value, napi_value* result) <ide> ``` <ide> The JavaScript `Number` type is described in <ide> added: v8.4.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_uint32(napi_env env, uint32_t value, napi_value* result) <ide> ``` <ide> The JavaScript `Number` type is described in <ide> added: v8.4.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_int64(napi_env env, int64_t value, napi_value* result) <ide> ``` <ide> outside the range of <ide> added: v8.4.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_double(napi_env env, double value, napi_value* result) <ide> ``` <ide> The resulting `BigInt` is calculated as: (–1)<sup>`sign_bit`</sup> (`words[0]` <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_string_latin1(napi_env env, <ide> const char* str, <ide> The JavaScript `String` type is described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_string_utf16(napi_env env, <ide> const char16_t* str, <ide> The JavaScript `String` type is described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_string_utf8(napi_env env, <ide> const char* str, <ide> The JavaScript `String` type is described in <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_array_length(napi_env env, <ide> napi_value value, <ide> of the ECMAScript Language Specification. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_arraybuffer_info(napi_env env, <ide> napi_value arraybuffer, <ide> trigger a GC. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_buffer_info(napi_env env, <ide> napi_value value, <ide> lifetime is not guaranteed if it's managed by the VM. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_prototype(napi_env env, <ide> napi_value object, <ide> Returns `napi_ok` if the API succeeded. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_typedarray_info(napi_env env, <ide> napi_value typedarray, <ide> This API returns the C double primitive of time value for the given JavaScript <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_bool(napi_env env, napi_value value, bool* result) <ide> ``` <ide> This API returns the C boolean primitive equivalent of the given JavaScript <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_double(napi_env env, <ide> napi_value value, <ide> both set to `NULL`, in order to get only `word_count`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_external(napi_env env, <ide> napi_value value, <ide> This API retrieves the external data pointer that was previously passed to <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_int32(napi_env env, <ide> napi_value value, <ide> result to zero. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_int64(napi_env env, <ide> napi_value value, <ide> result to zero. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_string_latin1(napi_env env, <ide> napi_value value, <ide> in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_string_utf8(napi_env env, <ide> napi_value value, <ide> This API returns the UTF8-encoded string corresponding the value passed in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_string_utf16(napi_env env, <ide> napi_value value, <ide> This API returns the UTF16-encoded string corresponding the value passed in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_value_uint32(napi_env env, <ide> napi_value value, <ide> This API returns the C primitive equivalent of the given `napi_value` as a <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_boolean(napi_env env, bool value, napi_value* result) <ide> ``` <ide> represent the given boolean value. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_global(napi_env env, napi_value* result) <ide> ``` <ide> This API returns the `global` object. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_null(napi_env env, napi_value* result) <ide> ``` <ide> This API returns the `null` object. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_undefined(napi_env env, napi_value* result) <ide> ``` <ide> These APIs support doing one of the following: <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_coerce_to_bool(napi_env env, <ide> napi_value value, <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_coerce_to_number(napi_env env, <ide> napi_value value, <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_coerce_to_object(napi_env env, <ide> napi_value value, <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_coerce_to_string(napi_env env, <ide> napi_value value, <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_typeof(napi_env env, napi_value value, napi_valuetype* result) <ide> ``` <ide> If `value` has a type that is invalid, an error is returned. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_instanceof(napi_env env, <ide> napi_value object, <ide> of the ECMAScript Language Specification. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_array(napi_env env, napi_value value, bool* result) <ide> ``` <ide> of the ECMAScript Language Specification. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_arraybuffer(napi_env env, napi_value value, bool* result) <ide> ``` <ide> This API checks if the `Object` passed in is an array buffer. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_buffer(napi_env env, napi_value value, bool* result) <ide> ``` <ide> This API checks if the `Object` passed in is a date. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_error(napi_env env, napi_value value, bool* result) <ide> ``` <ide> This API checks if the `Object` passed in is an `Error`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_typedarray(napi_env env, napi_value value, bool* result) <ide> ``` <ide> This API checks if the `Object` passed in is a `DataView`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_strict_equals(napi_env env, <ide> napi_value lhs, <ide> get and set properties on arbitrary JavaScript objects represented by <ide> `napi_value`. <ide> <ide> For instance, consider the following JavaScript code snippet: <add> <ide> ```js <ide> const obj = {}; <ide> obj.myProp = 123; <ide> ``` <add> <ide> The equivalent can be done using N-API values with the following snippet: <add> <ide> ```C <ide> napi_status status = napi_generic_failure; <ide> <ide> if (status != napi_ok) return status; <ide> <ide> Indexed properties can be set in a similar manner. Consider the following <ide> JavaScript snippet: <add> <ide> ```js <ide> const arr = []; <ide> arr[123] = 'hello'; <ide> ``` <add> <ide> The equivalent can be done using N-API values with the following snippet: <add> <ide> ```C <ide> napi_status status = napi_generic_failure; <ide> <ide> if (status != napi_ok) return status; <ide> <ide> Properties can be retrieved using the APIs described in this section. <ide> Consider the following JavaScript snippet: <add> <ide> ```js <ide> const arr = []; <ide> const value = arr[123]; <ide> ``` <ide> <ide> The following is the approximate equivalent of the N-API counterpart: <add> <ide> ```C <ide> napi_status status = napi_generic_failure; <ide> <ide> if (status != napi_ok) return status; <ide> <ide> Finally, multiple properties can also be defined on an object for performance <ide> reasons. Consider the following JavaScript: <add> <ide> ```js <ide> const obj = {}; <ide> Object.defineProperties(obj, { <ide> Object.defineProperties(obj, { <ide> ``` <ide> <ide> The following is the approximate equivalent of the N-API counterpart: <add> <ide> ```C <ide> napi_status status = napi_status_generic_failure; <ide> <ide> if (status != napi_ok) return status; <ide> <ide> ### Structures <ide> #### napi_property_attributes <add> <ide> ```C <ide> typedef enum { <ide> napi_default = 0, <ide> default. This is used only by [`napi_define_class`][]. It is ignored by <ide> `napi_define_properties`. <ide> <ide> #### napi_property_descriptor <add> <ide> ```C <ide> typedef struct { <ide> // One of utf8name or name should be NULL. <ide> this function is invoked. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_property_names(napi_env env, <ide> napi_value object, <ide> included. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_set_property(napi_env env, <ide> napi_value object, <ide> This API set a property on the `Object` passed in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_property(napi_env env, <ide> napi_value object, <ide> This API gets the requested property from the `Object` passed in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_has_property(napi_env env, <ide> napi_value object, <ide> This API checks if the `Object` passed in has the named property. <ide> added: v8.2.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_delete_property(napi_env env, <ide> napi_value object, <ide> This API attempts to delete the `key` own property from `object`. <ide> added: v8.2.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_has_own_property(napi_env env, <ide> napi_value object, <ide> any conversion between data types. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_set_named_property(napi_env env, <ide> napi_value object, <ide> created from the string passed in as `utf8Name`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_named_property(napi_env env, <ide> napi_value object, <ide> created from the string passed in as `utf8Name`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_has_named_property(napi_env env, <ide> napi_value object, <ide> created from the string passed in as `utf8Name`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_set_element(napi_env env, <ide> napi_value object, <ide> This API sets and element on the `Object` passed in. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_element(napi_env env, <ide> napi_value object, <ide> This API gets the element at the requested index. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_has_element(napi_env env, <ide> napi_value object, <ide> requested index. <ide> added: v8.2.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_delete_element(napi_env env, <ide> napi_value object, <ide> This API attempts to delete the specified `index` from `object`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_define_properties(napi_env env, <ide> napi_value object, <ide> whenever `object` is garbage-collected by passing both `object` and the data to <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_call_function(napi_env env, <ide> napi_value recv, <ide> after an async operation, see [`napi_make_callback`][]. <ide> <ide> A sample use case might look as follows. Consider the following JavaScript <ide> snippet: <add> <ide> ```js <ide> function AddTwo(num) { <ide> return num + 2; <ide> function AddTwo(num) { <ide> <ide> Then, the above function can be invoked from a native add-on using the <ide> following code: <add> <ide> ```C <ide> // Get the function named "AddTwo" on the global object <ide> napi_value global, add_two, arg; <ide> if (status != napi_ok) return; <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_function(napi_env env, <ide> const char* utf8name, <ide> to JavaScript, in order for the function to be accessible from script. <ide> In order to expose a function as part of the <ide> add-on's module exports, set the newly created function on the exports <ide> object. A sample module might look as follows: <add> <ide> ```C <ide> napi_value SayHello(napi_env env, napi_callback_info info) { <ide> printf("Hello\n"); <ide> NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) <ide> ``` <ide> <ide> Given the above code, the add-on can be used from JavaScript as follows: <add> <ide> ```js <ide> const myaddon = require('./addon'); <ide> myaddon.sayHello(); <ide> of the ECMAScript Language Specification. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_cb_info(napi_env env, <ide> napi_callback_info cbinfo, <ide> call like the arguments and the `this` pointer from a given callback info. <ide> added: v8.6.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_new_target(napi_env env, <ide> napi_callback_info cbinfo, <ide> callback is not a constructor call, the result is `NULL`. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_new_instance(napi_env env, <ide> napi_value cons, <ide> which in this case is the constructed object. <ide> This method is used to instantiate a new JavaScript value using a given <ide> `napi_value` that represents the constructor for the object. For example, <ide> consider the following snippet: <add> <ide> ```js <ide> function MyObject(param) { <ide> this.param = param; <ide> const value = new MyObject(arg); <ide> ``` <ide> <ide> The following can be approximated in N-API using the following snippet: <add> <ide> ```C <ide> // Get the constructor function MyObject <ide> napi_value global, constructor, arg, value; <ide> The reference must be freed once it is no longer needed. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_define_class(napi_env env, <ide> const char* utf8name, <ide> the JavaScript function and the data to [`napi_add_finalizer`][]. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_wrap(napi_env env, <ide> napi_value js_object, <ide> first. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_unwrap(napi_env env, <ide> napi_value js_object, <ide> then by calling `napi_unwrap()` on the wrapper object. <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_remove_wrap(napi_env env, <ide> napi_value js_object, <ide> JavaScript object becomes garbage-collected. <ide> <!-- YAML <ide> added: v8.0.0 <ide> --> <add> <ide> ```C <ide> napi_status napi_add_finalizer(napi_env env, <ide> napi_value js_object, <ide> changes: <ide> pr-url: https://github.com/nodejs/node/pull/14697 <ide> description: Added `async_resource` and `async_resource_name` parameters. <ide> --> <add> <ide> ```C <ide> napi_status napi_create_async_work(napi_env env, <ide> napi_value async_resource, <ide> the [`async_hooks` documentation][async_hooks `type`] for more information. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_delete_async_work(napi_env env, <ide> napi_async_work work); <ide> This API can be called even if there is a pending JavaScript exception. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_queue_async_work(napi_env env, <ide> napi_async_work work); <ide> with the same `napi_async_work` item or the result will be undefined. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_cancel_async_work(napi_env env, <ide> napi_async_work work); <ide> the runtime. <ide> added: v8.6.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_async_init(napi_env env, <ide> napi_value async_resource, <ide> Returns `napi_ok` if the API succeeded. <ide> added: v8.6.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_async_destroy(napi_env env, <ide> napi_async_context async_context); <ide> changes: <ide> - version: v8.6.0 <ide> description: Added `async_context` parameter. <ide> --> <add> <ide> ```C <ide> napi_status napi_make_callback(napi_env env, <ide> napi_async_context async_context, <ide> may be required when implementing custom async behavior that does not use <ide> added: v9.6.0 <ide> napiVersion: 3 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_open_callback_scope(napi_env env, <ide> napi_value resource_object, <ide> napi_async_context context, <ide> napi_callback_scope* result) <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] resource_object`: An object associated with the async work <ide> that will be passed to possible `async_hooks` [`init` hooks][]. <ide> the required scope. <ide> added: v9.6.0 <ide> napiVersion: 3 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env, <ide> napi_callback_scope scope) <ide> ``` <add> <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] scope`: The scope to be closed. <ide> <ide> The returned buffer is statically allocated and does not need to be freed. <ide> added: v8.0.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_get_version(napi_env env, <ide> uint32_t* result); <ide> support it: <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, <ide> int64_t change_in_bytes, <ide> deferred object that is created by `napi_create_promise()` is freed by <ide> be returned to JavaScript where it can be used in the usual fashion. <ide> <ide> For example, to create a promise and pass it to an asynchronous worker: <add> <ide> ```c <ide> napi_deferred deferred; <ide> napi_value promise; <ide> return promise; <ide> The above function `do_something_asynchronous()` would perform its asynchronous <ide> action and then it would resolve or reject the deferred, thereby concluding the <ide> promise and freeing the deferred: <add> <ide> ```c <ide> napi_deferred deferred; <ide> napi_value undefined; <ide> deferred = NULL; <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_create_promise(napi_env env, <ide> napi_deferred* deferred, <ide> This API creates a deferred object and a JavaScript promise. <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_resolve_deferred(napi_env env, <ide> napi_deferred deferred, <ide> The deferred object is freed upon successful completion. <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_reject_deferred(napi_env env, <ide> napi_deferred deferred, <ide> The deferred object is freed upon successful completion. <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> napi_status napi_is_promise(napi_env env, <ide> napi_value promise, <ide> underlying JavaScript engine. <ide> added: v8.5.0 <ide> napiVersion: 1 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_run_script(napi_env env, <ide> napi_value script, <ide> added: <ide> - v9.3.0 <ide> napiVersion: 2 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, <ide> uv_loop_t** loop); <ide> changes: <ide> pr-url: https://github.com/nodejs/node/pull/27791 <ide> description: Made `func` parameter optional with custom `call_js_cb`. <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_create_threadsafe_function(napi_env env, <ide> parameters and with `undefined` as its `this` value. <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_get_threadsafe_function_context(napi_threadsafe_function func, <ide> This API may be called from any thread which makes use of `func`. <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_call_threadsafe_function(napi_threadsafe_function func, <ide> This API may be called from any thread which makes use of `func`. <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_acquire_threadsafe_function(napi_threadsafe_function func); <ide> This API may be called from any thread which will start making use of `func`. <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_release_threadsafe_function(napi_threadsafe_function func, <ide> This API may be called from any thread which will stop making use of `func`. <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func); <ide> This API may only be called from the main thread. <ide> added: v10.6.0 <ide> napiVersion: 4 <ide> --> <add> <ide> ```C <ide> NAPI_EXTERN napi_status <ide> napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func); <ide><path>doc/api/perf_hooks.md <ide> obs.observe({ entryTypes: ['mark'], buffered: true }); <ide> <ide> performance.mark('test'); <ide> ``` <add> <ide> Because `PerformanceObserver` instances introduce their own additional <ide> performance overhead, instances should not be left subscribed to notifications <ide> indefinitely. Users should disconnect observers as soon as they are no <ide><path>doc/api/process.md <ide> process. <ide> ```js <ide> console.log(`Current directory: ${process.cwd()}`); <ide> ``` <add> <ide> ## process.debugPort <ide> <!-- YAML <ide> added: v0.7.2 <ide> The port used by Node.js's debugger when enabled. <ide> ```js <ide> process.debugPort = 5858; <ide> ``` <add> <ide> ## process.disconnect() <ide> <!-- YAML <ide> added: v0.7.2 <ide> To check if a stream is connected to a [TTY][] context, check the `isTTY` <ide> property. <ide> <ide> For instance: <add> <ide> ```console <ide> $ node -p "Boolean(process.stdin.isTTY)" <ide> true <ide><path>doc/api/stream.md <ide> const writable = fs.createWriteStream('file.txt'); <ide> // All the data from readable goes into 'file.txt'. <ide> readable.pipe(writable); <ide> ``` <add> <ide> It is possible to attach multiple `Writable` streams to a single `Readable` <ide> stream. <ide> <ide><path>doc/api/tls.md <ide> For EC keys, the following properties may be defined: <ide> `'P-256'`. <ide> <ide> Example certificate: <add> <ide> ```text <ide> { subject: <ide> { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], <ide><path>doc/api/util.md <ide> where `3245` is the process id. If it is not run with that <ide> environment variable set, then it will not print anything. <ide> <ide> The `section` supports wildcard also: <add> <ide> ```js <ide> const util = require('util'); <ide> const debuglog = util.debuglog('foo-bar'); <ide> debuglog('hi there, it\'s foo-bar [%d]', 2333); <ide> <ide> if it is run with `NODE_DEBUG=foo*` in the environment, then it will output <ide> something like: <add> <ide> ```txt <ide> FOO-BAR 3257: hi there, it's foo-bar [2333] <ide> ``` <ide> doSomething[util.promisify.custom] = (foo) => { <ide> }); <ide> }; <ide> ``` <add> <ide> If `promisify.custom` is defined but is not a function, `promisify()` will <ide> throw an error. <ide> <ide><path>doc/api/vm.md <ide> Module Record][]s in the ECMAScript specification. <ide> import foo from 'foo'; <ide> // ^^^^^ the module specifier <ide> ``` <add> <ide> * `referencingModule` {vm.SourceTextModule} The `Module` object `link()` is <ide> called on. <ide> * Returns: {vm.SourceTextModule|Promise} <ide><path>doc/api/zlib.md <ide> quality, but can be useful when data needs to be available as soon as possible. <ide> <ide> In the following example, `flush()` is used to write a compressed partial <ide> HTTP response to the client: <add> <ide> ```js <ide> const zlib = require('zlib'); <ide> const http = require('http'); <ide><path>doc/guides/updating-root-certs.md <ide> version in the [tag list][]. <ide> 2. Update `certdata.txt` from the NSS release tag. <ide> <ide> Update the tag in the commands below, and run: <add> <ide> ```shell <ide> cd tools/ <ide> ./mk-ca-bundle.pl -v 2>_before <ide> Run the command below: <ide> Confirm that `../src/node_root_certs.h` was updated. <ide> <ide> Determine what changes were made by diffing the before and after files: <add> <ide> ```shell <ide> % diff _before _after <ide> 11d10 <ide> Determine what changes were made by diffing the before and after files: <ide> ``` <ide> <ide> Use the diff to update the message below, and commit `src/node_root_certs.h`: <add> <ide> ```text <ide> crypto: update root certificates <ide> <ide><path>doc/guides/writing-tests.md <ide> const server = http.createServer(common.mustCall((req, res) => { <ide> }); <ide> <ide> ``` <add> <ide> #### Countdown Module <ide> <ide> The common [Countdown module](https://github.com/nodejs/node/tree/master/test/common#countdown-module) <ide> $ make cctest <ide> ``` <ide> <ide> A filter can be applied to run single/multiple test cases: <add> <ide> ```console <ide> $ make cctest GTEST_FILTER=EnvironmentTest.AtExitWithArgument <ide> ``` <ide> <ide> `cctest` can also be run directly which can be useful when debugging: <add> <ide> ```console <ide> $ out/Release/cctest --gtest_filter=EnvironmentTest.AtExit* <ide> ``` <ide><path>doc/onboarding-extras.md <ide> request. <ide> they pass, **probably** minor or patch <ide> * A breaking change helper <ide> ([full source](https://gist.github.com/chrisdickinson/ba532fa0e4e243fb7b44)): <del> ```sh <del> SHOW=$(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}') <del> git checkout $(git show -s --pretty='%T' $SHOW) -- test <del> make -j4 test <del> ``` <add> <add> ```sh <add> SHOW=$(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}') <add> git checkout $(git show -s --pretty='%T' $SHOW) -- test <add> make -j4 test <add> ``` <ide> <ide> ### LTS/Version labels <ide>
23
Javascript
Javascript
fix three path
0533e1785a069795c0f9c4fc2905447c049910b2
<ide><path>examples/jsm/postprocessing/LUTPass.js <del>import { ShaderPass } from '//unpkg.com/[email protected]/examples/jsm/postprocessing/ShaderPass.js'; <add>import { ShaderPass } from './ShaderPass.js'; <ide> <ide> const LUTShader = { <ide>
1
Mixed
Javascript
add headers prop to android webviews
80a2f5d50fc61b8ba48169d8dcca0247f4b484f2
<ide><path>Libraries/Components/WebView/WebView.android.js <ide> var StyleSheet = require('StyleSheet'); <ide> var UIManager = require('UIManager'); <ide> var View = require('View'); <ide> <add>var deprecatedPropType = require('deprecatedPropType'); <ide> var keyMirror = require('keyMirror'); <ide> var merge = require('merge'); <ide> var requireNativeComponent = require('requireNativeComponent'); <ide> var WebView = React.createClass({ <ide> onLoadEnd: PropTypes.func, <ide> onLoadStart: PropTypes.func, <ide> onError: PropTypes.func, <del> url: PropTypes.string, <del> html: PropTypes.string, <ide> automaticallyAdjustContentInsets: PropTypes.bool, <ide> contentInset: EdgeInsetsPropType, <ide> onNavigationStateChange: PropTypes.func, <ide> startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load <ide> style: View.propTypes.style, <ide> <add> html: deprecatedPropType( <add> PropTypes.string, <add> 'Use the `source` prop instead.' <add> ), <add> <add> url: deprecatedPropType( <add> PropTypes.string, <add> 'Use the `source` prop instead.' <add> ), <add> <add> /** <add> * Used on Android only, provides html or url with optional headers to the WebView. <add> * `{ html: string, uri: string, headers: map<string, string> }` <add> * @platform android <add> */ <add> source: PropTypes.object, <add> <ide> /** <ide> * Used on Android only, JS is enabled by default for WebView on iOS <ide> * @platform android <ide> var WebView = React.createClass({ <ide> domStorageEnabled = this.props.domStorageEnabledAndroid; <ide> } <ide> <add> var source = this.props.source || {}; <add> if (this.props.html) { <add> source.html = this.props.html; <add> } else if (this.props.url) { <add> source.uri = this.props.url; <add> } <add> <ide> var webView = <ide> <RCTWebView <ide> ref={RCT_WEBVIEW_REF} <ide> key="webViewKey" <ide> style={webViewStyles} <del> url={this.props.url} <del> html={this.props.html} <add> source={source} <ide> injectedJavaScript={this.props.injectedJavaScript} <ide> userAgent={this.props.userAgent} <ide> javaScriptEnabled={javaScriptEnabled} <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java <ide> <ide> package com.facebook.react.views.webview; <ide> <del>import javax.annotation.Nullable; <del> <del>import java.util.Map; <del> <ide> import android.graphics.Bitmap; <ide> import android.os.Build; <ide> import android.os.SystemClock; <ide> import com.facebook.react.bridge.LifecycleEventListener; <ide> import com.facebook.react.bridge.ReactContext; <ide> import com.facebook.react.bridge.ReadableArray; <add>import com.facebook.react.bridge.ReadableMap; <add>import com.facebook.react.bridge.ReadableMapKeySetIterator; <ide> import com.facebook.react.bridge.WritableMap; <ide> import com.facebook.react.common.MapBuilder; <ide> import com.facebook.react.common.build.ReactBuildConfig; <del>import com.facebook.react.uimanager.annotations.ReactProp; <ide> import com.facebook.react.uimanager.SimpleViewManager; <ide> import com.facebook.react.uimanager.ThemedReactContext; <ide> import com.facebook.react.uimanager.UIManagerModule; <add>import com.facebook.react.uimanager.annotations.ReactProp; <ide> import com.facebook.react.uimanager.events.Event; <ide> import com.facebook.react.uimanager.events.EventDispatcher; <ide> <add>import java.util.HashMap; <add>import java.util.Map; <add> <add>import javax.annotation.Nullable; <add> <ide> /** <ide> * Manages instances of {@link WebView} <ide> * <ide> public void setInjectedJavaScript(WebView view, @Nullable String injectedJavaScr <ide> ((ReactWebView) view).setInjectedJavaScript(injectedJavaScript); <ide> } <ide> <del> @ReactProp(name = "html") <del> public void setHtml(WebView view, @Nullable String html) { <del> if (html != null) { <del> view.loadData(html, HTML_MIME_TYPE, HTML_ENCODING); <del> } else { <del> view.loadUrl(BLANK_URL); <del> } <del> } <del> <del> @ReactProp(name = "url") <del> public void setUrl(WebView view, @Nullable String url) { <del> // TODO(8495359): url and html are coupled as they both call loadUrl, therefore in case when <del> // property url is removed in favor of property html being added in single transaction we may <del> // end up in a state when blank url is loaded as it depends on the order of update operations! <del> <del> String currentUrl = view.getUrl(); <del> if (currentUrl != null && currentUrl.equals(url)) { <del> // We are already loading it so no need to stomp over it and start again <del> return; <del> } <del> if (url != null) { <del> view.loadUrl(url); <del> } else { <del> view.loadUrl(BLANK_URL); <add> @ReactProp(name = "source") <add> public void setSource(WebView view, @Nullable ReadableMap source) { <add> if (source != null) { <add> if (source.hasKey("html")) { <add> view.loadData(source.getString("html"), HTML_MIME_TYPE, HTML_ENCODING); <add> return; <add> } <add> if (source.hasKey("uri")) { <add> HashMap<String, String> headerMap = new HashMap<>(); <add> if (source.hasKey("headers")) { <add> ReadableMap headers = source.getMap("headers"); <add> ReadableMapKeySetIterator iter = headers.keySetIterator(); <add> while (iter.hasNextKey()) { <add> String key = iter.nextKey(); <add> headerMap.put(key, headers.getString(key)); <add> } <add> } <add> view.loadUrl(source.getString("uri"), headerMap); <add> return; <add> } <ide> } <add> view.loadUrl(BLANK_URL); <ide> } <ide> <ide> @Override
2
Python
Python
raise assertionerror on failure
c3d111cc84c04b1b70c719138cc46d3ad531bfed
<ide><path>numpy/lib/tests/test_regression.py <ide> class C(): <ide> out = open(os.devnull, 'w') <ide> try: <ide> np.info(C(), output=out) <add> except AttributeError: <add> raise AssertionError() <ide> finally: <ide> out.close() <ide>
1
Go
Go
move "viz" to graph/viz.go
77781440f13b07caa19c835523cbc6591dc1ffa8
<ide><path>graph/service.go <ide> func (s *TagStore) Install(eng *engine.Engine) error { <ide> eng.Register("image_export", s.CmdImageExport) <ide> eng.Register("history", s.CmdHistory) <ide> eng.Register("images", s.CmdImages) <add> eng.Register("viz", s.CmdViz) <ide> return nil <ide> } <ide> <ide><path>graph/viz.go <add>package graph <add> <add>import ( <add> "strings" <add> <add> "github.com/docker/docker/engine" <add> "github.com/docker/docker/image" <add>) <add> <add>func (s *TagStore) CmdViz(job *engine.Job) engine.Status { <add> images, _ := s.graph.Map() <add> if images == nil { <add> return engine.StatusOK <add> } <add> job.Stdout.Write([]byte("digraph docker {\n")) <add> <add> var ( <add> parentImage *image.Image <add> err error <add> ) <add> for _, image := range images { <add> parentImage, err = image.GetParent() <add> if err != nil { <add> return job.Errorf("Error while getting parent image: %v", err) <add> } <add> if parentImage != nil { <add> job.Stdout.Write([]byte(" \"" + parentImage.ID + "\" -> \"" + image.ID + "\"\n")) <add> } else { <add> job.Stdout.Write([]byte(" base -> \"" + image.ID + "\" [style=invis]\n")) <add> } <add> } <add> <add> for id, repos := range s.GetRepoRefs() { <add> job.Stdout.Write([]byte(" \"" + id + "\" [label=\"" + id + "\\n" + strings.Join(repos, "\\n") + "\",shape=box,fillcolor=\"paleturquoise\",style=\"filled,rounded\"];\n")) <add> } <add> job.Stdout.Write([]byte(" base [style=invisible]\n}\n")) <add> return engine.StatusOK <add>} <ide><path>server/image.go <ide> func (srv *Server) recursiveLoad(eng *engine.Engine, address, tmpImageDir string <ide> return nil <ide> } <ide> <del>func (srv *Server) ImagesViz(job *engine.Job) engine.Status { <del> images, _ := srv.daemon.Graph().Map() <del> if images == nil { <del> return engine.StatusOK <del> } <del> job.Stdout.Write([]byte("digraph docker {\n")) <del> <del> var ( <del> parentImage *image.Image <del> err error <del> ) <del> for _, image := range images { <del> parentImage, err = image.GetParent() <del> if err != nil { <del> return job.Errorf("Error while getting parent image: %v", err) <del> } <del> if parentImage != nil { <del> job.Stdout.Write([]byte(" \"" + parentImage.ID + "\" -> \"" + image.ID + "\"\n")) <del> } else { <del> job.Stdout.Write([]byte(" base -> \"" + image.ID + "\" [style=invis]\n")) <del> } <del> } <del> <del> for id, repos := range srv.daemon.Repositories().GetRepoRefs() { <del> job.Stdout.Write([]byte(" \"" + id + "\" [label=\"" + id + "\\n" + strings.Join(repos, "\\n") + "\",shape=box,fillcolor=\"paleturquoise\",style=\"filled,rounded\"];\n")) <del> } <del> job.Stdout.Write([]byte(" base [style=invisible]\n}\n")) <del> return engine.StatusOK <del>} <del> <ide> func (srv *Server) ImageTag(job *engine.Job) engine.Status { <ide> if len(job.Args) != 2 && len(job.Args) != 3 { <ide> return job.Errorf("Usage: %s IMAGE REPOSITORY [TAG]\n", job.Name) <ide><path>server/init.go <ide> func InitServer(job *engine.Job) engine.Status { <ide> for name, handler := range map[string]engine.Handler{ <ide> "tag": srv.ImageTag, // FIXME merge with "image_tag" <ide> "info": srv.DockerInfo, <del> "viz": srv.ImagesViz, <ide> "log": srv.Log, <ide> "load": srv.ImageLoad, <ide> "build": srv.Build,
4
Python
Python
apply suggestions from code review
57b5fc1995ded2f4bb9dd6305c567cdd4c1151ee
<ide><path>spacy/displacy/render.py <ide> def render_ents( <ide> end = span["end"] <ide> kb_id = span.get("kb_id", "") <ide> kb_url = span.get("kb_url", "") <add> if kb_id: <add> kb_link = """<a style="text-decoration: none; color: black; font-weight: bold" href="{}">{}</a>""".format(kb_url, kb_id) <add> else: <add> kb_link = "" <ide> additional_params = span.get("params", {}) <ide> entity = escape_html(text[start:end]) <ide> fragments = text[offset:start].split("\n") <ide> def render_ents( <ide> markup += "</br>" <ide> if self.ents is None or label.upper() in self.ents: <ide> color = self.colors.get(label.upper(), self.default_color) <del> ent_settings = {"label": label, "text": entity, "bg": color, "kb_id": kb_id, "kb_url": kb_url} <add> ent_settings = {"label": label, "text": entity, "bg": color, "kb_link": kb_link} <ide> ent_settings.update(additional_params) <ide> markup += self.ent_template.format(**ent_settings) <ide> else: <ide><path>spacy/displacy/templates.py <ide> <mark class="entity" style="background: {bg}; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;"> <ide> {text} <ide> <span style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem">{label} <del> <a style="text-decoration: none; color: black; font-weight: bold" href="{kb_url}">{kb_id}</a> <add> {kb_link} <ide> </span> <ide> </mark> <ide> """
2
PHP
PHP
add attributes() and hasattribute() functions
4c55494e675ee2d15c9067b1f235efd188fa1d9e
<ide><path>src/Illuminate/Validation/Validator.php <ide> public function after($callback) <ide> */ <ide> public function sometimes($attribute, $rules, callable $callback) <ide> { <del> $payload = new Fluent(array_merge($this->data, $this->files)); <add> $payload = new Fluent($this->attributes()); <ide> <ide> if (call_user_func($callback, $payload)) { <ide> foreach ((array) $attribute as $key) { <ide> public function each($attribute, $rules) <ide> */ <ide> protected function initializeAttributeOnData($attribute) <ide> { <del> if (! str_contains($attribute, '*') || ends_with($attribute, '*')) { <add> if (! Str::contains($attribute, '*') || Str::endsWith($attribute, '*')) { <ide> return $this->data; <ide> } <ide> <ide> protected function validateAccepted($attribute, $value) <ide> */ <ide> protected function validateArray($attribute, $value) <ide> { <del> if (! Arr::has(array_merge($this->data, $this->files), $attribute)) { <add> if (! $this->hasAttribute($attribute)) { <ide> return true; <ide> } <ide> <ide> protected function validateArray($attribute, $value) <ide> */ <ide> protected function validateBoolean($attribute, $value) <ide> { <del> if (! Arr::has(array_merge($this->data, $this->files), $attribute)) { <add> if (! $this->hasAttribute($attribute)) { <ide> return true; <ide> } <ide> <ide> protected function validateBoolean($attribute, $value) <ide> */ <ide> protected function validateInteger($attribute, $value) <ide> { <del> if (! Arr::has(array_merge($this->data, $this->files), $attribute)) { <add> if (! $this->hasAttribute($attribute)) { <ide> return true; <ide> } <ide> <ide> protected function validateInteger($attribute, $value) <ide> */ <ide> protected function validateNumeric($attribute, $value) <ide> { <del> if (! Arr::has(array_merge($this->data, $this->files), $attribute)) { <add> if (! $this->hasAttribute($attribute)) { <ide> return true; <ide> } <ide> <ide> protected function validateNumeric($attribute, $value) <ide> */ <ide> protected function validateString($attribute, $value) <ide> { <del> if (! Arr::has(array_merge($this->data, $this->files), $attribute)) { <add> if (! $this->hasAttribute($attribute)) { <ide> return true; <ide> } <ide> <ide> public function __call($method, $parameters) <ide> <ide> throw new BadMethodCallException("Method [$method] does not exist."); <ide> } <add> <add> /** <add> * Get all attributes. <add> * <add> * @return array <add> */ <add> protected function attributes() <add> { <add> return array_merge($this->data, $this->files); <add> } <add> <add> /** <add> * Checks if an attribute exists. <add> * <add> * @param string $attribute <add> * @return bool <add> */ <add> protected function hasAttribute($attribute) <add> { <add> return Arr::has($this->attributes(), $attribute); <add> } <ide> }
1
Ruby
Ruby
fix method typo
48641f3a3a0423004a7e6f8bae931e752b534f28
<ide><path>Library/Homebrew/install.rb <ide> def install_formula( <ide> Upgrading #{Formatted.identifier(f.name)} #{version_upgrade} <ide> EOS <ide> outdated_kegs = outdated_formulae.map(&:linked_keg).select(&:directory?).map { |k| Keg.new(k.resolved_path) } <del> linked_kegs = outdated_kegs.select(&:linked) <add> linked_kegs = outdated_kegs.select(&:linked?) <ide> end <ide> <ide> fi = FormulaInstaller.new(
1
Ruby
Ruby
pass a request object to the headers object
34fa6658dd1b779b21e586f01ee64c6f59ca1537
<ide><path>actionpack/lib/action_dispatch/http/headers.rb <ide> class Headers <ide> HTTP_HEADER = /\A[A-Za-z0-9-]+\z/ <ide> <ide> include Enumerable <del> attr_reader :env <ide> <del> def initialize(env = {}) # :nodoc: <del> @env = env <add> def self.from_hash(hash) <add> new ActionDispatch::Request.new hash <add> end <add> <add> def initialize(request) # :nodoc: <add> @req = request <ide> end <ide> <ide> # Returns the value for the given key mapped to @env. <ide> def [](key) <del> @env[env_name(key)] <add> env[env_name(key)] <ide> end <ide> <ide> # Sets the given value for the key mapped to @env. <ide> def []=(key, value) <del> @env[env_name(key)] = value <add> env[env_name(key)] = value <ide> end <ide> <ide> def key?(key) <del> @env.key? env_name(key) <add> env.key? env_name(key) <ide> end <ide> alias :include? :key? <ide> <ide> def key?(key) <ide> # If the code block is provided, then it will be run and <ide> # its result returned. <ide> def fetch(key, *args, &block) <del> @env.fetch env_name(key), *args, &block <add> env.fetch env_name(key), *args, &block <ide> end <ide> <ide> def each(&block) <del> @env.each(&block) <add> env.each(&block) <ide> end <ide> <ide> # Returns a new Http::Headers instance containing the contents of <ide> # <tt>headers_or_env</tt> and the original instance. <ide> def merge(headers_or_env) <del> headers = Http::Headers.new(env.dup) <add> headers = Http::Headers.new(ActionDispatch::Request.new(env.dup)) <ide> headers.merge!(headers_or_env) <ide> headers <ide> end <ide> def merge!(headers_or_env) <ide> end <ide> end <ide> <add> def env; @req.env; end <add> <ide> private <add> <ide> # Converts a HTTP header name to an environment variable name if it is <ide> # not contained within the headers hash. <ide> def env_name(key) <ide><path>actionpack/lib/action_dispatch/http/request.rb <ide> def method_symbol <ide> # <ide> # request.headers["Content-Type"] # => "text/plain" <ide> def headers <del> @headers ||= Http::Headers.new(@env) <add> @headers ||= Http::Headers.new(self) <ide> end <ide> <ide> # Returns a +String+ with the last requested path including their params. <ide><path>actionpack/lib/action_dispatch/testing/integration.rb <ide> def process(method, path, params: nil, headers: nil, env: nil, xhr: false) <ide> <ide> # this modifies the passed request_env directly <ide> if headers.present? <del> Http::Headers.new(request_env).merge!(headers) <add> Http::Headers.from_hash(request_env).merge!(headers) <ide> end <ide> if env.present? <del> Http::Headers.new(request_env).merge!(env) <add> Http::Headers.from_hash(request_env).merge!(env) <ide> end <ide> <ide> session = Rack::Test::Session.new(_mock_session) <ide><path>actionpack/test/dispatch/header_test.rb <ide> <ide> class HeaderTest < ActiveSupport::TestCase <ide> def make_headers(hash) <del> ActionDispatch::Http::Headers.new hash <add> ActionDispatch::Http::Headers.new ActionDispatch::Request.new hash <ide> end <ide> <ide> setup do
4
PHP
PHP
fix silent failures
00f3e7e441d3f8e839a2488e4caebe19ede81b84
<ide><path>lib/Cake/TestSuite/ControllerTestCase.php <ide> abstract class ControllerTestCase extends CakeTestCase { <ide> * <ide> * @param string $name The name of the function <ide> * @param array $arguments Array of arguments <del> * @return Function <add> * @return the return of _testAction <add> * @throws BadMethodCallException when you call methods that don't exist. <ide> */ <ide> public function __call($name, $arguments) { <ide> if ($name == 'testAction') { <ide> return call_user_func_array(array($this, '_testAction'), $arguments); <ide> } <add> throw new BadMethodCallException("Method '{$name}' does not exist."); <ide> } <ide> <ide> /**
1
Text
Text
add a section on rn support
022e6b0fa0c47754d36f7cb37a6842b385ee4141
<ide><path>README.md <ide> export default class Counter { <ide> <ide> import React from 'react'; <ide> import { bindActionCreators } from 'redux'; <del>import { Connector } from 'redux/react'; // Or redux/react-native <add>import { Connector } from 'redux/react'; <ide> import Counter from '../components/Counter'; <ide> import * as CounterActions from '../actions/CounterActions'; <ide> <ide> The `@connect` decorator lets you create smart components less verbosely: <ide> ```js <ide> import React from 'react'; <ide> import { bindActionCreators } from 'redux'; <del>import { connect } from 'redux/react'; // Or redux/react-native <add>import { connect } from 'redux/react'; <ide> import Counter from '../components/Counter'; <ide> import * as CounterActions from '../actions/CounterActions'; <ide> <ide> export default class CounterApp { <ide> } <ide> ``` <ide> <add>#### React Native <add> <add>To use Redux with React Native, just replace imports from `redux/react` with `redux/react-native`: <add> <add>```js <add>import { bindActionCreators } from 'redux'; <add>import { Provider, Connector } from 'redux/react-native'; <add>``` <add> <ide> #### Initializing Redux <ide> <ide> The simplest way to initialize a Redux instance is to give it an object whose values are your Store functions, and whose keys are their names. You may `import *` from the file with all your Store definitions to obtain such an object:
1
Python
Python
delay calls of array repr in getlimits
0649ba224f7b44f6da7005c1e8240d970a5a3be5
<ide><path>numpy/core/getlimits.py <ide> def __init__(self, <ide> params = _MACHAR_PARAMS[ftype] <ide> float_conv = lambda v: array([v], ftype) <ide> float_to_float = lambda v : _fr1(float_conv(v)) <del> float_to_str = lambda v: (params['fmt'] % array(_fr0(v)[0], ftype)) <add> self._float_to_str = lambda v: (params['fmt'] % <add> array(_fr0(v)[0], ftype)) <ide> self.title = params['title'] <ide> # Parameter types same as for discovered MachAr object. <ide> self.epsilon = self.eps = float_to_float(kwargs.pop('eps')) <ide> def __init__(self, <ide> self.__dict__.update(kwargs) <ide> self.precision = int(-log10(self.eps)) <ide> self.resolution = float_to_float(float_conv(10) ** (-self.precision)) <del> self._str_eps = float_to_str(self.eps) <del> self._str_epsneg = float_to_str(self.epsneg) <del> self._str_xmin = float_to_str(self.xmin) <del> self._str_xmax = float_to_str(self.xmax) <del> self._str_resolution = float_to_str(self.resolution) <add> <add> # Properties below to delay need for float_to_str, and thus avoid circular <add> # imports during early numpy module loading. <add> # See: https://github.com/numpy/numpy/pull/8983#discussion_r115838683 <add> <add> @property <add> def _str_eps(self): <add> return self._float_to_str(self.eps) <add> <add> @property <add> def _str_epsneg(self): <add> return self._float_to_str(self.epsneg) <add> <add> @property <add> def _str_xmin(self): <add> return self._float_to_str(self.xmin) <add> <add> @property <add> def _str_xmax(self): <add> return self._float_to_str(self.xmax) <add> <add> @property <add> def _str_resolution(self): <add> return self._float_to_str(self.resolution) <ide> <ide> <ide> # Known parameters for float16
1
PHP
PHP
remove temp variable
9d54a3bbdf32d185a68e2261be1eca95ac071729
<ide><path>src/Illuminate/Database/Schema/MySqlSchemaState.php <ide> protected function executeDumpProcess(Process $process, $output, array $variable <ide> $process->mustRun($output, $variables); <ide> } catch (Exception $e) { <ide> if (Str::contains($e->getMessage(), 'column_statistics')) { <del> $process = Process::fromShellCommandLine( <add> return $this->executeDumpProcess(Process::fromShellCommandLine( <ide> str_replace(' --column-statistics=0', '', $process->getCommandLine()) <del> ); <del> <del> return $this->executeDumpProcess($process, $output, $variables); <add> ), $output, $variables); <ide> } <ide> } <ide>
1
Go
Go
increase timeout on health check command
47436e9628149e7077a8e89c2fcac2a8f85bc62a
<ide><path>integration-cli/docker_api_swarm_service_test.go <ide> func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *check.C) { <ide> // service started from this image won't pass health check <ide> _, _, err := d.BuildImageWithOut(image2, <ide> `FROM busybox <del> HEALTHCHECK --interval=1s --timeout=1s --retries=1024\ <add> HEALTHCHECK --interval=1s --timeout=30s --retries=1024 \ <ide> CMD cat /status`, <ide> true) <ide> c.Check(err, check.IsNil)
1
PHP
PHP
add mapinto method
2642ac73cc5718a8aebe3d009b143b0fa43be085
<ide><path>src/Illuminate/Support/Collection.php <ide> public function flatMap(callable $callback) <ide> return $this->map($callback)->collapse(); <ide> } <ide> <add> /** <add> * Map the values into a new class. <add> * <add> * @param string $class <add> * @return static <add> */ <add> public function mapInto($class) <add> { <add> return $this->map(function ($value, $key) use ($class) { <add> return new $class($value, $key); <add> }); <add> } <add> <ide> /** <ide> * Get the max value of a given key. <ide> * <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testMapWithKeysCallbackKey() <ide> ); <ide> } <ide> <add> public function testMapInto() <add> { <add> $data = new Collection([ <add> 'first', 'second', <add> ]); <add> <add> $data = $data->mapInto(TestCollectionMapIntoObject::class); <add> <add> $this->assertEquals('first', $data[0]->value); <add> $this->assertEquals('second', $data[1]->value); <add> } <add> <ide> public function testNth() <ide> { <ide> $data = new Collection([ <ide> public function jsonSerialize() <ide> return ['foo' => 'bar']; <ide> } <ide> } <add> <add>class TestCollectionMapIntoObject <add>{ <add> public $value; <add> <add> public function __construct($value) <add> { <add> $this->value = $value; <add> } <add>}
2
PHP
PHP
fix bug in wincache driver
24a3fc8ccf7d6839e42f5f509e413bbcde8ac06b
<ide><path>src/Illuminate/Cache/WinCacheStore.php <ide> protected function retrieveItem($key) <ide> */ <ide> protected function storeItem($key, $value, $minutes) <ide> { <del> wincache_ucache_add($this->prefix.$key, value, $minutes * 60); <add> wincache_ucache_add($this->prefix.$key, $value, $minutes * 60); <ide> } <ide> <ide> /**
1
Text
Text
fix typo in models.md
8109f0bcf29ede50b41b70fe6ecb5d1eca8ead79
<ide><path>website/docs/usage/models.md <ide> logic around spaCy's loader, you can use <ide> [pytest](http://pytest.readthedocs.io/en/latest/)'s <ide> [`importorskip()`](https://docs.pytest.org/en/latest/builtin.html#_pytest.outcomes.importorskip) <ide> method to only run a test if a specific pipeline package or version is <del>installed. Each pipeline package package exposes a `__version__` attribute which <add>installed. Each pipeline package exposes a `__version__` attribute which <ide> you can also use to perform your own version compatibility checks before loading <ide> it.
1
Javascript
Javascript
add support for copying `blob` objects
0b1b9112a341f7f798db915575fad63e0e59894e
<ide><path>src/Angular.js <ide> function copy(source, destination) { <ide> var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]); <ide> re.lastIndex = source.lastIndex; <ide> return re; <add> <add> case '[object Blob]': <add> return new source.constructor([source], {type: source.type}); <ide> } <ide> <ide> if (isFunction(source.cloneNode)) { <ide><path>test/AngularSpec.js <ide> describe('angular', function() { <ide> } <ide> }); <ide> <add> it('should handle Blob objects', function() { <add> if (typeof Blob !== 'undefined') { <add> var src = new Blob(['foo'], {type: 'bar'}); <add> var dst = copy(src); <add> <add> expect(dst).not.toBe(src); <add> expect(dst.size).toBe(3); <add> expect(dst.type).toBe('bar'); <add> expect(isBlob(dst)).toBe(true); <add> } <add> }); <add> <ide> it("should throw an exception if a Uint8Array is the destination", function() { <ide> if (typeof Uint8Array !== 'undefined') { <ide> var src = new Uint8Array(); <ide><path>test/ngMock/angular-mocksSpec.js <ide> describe('ngMock', function() { <ide> }); <ide> <ide> <add> it('should be able to handle Blobs as mock data', function() { <add> if (typeof Blob !== 'undefined') { <add> var mockBlob = new Blob(['{"foo":"bar"}'], {type: 'application/json'}); <add> <add> hb.when('GET', '/url1').respond(200, mockBlob, {}); <add> <add> callback.andCallFake(function(status, response) { <add> expect(response).not.toBe(mockBlob); <add> expect(response.size).toBe(13); <add> expect(response.type).toBe('application/json'); <add> expect(response.toString()).toBe('[object Blob]'); <add> }); <add> <add> hb('GET', '/url1', null, callback); <add> hb.flush(); <add> expect(callback).toHaveBeenCalledOnce(); <add> } <add> }); <add> <add> <ide> it('should throw error when unexpected request', function() { <ide> hb.when('GET', '/url1').respond(200, 'content'); <ide> expect(function() {
3
PHP
PHP
fix tests that fail on windows
154b0015525642344d7a8e1931d32babec769e9d
<ide><path>lib/Cake/Test/Case/Utility/DebuggerTest.php <ide> public function testExportVar() { <ide> float => (float) 1.333 <ide> } <ide> TEXT; <del> $result = str_replace(array("\r\n", "\n"), "", $result); <del> $expected = str_replace(array("\r\n", "\n"), "", $expected); <del> $this->assertEquals($expected, $result); <add> $this->assertTextEquals($expected, $result); <ide> <ide> $data = array( <ide> 1 => 'Index one', <ide> public function testExportVar() { <ide> (int) 5 => 'Index five' <ide> ) <ide> TEXT; <del> $this->assertEquals($expected, $result); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide> public function testDump() { <ide> ) <ide> )</pre> <ide> TEXT; <del> $result = str_replace(array("\r\n", "\n"), "", $result); <del> $expected = str_replace(array("\r\n", "\n"), "", $expected); <del> $this->assertEquals($expected, $result); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/Case/Utility/SanitizeTest.php <ide> public function testStripScripts() { <ide> HTML; <ide> $expected = "text\n\ntext"; <ide> $result = Sanitize::stripScripts($string); <del> $this->assertEquals($expected, $result); <add> $this->assertTextEquals($expected, $result); <ide> <ide> $string = <<<HTML <ide> text <ide> public function testStripScripts() { <ide> HTML; <ide> $expected = "text\n\ntext"; <ide> $result = Sanitize::stripScripts($string); <del> $this->assertEquals($expected, $result); <add> $this->assertTextEquals($expected, $result); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/Case/Utility/StringTest.php <ide> public function testWrap() { <ide> This is the song that never ends. <ide> This is the song that never ends. <ide> TEXT; <del> $this->assertEquals($expected, $result, 'Text not wrapped.'); <add> $this->assertTextEquals($expected, $result, 'Text not wrapped.'); <ide> <ide> $result = String::wrap($text, array('width' => 20, 'wordWrap' => false)); <ide> $expected = <<<TEXT <ide> public function testWrap() { <ide> the song that never <ide> ends. <ide> TEXT; <del> $this->assertEquals($expected, $result, 'Text not wrapped.'); <add> $this->assertTextEquals($expected, $result, 'Text not wrapped.'); <ide> } <ide> <ide> /** <ide> public function testWrapIndent() { <ide> This is the song that never ends. <ide> This is the song that never ends. <ide> TEXT; <add> $this->assertTextEquals($expected, $result); <ide> } <ide> }
3
Javascript
Javascript
make timeout longer (correctly)
f582f9e57be3cc7988d3a7c99493e77d8eda17e6
<ide><path>Gruntfile.js <ide> module.exports = function(grunt) { <ide> stderr: true, <ide> failOnError: true <ide> }, <del> command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js -t 2000') <add> command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js --timeout 2000') <ide> } <ide> }, <ide>
1
Ruby
Ruby
move alias building to the table node
a53c2beac42e0fea5dab9a334a066911beeba976
<ide><path>activerecord/lib/active_record/associations/join_dependency.rb <ide> def columns <ide> @tables.flat_map { |t| t.columns } <ide> end <ide> <del> class Table < Struct.new(:table, :columns) <add> class Table < Struct.new(:name, :alias, :columns) <add> def table <add> Arel::Nodes::TableAlias.new name, self.alias <add> end <add> <ide> def columns <del> super.map { |column| table[column.name].as Arel.sql column.alias } <add> t = table <add> super.map { |column| t[column.name].as Arel.sql column.alias } <ide> end <ide> end <ide> Column = Struct.new(:name, :alias) <ide> end <ide> <ide> def aliases <ide> Aliases.new join_root.each_with_index.map { |join_part,i| <del> table = join_part.aliased_table <ide> columns = join_part.column_names.each_with_index.map { |column_name,j| <ide> Aliases::Column.new column_name, "t#{i}_r#{j}" <ide> } <del> Aliases::Table.new(table, columns) <add> Aliases::Table.new(join_part.table, join_part.aliased_table_name, columns) <ide> } <ide> end <ide> <ide><path>activerecord/lib/active_record/associations/join_dependency/join_part.rb <ide> def each(&block) <ide> children.each { |child| child.each(&block) } <ide> end <ide> <del> def aliased_table <del> Arel::Nodes::TableAlias.new table, aliased_table_name <del> end <del> <ide> # An Arel::Table for the active_record <ide> def table <ide> raise NotImplementedError
2
Python
Python
resolve line-too-long in applications
2ba062a28b6c646e1a0a88d0e0d30aab3438c757
<ide><path>keras/applications/convnext.py <ide> include_top: Whether to include the fully-connected <ide> layer at the top of the network. Defaults to True. <ide> weights: One of `None` (random initialization), <del> `"imagenet"` (pre-training on ImageNet-1k), or the path to the weights file <del> to be loaded. Defaults to `"imagenet"`. <add> `"imagenet"` (pre-training on ImageNet-1k), or the path to the weights <add> file to be loaded. Defaults to `"imagenet"`. <ide> input_tensor: Optional Keras tensor <ide> (i.e. output of `layers.Input()`) <ide> to use as image input for the model. <ide> def ConvNeXtBlock( <ide> """ConvNeXt block. <ide> <ide> References: <del> - https://arxiv.org/abs/2201.03545 <del> - https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py <add> - https://arxiv.org/abs/2201.03545 <add> - https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py <ide> <ide> Notes: <ide> In the original ConvNeXt implementation (linked above), the authors use <ide> def ConvNeXt( <ide> depths: An iterable containing depths for each individual stages. <ide> projection_dims: An iterable containing output number of channels of <ide> each individual stages. <del> drop_path_rate: Stochastic depth probability. If 0.0, then stochastic depth <add> drop_path_rate: Stochastic depth probability. If 0.0, then stochastic <add> depth won't be used. <add> layer_scale_init_value: Layer scale coefficient. If 0.0, layer scaling <ide> won't be used. <del> layer_scale_init_value: Layer scale coefficient. If 0.0, layer scaling won't <del> be used. <ide> default_size: Default input image size. <ide> model_name: An optional name for the model. <ide> include_preprocessing: boolean denoting whther to include preprocessing in <ide> the model. When `weights="imagenet"` this should be always set to True. <ide> But for other models (e.g., randomly initialized) users should set it <ide> to False and apply preprocessing to data accordingly. <del> include_top: Boolean denoting whether to include classification head to the <del> model. <add> include_top: Boolean denoting whether to include classification head to <add> the model. <ide> weights: one of `None` (random initialization), `"imagenet"` (pre-training <ide> on ImageNet-1k), or the path to the weights file to be loaded. <del> input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to use <del> as image input for the model. <del> input_shape: optional shape tuple, only to be specified if `include_top` is <del> False. It should have exactly 3 inputs channels. <del> pooling: optional pooling mode for feature extraction when `include_top` is <del> `False`. - `None` means that the output of the model will be the 4D tensor <del> output of the last convolutional layer. - `avg` means that global average <del> pooling will be applied to the output of the last convolutional layer, and <del> thus the output of the model will be a 2D tensor. - `max` means that <del> global max pooling will be applied. <add> input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to <add> use as image input for the model. <add> input_shape: optional shape tuple, only to be specified if `include_top` <add> is False. It should have exactly 3 inputs channels. <add> pooling: optional pooling mode for feature extraction when `include_top` <add> is `False`. <add> - `None` means that the output of the model will be the 4D tensor output <add> of the last convolutional layer. <add> - `avg` means that global average pooling will be applied to the output <add> of the last convolutional layer, and thus the output of the model will <add> be a 2D tensor. <add> - `max` means that global max pooling will be applied. <ide> classes: optional number of classes to classify images into, only to be <ide> specified if `include_top` is True, and if no `weights` argument is <ide> specified. <ide> def preprocess_input(x, data_format=None): # pylint: disable=unused-argument <ide> """A placeholder method for backward compatibility. <ide> <ide> The preprocessing logic has been included in the convnext model <del> implementation. Users are no longer required to call this method to normalize <del> the input data. This method does nothing and only kept as a placeholder to <del> align the API surface between old and new version of model. <add> implementation. Users are no longer required to call this method to <add> normalize the input data. This method does nothing and only kept as a <add> placeholder to align the API surface between old and new version of model. <ide> <ide> Args: <ide> x: A floating point `numpy.array` or a `tf.Tensor`. <ide> data_format: Optional data format of the image tensor/array. Defaults to <ide> None, in which case the global setting <del> `tf.keras.backend.image_data_format()` is used (unless you changed it, it <del> defaults to "channels_last").{mode} <add> `tf.keras.backend.image_data_format()` is used (unless you changed it, <add> it defaults to "channels_last").{mode} <ide> <ide> Returns: <ide> Unchanged `numpy.array` or `tf.Tensor`. <ide><path>keras/applications/efficientnet.py <ide> def round_repeats(repeats): <ide> # However, the original implemenetation uses (input - mean) / var to <ide> # normalize the input, we need to divide another sqrt(var) to match the <ide> # original implementation. <del> # See https://github.com/tensorflow/tensorflow/issues/49930 for more details <add> # See https://github.com/tensorflow/tensorflow/issues/49930 for more <add> # details <ide> x = layers.Rescaling(1.0 / tf.math.sqrt(IMAGENET_STDDEV_RGB))(x) <ide> <ide> x = layers.ZeroPadding2D( <ide> def round_repeats(repeats): <ide> args["filters_out"] = round_filters(args["filters_out"]) <ide> <ide> for j in range(round_repeats(args.pop("repeats"))): <del> # The first block needs to take care of stride and filter size increase. <add> # The first block needs to take care of stride and filter size <add> # increase. <ide> if j > 0: <ide> args["strides"] = 1 <ide> args["filters_in"] = args["filters_out"] <ide> def preprocess_input(x, data_format=None): # pylint: disable=unused-argument <ide> """A placeholder method for backward compatibility. <ide> <ide> The preprocessing logic has been included in the efficientnet model <del> implementation. Users are no longer required to call this method to normalize <del> the input data. This method does nothing and only kept as a placeholder to <del> align the API surface between old and new version of model. <add> implementation. Users are no longer required to call this method to <add> normalize the input data. This method does nothing and only kept as a <add> placeholder to align the API surface between old and new version of model. <ide> <ide> Args: <ide> x: A floating point `numpy.array` or a `tf.Tensor`. <ide><path>keras/applications/efficientnet_v2.py <ide> https://keras.io/guides/transfer_learning/). <ide> <ide> Note: each Keras Application expects a specific kind of input preprocessing. <del> For EfficientNetV2, by default input preprocessing is included as a part of the <del> model (as a `Rescaling` layer), and thus <add> For EfficientNetV2, by default input preprocessing is included as a part of <add> the model (as a `Rescaling` layer), and thus <ide> `tf.keras.applications.efficientnet_v2.preprocess_input` is actually a <del> pass-through function. In this use case, EfficientNetV2 models expect their inputs <del> to be float tensors of pixels with values in the [0-255] range. <add> pass-through function. In this use case, EfficientNetV2 models expect their <add> inputs to be float tensors of pixels with values in the [0-255] range. <ide> At the same time, preprocessing as a part of the model (i.e. `Rescaling` <ide> layer) can be disabled by setting `include_preprocessing` argument to False. <del> With preprocessing disabled EfficientNetV2 models expect their inputs to be float <del> tensors of pixels with values in the [-1, 1] range. <add> With preprocessing disabled EfficientNetV2 models expect their inputs to be <add> float tensors of pixels with values in the [-1, 1] range. <ide> <ide> Args: <ide> include_top: Boolean, whether to include the fully-connected <ide> def FusedMBConvBlock( <ide> survival_probability: float = 0.8, <ide> name=None, <ide> ): <del> """Fused MBConv Block: Fusing the proj conv1x1 and depthwise_conv into a conv2d.""" <add> """Fused MBConv Block: Fusing the proj conv1x1 and depthwise_conv into a <add> conv2d.""" <ide> bn_axis = 3 if backend.image_data_format() == "channels_last" else 1 <ide> <ide> if name is None: <ide> def EfficientNetV2( <ide> classifier_activation="softmax", <ide> include_preprocessing=True, <ide> ): <del> """Instantiates the EfficientNetV2 architecture using given scaling coefficients. <add> """Instantiates the EfficientNetV2 architecture using given scaling <add> coefficients. <ide> <ide> Args: <ide> width_coefficient: float, scaling coefficient for network width. <ide> def EfficientNetV2( <ide> activation: activation function. <ide> blocks_args: list of dicts, parameters to construct block modules. <ide> model_name: string, model name. <del> include_top: whether to include the fully-connected layer at the top of the <del> network. <add> include_top: whether to include the fully-connected layer at the top of <add> the network. <ide> weights: one of `None` (random initialization), `"imagenet"` (pre-training <ide> on ImageNet), or the path to the weights file to be loaded. <ide> input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) or <ide> numpy array to use as image input for the model. <del> input_shape: optional shape tuple, only to be specified if `include_top` is <del> False. It should have exactly 3 inputs channels. <del> pooling: optional pooling mode for feature extraction when `include_top` is <del> `False`. - `None` means that the output of the model will be the 4D tensor <del> output of the last convolutional layer. - "avg" means that global average <del> pooling will be applied to the output of the last convolutional layer, and <del> thus the output of the model will be a 2D tensor. - `"max"` means that <del> global max pooling will be applied. <add> input_shape: optional shape tuple, only to be specified if `include_top` <add> is False. It should have exactly 3 inputs channels. <add> pooling: optional pooling mode for feature extraction when `include_top` <add> is `False`. <add> - `None` means that the output of the model will be the 4D tensor output <add> of the last convolutional layer. <add> - "avg" means that global average pooling will be applied to the output <add> of the last convolutional layer, and thus the output of the model will <add> be a 2D tensor. <add> - `"max"` means that global max pooling will be applied. <ide> classes: optional number of classes to classify images into, only to be <ide> specified if `include_top` is True, and if no `weights` argument is <ide> specified. <del> classifier_activation: A string or callable. The activation function to use <del> on the `"top"` layer. Ignored unless `include_top=True`. Set <add> classifier_activation: A string or callable. The activation function to <add> use on the `"top"` layer. Ignored unless `include_top=True`. Set <ide> `classifier_activation=None` to return the logits of the `"top"` layer. <ide> include_preprocessing: Boolean, whether to include the preprocessing layer <ide> (`Rescaling`) at the bottom of the network. Defaults to `True`. <ide> def EfficientNetV2( <ide> repeats=args.pop("num_repeat"), depth_coefficient=depth_coefficient <ide> ) <ide> for j in range(repeats): <del> # The first block needs to take care of stride and filter size increase. <add> # The first block needs to take care of stride and filter size <add> # increase. <ide> if j > 0: <ide> args["strides"] = 1 <ide> args["input_filters"] = args["output_filters"] <ide> def preprocess_input(x, data_format=None): # pylint: disable=unused-argument <ide> """A placeholder method for backward compatibility. <ide> <ide> The preprocessing logic has been included in the EfficientNetV2 model <del> implementation. Users are no longer required to call this method to normalize <del> the input data. This method does nothing and only kept as a placeholder to <del> align the API surface between old and new version of model. <add> implementation. Users are no longer required to call this method to <add> normalize the input data. This method does nothing and only kept as a <add> placeholder to align the API surface between old and new version of model. <ide> <ide> Args: <ide> x: A floating point `numpy.array` or a `tf.Tensor`. <ide> data_format: Optional data format of the image tensor/array. Defaults to <ide> None, in which case the global setting <del> `tf.keras.backend.image_data_format()` is used (unless you changed it, it <del> defaults to "channels_last").{mode} <add> `tf.keras.backend.image_data_format()` is used (unless you changed it, <add> it defaults to "channels_last").{mode} <ide> <ide> Returns: <ide> Unchanged `numpy.array` or `tf.Tensor`. <ide><path>keras/applications/inception_resnet_v2.py <ide> def inception_resnet_block(x, scale, block_type, block_idx, activation="relu"): <ide> x: input tensor. <ide> scale: scaling factor to scale the residuals (i.e., the output of passing <ide> `x` through an inception module) before adding them to the shortcut <del> branch. Let `r` be the output from the residual branch, the output of this <del> block will be `x + scale * r`. <add> branch. Let `r` be the output from the residual branch, the output of <add> this block will be `x + scale * r`. <ide> block_type: `'block35'`, `'block17'` or `'block8'`, determines the network <ide> structure in the residual branch. <ide> block_idx: an `int` used for generating layer names. The Inception-ResNet <ide><path>keras/applications/inception_v3.py <ide> def InceptionV3( <ide> https://keras.io/guides/transfer_learning/). <ide> <ide> Note: each Keras Application expects a specific kind of input preprocessing. <del> For `InceptionV3`, call `tf.keras.applications.inception_v3.preprocess_input` <del> on your inputs before passing them to the model. <del> `inception_v3.preprocess_input` will scale input pixels between -1 and 1. <add> For `InceptionV3`, call <add> `tf.keras.applications.inception_v3.preprocess_input` on your inputs before <add> passing them to the model. `inception_v3.preprocess_input` will scale input <add> pixels between -1 and 1. <ide> <ide> Args: <ide> include_top: Boolean, whether to include the fully-connected <ide> def InceptionV3( <ide> `imagenet` (pre-training on ImageNet), <ide> or the path to the weights file to be loaded. Default to `imagenet`. <ide> input_tensor: Optional Keras tensor (i.e. output of `layers.Input()`) <del> to use as image input for the model. `input_tensor` is useful for sharing <del> inputs between multiple different networks. Default to None. <add> to use as image input for the model. `input_tensor` is useful for <add> sharing inputs between multiple different networks. Default to None. <ide> input_shape: Optional shape tuple, only to be specified <ide> if `include_top` is False (otherwise the input shape <ide> has to be `(299, 299, 3)` (with `channels_last` data format) <ide><path>keras/applications/mobilenet_v2.py <ide> def MobileNetV2( <ide> include_top: Boolean, whether to include the fully-connected layer at the <ide> top of the network. Defaults to `True`. <ide> weights: String, one of `None` (random initialization), 'imagenet' <del> (pre-training on ImageNet), or the path to the weights file to be loaded. <add> (pre-training on ImageNet), or the path to the weights file to be <add> loaded. <ide> input_tensor: Optional Keras tensor (i.e. output of `layers.Input()`) <ide> to use as image input for the model. <ide> pooling: String, optional pooling mode for feature extraction when <ide> def MobileNetV2( <ide> 2D tensor. <ide> - `max` means that global max pooling will <ide> be applied. <del> classes: Optional integer number of classes to classify images into, only to <del> be specified if `include_top` is True, and if no `weights` argument is <del> specified. <add> classes: Optional integer number of classes to classify images into, only <add> to be specified if `include_top` is True, and if no `weights` argument <add> is specified. <ide> classifier_activation: A `str` or callable. The activation function to use <ide> on the "top" layer. Ignored unless `include_top=True`. Set <ide> `classifier_activation=None` to return the logits of the "top" layer. <ide> def _inverted_res_block(inputs, expansion, stride, alpha, filters, block_id): <ide> <ide> in_channels = backend.int_shape(inputs)[channel_axis] <ide> pointwise_conv_filters = int(filters * alpha) <del> # Ensure the number of filters on the last 1x1 convolution is divisible by 8. <add> # Ensure the number of filters on the last 1x1 convolution is divisible by <add> # 8. <ide> pointwise_filters = _make_divisible(pointwise_conv_filters, 8) <ide> x = inputs <ide> prefix = "block_{}_".format(block_id) <ide><path>keras/applications/mobilenet_v3.py <ide> For MobileNetV3, by default input preprocessing is included as a part of the <ide> model (as a `Rescaling` layer), and thus <ide> `tf.keras.applications.mobilenet_v3.preprocess_input` is actually a <del> pass-through function. In this use case, MobileNetV3 models expect their inputs <del> to be float tensors of pixels with values in the [0-255] range. <add> pass-through function. In this use case, MobileNetV3 models expect their <add> inputs to be float tensors of pixels with values in the [0-255] range. <ide> At the same time, preprocessing as a part of the model (i.e. `Rescaling` <ide> layer) can be disabled by setting `include_preprocessing` argument to False. <ide> With preprocessing disabled MobileNetV3 models expect their inputs to be float <ide> def preprocess_input(x, data_format=None): # pylint: disable=unused-argument <ide> """A placeholder method for backward compatibility. <ide> <ide> The preprocessing logic has been included in the mobilenet_v3 model <del> implementation. Users are no longer required to call this method to normalize <del> the input data. This method does nothing and only kept as a placeholder to <del> align the API surface between old and new version of model. <add> implementation. Users are no longer required to call this method to <add> normalize the input data. This method does nothing and only kept as a <add> placeholder to align the API surface between old and new version of model. <ide> <ide> Args: <ide> x: A floating point `numpy.array` or a `tf.Tensor`. <ide><path>keras/applications/nasnet.py <ide> def NASNetMobile( <ide> include_top: Whether to include the fully-connected <ide> layer at the top of the network. <ide> weights: `None` (random initialization) or <del> `imagenet` (ImageNet weights) <del> For loading `imagenet` weights, `input_shape` should be (224, 224, 3) <add> `imagenet` (ImageNet weights). For loading `imagenet` weights, <add> `input_shape` should be (224, 224, 3) <ide> input_tensor: Optional Keras tensor (i.e. output of <ide> `layers.Input()`) <ide> to use as image input for the model. <ide> def NASNetMobile( <ide> classes: Optional number of classes to classify images <ide> into, only to be specified if `include_top` is True, and <ide> if no `weights` argument is specified. <del> classifier_activation: A `str` or callable. The activation function to use <del> on the "top" layer. Ignored unless `include_top=True`. Set <del> `classifier_activation=None` to return the logits of the "top" layer. <del> When loading pretrained weights, `classifier_activation` can only <del> be `None` or `"softmax"`. <add> classifier_activation: A `str` or callable. The activation function to <add> use on the "top" layer. Ignored unless `include_top=True`. Set <add> `classifier_activation=None` to return the logits of the "top" <add> layer. When loading pretrained weights, `classifier_activation` can <add> only be `None` or `"softmax"`. <ide> <ide> Returns: <ide> A Keras model instance. <ide> def NASNetLarge( <ide> include_top: Whether to include the fully-connected <ide> layer at the top of the network. <ide> weights: `None` (random initialization) or <del> `imagenet` (ImageNet weights) <del> For loading `imagenet` weights, `input_shape` should be (331, 331, 3) <add> `imagenet` (ImageNet weights). For loading `imagenet` weights, <add> `input_shape` should be (331, 331, 3) <ide> input_tensor: Optional Keras tensor (i.e. output of <ide> `layers.Input()`) <ide> to use as image input for the model. <ide> def NASNetLarge( <ide> classes: Optional number of classes to classify images <ide> into, only to be specified if `include_top` is True, and <ide> if no `weights` argument is specified. <del> classifier_activation: A `str` or callable. The activation function to use <del> on the "top" layer. Ignored unless `include_top=True`. Set <del> `classifier_activation=None` to return the logits of the "top" layer. <del> When loading pretrained weights, `classifier_activation` can only <del> be `None` or `"softmax"`. <add> classifier_activation: A `str` or callable. The activation function to <add> use on the "top" layer. Ignored unless `include_top=True`. Set <add> `classifier_activation=None` to return the logits of the "top" <add> layer. When loading pretrained weights, `classifier_activation` can <add> only be `None` or `"softmax"`. <ide> <ide> Returns: <ide> A Keras model instance. <ide><path>keras/applications/regnet.py <ide> def XBlock(filters_in, filters_out, group_width, stride=1, name=None): <ide> def apply(inputs): <ide> if filters_in != filters_out and stride == 1: <ide> raise ValueError( <del> f"Input filters({filters_in}) and output filters({filters_out}) " <del> f"are not equal for stride {stride}. Input and output filters must " <del> f"be equal for stride={stride}." <add> f"Input filters({filters_in}) and output " <add> f"filters({filters_out}) " <add> f"are not equal for stride {stride}. Input and output filters " <add> f"must be equal for stride={stride}." <ide> ) <ide> <ide> # Declare layers <ide> def YBlock( <ide> def apply(inputs): <ide> if filters_in != filters_out and stride == 1: <ide> raise ValueError( <del> f"Input filters({filters_in}) and output filters({filters_out}) " <del> f"are not equal for stride {stride}. Input and output filters must " <del> f"be equal for stride={stride}." <add> f"Input filters({filters_in}) and output " <add> f"filters({filters_out}) " <add> f"are not equal for stride {stride}. Input and output filters " <add> f"must be equal for stride={stride}." <ide> ) <ide> <ide> groups = filters_out // group_width <ide> def ZBlock( <ide> bottleneck_ratio=0.25, <ide> name=None, <ide> ): <del> """Implementation of Z block Reference: [Fast and Accurate Model Scaling](https://arxiv.org/abs/2103.06877). <add> """Implementation of Z block Reference: [Fast and Accurate Model <add> Scaling](https://arxiv.org/abs/2103.06877). <ide> <ide> Args: <ide> filters_in: filters in the input tensor <ide> def apply(inputs): <ide> if filters_in != filters_out and stride == 1: <ide> raise ValueError( <ide> f"Input filters({filters_in}) and output filters({filters_out})" <del> f"are not equal for stride {stride}. Input and output filters must be" <del> f" equal for stride={stride}." <add> f"are not equal for stride {stride}. Input and output filters " <add> f"must be equal for stride={stride}." <ide> ) <ide> <ide> groups = filters_out // group_width <ide> def RegNet( <ide> model_name: An optional name for the model. <ide> include_preprocessing: boolean denoting whther to include preprocessing in <ide> the model <del> include_top: Boolean denoting whether to include classification head to the <del> model. <del> weights: one of `None` (random initialization), "imagenet" (pre-training on <del> ImageNet), or the path to the weights file to be loaded. <del> input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to use <del> as image input for the model. <del> input_shape: optional shape tuple, only to be specified if `include_top` is <del> False. It should have exactly 3 inputs channels. <del> pooling: optional pooling mode for feature extraction when `include_top` is <del> `False`. - `None` means that the output of the model will be the 4D tensor <del> output of the last convolutional layer. - `avg` means that global average <del> pooling will be applied to the output of the last convolutional layer, and <del> thus the output of the model will be a 2D tensor. - `max` means that <del> global max pooling will be applied. <add> include_top: Boolean denoting whether to include classification head to <add> the model. <add> weights: one of `None` (random initialization), "imagenet" (pre-training <add> on ImageNet), or the path to the weights file to be loaded. <add> input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to <add> use as image input for the model. <add> input_shape: optional shape tuple, only to be specified if `include_top` <add> is False. It should have exactly 3 inputs channels. <add> pooling: optional pooling mode for feature extraction when `include_top` <add> is `False`. - `None` means that the output of the model will be the 4D <add> tensor output of the last convolutional layer. - `avg` means that global <add> average pooling will be applied to the output of the last convolutional <add> layer, and thus the output of the model will be a 2D tensor. - `max` <add> means that global max pooling will be applied. <ide> classes: optional number of classes to classify images into, only to be <ide> specified if `include_top` is True, and if no `weights` argument is <ide> specified. <ide> def preprocess_input(x, data_format=None): # pylint: disable=unused-argument <ide> """A placeholder method for backward compatibility. <ide> <ide> The preprocessing logic has been included in the regnet model <del> implementation. Users are no longer required to call this method to normalize <del> the input data. This method does nothing and only kept as a placeholder to <del> align the API surface between old and new version of model. <add> implementation. Users are no longer required to call this method to <add> normalize the input data. This method does nothing and only kept as a <add> placeholder to align the API surface between old and new version of model. <ide> <ide> Args: <ide> x: A floating point `numpy.array` or a `tf.Tensor`. <ide> data_format: Optional data format of the image tensor/array. Defaults to <ide> None, in which case the global setting <del> `tf.keras.backend.image_data_format()` is used (unless you changed it, it <del> defaults to "channels_last").{mode} <add> `tf.keras.backend.image_data_format()` is used (unless you changed it, <add> it defaults to "channels_last").{mode} <ide> <ide> Returns: <ide> Unchanged `numpy.array` or `tf.Tensor`. <ide><path>keras/applications/resnet_rs.py <ide> specified. <ide> classifier_activation: A `str` or callable. The activation function to <ide> use on the "top" layer. Ignored unless `include_top=True`. Set <del> `classifier_activation=None` to return the logits of the "top" layer. <del> include_preprocessing: Boolean, whether to include the preprocessing layer <del> (`Rescaling`) at the bottom of the network. Defaults to `True`. <del> Note: Input image is normalized by ImageNet mean and standard deviation. <add> `classifier_activation=None` to return the logits of the "top" <add> layer. <add> include_preprocessing: Boolean, whether to include the preprocessing <add> layer (`Rescaling`) at the bottom of the network. Defaults to <add> `True`. Note: Input image is normalized by ImageNet mean and <add> standard deviation. <ide> <ide> Returns: <ide> A `keras.Model` instance. <ide> def BlockGroup( <ide> name = f"block_group_{counter}" <ide> <ide> def apply(inputs): <del> # Only the first block per block_group uses projection shortcut and strides. <add> # Only the first block per block_group uses projection shortcut and <add> # strides. <ide> x = BottleneckBlock( <ide> filters=filters, <ide> strides=strides, <ide> def allow_bigger_recursion(target_limit: int): <ide> <ide> <ide> def fixed_padding(inputs, kernel_size): <del> """Pad the input along the spatial dimensions independently of input size.""" <add> """Pad the input along the spatial dimensions independently of input <add> size.""" <ide> pad_total = kernel_size - 1 <ide> pad_beg = pad_total // 2 <ide> pad_end = pad_total - pad_beg <ide> def ResNetRS( <ide> Args: <ide> depth: Depth of ResNet network. <ide> input_shape: optional shape tuple. It should have exactly 3 inputs <del> channels, and width and height should be no smaller than 32. E.g. (200, <del> 200, 3) would be one valid value. <add> channels, and width and height should be no smaller than 32. E.g. <add> (200, 200, 3) would be one valid value. <ide> bn_momentum: Momentum parameter for Batch Normalization layers. <ide> bn_epsilon: Epsilon parameter for Batch Normalization layers. <ide> activation: activation function. <ide> def ResNetRS( <ide> block_args: list of dicts, parameters to construct block modules. <ide> model_name: name of the model. <ide> pooling: optional pooling mode for feature extraction when `include_top` <del> is `False`. - `None` means that the output of the model will be the 4D <del> tensor output of the last convolutional layer. - `avg` means that global <del> average pooling will be applied to the output of the last convolutional <del> layer, and thus the output of the model will be a 2D tensor. - `max` <del> means that global max pooling will be applied. <del> weights: one of `None` (random initialization), `'imagenet'` (pre-training <del> on ImageNet), or the path to the weights file to be loaded. Note- one <del> model can have multiple imagenet variants depending on input shape it <del> was trained with. For input_shape 224x224 pass `imagenet-i224` as <del> argument. By default, highest input shape weights are downloaded. <add> is `False`. <add> - `None` means that the output of the model will be the 4D tensor <add> output of the last convolutional layer. <add> - `avg` means that global average pooling will be applied to the <add> output of the last convolutional layer, and thus the output of the <add> model will be a 2D tensor. <add> - `max` means that global max pooling will be applied. <add> weights: one of `None` (random initialization), `'imagenet'` <add> (pre-training on ImageNet), or the path to the weights file to be <add> loaded. Note- one model can have multiple imagenet variants depending <add> on input shape it was trained with. For input_shape 224x224 pass <add> `imagenet-i224` as argument. By default, highest input shape weights <add> are downloaded. <ide> input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to <ide> use as image input for the model. <ide> classes: optional number of classes to classify images into, only to be <ide> specified if `include_top` is True, and if no `weights` argument is <ide> specified. <del> classifier_activation: A `str` or callable. The activation function to use <del> on the "top" layer. Ignored unless `include_top=True`. Set <add> classifier_activation: A `str` or callable. The activation function to <add> use on the "top" layer. Ignored unless `include_top=True`. Set <ide> `classifier_activation=None` to return the logits of the "top" layer. <del> include_preprocessing: Boolean, whether to include the preprocessing layer <del> (`Rescaling`) at the bottom of the network. Defaults to `True`. Note- <del> Input image is normalized by ImageNet mean and standard deviation. <add> include_preprocessing: Boolean, whether to include the preprocessing <add> layer (`Rescaling`) at the bottom of the network. Defaults to `True`. <add> Note- Input image is normalized by ImageNet mean and standard <add> deviation. <ide> <ide> Returns: <ide> A `tf.keras.Model` instance. <ide> def ResNetRS( <ide> <ide> if weights in weights_allow_list and include_top and classes != 1000: <ide> raise ValueError( <del> f"If using `weights` as `'imagenet'` or any of {weights_allow_list} " <add> f"If using `weights` as `'imagenet'` or any " <add> f"of {weights_allow_list} " <ide> f"with `include_top` as true, `classes` should be 1000. " <ide> f"Received classes={classes}" <ide> ) <ide><path>keras/applications/vgg16.py <ide> def VGG16( <ide> For VGG16, call `tf.keras.applications.vgg16.preprocess_input` on your <ide> inputs before passing them to the model. <ide> `vgg16.preprocess_input` will convert the input images from RGB to BGR, <del> then will zero-center each color channel with respect to the ImageNet dataset, <del> without scaling. <add> then will zero-center each color channel with respect to the ImageNet <add> dataset, without scaling. <ide> <ide> Args: <ide> include_top: whether to include the 3 fully-connected <ide> def VGG16( <ide> classes: optional number of classes to classify images <ide> into, only to be specified if `include_top` is True, and <ide> if no `weights` argument is specified. <del> classifier_activation: A `str` or callable. The activation function to use <del> on the "top" layer. Ignored unless `include_top=True`. Set <del> `classifier_activation=None` to return the logits of the "top" layer. <del> When loading pretrained weights, `classifier_activation` can only <del> be `None` or `"softmax"`. <add> classifier_activation: A `str` or callable. The activation function to <add> use on the "top" layer. Ignored unless `include_top=True`. Set <add> `classifier_activation=None` to return the logits of the "top" <add> layer. When loading pretrained weights, `classifier_activation` can <add> only be `None` or `"softmax"`. <ide> <ide> Returns: <ide> A `keras.Model` instance. <ide><path>keras/applications/vgg19.py <ide> def VGG19( <ide> For VGG19, call `tf.keras.applications.vgg19.preprocess_input` on your <ide> inputs before passing them to the model. <ide> `vgg19.preprocess_input` will convert the input images from RGB to BGR, <del> then will zero-center each color channel with respect to the ImageNet dataset, <del> without scaling. <add> then will zero-center each color channel with respect to the ImageNet <add> dataset, without scaling. <ide> <ide> Args: <ide> include_top: whether to include the 3 fully-connected
12
Python
Python
add glorot & he initializations
a1c9d0823cd284213c884be0964cd47c47d5e666
<ide><path>keras/initializations.py <ide> def lecun_uniform(shape): <ide> scale = 1./np.sqrt(m) <ide> return uniform(shape, scale) <ide> <add>def glorot_normal(shape): <add> ''' Reference: Glorot & Bengio, AISTATS 2010 <add> ''' <add> fan_in = shape[0] if len(shape) == 2 else np.prod(shape[1:]) <add> fan_out = shape[1] if len(shape) == 2 else shape[0] <add> s = np.sqrt(2. / (fan_in + fan_out) <add> return normal(shape, s) <add> <add>def he_normal(shape): <add> ''' Reference: He et al., http://arxiv.org/abs/1502.01852 <add> ''' <add> fan_in = shape[1] if len(shape) == 2 else np.prod(shape[1:]) <add> s = np.sqrt(2. / fan_in) <add> return normal(shape, s) <add> <ide> def orthogonal(shape, scale=1.1): <ide> ''' From Lasagne <ide> ''' <ide> def zero(shape): <ide> <ide> from utils.generic_utils import get_from_module <ide> def get(identifier): <del> return get_from_module(identifier, globals(), 'initialization') <ide>\ No newline at end of file <add> return get_from_module(identifier, globals(), 'initialization')
1
Python
Python
mark some tests with slow decorator
0efbe711422ac32850d54f791faf8ad46fcdc4a0
<ide><path>numpy/core/tests/test_extint128.py <ide> import numpy.core.multiarray_tests as mt <ide> from numpy.compat import long <ide> <del>from numpy.testing import assert_raises, assert_equal <add>from numpy.testing import assert_raises, assert_equal, dec <ide> <ide> <ide> INT64_MAX = np.iinfo(np.int64).max <ide> def test_gt_128(): <ide> assert_equal(d, c) <ide> <ide> <add>@dec.slow <ide> def test_divmod_128_64(): <ide> with exc_iter(INT128_VALUES, INT64_POS_VALUES) as it: <ide> for a, b in it: <ide><path>numpy/core/tests/test_mem_overlap.py <ide> <ide> import numpy as np <ide> from numpy.testing import (run_module_suite, assert_, assert_raises, assert_equal, <del> assert_array_equal, assert_allclose) <add> assert_array_equal, assert_allclose, dec) <ide> <ide> from numpy.core.multiarray_tests import solve_diophantine, internal_overlap <ide> from numpy.core import umath_tests <ide> def test_overlapping_assignments(): <ide> yield _check_assignment, srcidx, dstidx <ide> <ide> <add>@dec.slow <ide> def test_diophantine_fuzz(): <ide> # Fuzz test the diophantine solver <ide> rng = np.random.RandomState(1234) <ide> def check_may_share_memory_easy_fuzz(get_max_work, same_steps, min_count): <ide> infeasible += 1 <ide> <ide> <add>@dec.slow <ide> def test_may_share_memory_easy_fuzz(): <ide> # Check that overlap problems with common strides are always <ide> # solved with little work. <ide> def test_may_share_memory_easy_fuzz(): <ide> min_count=2000) <ide> <ide> <add>@dec.slow <ide> def test_may_share_memory_harder_fuzz(): <ide> # Overlap problems with not necessarily common strides take more <ide> # work. <ide> def check_unary_fuzz(self, operation, get_out_axis_size, dtype=np.int16, <ide> # Check result <ide> assert_copy_equivalent(operation, [a], out=b_out, axis=axis) <ide> <add> @dec.slow <ide> def test_unary_ufunc_call_fuzz(self): <ide> self.check_unary_fuzz(np.invert, None, np.int16) <ide> <ide> def check(a, out, mask): <ide> check(x, x.copy(), x) <ide> check(x, x, x.copy()) <ide> <add> @dec.slow <ide> def test_binary_ufunc_1d_manual(self): <ide> ufunc = np.add <ide>
2
PHP
PHP
update config folder references
7f2b426c50f41076b07ef42c60b775f60262b953
<ide><path>tests/TestCase/Console/Command/Task/PluginTaskTest.php <ide> public function testBakeFoldersAndFiles() { <ide> $this->assertTrue(is_dir($path), 'No plugin dir'); <ide> <ide> $directories = array( <del> 'src/Config', <add> 'config', <ide> 'src/Model/Behavior', <ide> 'src/Model/Table', <ide> 'src/Model/Entity', <ide> public function testExecuteWithOneArg() { <ide> $this->Task->expects($this->at(1))->method('createFile') <ide> ->with($file, $this->stringContains('class AppController extends BaseController {')); <ide> <del> $file = $path . DS . 'src' . DS . 'Config' . DS . 'routes.php'; <add> $file = $path . DS . 'config' . DS . 'routes.php'; <ide> $this->Task->expects($this->at(2))->method('createFile') <ide> ->with($file, $this->stringContains("Router::plugin('BakeTestPlugin', function(\$routes)")); <ide>
1
Python
Python
add no_status to state priority list
55aa7015037156822a8100518ffe189c4610e186
<ide><path>airflow/www/utils.py <ide> def get_instance_with_map(task_instance, session): <ide> return get_mapped_summary(task_instance, mapped_instances) <ide> <ide> <del>def get_mapped_summary(parent_instance, task_instances): <del> priority = [ <del> TaskInstanceState.FAILED, <del> TaskInstanceState.UPSTREAM_FAILED, <del> TaskInstanceState.UP_FOR_RETRY, <del> TaskInstanceState.UP_FOR_RESCHEDULE, <del> TaskInstanceState.QUEUED, <del> TaskInstanceState.SCHEDULED, <del> TaskInstanceState.DEFERRED, <del> TaskInstanceState.SENSING, <del> TaskInstanceState.RUNNING, <del> TaskInstanceState.SHUTDOWN, <del> TaskInstanceState.RESTARTING, <del> TaskInstanceState.REMOVED, <del> TaskInstanceState.SUCCESS, <del> TaskInstanceState.SKIPPED, <del> ] <add>priority = [ <add> TaskInstanceState.FAILED, <add> TaskInstanceState.UPSTREAM_FAILED, <add> TaskInstanceState.UP_FOR_RETRY, <add> TaskInstanceState.UP_FOR_RESCHEDULE, <add> TaskInstanceState.QUEUED, <add> TaskInstanceState.SCHEDULED, <add> TaskInstanceState.DEFERRED, <add> TaskInstanceState.SENSING, <add> TaskInstanceState.RUNNING, <add> TaskInstanceState.SHUTDOWN, <add> TaskInstanceState.RESTARTING, <add> TaskInstanceState.REMOVED, <add> None, <add> TaskInstanceState.SUCCESS, <add> TaskInstanceState.SKIPPED, <add>] <add> <ide> <add>def get_mapped_summary(parent_instance, task_instances): <ide> mapped_states = [ti.state for ti in task_instances] <ide> <ide> group_state = None <ide><path>airflow/www/views.py <ide> def task_group_to_tree(task_item_or_group, dag, dag_runs, tis, session): <ide> ] <ide> <ide> def get_summary(dag_run, children): <del> priority = [ <del> TaskInstanceState.FAILED, <del> TaskInstanceState.UPSTREAM_FAILED, <del> TaskInstanceState.UP_FOR_RETRY, <del> TaskInstanceState.UP_FOR_RESCHEDULE, <del> TaskInstanceState.QUEUED, <del> TaskInstanceState.SCHEDULED, <del> TaskInstanceState.DEFERRED, <del> TaskInstanceState.SENSING, <del> TaskInstanceState.RUNNING, <del> TaskInstanceState.SHUTDOWN, <del> TaskInstanceState.RESTARTING, <del> TaskInstanceState.REMOVED, <del> TaskInstanceState.SUCCESS, <del> TaskInstanceState.SKIPPED, <del> ] <del> <ide> child_instances = [child['instances'] for child in children if 'instances' in child] <ide> child_instances = [item for sublist in child_instances for item in sublist] <ide> <ide> def get_summary(dag_run, children): <ide> children_states = [item['state'] for item in child_instances if item['run_id'] == dag_run.run_id] <ide> <ide> group_state = None <del> for state in priority: <add> for state in wwwutils.priority: <ide> if state in children_states: <ide> group_state = state <ide> break
2
Python
Python
pass ping destination to request
f8e3df669e0c1e2769d358655115cc9596f11fa5
<ide><path>celery/app/control.py <ide> def registered(self, *taskinfoitems): <ide> registered_tasks = registered <ide> <ide> def ping(self, destination=None): <add> if destination: <add> self.destination = destination <ide> return self._request('ping') <ide> <ide> def active_queues(self):
1
Text
Text
update deployment docs to fix oversized image.
bc223d76e0e1962ba5904b52597c4b3a47184f11
<ide><path>docs/deployment.md <ide> All JavaScript code inside `.next` has been **compiled** and browser bundles hav <ide> <ide> ## Managed Next.js with Vercel <ide> <del>[Vercel](https://vercel.com/) is a frontend cloud platform from the creators of Next.js. It's the fastest way to deploy your managed Next.js application with zero configuration. <add>[Vercel](https://vercel.com?utm_source=github.com&utm_medium=referral&utm_campaign=deployment) is the fastest way to deploy your Next.js application with zero configuration. <ide> <del>When deploying to Vercel, the platform automatically detects Next.js, runs `next build`, and optimizes the build output for you, including: <add>When deploying to Vercel, the platform [automatically detects Next.js](https://vercel.com/solutions/nextjs?utm_source=github.com&utm_medium=referral&utm_campaign=deployment), runs `next build`, and optimizes the build output for you, including: <ide> <ide> - Persisting cached assets across deployments if unchanged <ide> - [Immutable deployments](https://vercel.com/features/previews) with a unique URL for every commit <ide> In addition, Vercel provides features like: <ide> - Support for [Image Optimization](/docs/basic-features/image-optimization.md) with `next/image` <ide> - Instant global deployments via `git push` <ide> <del>You can start using Vercel (for free) through a personal hobby account, or create a team to start the next big thing. Learn more about [Next.js on Vercel](https://vercel.com/solutions/nextjs) or read the [Vercel Documentation](https://vercel.com/docs). <del> <del>[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world&utm_source=github.com&utm_medium=referral&utm_campaign=deployment) <add>[Deploy a Next.js application to Vercel](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world&utm_source=github.com&utm_medium=referral&utm_campaign=deployment) for free to try it out. <ide> <ide> ## Self-Hosting <ide>
1
Go
Go
fix empty-lines (revive)
ddb42f3ad204f6ea4312c4db71bc01105e87d3c1
<ide><path>daemon/container_operations.go <ide> func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr er <ide> if err := daemon.connectToNetwork(container, defaultNetName, nConf.EndpointSettings, updateSettings); err != nil { <ide> return err <ide> } <del> <ide> } <ide> <ide> // the intermediate map is necessary because "connectToNetwork" modifies "container.NetworkSettings.Networks" <ide> func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr er <ide> } <ide> }() <ide> } <del> <ide> } <ide> <ide> if _, err := container.WriteHostConfig(); err != nil { <ide><path>daemon/daemon_linux_test.go <ide> func TestRootMountCleanup(t *testing.T) { <ide> checkMounted(t, cfg.Root, false) <ide> assert.Assert(t, d.cleanupMounts()) <ide> }) <del> <ide> } <ide><path>daemon/daemon_unix.go <ide> func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn <ide> if len(resources.BlkioDeviceWriteBps) > 0 && !sysInfo.BlkioWriteBpsDevice { <ide> warnings = append(warnings, "Your kernel does not support BPS Block I/O write limit or the cgroup is not mounted. Block I/O BPS write limit discarded.") <ide> resources.BlkioDeviceWriteBps = []*pblkiodev.ThrottleDevice{} <del> <ide> } <ide> if len(resources.BlkioDeviceReadIOps) > 0 && !sysInfo.BlkioReadIOpsDevice { <ide> warnings = append(warnings, "Your kernel does not support IOPS Block read limit or the cgroup is not mounted. Block I/O IOPS read limit discarded.") <ide> func setupInitLayer(idMapping idtools.IdentityMapping) func(string) error { <ide> // <ide> // If names are used, they are verified to exist in passwd/group <ide> func parseRemappedRoot(usergrp string) (string, string, error) { <del> <ide> var ( <ide> userID, groupID int <ide> username, groupname string <ide><path>daemon/network.go <ide> func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep <ide> return nil, errors.Errorf("Invalid link-local IP address: %s", ipam.LinkLocalIPs) <ide> } <ide> ipList = append(ipList, linkip) <del> <ide> } <ide> <ide> if ip = net.ParseIP(ipam.IPv4Address); ip == nil && ipam.IPv4Address != "" { <ide> func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep <ide> <ide> createOptions = append(createOptions, <ide> libnetwork.CreateOptionIpam(ip, ip6, ipList, nil)) <del> <ide> } <ide> <ide> for _, alias := range epConfig.Aliases { <ide> func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep <ide> <ide> createOptions = append(createOptions, libnetwork.EndpointOptionGeneric(genericOption)) <ide> } <del> <ide> } <ide> <ide> // Port-mapping rules belong to the container & applicable only to non-internal networks <ide><path>daemon/network/filter_test.go <ide> func TestFilterNetworks(t *testing.T) { <ide> if testCase.err != "" { <ide> if err == nil { <ide> t.Fatalf("expect error '%s', got no error", testCase.err) <del> <ide> } else if !strings.Contains(err.Error(), testCase.err) { <ide> t.Fatalf("expect error '%s', got '%s'", testCase.err, err) <ide> } <ide><path>daemon/oci_linux.go <ide> func WithMounts(daemon *Daemon, c *container.Container) coci.SpecOpts { <ide> } <ide> <ide> return nil <del> <ide> } <ide> } <ide> <ide><path>daemon/reload_test.go <ide> func TestDaemonReloadNetworkDiagnosticPort(t *testing.T) { <ide> if !daemon.netController.IsDiagnosticEnabled() { <ide> t.Fatalf("diagnostic should be enable") <ide> } <del> <ide> } <ide><path>daemon/restart.go <ide> func (daemon *Daemon) ContainerRestart(ctx context.Context, name string, options <ide> return fmt.Errorf("Cannot restart container %s: %v", name, err) <ide> } <ide> return nil <del> <ide> } <ide> <ide> // containerRestart attempts to gracefully stop and then start the <ide><path>daemon/seccomp_linux_test.go <ide> import ( <ide> ) <ide> <ide> func TestWithSeccomp(t *testing.T) { <del> <ide> type expected struct { <ide> daemon *Daemon <ide> c *container.Container
9
Go
Go
add unit test for child changes diff in aufs
f512049c8f9e64848cd8b1be794619f01c5227f2
<ide><path>aufs/aufs_test.go <ide> func TestChanges(t *testing.T) { <ide> if change.Kind != archive.ChangeAdd { <ide> t.Fatalf("Change kind should be ChangeAdd got %s", change.Kind) <ide> } <add> <add> if err := d.Create("3", "2"); err != nil { <add> t.Fatal(err) <add> } <add> mntPoint, err = d.Get("3") <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> // Create a file to save in the mountpoint <add> f, err = os.Create(path.Join(mntPoint, "test2.txt")) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if _, err := f.WriteString("testline"); err != nil { <add> t.Fatal(err) <add> } <add> if err := f.Close(); err != nil { <add> t.Fatal(err) <add> } <add> <add> changes, err = d.Changes("3") <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(changes) != 1 { <add> t.Fatalf("Dir 2 should have one change from parent got %d", len(changes)) <add> } <add> change = changes[0] <add> <add> expectedPath = "/test2.txt" <add> if change.Path != expectedPath { <add> t.Fatalf("Expected path %s got %s", expectedPath, change.Path) <add> } <add> <add> if change.Kind != archive.ChangeAdd { <add> t.Fatalf("Change kind should be ChangeAdd got %s", change.Kind) <add> } <ide> } <ide> <ide> /* FIXME: How to properly test this?
1
Ruby
Ruby
convert `formula_support` test to spec
fb09867ba35e3cb30651cc6b9ab871849c7e8474
<ide><path>Library/Homebrew/test/formula_support_spec.rb <add>require "formula_support" <add> <add>describe KegOnlyReason do <add> describe "#to_s" do <add> it "returns the reason provided" do <add> r = KegOnlyReason.new :provided_by_osx, "test" <add> expect(r.to_s).to eq("test") <add> end <add> <add> it "returns a default message when no reason is provided" do <add> r = KegOnlyReason.new :provided_by_macos, "" <add> expect(r.to_s).to match(/^macOS already provides/) <add> end <add> end <add>end <add> <add>describe BottleDisableReason do <add> specify ":unneeded" do <add> bottle_disable_reason = BottleDisableReason.new :unneeded, nil <add> expect(bottle_disable_reason).to be_unneeded <add> expect(bottle_disable_reason.to_s).to eq("This formula doesn't require compiling.") <add> end <add> <add> specify ":disabled" do <add> bottle_disable_reason = BottleDisableReason.new :disable, "reason" <add> expect(bottle_disable_reason).not_to be_unneeded <add> expect(bottle_disable_reason.to_s).to eq("reason") <add> end <add>end <ide><path>Library/Homebrew/test/formula_support_test.rb <del>require "testing_env" <del>require "formula_support" <del> <del>class KegOnlyReasonTests < Homebrew::TestCase <del> def test_to_s_explanation <del> r = KegOnlyReason.new :provided_by_osx, "test" <del> assert_equal "test", r.to_s <del> end <del> <del> def test_to_s_no_explanation <del> r = KegOnlyReason.new :provided_by_macos, "" <del> assert_match(/^macOS already provides/, r.to_s) <del> end <del>end <del> <del>class BottleDisableReasonTests < Homebrew::TestCase <del> def test_bottle_unneeded <del> bottle_disable_reason = BottleDisableReason.new :unneeded, nil <del> assert_predicate bottle_disable_reason, :unneeded? <del> assert_equal "This formula doesn't require compiling.", bottle_disable_reason.to_s <del> end <del> <del> def test_bottle_disabled <del> bottle_disable_reason = BottleDisableReason.new :disable, "reason" <del> refute_predicate bottle_disable_reason, :unneeded? <del> assert_equal "reason", bottle_disable_reason.to_s <del> end <del>end
2
Text
Text
add section for troubleshooting. closes
c211a084ef86a4fb496c736ebf20f07525b64701
<ide><path>docs/Troubleshooting.md <ide> permalink: docs/troubleshooting.html <ide> --- <ide> <ide> ## Cmd-R does not reload the simulator <del>Enable iOS simulator's "Connect hardware keyboard" from menu Hardware > Keyboard menu. <add>Enable iOS simulator's "Connect hardware keyboard" from menu Hardware > Keyboard menu. <ide> <ide> ![Keyboard Menu](https://cloud.githubusercontent.com/assets/1388454/6863127/03837824-d409-11e4-9251-e05bd31d978f.png) <ide> <ide> If you are adding React manually, make sure you have included all the relevant d <ide> In the project's build settings, `User Search Header Paths` and `Header Search Paths` are two configs that specify where Xcode should look for `#import` header files specified in the code. For Pods, CocoaPods uses a default array of specific folders to look in. Verify that this particular config is not overwritten, and that none of the folders configured are too large. If one of the folders is a large folder, Xcode will attempt to recursively search the entire directory and throw above error at some point. <ide> <ide> To revert the `User Search Header Paths` and `Header Search Paths` build settings to their defaults set by CocoaPods - select the entry in the Build Settings panel, and hit delete. It will remove the custom override and return to the CocoaPod defaults. <add> <add>## Unable to connect to development server <add> <add>##### iOS <add>Ensure that you are on the same WiFi network as your computer. If you're using a cell data plan, your phone can't access your computer's local IP address. <add> <add>##### Android <add>You need to run `adb reverse tcp:8081 tcp:8081` to forward requests from the device to your computer. This works only on Android 5.0 and newer.
1
Javascript
Javascript
fix performance regression with cursors
a602dcbd14d3ab99329d93c9e4713a48a4fc8ec1
<ide><path>contrib/cursor/index.js <ide> function cursorFrom(rootData, keyPath, onChange) { <ide> } else if (typeof keyPath === 'function') { <ide> onChange = keyPath; <ide> keyPath = []; <del> } else if (!Array.isArray(keyPath)) { <del> keyPath = [keyPath]; <add> } else { <add> keyPath = valToKeyPath(keyPath); <ide> } <ide> return makeCursor(rootData, keyPath, onChange); <ide> } <ide> IndexedCursorPrototype.get = function(key, notSetValue) { <ide> } <ide> <ide> KeyedCursorPrototype.getIn = <del>IndexedCursorPrototype.getIn = function(key, notSetValue) { <del> if (!Array.isArray(key)) { <del> key = Immutable.Iterable(key).toArray(); <del> } <del> if (key.length === 0) { <add>IndexedCursorPrototype.getIn = function(keyPath, notSetValue) { <add> keyPath = listToKeyPath(keyPath); <add> if (keyPath.length === 0) { <ide> return this; <ide> } <del> var value = this._rootData.getIn(newKeyPath(this._keyPath, key), NOT_SET); <del> return value === NOT_SET ? notSetValue : wrappedValue(this, key, value); <add> var value = this._rootData.getIn(newKeyPath(this._keyPath, keyPath), NOT_SET); <add> return value === NOT_SET ? notSetValue : wrappedValue(this, keyPath, value); <ide> } <ide> <ide> IndexedCursorPrototype.set = <ide> KeyedCursorPrototype.set = function(key, value) { <del> return updateCursor(this, function (m) { return m.set(key, value); }, key); <add> return updateCursor(this, function (m) { return m.set(key, value); }, [key]); <ide> } <ide> <ide> IndexedCursorPrototype.setIn = <ide> KeyedCursorPrototype.remove = <ide> KeyedCursorPrototype['delete'] = <ide> IndexedCursorPrototype.remove = <ide> IndexedCursorPrototype['delete'] = function(key) { <del> return updateCursor(this, function (m) { return m.remove(key); }, key); <add> return updateCursor(this, function (m) { return m.remove(key); }, [key]); <ide> } <ide> <ide> IndexedCursorPrototype.removeIn = <ide> IndexedCursorPrototype.withMutations = function(fn) { <ide> } <ide> <ide> KeyedCursorPrototype.cursor = <del>IndexedCursorPrototype.cursor = function(subKey) { <del> return Array.isArray(subKey) && subKey.length === 0 ? <del> this : subCursor(this, subKey); <add>IndexedCursorPrototype.cursor = function(subKeyPath) { <add> subKeyPath = valToKeyPath(subKeyPath); <add> return subKeyPath.length === 0 ? this : subCursor(this, subKeyPath); <ide> } <ide> <ide> /** <ide> IndexedCursorPrototype.__iterate = function(fn, reverse) { <ide> var cursor = this; <ide> var deref = cursor.deref(); <ide> return deref && deref.__iterate ? deref.__iterate( <del> function (v, k) { return fn(wrappedValue(cursor, k, v), k, cursor); }, <add> function (v, k) { return fn(wrappedValue(cursor, [k], v), k, cursor); }, <ide> reverse <ide> ) : 0; <ide> } <ide> IndexedCursorPrototype.__iterator = function(type, reverse) { <ide> } <ide> var entry = step.value; <ide> var k = entry[0]; <del> var v = wrappedValue(cursor, k, entry[1]); <add> var v = wrappedValue(cursor, [k], entry[1]); <ide> return { <ide> value: type === Iterator.KEYS ? k : type === Iterator.VALUES ? v : [k, v], <ide> done: false <ide> function makeCursor(rootData, keyPath, onChange, value) { <ide> return new CursorClass(rootData, keyPath, onChange, size); <ide> } <ide> <del>function wrappedValue(cursor, key, value) { <del> return Iterable.isIterable(value) ? subCursor(cursor, key, value) : value; <add>function wrappedValue(cursor, keyPath, value) { <add> return Iterable.isIterable(value) ? subCursor(cursor, keyPath, value) : value; <ide> } <ide> <del>function subCursor(cursor, key, value) { <add>function subCursor(cursor, keyPath, value) { <ide> return makeCursor( <ide> cursor._rootData, <del> newKeyPath(cursor._keyPath, key), <add> newKeyPath(cursor._keyPath, keyPath), <ide> cursor._onChange, <ide> value <ide> ); <ide> } <ide> <del>function updateCursor(cursor, changeFn, changeKey) { <add>function updateCursor(cursor, changeFn, changeKeyPath) { <add> var deepChange = arguments.length > 2; <ide> var newRootData = cursor._rootData.updateIn( <ide> cursor._keyPath, <del> changeKey ? Map() : undefined, <add> deepChange ? Map() : undefined, <ide> changeFn <ide> ); <ide> var keyPath = cursor._keyPath || []; <ide> var result = cursor._onChange && cursor._onChange.call( <ide> undefined, <ide> newRootData, <ide> cursor._rootData, <del> arguments.length > 2 ? newKeyPath(keyPath, changeKey) : keyPath <add> deepChange ? newKeyPath(keyPath, changeKeyPath) : keyPath <ide> ); <ide> if (result !== undefined) { <ide> newRootData = result; <ide> function updateCursor(cursor, changeFn, changeKey) { <ide> } <ide> <ide> function newKeyPath(head, tail) { <del> return Seq(head).concat(tail).toArray(); <add> return head.concat(listToKeyPath(tail)); <add>} <add> <add>function listToKeyPath(list) { <add> return Array.isArray(list) ? list : Immutable.Iterable(list).toArray(); <add>} <add> <add>function valToKeyPath(val) { <add> return Array.isArray(val) ? val : <add> Iterable.isIterable(val) ? val.toArray() : <add> [val]; <ide> } <ide> <ide> exports.from = cursorFrom;
1
Python
Python
use assert function instead of python keyword
1aca67fcc689b66737b39862e517e821be0c4767
<ide><path>numpy/core/tests/test_multiarray.py <ide> def test_lt(self): <ide> res3 = lp < r <ide> res4 = lp < rp <ide> <del> assert np.allclose(res1, res2.array) <del> assert np.allclose(res1, res3.array) <del> assert np.allclose(res1, res4.array) <del> assert isinstance(res1, np.ndarray) <del> assert isinstance(res2, PriorityNdarray) <del> assert isinstance(res3, PriorityNdarray) <del> assert isinstance(res4, PriorityNdarray) <add> assert_array_equal(res1, res2.array) <add> assert_array_equal(res1, res3.array) <add> assert_array_equal(res1, res4.array) <add> assert_(isinstance(res1, np.ndarray)) <add> assert_(isinstance(res2, PriorityNdarray)) <add> assert_(isinstance(res3, PriorityNdarray)) <add> assert_(isinstance(res4, PriorityNdarray)) <ide> <ide> def test_gt(self): <ide> l = np.asarray([0., -1., 1.], dtype=dtype) <ide> def test_gt(self): <ide> res3 = lp > r <ide> res4 = lp > rp <ide> <del> assert np.allclose(res1, res2.array) <del> assert np.allclose(res1, res3.array) <del> assert np.allclose(res1, res4.array) <del> assert isinstance(res1, np.ndarray) <del> assert isinstance(res2, PriorityNdarray) <del> assert isinstance(res3, PriorityNdarray) <del> assert isinstance(res4, PriorityNdarray) <add> assert_array_equal(res1, res2.array) <add> assert_array_equal(res1, res3.array) <add> assert_array_equal(res1, res4.array) <add> assert_(isinstance(res1, np.ndarray)) <add> assert_(isinstance(res2, PriorityNdarray)) <add> assert_(isinstance(res3, PriorityNdarray)) <add> assert_(isinstance(res4, PriorityNdarray)) <ide> <ide> def test_le(self): <ide> l = np.asarray([0., -1., 1.], dtype=dtype) <ide> def test_le(self): <ide> res3 = lp <= r <ide> res4 = lp <= rp <ide> <del> assert np.allclose(res1, res2.array) <del> assert np.allclose(res1, res3.array) <del> assert np.allclose(res1, res4.array) <del> assert isinstance(res1, np.ndarray) <del> assert isinstance(res2, PriorityNdarray) <del> assert isinstance(res3, PriorityNdarray) <del> assert isinstance(res4, PriorityNdarray) <add> assert_array_equal(res1, res2.array) <add> assert_array_equal(res1, res3.array) <add> assert_array_equal(res1, res4.array) <add> assert_(isinstance(res1, np.ndarray)) <add> assert_(isinstance(res2, PriorityNdarray)) <add> assert_(isinstance(res3, PriorityNdarray)) <add> assert_(isinstance(res4, PriorityNdarray)) <ide> <ide> def test_ge(self): <ide> l = np.asarray([0., -1., 1.], dtype=dtype) <ide> def test_ge(self): <ide> res3 = lp >= r <ide> res4 = lp >= rp <ide> <del> assert np.allclose(res1, res2.array) <del> assert np.allclose(res1, res3.array) <del> assert np.allclose(res1, res4.array) <del> assert isinstance(res1, np.ndarray) <del> assert isinstance(res2, PriorityNdarray) <del> assert isinstance(res3, PriorityNdarray) <del> assert isinstance(res4, PriorityNdarray) <add> assert_array_equal(res1, res2.array) <add> assert_array_equal(res1, res3.array) <add> assert_array_equal(res1, res4.array) <add> assert_(isinstance(res1, np.ndarray)) <add> assert_(isinstance(res2, PriorityNdarray)) <add> assert_(isinstance(res3, PriorityNdarray)) <add> assert_(isinstance(res4, PriorityNdarray)) <ide> <ide> def test_eq(self): <ide> l = np.asarray([0., -1., 1.], dtype=dtype) <ide> def test_eq(self): <ide> res3 = lp == r <ide> res4 = lp == rp <ide> <del> assert np.allclose(res1, res2.array) <del> assert np.allclose(res1, res3.array) <del> assert np.allclose(res1, res4.array) <del> assert isinstance(res1, np.ndarray) <del> assert isinstance(res2, PriorityNdarray) <del> assert isinstance(res3, PriorityNdarray) <del> assert isinstance(res4, PriorityNdarray) <add> assert_array_equal(res1, res2.array) <add> assert_array_equal(res1, res3.array) <add> assert_array_equal(res1, res4.array) <add> assert_(isinstance(res1, np.ndarray)) <add> assert_(isinstance(res2, PriorityNdarray)) <add> assert_(isinstance(res3, PriorityNdarray)) <add> assert_(isinstance(res4, PriorityNdarray)) <ide> <ide> def test_ne(self): <ide> l = np.asarray([0., -1., 1.], dtype=dtype) <ide> def test_ne(self): <ide> res3 = lp != r <ide> res4 = lp != rp <ide> <del> assert np.allclose(res1, res2.array) <del> assert np.allclose(res1, res3.array) <del> assert np.allclose(res1, res4.array) <del> assert isinstance(res1, np.ndarray) <del> assert isinstance(res2, PriorityNdarray) <del> assert isinstance(res3, PriorityNdarray) <del> assert isinstance(res4, PriorityNdarray) <add> assert_array_equal(res1, res2.array) <add> assert_array_equal(res1, res3.array) <add> assert_array_equal(res1, res4.array) <add> assert_(isinstance(res1, np.ndarray)) <add> assert_(isinstance(res2, PriorityNdarray)) <add> assert_(isinstance(res3, PriorityNdarray)) <add> assert_(isinstance(res4, PriorityNdarray)) <ide> <ide> <ide> if __name__ == "__main__":
1
PHP
PHP
fix formatting and tests
db4879ae84a3a1959729ac2732ae42cfe377314c
<ide><path>src/Illuminate/Notifications/Channels/SlackWebhookChannel.php <ide> namespace Illuminate\Notifications\Channels; <ide> <ide> use GuzzleHttp\Client as HttpClient; <del>use Illuminate\Notifications\Messages\SlackAttachmentField; <ide> use Illuminate\Notifications\Notification; <ide> use Illuminate\Notifications\Messages\SlackMessage; <ide> use Illuminate\Notifications\Messages\SlackAttachment; <add>use Illuminate\Notifications\Messages\SlackAttachmentField; <ide> <ide> class SlackWebhookChannel <ide> { <ide><path>src/Illuminate/Notifications/Messages/SlackAttachment.php <ide> public function field($title, $content = '') <ide> if (is_callable($title)) { <ide> $callback = $title; <ide> <del> $attachmentField = new SlackAttachmentField(); <add> $callback($attachmentField = new SlackAttachmentField); <ide> <del> $callback($attachmentField); <ide> $this->fields[] = $attachmentField; <ide> <ide> return $this; <ide><path>src/Illuminate/Notifications/Messages/SlackAttachmentField.php <ide> class SlackAttachmentField <ide> protected $content; <ide> <ide> /** <del> * Whether the content is short enough to fit side by side with <del> * other contents. <add> * Whether the content is short. <ide> * <ide> * @var bool <ide> */ <ide> class SlackAttachmentField <ide> /** <ide> * Set the title of the field. <ide> * <del> * @param string $title <add> * @param string $title <ide> * @return $this <ide> */ <ide> public function title($title) <ide> public function title($title) <ide> /** <ide> * Set the content of the field. <ide> * <del> * @param string $content <add> * @param string $content <ide> * @return $this <ide> */ <ide> public function content($content) <ide> public function content($content) <ide> } <ide> <ide> /** <add> * Indicates that the content should not be displayed side-by-side with other fields. <add> * <ide> * @return $this <ide> */ <del> public function displaySideBySide() <del> { <del> $this->short = true; <del> <del> return $this; <del> } <del> <del> /** <del> * @return $this <del> */ <del> public function dontDisplaySideBySide() <add> public function long() <ide> { <ide> $this->short = false; <ide> <ide><path>tests/Notifications/NotificationSlackChannelTest.php <ide> public function toSlack($notifiable) <ide> $attachmentField <ide> ->title('Special powers') <ide> ->content('Zonda') <del> ->dontDisplaySideBySide(); <add> ->long(); <ide> }); <ide> }); <ide> }
4
PHP
PHP
fix double inflection in bake all <foo>
0f71254fe175c4a67c355cc39633e8a1c65979e4
<ide><path>lib/Cake/Console/Command/BakeShell.php <ide> public function all() { <ide> } <ide> App::uses($controller . 'Controller', 'Controller'); <ide> if (class_exists($controller . 'Controller')) { <del> $this->View->args = array($controller); <add> $this->View->args = array($name); <ide> $this->View->execute(); <ide> } <ide> $this->out('', 1, Shell::QUIET); <ide><path>lib/Cake/Test/Case/Console/Command/BakeShellTest.php <ide> public function testAllWithModelName() { <ide> $this->Shell->View = $this->getMock('ModelTask', array(), array(&$this->Dispatcher)); <ide> $this->Shell->DbConfig = $this->getMock('DbConfigTask', array(), array(&$this->Dispatcher)); <ide> <del> $this->Shell->DbConfig->expects($this->once())->method('getConfig')->will($this->returnValue('test')); <add> $this->Shell->DbConfig->expects($this->once()) <add> ->method('getConfig') <add> ->will($this->returnValue('test')); <ide> <del> $this->Shell->Model->expects($this->never())->method('getName'); <del> $this->Shell->Model->expects($this->once())->method('bake')->will($this->returnValue(true)); <add> $this->Shell->Model->expects($this->never()) <add> ->method('getName'); <add> <add> $this->Shell->Model->expects($this->once()) <add> ->method('bake') <add> ->will($this->returnValue(true)); <ide> <del> $this->Shell->Controller->expects($this->once())->method('bake')->will($this->returnValue(true)); <del> $this->Shell->View->expects($this->once())->method('execute'); <add> $this->Shell->Controller->expects($this->once()) <add> ->method('bake') <add> ->will($this->returnValue(true)); <add> <add> $this->Shell->View->expects($this->once()) <add> ->method('execute'); <ide> <ide> $this->Shell->expects($this->once())->method('_stop'); <del> $this->Shell->expects($this->at(0))->method('out')->with('Bake All'); <del> $this->Shell->expects($this->at(5))->method('out')->with('<success>Bake All complete</success>'); <add> $this->Shell->expects($this->at(0)) <add> ->method('out') <add> ->with('Bake All'); <add> <add> $this->Shell->expects($this->at(5)) <add> ->method('out') <add> ->with('<success>Bake All complete</success>'); <ide> <ide> $this->Shell->connection = ''; <ide> $this->Shell->params = array(); <ide> $this->Shell->args = array('User'); <ide> $this->Shell->all(); <add> <add> $this->assertEquals('User', $this->Shell->View->args[0]); <ide> } <ide> }
2
Text
Text
add changelog entry for . [ci skip]
1b356c2e7ad4eaf5ed16584501c586d1893b8eed
<ide><path>activerecord/CHANGELOG.md <add>* Fix default `format` value in `ActiveRecord::Tasks::DatabaseTasks#schema_file`. <add> <add> *James Cox* <add> <ide> * Dont enroll records in the transaction if they dont have commit callbacks. <ide> That was causing a memory grow problem when creating a lot of records inside a transaction. <ide>
1
Java
Java
fix stacktrace parsing for js
37d28be2d97df0310d1918b258b40815c8346209
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java <ide> public class StackTraceHelper { <ide> public static final java.lang.String COLUMN_KEY = "column"; <ide> public static final java.lang.String LINE_NUMBER_KEY = "lineNumber"; <ide> <del> private static final Pattern STACK_FRAME_PATTERN = Pattern.compile( <add> private static final Pattern STACK_FRAME_PATTERN1 = Pattern.compile( <ide> "^(?:(.*?)@)?(.*?)\\:([0-9]+)\\:([0-9]+)$"); <add> private static final Pattern STACK_FRAME_PATTERN2 = Pattern.compile( <add> "\\s*(?:at)\\s*(.+?)\\s*[@(](.*):([0-9]+):([0-9]+)[)]$"); <ide> <ide> /** <ide> * Represents a generic entry in a stack trace, be it originally from JS or Java. <ide> public static StackFrame[] convertJsStackTrace(String stack) { <ide> String[] stackTrace = stack.split("\n"); <ide> StackFrame[] result = new StackFrame[stackTrace.length]; <ide> for (int i = 0; i < stackTrace.length; ++i) { <del> Matcher matcher = STACK_FRAME_PATTERN.matcher(stackTrace[i]); <del> if (matcher.find()) { <del> result[i] = new StackFrameImpl( <del> matcher.group(2), <del> matcher.group(1) == null ? "(unknown)" : matcher.group(1), <del> Integer.parseInt(matcher.group(3)), <del> Integer.parseInt(matcher.group(4))); <add> Matcher matcher1 = STACK_FRAME_PATTERN1.matcher(stackTrace[i]); <add> Matcher matcher2 = STACK_FRAME_PATTERN2.matcher(stackTrace[i]); <add> Matcher matcher; <add> if (matcher2.find()) { <add> matcher = matcher2; <add> } else if (matcher1.find()) { <add> matcher = matcher1; <ide> } else { <ide> result[i] = new StackFrameImpl(null, stackTrace[i], -1, -1); <add> continue; <ide> } <add> result[i] = new StackFrameImpl( <add> matcher.group(2), <add> matcher.group(1) == null ? "(unknown)" : matcher.group(1), <add> Integer.parseInt(matcher.group(3)), <add> Integer.parseInt(matcher.group(4))); <ide> } <ide> return result; <ide> } <ide><path>ReactAndroid/src/test/java/com/facebook/react/devsupport/StackTraceHelperTest.java <ide> @RunWith(RobolectricTestRunner.class) <ide> public class StackTraceHelperTest { <ide> <add> @Test <add> public void testParseAlternateFormatStackFrameWithMethod() { <add> final StackFrame frame = StackTraceHelper.convertJsStackTrace( <add> "at func1 (/path/to/file.js:2:18)")[0]; <add> assertThat(frame.getMethod()).isEqualTo("func1"); <add> assertThat(frame.getFileName()).isEqualTo("file.js"); <add> assertThat(frame.getLine()).isEqualTo(2); <add> assertThat(frame.getColumn()).isEqualTo(18); <add> } <add> <ide> @Test <ide> public void testParseStackFrameWithMethod() { <ide> final StackFrame frame = StackTraceHelper.convertJsStackTrace(
2
PHP
PHP
add type hints
4a9abe430042a577fa7230951b2ff9dbb0f7b824
<ide><path>src/Collection/CollectionInterface.php <ide> public function take(int $size = 1, int $from = 0): CollectionInterface; <ide> * @param int $howMany The number of elements at the end of the collection <ide> * @return \Cake\Collection\CollectionInterface <ide> */ <del> public function takeLast($howMany); <add> public function takeLast(int $howMany): CollectionInterface; <ide> <ide> /** <ide> * Returns a new collection that will skip the specified amount of elements <ide><path>src/Collection/CollectionTrait.php <ide> public function last() <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function takeLast($howMany) <add> public function takeLast(int $howMany): CollectionInterface <ide> { <ide> if ($howMany < 1) { <ide> throw new \InvalidArgumentException("The takeLast method requires a number greater than 0.");
2
Go
Go
normalize the use of normalize
ae8dbeaeedce3a9f247f2d58df7459f9d79bde5d
<ide><path>builder/dockerfile/dispatchers.go <ide> func workdir(req dispatchRequest) error { <ide> runConfig := req.state.runConfig <ide> // This is from the Dockerfile and will not necessarily be in platform <ide> // specific semantics, hence ensure it is converted. <del> runConfig.WorkingDir, err = normaliseWorkdir(req.builder.platform, runConfig.WorkingDir, req.args[0]) <add> runConfig.WorkingDir, err = normalizeWorkdir(req.builder.platform, runConfig.WorkingDir, req.args[0]) <ide> if err != nil { <ide> return err <ide> } <ide><path>builder/dockerfile/dispatchers_unix.go <ide> import ( <ide> "path/filepath" <ide> ) <ide> <del>// normaliseWorkdir normalises a user requested working directory in a <add>// normalizeWorkdir normalizes a user requested working directory in a <ide> // platform semantically consistent way. <del>func normaliseWorkdir(_ string, current string, requested string) (string, error) { <add>func normalizeWorkdir(_ string, current string, requested string) (string, error) { <ide> if requested == "" { <del> return "", errors.New("cannot normalise nothing") <add> return "", errors.New("cannot normalize nothing") <ide> } <ide> current = filepath.FromSlash(current) <ide> requested = filepath.FromSlash(requested) <ide><path>builder/dockerfile/dispatchers_unix_test.go <ide> import ( <ide> "testing" <ide> ) <ide> <del>func TestNormaliseWorkdir(t *testing.T) { <add>func TestNormalizeWorkdir(t *testing.T) { <ide> testCases := []struct{ current, requested, expected, expectedError string }{ <del> {``, ``, ``, `cannot normalise nothing`}, <add> {``, ``, ``, `cannot normalize nothing`}, <ide> {``, `foo`, `/foo`, ``}, <ide> {``, `/foo`, `/foo`, ``}, <ide> {`/foo`, `bar`, `/foo/bar`, ``}, <ide> {`/foo`, `/bar`, `/bar`, ``}, <ide> } <ide> <ide> for _, test := range testCases { <del> normalised, err := normaliseWorkdir(runtime.GOOS, test.current, test.requested) <add> normalized, err := normalizeWorkdir(runtime.GOOS, test.current, test.requested) <ide> <ide> if test.expectedError != "" && err == nil { <del> t.Fatalf("NormaliseWorkdir should return an error %s, got nil", test.expectedError) <add> t.Fatalf("NormalizeWorkdir should return an error %s, got nil", test.expectedError) <ide> } <ide> <ide> if test.expectedError != "" && err.Error() != test.expectedError { <del> t.Fatalf("NormaliseWorkdir returned wrong error. Expected %s, got %s", test.expectedError, err.Error()) <add> t.Fatalf("NormalizeWorkdir returned wrong error. Expected %s, got %s", test.expectedError, err.Error()) <ide> } <ide> <del> if normalised != test.expected { <del> t.Fatalf("NormaliseWorkdir error. Expected %s for current %s and requested %s, got %s", test.expected, test.current, test.requested, normalised) <add> if normalized != test.expected { <add> t.Fatalf("NormalizeWorkdir error. Expected %s for current %s and requested %s, got %s", test.expected, test.current, test.requested, normalized) <ide> } <ide> } <ide> } <ide><path>builder/dockerfile/dispatchers_windows.go <ide> import ( <ide> <ide> var pattern = regexp.MustCompile(`^[a-zA-Z]:\.$`) <ide> <del>// normaliseWorkdir normalises a user requested working directory in a <add>// normalizeWorkdir normalizes a user requested working directory in a <ide> // platform semantically consistent way. <del>func normaliseWorkdir(platform string, current string, requested string) (string, error) { <add>func normalizeWorkdir(platform string, current string, requested string) (string, error) { <ide> if platform == "" { <ide> platform = "windows" <ide> } <ide> if platform == "windows" { <del> return normaliseWorkdirWindows(current, requested) <add> return normalizeWorkdirWindows(current, requested) <ide> } <del> return normaliseWorkdirUnix(current, requested) <add> return normalizeWorkdirUnix(current, requested) <ide> } <ide> <del>// normaliseWorkdirUnix normalises a user requested working directory in a <add>// normalizeWorkdirUnix normalizes a user requested working directory in a <ide> // platform semantically consistent way. <del>func normaliseWorkdirUnix(current string, requested string) (string, error) { <add>func normalizeWorkdirUnix(current string, requested string) (string, error) { <ide> if requested == "" { <del> return "", errors.New("cannot normalise nothing") <add> return "", errors.New("cannot normalize nothing") <ide> } <ide> current = strings.Replace(current, string(os.PathSeparator), "/", -1) <ide> requested = strings.Replace(requested, string(os.PathSeparator), "/", -1) <ide> func normaliseWorkdirUnix(current string, requested string) (string, error) { <ide> return requested, nil <ide> } <ide> <del>// normaliseWorkdirWindows normalises a user requested working directory in a <add>// normalizeWorkdirWindows normalizes a user requested working directory in a <ide> // platform semantically consistent way. <del>func normaliseWorkdirWindows(current string, requested string) (string, error) { <add>func normalizeWorkdirWindows(current string, requested string) (string, error) { <ide> if requested == "" { <del> return "", errors.New("cannot normalise nothing") <add> return "", errors.New("cannot normalize nothing") <ide> } <ide> <ide> // `filepath.Clean` will replace "" with "." so skip in that case <ide><path>builder/dockerfile/dispatchers_windows_test.go <ide> package dockerfile <ide> <ide> import "testing" <ide> <del>func TestNormaliseWorkdir(t *testing.T) { <add>func TestNormalizeWorkdir(t *testing.T) { <ide> tests := []struct{ platform, current, requested, expected, etext string }{ <del> {"windows", ``, ``, ``, `cannot normalise nothing`}, <add> {"windows", ``, ``, ``, `cannot normalize nothing`}, <ide> {"windows", ``, `C:`, ``, `C:. is not a directory. If you are specifying a drive letter, please add a trailing '\'`}, <ide> {"windows", ``, `C:.`, ``, `C:. is not a directory. If you are specifying a drive letter, please add a trailing '\'`}, <ide> {"windows", `c:`, `\a`, ``, `c:. is not a directory. If you are specifying a drive letter, please add a trailing '\'`}, <ide> func TestNormaliseWorkdir(t *testing.T) { <ide> {"windows", `C:\foo`, `bar`, `C:\foo\bar`, ``}, <ide> {"windows", `C:\foo`, `/bar`, `C:\bar`, ``}, <ide> {"windows", `C:\foo`, `\bar`, `C:\bar`, ``}, <del> {"linux", ``, ``, ``, `cannot normalise nothing`}, <add> {"linux", ``, ``, ``, `cannot normalize nothing`}, <ide> {"linux", ``, `foo`, `/foo`, ``}, <ide> {"linux", ``, `/foo`, `/foo`, ``}, <ide> {"linux", `/foo`, `bar`, `/foo/bar`, ``}, <ide> {"linux", `/foo`, `/bar`, `/bar`, ``}, <ide> {"linux", `\a`, `b\c`, `/a/b/c`, ``}, <ide> } <ide> for _, i := range tests { <del> r, e := normaliseWorkdir(i.platform, i.current, i.requested) <add> r, e := normalizeWorkdir(i.platform, i.current, i.requested) <ide> <ide> if i.etext != "" && e == nil { <del> t.Fatalf("TestNormaliseWorkingDir Expected error %s for '%s' '%s', got no error", i.etext, i.current, i.requested) <add> t.Fatalf("TestNormalizeWorkingDir Expected error %s for '%s' '%s', got no error", i.etext, i.current, i.requested) <ide> } <ide> <ide> if i.etext != "" && e.Error() != i.etext { <del> t.Fatalf("TestNormaliseWorkingDir Expected error %s for '%s' '%s', got %s", i.etext, i.current, i.requested, e.Error()) <add> t.Fatalf("TestNormalizeWorkingDir Expected error %s for '%s' '%s', got %s", i.etext, i.current, i.requested, e.Error()) <ide> } <ide> <ide> if r != i.expected { <del> t.Fatalf("TestNormaliseWorkingDir Expected '%s' for '%s' '%s', got '%s'", i.expected, i.current, i.requested, r) <add> t.Fatalf("TestNormalizeWorkingDir Expected '%s' for '%s' '%s', got '%s'", i.expected, i.current, i.requested, r) <ide> } <ide> } <ide> } <ide><path>builder/dockerfile/internals.go <ide> func (b *Builder) performCopy(state *dispatchState, inst copyInstruction) error <ide> func createDestInfo(workingDir string, inst copyInstruction, imageMount *imageMount) (copyInfo, error) { <ide> // Twiddle the destination when it's a relative path - meaning, make it <ide> // relative to the WORKINGDIR <del> dest, err := normaliseDest(workingDir, inst.dest) <add> dest, err := normalizeDest(workingDir, inst.dest) <ide> if err != nil { <ide> return copyInfo{}, errors.Wrapf(err, "invalid %s", inst.cmdName) <ide> } <ide><path>builder/dockerfile/internals_unix.go <ide> import ( <ide> "github.com/docker/docker/pkg/system" <ide> ) <ide> <del>// normaliseDest normalises the destination of a COPY/ADD command in a <add>// normalizeDest normalizes the destination of a COPY/ADD command in a <ide> // platform semantically consistent way. <del>func normaliseDest(workingDir, requested string) (string, error) { <add>func normalizeDest(workingDir, requested string) (string, error) { <ide> dest := filepath.FromSlash(requested) <ide> endsInSlash := strings.HasSuffix(requested, string(os.PathSeparator)) <ide> if !system.IsAbs(requested) { <ide><path>builder/dockerfile/internals_windows.go <ide> import ( <ide> "github.com/pkg/errors" <ide> ) <ide> <del>// normaliseDest normalises the destination of a COPY/ADD command in a <add>// normalizeDest normalizes the destination of a COPY/ADD command in a <ide> // platform semantically consistent way. <del>func normaliseDest(workingDir, requested string) (string, error) { <add>func normalizeDest(workingDir, requested string) (string, error) { <ide> dest := filepath.FromSlash(requested) <ide> endsInSlash := strings.HasSuffix(dest, string(os.PathSeparator)) <ide> <ide><path>builder/dockerfile/internals_windows_test.go <ide> import ( <ide> "github.com/stretchr/testify/assert" <ide> ) <ide> <del>func TestNormaliseDest(t *testing.T) { <add>func TestNormalizeDest(t *testing.T) { <ide> tests := []struct{ current, requested, expected, etext string }{ <ide> {``, `D:\`, ``, `Windows does not support destinations not on the system drive (C:)`}, <ide> {``, `e:/`, ``, `Windows does not support destinations not on the system drive (C:)`}, <ide> func TestNormaliseDest(t *testing.T) { <ide> } <ide> for _, testcase := range tests { <ide> msg := fmt.Sprintf("Input: %s, %s", testcase.current, testcase.requested) <del> actual, err := normaliseDest(testcase.current, testcase.requested) <add> actual, err := normalizeDest(testcase.current, testcase.requested) <ide> if testcase.etext == "" { <ide> if !assert.NoError(t, err, msg) { <ide> continue <ide><path>integration-cli/docker_cli_commit_test.go <ide> func (s *DockerSuite) TestCommitChange(c *check.C) { <ide> imageID = strings.TrimSpace(imageID) <ide> <ide> prefix, slash := getPrefixAndSlashFromDaemonPlatform() <del> prefix = strings.ToUpper(prefix) // Force C: as that's how WORKDIR is normalised on Windows <add> prefix = strings.ToUpper(prefix) // Force C: as that's how WORKDIR is normalized on Windows <ide> expected := map[string]string{ <ide> "Config.ExposedPorts": "map[8080/tcp:{}]", <ide> "Config.Env": "[DEBUG=true test=1 PATH=/foo]", <ide><path>volume/store/store.go <ide> func (s *VolumeStore) List() ([]volume.Volume, []string, error) { <ide> var out []volume.Volume <ide> <ide> for _, v := range vols { <del> name := normaliseVolumeName(v.Name()) <add> name := normalizeVolumeName(v.Name()) <ide> <ide> s.locks.Lock(name) <ide> storedV, exists := s.getNamed(name) <ide> func (s *VolumeStore) list() ([]volume.Volume, []string, error) { <ide> // CreateWithRef creates a volume with the given name and driver and stores the ref <ide> // This ensures there's no race between creating a volume and then storing a reference. <ide> func (s *VolumeStore) CreateWithRef(name, driverName, ref string, opts, labels map[string]string) (volume.Volume, error) { <del> name = normaliseVolumeName(name) <add> name = normalizeVolumeName(name) <ide> s.locks.Lock(name) <ide> defer s.locks.Unlock(name) <ide> <ide> func (s *VolumeStore) create(name, driverName string, opts, labels map[string]st <ide> // This is just like Get(), but we store the reference while holding the lock. <ide> // This makes sure there are no races between checking for the existence of a volume and adding a reference for it <ide> func (s *VolumeStore) GetWithRef(name, driverName, ref string) (volume.Volume, error) { <del> name = normaliseVolumeName(name) <add> name = normalizeVolumeName(name) <ide> s.locks.Lock(name) <ide> defer s.locks.Unlock(name) <ide> <ide> func (s *VolumeStore) GetWithRef(name, driverName, ref string) (volume.Volume, e <ide> <ide> // Get looks if a volume with the given name exists and returns it if so <ide> func (s *VolumeStore) Get(name string) (volume.Volume, error) { <del> name = normaliseVolumeName(name) <add> name = normalizeVolumeName(name) <ide> s.locks.Lock(name) <ide> defer s.locks.Unlock(name) <ide> <ide> func lookupVolume(driverName, volumeName string) (volume.Volume, error) { <ide> <ide> // Remove removes the requested volume. A volume is not removed if it has any refs <ide> func (s *VolumeStore) Remove(v volume.Volume) error { <del> name := normaliseVolumeName(v.Name()) <add> name := normalizeVolumeName(v.Name()) <ide> s.locks.Lock(name) <ide> defer s.locks.Unlock(name) <ide> <ide><path>volume/store/store_unix.go <ide> <ide> package store <ide> <del>// normaliseVolumeName is a platform specific function to normalise the name <add>// normalizeVolumeName is a platform specific function to normalize the name <ide> // of a volume. This is a no-op on Unix-like platforms <del>func normaliseVolumeName(name string) string { <add>func normalizeVolumeName(name string) string { <ide> return name <ide> } <ide><path>volume/store/store_windows.go <ide> package store <ide> <ide> import "strings" <ide> <del>// normaliseVolumeName is a platform specific function to normalise the name <add>// normalizeVolumeName is a platform specific function to normalize the name <ide> // of a volume. On Windows, as NTFS is case insensitive, under <ide> // c:\ProgramData\Docker\Volumes\, the folders John and john would be synonymous. <ide> // Hence we can't allow the volume "John" and "john" to be created as separate <ide> // volumes. <del>func normaliseVolumeName(name string) string { <add>func normalizeVolumeName(name string) string { <ide> return strings.ToLower(name) <ide> }
13
Ruby
Ruby
remove nil requireds/dependents"
49310667b4e6327d8276752a74fe480c1d7fb135
<ide><path>Library/Homebrew/cmd/uninstall.rb <ide> class DependentsMessage <ide> attr_reader :reqs, :deps <ide> <ide> def initialize(requireds, dependents) <del> @reqs = requireds.compact <del> @deps = dependents.compact <add> @reqs = requireds <add> @deps = dependents <ide> end <ide> <ide> protected
1
Javascript
Javascript
perform replacmenents even without parser
1a541e12cef4f31437ad1831f92911306e57ae9f
<ide><path>lib/dependencies/ContextDependencyHelpers.js <ide> ContextDependencyHelpers.create = ( <ide> dep.loc = expr.loc; <ide> const replaces = []; <ide> <del> if (parser) { <del> param.parts.forEach((part, i) => { <del> if (i % 2 === 0) { <del> // Quasis or merged quasi <del> let range = part.range; <del> let value = part.string; <del> if (param.templateStringKind === "cooked") { <del> value = JSON.stringify(value); <del> value = value.slice(1, value.length - 1); <del> } <del> if (i === 0) { <del> // prefix <del> value = prefix; <del> range = [param.range[0], part.range[1]]; <del> value = <del> (param.templateStringKind === "cooked" ? "`" : "String.raw`") + <del> value; <del> } else if (i === param.parts.length - 1) { <del> // postfix <del> value = postfix; <del> range = [part.range[0], param.range[1]]; <del> value = value + "`"; <del> } else if ( <del> param.expression && <del> param.expression.type === "TemplateElement" && <del> param.expression.value[param.templateStringKind] === value <del> ) { <del> // Shortcut when it's a single quasi and doesn't need to be replaced <del> return; <del> } <del> replaces.push({ <del> range, <del> value <del> }); <del> } else { <del> // Expression <add> param.parts.forEach((part, i) => { <add> if (i % 2 === 0) { <add> // Quasis or merged quasi <add> let range = part.range; <add> let value = part.string; <add> if (param.templateStringKind === "cooked") { <add> value = JSON.stringify(value); <add> value = value.slice(1, value.length - 1); <add> } <add> if (i === 0) { <add> // prefix <add> value = prefix; <add> range = [param.range[0], part.range[1]]; <add> value = <add> (param.templateStringKind === "cooked" ? "`" : "String.raw`") + <add> value; <add> } else if (i === param.parts.length - 1) { <add> // postfix <add> value = postfix; <add> range = [part.range[0], param.range[1]]; <add> value = value + "`"; <add> } else if ( <add> param.expression && <add> param.expression.type === "TemplateElement" && <add> param.expression.value[param.templateStringKind] === value <add> ) { <add> // Shortcut when it's a single quasi and doesn't need to be replaced <add> return; <add> } <add> replaces.push({ <add> range, <add> value <add> }); <add> } else { <add> // Expression <add> if (parser) { <ide> parser.walkExpression(part.expression); <ide> } <del> }); <del> } <add> } <add> }); <ide> <ide> dep.replaces = replaces; <ide> dep.critical =
1
PHP
PHP
fix remaining failing tests
2eb2b1eb6a5bdc103b9933dd0335f017905fac29
<ide><path>lib/Cake/Network/Request.php <ide> public static function createFromGlobals() { <ide> * @param array $config An array of request data to create a request with. <ide> */ <ide> public function __construct($config = array()) { <del> $config = (array)$config; <add> if (is_string($config)) { <add> $config = array('url' => $config); <add> } <ide> $config += array( <ide> 'params' => $this->params, <ide> 'query' => array(), <ide><path>lib/Cake/Test/TestCase/Routing/DispatcherTest.php <ide> public function testParseParamsWithoutZerosAndEmptyPost() { <ide> $this->assertFalse(!empty($request['form'])); <ide> } <ide> <del>/** <del> * testParseParamsReturnsPostedData method <del> * <del> * @return void <del> */ <del> public function testParseParamsReturnsPostedData() { <del> $_POST['testdata'] = "My Posted Content"; <del> $Dispatcher = new Dispatcher(); <del> $request = new Request("/"); <del> $event = new Event(__CLASS__, $Dispatcher, array('request' => $request)); <del> $Dispatcher->parseParams($event); <del> $test = $Dispatcher->parseParams($event); <del> $this->assertEquals("My Posted Content", $request['data']['testdata']); <del> } <del> <ide> /** <ide> * testQueryStringOnRoot method <ide> * <ide> public function testDispatchActionReturnsResponse() { <ide> public function testAdminDispatch() { <ide> $Dispatcher = new TestDispatcher(); <ide> Configure::write('Routing.prefixes', array('admin')); <del> Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php'); <ide> $url = new Request('admin/test_dispatch_pages/index/param:value/param2:value2'); <ide> $response = $this->getMock('Cake\Network\Response'); <ide> <ide> public function testAdminDispatch() { <ide> <ide> $this->assertTrue($Dispatcher->controller->params['admin']); <ide> <del> $expected = '/cake/repo/branches/1.2.x.x/index.php/admin/test_dispatch_pages/index/param:value/param2:value2'; <add> $expected = '/admin/test_dispatch_pages/index/param:value/param2:value2'; <ide> $this->assertSame($expected, $Dispatcher->controller->here); <del> <del> $expected = '/cake/repo/branches/1.2.x.x/index.php'; <del> $this->assertSame($expected, $Dispatcher->controller->base); <ide> } <ide> <ide> /** <ide> public function testHttpMethodOverrides() { <ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s'); <ide> } <ide> <del> $_POST['_method'] = 'PUT'; <del> <del> $request = new Request('/posts/5'); <add> $request = new Request(array( <add> 'url' => '/posts/5', <add> 'post' => array('_method' => 'PUT') <add> )); <ide> $event = new Event(__CLASS__, $dispatcher, array('request' => $request)); <ide> $dispatcher->parseParams($event); <ide> $expected = array( <ide> public function testHttpMethodOverrides() { <ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s'); <ide> } <ide> <del> $_POST['_method'] = 'POST'; <del> $_POST['data'] = array('Post' => array('title' => 'New Post')); <del> $_POST['extra'] = 'data'; <ide> $_SERVER = array(); <ide> <del> $request = new Request('/posts'); <add> $request = new Request(array( <add> 'url' => '/posts', <add> 'post' => array( <add> '_method' => 'POST', <add> 'Post' => array('title' => 'New Post'), <add> 'extra' => 'data' <add> ), <add> )); <ide> $event = new Event(__CLASS__, $dispatcher, array('request' => $request)); <ide> $dispatcher->parseParams($event); <ide> $expected = array( <ide> public function testHttpMethodOverrides() { <ide> foreach ($expected as $key => $value) { <ide> $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s'); <ide> } <del> <del> unset($_POST['_method']); <ide> } <ide> <ide> /**
2
Go
Go
avoid regression in events test
560eb07009d65fbcfb49b2fa8b04a2e3f4d647e8
<ide><path>integration-cli/docker_cli_events_test.go <ide> func TestCLILimitEvents(t *testing.T) { <ide> out, _, _ := runCommandWithOutput(eventsCmd) <ide> events := strings.Split(out, "\n") <ide> n_events := len(events) - 1 <del> if n_events > 64 { <add> if n_events != 64 { <ide> t.Fatalf("events should be limited to 64, but received %d", n_events) <ide> } <ide> logDone("events - limited to 64 entries")
1
Javascript
Javascript
use indices instead of indicies
1014d4b829429f238a17cae35f78a12756bc5155
<ide><path>test/configCases/chunk-index/order-multiple-entries/webpack.config.js <ide> module.exports = { <ide> `${i}: ${m.readableIdentifier(compilation.requestShortener)}` <ide> ) <ide> .join(", "); <del> const indicies2 = Array.from(compilation.modules) <add> const indices2 = Array.from(compilation.modules) <ide> .map(m => [moduleGraph.getPostOrderIndex(m), m]) <ide> .filter(p => typeof p[0] === "number") <ide> .sort((a, b) => a[0] - b[0]) <ide> module.exports = { <ide> expect(indices).toEqual( <ide> "0: ./entry1.js, 1: ./a.js, 2: ./shared.js, 3: ./b.js, 4: ./c.js, 5: ./entry2.js, 6: ./async.js" <ide> ); <del> expect(indicies2).toEqual( <add> expect(indices2).toEqual( <ide> "0: ./shared.js, 1: ./a.js, 2: ./b.js, 3: ./c.js, 4: ./entry1.js, 5: ./entry2.js, 6: ./async.js" <ide> ); <ide> });
1
PHP
PHP
simplify encrypter logic
051c68d94f812986f54d71294d66a3a7bfad5adf
<ide><path>src/Illuminate/Encryption/Encrypter.php <ide> class Encrypter extends BaseEncrypter implements EncrypterContract <ide> */ <ide> protected $cipher; <ide> <del> /** <del> * The block size of the cipher. <del> * <del> * @var int <del> */ <del> protected $block = 16; <del> <ide> /** <ide> * Create a new encrypter instance. <ide> * <ide> public function decrypt($payload) <ide> */ <ide> protected function getIvSize() <ide> { <del> return $this->block; <add> return 16; <ide> } <ide> }
1
Python
Python
fix reference to atleast_1d
75b004254f46992f742b2f128700f8cf7d5b3d6d
<ide><path>numpy/core/fromnumeric.py <ide> def nonzero(a): <ide> .. note:: <ide> <ide> When called on a zero-d array or scalar, ``nonzero(a)`` is treated <del> as ``nonzero(atleast1d(a))``. <add> as ``nonzero(atleast_1d(a))``. <ide> <ide> .. deprecated:: 1.17.0 <ide> <del> Use `atleast1d` explicitly if this behavior is deliberate. <add> Use `atleast_1d` explicitly if this behavior is deliberate. <ide> <ide> Parameters <ide> ----------
1
Python
Python
freeze backbone support for retinanet
14c320651e69248809bf22587644d5e4700748ea
<ide><path>official/vision/configs/retinanet.py <ide> class RetinaNetTask(cfg.TaskConfig): <ide> # If set, the Waymo Open Dataset evaluator would be used. <ide> use_wod_metrics: bool = False <ide> <add> # If set, freezes the backbone during training. <add> # TODO(crisnv) Add paper link when available. <add> freeze_backbone: bool = False <add> <ide> <ide> @exp_factory.register_config_factory('retinanet') <ide> def retinanet() -> cfg.ExperimentConfig: <ide><path>official/vision/tasks/retinanet.py <ide> def build_model(self): <ide> input_specs=input_specs, <ide> model_config=self.task_config.model, <ide> l2_regularizer=l2_regularizer) <add> <add> if self.task_config.freeze_backbone: <add> model.backbone.trainable = False <add> <ide> return model <ide> <ide> def initialize(self, model: tf.keras.Model):
2
PHP
PHP
change $serializer visibility, and other fix
85e5ef4d4ece0014211e380c038b71d058ce3c10
<ide><path>lib/Cake/Cache/Engine/MemcachedEngine.php <ide> class MemcachedEngine extends CacheEngine { <ide> public $settings = array(); <ide> <ide> /** <del> * List of available serializer engine <add> * List of available serializer engines <ide> * <ide> * Memcached must be compiled with json and igbinary support to use these engines <ide> * <ide> * @var array <ide> */ <del> public static $serializer = array( <add> protected $_serializers = array( <ide> 'igbinary' => Memcached::SERIALIZER_IGBINARY, <ide> 'json' => Memcached::SERIALIZER_JSON, <ide> 'php' => Memcached::SERIALIZER_PHP <ide> public function init($settings = array()) { <ide> protected function _setOptions() { <ide> $this->_Memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true); <ide> <del> if (!array_key_exists($this->settings['serialize'], self::$serializer)) { <add> if (!isset($this->_serializers[$this->settings['serialize']])) { <ide> throw new CacheException( <ide> __d('cake_dev', '%s is not a valid serializer engine for Memcached', $this->settings['serialize']) <ide> ); <ide> } <ide> <del> $serializer = self::$serializer['php']; <add> $serializer = $this->_serializers['php']; <ide> switch($this->settings['serialize']) { <ide> case 'igbinary': <ide> if (Memcached::HAVE_IGBINARY) { <del> $serializer = self::$serializer['igbinary']; <add> $serializer = $this->_serializers['igbinary']; <ide> } else { <ide> throw new CacheException( <ide> __d('cake_dev', 'Memcached extension is not compiled with igbinary support') <ide> protected function _setOptions() { <ide> break; <ide> case 'json': <ide> if (Memcached::HAVE_JSON) { <del> $serializer = self::$serializer['json']; <add> $serializer = $this->_serializers['json']; <ide> } else { <ide> throw new CacheException( <ide> __d('cake_dev', 'Memcached extension is not compiled with json support')
1
Javascript
Javascript
handle errors that are not `error` instances
34d57afc32b25984741d3772a7cf832cfa189d79
<ide><path>Libraries/JavaScriptAppEngine/Initialization/ExceptionsManager.js <ide> var stringifySafe = require('stringifySafe'); <ide> <ide> var sourceMapPromise; <ide> <del>type Exception = { <del> sourceURL: string; <del> line: number; <del> message: string; <del>} <del> <ide> var exceptionID = 0; <ide> <del>function reportException(e: Exception, isFatal: bool, stack?: any) { <add>function reportException(e: Error, isFatal: bool, stack?: any) { <ide> var currentExceptionID = ++exceptionID; <ide> if (RCTExceptionsManager) { <ide> if (!stack) { <ide> function reportException(e: Exception, isFatal: bool, stack?: any) { <ide> } <ide> } <ide> <del>function handleException(e: Exception, isFatal: boolean) { <add>function handleException(e: Error, isFatal: boolean) { <add> // Workaround for reporting errors caused by `throw 'some string'` <add> // Unfortunately there is no way to figure out the stacktrace in this <add> // case, so if you ended up here trying to trace an error, look for <add> // `throw '<error message>'` somewhere in your codebase. <add> if (!e.message) { <add> e = new Error(e); <add> } <ide> var stack = parseErrorStack(e); <ide> var msg = <ide> 'Error: ' + e.message + <ide> '\n stack: \n' + stackToString(stack) + <del> '\n URL: ' + e.sourceURL + <del> '\n line: ' + e.line + <add> '\n URL: ' + (e: any).sourceURL + <add> '\n line: ' + (e: any).line + <ide> '\n message: ' + e.message; <ide> if (console.errorOriginal) { <ide> console.errorOriginal(msg);
1
Javascript
Javascript
push serialize module to swarm /cc @jaubourg
0d9006531d2b991cdbf419e1b4b0b4e03a588b10
<ide><path>grunt.js <ide> module.exports = function( grunt ) { <ide> var testswarm = require( "testswarm" ), <ide> testUrls = [], <ide> config = grunt.file.readJSON( configFile ).jquery, <del> tests = "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector support traversing".split( " " ); <add> tests = "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue serialize selector support traversing".split( " " ); <ide> <ide> tests.forEach(function( test ) { <ide> testUrls.push( config.testUrl + commit + "/test/index.html?module=" + test );
1
Text
Text
fix filename in usagewithreactrouter
decec821a17551934f7b15ea27c0236a43979964
<ide><path>docs/advanced/UsageWithReactRouter.md <ide> const FilterLink = ({ filter, children }) => ( <ide> export default FilterLink; <ide> ``` <ide> <del>#### `containers/Footer.js` <add>#### `components/Footer.js` <ide> ```js <ide> import React from 'react' <ide> import FilterLink from '../containers/FilterLink'
1
Javascript
Javascript
add more filter tests
da113811543865de525f5332209d384b5352be3e
<ide><path>test/parallel/test-stream-filter.js <ide> const { <ide> Readable, <ide> } = require('stream'); <ide> const assert = require('assert'); <add>const { once } = require('events'); <ide> const { setTimeout } = require('timers/promises'); <ide> <ide> { <ide> const { setTimeout } = require('timers/promises'); <ide> })().then(common.mustCall()); <ide> } <ide> <add>{ <add> // Filter works on an infinite stream <add> const stream = Readable.from(async function* () { <add> while (true) yield 1; <add> }()).filter(common.mustCall(async (x) => { <add> return x < 3; <add> }, 5)); <add> (async () => { <add> let i = 1; <add> for await (const item of stream) { <add> assert.strictEqual(item, 1); <add> if (++i === 5) break; <add> } <add> })().then(common.mustCall()); <add>} <add> <add>{ <add> // Filter works on constructor created streams <add> let i = 0; <add> const stream = new Readable({ <add> read() { <add> if (i === 10) { <add> this.push(null); <add> return; <add> } <add> this.push(Uint8Array.from([i])); <add> i++; <add> }, <add> highWaterMark: 0, <add> }).filter(common.mustCall(async ([x]) => { <add> return x !== 5; <add> }, 10)); <add> (async () => { <add> const result = (await stream.toArray()).map((x) => x[0]); <add> const expected = [...Array(10).keys()].filter((x) => x !== 5); <add> assert.deepStrictEqual(result, expected); <add> })().then(common.mustCall()); <add>} <add> <add>{ <add> // Throwing an error during `filter` (sync) <add> const stream = Readable.from([1, 2, 3, 4, 5]).filter((x) => { <add> if (x === 3) { <add> throw new Error('boom'); <add> } <add> return true; <add> }); <add> assert.rejects( <add> stream.map((x) => x + x).toArray(), <add> /boom/, <add> ).then(common.mustCall()); <add>} <add> <add>{ <add> // Throwing an error during `filter` (async) <add> const stream = Readable.from([1, 2, 3, 4, 5]).filter(async (x) => { <add> if (x === 3) { <add> throw new Error('boom'); <add> } <add> return true; <add> }); <add> assert.rejects( <add> stream.filter(() => true).toArray(), <add> /boom/, <add> ).then(common.mustCall()); <add>} <add> <ide> { <ide> // Concurrency + AbortSignal <ide> const ac = new AbortController(); <ide> let calls = 0; <ide> const stream = Readable.from([1, 2, 3, 4]).filter(async (_, { signal }) => { <ide> calls++; <del> await setTimeout(100, { signal }); <add> await once(signal, 'abort'); <ide> }, { signal: ac.signal, concurrency: 2 }); <ide> // pump <ide> assert.rejects(async () => {
1
Ruby
Ruby
add epoch tests
6a684f41993f4820b48b7487c32096ea72d4de2f
<ide><path>Library/Homebrew/test/test_formula.rb <ide> def setup_tab_for_prefix(prefix, options = {}) <ide> <ide> def reset_outdated_versions <ide> f.instance_variable_set(:@outdated_versions, nil) <del> f.instance_variable_set(:@outdated_versions_head_fetched, nil) <ide> end <ide> <ide> def test_greater_different_tap_installed <ide> def test_outdated_fetch_head <ide> FileUtils.rm_rf HOMEBREW_CACHE/"testball--git" <ide> FileUtils.rm_rf HOMEBREW_CELLAR/"testball" <ide> end <add> <add> def test_outdated_versions_version_scheme_changed <add> @f = formula("testball") do <add> url "foo" <add> version "20141010" <add> version_scheme 1 <add> end <add> <add> prefix = HOMEBREW_CELLAR.join("testball/0.1") <add> setup_tab_for_prefix(prefix, :versions => { "stable" => "0.1" }) <add> <add> refute_predicate f.outdated_versions, :empty? <add> ensure <add> prefix.rmtree <add> end <add> <add> def test_outdated_versions_mixed_version_schemes <add> @f = formula("testball") do <add> url "foo" <add> version "20141010" <add> version_scheme 3 <add> end <add> <add> prefix_a = HOMEBREW_CELLAR.join("testball/20141009") <add> setup_tab_for_prefix(prefix_a, :versions => { "stable" => "20141009", "version_scheme" => 1 }) <add> <add> prefix_b = HOMEBREW_CELLAR.join("testball/2.14") <add> setup_tab_for_prefix(prefix_b, :versions => { "stable" => "2.14", "version_scheme" => 2 }) <add> <add> refute_predicate f.outdated_versions, :empty? <add> reset_outdated_versions <add> <add> prefix_c = HOMEBREW_CELLAR.join("testball/20141009") <add> setup_tab_for_prefix(prefix_c, :versions => { "stable" => "20141009", "version_scheme" => 3 }) <add> <add> refute_predicate f.outdated_versions, :empty? <add> reset_outdated_versions <add> <add> prefix_d = HOMEBREW_CELLAR.join("testball/20141011") <add> setup_tab_for_prefix(prefix_d, :versions => { "stable" => "20141009", "version_scheme" => 3 }) <add> assert_predicate f.outdated_versions, :empty? <add> ensure <add> f.rack.rmtree <add> end <add> <add> def test_outdated_versions_head_with_version_scheme <add> @f = formula("testball") do <add> url "foo" <add> version "1.0" <add> version_scheme 2 <add> end <add> <add> head_prefix = HOMEBREW_CELLAR.join("testball/HEAD") <add> <add> setup_tab_for_prefix(head_prefix, :versions => { "stable" => "1.0", "version_scheme" => 1 }) <add> refute_predicate f.outdated_versions, :empty? <add> <add> reset_outdated_versions <add> head_prefix.rmtree <add> <add> setup_tab_for_prefix(head_prefix, :versions => { "stable" => "1.0", "version_scheme" => 2 }) <add> assert_predicate f.outdated_versions, :empty? <add> ensure <add> head_prefix.rmtree <add> end <ide> end
1
Ruby
Ruby
fix activejob isolation tests
2f9179b4f4dd3335583ddcc046d520b149b91866
<ide><path>activejob/test/cases/rescue_test.rb <ide> require 'helper' <ide> require 'jobs/rescue_job' <add>require 'models/person' <ide> <ide> require 'active_support/core_ext/object/inclusion' <ide>
1
Text
Text
specify path to commentscontroller again inline
8cf428fe78d8a45690524e83663e69ae35a5c413
<ide><path>guides/source/getting_started.md <ide> This adds a form on the `Post` show page that creates a new comment by <ide> calling the `CommentsController` `create` action. The `form_for` call here uses <ide> an array, which will build a nested route, such as `/posts/1/comments`. <ide> <del>Let's wire up the `create`: <add>Let's wire up the `create` in `app/controllers/comments_controller.rb`: <ide> <ide> ```ruby <ide> class CommentsController < ApplicationController
1
Javascript
Javascript
change arguments order in strictequal
a67e0a6fd21d09c3bca2c6211109e5be980b0b9d
<ide><path>test/parallel/test-net-eaddrinuse.js <ide> const server2 = net.createServer(function(socket) { <ide> }); <ide> server1.listen(0, function() { <ide> server2.on('error', function(error) { <del> assert.strictEqual(true, error.message.includes('EADDRINUSE')); <add> assert.strictEqual(error.message.includes('EADDRINUSE'), true); <ide> server1.close(); <ide> }); <ide> server2.listen(this.address().port);
1
Go
Go
allow inter-network connectivity via exposed ports
9db2b791bcc798852a4b1c698e401e1882f5be2f
<ide><path>libnetwork/drivers/bridge/setup_ip_tables.go <ide> func setupIPTablesInternal(bridgeIface string, addr net.Addr, icc, ipmasq, hairp <ide> address = addr.String() <ide> natRule = iptRule{table: iptables.Nat, chain: "POSTROUTING", preArgs: []string{"-t", "nat"}, args: []string{"-s", address, "!", "-o", bridgeIface, "-j", "MASQUERADE"}} <ide> hpNatRule = iptRule{table: iptables.Nat, chain: "POSTROUTING", preArgs: []string{"-t", "nat"}, args: []string{"-m", "addrtype", "--src-type", "LOCAL", "-o", bridgeIface, "-j", "MASQUERADE"}} <add> skipDNAT = iptRule{table: iptables.Nat, chain: DockerChain, preArgs: []string{"-t", "nat"}, args: []string{"-i", bridgeIface, "-j", "RETURN"}} <ide> outRule = iptRule{table: iptables.Filter, chain: "FORWARD", args: []string{"-i", bridgeIface, "!", "-o", bridgeIface, "-j", "ACCEPT"}} <ide> inRule = iptRule{table: iptables.Filter, chain: "FORWARD", args: []string{"-o", bridgeIface, "-m", "conntrack", "--ctstate", "RELATED,ESTABLISHED", "-j", "ACCEPT"}} <ide> ) <ide> func setupIPTablesInternal(bridgeIface string, addr net.Addr, icc, ipmasq, hairp <ide> if err := programChainRule(natRule, "NAT", enable); err != nil { <ide> return err <ide> } <add> if err := programChainRule(skipDNAT, "SKIP DNAT", enable); err != nil { <add> return err <add> } <ide> } <ide> <ide> // In hairpin mode, masquerade traffic from localhost
1
Javascript
Javascript
reverse factory usekeys instead of instanceof
a51e636d6e8535c65547850c5b077e175c0ebcd6
<ide><path>dist/Immutable.js <ide> var $Sequence = Sequence; <ide> return reversed.reduce.apply(reversed, arguments); <ide> }, <ide> reverse: function() { <del> return reverseFactory(this); <add> return reverseFactory(this, true); <ide> }, <ide> slice: function(begin, end) { <ide> if (wholeSlice(begin, end, this.length)) { <ide> var $IndexedSequence = IndexedSequence; <ide> lastIndexOf: function(searchValue) { <ide> return this.toKeyedSeq().reverse().indexOf(searchValue); <ide> }, <add> reverse: function() { <add> return reverseFactory(this, false); <add> }, <ide> splice: function(index, removeNum) { <ide> var numArgs = arguments.length; <ide> removeNum = Math.max(removeNum | 0, 0); <ide> var KeyedIndexedSequence = function KeyedIndexedSequence(indexedSeq) { <ide> }, <ide> reverse: function() { <ide> var $__0 = this; <del> var reversedSequence = reverseFactory(this); <add> var reversedSequence = reverseFactory(this, true); <ide> reversedSequence.valueSeq = (function() { <ide> return $__0._seq.reverse(); <ide> }); <ide> function mapFactory(sequence, mapper, context) { <ide> }; <ide> return mappedSequence; <ide> } <del>function reverseFactory(sequence) { <del> var isIndexedSequence = (sequence instanceof IndexedSequence); <add>function reverseFactory(sequence, useKeys) { <ide> var reversedSequence = sequence.__makeSequence(); <ide> reversedSequence.length = sequence.length; <ide> reversedSequence.reverse = (function() { <ide> function reverseFactory(sequence) { <ide> }); <ide> return flipSequence; <ide> }; <del> if (isIndexedSequence) { <del> var reverseIndexOffset = sequence.length - 1; <del> reversedSequence.get = (function(key, notSetValue) { <del> return sequence.get(reverseIndexOffset - key, notSetValue); <del> }); <del> } else { <del> reversedSequence.get = (function(key, notSetValue) { <del> return sequence.get(key, notSetValue); <del> }); <del> } <add> reversedSequence.get = (function(key, notSetValue) { <add> return sequence.get(useKeys ? key : -1 - key, notSetValue); <add> }); <ide> reversedSequence.has = (function(key) { <ide> return sequence.has(key); <ide> }); <ide><path>dist/Immutable.min.js <ide> */ <ide> function t(){function t(t,e,r,n){var i;if(n){var u=n.prototype;i=Ue.create(u)}else i=t.prototype;return Ue.keys(e).forEach(function(t){i[t]=e[t]}),Ue.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return Ue.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t&&"function"==typeof t.equals?t.equals(e):!1}function i(t){return t.value=!1,t}function u(t){t&&(t.value=!0)}function a(){}function s(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;r>i;i++)n[i]=t[i+e];return n}function o(t,e){if(!t)throw Error(e)}function h(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Fe;t=""+t,e="string"}return"string"===e?t.length>Qe?c(t):f(t):t.hashCode?h("function"==typeof t.hashCode?t.hashCode():t.hashCode):_(t)}function c(t){var e=Ze[t];return null==e&&(e=f(t),Ye===Xe&&(Ye=0,Ze={}),Ye++,Ze[t]=e),e}function f(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)&Fe;return e}function _(t){var e=t[He];if(e)return e;if(!Te){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[He])return e;if(e=l(t))return e}if(!Te||Object.isExtensible(t)){if(e=++Ge&Fe,Te)Object.defineProperty(t,He,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(Ne&&t.propertyIsEnumerable===Ne)t.propertyIsEnumerable=function(){return Ne.apply(this,arguments)},t.propertyIsEnumerable[He]=e;else{if(!t.nodeType)throw Error("Unable to set a non-enumerable property on object.");t[He]=e}return e}throw Error("Non-extensible objects are not allowed as keys.")}function l(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function v(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function g(){return{value:void 0,done:!0}}function p(t){return!!y(t)}function m(t){return t&&"function"==typeof t.next}function d(t){var e=y(t);return"function"==typeof e?e.call(t):void 0}function y(t){return t&&(t[nr]||t[rr]) <ide> }function w(t){return null==t.length&&t.cacheResult(),o(1/0>t.length,"Cannot reverse infinite range."),t.length}function S(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function I(t,e){return q(t,e,0)}function b(t,e){return q(t,e,e)}function q(t,e,r){return null==t?r:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function M(t){return t}function D(t,e){return[e,t]}function k(){return!0}function x(t){return function(){return!t.apply(this,arguments)}}function O(t){return"string"==typeof t?JSON.stringify(t):t}function A(t,e){return t>e?1:e>t?-1:0}function C(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function E(t){o(1/0!==t,"Cannot perform this action with an infinite sequence.")}function j(t,e,r,n){var i=t._cache;if(i){for(var u=i.length-1,a=0;u>=a;a++){var s=i[r?u-a:a];if(e(s[1],n?s[0]:a,t)===!1)return a+1}return a}return t.__iterateUncached(e,r)}function R(t,e,r,n){var i=t._cache;if(i){var u=i.length-1,a=0;return new ir(function(){var t=i[r?u-a:a];return a++>u?g():v(e,n?t[0]:a-1,t[1])})}return t.__iteratorUncached(e,r)}function U(t){var e=t.__makeSequence();return e.length=t.length,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.contains(e)},e.contains=function(e){return t.has(e)},e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===er){var n=t.__iterator(e,r);return new ir(function(){var t=n.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===tr?$e:tr,r)},e}function W(t,e,r){var n=t.__makeSequence();return n.length=t.length,n.has=function(e){return t.has(e)},n.get=function(n,i){var u=t.get(n,Le);return u===Le?i:e.call(r,u,n,t)},n.__iterateUncached=function(n,i){var u=this;return t.__iterate(function(t,i,a){return n(e.call(r,t,i,a),i,u)!==!1},i)},n.__iteratorUncached=function(n,i){var u=t.__iterator(er,i);return new ir(function(){var i=u.next(); <del>if(i.done)return i;var a=i.value,s=a[0];return v(n,s,e.call(r,a[1],s,t),i)})},n}function P(t){var e=t instanceof hr,r=t.__makeSequence();if(r.length=t.length,r.reverse=function(){return t},r.flip=function(){var e=t.flip.apply(this);return e.reverse=function(){return t.flip()},e},e){var n=t.length-1;r.get=function(e,r){return t.get(n-e,r)}}else r.get=function(e,r){return t.get(e,r)};return r.has=function(e){return t.has(e)},r.contains=function(e){return t.contains(e)},r.cacheResult=function(){return t.cacheResult(),this.length=t.length,this},r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function K(t,e,r,n){var i=t.__makeSequence();return i.has=function(n){var i=t.get(n,Le);return i!==Le&&!!e.call(r,i,n,t)},i.get=function(n,i){var u=t.get(n,Le);return u!==Le&&e.call(r,u,n,t)?u:i},i.__iterateUncached=function(i,u){var a=this,s=0;return t.__iterate(function(t,u,o){return e.call(r,t,u,o)?(s++,i(t,n?u:s-1,a)):void 0},u),s},i.__iteratorUncached=function(i,u){var a=t.__iterator(er,u),s=0;return new ir(function(){for(;;){var u=a.next();if(u.done)return u;var o=u.value,h=o[0],c=o[1];if(e.call(r,c,h,t))return v(i,n?h:s++,c,u)}})},i}function z(t,e,r,n){var i={},u=[];return t.__iterate(function(a,s){var o=e.call(r,a,s,t),c=h(o),f=n?[s,a]:a;i.hasOwnProperty(c)?u[i[c]][1].push(f):(i[c]=u.length,u.push([o,[f]]))}),ar(u).fromEntrySeq().map(n?function(t){return ar(t).fromEntrySeq()}:function(t){return ar(t)})}function J(t,e){if(e>t.length)return t;0>e&&(e=0);var r=t.__makeSequence();return r.length=t.length&&Math.min(t.length,e),r.__iterateUncached=function(r,n){var i=this;if(0===e)return 0;if(n)return this.cacheResult().__iterate(r,n);var u=0;return t.__iterate(function(t,n){return++u&&r(t,n,i)!==!1&&e>u}),u},r.__iteratorUncached=function(r,n){if(n)return this.cacheResult().__iterator(r,n);var i=e&&t.__iterator(r,n),u=0;return new ir(function(){return u++>e?g():i.next()})},r}function L(t,e,r){var n=t.__makeSequence();return n.__iterateUncached=function(n,i){var u=this; <del>if(i)return this.cacheResult().__iterate(n,i);var a=0;return t.__iterate(function(t,i,s){return e.call(r,t,i,s)&&++a&&n(t,i,u)}),a},n.__iteratorUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterator(n,i);var a=t.__iterator(er,i),s=!0;return new ir(function(){if(!s)return g();var t=a.next();if(t.done)return t;var i=t.value,o=i[0],h=i[1];return e.call(r,h,o,u)?n===er?t:v(n,o,h,t):(s=!1,g())})},n}function B(t,e,r){if(0>=e)return t;var n=t.__makeSequence();return n.length=t.length&&Math.max(0,t.length-e),n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0,s=!0,o=0;return t.__iterate(function(t,i){return s&&(s=a++<e)?void 0:(o++,n(t,r?i:o-1,u))}),o},n.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var u=e&&t.__iterator(n,i),a=0,s=0;return new ir(function(){for(;e>a;)a++,u.next();var t=u.next();return r||n===tr?t:n===$e?v(n,s++,null,t):v(n,s++,t.value[1],t)})},n}function V(t,e,r,n){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,o=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(o++,i(t,n?u:o-1,a))}),o},i.__iteratorUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterator(i,u);var s=t.__iterator(er,u),o=!0,h=0;return new ir(function(){var t,u,c;do{if(t=s.next(),t.done)return n||i===tr?t:i===$e?v(i,h++,null,t):v(i,h++,t.value[1],t);var f=t.value;u=f[0],c=f[1],o&&(o=e.call(r,c,u,a))}while(o);return i===er?t:v(i,u,c,t)})},i}function N(t,e,r){var n=[t].concat(e),i=ar(n);return r&&(i=i.toKeyedSeq()),i=i.flatMap(M),i.length=n.reduce(function(t,e){if(void 0!==t){var r=ar(e).length;if(null!=r)return t+r}},0),i}function T(t,e,r){var n=t.__makeSequence();return n.__iterateUncached=function(n,i){function u(t,o){var h=this;t.__iterate(function(t,i){return(!e||e>o)&&t instanceof ar?u(t,o+1):n(t,r?i:a++,h)===!1&&(s=!0),!s},i)}var a=0,s=!1;return u(t,0),a},n.__iteratorUncached=function(n,i){var u=t.__iterator(n,i),a=[],s=0; <del>return new ir(function(){for(;u;){var t=u.next();if(t.done===!1){var o=t.value;if(n===er&&(o=o[1]),!((!e||e>a.length)&&o instanceof ar))return r?t:v(n,s++,o,t);a.push(u),u=o.__iterator(n,i)}else u=a.pop()}return g()})},n}function F(t,e){var r=t.__makeSequence();return r.length=t.length&&2*t.length-1,r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){return(!u||r(e,u++,i)!==!1)&&r(t,u++,i)!==!1},n),u},r.__iteratorUncached=function(r,n){var i,u=t.__iterator(tr,n),a=0;return new ir(function(){return(!i||a%2)&&(i=u.next(),i.done)?i:a%2?v(r,a++,e):v(r,a++,i.value,i)})},r}function G(t,e){return v(t,e[0],e[1])}function H(t,e){return{node:t,index:0,__prev:e}}function Q(t,e,r,n){var i=Object.create(Sr);return i.length=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function X(t,e,r){var n=i(Be),u=i(Ve),a=Y(t._root,t.__ownerID,0,h(e),e,r,n,u);if(!u.value)return t;var s=t.length+(n.value?r===Le?-1:1:0);return t.__ownerID?(t.length=s,t._root=a,t.__hash=void 0,t.__altered=!0,t):a?Q(s,a):yr.empty()}function Y(t,e,r,n,i,a,s,o){return t?t.update(e,r,n,i,a,s,o):a===Le?t:(u(o),u(s),new xr(e,n,[i,a]))}function Z(t){return t.constructor===xr||t.constructor===Dr}function $(t,e,r,n,i){if(t.hash===n)return new Dr(e,n,[t.entry,i]);var u,a=(0===r?t.hash:t.hash>>>r)&Je,s=(0===r?n:n>>>r)&Je,o=a===s?[$(t,e,r+Ke,n,i)]:(u=new xr(e,n,i),s>a?[t,u]:[u,t]);return new Ir(e,1<<a|1<<s,o)}function te(t,e,r,n){for(var i=0,u=0,a=Array(r),s=0,o=1,h=e.length;h>s;s++,o<<=1){var c=e[s];null!=c&&s!==n&&(i|=o,a[u++]=c)}return new Ir(t,i,a)}function ee(t,e,r,n,i){for(var u=0,a=Array(ze),s=0;0!==r;s++,r>>>=1)a[s]=1&r?e[u++]:null;return a[n]=i,new qr(t,u+1,a)}function re(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u instanceof ar||(u=ar(u),u instanceof hr&&(u=u.fromEntrySeq())),u&&n.push(u)}return ie(t,e,n)}function ne(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function ie(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,Le);t.set(n,i===Le?r:e(i,r)) <del>}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function ue(t,e,r,n,i){var u=e.length;if(i===u)return n(t);o(t.set,"updateIn with invalid keyPath");var a=i===u-1?r:yr.empty(),s=e[i],h=t.get(s,a),c=ue(h,e,r,n,i+1);return c===h?t:t.set(s,c)}function ae(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function se(t,e,r,n){var i=n?t:s(t);return i[e]=r,i}function oe(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),a=0,s=0;i>s;s++)s===e?(u[s]=r,a=-1):u[s]=t[s+a];return u}function he(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,a=0;n>a;a++)a===e&&(u=1),i[a]=t[a+u];return i}function ce(t,e,r,n,i,u){var a,s=t&&t.array;if(0===e){var o=0>r?-r:0,h=n-r;for(h>ze&&(h=ze),a=o;h>a;a++)if(i(s&&s[u?o+h-1-a:a])===!1)return!1}else{var c=1<<e,f=e-Ke;for(a=0;Je>=a;a++){var _=u?Je-a:a,l=r+(_<<e);if(n>l&&l+c>0){var v=s&&s[_];if(!ce(v,f,l,n,i,u))return!1}}}return!0}function fe(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function _e(t,e,r,n,i,u,a){var s=Object.create(Wr);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=a,s.__altered=!1,s}function le(t,e,r){if(e=C(t,e),e>=t.length||0>e)return r===Le?t:t.withMutations(function(t){0>e?me(t,e).set(0,r):me(t,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,u=t._root,a=i(Ve);return e>=ye(t._size)?n=ve(n,t.__ownerID,0,e,r,a):u=ve(u,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=u,t._tail=n,t.__hash=void 0,t.__altered=!0,t):_e(t._origin,t._size,t._level,u,n):t}function ve(t,e,r,n,i,a){var s,o=i===Le,h=n>>>r&Je,c=t&&t.array.length>h;if(o&&!c)return t;if(r>0){var f=t&&t.array[h],_=ve(f,e,r-Ke,n,i,a);return _===f?t:(s=ge(t,e),s.array[h]=_,s)}return!o&&c&&t.array[h]===i?t:(u(a),s=ge(t,e),o&&h===s.array.length-1?s.array.pop():s.array[h]=o?void 0:i,s)}function ge(t,e){return e&&t&&e===t.ownerID?t:new Pr(t?t.array.slice():[],e)}function pe(t,e){if(e>=ye(t._size))return t._tail;if(1<<t._level+Ke>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Je],n-=Ke; <add>if(i.done)return i;var a=i.value,s=a[0];return v(n,s,e.call(r,a[1],s,t),i)})},n}function P(t,e){var r=t.__makeSequence();return r.length=t.length,r.reverse=function(){return t},r.flip=function(){var e=t.flip.apply(this);return e.reverse=function(){return t.flip()},e},r.get=function(r,n){return t.get(e?r:-1-r,n)},r.has=function(e){return t.has(e)},r.contains=function(e){return t.contains(e)},r.cacheResult=function(){return t.cacheResult(),this.length=t.length,this},r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function K(t,e,r,n){var i=t.__makeSequence();return i.has=function(n){var i=t.get(n,Le);return i!==Le&&!!e.call(r,i,n,t)},i.get=function(n,i){var u=t.get(n,Le);return u!==Le&&e.call(r,u,n,t)?u:i},i.__iterateUncached=function(i,u){var a=this,s=0;return t.__iterate(function(t,u,o){return e.call(r,t,u,o)?(s++,i(t,n?u:s-1,a)):void 0},u),s},i.__iteratorUncached=function(i,u){var a=t.__iterator(er,u),s=0;return new ir(function(){for(;;){var u=a.next();if(u.done)return u;var o=u.value,h=o[0],c=o[1];if(e.call(r,c,h,t))return v(i,n?h:s++,c,u)}})},i}function z(t,e,r,n){var i={},u=[];return t.__iterate(function(a,s){var o=e.call(r,a,s,t),c=h(o),f=n?[s,a]:a;i.hasOwnProperty(c)?u[i[c]][1].push(f):(i[c]=u.length,u.push([o,[f]]))}),ar(u).fromEntrySeq().map(n?function(t){return ar(t).fromEntrySeq()}:function(t){return ar(t)})}function J(t,e){if(e>t.length)return t;0>e&&(e=0);var r=t.__makeSequence();return r.length=t.length&&Math.min(t.length,e),r.__iterateUncached=function(r,n){var i=this;if(0===e)return 0;if(n)return this.cacheResult().__iterate(r,n);var u=0;return t.__iterate(function(t,n){return++u&&r(t,n,i)!==!1&&e>u}),u},r.__iteratorUncached=function(r,n){if(n)return this.cacheResult().__iterator(r,n);var i=e&&t.__iterator(r,n),u=0;return new ir(function(){return u++>e?g():i.next()})},r}function L(t,e,r){var n=t.__makeSequence();return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i); <add>var a=0;return t.__iterate(function(t,i,s){return e.call(r,t,i,s)&&++a&&n(t,i,u)}),a},n.__iteratorUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterator(n,i);var a=t.__iterator(er,i),s=!0;return new ir(function(){if(!s)return g();var t=a.next();if(t.done)return t;var i=t.value,o=i[0],h=i[1];return e.call(r,h,o,u)?n===er?t:v(n,o,h,t):(s=!1,g())})},n}function B(t,e,r){if(0>=e)return t;var n=t.__makeSequence();return n.length=t.length&&Math.max(0,t.length-e),n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0,s=!0,o=0;return t.__iterate(function(t,i){return s&&(s=a++<e)?void 0:(o++,n(t,r?i:o-1,u))}),o},n.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var u=e&&t.__iterator(n,i),a=0,s=0;return new ir(function(){for(;e>a;)a++,u.next();var t=u.next();return r||n===tr?t:n===$e?v(n,s++,null,t):v(n,s++,t.value[1],t)})},n}function V(t,e,r,n){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,o=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(o++,i(t,n?u:o-1,a))}),o},i.__iteratorUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterator(i,u);var s=t.__iterator(er,u),o=!0,h=0;return new ir(function(){var t,u,c;do{if(t=s.next(),t.done)return n||i===tr?t:i===$e?v(i,h++,null,t):v(i,h++,t.value[1],t);var f=t.value;u=f[0],c=f[1],o&&(o=e.call(r,c,u,a))}while(o);return i===er?t:v(i,u,c,t)})},i}function N(t,e,r){var n=[t].concat(e),i=ar(n);return r&&(i=i.toKeyedSeq()),i=i.flatMap(M),i.length=n.reduce(function(t,e){if(void 0!==t){var r=ar(e).length;if(null!=r)return t+r}},0),i}function T(t,e,r){var n=t.__makeSequence();return n.__iterateUncached=function(n,i){function u(t,o){var h=this;t.__iterate(function(t,i){return(!e||e>o)&&t instanceof ar?u(t,o+1):n(t,r?i:a++,h)===!1&&(s=!0),!s},i)}var a=0,s=!1;return u(t,0),a},n.__iteratorUncached=function(n,i){var u=t.__iterator(n,i),a=[],s=0;return new ir(function(){for(;u;){var t=u.next(); <add>if(t.done===!1){var o=t.value;if(n===er&&(o=o[1]),!((!e||e>a.length)&&o instanceof ar))return r?t:v(n,s++,o,t);a.push(u),u=o.__iterator(n,i)}else u=a.pop()}return g()})},n}function F(t,e){var r=t.__makeSequence();return r.length=t.length&&2*t.length-1,r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){return(!u||r(e,u++,i)!==!1)&&r(t,u++,i)!==!1},n),u},r.__iteratorUncached=function(r,n){var i,u=t.__iterator(tr,n),a=0;return new ir(function(){return(!i||a%2)&&(i=u.next(),i.done)?i:a%2?v(r,a++,e):v(r,a++,i.value,i)})},r}function G(t,e){return v(t,e[0],e[1])}function H(t,e){return{node:t,index:0,__prev:e}}function Q(t,e,r,n){var i=Object.create(Sr);return i.length=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function X(t,e,r){var n=i(Be),u=i(Ve),a=Y(t._root,t.__ownerID,0,h(e),e,r,n,u);if(!u.value)return t;var s=t.length+(n.value?r===Le?-1:1:0);return t.__ownerID?(t.length=s,t._root=a,t.__hash=void 0,t.__altered=!0,t):a?Q(s,a):yr.empty()}function Y(t,e,r,n,i,a,s,o){return t?t.update(e,r,n,i,a,s,o):a===Le?t:(u(o),u(s),new xr(e,n,[i,a]))}function Z(t){return t.constructor===xr||t.constructor===Dr}function $(t,e,r,n,i){if(t.hash===n)return new Dr(e,n,[t.entry,i]);var u,a=(0===r?t.hash:t.hash>>>r)&Je,s=(0===r?n:n>>>r)&Je,o=a===s?[$(t,e,r+Ke,n,i)]:(u=new xr(e,n,i),s>a?[t,u]:[u,t]);return new Ir(e,1<<a|1<<s,o)}function te(t,e,r,n){for(var i=0,u=0,a=Array(r),s=0,o=1,h=e.length;h>s;s++,o<<=1){var c=e[s];null!=c&&s!==n&&(i|=o,a[u++]=c)}return new Ir(t,i,a)}function ee(t,e,r,n,i){for(var u=0,a=Array(ze),s=0;0!==r;s++,r>>>=1)a[s]=1&r?e[u++]:null;return a[n]=i,new qr(t,u+1,a)}function re(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u instanceof ar||(u=ar(u),u instanceof hr&&(u=u.fromEntrySeq())),u&&n.push(u)}return ie(t,e,n)}function ne(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function ie(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,Le);t.set(n,i===Le?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n) <add>})}function ue(t,e,r,n,i){var u=e.length;if(i===u)return n(t);o(t.set,"updateIn with invalid keyPath");var a=i===u-1?r:yr.empty(),s=e[i],h=t.get(s,a),c=ue(h,e,r,n,i+1);return c===h?t:t.set(s,c)}function ae(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function se(t,e,r,n){var i=n?t:s(t);return i[e]=r,i}function oe(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),a=0,s=0;i>s;s++)s===e?(u[s]=r,a=-1):u[s]=t[s+a];return u}function he(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,a=0;n>a;a++)a===e&&(u=1),i[a]=t[a+u];return i}function ce(t,e,r,n,i,u){var a,s=t&&t.array;if(0===e){var o=0>r?-r:0,h=n-r;for(h>ze&&(h=ze),a=o;h>a;a++)if(i(s&&s[u?o+h-1-a:a])===!1)return!1}else{var c=1<<e,f=e-Ke;for(a=0;Je>=a;a++){var _=u?Je-a:a,l=r+(_<<e);if(n>l&&l+c>0){var v=s&&s[_];if(!ce(v,f,l,n,i,u))return!1}}}return!0}function fe(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function _e(t,e,r,n,i,u,a){var s=Object.create(Wr);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=a,s.__altered=!1,s}function le(t,e,r){if(e=C(t,e),e>=t.length||0>e)return r===Le?t:t.withMutations(function(t){0>e?me(t,e).set(0,r):me(t,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,u=t._root,a=i(Ve);return e>=ye(t._size)?n=ve(n,t.__ownerID,0,e,r,a):u=ve(u,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=u,t._tail=n,t.__hash=void 0,t.__altered=!0,t):_e(t._origin,t._size,t._level,u,n):t}function ve(t,e,r,n,i,a){var s,o=i===Le,h=n>>>r&Je,c=t&&t.array.length>h;if(o&&!c)return t;if(r>0){var f=t&&t.array[h],_=ve(f,e,r-Ke,n,i,a);return _===f?t:(s=ge(t,e),s.array[h]=_,s)}return!o&&c&&t.array[h]===i?t:(u(a),s=ge(t,e),o&&h===s.array.length-1?s.array.pop():s.array[h]=o?void 0:i,s)}function ge(t,e){return e&&t&&e===t.ownerID?t:new Pr(t?t.array.slice():[],e)}function pe(t,e){if(e>=ye(t._size))return t._tail;if(1<<t._level+Ke>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Je],n-=Ke; <ide> return r}}function me(t,e,r){var n=t.__ownerID||new a,i=t._origin,u=t._size,s=i+e,o=null==r?u:0>r?u+r:i+r;if(s===i&&o===u)return t;if(s>=o)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new Pr(c&&c.array.length?[null,c]:[],n),h+=Ke,f+=1<<h;f&&(s+=f,i+=f,o+=f,u+=f);for(var _=ye(u),l=ye(o);l>=1<<h+Ke;)c=new Pr(c&&c.array.length?[c]:[],n),h+=Ke;var v=t._tail,g=_>l?pe(t,o-1):l>_?new Pr([],n):v;if(v&&l>_&&u>s&&v.array.length){c=ge(c,n);for(var p=c,m=h;m>Ke;m-=Ke){var d=_>>>m&Je;p=p.array[d]=ge(p.array[d],n)}p.array[_>>>Ke&Je]=v}if(u>o&&(g=g&&g.removeAfter(n,0,o)),s>=l)s-=l,o-=l,h=Ke,c=null,g=g&&g.removeBefore(n,0,s);else if(s>i||_>l){var y,w;f=0;do y=s>>>h&Je,w=l-1>>>h&Je,y===w&&(y&&(f+=(1<<h)*y),h-=Ke,c=c&&c.array[y]);while(c&&y===w);c&&s>i&&(c=c&&c.removeBefore(n,h,s-f)),c&&_>l&&(c=c&&c.removeAfter(n,h,l-f)),f&&(s-=f,o-=f)}return t.__ownerID?(t.length=o-s,t._origin=s,t._size=o,t._level=h,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):_e(s,o,h,c,g)}function de(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(ar(u))}var a=Math.max.apply(null,n.map(function(t){return t.length||0}));return a>t.length&&(t=t.setLength(a)),ie(t,e,n)}function ye(t){return ze>t?0:t-1>>>Ke<<Ke}function we(t,e,r,n){var i=Object.create(Vr);return i.length=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Se(t,e){var r=Object.create(Gr);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function Ie(t,e,r,n){var i=Object.create(Qr.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=r,i.__hash=n,i}function be(t,e,r){var n=t._map,i=t._vector,u=n.get(e),a=void 0!==u,s=r===Le;if(!a&&s||a&&r===i.get(u)[1])return t;a||(u=i.length);var o=s?n.remove(e):a?n:n.set(e,u),h=s?i.remove(u):i.set(u,[e,r]);return t.__ownerID?(t.length=o.length,t._map=o,t._vector=h,t.__hash=void 0,t):Ie(o,h)}function qe(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Me(t,e){return e?De(e,t,"",{"":t}):ke(t)}function De(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,ar(e).map(function(r,n){return De(t,r,n,e) <ide> })):e}function ke(t){if(t){if(Array.isArray(t))return ar(t).map(ke).toVector();if(t.constructor===Object)return ar(t).map(ke).toMap()}return t}function xe(t){return t instanceof ar&&"function"==typeof t.__deref}function Oe(t){return xe(t)?t.__deref():t}function Ae(t,e,r,n){if(n=n||t.getIn(e,Le),n===Le||n instanceof ar){var i=n&&n.length;return n instanceof Rr?new fn(t,e,r,i):n instanceof Tr?new ln(t,e,r,i):n instanceof Lr?new gn(t,e,r,i):new hn(t,e,r,i)}return n}function Ce(t,e,r){return r instanceof ar?Ee(t,e,r):r}function Ee(t,e,r){return Ae(t._rootData,t._keyPath.concat(e),t._onChange,r)}function je(t,e,r){var n=t._rootData,i=t._keyPath,u=t._onChange,a=i||[];arguments.length>2&&(a=a.concat(r));var s=Re(i,e),o=xe(n)?je(n,s,a):s(n);return o===n?n:(u&&u(o,n,a),Ae(o,i,u))}function Re(t,e){return function(r){return r.updateIn(t,yr.empty(),e)}}var Ue=Object,We={};We.createClass=t,We.superCall=e,We.defaultSuperCall=r;var Pe="delete",Ke=5,ze=1<<Ke,Je=ze-1,Le={},Be={value:!1},Ve={value:!1},Ne=Object.prototype.propertyIsEnumerable,Te=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),Fe=2147483647,Ge=0,He="__immutablehash__";"undefined"!=typeof Symbol&&(He=Symbol(He));var Qe=16,Xe=255,Ye=0,Ze={},$e=0,tr=1,er=2,rr="@@iterator",nr="undefined"!=typeof Symbol?Symbol.iterator:rr,ir=function(t){this.next=t};We.createClass(ir,{toString:function(){return"[Iterator]"}},{});var ur=ir.prototype;ur.inspect=ur.toSource=function(){return""+this},ur[nr]=function(){return this};var ar=function(t){return sr.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},sr=ar;We.createClass(ar,{toArray:function(){E(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 sr?t.toJS():t}).__toJS()},toMap:function(){return E(this.length),yr.from(this)},toObject:function(){E(this.length);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return E(this.length),Qr.from(this)},toSet:function(){return E(this.length),Tr.from(this) <del>},toStack:function(){return E(this.length),Lr.from(this)},toVector:function(){return E(this.length),Rr.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+": "+O(t)},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N(this,t,!0)},contains:function(t){return this.find(function(e){return n(e,t)},null,Le)!==Le},entries:function(){return this.__iterator(er)},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 K(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($e)},map:function(t,e){return W(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(S(t,e,this.length))return this;var r=I(t,this.length),n=b(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(x(t),e)},sort:function(t){return this.sortBy(M,t)},values:function(){return this.__iterator(tr)},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),o=h(s);n.hasOwnProperty(o)?i[n[o]][1]++:(n[o]=i.length,i.push([s,1]))}),sr(i).fromEntrySeq() <add>},toStack:function(){return E(this.length),Lr.from(this)},toVector:function(){return E(this.length),Rr.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+": "+O(t)},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N(this,t,!0)},contains:function(t){return this.find(function(e){return n(e,t)},null,Le)!==Le},entries:function(){return this.__iterator(er)},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 K(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($e)},map:function(t,e){return W(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,!0)},slice:function(t,e){if(S(t,e,this.length))return this;var r=I(t,this.length),n=b(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(x(t),e)},sort:function(t){return this.sortBy(M,t)},values:function(){return this.__iterator(tr)},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),o=h(s);n.hasOwnProperty(o)?i[n[o]][1]++:(n[o]=i.length,i.push([s,1]))}),sr(i).fromEntrySeq() <ide> },equals:function(t){if(this===t)return!0;if(!(t instanceof sr))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 i=e.next().value;return i&&n(i[0],r)&&n(i[1],t)})&&e.next().done},entrySeq:function(){var t=this;if(t._cache)return sr(t._cache);var e=t.toKeyedSeq().map(D).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(function(r,n,i){return sr(t.call(e,r,n,i))}).flatten(!0)},flatten:function(t){return T(this,t,!0)},flip:function(){return U(this)},get:function(t,e){return this.find(function(e,r){return n(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],Le):Le,r===Le)return e;return r},groupBy:function(t,e){return z(this,t,e,!0)},has:function(t){return this.get(t,Le)!==Le},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 V(this,t,e,!0)},skipUntil:function(t,e){return this.skipWhile(x(t),e)},sortBy:function(t,e){e=e||A;var r=this;return sr(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() <del>},take:function(t){return J(this,t)},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){return L(this,t,e)},takeUntil:function(t,e){return this.takeWhile(x(t),e)},toKeyedSeq:function(){return this},valueSeq:function(){return new pr(this)},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(E(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(h(e)^(e===r?0:h(r)))&Fe},0))},__makeSequence:function(){return Object.create(or)},__iterate:function(t,e){return j(this,t,e,!0)},__iterator:function(t,e){return R(this,t,e,!0)}},{from:function(t){if(t instanceof sr)return t;if(!Array.isArray(t)){if(m(t))return new _r(t);if(p(t))return new lr(t);if(t&&t.constructor===Object)return new vr(t);t=[t]}return new gr(t)}});var or=ar.prototype;or[nr]=or.entries,or.toJSON=or.toJS,or.__toJS=or.toObject,or.inspect=or.toSource=function(){return""+this},or.chain=or.flatMap;var hr=function(){We.defaultSuperCall(this,cr.prototype,arguments)},cr=hr;We.createClass(hr,{toString:function(){return this.__toString("Seq [","]")},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N(this,t,!1)},filter:function(t,e){return K(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 n(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=I(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(s(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(t){return T(this,t,!1)},flip:function(){return U(this.toKeyedSeq())},fromEntrySeq:function(){return new dr(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 <del>},null,e)},groupBy:function(t,e){return z(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 F(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}),r},skipWhile:function(t,e){return V(this,t,e,!1)},sortBy:function(t,e){e=e||A;var r=this;return ar(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=J(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 mr(this)},valueSeq:function(){return this},__makeSequence:function(){return Object.create(fr)},__iterate:function(t,e){return j(this,t,e,!1)},__iterator:function(t,e){return R(this,t,e,!1)}},{},ar);var fr=hr.prototype;fr[nr]=fr.values,fr.__toJS=fr.toArray,fr.__toStringMapper=O;var _r=function(t){this._iterator=t,this._iteratorCache=[]};We.createClass(_r,{__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 ir(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return v(t,i,n[i++])})}},{},hr);var lr=function(t){this._iterable=t,this.length=t.length||t.size};We.createClass(lr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=d(r),i=0;if(m(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=d(r);if(!m(n))return new ir(function(){return g() <del>});var i=0;return new ir(function(){var e=n.next();return e.done?e:v(t,i++,e.value)})}},{},hr);var vr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};We.createClass(vr,{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];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 ir(function(){var a=n[e?i-u:u];return u++>i?g():v(t,a,r[a])})}},{},ar);var gr=function(t){this._array=t,this.length=t.length};We.createClass(gr,{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 ir(function(){return i>n?g():v(t,i,r[e?n-i++:i++])})}},{},hr);var pr=function(t){this._seq=t,this.length=t.length};We.createClass(pr,{contains:function(t){return this._seq.contains(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(tr,e),n=0;return new ir(function(){var e=r.next();return e.done?e:v(t,n++,e.value,e)})}},{},hr);var mr=function(t){this._seq=t,this.length=t.length};We.createClass(mr,{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=W(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?w(this):0; <del>return this._seq.__iterate(function(i){return t(i,e?--n:n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(tr,e),n=e?w(this):0;return new ir(function(){var i=r.next();return i.done?i:v(t,e?--n:n++,i.value,i)})}},{},ar);var dr=function(t){this._seq=t,this.length=t.length};We.createClass(dr,{entrySeq:function(){return this._seq},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__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(tr,e);return new ir(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return t===er?e:v(t,n[0],n[1],e)}})}},{},ar);var yr=function(t){var e=wr.empty();return t?t.constructor===wr?t:e.merge(t):e},wr=yr;We.createClass(yr,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,h(t),t,e):e},set:function(t,e){return X(this,t,e)},remove:function(t){return X(this,t,Le)},update:function(t,e,r){return 1===arguments.length?this.updateIn([],void 0,t):this.updateIn([t],e,r)},updateIn:function(t,e,r){return r||(r=e,e=void 0),ue(this,t,e,r,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):wr.empty()},merge:function(){return re(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return re(this,t,e)},mergeDeep:function(){return re(this,ne(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return re(this,ne(t),e)},cursor:function(t,e){var r=0===arguments.length||"function"==typeof t&&(e=t)?[]:Array.isArray(t)?t:[t];return Ae(this,r,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 a)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered <del>},__iterator:function(t,e){return new Ar(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?Q(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return Cr||(Cr=Q(0))}},ar);var Sr=yr.prototype;Sr[Pe]=Sr.remove,yr.from=yr;var Ir=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},br=Ir;We.createClass(Ir,{get:function(t,e,r,n){var i=1<<((0===t?e:e>>>t)&Je),u=this.bitmap;return 0===(u&i)?n:this.nodes[ae(u&i-1)].get(t+Ke,e,r,n)},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Je,o=1<<s,h=this.bitmap,c=0!==(h&o);if(!c&&i===Le)return this;var f=ae(h&o-1),_=this.nodes,l=c?_[f]:null,v=Y(l,t,e+Ke,r,n,i,u,a);if(v===l)return this;if(!c&&v&&_.length>=Er)return ee(t,_,h,s,v);if(c&&!v&&2===_.length&&Z(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&Z(v))return v;var g=t&&t===this.ownerID,p=c?v?h:h^o:h|o,m=c?v?se(_,f,v,g):he(_,f,g):oe(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new br(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}},{});var qr=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},Mr=qr;We.createClass(qr,{get:function(t,e,r,n){var i=(0===t?e:e>>>t)&Je,u=this.nodes[i];return u?u.get(t+Ke,e,r,n):n},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Je,o=i===Le,h=this.nodes,c=h[s];if(o&&!c)return this;var f=Y(c,t,e+Ke,r,n,i,u,a);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,jr>_))return te(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=se(h,s,f,l);return l?(this.count=_,this.nodes=v,this):new Mr(t,_,v)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}}},{});var Dr=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},kr=Dr;We.createClass(Dr,{get:function(t,e,r,i){for(var u=this.entries,a=0,s=u.length;s>a;a++)if(n(r,u[a][0]))return u[a][1];return i},update:function(t,e,r,i,a,o,h){var c=a===Le; <del>if(r!==this.hash)return c?this:(u(h),u(o),$(this,t,e,r,[i,a]));for(var f=this.entries,_=0,l=f.length;l>_&&!n(i,f[_][0]);_++);var v=l>_;if(c&&!v)return this;if(u(h),(c||!v)&&u(o),c&&2===l)return new xr(t,this.hash,f[1^_]);var g=t&&t===this.ownerID,p=g?f:s(f);return v?c?_===l-1?p.pop():p[_]=p.pop():p[_]=[i,a]:p.push([i,a]),g?(this.entries=p,this):new kr(t,this.hash,p)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var xr=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Or=xr;We.createClass(xr,{get:function(t,e,r,i){return n(r,this.entry[0])?this.entry[1]:i},update:function(t,e,r,i,a,s,o){var h=a===Le,c=n(i,this.entry[0]);return(c?a===this.entry[1]:h)?this:(u(o),h?(u(s),null):c?t&&t===this.ownerID?(this.entry[1]=a,this):new Or(t,r,[i,a]):(u(s),$(this,t,e,r,[i,a])))},iterate:function(t){return t(this.entry)}},{});var Ar=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&H(t._root)};We.createClass(Ar,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return G(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return G(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return G(t,u.entry);e=this._stack=H(u,e)}continue}e=this._stack=this._stack.__prev}return g()}},{},ir);var Cr,Er=ze/2,jr=ze/4,Rr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Ur.from(t)},Ur=Rr;We.createClass(Rr,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=C(this,t),0>t||t>=this.length)return e;t+=this._origin;var r=pe(this,t);return r&&r.array[t&Je]},set:function(t,e){return le(this,t,e)},remove:function(t){return le(this,t,Le)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=Ke,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Ur.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){me(r,0,e+t.length); <del>for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return me(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){me(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return me(this,1)},merge:function(){return de(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return de(this,t,e)},mergeDeep:function(){return de(this,ne(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return de(this,ne(t),e)},setLength:function(t){return me(this,0,t)},slice:function(t,e){var r=We.superCall(this,Ur.prototype,"slice",[t,e]);if(r!==this){var n=this,i=n.length;r.toVector=function(){return me(n,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return r},__iterator:function(t,e){return new zr(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=ye(this._size);return e?ce(this._tail,0,u-this._origin,this._size-this._origin,i,e)&&ce(this._root,this._level,-this._origin,u-this._origin,i,e):ce(this._root,this._level,-this._origin,u-this._origin,i,e)&&ce(this._tail,0,u-this._origin,this._size-this._origin,i,e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?_e(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return Jr||(Jr=_e(0,0,Ke))},from:function(t){if(!t||0===t.length)return Ur.empty();if(t.constructor===Ur)return t;var e=Array.isArray(t);return t.length>0&&ze>t.length?_e(0,t.length,Ke,null,new Pr(e?s(t):ar(t).toArray())):(e||(t=ar(t).valueSeq()),Ur.empty().merge(t))}},hr);var Wr=Rr.prototype;Wr[Pe]=Wr.remove,Wr.update=Sr.update,Wr.updateIn=Sr.updateIn,Wr.cursor=Sr.cursor,Wr.withMutations=Sr.withMutations,Wr.asMutable=Sr.asMutable,Wr.asImmutable=Sr.asImmutable,Wr.wasAltered=Sr.wasAltered;var Pr=function(t,e){this.array=t,this.ownerID=e},Kr=Pr;We.createClass(Pr,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this; <add>},take:function(t){return J(this,t)},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){return L(this,t,e)},takeUntil:function(t,e){return this.takeWhile(x(t),e)},toKeyedSeq:function(){return this},valueSeq:function(){return new pr(this)},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(E(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(h(e)^(e===r?0:h(r)))&Fe},0))},__makeSequence:function(){return Object.create(or)},__iterate:function(t,e){return j(this,t,e,!0)},__iterator:function(t,e){return R(this,t,e,!0)}},{from:function(t){if(t instanceof sr)return t;if(!Array.isArray(t)){if(m(t))return new _r(t);if(p(t))return new lr(t);if(t&&t.constructor===Object)return new vr(t);t=[t]}return new gr(t)}});var or=ar.prototype;or[nr]=or.entries,or.toJSON=or.toJS,or.__toJS=or.toObject,or.inspect=or.toSource=function(){return""+this},or.chain=or.flatMap;var hr=function(){We.defaultSuperCall(this,cr.prototype,arguments)},cr=hr;We.createClass(hr,{toString:function(){return this.__toString("Seq [","]")},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N(this,t,!1)},filter:function(t,e){return K(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 n(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},reverse:function(){return P(this,!1)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=I(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(s(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(t){return T(this,t,!1)},flip:function(){return U(this.toKeyedSeq())},fromEntrySeq:function(){return new dr(this) <add>},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 z(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 F(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}),r},skipWhile:function(t,e){return V(this,t,e,!1)},sortBy:function(t,e){e=e||A;var r=this;return ar(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=J(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 mr(this)},valueSeq:function(){return this},__makeSequence:function(){return Object.create(fr)},__iterate:function(t,e){return j(this,t,e,!1)},__iterator:function(t,e){return R(this,t,e,!1)}},{},ar);var fr=hr.prototype;fr[nr]=fr.values,fr.__toJS=fr.toArray,fr.__toStringMapper=O;var _r=function(t){this._iterator=t,this._iteratorCache=[]};We.createClass(_r,{__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 ir(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return v(t,i,n[i++])})}},{},hr);var lr=function(t){this._iterable=t,this.length=t.length||t.size};We.createClass(lr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=d(r),i=0;if(m(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); <add>var r=this._iterable,n=d(r);if(!m(n))return new ir(function(){return g()});var i=0;return new ir(function(){var e=n.next();return e.done?e:v(t,i++,e.value)})}},{},hr);var vr=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};We.createClass(vr,{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];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 ir(function(){var a=n[e?i-u:u];return u++>i?g():v(t,a,r[a])})}},{},ar);var gr=function(t){this._array=t,this.length=t.length};We.createClass(gr,{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 ir(function(){return i>n?g():v(t,i,r[e?n-i++:i++])})}},{},hr);var pr=function(t){this._seq=t,this.length=t.length};We.createClass(pr,{contains:function(t){return this._seq.contains(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(tr,e),n=0;return new ir(function(){var e=r.next();return e.done?e:v(t,n++,e.value,e)})}},{},hr);var mr=function(t){this._seq=t,this.length=t.length};We.createClass(mr,{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,!0);return e.valueSeq=function(){return t._seq.reverse()},e},map:function(t,e){var r=this,n=W(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 <add>},__iterate:function(t,e){var r=this,n=e?w(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(tr,e),n=e?w(this):0;return new ir(function(){var i=r.next();return i.done?i:v(t,e?--n:n++,i.value,i)})}},{},ar);var dr=function(t){this._seq=t,this.length=t.length};We.createClass(dr,{entrySeq:function(){return this._seq},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__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(tr,e);return new ir(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return t===er?e:v(t,n[0],n[1],e)}})}},{},ar);var yr=function(t){var e=wr.empty();return t?t.constructor===wr?t:e.merge(t):e},wr=yr;We.createClass(yr,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,h(t),t,e):e},set:function(t,e){return X(this,t,e)},remove:function(t){return X(this,t,Le)},update:function(t,e,r){return 1===arguments.length?this.updateIn([],void 0,t):this.updateIn([t],e,r)},updateIn:function(t,e,r){return r||(r=e,e=void 0),ue(this,t,e,r,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):wr.empty()},merge:function(){return re(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return re(this,t,e)},mergeDeep:function(){return re(this,ne(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return re(this,ne(t),e)},cursor:function(t,e){var r=0===arguments.length||"function"==typeof t&&(e=t)?[]:Array.isArray(t)?t:[t];return Ae(this,r,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 a)},asImmutable:function(){return this.__ensureOwner() <add>},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new Ar(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?Q(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return Cr||(Cr=Q(0))}},ar);var Sr=yr.prototype;Sr[Pe]=Sr.remove,yr.from=yr;var Ir=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},br=Ir;We.createClass(Ir,{get:function(t,e,r,n){var i=1<<((0===t?e:e>>>t)&Je),u=this.bitmap;return 0===(u&i)?n:this.nodes[ae(u&i-1)].get(t+Ke,e,r,n)},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Je,o=1<<s,h=this.bitmap,c=0!==(h&o);if(!c&&i===Le)return this;var f=ae(h&o-1),_=this.nodes,l=c?_[f]:null,v=Y(l,t,e+Ke,r,n,i,u,a);if(v===l)return this;if(!c&&v&&_.length>=Er)return ee(t,_,h,s,v);if(c&&!v&&2===_.length&&Z(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&Z(v))return v;var g=t&&t===this.ownerID,p=c?v?h:h^o:h|o,m=c?v?se(_,f,v,g):he(_,f,g):oe(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new br(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}},{});var qr=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},Mr=qr;We.createClass(qr,{get:function(t,e,r,n){var i=(0===t?e:e>>>t)&Je,u=this.nodes[i];return u?u.get(t+Ke,e,r,n):n},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Je,o=i===Le,h=this.nodes,c=h[s];if(o&&!c)return this;var f=Y(c,t,e+Ke,r,n,i,u,a);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,jr>_))return te(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=se(h,s,f,l);return l?(this.count=_,this.nodes=v,this):new Mr(t,_,v)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}}},{});var Dr=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},kr=Dr;We.createClass(Dr,{get:function(t,e,r,i){for(var u=this.entries,a=0,s=u.length;s>a;a++)if(n(r,u[a][0]))return u[a][1]; <add>return i},update:function(t,e,r,i,a,o,h){var c=a===Le;if(r!==this.hash)return c?this:(u(h),u(o),$(this,t,e,r,[i,a]));for(var f=this.entries,_=0,l=f.length;l>_&&!n(i,f[_][0]);_++);var v=l>_;if(c&&!v)return this;if(u(h),(c||!v)&&u(o),c&&2===l)return new xr(t,this.hash,f[1^_]);var g=t&&t===this.ownerID,p=g?f:s(f);return v?c?_===l-1?p.pop():p[_]=p.pop():p[_]=[i,a]:p.push([i,a]),g?(this.entries=p,this):new kr(t,this.hash,p)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var xr=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Or=xr;We.createClass(xr,{get:function(t,e,r,i){return n(r,this.entry[0])?this.entry[1]:i},update:function(t,e,r,i,a,s,o){var h=a===Le,c=n(i,this.entry[0]);return(c?a===this.entry[1]:h)?this:(u(o),h?(u(s),null):c?t&&t===this.ownerID?(this.entry[1]=a,this):new Or(t,r,[i,a]):(u(s),$(this,t,e,r,[i,a])))},iterate:function(t){return t(this.entry)}},{});var Ar=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&H(t._root)};We.createClass(Ar,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return G(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return G(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return G(t,u.entry);e=this._stack=H(u,e)}continue}e=this._stack=this._stack.__prev}return g()}},{},ir);var Cr,Er=ze/2,jr=ze/4,Rr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Ur.from(t)},Ur=Rr;We.createClass(Rr,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=C(this,t),0>t||t>=this.length)return e;t+=this._origin;var r=pe(this,t);return r&&r.array[t&Je]},set:function(t,e){return le(this,t,e)},remove:function(t){return le(this,t,Le)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=Ke,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Ur.empty()},push:function(){var t=arguments,e=this.length; <add>return this.withMutations(function(r){me(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return me(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){me(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return me(this,1)},merge:function(){return de(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return de(this,t,e)},mergeDeep:function(){return de(this,ne(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return de(this,ne(t),e)},setLength:function(t){return me(this,0,t)},slice:function(t,e){var r=We.superCall(this,Ur.prototype,"slice",[t,e]);if(r!==this){var n=this,i=n.length;r.toVector=function(){return me(n,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return r},__iterator:function(t,e){return new zr(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=ye(this._size);return e?ce(this._tail,0,u-this._origin,this._size-this._origin,i,e)&&ce(this._root,this._level,-this._origin,u-this._origin,i,e):ce(this._root,this._level,-this._origin,u-this._origin,i,e)&&ce(this._tail,0,u-this._origin,this._size-this._origin,i,e),n},__ensureOwner:function(t){return t===this.__ownerID?this:t?_e(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return Jr||(Jr=_e(0,0,Ke))},from:function(t){if(!t||0===t.length)return Ur.empty();if(t.constructor===Ur)return t;var e=Array.isArray(t);return t.length>0&&ze>t.length?_e(0,t.length,Ke,null,new Pr(e?s(t):ar(t).toArray())):(e||(t=ar(t).valueSeq()),Ur.empty().merge(t))}},hr);var Wr=Rr.prototype;Wr[Pe]=Wr.remove,Wr.update=Sr.update,Wr.updateIn=Sr.updateIn,Wr.cursor=Sr.cursor,Wr.withMutations=Sr.withMutations,Wr.asMutable=Sr.asMutable,Wr.asImmutable=Sr.asImmutable,Wr.wasAltered=Sr.wasAltered;var Pr=function(t,e){this.array=t,this.ownerID=e},Kr=Pr;We.createClass(Pr,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this; <ide> var n=r>>>e&Je;if(n>=this.array.length)return new Kr([],t);var i,u=0===n;if(e>0){var a=this.array[n];if(i=a&&a.removeBefore(t,e-Ke,r),i===a&&u)return this}if(u&&!i)return this;var s=ge(this,t);if(!u)for(var o=0;n>o;o++)s.array[o]=void 0;return i&&(s.array[n]=i),s},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&Je;if(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var a=this.array[n];if(i=a&&a.removeAfter(t,e-Ke,r),i===a&&u)return this}if(u&&!i)return this;var s=ge(this,t);return u||s.array.pop(),i&&(s.array[n]=i),s}},{});var zr=function(t,e,r){this._type=e,this._reverse=!!r,this._maxIndex=t.length-1;var n=ye(t._size),i=fe(t._root&&t._root.array,t._level,-t._origin,n-t._origin-1),u=fe(t._tail&&t._tail.array,0,n-t._origin,t._size-t._origin-1);this._stack=r?u:i,this._stack.__prev=r?i:u};We.createClass(zr,{next:function(){for(var t=this._stack;t;){var e=t.array,r=t.index++;if(this._reverse&&(r=Je-r,r>t.rawMax&&(r=t.rawMax,t.index=ze-r)),r>=0&&ze>r&&t.rawMax>=r){var n=e&&e[r];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(r<<t.level),this._reverse&&(i=this._maxIndex-i)),v(u,i,n)}this._stack=t=fe(n&&n.array,t.level-Ke,t.offset+(r<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return g()}},{},ir);var Jr,Lr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Br.from(t)},Br=Lr;We.createClass(Lr,{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},push: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):we(t,e)},pushAll:function(t){if(t=ar(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):we(e,r) <ide> },pop:function(){return this.slice(1)},unshift:function(){return this.push.apply(this,arguments)},unshiftAll:function(t){return this.pushAll(t)},shift:function(){return this.pop.apply(this,arguments)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Br.empty()},slice:function(t,e){if(S(t,e,this.length))return this;var r=I(t,this.length),n=b(e,this.length);if(n!==this.length)return We.superCall(this,Br.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):we(i,u)},__ensureOwner:function(t){return t===this.__ownerID?this:t?we(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 ir(function(){if(n){var e=n.value;return n=n.next,v(t,r++,e)}return g()})}},{empty:function(){return Nr||(Nr=we(0))},from:function(t){var e=Br.empty();return t?t.constructor===Br?t:e.unshiftAll(t):e}},hr);var Vr=Lr.prototype;Vr.withMutations=Sr.withMutations,Vr.asMutable=Sr.asMutable,Vr.asImmutable=Sr.asImmutable,Vr.wasAltered=Sr.wasAltered;var Nr,Tr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Fr.from(t)},Fr=Tr;We.createClass(Tr,{toString:function(){return this.__toString("Set {","}")},get:function(t,e){return this._map.has(t)?t:e},contains:function(t){return this._map.has(t)},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:Se(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?Fr.empty():Se(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):Fr.empty() <ide> },union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++)ar(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 ar(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 ar(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=ar(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=ar(t),t.every(function(t){return e.contains(t)})},merge:function(){return this.union.apply(this,arguments)},mergeWith:function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.union.apply(this,t)},wasAltered:function(){return this._map.wasAltered()},__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?Se(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Hr||(Hr=Se(yr.empty()))},from:function(t){var e=Fr.empty();return t?t.constructor===Fr?t:e.union(t):e},fromKeys:function(t){return Fr.from(ar(t).flip())}},ar);var Gr=Tr.prototype;Gr[Pe]=Gr.remove,Gr[nr]=Gr.values,Gr.mergeDeep=Gr.merge,Gr.mergeDeepWith=Gr.mergeWith,Gr.withMutations=Sr.withMutations,Gr.asMutable=Sr.asMutable,Gr.asImmutable=Sr.asImmutable,Gr.__toJS=fr.__toJS,Gr.__toStringMapper=fr.__toStringMapper;var Hr,Qr=function(t){var e=Xr.empty();return t?t.constructor===Xr?t:e.merge(t):e},Xr=Qr;We.createClass(Qr,{toString:function(){return this.__toString("OrderedMap {","}") <ide> },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):Xr.empty()},set:function(t,e){return be(this,t,e)},remove:function(t){return be(this,t,Le)},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?Ie(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return Yr||(Yr=Ie(yr.empty(),Rr.empty()))}},yr),Qr.from=Qr,Qr.prototype[Pe]=Qr.prototype.remove;var Yr,Zr=function(t,e){var r=function(t){return this instanceof r?void(this._map=yr(t)):new r(t)},n=Object.keys(t),i=r.prototype=Object.create($r);i.constructor=r,e&&(i._name=e),i._defaultValues=t,i._keys=n,i.length=n.length;try{ar(t).forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){o(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})})}catch(u){}return r};We.createClass(Zr,{toString:function(){return this.__toString(this._name+" {","}")},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;var t=Object.getPrototypeOf(this).constructor;return t._empty||(t._empty=qe(this,yr.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:qe(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:qe(this,e)},keys:function(){return this._map.keys() <ide> },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 ar(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?qe(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},ar);var $r=Zr.prototype;$r._name="Record",$r[Pe]=$r.remove,$r.merge=Sr.merge,$r.mergeWith=Sr.mergeWith,$r.mergeDeep=Sr.mergeDeep,$r.mergeDeepWith=Sr.mergeDeepWith,$r.update=Sr.update,$r.updateIn=Sr.updateIn,$r.cursor=Sr.cursor,$r.withMutations=Sr.withMutations,$r.asMutable=Sr.asMutable,$r.asImmutable=Sr.asImmutable;var tn=function(t,e,r){return this instanceof en?(o(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&nn?nn:(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 en(t,e,r)},en=tn;We.createClass(tn,{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)},slice:function(t,e){return S(t,e,this.length)?this:(t=I(t,this.length),e=b(e,this.length),t>=e?nn:new en(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; <ide> return new ir(function(){var a=i;return i+=e?-n:n,u>r?g():v(t,u++,a)})},__deepEquals:function(t){return t instanceof en?this._start===t._start&&this._end===t._end&&this._step===t._step:We.superCall(this,en.prototype,"__deepEquals",[t])}},{},hr);var rn=tn.prototype;rn.__toJS=rn.toArray,rn.first=Wr.first,rn.last=Wr.last;var nn=tn(0,0),un=function(t,e){return 0===e&&on?on:this instanceof an?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new an(t,e)},an=un;We.createClass(un,{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 n(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 an(this._value,e-t):on},reverse:function(){return this},indexOf:function(t){return n(this._value,t)?0:-1},lastIndexOf:function(t){return n(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 ir(function(){return e.length>r?v(t,r++,e._value):g()})},__deepEquals:function(t){return t instanceof an?n(this._value,t._value):We.superCall(this,an.prototype,"__deepEquals",[t])}},{},hr);var sn=un.prototype;sn.last=sn.first,sn.has=rn.has,sn.take=rn.take,sn.skip=rn.skip,sn.__toJS=rn.__toJS;var on=new un(void 0,0),hn=function(t,e,r,n){this.length=n,this._rootData=t,this._keyPath=e,this._onChange=r};We.createClass(hn,{toString:function(){return""+this.__deref()},equals:function(t){return n(this.__deref(),Oe(t))},get:function(t,e){return this.getIn([t],e)},getIn:function(t,e){if(!t||Array.isArray(t)&&0===t.length)return this;var r=this._rootData.getIn(this._keyPath.concat(t),Le);return r===Le?e:Ce(this,t,r)},set:function(t,e){return je(this,function(r){return r.set(t,e)},t)},remove:function(t){return je(this,function(e){return e.remove(t)},t)},updateIn:function(t,e,r){return je(this,function(n){return n.updateIn(t,e,r) <ide> },t)},merge:function(){var t=arguments;return je(this,function(e){return e.merge.apply(e,t)})},mergeWith:function(){var t=arguments;return je(this,function(e){return e.mergeWith.apply(e,t)})},mergeDeep:function(){var t=arguments;return je(this,function(e){return e.mergeDeep.apply(e,t)})},mergeDeepWith:function(){var t=arguments;return je(this,function(e){return e.mergeDeepWith.apply(e,t)})},clear:function(){return je(this,function(t){return t.clear()})},cursor:function(t,e){var r=0===arguments.length||"function"==typeof t&&(e=t)?[]:Array.isArray(t)?t:[t];return e?Ae(this,r,e):0===r.length?this:Ee(this,r)},withMutations:function(t){return je(this,function(e){return e.withMutations(t)})},asMutable:function(){return je(this,function(t){return t.asMutable()})},asImmutable:function(){return je(this,function(t){return t.asImmutable()})},wasAltered:function(){return this.__deref().wasAltered()},__iterate:function(t,e){var r=this;return this.__deref().__iterate(function(e,n){return t(Ce(r,n,e),n,r)},e)},__iterator:function(t,e){var r=this,n=this.__deref().__iterator(er,e);return new ir(function(){if(!n)return g();var e=n.next();if(e.done)return e;var i=e.value,u=i[0],a=i[1];return v(t,u,Ce(r,u,a),e)})},__ensureOwner:function(t){return je(this,function(e){return e.__ensureOwner(t)})},__deref:function(){return this._rootData.getIn(this._keyPath,yr.empty())}},{},yr);var cn=hn.prototype;cn[Pe]=cn.remove;var fn=function(t,e,r,n){this.length=n,this._rootData=t,this._keyPath=e,this._onChange=r};We.createClass(fn,{push:function(){var t=arguments;return je(this,function(e){return e.push.apply(e,t)})},pop:function(){return je(this,function(t){return t.pop()})},unshift:function(){var t=arguments;return je(this,function(e){return e.unshift.apply(e,t)})},shift:function(){return je(this,function(t){return t.shift()})},setLength:function(t){return je(this,function(e){return e.setLength(t)})},slice:function(){var t=arguments;return je(this,function(e){return e.slice.apply(e,t)})}},{},Rr);var _n=fn.prototype;_n[Pe]=_n.remove=cn.remove,_n.toString=cn.toString,_n.equals=cn.equals,_n.__deref=cn.__deref,_n.get=cn.get,_n.getIn=cn.getIn,_n.set=cn.set,_n.remove=cn.remove,_n.updateIn=cn.updateIn,_n.merge=cn.merge,_n.mergeWith=cn.mergeWith,_n.mergeDeep=cn.mergeDeep,_n.mergeDeepWith=cn.mergeDeepWith,_n.clear=cn.clear,_n.cursor=cn.cursor,_n.withMutations=cn.withMutations,_n.asMutable=cn.asMutable,_n.asImmutable=cn.asImmutable,_n.wasAltered=cn.wasAltered,_n.__iterate=cn.__iterate,_n.__iterator=cn.__iterator,_n.__ensureOwner=cn.__ensureOwner; <del>var ln=function(t,e,r,n){this.length=n,this._rootData=t,this._keyPath=e,this._onChange=r};We.createClass(ln,{add:function(t){return je(this,function(e){return e.add(t)})},contains:function(t){return t.__deref().contains(t)},union:function(){var t=arguments;return je(this,function(e){return e.union.apply(e,t)})},intersect:function(){var t=arguments;return je(this,function(e){return e.intersect.apply(e,t)})},subtract:function(){var t=arguments;return je(this,function(e){return e.subtract.apply(e,t)})},isSubset:function(t){return this.__deref().isSubset(t)},isSuperset:function(t){return this.__deref().isSuperset(t)}},{},Tr);var vn=ln.prototype;vn[Pe]=vn.remove=cn.remove,vn.toString=cn.toString,vn.equals=cn.equals,vn.__deref=cn.__deref,vn.get=cn.get,vn.getIn=cn.getIn,vn.remove=cn.remove,vn.clear=cn.clear,vn.withMutations=cn.withMutations,vn.asMutable=cn.asMutable,vn.asImmutable=cn.asImmutable,vn.wasAltered=cn.wasAltered,vn.__iterate=cn.__iterate,vn.__iterator=cn.__iterator,vn.__ensureOwner=cn.__ensureOwner;var gn=function(t,e,r,n){this.length=n,this._rootData=t,this._keyPath=e,this._onChange=r};We.createClass(gn,{pushAll:function(t){return je(this,function(e){return e.pushAll(t)})},peek:function(){return this.__deref().peek()}},{},Lr);var pn=gn.prototype;pn.toString=cn.toString,pn.equals=cn.equals,pn.__deref=cn.__deref,pn.get=cn.get,pn.getIn=cn.getIn,pn.push=_n.push,pn.pop=_n.pop,pn.slice=_n.slice,pn.clear=cn.clear,pn.withMutations=cn.withMutations,pn.asMutable=cn.asMutable,pn.asImmutable=cn.asImmutable,pn.wasAltered=cn.wasAltered,pn.__iterate=cn.__iterate,pn.__iterator=cn.__iterator,pn.__ensureOwner=cn.__ensureOwner;var mn={Sequence:ar,Map:yr,Vector:Rr,Stack:Lr,Set:Tr,OrderedMap:Qr,Record:Zr,Range:tn,Repeat:un,is:n,fromJS:Me,isCursor:xe,unCursor:Oe};return mn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t(); <add>var ln=function(t,e,r,n){this.length=n,this._rootData=t,this._keyPath=e,this._onChange=r};We.createClass(ln,{add:function(t){return je(this,function(e){return e.add(t)})},contains:function(t){return t.__deref().contains(t)},union:function(){var t=arguments;return je(this,function(e){return e.union.apply(e,t)})},intersect:function(){var t=arguments;return je(this,function(e){return e.intersect.apply(e,t)})},subtract:function(){var t=arguments;return je(this,function(e){return e.subtract.apply(e,t)})},isSubset:function(t){return this.__deref().isSubset(t)},isSuperset:function(t){return this.__deref().isSuperset(t)}},{},Tr);var vn=ln.prototype;vn[Pe]=vn.remove=cn.remove,vn.toString=cn.toString,vn.equals=cn.equals,vn.__deref=cn.__deref,vn.get=cn.get,vn.getIn=cn.getIn,vn.remove=cn.remove,vn.clear=cn.clear,vn.withMutations=cn.withMutations,vn.asMutable=cn.asMutable,vn.asImmutable=cn.asImmutable,vn.wasAltered=cn.wasAltered,vn.__iterate=cn.__iterate,vn.__iterator=cn.__iterator,vn.__ensureOwner=cn.__ensureOwner;var gn=function(t,e,r,n){this.length=n,this._rootData=t,this._keyPath=e,this._onChange=r};We.createClass(gn,{pushAll:function(t){return je(this,function(e){return e.pushAll(t)})},peek:function(){return this.__deref().peek()}},{},Lr);var pn=gn.prototype;pn.toString=cn.toString,pn.equals=cn.equals,pn.__deref=cn.__deref,pn.get=cn.get,pn.getIn=cn.getIn,pn.push=_n.push,pn.pop=_n.pop,pn.slice=_n.slice,pn.clear=cn.clear,pn.withMutations=cn.withMutations,pn.asMutable=cn.asMutable,pn.asImmutable=cn.asImmutable,pn.wasAltered=cn.wasAltered,pn.__iterate=cn.__iterate,pn.__iterator=cn.__iterator,pn.__ensureOwner=cn.__ensureOwner;var mn={Sequence:ar,Map:yr,Vector:Rr,Stack:Lr,Set:Tr,OrderedMap:Qr,Record:Zr,Range:tn,Repeat:un,is:n,fromJS:Me,isCursor:xe,unCursor:Oe};return mn}"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/Sequence.js <ide> class Sequence { <ide> } <ide> <ide> reverse() { <del> return reverseFactory(this); <add> return reverseFactory(this, true); <ide> } <ide> <ide> slice(begin, end) { <ide> class IndexedSequence extends Sequence { <ide> return this.toKeyedSeq().reverse().indexOf(searchValue); <ide> } <ide> <add> reverse() { <add> return reverseFactory(this, false); <add> } <add> <ide> splice(index, removeNum /*, ...values*/) { <ide> var numArgs = arguments.length; <ide> removeNum = Math.max(removeNum | 0, 0); <ide> class KeyedIndexedSequence extends Sequence { <ide> } <ide> <ide> reverse() { <del> var reversedSequence = reverseFactory(this); <add> var reversedSequence = reverseFactory(this, true); <ide> reversedSequence.valueSeq = () => this._seq.reverse(); <ide> return reversedSequence; <ide> } <ide> function mapFactory(sequence, mapper, context) { <ide> return mappedSequence; <ide> } <ide> <del>function reverseFactory(sequence) { <del> var isIndexedSequence = (sequence instanceof IndexedSequence); <add>function reverseFactory(sequence, useKeys) { <ide> var reversedSequence = sequence.__makeSequence(); <ide> reversedSequence.length = sequence.length; <ide> reversedSequence.reverse = () => sequence; <ide> function reverseFactory(sequence) { <ide> flipSequence.reverse = () => sequence.flip(); <ide> return flipSequence; <ide> }; <del> if (isIndexedSequence) { <del> var reverseIndexOffset = sequence.length - 1; <del> reversedSequence.get = (key, notSetValue) => sequence.get(reverseIndexOffset - key, notSetValue); <del> } else { <del> reversedSequence.get = (key, notSetValue) => sequence.get(key, notSetValue); <del> } <add> reversedSequence.get = (key, notSetValue) => <add> sequence.get(useKeys ? key : -1 - key, notSetValue); <ide> reversedSequence.has = key => sequence.has(key); <ide> reversedSequence.contains = value => sequence.contains(value); <ide> reversedSequence.cacheResult = function () {
3
Python
Python
remove redundant parentheses
20b1664685027ef7e1b9a5c9c30d1fddb600ed0f
<ide><path>airflow/configuration.py <ide> def _TEST_CONFIG(): <ide> _deprecated = { <ide> 'DEFAULT_CONFIG': _DEFAULT_CONFIG, <ide> 'TEST_CONFIG': _TEST_CONFIG, <del> 'TEST_CONFIG_FILE_PATH': functools.partial(_default_config_file_path, ('default_test.cfg')), <del> 'DEFAULT_CONFIG_FILE_PATH': functools.partial(_default_config_file_path, ('default_airflow.cfg')), <add> 'TEST_CONFIG_FILE_PATH': functools.partial(_default_config_file_path, 'default_test.cfg'), <add> 'DEFAULT_CONFIG_FILE_PATH': functools.partial(_default_config_file_path, 'default_airflow.cfg'), <ide> } <ide> <ide>
1
Ruby
Ruby
unify benchmark apis
a15e02d44ac2afb27a7e8e652c98a796d271b645
<ide><path>actionpack/lib/abstract_controller/logger.rb <ide> require 'active_support/core_ext/logger' <add>require 'active_support/benchmarkable' <ide> <ide> module AbstractController <ide> module Logger <ide> extend ActiveSupport::Concern <ide> <ide> included do <ide> cattr_accessor :logger <del> end <del> <del> module ClassMethods #:nodoc: <del> # Logs a message appending the value measured. <del> def log(message, log_level=::Logger::DEBUG) <del> return unless logger && logger.level >= log_level <del> logger.add(log_level, message) <del> end <del> <del> # Silences the logger for the duration of the block. <del> def silence <del> old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger <del> yield <del> ensure <del> logger.level = old_logger_level if logger <del> end <add> extend ActiveSupport::Benchmarkable <ide> end <ide> <ide> # A class that allows you to defer expensive processing <ide><path>actionpack/lib/action_controller/instrument.rb <ide> require 'active_support/orchestra' <ide> <ide> ActiveSupport::Orchestra.subscribe(/(read|write|cache|expire|exist)_(fragment|page)\??/) do |event| <del> human_name = event.name.to_s.humanize <del> ActionController::Base.log("#{human_name} (%.1fms)" % event.duration) <add> if logger = ActionController::Base.logger <add> human_name = event.name.to_s.humanize <add> logger.info("#{human_name} (%.1fms)" % event.duration) <add> end <ide> end <ide><path>actionpack/lib/action_controller/metal/benchmarking.rb <del>require 'benchmark' <add>require 'active_support/core_ext/benchmark' <ide> <ide> module ActionController #:nodoc: <ide> # The benchmarking module times the performance of actions and reports to the logger. If the Active Record <ide> # package has been included, a separate timing section for database calls will be added as well. <ide> module Benchmarking #:nodoc: <ide> extend ActiveSupport::Concern <ide> <del> module ClassMethods <del> # Log and benchmark the workings of a single block and silence whatever logging that may have happened inside it <del> # (unless <tt>use_silence</tt> is set to false). <del> # <del> # The benchmark is only recorded if the current level of the logger matches the <tt>log_level</tt>, which makes it <del> # easy to include benchmarking statements in production software that will remain inexpensive because the benchmark <del> # will only be conducted if the log level is low enough. <del> def benchmark(title, log_level = Logger::DEBUG, use_silence = true) <del> if logger && logger.level == log_level <del> result = nil <del> ms = Benchmark.ms { result = use_silence ? silence { yield } : yield } <del> logger.add(log_level, "#{title} (#{('%.1f' % ms)}ms)") <del> result <del> else <del> yield <del> end <del> end <del> end <del> <ide> protected <ide> def render(*args, &block) <ide> if logger <ide> def render(*args, &block) <ide> else <ide> super <ide> end <del> end <add> end <ide> <ide> private <ide> def process_action(*args) <ide><path>actionpack/lib/action_view/helpers.rb <add>require 'active_support/benchmarkable' <add> <ide> module ActionView #:nodoc: <ide> module Helpers #:nodoc: <ide> autoload :ActiveModelHelper, 'action_view/helpers/active_model_helper' <ide> autoload :AjaxHelper, 'action_view/helpers/ajax_helper' <ide> autoload :AssetTagHelper, 'action_view/helpers/asset_tag_helper' <ide> autoload :AtomFeedHelper, 'action_view/helpers/atom_feed_helper' <del> autoload :BenchmarkHelper, 'action_view/helpers/benchmark_helper' <ide> autoload :CacheHelper, 'action_view/helpers/cache_helper' <ide> autoload :CaptureHelper, 'action_view/helpers/capture_helper' <ide> autoload :DateHelper, 'action_view/helpers/date_helper' <ide> module ClassMethods <ide> include SanitizeHelper::ClassMethods <ide> end <ide> <add> include ActiveSupport::Benchmarkable <add> <ide> include ActiveModelHelper <ide> include AssetTagHelper <ide> include AtomFeedHelper <del> include BenchmarkHelper <ide> include CacheHelper <ide> include CaptureHelper <ide> include DateHelper <ide><path>actionpack/lib/action_view/helpers/benchmark_helper.rb <del>require 'active_support/core_ext/benchmark' <del> <del>module ActionView <del> module Helpers <del> # This helper offers a method to measure the execution time of a block <del> # in a template. <del> module BenchmarkHelper <del> # Allows you to measure the execution time of a block <del> # in a template and records the result to the log. Wrap this block around <del> # expensive operations or possible bottlenecks to get a time reading <del> # for the operation. For example, let's say you thought your file <del> # processing method was taking too long; you could wrap it in a benchmark block. <del> # <del> # <% benchmark "Process data files" do %> <del> # <%= expensive_files_operation %> <del> # <% end %> <del> # <del> # That would add something like "Process data files (345.2ms)" to the log, <del> # which you can then use to compare timings when optimizing your code. <del> # <del> # You may give an optional logger level as the :level option. <del> # (:debug, :info, :warn, :error); the default value is :info. <del> # <del> # <% benchmark "Low-level files", :level => :debug do %> <del> # <%= lowlevel_files_operation %> <del> # <% end %> <del> # <del> # Finally, you can pass true as the third argument to silence all log activity <del> # inside the block. This is great for boiling down a noisy block to just a single statement: <del> # <del> # <% benchmark "Process data files", :level => :info, :silence => true do %> <del> # <%= expensive_and_chatty_files_operation %> <del> # <% end %> <del> def benchmark(message = "Benchmarking", options = {}) <del> if controller.logger <del> if options.is_a?(Symbol) <del> ActiveSupport::Deprecation.warn("use benchmark('#{message}', :level => :#{options}) instead", caller) <del> options = { :level => options, :silence => false } <del> else <del> options.assert_valid_keys(:level, :silence) <del> options[:level] ||= :info <del> end <del> <del> result = nil <del> ms = Benchmark.ms { result = options[:silence] ? controller.logger.silence { yield } : yield } <del> controller.logger.send(options[:level], '%s (%.1fms)' % [ message, ms ]) <del> result <del> else <del> yield <del> end <del> end <del> end <del> end <del>end <ide><path>activerecord/lib/active_record/base.rb <ide> require 'benchmark' <ide> require 'yaml' <ide> require 'set' <add>require 'active_support/benchmarkable' <ide> require 'active_support/dependencies' <ide> require 'active_support/time' <ide> require 'active_support/core_ext/class/attribute_accessors' <ide> require 'active_support/core_ext/hash/slice' <ide> require 'active_support/core_ext/string/behavior' <ide> require 'active_support/core_ext/symbol' <del>require 'active_support/core_ext/benchmark' <ide> require 'active_support/core_ext/object/metaclass' <ide> <ide> module ActiveRecord #:nodoc: <ide> def sanitize(object) #:nodoc: <ide> connection.quote(object) <ide> end <ide> <del> # Log and benchmark multiple statements in a single block. Example: <del> # <del> # Project.benchmark("Creating project") do <del> # project = Project.create("name" => "stuff") <del> # project.create_manager("name" => "David") <del> # project.milestones << Milestone.find(:all) <del> # end <del> # <del> # The benchmark is only recorded if the current level of the logger is less than or equal to the <tt>log_level</tt>, <del> # which makes it easy to include benchmarking statements in production software that will remain inexpensive because <del> # the benchmark will only be conducted if the log level is low enough. <del> # <del> # The logging of the multiple statements is turned off unless <tt>use_silence</tt> is set to false. <del> def benchmark(title, log_level = Logger::DEBUG, use_silence = true) <del> if logger && logger.level <= log_level <del> result = nil <del> ms = Benchmark.ms { result = use_silence ? silence { yield } : yield } <del> logger.add(log_level, '%s (%.1fms)' % [title, ms]) <del> result <del> else <del> yield <del> end <del> end <del> <del> # Silences the logger for the duration of the block. <del> def silence <del> old_logger_level, logger.level = logger.level, Logger::ERROR if logger <del> yield <del> ensure <del> logger.level = old_logger_level if logger <del> end <del> <ide> # Overwrite the default class equality method to provide support for association proxies. <ide> def ===(object) <ide> object.is_a?(self) <ide> def object_from_yaml(string) <ide> Base.class_eval do <ide> extend ActiveModel::Naming <ide> extend QueryCache::ClassMethods <add> extend ActiveSupport::Benchmarkable <add> <ide> include Validations <ide> include Locking::Optimistic, Locking::Pessimistic <ide> include AttributeMethods <ide><path>activerecord/test/cases/base_test.rb <ide> def test_benchmark_with_log_level <ide> log = StringIO.new <ide> ActiveRecord::Base.logger = Logger.new(log) <ide> ActiveRecord::Base.logger.level = Logger::WARN <del> ActiveRecord::Base.benchmark("Debug Topic Count", Logger::DEBUG) { Topic.count } <del> ActiveRecord::Base.benchmark("Warn Topic Count", Logger::WARN) { Topic.count } <del> ActiveRecord::Base.benchmark("Error Topic Count", Logger::ERROR) { Topic.count } <add> ActiveRecord::Base.benchmark("Debug Topic Count", :level => :debug) { Topic.count } <add> ActiveRecord::Base.benchmark("Warn Topic Count", :level => :warn) { Topic.count } <add> ActiveRecord::Base.benchmark("Error Topic Count", :level => :error) { Topic.count } <ide> assert_no_match /Debug Topic Count/, log.string <ide> assert_match /Warn Topic Count/, log.string <ide> assert_match /Error Topic Count/, log.string <ide> def test_benchmark_with_use_silence <ide> original_logger = ActiveRecord::Base.logger <ide> log = StringIO.new <ide> ActiveRecord::Base.logger = Logger.new(log) <del> ActiveRecord::Base.benchmark("Logging", Logger::DEBUG, true) { ActiveRecord::Base.logger.debug "Loud" } <del> ActiveRecord::Base.benchmark("Logging", Logger::DEBUG, false) { ActiveRecord::Base.logger.debug "Quiet" } <add> ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => true) { ActiveRecord::Base.logger.debug "Loud" } <add> ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => false) { ActiveRecord::Base.logger.debug "Quiet" } <ide> assert_no_match /Loud/, log.string <ide> assert_match /Quiet/, log.string <ide> ensure <ide><path>activesupport/lib/active_support/autoload.rb <ide> module ActiveSupport <ide> autoload :BacktraceCleaner, 'active_support/backtrace_cleaner' <ide> autoload :Base64, 'active_support/base64' <ide> autoload :BasicObject, 'active_support/basic_object' <add> autoload :Benchmarkable, 'active_support/benchmarkable' <ide> autoload :BufferedLogger, 'active_support/buffered_logger' <ide> autoload :Cache, 'active_support/cache' <ide> autoload :Callbacks, 'active_support/callbacks' <ide><path>activesupport/lib/active_support/benchmarkable.rb <add>require 'active_support/core_ext/benchmark' <add> <add>module ActiveSupport <add> module Benchmarkable <add> # Allows you to measure the execution time of a block <add> # in a template and records the result to the log. Wrap this block around <add> # expensive operations or possible bottlenecks to get a time reading <add> # for the operation. For example, let's say you thought your file <add> # processing method was taking too long; you could wrap it in a benchmark block. <add> # <add> # <% benchmark "Process data files" do %> <add> # <%= expensive_files_operation %> <add> # <% end %> <add> # <add> # That would add something like "Process data files (345.2ms)" to the log, <add> # which you can then use to compare timings when optimizing your code. <add> # <add> # You may give an optional logger level as the :level option. <add> # (:debug, :info, :warn, :error); the default value is :info. <add> # <add> # <% benchmark "Low-level files", :level => :debug do %> <add> # <%= lowlevel_files_operation %> <add> # <% end %> <add> # <add> # Finally, you can pass true as the third argument to silence all log activity <add> # inside the block. This is great for boiling down a noisy block to just a single statement: <add> # <add> # <% benchmark "Process data files", :level => :info, :silence => true do %> <add> # <%= expensive_and_chatty_files_operation %> <add> # <% end %> <add> def benchmark(message = "Benchmarking", options = {}) <add> if logger <add> if options.is_a?(Symbol) <add> ActiveSupport::Deprecation.warn("use benchmark('#{message}', :level => :#{options}) instead", caller) <add> options = { :level => options, :silence => false } <add> else <add> options.assert_valid_keys(:level, :silence) <add> options[:level] ||= :info <add> end <add> <add> result = nil <add> ms = Benchmark.ms { result = options[:silence] ? logger.silence { yield } : yield } <add> logger.send(options[:level], '%s (%.1fms)' % [ message, ms ]) <add> result <add> else <add> yield <add> end <add> end <add> <add> # Silence the logger during the execution of the block. <add> # <add> def silence <add> old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger <add> yield <add> ensure <add> logger.level = old_logger_level if logger <add> end <add> end <add>end <add><path>activesupport/test/benchmarkable_test.rb <del><path>actionpack/test/template/benchmark_helper_test.rb <ide> require 'abstract_unit' <ide> require 'action_view/helpers/benchmark_helper' <ide> <del>class BenchmarkHelperTest < ActionView::TestCase <del> tests ActionView::Helpers::BenchmarkHelper <del> <del> def setup <del> super <del> controller.logger = ActiveSupport::BufferedLogger.new(StringIO.new) <del> controller.logger.auto_flushing = false <del> end <add>class BenchmarkableTest < ActiveSupport::TestCase <add> include ActiveSupport::Benchmarkable <ide> <ide> def teardown <del> controller.logger.send(:clear_buffer) <add> logger.send(:clear_buffer) <ide> end <ide> <ide> def test_without_block <ide> def test_with_message_and_deprecated_level <ide> end <ide> <ide> def test_within_level <del> controller.logger.level = ActiveSupport::BufferedLogger::DEBUG <add> logger.level = ActiveSupport::BufferedLogger::DEBUG <ide> benchmark('included_debug_run', :level => :debug) { } <ide> assert_last_logged 'included_debug_run' <ide> end <ide> <ide> def test_outside_level <del> controller.logger.level = ActiveSupport::BufferedLogger::ERROR <add> logger.level = ActiveSupport::BufferedLogger::ERROR <ide> benchmark('skipped_debug_run', :level => :debug) { } <ide> assert_no_match(/skipped_debug_run/, buffer.last) <ide> ensure <del> controller.logger.level = ActiveSupport::BufferedLogger::DEBUG <add> logger.level = ActiveSupport::BufferedLogger::DEBUG <ide> end <ide> <ide> def test_without_silencing <ide> benchmark('debug_run', :silence => false) do <del> controller.logger.info "not silenced!" <add> logger.info "not silenced!" <ide> end <ide> <ide> assert_equal 2, buffer.size <ide> end <ide> <ide> def test_with_silencing <ide> benchmark('debug_run', :silence => true) do <del> controller.logger.info "silenced!" <add> logger.info "silenced!" <ide> end <ide> <ide> assert_equal 1, buffer.size <ide> end <ide> <del> <ide> private <add> def logger <add> @logger ||= begin <add> logger = ActiveSupport::BufferedLogger.new(StringIO.new) <add> logger.auto_flushing = false <add> logger <add> end <add> end <add> <ide> def buffer <del> controller.logger.send(:buffer) <add> logger.send(:buffer) <ide> end <del> <add> <ide> def assert_last_logged(message = 'Benchmarking') <ide> assert_match(/^#{message} \(.*\)$/, buffer.last) <ide> end
10
Javascript
Javascript
add test to fs/promises setimmediate
5dd344a2a8a70d8c3b6e570c00b72f03d2801a84
<ide><path>test/parallel/test-timers-promisified.js <ide> process.on('multipleResolves', common.mustNotCall()); <ide> code: 'ERR_INVALID_ARG_TYPE' <ide> })).then(common.mustCall()); <ide> <add> Promise.all( <add> [1, '', Infinity, null, {}].map( <add> (ref) => assert.rejects(setImmediate(10, { ref })), { <add> code: 'ERR_INVALID_ARG_TYPE' <add> })).then(common.mustCall()); <add> <ide> Promise.all( <ide> [1, '', false, Infinity].map( <ide> (i) => assert.rejects(setTimeout(10, null, i)), {
1
Ruby
Ruby
remove useless conditional
85903d1b08963c1ac872106c3c727ff5468559a2
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def check_required_ivars <ide> end <ide> <ide> def build_request_uri(controller_class_name, action, parameters) <del> unless @request.env["PATH_INFO"] <del> options = @controller.respond_to?(:url_options) ? @controller.__send__(:url_options).merge(parameters) : parameters <del> options.update( <del> :controller => controller_class_name, <del> :action => action, <del> :relative_url_root => nil, <del> :_recall => @request.path_parameters) <del> <del> url, = @routes.path_for(options).split("?", 2) <del> <del> @request.env["PATH_INFO"] = url <del> end <ide> @request.env["SCRIPT_NAME"] ||= @controller.config.relative_url_root <ide> end <ide>
1
Text
Text
release notes for 1.0.2 and 1.1.0 releases
db861db1f239bdb2c13f157e2632cb2bc76f0432
<ide><path>CHANGELOG.md <add><a name="1.1.0"></a> <add># 1.1.0 increase-gravatas (2012-08-31) <add> <add>_Note: 1.1.x releases are [considered unstable](http://blog.angularjs.org/2012/07/angularjs-10-12-roadmap.html)._ <add> <add>## Features <add> <add>- **$http:** support custom reponseType <add> ([e0a54f6b](https://github.com/angular/angular.js/commit/e0a54f6b206dc2b6595f2bc3a17c5932e7477545), <add> [#1013](https://github.com/angular/angular.js/issues/1013)) <add>- **$interpolate:** <add> - provide contextual error messages <add> ([d804bbcd](https://github.com/angular/angular.js/commit/d804bbcd51ec83bee1f4a3ccd42c3bd7eb38a988)) <add> - expose start/end symbols in run phase <add> ([58f121a5](https://github.com/angular/angular.js/commit/58f121a5c293ed57043e22ed526fdf99642fca81)) <add>- **$sniffer:** auto detect CSP mode (currently requires Chrome on dev channel) <add> ([167aa0c2](https://github.com/angular/angular.js/commit/167aa0c29c998be33c49d33302e099b36d1ce0be)) <add> <add>This release also contains all bug fixes available in [1.0.2](#1.0.2). <add> <add> <add> <add><a name="1.0.2"></a> <add># 1.0.2 debilitating-awesomeness (2012-08-31) <add> <add> <add>## Bug Fixes <add> <add>- **$compile:** denormalize directive templates <add> ([dfe99836](https://github.com/angular/angular.js/commit/dfe99836cd98c2a1b0f9bde6216bd44088de275a)) <add>- **$interpolate:** $interpolateProvider.endSymbol() returns startSymbol <add> ([20348717](https://github.com/angular/angular.js/commit/20348717640c0ef405c9fdcc8fec5b566efc48b3)) <add>- **jqLite:** better support for xhtml <add> ([d3fa7a2e](https://github.com/angular/angular.js/commit/d3fa7a2e9e93c9dae13d852b28c878f7d6b7c420), <add> [#1301](https://github.com/angular/angular.js/issues/1301)) <add>- **mocks:** free up memory after every spec <add> ([1a8642aa](https://github.com/angular/angular.js/commit/1a8642aac2de40dccdab464e58dc164006c300bb)) <add>- **e2e test runner:** Adding meta tag to avoid cache issues <add> ([5318588d](https://github.com/angular/angular.js/commit/5318588d6e8ee9a31f4002affd6858d25305aabf)) <add>- Directives: <add> - **form:** prevent page reload when form destroyed <add> ([054d40f3](https://github.com/angular/angular.js/commit/054d40f338f9000cddcf7f0513af37328b88ef41), <add> [#1238](https://github.com/angular/angular.js/issues/1238)) <add> - **ngList:** remove data bound flicker <add> ([fa62ea81](https://github.com/angular/angular.js/commit/fa62ea810f6c701e898dd07c6c9228f13d5b5e02)) <add> - **ngPluralize:** fixes ng-pluralize when using non-standard start/end symbols <add> ([e85774f7](https://github.com/angular/angular.js/commit/e85774f709b9f681b0ff8d829b07568b0f844a62), <add> [#1134](https://github.com/angular/angular.js/issues/1134)) <add> - **option:** support option elements in datalist <add> ([9767f7bd](https://github.com/angular/angular.js/commit/9767f7bdd3e1ce6f65bdea992d67369ead13d813), <add> [#1165](https://github.com/angular/angular.js/issues/1165)) <add> <add> <add>## Docs <add> <add>- Conceptual Overview of AngularJS (high level overview of how things work): <add> <http://docs.angularjs.org/guide/concepts> <add> ([7a5f25f6](https://github.com/angular/angular.js/commit/7a5f25f6671eb5f51b06615d74a05855ab79f31e)) <add>- Lots of spelling, grammar and other fixes: <add> [9a710c78](https://github.com/angular/angular.js/commit/9a710c788d880785d2b02a9c5411eb15e9c278bf), <add> [847d2da0](https://github.com/angular/angular.js/commit/847d2da0f8d1e265eda7b4dd3e7eb52ac86d784e), <add> [dbefd671](https://github.com/angular/angular.js/commit/dbefd671e41c3bda481850bb7e566349e275d759), <add> [cab5e1d9](https://github.com/angular/angular.js/commit/cab5e1d9b363eac6fd31b15c5b86f30993e2f147), <add> [f00b6cca](https://github.com/angular/angular.js/commit/f00b6cca024a9418f353651f29c984f934575bd9), <add> [2e365168](https://github.com/angular/angular.js/commit/2e3651686c2bd84cf464ecc236c8ad77e61179df), <add> [536de148](https://github.com/angular/angular.js/commit/536de148214290f0b4a0595fa16c00da5e527e79), <add> [a1107e81](https://github.com/angular/angular.js/commit/a1107e81ebf2254caf75718de2e3ec773cce0c56), <add> [5ef9ed87](https://github.com/angular/angular.js/commit/5ef9ed87d82b109715a87e9aa1b1d5b63f515d3a), <add> [8c81a0f3](https://github.com/angular/angular.js/commit/8c81a0f3728b9308854ceb9bf392ec467b95d8eb), <add> [bde931af](https://github.com/angular/angular.js/commit/bde931afd5cf2483df236e06992666a0a4182794), <add> [6553fe68](https://github.com/angular/angular.js/commit/6553fe68d17d42ec25e0c592ceaa1077cc0ec4f6), <add> [13b5fd1b](https://github.com/angular/angular.js/commit/13b5fd1b9d60f1a9187da8a89db9272284ccdac4), <add> [17209d5b](https://github.com/angular/angular.js/commit/17209d5b4a579edf8425715b5cdf25bc5cd96711), <add> [31c82560](https://github.com/angular/angular.js/commit/31c825607dd524241c811ca3e401b119c810e977), <add> [ab6937e2](https://github.com/angular/angular.js/commit/ab6937e2518bfd77d9fe42e3d2e11fe4a7a16814), <add> [fbfda241](https://github.com/angular/angular.js/commit/fbfda241f616bcfe8273f501dd49120a3cb35fab), <add> [206371b7](https://github.com/angular/angular.js/commit/206371b7372c242db234ca8da12d1c7a8a322d54), <add> [b6b92bd8](https://github.com/angular/angular.js/commit/b6b92bd866e1d6d066f1c9bf1937496cd3e28664), <add> [79f2d843](https://github.com/angular/angular.js/commit/79f2d843a8458bfdc23fe9f179a1416fe21f7533), <add> [64a9cd8f](https://github.com/angular/angular.js/commit/64a9cd8f4fac1c518869a1c955fe60bd6ef76439), <add> [7f6e1326](https://github.com/angular/angular.js/commit/7f6e1326f3a7a6a2ba2dbd48dd6571ebe929a7c1), <add> [1fd2b3d4](https://github.com/angular/angular.js/commit/1fd2b3d402f36e395a1fe9ea7e3f91a1b2833426), <add> [d56d69cc](https://github.com/angular/angular.js/commit/d56d69cc8319f69135a17a9bb5ae394123b33c51), <add> [01e726b2](https://github.com/angular/angular.js/commit/01e726b2fa3fb0d2584c9bb8df116ff3a9f05879), <add> [16136216](https://github.com/angular/angular.js/commit/161362164532af3578c9e3e8b52cd80b15345add), <add> [92a3d282](https://github.com/angular/angular.js/commit/92a3d2821856c75eb95f8ec6ccf26d6a9b37fdd9), <add> [4c585019](https://github.com/angular/angular.js/commit/4c5850195699b1d982963f25399d24bf8b815f81), <add> [c076fe08](https://github.com/angular/angular.js/commit/c076fe08cf47e8af4b5e8845aed917ebb7dbd593), <add> [2473412b](https://github.com/angular/angular.js/commit/2473412ba55f7c47f2ca24311312ce95ee11949e), <add> [1f2d5000](https://github.com/angular/angular.js/commit/1f2d50000e82630bfce6eb9cf0a8da752fd1e826), <add> [5026315d](https://github.com/angular/angular.js/commit/5026315d6f4495d636d86ae2a022fb55cc0ca211), <add> [f0a090dd](https://github.com/angular/angular.js/commit/f0a090ddf256d0c144e705c0cdf4216d824140f9), <add> [6d9313a6](https://github.com/angular/angular.js/commit/6d9313a68d82654d389c0b2c3e4af148382f14be)) and more! <add> <add> <add> <ide> <a name="1.0.1"></a> <ide> # 1.0.1 thorium-shielding (2012-06-25) <ide>
1
Ruby
Ruby
make parameters#to_h and #to_unsafe_h return hwia
6d4aef984c0cd74ebd92b8d18a8e68f371fbb944
<ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb <ide> def ==(other_hash) <ide> end <ide> end <ide> <del> # Returns a safe +Hash+ representation of this parameter with all <del> # unpermitted keys removed. <add> # Returns a safe <tt>ActiveSupport::HashWithIndifferentAccess</tt> <add> # representation of this parameter with all unpermitted keys removed. <ide> # <ide> # params = ActionController::Parameters.new({ <ide> # name: 'Senjougahara Hitagi', <ide> def ==(other_hash) <ide> # safe_params.to_h # => {"name"=>"Senjougahara Hitagi"} <ide> def to_h <ide> if permitted? <del> @parameters.to_h <add> @parameters.deep_dup <ide> else <ide> slice(*self.class.always_permitted_parameters).permit!.to_h <ide> end <ide> end <ide> <del> # Returns an unsafe, unfiltered +Hash+ representation of this parameter. <add> # Returns an unsafe, unfiltered <add> # <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of this <add> # parameter. <ide> def to_unsafe_h <del> @parameters.to_h <add> @parameters.deep_dup <ide> end <ide> alias_method :to_unsafe_hash, :to_unsafe_h <ide> <ide><path>actionpack/test/controller/parameters/parameters_permit_test.rb <ide> def assert_filtered_out(params, key) <ide> end <ide> <ide> test "to_h returns empty hash on unpermitted params" do <del> assert @params.to_h.is_a? Hash <add> assert @params.to_h.is_a? ActiveSupport::HashWithIndifferentAccess <ide> assert_not @params.to_h.is_a? ActionController::Parameters <ide> assert @params.to_h.empty? <ide> end <ide> <ide> test "to_h returns converted hash on permitted params" do <ide> @params.permit! <ide> <del> assert @params.to_h.is_a? Hash <add> assert @params.to_h.is_a? ActiveSupport::HashWithIndifferentAccess <ide> assert_not @params.to_h.is_a? ActionController::Parameters <ide> end <ide> <ide> def assert_filtered_out(params, key) <ide> ActionController::Parameters.permit_all_parameters = true <ide> params = ActionController::Parameters.new(crab: "Senjougahara Hitagi") <ide> <del> assert params.to_h.is_a? Hash <add> assert params.to_h.is_a? ActiveSupport::HashWithIndifferentAccess <ide> assert_not @params.to_h.is_a? ActionController::Parameters <ide> assert_equal({ "crab" => "Senjougahara Hitagi" }, params.to_h) <ide> ensure <ide> def assert_filtered_out(params, key) <ide> end <ide> <ide> test "to_unsafe_h returns unfiltered params" do <del> assert @params.to_h.is_a? Hash <add> assert @params.to_h.is_a? ActiveSupport::HashWithIndifferentAccess <ide> assert_not @params.to_h.is_a? ActionController::Parameters <ide> end <ide> end
2
Java
Java
fix spel javabean compliance
1f28bdfbfa7f6f7025dac18bd5cdf4fdefb32950
<ide><path>spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java <ide> else if (canWrite(context, target, name)) { <ide> } <ide> <ide> /** <del> * Find a getter method for the specified property. A getter is defined as a method whose name start with the prefix <del> * 'get' and the rest of the name is the same as the property name (with the first character uppercased). <add> * Find a getter method for the specified property. <ide> */ <ide> protected Method findGetterForProperty(String propertyName, Class<?> clazz, boolean mustBeStatic) { <ide> Method[] ms = clazz.getMethods(); <add> String propertyWriteMethodSuffix; <add> if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { <add> propertyWriteMethodSuffix = propertyName; <add> } <add> else { <add> propertyWriteMethodSuffix = StringUtils.capitalize(propertyName); <add> } <ide> // Try "get*" method... <del> String getterName = "get" + StringUtils.capitalize(propertyName); <add> String getterName = "get" + propertyWriteMethodSuffix; <ide> for (Method method : ms) { <ide> if (method.getName().equals(getterName) && method.getParameterTypes().length == 0 && <ide> (!mustBeStatic || Modifier.isStatic(method.getModifiers()))) { <ide> return method; <ide> } <ide> } <ide> // Try "is*" method... <del> getterName = "is" + StringUtils.capitalize(propertyName); <add> getterName = "is" + propertyWriteMethodSuffix; <ide> for (Method method : ms) { <ide> if (method.getName().equals(getterName) && method.getParameterTypes().length == 0 && <ide> boolean.class.equals(method.getReturnType()) && <ide><path>spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java <ide> public void testReflectivePropertyResolver() throws Exception { <ide> // Assert.assertEquals(0,rpr.read(ctx,t,"field3").getValue()); <ide> Assert.assertEquals(false,rpr.read(ctx,t,"property4").getValue()); <ide> Assert.assertTrue(rpr.canRead(ctx,t,"property4")); <del> <add> <add> // repro SPR-9123, ReflectivePropertyAccessor JavaBean property names compliance tests <add> Assert.assertEquals("iD",rpr.read(ctx,t,"iD").getValue()); <add> Assert.assertTrue(rpr.canRead(ctx,t,"iD")); <add> Assert.assertEquals("id",rpr.read(ctx,t,"id").getValue()); <add> Assert.assertTrue(rpr.canRead(ctx,t,"id")); <add> Assert.assertEquals("ID",rpr.read(ctx,t,"ID").getValue()); <add> Assert.assertTrue(rpr.canRead(ctx,t,"ID")); <add> // note: "Id" is not a valid JavaBean name, nevertheless it is treated as "id" <add> Assert.assertEquals("id",rpr.read(ctx,t,"Id").getValue()); <add> Assert.assertTrue(rpr.canRead(ctx,t,"Id")); <ide> } <ide> <ide> @Test <ide> static class Tester { <ide> String property2; <ide> String property3 = "doodoo"; <ide> boolean property4 = false; <add> String iD = "iD"; <add> String id = "id"; <add> String ID = "ID"; <ide> <ide> public String getProperty() { return property; } <ide> public void setProperty(String value) { property = value; } <ide> static class Tester { <ide> public String getProperty3() { return property3; } <ide> <ide> public boolean isProperty4() { return property4; } <add> <add> public String getiD() { return iD; } <add> <add> public String getId() { return id; } <add> <add> public String getID() { return ID; } <ide> } <ide> <ide> static class Super {
2
Ruby
Ruby
allow an association as a scope parameter
5f472785fed770da77270300fb9ee5d7763ba7ac
<ide><path>activerecord/lib/active_record/validations/uniqueness.rb <ide> def validate_each(record, attribute, value) <ide> <ide> Array(options[:scope]).each do |scope_item| <ide> scope_value = record.send(scope_item) <add> reflection = record.class.reflect_on_association(scope_item) <add> if reflection <add> scope_value = record.send(reflection.foreign_key) <add> scope_item = reflection.foreign_key <add> end <ide> relation = relation.and(table[scope_item].eq(scope_value)) <ide> end <ide> <ide><path>activerecord/test/cases/validations/uniqueness_validation_test.rb <ide> def test_validate_uniqueness_with_scope <ide> assert r3.valid?, "Saving r3" <ide> end <ide> <add> def test_validate_uniqueness_with_object_scope <add> Reply.validates_uniqueness_of(:content, :scope => :topic) <add> <add> t = Topic.create("title" => "I'm unique!") <add> <add> r1 = t.replies.create "title" => "r1", "content" => "hello world" <add> assert r1.valid?, "Saving r1" <add> <add> r2 = t.replies.create "title" => "r2", "content" => "hello world" <add> assert !r2.valid?, "Saving r2 first time" <add> end <add> <ide> def test_validate_uniqueness_scoped_to_defining_class <ide> t = Topic.create("title" => "What, me worry?") <ide>
2
Ruby
Ruby
fix ambiguous params
c48352aa6ca409bcf2d05f7a046c264565243068
<ide><path>Library/Homebrew/cask/cmd/list.rb <ide> def list_installed <ide> elsif versions? <ide> puts installed_casks.map(&self.class.method(:format_versioned)) <ide> elsif full_name? <del> puts installed_casks.map(&:full_name).sort &tap_and_name_comparison <add> puts installed_casks.map(&:full_name).sort(&tap_and_name_comparison) <ide> elsif !installed_casks.empty? <ide> puts Formatter.columns(installed_casks.map(&:to_s)) <ide> end
1
Go
Go
fix tests with memory limit
0b8b8ed9e98a7355661f1aad93bfa0dd76362723
<ide><path>integration-cli/docker_cli_run_unix_test.go <ide> func (s *DockerSuite) TestRunEchoStdoutWitCPUShares(c *check.C) { <ide> func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *check.C) { <ide> testRequires(c, cpuShare) <ide> testRequires(c, memoryLimitSupport) <del> out, _ := dockerCmd(c, "run", "--cpu-shares", "1000", "-m", "16m", "busybox", "echo", "test") <add> out, _, _ := dockerCmdWithStdoutStderr(c, "run", "--cpu-shares", "1000", "-m", "16m", "busybox", "echo", "test") <ide> if out != "test\n" { <ide> c.Errorf("container should've printed 'test', got %q instead", out) <ide> } <ide> func (s *DockerSuite) TestRunOOMExitCode(c *check.C) { <ide> // "test" should be printed <ide> func (s *DockerSuite) TestRunEchoStdoutWithMemoryLimit(c *check.C) { <ide> testRequires(c, memoryLimitSupport) <del> out, _ := dockerCmd(c, "run", "-m", "16m", "busybox", "echo", "test") <add> out, _, _ := dockerCmdWithStdoutStderr(c, "run", "-m", "16m", "busybox", "echo", "test") <ide> out = strings.Trim(out, "\r\n") <ide> <ide> if expected := "test"; out != expected {
1
Ruby
Ruby
extract #values from missing
c4c855b9fc8695664a66dd7822a483b91e3e26e3
<ide><path>Library/Homebrew/cmd/missing.rb <ide> def missing <ide> ARGV.resolved_formulae <ide> end <ide> <del> hide = (ARGV.value("hide") || "").split(",") <del> <ide> ff.each do |f| <del> missing = f.missing_dependencies(hide: hide) <add> missing = f.missing_dependencies(hide: ARGV.values("hide")) <ide> next if missing.empty? <ide> <ide> print "#{f}: " if ff.size > 1 <ide><path>Library/Homebrew/extend/ARGV.rb <ide> def value(name) <ide> flag_with_value.strip_prefix(arg_prefix) if flag_with_value <ide> end <ide> <add> # Returns an array of values that were given as a comma-seperated list. <add> # @see value <add> def values(name) <add> return unless val = value(name) <add> val.split(",") <add> end <add> <ide> def force? <ide> flag? "--force" <ide> end <ide><path>Library/Homebrew/test/test_ARGV.rb <ide> def test_flag? <ide> assert [email protected]?("--frotz") <ide> assert [email protected]?("--debug") <ide> end <add> <add> def test_value <add> @argv << "--foo=" << "--bar=ab" <add> assert_equal "", @argv.value("foo") <add> assert_equal "ab", @argv.value("bar") <add> assert_nil @argv.value("baz") <add> end <add> <add> def test_values <add> @argv << "--foo=" << "--bar=a" << "--baz=b,c" <add> assert_equal [], @argv.values("foo") <add> assert_equal ["a"], @argv.values("bar") <add> assert_equal ["b", "c"], @argv.values("baz") <add> assert_nil @argv.values("qux") <add> end <ide> end
3
Python
Python
fix syntax error
359308eae810eee71ac31361155ce50c0f7abe09
<ide><path>celery/managers.py <ide> def get_waiting_tasks(self): <ide> for task_name, task in periodic_tasks.items(): <ide> task_meta, created = self.get_or_create(name=task_name) <ide> # task_run.every must be a timedelta object. <del> run_every_drifted = task.run_every + \ <del> timedelta(seconds=SERVER_DRIFT) <del> run_at = task_meta.last_run_at + task.run_every <add> run_every_drifted = task.run_every + SERVER_DRIFT <add> run_at = task_meta.last_run_at + run_every_drifted <ide> if datetime.now() > run_at: <ide> waiting.append(task_meta) <ide> return waiting
1
Ruby
Ruby
fix typo in caching docs. [marcel molina jr.]
08f40a5e061d51b0cb909bb1160ac03a3b47c232
<ide><path>actionpack/lib/action_controller/caching.rb <ide> def caching_allowed <ide> # "jamis.somewhere.com/lists/" -- which is a helpful way of assisting the subdomain-as-account-key pattern. <ide> # <ide> # Different representations of the same resource, e.g. <tt>http://david.somewhere.com/lists</tt> and <tt>http://david.somewhere.com/lists.xml</tt> <del> # are treated like separate requests and are so are cached separately. Keep in mine when expiring an action cache that <tt>:action => 'lists'</tt> is not the same <add> # are treated like separate requests and so are cached separately. Keep in mine when expiring an action cache that <tt>:action => 'lists'</tt> is not the same <ide> # as <tt>:action => 'list', :format => :xml</tt>. <ide> module Actions <ide> def self.included(base) #:nodoc:
1
Java
Java
add interruptible mode to schedulers.from
a85ddd154087f634c2834851acff87a02d39a061
<ide><path>src/main/java/io/reactivex/internal/schedulers/ExecutorScheduler.java <ide> import io.reactivex.internal.disposables.*; <ide> import io.reactivex.internal.functions.Functions; <ide> import io.reactivex.internal.queue.MpscLinkedQueue; <del>import io.reactivex.internal.schedulers.ExecutorScheduler.ExecutorWorker.BooleanRunnable; <add>import io.reactivex.internal.schedulers.ExecutorScheduler.ExecutorWorker.*; <ide> import io.reactivex.plugins.RxJavaPlugins; <ide> import io.reactivex.schedulers.*; <ide> <ide> */ <ide> public final class ExecutorScheduler extends Scheduler { <ide> <add> final boolean interruptibleWorker; <add> <ide> @NonNull <ide> final Executor executor; <ide> <ide> static final Scheduler HELPER = Schedulers.single(); <ide> <del> public ExecutorScheduler(@NonNull Executor executor) { <add> public ExecutorScheduler(@NonNull Executor executor, boolean interruptibleWorker) { <ide> this.executor = executor; <add> this.interruptibleWorker = interruptibleWorker; <ide> } <ide> <ide> @NonNull <ide> @Override <ide> public Worker createWorker() { <del> return new ExecutorWorker(executor); <add> return new ExecutorWorker(executor, interruptibleWorker); <ide> } <ide> <ide> @NonNull <ide> public Disposable scheduleDirect(@NonNull Runnable run) { <ide> return task; <ide> } <ide> <del> BooleanRunnable br = new BooleanRunnable(decoratedRun); <del> executor.execute(br); <del> return br; <add> if (interruptibleWorker) { <add> InterruptibleRunnable interruptibleTask = new InterruptibleRunnable(decoratedRun, null); <add> executor.execute(interruptibleTask); <add> return interruptibleTask; <add> } else { <add> BooleanRunnable br = new BooleanRunnable(decoratedRun); <add> executor.execute(br); <add> return br; <add> } <ide> } catch (RejectedExecutionException ex) { <ide> RxJavaPlugins.onError(ex); <ide> return EmptyDisposable.INSTANCE; <ide> public Disposable schedulePeriodicallyDirect(@NonNull Runnable run, long initial <ide> } <ide> /* public: test support. */ <ide> public static final class ExecutorWorker extends Scheduler.Worker implements Runnable { <add> <add> final boolean interruptibleWorker; <add> <ide> final Executor executor; <ide> <ide> final MpscLinkedQueue<Runnable> queue; <ide> public static final class ExecutorWorker extends Scheduler.Worker implements Run <ide> <ide> final CompositeDisposable tasks = new CompositeDisposable(); <ide> <del> public ExecutorWorker(Executor executor) { <add> public ExecutorWorker(Executor executor, boolean interruptibleWorker) { <ide> this.executor = executor; <ide> this.queue = new MpscLinkedQueue<Runnable>(); <add> this.interruptibleWorker = interruptibleWorker; <ide> } <ide> <ide> @NonNull <ide> public Disposable schedule(@NonNull Runnable run) { <ide> } <ide> <ide> Runnable decoratedRun = RxJavaPlugins.onSchedule(run); <del> BooleanRunnable br = new BooleanRunnable(decoratedRun); <ide> <del> queue.offer(br); <add> Runnable task; <add> Disposable disposable; <add> <add> if (interruptibleWorker) { <add> InterruptibleRunnable interruptibleTask = new InterruptibleRunnable(decoratedRun, tasks); <add> tasks.add(interruptibleTask); <add> <add> task = interruptibleTask; <add> disposable = interruptibleTask; <add> } else { <add> BooleanRunnable runnableTask = new BooleanRunnable(decoratedRun); <add> <add> task = runnableTask; <add> disposable = runnableTask; <add> } <add> <add> queue.offer(task); <ide> <ide> if (wip.getAndIncrement() == 0) { <ide> try { <ide> public Disposable schedule(@NonNull Runnable run) { <ide> } <ide> } <ide> <del> return br; <add> return disposable; <ide> } <ide> <ide> @NonNull <ide> public void run() { <ide> mar.replace(schedule(decoratedRun)); <ide> } <ide> } <add> <add> /** <add> * Wrapper for a {@link Runnable} with additional logic for handling interruption on <add> * a shared thread, similar to how Java Executors do it. <add> */ <add> static final class InterruptibleRunnable extends AtomicInteger implements Runnable, Disposable { <add> <add> private static final long serialVersionUID = -3603436687413320876L; <add> <add> final Runnable run; <add> <add> final DisposableContainer tasks; <add> <add> volatile Thread thread; <add> <add> static final int READY = 0; <add> <add> static final int RUNNING = 1; <add> <add> static final int FINISHED = 2; <add> <add> static final int INTERRUPTING = 3; <add> <add> static final int INTERRUPTED = 4; <add> <add> InterruptibleRunnable(Runnable run, DisposableContainer tasks) { <add> this.run = run; <add> this.tasks = tasks; <add> } <add> <add> @Override <add> public void run() { <add> if (get() == READY) { <add> thread = Thread.currentThread(); <add> if (compareAndSet(READY, RUNNING)) { <add> try { <add> run.run(); <add> } finally { <add> thread = null; <add> if (compareAndSet(RUNNING, FINISHED)) { <add> cleanup(); <add> } else { <add> while (get() == INTERRUPTING) { <add> Thread.yield(); <add> } <add> Thread.interrupted(); <add> } <add> } <add> } else { <add> thread = null; <add> } <add> } <add> } <add> <add> @Override <add> public void dispose() { <add> for (;;) { <add> int state = get(); <add> if (state >= FINISHED) { <add> break; <add> } else if (state == READY) { <add> if (compareAndSet(READY, INTERRUPTED)) { <add> cleanup(); <add> break; <add> } <add> } else { <add> if (compareAndSet(RUNNING, INTERRUPTING)) { <add> Thread t = thread; <add> if (t != null) { <add> t.interrupt(); <add> thread = null; <add> } <add> set(INTERRUPTED); <add> cleanup(); <add> break; <add> } <add> } <add> } <add> } <add> <add> void cleanup() { <add> if (tasks != null) { <add> tasks.delete(this); <add> } <add> } <add> <add> @Override <add> public boolean isDisposed() { <add> return get() >= FINISHED; <add> } <add> } <ide> } <ide> <ide> static final class DelayedRunnable extends AtomicReference<Runnable> <ide><path>src/main/java/io/reactivex/schedulers/Schedulers.java <ide> <ide> package io.reactivex.schedulers; <ide> <add>import java.util.concurrent.*; <add> <ide> import io.reactivex.Scheduler; <del>import io.reactivex.annotations.NonNull; <add>import io.reactivex.annotations.*; <ide> import io.reactivex.internal.schedulers.*; <ide> import io.reactivex.plugins.RxJavaPlugins; <ide> <del>import java.util.concurrent.*; <del> <ide> /** <ide> * Static factory methods for returning standard Scheduler instances. <ide> * <p> <ide> public static Scheduler single() { <ide> * a time delay or periodically will use the {@link #single()} scheduler for the timed waiting <ide> * before posting the actual task to the given executor. <ide> * <p> <add> * Tasks submitted to the {@link Scheduler.Worker} of this {@code Scheduler} are also not interruptible. Use the <add> * {@link #from(Executor, boolean)} overload to enable task interruption via this wrapper. <add> * <p> <ide> * If the provided executor supports the standard Java {@link ExecutorService} API, <ide> * cancelling tasks scheduled by this scheduler can be cancelled/interrupted by calling <ide> * {@link io.reactivex.disposables.Disposable#dispose()}. In addition, tasks scheduled with <ide> public static Scheduler single() { <ide> * } <ide> * </code></pre> <ide> * <p> <del> * This type of scheduler is less sensitive to leaking {@link io.reactivex.Scheduler.Worker} instances, although <add> * This type of scheduler is less sensitive to leaking {@link Scheduler.Worker} instances, although <ide> * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or <ide> * execute those tasks "unexpectedly". <ide> * <p> <ide> public static Scheduler single() { <ide> */ <ide> @NonNull <ide> public static Scheduler from(@NonNull Executor executor) { <del> return new ExecutorScheduler(executor); <add> return new ExecutorScheduler(executor, false); <add> } <add> <add> /** <add> * Wraps an {@link Executor} into a new Scheduler instance and delegates {@code schedule()} <add> * calls to it. <add> * <p> <add> * The tasks scheduled by the returned {@link Scheduler} and its {@link Scheduler.Worker} <add> * can be optionally interrupted. <add> * <p> <add> * If the provided executor doesn't support any of the more specific standard Java executor <add> * APIs, tasks scheduled with a time delay or periodically will use the <add> * {@link #single()} scheduler for the timed waiting <add> * before posting the actual task to the given executor. <add> * <p> <add> * If the provided executor supports the standard Java {@link ExecutorService} API, <add> * canceling tasks scheduled by this scheduler can be cancelled/interrupted by calling <add> * {@link io.reactivex.disposables.Disposable#dispose()}. In addition, tasks scheduled with <add> * a time delay or periodically will use the {@link #single()} scheduler for the timed waiting <add> * before posting the actual task to the given executor. <add> * <p> <add> * If the provided executor supports the standard Java {@link ScheduledExecutorService} API, <add> * canceling tasks scheduled by this scheduler can be cancelled/interrupted by calling <add> * {@link io.reactivex.disposables.Disposable#dispose()}. In addition, tasks scheduled with <add> * a time delay or periodically will use the provided executor. Note, however, if the provided <add> * {@code ScheduledExecutorService} instance is not single threaded, tasks scheduled <add> * with a time delay close to each other may end up executing in different order than <add> * the original schedule() call was issued. This limitation may be lifted in a future patch. <add> * <p> <add> * Starting, stopping and restarting this scheduler is not supported (no-op) and the provided <add> * executor's lifecycle must be managed externally: <add> * <pre><code> <add> * ExecutorService exec = Executors.newSingleThreadedExecutor(); <add> * try { <add> * Scheduler scheduler = Schedulers.from(exec, true); <add> * Flowable.just(1) <add> * .subscribeOn(scheduler) <add> * .map(v -&gt; v + 1) <add> * .observeOn(scheduler) <add> * .blockingSubscribe(System.out::println); <add> * } finally { <add> * exec.shutdown(); <add> * } <add> * </code></pre> <add> * <p> <add> * This type of scheduler is less sensitive to leaking {@link Scheduler.Worker} instances, although <add> * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or <add> * execute those tasks "unexpectedly". <add> * <p> <add> * Note that this method returns a new {@link Scheduler} instance, even for the same {@link Executor} instance. <add> * @param executor <add> * the executor to wrap <add> * @param interruptibleWorker if {@code true} the tasks submitted to the {@link Scheduler.Worker} will <add> * be interrupted when the task is disposed. <add> * @return the new Scheduler wrapping the Executor <add> * @since 2.2.6 - experimental <add> */ <add> @NonNull <add> @Experimental <add> public static Scheduler from(@NonNull Executor executor, boolean interruptibleWorker) { <add> return new ExecutorScheduler(executor, interruptibleWorker); <ide> } <ide> <ide> /** <ide><path>src/test/java/io/reactivex/schedulers/ExecutorSchedulerInterruptibleTest.java <add>/** <add> * Copyright (c) 2016-present, RxJava Contributors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. 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 distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add> <add>package io.reactivex.schedulers; <add> <add>import static org.junit.Assert.*; <add> <add>import java.lang.management.*; <add>import java.util.List; <add>import java.util.concurrent.*; <add>import java.util.concurrent.atomic.*; <add> <add>import org.junit.*; <add> <add>import io.reactivex.*; <add>import io.reactivex.Scheduler.Worker; <add>import io.reactivex.disposables.Disposable; <add>import io.reactivex.internal.disposables.EmptyDisposable; <add>import io.reactivex.internal.functions.Functions; <add>import io.reactivex.internal.schedulers.*; <add>import io.reactivex.plugins.RxJavaPlugins; <add> <add>public class ExecutorSchedulerInterruptibleTest extends AbstractSchedulerConcurrencyTests { <add> <add> static final Executor executor = Executors.newFixedThreadPool(2, new RxThreadFactory("TestCustomPool")); <add> <add> @Override <add> protected Scheduler getScheduler() { <add> return Schedulers.from(executor, true); <add> } <add> <add> @Test <add> @Ignore("Unhandled errors are no longer thrown") <add> public final void testUnhandledErrorIsDeliveredToThreadHandler() throws InterruptedException { <add> SchedulerTestHelper.testUnhandledErrorIsDeliveredToThreadHandler(getScheduler()); <add> } <add> <add> @Test <add> public final void testHandledErrorIsNotDeliveredToThreadHandler() throws InterruptedException { <add> SchedulerTestHelper.testHandledErrorIsNotDeliveredToThreadHandler(getScheduler()); <add> } <add> <add> public static void testCancelledRetention(Scheduler.Worker w, boolean periodic) throws InterruptedException { <add> System.out.println("Wait before GC"); <add> Thread.sleep(1000); <add> <add> System.out.println("GC"); <add> System.gc(); <add> <add> Thread.sleep(1000); <add> <add> MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); <add> MemoryUsage memHeap = memoryMXBean.getHeapMemoryUsage(); <add> long initial = memHeap.getUsed(); <add> <add> System.out.printf("Starting: %.3f MB%n", initial / 1024.0 / 1024.0); <add> <add> int n = 100 * 1000; <add> if (periodic) { <add> final CountDownLatch cdl = new CountDownLatch(n); <add> final Runnable action = new Runnable() { <add> @Override <add> public void run() { <add> cdl.countDown(); <add> } <add> }; <add> for (int i = 0; i < n; i++) { <add> if (i % 50000 == 0) { <add> System.out.println(" -> still scheduling: " + i); <add> } <add> w.schedulePeriodically(action, 0, 1, TimeUnit.DAYS); <add> } <add> <add> System.out.println("Waiting for the first round to finish..."); <add> cdl.await(); <add> } else { <add> for (int i = 0; i < n; i++) { <add> if (i % 50000 == 0) { <add> System.out.println(" -> still scheduling: " + i); <add> } <add> w.schedule(Functions.EMPTY_RUNNABLE, 1, TimeUnit.DAYS); <add> } <add> } <add> <add> memHeap = memoryMXBean.getHeapMemoryUsage(); <add> long after = memHeap.getUsed(); <add> System.out.printf("Peak: %.3f MB%n", after / 1024.0 / 1024.0); <add> <add> w.dispose(); <add> <add> System.out.println("Wait before second GC"); <add> System.out.println("JDK 6 purge is N log N because it removes and shifts one by one"); <add> int t = (int)(n * Math.log(n) / 100) + SchedulerPoolFactory.PURGE_PERIOD_SECONDS * 1000; <add> while (t > 0) { <add> System.out.printf(" >> Waiting for purge: %.2f s remaining%n", t / 1000d); <add> <add> System.gc(); <add> <add> Thread.sleep(1000); <add> <add> t -= 1000; <add> memHeap = memoryMXBean.getHeapMemoryUsage(); <add> long finish = memHeap.getUsed(); <add> System.out.printf("After: %.3f MB%n", finish / 1024.0 / 1024.0); <add> if (finish <= initial * 5) { <add> break; <add> } <add> } <add> <add> System.out.println("Second GC"); <add> System.gc(); <add> <add> Thread.sleep(1000); <add> <add> memHeap = memoryMXBean.getHeapMemoryUsage(); <add> long finish = memHeap.getUsed(); <add> System.out.printf("After: %.3f MB%n", finish / 1024.0 / 1024.0); <add> <add> if (finish > initial * 5) { <add> fail(String.format("Tasks retained: %.3f -> %.3f -> %.3f", initial / 1024 / 1024.0, after / 1024 / 1024.0, finish / 1024 / 1024d)); <add> } <add> } <add> <add> @Test(timeout = 60000) <add> public void testCancelledTaskRetention() throws InterruptedException { <add> ExecutorService exec = Executors.newSingleThreadExecutor(); <add> Scheduler s = Schedulers.from(exec, true); <add> try { <add> Scheduler.Worker w = s.createWorker(); <add> try { <add> testCancelledRetention(w, false); <add> } finally { <add> w.dispose(); <add> } <add> <add> w = s.createWorker(); <add> try { <add> testCancelledRetention(w, true); <add> } finally { <add> w.dispose(); <add> } <add> } finally { <add> exec.shutdownNow(); <add> } <add> } <add> <add> /** A simple executor which queues tasks and executes them one-by-one if executeOne() is called. */ <add> static final class TestExecutor implements Executor { <add> final ConcurrentLinkedQueue<Runnable> queue = new ConcurrentLinkedQueue<Runnable>(); <add> @Override <add> public void execute(Runnable command) { <add> queue.offer(command); <add> } <add> public void executeOne() { <add> Runnable r = queue.poll(); <add> if (r != null) { <add> r.run(); <add> } <add> } <add> public void executeAll() { <add> Runnable r; <add> while ((r = queue.poll()) != null) { <add> r.run(); <add> } <add> } <add> } <add> <add> @Test <add> public void testCancelledTasksDontRun() { <add> final AtomicInteger calls = new AtomicInteger(); <add> Runnable task = new Runnable() { <add> @Override <add> public void run() { <add> calls.getAndIncrement(); <add> } <add> }; <add> TestExecutor exec = new TestExecutor(); <add> Scheduler custom = Schedulers.from(exec, true); <add> Worker w = custom.createWorker(); <add> try { <add> Disposable d1 = w.schedule(task); <add> Disposable d2 = w.schedule(task); <add> Disposable d3 = w.schedule(task); <add> <add> d1.dispose(); <add> d2.dispose(); <add> d3.dispose(); <add> <add> exec.executeAll(); <add> <add> assertEquals(0, calls.get()); <add> } finally { <add> w.dispose(); <add> } <add> } <add> <add> @Test <add> public void testCancelledWorkerDoesntRunTasks() { <add> final AtomicInteger calls = new AtomicInteger(); <add> Runnable task = new Runnable() { <add> @Override <add> public void run() { <add> calls.getAndIncrement(); <add> } <add> }; <add> TestExecutor exec = new TestExecutor(); <add> Scheduler custom = Schedulers.from(exec, true); <add> Worker w = custom.createWorker(); <add> try { <add> w.schedule(task); <add> w.schedule(task); <add> w.schedule(task); <add> } finally { <add> w.dispose(); <add> } <add> exec.executeAll(); <add> assertEquals(0, calls.get()); <add> } <add> <add> // FIXME the internal structure changed and these can't be tested <add>// <add>// @Test <add>// public void testNoTimedTaskAfterScheduleRetention() throws InterruptedException { <add>// Executor e = new Executor() { <add>// @Override <add>// public void execute(Runnable command) { <add>// command.run(); <add>// } <add>// }; <add>// ExecutorWorker w = (ExecutorWorker)Schedulers.from(e, true).createWorker(); <add>// <add>// w.schedule(Functions.emptyRunnable(), 50, TimeUnit.MILLISECONDS); <add>// <add>// assertTrue(w.tasks.hasSubscriptions()); <add>// <add>// Thread.sleep(150); <add>// <add>// assertFalse(w.tasks.hasSubscriptions()); <add>// } <add>// <add>// @Test <add>// public void testNoTimedTaskPartRetention() { <add>// Executor e = new Executor() { <add>// @Override <add>// public void execute(Runnable command) { <add>// <add>// } <add>// }; <add>// ExecutorWorker w = (ExecutorWorker)Schedulers.from(e, true).createWorker(); <add>// <add>// Disposable task = w.schedule(Functions.emptyRunnable(), 1, TimeUnit.DAYS); <add>// <add>// assertTrue(w.tasks.hasSubscriptions()); <add>// <add>// task.dispose(); <add>// <add>// assertFalse(w.tasks.hasSubscriptions()); <add>// } <add>// <add>// @Test <add>// public void testNoPeriodicTimedTaskPartRetention() throws InterruptedException { <add>// Executor e = new Executor() { <add>// @Override <add>// public void execute(Runnable command) { <add>// command.run(); <add>// } <add>// }; <add>// ExecutorWorker w = (ExecutorWorker)Schedulers.from(e, true).createWorker(); <add>// <add>// final CountDownLatch cdl = new CountDownLatch(1); <add>// final Runnable action = new Runnable() { <add>// @Override <add>// public void run() { <add>// cdl.countDown(); <add>// } <add>// }; <add>// <add>// Disposable task = w.schedulePeriodically(action, 0, 1, TimeUnit.DAYS); <add>// <add>// assertTrue(w.tasks.hasSubscriptions()); <add>// <add>// cdl.await(); <add>// <add>// task.dispose(); <add>// <add>// assertFalse(w.tasks.hasSubscriptions()); <add>// } <add> <add> @Test <add> public void plainExecutor() throws Exception { <add> Scheduler s = Schedulers.from(new Executor() { <add> @Override <add> public void execute(Runnable r) { <add> r.run(); <add> } <add> }, true); <add> <add> final CountDownLatch cdl = new CountDownLatch(5); <add> <add> Runnable r = new Runnable() { <add> @Override <add> public void run() { <add> cdl.countDown(); <add> } <add> }; <add> <add> s.scheduleDirect(r); <add> <add> s.scheduleDirect(r, 50, TimeUnit.MILLISECONDS); <add> <add> Disposable d = s.schedulePeriodicallyDirect(r, 10, 10, TimeUnit.MILLISECONDS); <add> <add> try { <add> assertTrue(cdl.await(5, TimeUnit.SECONDS)); <add> } finally { <add> d.dispose(); <add> } <add> <add> assertTrue(d.isDisposed()); <add> } <add> <add> @Test <add> public void rejectingExecutor() { <add> ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); <add> exec.shutdown(); <add> <add> Scheduler s = Schedulers.from(exec, true); <add> <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> <add> try { <add> assertSame(EmptyDisposable.INSTANCE, s.scheduleDirect(Functions.EMPTY_RUNNABLE)); <add> <add> assertSame(EmptyDisposable.INSTANCE, s.scheduleDirect(Functions.EMPTY_RUNNABLE, 10, TimeUnit.MILLISECONDS)); <add> <add> assertSame(EmptyDisposable.INSTANCE, s.schedulePeriodicallyDirect(Functions.EMPTY_RUNNABLE, 10, 10, TimeUnit.MILLISECONDS)); <add> <add> TestHelper.assertUndeliverable(errors, 0, RejectedExecutionException.class); <add> TestHelper.assertUndeliverable(errors, 1, RejectedExecutionException.class); <add> TestHelper.assertUndeliverable(errors, 2, RejectedExecutionException.class); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void rejectingExecutorWorker() { <add> ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); <add> exec.shutdown(); <add> <add> List<Throwable> errors = TestHelper.trackPluginErrors(); <add> <add> try { <add> Worker s = Schedulers.from(exec, true).createWorker(); <add> assertSame(EmptyDisposable.INSTANCE, s.schedule(Functions.EMPTY_RUNNABLE)); <add> <add> s = Schedulers.from(exec, true).createWorker(); <add> assertSame(EmptyDisposable.INSTANCE, s.schedule(Functions.EMPTY_RUNNABLE, 10, TimeUnit.MILLISECONDS)); <add> <add> s = Schedulers.from(exec, true).createWorker(); <add> assertSame(EmptyDisposable.INSTANCE, s.schedulePeriodically(Functions.EMPTY_RUNNABLE, 10, 10, TimeUnit.MILLISECONDS)); <add> <add> TestHelper.assertUndeliverable(errors, 0, RejectedExecutionException.class); <add> TestHelper.assertUndeliverable(errors, 1, RejectedExecutionException.class); <add> TestHelper.assertUndeliverable(errors, 2, RejectedExecutionException.class); <add> } finally { <add> RxJavaPlugins.reset(); <add> } <add> } <add> <add> @Test <add> public void reuseScheduledExecutor() throws Exception { <add> ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); <add> <add> try { <add> Scheduler s = Schedulers.from(exec, true); <add> <add> final CountDownLatch cdl = new CountDownLatch(8); <add> <add> Runnable r = new Runnable() { <add> @Override <add> public void run() { <add> cdl.countDown(); <add> } <add> }; <add> <add> s.scheduleDirect(r); <add> <add> s.scheduleDirect(r, 10, TimeUnit.MILLISECONDS); <add> <add> Disposable d = s.schedulePeriodicallyDirect(r, 10, 10, TimeUnit.MILLISECONDS); <add> <add> try { <add> assertTrue(cdl.await(5, TimeUnit.SECONDS)); <add> } finally { <add> d.dispose(); <add> } <add> } finally { <add> exec.shutdown(); <add> } <add> } <add> <add> @Test <add> public void reuseScheduledExecutorAsWorker() throws Exception { <add> ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); <add> <add> Worker s = Schedulers.from(exec, true).createWorker(); <add> <add> assertFalse(s.isDisposed()); <add> try { <add> <add> final CountDownLatch cdl = new CountDownLatch(8); <add> <add> Runnable r = new Runnable() { <add> @Override <add> public void run() { <add> cdl.countDown(); <add> } <add> }; <add> <add> s.schedule(r); <add> <add> s.schedule(r, 10, TimeUnit.MILLISECONDS); <add> <add> Disposable d = s.schedulePeriodically(r, 10, 10, TimeUnit.MILLISECONDS); <add> <add> try { <add> assertTrue(cdl.await(5, TimeUnit.SECONDS)); <add> } finally { <add> d.dispose(); <add> } <add> } finally { <add> s.dispose(); <add> exec.shutdown(); <add> } <add> <add> assertTrue(s.isDisposed()); <add> } <add> <add> @Test <add> public void disposeRace() { <add> ExecutorService exec = Executors.newSingleThreadExecutor(); <add> final Scheduler s = Schedulers.from(exec, true); <add> try { <add> for (int i = 0; i < 500; i++) { <add> final Worker w = s.createWorker(); <add> <add> final AtomicInteger c = new AtomicInteger(2); <add> <add> w.schedule(new Runnable() { <add> @Override <add> public void run() { <add> c.decrementAndGet(); <add> while (c.get() != 0) { } <add> } <add> }); <add> <add> c.decrementAndGet(); <add> while (c.get() != 0) { } <add> w.dispose(); <add> } <add> } finally { <add> exec.shutdownNow(); <add> } <add> } <add> <add> @Test <add> public void runnableDisposed() { <add> final Scheduler s = Schedulers.from(new Executor() { <add> @Override <add> public void execute(Runnable r) { <add> r.run(); <add> } <add> }, true); <add> Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE); <add> <add> assertTrue(d.isDisposed()); <add> } <add> <add> @Test(timeout = 1000) <add> public void runnableDisposedAsync() throws Exception { <add> final Scheduler s = Schedulers.from(new Executor() { <add> @Override <add> public void execute(Runnable r) { <add> new Thread(r).start(); <add> } <add> }, true); <add> Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE); <add> <add> while (!d.isDisposed()) { <add> Thread.sleep(1); <add> } <add> } <add> <add> @Test(timeout = 1000) <add> public void runnableDisposedAsync2() throws Exception { <add> final Scheduler s = Schedulers.from(executor, true); <add> Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE); <add> <add> while (!d.isDisposed()) { <add> Thread.sleep(1); <add> } <add> } <add> <add> @Test(timeout = 1000) <add> public void runnableDisposedAsyncCrash() throws Exception { <add> final Scheduler s = Schedulers.from(new Executor() { <add> @Override <add> public void execute(Runnable r) { <add> new Thread(r).start(); <add> } <add> }, true); <add> Disposable d = s.scheduleDirect(new Runnable() { <add> @Override <add> public void run() { <add> throw new IllegalStateException(); <add> } <add> }); <add> <add> while (!d.isDisposed()) { <add> Thread.sleep(1); <add> } <add> } <add> <add> @Test(timeout = 1000) <add> public void runnableDisposedAsyncTimed() throws Exception { <add> final Scheduler s = Schedulers.from(new Executor() { <add> @Override <add> public void execute(Runnable r) { <add> new Thread(r).start(); <add> } <add> }, true); <add> Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS); <add> <add> while (!d.isDisposed()) { <add> Thread.sleep(1); <add> } <add> } <add> <add> @Test(timeout = 1000) <add> public void runnableDisposedAsyncTimed2() throws Exception { <add> ExecutorService executorScheduler = Executors.newScheduledThreadPool(1, new RxThreadFactory("TestCustomPoolTimed")); <add> try { <add> final Scheduler s = Schedulers.from(executorScheduler, true); <add> Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS); <add> <add> while (!d.isDisposed()) { <add> Thread.sleep(1); <add> } <add> } finally { <add> executorScheduler.shutdownNow(); <add> } <add> } <add> <add> @Test <add> public void unwrapScheduleDirectTaskAfterDispose() { <add> Scheduler scheduler = getScheduler(); <add> final CountDownLatch cdl = new CountDownLatch(1); <add> Runnable countDownRunnable = new Runnable() { <add> @Override <add> public void run() { <add> cdl.countDown(); <add> } <add> }; <add> Disposable disposable = scheduler.scheduleDirect(countDownRunnable, 100, TimeUnit.MILLISECONDS); <add> SchedulerRunnableIntrospection wrapper = (SchedulerRunnableIntrospection) disposable; <add> assertSame(countDownRunnable, wrapper.getWrappedRunnable()); <add> disposable.dispose(); <add> <add> assertSame(Functions.EMPTY_RUNNABLE, wrapper.getWrappedRunnable()); <add> } <add> <add> @Test(timeout = 10000) <add> public void interruptibleDirectTask() throws Exception { <add> Scheduler scheduler = getScheduler(); <add> <add> final AtomicInteger sync = new AtomicInteger(2); <add> <add> final AtomicBoolean isInterrupted = new AtomicBoolean(); <add> <add> Disposable d = scheduler.scheduleDirect(new Runnable() { <add> @Override <add> public void run() { <add> if (sync.decrementAndGet() != 0) { <add> while (sync.get() != 0) { } <add> } <add> try { <add> Thread.sleep(1000); <add> } catch (InterruptedException ex) { <add> isInterrupted.set(true); <add> } <add> } <add> }); <add> <add> if (sync.decrementAndGet() != 0) { <add> while (sync.get() != 0) { } <add> } <add> <add> Thread.sleep(500); <add> <add> d.dispose(); <add> <add> int i = 20; <add> while (i-- > 0 && !isInterrupted.get()) { <add> Thread.sleep(50); <add> } <add> <add> assertTrue("Interruption did not propagate", isInterrupted.get()); <add> } <add> <add> @Test(timeout = 10000) <add> public void interruptibleWorkerTask() throws Exception { <add> Scheduler scheduler = getScheduler(); <add> <add> Worker worker = scheduler.createWorker(); <add> <add> try { <add> final AtomicInteger sync = new AtomicInteger(2); <add> <add> final AtomicBoolean isInterrupted = new AtomicBoolean(); <add> <add> Disposable d = worker.schedule(new Runnable() { <add> @Override <add> public void run() { <add> if (sync.decrementAndGet() != 0) { <add> while (sync.get() != 0) { } <add> } <add> try { <add> Thread.sleep(1000); <add> } catch (InterruptedException ex) { <add> isInterrupted.set(true); <add> } <add> } <add> }); <add> <add> if (sync.decrementAndGet() != 0) { <add> while (sync.get() != 0) { } <add> } <add> <add> Thread.sleep(500); <add> <add> d.dispose(); <add> <add> int i = 20; <add> while (i-- > 0 && !isInterrupted.get()) { <add> Thread.sleep(50); <add> } <add> <add> assertTrue("Interruption did not propagate", isInterrupted.get()); <add> } finally { <add> worker.dispose(); <add> } <add> } <add>}
3
Javascript
Javascript
exclude the e2e test that fails on safari
729129b461f5175c7650599d528f4f58a5544aec
<ide><path>src/ng/filter/limitTo.js <ide> 'use strict'; <ide> <del>/** <add>* <ide> * @ngdoc filter <ide> * @name limitTo <ide> * @kind function <ide> }); <ide> <ide> // There is a bug in safari and protractor that doesn't like the minus key <del> xit('should update the output when -3 is entered', function() { <del> numLimitInput.clear(); <del> numLimitInput.sendKeys('-3'); <del> letterLimitInput.clear(); <del> letterLimitInput.sendKeys('-3'); <del> longNumberLimitInput.clear(); <del> longNumberLimitInput.sendKeys('-3'); <del> expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]'); <del> expect(limitedLetters.getText()).toEqual('Output letters: ghi'); <del> expect(limitedLongNumber.getText()).toEqual('Output long number: 342'); <del> }); <add> // it('should update the output when -3 is entered', function() { <add> // numLimitInput.clear(); <add> // numLimitInput.sendKeys('-3'); <add> // letterLimitInput.clear(); <add> // letterLimitInput.sendKeys('-3'); <add> // longNumberLimitInput.clear(); <add> // longNumberLimitInput.sendKeys('-3'); <add> // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]'); <add> // expect(limitedLetters.getText()).toEqual('Output letters: ghi'); <add> // expect(limitedLongNumber.getText()).toEqual('Output long number: 342'); <add> // }); <ide> <ide> it('should not exceed the maximum size of input array', function() { <ide> numLimitInput.clear(); <ide> }); <ide> </file> <ide> </example> <del> */ <add> <ide> function limitToFilter(){ <ide> return function(input, limit) { <ide> if (isNumber(input)) input = input.toString();
1
Text
Text
remove unnecessary comments
c4ba0c692fb3a3825d56bee7724f7bb3eb03ad7a
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md <ide> ourPets[1].names[0]; <ide> <ide> # --instructions-- <ide> <del>Retrieve the second tree from the variable `myPlants` using object dot and array bracket notation. <add>Using dot and bracket notation, set the variable `secondTree` to the second item in the `trees` list from the `myPlants` object. <ide> <ide> # --hints-- <ide> <ide> assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); <ide> ## --seed-contents-- <ide> <ide> ```js <del>// Setup <ide> var myPlants = [ <ide> { <ide> type: "flowers", <ide> var myPlants = [ <ide> } <ide> ]; <ide> <del>// Only change code below this line <del> <del>var secondTree = ""; // Change this line <add>var secondTree = ""; <ide> ``` <ide> <ide> # --solutions-- <ide> var myPlants = [ <ide> } <ide> ]; <ide> <del>// Only change code below this line <del> <ide> var secondTree = myPlants[1].list[1]; <ide> ```
1
Python
Python
remove extraneous import statements
2644e8904de282dc455f69716dfb0556e9a59478
<ide><path>celery/datastructures.py <ide> Custom Datastructures <ide> <ide> """ <del>import multiprocessing <del>from multiprocessing.pool import RUN as POOL_STATE_RUN <del>import itertools <del>import threading <del>import time <del>import os <del>import traceback <ide> from UserList import UserList <del>from celery.timer import TimeoutTimer, TimeoutError <del>from celery.conf import REAP_TIMEOUT, SEND_CELERY_TASK_ERROR_EMAILS <del> <del>from django.core.mail import mail_admins <add>import traceback <ide> <ide> <ide> class PositionQueue(UserList):
1
Python
Python
add __main__ to the pricing test
2e2e7e6c86abcdf414848708a246ecc2f2436685
<ide><path>test/test_pricing.py <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <ide> <add>import sys <ide> import unittest <ide> <ide> import libcloud.pricing <ide> def test_set_pricing(self): <ide> pricing={'foo': 1}) <ide> self.assertTrue('foo' in libcloud.pricing.PRICING_DATA['compute']) <ide> <add>if __name__ == '__main__': <add> sys.exit(unittest.main()) <add>
1
Python
Python
add color to pytest tests on ci
6ed3f5d97fe8f8967df5624f62e69ce2a58a9413
<ide><path>scripts/ci/images/ci_run_docker_tests.py <ide> def main(): <ide> if not extra_pytest_args: <ide> raise SystemExit("You must select the tests to run.") <ide> <del> pytest_args = ( <del> "-n", <del> "auto", <del> ) <add> pytest_args = ("-n", "auto", "--color=yes") <ide> <ide> run_verbose([str(python_bin), "-m", "pytest", *pytest_args, *extra_pytest_args]) <ide>
1
Javascript
Javascript
fix portable extraction for beta
590b64a34b6e1bcd1d9e5d0242edd3282d52abeb
<ide><path>script/lib/create-windows-installer.js <ide> module.exports = function (packagedAppPath, codeSign) { <ide> for (let nupkgPath of glob.sync(`${CONFIG.buildOutputPath}/*-full.nupkg`)) { <ide> if (nupkgPath.includes(CONFIG.appMetadata.version)) { <ide> console.log(`Extracting signed executables from ${nupkgPath} for use in portable zip`) <del> var atomOutPath = path.join(path.dirname(packagedAppPath), 'Atom') <del> spawnSync('7z.exe', ['e', nupkgPath, 'lib\\net45\\*.exe', '-aoa'], {cwd: atomOutPath}) <del> spawnSync(process.env.COMSPEC, ['/c', `move /y ${path.join(atomOutPath, 'squirrel.exe')} ${path.join(atomOutPath, 'update.exe')}`]) <add> spawnSync('7z.exe', ['e', nupkgPath, 'lib\\net45\\*.exe', '-aoa', `-o"${packagedAppPath}"`]) <add> spawnSync(process.env.COMSPEC, ['/c', `move /y "${path.join(packagedAppPath, 'squirrel.exe')}" "${path.join(packagedAppPath, 'update.exe')}"`]) <ide> return <ide> } <ide> }
1
Text
Text
correct patrons.md entry
0562ee431910a6639f37c7f2691dd1e4f56e4403
<ide><path>PATRONS.md <ide> Meet some of the outstanding companies and individuals that made it possible: <ide> <ide> * [Webflow](https://github.com/webflow) <ide> * [Ximedes](https://www.ximedes.com/) <del>* [Herman J. Radtke III](http://hermanradtke.com) <add>* [HauteLook](http://hautelook.github.io/) <ide> * [Ken Wheeler](http://kenwheeler.github.io/) <ide> * [Chung Yen Li](https://www.facebook.com/prototocal.lee) <ide> * [Sunil Pai](https://twitter.com/threepointone)
1
Ruby
Ruby
remove another unnecessary default argument
af804f74759c44f220b4d88b1c0b27218f33110e
<ide><path>Library/Homebrew/formula.rb <ide> def skip_clean_paths <ide> @skip_clean_paths ||= Set.new <ide> end <ide> <del> def keg_only reason, explanation=nil <del> @keg_only_reason = KegOnlyReason.new(reason, explanation.to_s.chomp) <add> def keg_only reason, explanation="" <add> @keg_only_reason = KegOnlyReason.new(reason, explanation) <ide> end <ide> <ide> # Flag for marking whether this formula needs C++ standard library <ide><path>Library/Homebrew/formula_support.rb <ide> # Used to annotate formulae that duplicate OS X provided software <ide> # or cause conflicts when linked in. <ide> class KegOnlyReason <del> attr_reader :reason, :explanation <del> <del> def initialize reason, explanation=nil <add> def initialize(reason, explanation) <ide> @reason = reason <ide> @explanation = explanation <ide> end <ide> def to_s <ide> #{@explanation} <ide> EOS <ide> when :provided_until_xcode43 <del> "Xcode provides this software prior to version 4.3.\n\n#{explanation}" <add> "Xcode provides this software prior to version 4.3.\n\n#{@explanation}" <ide> when :provided_until_xcode5 <del> "Xcode provides this software prior to version 5.\n\n#{explanation}" <add> "Xcode provides this software prior to version 5.\n\n#{@explanation}" <ide> else <ide> @reason <ide> end.strip
2
Python
Python
fix minor typo
15d8af52dbb091f198664bedc5dfc3d5d9ffdea0
<ide><path>flask/app.py <ide> def make_null_session(self): <ide> return self.session_interface.make_null_session(self) <ide> <ide> def register_module(self, module, **options): <del> """Registers a module with this application. The keyword argument <add> """Registers a module with this application. The keyword arguments <ide> of this function are the same as the ones for the constructor of the <ide> :class:`Module` class and will override the values of the module if <ide> provided.
1
Python
Python
fix a writing issue in the comments of trainer.py
70d5711848676321928be5f8b14f8a2ae1e759a5
<ide><path>src/transformers/trainer.py <ide> class Trainer: <ide> detailed in :doc:`here <callback>`. <ide> <ide> If you want to remove one of the default callbacks used, use the :meth:`Trainer.remove_callback` method. <del> optimizers (:obj:`Tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR`, `optional`): A tuple <add> optimizers (:obj:`Tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR]`, `optional`): A tuple <ide> containing the optimizer and the scheduler to use. Will default to an instance of <ide> :class:`~transformers.AdamW` on your model and a scheduler given by <ide> :func:`~transformers.get_linear_schedule_with_warmup` controlled by :obj:`args`.
1
Go
Go
copy values out of hostconfig
ddb2086ca9e0991ca12e0771a0e581e782c57f50
<ide><path>daemon/container.go <ide> func (container *Container) allocateNetwork() error { <ide> if container.Config.ExposedPorts != nil { <ide> portSpecs = container.Config.ExposedPorts <ide> } <add> <ide> if container.hostConfig.PortBindings != nil { <del> bindings = container.hostConfig.PortBindings <add> for p, b := range container.hostConfig.PortBindings { <add> bindings[p] = []nat.PortBinding{} <add> for _, bb := range b { <add> bindings[p] = append(bindings[p], nat.PortBinding{ <add> HostIp: bb.HostIp, <add> HostPort: bb.HostPort, <add> }) <add> } <add> } <ide> } <ide> <ide> container.NetworkSettings.PortMapping = nil
1
Javascript
Javascript
reduce ga events to stay within limits (#157)
8635f8bdee2208e89b7b9d9f3e13bd9dd24294fb
<ide><path>packages/learn/src/analytics/analytics-epic.js <del>import { tap, ignoreElements } from 'rxjs/operators'; <del> <del>import ga from './'; <del> <del>export default function analyticsEpic(action$) { <del> return action$.pipe( <del> tap(({ type }) => { <del> ga.event({ <del> category: 'Redux Action', <del> action: type <del> }); <del> }), <del> ignoreElements() <del> ); <del>} <ide><path>packages/learn/src/redux/store.js <ide> import { routerReducer as router, routerMiddleware } from 'react-router-redux'; <ide> <ide> import { reducer as formReducer } from 'redux-form'; <ide> <del>import analyticsEpic from '../analytics/analytics-epic'; <ide> import { reducer as app, epics as appEpics } from './app'; <ide> import { <ide> reducer as challenge, <ide> const rootReducer = combineReducers({ <ide> router <ide> }); <ide> <del>const rootEpic = combineEpics(analyticsEpic, ...appEpics, ...challengeEpics); <add>const rootEpic = combineEpics(...appEpics, ...challengeEpics); <ide> <ide> const epicMiddleware = createEpicMiddleware(rootEpic, { <ide> dependencies: {
2
PHP
PHP
prevent undefined index error baking a new project
a0fce70c13fce9bf6f875460e144f283a2a885a7
<ide><path>lib/Cake/Console/Command/Task/ProjectTask.php <ide> public function execute() { <ide> * @access private <ide> */ <ide> function bake($path, $skel = null, $skip = array('empty')) { <del> if (!$skel) { <add> if (!$skel && !empty($this->params['skel'])) { <ide> $skel = $this->params['skel']; <ide> } <ide> while (!$skel) { <ide> public function getOptionParser() { <ide> )); <ide> } <ide> <del>} <add>} <ide>\ No newline at end of file
1
Python
Python
add xfail tests for token.conjuncts
db79a704bf923602597a933a127fcdca1fc5edfc
<ide><path>spacy/tests/doc/test_token_api.py <ide> def test_token0_has_sent_start_true(): <ide> assert doc[0].is_sent_start is True <ide> assert doc[1].is_sent_start is None <ide> assert not doc.is_sentenced <add> <add> <add>@pytest.mark.xfail <add>def test_token_api_conjuncts_chain(en_vocab): <add> words = "The boy and the girl and the man went .".split() <add> heads = [1, 7, -1, 1, -3, -1, 1, -3, 0, -1] <add> deps = ["det", "nsubj", "cc", "det", "conj", "cc", "det", "conj", "ROOT", "punct"] <add> doc = get_doc(en_vocab, words=words, heads=heads, deps=deps) <add> assert [w.text for w in doc[1].conjuncts] == ["girl", "man"] <add> assert [w.text for w in doc[4].conjuncts] == ["boy", "man"] <add> assert [w.text for w in doc[7].conjuncts] == ["boy", "girl"] <add> <add> <add>@pytest.mark.xfail <add>def test_token_api_conjuncts_simple(en_vocab): <add> words = "They came and went .".split() <add> heads = [1, 0, -1, -2, -1] <add> deps = ["nsubj", "ROOT", "cc", "conj"] <add> doc = get_doc(en_vocab, words=words, heads=heads, deps=deps) <add> assert [w.text for w in doc[1].conjuncts] == ["went"] <add> assert [w.text for w in doc[3].conjuncts] == ["came"] <add> <add> <add>@pytest.mark.xfail <add>def test_token_api_non_conjuncts(en_vocab): <add> words = "They came .".split() <add> heads = [1, 0, -1] <add> deps = ["nsubj", "ROOT", "punct"] <add> doc = get_doc(en_vocab, words=words, heads=heads, deps=deps) <add> assert [w.text for w in doc[0].conjuncts] == [] <add> assert [w.text for w in doc[1].conjuncts] == []
1
Text
Text
update webpack website in readme
01819bc3bcc44282e5bb9301c3478d837d1e5152
<ide><path>build/fixtures/README.md <ide> import $ from "jquery"; <ide> <ide> #### Browserify/Webpack <ide> <del>There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.github.io/). For more information on using these tools, please refer to the corresponding project's documentation. In the script, including jQuery will usually look like this... <add>There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.js.org/). For more information on using these tools, please refer to the corresponding project's documentation. In the script, including jQuery will usually look like this... <ide> <ide> ```js <ide> var $ = require( "jquery" );
1
Javascript
Javascript
fix deprecation warnings 3d3327c brought to light
a310f8ccc287026017b491d6101d68587cf9af82
<ide><path>packages/container/tests/sub_container_test.js <ide> module("Container (sub-containers)", { <ide> container = new Container(); <ide> var PostController = factory(); <ide> <del> container.register('controller', 'post', PostController); <add> container.register('controller:post', PostController); <ide> }, <ide> <ide> teardown: function() { <ide><path>packages/ember-application/lib/system/application.js <ide> var get = Ember.get, set = Ember.set, <ide> name: "store", <ide> <ide> initialize: function(container, application) { <del> container.register('store', 'main', application.Store); <add> container.register('store:main', application.Store); <ide> } <ide> }); <ide> ``` <ide> var Application = Ember.Application = Ember.Namespace.extend({ <ide> this.isInitialized = true; <ide> <ide> // At this point, the App.Router must already be assigned <del> this.register('router', 'main', this.Router); <add> this.register('router:main', this.Router); <ide> <ide> this.runInitializers(); <ide> Ember.runLoadHooks('application', this); <ide> Ember.Application.reopenClass({ <ide> container.resolver = resolverFor(namespace); <ide> container.optionsForType('view', { singleton: false }); <ide> container.optionsForType('template', { instantiate: false }); <del> container.register('application', 'main', namespace, { instantiate: false }); <add> container.register('application:main', namespace, { instantiate: false }); <ide> <ide> container.register('controller:basic', Ember.Controller, { instantiate: false }); <ide> container.register('controller:object', Ember.ObjectController, { instantiate: false }); <ide><path>packages/ember-application/tests/system/application_test.js <ide> test('initialized application go to initial route', function() { <ide> location: 'none' <ide> }); <ide> <del> app.register('template', 'application', <add> app.register('template:application', <ide> Ember.Handlebars.compile("{{outlet}}") <ide> ); <ide> <ide> test("initialize application with stateManager via initialize call from Router c <ide> location: 'none' <ide> }); <ide> <del> app.register('template', 'application', function() { <add> app.register('template:application', function() { <ide> return "<h1>Hello!</h1>"; <ide> }); <ide> }); <ide><path>packages/ember-application/tests/system/controller_test.js <ide> module("Controller dependencies"); <ide> test("If a controller specifies a dependency, it is accessible", function() { <ide> var container = new Ember.Container(); <ide> <del> container.register('controller', 'post', Ember.Controller.extend({ <add> container.register('controller:post', Ember.Controller.extend({ <ide> needs: 'posts' <ide> })); <ide> <del> container.register('controller', 'posts', Ember.Controller.extend()); <add> container.register('controller:posts', Ember.Controller.extend()); <ide> <ide> var postController = container.lookup('controller:post'), <ide> postsController = container.lookup('controller:posts'); <ide> test("If a controller specifies a dependency, it is accessible", function() { <ide> test("If a controller specifies an unavailable dependency, it raises", function() { <ide> var container = new Ember.Container(); <ide> <del> container.register('controller', 'post', Ember.Controller.extend({ <add> container.register('controller:post', Ember.Controller.extend({ <ide> needs: 'posts' <ide> })); <ide> <ide><path>packages/ember-handlebars/tests/handlebars_test.js <ide> module("Ember.View - handlebars integration", { <ide> }); <ide> <ide> test("template view should call the function of the associated template", function() { <del> container.register('template', 'testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called</h1>")); <add> container.register('template:testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called</h1>")); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("template view should call the function of the associated template", functi <ide> }); <ide> <ide> test("template view should call the function of the associated template with itself as the context", function() { <del> container.register('template', 'testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called for {{view.personName}}. Yea {{view.personName}}</h1>")); <add> container.register('template:testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called for {{view.personName}}. Yea {{view.personName}}</h1>")); <ide> <ide> view = Ember.View.createWithMixins({ <ide> container: container, <ide> test("should not escape HTML if string is a Handlebars.SafeString", function() { <ide> }); <ide> <ide> test("child views can be inserted using the {{view}} Handlebars helper", function() { <del> container.register('template', 'nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.LabelView\"}}")); <del> container.register('template', 'nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{cruel}} {{world}}</div>")); <add> container.register('template:nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.LabelView\"}}")); <add> container.register('template:nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{cruel}} {{world}}</div>")); <ide> <ide> var context = { <ide> world: "world!" <ide> test("should accept relative paths to views", function() { <ide> }); <ide> <ide> test("child views can be inserted inside a bind block", function() { <del> container.register('template', 'nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.BQView\"}}")); <del> container.register('template', 'nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{#with content}}{{blah}} {{view \"TemplateTests.OtherView\"}}{{/with}} {{world}}</div>")); <del> container.register('template', 'other', Ember.Handlebars.compile("cruel")); <add> container.register('template:nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.BQView\"}}")); <add> container.register('template:nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{#with content}}{{blah}} {{view \"TemplateTests.OtherView\"}}{{/with}} {{world}}</div>")); <add> container.register('template:other', Ember.Handlebars.compile("cruel")); <ide> <ide> var context = { <ide> world: "world!" <ide> test("Ember.View should bind properties in the grandparent context", function() <ide> }); <ide> <ide> test("Ember.View should update when a property changes and the bind helper is used", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{bind "wham"}}{{/with}}</h1>')); <add> container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{bind "wham"}}{{/with}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("Ember.View should update when a property changes and the bind helper is us <ide> }); <ide> <ide> test("Ember.View should not use keyword incorrectly - Issue #1315", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('{{#each value in view.content}}{{value}}-{{#each option in view.options}}{{option.value}}:{{option.label}} {{/each}}{{/each}}')); <add> container.register('template:foo', Ember.Handlebars.compile('{{#each value in view.content}}{{value}}-{{#each option in view.options}}{{option.value}}:{{option.label}} {{/each}}{{/each}}')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("Ember.View should not use keyword incorrectly - Issue #1315", function() { <ide> }); <ide> <ide> test("Ember.View should update when a property changes and no bind helper is used", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>')); <add> container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>')); <ide> <ide> var templates = Ember.Object.create({ <ide> foo: Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>') <ide> test("Ember.View should update when a property changes and no bind helper is use <ide> }); <ide> <ide> test("Ember.View should update when the property used with the #with helper changes", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>')); <add> container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("Ember.View should update when the property used with the #with helper chan <ide> }); <ide> <ide> test("should not update when a property is removed from the view", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#bind "view.content"}}{{#bind "foo"}}{{bind "baz"}}{{/bind}}{{/bind}}</h1>')); <add> container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#bind "view.content"}}{{#bind "foo"}}{{bind "baz"}}{{/bind}}{{/bind}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("should not update when a property is removed from the view", function() { <ide> }); <ide> <ide> test("Handlebars templates update properties if a content object changes", function() { <del> container.register('template', 'menu', Ember.Handlebars.compile('<h1>Today\'s Menu</h1>{{#bind "view.coffee"}}<h2>{{color}} coffee</h2><span id="price">{{bind "price"}}</span>{{/bind}}')); <add> container.register('template:menu', Ember.Handlebars.compile('<h1>Today\'s Menu</h1>{{#bind "view.coffee"}}<h2>{{color}} coffee</h2><span id="price">{{bind "price"}}</span>{{/bind}}')); <ide> <ide> Ember.run(function() { <ide> view = Ember.View.create({ <ide> test("Handlebars templates update properties if a content object changes", funct <ide> }); <ide> <ide> test("Template updates correctly if a path is passed to the bind helper", function() { <del> container.register('template', 'menu', Ember.Handlebars.compile('<h1>{{bind "view.coffee.price"}}</h1>')); <add> container.register('template:menu', Ember.Handlebars.compile('<h1>{{bind "view.coffee.price"}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("Template updates correctly if a path is passed to the bind helper", functi <ide> // }); <ide> <ide> test("should update the block when object passed to #if helper changes", function() { <del> container.register('template', 'menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{/if}}</h1>')); <add> container.register('template:menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{/if}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("should update the block when object passed to #if helper changes", functio <ide> }); <ide> <ide> test("should update the block when object passed to #unless helper changes", function() { <del> container.register('template', 'advice', Ember.Handlebars.compile('<h1>{{#unless view.onDrugs}}{{view.doWellInSchool}}{{/unless}}</h1>')); <add> container.register('template:advice', Ember.Handlebars.compile('<h1>{{#unless view.onDrugs}}{{view.doWellInSchool}}{{/unless}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("should update the block when object passed to #unless helper changes", fun <ide> }); <ide> <ide> test("should update the block when object passed to #if helper changes and an inverse is supplied", function() { <del> container.register('template', 'menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{else}}{{view.SAD}}{{/if}}</h1>')); <add> container.register('template:menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{else}}{{view.SAD}}{{/if}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("Layout views return throw if their layout cannot be found", function() { <ide> }); <ide> <ide> test("Template views add an elementId to child views created using the view helper", function() { <del> container.register('template', 'parent', Ember.Handlebars.compile('<div>{{view "TemplateTests.ChildView"}}</div>')); <del> container.register('template', 'child', Ember.Handlebars.compile("I can't believe it's not butter.")); <add> container.register('template:parent', Ember.Handlebars.compile('<div>{{view "TemplateTests.ChildView"}}</div>')); <add> container.register('template:child', Ember.Handlebars.compile("I can't believe it's not butter.")); <ide> <ide> TemplateTests.ChildView = Ember.View.extend({ <ide> container: container, <ide> test("Template views add an elementId to child views created using the view help <ide> }); <ide> <ide> test("views set the template of their children to a passed block", function() { <del> container.register('template', 'parent', Ember.Handlebars.compile('<h1>{{#view "TemplateTests.NoTemplateView"}}<span>It worked!</span>{{/view}}</h1>')); <add> container.register('template:parent', Ember.Handlebars.compile('<h1>{{#view "TemplateTests.NoTemplateView"}}<span>It worked!</span>{{/view}}</h1>')); <ide> <ide> TemplateTests.NoTemplateView = Ember.View.extend(); <ide> <ide> test("views set the template of their children to a passed block", function() { <ide> }); <ide> <ide> test("views render their template in the context of the parent view's context", function() { <del> container.register('template', 'parent', Ember.Handlebars.compile('<h1>{{#with content}}{{#view}}{{firstName}} {{lastName}}{{/view}}{{/with}}</h1>')); <add> container.register('template:parent', Ember.Handlebars.compile('<h1>{{#with content}}{{#view}}{{firstName}} {{lastName}}{{/view}}{{/with}}</h1>')); <ide> <ide> var context = { <ide> content: { <ide> test("views render their template in the context of the parent view's context", <ide> }); <ide> <ide> test("views make a view keyword available that allows template to reference view context", function() { <del> container.register('template', 'parent', Ember.Handlebars.compile('<h1>{{#with view.content}}{{#view subview}}{{view.firstName}} {{lastName}}{{/view}}{{/with}}</h1>')); <add> container.register('template:parent', Ember.Handlebars.compile('<h1>{{#with view.content}}{{#view subview}}{{view.firstName}} {{lastName}}{{/view}}{{/with}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("itemViewClass works in the #collection helper relatively", function() { <ide> }); <ide> <ide> test("should update boundIf blocks if the conditional changes", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#boundIf "view.content.myApp.isEnabled"}}{{view.content.wham}}{{/boundIf}}</h1>')); <add> container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#boundIf "view.content.myApp.isEnabled"}}{{view.content.wham}}{{/boundIf}}</h1>')); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("boundIf should support parent access", function(){ <ide> }); <ide> <ide> test("{{view}} id attribute should set id on layer", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" id="bar"}}baz{{/view}}')); <add> container.register('template:foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" id="bar"}}baz{{/view}}')); <ide> <ide> TemplateTests.IdView = Ember.View; <ide> <ide> test("{{view}} id attribute should set id on layer", function() { <ide> }); <ide> <ide> test("{{view}} tag attribute should set tagName of the view", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.TagView" tag="span"}}baz{{/view}}')); <add> container.register('template:foo', Ember.Handlebars.compile('{{#view "TemplateTests.TagView" tag="span"}}baz{{/view}}')); <ide> <ide> TemplateTests.TagView = Ember.View; <ide> <ide> test("{{view}} tag attribute should set tagName of the view", function() { <ide> }); <ide> <ide> test("{{view}} class attribute should set class on layer", function() { <del> container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" class="bar"}}baz{{/view}}')); <add> container.register('template:foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" class="bar"}}baz{{/view}}')); <ide> <ide> TemplateTests.IdView = Ember.View; <ide> <ide> test("{{view}} should evaluate other attributes bindings set in the current cont <ide> }); <ide> <ide> test("{{view}} should be able to bind class names to truthy properties", function() { <del> container.register('template', 'template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy"}}foo{{/view}}')); <add> container.register('template:template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy"}}foo{{/view}}')); <ide> <ide> TemplateTests.classBindingView = Ember.View.extend(); <ide> <ide> test("{{view}} should be able to bind class names to truthy properties", functio <ide> }); <ide> <ide> test("{{view}} should be able to bind class names to truthy or falsy properties", function() { <del> container.register('template', 'template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}')); <add> container.register('template:template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}')); <ide> <ide> TemplateTests.classBindingView = Ember.View.extend(); <ide> <ide><path>packages/ember-handlebars/tests/helpers/each_test.js <ide> test("it supports itemController", function() { <ide> controller: parentController <ide> }); <ide> <del> container.register('controller', 'person', Controller); <add> container.register('controller:person', Controller); <ide> <ide> append(view); <ide> <ide> test("it supports itemController when using a custom keyword", function() { <ide> } <ide> }); <ide> <del> container.register('controller', 'person', Controller); <add> container.register('controller:person', Controller); <ide> <ide> append(view); <ide> <ide><path>packages/ember-handlebars/tests/helpers/yield_test.js <ide> test("a view with a layout set renders its template where the {{yield}} helper a <ide> }); <ide> <ide> test("block should work properly even when templates are not hard-coded", function() { <del> container.register('template', 'nester', Ember.Handlebars.compile('<div class="wrapper"><h1>{{title}}</h1>{{yield}}</div>')); <del> container.register('template', 'nested', Ember.Handlebars.compile('{{#view TemplateTests.ViewWithLayout title="My Fancy Page"}}<div class="page-body">Show something interesting here</div>{{/view}}')); <add> container.register('template:nester', Ember.Handlebars.compile('<div class="wrapper"><h1>{{title}}</h1>{{yield}}</div>')); <add> container.register('template:nested', Ember.Handlebars.compile('{{#view TemplateTests.ViewWithLayout title="My Fancy Page"}}<div class="page-body">Show something interesting here</div>{{/view}}')); <ide> <ide> TemplateTests.ViewWithLayout = Ember.View.extend({ <ide> container: container, <ide><path>packages/ember-routing/lib/system/controller_for.js <ide> Ember.controllerFor = function(container, controllerName, context, lookupOptions <ide> `App.ObjectController` and `App.ArrayController` <ide> */ <ide> Ember.generateController = function(container, controllerName, context) { <del> var controller, DefaultController; <add> var controller, DefaultController, fullName; <ide> <ide> if (context && Ember.isArray(context)) { <ide> DefaultController = container.resolve('controller:array'); <ide> Ember.generateController = function(container, controllerName, context) { <ide> return "(generated " + controllerName + " controller)"; <ide> }; <ide> <del> container.register('controller', controllerName, controller); <del> return container.lookup('controller:' + controllerName); <add> <add> fullName = 'controller:' + controllerName; <add> container.register(fullName, controller); <add> return container.lookup(fullName); <ide> }; <ide><path>packages/ember-routing/lib/system/router.js <ide> Ember.Router = Ember.Object.extend({ <ide> <ide> setupRouter(this, router, location); <ide> <del> container.register('view', 'default', DefaultView); <del> container.register('view', 'toplevel', Ember.View.extend()); <add> container.register('view:default', DefaultView); <add> container.register('view:toplevel', Ember.View.extend()); <ide> <ide> location.onUpdateURL(function(url) { <ide> self.handleURL(url); <ide> function getHandlerFunction(router) { <ide> DefaultRoute = container.resolve('route:basic'); <ide> <ide> return function(name) { <del> var handler = container.lookup('route:' + name); <add> var routeName = 'route:' + name, <add> handler = container.lookup(routeName); <add> <ide> if (seen[name]) { return handler; } <ide> <ide> seen[name] = true; <ide> function getHandlerFunction(router) { <ide> if (name === 'loading') { return {}; } <ide> if (name === 'failure') { return router.constructor.defaultFailureHandler; } <ide> <del> container.register('route', name, DefaultRoute.extend()); <del> handler = container.lookup('route:' + name); <add> container.register(routeName, DefaultRoute.extend()); <add> handler = container.lookup(routeName); <ide> } <ide> <ide> handler.routeName = name; <ide> function getHandlerFunction(router) { <ide> } <ide> <ide> function handlerIsActive(router, handlerName) { <del> var handler = router.container.lookup('route:' + handlerName), <add> var routeName = 'route:' + handlerName, <add> handler = router.container.lookup(routeName), <ide> currentHandlerInfos = router.router.currentHandlerInfos, <ide> handlerInfo; <ide> <ide><path>packages/ember-routing/tests/helpers/render_test.js <ide> var buildContainer = function(namespace) { <ide> container.resolver = resolverFor(namespace); <ide> container.optionsForType('view', { singleton: false }); <ide> container.optionsForType('template', { instantiate: false }); <del> container.register('application', 'main', namespace, { instantiate: false }); <add> container.register('application:main', namespace, { instantiate: false }); <ide> container.injection('router:main', 'namespace', 'application:main'); <ide> <ide> container.register('controller:basic', Ember.Controller, { instantiate: false }); <ide> module("Handlebars {{render}} helper", { <ide> setup: function() { <ide> var namespace = Ember.Namespace.create(); <ide> container = buildContainer(namespace); <del> container.register('view', 'default', Ember.View.extend()); <del> container.register('router', 'main', Ember.Router.extend()); <add> container.register('view:default', Ember.View.extend()); <add> container.register('router:main', Ember.Router.extend()); <ide> }, <ide> teardown: function() { <ide> Ember.run(function () { <ide> test("{{render}} helper should render given template with a supplied model", fun <ide> }); <ide> <ide> var PostController = Ember.ObjectController.extend(); <del> container.register('controller', 'post', PostController); <add> container.register('controller:post', PostController); <ide> <ide> Ember.TEMPLATES['post'] = compile("<p>{{title}}</p>"); <ide> <ide> test("{{render}} helper should not use singleton controller with a supplied mode <ide> test("{{render}} helper should render with given controller", function() { <ide> var template = '<h1>HI</h1>{{render home controller="posts"}}'; <ide> var controller = Ember.Controller.extend({container: container}); <del> container.register('controller', 'posts', Ember.ArrayController.extend()); <add> container.register('controller:posts', Ember.ArrayController.extend()); <ide> view = Ember.View.create({ <ide> controller: controller.create(), <ide> template: Ember.Handlebars.compile(template) <ide> test("{{render}} helper should link child controllers to the parent controller", <ide> } <ide> }); <ide> <del> container.register('controller', 'posts', Ember.ArrayController.extend()); <add> container.register('controller:posts', Ember.ArrayController.extend()); <ide> <ide> view = Ember.View.create({ <ide> controller: controller.create(), <ide> test("{{render}} works with dot notation", function() { <ide> var template = '<h1>BLOG</h1>{{render blog.post}}'; <ide> <ide> var controller = Ember.Controller.extend({container: container}); <del> container.register('controller', 'blog.post', Ember.ObjectController.extend()); <add> container.register('controller:blog.post', Ember.ObjectController.extend()); <ide> <ide> view = Ember.View.create({ <ide> controller: controller.create(), <ide> test("{{render}} works with slash notation", function() { <ide> var template = '<h1>BLOG</h1>{{render "blog/post"}}'; <ide> <ide> var controller = Ember.Controller.extend({container: container}); <del> container.register('controller', 'blog.post', Ember.ObjectController.extend()); <add> container.register('controller:blog.post', Ember.ObjectController.extend()); <ide> <ide> view = Ember.View.create({ <ide> controller: controller.create(), <ide><path>packages/ember-routing/tests/system/controller_for_test.js <ide> var buildContainer = function(namespace) { <ide> container.resolver = resolverFor(namespace); <ide> container.optionsForType('view', { singleton: false }); <ide> <del> container.register('application', 'main', namespace, { instantiate: false }); <add> container.register('application:main', namespace, { instantiate: false }); <ide> <ide> container.register('controller:basic', Ember.Controller, { instantiate: false }); <ide> container.register('controller:object', Ember.ObjectController, { instantiate: false }); <ide> module("Ember.controllerFor", { <ide> setup: function() { <ide> namespace = Ember.Namespace.create(); <ide> container = buildContainer(namespace); <del> container.register('controller', 'app', Ember.Controller.extend()); <add> container.register('controller:app', Ember.Controller.extend()); <ide> appController = container.lookup('controller:app'); <ide> }, <ide> teardown: function() { <ide> test("controllerFor should create App.ArrayController if provided", function() { <ide> ok(controller instanceof namespace.ArrayController, 'should create controller'); <ide> equal(controller.get('content'), context, 'should set content'); <ide> <del>}); <ide>\ No newline at end of file <add>}); <ide><path>packages/ember-runtime/tests/controllers/item_controller_class_test.js <ide> module("Ember.ArrayController - itemController", { <ide> } <ide> }); <ide> <del> container.register("controller", "Item", controllerClass); <del> container.register("controller", "OtherItem", otherControllerClass); <add> container.register("controller:Item", controllerClass); <add> container.register("controller:OtherItem", otherControllerClass); <ide> }, <ide> teardown: function() { <ide> Ember.run(function() { <ide><path>packages/ember-views/tests/views/view/layout_test.js <ide> module("Ember.View - Layout Functionality", { <ide> test("should call the function of the associated layout", function() { <ide> var templateCalled = 0, layoutCalled = 0; <ide> <del> container.register('template', 'template', function() { templateCalled++; }); <del> container.register('template', 'layout', function() { layoutCalled++; }); <add> container.register('template:template', function() { templateCalled++; }); <add> container.register('template:layout', function() { layoutCalled++; }); <ide> <ide> view = Ember.View.create({ <ide> container: container, <ide> test("should call the function of the associated layout", function() { <ide> }); <ide> <ide> test("should call the function of the associated template with itself as the context", function() { <del> container.register('template', 'testTemplate', function(dataSource) { <add> container.register('template:testTemplate', function(dataSource) { <ide> return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; <ide> }); <ide> <ide><path>packages/ember-views/tests/views/view/template_test.js <ide> module("Ember.View - Template Functionality", { <ide> }); <ide> <ide> test("should call the function of the associated template", function() { <del> container.register('template', 'testTemplate', function() { <add> container.register('template:testTemplate', function() { <ide> return "<h1 id='twas-called'>template was called</h1>"; <ide> }); <ide> <ide> test("should call the function of the associated template", function() { <ide> }); <ide> <ide> test("should call the function of the associated template with itself as the context", function() { <del> container.register('template', 'testTemplate', function(dataSource) { <add> container.register('template:testTemplate', function(dataSource) { <ide> return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; <ide> }); <ide> <ide> test("should not use defaultTemplate if template is provided", function() { <ide> test("should not use defaultTemplate if template is provided", function() { <ide> var View; <ide> <del> container.register('template', 'foobar', function() { return 'foo'; }); <add> container.register('template:foobar', function() { return 'foo'; }); <ide> <ide> View = Ember.View.extend({ <ide> container: container, <ide><path>packages/ember/tests/helpers/link_to_test.js <ide> module("The {{linkTo}} helper", { <ide> <ide> container = App.__container__; <ide> <del> container.register('view', 'app'); <del> container.register('router', 'main', Router); <add> container.register('view:app'); <add> container.register('router:main', Router); <ide> }); <ide> }, <ide> <ide><path>packages/ember/tests/routing/basic_test.js <ide> test("The Homepage with a `setupController` hook", function() { <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'home', Ember.Controller.extend()); <add> container.register('controller:home', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/"); <ide> test("The route controller is still set when overriding the setupController hook <ide> } <ide> }); <ide> <del> container.register('controller', 'home', Ember.Controller.extend()); <add> container.register('controller:home', Ember.Controller.extend()); <ide> <ide> bootApplication(); <ide> <ide> test("The default controller's model is still set when overriding the setupContr <ide> "<ul>{{#each entry in hours}}<li>{{entry}}</li>{{/each}}</ul>" <ide> ); <ide> <del> container.register('controller', 'home', Ember.Controller.extend()); <add> container.register('controller:home', Ember.Controller.extend()); <ide> <ide> bootApplication(); <ide> <ide> test("The Homepage with a `setupController` hook modifying other controllers", f <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'home', Ember.Controller.extend()); <add> container.register('controller:home', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/"); <ide> test("The Homepage getting its controller context via model", function() { <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'home', Ember.Controller.extend()); <add> container.register('controller:home', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/"); <ide> test("The Specials Page getting its controller context by deserializing the para <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'special', Ember.Controller.extend()); <add> container.register('controller:special', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/specials/1"); <ide> test("The Specials Page defaults to looking models up via `find`", function() { <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'special', Ember.Controller.extend()); <add> container.register('controller:special', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/specials/1"); <ide> test("The Special Page returning a promise puts the app into a loading state unt <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'special', Ember.Controller.extend()); <add> container.register('controller:special', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/specials/1"); <ide> test("Moving from one page to another triggers the correct callbacks", function( <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'special', Ember.Controller.extend()); <add> container.register('controller:special', Ember.Controller.extend()); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/"); <ide> test("Nested callbacks are not exited when moving to siblings", function() { <ide> bootApplication(); <ide> }); <ide> <del> container.register('controller', 'special', Ember.Controller.extend()); <add> container.register('controller:special', Ember.Controller.extend()); <ide> <ide> equal(Ember.$('h3', '#qunit-fixture').text(), "Home", "The app is now in the initial state"); <ide> equal(rootSetup, 1, "The root setup was triggered"); <ide> asyncTest("Events are triggered on the controller if a matching action name is i <ide> } <ide> }); <ide> <del> container.register('controller', 'home', controller); <add> container.register('controller:home', controller); <ide> <ide> bootApplication(); <ide> <ide> asyncTest("Events are triggered on the current state", function() { <ide> <ide> bootApplication(); <ide> <del> container.register('controller', 'home', Ember.Controller.extend()); <add> container.register('controller:home', Ember.Controller.extend()); <ide> <ide> //var controller = router._container.controller.home = Ember.Controller.create(); <ide> //controller.target = router;
16
PHP
PHP
add test for max page count value
009cf4efab63c047ec6f9ae4ac816e5dded7d061
<ide><path>tests/TestCase/Controller/Component/PaginatorComponentTest.php <ide> public function testValidateSortInvalidDirection() <ide> $this->assertEquals('asc', $result['order']['model.something']); <ide> } <ide> <add> /** <add> * Test empty pagination result. <add> * <add> * @return void <add> */ <add> public function testEmptyPaginationResult() <add> { <add> $this->loadFixtures('Posts'); <add> <add> $table = TableRegistry::get('PaginatorPosts'); <add> $table->deleteAll('1=1'); <add> <add> $this->Paginator->paginate($table); <add> <add> $this->assertEquals( <add> 0, <add> $this->request->params['paging']['PaginatorPosts']['count'], <add> 'Count should be 0' <add> ); <add> $this->assertEquals( <add> 1, <add> $this->request->params['paging']['PaginatorPosts']['page'], <add> 'Page number should not be 0' <add> ); <add> $this->assertEquals( <add> 1, <add> $this->request->params['paging']['PaginatorPosts']['pageCount'], <add> 'Page count number should not be 0' <add> ); <add> } <add> <ide> /** <ide> * Test that a really large page number gets clamped to the max page size. <ide> *
1
PHP
PHP
remove errors when aliases don't match
cb5f4d3adc637d741b9516b03eeb427d74db9582
<ide><path>src/ORM/Association.php <ide> protected function _appendFields($query, $surrogate, $options) <ide> } <ide> <ide> if ($fields) { <del> $query->select($query->aliasFields($fields, $target->getAlias())); <add> $query->select($query->aliasFields($fields, $this->_name)); <ide> } <ide> $query->addDefaultTypes($target); <ide> } <ide> protected function _bindNewAssociations($query, $surrogate, $options) <ide> protected function _joinCondition($options) <ide> { <ide> $conditions = []; <del> $tAlias = $this->getTarget()->getAlias(); <add> $tAlias = $this->_name; <ide> $sAlias = $this->getSource()->getAlias(); <ide> $foreignKey = (array)$options['foreignKey']; <ide> $bindingKey = (array)$this->getBindingKey(); <ide><path>src/ORM/Association/BelongsTo.php <ide> public function saveAssociated(EntityInterface $entity, array $options = []) <ide> protected function _joinCondition($options) <ide> { <ide> $conditions = []; <del> $tAlias = $this->getTarget()->getAlias(); <add> $tAlias = $this->_name; <ide> $sAlias = $this->_sourceTable->getAlias(); <ide> $foreignKey = (array)$options['foreignKey']; <ide> $bindingKey = (array)$this->getBindingKey(); <ide><path>src/ORM/EagerLoader.php <ide> protected function _normalizeContain(Table $parent, $alias, $options, $paths) <ide> sprintf('%s is not associated with %s', $parent->getAlias(), $alias) <ide> ); <ide> } <del> if ($instance->getAlias() !== $alias) { <del> throw new InvalidArgumentException(sprintf( <del> "You have contained '%s' but that association was bound as '%s'.", <del> $alias, <del> $instance->getAlias() <del> )); <del> } <ide> <ide> $paths += ['aliasPath' => '', 'propertyPath' => '', 'root' => $alias]; <ide> $paths['aliasPath'] .= '.' . $alias; <ide><path>tests/TestCase/ORM/EagerLoaderTest.php <ide> public function testContainToFieldsDefault() <ide> $this->assertEquals($expected, $select); <ide> } <ide> <del> /** <del> * Check that normalizing contains checks alias names. <del> * <del> * @expectedException \InvalidArgumentException <del> * @expectedExceptionMessage You have contained 'Clients' but that association was bound as 'clients' <del> * @return void <del> */ <del> public function testNormalizedChecksAliasNames() <del> { <del> $contains = ['Clients']; <del> $loader = new EagerLoader; <del> $loader->contain($contains); <del> $loader->normalized($this->table); <del> } <del> <ide> /** <ide> * Tests that the path for getting to a deep association is materialized in an <ide> * array key <ide><path>tests/TestCase/ORM/QueryRegressionTest.php <ide> use Cake\Core\Plugin; <ide> use Cake\Database\Expression\Comparison; <ide> use Cake\Database\Expression\QueryExpression; <add>use Cake\Datasource\EntityInterface; <ide> use Cake\Event\Event; <ide> use Cake\I18n\Time; <ide> use Cake\ORM\TableRegistry; <ide> public function testEagerLoadingFromEmptyResults() <ide> $this->assertEmpty($results); <ide> } <ide> <add> /** <add> * Tests that eagerloading and hydration works for associations that have <add> * different aliases in the association and targetTable <add> * <add> * @return void <add> */ <add> public function testEagerLoadingMismatchingAliasInBelongsTo() <add> { <add> $this->loadFixtures('Articles', 'Users'); <add> $table = TableRegistry::get('Articles'); <add> $users = TableRegistry::get('Users'); <add> $table->belongsTo('Authors', [ <add> 'targetTable' => $users, <add> 'foreignKey' => 'author_id' <add> ]); <add> $result = $table->find()->where(['Articles.id' => 1])->contain('Authors')->first(); <add> $this->assertInstanceOf(EntityInterface::class, $result); <add> $this->assertInstanceOf(EntityInterface::class, $result->author); <add> $this->assertSame('mariano', $result->author->username); <add> } <add> <add> /** <add> * Tests that eagerloading and hydration works for associations that have <add> * different aliases in the association and targetTable <add> * <add> * @return void <add> */ <add> public function testEagerLoadingMismatchingAliasInHasOne() <add> { <add> $this->loadFixtures('Articles', 'Users'); <add> $articles = TableRegistry::get('Articles'); <add> $users = TableRegistry::get('Users'); <add> $users->hasOne('Posts', [ <add> 'targetTable' => $articles, <add> 'foreignKey' => 'author_id' <add> ]); <add> $result = $users->find()->where(['Users.id' => 1])->contain('Posts')->first(); <add> $this->assertInstanceOf(EntityInterface::class, $result); <add> $this->assertInstanceOf(EntityInterface::class, $result->post); <add> $this->assertSame('First Article', $result->post->title); <add> } <add> <ide> /** <ide> * Tests that eagerloading belongsToMany with find list fails with a helpful message. <ide> *
5
Ruby
Ruby
sanitize argv options
52de8d93733ca371996d56c721ba99483d271b24
<ide><path>Library/Homebrew/cmd/postinstall.rb <ide> def run_post_install(formula) <ide> #{formula.path} <ide> ].concat(ARGV.options_only) <ide> <add> if formula.head? <add> args << "--HEAD" <add> elsif formula.devel? <add> args << "--devel" <add> end <add> <ide> if Sandbox.available? && ARGV.sandbox? <ide> if Sandbox.auto_disable? <ide> Sandbox.print_autodisable_warning
1
Javascript
Javascript
add clearcoatnormal context only to physical
f5110b235bfb3b1473809a1d3880434daaae9b04
<ide><path>src/renderers/shaders/ShaderChunk/common.glsl.js <ide> struct GeometricContext { <ide> vec3 position; <ide> vec3 normal; <ide> vec3 viewDir; <add>#ifdef PHYSICAL <ide> vec3 clearCoatNormal; <add>#endif <ide> }; <ide> <ide> vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
1
Javascript
Javascript
remove false annotation
7b048ca02313db8d454983231cdcb8a695874b6a
<ide><path>Libraries/Components/TextInput/TextInput.js <ide> var TextInput = React.createClass({ <ide> */ <ide> onFocus: PropTypes.func, <ide> /** <del> * (text: string) => void <del> * <ide> * Callback that is called when the text input's text changes. <ide> */ <ide> onChange: PropTypes.func,
1
Text
Text
add guiding document
760c596a8e75c6126e95cb9897eb9b66faffbb0c
<ide><path>share/doc/homebrew/Checksum_Deprecation.md <add># Checksum Deprecation <add> <add>During early 2015 Homebrew started the process of deprecating _SHA1_ for package <add>integrity verification. Since then every formulae under the Homebrew organisation <add>has been moved onto _SHA256_ verification; this includes both source packages <add>and our precompiled packages (bottles). <add> <add>We also stopped supporting _MD5_ entirely. It was removed from core formulae in 2012 but until April 2015 if you tried to install a formula still using an <add>_MD5_ checksum Homebrew wouldn't actively stop you. <add> <add>On _SHA1_ we added a `brew audit` check that flags _SHA1_ checksums as deprecated <add>and requests that you use _SHA256_. <add> <add>We saw positive ecosystem engagement on moving from _MD5_ & _SHA1_ to the recommended _SHA256_ and thanks to that we're in a strong position to move forwards. <add> <add>## Moving forwards on SHA1. <add> <add>From March 20th 2016 we've stepped up the visibility of that notification & you'll start <add>seeing deprecation warnings when installing _SHA1_-validated formula. <add>If you see these please consider reporting it to where the formula originated. <add> <add>We're targeting **the end of September 2016** for _SHA1_ support removal, <add>19 months after we started warning people to move away from it for verification. <add>This will be enforced in the same way _MD5_ is today, by blocking the installation of that individual formula until the checksum is migrated. <add> <add>This means prior to that date custom taps, local custom formulae, etc <add>need to be migrated to use _SHA256_.
1
Ruby
Ruby
remove debug message
5efed5d8c54ca541791c8b9b6dd91b94ed3929b3
<ide><path>Library/Homebrew/dev-cmd/irb.rb <ide> def irb <ide> require "keg" <ide> require "cask/all" <ide> <del> puts ARGV.inspect <del> <ide> ohai "Interactive Homebrew Shell" <ide> puts "Example commands available with: brew irb --examples" <ide> if args.pry?
1