content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
improve test without using anonymous classes
e7f4c45bdc178c41face92e4be9ec027a07daeda
<ide><path>activerecord/test/cases/autosave_association_test.rb <ide> def test_replace_on_new_object <ide> assert_equal 2, firm.clients.length <ide> assert_includes firm.clients, Client.find_by_name("New Client") <ide> end <del> <del> def test_inverse_association_within_autosave_after_save_callback <del> posts = Class.new(ActiveRecord::Base) do <del> self.table_name = "posts" <del> end <del> comments = Class.new(ActiveRecord::Base) do <del> self.table_name = "comments" <del> end <del> posts.class_eval do <del> has_many :comments, inverse_of: :post, foreign_key: :post_id, anonymous_class: comments <del> end <del> comments.class_eval do <del> belongs_to :post, inverse_of: :comments, anonymous_class: posts <del> <del> attr_accessor :post_comments_count <del> after_save do <del> self.post_comments_count = post.comments.count <del> end <del> end <del> <del> post = posts.new(title: "Test", body: "...") <del> comment = post.comments.build(body: "...") <del> post.save! <del> <del> assert_equal 1, post.comments.count <del> assert_equal 1, comment.post_comments_count <del> end <ide> end <ide> <ide> class TestDefaultAutosaveAssociationOnNewRecord < ActiveRecord::TestCase <ide> def test_autosave_with_touch_should_not_raise_system_stack_error <ide> assert_nothing_raised { invoice.line_items.create(amount: 10) } <ide> end <ide> end <add> <add>class TestAutosaveAssociationOnAHasManyAssociationWithInverse < ActiveRecord::TestCase <add> class Post < ActiveRecord::Base <add> has_many :comments, inverse_of: :post <add> end <add> <add> class Comment < ActiveRecord::Base <add> belongs_to :post, inverse_of: :comments <add> <add> attr_accessor :post_comments_count <add> after_save do <add> self.post_comments_count = post.comments.count <add> end <add> end <add> <add> def test_after_save_callback_with_autosave <add> post = Post.new(title: "Test", body: "...") <add> comment = post.comments.build(body: "...") <add> post.save! <add> <add> assert_equal 1, post.comments.count <add> assert_equal 1, comment.post_comments_count <add> end <add>end
1
Javascript
Javascript
fix lint error
397d427568ab5b5166542315dd557b0cdbf4891a
<ide><path>spec/text-editor-spec.js <ide> describe('TextEditor', () => { <ide> <ide> { <ide> editor.setText(' test') <del> selection.setBufferRange([[0, 4], [0,4]]) <add> selection.setBufferRange([[0, 4], [0, 4]]) <ide> selection.toggleLineComments() <ide> <ide> const range = selection.getBufferRange()
1
Go
Go
ignore mtime changes on directories
2ce37f6616762900aa941c0644dece9cdbf90124
<ide><path>pkg/archive/changes.go <ide> func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) { <ide> oldStat.Gid() != newStat.Gid() || <ide> oldStat.Rdev() != newStat.Rdev() || <ide> // Don't look at size for dirs, its not a good measure of change <del> (oldStat.Size() != newStat.Size() && oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR) || <del> !sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || <add> (oldStat.Mode()&syscall.S_IFDIR != syscall.S_IFDIR && <add> (!sameFsTimeSpec(oldStat.Mtim(), newStat.Mtim()) || (oldStat.Size() != newStat.Size()))) || <ide> bytes.Compare(oldChild.capability, newChild.capability) != 0 { <ide> change := Change{ <ide> Path: newChild.path(), <ide><path>pkg/archive/changes_test.go <ide> func TestChangesDirsMutated(t *testing.T) { <ide> expectedChanges := []Change{ <ide> {"/dir1", ChangeDelete}, <ide> {"/dir2", ChangeModify}, <del> {"/dir3", ChangeModify}, <ide> {"/dirnew", ChangeAdd}, <ide> {"/file1", ChangeDelete}, <ide> {"/file2", ChangeModify},
2
Ruby
Ruby
remove dead code
ed5b076ff6b5e187db849728df313876c1e7fa39
<ide><path>activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb <ide> def pp(result) # :nodoc: <ide> end <ide> <ide> def exec_query(sql, name = nil, binds = []) <del> #if @prepared_statements && name != 'EXPLAIN' <del> # unless sql.count('?') == binds.length <del> # str = "binds.length => #{binds.length} sql.count => #{sql.count('?')}\n" \ <del> # "#{sql}" <del> # raise str <del> # end <del> #end <ide> type_casted_binds = binds.map { |col, val| <ide> [col, type_cast(val, col)] <ide> } <ide><path>activerecord/lib/active_record/statement_cache.rb <ide> def initialize(bind_values) <ide> @value_map = {} <ide> @bind_values = bind_values <ide> <del> bind_values.each_with_index do |(column, value), i| <add> bind_values.each_with_index do |(_, value), i| <ide> if Substitute === value <ide> @value_map[value.name] = i <ide> end
2
Text
Text
fix wrong imports in docs (about-keras-models)
54a6133bb2079f28daac911ba2aeee71bb013e92
<ide><path>docs/templates/models/about-keras-models.md <ide> model = Sequential.from_config(config) <ide> - `model.set_weights(weights)`: sets the values of the weights of the model, from a list of Numpy arrays. The arrays in the list should have the same shape as those returned by `get_weights()`. <ide> - `model.to_json()`: returns a representation of the model as a JSON string. Note that the representation does not include the weights, only the architecture. You can reinstantiate the same model (with reinitialized weights) from the JSON string via: <ide> ```python <del>from models import model_from_json <add>from keras.models import model_from_json <ide> <ide> json_string = model.to_json() <ide> model = model_from_json(json_string) <ide> ``` <ide> - `model.to_yaml()`: returns a representation of the model as a YAML string. Note that the representation does not include the weights, only the architecture. You can reinstantiate the same model (with reinitialized weights) from the YAML string via: <ide> ```python <del>from models import model_from_yaml <add>from keras.models import model_from_yaml <ide> <ide> yaml_string = model.to_yaml() <ide> model = model_from_yaml(yaml_string)
1
Javascript
Javascript
remove unused args
9134f5ce5a402bb76ba9bc5627ade282552898fe
<ide><path>test/directive/ngIncludeSpec.js <ide> describe('ng-include', function() { <ide> <ide> <ide> it('should include on external file', inject(putIntoCache('myUrl', '{{name}}'), <del> function($rootScope, $compile, $browser) { <add> function($rootScope, $compile) { <ide> element = jqLite('<ng:include src="url" scope="childScope"></ng:include>'); <ide> jqLite(document.body).append(element); <ide> element = $compile(element)($rootScope); <ide> describe('ng-include', function() { <ide> <ide> <ide> it('should allow this for scope', inject(putIntoCache('myUrl', '{{"abc"}}'), <del> function($rootScope, $compile, $browser) { <add> function($rootScope, $compile) { <ide> element = jqLite('<ng:include src="url" scope="this"></ng:include>'); <ide> element = $compile(element)($rootScope); <ide> $rootScope.url = 'myUrl'; <ide> describe('ng-include', function() { <ide> <ide> it('should evaluate onload expression when a partial is loaded', inject( <ide> putIntoCache('myUrl', 'my partial'), <del> function($rootScope, $compile, $browser) { <add> function($rootScope, $compile) { <ide> element = jqLite('<ng:include src="url" onload="loaded = true"></ng:include>'); <ide> element = $compile(element)($rootScope); <ide> <ide> describe('ng-include', function() { <ide> <ide> <ide> it('should destroy old scope', inject(putIntoCache('myUrl', 'my partial'), <del> function($rootScope, $compile, $browser) { <add> function($rootScope, $compile) { <ide> element = jqLite('<ng:include src="url"></ng:include>'); <ide> element = $compile(element)($rootScope); <ide> <ide> describe('ng-include', function() { <ide> <ide> <ide> it('should do xhr request and cache it', <del> inject(function($rootScope, $httpBackend, $compile, $browser) { <add> inject(function($rootScope, $httpBackend, $compile) { <ide> element = $compile('<ng:include src="url"></ng:include>')($rootScope); <ide> $httpBackend.expect('GET', 'myUrl').respond('my partial'); <ide> <ide> describe('ng-include', function() { <ide> <ide> it('should be async even if served from cache', inject( <ide> putIntoCache('myUrl', 'my partial'), <del> function($rootScope, $compile, $browser) { <add> function($rootScope, $compile) { <ide> element = $compile('<ng:include src="url"></ng:include>')($rootScope); <ide> <ide> $rootScope.url = 'myUrl';
1
Text
Text
fix typo on text geometry primitive
1c210f21e38aee732f8a5187e4239ed9127b027a
<ide><path>threejs/lessons/threejs-primitives.md <ide> parameters so you can use more or less depending on your needs. <ide> <div id="Diagram-DodecahedronGeometry" data-primitive="DodecahedronGeometry">A dodecahedron (12 sides)</div> <ide> <div id="Diagram-ExtrudeGeometry" data-primitive="ExtrudeGeometry">An extruded 2d shape with optional bevelling. <ide> Here we are extruding a heart shape. Note this is the basis <del>for <code>TextGeometry</code> and <code>TextGeometry</code> respectively.</div> <add>for <code>TextGeometry</code>.</div> <ide> <div id="Diagram-IcosahedronGeometry" data-primitive="IcosahedronGeometry">An icosahedron (20 sides)</div> <ide> <div id="Diagram-LatheGeometry" data-primitive="LatheGeometry">A shape generated by spinning a line. Examples would be: lamps, bowling pins, candles, candle holders, wine glasses, drinking glasses, etc... You provide the 2d silhouette as series of points and then tell three.js how many subdivisions to make as it spins the silhouette around an axis.</div> <ide> <div id="Diagram-OctahedronGeometry" data-primitive="OctahedronGeometry">An Octahedron (8 sides)</div>
1
PHP
PHP
remove a mock where we can use arraycache
2a7a5e9f5ec8f394c22315ad16a8615cfb807223
<ide><path>tests/TestCase/Datasource/QueryCacherTest.php <ide> class QueryCacherTest extends TestCase <ide> public function setUp(): void <ide> { <ide> parent::setUp(); <del> $this->engine = $this->getMockBuilder('Cake\Cache\CacheEngine')->getMock(); <del> $this->engine->expects($this->any()) <del> ->method('init') <del> ->will($this->returnValue(true)); <del> <del> Cache::setConfig('queryCache', $this->engine); <add> Cache::setConfig('queryCache', ['className' => 'Array']); <add> $this->engine = Cache::engine('queryCache'); <ide> Cache::enable(); <ide> } <ide> <ide> public function tearDown(): void <ide> */ <ide> public function testFetchFunctionKey() <ide> { <del> $this->_mockRead('my_key', 'A winner'); <add> $this->engine->set('my_key', 'A winner'); <ide> $query = new stdClass(); <ide> <ide> $cacher = new QueryCacher(function ($q) use ($query) { <ide> public function testFetchFunctionKeyNoString() <ide> { <ide> $this->expectException(\RuntimeException::class); <ide> $this->expectExceptionMessage('Cache key functions must return a string. Got false.'); <del> $this->_mockRead('my_key', 'A winner'); <add> $this->engine->set('my_key', 'A winner'); <ide> $query = new stdClass(); <ide> <ide> $cacher = new QueryCacher(function ($q) { <ide> public function testFetchFunctionKeyNoString() <ide> */ <ide> public function testFetchCacheHitStringEngine() <ide> { <del> $this->_mockRead('my_key', 'A winner'); <add> $this->engine->set('my_key', 'A winner'); <ide> $cacher = new QueryCacher('my_key', 'queryCache'); <ide> $query = new stdClass(); <ide> $result = $cacher->fetch($query); <ide> public function testFetchCacheHitStringEngine() <ide> */ <ide> public function testFetchCacheHit() <ide> { <del> $this->_mockRead('my_key', 'A winner'); <add> $this->engine->set('my_key', 'A winner'); <ide> $cacher = new QueryCacher('my_key', $this->engine); <ide> $query = new stdClass(); <ide> $result = $cacher->fetch($query); <ide> public function testFetchCacheHit() <ide> */ <ide> public function testFetchCacheMiss() <ide> { <del> $this->_mockRead('my_key', false); <add> $this->engine->set('my_key', false); <ide> $cacher = new QueryCacher('my_key', $this->engine); <ide> $query = new stdClass(); <ide> $result = $cacher->fetch($query); <ide> $this->assertNull($result, 'Cache miss should not have an isset() return.'); <ide> } <del> <del> /** <del> * Helper for building mocks. <del> */ <del> protected function _mockRead($key, $value = false) <del> { <del> $this->engine->expects($this->any()) <del> ->method('get') <del> ->with($key) <del> ->will($this->returnValue($value)); <del> } <ide> }
1
Text
Text
remove skip-gems from 4-2 release notes
c1116e954c89428b2611e3a595e257e83c47a633
<ide><path>guides/source/4_2_release_notes.md <ide> Please refer to the [Changelog][railties] for detailed changes. <ide> <ide> ([Pull Request](https://github.com/rails/rails/pull/16129)) <ide> <del>* Introduced a `--skip-gems` option in the app generator to skip gems such as <del> `turbolinks` and `coffee-rails` that do not have their own specific flags. <del> ([Commit](https://github.com/rails/rails/commit/10565895805887d4faf004a6f71219da177f78b7)) <del> <ide> * Introduced a `bin/setup` script to enable automated setup code when <ide> bootstrapping an application. <ide> ([Pull Request](https://github.com/rails/rails/pull/15189))
1
Text
Text
amend documentation to language.evaluate
fb73d4943a91d18cd36ded98994a932515f4bf05
<ide><path>.github/contributors/laszabine.md <add># spaCy contributor agreement <add> <add>This spaCy Contributor Agreement (**"SCA"**) is based on the <add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf). <add>The SCA applies to any contribution that you make to any product or project <add>managed by us (the **"project"**), and sets out the intellectual property rights <add>you grant to us in the contributed materials. The term **"us"** shall mean <add>[ExplosionAI GmbH](https://explosion.ai/legal). The term <add>**"you"** shall mean the person or entity identified below. <add> <add>If you agree to be bound by these terms, fill in the information requested <add>below and include the filled-in version with your first pull request, under the <add>folder [`.github/contributors/`](/.github/contributors/). The name of the file <add>should be your GitHub username, with the extension `.md`. For example, the user <add>example_user would create the file `.github/contributors/example_user.md`. <add> <add>Read this agreement carefully before signing. These terms and conditions <add>constitute a binding legal agreement. <add> <add>## Contributor Agreement <add> <add>1. The term "contribution" or "contributed materials" means any source code, <add>object code, patch, tool, sample, graphic, specification, manual, <add>documentation, or any other material posted or submitted by you to the project. <add> <add>2. With respect to any worldwide copyrights, or copyright applications and <add>registrations, in your contribution: <add> <add> * you hereby assign to us joint ownership, and to the extent that such <add> assignment is or becomes invalid, ineffective or unenforceable, you hereby <add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge, <add> royalty-free, unrestricted license to exercise all rights under those <add> copyrights. This includes, at our option, the right to sublicense these same <add> rights to third parties through multiple levels of sublicensees or other <add> licensing arrangements; <add> <add> * you agree that each of us can do all things in relation to your <add> contribution as if each of us were the sole owners, and if one of us makes <add> a derivative work of your contribution, the one who makes the derivative <add> work (or has it made will be the sole owner of that derivative work; <add> <add> * you agree that you will not assert any moral rights in your contribution <add> against us, our licensees or transferees; <add> <add> * you agree that we may register a copyright in your contribution and <add> exercise all ownership rights associated with it; and <add> <add> * you agree that neither of us has any duty to consult with, obtain the <add> consent of, pay or render an accounting to the other for any use or <add> distribution of your contribution. <add> <add>3. With respect to any patents you own, or that you can license without payment <add>to any third party, you hereby grant to us a perpetual, irrevocable, <add>non-exclusive, worldwide, no-charge, royalty-free license to: <add> <add> * make, have made, use, sell, offer to sell, import, and otherwise transfer <add> your contribution in whole or in part, alone or in combination with or <add> included in any product, work or materials arising out of the project to <add> which your contribution was submitted, and <add> <add> * at our option, to sublicense these same rights to third parties through <add> multiple levels of sublicensees or other licensing arrangements. <add> <add>4. Except as set out above, you keep all right, title, and interest in your <add>contribution. The rights that you grant to us under these terms are effective <add>on the date you first submitted a contribution to us, even if your submission <add>took place before the date you sign these terms. <add> <add>5. You covenant, represent, warrant and agree that: <add> <add> * Each contribution that you submit is and shall be an original work of <add> authorship and you can legally grant the rights set out in this SCA; <add> <add> * to the best of your knowledge, each contribution will not violate any <add> third party's copyrights, trademarks, patents, or other intellectual <add> property rights; and <add> <add> * each contribution shall be in compliance with U.S. export control laws and <add> other applicable export and import laws. You agree to notify us if you <add> become aware of any circumstance which would make any of the foregoing <add> representations inaccurate in any respect. We may publicly disclose your <add> participation in the project, including the fact that you have signed the SCA. <add> <add>6. This SCA is governed by the laws of the State of California and applicable <add>U.S. Federal law. Any choice of law rules will not apply. <add> <add>7. Please place an “x” on one of the applicable statement below. Please do NOT <add>mark both statements: <add> <add> * [x] I am signing on behalf of myself as an individual and no other person <add> or entity, including my employer, has or will have rights with respect to my <add> contributions. <add> <add> * [ ] I am signing on behalf of my employer or a legal entity and I have the <add> actual authority to contractually bind that entity. <add> <add>## Contributor Details <add> <add>| Field | Entry | <add>|------------------------------- | -------------------- | <add>| Name | Sabine Laszakovits | <add>| Company name (if applicable) | Austrian Academy of Sciences | <add>| Title or role (if applicable) | Data analyst | <add>| Date | 2020-04-16 | <add>| GitHub username | laszabine | <add>| Website (optional) | https://sabine.laszakovits.net | <ide><path>website/docs/api/language.md <ide> Evaluate a model's pipeline components. <ide> <ide> | Name | Type | Description | <ide> | -------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `docs_golds` | iterable | Tuples of `Doc` and `GoldParse` objects or `(text, annotations)` of raw text and a dict (see [simple training style](/usage/training#training-simple-style)). | <add>| `docs_golds` | iterable | Tuples of `Doc` and `GoldParse` objects, such that the `Doc` objects contain the predictions and the `GoldParse` objects the correct annotations. Alternatively, `(text, annotations)` tuples of raw text and a dict (see [simple training style](/usage/training#training-simple-style)). | <ide> | `verbose` | bool | Print debugging information. | <ide> | `batch_size` | int | The batch size to use. | <ide> | `scorer` | `Scorer` | Optional [`Scorer`](/api/scorer) to use. If not passed in, a new one will be created. |
2
Go
Go
fix error message on version too low
0fd9b4067d5126a8059dc2821b835d3bde26e7eb
<ide><path>api/server/middleware.go <ide> func versionMiddleware(handler httputils.APIFunc) httputils.APIFunc { <ide> return errors.ErrorCodeNewerClientVersion.WithArgs(apiVersion, api.DefaultVersion) <ide> } <ide> if apiVersion.LessThan(api.MinVersion) { <del> return errors.ErrorCodeOldClientVersion.WithArgs(apiVersion, api.DefaultVersion) <add> return errors.ErrorCodeOldClientVersion.WithArgs(apiVersion, api.MinVersion) <ide> } <ide> <ide> w.Header().Set("Server", "Docker/"+dockerversion.Version+" ("+runtime.GOOS+")")
1
Go
Go
use beam.router to simplify 'logger'
63fd2ec0f7ec091912435cedc081b132e66ae658
<ide><path>pkg/beam/examples/beamsh/beamsh.go <ide> func Handlers() (*beam.UnixConn, error) { <ide> func GetHandler(name string) Handler { <ide> if name == "logger" { <ide> return func(args []string, in beam.Receiver, out beam.Sender) { <del> var tasks sync.WaitGroup <ide> stdout, err := beam.SendPipe(out, data.Empty().Set("cmd", "log", "stdout").Set("fromcmd", args...).Bytes()) <ide> if err != nil { <ide> return <ide> func GetHandler(name string) Handler { <ide> fmt.Fprintf(stderr, "%v\n", err) <ide> return <ide> } <add> var tasks sync.WaitGroup <add> defer tasks.Wait() <ide> var n int = 1 <del> for { <del> payload, attachment, err := in.Receive() <del> if err != nil { <del> return <del> } <del> if attachment == nil { <del> continue <del> } <del> w, err := beam.SendPipe(out, payload) <del> if err != nil { <del> fmt.Fprintf(stderr, "%v\n", err) <del> attachment.Close() <del> return <del> } <add> r := beam.NewRouter(out) <add> r.NewRoute().HasAttachment().KeyStartsWith("cmd", "log").Handler(func (payload []byte, attachment *os.File) error { <ide> tasks.Add(1) <del> go func(payload []byte, attachment *os.File, n int, sink *os.File) { <add> go func(n int) { <ide> defer tasks.Done() <ide> defer attachment.Close() <del> defer sink.Close() <del> cmd := data.Message(payload).Get("cmd") <del> if cmd == nil || len(cmd) == 0 { <del> return <del> } <del> if cmd[0] != "log" { <del> return <del> } <ide> var streamname string <del> if len(cmd) == 1 || cmd[1] == "stdout" { <add> if cmd := data.Message(payload).Get("cmd"); len(cmd) == 1 || cmd[1] == "stdout" { <ide> streamname = "stdout" <ide> } else { <ide> streamname = cmd[1] <ide> func GetHandler(name string) Handler { <ide> fmt.Fprintf(stderr, "%v\n", err) <ide> return <ide> } <del> io.Copy(io.MultiWriter(logfile, sink), attachment) <add> defer logfile.Close() <add> io.Copy(logfile, attachment) <ide> logfile.Sync() <del> logfile.Close() <del> }(payload, attachment, n, w) <add> }(n) <ide> n++ <add> return nil <add> }).Tee(out) <add> if _, err := beam.Copy(r, in); err != nil { <add> fmt.Fprintf(stderr, "%v\n", err) <add> return <ide> } <del> tasks.Wait() <ide> } <ide> } else if name == "render" { <ide> return func(args []string, in beam.Receiver, out beam.Sender) {
1
PHP
PHP
remove unused argument
e79911b04052c469704cb0f4cc5e2ea640955af3
<ide><path>src/Error/ExceptionRenderer.php <ide> class ExceptionRenderer { <ide> * @param \Exception $exception Exception <ide> */ <ide> public function __construct(\Exception $exception) { <del> $this->controller = $this->_getController($exception); <ide> $this->error = $exception; <add> $this->controller = $this->_getController(); <ide> } <ide> <ide> /** <ide> public function __construct(\Exception $exception) { <ide> * This method returns the built in `ErrorController` normally, or if an error is repeated <ide> * a bare controller will be used. <ide> * <del> * @param \Exception $exception The exception to get a controller for. <del> * @return Controller <add> * @return \Cake\Controller\Controller <ide> */ <del> protected function _getController($exception) { <add> protected function _getController() { <ide> if (!$request = Router::getRequest(true)) { <ide> $request = Request::createFromGlobals(); <ide> } <ide><path>tests/test_app/TestApp/Error/TestAppsExceptionRenderer.php <ide> <ide> class TestAppsExceptionRenderer extends ExceptionRenderer { <ide> <del> protected function _getController($exception) { <add>/** <add> * @inheritdoc <add> */ <add> protected function _getController() { <ide> if (!$request = Router::getRequest(true)) { <ide> $request = new Request(); <ide> }
2
Text
Text
remove extra "\" from description
2a3e344d13904bc901c0a80b57176cae27adc184
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/step-004.md <ide> dashedName: step-4 <ide> <ide> Commenting allows you to leave messages without affecting the browser display. It also allows you to make code inactive. A comment in HTML starts with `<!--`, contains any number of lines of text, and ends with `-->`. For example, the comment `<!-- TODO: Remove h1 -->` contains the text `TODO: Remove h1`. <ide> <del>Add a comment above the `p` element with the text `TODO: Add link to cat photos`. \\ <add>Add a comment above the `p` element with the text `TODO: Add link to cat photos`. <ide> <ide> # --hints-- <ide>
1
Text
Text
update the documentation
26db31e0c09a8b5e1ca7a61c454b159eab9d86be
<ide><path>examples/README.md <ide> In this section a few examples are put together. All of these examples work for several models, making use of the very <ide> similar API between the different models. <ide> <add>**Important** <add>To use the examples, execute the following steps in a new virtual environment: <add> <add>```bash <add>git clone git@github.com:huggingface/transformers <add>cd transformers <add>pip install . <add>``` <add> <ide> | Section | Description | <ide> |----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| <ide> | [TensorFlow 2.0 models on GLUE](#TensorFlow-2.0-Bert-models-on-GLUE) | Examples running BERT TensorFlow 2.0 model on the GLUE tasks.
1
PHP
PHP
add missing option
828e105f48b624fe33d9659afc9de5ff863dadb0
<ide><path>src/View/Helper/FormHelper.php <ide> public function meridian($fieldName, $options = array()) { <ide> * matching the field name will override this value. If no default is provided `time()` will be used. <ide> * - `timeFormat` The time format to use, either 12 or 24. <ide> * - `second` Set to true to enable seconds drop down. <add> * - `orderYear` The order you want year optiosn to be generated. <ide> * <ide> * To control the order of inputs, and any elements/content between the inputs you <ide> * can override the `dateWidget` template. By default the `dateWidget` template is:
1
Ruby
Ruby
consolidate passes through path ast
6a2adeb39472253fa0e45115d0078944035fb6f6
<ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> def initialize(set:, ast:, controller:, default_action:, to:, formatted:, via:, <ide> @internal = options.delete(:internal) <ide> @scope_options = scope_params[:options] <ide> <del> path_params = ast.find_all(&:symbol?).map(&:to_sym) <add> path_params = [] <add> wildcard_options = {} <add> ast.each do |node| <add> if node.symbol? <add> path_params << node.to_sym <add> elsif formatted != false && node.star? <add> # Add a constraint for wildcard route to make it non-greedy and match the <add> # optional format part of the route by default. <add> wildcard_options[node.name.to_sym] ||= /.+?/ <add> end <add> end <ide> <del> options = add_wildcard_options(options, formatted, ast) <add> options = wildcard_options.merge!(options) <ide> <ide> options = normalize_options!(options, path_params, scope_params[:module]) <ide> <ide> def intern(object) <ide> object.is_a?(String) ? -object : object <ide> end <ide> <del> def add_wildcard_options(options, formatted, path_ast) <del> # Add a constraint for wildcard route to make it non-greedy and match the <del> # optional format part of the route by default. <del> if formatted != false <del> path_ast.grep(Journey::Nodes::Star).each_with_object({}) { |node, hash| <del> hash[node.name.to_sym] ||= /.+?/ <del> }.merge options <del> else <del> options <del> end <del> end <del> <ide> def normalize_options!(options, path_params, modyoule) <ide> if path_params.include?(:controller) <ide> raise ArgumentError, ":controller segment is not allowed within a namespace block" if modyoule
1
Ruby
Ruby
allow write access to cellars in repository
58d998e20826a9d7b319b9677c91391240e22297
<ide><path>Library/Homebrew/cmd/postinstall.rb <ide> def run_post_install(formula) <ide> sandbox.record_log(formula.logs/"postinstall.sandbox.log") <ide> sandbox.allow_write_temp_and_cache <ide> sandbox.allow_write_log(formula) <del> sandbox.allow_write_cellar(formula) <ide> sandbox.allow_write_xcode <del> sandbox.allow_write_path HOMEBREW_PREFIX <ide> sandbox.deny_write_homebrew_repository <add> sandbox.allow_write_path HOMEBREW_PREFIX <add> sandbox.allow_write_cellar(formula) <ide> sandbox.exec(*args) <ide> else <ide> exec(*args)
1
Text
Text
fix example in faq
d49baf1bfb303e56d29d48847342b2bbfd7ce207
<ide><path>docs/templates/faq.md <ide> layer_output = get_3rd_layer_output(X) <ide> <ide> # with a Graph model <ide> get_conv_layer_output = theano.function([model.inputs[i].input for i in model.input_order], <del> model.outputs['conv'].get_output(train=False), <add> model.nodes['conv'].get_output(train=False), <ide> on_unused_input='ignore') <del>conv_output = get_conv_output(input_data_dict) <add>conv_output = get_conv_layer_output([input_data_dict[i] for i in model.input_order]) <ide> ``` <ide> <ide> ---
1
Javascript
Javascript
replace master/slave with leader/follower
3651e42e49ded7d410fd1cbd46f717056000afd4
<ide><path>src/Angular.js <ide> function arrayRemove(array, value) { <ide> <button ng-click="update(user)">SAVE</button> <ide> </form> <ide> <pre>form = {{user | json}}</pre> <del> <pre>master = {{master | json}}</pre> <add> <pre>leader = {{leader | json}}</pre> <ide> </div> <ide> </file> <ide> <file name="script.js"> <ide> // Module: copyExample <ide> angular. <ide> module('copyExample', []). <ide> controller('ExampleController', ['$scope', function($scope) { <del> $scope.master = {}; <add> $scope.leader = {}; <ide> <ide> $scope.reset = function() { <ide> // Example with 1 argument <del> $scope.user = angular.copy($scope.master); <add> $scope.user = angular.copy($scope.leader); <ide> }; <ide> <ide> $scope.update = function(user) { <ide> // Example with 2 arguments <del> angular.copy(user, $scope.master); <add> angular.copy(user, $scope.leader); <ide> }; <ide> <ide> $scope.reset(); <ide><path>src/ng/directive/attrs.js <ide> * @example <ide> <example name="ng-checked"> <ide> <file name="index.html"> <del> <label>Check me to check both: <input type="checkbox" ng-model="master"></label><br/> <del> <input id="checkSlave" type="checkbox" ng-checked="master" aria-label="Slave input"> <add> <label>Check me to check both: <input type="checkbox" ng-model="leader"></label><br/> <add> <input id="checkFollower" type="checkbox" ng-checked="leader" aria-label="Follower input"> <ide> </file> <ide> <file name="protractor.js" type="protractor"> <ide> it('should check both checkBoxes', function() { <del> expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy(); <del> element(by.model('master')).click(); <del> expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy(); <add> expect(element(by.id('checkFollower')).getAttribute('checked')).toBeFalsy(); <add> element(by.model('leader')).click(); <add> expect(element(by.id('checkFollower')).getAttribute('checked')).toBeTruthy(); <ide> }); <ide> </file> <ide> </example> <ide><path>test/jqLiteSpec.js <ide> describe('jqLite', function() { <ide> <ide> it('should deregister specific listener for multiple types separated by spaces', function() { <ide> var aElem = jqLite(a), <del> masterSpy = jasmine.createSpy('master'), <add> leaderSpy = jasmine.createSpy('leader'), <ide> extraSpy = jasmine.createSpy('extra'); <ide> <del> aElem.on('click', masterSpy); <add> aElem.on('click', leaderSpy); <ide> aElem.on('click', extraSpy); <del> aElem.on('mouseover', masterSpy); <add> aElem.on('mouseover', leaderSpy); <ide> <ide> browserTrigger(a, 'click'); <ide> browserTrigger(a, 'mouseover'); <del> expect(masterSpy).toHaveBeenCalledTimes(2); <add> expect(leaderSpy).toHaveBeenCalledTimes(2); <ide> expect(extraSpy).toHaveBeenCalledOnce(); <ide> <del> masterSpy.calls.reset(); <add> leaderSpy.calls.reset(); <ide> extraSpy.calls.reset(); <ide> <del> aElem.off('click mouseover', masterSpy); <add> aElem.off('click mouseover', leaderSpy); <ide> <ide> browserTrigger(a, 'click'); <ide> browserTrigger(a, 'mouseover'); <del> expect(masterSpy).not.toHaveBeenCalled(); <add> expect(leaderSpy).not.toHaveBeenCalled(); <ide> expect(extraSpy).toHaveBeenCalledOnce(); <ide> }); <ide>
3
Javascript
Javascript
use correct index when resolving bubble options
53f503825219e4a8ff78be16b858a0e969f9b435
<ide><path>src/controllers/controller.bubble.js <ide> export default class BubbleController extends DatasetController { <ide> }; <ide> <ide> if (includeOptions) { <del> properties.options = me.resolveDataElementOptions(i, mode); <add> properties.options = me.resolveDataElementOptions(index, mode); <ide> <ide> if (reset) { <ide> properties.options.radius = 0;
1
Javascript
Javascript
catch undefined filename
d41afdc45af4853eceaeb6ccb7a3cfd561e475bf
<ide><path>examples/js/loaders/FBXLoader.js <ide> <ide> var fileName; <ide> <add> var currentPath = loader.path; <add> <ide> var children = connections.get( textureNode.id ).children; <ide> <ide> if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { <ide> <ide> fileName = images[ children[ 0 ].ID ]; <ide> <del> } <del> <del> var currentPath = loader.path; <add> if ( fileName.indexOf( 'blob:' ) === 0 || fileName.indexOf( 'data:' ) === 0 ) { <ide> <del> if ( fileName.indexOf( 'blob:' ) === 0 || fileName.indexOf( 'data:' ) === 0 ) { <add> loader.setPath( undefined ); <ide> <del> loader.setPath( undefined ); <add> } <ide> <ide> } <ide>
1
Go
Go
fix docs for config-default constants
ad4073edc174725849eb5b9c7f4977ce45a0ed19
<ide><path>daemon/config/config.go <ide> import ( <ide> const ( <ide> // DefaultMaxConcurrentDownloads is the default value for <ide> // maximum number of downloads that <del> // may take place at a time for each pull. <add> // may take place at a time. <ide> DefaultMaxConcurrentDownloads = 3 <ide> // DefaultMaxConcurrentUploads is the default value for <ide> // maximum number of uploads that <del> // may take place at a time for each push. <add> // may take place at a time. <ide> DefaultMaxConcurrentUploads = 5 <ide> // DefaultDownloadAttempts is the default value for <ide> // maximum number of attempts that
1
Ruby
Ruby
check definition on constant not string
c29cfe389e5ba27e75d05a23823ebe7abe22e9d0
<ide><path>actionpack/lib/action_controller/caching.rb <ide> def cache_sweeper(*sweepers) <ide> end <ide> end <ide> <del> if defined?("ActiveRecord") <add> if defined?(ActiveRecord::Observer) <ide> class Sweeper < ActiveRecord::Observer <ide> attr_accessor :controller <ide>
1
Javascript
Javascript
remove double word "then" in comments
e6c389cb3cb1888773c3d505ca954d5e846541aa
<ide><path>benchmark/net/net-pipe.js <ide> function main({ dur, len, type }) { <ide> <ide> setTimeout(() => { <ide> // Multiply by 2 since we're sending it first one way <del> // then then back again. <add> // then back again. <ide> const bytes = writer.received * 2; <ide> const gbits = (bytes * 8) / (1024 * 1024 * 1024); <ide> bench.end(gbits); <ide><path>benchmark/net/tcp-raw-pipe.js <ide> function main({ dur, len, type }) { <ide> <ide> setTimeout(() => { <ide> // Multiply by 2 since we're sending it first one way <del> // then then back again. <add> // then back again. <ide> bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024)); <ide> process.exit(0); <ide> }, dur * 1000);
2
Python
Python
improve pytorch examples for fp16
10e5f28212ceb9b71eb7c8d3a12044d563723362
<ide><path>examples/legacy/multiple_choice/run_multiple_choice.py <ide> AutoConfig, <ide> AutoModelForMultipleChoice, <ide> AutoTokenizer, <add> DataCollatorWithPadding, <ide> EvalPrediction, <ide> HfArgumentParser, <ide> Trainer, <ide> def compute_metrics(p: EvalPrediction) -> Dict: <ide> preds = np.argmax(p.predictions, axis=1) <ide> return {"acc": simple_accuracy(preds, p.label_ids)} <ide> <add> # Data collator <add> data_collator = DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8) if training_args.fp16 else None <add> <ide> # Initialize our Trainer <ide> trainer = Trainer( <ide> model=model, <ide> args=training_args, <ide> train_dataset=train_dataset, <ide> eval_dataset=eval_dataset, <ide> compute_metrics=compute_metrics, <add> data_collator=data_collator, <ide> ) <ide> <ide> # Training <ide><path>examples/legacy/question-answering/run_squad_trainer.py <ide> from typing import Optional <ide> <ide> import transformers <del>from transformers import AutoConfig, AutoModelForQuestionAnswering, AutoTokenizer, HfArgumentParser, SquadDataset <add>from transformers import ( <add> AutoConfig, <add> AutoModelForQuestionAnswering, <add> AutoTokenizer, <add> DataCollatorWithPadding, <add> HfArgumentParser, <add> SquadDataset, <add>) <ide> from transformers import SquadDataTrainingArguments as DataTrainingArguments <ide> from transformers import Trainer, TrainingArguments <ide> from transformers.trainer_utils import is_main_process <ide> def main(): <ide> else None <ide> ) <ide> <add> # Data collator <add> data_collator = DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8) if training_args.fp16 else None <add> <ide> # Initialize our Trainer <ide> trainer = Trainer( <ide> model=model, <ide> args=training_args, <ide> train_dataset=train_dataset, <ide> eval_dataset=eval_dataset, <add> data_collator=data_collator, <ide> ) <ide> <ide> # Training <ide><path>examples/legacy/token-classification/run_ner.py <ide> AutoConfig, <ide> AutoModelForTokenClassification, <ide> AutoTokenizer, <add> DataCollatorWithPadding, <ide> EvalPrediction, <ide> HfArgumentParser, <ide> Trainer, <ide> def compute_metrics(p: EvalPrediction) -> Dict: <ide> "f1": f1_score(out_label_list, preds_list), <ide> } <ide> <add> # Data collator <add> data_collator = DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8) if training_args.fp16 else None <add> <ide> # Initialize our Trainer <ide> trainer = Trainer( <ide> model=model, <ide> args=training_args, <ide> train_dataset=train_dataset, <ide> eval_dataset=eval_dataset, <ide> compute_metrics=compute_metrics, <add> data_collator=data_collator, <ide> ) <ide> <ide> # Training <ide><path>examples/multiple-choice/run_swag.py <ide> def preprocess_function(examples): <ide> <ide> # Data collator <ide> data_collator = ( <del> default_data_collator if data_args.pad_to_max_length else DataCollatorForMultipleChoice(tokenizer=tokenizer) <add> default_data_collator <add> if data_args.pad_to_max_length <add> else DataCollatorForMultipleChoice(tokenizer=tokenizer, pad_to_multiple_of=8 if training_args.fp16 else None) <ide> ) <ide> <ide> # Metric <ide><path>examples/question-answering/run_qa.py <ide> def prepare_validation_features(examples): <ide> # Data collator <ide> # We have already padded to max length if the corresponding flag is True, otherwise we need to pad in the data <ide> # collator. <del> data_collator = default_data_collator if data_args.pad_to_max_length else DataCollatorWithPadding(tokenizer) <add> data_collator = ( <add> default_data_collator <add> if data_args.pad_to_max_length <add> else DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8 if training_args.fp16 else None) <add> ) <ide> <ide> # Post-processing: <ide> def post_processing_function(examples, features, predictions): <ide><path>examples/question-answering/run_qa_beam_search.py <ide> def prepare_validation_features(examples): <ide> # Data collator <ide> # We have already padded to max length if the corresponding flag is True, otherwise we need to pad in the data <ide> # collator. <del> data_collator = default_data_collator if data_args.pad_to_max_length else DataCollatorWithPadding(tokenizer) <add> data_collator = ( <add> default_data_collator <add> if data_args.pad_to_max_length <add> else DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8 if training_args.fp16 else None) <add> ) <ide> <ide> # Post-processing: <ide> def post_processing_function(examples, features, predictions): <ide><path>examples/seq2seq/run_seq2seq.py <ide> def preprocess_function(examples): <ide> if data_args.pad_to_max_length: <ide> data_collator = default_data_collator <ide> else: <del> data_collator = DataCollatorForSeq2Seq(tokenizer, label_pad_token_id=label_pad_token_id) <add> data_collator = DataCollatorForSeq2Seq( <add> tokenizer, <add> label_pad_token_id=label_pad_token_id, <add> pad_to_multiple_of=8 if training_args.fp16 else None, <add> ) <ide> <ide> # Metric <ide> metric_name = "rouge" if data_args.task.startswith("summarization") else "sacrebleu" <ide><path>examples/text-classification/run_glue.py <ide> AutoConfig, <ide> AutoModelForSequenceClassification, <ide> AutoTokenizer, <add> DataCollatorWithPadding, <ide> EvalPrediction, <ide> HfArgumentParser, <ide> PretrainedConfig, <ide> def compute_metrics(p: EvalPrediction): <ide> else: <ide> return {"accuracy": (preds == p.label_ids).astype(np.float32).mean().item()} <ide> <add> # Data collator will default to DataCollatorWithPadding, so we change it if we already did the padding. <add> if data_args.pad_to_max_length: <add> data_collator = default_data_collator <add> elif training_args.fp16: <add> data_collator = DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8) <add> else: <add> data_collator = None <add> <ide> # Initialize our Trainer <ide> trainer = Trainer( <ide> model=model, <ide> def compute_metrics(p: EvalPrediction): <ide> eval_dataset=eval_dataset if training_args.do_eval else None, <ide> compute_metrics=compute_metrics, <ide> tokenizer=tokenizer, <del> # Data collator will default to DataCollatorWithPadding, so we change it if we already did the padding. <del> data_collator=default_data_collator if data_args.pad_to_max_length else None, <add> data_collator=data_collator, <ide> ) <ide> <ide> # Training <ide><path>examples/token-classification/run_ner.py <ide> def tokenize_and_align_labels(examples): <ide> ) <ide> <ide> # Data collator <del> data_collator = DataCollatorForTokenClassification(tokenizer) <add> data_collator = DataCollatorForTokenClassification(tokenizer, pad_to_multiple_of=8 if training_args.fp16 else None) <ide> <ide> # Metrics <ide> metric = load_metric("seqeval") <ide><path>templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py <ide> AutoConfig, <ide> {{cookiecutter.model_class}}, <ide> AutoTokenizer, <add> DataCollatorWithPadding, <ide> HfArgumentParser, <ide> Trainer, <ide> TrainingArguments, <ide> def tokenize_function(examples): <ide> ) <ide> <ide> # Data collator <del> data_collator=default_data_collator <add> data_collator=default_data_collator if not training_args.fp16 else DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8) <ide> <ide> # Initialize our Trainer <ide> trainer = Trainer(
10
PHP
PHP
add test for ignoring expired cookies
ea4951d2f0c91bffe4125869de536e6808cbd520
<ide><path>tests/TestCase/Http/Cookie/CookieCollectionTest.php <ide> public function testAddFromResponse() <ide> 'Has expiry' <ide> ); <ide> } <add> <add> /** <add> * Test adding cookies from a response ignores expired cookies <add> * <add> * @return void <add> */ <add> public function testAddFromResponseIgnoreExpired() <add> { <add> $collection = new CookieCollection(); <add> $request = new ServerRequest([ <add> 'url' => '/app' <add> ]); <add> $response = (new Response()) <add> ->withAddedHeader('Set-Cookie', 'test=value') <add> ->withAddedHeader('Set-Cookie', 'expired=soon; Expires=Wed, 09-Jun-2012 10:18:14 GMT; Path=/; HttpOnly; Secure;'); <add> $new = $collection->addFromResponse($response, $request); <add> $this->assertFalse($new->has('expired'),'Should drop expired cookies'); <add> } <ide> }
1
Python
Python
add xfailing test for
3b667787a932efdf2179bb8eb8a1654517e9a3e6
<ide><path>spacy/tests/regression/test_issue3289.py <add># coding: utf-8 <add>from __future__ import unicode_literals <add> <add>import pytest <add>from spacy.lang.en import English <add> <add> <add>@pytest.mark.xfail <add>def test_issue3289(): <add> """Test that Language.to_bytes handles serializing a pipeline component <add> with an uninitialized model.""" <add> nlp = English() <add> nlp.add_pipe(nlp.create_pipe("textcat")) <add> bytes_data = nlp.to_bytes() <add> new_nlp = English() <add> new_nlp.add_pipe(nlp.create_pipe("textcat")) <add> new_nlp.from_bytes(bytes_data)
1
Python
Python
fix merge_dot tests
8b3543fca9d811c638bb72d78601c8564f5465fd
<ide><path>examples/babi_memnn.py <ide> def vectorize_stories(data, word_idx, story_maxlen, query_maxlen): <ide> match = Sequential() <ide> match.add(Merge([input_encoder_m, question_encoder], <ide> mode='dot', <del> dot_axes=[(2,), (2,)])) <add> dot_axes=[2, 2])) <ide> # output: (samples, story_maxlen, query_maxlen) <ide> # embed the input into a single vector with size = story_maxlen: <ide> input_encoder_c = Sequential() <ide><path>keras/backend/tensorflow_backend.py <ide> def dot(x, y): <ide> <ide> <ide> def batch_dot(x, y, axes=None): <del> if axes: <del> adj_x = None if axes[0][0] == ndim(x) - 1 else True <del> adj_y = True if axes[1][0] == ndim(y) - 1 else None <add> '''batchwise dot product <add> batch_dot results in a tensor with less dimensions than the input. <add> If the number of dimensions is reduced to 1, we use `expand_dims` to <add> make sure that ndim is at least 2. <add> <add> # Example <add> Assume x = [[1, 2] and y = [[5, 6] <add> [3, 4]] [7, 8]] <add> batch_dot(x, y, axes=1) = [[17, 53]] which is the main diagonal <add> of x.dot(y.T), although we never have to calculate the off-diagonal <add> elements. <add> <add> <add> # Arguments <add> x, y: tensors with ndim >= 2 <add> axes: list (or single) int with target dimensions <add> <add> # Returns <add> Tensor with ndim >= 2 <add> ''' <add> if type(axes) == int: <add> axes = (axes, axes) <add> if axes is not None: <add> adj_x = None if axes[0] == ndim(x) - 1 else True <add> adj_y = True if axes[1] == ndim(y) - 1 else None <ide> else: <ide> adj_x = None <ide> adj_y = None <del> return tf.batch_matmul(x, y, adj_x=adj_x, adj_y=adj_y) <add> out = tf.batch_matmul(x, y, adj_x=adj_x, adj_y=adj_y) <add> if ndim(out) == 1: <add> out = expand_dims(out, 1) <add> return out <ide> <ide> <ide> def transpose(x): <ide> def round(x): <ide> return tf.round(x) <ide> <ide> <add>def sign(x): <add> return tf.sign(x) <add> <add> <ide> def pow(x, a): <ide> return tf.pow(x, a) <ide> <ide><path>keras/backend/theano_backend.py <ide> def dot(x, y): <ide> <ide> <ide> def batch_dot(x, y, axes=None): <add> '''batchwise dot product <add> batch_dot results in a tensor with less dimensions than the input. <add> If the number of dimensions is reduced to 1, we use `expand_dims` to <add> make sure that ndim is at least 2. <add> <add> # Example <add> Assume x = [[1, 2] and y = [[5, 6] <add> [3, 4]] [7, 8]] <add> batch_dot(x, y, axes=1) = [[17, 53]] which is the main diagonal <add> of x.dot(y.T), although we never have to calculate the off-diagonal <add> elements. <add> <add> <add> # Arguments <add> x, y: tensors with ndim >= 2 <add> axes: list (or single) int with target dimensions <add> <add> # Returns <add> Tensor with ndim >= 2 <add> ''' <add> if type(axes) == int: <add> axes = (axes, axes) <ide> if axes is None: <ide> # behaves like tf.batch_matmul as default <del> axes = [(x.ndim - 1,), (y.ndim - 2,)] <del> return T.batched_tensordot(x, y, axes=axes) <add> axes = [x.ndim - 1, y.ndim - 2] <add> out = T.batched_tensordot(x, y, axes=axes) <add> if ndim(out) == 1: <add> out = expand_dims(out, 1) <add> return out <ide> <ide> <ide> def transpose(x): <ide> def round(x): <ide> return T.round(x) <ide> <ide> <add>def sign(x): <add> return T.sgn(x) <add> <add> <ide> def pow(x, a): <ide> return T.pow(x, a) <ide> <ide><path>keras/engine/topology.py <ide> def __init__(self, layers=None, mode='sum', concat_axis=-1, <ide> self.mode = mode <ide> self.concat_axis = concat_axis <ide> self.dot_axes = dot_axes <add> if type(self.dot_axes) == int: <add> self.dot_axes = [self.dot_axes, ] * 2 <ide> self._output_shape = output_shape <ide> self.node_indices = node_indices <ide> <ide> def _arguments_validation(self, layers, mode, concat_axis, dot_axes, <ide> if mode == 'dot': <ide> if type(dot_axes) == int: <ide> if dot_axes < 0: <del> dot_axes = [range(dot_axes % n1, n1), range(dot_axes % n2, n2)] <add> dot_axes = [dot_axes % n1, dot_axes % n2] <ide> else: <del> dot_axes = [range(n1 - dot_axes, n2), range(1, dot_axes + 1)] <add> dot_axes = [n1 - dot_axes, n2-dot_axes] <ide> if type(dot_axes) not in [list, tuple]: <ide> raise Exception('Invalid type for dot_axes - should be a list.') <ide> if len(dot_axes) != 2: <ide> raise Exception('Invalid format for dot_axes - should contain two elements.') <del> if type(dot_axes[0]) not in [list, tuple, range] or type(dot_axes[1]) not in [list, tuple, range]: <del> raise Exception('Invalid format for dot_axes - list elements should have type "list" or "tuple".') <del> for i in range(len(dot_axes[0])): <del> if shape1[dot_axes[0][i]] != shape2[dot_axes[1][i]]: <del> raise Exception('Dimension incompatibility using dot mode: ' + <del> '%s != %s. ' % (shape1[dot_axes[0][i]], shape2[dot_axes[1][i]]) + <del> 'Layer shapes: %s, %s' % (shape1, shape2)) <add> if type(dot_axes[0]) is not int or type(dot_axes[1]) is not int: <add> raise Exception('Invalid format for dot_axes - list elements should be "int".') <add> if shape1[dot_axes[0]] != shape2[dot_axes[1]]: <add> raise Exception('Dimension incompatibility using dot mode: ' + <add> '%s != %s. ' % (shape1[dot_axes[0]], shape2[dot_axes[1][i]]) + <add> 'Layer shapes: %s, %s' % (shape1, shape2)) <ide> elif mode == 'concat': <ide> reduced_inputs_shapes = [list(shape) for shape in input_shapes] <ide> shape_set = set() <ide> def get_output_shape_for(self, input_shape): <ide> elif self.mode == 'dot': <ide> shape1 = list(input_shapes[0]) <ide> shape2 = list(input_shapes[1]) <del> dot_axes = [] <del> for axes in self.dot_axes: <del> dot_axes.append([index-1 for index in axes]) <add> dot_axes = [a-1 for a in self.dot_axes] <ide> tensordot_output = np.tensordot(np.zeros(tuple(shape1[1:])), <ide> np.zeros(tuple(shape2[1:])), <ide> axes=dot_axes) <ide><path>tests/keras/backend/test_backends.py <ide> def test_elementwise_operations(self): <ide> check_single_tensor_operation('exp', (4, 2)) <ide> check_single_tensor_operation('log', (4, 2)) <ide> check_single_tensor_operation('round', (4, 2)) <add> check_single_tensor_operation('sign', (4, 2)) <ide> check_single_tensor_operation('pow', (4, 2), a=3) <ide> check_single_tensor_operation('clip', (4, 2), min_value=0.4, <ide> max_value=0.6) <ide><path>tests/keras/test_sequential_model.py <ide> def test_merge_dot(): <ide> right.add(Activation('relu')) <ide> <ide> model = Sequential() <del> model.add(Merge([left, right], mode='dot', dot_axes=([1], [1]))) <add> model.add(Merge([left, right], mode='dot', dot_axes=[1, 1])) <ide> model.add(Dense(nb_class)) <ide> model.add(Activation('softmax')) <ide>
6
Go
Go
fix unclear error message when deleting container
70c1781e073287a0b012ce94ea1b233fd6628dfa
<ide><path>server.go <ide> func (srv *Server) ContainerDestroy(job *engine.Job) engine.Status { <ide> continue <ide> } <ide> if err := srv.runtime.volumes.Delete(volumeId); err != nil { <del> job.Error(err) <add> job.Errorf("Error calling volumes.Delete(%q): %v", volumeId, err) <ide> return engine.StatusErr <ide> } <ide> }
1
Python
Python
add regression test for
f35ce097762c3bfc7010cfe6ee8398c66d8223b0
<ide><path>spacy/tests/regression/test_issue3839.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>import pytest <add>from spacy.matcher import Matcher <add>from spacy.tokens import Doc <add> <add> <add>@pytest.mark.xfail <add>def test_issue3839(en_vocab): <add> """Test that match IDs returned by the matcher are correct, are in the string """ <add> doc = Doc(en_vocab, words=["terrific", "group", "of", "people"]) <add> matcher = Matcher(en_vocab) <add> match_id = "PATTERN" <add> pattern1 = [{"LOWER": "terrific"}, {"OP": "?"}, {"LOWER": "group"}] <add> pattern2 = [{"LOWER": "terrific"}, {"OP": "?"}, {"OP": "?"}, {"LOWER": "group"}] <add> matcher.add(match_id, None, pattern1) <add> matches = matcher(doc) <add> assert matches[0][0] == en_vocab.strings[match_id] <add> matcher = Matcher(en_vocab) <add> matcher.add(match_id, None, pattern2) <add> matches = matcher(doc) <add> assert matches[0][0] == en_vocab.strings[match_id]
1
Python
Python
add test for textcat
7dc76c6ff6b51749f39f3fabecee27417a77b1df
<ide><path>spacy/tests/test_textcat.py <add>import random <add> <add>from ..pipeline import TextCategorizer <add>from ..lang.en import English <add>from ..vocab import Vocab <add>from ..tokens import Doc <add>from ..gold import GoldParse <add> <add> <add>def test_textcat_learns_multilabel(): <add> docs = [] <add> nlp = English() <add> vocab = nlp.vocab <add> letters = ['a', 'b', 'c'] <add> for w1 in letters: <add> for w2 in letters: <add> cats = {letter: float(w2==letter) for letter in letters} <add> docs.append((Doc(vocab, words=['d']*3 + [w1, w2] + ['d']*3), cats)) <add> random.shuffle(docs) <add> model = TextCategorizer(vocab, width=8) <add> for letter in letters: <add> model.add_label(letter) <add> optimizer = model.begin_training() <add> for i in range(20): <add> losses = {} <add> Ys = [GoldParse(doc, cats=cats) for doc, cats in docs] <add> Xs = [doc for doc, cats in docs] <add> model.update(Xs, Ys, sgd=optimizer, losses=losses) <add> random.shuffle(docs) <add> for w1 in letters: <add> for w2 in letters: <add> doc = Doc(vocab, words=['d']*3 + [w1, w2] + ['d']*3) <add> truth = {letter: w2==letter for letter in letters} <add> model(doc) <add> for cat, score in doc.cats.items(): <add> print(doc, cat, score) <add> if not truth[cat]: <add> assert score < 0.5 <add> else: <add> assert score > 0.5 <add>
1
Javascript
Javascript
add support for `component.prototype.layout`
952efd0e1d6f1d205123f959d8679fd6e98ea1d1
<ide><path>packages/ember-application/lib/system/application.js <ide> function glimmerSetupRegistry(registry) { <ide> }); <ide> <ide> let glimmerOutletTemplate = require('ember-glimmer/templates/outlet').default; <add> let glimmerComponentTemplate = require('ember-glimmer/templates/component').default; <add> registry.register(P`template:components/-default`, glimmerComponentTemplate); <ide> registry.register('template:-outlet', glimmerOutletTemplate); <ide> registry.injection('view:-outlet', 'template', 'template:-outlet'); <ide> registry.injection('template', 'env', 'service:-glimmer-environment'); <ide><path>packages/ember-glimmer/lib/utils/lookup-component.js <ide> import isEnabled from 'ember-metal/features'; <add>import { privatize as P } from 'container/registry'; <add> <add>const DEFAULT_LAYOUT = P`template:components/-default`; <ide> <ide> function lookupComponentPair(componentLookup, owner, name, options) { <add> let component = componentLookup.componentFor(name, owner, options); <add> let layout = componentLookup.layoutFor(name, owner, options); <add> <add> if (!layout && component) { <add> let layoutProp = component.proto().layout; <add> if (layoutProp) { <add> let templateFullName = 'template:components/' + name; <add> owner.register(templateFullName, layoutProp); <add> layout = owner.lookup(templateFullName, options); <add> } else { <add> layout = owner.lookup(DEFAULT_LAYOUT); <add> } <add> } <add> <ide> return { <del> component: componentLookup.componentFor(name, owner, options), <del> layout: componentLookup.layoutFor(name, owner, options) <add> component, <add> layout <ide> }; <ide> } <ide>
2
Javascript
Javascript
fix flaky watchfile()
8c305e1c2fc94e3d0b3e6a016f5635970e287df7
<add><path>test/parallel/test-fs-watch-file-enoent-after-deletion.js <del><path>test/sequential/test-fs-watch-file-enoent-after-deletion.js <ide> const common = require('../common'); <ide> // stopped it from getting emitted. <ide> // https://github.com/nodejs/node-v0.x-archive/issues/4027 <ide> <del>const assert = require('assert'); <ide> const path = require('path'); <ide> const fs = require('fs'); <ide> <ide> const filename = path.join(tmpdir.path, 'watched'); <ide> fs.writeFileSync(filename, 'quis custodiet ipsos custodes'); <ide> <ide> fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) { <del> assert.strictEqual(prev.nlink, 1); <del> assert.strictEqual(curr.nlink, 0); <ide> fs.unwatchFile(filename); <ide> })); <ide>
1
Java
Java
commit changes to test
41b6f4e351eec14bfd6e7a4759ed8b2cbbe7bf54
<ide><path>spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java <ide> import java.util.ArrayList; <ide> import java.util.List; <ide> import java.util.Set; <del>import java.util.function.Consumer; <ide> <ide> import org.junit.jupiter.api.Test; <ide> <ide> import org.springframework.aot.generate.DefaultGenerationContext; <ide> import org.springframework.aot.generate.GeneratedFiles.Kind; <ide> import org.springframework.aot.generate.InMemoryGeneratedFiles; <del>import org.springframework.aot.hint.JdkProxyHint; <ide> import org.springframework.aot.hint.MemberCategory; <ide> import org.springframework.aot.hint.RuntimeHints; <ide> import org.springframework.aot.hint.TypeReference; <ide> private static void assertRuntimeHints(RuntimeHints runtimeHints) { <ide> ).forEach(type -> assertReflectionRegistered(runtimeHints, type, INVOKE_DECLARED_CONSTRUCTORS)); <ide> <ide> Set.of( <del> // Legacy and JUnit 4 <del> org.springframework.test.annotation.Commit.class, <del> org.springframework.test.annotation.DirtiesContext.class, <del> org.springframework.test.annotation.IfProfileValue.class, <del> org.springframework.test.annotation.ProfileValueSourceConfiguration.class, <del> org.springframework.test.annotation.Repeat.class, <del> org.springframework.test.annotation.Rollback.class, <del> org.springframework.test.annotation.Timed.class, <del> <del> // Core TestContext framework <del> org.springframework.test.context.ActiveProfiles.class, <del> org.springframework.test.context.BootstrapWith.class, <del> org.springframework.test.context.ContextConfiguration.class, <del> org.springframework.test.context.ContextHierarchy.class, <del> org.springframework.test.context.DynamicPropertySource.class, <del> org.springframework.test.context.NestedTestConfiguration.class, <del> org.springframework.test.context.TestConstructor.class, <del> org.springframework.test.context.TestExecutionListeners.class, <del> org.springframework.test.context.TestPropertySource.class, <del> org.springframework.test.context.TestPropertySources.class, <del> <del> // Application Events <del> org.springframework.test.context.event.RecordApplicationEvents.class, <del> <del> // Test execution events <del> org.springframework.test.context.event.annotation.AfterTestClass.class, <del> org.springframework.test.context.event.annotation.AfterTestExecution.class, <del> org.springframework.test.context.event.annotation.AfterTestMethod.class, <del> org.springframework.test.context.event.annotation.BeforeTestClass.class, <del> org.springframework.test.context.event.annotation.BeforeTestExecution.class, <del> org.springframework.test.context.event.annotation.BeforeTestMethod.class, <del> org.springframework.test.context.event.annotation.PrepareTestInstance.class, <del> <del> // JUnit Jupiter <del> org.springframework.test.context.junit.jupiter.EnabledIf.class, <del> org.springframework.test.context.junit.jupiter.DisabledIf.class, <del> org.springframework.test.context.junit.jupiter.SpringJUnitConfig.class, <del> org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig.class, <del> <del> // Web <ide> org.springframework.test.context.web.WebAppConfiguration.class <ide> ).forEach(type -> assertAnnotationRegistered(runtimeHints, type)); <ide> <ide> private static void assertReflectionRegistered(RuntimeHints runtimeHints, Class< <ide> <ide> private static void assertAnnotationRegistered(RuntimeHints runtimeHints, Class<? extends Annotation> annotationType) { <ide> assertReflectionRegistered(runtimeHints, annotationType, INVOKE_DECLARED_METHODS); <del> assertThat(runtimeHints.proxies().jdkProxies()) <del> .as("Proxy hint for annotation @%s", annotationType.getSimpleName()) <del> .anySatisfy(annotationProxy(annotationType)); <ide> } <ide> <del> @SuppressWarnings("deprecation") <del> private static Consumer<JdkProxyHint> annotationProxy(Class<? extends Annotation> type) { <del> return jdkProxyHint -> assertThat(jdkProxyHint.getProxiedInterfaces()) <del> .containsExactly(TypeReference.of(type), <del> TypeReference.of(org.springframework.core.annotation.SynthesizedAnnotation.class)); <del> } <ide> <ide> @Test <ide> void processAheadOfTimeWithBasicTests() {
1
Javascript
Javascript
parse opacity of material
c52fef3b548ecf7d252850ffaa9a2eaca6b26989
<ide><path>examples/js/loaders/TDSLoader.js <ide> THREE.TDSLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype <ide> material.shininess = shininess; <ide> this.debugMessage( ' Shininess : ' + shininess ); <ide> <add> } else if ( next === MAT_TRANSPARENCY ) { <add> <add> var opacity = this.readWord( data ); <add> material.opacity = opacity*0.01; <add> this.debugMessage( ' Opacity : ' + opacity ); <add> material.transparent = opacity<100 ? true : false; <ide> } else if ( next === MAT_TEXMAP ) { <ide> <ide> this.debugMessage( ' ColorMap' );
1
Text
Text
translate english "use" to spanish "usa"
1d04e727e07d25d386d38b54df0a28b4a6632ab6
<ide><path>curriculum/challenges/spanish/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.spanish.md <ide> localeTitle: Agregue espacios más rápido con la rejilla <ide> <section id="description"> <code>grid-gap</code> es una propiedad abreviada de <code>grid-row-gap</code> y <code>grid-column-gap</code> de los dos desafíos anteriores que es más conveniente de usar. Si <code>grid-gap</code> tiene un valor, creará un gap entre todas las filas y columnas. Sin embargo, si hay dos valores, utilizará el primero para establecer el espacio entre las filas y el segundo valor para las columnas. </section> <ide> <ide> ## Instructions <del><section id="instructions"> Use <code>grid-gap</code> para introducir un espacio de <code>10px</code> entre las filas y un espacio de <code>20px</code> entre las columnas. </section> <add><section id="instructions"> Usa <code>grid-gap</code> para introducir un espacio de <code>10px</code> entre las filas y un espacio de <code>20px</code> entre las columnas. </section> <ide> <ide> ## Tests <ide> <section id='tests'>
1
Ruby
Ruby
require instances to use a subclass
93647e5c987f89f27502b79af4aedda8c917c6e3
<ide><path>Library/Homebrew/requirement.rb <ide> class Requirement <ide> attr_reader :tags, :name, :cask, :download <ide> <ide> def initialize(tags = []) <add> # Only allow instances of subclasses. This base class enforces no constraints on its own. <add> # Individual subclasses use the `satisfy` DSL to define those constraints. <add> raise "Do not call `Requirement.new' directly without a subclass." unless self.class < Requirement <add> <ide> @cask = self.class.cask <ide> @download = self.class.download <ide> tags.each do |tag| <ide><path>Library/Homebrew/test/requirement_spec.rb <ide> let(:klass) { Class.new(described_class) } <ide> <ide> describe "#tags" do <del> subject { described_class.new(tags) } <add> subject { klass.new(tags) } <ide> <ide> context "with a single tag" do <ide> let(:tags) { ["bar"] } <ide> <ide> describe "#build?" do <ide> context "when the :build tag is specified" do <del> subject { described_class.new([:build]) } <add> subject { klass.new([:build]) } <ide> <ide> it { is_expected.to be_a_build_requirement } <ide> end <ide> end <ide> <ide> describe "#eql? and #==" do <del> subject(:requirement) { described_class.new } <add> subject(:requirement) { klass.new } <ide> <ide> it "returns true if the names and tags are equal" do <del> other = described_class.new <add> other = klass.new <ide> <ide> expect(requirement).to eql(other) <ide> expect(requirement).to eq(other) <ide> end <ide> <ide> it "returns false if names differ" do <del> other = described_class.new <add> other = klass.new <ide> allow(other).to receive(:name).and_return("foo") <ide> expect(requirement).not_to eql(other) <ide> expect(requirement).not_to eq(other) <ide> end <ide> <ide> it "returns false if tags differ" do <del> other = described_class.new([:optional]) <add> other = klass.new([:optional]) <ide> <ide> expect(requirement).not_to eql(other) <ide> expect(requirement).not_to eq(other) <ide> end <ide> end <ide> <ide> describe "#hash" do <del> subject(:requirement) { described_class.new } <add> subject(:requirement) { klass.new } <ide> <ide> it "is equal if names and tags are equal" do <del> other = described_class.new <add> other = klass.new <ide> expect(requirement.hash).to eq(other.hash) <ide> end <ide> <ide> it "differs if names differ" do <del> other = described_class.new <add> other = klass.new <ide> allow(other).to receive(:name).and_return("foo") <ide> expect(requirement.hash).not_to eq(other.hash) <ide> end <ide> <ide> it "differs if tags differ" do <del> other = described_class.new([:optional]) <add> other = klass.new([:optional]) <ide> expect(requirement.hash).not_to eq(other.hash) <ide> end <ide> end <ide><path>Library/Homebrew/test/requirements_spec.rb <ide> end <ide> <ide> it "merges duplicate requirements" do <del> requirements << Requirement.new << Requirement.new <add> klass = Class.new(Requirement) <add> requirements << klass.new << klass.new <ide> expect(requirements.count).to eq(1) <ide> end <ide> end
3
Javascript
Javascript
remove unused modules
6abd8b587e978d03705d97f85d809f677cf97532
<ide><path>test/addons/at-exit/test.js <ide> 'use strict'; <ide> require('../../common'); <del>var binding = require('./build/Release/binding'); <add>require('./build/Release/binding'); <ide><path>test/internet/test-dns-ipv4.js <ide> var common = require('../common'); <ide> var assert = require('assert'), <ide> dns = require('dns'), <ide> net = require('net'), <del> isIP = net.isIP, <ide> isIPv4 = net.isIPv4; <del>var util = require('util'); <ide> <ide> var expected = 0, <ide> completed = 0, <ide><path>test/internet/test-dns-ipv6.js <ide> var common = require('../common'); <ide> var assert = require('assert'), <ide> dns = require('dns'), <ide> net = require('net'), <del> isIP = net.isIP, <ide> isIPv6 = net.isIPv6; <del>var util = require('util'); <ide> <ide> var expected = 0, <ide> completed = 0, <ide><path>test/message/2100bytes.js <ide> 'use strict'; <ide> require('../common'); <del>var util = require('util'); <ide> <ide> console.log([ <ide> '_______________________________________________50', <ide><path>test/parallel/test-cluster-eaddrinuse.js <ide> <ide> var common = require('../common'); <ide> var assert = require('assert'); <del>var cluster = require('cluster'); <ide> var fork = require('child_process').fork; <ide> var net = require('net'); <ide> <ide><path>test/parallel/test-cluster-worker-forced-exit.js <ide> require('../common'); <ide> var assert = require('assert'); <ide> var cluster = require('cluster'); <del>var net = require('net'); <ide> <ide> var SENTINEL = 42; <ide> <ide><path>test/parallel/test-crypto-certificate.js <ide> var crypto = require('crypto'); <ide> crypto.DEFAULT_ENCODING = 'buffer'; <ide> <ide> var fs = require('fs'); <del>var path = require('path'); <ide> <ide> // Test Certificates <ide> var spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid'); <ide><path>test/parallel/test-dgram-send-callback-buffer-length.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <del>var fs = require('fs'); <ide> var dgram = require('dgram'); <del>var callbacks = 0; <ide> var client, timer, buf, len, offset; <ide> <ide> <ide><path>test/parallel/test-dgram-udp4.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <del>var fs = require('fs'), <del> dgram = require('dgram'), server, client, <add>var dgram = require('dgram'), server, client, <ide> server_port = common.PORT, <ide> message_to_send = 'A message to send', <ide> timer; <ide><path>test/parallel/test-domain-multi.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var domain = require('domain'); <del>var events = require('events'); <ide> <ide> var caughtA = false; <ide> var caughtB = false; <ide><path>test/parallel/test-eval-require.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var spawn = require('child_process').spawn; <del>var path = require('path'); <del>var fs = require('fs'); <ide> <ide> var options = { <ide> cwd: common.fixturesDir <ide><path>test/parallel/test-event-emitter-listeners-side-effects.js <ide> <ide> require('../common'); <ide> var assert = require('assert'); <del>var events = require('events'); <ide> <ide> var EventEmitter = require('events').EventEmitter; <ide> var assert = require('assert'); <ide><path>test/parallel/test-fs-readdir.js <ide> <ide> const common = require('../common'); <ide> const assert = require('assert'); <del>const path = require('path'); <ide> const fs = require('fs'); <ide> <ide> const readdirDir = common.tmpDir; <ide><path>test/parallel/test-listen-fd-cluster.js <ide> var assert = require('assert'); <ide> var http = require('http'); <ide> var net = require('net'); <ide> var PORT = common.PORT; <del>var spawn = require('child_process').spawn; <ide> var cluster = require('cluster'); <ide> <ide> console.error('Cluster listen fd test', process.argv[2] || 'runner'); <ide><path>test/parallel/test-listen-fd-server.js <ide> var assert = require('assert'); <ide> var http = require('http'); <ide> var net = require('net'); <ide> var PORT = common.PORT; <del>var spawn = require('child_process').spawn; <ide> <ide> if (common.isWindows) { <ide> console.log('1..0 # Skipped: This test is disabled on windows.'); <ide><path>test/parallel/test-readline-keys.js <ide> 'use strict'; <ide> require('../common'); <del>var EventEmitter = require('events').EventEmitter; <ide> var PassThrough = require('stream').PassThrough; <ide> var assert = require('assert'); <ide> var inherits = require('util').inherits; <ide> inherits(FakeInput, PassThrough); <ide> <ide> var fi = new FakeInput(); <ide> var fo = new FakeInput(); <del>var rli = new Interface({ input: fi, output: fo, terminal: true }); <add>new Interface({ input: fi, output: fo, terminal: true }); <ide> <ide> var keys = []; <ide> fi.on('keypress', function(s, k) { <ide><path>test/parallel/test-tick-processor.js <ide> 'use strict'; <ide> var fs = require('fs'); <ide> var assert = require('assert'); <del>var path = require('path'); <ide> var cp = require('child_process'); <ide> var common = require('../common'); <ide> <ide><path>test/parallel/test-tls-legacy-onselect.js <ide> if (!common.hasCrypto) { <ide> var tls = require('tls'); <ide> var net = require('net'); <ide> <del>var fs = require('fs'); <del> <ide> var success = false; <ide> <del>function filenamePEM(n) { <del> return require('path').join(common.fixturesDir, 'keys', n + '.pem'); <del>} <del> <ide> var server = net.Server(function(raw) { <ide> var pair = tls.createSecurePair(null, true, false, false); <ide> pair.on('error', function() {}); <ide><path>test/parallel/test-zlib-dictionary.js <ide> require('../common'); <ide> const assert = require('assert'); <ide> const zlib = require('zlib'); <del>const path = require('path'); <ide> <ide> const spdyDict = new Buffer([ <ide> 'optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-', <ide><path>test/parallel/test-zlib-flush-drain.js <ide> require('../common'); <ide> const assert = require('assert'); <ide> const zlib = require('zlib'); <del>const path = require('path'); <ide> <ide> const bigData = new Buffer(10240).fill('x'); <ide> <ide><path>test/parallel/test-zlib-write-after-flush.js <ide> require('../common'); <ide> var assert = require('assert'); <ide> var zlib = require('zlib'); <del>var fs = require('fs'); <ide> <ide> var gzip = zlib.createGzip(); <ide> var gunz = zlib.createUnzip(); <ide><path>test/pummel/test-dtrace-jsstack.js <ide> require('../common'); <ide> var assert = require('assert'); <ide> var os = require('os'); <del>var util = require('util'); <ide> <ide> if (os.type() != 'SunOS') { <ide> console.log('1..0 # Skipped: no DTRACE support'); <ide> if (os.type() != 'SunOS') { <ide> * Some functions to create a recognizable stack. <ide> */ <ide> var frames = [ 'stalloogle', 'bagnoogle', 'doogle' ]; <del>var expected; <ide> <ide> var stalloogle = function(str) { <ide> expected = str; <ide> var doogle = function() { <ide> <ide> var spawn = require('child_process').spawn; <ide> var prefix = '/var/tmp/node'; <del>var corefile = prefix + '.' + process.pid; <ide> <ide> /* <ide> * We're going to use DTrace to stop us, gcore us, and set us running again <ide><path>test/pummel/test-http-client-reconnect-bug.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> <ide> var net = require('net'), <del> util = require('util'), <ide> http = require('http'); <ide> <ide> var errorCount = 0; <ide><path>test/pummel/test-keep-alive.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var spawn = require('child_process').spawn; <ide> var http = require('http'); <del>var path = require('path'); <ide> var url = require('url'); <ide> <ide> if (common.isWindows) { <ide><path>test/pummel/test-timer-wrap2.js <ide> 'use strict'; <ide> require('../common'); <del>var assert = require('assert'); <ide> <ide> // Test that allocating a timer does not increase the loop's reference <ide> // count. <ide> <ide> var Timer = process.binding('timer_wrap').Timer; <del>var t = new Timer(); <add>new Timer(); <ide><path>test/pummel/test-tls-securepair-client.js <ide> var join = require('path').join; <ide> var net = require('net'); <ide> var assert = require('assert'); <ide> var fs = require('fs'); <del>var crypto = require('crypto'); <ide> var tls = require('tls'); <del>var exec = require('child_process').exec; <ide> var spawn = require('child_process').spawn; <ide> <ide> test1(); <ide> function test(keyfn, certfn, check, next) { <ide> // EADDRINUSE. <ide> var PORT = common.PORT + 5; <ide> <del> var connections = 0; <del> <ide> keyfn = join(common.fixturesDir, keyfn); <ide> var key = fs.readFileSync(keyfn).toString(); <ide> <ide><path>test/sequential/test-child-process-execsync.js <ide> 'use strict'; <ide> var common = require('../common'); <ide> var assert = require('assert'); <del>var os = require('os'); <ide> <ide> var execSync = require('child_process').execSync; <ide> var execFileSync = require('child_process').execFileSync; <ide><path>test/sequential/test-regress-GH-1697.js <ide> 'use strict'; <ide> var common = require('../common'); <ide> var net = require('net'), <del> cp = require('child_process'), <del> util = require('util'); <add> cp = require('child_process'); <ide> <ide> if (process.argv[2] === 'server') { <ide> // Server <ide><path>test/sequential/test-stdout-close-catch.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var path = require('path'); <ide> var child_process = require('child_process'); <del>var fs = require('fs'); <ide> <ide> var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); <ide>
29
Python
Python
remove some outdated comments
f306e941ffb0bc49604f5507aa8ea614d933cfd0
<ide><path>numpy/array_api/linalg.py <ide> def diagonal(x: Array, /, *, offset: int = 0) -> Array: <ide> return Array._new(np.diagonal(x._array, offset=offset, axis1=-2, axis2=-1)) <ide> <ide> <del># Note: the keyword argument name upper is different from np.linalg.eigh <ide> def eigh(x: Array, /) -> EighResult: <ide> """ <ide> Array API compatible wrapper for :py:func:`np.linalg.eigh <numpy.linalg.eigh>`. <ide> def eigh(x: Array, /) -> EighResult: <ide> return EighResult(*map(Array._new, np.linalg.eigh(x._array))) <ide> <ide> <del># Note: the keyword argument name upper is different from np.linalg.eigvalsh <ide> def eigvalsh(x: Array, /) -> Array: <ide> """ <ide> Array API compatible wrapper for :py:func:`np.linalg.eigvalsh <numpy.linalg.eigvalsh>`.
1
Ruby
Ruby
extract logic into generic os classes. (#450)
a5ec0aa2598d702b68300e7400fad48e8a392527
<ide><path>Library/Homebrew/emoji.rb <add>module Emoji <add> class << self <add> def tick <add> # necessary for 1.8.7 unicode handling since many installs are on 1.8.7 <add> @tick ||= ["2714".hex].pack("U*") <add> end <add> <add> def cross <add> # necessary for 1.8.7 unicode handling since many installs are on 1.8.7 <add> @cross ||= ["2718".hex].pack("U*") <add> end <add> <add> def install_badge <add> ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba" <add> end <add> <add> def enabled? <add> !ENV["HOMEBREW_NO_EMOJI"] <add> end <add> alias generic_enabled? enabled? <add> end <add>end <add> <add>require "extend/os/emoji" <ide><path>Library/Homebrew/extend/os/emoji.rb <add>require "os" <add>require "emoji" <add> <add>if OS.mac? <add> require "extend/os/mac/emoji" <add>end <ide><path>Library/Homebrew/extend/os/mac/emoji.rb <add>module Emoji <add> class << self <add> def enabled? <add> generic_enabled? && MacOS.version >= :lion <add> end <add> end <add>end <ide><path>Library/Homebrew/formula_installer.rb <ide> require "debrew" <ide> require "sandbox" <ide> require "requirements/cctools_requirement" <add>require "emoji" <ide> <ide> class FormulaInstaller <ide> include FormulaCellarChecks <ide> def finish <ide> unlock <ide> end <ide> <del> def emoji <del> ENV["HOMEBREW_INSTALL_BADGE"] || "\xf0\x9f\x8d\xba" <del> end <del> <ide> def summary <ide> s = "" <del> s << "#{emoji} " if MacOS.version >= :lion && !ENV["HOMEBREW_NO_EMOJI"] <add> s << "#{Emoji.install_badge} " if Emoji.enabled? <ide> s << "#{formula.prefix}: #{formula.prefix.abv}" <ide> s << ", built in #{pretty_duration build_time}" if build_time <ide> s <ide><path>Library/Homebrew/utils.rb <ide> require "pathname" <add>require "emoji" <ide> require "exceptions" <ide> require "utils/hash" <ide> require "utils/json" <ide> <ide> class Tty <ide> class << self <del> def tick <del> # necessary for 1.8.7 unicode handling since many installs are on 1.8.7 <del> @tick ||= ["2714".hex].pack("U*") <del> end <del> <del> def cross <del> # necessary for 1.8.7 unicode handling since many installs are on 1.8.7 <del> @cross ||= ["2718".hex].pack("U*") <del> end <del> <ide> def strip_ansi(string) <ide> string.gsub(/\033\[\d+(;\d+)*m/, "") <ide> end <ide> def odie(error) <ide> def pretty_installed(f) <ide> if !$stdout.tty? <ide> "#{f}" <del> elsif ENV["HOMEBREW_NO_EMOJI"] <del> "#{Tty.highlight}#{Tty.green}#{f} (installed)#{Tty.reset}" <add> elsif Emoji.enabled? <add> "#{Tty.highlight}#{f} #{Tty.green}#{Emoji.tick}#{Tty.reset}" <ide> else <del> "#{Tty.highlight}#{f} #{Tty.green}#{Tty.tick}#{Tty.reset}" <add> "#{Tty.highlight}#{Tty.green}#{f} (installed)#{Tty.reset}" <ide> end <ide> end <ide> <ide> def pretty_uninstalled(f) <ide> if !$stdout.tty? <ide> "#{f}" <del> elsif ENV["HOMEBREW_NO_EMOJI"] <del> "#{Tty.red}#{f} (uninstalled)#{Tty.reset}" <add> elsif Emoji.enabled? <add> "#{f} #{Tty.red}#{Emoji.cross}#{Tty.reset}" <ide> else <del> "#{f} #{Tty.red}#{Tty.cross}#{Tty.reset}" <add> "#{Tty.red}#{f} (uninstalled)#{Tty.reset}" <ide> end <ide> end <ide>
5
Python
Python
add tests for "_get_numeric_id"
c67f1a97babbec3e67bed3df17a2ece45bff0d84
<ide><path>libcloud/dns/base.py <ide> def delete(self): <ide> return self.driver.delete_record(record=self) <ide> <ide> def _get_numeric_id(self): <add> """ <add> Return numeric ID for the provided record if the ID is a digit. <add> <add> This method is used for sorting the values when exporting Zone to a <add> BIND format. <add> """ <ide> # type: () -> Union[int, str] <ide> record_id = self.id <ide> <ide><path>libcloud/test/dns/test_base.py <ide> def test_export_zone_to_bind_format_success(self): <ide> assertRegex(self, lines[10], r'example.com\.\s+900\s+IN\s+MX\s+10\s+mx.example.com') <ide> assertRegex(self, lines[11], r'example.com\.\s+900\s+IN\s+SRV\s+20\s+10 3333 example.com') <ide> <add> def test_get_numeric_id(self): <add> values = MOCK_RECORDS_VALUES[0].copy() <add> values['driver'] = self.driver <add> values['zone'] = None <add> record = Record(**values) <add> <add> record.id = 'abcd' <add> result = record._get_numeric_id() <add> self.assertEqual(result, 'abcd') <add> <add> record.id = '1' <add> result = record._get_numeric_id() <add> self.assertEqual(result, 1) <add> <add> record.id = '12345' <add> result = record._get_numeric_id() <add> self.assertEqual(result, 12345) <add> <add> record.id = '' <add> result = record._get_numeric_id() <add> self.assertEqual(result, '') <add> <add> record.id = None <add> result = record._get_numeric_id() <add> self.assertEqual(result, '') <add> <ide> <ide> if __name__ == '__main__': <ide> sys.exit(unittest.main())
2
Python
Python
improve error message and order + added unit tests
6c8ce10093c3a63ac2791497905f01bc0b4daa54
<ide><path>airflow/models.py <ide> def detect_downstream_cycle(self, task=None): <ide> task = self <ide> for t in self.get_direct_relatives(): <ide> if task is t: <del> msg = "Cycle detect in DAG. Faulty task: {0}".format(task) <add> msg = "Cycle detected in DAG. Faulty task: {0}".format(task) <ide> raise AirflowException(msg) <ide> else: <ide> t.detect_downstream_cycle(task=task) <ide> def _set_relatives(self, task_or_task_list, upstream=False): <ide> if not isinstance(task, BaseOperator): <ide> raise AirflowException('Expecting a task') <ide> if upstream: <del> self.append_only_new(task._downstream_list, self) <add> task.append_only_new(task._downstream_list, self) <ide> self.append_only_new(self._upstream_list, task) <ide> else: <del> self.append_only_new(task._upstream_list, self) <ide> self.append_only_new(self._downstream_list, task) <add> task.append_only_new(task._upstream_list, self) <add> <ide> self.detect_downstream_cycle() <ide> <ide> def set_downstream(self, task_or_task_list): <ide><path>tests/core.py <ide> from airflow.settings import Session <ide> from airflow.utils import LoggingMixin, round_time <ide> from lxml import html <add>from airflow.utils import AirflowException <ide> <ide> NUM_EXAMPLE_DAGS = 7 <ide> DEV_NULL = '/dev/null' <ide> def setUp(self): <ide> self.dag = dag <ide> self.dag_bash = self.dagbag.dags['example_bash_operator'] <ide> self.runme_0 = self.dag_bash.get_task('runme_0') <add> self.run_after_loop = self.dag_bash.get_task('run_after_loop') <add> self.run_this_last = self.dag_bash.get_task('run_this_last') <ide> <ide> def test_schedule_dag_no_previous_runs(self): <ide> """ <ide> def test_round_time(self): <ide> 2015, 9, 14, 0, 0)) <ide> assert rt6 == datetime(2015, 9, 14, 0, 0) <ide> <add> def test_duplicate_dependencies(self): <add> <add> regexp = "Dependency (.*)runme_0(.*)run_after_loop(.*) " \ <add> "already registered" <add> <add> with self.assertRaisesRegexp(AirflowException, regexp): <add> self.runme_0.set_downstream(self.run_after_loop) <add> <add> with self.assertRaisesRegexp(AirflowException, regexp): <add> self.run_after_loop.set_upstream(self.runme_0) <add> <add> def test_cyclic_dependencies_1(self): <add> <add> regexp = "Cycle detected in DAG. (.*)runme_0(.*)" <add> with self.assertRaisesRegexp(AirflowException, regexp): <add> self.runme_0.set_upstream(self.run_after_loop) <add> <add> def test_cyclic_dependencies_2(self): <add> regexp = "Cycle detected in DAG. (.*)run_after_loop(.*)" <add> with self.assertRaisesRegexp(AirflowException, regexp): <add> self.run_after_loop.set_downstream(self.runme_0) <add> <add> def test_cyclic_dependencies_3(self): <add> regexp = "Cycle detected in DAG. (.*)run_this_last(.*)" <add> with self.assertRaisesRegexp(AirflowException, regexp): <add> self.run_this_last.set_downstream(self.runme_0) <add> <ide> <ide> class CliTests(unittest.TestCase): <ide>
2
Javascript
Javascript
add missing semicolon
f77832499898d970ea665a92333a3ed2ec0d663c
<ide><path>packages/ember-metal/tests/run_loop/unwind_test.js <ide> test('RunLoop unwinds despite unhandled exception', function() { <ide> <ide> raises(function(){ <ide> Ember.run(function() { <del> Ember.run.schedule('actions', function() { throw new Error("boom!") }); <add> Ember.run.schedule('actions', function() { throw new Error("boom!"); }); <ide> }); <ide> }, Error, "boom!"); <ide>
1
Ruby
Ruby
eliminate naked rescue
951b09b1c51e8aded1b4b8d7e9e2c5523dee350c
<ide><path>Library/Homebrew/cmd/link.rb <ide> def link <ide> puts "Note that doing so can interfere with building software." <ide> next <ide> end <del> rescue <del> # Nothing to see here <add> rescue FormulaUnavailableError <ide> end <ide> <ide> keg.lock do
1
Python
Python
improve the docstring of conv3dtranspose
52e3f9835c1a25a8b895773f64524e27a5ae10c0
<ide><path>keras/layers/convolutional.py <ide> class Conv3DTranspose(Conv3D): <ide> filters: Integer, the dimensionality of the output space <ide> (i.e. the number of output filters in the convolution). <ide> kernel_size: An integer or tuple/list of 3 integers, specifying the <del> height and width of the 3D convolution window. <add> depth, height and width of the 3D convolution window. <ide> Can be a single integer to specify the same value for <ide> all spatial dimensions. <ide> strides: An integer or tuple/list of 3 integers, <ide> specifying the strides of the convolution <del> along the height and width. <add> along the depth, height and width. <ide> Can be a single integer to specify the same value for <ide> all spatial dimensions. <ide> Specifying any stride value != 1 is incompatible with specifying
1
Go
Go
move `exportcontainerrw` to the daemon
581380cc6cd26f43fe5e69965873769d8dc739ef
<ide><path>daemon/commit.go <ide> package daemon <ide> <ide> import ( <ide> "github.com/docker/docker/image" <add> "github.com/docker/docker/pkg/archive" <add> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/runconfig" <ide> ) <ide> <ide> func (daemon *Daemon) Commit(container *Container, c *ContainerCommitConfig) (*i <ide> defer container.unpause() <ide> } <ide> <del> rwTar, err := container.exportContainerRw() <add> rwTar, err := daemon.exportContainerRw(container) <ide> if err != nil { <ide> return nil, err <ide> } <ide> func (daemon *Daemon) Commit(container *Container, c *ContainerCommitConfig) (*i <ide> container.logEvent("commit") <ide> return img, nil <ide> } <add> <add>func (daemon *Daemon) exportContainerRw(container *Container) (archive.Archive, error) { <add> archive, err := daemon.diff(container) <add> if err != nil { <add> return nil, err <add> } <add> return ioutils.NewReadCloserWrapper(archive, func() error { <add> err := archive.Close() <add> return err <add> }), <add> nil <add>} <ide><path>daemon/container.go <ide> func (container *Container) getRootResourcePath(path string) (string, error) { <ide> return symlink.FollowSymlinkInScope(filepath.Join(container.root, cleanPath), container.root) <ide> } <ide> <del>func (container *Container) exportContainerRw() (archive.Archive, error) { <del> if container.daemon == nil { <del> return nil, derr.ErrorCodeUnregisteredContainer.WithArgs(container.ID) <del> } <del> archive, err := container.daemon.diff(container) <del> if err != nil { <del> return nil, err <del> } <del> return ioutils.NewReadCloserWrapper(archive, func() error { <del> err := archive.Close() <del> return err <del> }), <del> nil <del>} <del> <ide> // Start prepares the container to run by setting up everything the <ide> // container needs, such as storage and networking, as well as links <ide> // between containers. The container is left waiting for a signal to
2
Javascript
Javascript
prevent non-js merge conflicts in brocfile.js
4e66ab623ac9dcc0722d801e9cc114668e3dfd04
<ide><path>Brocfile.js <ide> function es6Package(packageName) { <ide> <ide> libTree = pickFiles('packages/' + packageName + '/lib', { <ide> srcDir: '/', <add> files: ['**/*.js'], <ide> destDir: packageName <ide> }); <ide> <ide> function es6Package(packageName) { <ide> <ide> var testTree = pickFiles('packages/' + packageName + '/tests', { <ide> srcDir: '/', <add> files: ['**/*.js'], <ide> destDir: '/' + packageName + '/tests' <ide> }); <ide>
1
PHP
PHP
add additional test coverage for createfile()
116062b9abf459195e52f1388e0b6e22319c3177
<ide><path>tests/TestCase/Console/ShellTest.php <ide> public function testShortPath() { <ide> */ <ide> public function testCreateFileNonInteractive() { <ide> $eol = PHP_EOL; <del> <ide> $path = TMP . 'shell_test'; <ide> $file = $path . DS . 'file1.php'; <ide> <ide> new Folder($path, true); <ide> <del> $this->Shell->interactive = false; <del> <ide> $contents = "<?php{$eol}echo 'test';${eol}\$te = 'st';{$eol}"; <ide> $result = $this->Shell->createFile($file, $contents); <ide> $this->assertTrue($result); <ide> $this->assertTrue(file_exists($file)); <ide> $this->assertEquals(file_get_contents($file), $contents); <add> } <add> <add>/** <add> * Test that files are not changed with a 'n' reply. <add> * <add> * @return void <add> */ <add> public function testCreateFileNoReply() { <add> $eol = PHP_EOL; <add> $path = TMP . 'shell_test'; <add> $file = $path . DS . 'file1.php'; <add> <add> new Folder($path, true); <add> <add> $this->Shell->stdin->expects($this->once()) <add> ->method('read') <add> ->will($this->returnValue('n')); <ide> <del> $contents = "<?php\necho 'another test';\n\$te = 'st';\n"; <add> touch($file); <add> $this->assertTrue(file_exists($file)); <add> <add> $contents = "My content"; <add> $result = $this->Shell->createFile($file, $contents); <add> $this->assertTrue(file_exists($file)); <add> $this->assertTextEquals('', file_get_contents($file)); <add> $this->assertFalse($result, 'Did not create file.'); <add> } <add> <add>/** <add> * Test that files are changed with a 'y' reply. <add> * <add> * @return void <add> */ <add> public function testCreateFileOverwrite() { <add> $eol = PHP_EOL; <add> $path = TMP . 'shell_test'; <add> $file = $path . DS . 'file1.php'; <add> <add> new Folder($path, true); <add> <add> $this->Shell->stdin->expects($this->once()) <add> ->method('read') <add> ->will($this->returnValue('y')); <add> <add> touch($file); <add> $this->assertTrue(file_exists($file)); <add> <add> $contents = "My content"; <ide> $result = $this->Shell->createFile($file, $contents); <del> $this->assertTrue($result); <ide> $this->assertTrue(file_exists($file)); <del> $this->assertTextEquals(file_get_contents($file), $contents); <add> $this->assertTextEquals($contents, file_get_contents($file)); <add> $this->assertTrue($result, 'Did create file.'); <ide> } <ide> <ide> /**
1
Java
Java
add systrace support for api 18+ in oss
853d249468b5c2a00dc7eb792e154b0f0541404f
<ide><path>ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java <ide> <ide> package com.facebook.systrace; <ide> <add>import android.os.Build; <add>import android.os.Trace; <add> <ide> /** <del> * Systrace stub. <add> * Systrace stub that mostly does nothing but delegates to Trace for beginning/ending sections. <add> * The internal version of this file has not been opensourced yet. <ide> */ <ide> public class Systrace { <ide> <ide> public static void traceInstant( <ide> } <ide> <ide> public static void beginSection(long tag, final String sectionName) { <add> if (Build.VERSION.SDK_INT >= 18) { <add> Trace.beginSection(sectionName); <add> } <ide> } <ide> <ide> public static void endSection(long tag) { <add> if (Build.VERSION.SDK_INT >= 18) { <add> Trace.endSection(); <add> } <ide> } <ide> <ide> public static void beginAsyncSection(
1
Javascript
Javascript
fix unique reflectnode
f75df95e815b45ca9a807b5563a0234e9798875b
<ide><path>examples/jsm/nodes/accessors/ReflectNode.js <ide> ReflectNode.prototype.generate = function ( builder, output ) { <ide> <ide> if ( isUnique ) { <ide> <del> builder.addNodeCode( `vec3 reflectVec = ${result};` ); <add> builder.addNodeCode( `vec3 reflectVec = ${code};` ); <ide> <ide> result = 'reflectVec'; <ide> <ide> ReflectNode.prototype.generate = function ( builder, output ) { <ide> <ide> if ( isUnique ) { <ide> <del> builder.addNodeCode( `vec3 reflectCubeVec = ${result};` ); <add> builder.addNodeCode( `vec3 reflectCubeVec = ${code};` ); <ide> <ide> result = 'reflectCubeVec'; <ide> <ide> ReflectNode.prototype.generate = function ( builder, output ) { <ide> <ide> if ( isUnique ) { <ide> <del> builder.addNodeCode( `vec2 reflectSphereVec = ${result};` ); <add> builder.addNodeCode( `vec2 reflectSphereVec = ${code};` ); <ide> <ide> result = 'reflectSphereVec'; <ide>
1
Javascript
Javascript
make 5th arg optional for renderchunkmodules
5782d6b16022b16af233af797a2438e589794a10
<ide><path>lib/Template.js <ide> class Template { <ide> * @param {ModuleFilterPredicate} filterFn function used to filter modules from chunk to render <ide> * @param {any} moduleTemplate ModuleTemplate instance used to render modules <ide> * @param {any | any[]} dependencyTemplates templates needed for each module to render dependencies <del> * @param {string} prefix applying prefix strings <add> * @param {string=} prefix applying prefix strings <ide> * @return {ConcatSource} rendered chunk modules in a Source object <ide> */ <ide> static renderChunkModules(
1
Javascript
Javascript
resolve a763ae72 test failures
30e2ffbeb869bb2f65ef139633c68a1c62f0e892
<ide><path>test/unit/manipulation.js <ide> var testAppend = function( valueObj ) { <ide> d.remove(); <ide> equal( jQuery("#nonnodes").contents().length, 3, "Check node,textnode,comment append cleanup worked" ); <ide> <del> $input = jQuery("<input />").attr({ <del> "type": "checkbox", <del> "checked": true <del> }).appendTo("#testForm"); <add> $input = jQuery("<input type='checkbox'/>").prop( "checked", true ).appendTo("#testForm"); <ide> equal( $input[ 0 ].checked, true, "A checked checkbox that is appended stays checked" ); <ide> <ide> $radioChecked = jQuery("input:radio[name='R1']").eq( 1 );
1
Python
Python
fix issues with see also sections of generic
5fe30a63923f8060913e3d4e9e8b99a3a83bf9c4
<ide><path>numpy/core/_add_newdocs.py <ide> albeit unimplemented, all the attributes of the ndarray class so as to <ide> provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class so as to <ide> a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class so as to <ide> provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class so as to <ide> provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide> <ide> albeit unimplemented, all the attributes of the ndarray class <ide> so as to provide a uniform API. <ide> <del> See Also <del> -------- <del> The corresponding attribute of the derived class of interest. <add> See also the corresponding attribute of the derived class of interest. <ide> <ide> """)) <ide>
1
Java
Java
turn flatviewmanager into viewgroupmanager
ad74dabb68e62bd3ccbb63ab5bc024f78b3a4b5d
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java <ide> public LayoutShadowNode createShadowNodeInstance() { <ide> } <ide> <ide> @Override <del> public Class<LayoutShadowNode> getShadowNodeClass() { <add> public Class<? extends LayoutShadowNode> getShadowNodeClass() { <ide> return LayoutShadowNode.class; <ide> } <ide>
1
Python
Python
convert more node states
446300d88de9087fe8e3e6544d22140aa23ecc28
<ide><path>libcloud/compute/drivers/azure_arm.py <ide> def _to_node(self, data, fetch_nic=True): <ide> r = self.connection.request(action, <ide> params={"api-version": "2015-06-15"}) <ide> for status in r.object["statuses"]: <del> if status["code"] == "ProvisioningState/creating": <add> if status["code"] in ["ProvisioningState/creating", <add> "ProvisioningState/updating"]: <ide> state = NodeState.PENDING <ide> break <ide> elif status["code"] == "ProvisioningState/deleting": <ide> def _to_node(self, data, fetch_nic=True): <ide> if status["code"] == "PowerState/deallocated": <ide> state = NodeState.STOPPED <ide> break <add> elif status["code"] == "PowerState/stopped": <add> state = NodeState.PAUSED <add> break <ide> elif status["code"] == "PowerState/deallocating": <ide> state = NodeState.PENDING <ide> break
1
Python
Python
ensure graceful handling of large header sizes
81bc4565b50c6cebb21c95c685285e32e1fb9b65
<ide><path>numpy/lib/format.py <ide> (3, 0): ('<I', 'utf8'), <ide> } <ide> <add># Python's literal_eval is not actually safe for large inputs, since parsing <add># may become slow or even cause interpreter crashes. <add># This is an arbitrary, low limit which should make it safe in practice. <add>_MAX_HEADER_SIZE = 10000 <ide> <ide> def _check_version(version): <ide> if version not in [(1, 0), (2, 0), (3, 0), None]: <ide> def write_array_header_2_0(fp, d): <ide> """ <ide> _write_array_header(fp, d, (2, 0)) <ide> <del>def read_array_header_1_0(fp): <add>def read_array_header_1_0(fp, max_header_size=_MAX_HEADER_SIZE): <ide> """ <ide> Read an array header from a filelike object using the 1.0 file format <ide> version. <ide> def read_array_header_1_0(fp): <ide> contiguous before writing it out. <ide> dtype : dtype <ide> The dtype of the file's data. <add> max_header_size : int, optional <add> Maximum allowed size of the header. Large headers may not be safe <add> to load securely and thus require explicitly passing a larger value. <add> See :py:meth:`ast.literal_eval()` for details. <ide> <ide> Raises <ide> ------ <ide> ValueError <ide> If the data is invalid. <ide> <ide> """ <del> return _read_array_header(fp, version=(1, 0)) <add> return _read_array_header( <add> fp, version=(1, 0), max_header_size=max_header_size) <ide> <del>def read_array_header_2_0(fp): <add>def read_array_header_2_0(fp, max_header_size=_MAX_HEADER_SIZE): <ide> """ <ide> Read an array header from a filelike object using the 2.0 file format <ide> version. <ide> def read_array_header_2_0(fp): <ide> ---------- <ide> fp : filelike object <ide> A file object or something with a `.read()` method like a file. <add> max_header_size : int, optional <add> Maximum allowed size of the header. Large headers may not be safe <add> to load securely and thus require explicitly passing a larger value. <add> See :py:meth:`ast.literal_eval()` for details. <ide> <ide> Returns <ide> ------- <ide> def read_array_header_2_0(fp): <ide> If the data is invalid. <ide> <ide> """ <del> return _read_array_header(fp, version=(2, 0)) <add> return _read_array_header( <add> fp, version=(2, 0), max_header_size=max_header_size) <ide> <ide> <ide> def _filter_header(s): <ide> def _filter_header(s): <ide> return tokenize.untokenize(tokens) <ide> <ide> <del>def _read_array_header(fp, version): <add>def _read_array_header(fp, version, max_header_size=_MAX_HEADER_SIZE): <ide> """ <ide> see read_array_header_1_0 <ide> """ <ide> def _read_array_header(fp, version): <ide> header_length = struct.unpack(hlength_type, hlength_str)[0] <ide> header = _read_bytes(fp, header_length, "array header") <ide> header = header.decode(encoding) <add> if len(header) > max_header_size: <add> raise ValueError( <add> f"Header info length ({len(header)}) is large and may not be safe " <add> "to load securely.\n" <add> "To allow loading, adjust `max_header_size` or fully trust " <add> "the `.npy` file using `allow_pickle=True`.\n" <add> "For safety against large resource use or crashes, sandboxing " <add> "may be necessary.") <ide> <ide> # The header is a pretty-printed string representation of a literal <ide> # Python dictionary with trailing newlines padded to a ARRAY_ALIGN byte <ide> def write_array(fp, array, version=None, allow_pickle=True, pickle_kwargs=None): <ide> fp.write(chunk.tobytes('C')) <ide> <ide> <del>def read_array(fp, allow_pickle=False, pickle_kwargs=None): <add>def read_array(fp, allow_pickle=False, pickle_kwargs=None, *, <add> max_header_size=_MAX_HEADER_SIZE): <ide> """ <ide> Read an array from an NPY file. <ide> <ide> def read_array(fp, allow_pickle=False, pickle_kwargs=None): <ide> Additional keyword arguments to pass to pickle.load. These are only <ide> useful when loading object arrays saved on Python 2 when using <ide> Python 3. <add> max_header_size : int, optional <add> Maximum allowed size of the header. Large headers may not be safe <add> to load securely and thus require explicitly passing a larger value. <add> See :py:meth:`ast.literal_eval()` for details. <add> This option is ignored when `allow_pickle` is passed. In that case <add> the file is by definition trusted and the limit is unnecessary. <ide> <ide> Returns <ide> ------- <ide> def read_array(fp, allow_pickle=False, pickle_kwargs=None): <ide> an object array. <ide> <ide> """ <add> if allow_pickle: <add> # Effectively ignore max_header_size, since `allow_pickle` indicates <add> # that the input is fully trusted. <add> max_header_size = 2**64 <add> <ide> version = read_magic(fp) <ide> _check_version(version) <del> shape, fortran_order, dtype = _read_array_header(fp, version) <add> shape, fortran_order, dtype = _read_array_header( <add> fp, version, max_header_size=max_header_size) <ide> if len(shape) == 0: <ide> count = 1 <ide> else: <ide> def read_array(fp, allow_pickle=False, pickle_kwargs=None): <ide> <ide> <ide> def open_memmap(filename, mode='r+', dtype=None, shape=None, <del> fortran_order=False, version=None): <add> fortran_order=False, version=None, *, <add> max_header_size=_MAX_HEADER_SIZE): <ide> """ <ide> Open a .npy file as a memory-mapped array. <ide> <ide> def open_memmap(filename, mode='r+', dtype=None, shape=None, <ide> If the mode is a "write" mode, then this is the version of the file <ide> format used to create the file. None means use the oldest <ide> supported version that is able to store the data. Default: None <add> max_header_size : int, optional <add> Maximum allowed size of the header. Large headers may not be safe <add> to load securely and thus require explicitly passing a larger value. <add> See :py:meth:`ast.literal_eval()` for details. <ide> <ide> Returns <ide> ------- <ide> def open_memmap(filename, mode='r+', dtype=None, shape=None, <ide> version = read_magic(fp) <ide> _check_version(version) <ide> <del> shape, fortran_order, dtype = _read_array_header(fp, version) <add> shape, fortran_order, dtype = _read_array_header( <add> fp, version, max_header_size=max_header_size) <ide> if dtype.hasobject: <ide> msg = "Array can't be memory-mapped: Python objects in dtype." <ide> raise ValueError(msg) <ide><path>numpy/lib/npyio.py <ide> class NpzFile(Mapping): <ide> Additional keyword arguments to pass on to pickle.load. <ide> These are only useful when loading object arrays saved on <ide> Python 2 when using Python 3. <add> max_header_size : int, optional <add> Maximum allowed size of the header. Large headers may not be safe <add> to load securely and thus require explicitly passing a larger value. <add> See :py:meth:`ast.literal_eval()` for details. <add> This option is ignored when `allow_pickle` is passed. In that case <add> the file is by definition trusted and the limit is unnecessary. <ide> <ide> Parameters <ide> ---------- <ide> class NpzFile(Mapping): <ide> fid = None <ide> <ide> def __init__(self, fid, own_fid=False, allow_pickle=False, <del> pickle_kwargs=None): <add> pickle_kwargs=None, *, <add> max_header_size=format._MAX_HEADER_SIZE): <ide> # Import is postponed to here since zipfile depends on gzip, an <ide> # optional component of the so-called standard library. <ide> _zip = zipfile_factory(fid) <ide> self._files = _zip.namelist() <ide> self.files = [] <ide> self.allow_pickle = allow_pickle <add> self.max_header_size = max_header_size <ide> self.pickle_kwargs = pickle_kwargs <ide> for x in self._files: <ide> if x.endswith('.npy'): <ide> def __getitem__(self, key): <ide> bytes = self.zip.open(key) <ide> return format.read_array(bytes, <ide> allow_pickle=self.allow_pickle, <del> pickle_kwargs=self.pickle_kwargs) <add> pickle_kwargs=self.pickle_kwargs, <add> max_header_size=self.max_header_size) <ide> else: <ide> return self.zip.read(key) <ide> else: <ide> def __getitem__(self, key): <ide> <ide> @set_module('numpy') <ide> def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, <del> encoding='ASCII'): <add> encoding='ASCII', *, max_header_size=format._MAX_HEADER_SIZE): <ide> """ <ide> Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. <ide> <ide> def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, <ide> npy/npz files containing object arrays. Values other than 'latin1', <ide> 'ASCII', and 'bytes' are not allowed, as they can corrupt numerical <ide> data. Default: 'ASCII' <add> max_header_size : int, optional <add> Maximum allowed size of the header. Large headers may not be safe <add> to load securely and thus require explicitly passing a larger value. <add> See :py:meth:`ast.literal_eval()` for details. <add> This option is ignored when `allow_pickle` is passed. In that case <add> the file is by definition trusted and the limit is unnecessary. <ide> <ide> Returns <ide> ------- <ide> def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True, <ide> # Potentially transfer file ownership to NpzFile <ide> stack.pop_all() <ide> ret = NpzFile(fid, own_fid=own_fid, allow_pickle=allow_pickle, <del> pickle_kwargs=pickle_kwargs) <add> pickle_kwargs=pickle_kwargs, <add> max_header_size=max_header_size) <ide> return ret <ide> elif magic == format.MAGIC_PREFIX: <ide> # .npy file <ide> if mmap_mode: <del> return format.open_memmap(file, mode=mmap_mode) <add> if allow_pickle: <add> max_header_size = 2**64 <add> return format.open_memmap(file, mode=mmap_mode, <add> max_header_size=max_header_size) <ide> else: <ide> return format.read_array(fid, allow_pickle=allow_pickle, <del> pickle_kwargs=pickle_kwargs) <add> pickle_kwargs=pickle_kwargs, <add> max_header_size=max_header_size) <ide> else: <ide> # Try a pickle <ide> if not allow_pickle: <ide><path>numpy/lib/tests/test_format.py <ide> def test_long_str(): <ide> assert_array_equal(long_str_arr, long_str_arr2) <ide> <ide> <add>@pytest.mark.slow <ide> def test_memmap_roundtrip(tmpdir): <ide> for i, arr in enumerate(basic_arrays + record_arrays): <ide> if arr.dtype.hasobject: <ide> def test_version_2_0(): <ide> assert_(len(header) % format.ARRAY_ALIGN == 0) <ide> <ide> f.seek(0) <del> n = format.read_array(f) <add> n = format.read_array(f, max_header_size=200000) <ide> assert_array_equal(d, n) <ide> <ide> # 1.0 requested but data cannot be saved this way <ide> def test_version_2_0_memmap(tmpdir): <ide> shape=d.shape, version=(2, 0)) <ide> ma[...] = d <ide> ma.flush() <del> ma = format.open_memmap(tf1, mode='r') <add> ma = format.open_memmap(tf1, mode='r', max_header_size=200000) <ide> assert_array_equal(ma, d) <ide> <ide> with warnings.catch_warnings(record=True) as w: <ide> def test_version_2_0_memmap(tmpdir): <ide> ma[...] = d <ide> ma.flush() <ide> <del> ma = format.open_memmap(tf2, mode='r') <add> ma = format.open_memmap(tf2, mode='r', max_header_size=200000) <add> <ide> assert_array_equal(ma, d) <ide> <add>@pytest.mark.parametrize("mmap_mode", ["r", None]) <add>def test_huge_header(tmpdir, mmap_mode): <add> f = os.path.join(tmpdir, f'large_header.npy') <add> arr = np.array(1, dtype="i,"*10000+"i") <add> <add> with pytest.warns(UserWarning, match=".*format 2.0"): <add> np.save(f, arr) <add> <add> with pytest.raises(ValueError, match="Header.*large"): <add> np.load(f, mmap_mode=mmap_mode) <add> <add> with pytest.raises(ValueError, match="Header.*large"): <add> np.load(f, mmap_mode=mmap_mode, max_header_size=20000) <add> <add> res = np.load(f, mmap_mode=mmap_mode, allow_pickle=True) <add> assert_array_equal(res, arr) <add> <add> res = np.load(f, mmap_mode=mmap_mode, max_header_size=180000) <add> assert_array_equal(res, arr) <add> <add>def test_huge_header_npz(tmpdir): <add> f = os.path.join(tmpdir, f'large_header.npz') <add> arr = np.array(1, dtype="i,"*10000+"i") <add> <add> with pytest.warns(UserWarning, match=".*format 2.0"): <add> np.savez(f, arr=arr) <add> <add> # Only getting the array from the file actually reads it <add> with pytest.raises(ValueError, match="Header.*large"): <add> np.load(f)["arr"] <add> <add> with pytest.raises(ValueError, match="Header.*large"): <add> np.load(f, max_header_size=20000)["arr"] <add> <add> res = np.load(f, allow_pickle=True)["arr"] <add> assert_array_equal(res, arr) <add> <add> res = np.load(f, max_header_size=180000)["arr"] <add> assert_array_equal(res, arr) <ide> <ide> def test_write_version(): <ide> f = BytesIO() <ide><path>numpy/lib/utils.py <ide> def safe_eval(source): <ide> Evaluate a string containing a Python literal expression without <ide> allowing the execution of arbitrary non-literal code. <ide> <add> .. warning:: <add> <add> This function is identical to :py:meth:`ast.literal_eval` and <add> has the same security implications. It may not always be safe <add> to evaluate large input strings. <add> <ide> Parameters <ide> ---------- <ide> source : str
4
Text
Text
remove references to ie 8 in docs
ee03c19b3b21a644a477f60132376207cda7c6f1
<ide><path>docs/docs/03-interactivity-and-dynamic-uis.md <ide> ReactDOM.render( <ide> <ide> ## Event Handling and Synthetic Events <ide> <del>With React you simply pass your event handler as a camelCased prop similar to how you'd do it in normal HTML. React ensures that all events behave identically in IE8 and above by implementing a synthetic event system. That is, React knows how to bubble and capture events according to the spec, and the events passed to your event handler are guaranteed to be consistent with [the W3C spec](http://www.w3.org/TR/DOM-Level-3-Events/), regardless of which browser you're using. <add>With React you simply pass your event handler as a camelCased prop similar to how you'd do it in normal HTML. React ensures that all events behave similarly in all browsers by implementing a synthetic event system. That is, React knows how to bubble and capture events according to the spec, and the events passed to your event handler are guaranteed to be consistent with [the W3C spec](http://www.w3.org/TR/DOM-Level-3-Events/), regardless of which browser you're using. <ide> <ide> ## Under the Hood: Autobinding and Event Delegation <ide> <ide><path>docs/docs/08-working-with-the-browser.md <ide> React provides powerful abstractions that free you from touching the DOM directl <ide> <ide> React is very fast because it never talks to the DOM directly. React maintains a fast in-memory representation of the DOM. `render()` methods actually return a *description* of the DOM, and React can compare this description with the in-memory representation to compute the fastest way to update the browser. <ide> <del>Additionally, React implements a full synthetic event system such that all event objects are guaranteed to conform to the W3C spec despite browser quirks, and everything bubbles consistently and efficiently across browsers. You can even use some HTML5 events in IE8! <add>Additionally, React implements a full synthetic event system such that all event objects are guaranteed to conform to the W3C spec despite browser quirks, and everything bubbles consistently and efficiently across browsers. You can even use some HTML5 events in older browsers that don't ordinarily support them! <ide> <ide> Most of the time you should stay within React's "faked browser" world since it's more performant and easier to reason about. However, sometimes you simply need to access the underlying API, perhaps to work with a third-party library like a jQuery plugin. React provides escape hatches for you to use the underlying DOM API directly. <ide> <ide> _Mounted_ composite components also support the following method: <ide> <ide> * `component.forceUpdate()` can be invoked on any mounted component when you know that some deeper aspect of the component's state has changed without using `this.setState()`. <ide> <del>## Browser Support and Polyfills <add>## Browser Support <ide> <del>At Facebook, we support older browsers, including IE8. We've had polyfills in place for a long time to allow us to write forward-thinking JS. This means we don't have a bunch of hacks scattered throughout our codebase and we can still expect our code to "just work". For example, instead of seeing `+new Date()`, we can just write `Date.now()`. Since the open source React is the same as what we use internally, we've carried over this philosophy of using forward thinking JS. <add>React supports most popular browsers, including Internet Explorer 9 and above. <ide> <del>In addition to that philosophy, we've also taken the stance that we, as authors of a JS library, should not be shipping polyfills as a part of our library. If every library did this, there's a good chance you'd be sending down the same polyfill multiple times, which could be a sizable chunk of dead code. If your product needs to support older browsers, chances are you're already using something like [es5-shim](https://github.com/es-shims/es5-shim). <del> <del>### Polyfills Needed to Support Older Browsers <del> <del>`es5-shim.js` from [kriskowal's es5-shim](https://github.com/es-shims/es5-shim) provides the following that React needs: <del> <del>* `Array.isArray` <del>* `Array.prototype.every` <del>* `Array.prototype.forEach` <del>* `Array.prototype.indexOf` <del>* `Array.prototype.map` <del>* `Date.now` <del>* `Function.prototype.bind` <del>* `Object.keys` <del>* `String.prototype.split` <del>* `String.prototype.trim` <del> <del>`es5-sham.js`, also from [kriskowal's es5-shim](https://github.com/es-shims/es5-shim), provides the following that React needs: <del> <del>* `Object.create` <del>* `Object.freeze` <del> <del>The unminified build of React needs the following from [paulmillr's console-polyfill](https://github.com/paulmillr/console-polyfill). <del> <del>* `console.*` <del> <del>When using HTML5 elements in IE8 including `<section>`, `<article>`, `<nav>`, `<header>`, and `<footer>`, it's also necessary to include [html5shiv](https://github.com/aFarkas/html5shiv) or a similar script. <del> <del>### Cross-browser Issues <del> <del>Although React is pretty good at abstracting browser differences, some browsers are limited or present quirky behaviors that we couldn't find a workaround for. <del> <del>#### onScroll event on IE8 <del> <del>On IE8 the `onScroll` event doesn't bubble and IE8 doesn't have an API to define handlers to the capturing phase of an event, meaning there is no way for React to listen to these events. <del>Currently a handler to this event is ignored on IE8. <del> <del>See the [onScroll doesn't work in IE8](https://github.com/facebook/react/issues/631) GitHub issue for more information. <add>(We don't support older browsers that don't support ES5 methods, but you may find that your apps do work in older browsers if polyfills such as [es5-shim and es5-sham](https://github.com/es-shims/es5-shim) are included in the page. You're on your own if you choose to take this path.) <ide><path>docs/docs/ref-04-tags-and-attributes.md <ide> circle clipPath defs ellipse g line linearGradient mask path pattern polygon pol <ide> radialGradient rect stop svg text tspan <ide> ``` <ide> <del>You may also be interested in [react-art](https://github.com/facebook/react-art), a drawing library for React that can render to Canvas, SVG, or VML (for IE8). <add>You may also be interested in [react-art](https://github.com/facebook/react-art), a cross-browser drawing library for React. <ide> <ide> <ide> ## Supported Attributes
3
Ruby
Ruby
reset column information after schema changed
56de573131cce08079c30d7631395726104eea1b
<ide><path>activerecord/test/cases/associations/belongs_to_associations_test.rb <ide> def test_raises_type_mismatch_with_namespaced_class <ide> remove_column :admin_users, :region_id if column_exists?(:admin_users, :region_id) <ide> drop_table :admin_regions, if_exists: true <ide> end <add> <add> Admin::User.reset_column_information <ide> end <ide> <ide> def test_natural_assignment <ide><path>activerecord/test/cases/null_relation_test.rb <add># frozen_string_literal: true <add> <ide> require "cases/helper" <ide> require "models/developer" <ide> require "models/comment"
2
Text
Text
add documentation for test common module
2cfd7fd8f9a2206a0cce0e9f6fa92850fbdbb4e3
<ide><path>test/README.md <del># Tests <add># Table of Contents <add>* [Test directories](#test-directories) <add>* [Common module API](#common-module-api) <add> <add>## Test Directories <ide> <ide> ### abort <ide> <ide> and `setInterval`). <ide> | Runs on CI | <ide> |:----------:| <ide> | No | <add> <add> <add>## Common module API <add> <add>The common.js module is used by tests for consistency across repeated <add>tasks. It has a number of helpful functions and properties to help with <add>writing tests. <add> <add>### allowGlobals(...whitelist) <add>* `whitelist` [&lt;Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) Array of Globals <add>* return [&lt;Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) <add> <add>Takes `whitelist` and concats that with predefined `knownGlobals`. <add> <add>### arrayStream <add>A stream to push an array into a REPL <add> <add>### busyLoop(time) <add>* `time` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) <add> <add>Blocks for `time` amount of time. <add> <add>### ddCommand(filename, kilobytes) <add>* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add> <add>Platform normalizes the `dd` command <add> <add>### enoughTestMem <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Check if there is more than 1gb of total memory. <add> <add>### expectWarning(name, expected) <add>* `name` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add>* `expected` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [&lt;Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) <add> <add>Tests whether `name` and `expected` are part of a raised warning. <add> <add>### hasCrypto <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks for 'openssl'. <add> <add>### hasFipsCrypto <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks `hasCrypto` and `crypto` with fips. <add> <add>### hasIPv6 <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks whether `IPv6` is supported on this platform. <add> <add>### hasMultiLocalhost <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks if there are multiple localhosts available. <add> <add>### fail(msg) <add>* `msg` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Throws an `AssertionError` with `msg` <add> <add>### faketimeCli <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Return the path to the fake. <add> <add>### fileExists(pathname) <add>* pathname [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks if `pathname` exists <add> <add>### fixturesDir <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Path to the 'fixtures' directory. <add> <add>### globalCheck <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Turn this off if the test should not check for global leaks. <add> <add>### inFreeBSDJail <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks whether free BSD Jail is true or false. <add> <add>### isAix <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for Advanced Interactive eXecutive (AIX). <add> <add>### isAlive(pid) <add>* `pid` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Attempts to 'kill' `pid` <add> <add>### isFreeBSD <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for Free BSD. <add> <add>### isLinux <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for Linux. <add> <add>### isLinuxPPCBE <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for Linux on PowerPC. <add> <add>### isOSX <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for OS X. <add> <add>### isSunOS <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for SunOS. <add> <add>### isWindows <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for Windows. <add> <add>### isWOW64 <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Platform check for Windows 32-bit on Windows 64-bit. <add> <add>### leakedGlobals <add>* return [&lt;Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) <add> <add>Checks whether any globals are not on the `knownGlobals` list. <add> <add>### libDir <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Path to the 'lib' directory. <add> <add>### localhostIPv4 <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Gets IP of localhost <add> <add>### localIPv6Hosts <add>* return [&lt;Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) <add> <add>Array of IPV6 hosts. <add> <add>### mustCall(fn[, expected]) <add>* fn [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) <add>* expected [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 <add> <add>Number of times `fn` should be called. <add> <add>### nodeProcessAborted(exitCode, signal) <add>* `exitCode` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) <add>* `signal` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. <add> <add>### opensslCli <add>* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) <add> <add>Checks whether 'opensslCli' is supported. <add> <add>### platformTimeout(ms) <add>* `ms` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) <add>* return [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) <add> <add>Platform normalizes timeout. <add> <add>### PIPE <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Path to the test sock. <add> <add>### PORT <add>* return [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = `12346` <add> <add>Port tests are running on. <add> <add>### refreshTmpDir <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Deletes the 'tmp' dir and recreates it <add> <add>### rootDir <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Path to the 'root' directory. either `/` or `c:\\` (windows) <add> <add>### skip(msg) <add>* `msg` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Logs '1..0 # Skipped: ' + `msg` <add> <add>### spawnCat(options) <add>* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add>* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add> <add>Platform normalizes the `cat` command. <add> <add>### spawnPwd(options) <add>* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add>* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add> <add>Platform normalizes the `pwd` command. <add> <add>### spawnSyncCat(options) <add>* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add>* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add> <add>Synchronous version of `spawnCat`. <add> <add>### spawnSyncPwd(options) <add>* `options` [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add>* return [&lt;Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) <add> <add>Synchronous version of `spawnPwd`. <add> <add>### testDir <add> <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Path to the 'test' directory. <add> <add>### tmpDir <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Path to the 'tmp' directory. <add> <add>### tmpDirName <add>* return [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) <add> <add>Name of the temp directory used by tests.
1
Text
Text
improve text in async_hooks.md
8d336dd8b1268f2b23f72999ebbd54f1c12263b8
<ide><path>doc/api/async_hooks.md <ide> instances and asynchronous work scheduled by them. <ide> <ide> Users are able to define their own `type` when using the public embedder API. <ide> <del>*Note:* It is possible to have type name collisions. Embedders are encouraged <del>to use unique prefixes, such as the npm package name, to prevent collisions <del>when listening to the hooks. <add>It is possible to have type name collisions. Embedders are encouraged to use <add>unique prefixes, such as the npm package name, to prevent collisions when <add>listening to the hooks. <ide> <ide> ###### `triggerId` <ide> <ide> TCPWRAP(4): trigger: 2 execution: 0 <ide> The `TCPSERVERWRAP` is the server which receives the connections. <ide> <ide> The `TCPWRAP` is the new connection from the client. When a new <del>connection is made the `TCPWrap` instance is immediately constructed. This <del>happens outside of any JavaScript stack (side note: a `executionAsyncId()` of <del>`0` means it's being executed from C++, with no JavaScript stack above it). <del>With only that information, it would be impossible to link resources together in <add>connection is made, the `TCPWrap` instance is immediately constructed. This <add>happens outside of any JavaScript stack. (An `executionAsyncId()` of `0` means <add>that it is being executed from C++ with no JavaScript stack above it). With only <add>that information, it would be impossible to link resources together in <ide> terms of what caused them to be created, so `triggerAsyncId` is given the task <ide> of propagating what resource is responsible for the new resource's existence. <ide> <ide> it only once. <ide> <ide> Called immediately after the callback specified in `before` is completed. <ide> <del>*Note:* If an uncaught exception occurs during execution of the callback, then <del>`after` will run *after* the `'uncaughtException'` event is emitted or a <del>`domain`'s handler runs. <add>If an uncaught exception occurs during execution of the callback, then `after` <add>will run *after* the `'uncaughtException'` event is emitted or a `domain`'s <add>handler runs. <ide> <ide> <ide> ##### `destroy(asyncId)` <ide> Called immediately after the callback specified in `before` is completed. <ide> Called after the resource corresponding to `asyncId` is destroyed. It is also <ide> called asynchronously from the embedder API `emitDestroy()`. <ide> <del>*Note:* Some resources depend on garbage collection for cleanup, so if a <del>reference is made to the `resource` object passed to `init` it is possible that <del>`destroy` will never be called, causing a memory leak in the application. If <del>the resource does not depend on garbage collection, then this will not be an <del>issue. <add>Some resources depend on garbage collection for cleanup, so if a reference is <add>made to the `resource` object passed to `init` it is possible that `destroy` <add>will never be called, causing a memory leak in the application. If the resource <add>does not depend on garbage collection, then this will not be an issue. <ide> <ide> ##### `promiseResolve(asyncId)` <ide> <ide> invoked (either directly or through other means of resolving a promise). <ide> <ide> Note that `resolve()` does not do any observable synchronous work. <ide> <del>*Note:* This does not necessarily mean that the `Promise` is fulfilled or <del>rejected at this point, if the `Promise` was resolved by assuming the state <del>of another `Promise`. <add>The `Promise` is not necessarily fulfilled or rejected at this point if the <add>`Promise` was resolved by assuming the state of another `Promise`. <ide> <ide> ```js <ide> new Promise((resolve) => resolve(true)).then((a) => {});
1
Python
Python
change version to glances 2.7
a9ba618e9171ac2d74d8106c758af27b1b3640b4
<ide><path>glances/__init__.py <ide> <ide> # Global name <ide> __appname__ = 'glances' <del>__version__ = '2.7_RC1' <add>__version__ = '2.7_' <ide> __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' <ide> __license__ = 'LGPL' <ide>
1
Javascript
Javascript
fix wrong links in source code
297c9b5b89a6e20d83631170e3c2f71448046bbd
<ide><path>src/Injector.js <ide> * <ide> * @description <ide> * Creates an inject function that can be used for dependency injection. <del> * (See {@link guide.di dependency injection}) <add> * (See {@link guide/di dependency injection}) <ide> * <ide> * The inject function can be used for retrieving service instances or for calling any function <ide> * which has the $inject property so that the services can be automatically provided. Angular <ide><path>src/directives.js <ide> * before the template enters execution mode during bootstrap. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval. <add> * @param {expression} expression {@link guide/expression Expression} to eval. <ide> * <ide> * @example <ide> <doc:example> <ide> angularDirective("ng:init", function(expression){ <ide> * <ide> * @element ANY <ide> * @param {expression} expression Name of a globally accessible constructor function or an <del> * {@link guide.expression expression} that on the current scope evaluates to a constructor <add> * {@link guide/expression expression} that on the current scope evaluates to a constructor <ide> * function. <ide> * <ide> * @example <ide> angularDirective("ng:controller", function(expression){ <ide> * without displaying the result to the user. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval. <add> * @param {expression} expression {@link guide/expression Expression} to eval. <ide> * <ide> * @example <ide> * Notice that `{{` `obj.multiplied = obj.a * obj.b` `}}` has a side effect of assigning <ide> angularDirective("ng:eval", function(expression){ <ide> * `<span ng:bind="expression"></span>` at bootstrap time. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval. <add> * @param {expression} expression {@link guide/expression Expression} to eval. <ide> * <ide> * @example <ide> * You can try it right here: enter text in the text box and watch the greeting change. <ide> var REMOVE_ATTRIBUTES = { <ide> * @name angular.directive.ng:bind-attr <ide> * <ide> * @description <del> * The `ng:bind-attr` attribute specifies that {@link guide.data-binding databindings} should be <add> * The `ng:bind-attr` attribute specifies that {@link guide/data-binding databindings} should be <ide> * created between element attributes and given expressions. Unlike `ng:bind` the `ng:bind-attr` <ide> * contains a JSON key value pairs representing which attributes need to be mapped to which <del> * {@link guide.expression expressions}. <add> * {@link guide/expression expressions}. <ide> * <ide> * You don't usually write the `ng:bind-attr` in the HTML since embedding <ide> * <tt ng:non-bindable>{{expression}}</tt> into the attribute directly as the attribute value is <ide> angularDirective("ng:bind-attr", function(expression){ <ide> * element is clicked. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval upon click. <add> * @param {expression} expression {@link guide/expression Expression} to eval upon click. <ide> * <ide> * @example <ide> <doc:example> <ide> angularDirective("ng:click", function(expression, element){ <ide> * server and reloading the current page). <ide> * <ide> * @element form <del> * @param {expression} expression {@link guide.expression Expression} to eval. <add> * @param {expression} expression {@link guide/expression Expression} to eval. <ide> * <ide> * @example <ide> <doc:example> <ide> function ngClass(selector) { <ide> * conditionally. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval. <add> * @param {expression} expression {@link guide/expression Expression} to eval. <ide> * <ide> * @example <ide> <doc:example> <ide> angularDirective("ng:class", ngClass(function(){return true;})); <ide> * and takes affect only on odd (even) rows. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval. Must be inside <add> * @param {expression} expression {@link guide/expression Expression} to eval. Must be inside <ide> * `ng:repeat`. <ide> * <ide> * @example <ide> angularDirective("ng:class-odd", ngClass(function(i){return i % 2 === 0;})); <ide> * and takes affect only on odd (even) rows. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} to eval. Must be inside <add> * @param {expression} expression {@link guide/expression Expression} to eval. Must be inside <ide> * `ng:repeat`. <ide> * <ide> * @example <ide> angularDirective("ng:class-even", ngClass(function(i){return i % 2 === 1;})); <ide> * conditionally. <ide> * <ide> * @element ANY <del> * @param {expression} expression If the {@link guide.expression expression} is truthy then the element <add> * @param {expression} expression If the {@link guide/expression expression} is truthy then the element <ide> * is shown or hidden respectively. <ide> * <ide> * @example <ide> angularDirective("ng:show", function(expression, element){ <ide> * of the HTML conditionally. <ide> * <ide> * @element ANY <del> * @param {expression} expression If the {@link guide.expression expression} truthy then the element <add> * @param {expression} expression If the {@link guide/expression expression} truthy then the element <ide> * is shown or hidden respectively. <ide> * <ide> * @example <ide> angularDirective("ng:hide", function(expression, element){ <ide> * The ng:style allows you to set CSS style on an HTML element conditionally. <ide> * <ide> * @element ANY <del> * @param {expression} expression {@link guide.expression Expression} which evals to an object whose <add> * @param {expression} expression {@link guide/expression Expression} which evals to an object whose <ide> * keys are CSS style names and values are corresponding values for those CSS keys. <ide> * <ide> * @example
2
Javascript
Javascript
remove double calls where possible
ae5e23310e64db99ddefbf4904f74a42906d6451
<ide><path>lib/repl.js <ide> function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) { <ide> function(e, ret) { <ide> if (e && !isSyntaxError(e)) return finish(e); <ide> <del> if (typeof ret === 'function' || e) { <add> if (typeof ret === 'function' && <add> /^[\r\n\s]*function/.test(evalCmd) || <add> e) { <ide> // Now as statement without parens. <ide> self.eval(evalCmd, self.context, 'repl', finish); <ide> } else { <ide><path>test/simple/test-repl.js <ide> function error_test() { <ide> expect: prompt_unix }, <ide> { client: client_unix, send: 'blah()', <ide> expect: '1\n' + prompt_unix }, <add> // Functions should not evaluate twice (#2773) <add> { client: client_unix, send: 'var I = [1,2,3,function() {}]; I.pop()', <add> expect: '[Function]' }, <ide> // Multiline object <ide> { client: client_unix, send: '{ a: ', <ide> expect: prompt_multiline },
2
Text
Text
fix typo in the changelog
cdf74eb5a00ceecfc52f1bc1b37e4a5f0f52452b
<ide><path>actionview/CHANGELOG.md <ide> <ide> *Paul Nikitochkin* <ide> <del>* Only cache template digests if `config.cache_template_loading` id true. <add>* Only cache template digests if `config.cache_template_loading` is true. <ide> <ide> *Josh Lauer*, *Justin Ridgewell* <ide>
1
Python
Python
change int to str for cpu in limits
24c8c3451ddff740d3c85cca5469a1df8ef2c381
<ide><path>libcloud/compute/drivers/kubevirt.py <ide> def create_node(self, name, image, location=None, ex_memory=128, ex_cpu=1, <ide> vm['spec']['template']['spec']['domain']['resources'][ <ide> 'limits']['memory'] = memory <ide> if ex_cpu < 10: <del> cpu = int(ex_cpu) <add> cpu = str(ex_cpu) <ide> vm['spec']['template']['spec']['domain'][ <ide> 'resources']['requests']['cpu'] = cpu <ide> vm['spec']['template']['spec']['domain'][
1
Ruby
Ruby
remove dead code
90c9a09ff70388b32b9c9afca4ae998b99fd2d1f
<ide><path>activerecord/lib/active_record/statement_cache.rb <ide> def bind(values) <ide> def initialize(block = Proc.new) <ide> @mutex = Mutex.new <ide> @relation = nil <del> @sql = nil <ide> @binds = nil <ide> @block = block <ide> @query_builder = nil <ide> def query_builder(connection, arel) <ide> } <ide> end <ide> <del> def sql(klass, arel, bv) <del> @sql || @mutex.synchronize { <del> @sql ||= klass.connection.to_sql arel, bv <del> } <del> end <del> <ide> def relation(values) <ide> @relation || @mutex.synchronize { @relation ||= @block.call(values) } <ide> end
1
Text
Text
add appveyor badge to readme
c63329f5ed582263c1cb700e12ae0dc1a7f44d1a
<ide><path>README.md <ide> # <img alt="NumPy" src="branding/icons/numpylogo.svg" height="60"> <ide> <del>[![Travis](https://api.travis-ci.org/numpy/numpy.svg?branch=master)](https://travis-ci.org/numpy/numpy) <add>[![Travis](https://img.shields.io/travis/numpy/numpy/master.svg?label=Travis%20CI)](https://travis-ci.org/numpy/numpy) <add>[![AppVeyor](https://img.shields.io/appveyor/ci/charris/numpy/master.svg?label=AppVeyor)](https://ci.appveyor.com/project/charris/numpy) <ide> <ide> NumPy is the fundamental package needed for scientific computing with Python. <ide>
1
Ruby
Ruby
remove circular dependency
13882d0067877ea512bc5b3ebf19950887833758
<ide><path>activestorage/app/models/active_storage/variant.rb <del>require "active_storage/blob" <del> <ide> # Image blobs can have variants that are the result of a set of transformations applied to the original. <ide> # These variants are used to create thumbnails, fixed-size avatars, or any other derivative image from the <ide> # original.
1
Javascript
Javascript
improve error message when action bubbles
dbcd947a81aca13005300637ef27701c00435de9
<ide><path>packages/ember-routing/lib/system/router.js <ide> function triggerEvent(handlerInfos, ignoreFailure, args) { <ide> } <ide> <ide> if (!eventWasHandled && !ignoreFailure) { <del> throw new Ember.Error("Nothing handled the event '" + name + "'."); <add> throw new Ember.Error("Nothing handled the action '" + name + "'. If you did handle the action, this error can be caused by returning true from an action handler, causing the action to bubble."); <ide> } <ide> } <ide>
1
Ruby
Ruby
use cache to avoid rereading the same files
10c79620c15dd2dc0b02b1376f6a79515f9d01af
<ide><path>Library/Homebrew/tab.rb <ide> # `Tab.create`. <ide> class Tab < OpenStruct <ide> FILENAME = "INSTALL_RECEIPT.json" <add> CACHE = {} <add> <add> def self.clear_cache <add> CACHE.clear <add> end <ide> <ide> def self.create(formula, compiler, stdlib, build) <ide> attributes = { <ide> def self.create(formula, compiler, stdlib, build) <ide> end <ide> <ide> def self.from_file(path) <del> from_file_content(File.read(path), path) <add> CACHE.fetch(path) { |p| CACHE[p] = from_file_content(File.read(p), p) } <ide> end <ide> <ide> def self.from_file_content(content, path) <ide> def to_json <ide> end <ide> <ide> def write <add> CACHE[tabfile] = self <ide> tabfile.atomic_write(to_json) <ide> end <ide> <ide><path>Library/Homebrew/test/test_formula_installer.rb <ide> def temporary_install(formula) <ide> assert_predicate formula, :installed? <ide> <ide> begin <add> Tab.clear_cache <ide> refute_predicate Tab.for_keg(keg), :poured_from_bottle <ide> <ide> yield formula <ide> ensure <add> Tab.clear_cache <ide> keg.unlink <ide> keg.uninstall <ide> formula.clear_cache
2
Javascript
Javascript
remove old fly task related to `eval-script.js`
1703ad302ca0dd4ae97d04fe593385c83c550fa5
<ide><path>flyfile.js <ide> const isWindows = /^win/.test(process.platform) <ide> <ide> export async function compile(fly) { <ide> await fly.parallel(['bin', 'server', 'lib', 'client']) <del> await fly.start('unrestrict') <ide> } <ide> <ide> export async function bin(fly, opts) { <ide> export async function client(fly, opts) { <ide> notify('Compiled client files') <ide> } <ide> <del>export async function unrestrict(fly) { <del> await fly.source('dist/lib/eval-script.js').babel({ <del> babelrc: false, <del> plugins: ['babel-plugin-transform-remove-strict-mode'] <del> }).target('dist/lib') <del> notify('Completed removing strict mode for eval script') <del>} <del> <ide> export async function copy(fly) { <ide> await fly.source('pages/**/*.js').target('dist/pages') <ide> }
1
Mixed
Javascript
allow wildcards in node_debug variable
fafd9fbd015ad091e1d43620e13eb2280b0cda08
<ide><path>doc/api/util.md <ide> FOO 3245: hello from foo [123] <ide> where `3245` is the process id. If it is not run with that <ide> environment variable set, then it will not print anything. <ide> <add>The `section` supports wildcard also, for example: <add>```js <add>const util = require('util'); <add>const debuglog = util.debuglog('foo-bar'); <add> <add>debuglog('hi there, it\'s foo-bar [%d]', 2333); <add>``` <add> <add>if it is run with `NODE_DEBUG=foo*` in the environment, then it will output something like: <add>```txt <add>FOO-BAR 3257: hi there, it's foo-bar [2333] <add>``` <add> <ide> Multiple comma-separated `section` names may be specified in the `NODE_DEBUG` <ide> environment variable. For example: `NODE_DEBUG=fs,net,tls`. <ide> <ide><path>lib/util.js <ide> function format(f) { <ide> return str; <ide> } <ide> <del>var debugs = {}; <del>var debugEnviron; <add>const debugs = {}; <add>let debugEnvRegex = /^$/; <add>if (process.env.NODE_DEBUG) { <add> let debugEnv = process.env.NODE_DEBUG; <add> debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') <add> .replace(/\*/g, '.*') <add> .replace(/,/g, '$|^') <add> .toUpperCase(); <add> debugEnvRegex = new RegExp(`^${debugEnv}$`, 'i'); <add>} <ide> <ide> function debuglog(set) { <del> if (debugEnviron === undefined) { <del> debugEnviron = new Set( <del> (process.env.NODE_DEBUG || '').split(',').map((s) => s.toUpperCase())); <del> } <ide> set = set.toUpperCase(); <ide> if (!debugs[set]) { <del> if (debugEnviron.has(set)) { <add> if (debugEnvRegex.test(set)) { <ide> var pid = process.pid; <ide> debugs[set] = function() { <ide> var msg = exports.format.apply(exports, arguments); <ide><path>test/sequential/test-util-debug.js <ide> function parent() { <ide> test('f$oo', true, 'f$oo'); <ide> test('f$oo', false, 'f.oo'); <ide> test('no-bar-at-all', false, 'bar'); <add> <add> test('test-abc', true, 'test-abc'); <add> test('test-a', false, 'test-abc'); <add> test('test-*', true, 'test-abc'); <add> test('test-*c', true, 'test-abc'); <add> test('test-*abc', true, 'test-abc'); <add> test('abc-test', true, 'abc-test'); <add> test('a*-test', true, 'abc-test'); <add> test('*-test', true, 'abc-test'); <ide> } <ide> <ide> function test(environ, shouldWrite, section) {
3
Javascript
Javascript
add unit tests for externalmodule
7421d4728409b2cb89562b8942df3c57761751c6
<ide><path>lib/ExternalModule.js <ide> const WebpackMissingModule = require("./dependencies/WebpackMissingModule"); <ide> class ExternalModule extends Module { <ide> constructor(request, type) { <ide> super(); <del> this.chunkCondition = function(chunk) { <del> return chunk.hasEntryModule(); <del> }; <ide> this.request = request; <ide> this.type = type; <ide> this.built = false; <ide> this.external = true; <ide> } <ide> <add> chunkCondition(chunk) { <add> return chunk.hasEntryModule(); <add> } <add> <ide> identifier() { <ide> return "external " + JSON.stringify(this.request); <ide> } <ide> class ExternalModule extends Module { <ide> callback(); <ide> } <ide> <del> getSourceForGlobalVariableExternal(request, type) { <del> if(!Array.isArray(request)) { <del> return `(function() { module.exports = ${type}[${JSON.stringify(request)}]; }());`; <add> getSourceForGlobalVariableExternal(variableName, type) { <add> if(!Array.isArray(variableName)) { <add> // make it an array as the look up works the same basically <add> variableName = [variableName]; <ide> } <ide> <ide> // needed for e.g. window["some"]["thing"] <del> const objectLookup = request.map(r => `[${JSON.stringify(r)}]`).join(""); <add> const objectLookup = variableName.map(r => `[${JSON.stringify(r)}]`).join(""); <ide> return `(function() { module.exports = ${type}${objectLookup}; }());`; <ide> } <ide> <del> getSourceForCommonJsExternal(request) { <del> if(!Array.isArray(request)) { <del> return `module.exports = require(${JSON.stringify(request)});`; <add> getSourceForCommonJsExternal(moduleAndSpecifiers) { <add> if(!Array.isArray(moduleAndSpecifiers)) { <add> return `module.exports = require(${JSON.stringify(moduleAndSpecifiers)});`; <ide> } <ide> <del> const moduleName = request[0]; <del> const objectLookup = request.slice(1).map(r => `[${JSON.stringify(r)}]`).join(""); <add> const moduleName = moduleAndSpecifiers[0]; <add> const objectLookup = moduleAndSpecifiers.slice(1).map(r => `[${JSON.stringify(r)}]`).join(""); <ide> return `module.exports = require(${moduleName})${objectLookup};`; <ide> } <ide> <ide><path>test/ExternalModule.test.js <add>/* globals describe, it, beforeEach, afterEach */ <add>"use strict"; <add>require("should"); <add>const sinon = require("sinon"); <add>const ExternalModule = require("../lib/ExternalModule"); <add>const path = require("path"); <add>const SourceMapSource = require("webpack-sources").SourceMapSource; <add>const OriginalSource = require("webpack-sources").OriginalSource; <add>const RawSource = require("webpack-sources").RawSource; <add> <add>describe("ExternalModule", function() { <add> let externalModule; <add> let request; <add> let type; <add> beforeEach(function() { <add> request = "some/request"; <add> type = "some-type"; <add> externalModule = new ExternalModule( <add> request, <add> type <add> ); <add> }); <add> describe("#identifier", function() { <add> it("returns an identifier for this module", function() { <add> const expected = `external "${request}"`; <add> externalModule.identifier().should.eql(expected); <add> }); <add> }); <add> <add> describe("#readableIdentifier", function() { <add> it("returns an identifier for this module", function() { <add> const expected = `external "${request}"`; <add> externalModule.identifier().should.eql(expected); <add> }); <add> }); <add> <add> describe("#needRebuild", function() { <add> it("always returns false", function() { <add> externalModule.needRebuild().should.eql(false); <add> }); <add> }); <add> <add> describe("#size", function() { <add> it("always returns 42", function() { <add> externalModule.size().should.eql(42); <add> }); <add> }); <add> <add> describe("#source", function() { <add> it("calls getSource with the result of getSourceString", function() { <add> // set up <add> const expectedString = "something expected stringy"; <add> const expectedSource = "something expected sourcy"; <add> externalModule.getSource = sinon.stub().returns(expectedSource); <add> externalModule.getSourceString = sinon.stub().returns(expectedString); <add> <add> // invoke <add> const result = externalModule.source(); <add> <add> // check <add> externalModule.getSource.callCount.should.eql(1); <add> externalModule.getSourceString.callCount.should.eql(1); <add> externalModule.getSource.args[0][0].should.eql(expectedString); <add> result.should.eql(expectedSource); <add> }); <add> }); <add> <add> describe("#getSource", function() { <add> describe("given it should use source maps", function() { <add> beforeEach(function() { <add> externalModule.useSourceMap = true; <add> }); <add> it("returns an instance of OriginalSource", function() { <add> // set up <add> const someSourceString = "some source string"; <add> <add> // invoke <add> const result = externalModule.getSource(someSourceString); <add> <add> // check <add> result.should.be.instanceOf(OriginalSource); <add> }); <add> }); <add> describe("given it does not use source maps", function() { <add> beforeEach(function() { <add> externalModule.useSourceMap = false; <add> }); <add> it("returns an instance of RawSource", function() { <add> // set up <add> const someSourceString = "some source string"; <add> <add> // invoke <add> const result = externalModule.getSource(someSourceString); <add> <add> // check <add> result.should.be.instanceOf(RawSource); <add> }); <add> }); <add> }); <add> <add> describe("#getSourceForGlobalVariableExternal", function() { <add> describe("given an array as variable name in the global namespace", function() { <add> it("use the array as lookup in the global object", function() { <add> // set up <add> const type = "window"; <add> const varName = ["foo", "bar"]; <add> const expected = "(function() { module.exports = window[\"foo\"][\"bar\"]; }());"; <add> <add> // invoke <add> const result = externalModule.getSourceForGlobalVariableExternal(varName, type); <add> <add> // check <add> result.should.eql(expected); <add> }); <add> }); <add> describe("given an single variable name", function() { <add> it("look it up in the global namespace", function() { <add> // set up <add> const type = "window"; <add> const varName = "foo"; <add> const expected = "(function() { module.exports = window[\"foo\"]; }());"; <add> <add> // invoke <add> const result = externalModule.getSourceForGlobalVariableExternal(varName, type); <add> <add> // check <add> result.should.eql(expected); <add> }); <add> }); <add> }); <add> <add> describe("#getSourceForCommonJsExternal", function() { <add> describe("given an array as names in the global namespace", function() { <add> it("use the first to require a module and the rest as lookup on the required module", function() { <add> // set up <add> const varName = ["module", "look", "up"]; <add> const expected = "module.exports = require(module)[\"look\"][\"up\"];"; <add> <add> // invoke <add> const result = externalModule.getSourceForCommonJsExternal(varName, type); <add> <add> // check <add> result.should.eql(expected); <add> }); <add> }); <add> describe("given an single variable name", function() { <add> it("require a module with that name", function() { <add> // set up <add> const type = "window"; <add> const varName = "foo"; <add> const expected = "module.exports = require(\"foo\");"; <add> <add> // invoke <add> const result = externalModule.getSourceForCommonJsExternal(varName, type); <add> <add> // check <add> result.should.eql(expected); <add> }); <add> }); <add> }); <add> <add> describe("#checkExternalVariable", function() { <add> it("creates a check that fails if a variable does not exist", function() { <add> // set up <add> const variableToCheck = "foo"; <add> const request = "bar"; <add> const expected = "if(typeof foo === 'undefined') {var e = new Error(\"Cannot find module \\\"bar\\\"\"); e.code = 'MODULE_NOT_FOUND';; throw e;}"; <add> <add> // invoke <add> const result = externalModule.checkExternalVariable(variableToCheck, request); <add> <add> // check <add> result.should.eql(expected); <add> }); <add> }); <add>});
2
Text
Text
fix links in google-font-display error
e0631d0ef115db42caf16b0e5c7b16052f85df15
<ide><path>errors/google-font-display.md <ide> If you want to specifically display a font using a `block` or `fallback` strateg <ide> <ide> ### Useful Links <ide> <del>- [Font-display](https://font-display.glitch.me/) <add>- [Google Fonts API Docs](https://developers.google.com/fonts/docs/css2#use_font-display) <add>- [CSS `font-display` property](https://www.w3.org/TR/css-fonts-4/#font-display-desc)
1
Java
Java
fix checkstyle errors
b33d2f463406b71676c7aba6a03892bab9086e40
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilder.java <ide> * you may not use this file except in compliance with the License. <ide> * You may obtain a copy of the License at <ide> * <del> * http://www.apache.org/licenses/LICENSE-2.0 <add> * https://www.apache.org/licenses/LICENSE-2.0 <ide> * <ide> * Unless required by applicable law or agreed to in writing, software <ide> * distributed under the License is distributed on an "AS IS" BASIS, <ide><path>spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java <ide> static RSocketRequester.Builder builder() { <ide> return new DefaultRSocketRequesterBuilder(); <ide> } <ide> <add> // For now we treat metadata as a simple string that is the route. <add> // This will change after the resolution of: <add> // https://github.com/rsocket/rsocket-java/issues/568 <add> <add> /** <add> * Entry point to prepare a new request to the given route. <add> * <add> * <p>For requestChannel interactions, i.e. Flux-to-Flux the metadata is <add> * attached to the first request payload. <add> * <add> * @param route the routing destination <add> * @return a spec for further defining and executing the reuqest <add> */ <add> RequestSpec route(String route); <add> <ide> /** <ide> * A mutable builder for creating a client {@link RSocketRequester}. <ide> */ <ide> RSocketRequester.Builder rsocketFactory( <ide> <ide> /** <ide> * Configure the {@code ClientTransport} for the RSocket connection <del> * and connect to the RSocket server <add> * and connect to the RSocket server. <ide> * @param transport the chosen client transport <ide> * @return a mono containing the connected {@code RSocketRequester} <ide> */ <ide> Mono<RSocketRequester> connect(ClientTransport transport, MimeType dataMimeType); <ide> <ide> /** <ide> * Connect to the RSocket server over TCP transport using the <del> * provided connection parameters <add> * provided connection parameters. <ide> * @param host the RSocket server host <ide> * @param port the RSocket server port <ide> * @param dataMimeType the data MimeType <ide> RSocketRequester.Builder rsocketFactory( <ide> <ide> /** <ide> * Connect to the RSocket server over WebSocket transport using the <del> * provided connection parameters <add> * provided connection parameters. <ide> * @param uri the RSocket server endpoint URI <ide> * @param dataMimeType the data MimeType <ide> * @return a mono containing the connected {@code RSocketRequester} <ide> RSocketRequester.Builder rsocketFactory( <ide> <ide> } <ide> <del> // For now we treat metadata as a simple string that is the route. <del> // This will change after the resolution of: <del> // https://github.com/rsocket/rsocket-java/issues/568 <del> <del> /** <del> * Entry point to prepare a new request to the given route. <del> * <del> * <p>For requestChannel interactions, i.e. Flux-to-Flux the metadata is <del> * attached to the first request payload. <del> * <del> * @param route the routing destination <del> * @return a spec for further defining and executing the reuqest <del> */ <del> RequestSpec route(String route); <del> <ide> <ide> /** <ide> * Contract to provide input data for an RSocket request.
2
Javascript
Javascript
improve docs for angular.object.copy
d517bcad5b4db5a1a60159df537e69b70702a381
<ide><path>src/Angular.js <ide> function isLeafNode (node) { <ide> * <ide> * @param {*} source The source to be used to make a copy. <ide> * Can be any type including primitives, `null` and `undefined`. <del> * @param {(Object|Array)=} destination Optional destination into which the source is copied. <add> * @param {(Object|Array)=} destination Optional destination into which the source is copied. If <add> * provided, must be of the same type as `source`. <ide> * @returns {*} The copy or updated `destination` if `destination` was specified. <ide> * <ide> * @example
1
Python
Python
fix init_fn in train_utils.
87bc52c5e5f31ae8eda05ff17b9e7fb2a0905f4b
<ide><path>research/deeplab/utils/train_utils.py <ide> def get_model_init_fn(train_logdir, <ide> ignore_missing_vars=ignore_missing_vars) <ide> global_step = tf.train.get_or_create_global_step() <ide> <del> def restore_fn(unused_scaffold, sess): <add> def restore_fn(sess): <ide> sess.run(init_op, init_feed_dict) <ide> sess.run([global_step]) <ide>
1
Ruby
Ruby
install cask’s default tap if untapped
0dd320318706bed665038350f11a74a0fb8e7f34
<ide><path>Library/Homebrew/cask/lib/hbc/cli.rb <ide> def self.process(arguments) <ide> command_string, *rest = *arguments <ide> rest = process_options(rest) <ide> command = Hbc.help ? "help" : lookup_command(command_string) <add> Hbc.default_tap.install unless Hbc.default_tap.installed? <ide> Hbc.init if should_init?(command) <ide> run_command(command, *rest) <ide> rescue Hbc::CaskError, Hbc::CaskSha256MismatchError => e <ide><path>Library/Homebrew/cask/lib/hbc/locations.rb <ide> def screen_saverdir <ide> attr_writer :default_tap <ide> <ide> def default_tap <del> @default_tap ||= Tap.fetch("caskroom/homebrew-cask") <add> @default_tap ||= Tap.fetch("caskroom", "homebrew-cask") <ide> end <ide> <ide> def path(query) <ide><path>Library/Homebrew/official_taps.rb <ide> ].freeze <ide> <ide> OFFICIAL_CMD_TAPS = { <del> "caskroom/cask" => ["cask"], <ide> "homebrew/bundle" => ["bundle"], <ide> "homebrew/services" => ["services"], <ide> }.freeze <ide><path>Library/Homebrew/tap.rb <ide> def formula_dir <ide> @formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?) <ide> end <ide> <del> # path to the directory of all casks for caskroom/cask {Tap}. <add> # path to the directory of all {Cask} files for this {Tap}. <ide> def cask_dir <ide> @cask_dir ||= path/"Casks" <ide> end
4
Text
Text
fix bert readme. always use keras_bert path
83076c16069b961ab82b7df9ca6a731551b0cbf5
<ide><path>official/nlp/bert/README.md <ide> and unpack it to some directory `$GLUE_DIR`. <ide> <ide> ```shell <ide> export GLUE_DIR=~/glue <del>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/tf_20/uncased_L-24_H-1024_A-16 <add>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> <ide> export TASK_NAME=MNLI <ide> export OUTPUT_DIR=gs://some_bucket/datasets <ide> The necessary files can be found here: <ide> ```shell <ide> export SQUAD_DIR=~/squad <ide> export SQUAD_VERSION=v1.1 <del>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/tf_20/uncased_L-24_H-1024_A-16 <add>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> export OUTPUT_DIR=gs://some_bucket/datasets <ide> <ide> python create_finetuning_data.py \ <ide> python create_finetuning_data.py \ <ide> * Cloud Storage <ide> <ide> The unzipped pre-trained model files can also be found in the Google Cloud <del>Storage folder `gs://cloud-tpu-checkpoints/bert/tf_20`. For example: <add>Storage folder `gs://cloud-tpu-checkpoints/bert/keras_bert`. For example: <ide> <ide> ```shell <ide> export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> For GPU memory of 16GB or smaller, you may try to use `BERT-Base` <ide> (uncased_L-12_H-768_A-12). <ide> <ide> ```shell <del>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/tf_20/uncased_L-24_H-1024_A-16 <add>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> export MODEL_DIR=gs://some_bucket/my_output_dir <ide> export GLUE_DIR=gs://some_bucket/datasets <ide> export TASK=MRPC <ide> To use TPU, you only need to switch distribution strategy type to `tpu` with TPU <ide> information and use remote storage for model checkpoints. <ide> <ide> ```shell <del>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/tf_20/uncased_L-24_H-1024_A-16 <add>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> export TPU_IP_ADDRESS='???' <ide> export MODEL_DIR=gs://some_bucket/my_output_dir <ide> export GLUE_DIR=gs://some_bucket/datasets <ide> For GPU memory of 16GB or smaller, you may try to use `BERT-Base` <ide> (uncased_L-12_H-768_A-12). <ide> <ide> ```shell <del>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/tf_20/uncased_L-24_H-1024_A-16 <add>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> export SQUAD_DIR=gs://some_bucket/datasets <ide> export MODEL_DIR=gs://some_bucket/my_output_dir <ide> export SQUAD_VERSION=v1.1 <ide> To use TPU, you need switch distribution strategy type to `tpu` with TPU <ide> information. <ide> <ide> ```shell <del>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/tf_20/uncased_L-24_H-1024_A-16 <add>export BERT_BASE_DIR=gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16 <ide> export TPU_IP_ADDRESS='???' <ide> export MODEL_DIR=gs://some_bucket/my_output_dir <ide> export SQUAD_DIR=gs://some_bucket/datasets
1
Javascript
Javascript
fix webcrypto digest() invalid algorithm
288304c888d00f07b4e3c969ca82990a8a0331e6
<ide><path>lib/internal/crypto/hash.js <ide> const { <ide> prepareSecretKey, <ide> } = require('internal/crypto/keys'); <ide> <add>const { <add> lazyDOMException, <add>} = require('internal/util'); <add> <ide> const { <ide> Buffer, <ide> } = require('buffer'); <ide> async function asyncDigest(algorithm, data) { <ide> if (algorithm.length !== undefined) <ide> validateUint32(algorithm.length, 'algorithm.length'); <ide> <del> return jobPromise(new HashJob( <del> kCryptoJobAsync, <del> normalizeHashName(algorithm.name), <del> data, <del> algorithm.length)); <add> switch (algorithm.name) { <add> case 'SHA-1': <add> // Fall through <add> case 'SHA-256': <add> // Fall through <add> case 'SHA-384': <add> // Fall through <add> case 'SHA-512': <add> return jobPromise(new HashJob( <add> kCryptoJobAsync, <add> normalizeHashName(algorithm.name), <add> data, <add> algorithm.length)); <add> } <add> <add> throw lazyDOMException('Unrecognized name.', 'NotSupportedError'); <ide> } <ide> <ide> module.exports = { <ide><path>test/parallel/test-webcrypto-digest.js <ide> async function testDigest(size, name) { <ide> <ide> await Promise.all(variations); <ide> })().then(common.mustCall()); <add> <add>(async () => { <add> await assert.rejects(subtle.digest('RSA-OAEP', Buffer.alloc(1)), { <add> name: 'NotSupportedError', <add> }); <add>})().then(common.mustCall());
2
Java
Java
reset connection before delegating to handler
99c7917124b8f5c997046bc169ec2a97ff5e62fb
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java <ide> public void afterConnectionClosed() { <ide> logger.debug("Connection closed session id=" + this.sessionId); <ide> } <ide> if (!this.closing) { <del> handleFailure(new ConnectionLostException("Connection closed")); <ide> resetConnection(); <add> handleFailure(new ConnectionLostException("Connection closed")); <ide> } <ide> } <ide> <ide> public void run() { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug(error); <ide> } <del> handleFailure(new IllegalStateException(error)); <ide> resetConnection(); <add> handleFailure(new IllegalStateException(error)); <ide> } <ide> } <ide>
1
Go
Go
enable dm deferred_* with version check
0dc1a80565d522fc2cc7c65c3ad2d8ed83aeaf0f
<ide><path>daemon/graphdriver/devmapper/deviceset.go <ide> func (devices *DeviceSet) initDevmapper(doInit bool) (retErr error) { <ide> // give ourselves to libdm as a log handler <ide> devicemapper.LogInit(devices) <ide> <del> version, err := devicemapper.GetDriverVersion() <del> if err != nil { <del> // Can't even get driver version, assume not supported <del> return graphdriver.ErrNotSupported <del> } <del> <del> if err := determineDriverCapabilities(version); err != nil { <del> return graphdriver.ErrNotSupported <del> } <del> <ide> if err := devices.enableDeferredRemovalDeletion(); err != nil { <ide> return err <ide> } <ide> func NewDeviceSet(root string, doInit bool, options []string, uidMaps, gidMaps [ <ide> minFreeSpacePercent: defaultMinFreeSpacePercent, <ide> } <ide> <add> version, err := devicemapper.GetDriverVersion() <add> if err != nil { <add> // Can't even get driver version, assume not supported <add> return nil, graphdriver.ErrNotSupported <add> } <add> <add> if err := determineDriverCapabilities(version); err != nil { <add> return nil, graphdriver.ErrNotSupported <add> } <add> <add> if driverDeferredRemovalSupport && devicemapper.LibraryDeferredRemovalSupport { <add> // enable deferred stuff by default <add> enableDeferredDeletion = true <add> enableDeferredRemoval = true <add> } <add> <ide> foundBlkDiscard := false <ide> var lvmSetupConfig directLVMConfig <ide> for _, option := range options {
1
Go
Go
add build command
27319da0d260b42acdbc3fd2a639ad3986d1ba64
<ide><path>builder.go <add>package docker <add> <add>import ( <add> "bufio" <add> "fmt" <add> "io" <add> "strings" <add>) <add> <add>type Builder struct { <add> runtime *Runtime <add>} <add> <add>func NewBuilder(runtime *Runtime) *Builder { <add> return &Builder{ <add> runtime: runtime, <add> } <add>} <add> <add>func (builder *Builder) run(image *Image, cmd string) (*Container, error) { <add> // FIXME: pass a NopWriter instead of nil <add> config, err := ParseRun([]string{"-d", image.Id, "/bin/sh", "-c", cmd}, nil, builder.runtime.capabilities) <add> if config.Image == "" { <add> return nil, fmt.Errorf("Image not specified") <add> } <add> if len(config.Cmd) == 0 { <add> return nil, fmt.Errorf("Command not specified") <add> } <add> if config.Tty { <add> return nil, fmt.Errorf("The tty mode is not supported within the builder") <add> } <add> <add> // Create new container <add> container, err := builder.runtime.Create(config) <add> if err != nil { <add> return nil, err <add> } <add> if err := container.Start(); err != nil { <add> return nil, err <add> } <add> return container, nil <add>} <add> <add>func (builder *Builder) runCommit(image *Image, cmd string) (*Image, error) { <add> c, err := builder.run(image, cmd) <add> if err != nil { <add> return nil, err <add> } <add> if result := c.Wait(); result != 0 { <add> return nil, fmt.Errorf("!!! '%s' return non-zero exit code '%d'. Aborting.", cmd, result) <add> } <add> img, err := builder.runtime.Commit(c.Id, "", "", "", "") <add> if err != nil { <add> return nil, err <add> } <add> return img, nil <add>} <add> <add>func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) error { <add> var image, base *Image <add> <add> file := bufio.NewReader(dockerfile) <add> for { <add> line, err := file.ReadString('\n') <add> if err != nil { <add> if err == io.EOF { <add> break <add> } <add> return err <add> } <add> line = strings.TrimSpace(line) <add> // Skip comments and empty line <add> if len(line) == 0 || line[0] == '#' { <add> continue <add> } <add> tmp := strings.SplitN(line, " ", 2) <add> if len(tmp) != 2 { <add> return fmt.Errorf("Invalid Dockerfile format") <add> } <add> switch tmp[0] { <add> case "from": <add> fmt.Fprintf(stdout, "FROM %s\n", tmp[1]) <add> image, err = builder.runtime.repositories.LookupImage(tmp[1]) <add> if err != nil { <add> return err <add> } <add> break <add> case "run": <add> fmt.Fprintf(stdout, "RUN %s\n", tmp[1]) <add> if image == nil { <add> return fmt.Errorf("Please provide a source image with `from` prior to run") <add> } <add> base, err = builder.runCommit(image, tmp[1]) <add> if err != nil { <add> return err <add> } <add> fmt.Fprintf(stdout, "===> %s\n", base.Id) <add> break <add> case "copy": <add> return fmt.Errorf("The copy operator has not yet been implemented") <add> default: <add> fmt.Fprintf(stdout, "Skipping unknown op %s\n", tmp[0]) <add> } <add> } <add> if base != nil { <add> fmt.Fprintf(stdout, "Build finished. image id: %s\n", base.Id) <add> } else { <add> fmt.Fprintf(stdout, "An error occured during the build\n") <add> } <add> return nil <add>} <ide><path>commands.go <ide> import ( <ide> "net/http" <ide> "net/url" <ide> "path/filepath" <add> "os" <ide> "runtime" <ide> "strconv" <ide> "strings" <ide> func (srv *Server) Help() string { <ide> help := "Usage: docker COMMAND [arg...]\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n" <ide> for _, cmd := range [][]string{ <ide> {"attach", "Attach to a running container"}, <add> {"build", "Build a container from Dockerfile"}, <ide> {"commit", "Create a new image from a container's changes"}, <ide> {"diff", "Inspect changes on a container's filesystem"}, <ide> {"export", "Stream the contents of a container as a tar archive"}, <ide> func (srv *Server) Help() string { <ide> return help <ide> } <ide> <add>func (srv *Server) CmdBuild(stdin io.ReadCloser, stdout rcli.DockerConn, args ...string) error { <add> stdout.Flush() <add> cmd := rcli.Subcmd(stdout, "build", "[Dockerfile|-]", "Build a container from Dockerfile") <add> if err := cmd.Parse(args); err != nil { <add> return nil <add> } <add> dockerfile := cmd.Arg(0) <add> if dockerfile == "" { <add> dockerfile = "Dockerfile" <add> } <add> <add> var file io.Reader <add> <add> if dockerfile != "-" { <add> f, err := os.Open(dockerfile) <add> if err != nil { <add> return err <add> } <add> defer f.Close() <add> file = f <add> } else { <add> file = stdin <add> } <add> return NewBuilder(srv.runtime).Build(file, stdout) <add>} <add> <ide> // 'docker login': login / register a user to registry service. <ide> func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout rcli.DockerConn, args ...string) error { <ide> // Read a line on raw terminal with support for simple backspace
2
Python
Python
add test for serializing extension attrs (see )
bf415fd7782c430135033ce40705d7d392743730
<ide><path>spacy/tests/serialize/test_serialize_extension_attrs.py <add># coding: utf-8 <add>from __future__ import unicode_literals <add> <add>import pytest <add> <add>from ...tokens.doc import Doc <add>from ...vocab import Vocab <add> <add> <add>@pytest.fixture <add>def doc_w_attrs(en_tokenizer): <add> Doc.set_extension('_test_attr', default=False) <add> Doc.set_extension('_test_prop', getter=lambda doc: len(doc.text)) <add> Doc.set_extension('_test_method', method=lambda doc, arg: "{}{}".format(len(doc.text), arg)) <add> doc = en_tokenizer("This is a test.") <add> doc._._test_attr = 'test' <add> return doc <add> <add> <add> <add>def test_serialize_ext_attrs_from_bytes(doc_w_attrs): <add> doc_b = doc_w_attrs.to_bytes() <add> doc = Doc(Vocab()).from_bytes(doc_b) <add> assert doc._.has('_test_attr') <add> assert doc._._test_attr == 'test' <add> assert doc._._test_prop == len(doc.text) <add> assert doc._._test_method('test') == '{}{}'.format(len(doc.text), 'test')
1
PHP
PHP
add missed 'static' in return type list
e2faaccc78b904bb0f0ec3258ee328be87458b28
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function findMany($ids, $columns = ['*']) <ide> * <ide> * @param mixed $id <ide> * @param array $columns <del> * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection <add> * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static <ide> * <ide> * @throws \Illuminate\Database\Eloquent\ModelNotFoundException <ide> */ <ide> public function findOrFail($id, $columns = ['*']) <ide> * <ide> * @param mixed $id <ide> * @param array $columns <del> * @return \Illuminate\Database\Eloquent\Model <add> * @return \Illuminate\Database\Eloquent\Model|static <ide> */ <ide> public function findOrNew($id, $columns = ['*']) <ide> { <ide> public function findOrNew($id, $columns = ['*']) <ide> * <ide> * @param array $attributes <ide> * @param array $values <del> * @return \Illuminate\Database\Eloquent\Model <add> * @return \Illuminate\Database\Eloquent\Model|static <ide> */ <ide> public function firstOrNew(array $attributes, array $values = []) <ide> { <ide> public function firstOrNew(array $attributes, array $values = []) <ide> * <ide> * @param array $attributes <ide> * @param array $values <del> * @return \Illuminate\Database\Eloquent\Model <add> * @return \Illuminate\Database\Eloquent\Model|static <ide> */ <ide> public function firstOrCreate(array $attributes, array $values = []) <ide> { <ide> public function firstOrCreate(array $attributes, array $values = []) <ide> * <ide> * @param array $attributes <ide> * @param array $values <del> * @return \Illuminate\Database\Eloquent\Model <add> * @return \Illuminate\Database\Eloquent\Model|static <ide> */ <ide> public function updateOrCreate(array $attributes, array $values = []) <ide> { <ide> public function get($columns = ['*']) <ide> * Get the hydrated models without eager loading. <ide> * <ide> * @param array $columns <del> * @return \Illuminate\Database\Eloquent\Model[] <add> * @return \Illuminate\Database\Eloquent\Model[]|static[] <ide> */ <ide> public function getModels($columns = ['*']) <ide> { <ide> public function without($relations) <ide> * Create a new instance of the model being queried. <ide> * <ide> * @param array $attributes <del> * @return \Illuminate\Database\Eloquent\Model <add> * @return \Illuminate\Database\Eloquent\Model|static <ide> */ <ide> public function newModelInstance($attributes = []) <ide> { <ide> public function setEagerLoads(array $eagerLoad) <ide> /** <ide> * Get the model instance being queried. <ide> * <del> * @return \Illuminate\Database\Eloquent\Model <add> * @return \Illuminate\Database\Eloquent\Model|static <ide> */ <ide> public function getModel() <ide> {
1
Javascript
Javascript
move helper functions outside of `describe` block
fc620b9e80d67ca99f962431461b8fc4d085d9df
<ide><path>spec/tooltip-manager-spec.js <ide> describe('TooltipManager', () => { <ide> const ctrlX = _.humanizeKeystroke('ctrl-x') <ide> const ctrlY = _.humanizeKeystroke('ctrl-y') <ide> <del> beforeEach(function () { <del> manager = new TooltipManager({keymapManager: atom.keymaps, viewRegistry: atom.views}) <del> element = createElement('foo') <del> }) <del> <del> var createElement = function (className) { <del> const el = document.createElement('div') <del> el.classList.add(className) <del> jasmine.attachToDOM(el) <del> return el <del> } <del> <del> const mouseEnter = function (element) { <del> element.dispatchEvent(new CustomEvent('mouseenter', {bubbles: false})) <del> element.dispatchEvent(new CustomEvent('mouseover', {bubbles: true})) <del> } <del> <del> const mouseLeave = function (element) { <del> element.dispatchEvent(new CustomEvent('mouseleave', {bubbles: false})) <del> element.dispatchEvent(new CustomEvent('mouseout', {bubbles: true})) <del> } <del> <ide> const hover = function (element, fn) { <ide> mouseEnter(element) <ide> advanceClock(manager.hoverDefaults.delay.show) <ide> describe('TooltipManager', () => { <ide> advanceClock(manager.hoverDefaults.delay.hide) <ide> } <ide> <add> beforeEach(function () { <add> manager = new TooltipManager({keymapManager: atom.keymaps, viewRegistry: atom.views}) <add> element = createElement('foo') <add> }) <add> <ide> describe('::add(target, options)', () => { <ide> describe("when the trigger is 'hover' (the default)", () => { <ide> it('creates a tooltip when hovering over the target element', () => { <ide> describe('TooltipManager', () => { <ide> }) <ide> }) <ide> }) <add> <add>function createElement (className) { <add> const el = document.createElement('div') <add> el.classList.add(className) <add> jasmine.attachToDOM(el) <add> return el <add>} <add> <add>function mouseEnter (element) { <add> element.dispatchEvent(new CustomEvent('mouseenter', {bubbles: false})) <add> element.dispatchEvent(new CustomEvent('mouseover', {bubbles: true})) <add>} <add> <add>function mouseLeave (element) { <add> element.dispatchEvent(new CustomEvent('mouseleave', {bubbles: false})) <add> element.dispatchEvent(new CustomEvent('mouseout', {bubbles: true})) <add>}
1
PHP
PHP
add test for query string encoding
45e3414d49707b690de27cd2e6dd8651a205aa69
<ide><path>lib/Cake/Test/Case/Network/Http/HttpSocketTest.php <ide> public function testGet() { <ide> ->method('request') <ide> ->with(array('method' => 'GET', 'uri' => 'https://secure.example.com/test.php?one=two')); <ide> <add> $this->RequestSocket->expects($this->at(6)) <add> ->method('request') <add> ->with(array('method' => 'GET', 'uri' => 'https://example.com/oauth/access?clientid=123&redirect_uri=http%3A%2F%2Fexample.com&code=456')); <add> <ide> $this->RequestSocket->get('http://www.google.com/'); <ide> $this->RequestSocket->get('http://www.google.com/', array('foo' => 'bar')); <ide> $this->RequestSocket->get('http://www.google.com/', 'foo=bar'); <ide> $this->RequestSocket->get('http://www.google.com/?foo=bar', array('foobar' => '42', 'foo' => '23')); <ide> $this->RequestSocket->get('http://www.google.com/', null, array('version' => '1.0')); <ide> $this->RequestSocket->get('https://secure.example.com/test.php', array('one' => 'two')); <add> $this->RequestSocket->get('https://example.com/oauth/access', array( <add> 'clientid' => '123', <add> 'redirect_uri' => 'http://example.com', <add> 'code' => 456 <add> )); <ide> } <ide> <ide> /**
1
Javascript
Javascript
prevent selection of non-text content in editor
c48ba79f3cbe8e014a086d4ab7d4544b232879f1
<ide><path>src/text-editor-component.js <ide> class CursorsAndInputComponent { <ide> zIndex: 1, <ide> width: scrollWidth + 'px', <ide> height: scrollHeight + 'px', <del> pointerEvents: 'none' <add> pointerEvents: 'none', <add> userSelect: 'none' <ide> } <ide> }, children) <ide> } <ide> class HighlightsComponent { <ide> this.element.style.contain = 'strict' <ide> this.element.style.position = 'absolute' <ide> this.element.style.overflow = 'hidden' <add> this.element.style.userSelect = 'none' <ide> this.highlightComponentsByKey = new Map() <ide> this.update(props) <ide> }
1
Javascript
Javascript
fix challenges of undefined error
b81cea4b08042924747d5e9bd885b2b255b3ef16
<ide><path>common/app/entities/index.js <ide> export function projectsSelector(state) { <ide> key.includes('projects') && !key.includes('coding-interview') <ide> ) <ide> .map(key => blocks[key]) <del> .map(({ name, challenges, superBlock }) => { <add> .map(({ title, challenges, superBlock }) => { <ide> const projectChallengeDashNames = challenges <ide> // remove any project intros <ide> .filter(chal => !chal.includes('get-set-for')); <ide> const projectChallenges = projectChallengeDashNames <ide> .map(dashedName => selectiveChallengeTitleSelector(state, dashedName)); <ide> return { <del> projectBlockName: name, <add> projectBlockName: title, <ide> superBlock, <ide> challenges: projectChallenges, <ide> challengeNameIdMap: pick( <ide><path>common/app/redux/fetch-challenges-epic.js <ide> export function fetchChallengesForBlockEpic( <ide> .flatMapLatest(({ type, payload }) => { <ide> const fetchAnotherBlock = type === types.fetchNewBlock.start; <ide> const state = getState(); <del> let { block: blockName } = challengeSelector(state); <add> let { <add> block: blockName = 'basic-html-and-html5' <add> } = challengeSelector(state); <ide> const lang = langSelector(state); <ide> <ide> if (fetchAnotherBlock) { <ide><path>server/services/mapUi.js <ide> export default function mapUiService(app) { <ide> }, {}); <ide> const blockMap = Object.keys(fullBlockMap) <ide> .map(block => fullBlockMap[block]) <del> .reduce((map, { dashedName, title, time, challenges }) => { <del> map[dashedName] = { dashedName, title, time, challenges }; <del> return map; <del> }, {}); <add> .reduce( <add> (map, { dashedName, title, time, challenges, superBlock }) => { <add> map[dashedName] = { <add> dashedName, <add> title, <add> time, <add> challenges, <add> superBlock <add> }; <add> return map; <add> }, <add> {} <add> ); <ide> const challengeMap = Object.keys(fullChallengeMap) <ide> .map(challenge => fullChallengeMap[challenge]) <ide> .reduce((map, challenge) => {
3
Javascript
Javascript
remove trailing whitespace
f8f97f8b61fb3f4e831e8aae12509bd173f86b59
<ide><path>src/ng/cacheFactory.js <ide> function $CacheFactoryProvider() { <ide> * `$templateCache` service directly. <ide> * <ide> * Adding via the `script` tag: <del> * <add> * <ide> * ```html <ide> * <script type="text/ng-template" id="templateId.html"> <ide> * <p>This is the content of the template</p> <ide> * </script> <ide> * ``` <del> * <add> * <ide> * **Note:** the `script` tag containing the template does not need to be included in the `head` of <ide> * the document, but it must be below the `ng-app` definition. <ide> *
1
Text
Text
release notes for 1.2.8
ece7854972a15564065c37fc2208671c8445f408
<ide><path>CHANGELOG.md <add><a name="1.2.8"></a> <add># 1.2.8 interdimensional-cartography (2014-01-10) <add> <add> <add>## Bug Fixes <add> <add>- **$http:** <add> - return responseText on IE8 for requests with responseType set <add> ([a9cccbe1](https://github.com/angular/angular.js/commit/a9cccbe14f1bd9048f5dab4443f58c804d4259a1), <add> [#4464](https://github.com/angular/angular.js/issues/4464), [#4738](https://github.com/angular/angular.js/issues/4738), [#5636](https://github.com/angular/angular.js/issues/5636)) <add> - Allow status code 0 from any protocol <add> ([28fc80bb](https://github.com/angular/angular.js/commit/28fc80bba0107075ab371fd0a7634a38891626b2), <add> [#1356](https://github.com/angular/angular.js/issues/1356), [#5547](https://github.com/angular/angular.js/issues/5547)) <add> - cancelled JSONP requests will not print error in the console <add> ([95e1b2d6](https://github.com/angular/angular.js/commit/95e1b2d6121b4e26cf87dcf6746a7b8cb4c25e7f), <add> [#5615](https://github.com/angular/angular.js/issues/5615), [#5616](https://github.com/angular/angular.js/issues/5616)) <add>- **$location:** return '/' for root path in hashbang mode <add> ([63cd873f](https://github.com/angular/angular.js/commit/63cd873fef3207deef30c7a7ed66f4b8f647dc12), <add> [#5650](https://github.com/angular/angular.js/issues/5650), [#5712](https://github.com/angular/angular.js/issues/5712)) <add>- **$parse:** fix CSP nested property evaluation, and issue that prevented its tests from failing <add> ([3b1a4fe0](https://github.com/angular/angular.js/commit/3b1a4fe0c83c7898ecd7261ab4213998ee7be0ec), <add> [#5591](https://github.com/angular/angular.js/issues/5591), [#5592](https://github.com/angular/angular.js/issues/5592)) <add>- **closure:** add Closure externs for angular.$q.Promise.finally <add> ([caeb7402](https://github.com/angular/angular.js/commit/caeb7402651702cd13df2f1594e9827439a8b760), <add> [#4757](https://github.com/angular/angular.js/issues/4757)) <add>- **ngMock window.inject:** Remove Error 'stack' property changes <add> ([7e916455](https://github.com/angular/angular.js/commit/7e916455b36dc9ca4d4afc1e44cade90006d00e3)) <add> <add> <add>## Features <add> <add>- **select:** allow multiline ng-options <add> ([43a2f3d0](https://github.com/angular/angular.js/commit/43a2f3d0bf435e3626cd679caff4281cfb3415bd), <add> [#5602](https://github.com/angular/angular.js/issues/5602)) <add> <ide> <a name="1.2.7"></a> <ide> # 1.2.7 emoji-clairvoyance (2014-01-03) <ide>
1
PHP
PHP
allow translations of 0
b52a30868e84cdc9643976c0c7191e19b8ac2b05
<ide><path>src/Model/Behavior/TranslateBehavior.php <ide> protected function _rowMapper($results, $locale) { <ide> $name = $field . '_translation'; <ide> $translation = $row->get($name); <ide> <del> if (!$translation) { <add> if ($translation === null || $translation === false) { <add> $row->unsetProperty($name); <ide> continue; <ide> } <ide>
1
Ruby
Ruby
simplify cleanup eligibility check
505d06c1761dfb89961b4f6b8093c5d62248e5fb
<ide><path>Library/Homebrew/cmd/cleanup.rb <ide> def can_cleanup? <ide> true <ide> elsif opt_prefix.directory? <ide> # SHA records were added to INSTALL_RECEIPTS the same day as opt symlinks <del> !Formula.installed. <del> select{ |ff| ff.deps.map{ |d| d.to_s }.include? name }. <del> map{ |ff| ff.rack.subdirs rescue [] }. <del> flatten. <del> map{ |keg_path| Tab.for_keg(keg_path).HEAD }. <del> include? nil <add> Formula.installed. <add> select { |f| f.deps.any? { |d| d.name == name } }. <add> all? { |f| f.rack.subdirs.all? { |keg| Tab.for_keg(keg).HEAD } } <ide> end <ide> end <ide> end
1
Python
Python
add scons command to numpy distutils
f9dbe2870e4d7ed425bbeb59a831b0626bdcf29e
<ide><path>numpy/distutils/command/scons.py <add>import os <add>import os.path <add>from os.path import join as pjoin, dirname as pdirname <add> <add>from distutils.errors import DistutilsPlatformError <add>from distutils.errors import DistutilsExecError, DistutilsSetupError <add> <add>from numpy.distutils.command.build_ext import build_ext as old_build_ext <add>from numpy.distutils.ccompiler import CCompiler <add>from numpy.distutils.fcompiler import FCompiler <add>from numpy.distutils.exec_command import find_executable <add>from numpy.distutils import log <add>from numpy.distutils.misc_util import get_numpy_include_dirs <add> <add>def get_scons_build_dir(): <add> """Return the top path where everything produced by scons will be put. <add> <add> The path is relative to the top setup.py""" <add> return os.path.join('build', 'scons') <add> <add>def get_scons_configres_dir(): <add> """Return the top path where everything produced by scons will be put. <add> <add> The path is relative to the top setup.py""" <add> return os.path.join('build', 'scons-configres') <add> <add>def get_scons_configres_filename(): <add> """Return the top path where everything produced by scons will be put. <add> <add> The path is relative to the top setup.py""" <add> return '__configres.py' <add> <add>def get_scons_local_path(): <add> """This returns the full path where scons.py for scons-local is located.""" <add> import numpy.distutils <add> return pjoin(pdirname(numpy.distutils.__file__), 'scons-local') <add> <add>def get_python_exec_invoc(): <add> """This returns the python executable from which this file is invocated.""" <add> # Do we need to take into account the PYTHONPATH, in a cross platform way, <add> # that is the string returned can be executed directly on supported <add> # platforms, and the sys.path of the executed python should be the same <add> # than the caller ? This may not be necessary, since os.system is said to <add> # take into accound os.environ. This actually also works for my way of <add> # using "local python", using the alias facility of bash. <add> import sys <add> return sys.executable <add> <add>def dirl_to_str(dirlist): <add> """Given a list of directories, returns a string where the paths are <add> concatenated by the path separator. <add> <add> example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'.""" <add> return os.pathsep.join(dirlist) <add> <add>def dist2sconscc(compiler): <add> """This converts the name passed to distutils to scons name convention (C <add> compiler). compiler should be a CCompiler instance. <add> <add> Example: <add> --compiler=intel -> intelc""" <add> compiler_type = compiler.compiler_type <add> if compiler_type == 'msvc': <add> return 'msvc' <add> elif compiler_type == 'intel': <add> return 'intelc' <add> elif compiler_type == 'mingw32': <add> return 'mingw' <add> else: <add> return compiler.compiler[0] <add> <add>def dist2sconsfc(compiler): <add> """This converts the name passed to distutils to scons name convention <add> (Fortran compiler). The argument should be a FCompiler instance. <add> <add> Example: <add> --fcompiler=intel -> ifort on linux, ifl on windows""" <add> if compiler.compiler_type == 'intel': <add> #raise NotImplementedError('FIXME: intel fortran compiler name ?') <add> return 'ifort' <add> elif compiler.compiler_type == 'gnu': <add> return 'g77' <add> elif compiler.compiler_type == 'gnu95': <add> return 'gfortran' <add> else: <add> # XXX: Just give up for now, and use generic fortran compiler <add> return 'fortran' <add> <add>def dist2sconscxx(compiler): <add> """This converts the name passed to distutils to scons name convention <add> (C++ compiler). The argument should be a Compiler instance.""" <add> if compiler.compiler_type == 'gnu': <add> return 'g++' <add> else: <add> return 'c++' <add> return compiler.compiler_cxx[0] <add> <add>def get_compiler_executable(compiler): <add> """For any give CCompiler instance, this gives us the name of C compiler <add> (the actual executable). <add> <add> NOTE: does NOT work with FCompiler instances.""" <add> # Geez, why does distutils has no common way to get the compiler name... <add> if compiler.compiler_type == 'msvc': <add> # this is harcoded in distutils... A bit cleaner way would be to <add> # initialize the compiler instance and then get compiler.cc, but this <add> # may be costly: we really just want a string. <add> # XXX: we need to initialize the compiler anyway, so do not use <add> # hardcoded string <add> #compiler.initialize() <add> #print compiler.cc <add> return 'cl.exe' <add> else: <add> return compiler.compiler[0] <add> <add>def get_f77_compiler_executable(compiler): <add> """For any give FCompiler instance, this gives us the name of F77 compiler <add> (the actual executable).""" <add> return compiler.compiler_f77[0] <add> <add>def get_cxxcompiler_executable(compiler): <add> """For any give CCompiler instance, this gives us the name of CXX compiler <add> (the actual executable). <add> <add> NOTE: does NOT work with FCompiler instances.""" <add> # Geez, why does distutils has no common way to get the compiler name... <add> if compiler.compiler_type == 'msvc': <add> # this is harcoded in distutils... A bit cleaner way would be to <add> # initialize the compiler instance and then get compiler.cc, but this <add> # may be costly: we really just want a string. <add> # XXX: we need to initialize the compiler anyway, so do not use <add> # hardcoded string <add> #compiler.initialize() <add> #print compiler.cc <add> return 'cl.exe' <add> else: <add> return compiler.compiler_cxx[0] <add> <add>def get_tool_path(compiler): <add> """Given a distutils.ccompiler.CCompiler class, returns the path of the <add> toolset related to C compilation.""" <add> fullpath_exec = find_executable(get_compiler_executable(compiler)) <add> if fullpath_exec: <add> fullpath = pdirname(fullpath_exec) <add> else: <add> raise DistutilsSetupError("Could not find compiler executable info for scons") <add> return fullpath <add> <add>def get_f77_tool_path(compiler): <add> """Given a distutils.ccompiler.FCompiler class, returns the path of the <add> toolset related to F77 compilation.""" <add> fullpath_exec = find_executable(get_f77_compiler_executable(compiler)) <add> if fullpath_exec: <add> fullpath = pdirname(fullpath_exec) <add> else: <add> raise DistutilsSetupError("Could not find F77 compiler executable "\ <add> "info for scons") <add> return fullpath <add> <add>def get_cxx_tool_path(compiler): <add> """Given a distutils.ccompiler.CCompiler class, returns the path of the <add> toolset related to C compilation.""" <add> fullpath_exec = find_executable(get_cxxcompiler_executable(compiler)) <add> if fullpath_exec: <add> fullpath = pdirname(fullpath_exec) <add> else: <add> raise DistutilsSetupError("Could not find compiler executable info for scons") <add> return fullpath <add> <add>def protect_path(path): <add> """Convert path (given as a string) to something the shell will have no <add> problem to understand (space, etc... problems).""" <add> # XXX: to this correctly, this is totally bogus for now (does not check for <add> # already quoted path, for example). <add> return '"' + path + '"' <add> <add>class scons(old_build_ext): <add> # XXX: add an option to the scons command for configuration (auto/force/cache). <add> description = "Scons builder" <add> user_options = old_build_ext.user_options + \ <add> [('jobs=', None, <add> "specify number of worker threads when executing scons"), <add> ('scons-tool-path=', None, 'specify additional path '\ <add> '(absolute) to look for scons tools'), <add> ('silent=', None, 'specify whether scons output should be silent '\ <add> '(1), super silent (2) or not (0, default)')] <add> <add> def initialize_options(self): <add> old_build_ext.initialize_options(self) <add> self.jobs = None <add> self.silent = 0 <add> self.scons_tool_path = '' <add> # If true, we bypass distutils to find the c compiler altogether. This <add> # is to be used in desperate cases (like incompatible visual studio <add> # version). <add> self._bypass_distutils_cc = False <add> self.scons_compiler = None <add> self.scons_compiler_path = None <add> self.scons_fcompiler = None <add> <add> def finalize_options(self): <add> old_build_ext.finalize_options(self) <add> if self.distribution.has_scons_scripts(): <add> self.sconscripts = self.distribution.get_scons_scripts() <add> self.pre_hooks = self.distribution.get_scons_pre_hooks() <add> self.post_hooks = self.distribution.get_scons_post_hooks() <add> self.pkg_names = self.distribution.get_scons_parent_names() <add> else: <add> self.sconscripts = [] <add> self.pre_hooks = [] <add> self.post_hooks = [] <add> self.pkg_names = [] <add> <add> # Try to get the same compiler than the ones used by distutils: this is <add> # non trivial because distutils and scons have totally different <add> # conventions on this one (distutils uses PATH from user's environment, <add> # whereas scons uses standard locations). The way we do it is once we <add> # got the c compiler used, we use numpy.distutils function to get the <add> # full path, and add the path to the env['PATH'] variable in env <add> # instance (this is done in numpy.distutils.scons module). <add> <add> # XXX: The logic to bypass distutils is ... not so logic. <add> compiler_type = self.compiler <add> if compiler_type == 'msvc': <add> self._bypass_distutils_cc = True <add> from numpy.distutils.ccompiler import new_compiler <add> try: <add> distutils_compiler = new_compiler(compiler=compiler_type, <add> verbose=self.verbose, <add> dry_run=self.dry_run, <add> force=self.force) <add> distutils_compiler.customize(self.distribution) <add> # This initialization seems necessary, sometimes, for find_executable to work... <add> if hasattr(distutils_compiler, 'initialize'): <add> distutils_compiler.initialize() <add> self.scons_compiler = dist2sconscc(distutils_compiler) <add> self.scons_compiler_path = protect_path(get_tool_path(distutils_compiler)) <add> except DistutilsPlatformError, e: <add> if not self._bypass_distutils_cc: <add> raise e <add> else: <add> self.scons_compiler = compiler_type <add> <add> # We do the same for the fortran compiler ... <add> fcompiler_type = self.fcompiler <add> from numpy.distutils.fcompiler import new_fcompiler <add> self.fcompiler = new_fcompiler(compiler = fcompiler_type, <add> verbose = self.verbose, <add> dry_run = self.dry_run, <add> force = self.force) <add> if self.fcompiler is not None: <add> self.fcompiler.customize(self.distribution) <add> <add> # And the C++ compiler <add> cxxcompiler = new_compiler(compiler = compiler_type, <add> verbose = self.verbose, <add> dry_run = self.dry_run, <add> force = self.force) <add> if cxxcompiler is not None: <add> cxxcompiler.customize(self.distribution, need_cxx = 1) <add> cxxcompiler.customize_cmd(self) <add> self.cxxcompiler = cxxcompiler.cxx_compiler() <add> #print self.cxxcompiler.compiler_cxx[0] <add> <add> def run(self): <add> # XXX: when a scons script is missing, scons only prints warnings, and <add> # does not return a failure (status is 0). We have to detect this from <add> # distutils (this cannot work for recursive scons builds...) <add> <add> # XXX: passing everything at command line may cause some trouble where <add> # there is a size limitation ? What is the standard solution in thise <add> # case ? <add> <add> scons_exec = get_python_exec_invoc() <add> scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) <add> <add> for sconscript, pre_hook, post_hook, pkg_name in zip(self.sconscripts, <add> self.pre_hooks, self.post_hooks, <add> self.pkg_names): <add> if pre_hook: <add> pre_hook() <add> <add> cmd = [scons_exec, "-f", sconscript, '-I.'] <add> if self.jobs: <add> cmd.append(" --jobs=%d" % int(self.jobs)) <add> cmd.append('scons_tool_path="%s"' % self.scons_tool_path) <add> cmd.append('src_dir="%s"' % pdirname(sconscript)) <add> cmd.append('pkg_name="%s"' % pkg_name) <add> #cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, <add> # pdirname(sconscript)))) <add> cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib))) <add> <add> if not self._bypass_distutils_cc: <add> cmd.append('cc_opt=%s' % self.scons_compiler) <add> cmd.append('cc_opt_path=%s' % self.scons_compiler_path) <add> else: <add> cmd.append('cc_opt=%s' % self.scons_compiler) <add> <add> <add> if self.fcompiler: <add> cmd.append('f77_opt=%s' % dist2sconsfc(self.fcompiler)) <add> cmd.append('f77_opt_path=%s' % protect_path(get_f77_tool_path(self.fcompiler))) <add> <add> if self.cxxcompiler: <add> cmd.append('cxx_opt=%s' % dist2sconscxx(self.cxxcompiler)) <add> cmd.append('cxx_opt_path=%s' % protect_path(get_cxx_tool_path(self.cxxcompiler))) <add> <add> cmd.append('include_bootstrap=%s' % dirl_to_str(get_numpy_include_dirs())) <add> if self.silent: <add> if int(self.silent) == 1: <add> cmd.append('-Q') <add> elif int(self.silent) == 2: <add> cmd.append('-s') <add> cmdstr = ' '.join(cmd) <add> log.info("Executing scons command: %s ", cmdstr) <add> st = os.system(cmdstr) <add> if st: <add> print "status is %d" % st <add> raise DistutilsExecError("Error while executing scons command "\ <add> "%s (see above)" % cmdstr) <add> if post_hook: <add> post_hook() <ide><path>numpy/distutils/core.py <ide> from numpy.distutils.numpy_distribution import NumpyDistribution <ide> from numpy.distutils.command import config, config_compiler, \ <ide> build, build_py, build_ext, build_clib, build_src, build_scripts, \ <del> sdist, install_data, install_headers, install, bdist_rpm <add> sdist, install_data, install_headers, install, bdist_rpm, scons <ide> from numpy.distutils.misc_util import get_data_files, is_sequence, is_string <ide> <ide> numpy_cmdclass = {'build': build.build, <ide> 'build_py': build_py.build_py, <ide> 'build_clib': build_clib.build_clib, <ide> 'sdist': sdist.sdist, <add> 'scons': scons.scons, <ide> 'install_data': install_data.install_data, <ide> 'install_headers': install_headers.install_headers, <ide> 'install': install.install,
2
PHP
PHP
apply fixes from styleci
3f2162a8ca7ca29e48a6457568e4459a33f08974
<ide><path>tests/Validation/ValidationValidatorTest.php <ide> public function testIndexValuesAreReplaced() <ide> 'foo', <ide> 1, <ide> ], <del> ] <del> ] <add> ], <add> ], <ide> ], ['input.*.attributes.*' => 'string'], ['input.*.attributes.*.string' => 'Attribute (:first-index, :first-position) (:second-index, :second-position) must be a string.']); <ide> $this->assertFalse($v->passes()); <ide> $this->assertSame('Attribute (0, 1) (1, 2) must be a string.', $v->messages()->first('input.*.attributes.*'));
1
Javascript
Javascript
remove case that only exists for createbatch
d75323f65d0f263dd4b0c15cebe987cccf822783
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.js <ide> function performSyncWorkOnRoot(root) { <ide> // Check if there's expired work on this root. Otherwise, render at Sync. <ide> const lastExpiredTime = root.lastExpiredTime; <ide> const expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync; <del> if (root.finishedExpirationTime === expirationTime) { <del> // There's already a pending commit at this expiration time. <del> // TODO: This is poorly factored. This case only exists for the <del> // batch.commit() API. <del> commitRoot(root); <del> } else { <del> invariant( <del> (executionContext & (RenderContext | CommitContext)) === NoContext, <del> 'Should not already be working.', <del> ); <del> <del> flushPassiveEffects(); <del> <del> // If the root or expiration time have changed, throw out the existing stack <del> // and prepare a fresh one. Otherwise we'll continue where we left off. <del> if ( <del> root !== workInProgressRoot || <del> expirationTime !== renderExpirationTime <del> ) { <del> prepareFreshStack(root, expirationTime); <del> startWorkOnPendingInteractions(root, expirationTime); <del> } <add> invariant( <add> (executionContext & (RenderContext | CommitContext)) === NoContext, <add> 'Should not already be working.', <add> ); <ide> <del> // If we have a work-in-progress fiber, it means there's still work to do <del> // in this root. <del> if (workInProgress !== null) { <del> const prevExecutionContext = executionContext; <del> executionContext |= RenderContext; <del> const prevDispatcher = pushDispatcher(root); <del> const prevInteractions = pushInteractions(root); <del> startWorkLoopTimer(workInProgress); <add> flushPassiveEffects(); <ide> <del> do { <del> try { <del> workLoopSync(); <del> break; <del> } catch (thrownValue) { <del> handleError(root, thrownValue); <del> } <del> } while (true); <del> resetContextDependencies(); <del> executionContext = prevExecutionContext; <del> popDispatcher(prevDispatcher); <del> if (enableSchedulerTracing) { <del> popInteractions(((prevInteractions: any): Set<Interaction>)); <del> } <add> // If the root or expiration time have changed, throw out the existing stack <add> // and prepare a fresh one. Otherwise we'll continue where we left off. <add> if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) { <add> prepareFreshStack(root, expirationTime); <add> startWorkOnPendingInteractions(root, expirationTime); <add> } <ide> <del> if (workInProgressRootExitStatus === RootFatalErrored) { <del> const fatalError = workInProgressRootFatalError; <del> stopInterruptedWorkLoopTimer(); <del> prepareFreshStack(root, expirationTime); <del> markRootSuspendedAtTime(root, expirationTime); <del> ensureRootIsScheduled(root); <del> throw fatalError; <del> } <add> // If we have a work-in-progress fiber, it means there's still work to do <add> // in this root. <add> if (workInProgress !== null) { <add> const prevExecutionContext = executionContext; <add> executionContext |= RenderContext; <add> const prevDispatcher = pushDispatcher(root); <add> const prevInteractions = pushInteractions(root); <add> startWorkLoopTimer(workInProgress); <ide> <del> if (workInProgress !== null) { <del> // This is a sync render, so we should have finished the whole tree. <del> invariant( <del> false, <del> 'Cannot commit an incomplete root. This error is likely caused by a ' + <del> 'bug in React. Please file an issue.', <del> ); <del> } else { <del> // We now have a consistent tree. Because this is a sync render, we <del> // will commit it even if something suspended. <del> stopFinishedWorkLoopTimer(); <del> root.finishedWork = (root.current.alternate: any); <del> root.finishedExpirationTime = expirationTime; <del> finishSyncRender(root, workInProgressRootExitStatus, expirationTime); <add> do { <add> try { <add> workLoopSync(); <add> break; <add> } catch (thrownValue) { <add> handleError(root, thrownValue); <ide> } <add> } while (true); <add> resetContextDependencies(); <add> executionContext = prevExecutionContext; <add> popDispatcher(prevDispatcher); <add> if (enableSchedulerTracing) { <add> popInteractions(((prevInteractions: any): Set<Interaction>)); <add> } <ide> <del> // Before exiting, make sure there's a callback scheduled for the next <del> // pending level. <add> if (workInProgressRootExitStatus === RootFatalErrored) { <add> const fatalError = workInProgressRootFatalError; <add> stopInterruptedWorkLoopTimer(); <add> prepareFreshStack(root, expirationTime); <add> markRootSuspendedAtTime(root, expirationTime); <ide> ensureRootIsScheduled(root); <add> throw fatalError; <ide> } <add> <add> if (workInProgress !== null) { <add> // This is a sync render, so we should have finished the whole tree. <add> invariant( <add> false, <add> 'Cannot commit an incomplete root. This error is likely caused by a ' + <add> 'bug in React. Please file an issue.', <add> ); <add> } else { <add> // We now have a consistent tree. Because this is a sync render, we <add> // will commit it even if something suspended. <add> stopFinishedWorkLoopTimer(); <add> root.finishedWork = (root.current.alternate: any); <add> root.finishedExpirationTime = expirationTime; <add> finishSyncRender(root, workInProgressRootExitStatus, expirationTime); <add> } <add> <add> // Before exiting, make sure there's a callback scheduled for the next <add> // pending level. <add> ensureRootIsScheduled(root); <ide> } <ide> <ide> return null;
1
Javascript
Javascript
cover .assert with single argument
e3d05a61215b2958cc1951759e08e816b35f5027
<ide><path>test/parallel/test-console.js <ide> assert.strictEqual(errStrings[errStrings.length - 1], <ide> <ide> console.assert(true, 'this should not throw'); <ide> <add>console.assert(true); <add> <ide> assert.strictEqual(strings.length, process.stdout.writeTimes); <ide> assert.strictEqual(errStrings.length, process.stderr.writeTimes); <ide> restoreStdout();
1
Ruby
Ruby
improve reasoning in brew bottle for using gzip
780750e0b7cacc9ba552addc3d31138c539e70ec
<ide><path>Library/Contributions/examples/brew-bottle.rb <ide> filename = formula + '-' + version + '.tar.gz' <ide> ohai "Bottling #{formula} #{version}..." <ide> HOMEBREW_CELLAR.cd do <del> # Use gzip, much faster than bzip2 and hardly any file size difference <del> # when compressing binaries. <add> # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2 <add> # or an uncompressed tarball (and more bandwidth friendly). <ide> safe_system 'tar', 'czf', "#{destination}/#{filename}", "#{formula}/#{version}" <ide> end <ide> ohai "Bottled #{filename}"
1
Javascript
Javascript
make all streams error in a pipeline
648088289d619bfb149fe90316ce0127083c4c99
<ide><path>lib/internal/streams/pipeline.js <ide> function destroyer(stream, reading, writing, callback) { <ide> <ide> // request.destroy just do .end - .abort is what we want <ide> if (isRequest(stream)) return stream.abort(); <del> if (typeof stream.destroy === 'function') return stream.destroy(); <add> if (typeof stream.destroy === 'function') { <add> if (stream.req && stream._writableState === undefined) { <add> // This is a ClientRequest <add> // TODO(mcollina): backward compatible fix to avoid crashing. <add> // Possibly remove in a later semver-major change. <add> stream.req.on('error', noop); <add> } <add> return stream.destroy(err); <add> } <ide> <ide> callback(err || new ERR_STREAM_DESTROYED('pipe')); <ide> }; <ide> } <ide> <del>function call(fn) { <del> fn(); <del>} <add>function noop() {} <ide> <ide> function pipe(from, to) { <ide> return from.pipe(to); <ide> function pipeline(...streams) { <ide> const writing = i > 0; <ide> return destroyer(stream, reading, writing, function(err) { <ide> if (!error) error = err; <del> if (err) destroys.forEach(call); <add> if (err) { <add> for (const destroy of destroys) { <add> destroy(err); <add> } <add> } <ide> if (reading) return; <del> destroys.forEach(call); <add> for (const destroy of destroys) { <add> destroy(); <add> } <ide> callback(error); <ide> }); <ide> }); <ide><path>test/parallel/test-stream-pipeline-async-iterator.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const { Readable, PassThrough, pipeline } = require('stream'); <add>const assert = require('assert'); <add> <add>const _err = new Error('kaboom'); <add> <add>async function run() { <add> const source = new Readable({ <add> read() { <add> } <add> }); <add> source.push('hello'); <add> source.push('world'); <add> <add> setImmediate(() => { source.destroy(_err); }); <add> <add> const iterator = pipeline( <add> source, <add> new PassThrough(), <add> () => {}); <add> <add> iterator.setEncoding('utf8'); <add> <add> for await (const k of iterator) { <add> assert.strictEqual(k, 'helloworld'); <add> } <add>} <add> <add>run().catch(common.mustCall((err) => assert.strictEqual(err, _err))); <ide><path>test/parallel/test-stream-pipeline.js <ide> const { promisify } = require('util'); <ide> transform.on('close', common.mustCall()); <ide> write.on('close', common.mustCall()); <ide> <add> [read, transform, write].forEach((stream) => { <add> stream.on('error', common.mustCall((err) => { <add> assert.deepStrictEqual(err, new Error('kaboom')); <add> })); <add> }); <add> <ide> const dst = pipeline(read, transform, write, common.mustCall((err) => { <ide> assert.deepStrictEqual(err, new Error('kaboom')); <ide> }));
3