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
Python
Python
add remaining tests for simpleratethrottle
dd11bd42a2bfec3d5799509f22405f04eee07e85
<ide><path>tests/test_throttling.py <ide> def test_allow_request_returns_true_if_key_is_none(self): <ide> throttle.rate = 'some rate' <ide> throttle.get_cache_key = lambda *args: None <ide> assert throttle.allow_request(request={}, view={}) is True <add> <add> def test_wait_returns_correct_waiting_time_without_history(self): <add> throttle = SimpleRateThrottle() <add> throttle.num_requests = 1 <add> throttle.duration = 60 <add> throttle.history = [] <add> waiting_time = throttle.wait() <add> assert isinstance(waiting_time, float) <add> assert waiting_time == 30.0 <add> <add> def test_wait_returns_none_if_there_are_no_available_requests(self): <add> throttle = SimpleRateThrottle() <add> throttle.num_requests = 1 <add> throttle.duration = 60 <add> throttle.now = throttle.timer() <add> throttle.history = [throttle.timer() for _ in range(3)] <add> assert throttle.wait() is None
1
Javascript
Javascript
fix some indenting within operatorlist
42d175efd43898709dc829c13609b75463cb5c34
<ide><path>src/core/evaluator.js <ide> var OperatorList = (function OperatorListClosure() { <ide> var CHUNK_SIZE = 1000; <ide> var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; // close to chunk size <ide> <del> function getTransfers(queue) { <del> var transfers = []; <del> var fnArray = queue.fnArray, argsArray = queue.argsArray; <del> for (var i = 0, ii = queue.length; i < ii; i++) { <del> switch (fnArray[i]) { <del> case OPS.paintInlineImageXObject: <del> case OPS.paintInlineImageXObjectGroup: <del> case OPS.paintImageMaskXObject: <del> var arg = argsArray[i][0]; // first param in imgData <del> if (!arg.cached) { <del> transfers.push(arg.data.buffer); <del> } <del> break; <del> } <add> function getTransfers(queue) { <add> var transfers = []; <add> var fnArray = queue.fnArray, argsArray = queue.argsArray; <add> for (var i = 0, ii = queue.length; i < ii; i++) { <add> switch (fnArray[i]) { <add> case OPS.paintInlineImageXObject: <add> case OPS.paintInlineImageXObjectGroup: <add> case OPS.paintImageMaskXObject: <add> var arg = argsArray[i][0]; // first param in imgData <add> if (!arg.cached) { <add> transfers.push(arg.data.buffer); <add> } <add> break; <ide> } <del> return transfers; <ide> } <add> return transfers; <add> } <ide> <del> <del> function OperatorList(intent, messageHandler, pageIndex) { <add> function OperatorList(intent, messageHandler, pageIndex) { <ide> this.messageHandler = messageHandler; <ide> // When there isn't a message handler the fn array needs to be able to grow <ide> // since we can't flush the operators.
1
PHP
PHP
remove tests for purged method
9809c829f6354b5784ed48254dc175f55c671337
<ide><path>tests/TestCase/Utility/Crypto/OpenSslTest.php <ide> public function setUp() <ide> $this->crypt = new OpenSsl(); <ide> } <ide> <del> /** <del> * testRijndael method <del> * <del> * @return void <del> */ <del> public function testRijndael() <del> { <del> $this->expectException(\LogicException::class); <del> $txt = 'The quick brown fox jumped over the lazy dog.'; <del> $key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'; <del> <del> $this->crypt->rijndael($txt, $key, 'encrypt'); <del> } <del> <ide> /** <ide> * Test encrypt/decrypt. <ide> * <ide><path>tests/TestCase/Utility/SecurityTest.php <ide> public function testInvalidHashTypeException() <ide> Security::hash('test', 'doesnotexist', false); <ide> } <ide> <del> /** <del> * testRijndael method <del> * <del> * @return void <del> */ <del> public function testRijndael() <del> { <del> $this->skipIf(!function_exists('mcrypt_encrypt') || version_compare(PHP_VERSION, '7.1', '>=')); <del> $engine = Security::engine(); <del> <del> Security::engine(new OpenSsl()); <del> $txt = 'The quick brown fox jumped over the lazy dog.'; <del> $key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'; <del> <del> $result = Security::rijndael($txt, $key, 'encrypt'); <del> $this->assertEquals($txt, Security::rijndael($result, $key, 'decrypt')); <del> <del> $result = Security::rijndael('', $key, 'encrypt'); <del> $this->assertEquals('', Security::rijndael($result, $key, 'decrypt')); <del> <del> $key = 'this is my key of over 32 chars, yes it is'; <del> $result = Security::rijndael($txt, $key, 'encrypt'); <del> $this->assertEquals($txt, Security::rijndael($result, $key, 'decrypt')); <del> <del> Security::engine($engine); <del> } <del> <del> /** <del> * testRijndaelInvalidOperation method <del> * <del> * @return void <del> */ <del> public function testRijndaelInvalidOperation() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $txt = 'The quick brown fox jumped over the lazy dog.'; <del> $key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'; <del> Security::rijndael($txt, $key, 'foo'); <del> } <del> <del> /** <del> * testRijndaelInvalidKey method <del> * <del> * @return void <del> */ <del> public function testRijndaelInvalidKey() <del> { <del> $this->expectException(\InvalidArgumentException::class); <del> $txt = 'The quick brown fox jumped over the lazy dog.'; <del> $key = 'too small'; <del> Security::rijndael($txt, $key, 'encrypt'); <del> } <del> <ide> /** <ide> * Test encrypt/decrypt. <ide> *
2
Text
Text
remove a couple of .html suffixes in docs
ca2bd616d989f78d00641231e645198a6c95caa0
<ide><path>docs/index.md <ide> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <ide> [0.4]: https://github.com/tomchristie/django-rest-framework/tree/0.4.X <ide> [image]: img/quickstart.png <ide> [index]: . <del>[oauth1-section]: api-guide/authentication.html#oauthauthentication <del>[oauth2-section]: api-guide/authentication.html#oauth2authentication <del>[serializer-section]: api-guide/serializers.html#serializers <del>[modelserializer-section]: api-guide/serializers.html#modelserializer <del>[functionview-section]: api-guide/views.html#function-based-views <add>[oauth1-section]: api-guide/authentication#oauthauthentication <add>[oauth2-section]: api-guide/authentication#oauth2authentication <add>[serializer-section]: api-guide/serializers#serializers <add>[modelserializer-section]: api-guide/serializers#modelserializer <add>[functionview-section]: api-guide/views#function-based-views <ide> [sandbox]: http://restframework.herokuapp.com/ <ide> <ide> [quickstart]: tutorial/quickstart.md <ide><path>docs/topics/2.2-announcement.md <ide> From version 2.2 onwards, serializers with hyperlinked relationships *always* re <ide> [porting-python-3]: https://docs.djangoproject.com/en/dev/topics/python3/ <ide> [python-compat]: https://docs.djangoproject.com/en/dev/releases/1.5/#python-compatibility <ide> [django-deprecation-policy]: https://docs.djangoproject.com/en/dev/internals/release-process/#internal-release-deprecation-policy <del>[credits]: http://django-rest-framework.org/topics/credits.html <add>[credits]: http://django-rest-framework.org/topics/credits <ide> [mailing-list]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework <ide> [django-rest-framework-docs]: https://github.com/marcgibbons/django-rest-framework-docs <ide> [marcgibbons]: https://github.com/marcgibbons/
2
Javascript
Javascript
fix failing test for new return value
5dc4616ca0fdbf2a80890bd9b236e796b84db8c1
<ide><path>src/attributes/attr.js <ide> jQuery.extend({ <ide> <ide> // don't get/set attributes on text, comment and attribute nodes <ide> if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { <del> return; <add> return null; <ide> } <ide> <ide> // Fallback to prop when attributes are not supported <ide><path>test/unit/attributes.js <ide> test( "attr(String, Object)", function() { <ide> jQuery.each( [ window, document, obj, "#firstp" ], function( i, elem ) { <ide> var oldVal = elem.nonexisting, <ide> $elem = jQuery( elem ); <del> strictEqual( $elem.attr("nonexisting"), null, "attr works correctly for non existing attributes (bug #7500)." ); <del> equal( $elem.attr( "nonexisting", "foo" ).attr("nonexisting"), "foo", "attr falls back to prop on unsupported arguments" ); <add> // Falls back to prop, which returns undefined <add> strictEqual( <add> $elem.attr( "nonexisting" ), <add> typeof $elem[0].getAttribute === "undefined" ? undefined : null, <add> "attr works correctly for non existing attributes (bug #7500)." <add> ); <add> equal( <add> $elem.attr( "nonexisting", "foo" ).attr( "nonexisting" ), <add> "foo", <add> "attr falls back to prop on unsupported arguments" <add> ); <ide> elem.nonexisting = oldVal; <ide> }); <ide>
2
Javascript
Javascript
improve semver range detection
2a0620a7f1b5634576b8b8e22710448f4ec8eff3
<ide><path>lib/sharing/utils.js <ide> const { join, dirname, readJson } = require("../util/fs"); <ide> * @returns {boolean} true, if it looks like a version <ide> */ <ide> exports.isRequiredVersion = str => { <del> if (str === "*") return true; <del> return /^[\d^=v<>~]/.test(str); <add> return /^([\d^=v<>~]|[*xX]$)/.test(str); <ide> }; <ide> <ide> /**
1
Ruby
Ruby
consolidate duplicated elsif branch
37221c6e0cf9336eed867e80765efa43b3ba10db
<ide><path>activerecord/test/cases/schema_dumper_test.rb <ide> def test_schema_dump_includes_limit_constraint_for_integer_columns <ide> assert_match %r{c_int_4.*limit: 4}, output <ide> end <ide> <del> if current_adapter?(:SQLite3Adapter) <del> assert_match %r{c_int_5.*limit: 5}, output <del> assert_match %r{c_int_6.*limit: 6}, output <del> assert_match %r{c_int_7.*limit: 7}, output <del> assert_match %r{c_int_8.*limit: 8}, output <del> elsif current_adapter?(:OracleAdapter) <add> if current_adapter?(:SQLite3Adapter, :OracleAdapter) <ide> assert_match %r{c_int_5.*limit: 5}, output <ide> assert_match %r{c_int_6.*limit: 6}, output <ide> assert_match %r{c_int_7.*limit: 7}, output
1
PHP
PHP
add tests for hasany and hasall
9074b557305da710435fe377df6e8c55919bf7ea
<ide><path>tests/Support/SupportMessageBagTest.php <ide> public function testHasIndicatesExistence() <ide> $this->assertFalse($container->has('bar')); <ide> } <ide> <add> public function testHasAnyIndicatesExistence() <add> { <add> $container = new MessageBag; <add> $container->setFormat(':message'); <add> $container->add('foo', 'bar'); <add> $container->add('bar', 'foo'); <add> $container->add('boom', 'baz'); <add> $this->assertTrue($container->hasAny(['foo', 'bar'])); <add> $this->assertTrue($container->hasAny(['boom', 'baz'])); <add> $this->assertFalse($container->hasAny(['baz'])); <add> } <add> <add> public function testHasAllIndicatesExistence() <add> { <add> $container = new MessageBag; <add> $container->setFormat(':message'); <add> $container->add('foo', 'bar'); <add> $container->add('bar', 'foo'); <add> $container->add('boom', 'baz'); <add> $this->assertTrue($container->hasAll(['foo', 'bar', 'boom'])); <add> $this->assertFalse($container->hasAll(['foo', 'bar', 'boom', 'baz'])); <add> $this->assertFalse($container->hasAll(['foo', 'baz'])); <add> } <add> <ide> public function testAllReturnsAllMessages() <ide> { <ide> $container = new MessageBag;
1
Text
Text
remove dead link for javascript and immutability
d460447c55902561a20fdfad94957ef8b3aa3cc7
<ide><path>docs/faq/ImmutableData.md <ide> In contrast, immutable libraries such as Immer can employ structural sharing, wh <ide> **Articles** <ide> <ide> - [A deep dive into Clojure’s data structures](https://www.slideshare.net/mohitthatte/a-deep-dive-into-clojures-data-structures-euroclojure-2015) <del>- [JavaScript and Immutability](https://t4d.io/javascript-and-immutability/) <ide> - [Immutable Javascript using ES6 and beyond](https://wecodetheweb.com/2016/02/12/immutable-javascript-using-es6-and-beyond/) <ide> - [Pros and Cons of using immutability with React.js - React Kung Fu](https://reactkungfu.com/2015/08/pros-and-cons-of-using-immutability-with-react-js/)
1
Text
Text
fix the order of lint and prettier
03db57aa718d23dcca69ffce26e9806f7ab1bcb4
<ide><path>docs/contributing/how-to-contribute.md <ide> The core team is monitoring for pull requests. We will review your pull request <ide> 2. If you've added code that should be tested, add tests! <ide> 3. If you've changed APIs, update the documentation. <ide> 4. Ensure the test suite passes (`npm test`). <del>5. Make sure your code lints (`npm run lint`). <del>6. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`). <add>5. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`). <add>6. Make sure your code lints (`npm run lint`). <ide> 7. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`). <ide> 8. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes. You can see the full output of fiber tests with `REACT_DOM_JEST_USE_FIBER=1 npm test`. <ide> 9. If you haven't already, complete the CLA.
1
Javascript
Javascript
remove deprecated function (prepare 1.0)
ba554752ffb83fc21bc8ecb66ac593fcdf6f7a43
<ide><path>packages/ember-runtime/lib/mixins/evented.js <ide> Ember.Evented = Ember.Mixin.create({ <ide> Ember.sendEvent(this, name, args); <ide> }, <ide> <del> fire: function(name) { <del> Ember.deprecate("Ember.Evented#fire() has been deprecated in favor of trigger() for compatibility with jQuery. It will be removed in 1.0. Please update your code to call trigger() instead."); <del> this.trigger.apply(this, arguments); <del> }, <del> <ide> /** <ide> Cancels subscription for given name, target, and method. <ide>
1
Text
Text
upgrade the maintainance policy
1c3c4f053f5b00dce5ed53570b2938977b830289
<ide><path>guides/source/maintenance_policy.md <ide> from. <ide> In special situations, where someone from the Core Team agrees to support more series, <ide> they are included in the list of supported series. <ide> <del>**Currently included series:** `5.2.Z`. <add>**Currently included series:** `6.0.Z`. <ide> <ide> Security Issues <ide> --------------- <ide> be built from 1.2.2, and then added to the end of 1-2-stable. This means that <ide> security releases are easy to upgrade to if you're running the latest version <ide> of Rails. <ide> <del>**Currently included series:** `5.2.Z`, `5.1.Z`. <add>**Currently included series:** `6.0.Z`, 5.2.Z`. <ide> <ide> Severe Security Issues <ide> ---------------------- <ide> For severe security issues all releases in the current major series, and also th <ide> last major release series will receive patches and new versions. The <ide> classification of the security issue is judged by the core team. <ide> <del>**Currently included series:** `5.2.Z`, `5.1.Z`, `5.0.Z`, `4.2.Z`. <add>**Currently included series:** `6.0.Z`, `5.2.Z`. <ide> <ide> Unsupported Release Series <ide> --------------------------
1
Python
Python
use lib2to3 for the conversions
9f9098f6f77f82eddb2471991d08ec0a37ead6f9
<ide><path>tools/py3tool.py <ide> BASE = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) <ide> TEMP = os.path.normpath(os.path.join(BASE, '_py3k')) <ide> <add>SCRIPT_2TO3 = os.path.join(BASE, 'tools', '2to3.py') <add> <ide> EXTRA_2TO3_FLAGS = { <ide> '*/setup.py': '-x import', <ide> 'numpy/core/code_generators/generate_umath.py': '-x import', <ide> 'numpy/core/code_generators/generate_numpy_api.py': '-x import', <ide> 'numpy/core/code_generators/generate_ufunc_api.py': '-x import', <ide> 'numpy/core/defchararray.py': '-x unicode', <ide> 'numpy/compat/py3k.py': '-x unicode', <add> 'numpy/ma/timer_comparison.py': 'skip', <ide> } <ide> <ide> def main(): <ide> def walk_sync(dir1, dir2, _seen=None): <ide> yield root1, root2, dirs, files <ide> <ide> def sync_2to3(src, dst, patchfile=None, clean=False): <add> import lib2to3.main <add> from io import StringIO <add> <ide> to_convert = [] <ide> <ide> for src_dir, dst_dir, dirs, files in walk_sync(src, dst): <ide> def sync_2to3(src, dst, patchfile=None, clean=False): <ide> p = open(os.devnull, 'wb') <ide> <ide> for flags, filenames in flag_sets.items(): <del> subprocess.call(['2to3', '-w'] + flags.split() + filenames, <del> stdout=p) <add> if flags == 'skip': <add> continue <add> <add> _old_stdout = sys.stdout <add> try: <add> sys.stdout = StringIO() <add> lib2to3.main.main("lib2to3.fixes", ['-w'] + flags.split()+filenames) <add> finally: <add> sys.stdout = _old_stdout <ide> <ide> for fn, dst_fn in to_convert: <ide> # perform custom mangling
1
PHP
PHP
remove return since this is a void method
efafba186a2787ad0642d4ff27cf618dc2191e10
<ide><path>src/Illuminate/Database/Schema/Blueprint.php <ide> public function timestampTz($column) <ide> */ <ide> public function nullableTimestamps() <ide> { <del> return $this->timestamps(); <add> $this->timestamps(); <ide> } <ide> <ide> /**
1
Ruby
Ruby
remove unused require
a865f621ee934e8741001bbed1b487698e44d914
<ide><path>railties/lib/rails/commands/server/server_command.rb <ide> # frozen_string_literal: true <ide> <ide> require "fileutils" <del>require "optparse" <ide> require "action_dispatch" <ide> require "rails" <ide> require "active_support/deprecation"
1
Javascript
Javascript
remove unused variables
7f0e35c50d694245f1bc2ad8506fb0f89a6cf8bf
<ide><path>src/core.js <ide> var Page = (function pagePage() { <ide> var self = this; <ide> this.IRQueue = IRQueue; <ide> var gfx = new CanvasGraphics(this.ctx, this.objs); <del> var startTime = Date.now(); <ide> <ide> var displayContinuation = function pageDisplayContinuation() { <ide> // Always defer call to display() to work around bug in <ide> var Page = (function pagePage() { <ide> var IRQueue = this.IRQueue; <ide> <ide> var self = this; <del> var startTime = Date.now(); <ide> function next() { <ide> startIdx = gfx.executeIRQueue(IRQueue, startIdx, next); <ide> if (startIdx == length) {
1
Text
Text
fix wrong grammar on upgrade guide
fa09e3c6787d8dd5f3eff30e07deb67b249af6b6
<ide><path>guides/source/upgrading_ruby_on_rails.md <ide> If you configured this setting after the environments configuration has been pro <ide> <ide> [`config.autoload_once_paths`]: configuring.html#config-autoload-once-paths <ide> <del>### `ActionDispatch::Request#content_type` now returned Content-Type header as it is. <add>### `ActionDispatch::Request#content_type` now returns Content-Type header as it is. <ide> <ide> Previously, `ActionDispatch::Request#content_type` returned value does NOT contain charset part. <ide> This behavior changed to returned Content-Type header containing charset part as it is.
1
Python
Python
fix typo in comment
bf6139bf651b20bc04b895a5f6eb8d50320bc252
<ide><path>celery/app/task.py <ide> from celery.utils.imports import instantiate <ide> from celery.utils.nodenames import gethostname <ide> from celery.utils.serialization import raise_with_context <del> <ide> from .annotations import resolve_all as resolve_all_annotations <ide> from .registry import _unpickle_task_v2 <ide> from .utils import appstr <ide> def replace(self, sig): <ide> sig (~@Signature): signature to replace with. <ide> <ide> Raises: <del> ~@Ignore: This is always raised when called in asynchrous context. <add> ~@Ignore: This is always raised when called in asynchronous context. <ide> It is best to always use ``return self.replace(...)`` to convey <ide> to the reader that the task won't continue after being replaced. <ide> """
1
Text
Text
fix example of `index_with`
1ae1099ed4c47d82b18a2ba8a9028ab06aff1f29
<ide><path>guides/source/active_support_core_extensions.md <ide> The method `index_with` generates a hash with the elements of an enumerable as k <ide> is either a passed default or returned in a block. <ide> <ide> ```ruby <del>%i( title body created_at ).index_with { |attr_name| public_send(attr_name) } <add>%i( title body created_at ).index_with { |attr_name| post.public_send(attr_name) } <ide> # => { title: "hey", body: "what's up?", … } <ide> <del>WEEKDAYS.index_with([ Interval.all_day ]) <add>WEEKDAYS.index_with(Interval.all_day) <ide> # => { monday: [ 0, 1440 ], … } <ide> ``` <ide>
1
Python
Python
update cpplint to check for inline headers
fc81e801913de3e3f3c0c8e26c105f983a74e539
<ide><path>tools/cpplint.py <ide> def CheckForBadCharacters(filename, lines, error): <ide> error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.') <ide> <ide> <add>def CheckInlineHeader(filename, include_state, error): <add> """Logs an error if both a header and its inline variant are included.""" <add> <add> all_headers = dict(item for sublist in include_state.include_list <add> for item in sublist) <add> bad_headers = set('%s.h' % name[:-6] for name in all_headers.keys() <add> if name.endswith('-inl.h')) <add> bad_headers &= set(all_headers.keys()) <add> <add> for name in bad_headers: <add> err = '%s includes both %s and %s-inl.h' % (filename, name, name) <add> linenum = all_headers[name] <add> error(filename, linenum, 'build/include', 5, err) <add> <add> <ide> def CheckForNewlineAtEOF(filename, lines, error): <ide> """Logs an error if there is no newline char at the end of the file. <ide> <ide> def ProcessFileData(filename, file_extension, lines, error, <ide> <ide> CheckForNewlineAtEOF(filename, lines, error) <ide> <add> CheckInlineHeader(filename, include_state, error) <add> <ide> def ProcessConfigOverrides(filename): <ide> """ Loads the configuration files and processes the config overrides. <ide>
1
Ruby
Ruby
add documentation to benchmark#ms [ci skip]
e946c5853b99607cc5fe92225c473a51ecc44e99
<ide><path>activesupport/lib/active_support/core_ext/benchmark.rb <ide> require 'benchmark' <ide> <ide> class << Benchmark <add> # Benchmark realtime in milliseconds. <add> # <add> # Benchmark.realtime { User.all } <add> # # => 8.0e-05 <add> # <add> # Benchmark.ms { User.all } <add> # # => 0.074 <ide> def ms <ide> 1000 * realtime { yield } <ide> end
1
PHP
PHP
add tests for selecting multiple values at a time
ba54a4789f1f9e6bde0f4de5b7f746e9a43a6444
<ide><path>Test/TestCase/View/Input/SelectBoxTest.php <ide> class SelectBoxTest extends TestCase { <ide> public function setUp() { <ide> parent::setUp(); <ide> $templates = [ <del> 'select' => '<select name="{{name}}" {{attrs}}>{{content}}</select>', <del> 'selectMultiple' => '<select name="{{name}}" multiple="multiple" {{attrs}}>{{content}}</select>', <add> 'select' => '<select name="{{name}}"{{attrs}}>{{content}}</select>', <ide> 'option' => '<option value="{{name}}">{{value}}</option>', <ide> 'optionSelected' => '<option value="{{name}}" selected="selected">{{value}}</option>', <ide> 'optgroup' => '<optgroup label="{{label}}">{{content}}</optgroup>', <ide> public function testRenderSelected() { <ide> * @return void <ide> */ <ide> public function testRenderMultipleSelect() { <del> $this->markTestIncomplete('Not done'); <add> $select = new SelectBox($this->templates); <add> $data = [ <add> 'id' => 'BirdName', <add> 'name' => 'Birds[name]', <add> 'multiple' => true, <add> 'options' => ['a' => 'Albatross', 'b' => 'Budgie'] <add> ]; <add> $result = $select->render($data); <add> $expected = [ <add> 'select' => [ <add> 'name' => 'Birds[name]', <add> 'id' => 'BirdName', <add> 'multiple' => 'multiple', <add> ], <add> ['option' => ['value' => 'a']], 'Albatross', '/option', <add> ['option' => ['value' => 'b']], 'Budgie', '/option', <add> '/select' <add> ]; <add> $this->assertTags($result, $expected); <ide> } <ide> <ide> /** <ide> public function testRenderMultipleSelect() { <ide> * @return void <ide> */ <ide> public function testRenderMultipleSelected() { <del> $this->markTestIncomplete('Not done'); <add> $select = new SelectBox($this->templates); <add> $data = [ <add> 'multiple' => true, <add> 'id' => 'BirdName', <add> 'name' => 'Birds[name]', <add> 'value' => ['1', '2', 'burp'], <add> 'options' => [ <add> 1 => 'one', <add> '1x' => 'one x', <add> '2' => 'two', <add> '2x' => 'two x', <add> ] <add> ]; <add> $result = $select->render($data); <add> $expected = [ <add> 'select' => [ <add> 'name' => 'Birds[name]', <add> 'multiple' => 'multiple', <add> 'id' => 'BirdName' <add> ], <add> ['option' => ['value' => '1', 'selected' => 'selected']], 'one', '/option', <add> ['option' => ['value' => '1x']], 'one x', '/option', <add> ['option' => ['value' => '2', 'selected' => 'selected']], 'two', '/option', <add> ['option' => ['value' => '2x']], 'two x', '/option', <add> '/select' <add> ]; <add> $this->assertTags($result, $expected); <ide> } <ide> <ide> /**
1
Python
Python
fix small mistake `optimizer` to `optimizers`
6638ce76b1d414b33393f00cdde13b78c3774a43
<ide><path>keras/engine/training.py <ide> def compile(self, <ide> Example: <ide> <ide> ```python <del> model.compile(optimizer=tf.keras.optimizer.Adam(learning_rate=1e-3), <add> model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=1e-3), <ide> loss=tf.keras.losses.BinaryCrossentropy(), <ide> metrics=[tf.keras.metrics.BinaryAccuracy(), <ide> tf.keras.metrics.FalseNegatives()])
1
Text
Text
fix metadata of dep0114
3d4db3a7bf16a788e59ab76ca8c4a37069b59e80
<ide><path>doc/api/deprecations.md <ide> release. <ide> <!-- YAML <ide> changes: <ide> - version: REPLACEME <del> pr-url: https://github.com/nodejs/node/pull/??? <add> pr-url: https://github.com/nodejs/node/pull/25338 <ide> description: End-of-Life. <ide> - version: v11.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/22501
1
Javascript
Javascript
keep deprecated module in slim
0588d0ce35458eccaa6a19f6350988d34496a31d
<ide><path>build/release.js <ide> module.exports = function( Release ) { <ide> generateArtifacts: function( callback ) { <ide> Release.exec( "grunt", "Grunt command failed" ); <ide> Release.exec( <del> "grunt custom:-ajax,-effects,-deprecated --filename=jquery.slim.js && " + <add> "grunt custom:-ajax,-effects --filename=jquery.slim.js && " + <ide> "grunt remove_map_comment --filename=jquery.slim.js", <ide> "Grunt custom failed" <ide> );
1
Java
Java
apply destinationresolver to listener container
444b9032be7fa73d12103cbf351f82751b08a95b
<ide><path>spring-jms/src/main/java/org/springframework/jms/config/MethodJmsListenerEndpoint.java <ide> import org.springframework.jms.listener.MessageListenerContainer; <ide> import org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter; <ide> import org.springframework.jms.support.converter.MessageConverter; <add>import org.springframework.jms.support.destination.DestinationResolver; <ide> import org.springframework.messaging.handler.annotation.SendTo; <ide> import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory; <ide> import org.springframework.messaging.handler.invocation.InvocableHandlerMethod; <ide> protected MessagingMessageListenerAdapter createMessageListener(MessageListenerC <ide> if (messageConverter != null) { <ide> messageListener.setMessageConverter(messageConverter); <ide> } <add> DestinationResolver destinationResolver = container.getDestinationResolver(); <add> if (destinationResolver != null) { <add> messageListener.setDestinationResolver(destinationResolver); <add> } <ide> return messageListener; <ide> } <ide> <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/MessageListenerContainer.java <ide> <ide> import org.springframework.context.SmartLifecycle; <ide> import org.springframework.jms.support.converter.MessageConverter; <add>import org.springframework.jms.support.destination.DestinationResolver; <ide> <ide> /** <ide> * Internal abstraction used by the framework representing a message <ide> public interface MessageListenerContainer extends SmartLifecycle { <ide> */ <ide> MessageConverter getMessageConverter(); <ide> <add> /** <add> * Return the {@link DestinationResolver} to use to resolve <add> * destinations by names. <add> */ <add> DestinationResolver getDestinationResolver(); <add> <ide> /** <ide> * Return whether the Publish/Subscribe domain ({@link javax.jms.Topic Topics}) is used. <ide> * Otherwise, the Point-to-Point domain ({@link javax.jms.Queue Queues}) is used. <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsMessageEndpointManager.java <ide> public MessageConverter getMessageConverter() { <ide> return null; <ide> } <ide> <add> @Override <add> public DestinationResolver getDestinationResolver() { <add> if (this.activationSpecFactory instanceof StandardJmsActivationSpecFactory) { <add> return ((StandardJmsActivationSpecFactory) this.activationSpecFactory).getDestinationResolver(); <add> } <add> return null; <add> } <add> <ide> @Override <ide> public boolean isPubSubDomain() { <ide> JmsActivationSpecConfig config = getActivationSpecConfig(); <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public void setDestinationResolver(DestinationResolver destinationResolver) { <ide> this.destinationResolver = destinationResolver; <ide> } <ide> <add> /** <add> * Return the {@link DestinationResolver} to use for resolving destinations names. <add> */ <add> public DestinationResolver getDestinationResolver() { <add> return destinationResolver; <add> } <ide> <ide> @Override <ide> public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) { <ide><path>spring-jms/src/test/java/org/springframework/jms/config/JmsListenerContainerFactoryTests.java <ide> private void setDefaultJcaConfig(DefaultJcaListenerContainerFactory factory) { <ide> <ide> private void assertDefaultJcaConfig(JmsMessageEndpointManager container) { <ide> assertEquals(messageConverter, container.getMessageConverter()); <add> assertEquals(destinationResolver, container.getDestinationResolver()); <ide> JmsActivationSpecConfig config = container.getActivationSpecConfig(); <ide> assertNotNull(config); <ide> assertEquals(Session.DUPS_OK_ACKNOWLEDGE, config.getAcknowledgeMode()); <ide><path>spring-jms/src/test/java/org/springframework/jms/config/MessageListenerTestContainer.java <ide> import org.springframework.jms.JmsException; <ide> import org.springframework.jms.listener.MessageListenerContainer; <ide> import org.springframework.jms.support.converter.MessageConverter; <add>import org.springframework.jms.support.destination.DestinationResolver; <ide> <ide> /** <ide> * @author Stephane Nicoll <ide> public MessageConverter getMessageConverter() { <ide> return null; <ide> } <ide> <add> @Override <add> public DestinationResolver getDestinationResolver() { <add> return null; <add> } <add> <ide> @Override <ide> public boolean isPubSubDomain() { <ide> return true; <ide><path>spring-jms/src/test/java/org/springframework/jms/config/MethodJmsListenerEndpointTests.java <ide> import org.junit.rules.ExpectedException; <ide> import org.junit.rules.TestName; <ide> <add>import org.springframework.beans.DirectFieldAccessor; <ide> import org.springframework.beans.factory.support.StaticListableBeanFactory; <ide> import org.springframework.jms.StubTextMessage; <ide> import org.springframework.jms.listener.DefaultMessageListenerContainer; <ide> import org.springframework.jms.listener.adapter.ReplyFailureException; <ide> import org.springframework.jms.support.JmsHeaders; <ide> import org.springframework.jms.support.JmsMessageHeaderAccessor; <add>import org.springframework.jms.support.converter.MessageConverter; <ide> import org.springframework.jms.support.destination.DestinationResolver; <ide> import org.springframework.messaging.Message; <ide> import org.springframework.messaging.MessageHeaders; <ide> public void createMessageListener() { <ide> assertNotNull(endpoint.createMessageListener(container)); <ide> } <ide> <add> @Test <add> public void setExtraCollaborators() { <add> MessageConverter messageConverter = mock(MessageConverter.class); <add> DestinationResolver destinationResolver = mock(DestinationResolver.class); <add> this.container.setMessageConverter(messageConverter); <add> this.container.setDestinationResolver(destinationResolver); <add> <add> MessagingMessageListenerAdapter listener = createInstance(this.factory, <add> getListenerMethod("resolveObjectPayload", MyBean.class), container); <add> DirectFieldAccessor accessor = new DirectFieldAccessor(listener); <add> assertSame(messageConverter, accessor.getPropertyValue("messageConverter")); <add> assertSame(destinationResolver, accessor.getPropertyValue("destinationResolver")); <add> } <add> <ide> @Test <ide> public void resolveMessageAndSession() throws JMSException { <ide> MessagingMessageListenerAdapter listener = createDefaultInstance(javax.jms.Message.class, Session.class); <ide><path>spring-jms/src/test/java/org/springframework/jms/listener/endpoint/JmsMessageEndpointManagerTests.java <ide> public void getMessageConverterNoConfig() { <ide> JmsMessageEndpointManager endpoint = new JmsMessageEndpointManager(); <ide> assertNull(endpoint.getMessageConverter()); <ide> } <add> <add> @Test <add> public void getDestinationResolverNoConfig() { <add> JmsMessageEndpointManager endpoint = new JmsMessageEndpointManager(); <add> assertNull(endpoint.getDestinationResolver()); <add> } <ide> }
8
Javascript
Javascript
fix the build id on browser stack
04d5a5072fe45d5aa8ec9c027bae9d29ee56c2d1
<ide><path>karma-shared.conf.js <ide> module.exports = function(config, specificOptions) { <ide> <ide> if (process.env.TRAVIS) { <ide> config.transports = ['websocket', 'xhr-polling']; <del> config.browserStack.build = 'TRAVIS ' + process.env.TRAVIS_BUILD; <add> config.browserStack.build = 'TRAVIS ' + process.env.TRAVIS_BUILD_ID; <ide> <ide> // Debug logging into a file, that we print out at the end of the build. <ide> config.loggers.push({
1
Go
Go
add docker interfaces to firewalld docker zone
23d1ca4426986fb4a62c864c12291dac653e22d4
<ide><path>libnetwork/iptables/firewalld.go <ide> const ( <ide> // Ebtables point to bridge table <ide> Ebtables IPV = "eb" <ide> ) <add> <ide> const ( <del> dbusInterface = "org.fedoraproject.FirewallD1" <del> dbusPath = "/org/fedoraproject/FirewallD1" <add> dbusInterface = "org.fedoraproject.FirewallD1" <add> dbusPath = "/org/fedoraproject/FirewallD1" <add> dbusConfigPath = "/org/fedoraproject/FirewallD1/config" <add> dockerZone = "docker" <ide> ) <ide> <ide> // Conn is a connection to firewalld dbus endpoint. <ide> type Conn struct { <del> sysconn *dbus.Conn <del> sysobj dbus.BusObject <del> signal chan *dbus.Signal <add> sysconn *dbus.Conn <add> sysObj dbus.BusObject <add> sysConfObj dbus.BusObject <add> signal chan *dbus.Signal <add>} <add> <add>// ZoneSettings holds the firewalld zone settings, documented in <add>// https://firewalld.org/documentation/man-pages/firewalld.dbus.html <add>type ZoneSettings struct { <add> version string <add> name string <add> description string <add> unused bool <add> target string <add> services []string <add> ports [][]interface{} <add> icmpBlocks []string <add> masquerade bool <add> forwardPorts [][]interface{} <add> interfaces []string <add> sourceAddresses []string <add> richRules []string <add> protocols []string <add> sourcePorts [][]interface{} <add> icmpBlockInversion bool <ide> } <ide> <ide> var ( <del> connection *Conn <add> connection *Conn <add> <ide> firewalldRunning bool // is Firewalld service running <ide> onReloaded []*func() // callbacks when Firewalld has been reloaded <ide> ) <ide> func FirewalldInit() error { <ide> } <ide> if connection != nil { <ide> go signalHandler() <add> if err := setupDockerZone(); err != nil { <add> return err <add> } <ide> } <ide> <ide> return nil <ide> func (c *Conn) initConnection() error { <ide> } <ide> <ide> // This never fails, even if the service is not running atm. <del> c.sysobj = c.sysconn.Object(dbusInterface, dbus.ObjectPath(dbusPath)) <del> <add> c.sysObj = c.sysconn.Object(dbusInterface, dbus.ObjectPath(dbusPath)) <add> c.sysConfObj = c.sysconn.Object(dbusInterface, dbus.ObjectPath(dbusConfigPath)) <ide> rule := fmt.Sprintf("type='signal',path='%s',interface='%s',sender='%s',member='Reloaded'", <ide> dbusPath, dbusInterface, dbusInterface) <ide> c.sysconn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, rule) <ide> func checkRunning() bool { <ide> var err error <ide> <ide> if connection != nil { <del> err = connection.sysobj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone) <add> err = connection.sysObj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone) <ide> return err == nil <ide> } <ide> return false <ide> func checkRunning() bool { <ide> func Passthrough(ipv IPV, args ...string) ([]byte, error) { <ide> var output string <ide> logrus.Debugf("Firewalld passthrough: %s, %s", ipv, args) <del> if err := connection.sysobj.Call(dbusInterface+".direct.passthrough", 0, ipv, args).Store(&output); err != nil { <add> if err := connection.sysObj.Call(dbusInterface+".direct.passthrough", 0, ipv, args).Store(&output); err != nil { <ide> return nil, err <ide> } <ide> return []byte(output), nil <ide> } <add> <add>// getDockerZoneSettings converts the ZoneSettings struct into a interface slice <add>func getDockerZoneSettings() []interface{} { <add> settings := ZoneSettings{ <add> version: "1.0", <add> name: dockerZone, <add> description: "zone for docker bridge network interfaces", <add> target: "ACCEPT", <add> } <add> slice := []interface{}{ <add> settings.version, <add> settings.name, <add> settings.description, <add> settings.unused, <add> settings.target, <add> settings.services, <add> settings.ports, <add> settings.icmpBlocks, <add> settings.masquerade, <add> settings.forwardPorts, <add> settings.interfaces, <add> settings.sourceAddresses, <add> settings.richRules, <add> settings.protocols, <add> settings.sourcePorts, <add> settings.icmpBlockInversion, <add> } <add> return slice <add> <add>} <add> <add>// setupDockerZone creates a zone called docker in firewalld which includes docker interfaces to allow <add>// container networking <add>func setupDockerZone() error { <add> var zones []string <add> // Check if zone exists <add> if err := connection.sysObj.Call(dbusInterface+".zone.getZones", 0).Store(&zones); err != nil { <add> return err <add> } <add> if contains(zones, dockerZone) { <add> logrus.Infof("Firewalld: %s zone already exists, returning", dockerZone) <add> return nil <add> } <add> logrus.Debugf("Firewalld: creating %s zone", dockerZone) <add> <add> settings := getDockerZoneSettings() <add> // Permanent <add> if err := connection.sysConfObj.Call(dbusInterface+".config.addZone", 0, dockerZone, settings).Err; err != nil { <add> return err <add> } <add> // Reload for change to take effect <add> if err := connection.sysObj.Call(dbusInterface+".reload", 0).Err; err != nil { <add> return err <add> } <add> <add> return nil <add>} <add> <add>// AddInterfaceFirewalld adds the interface to the trusted zone <add>func AddInterfaceFirewalld(intf string) error { <add> var intfs []string <add> // Check if interface is already added to the zone <add> if err := connection.sysObj.Call(dbusInterface+".zone.getInterfaces", 0, dockerZone).Store(&intfs); err != nil { <add> return err <add> } <add> // Return if interface is already part of the zone <add> if contains(intfs, intf) { <add> logrus.Infof("Firewalld: interface %s already part of %s zone, returning", intf, dockerZone) <add> return nil <add> } <add> <add> logrus.Debugf("Firewalld: adding %s interface to %s zone", intf, dockerZone) <add> // Runtime <add> if err := connection.sysObj.Call(dbusInterface+".zone.addInterface", 0, dockerZone, intf).Err; err != nil { <add> return err <add> } <add> return nil <add>} <add> <add>// DelInterfaceFirewalld removes the interface from the trusted zone <add>func DelInterfaceFirewalld(intf string) error { <add> var intfs []string <add> // Check if interface is part of the zone <add> if err := connection.sysObj.Call(dbusInterface+".zone.getInterfaces", 0, dockerZone).Store(&intfs); err != nil { <add> return err <add> } <add> // Remove interface if it exists <add> if !contains(intfs, intf) { <add> return fmt.Errorf("Firewalld: unable to find interface %s in %s zone", intf, dockerZone) <add> } <add> <add> logrus.Debugf("Firewalld: removing %s interface from %s zone", intf, dockerZone) <add> // Runtime <add> if err := connection.sysObj.Call(dbusInterface+".zone.removeInterface", 0, dockerZone, intf).Err; err != nil { <add> return err <add> } <add> return nil <add>} <add> <add>func contains(list []string, val string) bool { <add> for _, v := range list { <add> if v == val { <add> return true <add> } <add> } <add> return false <add>} <ide><path>libnetwork/iptables/iptables.go <ide> func ProgramChain(c *ChainInfo, bridgeName string, hairpinMode, enable bool) err <ide> return errors.New("Could not program chain, missing chain name") <ide> } <ide> <add> // Either add or remove the interface from the firewalld zone <add> if firewalldRunning { <add> if enable { <add> if err := AddInterfaceFirewalld(bridgeName); err != nil { <add> return err <add> } <add> } else { <add> if err := DelInterfaceFirewalld(bridgeName); err != nil { <add> return err <add> } <add> } <add> } <add> <ide> switch c.Table { <ide> case Nat: <ide> preroute := []string{
2
Javascript
Javascript
throw if protocol too long
cdba3c1de0de37576426421128982a4022480381
<ide><path>lib/internal/errors.js <ide> E('ERR_NO_ICU', <ide> '%s is not supported on Node.js compiled without ICU', TypeError); <ide> E('ERR_NO_LONGER_SUPPORTED', '%s is no longer supported', Error); <ide> E('ERR_OUT_OF_RANGE', <del> (name, range, value) => { <del> let msg = `The value of "${name}" is out of range.`; <add> (str, range, input, replaceDefaultBoolean = false) => { <add> let msg = replaceDefaultBoolean ? str : <add> `The value of "${str}" is out of range.`; <ide> if (range !== undefined) msg += ` It must be ${range}.`; <del> msg += ` Received ${value}`; <add> msg += ` Received ${input}`; <ide> return msg; <ide> }, RangeError); <ide> E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s', Error); <ide><path>lib/tls.js <ide> <ide> 'use strict'; <ide> <del>const { ERR_TLS_CERT_ALTNAME_INVALID } = require('internal/errors').codes; <add>const { <add> ERR_TLS_CERT_ALTNAME_INVALID, <add> ERR_OUT_OF_RANGE <add>} = require('internal/errors').codes; <ide> const internalUtil = require('internal/util'); <ide> const internalTLS = require('internal/tls'); <ide> internalUtil.assertCrypto(); <ide> function convertProtocols(protocols) { <ide> const lens = new Array(protocols.length); <ide> const buff = Buffer.allocUnsafe(protocols.reduce((p, c, i) => { <ide> var len = Buffer.byteLength(c); <add> if (len > 255) { <add> throw new ERR_OUT_OF_RANGE('The byte length of the protocol at index ' + <add> `${i} exceeds the maximum length.`, '<= 255', len, true); <add> } <ide> lens[i] = len; <ide> return p + 1 + len; <ide> }, 0)); <ide><path>test/parallel/test-tls-basic-validations.js <ide> common.expectsError( <ide> assert(out.ALPNProtocols.equals(Buffer.from(expectView))); <ide> } <ide> } <add> <add>{ <add> const protocols = [(new String('a')).repeat(500)]; <add> const out = {}; <add> common.expectsError( <add> () => tls.convertALPNProtocols(protocols, out), <add> { <add> code: 'ERR_OUT_OF_RANGE', <add> message: 'The byte length of the protocol at index 0 exceeds the ' + <add> 'maximum length. It must be <= 255. Received 500' <add> } <add> ); <add>}
3
Text
Text
update fallback docs
b9791bf99940e15eda60e863fe8e052d356e0b7c
<ide><path>docs/api-reference/next.config.js/rewrites.md <ide> The order Next.js routes are checked is: <ide> 3. `beforeFiles` rewrites are checked/applied <ide> 4. static files from the [public directory](/docs/basic-features/static-file-serving), `_next/static` files, and non-dynamic pages are checked/served <ide> 5. `afterFiles` rewrites are checked/applied, if one of these rewrites is matched we check dynamic routes/static files after each match <del>6. `fallback` rewrites are checked/applied, these are applied before rendering the 404 page and after dynamic routes/all static assets have been checked. <add>6. `fallback` rewrites are checked/applied, these are applied before rendering the 404 page and after dynamic routes/all static assets have been checked. If you use [fallback: true/'blocking'](/docs/api-reference/data-fetching/get-static-paths#fallback-true) in `getStaticPaths`, the fallback `rewrites` defined in your `next.config.js` will _not_ be run. <ide> <ide> ## Rewrite parameters <ide> <ide><path>docs/migrating/incremental-adoption.md <ide> The second strategy is to create a new Next.js app that points to the root URL o <ide> <ide> For example, let's say you created a Next.js app to be served from `example.com` with the following `next.config.js`. Now, requests for the pages you’ve added to this Next.js app (e.g. `/about` if you’ve added `pages/about.js`) will be handled by Next.js, and requests for any other route (e.g. `/dashboard`) will be proxied to `proxy.example.com`. <ide> <add>> **Note:** If you use [fallback: true/'blocking'](/docs/api-reference/data-fetching/get-static-paths#fallback-true) in `getStaticPaths`, the catch-all fallback `rewrites` defined in `next.config.js` will not be run. They are instead caught by the `getStaticPaths` fallback. <add> <ide> ```jsx <ide> // next.config.js <ide>
2
Go
Go
fix race in firewalldinit
a05bcd12c44b4daada51267d89fd9ac53812be02
<ide><path>pkg/iptables/firewalld.go <ide> package iptables <ide> <ide> import ( <ide> "fmt" <add> "strings" <add> <ide> "github.com/Sirupsen/logrus" <ide> "github.com/godbus/dbus" <del> "strings" <ide> ) <ide> <ide> type IPV string <ide> func FirewalldInit() { <ide> if err != nil { <ide> logrus.Errorf("Failed to connect to D-Bus system bus: %s", err) <ide> } <add> if connection != nil { <add> go signalHandler() <add> } <ide> <ide> firewalldRunning = checkRunning() <ide> } <ide> func (c *Conn) initConnection() error { <ide> <ide> c.signal = make(chan *dbus.Signal, 10) <ide> c.sysconn.Signal(c.signal) <del> go signalHandler() <ide> <ide> return nil <ide> } <ide> <ide> func signalHandler() { <del> if connection != nil { <del> for signal := range connection.signal { <del> if strings.Contains(signal.Name, "NameOwnerChanged") { <del> firewalldRunning = checkRunning() <del> dbusConnectionChanged(signal.Body) <del> } else if strings.Contains(signal.Name, "Reloaded") { <del> reloaded() <del> } <add> for signal := range connection.signal { <add> if strings.Contains(signal.Name, "NameOwnerChanged") { <add> firewalldRunning = checkRunning() <add> dbusConnectionChanged(signal.Body) <add> } else if strings.Contains(signal.Name, "Reloaded") { <add> reloaded() <ide> } <ide> } <ide> }
1
Ruby
Ruby
prevent error on transliterate with frozen strings
fc6ec7bfc7d1cc13380ac91eac3caeaa5e37df02
<ide><path>activesupport/lib/active_support/inflector/transliterate.rb <ide> module Inflector <ide> # Transliteration is restricted to UTF-8, US-ASCII and GB18030 strings <ide> # Other encodings will raise an ArgumentError. <ide> def transliterate(string, replacement = "?", locale: nil) <add> string = string.dup if string.frozen? <ide> raise ArgumentError, "Can only transliterate strings. Received #{string.class.name}" unless string.is_a?(String) <ide> <ide> allowed_encodings = [Encoding::UTF_8, Encoding::US_ASCII, Encoding::GB18030] <ide><path>activesupport/test/transliterate_test.rb <ide> def test_transliterate_handles_unknown_object <ide> end <ide> <ide> def test_transliterate_handles_strings_with_valid_utf8_encodings <del> string = String.new("A", encoding: Encoding::UTF_8) <add> string = String.new("A", encoding: Encoding::UTF_8).freeze <ide> assert_equal "A", ActiveSupport::Inflector.transliterate(string) <ide> end <ide> <ide> def test_transliterate_handles_strings_with_valid_us_ascii_encodings <del> string = String.new("A", encoding: Encoding::US_ASCII) <add> string = String.new("A", encoding: Encoding::US_ASCII).freeze <ide> transcoded = ActiveSupport::Inflector.transliterate(string) <ide> assert_equal "A", transcoded <ide> assert_equal Encoding::US_ASCII, transcoded.encoding <ide> end <ide> <ide> def test_transliterate_handles_strings_with_valid_gb18030_encodings <del> string = String.new("A", encoding: Encoding::GB18030) <add> string = String.new("A", encoding: Encoding::GB18030).freeze <ide> transcoded = ActiveSupport::Inflector.transliterate(string) <ide> assert_equal "A", transcoded <ide> assert_equal Encoding::GB18030, transcoded.encoding <ide> def test_transliterate_handles_strings_with_incompatible_encodings <ide> Encoding::GB18030 <ide> ] <ide> incompatible_encodings.each do |encoding| <del> string = String.new("", encoding: encoding) <add> string = String.new("", encoding: encoding).freeze <ide> exception = assert_raises ArgumentError do <ide> ActiveSupport::Inflector.transliterate(string) <ide> end <ide> def test_transliterate_handles_strings_with_incompatible_encodings <ide> end <ide> <ide> def test_transliterate_handles_strings_with_invalid_utf8_bytes <del> string = String.new("\255", encoding: Encoding::UTF_8) <add> string = String.new("\255", encoding: Encoding::UTF_8).freeze <ide> assert_equal "?", ActiveSupport::Inflector.transliterate(string) <ide> end <ide> <ide> def test_transliterate_handles_strings_with_invalid_us_ascii_bytes <del> string = String.new("\255", encoding: Encoding::US_ASCII) <add> string = String.new("\255", encoding: Encoding::US_ASCII).freeze <ide> assert_equal "?", ActiveSupport::Inflector.transliterate(string) <ide> end <ide> <ide> def test_transliterate_handles_strings_with_invalid_gb18030_bytes <del> string = String.new("\255", encoding: Encoding::GB18030) <add> string = String.new("\255", encoding: Encoding::GB18030).freeze <ide> assert_equal "?", ActiveSupport::Inflector.transliterate(string) <ide> end <ide> end
2
Javascript
Javascript
set stderr._destroy to dummydestroy
71f4d5abfa4dcc9b0aa2d17a80213eecfc4a911b
<ide><path>lib/internal/process/stdio.js <ide> function getMainThreadStdio() { <ide> stderr = createWritableStdioStream(2); <ide> stderr.destroySoon = stderr.destroy; <ide> // Override _destroy so that the fd is never actually closed. <del> stdout._destroy = dummyDestroy; <add> stderr._destroy = dummyDestroy; <ide> if (stderr.isTTY) { <ide> process.on('SIGWINCH', () => stderr._refreshSize()); <ide> }
1
Mixed
Ruby
return proper format on exceptions
bd8c0b8a7ad680aae909c6453758d86b9fc66559
<ide><path>actionpack/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <add>* Return proper format on exceptions. *Santiago Pastorino* <add> <ide> * Allow to use mounted_helpers (helpers for accessing mounted engines) in ActionView::TestCase. *Piotr Sarnacki* <ide> <ide> * Include mounted_helpers (helpers for accessing mounted engines) in ActionDispatch::IntegrationTest by default. *Piotr Sarnacki* <ide><path>actionpack/lib/action_dispatch/middleware/public_exceptions.rb <ide> module ActionDispatch <ide> class PublicExceptions <ide> attr_accessor :public_path <ide> <del> def initialize(public_path) <add> def initialize(public_path, consider_all_requests_local = false) <ide> @public_path = public_path <add> @consider_all_requests_local = consider_all_requests_local <ide> end <ide> <ide> def call(env) <del> status = env["PATH_INFO"][1..-1] <del> locale_path = "#{public_path}/#{status}.#{I18n.locale}.html" if I18n.locale <del> path = "#{public_path}/#{status}.html" <del> <del> if locale_path && File.exist?(locale_path) <del> render(status, File.read(locale_path)) <del> elsif File.exist?(path) <del> render(status, File.read(path)) <add> exception = env["action_dispatch.exception"] <add> status = env["PATH_INFO"][1..-1] <add> request = ActionDispatch::Request.new(env) <add> content_type = request.formats.first <add> format = (mime = Mime[content_type]) && "to_#{mime.to_sym}" <add> body = { :status => status, :error => exception.message } <add> <add> render(status, body, :format => format, :content_type => content_type) <add> end <add> <add> private <add> <add> def render(status, body, options) <add> format = options[:format] <add> <add> if !@consider_all_requests_local && format && body.respond_to?(format) <add> render_format(status, body.public_send(format), options) <ide> else <del> [404, { "X-Cascade" => "pass" }, []] <add> render_html(status) <ide> end <ide> end <ide> <del> private <add> def render_format(status, body, options) <add> [status, {'Content-Type' => "#{options[:content_type]}; charset=#{ActionDispatch::Response.default_charset}", <add> 'Content-Length' => body.bytesize.to_s}, [body]] <add> end <add> <add> def render_html(status) <add> found = false <add> path = "#{public_path}/#{status}.#{I18n.locale}.html" if I18n.locale <add> path = "#{public_path}/#{status}.html" unless path && (found = File.exist?(path)) <ide> <del> def render(status, body) <del> [status, {'Content-Type' => "text/html; charset=#{Response.default_charset}", 'Content-Length' => body.bytesize.to_s}, [body]] <add> if found || File.exist?(path) <add> body = File.read(path) <add> [status, {'Content-Type' => "text/html; charset=#{Response.default_charset}", 'Content-Length' => body.bytesize.to_s}, [body]] <add> else <add> [404, { "X-Cascade" => "pass" }, []] <add> end <ide> end <ide> end <del>end <ide>\ No newline at end of file <add>end <ide><path>actionpack/test/controller/show_exceptions_test.rb <ide> def show_detailed_exceptions? <ide> end <ide> end <ide> <add> class ShowLocalExceptionsController < ActionController::Base <add> use ActionDispatch::ShowExceptions, ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public", true) <add> <add> def boom <add> raise 'boom!' <add> end <add> end <add> <ide> class ShowExceptionsTest < ActionDispatch::IntegrationTest <ide> test 'show error page from a remote ip' do <ide> @app = ShowExceptionsController.action(:boom) <ide> class ShowExceptionsOverridenTest < ActionDispatch::IntegrationTest <ide> assert_match(/boom/, body) <ide> end <ide> end <add> <add> class ShowExceptionsFormatsTest < ActionDispatch::IntegrationTest <add> def test_render_json_exception <add> @app = ShowExceptionsOverridenController.action(:boom) <add> get "/", {}, 'HTTP_ACCEPT' => 'application/json' <add> assert_response :internal_server_error <add> assert_equal 'application/json', response.content_type.to_s <add> assert_equal({ :status => '500', :error => 'boom!' }.to_json, response.body) <add> end <add> <add> def test_render_xml_exception <add> @app = ShowExceptionsOverridenController.action(:boom) <add> get "/", {}, 'HTTP_ACCEPT' => 'application/xml' <add> assert_response :internal_server_error <add> assert_equal 'application/xml', response.content_type.to_s <add> assert_equal({ :status => '500', :error => 'boom!' }.to_xml, response.body) <add> end <add> <add> def test_render_fallback_exception <add> @app = ShowExceptionsOverridenController.action(:boom) <add> get "/", {}, 'HTTP_ACCEPT' => 'text/csv' <add> assert_response :internal_server_error <add> assert_equal 'text/html', response.content_type.to_s <add> end <add> end <add> <add> class ShowExceptionsFormatsTest < ActionDispatch::IntegrationTest <add> def test_render_formatted_exception_in_development <add> @app = ShowLocalExceptionsController.action(:boom) <add> get "/", {}, 'HTTP_ACCEPT' => 'application/xml' <add> <add> assert_response :internal_server_error <add> assert_equal 'text/html', response.content_type.to_s <add> end <add> end <ide> end
3
Python
Python
remove manual error message
cd01f01e9238bf3d4d42613d804e06d35b94b48f
<ide><path>numpy/ma/core.py <ide> def count(self, axis=None, keepdims=np._NoValue): <ide> <ide> if self.shape is (): <ide> if axis not in (None, 0): <del> raise np.AxisError("'axis' entry is out of bounds") <add> raise np.AxisError(axis=axis, ndim=self.ndim) <ide> return 1 <ide> elif axis is None: <ide> if kwargs.get('keepdims', False):
1
Ruby
Ruby
add brew tap-info
787934ed6fcf1f0b7a6240f8daf6d8908cf09650
<ide><path>Library/Homebrew/cmd/tap-info.rb <add>require "cmd/tap" <add> <add>module Homebrew <add> def tap_info <add> if ARGV.include? "--installed" <add> taps = Tap <add> else <add> taps = ARGV.named.map do |name| <add> Tap.new(*tap_args(name)) <add> end <add> end <add> <add> if ARGV.json == "v1" <add> print_tap_json(taps) <add> else <add> print_tap_info(taps) <add> end <add> end <add> <add> private <add> <add> def print_tap_info(taps) <add> if taps.none? <add> tap_count = 0 <add> formula_count = 0 <add> command_count = 0 <add> Tap.each do |tap| <add> tap_count += 1 <add> formula_count += tap.formula_files.size <add> command_count += tap.command_files.size <add> end <add> info = "#{tap_count} tap#{plural(tap_count)}" <add> info += ", #{formula_count} formula#{plural(formula_count, "e")}" <add> info += ", #{command_count} command#{plural(command_count)}" <add> info += ", #{Tap::TAP_DIRECTORY.abv}" if Tap::TAP_DIRECTORY.directory? <add> puts info <add> else <add> taps.each_with_index do |tap, i| <add> puts unless i == 0 <add> info = "#{tap}: " <add> if tap.installed? <add> formula_count = tap.formula_files.size <add> info += "#{formula_count} formula#{plural(formula_count, "e")} " if formula_count > 0 <add> command_count = tap.command_files.size <add> info += "#{command_count} command#{plural(command_count)} " if command_count > 0 <add> info += "\n#{tap.path} (#{tap.path.abv})" <add> else <add> info += "Not installed" <add> end <add> puts info <add> puts "From: #{tap.remote}" <add> end <add> end <add> end <add> <add> def print_tap_json(taps) <add> puts Utils::JSON.dump(taps.map(&:to_hash)) <add> end <add>end
1
Python
Python
remove accidental pdb call
4881364a86a9d7452798ea690c7bd2339f0d6b42
<ide><path>libcloud/httplib_ssl.py <ide> def __init__(self, host, port, **kwargs): <ide> self.session.timeout = kwargs.get('timeout', 60) <ide> <ide> def request(self, method, url, body=None, headers=None, raw=False): <del> import pdb; pdb.set_trace() <ide> self.response = self.session.request( <ide> method=method.lower(), <ide> url=''.join([self.host, url]),
1
Javascript
Javascript
replace string concetation with templates
94fb298819d9f4b3a575f64c71963e600d353067
<ide><path>tools/doc/html.js <ide> function buildToc(lexed, filename, cb) { <ide> <ide> depth = tok.depth; <ide> const realFilename = path.basename(realFilenames[0], '.md'); <del> const id = getId(realFilename + '_' + tok.text.trim()); <add> const id = getId(`${realFilename}_${tok.text.trim()}`); <ide> toc.push(new Array((depth - 1) * 2 + 1).join(' ') + <ide> `* <span class="stability_${tok.stability}">` + <ide> `<a href="#${id}">${tok.text}</a></span>`); <del> tok.text += '<span><a class="mark" href="#' + id + '" ' + <del> 'id="' + id + '">#</a></span>'; <add> tok.text += `<span><a class="mark" href="#${id}"` + <add> `id="${id}">#</a></span>`; <ide> }); <ide> <ide> toc = marked.parse(toc.join('\n')); <ide> function getId(text) { <ide> text = text.replace(/^_+|_+$/, ''); <ide> text = text.replace(/^([^a-z])/, '_$1'); <ide> if (idCounters.hasOwnProperty(text)) { <del> text += '_' + (++idCounters[text]); <add> text += `_${(++idCounters[text])}`; <ide> } else { <ide> idCounters[text] = 0; <ide> }
1
Python
Python
fix .merge tests to not use deprecated api
5914faafbb6ed4703f85e7f4a9a23e7ad7da383b
<ide><path>spacy/tests/doc/test_doc_api.py <ide> def test_doc_api_merge(en_tokenizer): <ide> # merge 'The Beach Boys' <ide> doc = en_tokenizer(text) <ide> assert len(doc) == 9 <del> doc.merge(doc[4].idx, doc[6].idx + len(doc[6]), 'NAMED', 'LEMMA', 'TYPE') <add> doc.merge(doc[4].idx, doc[6].idx + len(doc[6]), tag='NAMED', lemma='LEMMA', <add> ent_type='TYPE') <ide> assert len(doc) == 7 <ide> assert doc[4].text == 'the beach boys' <ide> assert doc[4].text_with_ws == 'the beach boys ' <ide> def test_doc_api_merge(en_tokenizer): <ide> # merge 'all night' <ide> doc = en_tokenizer(text) <ide> assert len(doc) == 9 <del> doc.merge(doc[7].idx, doc[8].idx + len(doc[8]), 'NAMED', 'LEMMA', 'TYPE') <add> doc.merge(doc[7].idx, doc[8].idx + len(doc[8]), tag='NAMED', lemma='LEMMA', <add> ent_type='TYPE') <ide> assert len(doc) == 8 <ide> assert doc[7].text == 'all night' <ide> assert doc[7].text_with_ws == 'all night' <ide> def test_doc_api_merge_children(en_tokenizer): <ide> text = "WKRO played songs by the beach boys all night" <ide> doc = en_tokenizer(text) <ide> assert len(doc) == 9 <del> doc.merge(doc[4].idx, doc[6].idx + len(doc[6]), 'NAMED', 'LEMMA', 'TYPE') <add> doc.merge(doc[4].idx, doc[6].idx + len(doc[6]), tag='NAMED', lemma='LEMMA', <add> ent_type='TYPE') <ide> <ide> for word in doc: <ide> if word.i < word.head.i: <ide> def test_doc_api_merge_children(en_tokenizer): <ide> def test_doc_api_merge_hang(en_tokenizer): <ide> text = "through North and South Carolina" <ide> doc = en_tokenizer(text) <del> doc.merge(18, 32, '', '', 'ORG') <del> doc.merge(8, 32, '', '', 'ORG') <add> doc.merge(18, 32, tag='', lemma='', ent_type='ORG') <add> doc.merge(8, 32, tag='', lemma='', ent_type='ORG') <ide> <ide> <ide> def test_doc_api_sents_empty_string(en_tokenizer): <ide> def test_doc_api_runtime_error(en_tokenizer): <ide> if len(np) > 1: <ide> nps.append((np.start_char, np.end_char, np.root.tag_, np.text, np.root.ent_type_)) <ide> for np in nps: <del> doc.merge(*np) <add> start, end, tag, lemma, ent_type = np <add> doc.merge(start, end, tag=tag, lemma=lemma, ent_type=ent_type) <ide> <ide> <ide> def test_doc_api_right_edge(en_tokenizer): <ide><path>spacy/tests/spans/test_merge.py <ide> def test_spans_merge_tokens(en_tokenizer): <ide> assert len(doc) == 4 <ide> assert doc[0].head.text == 'Angeles' <ide> assert doc[1].head.text == 'start' <del> doc.merge(0, len('Los Angeles'), 'NNP', 'Los Angeles', 'GPE') <add> doc.merge(0, len('Los Angeles'), tag='NNP', lemma='Los Angeles', ent_type='GPE') <ide> assert len(doc) == 3 <ide> assert doc[0].text == 'Los Angeles' <ide> assert doc[0].head.text == 'start' <ide> def test_spans_merge_heads(en_tokenizer): <ide> doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads) <ide> <ide> assert len(doc) == 8 <del> doc.merge(doc[3].idx, doc[4].idx + len(doc[4]), doc[4].tag_, 'pilates class', 'O') <add> doc.merge(doc[3].idx, doc[4].idx + len(doc[4]), tag=doc[4].tag_, <add> lemma='pilates class', ent_type='O') <ide> assert len(doc) == 7 <ide> assert doc[0].head.i == 1 <ide> assert doc[1].head.i == 1 <ide> def test_span_np_merges(en_tokenizer): <ide> doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads) <ide> <ide> assert doc[4].head.i == 1 <del> doc.merge(doc[2].idx, doc[4].idx + len(doc[4]), 'NP', 'tool', 'O') <add> doc.merge(doc[2].idx, doc[4].idx + len(doc[4]), tag='NP', lemma='tool', <add> ent_type='O') <ide> assert doc[2].head.i == 1 <ide> <ide> text = "displaCy is a lightweight and modern dependency parse tree visualization tool built with CSS3 and JavaScript." <ide> def test_span_np_merges(en_tokenizer): <ide> <ide> ents = [(e[0].idx, e[-1].idx + len(e[-1]), e.label_, e.lemma_) for e in doc.ents] <ide> for start, end, label, lemma in ents: <del> merged = doc.merge(start, end, label, lemma, label) <add> merged = doc.merge(start, end, tag=label, lemma=lemma, ent_type=label) <ide> assert merged != None, (start, end, label, lemma) <ide> <ide> <ide> def test_spans_entity_merge(en_tokenizer): <ide> assert len(doc) == 17 <ide> for ent in doc.ents: <ide> label, lemma, type_ = (ent.root.tag_, ent.root.lemma_, max(w.ent_type_ for w in ent)) <del> ent.merge(label, lemma, type_) <add> ent.merge(label=label, lemma=lemma, ent_type=type_) <ide> # check looping is ok <ide> assert len(doc) == 15 <ide> <ide> def test_spans_sentence_update_after_merge(en_tokenizer): <ide> sent1, sent2 = list(doc.sents) <ide> init_len = len(sent1) <ide> init_len2 = len(sent2) <del> doc[0:2].merge('none', 'none', 'none') <del> doc[-2:].merge('none', 'none', 'none') <add> doc[0:2].merge(label='none', lemma='none', ent_type='none') <add> doc[-2:].merge(label='none', lemma='none', ent_type='none') <ide> assert len(sent1) == init_len - 1 <ide> assert len(sent2) == init_len2 - 1 <ide> <ide> def test_spans_subtree_size_check(en_tokenizer): <ide> doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads, deps=deps) <ide> sent1 = list(doc.sents)[0] <ide> init_len = len(list(sent1.root.subtree)) <del> doc[0:2].merge('none', 'none', 'none') <del> assert len(list(sent1.root.subtree)) == init_len - 1 <ide>\ No newline at end of file <add> doc[0:2].merge(label='none', lemma='none', ent_type='none') <add> assert len(list(sent1.root.subtree)) == init_len - 1
2
PHP
PHP
add assertnoredirect method
4e409d6a9d582a087f28e38e1eb79cf2018cff9c
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> public function assertRedirect($url, $message = '') { <ide> $this->assertEquals(Router::url($url, ['_full' => true]), $result['Location'], $message); <ide> } <ide> <add>/** <add> * Asserts that the Location header is not set. <add> * <add> * @param string $message The failure message that will be appended to the generated message. <add> * @return void <add> */ <add> public function assertNoRedirect($message = '') { <add> if (!$this->_response) { <add> $this->fail('No response set, cannot assert location header. ' . $message); <add> } <add> $result = $this->_response->header(); <add> if (!$message) { <add> $message = 'Redirect header set'; <add> } <add> if (!empty($result['Location'])) { <add> $message .= ': ' . $result['Location']; <add> } <add> $this->assertEmpty($result['Location'], $message); <add> } <add> <ide> /** <ide> * Asserts response headers <ide> *
1
Javascript
Javascript
improve compare output
809af1fe8a0a096be4f0a3020f8e60ee1c827cbc
<ide><path>benchmark/compare.js <ide> 'use strict'; <ide> <del>const fork = require('child_process').fork; <add>const { fork } = require('child_process'); <add>const { inspect } = require('util'); <ide> const path = require('path'); <ide> const CLI = require('./_cli.js'); <ide> const BenchmarkProgress = require('./_benchmark_progress.js'); <ide> if (showProgress) { <ide> // Construct configuration string, " A=a, B=b, ..." <ide> let conf = ''; <ide> for (const key of Object.keys(data.conf)) { <del> conf += ` ${key}=${JSON.stringify(data.conf[key])}`; <add> conf += ` ${key}=${inspect(data.conf[key])}`; <ide> } <ide> conf = conf.slice(1); <ide> // Escape quotes (") for correct csv formatting
1
Python
Python
fix whitespace issue
ff98b041da4b992a87d8b6258b30e47310ec8430
<ide><path>transformers/__init__.py <ide> from .modeling_tf_distilbert import (TFDistilBertPreTrainedModel, TFDistilBertMainLayer, <ide> TFDistilBertModel, TFDistilBertForMaskedLM, <ide> TFDistilBertForSequenceClassification, <del> TFDistilBertForTokenClassification, <add> TFDistilBertForTokenClassification, <ide> TFDistilBertForQuestionAnswering, <ide> TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_MAP) <ide>
1
Mixed
Python
add vocab kwarg back to spacy.load
124304b14672cb3d82c495b0fd45f60ecca90ea8
<ide><path>spacy/__init__.py <ide> def load( <ide> name: Union[str, Path], <ide> *, <add> vocab: Union[Vocab, bool] = True, <ide> disable: Iterable[str] = util.SimpleFrozenList(), <ide> exclude: Iterable[str] = util.SimpleFrozenList(), <ide> config: Union[Dict[str, Any], Config] = util.SimpleFrozenDict(), <ide> ) -> Language: <ide> """Load a spaCy model from an installed package or a local path. <ide> <ide> name (str): Package name or model path. <add> vocab (Vocab): A Vocab object. If True, a vocab is created. <ide> disable (Iterable[str]): Names of pipeline components to disable. Disabled <ide> pipes will be loaded but they won't be run unless you explicitly <ide> enable them by calling nlp.enable_pipe. <ide> def load( <ide> keyed by section values in dot notation. <ide> RETURNS (Language): The loaded nlp object. <ide> """ <del> return util.load_model(name, disable=disable, exclude=exclude, config=config) <add> return util.load_model( <add> name, vocab=vocab, disable=disable, exclude=exclude, config=config <add> ) <ide> <ide> <ide> def blank( <ide> name: str, <ide> *, <ide> vocab: Union[Vocab, bool] = True, <ide> config: Union[Dict[str, Any], Config] = util.SimpleFrozenDict(), <del> meta: Dict[str, Any] = util.SimpleFrozenDict() <add> meta: Dict[str, Any] = util.SimpleFrozenDict(), <ide> ) -> Language: <ide> """Create a blank nlp object for a given language code. <ide> <ide><path>website/docs/api/top-level.md <ide> specified separately using the new `exclude` keyword argument. <ide> | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> | `name` | Pipeline to load, i.e. package name or path. ~~Union[str, Path]~~ | <ide> | _keyword-only_ | | <add>| `vocab` | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <ide> | `disable` | Names of pipeline components to [disable](/usage/processing-pipelines#disabling). Disabled pipes will be loaded but they won't be run unless you explicitly enable them by calling [nlp.enable_pipe](/api/language#enable_pipe). ~~List[str]~~ | <ide> | `exclude` <Tag variant="new">3</Tag> | Names of pipeline components to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~List[str]~~ | <ide> | `config` <Tag variant="new">3</Tag> | Optional config overrides, either as nested dict or dict keyed by section value in dot notation, e.g. `"components.name.value"`. ~~Union[Dict[str, Any], Config]~~ | <ide> Create a blank pipeline of a given language class. This function is the twin of <ide> | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | <ide> | `name` | [ISO code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) of the language class to load. ~~str~~ | <ide> | _keyword-only_ | | <del>| `vocab` <Tag variant="new">3</Tag> | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~. | <add>| `vocab` | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <ide> | `config` <Tag variant="new">3</Tag> | Optional config overrides, either as nested dict or dict keyed by section value in dot notation, e.g. `"components.name.value"`. ~~Union[Dict[str, Any], Config]~~ | <del>| `meta` <Tag variant="new">3</Tag> | Optional meta overrides for [`nlp.meta`](/api/language#meta). ~~Dict[str, Any]~~ | <add>| `meta` | Optional meta overrides for [`nlp.meta`](/api/language#meta). ~~Dict[str, Any]~~ | <ide> | **RETURNS** | An empty `Language` object of the appropriate subclass. ~~Language~~ | <ide> <ide> ### spacy.info {#spacy.info tag="function"} <ide> and create a `Language` object. The model data will then be loaded in via <ide> | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | <ide> | `name` | Package name or path. ~~str~~ | <ide> | _keyword-only_ | | <del>| `vocab` <Tag variant="new">3</Tag> | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <add>| `vocab` | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <ide> | `disable` | Names of pipeline components to [disable](/usage/processing-pipelines#disabling). Disabled pipes will be loaded but they won't be run unless you explicitly enable them by calling [`nlp.enable_pipe`](/api/language#enable_pipe). ~~List[str]~~ | <ide> | `exclude` <Tag variant="new">3</Tag> | Names of pipeline components to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~List[str]~~ | <ide> | `config` <Tag variant="new">3</Tag> | Config overrides as nested dict or flat dict keyed by section values in dot notation, e.g. `"nlp.pipeline"`. ~~Union[Dict[str, Any], Config]~~ | <ide> A helper function to use in the `load()` method of a pipeline package's <ide> | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <ide> | `init_file` | Path to package's `__init__.py`, i.e. `__file__`. ~~Union[str, Path]~~ | <ide> | _keyword-only_ | | <del>| `vocab` <Tag variant="new">3</Tag> | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~. | <add>| `vocab` <Tag variant="new">3</Tag> | Optional shared vocab to pass in on initialization. If `True` (default), a new `Vocab` object will be created. ~~Union[Vocab, bool]~~ | <ide> | `disable` | Names of pipeline components to [disable](/usage/processing-pipelines#disabling). Disabled pipes will be loaded but they won't be run unless you explicitly enable them by calling [nlp.enable_pipe](/api/language#enable_pipe). ~~List[str]~~ | <ide> | `exclude` <Tag variant="new">3</Tag> | Names of pipeline components to [exclude](/usage/processing-pipelines#disabling). Excluded components won't be loaded. ~~List[str]~~ | <ide> | `config` <Tag variant="new">3</Tag> | Config overrides as nested dict or flat dict keyed by section values in dot notation, e.g. `"nlp.pipeline"`. ~~Union[Dict[str, Any], Config]~~ | <ide> vary on each step. <ide> > nlp.update(batch) <ide> > ``` <ide> <del>| Name | Description | <del>| ---------- | ---------------------------------------- | <del>| `items` | The items to batch up. ~~Iterable[Any]~~ | <del>| `size` | int / iterable | The batch size(s). ~~Union[int, Sequence[int]]~~ | <del>| **YIELDS** | The batches. | <add>| Name | Description | <add>| ---------- | ------------------------------------------------ | <add>| `items` | The items to batch up. ~~Iterable[Any]~~ | <add>| `size` | The batch size(s). ~~Union[int, Sequence[int]]~~ | <add>| **YIELDS** | The batches. | <ide> <ide> ### util.filter_spans {#util.filter_spans tag="function" new="2.1.4"} <ide>
2
Javascript
Javascript
fix escape issue
3a0fe4349c911e49f78c0fb9a424ce3fe4717e94
<ide><path>examples/with-material-ui-next/pages/_document.js <ide> export default class MyDocument extends Document { <ide> const styleContext = getDefaultContext() <ide> return { <ide> ...page, <del> styles: ( <del> <style id='jss-server-side' type='text/css'> <del> {styleContext.styleManager.sheetsToString()} <del> </style> <del> ) <add> styles: <style id='jss-server-side' dangerouslySetInnerHTML={{ __html: styleContext.styleManager.sheetsToString() }} /> <ide> } <ide> } <ide>
1
Mixed
Ruby
ensure suppressor runs before validations
73f8c16601e51480d007dca5a33f2035293bdd23
<ide><path>activerecord/CHANGELOG.md <add>* Ensure that the Suppressor runs before validations. <add> <add> This moves the suppressor up to be run before validations rather than after <add> validations. There's no reason to validate a record you aren't planning on saving. <add> <add> *Eileen M. Uchitelle* <add> <ide> ## Rails 5.0.0.beta3 (February 24, 2016) ## <ide> <ide> * Ensure that mutations of the array returned from `ActiveRecord::Relation#to_a` <ide><path>activerecord/lib/active_record/suppressor.rb <ide> def suppress(&block) <ide> end <ide> end <ide> <del> def create_or_update(*args) # :nodoc: <add> def save(*) # :nodoc: <add> SuppressorRegistry.suppressed[self.class.name] ? true : super <add> end <add> <add> def save!(*) # :nodoc: <ide> SuppressorRegistry.suppressed[self.class.name] ? true : super <ide> end <ide> end <ide><path>activerecord/test/cases/suppressor_test.rb <ide> def test_resumes_saving_after_suppression_complete <ide> Notification.suppress { UserWithNotification.create! } <ide> <ide> assert_difference -> { Notification.count } do <del> Notification.create! <add> Notification.create!(message: "New Comment") <add> end <add> end <add> <add> def test_suppresses_validations_on_create <add> assert_no_difference -> { Notification.count } do <add> Notification.suppress do <add> User.create <add> User.create! <add> User.new.save <add> User.new.save! <add> end <ide> end <ide> end <ide> end <ide><path>activerecord/test/models/notification.rb <ide> class Notification < ActiveRecord::Base <add> validates_presence_of :message <ide> end
4
Javascript
Javascript
add test case for watch-options-poll
026efa8b1ad60e3dbacb42446303d49e2e88dd16
<ide><path>test/Cli.test.js <ide> describe("Cli", () => { <ide> "numbers", <ide> { <ide> "watch-options-aggregate-timeout": 100, <add> "watch-options-poll": "100", <ide> "output-ecma-version": "2015" <ide> }, <ide> {}, <ide> describe("Cli", () => { <ide> }, <ide> "watchOptions": Object { <ide> "aggregateTimeout": 100, <add> "poll": 100, <ide> }, <ide> } <ide> `)
1
Javascript
Javascript
fix accessibility issues
c6c1e347d0fcf6a7d34e57fa402da1b2735395fc
<ide><path>packages/learn/src/templates/Challenges/components/Test-Suite.js <ide> const propTypes = { <ide> <ide> function getAccessibleText(err, pass, text) { <ide> let accessibleText = 'Waiting'; <add> const cleanText = text.replace(/<\/?code>/g, ''); <ide> <ide> // Determine test status (i.e. icon) <ide> if (err) { <ide> function getAccessibleText(err, pass, text) { <ide> } <ide> <ide> // Append the text itself <del> return accessibleText + ' - ' + text; <add> return accessibleText + ' - ' + cleanText; <ide> } <ide> <ide> function TestSuite({ tests }) { <ide><path>packages/learn/src/templates/Challenges/components/icons/GreenNotCompleted.js <del>import React from 'react'; <add>import React, { Fragment } from 'react'; <ide> <ide> const propTypes = {}; <ide> <ide> function GreenNotCompleted(props) { <ide> return ( <del> <svg <del> height='50' <del> viewBox='0 0 200 200' <del> width='50' <del> xmlns='http://www.w3.org/2000/svg' <del> {...props} <del> > <del> <g> <del> <title>Not Passed</title> <del> <circle <del> cx='100' <del> cy='99' <del> fill='#FFFFFF' <del> r='95' <del> stroke='#006400' <del> strokeDasharray='null' <del> strokeLinecap='null' <del> strokeLinejoin='null' <del> strokeWidth='5' <del> /> <del> </g> <del> </svg> <add> <Fragment> <add> <span className='sr-only'>Not Passed</span> <add> <svg <add> height='50' <add> viewBox='0 0 200 200' <add> width='50' <add> xmlns='http://www.w3.org/2000/svg' <add> {...props} <add> > <add> <g> <add> <title>Not Passed</title> <add> <circle <add> cx='100' <add> cy='99' <add> fill='#FFFFFF' <add> r='95' <add> stroke='#006400' <add> strokeDasharray='null' <add> strokeLinecap='null' <add> strokeLinejoin='null' <add> strokeWidth='5' <add> /> <add> </g> <add> </svg> <add> </Fragment> <ide> ); <ide> } <ide> <ide><path>packages/learn/src/templates/Challenges/components/icons/GreenPass.js <del>import React from 'react'; <add>import React, { Fragment } from 'react'; <ide> <ide> function GreenPass(props) { <ide> return ( <del> <svg <del> height='50' <del> viewBox='0 0 200 200' <del> width='50' <del> xmlns='http://www.w3.org/2000/svg' <del> {...props} <del> > <del> <g> <del> <title>Passed</title> <del> <circle <del> cx='100' <del> cy='99' <del> fill='#006400' <del> r='95' <del> stroke='#006400' <del> strokeDasharray='null' <del> strokeLinecap='null' <del> strokeLinejoin='null' <del> /> <del> <rect <del> fill='#ffffff' <del> height='30' <del> stroke='#ffffff' <del> strokeDasharray='null' <del> strokeLinecap='null' <del> strokeLinejoin='null' <del> transform='rotate(-45, 120, 106.321)' <del> width='128.85878' <del> x='55.57059' <del> y='91.32089' <del> /> <del> <rect <del> fill='#ffffff' <del> height='30' <del> stroke='#ffffff' <del> strokeDasharray='null' <del> strokeLinecap='null' <del> strokeLinejoin='null' <del> transform='rotate(45, 66.75, 123.75)' <del> width='80.66548' <del> x='26.41726' <del> y='108.75' <del> /> <del> </g> <del> </svg> <add> <Fragment> <add> <span className='sr-only'>Passed</span> <add> <svg <add> height='50' <add> viewBox='0 0 200 200' <add> width='50' <add> xmlns='http://www.w3.org/2000/svg' <add> {...props} <add> > <add> <g> <add> <title>Passed</title> <add> <circle <add> cx='100' <add> cy='99' <add> fill='#006400' <add> r='95' <add> stroke='#006400' <add> strokeDasharray='null' <add> strokeLinecap='null' <add> strokeLinejoin='null' <add> /> <add> <rect <add> fill='#ffffff' <add> height='30' <add> stroke='#ffffff' <add> strokeDasharray='null' <add> strokeLinecap='null' <add> strokeLinejoin='null' <add> transform='rotate(-45, 120, 106.321)' <add> width='128.85878' <add> x='55.57059' <add> y='91.32089' <add> /> <add> <rect <add> fill='#ffffff' <add> height='30' <add> stroke='#ffffff' <add> strokeDasharray='null' <add> strokeLinecap='null' <add> strokeLinejoin='null' <add> transform='rotate(45, 66.75, 123.75)' <add> width='80.66548' <add> x='26.41726' <add> y='108.75' <add> /> <add> </g> <add> </svg> <add> </Fragment> <ide> ); <ide> } <ide>
3
PHP
PHP
add errors to validator interface.
5a649288b9be7ff12256c3042dce0982900137b2
<ide><path>src/Illuminate/Contracts/Validation/Validator.php <ide> public function sometimes($attribute, $rules, callable $callback); <ide> * @return $this <ide> */ <ide> public function after($callback); <add> <add> /** <add> * Get all of the validation error messages. <add> * <add> * @return array <add> */ <add> public function errors(); <ide> }
1
Javascript
Javascript
fix remaining issues and edge cases
795f6fcbbab6ba3dd9afa6b3ab7a8a9b4d7df75c
<ide><path>lib/optimize/ConcatenatedModule.js <ide> function getFinalName(info, exportName, moduleToInfoMap, requestShortener, asCal <ide> return getExternalImport(importedModule, importedVar, exportName, asCall); <ide> } <ide> } <del> throw new Error(`Cannot get final name for export "${exportName}" in "${info.module.readableIdentifier(requestShortener)}"` + <del> ` (known exports: ${Array.from(info.exportMap.keys()).join(" ")}, ` + <del> `known reexports: ${Array.from(info.reexportMap.keys()).join(" ")})`); <add> const problem = `Cannot get final name for export "${exportName}" in "${info.module.readableIdentifier(requestShortener)}"` + <add> ` (known exports: ${Array.from(info.exportMap.keys()).filter(name => name !== true).join(" ")}, ` + <add> `known reexports: ${Array.from(info.reexportMap.keys()).join(" ")})`; <add> // TODO use Template.toNormalComment when merging with pure-module <add> return `/* ${problem} */ undefined`; <ide> } <ide> case "external": <ide> { <ide> class ConcatenatedModule extends Module { <ide> const allDeps = module.dependencies <ide> .filter(dep => dep instanceof HarmonyImportDependency && dep.module); <ide> <del> return allDeps.map(dep => dep.module); <add> return allDeps.map(dep => () => dep.module); <ide> } <ide> <del> function enterModule(module) { <add> function enterModule(getModule) { <add> const module = getModule(); <ide> if(set.has(module)) return; <ide> set.add(module); <ide> if(modulesSet.has(module)) { <ide> class ConcatenatedModule extends Module { <ide> } else { <ide> list.push({ <ide> type: "external", <del> module <add> get module() { <add> // We need to use a getter here, because the module in the dependency <add> // could be replaced by some other process (i. e. also replaced with a <add> // concatenated module) <add> return getModule(); <add> } <ide> }); <ide> } <ide> } <ide> <del> enterModule(rootModule); <add> enterModule(() => rootModule); <ide> <ide> return list; <ide> } <ide> class ConcatenatedModule extends Module { <ide> if(info.globalScope) { <ide> info.globalScope.through.forEach(reference => { <ide> const name = reference.identifier.name; <del> if(/^__WEBPACK_MODULE_REFERENCE__\d+_(\d+|ns)(_call)?__$/.test(name)) { <add> if(/^__WEBPACK_MODULE_REFERENCE__\d+_([\da-f]+|ns)(_call)?__$/.test(name)) { <ide> for(const s of getSymbolsFromScope(reference.from, info.moduleScope)) { <ide> allUsedNames.add(s); <ide> } <ide> class ConcatenatedModule extends Module { <ide> if(info.type === "concatenated") { <ide> info.globalScope.through.forEach(reference => { <ide> const name = reference.identifier.name; <del> const match = /^__WEBPACK_MODULE_REFERENCE__(\d+)_(\d+|ns)(_call)?__$/.exec(name); <add> const match = /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?__$/.exec(name); <ide> if(match) { <ide> const referencedModule = modulesWithInfo[+match[1]]; <ide> let exportName; <ide> if(match[2] === "ns") { <ide> exportName = true; <ide> } else { <del> const exportIdx = +match[2]; <del> exportName = referencedModule.module.providedExports[exportIdx]; <add> const exportData = match[2]; <add> exportName = Buffer.from(exportData, "hex").toString("utf-8"); <ide> } <ide> const asCall = !!match[3]; <ide> const finalName = getFinalName(referencedModule, exportName, moduleToInfoMap, requestShortener, asCall); <ide> class HarmonyImportSpecifierDependencyConcatenatedTemplate { <ide> this.originalTemplate.apply(dep, source, outputOptions, requestShortener, dependencyTemplates); <ide> return; <ide> } <del> if(!Array.isArray(module.providedExports)) <del> throw new Error(`Module ${module.resource} has no static exports ${module.providedExports}`); <ide> let content; <ide> if(dep.id === null) { <ide> content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns__`; <ide> } else if(dep.namespaceObjectAsContext) { <ide> content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns__[${JSON.stringify(dep.id)}]`; <ide> } else { <del> const exportIdx = (module.providedExports).indexOf(dep.id); <del> content = exportIdx === -1 ? "undefined" : `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportIdx}${dep.call ? "_call" : ""}__`; <add> const exportData = Buffer.from(dep.id, "utf-8").toString("hex"); <add> content = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${dep.call ? "_call" : ""}__`; <ide> } <ide> if(dep.shorthand) { <ide> content = dep.name + ": " + content; <ide> class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { <ide> if(def.id === true) { <ide> finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns__`; <ide> } else { <del> const exportIdx = def.module.providedExports.indexOf(def.id); <del> finalName = exportIdx < 0 ? "undefined" : `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportIdx}__`; <add> const exportData = Buffer.from(def.id, "utf-8").toString("hex"); <add> finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}__`; <ide> } <ide> const exportsName = this.rootModule.exportsArgument || "exports"; <ide> const content = `/* concated harmony reexport */__webpack_require__.d(${exportsName}, ${JSON.stringify(used)}, function() { return ${finalName}; });\n`; <ide><path>lib/optimize/ModuleConcatenationPlugin.js <ide> class ModuleConcatenationPlugin { <ide> continue; <ide> } <ide> <add> // Exports must be known (and not dynamic) <add> if(!Array.isArray(module.providedExports)) { <add> setBailoutReason(module, "Module exports are unknown"); <add> continue; <add> } <add> <ide> relevantModules.push(module); <ide> <ide> // Module must not be the entry points <ide> class ModuleConcatenationPlugin { <ide> continue; <ide> } <ide> <del> // Exports must be known (and not dynamic) <del> if(!Array.isArray(module.providedExports)) { <del> setBailoutReason(module, "Module exports are unknown"); <del> continue; <del> } <del> <ide> // Using dependency variables is not possible as this wraps the code in a function <ide> if(module.variables.length > 0) { <ide> setBailoutReason(module, "Module uses injected variables (usually caused by the ProvidePlugin)");
2
PHP
PHP
fix driver specific failures
50d5416b2a6c680bbcc0fa1e6153fbf9f431b2d2
<ide><path>tests/TestCase/Database/Driver/MysqlTest.php <ide> public function testRollbackTransactionAutoConnect() <ide> $connection = ConnectionManager::get('test'); <ide> $connection->disconnect(); <ide> <del> $driver = $connection->driver(); <add> $driver = $connection->getDriver(); <ide> $this->assertFalse($driver->rollbackTransaction()); <ide> $this->assertTrue($driver->isConnected()); <ide> } <ide> <ide> public function testCommitTransactionAutoConnect() <ide> { <ide> $connection = ConnectionManager::get('test'); <del> $driver = $connection->driver(); <add> $driver = $connection->getDriver(); <ide> <ide> $this->assertFalse($driver->commitTransaction()); <ide> $this->assertTrue($driver->isConnected()); <ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testSqlCaseStatement() <ide> <ide> //Postgres requires the case statement to be cast to a integer <ide> if ($this->connection->getDriver() instanceof \Cake\Database\Driver\Postgres) { <del> $publishedCase = $query->func()->cast([$publishedCase, 'integer' => 'literal'])->type(' AS '); <del> $notPublishedCase = $query->func()->cast([$notPublishedCase, 'integer' => 'literal'])->type(' AS '); <add> $publishedCase = $query->func() <add> ->cast([$publishedCase, 'integer' => 'literal']) <add> ->setConjunction(' AS '); <add> $notPublishedCase = $query->func() <add> ->cast([$notPublishedCase, 'integer' => 'literal']) <add> ->setConjunction(' AS '); <ide> } <ide> <ide> $results = $query
2
Javascript
Javascript
modify run loop behavior
d6ef3990289357f26132418cf25b1ec4898814e7
<ide><path>packages/ember-metal/lib/run_loop.js <ide> RunLoop.prototype = { <ide> }, <ide> <ide> flush: function(queueName) { <del> var queues = this._queues, queueNames, idx, len, queue, log; <add> var queueNames, idx, len, queue, log; <ide> <del> if (!queues) { return this; } // nothing to do <add> if (!this._queues) { return this; } // nothing to do <ide> <ide> function iter(item) { <ide> invoke(item.target, item.method, item.args); <ide> RunLoop.prototype = { <ide> } else { <ide> queueNames = Ember.run.queues; <ide> len = queueNames.length; <del> do { <del> this._queues = null; <del> for (idx=0; idx < len; idx++) { <del> queueName = queueNames[idx]; <del> queue = queues[queueName]; <del> <del> if (queue) { <del> // the sync phase is to allow property changes to propagate. don't <del> // invoke observers until that is finished. <del> if (queueName === 'sync') { <del> log = Ember.LOG_BINDINGS; <del> if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); } <del> <del> Ember.beginPropertyChanges(); <del> try { <del> forEach.call(queue, iter); <del> } finally { <del> Ember.endPropertyChanges(); <del> } <del> <del> if (log) { Ember.Logger.log('End: Flush Sync Queue'); } <del> } else { <add> idx = 0; <add> <add> outerloop: <add> while (idx < len) { <add> queueName = queueNames[idx]; <add> queue = this._queues && this._queues[queueName]; <add> delete this._queues[queueName]; <add> <add> if (queue) { <add> // the sync phase is to allow property changes to propagate. don't <add> // invoke observers until that is finished. <add> if (queueName === 'sync') { <add> log = Ember.LOG_BINDINGS; <add> if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); } <add> <add> Ember.beginPropertyChanges(); <add> try { <ide> forEach.call(queue, iter); <add> } finally { <add> Ember.endPropertyChanges(); <ide> } <add> <add> if (log) { Ember.Logger.log('End: Flush Sync Queue'); } <add> } else { <add> forEach.call(queue, iter); <ide> } <ide> } <del> } while (queues = this._queues); // go until queues stay clean <add> <add> // Loop through prior queues <add> for (var i = 0; i <= idx; i++) { <add> if (this._queues && this._queues[queueNames[i]]) { <add> // Start over at the first queue with contents <add> idx = i; <add> continue outerloop; <add> } <add> } <add> <add> idx++; <add> } <ide> } <ide> <ide> timerMark = null; <ide><path>packages/ember-metal/tests/run_loop/schedule_test.js <ide> test('nested runs should queue each phase independently', function() { <ide> equal(cnt, 2, 'should flush actions now'); <ide> <ide> }); <add> <add>test('prior queues should be flushed before moving on to next queue', function() { <add> var order = []; <add> <add> Ember.run(function() { <add> Ember.run.schedule('sync', function() { <add> order.push('sync'); <add> }); <add> Ember.run.schedule('actions', function() { <add> order.push('actions'); <add> Ember.run.schedule('actions', function() { <add> order.push('actions'); <add> }); <add> Ember.run.schedule('sync', function() { <add> order.push('sync'); <add> }); <add> }); <add> Ember.run.schedule('timers', function() { <add> order.push('timers'); <add> }); <add> }); <add> <add> deepEqual(order, ['sync', 'actions', 'sync', 'actions', 'timers']); <add>});
2
Ruby
Ruby
fix #post documentation [ci skip]
c8bf6da46590bcf6bb4253bc4ba069a442c6b776
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def load! <ide> # <ide> # def test_create <ide> # json = {book: { title: "Love Hina" }}.to_json <del> # post :create, json <add> # post :create, body: json <ide> # end <ide> # <ide> # == Special instance variables
1
Mixed
Python
add push_to_hub to no_trainer examples
b7d264be0d70d5309dbf24a6c7ebba1e073bdda5
<ide><path>examples/pytorch/README.md <ide> line, 🤗 Trainer supports resuming from a checkpoint via `trainer.train(resume <ide> 2. If `resume_from_checkpoint` is a path to a specific checkpoint it will use that saved checkpoint folder to resume the training from. <ide> <ide> <add>### Upload the trained/fine-tuned model to the Hub <add> <add>All the example scripts support automatic upload of your final model to the [Model Hub](https://huggingface.co/models) by adding a `--push_to_hub` argument. It will then create a repository with your username slash the name of the folder you are using as `output_dir`. For instance, `"sgugger/test-mrpc"` if your username is `sgugger` and you are working in the folder `~/tmp/test-mrpc`. <add> <add>To specify a given repository name, use the `--hub_model_id` argument. You will need to specify the whole repository name (including your username), for instance `--hub_model_id sgugger/finetuned-bert-mrpc`. To upload to an organization you are a member of, just use the name of that organization instead of your username: `--hub_model_id huggingface/finetuned-bert-mrpc`. <add> <add>A few notes on this integration: <add> <add>- you will need to be logged in to the Hugging Face website locally for it to work, the easiest way to achieve this is to run `huggingface-cli login` and then type your username and password when prompted. You can also pass along your authentication token with the `--hub_token` argument. <add>- the `output_dir` you pick will either need to be a new folder or a local clone of the distant repository you are using. <add> <ide> ## Distributed training and mixed precision <ide> <ide> All the PyTorch scripts mentioned above work out of the box with distributed training and mixed precision, thanks to <ide><path>examples/pytorch/language-modeling/run_clm_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import torch <ide> <ide> import transformers <ide> from accelerate import Accelerator, DistributedType <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> parser.add_argument( <ide> "--no_keep_linebreaks", action="store_true", help="Do not keep line breaks when using TXT files." <ide> ) <del> <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.validation_file.split(".")[-1] <ide> assert extension in ["csv", "json", "txt"], "`validation_file` should be a csv, json or txt file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def group_texts(examples): <ide> <ide> logger.info(f"epoch {epoch}: perplexity: {perplexity}") <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/language-modeling/run_mlm_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import torch <ide> <ide> import transformers <ide> from accelerate import Accelerator, DistributedType <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> parser.add_argument( <ide> "--mlm_probability", type=float, default=0.15, help="Ratio of tokens to mask for masked language modeling loss" <ide> ) <del> <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.validation_file.split(".")[-1] <ide> assert extension in ["csv", "json", "txt"], "`validation_file` should be a csv, json or txt file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def group_texts(examples): <ide> <ide> logger.info(f"epoch {epoch}: perplexity: {perplexity}") <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/multiple-choice/run_swag_no_trainer.py <ide> import os <ide> import random <ide> from dataclasses import dataclass <add>from pathlib import Path <ide> from typing import Optional, Union <ide> <ide> import datasets <ide> <ide> import transformers <ide> from accelerate import Accelerator <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <del>from transformers.file_utils import PaddingStrategy <add>from transformers.file_utils import PaddingStrategy, get_full_repo_name <ide> <ide> <ide> logger = logging.getLogger(__name__) <ide> def parse_args(): <ide> action="store_true", <ide> help="Activate debug mode and run training only with a subset of data.", <ide> ) <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def preprocess_function(examples): <ide> eval_metric = metric.compute() <ide> accelerator.print(f"epoch {epoch}: {eval_metric}") <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import numpy as np <ide> <ide> import transformers <ide> from accelerate import Accelerator <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> AdamW, <ide> DataCollatorWithPadding, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils import check_min_version <ide> from transformers.utils.versions import require_version <ide> from utils_qa import postprocess_qa_predictions_with_beam_search <ide> def parse_args(): <ide> default=None, <ide> help="For debugging purposes or quicker training, truncate the number of prediction examples to this", <ide> ) <del> <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.test_file.split(".")[-1] <ide> assert extension in ["csv", "json"], "`test_file` should be a csv or a json file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def create_and_fill_np_array(start_or_end_logits, dataset, max_len): <ide> if completed_steps >= args.max_train_steps: <ide> break <ide> <del> # intialize all lists to collect the batches <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <ide> <add> # intialize all lists to collect the batches <ide> all_start_top_log_probs = [] <ide> all_start_top_index = [] <ide> all_end_top_log_probs = [] <ide> def create_and_fill_np_array(start_or_end_logits, dataset, max_len): <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/question-answering/run_qa_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import numpy as np <ide> <ide> import transformers <ide> from accelerate import Accelerator <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils import check_min_version <ide> from transformers.utils.versions import require_version <ide> from utils_qa import postprocess_qa_predictions <ide> def parse_args(): <ide> help="Model type to use if training from scratch.", <ide> choices=MODEL_TYPES, <ide> ) <del> <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.test_file.split(".")[-1] <ide> assert extension in ["csv", "json"], "`test_file` should be a csv or a json file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def create_and_fill_np_array(start_or_end_logits, dataset, max_len): <ide> if completed_steps >= args.max_train_steps: <ide> break <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> # Evaluation <ide> logger.info("***** Running Evaluation *****") <ide> logger.info(f" Num examples = {len(eval_dataset)}") <ide> def create_and_fill_np_array(start_or_end_logits, dataset, max_len): <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/summarization/run_summarization_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import nltk <ide> import transformers <ide> from accelerate import Accelerator <ide> from filelock import FileLock <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <del>from transformers.file_utils import is_offline_mode <add>from transformers.file_utils import get_full_repo_name, is_offline_mode <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> help="Model type to use if training from scratch.", <ide> choices=MODEL_TYPES, <ide> ) <del> <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.validation_file.split(".")[-1] <ide> assert extension in ["csv", "json"], "`validation_file` should be a csv or a json file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def postprocess_text(preds, labels): <ide> <ide> logger.info(result) <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/text-classification/run_glue_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> from datasets import load_dataset, load_metric <ide> <ide> import transformers <ide> from accelerate import Accelerator <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> AdamW, <ide> AutoConfig, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> ) <ide> parser.add_argument("--output_dir", type=str, default=None, help="Where to store the final model.") <ide> parser.add_argument("--seed", type=int, default=None, help="A seed for reproducible training.") <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.validation_file.split(".")[-1] <ide> assert extension in ["csv", "json"], "`validation_file` should be a csv or a json file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON training and evaluation files (see below) <ide> # or specify a GLUE benchmark task (the dataset will be downloaded automatically from the datasets Hub). <ide> <ide> def preprocess_function(examples): <ide> eval_metric = metric.compute() <ide> logger.info(f"epoch {epoch}: {eval_metric}") <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> if args.task_name == "mnli": <ide> # Final evaluation on mismatched validation set <ide><path>examples/pytorch/token-classification/run_ner_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import torch <ide> <ide> import transformers <ide> from accelerate import Accelerator <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> action="store_true", <ide> help="Activate debug mode and run training only with a subset of data.", <ide> ) <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.validation_file.split(".")[-1] <ide> assert extension in ["csv", "json"], "`validation_file` should be a csv or a json file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <ide> <ide> return args <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets for token classification task available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def compute_metrics(): <ide> eval_metric = compute_metrics() <ide> accelerator.print(f"epoch {epoch}:", eval_metric) <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__": <ide><path>examples/pytorch/translation/run_translation_no_trainer.py <ide> import math <ide> import os <ide> import random <add>from pathlib import Path <ide> <ide> import datasets <ide> import numpy as np <ide> <ide> import transformers <ide> from accelerate import Accelerator <add>from huggingface_hub import Repository <ide> from transformers import ( <ide> CONFIG_MAPPING, <ide> MODEL_MAPPING, <ide> get_scheduler, <ide> set_seed, <ide> ) <add>from transformers.file_utils import get_full_repo_name <ide> from transformers.utils.versions import require_version <ide> <ide> <ide> def parse_args(): <ide> help="Model type to use if training from scratch.", <ide> choices=MODEL_TYPES, <ide> ) <del> <add> parser.add_argument("--push_to_hub", action="store_true", help="Whether or not to push the model to the Hub.") <add> parser.add_argument( <add> "--hub_model_id", type=str, help="The name of the repository to keep in sync with the local `output_dir`." <add> ) <add> parser.add_argument("--hub_token", type=str, help="The token to use to push to the Model Hub.") <ide> args = parser.parse_args() <ide> <ide> # Sanity checks <ide> def parse_args(): <ide> extension = args.validation_file.split(".")[-1] <ide> assert extension in ["csv", "json"], "`validation_file` should be a csv or a json file." <ide> <del> if args.output_dir is not None: <del> os.makedirs(args.output_dir, exist_ok=True) <add> if args.push_to_hub: <add> assert args.output_dir is not None, "Need an `output_dir` to create a repo when `--push_to_hub` is passed." <add> <ide> return args <ide> <ide> <ide> def main(): <ide> if args.seed is not None: <ide> set_seed(args.seed) <ide> <add> # Handle the repository creation <add> if accelerator.is_main_process: <add> if args.push_to_hub: <add> if args.hub_model_id is None: <add> repo_name = get_full_repo_name(Path(args.output_dir).name, token=args.hub_token) <add> else: <add> repo_name = args.hub_model_id <add> repo = Repository(args.output_dir, clone_from=repo_name) <add> elif args.output_dir is not None: <add> os.makedirs(args.output_dir, exist_ok=True) <add> accelerator.wait_for_everyone() <add> <ide> # Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below) <ide> # or just provide the name of one of the public datasets available on the hub at https://huggingface.co/datasets/ <ide> # (the dataset will be downloaded automatically from the datasets Hub). <ide> def postprocess_text(preds, labels): <ide> eval_metric = metric.compute() <ide> logger.info({"bleu": eval_metric["score"]}) <ide> <add> if args.push_to_hub and epoch < args.num_train_epochs - 1: <add> accelerator.wait_for_everyone() <add> unwrapped_model = accelerator.unwrap_model(model) <add> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> repo.push_to_hub(commit_message=f"Training in progress epoch {epoch}", blocking=False) <add> <ide> if args.output_dir is not None: <ide> accelerator.wait_for_everyone() <ide> unwrapped_model = accelerator.unwrap_model(model) <ide> unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save) <add> if accelerator.is_main_process: <add> tokenizer.save_pretrained(args.output_dir) <add> if args.push_to_hub: <add> repo.push_to_hub(commit_message="End of training") <ide> <ide> <ide> if __name__ == "__main__":
10
Go
Go
fix race condition between swarm and libnetwork
e2ec006797fa14f59bcf7b9c23505ccdf1d3ded3
<ide><path>cmd/dockerd/daemon.go <ide> func (cli *DaemonCli) start(opts daemonOptions) (err error) { <ide> if err != nil { <ide> logrus.Fatalf("Error creating cluster component: %v", err) <ide> } <add> d.SetCluster(c) <add> err = c.Start() <add> if err != nil { <add> logrus.Fatalf("Error starting cluster component: %v", err) <add> } <ide> <ide> // Restart all autostart containers which has a swarm endpoint <ide> // and is not yet running now that we have successfully <ide> func (cli *DaemonCli) start(opts daemonOptions) (err error) { <ide> <ide> cli.d = d <ide> <del> d.SetCluster(c) <ide> initRouter(api, d, c) <ide> <ide> cli.setupConfigReloadTrap() <ide><path>daemon/cluster.go <ide> package daemon <ide> <ide> import ( <ide> apitypes "github.com/docker/docker/api/types" <add> lncluster "github.com/docker/libnetwork/cluster" <ide> ) <ide> <ide> // Cluster is the interface for github.com/docker/docker/daemon/cluster.(*Cluster). <ide> type Cluster interface { <ide> ClusterStatus <ide> NetworkManager <add> SendClusterEvent(event lncluster.ConfigEventType) <ide> } <ide> <ide> // ClusterStatus interface provides information about the Swarm status of the Cluster <ide><path>daemon/cluster/cluster.go <ide> import ( <ide> types "github.com/docker/docker/api/types/swarm" <ide> executorpkg "github.com/docker/docker/daemon/cluster/executor" <ide> "github.com/docker/docker/pkg/signal" <add> lncluster "github.com/docker/libnetwork/cluster" <ide> swarmapi "github.com/docker/swarmkit/api" <ide> swarmnode "github.com/docker/swarmkit/node" <ide> "github.com/pkg/errors" <ide> type Cluster struct { <ide> root string <ide> runtimeRoot string <ide> config Config <del> configEvent chan struct{} // todo: make this array and goroutine safe <add> configEvent chan lncluster.ConfigEventType // todo: make this array and goroutine safe <ide> attachers map[string]*attacher <ide> } <ide> <ide> func New(config Config) (*Cluster, error) { <ide> c := &Cluster{ <ide> root: root, <ide> config: config, <del> configEvent: make(chan struct{}, 10), <add> configEvent: make(chan lncluster.ConfigEventType, 10), <ide> runtimeRoot: config.RuntimeRoot, <ide> attachers: make(map[string]*attacher), <ide> } <add> return c, nil <add>} <add> <add>// Start the Cluster instance <add>// TODO The split between New and Start can be join again when the SendClusterEvent <add>// method is no longer required <add>func (c *Cluster) Start() error { <add> root := filepath.Join(c.config.Root, swarmDirName) <ide> <ide> nodeConfig, err := loadPersistentState(root) <ide> if err != nil { <ide> if os.IsNotExist(err) { <del> return c, nil <add> return nil <ide> } <del> return nil, err <add> return err <ide> } <ide> <ide> nr, err := c.newNodeRunner(*nodeConfig) <ide> if err != nil { <del> return nil, err <add> return err <ide> } <ide> c.nr = nr <ide> <ide> func New(config Config) (*Cluster, error) { <ide> case err := <-nr.Ready(): <ide> if err != nil { <ide> logrus.WithError(err).Error("swarm component could not be started") <del> return c, nil <add> return nil <ide> } <ide> } <del> return c, nil <add> return nil <ide> } <ide> <ide> func (c *Cluster) newNodeRunner(conf nodeStartConfig) (*nodeRunner, error) { <ide> func (c *Cluster) getRemoteAddressList() []string { <ide> // ListenClusterEvents returns a channel that receives messages on cluster <ide> // participation changes. <ide> // todo: make cancelable and accessible to multiple callers <del>func (c *Cluster) ListenClusterEvents() <-chan struct{} { <add>func (c *Cluster) ListenClusterEvents() <-chan lncluster.ConfigEventType { <ide> return c.configEvent <ide> } <ide> <ide> func (c *Cluster) lockedManagerAction(fn func(ctx context.Context, state nodeSta <ide> <ide> return fn(ctx, state) <ide> } <add> <add>// SendClusterEvent allows to send cluster events on the configEvent channel <add>// TODO This method should not be exposed. <add>// Currently it is used to notify the network controller that the keys are <add>// available <add>func (c *Cluster) SendClusterEvent(event lncluster.ConfigEventType) { <add> c.mu.RLock() <add> defer c.mu.RUnlock() <add> c.configEvent <- event <add>} <ide><path>daemon/cluster/noderunner.go <ide> import ( <ide> "github.com/Sirupsen/logrus" <ide> types "github.com/docker/docker/api/types/swarm" <ide> "github.com/docker/docker/daemon/cluster/executor/container" <add> lncluster "github.com/docker/libnetwork/cluster" <ide> swarmapi "github.com/docker/swarmkit/api" <ide> swarmnode "github.com/docker/swarmkit/node" <ide> "github.com/pkg/errors" <ide> func (n *nodeRunner) handleControlSocketChange(ctx context.Context, node *swarmn <ide> } <ide> n.grpcConn = conn <ide> n.mu.Unlock() <del> n.cluster.configEvent <- struct{}{} <add> n.cluster.SendClusterEvent(lncluster.EventSocketChange) <ide> } <ide> } <ide> <ide> func (n *nodeRunner) handleReadyEvent(ctx context.Context, node *swarmnode.Node, <ide> close(ready) <ide> case <-ctx.Done(): <ide> } <del> n.cluster.configEvent <- struct{}{} <add> n.cluster.SendClusterEvent(lncluster.EventNodeReady) <ide> } <ide> <ide> func (n *nodeRunner) handleNodeExit(node *swarmnode.Node) { <ide> func (n *nodeRunner) Stop() error { <ide> if err := n.swarmNode.Stop(ctx); err != nil && !strings.Contains(err.Error(), "context canceled") { <ide> return err <ide> } <add> n.cluster.SendClusterEvent(lncluster.EventNodeLeave) <ide> <-n.done <ide> return nil <ide> } <ide><path>daemon/cluster/swarm.go <ide> func (c *Cluster) Leave(force bool) error { <ide> } <ide> } <ide> <del> c.configEvent <- struct{}{} <ide> // todo: cleanup optional? <ide> if err := clearPersistentState(c.root); err != nil { <ide> return err <ide><path>daemon/network.go <ide> import ( <ide> "github.com/docker/docker/pkg/plugingetter" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/docker/libnetwork" <add> lncluster "github.com/docker/libnetwork/cluster" <ide> "github.com/docker/libnetwork/driverapi" <ide> "github.com/docker/libnetwork/ipamapi" <ide> networktypes "github.com/docker/libnetwork/types" <ide> func (daemon *Daemon) setupIngress(create *clustertypes.NetworkCreateRequest, ip <ide> <ide> func (daemon *Daemon) releaseIngress(id string) { <ide> controller := daemon.netController <del> <ide> if err := controller.SandboxDestroy("ingress-sbox"); err != nil { <ide> logrus.Errorf("Failed to delete ingress sandbox: %v", err) <ide> } <ide> func (daemon *Daemon) releaseIngress(id string) { <ide> logrus.Errorf("Failed to delete ingress network %s: %v", n.ID(), err) <ide> return <ide> } <del> <ide> return <ide> } <ide> <ide> // SetNetworkBootstrapKeys sets the bootstrap keys. <ide> func (daemon *Daemon) SetNetworkBootstrapKeys(keys []*networktypes.EncryptionKey) error { <del> return daemon.netController.SetKeys(keys) <add> err := daemon.netController.SetKeys(keys) <add> if err == nil { <add> // Upon successful key setting dispatch the keys available event <add> daemon.cluster.SendClusterEvent(lncluster.EventNetworkKeysAvailable) <add> } <add> return err <ide> } <ide> <ide> // UpdateAttachment notifies the attacher about the attachment config. <ide><path>integration-cli/docker_cli_swarm_test.go <ide> func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *check.C) { <ide> c.Assert(err, checker.NotNil) <ide> c.Assert(out, checker.Contains, "data path address must be a non-zero IP") <ide> } <add> <add>func (s *DockerSwarmSuite) TestSwarmJoinLeave(c *check.C) { <add> d := s.AddDaemon(c, true, true) <add> <add> out, err := d.Cmd("swarm", "join-token", "-q", "worker") <add> c.Assert(err, checker.IsNil) <add> c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") <add> <add> token := strings.TrimSpace(out) <add> <add> // Verify that back to back join/leave does not cause panics <add> d1 := s.AddDaemon(c, false, false) <add> for i := 0; i < 10; i++ { <add> out, err = d1.Cmd("swarm", "join", "--token", token, d.ListenAddr) <add> c.Assert(err, checker.IsNil) <add> c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") <add> <add> _, err = d1.Cmd("swarm", "leave") <add> c.Assert(err, checker.IsNil) <add> } <add>}
7
Javascript
Javascript
fix edgecase without any hash used
b13fe9780104aa24f640b666b0de663a8affa82b
<ide><path>lib/optimize/RealContentHashPlugin.js <ide> class RealContentHashPlugin { <ide> } <ide> } <ide> } <add> if (hashToAssets.size === 0) return; <ide> const hashRegExp = new RegExp( <ide> Array.from(hashToAssets.keys(), quoteMeta).join("|"), <ide> "g"
1
Go
Go
catch sigquit for cleanup
db7c55ba7f97358f3a6de2b83c8e3d1827667446
<ide><path>server.go <ide> func init() { <ide> <ide> // jobInitApi runs the remote api server `srv` as a daemon, <ide> // Only one api server can run at the same time - this is enforced by a pidfile. <del>// The signals SIGINT and SIGTERM are intercepted for cleanup. <add>// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup. <ide> func jobInitApi(job *engine.Job) string { <ide> job.Logf("Creating server") <ide> srv, err := NewServer(job.Eng, ConfigFromJob(job)) <ide> func jobInitApi(job *engine.Job) string { <ide> } <ide> job.Logf("Setting up signal traps") <ide> c := make(chan os.Signal, 1) <del> signal.Notify(c, os.Interrupt, os.Signal(syscall.SIGTERM)) <add> signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT) <ide> go func() { <ide> sig := <-c <ide> log.Printf("Received signal '%v', exiting\n", sig)
1
Text
Text
fix duplicate "this" and "the" on http2.md
7c3c70cc48a2a23fbc3a1f3c9e01d02f2ecf2dc1
<ide><path>doc/api/http2.md <ide> Every `Http2Session` instance is associated with exactly one [`net.Socket`][] or <ide> [`tls.TLSSocket`][] when it is created. When either the `Socket` or the <ide> `Http2Session` are destroyed, both will be destroyed. <ide> <del>Because the of the specific serialization and processing requirements imposed <add>Because of the specific serialization and processing requirements imposed <ide> by the HTTP/2 protocol, it is not recommended for user code to read data from <ide> or write data to a `Socket` instance bound to a `Http2Session`. Doing so can <ide> put the HTTP/2 session into an indeterminate state causing the session and <ide> added: v9.5.0 <ide> <ide> * {HTTP/2 Headers Object} <ide> <del>An object containing the outbound trailers sent for this this `HttpStream`. <add>An object containing the outbound trailers sent for this `HttpStream`. <ide> <ide> #### http2stream.session <ide> <!-- YAML
1
Go
Go
use transactions during device deletion
17b75a21a667a27a9a27565ab282cd615dbdb66e
<ide><path>daemon/graphdriver/devmapper/deviceset.go <ide> func (devices *DeviceSet) deleteDevice(info *DevInfo) error { <ide> } <ide> } <ide> <add> if err := devices.openTransaction(info.Hash, info.DeviceId); err != nil { <add> log.Debugf("Error opening transaction hash = %s deviceId = %d", "", info.DeviceId) <add> return err <add> } <add> <ide> if err := devicemapper.DeleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil { <ide> log.Debugf("Error deleting device: %s", err) <ide> return err <ide> func (devices *DeviceSet) deleteDevice(info *DevInfo) error { <ide> return err <ide> } <ide> <add> if err := devices.closeTransaction(); err != nil { <add> return err <add> } <add> <ide> devices.markDeviceIdFree(info.DeviceId) <ide> <ide> return nil
1
Text
Text
update working directory in builder stage
e5bc0cdae0f17c09f89ab609b6187b9178ef3204
<ide><path>docs/deployment.md <ide> RUN yarn install --frozen-lockfile <ide> <ide> # Rebuild the source code only when needed <ide> FROM node:alpine AS builder <add>WORKDIR /app <ide> COPY . . <ide> COPY --from=deps /app/node_modules ./node_modules <ide> RUN yarn build
1
Ruby
Ruby
remove vestigial code
1f80f3a3738a57be6e36901ef60645fabb6576a9
<ide><path>actionpack/lib/action_controller/middleware.rb <del>module ActionController <del> class Middleware < Metal <del> class ActionMiddleware <del> def initialize(controller, app) <del> @controller, @app = controller, app <del> end <del> <del> def call(env) <del> request = ActionDispatch::Request.new(env) <del> @controller.build(@app).dispatch(:index, request) <del> end <del> end <del> <del> class << self <del> alias build new <del> <del> def new(app) <del> ActionMiddleware.new(self, app) <del> end <del> end <del> <del> attr_internal :app <del> <del> def process(action) <del> response = super <del> self.status, self.headers, self.response_body = response if response.is_a?(Array) <del> response <del> end <del> <del> def initialize(app) <del> super() <del> @_app = app <del> end <del> <del> def index <del> call(env) <del> end <del> end <del>end <ide>\ No newline at end of file <ide><path>actionpack/test/controller/new_base/metal_test.rb <del>require 'abstract_unit' <del> <del>module MetalTest <del> class MetalMiddleware < ActionController::Middleware <del> def call(env) <del> if env["PATH_INFO"] =~ /authed/ <del> app.call(env) <del> else <del> [401, headers, "Not authed!"] <del> end <del> end <del> end <del> <del> class Endpoint <del> def call(env) <del> [200, {}, "Hello World"] <del> end <del> end <del> <del> class TestMiddleware < ActiveSupport::TestCase <del> def setup <del> @app = Rack::Builder.new do <del> use MetalTest::MetalMiddleware <del> run MetalTest::Endpoint.new <del> end.to_app <del> end <del> <del> test "it can call the next app by using @app" do <del> env = Rack::MockRequest.env_for("/authed") <del> response = @app.call(env) <del> <del> assert_equal ["Hello World"], response[2] <del> end <del> <del> test "it can return a response using the normal AC::Metal techniques" do <del> env = Rack::MockRequest.env_for("/") <del> response = @app.call(env) <del> <del> assert_equal ["Not authed!"], response[2] <del> assert_equal 401, response[0] <del> end <del> end <del>end
2
PHP
PHP
use false instead of null
d7f04ce1b40fc4bf5e0aff32a78410d10b999533
<ide><path>src/ORM/Behavior/CounterCacheBehavior.php <ide> protected function _processAssociation(Event $event, EntityInterface $entity, As <ide> } else { <ide> $count = $this->_getCount($config, $countConditions); <ide> } <del> if (!is_null($count)) { <add> if ($count !== false) { <ide> $assoc->getTarget()->updateAll([$field => $count], <ide> $updateConditions); <ide> } <ide> protected function _processAssociation(Event $event, EntityInterface $entity, As <ide> } else { <ide> $count = $this->_getCount($config, $countOriginalConditions); <ide> } <del> if (!is_null($count)) { <add> if ($count !== false) { <ide> $assoc->getTarget()->updateAll([$field => $count], <ide> $updateOriginalConditions); <ide> }
1
Python
Python
fix unit tests for merge
dc3c1488bb5a75af798cee7a81a46e454e17d85d
<ide><path>keras/backend/theano_backend.py <ide> def dot(x, y): <ide> def batch_dot(x, y, axes=None): <ide> if axes is None: <ide> # behaves like tf.batch_matmul as default <del> axes = [(x.ndim-1,), (y.ndim-2,)] <add> axes = [(x.ndim - 1,), (y.ndim - 2,)] <ide> return T.batched_tensordot(x, y, axes=axes) <ide> <ide> <ide><path>keras/engine/topology.py <ide> def call(self, inputs, mask=None): <ide> <ide> if self.mode == 'sum' or self.mode == 'ave': <ide> s = inputs[0] <del> for i in range(1, len(self.layers)): <add> for i in range(1, len(inputs)): <ide> s += inputs[i] <ide> if self.mode == 'ave': <del> s /= len(self.layers) <add> s /= len(inputs) <ide> return s <ide> <ide> elif self.mode == 'concat': <ide> return K.concatenate(inputs, axis=self.concat_axis) <ide> <ide> elif self.mode == 'mul': <ide> s = inputs[0] <del> for i in range(1, len(self.layers)): <add> for i in range(1, len(inputs)): <ide> s *= inputs[i] <ide> return s <ide> <ide> elif self.mode == 'dot': <ide> l1 = inputs[0] <ide> l2 = inputs[1] <ide> output = K.batch_dot(l1, l2, self.dot_axes) <del> # output_shape = list(self.get_output_shape_for(inputs[0]._keras_shape)) <del> # output_shape[0] = l1.shape[0] <del> # output = output.reshape(tuple(output_shape)) <ide> return output <ide> <ide> elif self.mode == 'cos': <ide> def get_output_shape_for(self, input_shape): <ide> <ide> cache_key = ','.join([str(x) for x in input_shapes]) <ide> if cache_key in self._output_shape_cache: <del> return self._output_shape_cache[cache_key] <add> output_shapes = self._output_shape_cache[cache_key] <add> if type(output_shapes) is list and len(output_shapes) == 1: <add> return output_shapes[0] <add> return output_shapes <ide> else: <ide> # bad luck, have to run the graph manually <ide> layers_to_output_shapes = {} <ide> def get_output_shape_for(self, input_shape): <ide> output_shapes.append(layers_to_output_shapes[key]) <ide> # store in cache <ide> self._output_shape_cache[cache_key] = output_shapes <add> if type(output_shapes) is list and len(output_shapes) == 1: <add> return output_shapes[0] <ide> return output_shapes <ide> <ide> def run_internal_graph(self, inputs, masks=None): <ide><path>tests/keras/layers/test_core.py <ide> def test_masking(): <ide> <ide> <ide> def test_merge(): <add> from keras.layers import Input, merge <add> from keras.models import Model <add> <ide> # test modes: 'sum', 'mul', 'concat', 'ave', 'cos', 'dot'. <add> input_shapes = [(3, 2), (3, 2)] <add> inputs = [np.random.random(shape) for shape in input_shapes] <add> <add> # test graph API <add> for mode in ['sum', 'mul', 'concat', 'ave', 'cos', 'dot']: <add> print(mode) <add> input_a = Input(shape=input_shapes[0][1:]) <add> input_b = Input(shape=input_shapes[1][1:]) <add> merged = merge([input_a, input_b], mode='sum') <add> model = Model([input_a, input_b], merged) <add> model.compile('rmsprop', 'mse') <add> <add> expected_output_shape = model.get_output_shape_for(input_shapes) <add> actual_output_shape = model.predict(inputs).shape <add> assert expected_output_shape == actual_output_shape <add> <add> config = model.get_config() <add> model = Model.from_config(config) <add> model.compile('rmsprop', 'mse') <add> <ide> # test lambda with output_shape lambda <add> input_a = Input(shape=input_shapes[0][1:]) <add> input_b = Input(shape=input_shapes[1][1:]) <add> merged = merge([input_a, input_b], <add> mode=lambda (x, y): K.concatenate([x, y]), <add> output_shape=lambda (s1, s2): (s1[:-1],) + (s1[-1] + s2[-1],)) <add> expected_output_shape = model.get_output_shape_for(input_shapes) <add> actual_output_shape = model.predict(inputs).shape <add> assert expected_output_shape == actual_output_shape <add> <add> config = model.get_config() <add> model = Model.from_config(config) <add> model.compile('rmsprop', 'mse') <add> <ide> # test function with output_shape function <del> pass <add> def fn_mode((x, y)): <add> return K.concatenate([x, y]) <add> <add> def fn_output_shape((s1, s2)): <add> return (s1[:-1],) + (s1[-1] + s2[-1],) <add> <add> input_a = Input(shape=input_shapes[0][1:]) <add> input_b = Input(shape=input_shapes[1][1:]) <add> merged = merge([input_a, input_b], <add> mode=fn_mode, <add> output_shape=fn_output_shape) <add> expected_output_shape = model.get_output_shape_for(input_shapes) <add> actual_output_shape = model.predict(inputs).shape <add> assert expected_output_shape == actual_output_shape <add> <add> config = model.get_config() <add> model = Model.from_config(config) <add> model.compile('rmsprop', 'mse') <ide> <ide> <ide> def test_dropout():
3
Text
Text
fix typo for docs reference
0f0b0db842e53c81191385395d6d040574eeb0d9
<ide><path>docs/reference/commandline/info.md <ide> meta data regarding those images are stored. When run for the first time Docker <ide> allocates a certain amount of data space and meta data space from the space <ide> available on the volume where `/var/lib/docker` is mounted. <ide> <del># EXAMPLES <add># Examples <ide> <ide> ## Display Docker system information <ide> <ide><path>docs/reference/commandline/push.md <ide> running in a terminal, terminates the push operation. <ide> <ide> Registry credentials are managed by [docker login](login.md). <ide> <del>## EXAMPLES <add>## Examples <ide> <ide> ### Pushing a new image to a registry <ide> <ide><path>docs/reference/commandline/update.md <ide> options on a running or a stopped container. On kernel version older than <ide> 4.6, you can only update `--kernel-memory` on a stopped container or on <ide> a running container with kernel memory initialized. <ide> <del>## EXAMPLES <add>## Examples <ide> <ide> The following sections illustrate ways to use this command. <ide>
3
Python
Python
add skipping batch
1771dae94e6a8c12e78219dc489e616539c2b00c
<ide><path>keras/preprocessing/timeseries.py <ide> def timeseries_dataset_from_array( <ide> `data[i], data[i + r], ... data[i + sequence_length]` <ide> are used for create a sample sequence. <ide> batch_size: Number of timeseries samples in each batch <del> (except maybe the last one). <add> (except maybe the last one). If `None`, it doesn't make batches. <ide> shuffle: Whether to shuffle output samples, <ide> or instead draw them in chronological order. <ide> seed: Optional int; random seed for shuffling. <ide> def timeseries_dataset_from_array( <ide> if shuffle: <ide> # Shuffle locally at each iteration <ide> dataset = dataset.shuffle(buffer_size=batch_size * 8, seed=seed) <del> dataset = dataset.prefetch(tf.data.AUTOTUNE).batch(batch_size) <add> dataset = dataset.prefetch(tf.data.AUTOTUNE) <add> if batch_size is not None: <add> dataset = dataset.batch(batch_size) <ide> return dataset <ide> <ide>
1
Python
Python
fix project urls
3fd7abec3c8c4a32da9579d0824b10d5ba0add83
<ide><path>setup.py <ide> url='https://www.palletsprojects.com/p/flask/', <ide> project_urls=OrderedDict(( <ide> ('Documentation', 'http://flask.pocoo.org/docs/'), <del> ('Code', 'https://github.com/pallets/pallets-sphinx-themes'), <del> ('Issue tracker', 'https://github.com/pallets/pallets-sphinx-themes/issues'), <add> ('Code', 'https://github.com/pallets/flask'), <add> ('Issue tracker', 'https://github.com/pallets/flask/issues'), <ide> )), <ide> license='BSD', <ide> author='Armin Ronacher',
1
PHP
PHP
add group to router contract
986f9d6026b6712b1411558288d73f2af7d8e1f9
<ide><path>src/Illuminate/Contracts/Routing/Registrar.php <ide> <?php namespace Illuminate\Contracts\Routing; <ide> <add>use Closure; <add> <ide> interface Registrar { <ide> <ide> /** <ide> public function match($methods, $uri, $action); <ide> */ <ide> public function resource($name, $controller, array $options = array()); <ide> <add> /** <add> * Create a route group with shared attributes. <add> * <add> * @param array $attributes <add> * @param \Closure $callback <add> * @return void <add> */ <add> public function group(array $attributes, Closure $callback); <add> <ide> /** <ide> * Register a new "before" filter with the router. <ide> *
1
Javascript
Javascript
remove unneeded escaping in generate.js
fe1dcb587300a9fd41db0de895b5e78ffaedeff0
<ide><path>tools/doc/generate.js <ide> let inputFile = null; <ide> let nodeVersion = null; <ide> <ide> args.forEach(function(arg) { <del> if (!arg.match(/^\-\-/)) { <add> if (!arg.match(/^--/)) { <ide> inputFile = arg; <del> } else if (arg.match(/^\-\-format=/)) { <del> format = arg.replace(/^\-\-format=/, ''); <del> } else if (arg.match(/^\-\-template=/)) { <del> template = arg.replace(/^\-\-template=/, ''); <del> } else if (arg.match(/^\-\-node\-version=/)) { <del> nodeVersion = arg.replace(/^\-\-node\-version=/, ''); <add> } else if (arg.match(/^--format=/)) { <add> format = arg.replace(/^--format=/, ''); <add> } else if (arg.match(/^--template=/)) { <add> template = arg.replace(/^--template=/, ''); <add> } else if (arg.match(/^--node-version=/)) { <add> nodeVersion = arg.replace(/^--node-version=/, ''); <ide> } <ide> }); <ide>
1
PHP
PHP
remove spaces around declare statement
94b191e48f5c6776d506d8886eecee6084b42784
<ide><path>src/Auth/AbstractPasswordHasher.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/BaseAuthenticate.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/BaseAuthorize.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/BasicAuthenticate.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/ControllerAuthorize.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/DefaultPasswordHasher.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/DigestAuthenticate.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/FallbackPasswordHasher.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/FormAuthenticate.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide><path>src/Auth/PasswordHasherFactory.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/Storage/MemoryStorage.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/Storage/SessionStorage.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/Storage/StorageInterface.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>src/Auth/WeakPasswordHasher.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/PHPStan/AssociationTableMixinClassReflectionExtension.php <del><?php declare(strict_types = 1); <add><?php declare(strict_types=1); <ide> <ide> namespace Cake\PHPStan; <ide> <ide><path>tests/TestCase/Auth/BasicAuthenticateTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/ControllerAuthorizeTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * ControllerAuthorizeTest file <ide> * <ide><path>tests/TestCase/Auth/DefaultPasswordHasherTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/DigestAuthenticateTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * DigestAuthenticateTest file <ide> * <ide><path>tests/TestCase/Auth/FallbackPasswordHasherTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/FormAuthenticateTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/PasswordHasherFactoryTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/Storage/MemoryStorageTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/Storage/SessionStorageTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide><path>tests/TestCase/Auth/WeakPasswordHasherTest.php <ide> <?php <del>declare(strict_types = 1); <add>declare(strict_types=1); <ide> /** <ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
25
Python
Python
fix np.average with object array weights
1588ae39ffb51ea916f03510671aab711fdfb568
<ide><path>numpy/lib/function_base.py <ide> def average(a, axis=None, weights=None, returned=False): <ide> wgt = wgt.swapaxes(-1, axis) <ide> <ide> scl = wgt.sum(axis=axis, dtype=result_dtype) <del> if (scl == 0.0).any(): <add> if np.any(scl == 0.0): <ide> raise ZeroDivisionError( <ide> "Weights sum to zero, can't be normalized") <ide> <ide><path>numpy/lib/tests/test_function_base.py <ide> import operator <ide> import warnings <ide> import sys <add>import decimal <ide> <ide> import numpy as np <ide> from numpy.testing import ( <ide> def test_upcasting(self): <ide> w = np.array([[1,2],[3,4]], dtype=wt) <ide> assert_equal(np.average(a, weights=w).dtype, np.dtype(rt)) <ide> <add> def test_object_dtype(self): <add> a = np.array([decimal.Decimal(x) for x in range(10)]) <add> w = np.array([decimal.Decimal(1) for _ in range(10)]) <add> w /= w.sum() <add> assert_almost_equal(a.mean(0), average(a, weights=w)) <add> <ide> class TestSelect(TestCase): <ide> choices = [np.array([1, 2, 3]), <ide> np.array([4, 5, 6]),
2
Text
Text
add the text "### background..." to article
f08734d2d2b14104f805b0cd0eb32f355fc34964
<ide><path>guide/english/blockchain/cryptocurrency/index.md <ide> Some people invest in cryptocurrency on exchanges such as Binance, Bitrex, or Co <ide> [Cryptocurrency](https://en.wikipedia.org/wiki/Cryptocurrency) <ide> [Ultimate Guide to Cryptocurrency](https://blockgeeks.com/guides/what-is-cryptocurrency) <ide> [Bitcoin](https://en.wikipedia.org/wiki/Bitcoin) <add> <add>### Background History on origins of cryptocurrency: <add>[Blockchain History](https://www.activism.net/cypherpunk/manifesto.html)
1
Ruby
Ruby
fix eager association test. closes [alexey]
52fe604da3b72ebbe4d7789917cdcb2ef68b2e6d
<ide><path>activerecord/test/associations/eager_test.rb <ide> def test_with_two_tables_in_from_without_getting_double_quoted <ide> :select => "posts.*", <ide> :from => "authors, posts", <ide> :include => :comments, <del> :conditions => "posts.author_id = authors.id" <add> :conditions => "posts.author_id = authors.id", <add> :order => "posts.id" <ide> ) <ide> <ide> assert_equal 2, posts.first.comments.size
1
Text
Text
fix typo in example section of dynamic-import.md
3bf0fcf35db9e4b03b1fe99486bdb3e65e86c295
<ide><path>docs/advanced-features/dynamic-import.md <ide> Next.js supports lazy loading external libraries with `import()` and React compo <ide> <ide> ## Example <ide> <del>By using `next/dynamic`, the header component will not be included in page's the initial JavaScript bundle. The page will render the Suspense `fallback` first, followed by the `Header` component when the `Suspense` boundary is resolved. <add>By using `next/dynamic`, the header component will not be included in the page's initial JavaScript bundle. The page will render the Suspense `fallback` first, followed by the `Header` component when the `Suspense` boundary is resolved. <ide> <ide> ```jsx <ide> import dynamic from 'next/dynamic'
1
Text
Text
update generic view documentation
1ceca69e5fa64344f1a039526fb653bf6bbd8a9d
<ide><path>docs/api-guide/generic-views.md <ide> For very simple cases you might want to pass through any class attributes using <ide> <ide> The following classes are the concrete generic views. If you're using generic views this is normally the level you'll be working at unless you need heavily customized behavior. <ide> <del>## ListAPIView <add>## CreateAPIView <ide> <del>Used for **read-only** endpoints to represent a **collection of model instances**. <add>Used for **create-only** endpoints. <ide> <del>Provides a `get` method handler. <add>Provides `post` method handlers. <ide> <del>Extends: [MultipleObjectBaseAPIView], [ListModelMixin] <add>Extends: [GenericAPIView], [CreateModelMixin] <ide> <del>## ListCreateAPIView <add>## ListAPIView <ide> <del>Used for **read-write** endpoints to represent a **collection of model instances**. <add>Used for **read-only** endpoints to represent a **collection of model instances**. <ide> <del>Provides `get` and `post` method handlers. <add>Provides a `get` method handler. <ide> <del>Extends: [MultipleObjectBaseAPIView], [ListModelMixin], [CreateModelMixin] <add>Extends: [MultipleObjectAPIView], [ListModelMixin] <ide> <ide> ## RetrieveAPIView <ide> <ide> Used for **read-only** endpoints to represent a **single model instance**. <ide> <ide> Provides a `get` method handler. <ide> <del>Extends: [SingleObjectBaseAPIView], [RetrieveModelMixin] <add>Extends: [SingleObjectAPIView], [RetrieveModelMixin] <add> <add>## DestroyAPIView <add> <add>Used for **delete-only** endpoints for a **single model instance**. <add> <add>Provides a `delete` method handler. <add> <add>Extends: [SingleObjectAPIView], [DestroyModelMixin] <add> <add>## UpdateAPIView <add> <add>Used for **update-only** endpoints for a **single model instance**. <add> <add>Provides a `put` method handler. <add> <add>Extends: [SingleObjectAPIView], [UpdateModelMixin] <add> <add>## ListCreateAPIView <add> <add>Used for **read-write** endpoints to represent a **collection of model instances**. <add> <add>Provides `get` and `post` method handlers. <add> <add>Extends: [MultipleObjectAPIView], [ListModelMixin], [CreateModelMixin] <ide> <ide> ## RetrieveDestroyAPIView <ide> <ide> Used for **read or delete** endpoints to represent a **single model instance**. <ide> <ide> Provides `get` and `delete` method handlers. <ide> <del>Extends: [SingleObjectBaseAPIView], [RetrieveModelMixin], [DestroyModelMixin] <add>Extends: [SingleObjectAPIView], [RetrieveModelMixin], [DestroyModelMixin] <ide> <ide> ## RetrieveUpdateDestroyAPIView <ide> <del>Used for **read-write** endpoints to represent a **single model instance**. <add>Used for **read-write-delete** endpoints to represent a **single model instance**. <ide> <ide> Provides `get`, `put` and `delete` method handlers. <ide> <del>Extends: [SingleObjectBaseAPIView], [RetrieveModelMixin], [UpdateModelMixin], [DestroyModelMixin] <add>Extends: [SingleObjectAPIView], [RetrieveModelMixin], [UpdateModelMixin], [DestroyModelMixin] <ide> <ide> --- <ide> <ide> The mixin classes provide the actions that are used to provide the basic view be <ide> <ide> Provides a `.list(request, *args, **kwargs)` method, that implements listing a queryset. <ide> <del>Should be mixed in with [MultipleObjectBaseAPIView]. <add>Should be mixed in with [MultipleObjectAPIView]. <ide> <ide> ## CreateModelMixin <ide> <ide> Should be mixed in with any [BaseAPIView]. <ide> <ide> Provides a `.retrieve(request, *args, **kwargs)` method, that implements returning an existing model instance in a response. <ide> <del>Should be mixed in with [SingleObjectBaseAPIView]. <add>Should be mixed in with [SingleObjectAPIView]. <ide> <ide> ## UpdateModelMixin <ide> <ide> Provides a `.update(request, *args, **kwargs)` method, that implements updating and saving an existing model instance. <ide> <del>Should be mixed in with [SingleObjectBaseAPIView]. <add>Should be mixed in with [SingleObjectAPIView]. <ide> <ide> ## DestroyModelMixin <ide> <ide> Provides a `.destroy(request, *args, **kwargs)` method, that implements deletion of an existing model instance. <ide> <del>Should be mixed in with [SingleObjectBaseAPIView]. <add>Should be mixed in with [SingleObjectAPIView]. <ide> <ide> [cite]: https://docs.djangoproject.com/en/dev/ref/class-based-views/#base-vs-generic-views <ide> [MultipleObjectMixin]: https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-multiple-object/ <ide> [SingleObjectMixin]: https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-single-object/ <ide> [multiple-object-mixin-classy]: http://ccbv.co.uk/projects/Django/1.4/django.views.generic.list/MultipleObjectMixin/ <ide> [single-object-mixin-classy]: http://ccbv.co.uk/projects/Django/1.4/django.views.generic.detail/SingleObjectMixin/ <ide> <del>[BaseAPIView]: #baseapiview <del>[SingleObjectBaseAPIView]: #singleobjectbaseapiview <del>[MultipleObjectBaseAPIView]: #multipleobjectbaseapiview <add>[GenericAPIView]: #genericapiview <add>[SingleObjectAPIView]: #singleobjectapiview <add>[MultipleObjectAPIView]: #multipleobjectapiview <ide> [ListModelMixin]: #listmodelmixin <ide> [CreateModelMixin]: #createmodelmixin <ide> [RetrieveModelMixin]: #retrievemodelmixin
1
Javascript
Javascript
add wasm extensions as default
ccbc07c239a54b312189f76b0d62f5038c20fe46
<ide><path>lib/WebpackOptionsDefaulter.js <ide> class WebpackOptionsDefaulter extends OptionsDefaulter { <ide> this.set("resolve", "call", value => Object.assign({}, value)); <ide> this.set("resolve.unsafeCache", true); <ide> this.set("resolve.modules", ["node_modules"]); <del> this.set("resolve.extensions", [".mjs", ".js", ".json"]); <add> this.set("resolve.extensions", [".wasm", ".mjs", ".js", ".json"]); <ide> this.set("resolve.mainFiles", ["index"]); <ide> this.set("resolve.aliasFields", "make", (options) => { <ide> if(options.target === "web" || options.target === "webworker")
1
Ruby
Ruby
use `builderror#formula` instead of `args`
a895f398edae9da096950bcd68eefa2d233fa137
<ide><path>Library/Homebrew/brew.rb <ide> def output_unsupported_error <ide> Utils::Analytics.report_build_error(e) <ide> e.dump <ide> <del> output_unsupported_error if Homebrew.args.HEAD? || e.formula.deprecated? || e.formula.disabled? <add> output_unsupported_error if e.formula.head? || e.formula.deprecated? || e.formula.disabled? <ide> <ide> exit 1 <ide> rescue RuntimeError, SystemCallError => e
1
Text
Text
remove extraneous colon in legacy subject
5d838d3f34b2367351ba16e2be82b3860988aa99
<ide><path>doc/api/tls.md <ide> certificate. <ide> <ide> * `raw` {Buffer} The DER encoded X.509 certificate data. <ide> * `subject` {Object} The certificate subject, described in terms of <del> Country (`C:`), StateOrProvince (`ST`), Locality (`L`), Organization (`O`), <add> Country (`C`), StateOrProvince (`ST`), Locality (`L`), Organization (`O`), <ide> OrganizationalUnit (`OU`), and CommonName (`CN`). The CommonName is typically <ide> a DNS name with TLS certificates. Example: <ide> `{C: 'UK', ST: 'BC', L: 'Metro', O: 'Node Fans', OU: 'Docs', CN: 'example.com'}`.
1
Javascript
Javascript
add test for cluster benchmarks
0c5ea126dccaa431b8ebe26a690dc1447369c72d
<ide><path>test/parallel/test-benchmark-cluster.js <add>'use strict'; <add> <add>require('../common'); <add> <add>// Minimal test for cluster benchmarks. This makes sure the benchmarks aren't <add>// horribly broken but nothing more than that. <add> <add>const assert = require('assert'); <add>const fork = require('child_process').fork; <add>const path = require('path'); <add> <add>const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js'); <add>const argv = ['--set', 'n=1', <add> '--set', 'payload=string', <add> '--set', 'sendsPerBroadcast=1', <add> 'cluster']; <add> <add>const child = fork(runjs, argv); <add>child.on('exit', (code, signal) => { <add> assert.strictEqual(code, 0); <add> assert.strictEqual(signal, null); <add>});
1
Text
Text
add 1.3.3 changes
d5968c785389d0d516075979f953d855398eb301
<ide><path>CHANGELOG.md <add><a name="1.3.3"></a> <add># 1.3.3 undersea-arithmetic (2014-11-17) <add> <add> <add>## Bug Fixes <add> <add>- **$http:** don't parse single space responses as JSON <add> ([6f19a6fd](https://github.com/angular/angular.js/commit/6f19a6fd33ab72d3908e3418fba47ee8e1598fa6), <add> [#9907](https://github.com/angular/angular.js/issues/9907)) <add>- **minErr:** stringify non-JSON compatible objects in error messages <add> ([cf43ccdf](https://github.com/angular/angular.js/commit/cf43ccdf9b8665a2fd5d6aa52f80cb2d7c9bb7e2), <add> [#10085](https://github.com/angular/angular.js/issues/10085)) <add>- **$rootScope:** handle cyclic references in scopes when creating error messages <add> ([e80053d9](https://github.com/angular/angular.js/commit/e80053d91fd7c722e092a23d326384de2e552eb6), <add> [#10085](https://github.com/angular/angular.js/issues/10085)) <add>- **ngRepeat:** support cyclic object references in error messages <add> ([fa12c3c8](https://github.com/angular/angular.js/commit/fa12c3c86af7965d1b9d9a5dd3434755e9e04635), <add> [#9838](https://github.com/angular/angular.js/issues/9838), [#10065](https://github.com/angular/angular.js/issues/10065), [#10085](https://github.com/angular/angular.js/issues/10085)) <add>- **ngMock:** call $interval callbacks even when invokeApply is false <add> ([d81ff888](https://github.com/angular/angular.js/commit/d81ff8885b77f70c6417d7be3124d86d07447375), <add> [#10032](https://github.com/angular/angular.js/issues/10032)) <add>- **ngPattern:** match behaviour of native HTML pattern attribute <add> ([85eb9660](https://github.com/angular/angular.js/commit/85eb9660ef67c24d5104a6a1921bedad0bd1b57e), <add> [#9881](https://github.com/angular/angular.js/issues/9881), [#9888](https://github.com/angular/angular.js/issues/9888)) <add>- **select:** ensure the label attribute is updated in Internet Explorer <add> ([6604c236](https://github.com/angular/angular.js/commit/6604c2361427fba8c43a39dc2e92197390dfbdbe), <add> [#9621](https://github.com/angular/angular.js/issues/9621), [#10042](https://github.com/angular/angular.js/issues/10042)) <add> <add> <add>## Features <add> <add>- **$location:** allow to location to be changed during $locationChangeStart <add> ([a9352c19](https://github.com/angular/angular.js/commit/a9352c19ce33f0393d6581547c7ea8dfc2a8b78f), <add> [#9607](https://github.com/angular/angular.js/issues/9607), [#9678](https://github.com/angular/angular.js/issues/9678)) <add>- **$routeProvider:** allow setting caseInsensitiveMatch on the provider <add> ([0db573b7](https://github.com/angular/angular.js/commit/0db573b7493f76abd94ff65ce660017d617e865b), <add> [#6477](https://github.com/angular/angular.js/issues/6477), [#9873](https://github.com/angular/angular.js/issues/9873)) <add> <add> <add>## Performance Improvements <add> <add>- **orderBy:** copy array with slice instead of for loop <add> ([8eabc546](https://github.com/angular/angular.js/commit/8eabc5463c795d87f37e5a9eacbbb14435024061), <add> [#9942](https://github.com/angular/angular.js/issues/9942)) <add> <add> <add> <ide> <a name="1.3.2"></a> <ide> # 1.3.2 cardiovasculatory-magnification (2014-11-07) <ide>
1
PHP
PHP
use tab characters instead of spaces
a427a4d8f093e016f7f73200b8b31542843fd059
<ide><path>src/Illuminate/View/Factory.php <ide> public function startSection($section, $content = '') <ide> { <ide> if ($content === '') <ide> { <del> if (ob_start()) <del> { <del> $this->sectionStack[] = $section; <del> } <add> if (ob_start()) <add> { <add> $this->sectionStack[] = $section; <add> } <ide> } <ide> else <ide> {
1
Go
Go
add logs when docker enabled selinux
1bf529a45674dc07de6efba806b854f63f3dc0bf
<ide><path>daemon/daemon.go <ide> func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) <ide> return nil, fmt.Errorf("Unable to get the full path to the TempDir (%s): %s", tmp, err) <ide> } <ide> os.Setenv("TMPDIR", realTmp) <del> if !config.EnableSelinuxSupport { <del> selinuxSetDisabled() <del> } <ide> <ide> // get the canonical path to the Docker root directory <ide> var realRoot string <ide> func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error) <ide> } <ide> log.Debugf("Using graph driver %s", driver) <ide> <del> // As Docker on btrfs and SELinux are incompatible at present, error on both being enabled <del> if selinuxEnabled() && config.EnableSelinuxSupport && driver.String() == "btrfs" { <del> return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver!") <add> if config.EnableSelinuxSupport { <add> if selinuxEnabled() { <add> // As Docker on btrfs and SELinux are incompatible at present, error on both being enabled <add> if driver.String() == "btrfs" { <add> return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver") <add> } <add> log.Debug("SELinux enabled successfully") <add> } else { <add> log.Warn("Docker could not enable SELinux on the host system") <add> } <add> } else { <add> selinuxSetDisabled() <ide> } <ide> <ide> daemonRepo := path.Join(config.Root, "containers")
1
Javascript
Javascript
remove redundant registrations
6fe5504e2fd50e4e70756e7c035d2b60160efd46
<ide><path>packages/ember-glimmer/tests/integration/helpers/input-test.js <ide> import { assign } from 'ember-utils'; <ide> import { set } from 'ember-metal'; <del>import { TextField, Checkbox, Component } from '../../utils/helpers'; <add>import { Component } from '../../utils/helpers'; <ide> import { RenderingTest, moduleFor } from '../../utils/test-case'; <ide> import { runDestroy } from 'internal-test-helpers'; <ide> <ide> class InputRenderingTest extends RenderingTest { <del> constructor() { <del> super(); <del> <del> this.registerComponent('-text-field', { ComponentClass: TextField }); <del> this.registerComponent('-checkbox', { ComponentClass: Checkbox }); <del> } <del> <ide> $input() { <ide> return this.$('input'); <ide> } <ide><path>packages/ember-glimmer/tests/integration/helpers/text-area-test.js <ide> import { assign } from 'ember-utils'; <ide> import { set } from 'ember-metal'; <del>import { TextArea } from '../../utils/helpers'; <ide> import { RenderingTest, moduleFor } from '../../utils/test-case'; <ide> import { classes } from '../../utils/test-helpers'; <ide> import { applyMixins } from '../../utils/abstract-test-case'; <ide> <ide> class TextAreaRenderingTest extends RenderingTest { <del> constructor() { <del> super(); <del> <del> this.registerComponent('-text-area', { ComponentClass: TextArea }); <del> } <del> <ide> assertTextArea({ attrs, value } = {}) { <ide> let mergedAttrs = assign({ 'class': classes('ember-view ember-text-area') }, attrs); <ide> this.assertComponentElement(this.firstChild, { tagName: 'textarea', attrs: mergedAttrs }); <ide><path>packages/ember-glimmer/tests/utils/helpers.js <ide> export { <ide> Helper, <ide> helper, <ide> Component, <del> TextArea, <ide> LinkComponent, <del> TextField, <ide> InteractiveRender, <ide> InertRenderer, <ide> htmlSafe,
3
PHP
PHP
add doc block for withfile()
361fb2430d3092a45fdbe4091ccc9a67e942a844
<ide><path>src/Network/Response.php <ide> public function cors(Request $request, $allowedDomains = [], $allowedMethods = [ <ide> * @param array $options Options See above. <ide> * @return void <ide> * @throws \Cake\Network\Exception\NotFoundException <add> * @deprecated 3.4.0 Use withFile() instead. <ide> */ <ide> public function file($path, array $options = []) <ide> { <ide> public function file($path, array $options = []) <ide> $this->stream = new Stream($file->path, 'rb'); <ide> } <ide> <add> /** <add> * Create a new instance that is based on a file. <add> * <add> * This method will augment both the body and a number of related headers. <add> * <add> * If `$_SERVER['HTTP_RANGE']` is set, a slice of the file will be <add> * returned instead of the entire file. <add> * <add> * ### Options keys <add> * <add> * - name: Alternate download name <add> * - download: If `true` sets download header and forces file to <add> * be downloaded rather than displayed inline. <add> * <add> * @param string $path Path to file. If the path is not an absolute path that resolves <add> * to a file, `APP` will be prepended to the path. <add> * @param array $options Options See above. <add> * @return static <add> * @throws \Cake\Network\Exception\NotFoundException <add> */ <ide> public function withFile($path, array $options = []) <ide> { <ide> $file = $this->validateFile($path); <ide> public function withFile($path, array $options = []) <ide> 'download' => null <ide> ]; <ide> <del> $new = clone $this; <ide> $extension = strtolower($file->ext()); <ide> $mapped = $this->getMimeType($extension); <ide> if ((!$extension || !$mapped) && $options['download'] === null) { <ide> $options['download'] = true; <ide> } <ide> <add> $new = clone $this; <ide> if ($mapped) { <ide> $new = $new->withType($extension); <ide> }
1
Python
Python
update ignored directories
411048b16bc09793aa6b0f3953c2fa4cc4b71456
<ide><path>scripts/check_asf_license_headers.py <ide> 'build', <ide> 'dist', <ide> 'docs', <add> 'venv/', <ide> <ide> 'libcloud/utils/iso8601.py' <ide> ]
1
PHP
PHP
update links to the book
bcab99540a4e938dfcb51510eb456a8d5104ca01
<ide><path>src/Core/App.php <ide> * Plugins can be located with App as well. Using Plugin::path('DebugKit') for example, will <ide> * give you the full path to the DebugKit plugin. <ide> * <del> * @link http://book.cakephp.org/3.0/en/core-utility-libraries/app.html <add> * @link http://book.cakephp.org/3.0/en/core-libraries/app.html <ide> */ <ide> class App <ide> { <ide><path>src/Filesystem/File.php <ide> class File <ide> * File name <ide> * <ide> * @var string <del> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$name <add> * http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#Cake\Filesystem\File::$name <ide> */ <ide> public $name = null; <ide> <ide> /** <ide> * File info <ide> * <ide> * @var array <del> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$info <add> * http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#Cake\Filesystem\File::$info <ide> */ <ide> public $info = []; <ide> <ide> /** <ide> * Holds the file handler resource if the file is opened <ide> * <ide> * @var resource <del> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$handle <add> * http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#Cake\Filesystem\File::$handle <ide> */ <ide> public $handle = null; <ide> <ide> /** <ide> * Enable locking for file reading and writing <ide> * <ide> * @var bool <del> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$lock <add> * http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#Cake\Filesystem\File::$lock <ide> */ <ide> public $lock = null; <ide> <ide> class File <ide> * Current file's absolute path <ide> * <ide> * @var mixed <del> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::$path <add> * http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#Cake\Filesystem\File::$path <ide> */ <ide> public $path = null; <ide> <ide><path>src/Filesystem/Folder.php <ide> class Folder <ide> * Mode to be used on create. Does nothing on windows platforms. <ide> * <ide> * @var int <del> * http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::$mode <add> * http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#Cake\Filesystem\Folder::$mode <ide> */ <ide> public $mode = 0755; <ide> <ide><path>src/View/Helper/FormHelper.php <ide> protected function _isRequiredField($validationRules) <ide> * to make a model-less form. <ide> * @param array $options An array of html attributes and options. <ide> * @return string An formatted opening FORM tag. <del> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-create <add> * @link http://book.cakephp.org/3.0/en/views/helpers/form.html#Cake\View\Helper\FormHelper::create <ide> */ <ide> public function create($model = null, array $options = []) <ide> {
4
Text
Text
update stability of report features
a022d387ea89a3bc5e7435faf2ae7030e0646af1
<ide><path>doc/api/cli.md <ide> warning will be written to stderr instead. <ide> <!-- YAML <ide> added: v11.8.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This option is no longer considered experimental. <ide> - version: v12.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/27312 <ide> description: Changed from `--diagnostic-report-directory` to <ide> Location at which the report will be generated. <ide> <!-- YAML <ide> added: v11.8.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This option is no longer considered experimental. <ide> - version: v12.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/27312 <ide> description: changed from `--diagnostic-report-filename` to <ide> changes: <ide> `--report-on-fatalerror` <ide> --> <ide> <add>> Stability: 1 - Experimental <add> <ide> Enables the report to be triggered on fatal errors (internal errors within <ide> the Node.js runtime such as out of memory) that lead to termination of the <ide> application. Useful to inspect various diagnostic data elements such as heap, <ide> error. <ide> <!-- YAML <ide> added: v11.8.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This option is no longer considered experimental. <ide> - version: v12.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/27312 <ide> description: changed from `--diagnostic-report-on-signal` to <ide> specified through `--report-signal`. <ide> <!-- YAML <ide> added: v11.8.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This option is no longer considered experimental. <ide> - version: v12.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/27312 <ide> description: changed from `--diagnostic-report-signal` to <ide> Default signal is `SIGUSR2`. <ide> <!-- YAML <ide> added: v11.8.0 <ide> changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This option is no longer considered experimental. <ide> - version: v12.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/27312 <ide> description: changed from `--diagnostic-report-uncaught-exception` to <ide><path>doc/api/process.md <ide> relied upon to exist. <ide> ## `process.report` <ide> <!-- YAML <ide> added: v11.8.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * {Object} <ide> <ide> `process.report` is an object whose methods are used to generate diagnostic <ide> reports for the current process. Additional documentation is available in the <ide> ### `process.report.directory` <ide> <!-- YAML <ide> added: v11.12.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * {string} <ide> <ide> Directory where the report is written. The default value is the empty string, <ide> console.log(`Report directory is ${process.report.directory}`); <ide> ### `process.report.filename` <ide> <!-- YAML <ide> added: v11.12.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * {string} <ide> <ide> Filename where the report is written. If set to the empty string, the output <ide> console.log(`Report filename is ${process.report.filename}`); <ide> ### `process.report.getReport([err])` <ide> <!-- YAML <ide> added: v11.8.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * `err` {Error} A custom error used for reporting the JavaScript stack. <ide> * Returns: {Object} <ide> <ide> console.log(`Report on fatal error: ${process.report.reportOnFatalError}`); <ide> ### `process.report.reportOnSignal` <ide> <!-- YAML <ide> added: v11.12.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * {boolean} <ide> <ide> If `true`, a diagnostic report is generated when the process receives the <ide> console.log(`Report on signal: ${process.report.reportOnSignal}`); <ide> ### `process.report.reportOnUncaughtException` <ide> <!-- YAML <ide> added: v11.12.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * {boolean} <ide> <ide> If `true`, a diagnostic report is generated on uncaught exception. <ide> console.log(`Report on exception: ${process.report.reportOnUncaughtException}`); <ide> ### `process.report.signal` <ide> <!-- YAML <ide> added: v11.12.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * {string} <ide> <ide> The signal used to trigger the creation of a diagnostic report. Defaults to <ide> console.log(`Report signal: ${process.report.signal}`); <ide> ### `process.report.writeReport([filename][, err])` <ide> <!-- YAML <ide> added: v11.8.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32242 <add> description: This API is no longer considered experimental. <ide> --> <ide> <del>> Stability: 1 - Experimental <del> <ide> * `filename` {string} Name of the file where the report is written. This <ide> should be a relative path, that will be appended to the directory specified in <ide> `process.report.directory`, or the current working directory of the Node.js <ide><path>doc/api/report.md <ide> <!--introduced_in=v11.8.0--> <ide> <!-- type=misc --> <ide> <del>> Stability: 1 - Experimental <add>> Stability: 2 - Stable <ide> <ide> <!-- name=report --> <ide>
3
PHP
PHP
tweak some bootstrapping logic
95d4f703f6a0b2c5e3f9d24412dd0049dae9c20b
<ide><path>src/Illuminate/Foundation/Application.php <ide> class Application extends Container implements ApplicationContract { <ide> */ <ide> protected $basePath; <ide> <add> /** <add> * Indicates if the application has been bootstrapped before. <add> * <add> * @var bool <add> */ <add> protected $hasBeenBootstrapped = false; <add> <ide> /** <ide> * Indicates if the application has "booted". <ide> * <ide> public function bootstrapWith(array $bootstrappers) <ide> { <ide> $this->make($bootstrapper)->bootstrap($this); <ide> } <add> <add> $this->hasBeenBootstrapped = true; <add> } <add> <add> /** <add> * Determine if the application has been bootstrapped before. <add> * <add> * @return bool <add> */ <add> public function hasBeenBootstrapped() <add> { <add> return $this->hasBeenBootstrapped; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Foundation/Console/Kernel.php <ide> class Kernel implements KernelContract { <ide> * @return void <ide> */ <ide> protected $bootstrappers = [ <del> 'Illuminate\Foundation\Bootstrap\DetectEnvironment', <add> 'Illuminate\Foundation\Bootstrap\LoadEnvironment', <ide> 'Illuminate\Foundation\Bootstrap\LoadConfiguration', <del> 'Illuminate\Foundation\Bootstrap\ConfigureLogging', <ide> 'Illuminate\Foundation\Bootstrap\RegisterFacades', <ide> 'Illuminate\Foundation\Bootstrap\RegisterProviders', <ide> 'Illuminate\Foundation\Bootstrap\BootProviders', <ide> ]; <ide> <del> /** <del> * The Artisan commands provided by your application. <del> * <del> * @var array <del> */ <del> protected $commands = []; <del> <ide> /** <ide> * Create a new console kernel instance. <ide> * <ide> public function __construct(Application $app, Dispatcher $events) <ide> */ <ide> public function handle($input, $output = null) <ide> { <del> $this->app->bootstrapWith($this->bootstrappers); <add> $this->bootstrap(); <add> <add> return (new Artisan($this->app, $this->events))->run($input, $output); <add> } <ide> <del> return (new Artisan($this->app, $this->events)) <del> ->resolveCommands($this->commands) <del> ->run($input, $output); <add> /** <add> * Bootstrap the application for HTTP requests. <add> * <add> * @return void <add> */ <add> public function bootstrap() <add> { <add> if ( ! $this->app->hasBeenBootstrapped()) <add> { <add> $this->app->bootstrapWith($this->bootstrappers); <add> } <ide> } <ide> <ide> } <ide><path>src/Illuminate/Foundation/Http/Kernel.php <ide> class Kernel implements KernelContract { <ide> */ <ide> protected $router; <ide> <del> /** <del> * Indicates if the bootstrap process has run. <del> * <del> * @var bool <del> */ <del> protected $bootstrapped = false; <del> <ide> /** <ide> * The bootstrap classes for the application. <ide> * <ide> * @return void <ide> */ <ide> protected $bootstrappers = [ <del> 'Illuminate\Foundation\Bootstrap\DetectEnvironment', <add> 'Illuminate\Foundation\Bootstrap\LoadEnvironment', <ide> 'Illuminate\Foundation\Bootstrap\LoadConfiguration', <del> 'Illuminate\Foundation\Bootstrap\ConfigureLogging', <ide> 'Illuminate\Foundation\Bootstrap\HandleExceptions', <ide> 'Illuminate\Foundation\Bootstrap\RegisterFacades', <ide> 'Illuminate\Foundation\Bootstrap\RegisterProviders', <ide> public function handle($request) <ide> */ <ide> public function bootstrap() <ide> { <del> if ( ! $this->bootstrapped) <add> if ( ! $this->app->hasBeenBootstrapped()) <ide> { <ide> $this->app->bootstrapWith($this->bootstrappers); <ide> } <del> <del> $this->bootstrapped = true; <ide> } <ide> <ide> /**
3
Javascript
Javascript
add mock "tostring" method to tzdate
0fbaa2f12ab96328fe2e7b4b9f3ec0c8d7f30e37
<ide><path>src/angular-mocks.js <ide> function MockLogFactory() { <ide> * </pre> <ide> * <ide> */ <del>function TzDate(offset, timestamp) { <add>function TzDate(offset, timestamp, toStringVal) { <ide> if (angular.isString(timestamp)) { <ide> var tsStr = timestamp; <ide> <ide> function TzDate(offset, timestamp) { <ide> return this.date.getTime() - this.offsetDiff; <ide> }; <ide> <add> this.toString = function() { <add> return toStringVal; <add> } <add> <ide> this.toLocaleDateString = function() { <ide> return this.date.toLocaleDateString(); <ide> }; <ide> function TzDate(offset, timestamp) { <ide> 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf']; <ide> <ide> angular.forEach(unimplementedMethods, function(methodName) { <add> if (methodName == 'toString' && toStringVal) return; <add> <ide> self[methodName] = function() { <ide> throw { <ide> name: "MethodNotImplemented", <ide><path>test/angular-mocksSpec.js <ide> describe('mocks', function(){ <ide> expect(date2.getUTCMinutes()).toBe(0); <ide> expect(date2.getUTCSeconds()).toBe(0); <ide> }); <add> <add> <add> it('should fake toString method when a third param is passed in', function() { <add> var t = new TzDate(0, 0, 'Mon Sep 3 2010 17:05:08 GMT+0500 (XYZ)'); <add> expect(t.toString()).toBe('Mon Sep 3 2010 17:05:08 GMT+0500 (XYZ)'); <add> }); <add> <add> <add> it('should throw error when no third param but toString called', function() { <add> var t = new TzDate(0, 0); <add> try { <add> t.toString(); <add> } catch(err) { <add> expect(err.name).toBe('MethodNotImplemented'); <add> } <add> }) <ide> }); <ide> <ide> describe('$log mock', function() {
2
Text
Text
update rfc based on feedback
6ca40a6521b9a2a46f632f16c01d02ed85a4cab3
<ide><path>docs/rfcs/001-updateable-bundled-packages.md <ide> Proposed <ide> <ide> ## Summary <ide> <del>> One paragraph explanation of the feature. <del> <ide> This feature will enable an opt-in subset of bundled Atom packages to be updated with `apm` outside of the Atom release cycle. This will enable users to receive new functionality and bug fixes for some bundled packages as regularly as needed without waiting for them to be included in a new Atom release. This is especially important for packages like [GitHub](https://github.com/atom/github/) and [Teletype](https://github.com/atom/teletype/) which provide essential Atom functionality and could be improved independently of Atom. <ide> <ide> ## Motivation <ide> <del>> Why are we doing this? What use cases does it support? What is the expected outcome? <del> <ide> Atom currently uses a monthly release cycle with staged Stable and Beta releases so that major issues get caught early in Beta before reaching the Stable release. Because Atom releases updates monthly, this means that a new feature merged into `master` right after a new Atom release could take one month to reach the next Beta and then another month to reach Stable. <ide> <ide> Since a large part of Atom's built-in functionality is provided by bundled packages, it makes sense to allow some of those packages to be updated independently of Atom's monthly release cycle so that users can receive new features and fixes whenever they become available. <ide> <add>Bundled packages are treated differently than community packages that you can install using `apm`: <add> <add>- You are not prompted to update them when new versions are released on `apm` <add>- `apm` will warn you at the command line when you try to install or update a bundled package <add>- If a user intentionally installs a bundled package from `apm` the [dalek package](https://github.com/atom/dalek/) will show a warning in the "deprecations" view asking the user to remove the offending package <add> <add>Despite all this, if the user *does* manually install an update to a bundled package using `apm`, it will be loaded into the editor and updated dutifully as new releases occur. The only new functionality needed is to enable `apm` to check bundled packages for updates when those packages haven't yet been installed in the user's `~/.atom/packages` folder. <add> <ide> The primary use case for this improvement is enabling the GitHub package to ship improvements more frequently than Atom's release cycle since many of its improvements can be done without changes to Atom itself. If this approach is proven to work well for the GitHub package, we might also consider using it to ship Teletype as a bundled Atom package. <ide> <ide> ## Explanation <ide> The primary use case for this improvement is enabling the GitHub package to ship <ide> > - Explaining the feature largely in terms of examples. <ide> > - Explaining any changes to existing workflows. <ide> <del>Bundled packages are treated differently than community packages that you can install using `apm`: <add>Any bundled Atom package can opt in to new updates released via `apm` by adding `"coreUpdateable": true` to its `package.json` file. This causes `apm` to consider it as part of the list of packages it checks for updates. If a community (non-bundled) package sets this field to `true` or `false` it will be ignored as it's only relevant to bundled packages. <ide> <del>- You are not prompted to update them when new versions are released on `apm` <del>- `apm` will warn you at the command line when you try to install or update a bundled package <del>- If a user intentionally installs a bundled package from `apm` the [Dalek package](https://github.com/atom/dalek/) will show a warning in the "deprecations" view asking the user to remove the offending package <del> <del>Despite all this, if the user *does* install a bundled package using `apm`, it will be loaded into the editor and updated dutifully as releases occur. <del> <del>### Implementation Details <del> <del>Because the necessary infrastructure is already in place to enable updates to bundled packages using `apm`, the only work required is to provide a way for packages to opt in to this behavior and for `apm` to include those packages in its update checks if they haven't already been installed in the user's packages folder. <del> <del>Any bundled Atom package will be able to opt in to updates by adding `"updateable": true` to its `package.json` file. This will cause `apm` to consider it as part of the list of packages it checks for updates. If a community (non-bundled) package sets this field to `true` or `false` it will be ignored as it's only relevant to bundled packages. <add>`apm` includes each updatable bundled package in its list of. The user is notified of new updates to the package so long as the update supports the engine version of their current Atom build. <ide> <del>`apm` will be updated to include the list of bundled packages with `"updateable": true` set in their `package.json` so that the user will be notified of new package versions that support the engine version of their current Atom build. <add>The `dalek` package is aware of the new "updateable" metadata and excludes updated bundled packages from its deprecation warnings. <ide> <ide> ### User Experience Examples <ide> <del>1. The user downloads Atom 1.28.0 from atom.io which includes GitHub package version 0.15.0. After Atom 1.28.0 was released, a hotfix release was shipped for the GitHub package as 0.15.1. When the user installs and starts Atom, they are prompted to install the update to the GitHub package. <add>1. The user downloads and installs Atom 1.28.0 which includes GitHub package version 0.15.0. Two weeks later, GitHub package 0.16.0 is released with a few new features. The user is prompted to update to the new version and gets the new features even though Atom 1.29.0 hasn't been released yet. <ide> <del>2. The user downloads and installs Atom 1.28.0 from atom.io which includes GitHub package version 0.15.0. Two weeks later, GitHub package 0.16.0 is released with a few new features. The user is prompted to update to the new version and gets the new features even though Atom 1.29.0 hasn't been released yet. <add>2. The user downloads and installs Atom 1.28.0, including GitHub package 0.15.0, which was released two weeks prior. Since that release the GitHub package has been updated to version 0.15.1 on `apm`. When the user starts Atom for the first time they are prompted to update the GitHub package. <ide> <ide> 3. In the future, a user has an old install of Atom 1.28.0 and waits a long time between installing Atom updates. The GitHub package releases version 0.25.0 but the user is not prompted to install it because the GitHub package has set `engines` in `package.json` to restrict to Atom 1.32.0 and above. <ide> <ide> ### Rules for Updateable Bundled Packages <ide> <del>Any package that opts into this behavior must follow one rule: **its `engines` field must be regularly updated to reflect the necessary Atom version for the Atom, Electron, and Node.js APIs used in the package**. This field defines the range of Atom versions in which the package is expected to work. The field should always be set to the lowest possible Atom version that the package supports. <add>Any package that opts into this behavior must adhere to two rules: <ide> <del>If a package wants to use API features of a newer version of Atom while still supporting older Atom versions, it must do so in a way that is aware of the user's version and adjust itself accordingly. <add>1. **Each release must ensure that its `engines` field in `package.json` reflects the necessary Atom version for the Atom, Electron, and Node.js APIs used in the package**. This field defines the range of Atom versions in which the package is expected to work. The field should always be set to the lowest possible Atom version that the package supports. <add> <add>2. **Any new update to a bundled package *must* support current Stable *and* Beta releases**. This enables user to upgrade the package and continue to use it in side-by-side Stable and Beta installs on their machine. If a package wants to use API features of a newer version of Atom while still supporting older Atom versions, it must do so in a way that is aware of the user's version and adjust itself accordingly. <ide> <ide> ## Drawbacks <ide> <del>> Why should we *not* do this? <add>The primary drawback of this approach is that updateable bundled packages might exhibit problems on older Atom versions due to missing or changed APIs in Atom, Electron, or Node.js. The solution for these packages is to keep their `engines` field updated appropriately, but there's still a chance that some updates will slip through without the necessary engine version changes. If this does occur and users are affected by it, the solution is to publish a new update which rolls back the package to the functionality of its previous release and then publish another new update with the new functionality restored and the proper `engine` version in place. <ide> <del>The primary drawback of this approach is that updateable bundled packages might exhibit problems on older Atom versions due to missing or changed APIs in Atom, Electron, or Node.js. The solution for these packages is to keep their `engines` field updated appropriately, but there's still a chance that some updates will slip through without the necessary engine version changes. <add>Another major drawback is that the snapshotted code for the bundled package will no longer be used since a newer version has been installed. This updated version of the package cannot be easily added back into Atom's snapshot so it could cause a noticable drag on Atom's startup time. <ide> <del>One other possible drawback is that an updated version of a bundled package might not be compatible across two different Atom channels. For example, if the user installs a new update to a bundled package that only supports the current Atom Beta release or higher, the user will no longer have access to that package if they open Atom Stable. <add>**TODO: Add some startup time information about running Atom with a non-snapshotted GitHub package** <ide> <del>However, this drawback is no different than what the user would face today installing a community package under the same circumstances, so this could be considered a general problem in the Atom package ecosystem. <add>One other possible drawback is that an updated version of a bundled package might not be compatible across two different Atom channels. For example, if the user installs a new update to a bundled package that only supports the current Atom Beta release or higher, the user will no longer have access to that package if they open Atom Stable. However, this drawback is no different than what the user would face today installing a community package under the same circumstances, so this could be considered a general problem in the Atom package ecosystem. <ide> <del>## Rationale and alternatives <add>Finally, one risk of this approach is that the Atom team forgets to update a bundled package to its latest appropriate version on `apm` just before a new release. If this happens, the user will install a new Atom update and then be prompted to update a package that should have been snapshotted and shipped in-box. To avoid this problem we could add some build automation that checks for the latest version of a bundled package to see if the current Atom build would be supported by it. <ide> <del>> - Why is this approach the best in the space of possible approaches? <del>> - What other approaches have been considered and what is the rationale for not choosing them? <del>> - What is the impact of not doing this? <add>## Rationale and alternatives <ide> <ide> This is the best approach for updating bundled packages because it allows those packages to take control of their own release cycle so long as they manage their Atom engine version correctly. It also does so in a way that allows us to decide which packages can be updated independently, reducing the likelihood of problems for users. <ide> <ide> The primary alternative to this approach is to speed up the Atom release cycle s <ide> <ide> Is it enough to just depend on the `engines` field of `package.json` to protect users from installing a package update that doesn't work with their version of Atom? <ide> <del>Is `updateable` the right name for the field in `package.json`? Is there a clearer name? <del> <ide> > - What unresolved questions do you expect to resolve through the implementation of this feature before it is released in a new version of Atom? <ide> <del>Can package authors ship updates to stable-only and beta-only versions of their packages simultaneously? For example, can the GitHub package keep shipping hotfixes to 0.14.x which targets Atom >=1.27.0 while also shipping updates to 0.15.x which targets >=1.28.0? <add>Is there any optimization we can use to reduce the performance hit of loading updated bundled packages? <ide> <ide> > - What related issues do you consider out of scope for this RFC that could be addressed in the future independently of the solution that comes out of this RFC? <ide>
1
Text
Text
replace an unpleasant grammatical construct
f83dae831f03969c44e80b1d874b0fd00ddeef8a
<ide><path>guides/source/rails_on_rack.md <ide> use Rack::ETag <ide> run MyApp::Application.routes <ide> ``` <ide> <del>Purpose of each of this middlewares is explained in the [Internal Middlewares](#internal-middleware-stack) section. <add>The default middlewares shown here (and some others) are each summarized in the [Internal Middlewares](#internal-middleware-stack) section, below. <ide> <ide> ### Configuring Middleware Stack <ide>
1
Go
Go
fix builder inconsistent error on buggy platform
399695305c67aae1010e6754f90f9078aa39e742
<ide><path>daemon/images/image_builder.go <ide> import ( <ide> "io" <ide> "runtime" <ide> <add> "github.com/containerd/containerd/platforms" <ide> "github.com/docker/distribution/reference" <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/api/types/backend" <ide> "github.com/docker/docker/builder" <add> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/image" <ide> "github.com/docker/docker/layer" <ide> "github.com/docker/docker/pkg/containerfs" <add> "github.com/docker/docker/pkg/progress" <add> "github.com/docker/docker/pkg/streamformatter" <ide> "github.com/docker/docker/pkg/stringid" <ide> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/registry" <ide> specs "github.com/opencontainers/image-spec/specs-go/v1" <ide> "github.com/pkg/errors" <add> "github.com/sirupsen/logrus" <ide> ) <ide> <ide> type roLayer struct { <ide> func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConf <ide> if err := i.pullImageWithReference(ctx, ref, platform, nil, pullRegistryAuth, output); err != nil { <ide> return nil, err <ide> } <del> return i.GetImage(name, platform) <add> <add> img, err := i.GetImage(name, platform) <add> if errdefs.IsNotFound(err) && img != nil && platform != nil { <add> imgPlat := specs.Platform{ <add> OS: img.OS, <add> Architecture: img.BaseImgArch(), <add> Variant: img.BaseImgVariant(), <add> } <add> <add> p := *platform <add> if !platforms.Only(p).Match(imgPlat) { <add> po := streamformatter.NewJSONProgressOutput(output, false) <add> progress.Messagef(po, "", ` <add>WARNING: Pulled image with specified platform (%s), but the resulting image's configured platform (%s) does not match. <add>This is most likely caused by a bug in the build system that created the fetched image (%s). <add>Please notify the image author to correct the configuration.`, <add> platforms.Format(p), platforms.Format(imgPlat), name, <add> ) <add> logrus.WithError(err).WithField("image", name).Warn("Ignoring error about platform mismatch where the manifest list points to an image whose configuration does not match the platform in the manifest.") <add> err = nil <add> } <add> } <add> return img, err <ide> } <ide> <ide> // GetImageAndReleasableLayer returns an image and releaseable layer for a reference or ID.
1
Ruby
Ruby
allow underscore in github version numbers
f0b6870de76a3cbb328c55de677a21c123f0b35a
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def version <ide> stem=self.stem <ide> end <ide> <del> # github tarballs are special <del> # we only support numbered tagged downloads <add> # github tarballs, like v1.2.3 <ide> %r[github.com/.*/tarball/v?((\d\.)+\d+)$].match to_s <ide> return $1 if $1 <ide> <add> # dashed version <ide> # eg. github.com/isaacs/npm/tarball/v0.2.5-1 <ide> %r[github.com/.*/tarball/v?((\d\.)+\d+-(\d+))$].match to_s <ide> return $1 if $1 <ide> <add> # underscore version <add> # eg. github.com/petdance/ack/tarball/1.93_02 <add> %r[github.com/.*/tarball/v?((\d\.)+\d+_(\d+))$].match to_s <add> return $1 if $1 <add> <ide> # eg. boost_1_39_0 <ide> /((\d+_)+\d+)$/.match stem <ide> return $1.gsub('_', '.') if $1
1
PHP
PHP
use repository interfaces instead of alias
4e44ae56d1a4a22b78d1d6fb7f82f06bb3678bbe
<ide><path>src/Illuminate/Queue/Console/RestartCommand.php <ide> <ide> use Illuminate\Console\Command; <ide> use Illuminate\Support\InteractsWithTime; <add>use Illuminate\Contracts\Cache\Repository as Cache; <ide> <ide> class RestartCommand extends Command <ide> { <ide> class RestartCommand extends Command <ide> */ <ide> protected $description = 'Restart queue worker daemons after their current job'; <ide> <add> /** <add> * The cache store implementation. <add> * <add> * @var \Illuminate\Contracts\Cache\Repository <add> */ <add> protected $cache; <add> <add> /** <add> * Create a new queue restart command. <add> * <add> * @param \Illuminate\Contracts\Cache\Repository $cache <add> * @return void <add> */ <add> public function __construct(Cache $cache) <add> { <add> parent::__construct(); <add> <add> $this->cache = $cache; <add> } <add> <ide> /** <ide> * Execute the console command. <ide> * <ide> * @return void <ide> */ <ide> public function handle() <ide> { <del> $this->laravel['cache.store']->forever('illuminate:queue:restart', $this->currentTime()); <add> $this->cache->forever('illuminate:queue:restart', $this->currentTime()); <ide> <ide> $this->info('Broadcasting queue restart signal.'); <ide> } <ide><path>src/Illuminate/Queue/Console/WorkCommand.php <ide> use Illuminate\Queue\Events\JobFailed; <ide> use Illuminate\Queue\Events\JobProcessed; <ide> use Illuminate\Queue\Events\JobProcessing; <add>use Illuminate\Contracts\Cache\Repository as Cache; <ide> <ide> class WorkCommand extends Command <ide> { <ide> class WorkCommand extends Command <ide> */ <ide> protected $worker; <ide> <add> /** <add> * The cache store implementation. <add> * <add> * @var \Illuminate\Contracts\Cache\Repository <add> */ <add> protected $cache; <add> <ide> /** <ide> * Create a new queue work command. <ide> * <ide> * @param \Illuminate\Queue\Worker $worker <add> * @param \Illuminate\Contracts\Cache\Repository $cache <ide> * @return void <ide> */ <del> public function __construct(Worker $worker) <add> public function __construct(Worker $worker, Cache $cache) <ide> { <ide> parent::__construct(); <ide> <add> $this->cache = $cache; <ide> $this->worker = $worker; <ide> } <ide> <ide> public function handle() <ide> */ <ide> protected function runWorker($connection, $queue) <ide> { <del> $this->worker->setCache($this->laravel['cache.store']); <add> $this->worker->setCache($this->cache); <ide> <ide> return $this->worker->{$this->option('once') ? 'runNextJob' : 'daemon'}( <ide> $connection, $queue, $this->gatherWorkerOptions()
2
Ruby
Ruby
remove duplicated `columns` definition
fdc3e789b5dada526f530969308e24874b9b1986
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb <ide> def index_exists?(table_name, column_name, options = {}) <ide> indexes(table_name).any? { |i| checks.all? { |check| check[i] } } <ide> end <ide> <del> # Returns an array of Column objects for the table specified by +table_name+. <del> # See the concrete implementation for details on the expected parameter values. <add> # Returns an array of +Column+ objects for the table specified by +table_name+. <ide> def columns(table_name) <del> raise NotImplementedError, "#columns is not implemented" <add> table_name = table_name.to_s <add> column_definitions(table_name).map do |field| <add> new_column_from_field(table_name, field) <add> end <ide> end <ide> <ide> # Checks to see if a column exists in a given table. <ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb <ide> def schema_creation <ide> SchemaCreation.new self <ide> end <ide> <del> # Returns an array of +Column+ objects for the table specified by +table_name+. <del> def columns(table_name) # :nodoc: <del> table_name = table_name.to_s <del> column_definitions(table_name).map do |field| <del> new_column_from_field(table_name, field) <del> end <del> end <del> <ide> # this method must only be called while holding connection pool's mutex <ide> def lease <ide> if in_use?
2
Go
Go
fix a comment typo
0050efcd8f82144ea7f6c74f9bc9af357743370d
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) CmdLogin(args ...string) error { <ide> } else { <ide> // However, if they don't override the username use the <ide> // password or email from the cmd line if specified. IOW, allow <del> // then to change/overide them. And if not specified, just <add> // then to change/override them. And if not specified, just <ide> // use what's in the config file <ide> if password == "" { <ide> password = authconfig.Password
1
Javascript
Javascript
add statistics report to resolvercacheplugin
0750da4dc37bd870c50d73d344b89802cbfa8491
<ide><path>lib/cache/ResolverCachePlugin.js <ide> class ResolverCachePlugin { <ide> const cache = compiler.cache; <ide> /** @type {FileSystemInfo} */ <ide> let fileSystemInfo; <add> let realResolves = 0; <add> let cachedResolves = 0; <add> let cacheInvalidResolves = 0; <ide> compiler.hooks.thisCompilation.tap("ResolverCachePlugin", compilation => { <ide> fileSystemInfo = compilation.fileSystemInfo; <add> compilation.hooks.finishModules.tap("ResolverCachePlugin", () => { <add> const logger = compilation.getLogger("webpack.ResolverCachePlugin"); <add> logger.debug( <add> `${Math.round( <add> (100 * realResolves) / (realResolves + cachedResolves) <add> )}% really resolved (${realResolves} real resolves, ${cachedResolves} cached, ${cacheInvalidResolves} cached but invalid)` <add> ); <add> realResolves = 0; <add> cachedResolves = 0; <add> cacheInvalidResolves = 0; <add> }); <ide> }); <ide> /** <ide> * @param {string} identifier cache key <ide> class ResolverCachePlugin { <ide> request, <ide> callback <ide> ) => { <add> realResolves++; <ide> const newRequest = { <ide> _ResolverCachePluginCacheMiss: true, <ide> ...request <ide> class ResolverCachePlugin { <ide> cacheEntry.snapshot, <ide> (err, valid) => { <ide> if (err || !valid) { <add> cacheInvalidResolves++; <ide> return doRealResolve( <ide> identifier, <ide> type, <ide> class ResolverCachePlugin { <ide> callback <ide> ); <ide> } <add> cachedResolves++; <ide> if (resolveContext.missingDependencies) { <ide> for (const item of cacheEntry.missingDependencies) { <ide> resolveContext.missingDependencies.add(item);
1
Javascript
Javascript
display infinity symbol when number is infinity
51d6774286202b55ade402ca097e417e70fd546b
<ide><path>src/ng/filter/filters.js <ide> function currencyFilter($locale) { <ide> * <ide> * If the input is not a number an empty string is returned. <ide> * <add> * If the input is an infinite (Infinity/-Infinity) the Infinity symbol '∞' is returned. <add> * <ide> * @param {number|string} number Number to format. <ide> * @param {(number|string)=} fractionSize Number of decimal places to round the number to. <ide> * If this is not provided then the fraction size is computed from the current locale's number <ide> function numberFilter($locale) { <ide> <ide> var DECIMAL_SEP = '.'; <ide> function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { <del> if (!isFinite(number) || isObject(number)) return ''; <add> if (isObject(number)) return ''; <ide> <ide> var isNegative = number < 0; <ide> number = Math.abs(number); <add> <add> var isInfinity = number === Infinity; <add> if (!isInfinity && !isFinite(number)) return ''; <add> <ide> var numStr = number + '', <ide> formatedText = '', <add> hasExponent = false, <ide> parts = []; <ide> <del> var hasExponent = false; <del> if (numStr.indexOf('e') !== -1) { <add> if (isInfinity) formatedText = '\u221e'; <add> <add> if (!isInfinity && numStr.indexOf('e') !== -1) { <ide> var match = numStr.match(/([\d\.]+)e(-?)(\d+)/); <ide> if (match && match[2] == '-' && match[3] > fractionSize + 1) { <ide> number = 0; <ide> function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { <ide> } <ide> } <ide> <del> if (!hasExponent) { <add> if (!isInfinity && !hasExponent) { <ide> var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length; <ide> <ide> // determine fractionSize if it is not specified <ide><path>test/ng/filter/filtersSpec.js <ide> describe('filters', function() { <ide> expect(number(Number.NaN)).toEqual(''); <ide> expect(number({})).toEqual(''); <ide> expect(number([])).toEqual(''); <del> expect(number(+Infinity)).toEqual(''); <del> expect(number(-Infinity)).toEqual(''); <add> expect(number(+Infinity)).toEqual('∞'); <add> expect(number(-Infinity)).toEqual('-∞'); <ide> expect(number("1234.5678")).toEqual('1,234.568'); <del> expect(number(1 / 0)).toEqual(""); <add> expect(number(1 / 0)).toEqual('∞'); <ide> expect(number(1, 2)).toEqual("1.00"); <ide> expect(number(.1, 2)).toEqual("0.10"); <ide> expect(number(.01, 2)).toEqual("0.01");
2
Java
Java
add concurrent test and fix potential npe
0b43e4e4f2ae8d59bcfb16b8d88c6a0c3a7b7ace
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java <ide> <ide> package org.springframework.messaging.simp.broker; <ide> <del>import static org.springframework.messaging.support.MessageHeaderAccessor.getAccessor; <del> <ide> import java.util.Collection; <ide> import java.util.HashSet; <ide> import java.util.LinkedHashMap; <ide> import org.springframework.util.MultiValueMap; <ide> import org.springframework.util.PathMatcher; <ide> <add>import static org.springframework.messaging.support.MessageHeaderAccessor.getAccessor; <add> <ide> <ide> /** <ide> * Implementation of {@link SubscriptionRegistry} that stores subscriptions <ide> private MultiValueMap<String, String> filterSubscriptions(MultiValueMap<String, <ide> for (String sessionId : allMatches.keySet()) { <ide> for (String subId : allMatches.get(sessionId)) { <ide> SessionSubscriptionInfo info = this.subscriptionRegistry.getSubscriptions(sessionId); <add> if (info == null) { <add> continue; <add> } <ide> Subscription sub = info.getSubscription(subId); <add> if (sub == null) { <add> continue; <add> } <ide> Expression expression = sub.getSelectorExpression(); <ide> if (expression == null) { <ide> result.add(sessionId, subId); <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistryTests.java <ide> import java.util.Collections; <ide> import java.util.Iterator; <ide> import java.util.List; <add>import java.util.concurrent.CountDownLatch; <add>import java.util.concurrent.TimeUnit; <add>import java.util.concurrent.atomic.AtomicReference; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> import org.springframework.messaging.simp.SimpMessageHeaderAccessor; <ide> import org.springframework.messaging.simp.SimpMessageType; <ide> import org.springframework.messaging.support.MessageBuilder; <add>import org.springframework.util.AntPathMatcher; <ide> import org.springframework.util.MultiValueMap; <add>import org.springframework.util.PathMatcher; <ide> <ide> import static org.junit.Assert.assertEquals; <ide> import static org.junit.Assert.assertNotNull; <add>import static org.junit.Assert.assertTrue; <ide> <ide> <ide> /** <ide> public void findSubscriptionsReturnsMapSafeToIterate() throws Exception { <ide> // no ConcurrentModificationException <ide> } <ide> <add> @Test <add> public void findSubscriptionsWithConcurrentUnregisterAllSubscriptions() throws Exception { <add> <add> final CountDownLatch iterationPausedLatch = new CountDownLatch(1); <add> final CountDownLatch iterationResumeLatch = new CountDownLatch(1); <add> final CountDownLatch iterationDoneLatch = new CountDownLatch(1); <add> <add> PathMatcher pathMatcher = new PausingPathMatcher(iterationPausedLatch, iterationResumeLatch); <add> this.registry.setPathMatcher(pathMatcher); <add> this.registry.registerSubscription(subscribeMessage("sess1", "1", "/foo")); <add> this.registry.registerSubscription(subscribeMessage("sess2", "1", "/foo")); <add> <add> AtomicReference<MultiValueMap<String, String>> subscriptions = new AtomicReference<>(); <add> new Thread(() -> { <add> subscriptions.set(registry.findSubscriptions(createMessage("/foo"))); <add> iterationDoneLatch.countDown(); <add> }).start(); <add> <add> assertTrue(iterationPausedLatch.await(10, TimeUnit.SECONDS)); <add> <add> this.registry.unregisterAllSubscriptions("sess1"); <add> this.registry.unregisterAllSubscriptions("sess2"); <add> <add> iterationResumeLatch.countDown(); <add> assertTrue(iterationDoneLatch.await(10, TimeUnit.SECONDS)); <add> <add> MultiValueMap<String, String> result = subscriptions.get(); <add> assertNotNull(result); <add> assertEquals(0, result.size()); <add> } <add> <add> <ide> private Message<?> createMessage(String destination) { <ide> SimpMessageHeaderAccessor accessor = SimpMessageHeaderAccessor.create(); <ide> accessor.setDestination(destination); <ide> private List<String> sort(List<String> list) { <ide> return list; <ide> } <ide> <add> /** <add> * An extension of AntPathMatcher with a pair of CountDownLatch's to pause <add> * while matching, allowing another thread to something, and resume when the <add> * other thread signals it's okay to do so. <add> */ <add> private static class PausingPathMatcher extends AntPathMatcher { <add> <add> private final CountDownLatch iterationPausedLatch; <add> <add> private final CountDownLatch iterationResumeLatch; <add> <add> <add> public PausingPathMatcher(CountDownLatch iterationPausedLatch, CountDownLatch iterationResumeLatch) { <add> this.iterationPausedLatch = iterationPausedLatch; <add> this.iterationResumeLatch = iterationResumeLatch; <add> } <add> <add> @Override <add> public boolean match(String pattern, String path) { <add> try { <add> this.iterationPausedLatch.countDown(); <add> assertTrue(this.iterationResumeLatch.await(10, TimeUnit.SECONDS)); <add> return super.match(pattern, path); <add> } <add> catch (InterruptedException ex) { <add> ex.printStackTrace(); <add> return false; <add> } <add> } <add> } <ide> }
2
Python
Python
add validation per epoch
e17e64bb03b49754b5f843adc1e6aa82419418b3
<ide><path>official/resnet/keras/keras_cifar_main.py <ide> def run_cifar_with_keras(flags_obj): <ide> lr_callback, <ide> tesorboard_callback <ide> ], <add> validation_steps=num_eval_steps, <add> validation_data=eval_input_dataset, <ide> verbose=1) <ide> <ide> eval_output = model.evaluate(eval_input_dataset,
1
Javascript
Javascript
add transformproptypes to docs
b8ca4e450b2fdff5eed68dbb3e1b4ca00b7d4a9c
<ide><path>website/layout/AutodocsLayout.js <ide> var ComponentDoc = React.createClass({ <ide> <div className="compactProps"> <ide> {(style.composes || []).map((name) => { <ide> var link; <del> if (name !== 'LayoutPropTypes') { <del> name = name.replace('StylePropTypes', ''); <del> link = <del> <a href={slugify(name) + '.html#style'}>{name}#style...</a>; <del> } else { <add> if (name === 'LayoutPropTypes') { <ide> name = 'Flexbox'; <ide> link = <ide> <a href={slugify(name) + '.html#proptypes'}>{name}...</a>; <add> } else if (name === 'TransformPropTypes') { <add> name = 'Transforms'; <add> link = <add> <a href={slugify(name) + '.html#proptypes'}>{name}...</a>; <add> } else { <add> name = name.replace('StylePropTypes', ''); <add> link = <add> <a href={slugify(name) + '.html#style'}>{name}#style...</a>; <ide> } <ide> return ( <ide> <div className="prop" key={name}> <ide><path>website/server/extractDocs.js <ide> function getNameFromPath(filepath) { <ide> while (ext = path.extname(filepath)) { <ide> filepath = path.basename(filepath, ext); <ide> } <add> <ide> if (filepath === 'LayoutPropTypes') { <ide> return 'Flexbox'; <del> } else if (filepath == 'TabBarItemIOS') { <add> } else if (filepath === 'TransformPropTypes') { <add> return 'Transforms'; <add> } else if (filepath === 'TabBarItemIOS') { <ide> return 'TabBarIOS.Item'; <ide> } <ide> return filepath; <ide> var apis = [ <ide> <ide> var styles = [ <ide> '../Libraries/StyleSheet/LayoutPropTypes.js', <add> '../Libraries/StyleSheet/TransformPropTypes.js', <ide> '../Libraries/Components/View/ViewStylePropTypes.js', <ide> '../Libraries/Text/TextStylePropTypes.js', <ide> '../Libraries/Image/ImageStylePropTypes.js', <ide> var polyfills = [ <ide> <ide> var all = components <ide> .concat(apis) <del> .concat(styles.slice(0, 1)) <add> .concat(styles.slice(0, 2)) <ide> .concat(polyfills); <ide> <del>var styleDocs = styles.slice(1).reduce(function(docs, filepath) { <add>var styleDocs = styles.slice(2).reduce(function(docs, filepath) { <ide> docs[path.basename(filepath).replace(path.extname(filepath), '')] = <ide> docgen.parse( <ide> fs.readFileSync(filepath), <ide> var styleDocs = styles.slice(1).reduce(function(docs, filepath) { <ide> ); <ide> <ide> // Remove deprecated style props <del> if (docs['ViewStylePropTypes']) { <add> if (docs['TransformPropTypes']) { <ide> ['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) { <del> delete docs['ViewStylePropTypes']['props'][key]; <add> delete docs['TransformPropTypes']['props'][key]; <ide> }); <ide> } <ide> <ide> module.exports = function() { <ide> return [].concat( <ide> components.map(renderComponent), <ide> apis.map(renderAPI('api')), <del> styles.slice(0, 1).map(renderStyle), <add> styles.slice(0, 2).map(renderStyle), <ide> polyfills.map(renderAPI('Polyfill')) <ide> ); <ide> };
2
Javascript
Javascript
fix linter error in whatwg-url-parsing
5acfbb0f252fdf70d8ac3d94f11d534c46772929
<ide><path>test/parallel/test-whatwg-url-parsing.js <ide> for (const test of tests) { <ide> } <ide> <ide> for (const test of allTests) { <del> const url = test.url <del> ? new URL(test.url) <del> : new URL(test.input, test.base); <add> const url = test.url ? new URL(test.url) : new URL(test.input, test.base); <ide> <ide> for (const showHidden of [true, false]) { <ide> const res = url.inspect(null, {
1